<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">///////////////////////////////////////////////////////////////////////////
// Copyright Â© 2014 - 2016 Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////

define([
  'dojo/_base/declare',
  'dojo/_base/lang',
  'dojo/_base/array',
  'dojo/_base/html',
  'dojo/topic',
  'dojo/Deferred',
  'dojo/on',
  './utils',
  './WidgetManager',
  './ConfigLoader',
  './dijit/LoadingIndicator',
  'esri/config',
  'esri/tasks/GeometryService',
  './tokenUtils'
],
function (declare, lang, array, html, topic, Deferred, on, jimuUtils, WidgetManager,
    ConfigLoader, LoadingIndicator, esriConfig, GeometryService, tokenUtils) {
    var instance = null, clazz;

    clazz = declare(null, {
        urlParams: null,
        appConfig: null,
        configFile: null,
        _configLoaded: false,

        constructor: function (urlParams) {
            this.urlParams = urlParams || {};
            this.widgetManager = WidgetManager.getInstance();
            this.configLoader = ConfigLoader.getInstance(this.urlParams, {
            });

            if (this.urlParams.mode === 'config' &amp;&amp; window.parent.setConfigViewerTopic &amp;&amp;
              lang.isFunction(window.parent.setConfigViewerTopic)) {
                window.parent.setConfigViewerTopic(topic);
            }
            if (this.urlParams.mode === 'preview' &amp;&amp; window.parent.setPreviewViewerTopic &amp;&amp;
              lang.isFunction(window.parent.setPreviewViewerTopic)) {
                window.parent.setPreviewViewerTopic(topic);
            }

            if (!jimuUtils.isMobileUa()) {
                //mobile devices do NOT listen to the 'resize' event
                //avoid to virtual-keyboard appears and then app switches between "Mobile Mode" and "Desktop Mode"
                on(window, 'resize', lang.hitch(this, this._onWindowResize));
            }
            on(window, "orientationchange", lang.hitch(this, this._onOrientationChange));
        },

        loadConfig: function () {
            if (this.urlParams.mode === 'preview' ||
              this.urlParams.mode === 'config') {
                //in preview/config mode, the config is set by the builder.
                return;
            }

            var loading = new LoadingIndicator();
            loading.placeAt(window.jimuConfig.layoutId);

            return this.configLoader.loadConfig().then(lang.hitch(this, function (appConfig) {


                this.appConfig = this._addDefaultValues(appConfig);

                console.timeEnd('Load Config');

                window.appInfo.isRunInMobile = jimuUtils.inMobileSize();
                var _ac = this.getAppConfig();


                var _connector = window.Connector.getInstance();
                var user = null;

                if (_connector) {
                   // user = _connector.getUser();
                }


                if (user)
                    return tokenUtils.registerToken(user).then(lang.hitch(this, function () {



                        loading.destroy();
                        topic.publish("appConfigLoaded", _ac);
                        return _ac;

                    }));

                loading.destroy();
                topic.publish("appConfigLoaded", _ac);
                return _ac;

            }), lang.hitch(this, function (err) {
                loading.destroy();
                console.error(err);
                if (err &amp;&amp; err.message &amp;&amp; typeof err.message === 'string') {
                    this._showErrorMessage(err.message);
                }
            }));
        },

        _showErrorMessage: function (msg) {
            html.create('div', {
                'class': 'app-error',
                innerHTML: msg
            }, document.body);
        },

        getAppConfig: function () {
            var c;
            if (window.appInfo.isRunInMobile) {
                // console.log('Switch to mobile mode.');
                c = lang.clone(this._getMobileConfig(this.appConfig));
                c._originConfig = lang.clone(this.appConfig);
            } else {
                // console.log('Switch to desktop mode.');
                c = lang.clone(this.appConfig);
            }

            c.getConfigElementById = function (id) {
                return jimuUtils.getConfigElementById(this, id);
            };

            c.getConfigElementsByName = function (name) {
                return jimuUtils.getConfigElementsByName(this, name);
            };

            c.getCleanConfig = function (isForAGOLTemplate) {
                if (this._originConfig) {
                    return getCleanConfig(this._originConfig, isForAGOLTemplate);
                } else {
                    return getCleanConfig(this, isForAGOLTemplate);
                }
            };

            c.visitElement = function (cb) {
                jimuUtils.visitElement(this, cb);
            };
            return c;
        },

        _onOrientationChange: function () {
            if (this.appConfig) {
                topic.publish("appConfigChanged", this.getAppConfig(), 'layoutChange');
            }
        },
        _onWindowResize: function () {
            var runInMobile = jimuUtils.inMobileSize();
            if (window.appInfo.isRunInMobile === runInMobile) {
                return;
            }
            window.appInfo.isRunInMobile = runInMobile;

            if (this.appConfig) {
                topic.publish("appConfigChanged", this.getAppConfig(), 'layoutChange');
            }
        },

        _getMobileConfig: function (appConfig) {
            return jimuUtils.mixinAppConfigPosition(appConfig, appConfig.mobileLayout);
        },

        _removeWidgetOrGroupFromPoolById: function (appConfig, id) {
            array.some(appConfig.widgetPool.widgets, function (widget, i) {
                if (widget.id === id) {
                    appConfig.widgetPool.widgets.splice(i, 1);
                    return true;
                }
            });

            array.some(appConfig.widgetPool.groups, function (group, i) {
                if (group.id === id) {
                    appConfig.widgetPool.groups.splice(i, 1);
                    return true;
                }
            });
        },



        _genStyles: function (allStyle, currentStyle) {
            var styles = [];
            styles.push(currentStyle);
            array.forEach(allStyle, function (_style) {
                if (styles.indexOf(_style) &lt; 0) {
                    styles.push(_style);
                }
            });
            return styles;
        },

        /**************************************
        Keep the following same between themes:
        1. map config excluding map's position
        2. widget pool config excluding pool panel config
        ***************************************/
        _getAppConfigFromTheme: function (theme) {
            var def = new Deferred();
            var config, styles = [];
            var currentConfig = this.getAppConfig().getCleanConfig();

            currentConfig.mode = this.urlParams.mode;

            //because we don't allow user config panel for group,
            //and group's panel should be different between differrent theme
            //so, we delete group panel
            array.forEach(currentConfig.widgetPool.groups, function (group) {
                delete group.panel;
            }, this);
            //theme has already appConfig object, use it but keep something
            if (theme.appConfig) {
                config = lang.clone(theme.appConfig);
                config.map = currentConfig.map;
                config.map.position = theme.appConfig.map.position;
                this._copyPoolToThemePool(currentConfig, config);

                config.links = currentConfig.links;
                config.title = currentConfig.title;
                config.subtitle = currentConfig.subtitle;
                config.logo = currentConfig.logo;
            } else {
                //use layout and style to create a new appConfig, which may contain some place holders
                var layout = theme.getCurrentLayout();
                var style = theme.getCurrentStyle();

                config = lang.clone(currentConfig);
                var layoutConfig = lang.clone(layout.layoutConfig);

                //use onscreen
                config.widgetOnScreen = layoutConfig.widgetOnScreen;

                //add flag
                if (layoutConfig.widgetPool) {
                    array.forEach(layoutConfig.widgetPool.widgets, function (w) {
                        w.isPreconfiguredInTheme = true;
                    });
                    array.forEach(layoutConfig.widgetPool.groups, function (g) {
                        g.isPreconfiguredInTheme = true;
                    });
                }

                //copy pool
                this._copyPoolToThemePool(currentConfig, layoutConfig);
                config.widgetPool = layoutConfig.widgetPool;

                if (layoutConfig.map &amp;&amp; layoutConfig.map.position) {
                    config.map.position = layoutConfig.map.position;
                }
                config.mobileLayout = layoutConfig.mobileLayout;

                //put all styles into the style array, and the current style is the first element
                styles = this._genStyles(array.map(theme.getStyles(), function (style) {
                    return style.name;
                }), style.name);
                config.theme = {
                    name: theme.getName(),
                    styles: styles,
                    version: theme.getVersion()
                };
            }

            this.configLoader.addNeedValues(config);
            this.configLoader.loadWidgetsManifest(config).then(lang.hitch(this, function (config) {
                return this.configLoader.loadAndUpgradeAllWidgetsConfig(config);
            })).then(lang.hitch(this, function () {
                this._addDefaultValues(config);
                def.resolve(config);
            }));
            return def;
        },

        _copyPoolToThemePool: function (currentAppConfig, themeAppConfig) {
            var cpool = currentAppConfig.widgetPool;

            if (!themeAppConfig.widgetPool) {
                themeAppConfig.widgetPool = {};
            }
            var tpool = themeAppConfig.widgetPool;

            //widgets/groups defined in theme
            var themePoolWidgets = array.filter(tpool.widgets, function (tw) {
                if (tw.isPreconfiguredInTheme) {
                    return true;
                }

                //widgets that exists in the theme only(added by user, not pre-configured)
                if (!array.some(cpool.widgets, function (cw) {
                  return cw.name === tw.name;
                })) {
                    return true;
                }
            });
            var themePoolGroups = array.filter(tpool.groups, function (g) {
                return g.isPreconfiguredInTheme;
            });

            //widgets/groups are shared
            var currentPoolWidgets = array.filter(cpool.widgets, function (w) {
                return !w.isPreconfiguredInTheme;
            });
            var currentPoolGroups = array.filter(cpool.groups, function (g) {
                return !g.isPreconfiguredInTheme;
            });

            currentPoolWidgets = this._getPoolWidgetsWithoutDuplicated(currentPoolWidgets,
                themeAppConfig.widgetOnScreen.widgets || []);

            tpool.widgets = currentPoolWidgets.concat(themePoolWidgets);
            tpool.groups = currentPoolGroups.concat(themePoolGroups);
        },

        _getPoolWidgetsWithoutDuplicated: function (currentPoolWidgets, themeOnScreeWidgets) {
            var ret = lang.clone(currentPoolWidgets);
            var currentAppConfig = this.getAppConfig();
            //we don't care groups and theme pool, because all in-panel widgets are not singleton
            for (var i = currentPoolWidgets.length - 1; i &gt;= 0; i--) {
                for (var j = themeOnScreeWidgets.length - 1; j &gt;= 0; j--) {
                    if (!themeOnScreeWidgets[j].uri) {
                        continue;
                    }
                    var wname = themeOnScreeWidgets[j].name;
                    if (!wname) {
                        wname = jimuUtils.getWidgetNameFromUri(themeOnScreeWidgets[j].uri);
                    }

                    var wid = currentPoolWidgets[i].id;
                    var wjson = currentAppConfig.getConfigElementById(wid);
                    if (currentPoolWidgets[i] &amp;&amp; currentPoolWidgets[i].name === wname &amp;&amp;
                      wjson.supportMultiInstance === false) {
                        console.log('Widget', currentPoolWidgets[i].name,
                          'is not copied to new theme because this widget exists in new theme.');
                        ret.splice(i, 1);
                    }
                }
            }
            return ret;
        },

        /**********************************************
        * Add default values
        ************************************************/
        _addDefaultValues: function (config) {
            this._addDefaultGeometryService(config);
            this._addDefaultStyle(config);
            this._addDefaultMap(config);
            this._addDefaultVisible(config);

            //preload widgets
            if (typeof config.widgetOnScreen === 'undefined') {
                config.widgetOnScreen = {};
            }

            if (typeof config.widgetPool === 'undefined') {
                config.widgetPool = {};
            }

            this._addDefaultPanelAndPosition(config);
            this._addDefaultOfWidgetGroup(config);
            //if the first widget or first group doesn't have index property, we add it

            // index ayarlama tekrar yazÄ±ldÄ±ÄŸÄ±ndan dolayÄ± burdaki if kontrolÃ¼ kaldÄ±rÄ±ldÄ±.
            // ali:ozer

            //if (config.widgetPool.widgets &amp;&amp; config.widgetPool.widgets.length &gt; 0 &amp;&amp;
            //  config.widgetPool.widgets[0].index === undefined ||
            //  config.widgetPool.groups &amp;&amp; config.widgetPool.groups.length &gt; 0 &amp;&amp;
            //  config.widgetPool.groups[0].index === undefined) {
            this._addIndexForWidgetPool(config);
            //}

            return config;
        },

        _addDefaultGeometryService: function (appConfig) {
            var geoServiceUrl = appConfig &amp;&amp; appConfig.geometryService;
            var validGeoServiceUrl = geoServiceUrl &amp;&amp; typeof geoServiceUrl === 'string' &amp;&amp;
            lang.trim(geoServiceUrl);
            if (validGeoServiceUrl) {
                geoServiceUrl = lang.trim(geoServiceUrl);
            }

            appConfig.geometryService = geoServiceUrl;
            esriConfig.defaults.geometryService = new GeometryService(appConfig.geometryService);
        },

        _addDefaultStyle: function (config) {
            if (config.theme) {
                if (!config.theme.styles || config.theme.styles.length === 0) {
                    config.theme.styles = ['default'];
                }
            }
        },

        _addDefaultMap: function (config) {
            config.map.id = 'map';

            if (typeof config.map['3D'] === 'undefined' &amp;&amp; typeof config.map['2D'] === 'undefined') {
                config.map['2D'] = true;
            }

            if (typeof config.map.position === 'undefined') {
                config.map.position = {
                    left: 0,
                    right: 0,
                    top: 0,
                    bottom: 0
                };
            }

            if (typeof config.map.portalUrl === 'undefined') {
                config.map.portalUrl = config.portalUrl;
            }
        },

        _addDefaultVisible: function (config) {
            jimuUtils.visitElement(config, function (e) {
                if (e.visible === undefined) {
                    e.visible = true;
                }
            });
        },

        _addDefaultPanelAndPosition: function (config) {
            this._addOnScreenDefaultPanelAndPosition(config);
            this._addPoolDefaultPanelAndPosition(config);
        },

        _addOnScreenDefaultPanelAndPosition: function (config) {
            var i, j, screenSectionConfig = config.widgetOnScreen;

            if (!screenSectionConfig) {
                return;
            }

            var panelDefaultPositionR =
              screenSectionConfig.panel &amp;&amp; screenSectionConfig.panel.positionRelativeTo ?
              screenSectionConfig.panel.positionRelativeTo : 'map';

            if (typeof screenSectionConfig.panel === 'undefined' ||
              typeof screenSectionConfig.panel.uri === 'undefined') {
                screenSectionConfig.panel = {
                    uri: 'uni/OnScreenWidgetPanel',
                    //positionRelativeTo: 'map',
                    position: {
                        //move positionRelativeTo to position.relativeTo
                        relativeTo: panelDefaultPositionR
                    }
                };
            } else if (typeof screenSectionConfig.panel.position === 'undefined') {
                screenSectionConfig.panel.position = { relativeTo: panelDefaultPositionR };
            } else if (typeof screenSectionConfig.panel.position.relativeTo === 'undefined') {
                screenSectionConfig.panel.position.relativeTo = panelDefaultPositionR;
            }

            if (screenSectionConfig.widgets) {
                for (i = 0; i &lt; screenSectionConfig.widgets.length; i++) {
                    if (!screenSectionConfig.widgets[i].position) {
                        screenSectionConfig.widgets[i].position = {};
                    }
                    if (!screenSectionConfig.widgets[i].position.relativeTo) {
                        screenSectionConfig.widgets[i].position.relativeTo =
                          screenSectionConfig.widgets[i] &amp;&amp; screenSectionConfig.widgets[i].positionRelativeTo ?
                          screenSectionConfig.widgets[i].positionRelativeTo : 'map';
                    }
                    if (screenSectionConfig.widgets[i].inPanel === true &amp;&amp;
                      !screenSectionConfig.widgets[i].panel) {
                        screenSectionConfig.widgets[i].panel = lang.clone(screenSectionConfig.panel);
                        screenSectionConfig.widgets[i].panel.position = screenSectionConfig.widgets[i].position;
                        screenSectionConfig.widgets[i].panel.position.relativeTo =
                        screenSectionConfig.widgets[i].position.relativeTo;
                    }
                }
            }

            if (screenSectionConfig.groups) {
                for (i = 0; i &lt; screenSectionConfig.groups.length; i++) {
                    if (!screenSectionConfig.groups[i].panel) {
                        screenSectionConfig.groups[i].panel = screenSectionConfig.panel;
                    }

                    if (screenSectionConfig.groups[i].panel &amp;&amp; !screenSectionConfig.groups[i].panel.position) {
                        screenSectionConfig.groups[i].panel.position = {};
                    }

                    if (!screenSectionConfig.groups[i].panel.position.relativeTo) {
                        screenSectionConfig.groups[i].panel.position.relativeTo =
                          screenSectionConfig.groups[i].panel.positionRelativeTo ?
                          screenSectionConfig.groups[i].panel.positionRelativeTo : 'map';
                    }

                    if (!screenSectionConfig.groups[i].widgets) {
                        screenSectionConfig.groups[i].widgets = [];
                    }
                    for (j = 0; j &lt; screenSectionConfig.groups[i].widgets.length; j++) {
                        screenSectionConfig.groups[i].widgets[j].panel = screenSectionConfig.groups[i].panel;
                    }
                }
            }
        },

        _addPoolDefaultPanelAndPosition: function (config) {
            var i, j, poolSectionConfig = config.widgetPool;

            if (!poolSectionConfig) {
                return;
            }

            var panelDefaultPositionR =
              poolSectionConfig.panel &amp;&amp; poolSectionConfig.panel.positionRelativeTo ?
              poolSectionConfig.panel.positionRelativeTo : 'map';

            if (typeof poolSectionConfig.panel === 'undefined' ||
              typeof poolSectionConfig.panel.uri === 'undefined') {
                poolSectionConfig.panel = {
                    uri: 'uni/OnScreenWidgetPanel',
                    position: {
                        relativeTo: panelDefaultPositionR
                    }
                };
            } else if (typeof poolSectionConfig.panel.position === 'undefined') {
                poolSectionConfig.panel.position = { relativeTo: panelDefaultPositionR };
            } else if (typeof poolSectionConfig.panel.position.relativeTo === 'undefined') {
                poolSectionConfig.panel.position.relativeTo = panelDefaultPositionR;
            }

            if (poolSectionConfig.groups) {
                for (i = 0; i &lt; poolSectionConfig.groups.length; i++) {
                    if (!poolSectionConfig.groups[i].panel) {
                        poolSectionConfig.groups[i].panel = poolSectionConfig.panel;
                    } else if (!poolSectionConfig.groups[i].panel.position.relativeTo) {
                        poolSectionConfig.groups[i].panel.position.relativeTo =
                          poolSectionConfig.groups[i].panel.positionRelativeTo ?
                          poolSectionConfig.groups[i].panel.positionRelativeTo : 'map';
                    }

                    if (!poolSectionConfig.groups[i].widgets) {
                        poolSectionConfig.groups[i].widgets = [];
                    }
                    for (j = 0; j &lt; poolSectionConfig.groups[i].widgets.length; j++) {
                        poolSectionConfig.groups[i].widgets[j].panel = poolSectionConfig.groups[i].panel;
                    }
                }
            }

            if (poolSectionConfig.widgets) {
                for (i = 0; i &lt; poolSectionConfig.widgets.length; i++) {
                    if (poolSectionConfig.widgets[i].inPanel === false) {
                        var defaultWidgetPositionR = poolSectionConfig.widgets[i].positionRelativeTo ?
                            poolSectionConfig.widgets[i].positionRelativeTo : 'map';
                        if (!poolSectionConfig.widgets[i].position) {
                            poolSectionConfig.widgets[i].position = {
                                relativeTo: defaultWidgetPositionR
                            };
                        } else if (!poolSectionConfig.widgets[i].position.relativeTo) {
                            poolSectionConfig.widgets[i].position.relativeTo = defaultWidgetPositionR;
                        }
                    } else if (!poolSectionConfig.widgets[i].panel) {
                        poolSectionConfig.widgets[i].panel = config.widgetPool.panel;
                    }
                }
            }
        },

        _addDefaultOfWidgetGroup: function (config) {
            //group/widget labe, icon
            jimuUtils.visitElement(config, lang.hitch(this, function (e, info) {
                e.isOnScreen = info.isOnScreen;
                if (e.widgets) {
                    //it's group
                    e.gid = e.id;
                    if (e.widgets.length === 1) {
                        if (!e.label) {
                            e.label = e.widgets[0].label ? e.widgets[0].label : 'Group';
                        }
                        if (!e.icon) {
                            if (e.widgets[0].uri) {
                                e.icon = this._getDefaultIconFromUri(e.widgets[0].uri);
                            } else {
                                e.icon = 'uni.js/images/group_icon.png';
                            }
                        }
                    } else {
                        e.icon = e.icon ? e.icon : 'uni.js/images/group_icon.png';
                        e.label = e.label ? e.label : 'Group_' + info.index;
                    }
                } else {
                    e.gid = info.groupId;
                }
            }));
        },

        _getDefaultIconFromUri: function (uri) {
            var segs = uri.split('/');
            segs.pop();
            return segs.join('/') + '/images/icon.png?wab_dv=' + window.deployVersion;
        },

        //_addIndexForWidgetPool: function (config) {
        //    //be default, widgets are in front
        //    var index = 0, i, j;
        //    if (config.widgetPool.widgets) {
        //        for (i = 0; i &lt; config.widgetPool.widgets.length; i++) {
        //            config.widgetPool.widgets[i].index = index;
        //            index++;
        //        }
        //    }

        //    if (config.widgetPool.groups) {
        //        for (i = 0; i &lt; config.widgetPool.groups.length; i++) {
        //            config.widgetPool.groups[i].index = index;
        //            index++;
        //            for (j = 0; j &lt; config.widgetPool.groups[i].widgets.length; j++) {
        //                config.widgetPool.groups[i].widgets[j].index = j;
        //            }
        //        }
        //    }
        //},



        // config' deki widget' larÄ±n hepsine index deÄŸeri girme zorunluluÄŸu olmamasÄ± iÃ§in tekrar yazÄ±ldÄ±.
        // ali:ozer
        _addIndexForWidgetPool: function (config) {
            //be default, widgets are in front
            var index = 0, i, j;
            var widgets = [];
            var tempWidgets = [];

            if (config.widgetPool.widgets) {
                widgets = widgets.concat(config.widgetPool.widgets);
            }

            if (config.widgetPool.groups) {
                widgets = widgets.concat(config.widgetPool.groups);
            }


            // config ten index deÄŸerleri girildi ise dizi' ye ekle
            for (var i = 0; i &lt; widgets.length; i++) {
                if (widgets[i].index) {
                    tempWidgets.push(widgets[i]);
                }
            }

            function applyIndex(index) {

                for (var j = 0; j &lt; tempWidgets.length; j++) {
                    if (tempWidgets[j].index == index)
                        return applyIndex(index + 1);
                }
                return index;
            }

            // config ten index deÄŸerleri girilmeyenleri sÄ±rayla ekle
            for (var i = 0; i &lt; widgets.length; i++) {
                if (!widgets[i].index) {
                    var tempIndex = applyIndex(index);
                    widgets[i].index = tempIndex;
                    index = tempIndex + 1;
                }
            }

        }

    });

    clazz.getInstance = function (urlParams) {
        if (instance === null) {
            instance = new clazz(urlParams);
        } else {
            if (urlParams) {
                instance.urlParams = urlParams;
                if (instance.configLoader) {
                    instance.configLoader.urlParams = urlParams;
                }
            }
        }

        window.getAppConfig = lang.hitch(instance, instance.getAppConfig);
        return instance;
    };

    function getCleanConfig(config, isForAGOLTemplate) {
        //delete the properties that framework add
        var newConfig = lang.clone(config);
        var properties = jimuUtils.widgetProperties;

        if (typeof isForAGOLTemplate === 'undefined') {
            isForAGOLTemplate = false;
        }
        delete newConfig.mode;
        jimuUtils.visitElement(newConfig, function (e, info) {
            if (e.widgets) {
                delete e.isOnScreen;
                delete e.gid;
                if (e.icon === 'jimu.js/images/group_icon.png') {
                    delete e.icon;
                }
                delete e.openType;
                if (info.isOnScreen) {
                    if (e.panel &amp;&amp; jimuUtils.isEqual(e.panel, newConfig.widgetOnScreen.panel)) {
                        delete e.panel;
                    }
                }
                return;
            }

            if (e.icon &amp;&amp; e.icon === e.folderUrl + 'images/icon.png?wab_dv=' + window.deployVersion) {
                delete e.icon;
            }

            delete e.panel;
            delete e.folderUrl;
            delete e.amdFolder;
            delete e.thumbnail;
            delete e.configFile;
            delete e.gid;
            delete e.isOnScreen;
            delete e.isRemote;

            properties.forEach(function (p) {
                delete e[p];
            });

            if (!isForAGOLTemplate) {
                if (e.visible) {
                    delete e.visible;
                }

                if (e.manifest &amp;&amp; e.label === e.manifest.label) {
                    delete e.label;
                }

                if (e.isDefaultConfig) {
                    delete e.config;
                    delete e.isDefaultConfig;
                }
            } else {
                if (typeof e.openAtStart === 'undefined') {
                    e.openAtStart = false;
                }
            }

            delete e.manifest;
        });
        delete newConfig.rawAppConfig;
        //the _ssl property is added by esriRequest
        delete newConfig._ssl;
        //delete all of the methods
        delete newConfig.getConfigElementById;
        delete newConfig.getConfigElementsByName;
        delete newConfig.processNoUriWidgets;
        delete newConfig.addElementId;
        delete newConfig.getCleanConfig;
        delete newConfig.visitElement;

        delete newConfig.agolConfig;
        delete newConfig._itemData;
        delete newConfig.oldWabVersion;

        return newConfig;
    }

    return clazz;
});
</pre></body></html>