import { SHJDatasourceV2 as t } from "../../datasource/index.mjs";
import { EventUtils as r } from "../utils/utils.mjs";
const c = (e, a) => {
  try {
    if (e.dataType === "params") {
      const n = r.toStringify(a);
      window.SHJSceneUnityIframeInstance.ref && window.SHJSceneUnityIframeInstance.ref.contentWindow.postMessage(
        {
          object: e.objectName,
          function: e.functionName,
          data: n
        },
        window.SHJSceneUnityIframeInstance.url
      );
      return;
    }
    if (!e.useDataSource)
      return;
    t.parse({
      sources: [e.useDataSource],
      noUseMapping: !0,
      isInterval: !1,
      callback: (n) => {
        window.SHJSceneUnityIframeInstance.ref && window.SHJSceneUnityIframeInstance.ref.contentWindow.postMessage(
          {
            object: e.objectName,
            function: e.functionName,
            data: n
          },
          window.SHJSceneUnityIframeInstance.url
        );
      }
    });
  } catch {
  }
};
export {
  c as executeUnityIframeExecMethodAction
};
