{"version":3,"file":"index.mjs","sources":["../../../../packages/overlay/cloudMarkerCollection/index.ts"],"sourcesContent":["import { defineComponent, onBeforeMount, onUnmounted } from \"vue\";\r\nimport { useMapRoot } from \"~/use/mapRoot\";\r\nimport { useEvent } from \"~/use/event\";\r\nimport { EVENTS, NATIVE_EVENTS, PROPS, useInit, useWatch } from \"./use\";\r\n\r\nexport const TdtCloudMarkerCollection = defineComponent({\r\n  name: \"TdtCloudMarkerCollection\",\r\n  props: PROPS,\r\n  emits: EVENTS,\r\n  setup(props, { emit }) {\r\n    onBeforeMount(async () => {\r\n      onUnmounted(() => {\r\n        tdtComponent?.clear();\r\n        if (tdtComponent) {\r\n          tdtMap?.removeOverLay(tdtComponent);\r\n        }\r\n      });\r\n\r\n      const tdtMap = await useMapRoot();\r\n      const tdtComponent = useInit(props);\r\n      tdtMap.addOverLay(tdtComponent);\r\n      useEvent({ events: NATIVE_EVENTS, emit, instance: tdtComponent });\r\n      useWatch({ props, instance: tdtComponent });\r\n      emit(\"init\", tdtComponent);\r\n    });\r\n\r\n    return () => {};\r\n  }\r\n});\r\n\r\nexport type TdtCloudMarkerCollectionInstance = InstanceType<typeof TdtCloudMarkerCollection>;\r\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;"}