/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
class e{constructor(e,E,t,T,r,_,i,u,n){this.createQuery=e,this.deleteQuery=E,this.resultAvailable=t,this.getResult=T,this.disjoint=r,this.beginTimeElapsed=_,this.endTimeElapsed=i,this.createTimestamp=u,this.timestampBits=n}}let E=!1;function t(t,T){if(T.disjointTimerQuery)return null;let r=t.getExtension("EXT_disjoint_timer_query_webgl2");return r?new e(()=>t.createQuery(),e=>{t.deleteQuery(e),E=!1},e=>t.getQueryParameter(e,t.QUERY_RESULT_AVAILABLE),e=>t.getQueryParameter(e,t.QUERY_RESULT),()=>t.getParameter(r.GPU_DISJOINT_EXT),e=>{E||(E=!0,t.beginQuery(r.TIME_ELAPSED_EXT,e))},()=>{t.endQuery(r.TIME_ELAPSED_EXT),E=!1},e=>r.queryCounterEXT(e,r.TIMESTAMP_EXT),()=>t.getQuery(r.TIMESTAMP_EXT,r.QUERY_COUNTER_BITS_EXT)):(r=t.getExtension("EXT_disjoint_timer_query"),r?new e(()=>r.createQueryEXT(),e=>{r.deleteQueryEXT(e),E=!1},e=>r.getQueryObjectEXT(e,r.QUERY_RESULT_AVAILABLE_EXT),e=>r.getQueryObjectEXT(e,r.QUERY_RESULT_EXT),()=>t.getParameter(r.GPU_DISJOINT_EXT),e=>{E||(E=!0,r.beginQueryEXT(r.TIME_ELAPSED_EXT,e))},()=>{r.endQueryEXT(r.TIME_ELAPSED_EXT),E=!1},e=>r.queryCounterEXT(e,r.TIMESTAMP_EXT),()=>r.getQueryEXT(r.TIMESTAMP_EXT,r.QUERY_COUNTER_BITS_EXT)):null)}export{e as DisjointTimerQuery,t as createDisjointTimerQuery,E as hasRunningElapsedTimer};
