import { defineComponent, createBlock, openBlock, unref } from "vue";
import { IconCameraSwitch } from "@tencentcloud/uikit-base-component-vue3";
import { useDeviceState, MirrorType } from "tuikit-atomicx-vue3/room";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  setup(__props) {
    const { isFrontCamera, switchCamera, localMirrorType, switchMirror } = useDeviceState();
    let lastLocalFrontCameraMirror = isFrontCamera.value ? localMirrorType.value : MirrorType.Auto;
    const handleSwitchCamera = async () => {
      await switchCamera({ isFrontCamera: !isFrontCamera.value });
      const newIsFrontCamera = isFrontCamera.value;
      if (newIsFrontCamera) {
        await switchMirror({ mirror: lastLocalFrontCameraMirror });
      } else {
        lastLocalFrontCameraMirror = localMirrorType.value;
        await switchMirror({ mirror: MirrorType.Disable });
      }
    };
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(IconCameraSwitch), {
        size: "20",
        onClick: handleSwitchCamera
      });
    };
  }
});
export {
  _sfc_main as default
};
