/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
function e(e){return t(e,"",new Set,new Map)}function t(e,s,n,r){if(n.has(e))return r;n.add(e),s&&e.id&&r.set(s,e);for(const a of e.properties)if("string"!=typeof a.type){const e=s?`${s}.${a.name}`:a.name;t(a.type,e,n,r)}return n.delete(e),r}function s(e){const t=n(e,"",[]);return t.sort((e,t)=>(e.name??"").localeCompare(t.name??"")),t}function n(e,t,s){for(const r of e.properties){const e=t?`${t}.${r.name}`:r.name;"string"==typeof r.type?s.push({name:e,type:r.type,default:r.default,enum:r.enum}):0===r.type.properties.length?s.push({name:e,type:"unknown",default:r.default,enum:r.enum}):n(r.type,e,s)}return s}class r{constructor(){this.stack=[],this.seen=new Map,this._uniqueDeclaredClasses=new Map}[Symbol.dispose](){this.seen.clear(),this.stack.length=0,this._uniqueDeclaredClasses.clear()}getDeclaredClass(e){const{_uniqueDeclaredClasses:t}=this,s=e.prototype.declaredClass.replaceAll(".","/");let n=0;for(;;){const r=n?`${s}/${n}`:s;n++;const a=t.get(r);if(!a)return t.set(r,e),r;if(a===e)return r}}addProperty(e){this.currentClass?.properties.push(e)}push(e,t){this.seen.set(t.id,t),this.stack.push({klass:t,propertyName:e})}pop(){return this.stack.pop()?.klass??null}get currentClass(){return this.stack.length?this.stack[this.stack.length-1].klass:null}get pathString(){return this.stack.map(e=>e.propertyName).filter(e=>!!e).join(".")}}function a(e){const t=e.slice();return t.sort(),t}export{r as ScanContext,e as collectClassPaths,s as flatten,a as sorted};
