( function() {  var mapping = [{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_INTRODUCTION", "path":"GUID-47A13FB7-44C1-40A7-8D06-0B4232F5348D.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_FOC_BASED_POSITION_CONTROL_PMSM_QUADRATURE_ENCODER", "path":"GUID-2259E505-5126-4C27-98E1-A4648C548DC0.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_PMSM_FOC_HALL_SENSOR", "path":"GUID-E5085858-17CC-43EE-8792-775C2D564225.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_PMSM_FOC_PLL_ESTIMATOR_HALL_SENSOR_STARTUP", "path":"GUID-4BC96244-89CA-4052-84E6-6AC71E919B76.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_PMSM_FOC_PLL_ESTIMATOR", "path":"GUID-0B6B2F29-C73A-49DD-8988-9BED28224372.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_PMSM_FOC_QUADRATURE_ENCODER", "path":"GUID-AD96AE15-B346-42EF-BA7E-6693190DBF5A.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_PMSM_FOC_HYBRID_ESTIMATOR_ZS_MT_BEMF_OBSERVER", "path":"GUID-504D3422-AA1C-4551-A18B-B25E0E5FD1C5.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_PMSM_FOC_SLIDING_MODE_OBSERVER", "path":"GUID-2B3D2430-DA1C-4BDA-9960-42145070BFAB.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_HW_SETUP", "path":"GUID-785E3739-14BD-4536-A15C-4C55AB5E5861.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_MCHV3_DB_SETUP_POSITION_CONTROL", "path":"GUID-64B9FCBD-75E4-46B9-8894-2489CF9DFFE9.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_MCHV3_DB_SETUP_QUADRATURE_ENCODER", "path":"GUID-859A1B9F-361A-4756-99EA-5CCED6F7CAEC.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_MCHV3_DB_SETUP_SENSORLESS_MODE", "path":"GUID-F692F0CA-7ABA-4476-A744-24E542F163FD.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_MCLV2_DB_SETUP_HALL_SENSOR", "path":"GUID-0CF2B7AB-01A5-4FF4-ADAA-A1829F336C90.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_MCLV2_DB_SETUP_POSITION_CONTROL", "path":"GUID-EDEFE810-4E2C-4278-AF51-532203EAE8A4.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_MCLV2_DB_SETUP_QUADRATURE_ENCODER", "path":"GUID-1BF42F29-9E6E-4ADF-86B4-38A7D69DAD98.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_MCLV2_DB_SETUP_SENSORLESS_MODE_TC1", "path":"GUID-1D38BD5D-19C9-49C2-9199-515D43386854.html"},{"appname":"", "appid":"MC_APPS_SAM_D5X_E5X_MCLV2_DB_SETUP_SENSORLESS_MODE", "path":"GUID-90D890CB-92F3-4022-8479-4B1C5BF268CE.html"}];
            var mchp = (function (mchp) {
                var mchp = mchp || {};
                var mapping = [];
        
                mchp.utils = {};
        
                mchp.utils.getQueryParam = function (name, url = window.location.href) {
                  name = name.replace(/[\[\]]/g, "\\$&");
                  var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
                    results = regex.exec(url);
                  if (!results) return null;
                  if (!results[2]) return "";
                  return decodeURIComponent(results[2].replace(/\+/g, " "));
                };

                mchp.utils.isFirefox = typeof InstallTrigger !== 'undefined';
        
                mchp.init = function (options) {
                  mchp.mapping = options.mapping || [];
                  mchp.bindEvents();
                };
        
                mchp.bindEvents = function () {
                    if (mchp.utils.isFirefox) {
                      window.onload = mchp.checkRedirect;
                    } else {
                      document.onreadystatechange = mchp.checkRedirect;
                    }
                };

                mchp.checkRedirect = function() {
                  var contextId = mchp.utils.getQueryParam("contextId") || "";
                  if (contextId && contextId != undefined) {
                    var record = mchp.mapping.find(function(x){
                      return x.appid && x.appid.toLowerCase() == contextId.toLowerCase();
                    });
                    if (record && record.path) {
                      window.stop();
                      window.location = record.path;
                    }
                  }
                };
        
                return {
                  init: mchp.init,
                };
              })();
        
              mchp.init({
                mapping: mapping
              });

        })();