import{BasG,sasxe,kasA,cas$,easK,tasX,naset,iastt,Iasnt,basj,dasst,fasV,hasit,jasp,lasq}from"./index-CBcRH9LY.js";constat=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,rt=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;classctextendsG{constructor({domain:t}){super(`Invalid domain "${xe(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}classotextendsG{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}classutextendsG{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}functiondt(e){const{domain:t={},message:n,primaryType:s}=e,c={EIP712Domain:Et({domain:t}),...e.types};ht({domain:t,message:n,primaryType:s,types:c});consti=["0x1901"];returnt&&i.push(lt({domain:t,types:c})),s!=="EIP712Domain"&&i.push(Q({data:n,primaryType:s,types:c})),A($(i))}functionlt({domain:e,types:t}){returnQ({data:e,primaryType:"EIP712Domain",types:t})}functionQ({data:e,primaryType:t,types:n}){consts=z({data:e,primaryType:t,types:n});returnA(s)}functionz({data:e,primaryType:t,types:n}){consts=[{type:"bytes32"}],c=[ft({primaryType:t,types:n})];for(constiofn[t]){const[u,l]=Y({types:n,name:i.name,type:i.type,value:e[i.name]});s.push(u),c.push(l)}returnK(s,c)}functionft({primaryType:e,types:t}){constn=X(gt({primaryType:e,types:t}));returnA(n)}functiongt({primaryType:e,types:t}){letn="";consts=J({primaryType:e,types:t});s.delete(e);constc=[e,...Array.from(s).sort()];for(constiofc)n+=`${i}(${t[i].map(({name:u,type:l})=>`${l}${u}`).join(",")})`;returnn}functionJ({primaryType:e,types:t},n=newSet){consts=e.match(/^\w*/u),c=s==null?void0:s[0];if(n.has(c)||t[c]===void0)returnn;n.add(c);for(constioft[c])J({primaryType:i.type,types:t},n);returnn}functionY({types:e,name:t,type:n,value:s}){if(e[n]!==void0)return[{type:"bytes32"},A(z({data:s,primaryType:n,types:e}))];if(n==="bytes")returns=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},A(s)];if(n==="string")return[{type:"bytes32"},A(X(s))];if(n.lastIndexOf("]")===n.length-1){constc=n.slice(0,n.lastIndexOf("[")),i=s.map(u=>Y({name:t,type:c,types:e,value:u}));return[{type:"bytes32"},A(K(i.map(([u])=>u),i.map(([,u])=>u)))]}return[{type:n},s]}functionht(e){const{domain:t,message:n,primaryType:s,types:c}=e,i=(u,l)=>{for(consthofu){const{name:v,type:f}=h,E=l[v],D=f.match(rt);if(D&&(typeofE=="number"||typeofE=="bigint")){const[B,S,H]=D;et(E,{signed:S==="int",size:Number.parseInt(H)/8})}if(f==="address"&&typeofE=="string"&&!tt(E))thrownewnt({address:E});constw=f.match(at);if(w){const[B,S]=w;if(S&&j(E)!==Number.parseInt(S))thrownewst({expectedSize:Number.parseInt(S),givenSize:j(E)})}constP=c[f];P&&(yt(f),i(P,E))}};if(c.EIP712Domain&&t){if(typeoft!="object")thrownewct({domain:t});i(c.EIP712Domain,t)}if(s!=="EIP712Domain")if(c[s])i(c[s],n);elsethrownewot({primaryType:s,types:c})}functionEt({domain:e}){return[typeof(e==null?void0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void0:e.version)&&{name:"version",type:"string"},typeof(e==null?void0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}functionyt(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))thrownewut({type:e})}const_t=`Ethereum Signed Message: