/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
function t(t){return t.split(" ").map((t,e)=>e>0?t.charAt(0).toUpperCase()+t.slice(1):t).join("")}function e(t,e){const s=[];for(s.push(e);s.length;){const e=s.pop();if("object"==typeof e&&!t.has(e.uid)){t.add(e.uid);for(const t of e.children)s.push(t)}}}class s{constructor(){this.uid=s.NodeCount++,this._debugName=null,this._isMutable=!1,this.isImplicit=!1}static{this.NodeCount=0}get isMutable(){return this._isMutable}setMutable(){return this._isMutable=!0,this}setDebugName(e){return e=t(e),this._debugName=e,this.isImplicit&&this.children[0]instanceof s&&this.children[0].setDebugName(e),this}get debugInfo(){return{name:this._debugName??""}}cloneInto(t){t._debugName=this._debugName,t._isMutable=this._isMutable,t.isImplicit=this.isImplicit,t.uid=this.uid}}function i(t){return"object"==typeof t?t.clone():t}class r extends s{constructor(){super(...arguments),this.shaderType="primitive-node"}}class n extends s{constructor(t){super(),this.child=t,this.shaderType="scope-node"}get children(){return[this.child]}clone(){const t=new n(i(this.child));return this.cloneInto(t),t}}class h extends s{constructor(t){super(),this.text=t,this.shaderType="text-node"}get children(){return[]}clone(){const t=new h(this.text);return this.cloneInto(t),t}}class c extends s{constructor(t,e,s){super(),this.property=t,this.target=e,this.returnType=s,this.shaderType="property-access-node"}get children(){const t=[this.target];return"string"!=typeof this.property&&t.push(this.property),t}clone(){const t=new c(this.property,i(this.target),this.returnType);return this.cloneInto(t),t}}class o extends s{constructor(t,e,s,i){super(),this.x=t,this.y=e,this.target=s,this.returnType=i,this.shaderType="property-access-2d-node"}get children(){return[this.target,this.x,this.y]}clone(){const t=new o(this.x,this.y,i(this.target),this.returnType);return this.cloneInto(t),t}}class u extends s{constructor(t,e,s){super(),this.condition=t,this.ifTrue=e,this.ifFalse=s,this.shaderType="condition-node"}get children(){return[this.condition,this.ifTrue,this.ifFalse]}clone(){const t=i(this.ifTrue),e=this.ifFalse?i(this.ifFalse):null,s=new u(this.condition,t,e);return this.cloneInto(s),s}}class p extends s{constructor(t,e,s,i){super(),this.captureList=t,this.returnType=e,this.generator=i,this.shaderType="block-node",s&&(this.subgraph=new n(s))}get children(){return Object.keys(this.captureList).map(t=>this.captureList[t]).concat(this.subgraph??[])}clone(){const t={};for(const s in this.captureList)t[s]=i(this.captureList[s]);const e=new p(t,this.returnType,this.subgraph?i(this.subgraph.child):this.subgraph,this.generator);return this.cloneInto(e),e}}class a extends s{constructor(t,e,s,i,r,n=!1){super(),this.token=t,this._children=e,this.isInfix=s,this.isPropertyAccess=i,this.returnType=r,this.isTernary=n,this.shaderType="function-node"}get children(){return this._children}clone(){const t=new a(this.token,this._children.map(i),this.isInfix,this.isPropertyAccess,this.returnType,this.isTernary);return this.cloneInto(t),t}}export{p as ShaderBlockNode,u as ShaderConditionNode,a as ShaderFunctionNode,s as ShaderNode,r as ShaderPrimitiveNode,o as ShaderPropertyAccess2DNode,c as ShaderPropertyAccessNode,n as ShaderScopeNode,h as ShaderTextNode,i as cloneShaderNode,e as setReachableUids};
