import t from"@arcgis/core/Graphic";import{checkArg as e}from"../utilities/checkArg.js";const i="graphic-visible",r="graphic-popup-template";export function jsonToGraphic(s){e("featureJson",s).isNotMissing();const o={...s};let a=!0;o.attributes?.hasOwnProperty(i)&&(a=o.attributes[i]),o.attributes?.hasOwnProperty(r)&&(o.popupInfo=o.attributes[r]);const p=t.fromJSON(o);return p.visible=a,delete p.attributes[i],delete p.attributes[r],p}export function graphicToJson(t){e("graphic",t).isNotMissing();const r=t.toJSON();return null==r.attributes&&(r.attributes={}),r.attributes[i]=t.visible,delete r.popupTemplate,delete r.aggregateGeometries,r}