/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{createProgramTemplate as r}from"./shaders/MaterialPrograms.js";class e{constructor(r){this._rctx=r,this._programByKey=new Map}dispose(){this._programByKey.clear()}getProgram(e,t=[]){const a=e.vsPath+"."+e.fsPath+JSON.stringify(t);if(this._programByKey.has(a))return this._programByKey.get(a);const s={...t.map(r=>"string"==typeof r?{name:r,value:!0}:r).reduce((r,e)=>({...r,[e.name]:e.value}),{})},{vsPath:o,fsPath:h,locations:g}=e,i=r(o,h,s),m=this._rctx.programCache.get(i.vertexShader,i.fragmentShader,g);if(!m)throw new Error("Unable to get program for key: ${key}");return this._programByKey.set(a,m),m}}export{e as default};
