/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","./utils"],(function(e,n){"use strict";function t(e){const n=p(e),t=[],i=a(n),s={};o("api","",e.api,n,i.api,s);const r={};o("spec","",e.spec,n,i.spec,r);const u=c(n);for(const o in s){const e=s[o],n=r[o],i=u[e.container.id],a=`${e.container.name} (${n.container.name})${e.container.typeValue?` <${e.container.typeValue}>`:""}`;t.push({name:a,api:e,spec:n,indent:i})}return t}function i(e,n,t,a,c,p,r,u,l){if(r.has(a))return l;for(const f of a.properties){const d=n?`${n}.${f.name}`:f.name,m=t?`${t}.${f.name}`:f.name,y=c[m];if(y){const n=p[y[e].id];l.push({name:d,type:"ref",ref:y,refName:n}),o(e,m,y[e],c,p,u)}else"string"==typeof f.type?l.push(s(d,f)):(r.add(a),i(e,d,m,f.type,c,p,r,u,l))}return r.delete(a),l}function o(e,n,t,o,a,c){if(t.id in c)return c;const p={container:t,text:null,props:[]};return a[t.id].forEach((e=>c[e]=p)),i(e,"",n,t,o,a,new Set,c,p.props),p.props.sort(r),c}function a(e){const n={api:{},spec:{}};for(const t in e){const i=e[t],o=`${i.api.name} (${i.spec.name})${i.api.typeValue?` <${i.api.typeValue}>`:""}`;let a=n.api[i.api.id];a||(a=new Set,n.api[i.api.id]=a),a.add(o);let c=n.spec[i.spec.id];c||(c=new Set,n.spec[i.spec.id]=c),c.add(o)}return n}function c(e){const n={};for(const t in e){const i=t?t.split(".").length:0,o=e[t].api.id;n[o]=o in n?Math.min(i,n[o]):i}return n}function p(e){const t=n.collectClassPaths(e.api),i=n.collectClassPaths(e.spec),o={};o[""]={api:e.api,spec:e.spec};for(const n in t){const e=i[n];if(e){const i=t[n];o[n]={api:i,spec:e}}}return o}function s(e,n){return{name:e,type:n.enum||("string"==typeof n.type?n.type:""),default:JSON.stringify(n.default)}}function r(e,n){const t=e.name.localeCompare(n.name);if(0!==t)return t;const i=(e.type||"").localeCompare(n.type||"");return 0!==i?i:(e.default||"").localeCompare(n.default||"")}e.collect=t,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
