"use weex:vue";

if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
  Promise.prototype.finally = function(callback) {
    const promise = this.constructor
    return this.then(
      value => promise.resolve(callback()).then(() => value),
      reason => promise.resolve(callback()).then(() => {
        throw reason
      })
    )
  }
};

if (typeof uni !== 'undefined' && uni && uni.requireGlobal) {
  const global = uni.requireGlobal()
  ArrayBuffer = global.ArrayBuffer
  Int8Array = global.Int8Array
  Uint8Array = global.Uint8Array
  Uint8ClampedArray = global.Uint8ClampedArray
  Int16Array = global.Int16Array
  Uint16Array = global.Uint16Array
  Int32Array = global.Int32Array
  Uint32Array = global.Uint32Array
  Float32Array = global.Float32Array
  Float64Array = global.Float64Array
  BigInt64Array = global.BigInt64Array
  BigUint64Array = global.BigUint64Array
};


(() => {
  var __create = Object.create;
  var __defProp = Object.defineProperty;
  var __defProps = Object.defineProperties;
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  var __getOwnPropNames = Object.getOwnPropertyNames;
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  var __getProtoOf = Object.getPrototypeOf;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __spreadValues = (a, b) => {
    for (var prop in b || (b = {}))
      if (__hasOwnProp.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    if (__getOwnPropSymbols)
      for (var prop of __getOwnPropSymbols(b)) {
        if (__propIsEnum.call(b, prop))
          __defNormalProp(a, prop, b[prop]);
      }
    return a;
  };
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
  var __commonJS = (cb, mod) => function __require() {
    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  };
  var __copyProps = (to, from, except, desc) => {
    if (from && typeof from === "object" || typeof from === "function") {
      for (let key of __getOwnPropNames(from))
        if (!__hasOwnProp.call(to, key) && key !== except)
          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
    }
    return to;
  };
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
    // If the importer is in node compatibility mode or this is not an ESM
    // file that has been converted to a CommonJS file using a Babel-
    // compatible transform (i.e. "__esModule" has not been set), then set
    // "default" to the CommonJS "module.exports" for node compatibility.
    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
    mod
  ));
  var __async = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };

  // vue-ns:vue
  var require_vue = __commonJS({
    "vue-ns:vue"(exports, module) {
      module.exports = Vue;
    }
  });

  // D:/WebstormProjects/oa-base/unpackage/dist/dev/.nvue/pages/index/index.js
  var import_vue = __toESM(require_vue());
  function formatAppLog(type, filename, ...args) {
    if (uni.__log__) {
      uni.__log__(type, filename, ...args);
    } else {
      console[type].apply(console, [...args, filename]);
    }
  }
  var env = "dev";
  var configs = {
    dev: {
      apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend",
      h5Url: "http://192.168.88.37:8080/#/"
    },
    test: {
      apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend",
      h5Url: "http://172.16.100.93:8041/#/"
    },
    prod: {
      apiBaseUrl: "https://oa-a.szjixun.cn/api",
      h5Url: "https://oa-a.szjixun.cn/#/"
    }
  };
  var config = configs[env];
  var sendWebWiew = (refValue, paramValue, callName = "onReceive") => {
    if (!refValue) {
      formatAppLog("error", "at utils/communicate/index.js:3", "evalJs: The reference to the webview is not provided or is null.");
      return;
    }
    if (typeof refValue.evalJs !== "function") {
      formatAppLog("error", "at utils/communicate/index.js:8", "evalJs: The evalJs method is not available on the provided reference.");
      return;
    }
    try {
      const jsonString = JSON.stringify(paramValue);
      const jsCode = `window.${callName}(${jsonString})`;
      refValue.evalJs(jsCode);
    } catch (error) {
      formatAppLog("error", "at utils/communicate/index.js:18", "evalJs: An error occurred while trying to stringify the parameter value or while invoking evalJs.", error);
    }
  };
  var receiveWebView = (e) => {
    return e.detail.data[0];
  };
  var _style_0 = { "content": { "": { "display": "flex", "flex": 1 } } };
  var _export_sfc = (sfc, props) => {
    const target = sfc.__vccOpts || sfc;
    for (const [key, val] of props) {
      target[key] = val;
    }
    return target;
  };
  var _sfc_main = {
    __name: "index",
    setup(__props) {
      const webViewRef = (0, import_vue.ref)(null);
      const systemInfo = uni.getSystemInfoSync();
      const webLoad = (e) => {
        const m = receiveWebView(e);
        switch (m.action) {
          case "load-complete": {
            const systemInfo2 = uni.getSystemInfoSync();
            uni.getLocation({
              type: "gcj02",
              geocode: false,
              isHighAccuracy: false,
              success: (res) => __async(this, null, function* () {
                sendWebWiew(webViewRef.value, __spreadProps(__spreadValues({}, res), { systemInfo: systemInfo2 }));
              }),
              fail: (e2) => {
                formatAppLog("log", "at pages/index/index.nvue:38", e2);
              }
            });
          }
        }
      };
      return (_ctx, _cache) => {
        return (0, import_vue.openBlock)(), (0, import_vue.createElementBlock)("scroll-view", {
          scrollY: true,
          showScrollbar: true,
          enableBackToTop: true,
          bubble: "true",
          style: { flexDirection: "column" }
        }, [
          (0, import_vue.createElementVNode)("div", { class: "content" }, [
            (0, import_vue.createElementVNode)("u-web-view", {
              class: "webview",
              "on:onPostMessage": webLoad,
              style: (0, import_vue.normalizeStyle)({ height: `${(0, import_vue.unref)(systemInfo).windowHeight}px`, width: `${(0, import_vue.unref)(systemInfo).windowWidth}` }),
              ref_key: "webViewRef",
              ref: webViewRef,
              src: (0, import_vue.unref)(config).h5Url
            }, null, 44, ["src"])
          ])
        ]);
      };
    }
  };
  var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["styles", [_style_0]], ["__file", "D:/WebstormProjects/oa-base/pages/index/index.nvue"]]);

  // <stdin>
  var webview = plus.webview.currentWebview();
  if (webview) {
    const __pageId = parseInt(webview.id);
    const __pagePath = "pages/index/index";
    let __pageQuery = {};
    try {
      __pageQuery = JSON.parse(webview.__query__);
    } catch (e) {
    }
    index.mpType = "page";
    const app = Vue.createPageApp(index, { $store: getApp({ allowDefault: true }).$store, __pageId, __pagePath, __pageQuery });
    app.provide("__globalStyles", Vue.useCssStyles([...__uniConfig.styles, ...index.styles || []]));
    app.mount("#root");
  }
})();