diff --git a/kinode/src/register-ui/build/assets/index-CqsVFnwl.js b/kinode/src/register-ui/build/assets/index-Do8ILYvr.js similarity index 99% rename from kinode/src/register-ui/build/assets/index-CqsVFnwl.js rename to kinode/src/register-ui/build/assets/index-Do8ILYvr.js index f52698012..b8aa0aad4 100644 --- a/kinode/src/register-ui/build/assets/index-CqsVFnwl.js +++ b/kinode/src/register-ui/build/assets/index-Do8ILYvr.js @@ -127,4 +127,4 @@ You are running Raphaël `+this.version};var d,x=function(f,m,B){for(var p=l(m). Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(t){(function(){var e={}.hasOwnProperty;function r(){for(var i="",a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function QM(t,e){if(t==null)return{};var r={},n=Object.keys(t),u,i;for(i=0;i=0)&&(r[u]=t[u]);return r}function fa(){return fa=Object.assign?Object.assign.bind():function(t){for(var e=1;eG6.createElement(e.tag,ca({key:r},e.attr),xm(e.child)))}function vm(t){return e=>G6.createElement(ZM,fa({attr:ca({},t.attr)},e),xm(t.child))}function ZM(t){var e=r=>{var{attr:n,size:u,title:i}=t,a=WM(t,VM),o=u||r.size||"1em",s;return r.className&&(s=r.className),t.className&&(s=(s?s+" ":"")+t.className),G6.createElement("svg",fa({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,a,{className:s,style:ca(ca({color:t.color||r.color},r.style),t.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),i&&G6.createElement("title",null,i),t.children)};return _c!==void 0?G6.createElement(_c.Consumer,null,r=>e(r)):e(gm)}function eU(t){return vm({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M80 160c0-35.3 28.7-64 64-64h32c35.3 0 64 28.7 64 64v3.6c0 21.8-11.1 42.1-29.4 53.8l-42.2 27.1c-25.2 16.2-40.4 44.1-40.4 74V320c0 17.7 14.3 32 32 32s32-14.3 32-32v-1.4c0-8.2 4.2-15.8 11-20.2l42.2-27.1c36.6-23.6 58.8-64.1 58.8-107.7V160c0-70.7-57.3-128-128-128H144C73.3 32 16 89.3 16 160c0 17.7 14.3 32 32 32s32-14.3 32-32zm80 320a40 40 0 1 0 0-80 40 40 0 1 0 0 80z"},child:[]}]})(t)}function tU(t){return vm({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"},child:[]}]})(t)}const z2=({text:t,button:e,className:r,position:n})=>{const[u,i]=n1.useState(!1);return Q.jsxs("div",{className:Lr("flex place-items-center place-content-center text-sm relative cursor-pointer shrink",r),children:[Q.jsx("div",{onClick:()=>i(!u),children:e||Q.jsx("button",{className:"icon ml-4",type:"button",children:Q.jsx(eU,{})})}),Q.jsx("div",{className:Lr("absolute rounded bg-black p-2 min-w-[200px] z-10",{"!hidden":!u,"top-8":n==="top"||!n,"bottom-8":n==="bottom","right-8":n==="left","left-8":n==="right"}),children:t}),Q.jsx("button",{type:"button",className:Lr("absolute bg-black icon right-0 top-0",{"!hidden":!u}),onClick:()=>i(!1),children:Q.jsx(tU,{})})]})},cl=()=>window.innerWidth<=600,{useIsActivating:rU,useChainId:nU}=Ut;function fr({header:t,closeConnect:e,nodeChainId:r,hideConnect:n=!1}){const{account:u,isActive:i}=ka.useWeb3React(),a=rU(),o=nU(),[s,l]=n1.useState("");n1.useEffect(()=>{l(Q6((o||1).toString()))},[o]);const c=n1.useCallback(async()=>{e(),await q4.activate().catch(()=>{});try{M2(r)}catch(_){console.error(_)}},[e,r]),y=n1.useCallback(async()=>{if(o){if("0x"+o.toString(16)===r)return alert(`You are already connected to ${Q6(o.toString())}`);try{M2(r)}catch(M){console.error(M)}}},[o,r]),v=n1.useCallback(async()=>{alert("You can change your connected account in your wallet.")},[]),w=cl();return Q.jsx(Q.Fragment,{children:Q.jsxs("div",{id:"signup-form-header",className:"flex flex-col",children:[(r===y2||r===Rr)&&Q.jsx(z2,{position:"left",className:Lr("!absolute z-10",{"top-8 right-8":!w,"top-2 right-2":w}),button:r===y2?Q.jsx("img",{alt:"sepolia",className:"network-icon",src:um}):r===Rr?Q.jsx("img",{alt:"optimism",className:"network-icon",src:im}):null,text:r===y2?'Your Kinode is currently pointed at Sepolia. To point at Optimism, boot without the "--testnet" flag.':r===Rr?'Your Kinode is currently pointed at Optimism. To point at Sepolia, boot with the "--testnet" flag.':""}),Q.jsx("div",{className:"flex flex-col gap-4 c",children:t}),!n&&Q.jsx("div",{className:"flex c w-[99vw] mb-8 absolute top-2 left-2",children:i&&u?Q.jsx(KM,{account:u,networkName:s,changeToNodeChain:y,changeConnectedAccount:v}):Q.jsxs("div",{className:"flex flex-col gap-8 my-4",children:[Q.jsxs("h5",{className:Lr("flex c",{"flex-wrap text-center max-w-3/4 gap-2":w}),children:[!a&&"You must connect to a browser wallet to continue.",a?Q.jsx(sr,{msg:"Approve connection in your wallet"}):Q.jsx("button",{onClick:c,className:"ml-2",children:" Connect Wallet "})]}),r===y2&&Q.jsxs("h5",{className:"text-center max-w-[450px] leading-6 flex c",children:["Kinode is currently on the Sepolia Testnet.",Q.jsx("a",{href:"https://sepoliafaucet.com/",target:"_blank",rel:"noreferrer",className:"button alt ml-2",children:"Get Testnet ETH"})]})]})})]})})}function hu(t){const e=t.split(".");if(e.length!==4)throw new Error("Invalid IP address");let r=0;for(let n=0;n<4;n++)r<<=8,r+=parseInt(e[n],10);return r>>>0}const uU=()=>Q.jsx(z2,{text:"A direct node publishes its own networking information on-chain: IP, port, so on. An indirect node relies on the service of routers, which are themselves direct nodes. Only register a direct node if you know what you’re doing and have a public, static IP address."});function pu({direct:t,setDirect:e}){return Q.jsxs("div",{className:"flex place-items-center",children:[Q.jsxs("div",{className:"relative flex place-items-center mr-2",children:[Q.jsx("input",{type:"checkbox",id:"direct",name:"direct",checked:t,onChange:r=>e(r.target.checked),autoFocus:!0}),t&&Q.jsx("span",{onClick:()=>e(!1),className:"checkmark",children:"✓"})]}),Q.jsx("label",{htmlFor:"direct",className:"flex place-items-center cursor-pointer",children:"Register as a direct node. If you are unsure leave unchecked."}),Q.jsx(uU,{})]})}const iU="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20width='779'%20height='514'%20viewBox='0%200%20779%20514'%20fill='none'%20version='1.1'%20id='svg2'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%20id='defs2'%20/%3e%3cpath%20d='M753.092%205.91932C756.557%205.09976%20755.962%20-0.00012207%20752.401%20-0.00012207H426.001C424.755%20-0.00012207%20423.639%200.77027%20423.197%201.93535L236.968%20492.6C235.729%20495.865%20240.123%20498.255%20242.191%20495.441L569.357%2050.1132C569.778%2049.5392%20570.391%2049.1339%20571.084%2048.97L753.092%205.91932Z'%20fill='%23FFF5D9'%20id='path1'%20/%3e%3cpath%20d='M%2012.054907,40.2288%20C%209.0444768,38.777%2010.207772,34.4583%2013.582982,34.5557%20l%20411.845088,11.881%20c%202.17167,0.0626%203.63105,2.1382%202.85869,4.0656%20l%20-62.7457,156.4787%20c%20-0.66805,1.666%20-2.71117,2.415%20-4.38655,1.607%20z'%20fill='%23fff5d9'%20id='path2'%20style='stroke-width:1.0265'%20/%3e%3c/svg%3e",bu=({prefix:t,showLogo:e})=>{const r=cl();return Q.jsxs("div",{className:"mb-4 flex flex-col c",children:[Q.jsx("h1",{children:t}),e&&Q.jsxs(Q.Fragment,{children:[Q.jsxs("h1",{className:Lr("display",{"text-5xl mt-10 mb-8 ml-4":!r,"text-3xl mt-5 mb-4 ml-2":r}),children:["Kinode",Q.jsx("span",{className:"text-xs",children:"®"})]}),Q.jsx("img",{src:iU,className:Lr({"w-32 h-32":!r,"w-16 h-16":r})})]})]})},{useAccounts:aU}=Ut;function oU({direct:t,setDirect:e,setOsName:r,nameWrapper:n,ensRegistry:u,knsEnsEntry:i,kns:a,openConnect:o,provider:s,closeConnect:l,setNetworkingKey:c,setIpAddress:y,setPort:v,setRouters:w,nodeChainId:_}){let M=aU(),N=ir();const k=Q6(_),[C,T]=n1.useState(""),[z,$]=n1.useState(""),[Y,J]=n1.useState([]),[e1,i1]=n1.useState(!1);n1.useEffect(()=>{document.title="Register"},[]),n1.useEffect(()=>i1(!e1),[s]);const o1={name:z,setName:$,nameValidities:Y,setNameValidities:J,nameWrapper:n,ensRegistry:u,triggerNameCheck:e1};let S=n1.useCallback(async X=>{if(X.preventDefault(),X.stopPropagation(),!s)return o();try{T("Please confirm the transaction in your wallet");const{networking_key:U,ws_routing:[d,x],allowed_routers:P}=await fetch("/generate-networking-info",{method:"POST"}).then(p=>p.json()),F=hu(d);c(U),y(F),v(x),w(P);const D=z.trim().replace(".eth",""),R=_===Rr?ra:_;try{await M2(R)}catch{throw window.alert(`You must connect to the ${Q6(R)} network to continue. Please connect and try again.`),new Error(`${Q6(R)} not connected`)}const q=[t?(await a.populateTransaction.setAllIp(ft(`${D}.eth`),F,x,0,0,0)).data:(await a.populateTransaction.setRouters(ft(`${D}.eth`),P.map(p=>ft(p)))).data,(await a.populateTransaction.setKey(ft(`${D}.eth`),U)).data];T("Please confirm the transaction in your wallet");const b=Pb(`${D}.eth`),f=Gi(`${D}.eth`),m=await i.setKNSRecords(b,q,{gasLimit:3e5}),B=(p,I)=>{p===f&&(a.off("NodeRegistered",B),T(""),r(`${D}.eth`),N("/set-password"))};await M2(_),T(`Registering ${D}.eth on Kinode... this may take a few minutes.`),a.on("NodeRegistered",B),await m.wait()}catch(U){console.error("Registration Error:",U),T(""),alert("There was an error linking your ENS name, please try again.")}},[z,t,M,a,N,r,s,o,c,y,v,w,_,k]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Register via ENS"}),openConnect:o,closeConnect:l,nodeChainId:_===Rr?ra:_}),!!s&&Q.jsx("form",{id:"signup-form",className:"flex flex-col",onSubmit:S,children:C?Q.jsx(sr,{msg:C}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("h3",{className:"w-full flex flex-col c mb-2",children:[Q.jsx("label",{className:"flex leading-6 mb-2",children:"Set up your Kinode with a .eth name"}),Q.jsx(VN,{...o1})]}),Q.jsx(pu,{direct:t,setDirect:e}),Q.jsx("button",{disabled:Y.length!==0,type:"submit",className:"mt-2",children:"Register .eth name"})]})})]})}function dl({name:t,setName:e,nameValidities:r,setNameValidities:n,dotOs:u,triggerNameCheck:i,isReset:a=!1}){const o="Name must be a valid URL without subdomains (A-Z, a-z, 0-9, and punycode)",s="Name must be 9 characters or more",l="Name is already claimed",c="Unsupported punycode character",y=n1.useRef(null);n1.useEffect(()=>{a||(y.current&&clearTimeout(y.current),y.current=setTimeout(async()=>{let w,_=[...r];const M=[...t].length;w=_.indexOf(s),M<9&&M!==0?w===-1&&_.push(s):w!==-1&&_.splice(w,1);let N;w=_.indexOf(c);try{N=sl(t+".os"),w!==-1&&_.splice(w,1)}catch{w===-1&&_.push(c)}if(N!==void 0&&(w=_.indexOf(o),t!==""&&!nl(N)?w===-1&&_.push(o):w!==-1&&_.splice(w,1),w=_.indexOf(l),_.length===0||w!==-1))try{await u.ownerOf(Gi(N)),w===-1&&_.push(l)}catch{w!==-1&&_.splice(w,1)}n(_)},500))},[t,i,a]);const v=w=>w.target.value.indexOf(".")===-1&&e(w.target.value);return Q.jsxs("div",{className:"flex flex-col w-full place-items-center place-content-center",children:[Q.jsxs("div",{className:"flex w-full place-items-center",children:[Q.jsx("input",{value:t,onChange:v,type:"text",required:!0,name:"dot-os-name",placeholder:"e.g. myname",className:"grow"}),Q.jsx("div",{className:"ml-2 text-lg",children:".os"})]}),r.map((w,_)=>Q.jsxs("div",{children:[Q.jsx("br",{}),Q.jsx("span",{className:"text-red-500",children:w})]},_))]})}const{useAccounts:sU}=Ut;function lU({direct:t,setDirect:e,setOsName:r,dotOs:n,kns:u,openConnect:i,provider:a,closeConnect:o,setNetworkingKey:s,setIpAddress:l,setPort:c,setRouters:y,nodeChainId:v}){let w=sU(),_=ir();const M=Q6(v),[N,k]=n1.useState(""),[C,T]=n1.useState(""),[z,$]=n1.useState([]),[Y,J]=n1.useState(!1);n1.useEffect(()=>{document.title="Register"},[]),n1.useEffect(()=>J(!Y),[a]);const e1={name:C,setName:T,nameValidities:z,setNameValidities:$,dotOs:n,triggerNameCheck:Y};let i1=n1.useCallback(async o1=>{if(o1.preventDefault(),o1.stopPropagation(),!a)return i();try{k("Please confirm the transaction in your wallet");const{networking_key:S,ws_routing:[X,U],allowed_routers:d}=await fetch("/generate-networking-info",{method:"POST"}).then(R=>R.json()),x=hu(X);s(S),l(x),c(U),y(d);const P=[t?(await u.populateTransaction.setAllIp(ft(`${C}.os`),x,U,0,0,0)).data:(await u.populateTransaction.setRouters(ft(`${C}.os`),d.map(R=>ft(R)))).data,(await u.populateTransaction.setKey(ft(`${C}.os`),S)).data];k("Please confirm the transaction in your wallet");try{await M2(v)}catch{throw window.alert(`You must connect to the ${M} network to continue. Please connect and try again.`),new Error(`${M} not set`)}const F=Pb(`${C}.os`),D=await n.register(F,w[0],P);k("Registering KNS ID..."),await D.wait(),k(""),r(`${C}.os`),_("/set-password")}catch(S){console.error("Registration Error:",S),k(""),alert("There was an error registering your dot-os-name, please try again.")}},[C,t,w,n,u,_,r,a,i,s,l,c,y,v,M]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx("h1",{className:"flex place-content-center place-items-center mb-4",children:"Register Kinode Name (KNS)"}),openConnect:i,closeConnect:o,nodeChainId:v}),!!a&&Q.jsx("form",{id:"signup-form",className:"flex flex-col w-full max-w-[450px]",onSubmit:i1,children:N?Q.jsx(sr,{msg:N}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("h3",{className:"flex flex-col w-full place-items-center my-8",children:[Q.jsxs("label",{className:"flex leading-6 place-items-center mt-2 cursor-pointer mb-2",children:["Choose a name for your kinode",Q.jsx(z2,{text:"Kinodes use a .os name in order to identify themselves to other nodes in the network."})]}),Q.jsx(dl,{...e1})]}),Q.jsx(pu,{direct:t,setDirect:e}),Q.jsx("button",{disabled:z.length!==0,type:"submit",className:"mt-2",children:"Register .os name"}),Q.jsx(v4,{to:"/reset",className:"flex self-stretch mt-2",children:Q.jsx("button",{className:"clear grow",children:"already have a dot-os-name?"})})]})})]})}var e3={};const{useAccounts:fU,useProvider:cU}=Ut;function dU({direct:t,setDirect:e,setOsName:r,dotOs:n,openConnect:u,setNetworkingKey:i,setIpAddress:a,setPort:o,setRouters:s,closeConnect:l,nodeChainId:c}){const y=fU(),v=cU(),w=ir(),[_,M]=n1.useState(!1),[N,k]=n1.useState(""),[C,T]=n1.useState(!1),[z,$]=n1.useState(""),[Y,J]=n1.useState(""),[e1,i1]=n1.useState(""),[o1,S]=n1.useState([]);n1.useEffect(()=>{document.title="Claim Invite"},[]),n1.useEffect(()=>T(!C),[v]),n1.useEffect(()=>{(async()=>{if(z!==""){const d=e3.REACT_APP_INVITE_GET+z,x=await fetch(d,{method:"GET"});x.status===200?J(""):J(await x.text())}})()},[z]);let X=async d=>{if(d.preventDefault(),d.stopPropagation(),!v)return u();const{networking_key:x,ws_routing:[P,F],allowed_routers:D}=await fetch("/generate-networking-info",{method:"POST"}).then(p=>p.json()),R=hu(P);if(i(x),a(R),o(F),s(D),o1.length!==0||Y!=="")return;if(!e1||!z)return window.alert("Please enter a name and invite code"),!1;let q;k("...Building EIP-4337 User Operation"),M(!0),console.log("BUILDING",x,R,F,D);try{q=await fetch(e3.REACT_APP_BUILD_USER_OP_POST,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e1+".os",address:y[0],networkingKey:x,wsIp:R,wsPort:F,routers:D,direct:t})})}catch(p){k(""),M(!1),alert(p),console.error("error from fetching userOp:",p);return}k("...Signing EIP-4337 User Operation");const b=await q.json(),f=new Uint8Array(Object.values(b.message)),m=await(v==null?void 0:v.getSigner()),B=await(m==null?void 0:m.signMessage(f));b.userOperation.signature=B;try{q=await fetch(e3.REACT_APP_BROADCAST_USER_OP_POST,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userOp:b.userOperation,code:z,name:e1+".os",eoa:y[0]})})}catch(p){alert(p),console.error("error from broadcasting userOp:",p);return}finally{k(""),M(!1)}r(`${e1}.os`),w("/set-password")};const U={name:e1,setName:i1,nameValidities:o1,setNameValidities:S,dotOs:n,triggerNameCheck:C};return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Claim Invite"}),openConnect:u,closeConnect:l,nodeChainId:c}),!!v&&Q.jsx("form",{id:"signup-form",className:"flex flex-col",onSubmit:X,children:_?Q.jsx(sr,{msg:N}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("div",{className:"flex c mb-2",children:[Q.jsx("h5",{children:"Set up your Kinode with a .os name"}),Q.jsx(z2,{text:"Kinodes use a .os name in order to identify themselves to other nodes in the network."})]}),Q.jsxs("div",{className:"flex flex-col mb-2",children:[Q.jsx("input",{value:z,onChange:d=>$(d.target.value),type:"text",required:!0,name:"nec-invite",placeholder:"invite code",className:"self-stretch"}),Y!==""&&Q.jsx("div",{className:"invite-validity",children:Y})]}),Q.jsx("h3",{className:"mb-2",children:Q.jsx(dl,{...U})}),Q.jsx(pu,{direct:t,setDirect:e}),Q.jsx("button",{disabled:o1.length!==0||Y!=="",type:"submit",className:"self-stretch mt-2",children:"Register .os name"}),Q.jsx(v4,{to:"/reset",className:"button clear",children:"already have a .os?"})]})})]})}const Am=(t,e)=>{let r=new Blob([e],{type:"text/plain;charset=utf-8"});const n=window.URL.createObjectURL(r),u=document.createElement("a");u.href=n,u.setAttribute("download",`${t}.keyfile`),document.body.appendChild(u),u.click()};function hU({knsName:t,direct:e,pw:r,reset:n,provider:u,setPw:i,appSizeOnLoad:a,closeConnect:o,nodeChainId:s}){const[l,c]=n1.useState(""),[y,v]=n1.useState(""),[w,_]=n1.useState(!1);n1.useEffect(()=>{document.title="Set Password"},[]),n1.useEffect(()=>{v("")},[r,l]);const M=n1.useCallback(async N=>{if(N.preventDefault(),r!==l)return v("Passwords do not match"),!1;setTimeout(async()=>{_(!0);let k=pt(z0(r)),C=await(u==null?void 0:u.getSigner()),T=await(C==null?void 0:C.getAddress()),z=await(C==null?void 0:C.getChainId()),$=Date.now(),Y=JSON.stringify({username:t,password_hash:k,timestamp:$,direct:e,reset:n,chain_id:z}),J=await(C==null?void 0:C.signMessage(z0(Y)));try{const i1=await(await fetch("/boot",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({password_hash:k,reset:n,username:t,direct:e,owner:T,timestamp:$,signature:J,chain_id:z})})).json();Am(t,i1);const o1=setInterval(async()=>{const S=await fetch("/");S.status<300&&Number(S.headers.get("content-length"))!==a&&(console.log("WE GOOD, ROUTING"),clearInterval(o1),window.location.replace("/"))},2e3)}catch{alert("There was an error setting your password, please try again."),_(!1)}},500)},[a,e,r,l,n,t]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Set Password",showLogo:!0}),openConnect:()=>{},closeConnect:o,nodeChainId:s}),w?Q.jsx(sr,{msg:"Setting up node..."}):Q.jsxs("form",{id:"signup-form",className:"flex flex-col w-full max-w-[450px] gap-4",onSubmit:M,children:[Q.jsxs("div",{className:"flex flex-col w-full place-items-center place-content-center",children:[Q.jsxs("div",{className:"flex w-full place-items-center mb-2",children:[Q.jsx("label",{className:"flex leading-6 place-items-center mt-2 cursor-pointer mb-2",style:{fontSize:20},htmlFor:"password",children:"New Password"}),Q.jsx(z2,{text:"This password will be used to log in if you restart your node or switch browsers."})]}),Q.jsx("div",{className:"flex w-full place-items-center",children:Q.jsx("input",{className:"grow",type:"password",id:"password",required:!0,minLength:6,name:"password",placeholder:"Min 6 characters",value:r,onChange:N=>i(N.target.value),autoFocus:!0})})]}),Q.jsxs("div",{className:"flex flex-col w-full place-items-center place-content-center",children:[Q.jsx("div",{className:"flex w-full place-items-center",children:Q.jsx("label",{className:"flex leading-6 place-items-center mt-2 cursor-pointer mb-4",style:{fontSize:20},htmlFor:"confirm-password",children:"Confirm Password"})}),Q.jsx("div",{className:"flex w-full place-items-center",children:Q.jsx("input",{className:"grow",type:"password",id:"confirm-password",required:!0,minLength:6,name:"confirm-password",placeholder:"Min 6 characters",value:l,onChange:N=>c(N.target.value)})}),!!y&&Q.jsx("p",{style:{color:"red"},children:y})]}),Q.jsx("button",{type:"submit",children:"Submit"})]})]})}var ct={};const pU=P0(nB),bU=P0(aA),mU=P0(sA),yU=P0(tv),gU=P0(cw),xU=P0(AB),vU=P0(PB),AU=P0(dv),wU=P0(Zx),Sc=P0($E),EU=P0(GB),CU=P0(KC),FU=P0(Zv),BU=P0(pv),DU=P0(pC),Tc=P0(PA),_U=P0(wC),kU=P0(YB),SU=P0(RB),TU=P0(WE);(function(t){var e=f0&&f0.__createBinding||(Object.create?function(S,X,U,d){d===void 0&&(d=U),Object.defineProperty(S,d,{enumerable:!0,get:function(){return X[U]}})}:function(S,X,U,d){d===void 0&&(d=U),S[d]=X[U]}),r=f0&&f0.__setModuleDefault||(Object.create?function(S,X){Object.defineProperty(S,"default",{enumerable:!0,value:X})}:function(S,X){S.default=X}),n=f0&&f0.__importStar||function(S){if(S&&S.__esModule)return S;var X={};if(S!=null)for(var U in S)U!=="default"&&Object.prototype.hasOwnProperty.call(S,U)&&e(X,S,U);return r(X,S),X};Object.defineProperty(t,"__esModule",{value:!0}),t.formatBytes32String=t.Utf8ErrorFuncs=t.toUtf8String=t.toUtf8CodePoints=t.toUtf8Bytes=t._toEscapedUtf8String=t.nameprep=t.hexDataSlice=t.hexDataLength=t.hexZeroPad=t.hexValue=t.hexStripZeros=t.hexConcat=t.isHexString=t.hexlify=t.base64=t.base58=t.TransactionDescription=t.LogDescription=t.Interface=t.SigningKey=t.HDNode=t.defaultPath=t.isBytesLike=t.isBytes=t.zeroPad=t.stripZeros=t.concat=t.arrayify=t.shallowCopy=t.resolveProperties=t.getStatic=t.defineReadOnly=t.deepCopy=t.checkProperties=t.poll=t.fetchJson=t._fetchData=t.RLP=t.Logger=t.checkResultErrors=t.FormatTypes=t.ParamType=t.FunctionFragment=t.EventFragment=t.ErrorFragment=t.ConstructorFragment=t.Fragment=t.defaultAbiCoder=t.AbiCoder=void 0,t.Indexed=t.Utf8ErrorReason=t.UnicodeNormalizationForm=t.SupportedAlgorithm=t.mnemonicToSeed=t.isValidMnemonic=t.entropyToMnemonic=t.mnemonicToEntropy=t.getAccountPath=t.verifyTypedData=t.verifyMessage=t.recoverPublicKey=t.computePublicKey=t.recoverAddress=t.computeAddress=t.getJsonWalletAddress=t.TransactionTypes=t.serializeTransaction=t.parseTransaction=t.accessListify=t.joinSignature=t.splitSignature=t.soliditySha256=t.solidityKeccak256=t.solidityPack=t.shuffled=t.randomBytes=t.sha512=t.sha256=t.ripemd160=t.keccak256=t.computeHmac=t.commify=t.parseUnits=t.formatUnits=t.parseEther=t.formatEther=t.isAddress=t.getCreate2Address=t.getContractAddress=t.getIcapAddress=t.getAddress=t._TypedDataEncoder=t.id=t.isValidName=t.namehash=t.hashMessage=t.dnsEncode=t.parseBytes32String=void 0;var u=pU;Object.defineProperty(t,"AbiCoder",{enumerable:!0,get:function(){return u.AbiCoder}}),Object.defineProperty(t,"checkResultErrors",{enumerable:!0,get:function(){return u.checkResultErrors}}),Object.defineProperty(t,"ConstructorFragment",{enumerable:!0,get:function(){return u.ConstructorFragment}}),Object.defineProperty(t,"defaultAbiCoder",{enumerable:!0,get:function(){return u.defaultAbiCoder}}),Object.defineProperty(t,"ErrorFragment",{enumerable:!0,get:function(){return u.ErrorFragment}}),Object.defineProperty(t,"EventFragment",{enumerable:!0,get:function(){return u.EventFragment}}),Object.defineProperty(t,"FormatTypes",{enumerable:!0,get:function(){return u.FormatTypes}}),Object.defineProperty(t,"Fragment",{enumerable:!0,get:function(){return u.Fragment}}),Object.defineProperty(t,"FunctionFragment",{enumerable:!0,get:function(){return u.FunctionFragment}}),Object.defineProperty(t,"Indexed",{enumerable:!0,get:function(){return u.Indexed}}),Object.defineProperty(t,"Interface",{enumerable:!0,get:function(){return u.Interface}}),Object.defineProperty(t,"LogDescription",{enumerable:!0,get:function(){return u.LogDescription}}),Object.defineProperty(t,"ParamType",{enumerable:!0,get:function(){return u.ParamType}}),Object.defineProperty(t,"TransactionDescription",{enumerable:!0,get:function(){return u.TransactionDescription}});var i=bh;Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return i.getAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return i.getCreate2Address}}),Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return i.getContractAddress}}),Object.defineProperty(t,"getIcapAddress",{enumerable:!0,get:function(){return i.getIcapAddress}}),Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return i.isAddress}});var a=n(bU);t.base64=a;var o=mU;Object.defineProperty(t,"base58",{enumerable:!0,get:function(){return o.Base58}});var s=yU;Object.defineProperty(t,"arrayify",{enumerable:!0,get:function(){return s.arrayify}}),Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return s.concat}}),Object.defineProperty(t,"hexConcat",{enumerable:!0,get:function(){return s.hexConcat}}),Object.defineProperty(t,"hexDataSlice",{enumerable:!0,get:function(){return s.hexDataSlice}}),Object.defineProperty(t,"hexDataLength",{enumerable:!0,get:function(){return s.hexDataLength}}),Object.defineProperty(t,"hexlify",{enumerable:!0,get:function(){return s.hexlify}}),Object.defineProperty(t,"hexStripZeros",{enumerable:!0,get:function(){return s.hexStripZeros}}),Object.defineProperty(t,"hexValue",{enumerable:!0,get:function(){return s.hexValue}}),Object.defineProperty(t,"hexZeroPad",{enumerable:!0,get:function(){return s.hexZeroPad}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return s.isBytes}}),Object.defineProperty(t,"isBytesLike",{enumerable:!0,get:function(){return s.isBytesLike}}),Object.defineProperty(t,"isHexString",{enumerable:!0,get:function(){return s.isHexString}}),Object.defineProperty(t,"joinSignature",{enumerable:!0,get:function(){return s.joinSignature}}),Object.defineProperty(t,"zeroPad",{enumerable:!0,get:function(){return s.zeroPad}}),Object.defineProperty(t,"splitSignature",{enumerable:!0,get:function(){return s.splitSignature}}),Object.defineProperty(t,"stripZeros",{enumerable:!0,get:function(){return s.stripZeros}});var l=gU;Object.defineProperty(t,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(t,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(t,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(t,"namehash",{enumerable:!0,get:function(){return l.namehash}});var c=xU;Object.defineProperty(t,"defaultPath",{enumerable:!0,get:function(){return c.defaultPath}}),Object.defineProperty(t,"entropyToMnemonic",{enumerable:!0,get:function(){return c.entropyToMnemonic}}),Object.defineProperty(t,"getAccountPath",{enumerable:!0,get:function(){return c.getAccountPath}}),Object.defineProperty(t,"HDNode",{enumerable:!0,get:function(){return c.HDNode}}),Object.defineProperty(t,"isValidMnemonic",{enumerable:!0,get:function(){return c.isValidMnemonic}}),Object.defineProperty(t,"mnemonicToEntropy",{enumerable:!0,get:function(){return c.mnemonicToEntropy}}),Object.defineProperty(t,"mnemonicToSeed",{enumerable:!0,get:function(){return c.mnemonicToSeed}});var y=vU;Object.defineProperty(t,"getJsonWalletAddress",{enumerable:!0,get:function(){return y.getJsonWalletAddress}});var v=AU;Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return v.keccak256}});var w=wU;Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return w.Logger}});var _=Sc;Object.defineProperty(t,"computeHmac",{enumerable:!0,get:function(){return _.computeHmac}}),Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return _.ripemd160}}),Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return _.sha256}}),Object.defineProperty(t,"sha512",{enumerable:!0,get:function(){return _.sha512}});var M=EU;Object.defineProperty(t,"solidityKeccak256",{enumerable:!0,get:function(){return M.keccak256}}),Object.defineProperty(t,"solidityPack",{enumerable:!0,get:function(){return M.pack}}),Object.defineProperty(t,"soliditySha256",{enumerable:!0,get:function(){return M.sha256}});var N=CU;Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return N.randomBytes}}),Object.defineProperty(t,"shuffled",{enumerable:!0,get:function(){return N.shuffled}});var k=FU;Object.defineProperty(t,"checkProperties",{enumerable:!0,get:function(){return k.checkProperties}}),Object.defineProperty(t,"deepCopy",{enumerable:!0,get:function(){return k.deepCopy}}),Object.defineProperty(t,"defineReadOnly",{enumerable:!0,get:function(){return k.defineReadOnly}}),Object.defineProperty(t,"getStatic",{enumerable:!0,get:function(){return k.getStatic}}),Object.defineProperty(t,"resolveProperties",{enumerable:!0,get:function(){return k.resolveProperties}}),Object.defineProperty(t,"shallowCopy",{enumerable:!0,get:function(){return k.shallowCopy}});var C=n(BU);t.RLP=C;var T=DU;Object.defineProperty(t,"computePublicKey",{enumerable:!0,get:function(){return T.computePublicKey}}),Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return T.recoverPublicKey}}),Object.defineProperty(t,"SigningKey",{enumerable:!0,get:function(){return T.SigningKey}});var z=Tc;Object.defineProperty(t,"formatBytes32String",{enumerable:!0,get:function(){return z.formatBytes32String}}),Object.defineProperty(t,"nameprep",{enumerable:!0,get:function(){return z.nameprep}}),Object.defineProperty(t,"parseBytes32String",{enumerable:!0,get:function(){return z.parseBytes32String}}),Object.defineProperty(t,"_toEscapedUtf8String",{enumerable:!0,get:function(){return z._toEscapedUtf8String}}),Object.defineProperty(t,"toUtf8Bytes",{enumerable:!0,get:function(){return z.toUtf8Bytes}}),Object.defineProperty(t,"toUtf8CodePoints",{enumerable:!0,get:function(){return z.toUtf8CodePoints}}),Object.defineProperty(t,"toUtf8String",{enumerable:!0,get:function(){return z.toUtf8String}}),Object.defineProperty(t,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return z.Utf8ErrorFuncs}});var $=_U;Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return $.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return $.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return $.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return $.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return $.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return $.TransactionTypes}});var Y=kU;Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return Y.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return Y.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return Y.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return Y.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return Y.parseUnits}});var J=SU;Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return J.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return J.verifyTypedData}});var e1=TU;Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return e1._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return e1.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return e1.poll}});var i1=Sc;Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return i1.SupportedAlgorithm}});var o1=Tc;Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return o1.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return o1.Utf8ErrorReason}})})(ct);const{useProvider:PU}=Ut;function NU({direct:t,setDirect:e,pw:r,setPw:n,kns:u,openConnect:i,appSizeOnLoad:a,closeConnect:o,routers:s,setRouters:l,knsName:c,setOsName:y,nodeChainId:v}){const w=PU(),_=ir(),[M,N]=n1.useState([]),[k,C]=n1.useState(""),[T,z]=n1.useState(!1),[$,Y]=n1.useState(!1),[J,e1]=n1.useState(!1);n1.useEffect(()=>{document.title="Login",(async()=>{try{const X=await fetch("/info",{method:"GET"}).then(U=>U.json());l(X.allowed_routers),y(X.name)}catch{}})()},[]);const i1=n1.useCallback(async X=>{X==null||X.preventDefault(),X==null||X.stopPropagation();try{if($){if(!w)return N(["Please connect your wallet and try again"]),e1(!0),i();C("Checking password...");let P=pt(z0(r));if((await fetch("/vet-keyfile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password_hash:P,keyfile:""})})).status>399)throw new Error("Incorrect password");const{networking_key:D,ws_routing:[R,q],allowed_routers:b}=await fetch("/generate-networking-info",{method:"POST"}).then(p=>p.json());C("Please confirm the transaction in your wallet");const f=hu(R),m=[t?(await u.populateTransaction.setAllIp(ct.namehash(c),f,q,0,0,0)).data:(await u.populateTransaction.setRouters(ct.namehash(c),b.map(p=>ct.namehash(p)))).data,(await u.populateTransaction.setKey(ct.namehash(c),D)).data];C("Please confirm the transaction");const B=await u.multicall(m);C("Resetting Networking Information..."),await B.wait()}C("Logging in...");let U=pt(z0(r));const d=await fetch($?"/confirm-change-network-keys":"login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($?{password_hash:U,direct:t}:{password_hash:U})});if(d.status>399)throw new Error(await d.text());if($){const P=await d.json();Am(c,P)}const x=setInterval(async()=>{const P=await fetch("/");P.status<300&&Number(P.headers.get("content-length"))!==a&&(clearInterval(x),window.location.replace("/"))},2e3)}catch(U){const d=String(U);d.includes("Object")?N(["There was an error with the transaction, or it was cancelled."]):N([d]),C("")}},[r,a,$,t,c,w,i,u]),o1=(s==null?void 0:s.length)===0,S=cl();return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Login to",showLogo:!0}),openConnect:i,closeConnect:o,hideConnect:!T,nodeChainId:v}),k?Q.jsx(sr,{msg:k}):Q.jsxs("form",{id:"signup-form",className:Lr("flex flex-col w-full max-w-[450px]",{"p-2":S}),onSubmit:i1,children:[Q.jsxs("div",{className:"self-stretch mb-2 flex flex-col",children:[Q.jsxs("div",{className:"flex text-lg mb-2 place-items-center place-content-center",children:[Q.jsx("h3",{className:"font-bold",children:c}),Q.jsxs("span",{className:"ml-2 mt-1 text-sm",children:["(",o1?"direct":"indirect"," node)"]})]}),Q.jsx("input",{type:"password",id:"password",required:!0,minLength:6,name:"password",placeholder:"Password",value:r,onChange:X=>n(X.target.value),autoFocus:!0,className:"self-stretch"})]}),M.length>0&&Q.jsx("div",{className:"flex flex-col w-full leading-6 mb-2",children:M.map((X,U)=>Q.jsx("div",{className:"text-red-500",children:X},U))}),Q.jsxs("button",{type:"submit",className:"w-full mb-2",children:[" ",$?"Reset & ":""," Login "]}),Q.jsxs("div",{className:"flex flex-col w-full self-stretch place-content-center place-items-center",children:[Q.jsx("button",{className:"clear self-stretch mb-1",onClick:()=>{z(!T),Y(!T)},children:T?"Cancel":"Reset Networking Info"}),Q.jsx("button",{className:"clear self-stretch",onClick:()=>{_("/reset-node")},children:"Reset Node & Password"}),T&&Q.jsxs("div",{className:"flex flex-col w-full gap-2 mt-4",children:[Q.jsxs("div",{className:"flex w-full place-items-center",children:[Q.jsxs("div",{className:"relative flex",children:[Q.jsx("input",{type:"checkbox",id:"reset",name:"reset",checked:$,onChange:X=>Y(X.target.checked),autoFocus:!0,className:"mr-2"}),$&&Q.jsx("span",{onClick:()=>Y(!1),className:"checkmark",children:"✓"})]}),Q.jsx("label",{htmlFor:"reset",className:"direct-node-message",children:"Reset networking keys and publish on-chain"}),Q.jsx(z2,{text:"This will update your networking keys and publish the new info on-chain"})]}),Q.jsx(pu,{direct:t,setDirect:e})]})]})]})]})}const Pc="Unsupported punycode character",Nc="Name does not belong to this wallet",t3="Name is not registered",Mc="Name must be a valid URL without subdomains (A-Z, a-z, 0-9, and punycode)",{useAccounts:MU,useProvider:UU}=Ut;function OU({direct:t,setDirect:e,setReset:r,knsName:n,setOsName:u,dotOs:i,kns:a,openConnect:o,closeConnect:s,setNetworkingKey:l,setIpAddress:c,setPort:y,setRouters:v,nodeChainId:w}){const _=MU(),M=UU(),N=ir(),k=Q6(w),[C,T]=n1.useState(n.slice(0,-3)),[z,$]=n1.useState([]),[Y,J]=n1.useState([]),[e1,i1]=n1.useState(""),[o1,S]=n1.useState(!1);n1.useEffect(()=>{document.title="Reset"},[]),n1.useEffect(()=>S(!o1),[M]);const X=n1.useRef(null);n1.useEffect(()=>{X.current&&clearTimeout(X.current),X.current=setTimeout(async()=>{if($([]),!M||C==="")return;let d,x=[...z],P;d=x.indexOf(Pc);try{P=sl(C+".os"),d!==-1&&x.splice(d,1)}catch{d===-1&&x.push(Pc)}if(P!==void 0){d=x.indexOf(Mc),C!==""&&!nl(P)?d===-1&&x.push(Mc):d!==-1&&x.splice(d,1);try{const F=await i.ownerOf(Gi(P));d=x.indexOf(Nc),F===_[0]&&d!==-1?x.splice(d,1):d===-1&&F!==_[0]&&x.push(Nc),d=x.indexOf(t3),d!==-1&&x.splice(d,1)}catch{d=x.indexOf(t3),d===-1&&x.push(t3)}z.length===0&&u(P)}$(x)},500)},[C,o1]);const U=n1.useCallback(async d=>{if(d.preventDefault(),d.stopPropagation(),!M)return o();try{i1("Please confirm the transaction in your wallet");const{networking_key:x,ws_routing:[P,F],allowed_routers:D}=await fetch("/generate-networking-info",{method:"POST"}).then(f=>f.json()),R=hu(P);l(x),c(R),y(F),v(D);const q=[t?(await a.populateTransaction.setAllIp(ct.namehash(n),R,F,0,0,0)).data:(await a.populateTransaction.setRouters(ct.namehash(n),D.map(f=>ct.namehash(f)))).data,(await a.populateTransaction.setKey(ct.namehash(n),x)).data];try{await M2(w)}catch{throw window.alert(`You must connect to the ${k} network to continue. Please connect and try again.`),new Error(`${k} not set`)}const b=await a.multicall(q);i1("Resetting Networking Information..."),await b.wait(),r(!0),i1(""),e(t),N("/set-password")}catch{i1(""),alert("An error occurred, please try again.")}},[M,n,r,e,N,o,a,t,l,c,y,v,w,k]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Reset KNS Name"}),openConnect:o,closeConnect:s,nodeChainId:w}),!!M&&Q.jsx("form",{id:"signup-form",className:"flex flex-col",onSubmit:U,children:e1?Q.jsx(sr,{msg:e1}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("h3",{className:"flex flex-col w-full place-items-center mb-2",children:[Q.jsxs("label",{className:"flex leading-6 place-items-center mt-2 cursor-pointer mb-2",children:["Choose a name for your kinode",Q.jsx(z2,{text:"Kinodes use a .os name in order to identify themselves to other nodes in the network."})]}),Q.jsx(dl,{name:C,setName:T,nameVets:z,dotOs:i,triggerNameCheck:o1,nameValidities:Y,setNameValidities:J,isReset:!0})]}),Q.jsx(pu,{direct:t,setDirect:e}),Q.jsx("button",{type:"submit",className:"mt-2",children:" Reset Node "})]})})]})}function IU({openConnect:t,knsName:e,closeConnect:r,nodeChainId:n}){const u=ir(),i=()=>u("/claim-invite"),a=()=>u("/register-eth-name"),o=()=>u("/register-name"),s=()=>u("/reset"),l=()=>u("/import-keyfile"),c=()=>u("/login"),y=!!e,v=!!window.ethereum;return n1.useEffect(()=>{document.title="Welcome | Kinode"},[]),Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Welcome to",showLogo:!0}),openConnect:t,closeConnect:r,hideConnect:!0,nodeChainId:n,nameLogo:!0}),Q.jsx("div",{className:"flex flex-col max-w-[460px] w-full gap-4 mt-8",children:y?Q.jsx("button",{onClick:c,children:" Login "}):Q.jsxs(Q.Fragment,{children:[!v&&Q.jsx("h4",{className:"self-start mx-auto",children:"You must install a Web3 wallet extension like Metamask in order to register or reset a username."}),v&&Q.jsx("h4",{className:"self-start mx-auto",children:"New here? Register a username to get started"}),Q.jsx("button",{disabled:!v,onClick:o,children:"Register Kinode Name"}),Q.jsx("h4",{className:"self-start mx-auto",children:"Other options"}),n!==Rr&&Q.jsx("button",{disabled:!v,onClick:a,className:"alt",children:"Register ENS Name"}),Q.jsx("button",{disabled:!v,onClick:i,className:"alt",children:"Claim Kinode Invite"}),Q.jsx("button",{disabled:!v,onClick:s,className:"alt",children:"Reset Kinode Name"}),Q.jsx("button",{onClick:l,className:"alt",children:"Import Keyfile"})]})})]})}const{useProvider:RU}=Ut;function LU({direct:t,setDirect:e,setReset:r,knsName:n,kns:u,openConnect:i,closeConnect:a,setNetworkingKey:o,setIpAddress:s,setPort:l,setRouters:c,nodeChainId:y}){const v=RU(),w=ir(),_=Q6(y),[M,N]=n1.useState("");n1.useEffect(()=>{document.title="Reset"},[]);const k=n1.useCallback(async C=>{if(C.preventDefault(),C.stopPropagation(),!v)return i();try{N("Please confirm the transaction in your wallet");const{networking_key:T,ws_routing:[z,$],allowed_routers:Y}=await fetch("/generate-networking-info",{method:"POST"}).then(o1=>o1.json()),J=hu(z);o(T),s(J),l($),c(Y);const e1=[t?(await u.populateTransaction.setAllIp(ct.namehash(n),J,$,0,0,0)).data:(await u.populateTransaction.setRouters(ct.namehash(n),Y.map(o1=>ct.namehash(o1)))).data,(await u.populateTransaction.setKey(ct.namehash(n),T)).data];try{await M2(y)}catch{throw window.alert(`You must connect to the ${_} network to continue. Please connect and try again.`),new Error(`${_} not set`)}const i1=await u.multicall(e1);N("Resetting Networking Information..."),await i1.wait(),r(!0),N(""),e(t),w("/set-password")}catch{N(""),alert("An error occurred, please try again.")}},[v,n,r,e,w,i,u,t,o,s,l,c,y,_]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx("h1",{className:"flex c mb-8",children:"Reset Kinode Name"}),openConnect:i,closeConnect:a,nodeChainId:y}),v?Q.jsx("form",{id:"signup-form",className:"flex flex-col",onSubmit:k,children:M?Q.jsx(sr,{msg:M}):Q.jsxs(Q.Fragment,{children:[Q.jsx(pu,{direct:t,setDirect:e}),Q.jsxs("button",{type:"submit",className:"self-stretch mt-2 text-2xl",children:["Reset ",n]}),Q.jsx(v4,{to:"/",className:"button alt mt-2",children:"Back"})]})}):Q.jsx("div",{children:"Please connect a wallet to continue."})]})}function jU({pw:t,setPw:e,openConnect:r,appSizeOnLoad:n,closeConnect:u,nodeChainId:i}){const[a,o]=n1.useState(""),[s,l]=n1.useState(""),[c,y]=n1.useState([]),[v,w]=n1.useState(""),[_,M]=n1.useState(!1),[N,k]=n1.useState(!1),[C,T]=n1.useState(!1);n1.useEffect(()=>{document.title="Import Keyfile"},[]);const z=n1.useCallback(e1=>{e1.preventDefault();const i1=e1.target.files[0];if(!i1)return;const o1=new FileReader;o1.onloadend=()=>{o(o1.result),l(i1.name)},o1.readAsText(i1)},[]),$=n1.useRef(null),Y=n1.useCallback(async e1=>{var i1;e1.preventDefault(),e1.stopPropagation(),(i1=$.current)==null||i1.click()},[]),J=n1.useCallback(async e1=>{e1.preventDefault(),e1.stopPropagation(),T(!0);try{if(c.length===0&&a!==""){let i1=pt(z0(t));if((await fetch("/vet-keyfile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keyfile:a,password:i1})})).status>399)throw new Error("Incorrect password");if((await fetch("/import-keyfile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keyfile:a,password:i1})})).status>399)throw new Error("Incorrect password");const X=setInterval(async()=>{const U=await fetch("/");U.status<300&&Number(U.headers.get("content-length"))!==n&&(clearInterval(X),window.location.replace("/"))},2e3)}}catch{window.alert("An error occurred, please try again."),T(!1)}},[a,t,c,n]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx("h1",{children:"Import Keyfile"}),openConnect:r,closeConnect:u,hideConnect:!0,nodeChainId:i}),C?Q.jsx(sr,{msg:"Setting up node..."}):Q.jsxs("form",{id:"signup-form",className:"flex flex-col max-w-[450px]",onSubmit:J,children:[Q.jsxs("div",{className:"flex flex-col self-start place-content-center w-full",children:[Q.jsxs("h4",{className:"my-2 flex",children:[" ","1. Upload Keyfile"," "]}),!!s&&Q.jsxs("h5",{className:"underline mb-2",children:[" ",s||".keyfile"," "]}),Q.jsxs("button",{type:"button",onClick:Y,children:[s?"Change":"Select"," Keyfile"]}),Q.jsx("input",{ref:$,className:"hidden",type:"file",onChange:z})]}),Q.jsxs("div",{className:"flex flex-col w-full",children:[Q.jsxs("h4",{className:"my-2 flex",children:[" ","2. Enter Password"," "]}),Q.jsx("input",{type:"password",id:"password",required:!0,minLength:6,name:"password",placeholder:"Min 6 characters",value:t,onChange:e1=>e(e1.target.value),className:"mb-2"}),v&&Q.jsxs("div",{className:"flex",children:[" ",Q.jsxs("p",{className:"text-red-500",children:[" ",v," "]})," "]}),N&&!_&&6<=t.length&&Q.jsxs("div",{className:"flex",children:[" ",Q.jsx("p",{className:"text-red-500",children:" Password is incorrect "})," "]})]}),Q.jsxs("div",{className:"flex flex-col w-full mb-2",children:[c.map((e1,i1)=>Q.jsx("span",{className:"key-err",children:e1},i1)),Q.jsx("button",{type:"submit",children:" Import Keyfile "})]}),Q.jsx("p",{className:"text-sm",children:'Please note: if the original node was booted as a direct node (static IP), then you must run this node from the same IP. If not, you will have networking issues. If you need to change the network options, please go back and select "Reset OsName".'})]})]})}var rn={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useProvider:zU}=Ut;function $U(){var b1,w1,L1,N1,_1,k1,O1;const t=zU(),e=Fx(),[r,n]=n1.useState(""),[u,i]=n1.useState(""),[a,o]=n1.useState(""),[s,l]=n1.useState(!1),[c,y]=n1.useState(!1),[v,w]=n1.useState(""),[_,M]=n1.useState(0),[N,k]=n1.useState(""),[C,T]=n1.useState(0),[z,$]=n1.useState(0),[Y,J]=n1.useState([]),[e1,i1]=n1.useState(""),[o1,S]=n1.useState(!1),[X,U]=n1.useState(!(e!=null&&e.initial)),[d,x]=n1.useState(!1),P=()=>x(!0),F=()=>x(!1),D=n1.useMemo(()=>{var S1;return((S1=t==null?void 0:t.network)==null?void 0:S1.chainId)===R1.SEPOLIA?rn.REACT_APP_SEPOLIA_RPC_URL:rn.REACT_APP_OPTIMISM_RPC_URL},[t]),[R,q]=n1.useState(ui.connect(((b1=t==null?void 0:t.network)==null?void 0:b1.chainId)===R1.SEPOLIA?I5[R1.SEPOLIA]:I5[R1.OPTIMISM],new je(D))),[b,f]=n1.useState(si.connect(((w1=t==null?void 0:t.network)==null?void 0:w1.chainId)===R1.SEPOLIA?zu[R1.SEPOLIA]:zu[R1.OPTIMISM],new je(D))),[m,B]=n1.useState(ai.connect(((L1=t==null?void 0:t.network)==null?void 0:L1.chainId)===R1.SEPOLIA?j5[R1.SEPOLIA]:j5[R1.MAINNET],new je(((N1=t==null?void 0:t.network)==null?void 0:N1.chainId)===R1.SEPOLIA?rn.REACT_APP_SEPOLIA_RPC_URL:rn.REACT_APP_MAINNET_RPC_URL))),[p,I]=n1.useState(oi.connect(((_1=t==null?void 0:t.network)==null?void 0:_1.chainId)===R1.SEPOLIA?z5[R1.SEPOLIA]:z5[R1.OPTIMISM],new je(D))),[L,V]=n1.useState(li.connect(((k1=t==null?void 0:t.network)==null?void 0:k1.chainId)===R1.SEPOLIA?R5[R1.SEPOLIA]:R5[R1.MAINNET],new je(D))),[G,r1]=n1.useState(ii.connect(((O1=t==null?void 0:t.network)==null?void 0:O1.chainId)===R1.SEPOLIA?L5[R1.SEPOLIA]:L5[R1.MAINNET],new je(D)));n1.useEffect(()=>M(window.performance.getEntriesByType("navigation")[0].transferSize),[]),n1.useEffect(()=>{(async()=>{try{const S1=await fetch("/info",{method:"GET"});if(S1.status>399)console.log("no info, unbooted");else{const e0=await S1.json();X&&(w(e0.name),J(e0.allowed_routers),S(!0),U(!1))}}catch{console.log("no info, unbooted")}try{const S1=await fetch("/current-chain",{method:"GET"});if(S1.status<400){const e0=await S1.json();i1(e0.toLowerCase()),console.log("Node Chain ID:",e0)}}catch{console.log("error getting current chain")}})()},[]),n1.useEffect(()=>S(!1),[X]),n1.useEffect(()=>{t==null||t.getNetwork().then(S1=>{S1.chainId===R1.SEPOLIA?(q(ui.connect(I5[R1.SEPOLIA],t.getSigner())),f(si.connect(zu[R1.SEPOLIA],t.getSigner())),B(ai.connect(j5[R1.SEPOLIA],t.getSigner())),I(oi.connect(z5[R1.SEPOLIA],t.getSigner())),V(li.connect(R5[R1.SEPOLIA],t.getSigner())),r1(ii.connect(L5[R1.SEPOLIA],t.getSigner()))):(S1.chainId===R1.OPTIMISM||S1.chainId===R1.MAINNET)&&(q(ui.connect(I5[R1.OPTIMISM],t.getSigner())),f(si.connect(zu[R1.OPTIMISM],t.getSigner())),I(oi.connect(z5[R1.OPTIMISM],t.getSigner())),B(ai.connect(j5[R1.MAINNET],t.getSigner())),V(li.connect(R5[R1.MAINNET],new je(rn.REACT_APP_MAINNET_RPC_URL))),r1(ii.connect(L5[R1.MAINNET],new je(rn.REACT_APP_MAINNET_RPC_URL))))})},[t]);const u1=R1.SEPOLIA,a1=R1.SEPOLIA,B1={direct:c,setDirect:y,key:u,keyFileName:a,setKeyFileName:o,reset:s,setReset:l,pw:r,setPw:n,knsName:v,setOsName:w,dotOs:R,kns:b,knsEnsEntryNetwork:u1,knsEnsExitNetwork:a1,knsEnsEntry:m,knsEnsExit:p,nameWrapper:L,ensRegistry:G,connectOpen:d,openConnect:P,closeConnect:F,provider:t,appSizeOnLoad:_,networkingKey:N,setNetworkingKey:k,ipAddress:C,setIpAddress:T,port:z,setPort:$,routers:Y,setRouters:J,nodeChainId:e1};return Q.jsxs(Q.Fragment,{children:[Q.jsx(m_,{...B1}),Q.jsx(Vx,{children:Q.jsxs(jx,{children:[Q.jsx(a6,{path:"/",element:o1?Q.jsx(Rx,{to:"/login",replace:!0}):Q.jsx(IU,{...B1})}),Q.jsx(a6,{path:"/claim-invite",element:Q.jsx(dU,{...B1})}),Q.jsx(a6,{path:"/register-name",element:Q.jsx(lU,{...B1})}),Q.jsx(a6,{path:"/register-eth-name",element:Q.jsx(oU,{...B1})}),Q.jsx(a6,{path:"/set-password",element:Q.jsx(hU,{...B1})}),Q.jsx(a6,{path:"/reset",element:Q.jsx(OU,{...B1})}),Q.jsx(a6,{path:"/reset-node",element:Q.jsx(LU,{...B1})}),Q.jsx(a6,{path:"/import-keyfile",element:Q.jsx(jU,{...B1})}),Q.jsx(a6,{path:"/login",element:Q.jsx(NU,{...B1})})]})})]})}const qU=[[q4,Ut]],HU=r3.createRoot(document.getElementById("root"));HU.render(Q.jsx(G6.StrictMode,{children:Q.jsx(ka.Web3ReactProvider,{connectors:qU,children:Q.jsx("div",{id:"signup-page",className:"flex flex-col place-items-center place-content-center h-screen w-screen",children:Q.jsx($U,{})})})})); +*/(function(t){(function(){var e={}.hasOwnProperty;function r(){for(var i="",a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function QM(t,e){if(t==null)return{};var r={},n=Object.keys(t),u,i;for(i=0;i=0)&&(r[u]=t[u]);return r}function fa(){return fa=Object.assign?Object.assign.bind():function(t){for(var e=1;eG6.createElement(e.tag,ca({key:r},e.attr),xm(e.child)))}function vm(t){return e=>G6.createElement(ZM,fa({attr:ca({},t.attr)},e),xm(t.child))}function ZM(t){var e=r=>{var{attr:n,size:u,title:i}=t,a=WM(t,VM),o=u||r.size||"1em",s;return r.className&&(s=r.className),t.className&&(s=(s?s+" ":"")+t.className),G6.createElement("svg",fa({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,a,{className:s,style:ca(ca({color:t.color||r.color},r.style),t.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),i&&G6.createElement("title",null,i),t.children)};return _c!==void 0?G6.createElement(_c.Consumer,null,r=>e(r)):e(gm)}function eU(t){return vm({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M80 160c0-35.3 28.7-64 64-64h32c35.3 0 64 28.7 64 64v3.6c0 21.8-11.1 42.1-29.4 53.8l-42.2 27.1c-25.2 16.2-40.4 44.1-40.4 74V320c0 17.7 14.3 32 32 32s32-14.3 32-32v-1.4c0-8.2 4.2-15.8 11-20.2l42.2-27.1c36.6-23.6 58.8-64.1 58.8-107.7V160c0-70.7-57.3-128-128-128H144C73.3 32 16 89.3 16 160c0 17.7 14.3 32 32 32s32-14.3 32-32zm80 320a40 40 0 1 0 0-80 40 40 0 1 0 0 80z"},child:[]}]})(t)}function tU(t){return vm({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"},child:[]}]})(t)}const z2=({text:t,button:e,className:r,position:n})=>{const[u,i]=n1.useState(!1);return Q.jsxs("div",{className:Lr("flex place-items-center place-content-center text-sm relative cursor-pointer shrink",r),children:[Q.jsx("div",{onClick:()=>i(!u),children:e||Q.jsx("button",{className:"icon ml-4",type:"button",children:Q.jsx(eU,{})})}),Q.jsx("div",{className:Lr("absolute rounded bg-black p-2 min-w-[200px] z-10",{"!hidden":!u,"top-8":n==="top"||!n,"bottom-8":n==="bottom","right-8":n==="left","left-8":n==="right"}),children:t}),Q.jsx("button",{type:"button",className:Lr("absolute bg-black icon right-0 top-0",{"!hidden":!u}),onClick:()=>i(!1),children:Q.jsx(tU,{})})]})},cl=()=>window.innerWidth<=600,{useIsActivating:rU,useChainId:nU}=Ut;function fr({header:t,closeConnect:e,nodeChainId:r,hideConnect:n=!1}){const{account:u,isActive:i}=ka.useWeb3React(),a=rU(),o=nU(),[s,l]=n1.useState("");n1.useEffect(()=>{l(Q6((o||1).toString()))},[o]);const c=n1.useCallback(async()=>{e(),await q4.activate().catch(()=>{});try{M2(r)}catch(_){console.error(_)}},[e,r]),y=n1.useCallback(async()=>{if(o){if("0x"+o.toString(16)===r)return alert(`You are already connected to ${Q6(o.toString())}`);try{M2(r)}catch(M){console.error(M)}}},[o,r]),v=n1.useCallback(async()=>{alert("You can change your connected account in your wallet.")},[]),w=cl();return Q.jsx(Q.Fragment,{children:Q.jsxs("div",{id:"signup-form-header",className:"flex flex-col",children:[(r===y2||r===Rr)&&Q.jsx(z2,{position:"left",className:Lr("!absolute z-10",{"top-8 right-8":!w,"top-2 right-2":w}),button:r===y2?Q.jsx("img",{alt:"sepolia",className:"network-icon",src:um}):r===Rr?Q.jsx("img",{alt:"optimism",className:"network-icon",src:im}):null,text:r===y2?'Your Kinode is currently pointed at Sepolia. To point at Optimism, boot without the "--testnet" flag.':r===Rr?'Your Kinode is currently pointed at Optimism. To point at Sepolia, boot with the "--testnet" flag.':""}),Q.jsx("div",{className:"flex flex-col gap-4 c",children:t}),!n&&Q.jsx("div",{className:"flex c w-[99vw] mb-8 absolute top-2 left-2",children:i&&u?Q.jsx(KM,{account:u,networkName:s,changeToNodeChain:y,changeConnectedAccount:v}):Q.jsxs("div",{className:"flex flex-col gap-8 my-4",children:[Q.jsxs("h5",{className:Lr("flex c",{"flex-wrap text-center max-w-3/4 gap-2":w}),children:[!a&&"You must connect to a browser wallet to continue.",a?Q.jsx(sr,{msg:"Approve connection in your wallet"}):Q.jsx("button",{onClick:c,className:"ml-2",children:" Connect Wallet "})]}),r===y2&&Q.jsxs("h5",{className:"text-center max-w-[450px] leading-6 flex c",children:["Kinode is currently on the Sepolia Testnet.",Q.jsx("a",{href:"https://sepoliafaucet.com/",target:"_blank",rel:"noreferrer",className:"button alt ml-2",children:"Get Testnet ETH"})]})]})})]})})}function hu(t){const e=t.split(".");if(e.length!==4)throw new Error("Invalid IP address");let r=0;for(let n=0;n<4;n++)r<<=8,r+=parseInt(e[n],10);return r>>>0}const uU=()=>Q.jsx(z2,{text:"A direct node publishes its own networking information on-chain: IP, port, so on. An indirect node relies on the service of routers, which are themselves direct nodes. Only register a direct node if you know what you’re doing and have a public, static IP address."});function pu({direct:t,setDirect:e}){return Q.jsxs("div",{className:"flex place-items-center",children:[Q.jsxs("div",{className:"relative flex place-items-center mr-2",children:[Q.jsx("input",{type:"checkbox",id:"direct",name:"direct",checked:t,onChange:r=>e(r.target.checked),autoFocus:!0}),t&&Q.jsx("span",{onClick:()=>e(!1),className:"checkmark",children:"✓"})]}),Q.jsx("label",{htmlFor:"direct",className:"flex place-items-center cursor-pointer",children:"Register as a direct node. If you are unsure leave unchecked."}),Q.jsx(uU,{})]})}const iU="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20width='779'%20height='514'%20viewBox='0%200%20779%20514'%20fill='none'%20version='1.1'%20id='svg2'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%20id='defs2'%20/%3e%3cpath%20d='M753.092%205.91932C756.557%205.09976%20755.962%20-0.00012207%20752.401%20-0.00012207H426.001C424.755%20-0.00012207%20423.639%200.77027%20423.197%201.93535L236.968%20492.6C235.729%20495.865%20240.123%20498.255%20242.191%20495.441L569.357%2050.1132C569.778%2049.5392%20570.391%2049.1339%20571.084%2048.97L753.092%205.91932Z'%20fill='%23FFF5D9'%20id='path1'%20/%3e%3cpath%20d='M%2012.054907,40.2288%20C%209.0444768,38.777%2010.207772,34.4583%2013.582982,34.5557%20l%20411.845088,11.881%20c%202.17167,0.0626%203.63105,2.1382%202.85869,4.0656%20l%20-62.7457,156.4787%20c%20-0.66805,1.666%20-2.71117,2.415%20-4.38655,1.607%20z'%20fill='%23fff5d9'%20id='path2'%20style='stroke-width:1.0265'%20/%3e%3c/svg%3e",bu=({prefix:t,showLogo:e})=>{const r=cl();return Q.jsxs("div",{className:"mb-4 flex flex-col c",children:[Q.jsx("h1",{children:t}),e&&Q.jsxs(Q.Fragment,{children:[Q.jsxs("h1",{className:Lr("display",{"text-5xl mt-10 mb-8 ml-4":!r,"text-3xl mt-5 mb-4 ml-2":r}),children:["Kinode",Q.jsx("span",{className:"text-xs",children:"®"})]}),Q.jsx("img",{src:iU,className:Lr({"w-32 h-32":!r,"w-16 h-16":r})})]})]})},{useAccounts:aU}=Ut;function oU({direct:t,setDirect:e,setOsName:r,nameWrapper:n,ensRegistry:u,knsEnsEntry:i,kns:a,openConnect:o,provider:s,closeConnect:l,setNetworkingKey:c,setIpAddress:y,setPort:v,setRouters:w,nodeChainId:_}){let M=aU(),N=ir();const k=Q6(_),[C,T]=n1.useState(""),[z,$]=n1.useState(""),[Y,J]=n1.useState([]),[e1,i1]=n1.useState(!1);n1.useEffect(()=>{document.title="Register"},[]),n1.useEffect(()=>i1(!e1),[s]);const o1={name:z,setName:$,nameValidities:Y,setNameValidities:J,nameWrapper:n,ensRegistry:u,triggerNameCheck:e1};let S=n1.useCallback(async X=>{if(X.preventDefault(),X.stopPropagation(),!s)return o();try{T("Please confirm the transaction in your wallet");const{networking_key:U,ws_routing:[d,x],allowed_routers:P}=await fetch("/generate-networking-info",{method:"POST"}).then(p=>p.json()),F=hu(d);c(U),y(F),v(x),w(P);const D=z.trim().replace(".eth",""),R=_===Rr?ra:_;try{await M2(R)}catch{throw window.alert(`You must connect to the ${Q6(R)} network to continue. Please connect and try again.`),new Error(`${Q6(R)} not connected`)}const q=[t?(await a.populateTransaction.setAllIp(ft(`${D}.eth`),F,x,0,0,0)).data:(await a.populateTransaction.setRouters(ft(`${D}.eth`),P.map(p=>ft(p)))).data,(await a.populateTransaction.setKey(ft(`${D}.eth`),U)).data];T("Please confirm the transaction in your wallet");const b=Pb(`${D}.eth`),f=Gi(`${D}.eth`),m=await i.setKNSRecords(b,q,{gasLimit:3e5}),B=(p,I)=>{p===f&&(a.off("NodeRegistered",B),T(""),r(`${D}.eth`),N("/set-password"))};await M2(_),T(`Registering ${D}.eth on Kinode... this may take a few minutes.`),a.on("NodeRegistered",B),await m.wait()}catch(U){console.error("Registration Error:",U),T(""),alert("There was an error linking your ENS name, please try again.")}},[z,t,M,a,N,r,s,o,c,y,v,w,_,k]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Register via ENS"}),openConnect:o,closeConnect:l,nodeChainId:_===Rr?ra:_}),!!s&&Q.jsx("form",{id:"signup-form",className:"flex flex-col",onSubmit:S,children:C?Q.jsx(sr,{msg:C}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("h3",{className:"w-full flex flex-col c mb-2",children:[Q.jsx("label",{className:"flex leading-6 mb-2",children:"Set up your Kinode with a .eth name"}),Q.jsx(VN,{...o1})]}),Q.jsx(pu,{direct:t,setDirect:e}),Q.jsx("button",{disabled:Y.length!==0,type:"submit",className:"mt-2",children:"Register .eth name"})]})})]})}function dl({name:t,setName:e,nameValidities:r,setNameValidities:n,dotOs:u,triggerNameCheck:i,isReset:a=!1}){const o="Name must be a valid URL without subdomains (A-Z, a-z, 0-9, and punycode)",s="Name must be 9 characters or more",l="Name is already claimed",c="Unsupported punycode character",y=n1.useRef(null);n1.useEffect(()=>{a||(y.current&&clearTimeout(y.current),y.current=setTimeout(async()=>{let w,_=[...r];const M=[...t].length;w=_.indexOf(s),M<9&&M!==0?w===-1&&_.push(s):w!==-1&&_.splice(w,1);let N;w=_.indexOf(c);try{N=sl(t+".os"),w!==-1&&_.splice(w,1)}catch{w===-1&&_.push(c)}if(N!==void 0&&(w=_.indexOf(o),t!==""&&!nl(N)?w===-1&&_.push(o):w!==-1&&_.splice(w,1),w=_.indexOf(l),_.length===0||w!==-1))try{await u.ownerOf(Gi(N)),w===-1&&_.push(l)}catch{w!==-1&&_.splice(w,1)}n(_)},500))},[t,i,a]);const v=w=>w.target.value.indexOf(".")===-1&&e(w.target.value);return Q.jsxs("div",{className:"flex flex-col w-full place-items-center place-content-center",children:[Q.jsxs("div",{className:"flex w-full place-items-center",children:[Q.jsx("input",{value:t,onChange:v,type:"text",required:!0,name:"dot-os-name",placeholder:"e.g. myname",className:"grow"}),Q.jsx("div",{className:"ml-2 text-lg",children:".os"})]}),r.map((w,_)=>Q.jsxs("div",{children:[Q.jsx("br",{}),Q.jsx("span",{className:"text-red-500",children:w})]},_))]})}const{useAccounts:sU}=Ut;function lU({direct:t,setDirect:e,setOsName:r,dotOs:n,kns:u,openConnect:i,provider:a,closeConnect:o,setNetworkingKey:s,setIpAddress:l,setPort:c,setRouters:y,nodeChainId:v}){let w=sU(),_=ir();const M=Q6(v),[N,k]=n1.useState(""),[C,T]=n1.useState(""),[z,$]=n1.useState([]),[Y,J]=n1.useState(!1);n1.useEffect(()=>{document.title="Register"},[]),n1.useEffect(()=>J(!Y),[a]);const e1={name:C,setName:T,nameValidities:z,setNameValidities:$,dotOs:n,triggerNameCheck:Y};let i1=n1.useCallback(async o1=>{if(o1.preventDefault(),o1.stopPropagation(),!a)return i();try{k("Please confirm the transaction in your wallet");const{networking_key:S,ws_routing:[X,U],allowed_routers:d}=await fetch("/generate-networking-info",{method:"POST"}).then(R=>R.json()),x=hu(X);s(S),l(x),c(U),y(d);const P=[t?(await u.populateTransaction.setAllIp(ft(`${C}.os`),x,U,0,0,0)).data:(await u.populateTransaction.setRouters(ft(`${C}.os`),d.map(R=>ft(R)))).data,(await u.populateTransaction.setKey(ft(`${C}.os`),S)).data];k("Please confirm the transaction in your wallet");try{await M2(v)}catch{throw window.alert(`You must connect to the ${M} network to continue. Please connect and try again.`),new Error(`${M} not set`)}const F=Pb(`${C}.os`),D=await n.register(F,w[0],P);k("Registering KNS ID..."),await D.wait(),k(""),r(`${C}.os`),_("/set-password")}catch(S){console.error("Registration Error:",S),k(""),alert("There was an error registering your dot-os-name, please try again.")}},[C,t,w,n,u,_,r,a,i,s,l,c,y,v,M]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx("h1",{className:"flex place-content-center place-items-center mb-4",children:"Register Kinode Name (KNS)"}),openConnect:i,closeConnect:o,nodeChainId:v}),!!a&&Q.jsx("form",{id:"signup-form",className:"flex flex-col w-full max-w-[450px]",onSubmit:i1,children:N?Q.jsx(sr,{msg:N}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("h3",{className:"flex flex-col w-full place-items-center my-8",children:[Q.jsxs("label",{className:"flex leading-6 place-items-center mt-2 cursor-pointer mb-2",children:["Choose a name for your kinode",Q.jsx(z2,{text:"Kinodes use a .os name in order to identify themselves to other nodes in the network."})]}),Q.jsx(dl,{...e1})]}),Q.jsx(pu,{direct:t,setDirect:e}),Q.jsx("button",{disabled:z.length!==0,type:"submit",className:"mt-2",children:"Register .os name"}),Q.jsx(v4,{to:"/reset",className:"flex self-stretch mt-2",children:Q.jsx("button",{className:"clear grow",children:"already have a dot-os-name?"})})]})})]})}var e3={};const{useAccounts:fU,useProvider:cU}=Ut;function dU({direct:t,setDirect:e,setOsName:r,dotOs:n,openConnect:u,setNetworkingKey:i,setIpAddress:a,setPort:o,setRouters:s,closeConnect:l,nodeChainId:c}){const y=fU(),v=cU(),w=ir(),[_,M]=n1.useState(!1),[N,k]=n1.useState(""),[C,T]=n1.useState(!1),[z,$]=n1.useState(""),[Y,J]=n1.useState(""),[e1,i1]=n1.useState(""),[o1,S]=n1.useState([]);n1.useEffect(()=>{document.title="Claim Invite"},[]),n1.useEffect(()=>T(!C),[v]),n1.useEffect(()=>{(async()=>{if(z!==""){const d=e3.REACT_APP_INVITE_GET+z,x=await fetch(d,{method:"GET"});x.status===200?J(""):J(await x.text())}})()},[z]);let X=async d=>{if(d.preventDefault(),d.stopPropagation(),!v)return u();const{networking_key:x,ws_routing:[P,F],allowed_routers:D}=await fetch("/generate-networking-info",{method:"POST"}).then(p=>p.json()),R=hu(P);if(i(x),a(R),o(F),s(D),o1.length!==0||Y!=="")return;if(!e1||!z)return window.alert("Please enter a name and invite code"),!1;let q;k("...Building EIP-4337 User Operation"),M(!0),console.log("BUILDING",x,R,F,D);try{q=await fetch(e3.REACT_APP_BUILD_USER_OP_POST,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e1+".os",address:y[0],networkingKey:x,wsIp:R,wsPort:F,routers:D,direct:t})})}catch(p){k(""),M(!1),alert(p),console.error("error from fetching userOp:",p);return}k("...Signing EIP-4337 User Operation");const b=await q.json(),f=new Uint8Array(Object.values(b.message)),m=await(v==null?void 0:v.getSigner()),B=await(m==null?void 0:m.signMessage(f));b.userOperation.signature=B;try{q=await fetch(e3.REACT_APP_BROADCAST_USER_OP_POST,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userOp:b.userOperation,code:z,name:e1+".os",eoa:y[0]})})}catch(p){alert(p),console.error("error from broadcasting userOp:",p);return}finally{k(""),M(!1)}r(`${e1}.os`),w("/set-password")};const U={name:e1,setName:i1,nameValidities:o1,setNameValidities:S,dotOs:n,triggerNameCheck:C};return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Claim Invite"}),openConnect:u,closeConnect:l,nodeChainId:c}),!!v&&Q.jsx("form",{id:"signup-form",className:"flex flex-col",onSubmit:X,children:_?Q.jsx(sr,{msg:N}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("div",{className:"flex c mb-2",children:[Q.jsx("h5",{children:"Set up your Kinode with a .os name"}),Q.jsx(z2,{text:"Kinodes use a .os name in order to identify themselves to other nodes in the network."})]}),Q.jsxs("div",{className:"flex flex-col mb-2",children:[Q.jsx("input",{value:z,onChange:d=>$(d.target.value),type:"text",required:!0,name:"nec-invite",placeholder:"invite code",className:"self-stretch"}),Y!==""&&Q.jsx("div",{className:"invite-validity",children:Y})]}),Q.jsx("h3",{className:"mb-2",children:Q.jsx(dl,{...U})}),Q.jsx(pu,{direct:t,setDirect:e}),Q.jsx("button",{disabled:o1.length!==0||Y!=="",type:"submit",className:"self-stretch mt-2",children:"Register .os name"}),Q.jsx(v4,{to:"/reset",className:"button clear",children:"already have a .os?"})]})})]})}const Am=(t,e)=>{let r=new Blob([e],{type:"text/plain;charset=utf-8"});const n=window.URL.createObjectURL(r),u=document.createElement("a");u.href=n,u.setAttribute("download",`${t}.keyfile`),document.body.appendChild(u),u.click()};function hU({knsName:t,direct:e,pw:r,reset:n,provider:u,setPw:i,appSizeOnLoad:a,closeConnect:o,nodeChainId:s}){const[l,c]=n1.useState(""),[y,v]=n1.useState(""),[w,_]=n1.useState(!1);n1.useEffect(()=>{document.title="Set Password"},[]),n1.useEffect(()=>{v("")},[r,l]);const M=n1.useCallback(async N=>{if(N.preventDefault(),r!==l)return v("Passwords do not match"),!1;setTimeout(async()=>{_(!0);let k=pt(z0(r)),C=await(u==null?void 0:u.getSigner()),T=await(C==null?void 0:C.getAddress()),z=await(C==null?void 0:C.getChainId()),$=Date.now(),Y=JSON.stringify({username:t,password_hash:k,timestamp:$,direct:e,reset:n,chain_id:z}),J=await(C==null?void 0:C.signMessage(z0(Y)));try{const i1=await(await fetch("/boot",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({password_hash:k,reset:n,username:t,direct:e,owner:T,timestamp:$,signature:J,chain_id:z})})).json();Am(t,i1);const o1=setInterval(async()=>{const S=await fetch("/");S.status<300&&Number(S.headers.get("content-length"))!==a&&(console.log("WE GOOD, ROUTING"),clearInterval(o1),window.location.replace("/"))},2e3)}catch{alert("There was an error setting your password, please try again."),_(!1)}},500)},[a,e,r,l,n,t]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Set Password",showLogo:!0}),openConnect:()=>{},closeConnect:o,nodeChainId:s}),w?Q.jsx(sr,{msg:"Setting up node..."}):Q.jsxs("form",{id:"signup-form",className:"flex flex-col w-full max-w-[450px] gap-4",onSubmit:M,children:[Q.jsxs("div",{className:"flex flex-col w-full place-items-center place-content-center",children:[Q.jsxs("div",{className:"flex w-full place-items-center mb-2",children:[Q.jsx("label",{className:"flex leading-6 place-items-center mt-2 cursor-pointer mb-2",style:{fontSize:20},htmlFor:"password",children:"New Password"}),Q.jsx(z2,{text:"This password will be used to log in if you restart your node or switch browsers."})]}),Q.jsx("div",{className:"flex w-full place-items-center",children:Q.jsx("input",{className:"grow",type:"password",id:"password",required:!0,minLength:6,name:"password",placeholder:"Min 6 characters",value:r,onChange:N=>i(N.target.value),autoFocus:!0})})]}),Q.jsxs("div",{className:"flex flex-col w-full place-items-center place-content-center",children:[Q.jsx("div",{className:"flex w-full place-items-center",children:Q.jsx("label",{className:"flex leading-6 place-items-center mt-2 cursor-pointer mb-4",style:{fontSize:20},htmlFor:"confirm-password",children:"Confirm Password"})}),Q.jsx("div",{className:"flex w-full place-items-center",children:Q.jsx("input",{className:"grow",type:"password",id:"confirm-password",required:!0,minLength:6,name:"confirm-password",placeholder:"Min 6 characters",value:l,onChange:N=>c(N.target.value)})}),!!y&&Q.jsx("p",{style:{color:"red"},children:y})]}),Q.jsx("button",{type:"submit",children:"Submit"})]})]})}var ct={};const pU=P0(nB),bU=P0(aA),mU=P0(sA),yU=P0(tv),gU=P0(cw),xU=P0(AB),vU=P0(PB),AU=P0(dv),wU=P0(Zx),Sc=P0($E),EU=P0(GB),CU=P0(KC),FU=P0(Zv),BU=P0(pv),DU=P0(pC),Tc=P0(PA),_U=P0(wC),kU=P0(YB),SU=P0(RB),TU=P0(WE);(function(t){var e=f0&&f0.__createBinding||(Object.create?function(S,X,U,d){d===void 0&&(d=U),Object.defineProperty(S,d,{enumerable:!0,get:function(){return X[U]}})}:function(S,X,U,d){d===void 0&&(d=U),S[d]=X[U]}),r=f0&&f0.__setModuleDefault||(Object.create?function(S,X){Object.defineProperty(S,"default",{enumerable:!0,value:X})}:function(S,X){S.default=X}),n=f0&&f0.__importStar||function(S){if(S&&S.__esModule)return S;var X={};if(S!=null)for(var U in S)U!=="default"&&Object.prototype.hasOwnProperty.call(S,U)&&e(X,S,U);return r(X,S),X};Object.defineProperty(t,"__esModule",{value:!0}),t.formatBytes32String=t.Utf8ErrorFuncs=t.toUtf8String=t.toUtf8CodePoints=t.toUtf8Bytes=t._toEscapedUtf8String=t.nameprep=t.hexDataSlice=t.hexDataLength=t.hexZeroPad=t.hexValue=t.hexStripZeros=t.hexConcat=t.isHexString=t.hexlify=t.base64=t.base58=t.TransactionDescription=t.LogDescription=t.Interface=t.SigningKey=t.HDNode=t.defaultPath=t.isBytesLike=t.isBytes=t.zeroPad=t.stripZeros=t.concat=t.arrayify=t.shallowCopy=t.resolveProperties=t.getStatic=t.defineReadOnly=t.deepCopy=t.checkProperties=t.poll=t.fetchJson=t._fetchData=t.RLP=t.Logger=t.checkResultErrors=t.FormatTypes=t.ParamType=t.FunctionFragment=t.EventFragment=t.ErrorFragment=t.ConstructorFragment=t.Fragment=t.defaultAbiCoder=t.AbiCoder=void 0,t.Indexed=t.Utf8ErrorReason=t.UnicodeNormalizationForm=t.SupportedAlgorithm=t.mnemonicToSeed=t.isValidMnemonic=t.entropyToMnemonic=t.mnemonicToEntropy=t.getAccountPath=t.verifyTypedData=t.verifyMessage=t.recoverPublicKey=t.computePublicKey=t.recoverAddress=t.computeAddress=t.getJsonWalletAddress=t.TransactionTypes=t.serializeTransaction=t.parseTransaction=t.accessListify=t.joinSignature=t.splitSignature=t.soliditySha256=t.solidityKeccak256=t.solidityPack=t.shuffled=t.randomBytes=t.sha512=t.sha256=t.ripemd160=t.keccak256=t.computeHmac=t.commify=t.parseUnits=t.formatUnits=t.parseEther=t.formatEther=t.isAddress=t.getCreate2Address=t.getContractAddress=t.getIcapAddress=t.getAddress=t._TypedDataEncoder=t.id=t.isValidName=t.namehash=t.hashMessage=t.dnsEncode=t.parseBytes32String=void 0;var u=pU;Object.defineProperty(t,"AbiCoder",{enumerable:!0,get:function(){return u.AbiCoder}}),Object.defineProperty(t,"checkResultErrors",{enumerable:!0,get:function(){return u.checkResultErrors}}),Object.defineProperty(t,"ConstructorFragment",{enumerable:!0,get:function(){return u.ConstructorFragment}}),Object.defineProperty(t,"defaultAbiCoder",{enumerable:!0,get:function(){return u.defaultAbiCoder}}),Object.defineProperty(t,"ErrorFragment",{enumerable:!0,get:function(){return u.ErrorFragment}}),Object.defineProperty(t,"EventFragment",{enumerable:!0,get:function(){return u.EventFragment}}),Object.defineProperty(t,"FormatTypes",{enumerable:!0,get:function(){return u.FormatTypes}}),Object.defineProperty(t,"Fragment",{enumerable:!0,get:function(){return u.Fragment}}),Object.defineProperty(t,"FunctionFragment",{enumerable:!0,get:function(){return u.FunctionFragment}}),Object.defineProperty(t,"Indexed",{enumerable:!0,get:function(){return u.Indexed}}),Object.defineProperty(t,"Interface",{enumerable:!0,get:function(){return u.Interface}}),Object.defineProperty(t,"LogDescription",{enumerable:!0,get:function(){return u.LogDescription}}),Object.defineProperty(t,"ParamType",{enumerable:!0,get:function(){return u.ParamType}}),Object.defineProperty(t,"TransactionDescription",{enumerable:!0,get:function(){return u.TransactionDescription}});var i=bh;Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return i.getAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return i.getCreate2Address}}),Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return i.getContractAddress}}),Object.defineProperty(t,"getIcapAddress",{enumerable:!0,get:function(){return i.getIcapAddress}}),Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return i.isAddress}});var a=n(bU);t.base64=a;var o=mU;Object.defineProperty(t,"base58",{enumerable:!0,get:function(){return o.Base58}});var s=yU;Object.defineProperty(t,"arrayify",{enumerable:!0,get:function(){return s.arrayify}}),Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return s.concat}}),Object.defineProperty(t,"hexConcat",{enumerable:!0,get:function(){return s.hexConcat}}),Object.defineProperty(t,"hexDataSlice",{enumerable:!0,get:function(){return s.hexDataSlice}}),Object.defineProperty(t,"hexDataLength",{enumerable:!0,get:function(){return s.hexDataLength}}),Object.defineProperty(t,"hexlify",{enumerable:!0,get:function(){return s.hexlify}}),Object.defineProperty(t,"hexStripZeros",{enumerable:!0,get:function(){return s.hexStripZeros}}),Object.defineProperty(t,"hexValue",{enumerable:!0,get:function(){return s.hexValue}}),Object.defineProperty(t,"hexZeroPad",{enumerable:!0,get:function(){return s.hexZeroPad}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return s.isBytes}}),Object.defineProperty(t,"isBytesLike",{enumerable:!0,get:function(){return s.isBytesLike}}),Object.defineProperty(t,"isHexString",{enumerable:!0,get:function(){return s.isHexString}}),Object.defineProperty(t,"joinSignature",{enumerable:!0,get:function(){return s.joinSignature}}),Object.defineProperty(t,"zeroPad",{enumerable:!0,get:function(){return s.zeroPad}}),Object.defineProperty(t,"splitSignature",{enumerable:!0,get:function(){return s.splitSignature}}),Object.defineProperty(t,"stripZeros",{enumerable:!0,get:function(){return s.stripZeros}});var l=gU;Object.defineProperty(t,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(t,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(t,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(t,"namehash",{enumerable:!0,get:function(){return l.namehash}});var c=xU;Object.defineProperty(t,"defaultPath",{enumerable:!0,get:function(){return c.defaultPath}}),Object.defineProperty(t,"entropyToMnemonic",{enumerable:!0,get:function(){return c.entropyToMnemonic}}),Object.defineProperty(t,"getAccountPath",{enumerable:!0,get:function(){return c.getAccountPath}}),Object.defineProperty(t,"HDNode",{enumerable:!0,get:function(){return c.HDNode}}),Object.defineProperty(t,"isValidMnemonic",{enumerable:!0,get:function(){return c.isValidMnemonic}}),Object.defineProperty(t,"mnemonicToEntropy",{enumerable:!0,get:function(){return c.mnemonicToEntropy}}),Object.defineProperty(t,"mnemonicToSeed",{enumerable:!0,get:function(){return c.mnemonicToSeed}});var y=vU;Object.defineProperty(t,"getJsonWalletAddress",{enumerable:!0,get:function(){return y.getJsonWalletAddress}});var v=AU;Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return v.keccak256}});var w=wU;Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return w.Logger}});var _=Sc;Object.defineProperty(t,"computeHmac",{enumerable:!0,get:function(){return _.computeHmac}}),Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return _.ripemd160}}),Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return _.sha256}}),Object.defineProperty(t,"sha512",{enumerable:!0,get:function(){return _.sha512}});var M=EU;Object.defineProperty(t,"solidityKeccak256",{enumerable:!0,get:function(){return M.keccak256}}),Object.defineProperty(t,"solidityPack",{enumerable:!0,get:function(){return M.pack}}),Object.defineProperty(t,"soliditySha256",{enumerable:!0,get:function(){return M.sha256}});var N=CU;Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return N.randomBytes}}),Object.defineProperty(t,"shuffled",{enumerable:!0,get:function(){return N.shuffled}});var k=FU;Object.defineProperty(t,"checkProperties",{enumerable:!0,get:function(){return k.checkProperties}}),Object.defineProperty(t,"deepCopy",{enumerable:!0,get:function(){return k.deepCopy}}),Object.defineProperty(t,"defineReadOnly",{enumerable:!0,get:function(){return k.defineReadOnly}}),Object.defineProperty(t,"getStatic",{enumerable:!0,get:function(){return k.getStatic}}),Object.defineProperty(t,"resolveProperties",{enumerable:!0,get:function(){return k.resolveProperties}}),Object.defineProperty(t,"shallowCopy",{enumerable:!0,get:function(){return k.shallowCopy}});var C=n(BU);t.RLP=C;var T=DU;Object.defineProperty(t,"computePublicKey",{enumerable:!0,get:function(){return T.computePublicKey}}),Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return T.recoverPublicKey}}),Object.defineProperty(t,"SigningKey",{enumerable:!0,get:function(){return T.SigningKey}});var z=Tc;Object.defineProperty(t,"formatBytes32String",{enumerable:!0,get:function(){return z.formatBytes32String}}),Object.defineProperty(t,"nameprep",{enumerable:!0,get:function(){return z.nameprep}}),Object.defineProperty(t,"parseBytes32String",{enumerable:!0,get:function(){return z.parseBytes32String}}),Object.defineProperty(t,"_toEscapedUtf8String",{enumerable:!0,get:function(){return z._toEscapedUtf8String}}),Object.defineProperty(t,"toUtf8Bytes",{enumerable:!0,get:function(){return z.toUtf8Bytes}}),Object.defineProperty(t,"toUtf8CodePoints",{enumerable:!0,get:function(){return z.toUtf8CodePoints}}),Object.defineProperty(t,"toUtf8String",{enumerable:!0,get:function(){return z.toUtf8String}}),Object.defineProperty(t,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return z.Utf8ErrorFuncs}});var $=_U;Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return $.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return $.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return $.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return $.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return $.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return $.TransactionTypes}});var Y=kU;Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return Y.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return Y.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return Y.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return Y.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return Y.parseUnits}});var J=SU;Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return J.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return J.verifyTypedData}});var e1=TU;Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return e1._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return e1.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return e1.poll}});var i1=Sc;Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return i1.SupportedAlgorithm}});var o1=Tc;Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return o1.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return o1.Utf8ErrorReason}})})(ct);const{useProvider:PU}=Ut;function NU({direct:t,setDirect:e,pw:r,setPw:n,kns:u,openConnect:i,appSizeOnLoad:a,closeConnect:o,routers:s,setRouters:l,knsName:c,setOsName:y,nodeChainId:v}){const w=PU(),_=ir(),[M,N]=n1.useState([]),[k,C]=n1.useState(""),[T,z]=n1.useState(!1),[$,Y]=n1.useState(!1),[J,e1]=n1.useState(!1);n1.useEffect(()=>{document.title="Login",(async()=>{try{const X=await fetch("/info",{method:"GET"}).then(U=>U.json());l(X.allowed_routers),y(X.name)}catch{}})()},[]);const i1=n1.useCallback(async X=>{X==null||X.preventDefault(),X==null||X.stopPropagation();try{if($){if(!w)return N(["Please connect your wallet and try again"]),e1(!0),i();C("Checking password...");let P=pt(z0(r));if((await fetch("/vet-keyfile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password_hash:P,keyfile:""})})).status>399)throw new Error("Incorrect password");const{networking_key:D,ws_routing:[R,q],allowed_routers:b}=await fetch("/generate-networking-info",{method:"POST"}).then(p=>p.json());C("Please confirm the transaction in your wallet");const f=hu(R),m=[t?(await u.populateTransaction.setAllIp(ct.namehash(c),f,q,0,0,0)).data:(await u.populateTransaction.setRouters(ct.namehash(c),b.map(p=>ct.namehash(p)))).data,(await u.populateTransaction.setKey(ct.namehash(c),D)).data];C("Please confirm the transaction");const B=await u.multicall(m);C("Resetting Networking Information..."),await B.wait()}C("Logging in...");let U=pt(z0(r));const d=await fetch($?"/confirm-change-network-keys":"login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($?{password_hash:U,direct:t}:{password_hash:U})});if(d.status>399)throw new Error(await d.text());if($){const P=await d.json();Am(c,P)}const x=setInterval(async()=>{const P=await fetch("/");P.status<300&&Number(P.headers.get("content-length"))!==a&&(clearInterval(x),window.location.replace("/"))},2e3)}catch(U){const d=String(U);d.includes("Object")?N(["There was an error with the transaction, or it was cancelled."]):N([d]),C("")}},[r,a,$,t,c,w,i,u]),o1=(s==null?void 0:s.length)===0,S=cl();return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Login to",showLogo:!0}),openConnect:i,closeConnect:o,hideConnect:!T,nodeChainId:v}),k?Q.jsx(sr,{msg:k}):Q.jsxs("form",{id:"signup-form",className:Lr("flex flex-col w-full max-w-[450px]",{"p-2":S}),onSubmit:i1,children:[Q.jsxs("div",{className:"self-stretch mb-2 flex flex-col",children:[Q.jsxs("div",{className:"flex text-lg mb-2 place-items-center place-content-center",children:[Q.jsx("h3",{className:"font-bold",children:c}),Q.jsxs("span",{className:"ml-2 mt-1 text-sm",children:["(",o1?"direct":"indirect"," node)"]})]}),Q.jsx("input",{type:"password",id:"password",required:!0,minLength:6,name:"password",placeholder:"Password",value:r,onChange:X=>n(X.target.value),autoFocus:!0,className:"self-stretch"})]}),M.length>0&&Q.jsx("div",{className:"flex flex-col w-full leading-6 mb-2",children:M.map((X,U)=>Q.jsx("div",{className:"text-red-500",children:X},U))}),Q.jsxs("button",{type:"submit",className:"w-full mb-2",children:[" ",$?"Reset & ":""," Login "]}),Q.jsxs("div",{className:"flex flex-col w-full self-stretch place-content-center place-items-center",children:[Q.jsx("button",{className:"clear self-stretch mb-1",onClick:()=>{z(!T),Y(!T)},children:T?"Cancel":"Reset Networking Info"}),Q.jsx("button",{className:"clear self-stretch",onClick:()=>{_("/reset-node")},children:"Reset Node & Password"}),T&&Q.jsxs("div",{className:"flex flex-col w-full gap-2 mt-4",children:[Q.jsxs("div",{className:"flex w-full place-items-center",children:[Q.jsxs("div",{className:"relative flex",children:[Q.jsx("input",{type:"checkbox",id:"reset",name:"reset",checked:$,onChange:X=>Y(X.target.checked),autoFocus:!0,className:"mr-2"}),$&&Q.jsx("span",{onClick:()=>Y(!1),className:"checkmark",children:"✓"})]}),Q.jsx("label",{htmlFor:"reset",className:"direct-node-message",children:"Reset networking keys and publish on-chain"}),Q.jsx(z2,{text:"This will update your networking keys and publish the new info on-chain"})]}),Q.jsx(pu,{direct:t,setDirect:e})]})]})]})]})}const Pc="Unsupported punycode character",Nc="Name does not belong to this wallet",t3="Name is not registered",Mc="Name must be a valid URL without subdomains (A-Z, a-z, 0-9, and punycode)",{useAccounts:MU,useProvider:UU}=Ut;function OU({direct:t,setDirect:e,setReset:r,knsName:n,setOsName:u,dotOs:i,kns:a,openConnect:o,closeConnect:s,setNetworkingKey:l,setIpAddress:c,setPort:y,setRouters:v,nodeChainId:w}){const _=MU(),M=UU(),N=ir(),k=Q6(w),[C,T]=n1.useState(n.slice(0,-3)),[z,$]=n1.useState([]),[Y,J]=n1.useState([]),[e1,i1]=n1.useState(""),[o1,S]=n1.useState(!1);n1.useEffect(()=>{document.title="Reset"},[]),n1.useEffect(()=>S(!o1),[M]);const X=n1.useRef(null);n1.useEffect(()=>{X.current&&clearTimeout(X.current),X.current=setTimeout(async()=>{if($([]),!M||C==="")return;let d,x=[...z],P;d=x.indexOf(Pc);try{P=sl(C+".os"),d!==-1&&x.splice(d,1)}catch{d===-1&&x.push(Pc)}if(P!==void 0){d=x.indexOf(Mc),C!==""&&!nl(P)?d===-1&&x.push(Mc):d!==-1&&x.splice(d,1);try{const F=await i.ownerOf(Gi(P));d=x.indexOf(Nc),F===_[0]&&d!==-1?x.splice(d,1):d===-1&&F!==_[0]&&x.push(Nc),d=x.indexOf(t3),d!==-1&&x.splice(d,1)}catch{d=x.indexOf(t3),d===-1&&x.push(t3)}z.length===0&&u(P)}$(x)},500)},[C,o1]);const U=n1.useCallback(async d=>{if(d.preventDefault(),d.stopPropagation(),!M)return o();try{i1("Please confirm the transaction in your wallet");const{networking_key:x,ws_routing:[P,F],allowed_routers:D}=await fetch("/generate-networking-info",{method:"POST"}).then(f=>f.json()),R=hu(P);l(x),c(R),y(F),v(D);const q=[t?(await a.populateTransaction.setAllIp(ct.namehash(n),R,F,0,0,0)).data:(await a.populateTransaction.setRouters(ct.namehash(n),D.map(f=>ct.namehash(f)))).data,(await a.populateTransaction.setKey(ct.namehash(n),x)).data];try{await M2(w)}catch{throw window.alert(`You must connect to the ${k} network to continue. Please connect and try again.`),new Error(`${k} not set`)}const b=await a.multicall(q);i1("Resetting Networking Information..."),await b.wait(),r(!0),i1(""),e(t),N("/set-password")}catch{i1(""),alert("An error occurred, please try again.")}},[M,n,r,e,N,o,a,t,l,c,y,v,w,k]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Reset KNS Name"}),openConnect:o,closeConnect:s,nodeChainId:w}),!!M&&Q.jsx("form",{id:"signup-form",className:"flex flex-col",onSubmit:U,children:e1?Q.jsx(sr,{msg:e1}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("h3",{className:"flex flex-col w-full place-items-center mb-2",children:[Q.jsxs("label",{className:"flex leading-6 place-items-center mt-2 cursor-pointer mb-2",children:["Choose a name for your kinode",Q.jsx(z2,{text:"Kinodes use a .os name in order to identify themselves to other nodes in the network."})]}),Q.jsx(dl,{name:C,setName:T,nameVets:z,dotOs:i,triggerNameCheck:o1,nameValidities:Y,setNameValidities:J,isReset:!0})]}),Q.jsx(pu,{direct:t,setDirect:e}),Q.jsx("button",{type:"submit",className:"mt-2",children:" Reset Node "})]})})]})}function IU({openConnect:t,knsName:e,closeConnect:r,nodeChainId:n}){const u=ir(),i=()=>u("/claim-invite"),a=()=>u("/register-eth-name"),o=()=>u("/register-name"),s=()=>u("/reset"),l=()=>u("/import-keyfile"),c=()=>u("/login"),y=!!e,v=!!window.ethereum;return n1.useEffect(()=>{document.title="Welcome | Kinode"},[]),Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx(bu,{prefix:"Welcome to",showLogo:!0}),openConnect:t,closeConnect:r,hideConnect:!0,nodeChainId:n,nameLogo:!0}),Q.jsx("div",{className:"flex flex-col max-w-[460px] w-full gap-4 mt-8",children:y?Q.jsx("button",{onClick:c,children:" Login "}):Q.jsxs(Q.Fragment,{children:[!v&&Q.jsx("h4",{className:"self-start mx-auto",children:"You must install a Web3 wallet extension like Metamask in order to register or reset a username."}),v&&Q.jsx("h4",{className:"self-start mx-auto",children:"New here? Register a username to get started"}),Q.jsx("button",{disabled:!v,onClick:o,children:"Register Kinode Name"}),Q.jsx("h4",{className:"self-start mx-auto",children:"Other options"}),n!==Rr&&Q.jsx("button",{disabled:!v,onClick:a,className:"alt",children:"Register ENS Name"}),Q.jsx("button",{disabled:!v,onClick:i,className:"alt",children:"Claim Kinode Invite"}),Q.jsx("button",{disabled:!v,onClick:s,className:"alt",children:"Reset Kinode Name"}),Q.jsx("button",{onClick:l,className:"alt",children:"Import Keyfile"})]})})]})}const{useProvider:RU}=Ut;function LU({direct:t,setDirect:e,setReset:r,knsName:n,kns:u,openConnect:i,closeConnect:a,setNetworkingKey:o,setIpAddress:s,setPort:l,setRouters:c,nodeChainId:y}){const v=RU(),w=ir(),_=Q6(y),[M,N]=n1.useState("");n1.useEffect(()=>{document.title="Reset"},[]);const k=n1.useCallback(async C=>{if(C.preventDefault(),C.stopPropagation(),!v)return i();try{N("Please confirm the transaction in your wallet");const{networking_key:T,ws_routing:[z,$],allowed_routers:Y}=await fetch("/generate-networking-info",{method:"POST"}).then(o1=>o1.json()),J=hu(z);o(T),s(J),l($),c(Y);const e1=[t?(await u.populateTransaction.setAllIp(ct.namehash(n),J,$,0,0,0)).data:(await u.populateTransaction.setRouters(ct.namehash(n),Y.map(o1=>ct.namehash(o1)))).data,(await u.populateTransaction.setKey(ct.namehash(n),T)).data];try{await M2(y)}catch{throw window.alert(`You must connect to the ${_} network to continue. Please connect and try again.`),new Error(`${_} not set`)}const i1=await u.multicall(e1);N("Resetting Networking Information..."),await i1.wait(),r(!0),N(""),e(t),w("/set-password")}catch{N(""),alert("An error occurred, please try again.")}},[v,n,r,e,w,i,u,t,o,s,l,c,y,_]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx("h1",{className:"flex c mb-8",children:"Reset Kinode Name"}),openConnect:i,closeConnect:a,nodeChainId:y}),v?Q.jsx("form",{id:"signup-form",className:"flex flex-col",onSubmit:k,children:M?Q.jsx(sr,{msg:M}):Q.jsxs(Q.Fragment,{children:[Q.jsx(pu,{direct:t,setDirect:e}),Q.jsxs("button",{type:"submit",className:"self-stretch mt-2 text-2xl",children:["Reset ",n]}),Q.jsx(v4,{to:"/",className:"button alt mt-2",children:"Back"})]})}):Q.jsx("div",{children:"Please connect a wallet to continue."})]})}function jU({pw:t,setPw:e,openConnect:r,appSizeOnLoad:n,closeConnect:u,nodeChainId:i}){const[a,o]=n1.useState(""),[s,l]=n1.useState(""),[c,y]=n1.useState([]),[v,w]=n1.useState(""),[_,M]=n1.useState(!1),[N,k]=n1.useState(!1),[C,T]=n1.useState(!1);n1.useEffect(()=>{document.title="Import Keyfile"},[]);const z=n1.useCallback(e1=>{e1.preventDefault();const i1=e1.target.files[0];if(!i1)return;const o1=new FileReader;o1.onloadend=()=>{o(o1.result),l(i1.name)},o1.readAsText(i1)},[]),$=n1.useRef(null),Y=n1.useCallback(async e1=>{var i1;e1.preventDefault(),e1.stopPropagation(),(i1=$.current)==null||i1.click()},[]),J=n1.useCallback(async e1=>{e1.preventDefault(),e1.stopPropagation(),T(!0);try{if(c.length===0&&a!==""){let i1=pt(z0(t));if((await fetch("/vet-keyfile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keyfile:a,password_hash:i1})})).status>399)throw new Error("Incorrect password");if((await fetch("/import-keyfile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keyfile:a,password_hash:i1})})).status>399)throw new Error("Incorrect password");const X=setInterval(async()=>{const U=await fetch("/");U.status<300&&Number(U.headers.get("content-length"))!==n&&(clearInterval(X),window.location.replace("/"))},2e3)}}catch{window.alert("An error occurred, please try again."),T(!1)}},[a,t,c,n]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(fr,{header:Q.jsx("h1",{children:"Import Keyfile"}),openConnect:r,closeConnect:u,hideConnect:!0,nodeChainId:i}),C?Q.jsx(sr,{msg:"Setting up node..."}):Q.jsxs("form",{id:"signup-form",className:"flex flex-col max-w-[450px]",onSubmit:J,children:[Q.jsxs("div",{className:"flex flex-col self-start place-content-center w-full",children:[Q.jsxs("h4",{className:"my-2 flex",children:[" ","1. Upload Keyfile"," "]}),!!s&&Q.jsxs("h5",{className:"underline mb-2",children:[" ",s||".keyfile"," "]}),Q.jsxs("button",{type:"button",onClick:Y,children:[s?"Change":"Select"," Keyfile"]}),Q.jsx("input",{ref:$,className:"hidden",type:"file",onChange:z})]}),Q.jsxs("div",{className:"flex flex-col w-full",children:[Q.jsxs("h4",{className:"my-2 flex",children:[" ","2. Enter Password"," "]}),Q.jsx("input",{type:"password",id:"password",required:!0,minLength:6,name:"password",placeholder:"Min 6 characters",value:t,onChange:e1=>e(e1.target.value),className:"mb-2"}),v&&Q.jsxs("div",{className:"flex",children:[" ",Q.jsxs("p",{className:"text-red-500",children:[" ",v," "]})," "]}),N&&!_&&6<=t.length&&Q.jsxs("div",{className:"flex",children:[" ",Q.jsx("p",{className:"text-red-500",children:" Password is incorrect "})," "]})]}),Q.jsxs("div",{className:"flex flex-col w-full mb-2",children:[c.map((e1,i1)=>Q.jsx("span",{className:"key-err",children:e1},i1)),Q.jsx("button",{type:"submit",children:" Import Keyfile "})]}),Q.jsx("p",{className:"text-sm",children:'Please note: if the original node was booted as a direct node (static IP), then you must run this node from the same IP. If not, you will have networking issues. If you need to change the network options, please go back and select "Reset OsName".'})]})]})}var rn={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useProvider:zU}=Ut;function $U(){var b1,w1,L1,N1,_1,k1,O1;const t=zU(),e=Fx(),[r,n]=n1.useState(""),[u,i]=n1.useState(""),[a,o]=n1.useState(""),[s,l]=n1.useState(!1),[c,y]=n1.useState(!1),[v,w]=n1.useState(""),[_,M]=n1.useState(0),[N,k]=n1.useState(""),[C,T]=n1.useState(0),[z,$]=n1.useState(0),[Y,J]=n1.useState([]),[e1,i1]=n1.useState(""),[o1,S]=n1.useState(!1),[X,U]=n1.useState(!(e!=null&&e.initial)),[d,x]=n1.useState(!1),P=()=>x(!0),F=()=>x(!1),D=n1.useMemo(()=>{var S1;return((S1=t==null?void 0:t.network)==null?void 0:S1.chainId)===R1.SEPOLIA?rn.REACT_APP_SEPOLIA_RPC_URL:rn.REACT_APP_OPTIMISM_RPC_URL},[t]),[R,q]=n1.useState(ui.connect(((b1=t==null?void 0:t.network)==null?void 0:b1.chainId)===R1.SEPOLIA?I5[R1.SEPOLIA]:I5[R1.OPTIMISM],new je(D))),[b,f]=n1.useState(si.connect(((w1=t==null?void 0:t.network)==null?void 0:w1.chainId)===R1.SEPOLIA?zu[R1.SEPOLIA]:zu[R1.OPTIMISM],new je(D))),[m,B]=n1.useState(ai.connect(((L1=t==null?void 0:t.network)==null?void 0:L1.chainId)===R1.SEPOLIA?j5[R1.SEPOLIA]:j5[R1.MAINNET],new je(((N1=t==null?void 0:t.network)==null?void 0:N1.chainId)===R1.SEPOLIA?rn.REACT_APP_SEPOLIA_RPC_URL:rn.REACT_APP_MAINNET_RPC_URL))),[p,I]=n1.useState(oi.connect(((_1=t==null?void 0:t.network)==null?void 0:_1.chainId)===R1.SEPOLIA?z5[R1.SEPOLIA]:z5[R1.OPTIMISM],new je(D))),[L,V]=n1.useState(li.connect(((k1=t==null?void 0:t.network)==null?void 0:k1.chainId)===R1.SEPOLIA?R5[R1.SEPOLIA]:R5[R1.MAINNET],new je(D))),[G,r1]=n1.useState(ii.connect(((O1=t==null?void 0:t.network)==null?void 0:O1.chainId)===R1.SEPOLIA?L5[R1.SEPOLIA]:L5[R1.MAINNET],new je(D)));n1.useEffect(()=>M(window.performance.getEntriesByType("navigation")[0].transferSize),[]),n1.useEffect(()=>{(async()=>{try{const S1=await fetch("/info",{method:"GET"});if(S1.status>399)console.log("no info, unbooted");else{const e0=await S1.json();X&&(w(e0.name),J(e0.allowed_routers),S(!0),U(!1))}}catch{console.log("no info, unbooted")}try{const S1=await fetch("/current-chain",{method:"GET"});if(S1.status<400){const e0=await S1.json();i1(e0.toLowerCase()),console.log("Node Chain ID:",e0)}}catch{console.log("error getting current chain")}})()},[]),n1.useEffect(()=>S(!1),[X]),n1.useEffect(()=>{t==null||t.getNetwork().then(S1=>{S1.chainId===R1.SEPOLIA?(q(ui.connect(I5[R1.SEPOLIA],t.getSigner())),f(si.connect(zu[R1.SEPOLIA],t.getSigner())),B(ai.connect(j5[R1.SEPOLIA],t.getSigner())),I(oi.connect(z5[R1.SEPOLIA],t.getSigner())),V(li.connect(R5[R1.SEPOLIA],t.getSigner())),r1(ii.connect(L5[R1.SEPOLIA],t.getSigner()))):(S1.chainId===R1.OPTIMISM||S1.chainId===R1.MAINNET)&&(q(ui.connect(I5[R1.OPTIMISM],t.getSigner())),f(si.connect(zu[R1.OPTIMISM],t.getSigner())),I(oi.connect(z5[R1.OPTIMISM],t.getSigner())),B(ai.connect(j5[R1.MAINNET],t.getSigner())),V(li.connect(R5[R1.MAINNET],new je(rn.REACT_APP_MAINNET_RPC_URL))),r1(ii.connect(L5[R1.MAINNET],new je(rn.REACT_APP_MAINNET_RPC_URL))))})},[t]);const u1=R1.SEPOLIA,a1=R1.SEPOLIA,B1={direct:c,setDirect:y,key:u,keyFileName:a,setKeyFileName:o,reset:s,setReset:l,pw:r,setPw:n,knsName:v,setOsName:w,dotOs:R,kns:b,knsEnsEntryNetwork:u1,knsEnsExitNetwork:a1,knsEnsEntry:m,knsEnsExit:p,nameWrapper:L,ensRegistry:G,connectOpen:d,openConnect:P,closeConnect:F,provider:t,appSizeOnLoad:_,networkingKey:N,setNetworkingKey:k,ipAddress:C,setIpAddress:T,port:z,setPort:$,routers:Y,setRouters:J,nodeChainId:e1};return Q.jsxs(Q.Fragment,{children:[Q.jsx(m_,{...B1}),Q.jsx(Vx,{children:Q.jsxs(jx,{children:[Q.jsx(a6,{path:"/",element:o1?Q.jsx(Rx,{to:"/login",replace:!0}):Q.jsx(IU,{...B1})}),Q.jsx(a6,{path:"/claim-invite",element:Q.jsx(dU,{...B1})}),Q.jsx(a6,{path:"/register-name",element:Q.jsx(lU,{...B1})}),Q.jsx(a6,{path:"/register-eth-name",element:Q.jsx(oU,{...B1})}),Q.jsx(a6,{path:"/set-password",element:Q.jsx(hU,{...B1})}),Q.jsx(a6,{path:"/reset",element:Q.jsx(OU,{...B1})}),Q.jsx(a6,{path:"/reset-node",element:Q.jsx(LU,{...B1})}),Q.jsx(a6,{path:"/import-keyfile",element:Q.jsx(jU,{...B1})}),Q.jsx(a6,{path:"/login",element:Q.jsx(NU,{...B1})})]})})]})}const qU=[[q4,Ut]],HU=r3.createRoot(document.getElementById("root"));HU.render(Q.jsx(G6.StrictMode,{children:Q.jsx(ka.Web3ReactProvider,{connectors:qU,children:Q.jsx("div",{id:"signup-page",className:"flex flex-col place-items-center place-content-center h-screen w-screen",children:Q.jsx($U,{})})})})); diff --git a/kinode/src/register-ui/build/index.html b/kinode/src/register-ui/build/index.html index eaeb258fd..cd76bcb9e 100644 --- a/kinode/src/register-ui/build/index.html +++ b/kinode/src/register-ui/build/index.html @@ -11,7 +11,7 @@ - + diff --git a/kinode/src/register-ui/src/pages/ImportKeyfile.tsx b/kinode/src/register-ui/src/pages/ImportKeyfile.tsx index 9d4a852c9..d250f7d80 100644 --- a/kinode/src/register-ui/src/pages/ImportKeyfile.tsx +++ b/kinode/src/register-ui/src/pages/ImportKeyfile.tsx @@ -132,7 +132,7 @@ function ImportKeyfile({ headers: { "Content-Type": "application/json" }, body: JSON.stringify({ keyfile: localKey, - password: hashed_password, + password_hash: hashed_password, }), }); @@ -145,7 +145,7 @@ function ImportKeyfile({ headers: { "Content-Type": "application/json" }, body: JSON.stringify({ keyfile: localKey, - password: hashed_password, + password_hash: hashed_password, }), });