import t from"@arcgis/core/portal/PortalItem";import{config as r}from"../config.js";export var Item;!function(o){o.fromEsriApiPortalItem=function(t){const o=t.toJSON();if(t.portal)for(const a of r.portals.keys())if(r.portals.get(a)===t.portal){o.$portal=a;break}return o},o.toEsriApiPortalItem=function(o){const a=t.fromJSON(o);if(o.$portal){if(!r.portals.has(o.$portal))throw new Error(`Portal with ID '${o.$portal}' must be configured through @vertigis/arcgis-extensions/config.`);a.portal=r.portals.get(o.$portal)}return a}}(Item||(Item={}));