/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{isTypedArray as e,isUint32Array as t}from"../../../../../core/typedArrayUtil.js";import{WorkerHandle as r}from"../../../../../core/workers/WorkerHandle.js";import{unpackInterleavedBuffer as n}from"../../../support/buffer/workerHelper.js";import{extract as s}from"./edgeProcessing.js";class a extends r{constructor(e){super("EdgeProcessingWorker","extract",{extract:e=>[e.dataBuffer],extractComponentsEdgeLocations:e=>[e.dataBuffer],extractEdgeLocations:e=>[e.dataBuffer]},e)}async process(e,t,r){if(r)return s(e);return i(await this.invoke(new o(e),t))}async extractEdgeLocations(e,t){const r=await this.invokeMethod("extractEdgeLocations",new o(e),t);return n(r)}async extractComponentsEdgeLocations(e,t){const r=await this.invokeMethod("extractComponentsEdgeLocations",new o(e),t);return n(r)}}function i(e){return{regular:{instancesData:n(e.regular.instancesData),lodInfo:{lengths:new Float32Array(e.regular.lodInfo.lengths)}},silhouette:{instancesData:n(e.silhouette.instancesData),lodInfo:{lengths:new Float32Array(e.silhouette.lodInfo.lengths)}},averageEdgeLength:e.averageEdgeLength}}class o{constructor(r){this.dataBuffer=r.data.buffer,this.writerSettings=r.writerSettings,this.skipDeduplicate=r.skipDeduplicate,this.indices=e(r.indices)?r.indices.buffer:r.indices,this.indicesType=e(r.indices)?t(r.indices)?"Uint32Array":"Uint16Array":"Array",this.indicesLength=r.indicesLength}}export{a as EdgeWorkerHandle,o as PackedInput};
