OneUi.use(["site", "addon"], function (site, addon) {

    site.setMenu("one_pan_option");

    addon.getInstall(function () {
        return window.OneContainer;
    }, function (OneContainer) {
        OneContainer.use(["runner"], function (runner) {
            runner.runScope("wpzs");
        });
    });

    addon.getInstall(function () {
        return window.OnePan;
    }, function (container) {
        container.use(["config", "option", "router"], function (config, option, router) {
            new Vue({
                mixins: [site.getMixin()],
                data: {
                    app_id: config.getConfig("app_id"),
                    client_type: config.getConfig("client_type"),
                    temp_path: config.getConfig("temp_path"),
                    option: option.getOption(),
                    notify_status: "all"
                },
                watch: {
                    option: function (value) {
                        option.setOption(value);
                    }
                },
                created: function () {
                    this.loadNotifyStatus();
                },
                methods: {
                    loadNotifyStatus: function () {
                        var notifyStatus = config.getConfig("notify_status");
                        if (notifyStatus) {
                            this.notify_status = notifyStatus;
                        }
                    },
                    syncNotifyStatus: function () {
                        config.setConfig("notify_status", this.notify_status);
                    },
                    syncAppId: function () {
                        config.setConfig("app_id", this.app_id);
                    },
                    syncClientType: function () {
                        config.setConfig("client_type", this.client_type);
                    },
                    syncTempPath: function () {
                        config.setConfig("temp_path", this.temp_path);
                    },
                    openTempPage: function () {
                        router.openTab("https://pan.baidu.com/disk/home#/all?vmode=list&path=" + encodeURIComponent(this.temp_path ? this.temp_path : "/onetmp"), true);
                    }
                }
            });
        });
    });

});