/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../has","../Logger","./utils","./tracking/Flags"],(function(t,e,n,r,i){"use strict";let c,o=[];const l=n.getLogger("esri.core.Accessor");function s(){o=[]}function a(t){void 0!==c&&c.onObservableAccessed(t)}let g=!1,u=!1;function f(t,e,n){if(g)return p(t,e,n);k(t);const r=e.call(n);return y(),r}function d(t,e){return f(void 0,t,e)}function p(t,e,n){const r=g;g=!0,k(t);let i=null;try{i=e.call(n)}catch(c){u&&l.error(c)}return y(),g=r,i}function k(t){c=t,o.push(t)}function y(){const t=o.pop();c=o.length>0?o[o.length-1]:void 0,void 0!==t&&t.onTrackingEnd()}function T(t,e){if(e.flags&i.Flags.DepTrackingInitialized)return;const n=u;u=!1,e.flags&i.Flags.AutoTracked?p(e,e.metadata.get,t):h(t,e),u=n}const A=[];function h(t,e){e.flags&i.Flags.ExplicitlyTracking||(e.flags|=i.Flags.ExplicitlyTracking,p(e,(()=>{const n=e.metadata.dependsOn||A;for(const e of n)if("string"!=typeof e||e.includes(".")){const n=r.pathToArray(e);for(let e=0,r=t;e<n.length&&null!=r&&"object"==typeof r;++e)r=v(r,n[e],e!==n.length-1)}else v(t,e,!1)})),e.flags&=~i.Flags.ExplicitlyTracking)}function v(t,e,n){const i="?"===e[e.length-1]?e.slice(0,-1):e;if(null!=t.getItemAt||Array.isArray(t)){const e=parseInt(i,10);if(!isNaN(e))return Array.isArray(t)?t[e]:t.getItemAt(e)}const c=r.getProperties(t),o=null==c?void 0:c.properties.get(i);return o&&(a(o),T(t,o)),n?t[i]:void 0}t.initializeDependencyTracking=T,t.resetGlobalTarget=s,t.runTracked=f,t.runTrackedNoThrow=p,t.runUntracked=d,t.trackAccess=a,t.trackExplicitDependencies=h,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
