{"version":3,"file":"index.mjs","sources":["../../../../packages/overlay/cloudMarkerCollection/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 TdtCloudMarkerCollection = defineComponent({\n  name: \"TdtCloudMarkerCollection\",\n  props: PROPS,\n  emits: EVENTS,\n  setup(props, { emit }) {\n    onBeforeMount(async () => {\n      onUnmounted(() => {\n        tdtComponent?.clear();\n        if (tdtComponent) {\n          tdtMap?.removeOverLay(tdtComponent);\n        }\n      });\n\n      const tdtMap = await useMapRoot();\n      const tdtComponent = useInit(props);\n      tdtMap.addOverLay(tdtComponent);\n      useEvent({ events: NATIVE_EVENTS, emit, instance: tdtComponent });\n      useWatch({ props, instance: tdtComponent });\n      emit(\"init\", tdtComponent);\n    });\n\n    return () => {};\n  }\n});\n\nexport type TdtCloudMarkerCollectionInstance = InstanceType<typeof TdtCloudMarkerCollection>;\n"],"names":["TdtCloudMarkerCollection","defineComponent","PROPS","EVENTS","props","emit","onBeforeMount","onUnmounted","tdtComponent","tdtMap","useMapRoot","useInit","useEvent","NATIVE_EVENTS","useWatch"],"mappings":";;;;;;AAKO,MAAMA,IAA2BC,EAAgB;AAAA,EACtD,MAAM;AAAA,EACN,OAAOC;AAAA,EACP,OAAOC;AAAA,EACP,MAAMC,GAAO,EAAE,MAAAC,KAAQ;AACrB,WAAAC,EAAc,YAAY;AACxB,MAAAC,EAAY,MAAM;AAChB,QAAAC,KAAA,QAAAA,EAAc,SACVA,MACFC,KAAA,QAAAA,EAAQ,cAAcD;AAAA,MACxB,CACD;AAEK,YAAAC,IAAS,MAAMC,EAAW,GAC1BF,IAAeG,EAAQP,CAAK;AAClC,MAAAK,EAAO,WAAWD,CAAY,GAC9BI,EAAS,EAAE,QAAQC,GAAe,MAAAR,GAAM,UAAUG,GAAc,GAChEM,EAAS,EAAE,OAAAV,GAAO,UAAUI,EAAA,CAAc,GAC1CH,EAAK,QAAQG,CAAY;AAAA,IAAA,CAC1B,GAEM,MAAM;AAAA,IAAC;AAAA,EAAA;AAElB,CAAC;"}