import{isWebMap as t,isWebScene as a}from"../utilities/mapping.js";export async function jsonToTable(t){return(await import("../portal/Table.js")).toEsriApiTable(t)}export async function applyJsonToTable(t,a){t&&Object.keys(t).some((t=>"$ref"!==t))&&await(await import("../portal/Table.js")).applyToEsriTable(t,a)}export function tableToJson(e){const{parent:o}=e;if(t(o)||a(o)){const t=o.toJSON();if(null!=t.tables)return t.tables.find((t=>t.id===e.id))}return e.write({},{layerContainerType:"tables",origin:"web-map"})}