"use strict";const n=require("./index-OO3WXYTB.js");function c(t,e){switch(t.binary){case"bytes":if("layout"in t){const{custom:r}=t;return r===void 0||typeof r.from!="function"?i(t.layout,r?r.from:e):e}case"int":case"uint":{const{custom:r}=t;return t!=null&&t.omit?void 0:n.isPrimitiveType(r)?r:n.isFixedPrimitiveConversion(r)?r.to:e}case"array":return Array.isArray(e)?e.map(r=>i(t.layout,r)):void 0;case"switch":{const r=e[t.idTag??"id"],[s,o]=t.layouts.find(([u])=>(Array.isArray(u)?u[1]:u)==r);return{[t.idTag??"id"]:r,...i(o,e)}}}}function i(t,e){if(e=e??{},n.isLayoutItem(t))return c(t,e);const r={};for(const s of t){const o=c(s,e[s.name]??{});o!==void 0&&(r[s.name]=o)}return r}function f(t,e){return i(t,e)}function d(t){return[...n.envelopeLayout,n.payloadLiteralToPayloadItemLayout(t)]}function a(t,e){const[r,s]=n.decomposeLiteral(t),o=f(d(t),e);return{protocolName:r,payloadName:s,payloadLiteral:t,...f(n.headerLayout,e),...o,hash:n.keccak_256(n.serializeLayout(d(t),o))}}exports.createVAA=a;
