/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as o}from"tslib";import t from"./Accessor.js";import"./has.js";import{tryClone as s}from"./lang.js";import"./Logger.js";import{assertIsSome as e}from"./maybe.js";import{getProperties as n}from"./accessorSupport/utils.js";import{subclass as r}from"./accessorSupport/decorators/subclass.js";const c=Symbol("ClonableMixin");function i(o){return o&&"object"==typeof o&&c in o}const l=t=>{var i;const l=t;let f=class extends l{constructor(){super(...arguments),this[i]=!0}static{i=c}clone(o){const t=n(this);e(t,"unable to clone instance of non-accessor class");const r=t.metadata,c=t.store,i={},l=new Map;for(const e in r){const t=r[e],n=c?.originOf(e),f=t.clonable;if(t.readOnly||!1===f||7!==n&&0!==n&&5!==n&&4!==n)continue;const a=this[e];let p=null;if("function"==typeof f)p=f(a,o);else if("reference"===f)p=a;else if(p=s(a,o),null!=a&&null==p)continue;0===n?l.set(e,p):i[e]=p}const f=new(0,Object.getPrototypeOf(this).constructor)(i);if(l.size){const o=n(f)?.store;if(o)for(const[t,s]of l)o.set(t,s,0)}return f}};return f=o([r("esri.core.Clonable")],f),f},f=l(t);export{f as Clonable,l as ClonableMixin,i as isClonableMixin};
