const t=t=>typeof t,e=t(""),r=t(!0),n=t(0),o="type",s="default",c="null",l="anyOf",u=t=>(e,r,n)=>t(e)?n?.():r(e),f=t=>null==t,p=u(f),a=u(t=>void 0===t),y=Object,i=t=>y.getPrototypeOf(t),h=y.entries,m=y.keys,d=y.freeze,v=(t=[])=>y.fromEntries(t),O=(t,e)=>((t,e)=>t.forEach(e))(h(t),([t,r])=>e(r,t)),b=(t,e,r)=>{if(t?.[l]){const r=t[l],o=r.some(t=>t?.type===c),u=(n=t=>t?.type!==c,r.find(n));if(o&&u)return b(u,e??t?.[s],!0)}var n;return[t,e??t?.[s],r??!1]},g=t=>t?.properties,E=()=>((t,c)=>{const l=c=>{const[l,u,f]=t(c),p=l?.type;if(p!==e&&p!==n&&p!==r)return;const y={[o]:p};return a(u,t=>{y[s]=t}),f&&(y.allowNull=!0),y};return d({toTablesSchema:t=>{const e=v();return O(t,(t,r)=>{const n=v();var o;a(c(t),t=>O(t,(t,e)=>a(l(t),t=>{n[e]=t}))),(t=>!f(t)&&p(i(t),t=>t==y.prototype||f(i(t)),()=>!0))(o=n)&&0==(t=>m(t).length)(o)||(e[r]=n)}),e},toValuesSchema:t=>{const e=v();return O(t,(t,r)=>a(l(t),t=>{e[r]=t})),e}})})(b,g);export{E as createTypeBoxSchematizer};
