{"version":3,"file":"index.mjs","sources":["../../../../packages/overlay/polygon/index.ts"],"sourcesContent":["import { defineComponent, onBeforeMount, onUnmounted } from \"vue\";\nimport { useMapRoot } from \"~/use/mapRoot\";\nimport { useEvent } from \"~/use/event\";\nimport { EVENTS, NATIVE_EVENTS, PROPS, useInit, useWatch } from \"./use\";\n\nexport const TdtPolygon = defineComponent({\n  name: \"TdtPolygon\",\n  props: PROPS,\n  emits: EVENTS,\n  setup(props, { emit }) {\n    onBeforeMount(async () => {\n      onUnmounted(() => tdtComponent && tdtMap?.removeOverLay(tdtComponent));\n\n      const tdtMap = await useMapRoot();\n      const tdtComponent = useInit(props);\n      tdtMap.addOverLay(tdtComponent);\n      useEvent({ events: NATIVE_EVENTS, emit, instance: tdtComponent, extData: props.extData });\n      useWatch({ props, instance: tdtComponent });\n      emit(\"init\", tdtComponent);\n    });\n\n    return () => {};\n  }\n});\n\nexport type TdtPolygonInstance = InstanceType<typeof TdtPolygon>;\n"],"names":["TdtPolygon","defineComponent","PROPS","EVENTS","props","emit","onBeforeMount","onUnmounted","tdtComponent","tdtMap","useMapRoot","useInit","useEvent","NATIVE_EVENTS","useWatch"],"mappings":";;;;;;AAKO,MAAMA,IAAaC,EAAgB;AAAA,EACxC,MAAM;AAAA,EACN,OAAOC;AAAA,EACP,OAAOC;AAAA,EACP,MAAMC,GAAO,EAAE,MAAAC,KAAQ;AACrB,WAAAC,EAAc,YAAY;AACxB,MAAAC,EAAY,MAAMC,MAAgBC,KAAA,gBAAAA,EAAQ,cAAcD,GAAa;AAE/D,YAAAC,IAAS,MAAMC,EAAW,GAC1BF,IAAeG,EAAQP,CAAK;AAClC,MAAAK,EAAO,WAAWD,CAAY,GACrBI,EAAA,EAAE,QAAQC,GAAe,MAAAR,GAAM,UAAUG,GAAc,SAASJ,EAAM,SAAS,GACxFU,EAAS,EAAE,OAAAV,GAAO,UAAUI,EAAA,CAAc,GAC1CH,EAAK,QAAQG,CAAY;AAAA,IAAA,CAC1B,GAEM,MAAM;AAAA,IAAC;AAAA,EAAA;AAElB,CAAC;"}