function e(e,t){return{type:`object`,properties:e,...t&&t.length>0?{required:t}:{}}}function t(t,n,r){return{message:t,schema:e(n,r)}}const n={text(e,t){return{type:`string`,title:e,...t?.description!==void 0&&{description:t.description},...t?.minLength!==void 0&&{minLength:t.minLength},...t?.maxLength!==void 0&&{maxLength:t.maxLength},...t?.default!==void 0&&{default:t.default}}},select(e,t,n){return{type:`string`,title:e,enum:t,...n?.description!==void 0&&{description:n.description},...n?.enumNames!==void 0&&{enumNames:n.enumNames},...n?.default!==void 0&&{default:n.default}}},multi(e,t,n){return{type:`array`,title:e,items:{type:`string`,enum:t},uniqueItems:!0,...n?.description!==void 0&&{description:n.description}}},confirm(e,t){return{type:`boolean`,title:e,...t?.description!==void 0&&{description:t.description},...t?.default!==void 0&&{default:t.default}}},number(e,t){return{type:t?.integer?`integer`:`number`,title:e,...t?.description!==void 0&&{description:t.description},...t?.minimum!==void 0&&{minimum:t.minimum},...t?.maximum!==void 0&&{maximum:t.maximum},...t?.default!==void 0&&{default:t.default}}}},r=new Set([`accept`,`decline`,`cancel`]);function i(e){if(!e)return{action:`cancel`};let t=r.has(e.action)?e.action:`cancel`;if(t!==`accept`||!e.content)return{action:t};let n={};for(let[t,r]of Object.entries(e.content))(typeof r==`string`||typeof r==`number`||typeof r==`boolean`||Array.isArray(r)&&r.every(e=>typeof e==`string`))&&(n[t]=r);return{action:t,content:n}}export{t as buildElicitRequest,e as buildFormSchema,n as field,i as normalizeResponse};