define("e40f8203-b39d-425a-a957-714852e33b79_1.8.1", ["@microsoft/sp-core-library","@microsoft/sp-diagnostics","resx-strings","@microsoft/sp-lodash-subset"], function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) { return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// CONCATENATED MODULE: ./lib/DynamicDataReference.js
var DynamicDataReference =  (function () {
    function DynamicDataReference(reference) {
        var split = reference.split(':');
        if (split.length < 2) {
            throw new Error("Data id is malformed. Data id: \"" + reference + "\"");
        }
        this._reference = reference;
        this._sourceId = split[0];
        this._property = split[1];
        this._propertyPath = split[2];
    }
    Object.defineProperty(DynamicDataReference.prototype, "reference", {
        get: function () {
            return this._reference;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DynamicDataReference.prototype, "sourceId", {
        get: function () {
            return this._sourceId;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DynamicDataReference.prototype, "property", {
        get: function () {
            return this._property;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DynamicDataReference.prototype, "propertyPath", {
        get: function () {
            return this._propertyPath;
        },
        enumerable: true,
        configurable: true
    });
    return DynamicDataReference;
}());
/* harmony default export */ var lib_DynamicDataReference = (DynamicDataReference);

// EXTERNAL MODULE: external "@microsoft/sp-core-library"
var sp_core_library_ = __webpack_require__(1);
var sp_core_library__default = /*#__PURE__*/__webpack_require__.n(sp_core_library_);

// EXTERNAL MODULE: external "@microsoft/sp-diagnostics"
var sp_diagnostics_ = __webpack_require__(2);
var sp_diagnostics__default = /*#__PURE__*/__webpack_require__.n(sp_diagnostics_);

// CONCATENATED MODULE: ./lib/loc/Strings.resx.js
var key = '_/GZrHjuQO4erDQbBRI2XSA';
var allStrings = ( false) ?
    require("../resx-strings/en-us.json") :
    __webpack_require__(3);
var strings = allStrings[key];
/* harmony default export */ var Strings_resx = (strings);

// CONCATENATED MODULE: ./lib/DynamicDataManager.js



var ANY_PROPERTY_EVENT_PREFIX = 'DynamicData_AnyPropertyChanged';
var PROPERTY_EVENT_PREFIX = 'DynamicData_PropertyChanged';
var ALL_PROPERTIES_EVENT_PREFIX = 'DynamicData_AllPropertiesChanged';
var SOURCES_CHANGED_EVENT_NAME = 'DynamicData_SourcesChanged';
var EVENT_NAME_SEPARATOR = '_';
var QOS_MONITOR_PREFIX = 'DynamicData.DynamicDataManager';
var LOG_SOURCE = sp_diagnostics_["_LogSource"].create('DynamicDataManager');
var DynamicDataManager_DynamicDataManager =  (function () {
    function DynamicDataManager(serviceScope) {
        this._sources = new Map();
        this._sourcesChangedEvent = new sp_core_library_["SPEvent"](SOURCES_CHANGED_EVENT_NAME);
        this._getPropertyChangedEventName = this._getPropertyChangedEventName.bind(this);
    }
    Object.defineProperty(DynamicDataManager.prototype, "sourcesChangedEvent", {
        get: function () {
            return this._sourcesChangedEvent;
        },
        enumerable: true,
        configurable: true
    });
    DynamicDataManager.prototype.notifySourceChanged = function (sourceId) {
        var qosMonitor = new sp_diagnostics_["_QosMonitor"](QOS_MONITOR_PREFIX + '.notifySourceChanged');
        try {
            sp_core_library_["Validate"].isNonemptyString(sourceId, 'sourceId');
            sp_core_library_["_SPEventManager"].instance.raiseEvent(this._getAllPropertiesChangedEventName(sourceId), {});
            sp_core_library_["_SPEventManager"].instance.raiseEvent(this._getAnyPropertyChangedEventName(sourceId), {});
            qosMonitor.writeSuccess();
        }
        catch (e) {
            qosMonitor.writeUnexpectedFailure(e);
            throw e;
        }
    };
    DynamicDataManager.prototype.notifyPropertyChanged = function (sourceId, propertyId) {
        var qosMonitor = new sp_diagnostics_["_QosMonitor"](QOS_MONITOR_PREFIX + '.notifyPropertyChanged');
        try {
            sp_core_library_["Validate"].isNonemptyString(sourceId, 'sourceId');
            sp_core_library_["Validate"].isNonemptyString(propertyId, 'propertyId');
            sp_core_library_["_SPEventManager"].instance.raiseEvent(this._getPropertyChangedEventName(sourceId, propertyId), {});
            sp_core_library_["_SPEventManager"].instance.raiseEvent(this._getAnyPropertyChangedEventName(sourceId), {});
            qosMonitor.writeSuccess();
        }
        catch (e) {
            qosMonitor.writeUnexpectedFailure(e);
            throw e;
        }
    };
    DynamicDataManager.prototype.registerSourceChanged = function (sourceId, observer, callback) {
        var qosMonitor = new sp_diagnostics_["_QosMonitor"](QOS_MONITOR_PREFIX + '.registerSourceChanged');
        try {
            sp_core_library_["Validate"].isNonemptyString(sourceId, 'sourceId');
            sp_core_library_["Validate"].isNotNullOrUndefined(observer, 'observer');
            sp_core_library_["Validate"].isNotNullOrUndefined(callback, 'callback');
            if (!this._sources.has(sourceId)) {
                throw new Error(sp_core_library_["Text"].format(Strings_resx.dynamicDataManagerSourceDoesntExist, sourceId));
            }
            sp_core_library_["_SPEventManager"].instance.registerEvent(this._getAllPropertiesChangedEventName(sourceId), observer, callback);
            sp_core_library_["_SPEventManager"].instance.registerEvent(this._getAnyPropertyChangedEventName(sourceId), observer, callback);
            qosMonitor.writeSuccess();
        }
        catch (e) {
            qosMonitor.writeUnexpectedFailure(e);
            throw e;
        }
    };
    DynamicDataManager.prototype.unregisterSourceChanged = function (sourceId, observer, callback) {
        var qosMonitor = new sp_diagnostics_["_QosMonitor"](QOS_MONITOR_PREFIX + '.unregisterSourceChanged');
        try {
            sp_core_library_["Validate"].isNonemptyString(sourceId, 'sourceId');
            sp_core_library_["Validate"].isNotNullOrUndefined(observer, 'observer');
            sp_core_library_["Validate"].isNotNullOrUndefined(callback, 'callback');
            if (!this._sources.has(sourceId)) {
                throw new Error(sp_core_library_["Text"].format(Strings_resx.dynamicDataManagerSourceDoesntExist, sourceId));
            }
            sp_core_library_["_SPEventManager"].instance.unregisterEvent(this._getAllPropertiesChangedEventName(sourceId), observer, callback);
            sp_core_library_["_SPEventManager"].instance.unregisterEvent(this._getAnyPropertyChangedEventName(sourceId), observer, callback);
            qosMonitor.writeSuccess();
        }
        catch (e) {
            qosMonitor.writeUnexpectedFailure(e);
            throw e;
        }
    };
    DynamicDataManager.prototype.registerPropertyChanged = function (sourceId, propertyId, observer, callback) {
        var qosMonitor = new sp_diagnostics_["_QosMonitor"](QOS_MONITOR_PREFIX + '.registerPropertyChanged');
        try {
            sp_core_library_["Validate"].isNonemptyString(sourceId, 'sourceId');
            sp_core_library_["Validate"].isNonemptyString(propertyId, 'propertyId');
            sp_core_library_["Validate"].isNotNullOrUndefined(observer, 'observer');
            sp_core_library_["Validate"].isNotNullOrUndefined(callback, 'callback');
            if (!this._sources.has(sourceId)) {
                throw new Error(sp_core_library_["Text"].format(Strings_resx.dynamicDataManagerSourceDoesntExist, sourceId));
            }
            sp_core_library_["_SPEventManager"].instance.registerEvent(this._getPropertyChangedEventName(sourceId, propertyId), observer, callback);
            sp_core_library_["_SPEventManager"].instance.registerEvent(this._getAllPropertiesChangedEventName(sourceId), observer, callback);
            qosMonitor.writeSuccess();
        }
        catch (e) {
            qosMonitor.writeUnexpectedFailure(e);
            throw e;
        }
    };
    DynamicDataManager.prototype.unregisterPropertyChanged = function (sourceId, propertyId, observer, callback) {
        var qosMonitor = new sp_diagnostics_["_QosMonitor"](QOS_MONITOR_PREFIX + '.unregisterPropertyChanged');
        try {
            sp_core_library_["Validate"].isNonemptyString(sourceId, 'sourceId');
            sp_core_library_["Validate"].isNonemptyString(propertyId, 'propertyId');
            sp_core_library_["Validate"].isNotNullOrUndefined(observer, 'observer');
            sp_core_library_["Validate"].isNotNullOrUndefined(callback, 'callback');
            if (!this._sources.has(sourceId)) {
                throw new Error(sp_core_library_["Text"].format(Strings_resx.dynamicDataManagerSourceDoesntExist, sourceId));
            }
            sp_core_library_["_SPEventManager"].instance.unregisterEvent(this._getPropertyChangedEventName(sourceId, propertyId), observer, callback);
            sp_core_library_["_SPEventManager"].instance.unregisterEvent(this._getAllPropertiesChangedEventName(sourceId), observer, callback);
            qosMonitor.writeSuccess();
        }
        catch (e) {
            qosMonitor.writeUnexpectedFailure(e);
            throw e;
        }
    };
    DynamicDataManager.prototype.getSources = function () {
        var sources = [];
        this._sources.forEach(function (source) { return sources.push(source); });
        return sources;
    };
    DynamicDataManager.prototype.tryGetSource = function (sourceId) {
        sp_core_library_["Validate"].isNotNullOrUndefined(sourceId, 'sourceId');
        return this._sources.get(sourceId);
    };
    DynamicDataManager.prototype.addSource = function (source) {
        var qosMonitor = new sp_diagnostics_["_QosMonitor"](QOS_MONITOR_PREFIX + '.addSource');
        try {
            this._validateSource(source);
            if (this._sources.has(source.id)) {
                sp_diagnostics_["_TraceLogger"].logVerbose(LOG_SOURCE, sp_core_library_["Text"].format(Strings_resx.dynamicDataManagerSourceAlreadyExists, source.id));
            }
            this._sources.set(source.id, source);
            this._raiseSourcesChangedEvent();
            qosMonitor.writeSuccess();
        }
        catch (e) {
            qosMonitor.writeUnexpectedFailure(e);
            throw e;
        }
    };
    DynamicDataManager.prototype.removeSource = function (sourceId) {
        var qosMonitor = new sp_diagnostics_["_QosMonitor"](QOS_MONITOR_PREFIX + '.removeSource');
        try {
            sp_core_library_["Validate"].isNonemptyString(sourceId, 'sourceId');
            if (this._sources.has(sourceId)) {
                sp_core_library_["_SPEventManager"].instance.removeEvent(this._getAllPropertiesChangedEventName(sourceId));
                sp_core_library_["_SPEventManager"].instance.removeEvent(this._getAnyPropertyChangedEventName(sourceId));
                sp_core_library_["_SPEventManager"].instance.removeEventsByPrefix(this._getPropertyChangedEventPrefix(sourceId));
                this._sources.delete(sourceId);
                this._raiseSourcesChangedEvent();
            }
            qosMonitor.writeSuccess();
        }
        catch (e) {
            qosMonitor.writeUnexpectedFailure(e);
            throw e;
        }
    };
    DynamicDataManager.prototype._validateSource = function (source) {
        sp_core_library_["Validate"].isNotNullOrUndefined(source, 'source');
        if (source.id.indexOf(EVENT_NAME_SEPARATOR) > -1) {
            throw new Error("Source id contains invalid characters, like \"" + EVENT_NAME_SEPARATOR + "\". Id: \"" + source.id + "\".");
        }
        var regex = /^[a-zA-Z0-9\-_]+$/;
        source.getPropertyDefinitions().forEach(function (def) {
            if (!regex.test(def.id)) {
                throw new Error("Source contains invalid property \"" + def.id + "\".");
            }
        });
    };
    DynamicDataManager.prototype._raiseSourcesChangedEvent = function () {
        sp_core_library_["_SPEventManager"].instance.raiseStickyEvent(SOURCES_CHANGED_EVENT_NAME, {});
    };
    DynamicDataManager.prototype._getAllPropertiesChangedEventName = function (sourceId) {
        return [ALL_PROPERTIES_EVENT_PREFIX, sourceId].join(EVENT_NAME_SEPARATOR);
    };
    DynamicDataManager.prototype._getAnyPropertyChangedEventName = function (sourceId) {
        return [ANY_PROPERTY_EVENT_PREFIX, sourceId].join(EVENT_NAME_SEPARATOR);
    };
    DynamicDataManager.prototype._getPropertyChangedEventPrefix = function (sourceId) {
        return [PROPERTY_EVENT_PREFIX, sourceId].join(EVENT_NAME_SEPARATOR);
    };
    DynamicDataManager.prototype._getPropertyChangedEventName = function (sourceId, propertyId) {
        return [this._getPropertyChangedEventPrefix(sourceId), propertyId].join(EVENT_NAME_SEPARATOR);
    };
    DynamicDataManager.serviceKey = sp_core_library_["ServiceKey"].create('sp-core-library:DynamicDataManager', DynamicDataManager);
    return DynamicDataManager;
}());
/* harmony default export */ var lib_DynamicDataManager = (DynamicDataManager_DynamicDataManager);

// EXTERNAL MODULE: external "@microsoft/sp-lodash-subset"
var sp_lodash_subset_ = __webpack_require__(4);
var sp_lodash_subset__default = /*#__PURE__*/__webpack_require__.n(sp_lodash_subset_);

// CONCATENATED MODULE: ./lib/PageContextDataSource.js



var PageContextDataSource_PageContextDataSource =  (function () {
    function PageContextDataSource(serviceScope) {
        var _this = this;
        this._propertyDefinitions = {};
        this._eventDefinitions = {};
        this._serviceScope = serviceScope;
        this._serviceScope.whenFinished(function () {
            _this._dynamicDataManager = serviceScope.consume(lib_DynamicDataManager.serviceKey);
            _this._dynamicDataManager.addSource({
                id: PageContextDataSource._pageContextDataSourceId,
                metadata: {
                    title: Strings_resx.pageContextDataSourceTitle,
                    description: Strings_resx.pageContextDataSourceDescription,
                    componentId: '1c4541f7-5c31-41aa-9fa8-fbc9dc14c0a8',
                    alias: PageContextDataSource._pageContextDataSourceAlias
                },
                getPropertyDefinitions: _this.getPropertyDefinitions.bind(_this),
                getAnnotatedPropertyValue: _this.getAnnotatedPropertyValue.bind(_this),
                getPropertyValue: _this.getPropertyValue.bind(_this),
                allowedEvents: _this.allowedEvents.bind(_this),
                sendEvent: _this.sendEvent.bind(_this)
            });
        });
    }
    PageContextDataSource.prototype.addPropertyHandler = function (propInfo) {
        var _this = this;
        propInfo.dynamicDataFunctions.getPropertyDefinitions().forEach(function (propertyDefinition) {
            _this._propertyDefinitions[propertyDefinition.id] = {
                propertyCollectionId: propInfo.id,
                annotatedPropertyValueFunction: propInfo.dynamicDataFunctions.getAnnotatedPropertyValue,
                propertyValueFunction: propInfo.dynamicDataFunctions.getPropertyValue,
                definition: propertyDefinition
            };
        });
        if (propInfo.dynamicDataFunctions.allowedEvents) {
            propInfo.dynamicDataFunctions.allowedEvents().forEach(function (event) {
                if (propInfo.dynamicDataFunctions.sendEvent) {
                    _this._eventDefinitions[event.name] = {
                        propertyCollectionId: propInfo.id,
                        sendEvent: propInfo.dynamicDataFunctions.sendEvent,
                        definition: event
                    };
                }
            });
        }
        this._dynamicDataManager.notifySourceChanged(PageContextDataSource._pageContextDataSourceId);
    };
    PageContextDataSource.prototype.notifyPropertyChanged = function (propertyId) {
        this._dynamicDataManager.notifyPropertyChanged(PageContextDataSource._pageContextDataSourceId, propertyId);
    };
    PageContextDataSource.prototype.removePropertyHandler = function (id) {
        for (var prop in this._propertyDefinitions) {
            if (this._propertyDefinitions.hasOwnProperty(prop)) {
                if (this._propertyDefinitions[prop].propertyCollectionId === id) {
                    delete this._propertyDefinitions[prop];
                }
            }
        }
        for (var prop in this._eventDefinitions) {
            if (this._eventDefinitions.hasOwnProperty(prop)) {
                if (this._eventDefinitions[prop].propertyCollectionId === id) {
                    delete this._eventDefinitions[prop];
                }
            }
        }
        this._dynamicDataManager.notifySourceChanged('PageContext');
    };
    PageContextDataSource.prototype.getPropertyDefinitions = function () {
        var retVal = [];
        for (var prop in this._propertyDefinitions) {
            if (this._propertyDefinitions.hasOwnProperty(prop)) {
                retVal.push(this._propertyDefinitions[prop].definition);
            }
        }
        return Object(sp_lodash_subset_["cloneDeep"])(retVal);
    };
    PageContextDataSource.prototype.getPropertyValue = function (propertyId) {
        if (this._propertyDefinitions[propertyId]) {
            return Object(sp_lodash_subset_["cloneDeep"])(this._propertyDefinitions[propertyId].propertyValueFunction(propertyId));
        }
        return undefined;
    };
    PageContextDataSource.prototype.getAnnotatedPropertyValue = function (propertyId) {
        if (this._propertyDefinitions[propertyId]) {
            return Object(sp_lodash_subset_["cloneDeep"])(this._propertyDefinitions[propertyId].annotatedPropertyValueFunction(propertyId));
        }
        else {
            return { sampleValue: undefined };
        }
    };
    PageContextDataSource.prototype.allowedEvents = function () {
        var retVal = [];
        for (var prop in this._eventDefinitions) {
            if (this._eventDefinitions.hasOwnProperty(prop)) {
                retVal.push(this._eventDefinitions[prop].definition);
            }
        }
        return Object(sp_lodash_subset_["cloneDeep"])(retVal);
    };
    PageContextDataSource.prototype.sendEvent = function (eventName, data) {
        if (this._eventDefinitions[eventName]) {
            this._eventDefinitions[eventName].sendEvent(eventName, data);
        }
    };
    PageContextDataSource._pageContextDataSourceId = 'PageContext';
    PageContextDataSource._pageContextDataSourceAlias = 'Page Context';
    return PageContextDataSource;
}());
/* harmony default export */ var lib_PageContextDataSource = (PageContextDataSource_PageContextDataSource);

// CONCATENATED MODULE: ./lib/index.js
/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "DynamicDataReference", function() { return lib_DynamicDataReference; });
/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "_PageContextDataSource", function() { return lib_PageContextDataSource; });
/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "_DynamicDataManager", function() { return lib_DynamicDataManager; });





/***/ }),
/* 1 */
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_1__;

/***/ }),
/* 2 */
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_2__;

/***/ }),
/* 3 */
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_3__;

/***/ }),
/* 4 */
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_4__;

/***/ })
/******/ ])});;
//# sourceMappingURL=sp-dynamic-data.js.map