kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
358 lines (348 loc) • 76.3 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
var _react = _interopRequireWildcard(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _constants = require("@kepler.gl/constants");
var _layers = require("@kepler.gl/layers");
var _localization = require("@kepler.gl/localization");
var _utils = require("@kepler.gl/utils");
var _rasterTileColormapListItem = require("./raster-tile-colormap-list-item");
var _styledComponents2 = require("../../common/styled-components");
var _switch = _interopRequireDefault(require("../../common/switch"));
var _infoHelper = _interopRequireDefault(require("../../common/info-helper"));
var _itemSelector = _interopRequireDefault(require("../../common/item-selector/item-selector"));
var _visConfigSlider = _interopRequireDefault(require("../../side-panel/layer-panel/vis-config-slider"));
var _layerConfigGroup = _interopRequireWildcard(require("../../side-panel/layer-panel/layer-config-group"));
var _visConfigSwitch = _interopRequireDefault(require("../../side-panel/layer-panel/vis-config-switch"));
var _templateObject, _templateObject2, _templateObject3; // SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var STAC_SEARCH_UI_ENABLED = true;
var StyledVisConfigSwitch = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n\n .vis-config-switch__title {\n display: flex;\n }\n"])));
var CustomVisConfigSwitch = function CustomVisConfigSwitch(_ref) {
var _ref$layer = _ref.layer,
id = _ref$layer.id,
config = _ref$layer.config,
property = _ref.property,
_onChange2 = _ref.onChange,
label = _ref.label,
disabled = _ref.disabled;
return /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, {
disabled: Boolean(disabled)
}, /*#__PURE__*/_react["default"].createElement(StyledVisConfigSwitch, {
className: "vis-config-switch"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "vis-config-switch__title"
}, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, label ? /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, label && /*#__PURE__*/_react["default"].createElement(_localization.FormattedMessage, {
id: label
}) || (0, _utils.capitalizeFirstLetter)(property)) : null)), /*#__PURE__*/_react["default"].createElement("div", {
className: "vis-config-switch__switch"
}, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
checked: config.visConfig[property],
id: "".concat(id, "-").concat(property, "-switch"),
onChange: function onChange() {
return _onChange2((0, _defineProperty2["default"])({}, property, !config.visConfig[property]));
}
}))));
};
var StyledLayerConfigurator = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n margin-top: 12px;\n"])));
var DescriptionText = (0, _styledComponents["default"])(_styledComponents2.PanelLabel)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n text-transform: none;\n display: inline;\n color: ", ";\n\n a {\n text-decoration: underline;\n margin-left: 4px;\n }\n"])), function (props) {
return props.theme.subtextColor;
});
// TODO: combine these two helpers into one
function findVisConfigItemById(layer, prop) {
return layer.visConfigSettings[prop].options.find(function (op) {
return op.id === layer.config.visConfig[prop];
});
}
function findItemById(layer, options, prop) {
// For now it's possible that non-raster metadata will be passed to the raster configurator, so
// options may be null
return options === null || options === void 0 ? void 0 : options.find(function (op) {
return op.id === layer.config.visConfig[prop];
});
}
/**
* Generate drop down labels for single band selector
* @param stac - STAC item metadata object
* @returns array of {id, label} elements
*/
function getBandSelectorOptions(stac) {
var eoBands = (0, _layers.getEOBands)(stac) || [];
return eoBands.map(function (eoBand) {
return {
id: eoBand.name || eoBand.common_name,
label: eoBand.common_name ? "".concat(eoBand.name || eoBand.common_name, " (").concat(eoBand.common_name, ")") : eoBand.name
};
});
}
function getCategoricalColormapListItem(categoricalColorMap) {
var categoricalItem;
if (categoricalColorMap) {
categoricalItem = {
label: 'Categorical',
id: _layers.CATEGORICAL_COLORMAP_ID
};
}
return categoricalItem;
}
/**
* Check if data source global pixel color range is calculated correctly
* @param layer - raster layer
* @param stac - STAC metadata object
* @param preset - preset name
* @param singleBandPresetOptions - options for single band preset
* @returns boolean value
*/
function isDataSourceColorRangeAvailable(layer, stac, preset, singleBandPresetOptions) {
var minPixelValue = null;
var maxPixelValue = null;
var dataSourceParams = layer.getDataSourceParams(stac, preset, {
singleBand: singleBandPresetOptions
});
if (dataSourceParams) {
minPixelValue = dataSourceParams.minPixelValue;
maxPixelValue = dataSourceParams.maxPixelValue;
}
return minPixelValue !== null && maxPixelValue !== null;
}
/**
* Updates color parameters based on a change in visualization preset.
*
* This function adjusts the color processing parameters when the visualization
* preset changes, based on whether the preset is switching to or from a
* single-band. Determines whether to apply color
* enhancements or reset parameters based on the preset transition.
*
* @param stac A STAC (SpatioTemporal Asset Catalog) object representing the dataset.
* @param newPreset The old visualization preset being applied.
* @param newPreset The new visualization preset being applied.
* @returns The updated color parameters to apply.
*/
function updateColorParamsOnPresetChange(stac, oldPreset, newPreset) {
var colorParams = {};
var colorOverrides = _layers.DATA_SOURCE_COLOR_DEFAULTS[stac.id];
if (colorOverrides) return colorParams;
var bandOfInterest = 'singleBand';
if (oldPreset === bandOfInterest && newPreset !== bandOfInterest) {
// enchance colors for multiband combinations
colorParams = colorOverrides;
} else if (oldPreset !== bandOfInterest && newPreset === bandOfInterest) {
// reset image processng params
colorParams = _layers.RASTER_COLOR_RESET_PARAMS;
}
return colorParams;
}
RasterTileLayerConfiguratorFactory.deps = [_layerConfigGroup["default"], _visConfigSlider["default"], _infoHelper["default"], _visConfigSwitch["default"]];
function RasterTileLayerConfiguratorFactory(LayerConfigGroup, VisConfigSlider, InfoHelper, VisConfigSwitch) {
/**
* Wrapper around configurator to check for dataset.metadata being null/undefined
*/
var STACCheckConfiguratorWrapper = function STACCheckConfiguratorWrapper(_ref2) {
var layer = _ref2.layer,
visConfiguratorProps = _ref2.visConfiguratorProps,
dataset = _ref2.dataset;
var stac = dataset === null || dataset === void 0 ? void 0 : dataset.metadata;
// If no dataset is loaded into Kepler, stac can be undefined
if (!stac) {
return null;
}
return /*#__PURE__*/_react["default"].createElement(RasterTileLayerConfigurator, {
layer: layer,
visConfiguratorProps: visConfiguratorProps,
dataset: dataset
});
};
// eslint-disable-next-line complexity
var RasterTileLayerConfigurator = function RasterTileLayerConfigurator(_ref3) {
var _stac$rasterTileServe;
var layer = _ref3.layer,
visConfiguratorProps = _ref3.visConfiguratorProps,
dataset = _ref3.dataset;
var _layer$config$visConf = layer.config.visConfig,
preset = _layer$config$visConf.preset,
nonLinearRescaling = _layer$config$visConf.nonLinearRescaling,
useSTACSearching = _layer$config$visConf.useSTACSearching,
categoricalColorMap = _layer$config$visConf.colorRange.colorMap,
dynamicColor = _layer$config$visConf.dynamicColor,
singleBandName = _layer$config$visConf.singleBandName;
var stac = dataset === null || dataset === void 0 ? void 0 : dataset.metadata;
var availablePresets = (0, _react.useMemo)(function () {
return (0, _layers.filterAvailablePresets)(stac, _layers.PRESET_OPTIONS);
}, [stac]);
var presetOptions = (0, _react.useMemo)(function () {
return layer.visConfigSettings.preset.options.filter(function (_ref4) {
var id = _ref4.id;
return availablePresets === null || availablePresets === void 0 ? void 0 : availablePresets.includes(id);
});
}, [layer.visConfigSettings.preset.options, availablePresets]);
var singleBandOptions = (0, _react.useMemo)(function () {
return getBandSelectorOptions(stac);
}, [stac]);
var colormapOptions = (0, _react.useMemo)(function () {
var options = (0, _toConsumableArray2["default"])(layer.visConfigSettings.colormapId.options);
var categoricalListItem = getCategoricalColormapListItem(categoricalColorMap);
if (categoricalListItem) {
options.push(categoricalListItem);
}
return options;
}, [layer.visConfigSettings.colormapId.options, categoricalColorMap]);
var _ref5 = _layers.PRESET_OPTIONS[preset] || {},
bandCombination = _ref5.bandCombination;
var colormapAllowed = (0, _layers.isColormapAllowed)(bandCombination);
var rescalingAllowed = !categoricalColorMap && (0, _layers.isRescalingAllowed)(bandCombination);
var filterAllowed = (0, _layers.isFilterAllowed)(bandCombination);
// Here we show the UI when useSTACSearching is explicitly set to true so that the UI shows up
var stacSearchAllowed = (0, _layers.isSearchableStac)(stac) || useSTACSearching;
var selectedColormap = findVisConfigItemById(layer, 'colormapId') || getCategoricalColormapListItem(categoricalColorMap);
var selectedPreset = findVisConfigItemById(layer, 'preset');
var selectedSingleBandName = findItemById(layer, singleBandOptions, 'singleBandName');
var singleBandPresetOptions = (0, _layers.getSingleBandPresetOptions)(stac, singleBandName);
var _getRasterStatisticsM = (0, _layers.getRasterStatisticsMinMax)(stac, preset, singleBandPresetOptions),
_getRasterStatisticsM2 = (0, _slicedToArray2["default"])(_getRasterStatisticsM, 2),
minCategoricalBandValue = _getRasterStatisticsM2[0],
maxCategoricalBandValue = _getRasterStatisticsM2[1];
var ColorMapListItem = (0, _react.useMemo)(function () {
return (0, _rasterTileColormapListItem.getColorMapListItemComponent)({
colorMap: categoricalColorMap,
minValue: minCategoricalBandValue,
maxValue: maxCategoricalBandValue
});
}, [categoricalColorMap, minCategoricalBandValue, maxCategoricalBandValue]);
var isDynamicColorsOnly = !isDataSourceColorRangeAvailable(layer, stac, preset, singleBandPresetOptions);
// Default of `dynamicColor` is false. Set it true if it is not possible to get data source
// wide color range
(0, _react.useEffect)(function () {
if (isDynamicColorsOnly && !dynamicColor) {
visConfiguratorProps.onChange({
dynamicColor: true
});
}
}, [visConfiguratorProps, dynamicColor, isDynamicColorsOnly]);
var elevationUI = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (0, _utils.getApplicationConfig)().rasterServerSupportsElevation && ((_stac$rasterTileServe = stac.rasterTileServerUrls) === null || _stac$rasterTileServe === void 0 ? void 0 : _stac$rasterTileServe.length) && /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, layer.visConfigSettings.enableTerrain || {
label: 'layer.color'
}, visConfiguratorProps, {
collapsible: true
}), /*#__PURE__*/_react["default"].createElement(_layerConfigGroup.ConfigGroupCollapsibleContent, null, /*#__PURE__*/_react["default"].createElement(VisConfigSwitch, (0, _extends2["default"])({}, visConfiguratorProps, layer.visConfigSettings.enableTerrainTopView)))));
// For PMTiles in raster format, only show opacity and terrain options for now
if (stac.pmtilesType === _constants.PMTilesType.RASTER) {
return /*#__PURE__*/_react["default"].createElement(StyledLayerConfigurator, null, /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, visConfiguratorProps, {
label: "Visual Settings",
collapsible: false
}), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.opacity, visConfiguratorProps))), elevationUI);
}
return /*#__PURE__*/_react["default"].createElement(StyledLayerConfigurator, null, availablePresets && /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, visConfiguratorProps, {
label: "Image Selection",
collapsible: false
}), /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "Preset"), /*#__PURE__*/_react["default"].createElement(InfoHelper, {
id: "preset",
description: "Select a preset to describe how to combine spectral bands."
})), /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], {
selectedItems: selectedPreset,
options: presetOptions,
multiSelect: false,
searchable: false,
displayOption: "label",
getOptionValue: "id",
onChange: function onChange(newPreset) {
var overrides = updateColorParamsOnPresetChange(stac, visConfiguratorProps.layer.config.visConfig.preset, newPreset);
visConfiguratorProps.onChange(_objectSpread(_objectSpread({}, overrides), {}, {
preset: newPreset
}));
}
}), selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.description ? /*#__PURE__*/_react["default"].createElement(DescriptionText, null, selectedPreset === null || selectedPreset === void 0 ? void 0 : selectedPreset.description, selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.infoUrl ? /*#__PURE__*/_react["default"].createElement("a", {
target: "_blank",
rel: "noopener noreferrer",
href: selectedPreset === null || selectedPreset === void 0 ? void 0 : selectedPreset.infoUrl
}, "More Info") : null) : null), selectedPreset.id === 'singleBand' && /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "Single Band Name"), /*#__PURE__*/_react["default"].createElement(InfoHelper, {
id: "".concat(layer.id, "-single-band-name"),
description: "Select a single band."
})), /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], {
selectedItems: selectedSingleBandName,
options: singleBandOptions,
multiSelect: false,
searchable: false,
displayOption: "label",
getOptionValue: "id",
onChange: function onChange(val) {
visConfiguratorProps.onChange({
singleBandName: val
});
}
})), STAC_SEARCH_UI_ENABLED && stacSearchAllowed && /*#__PURE__*/_react["default"].createElement(CustomVisConfigSwitch, (0, _extends2["default"])({}, layer.visConfigSettings.useSTACSearching, visConfiguratorProps)), STAC_SEARCH_UI_ENABLED && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, stacSearchAllowed && useSTACSearching ? /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "STAC Search Provider")), /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], (0, _extends2["default"])({}, layer.visConfigSettings.stacSearchProvider, {
selectedItems: findVisConfigItemById(layer, 'stacSearchProvider'),
placeholder: "Choose search provider",
multiSelect: false,
searchable: false,
displayOption: "label",
getOptionValue: "id",
onChange: function onChange(val) {
// TODO: check when switching layers so that you don't mismatch allowed mosaics with layers
visConfiguratorProps.onChange({
stacSearchProvider: val
});
}
})), /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "Date Range")), /*#__PURE__*/_react["default"].createElement(_styledComponents2.Input, {
type: "text",
id: "".concat(layer.id, "-startDate"),
onChange: function onChange(_ref6) {
var value = _ref6.target.value;
visConfiguratorProps.onChange({
startDate: value
});
},
value: layer.config.visConfig.startDate
}), /*#__PURE__*/_react["default"].createElement(_styledComponents2.Input, {
type: "text",
id: "".concat(layer.id, "-endDate"),
onChange: function onChange(_ref7) {
var value = _ref7.target.value;
visConfiguratorProps.onChange({
endDate: value
});
},
value: layer.config.visConfig.endDate
}), /*#__PURE__*/_react["default"].createElement(DescriptionText, null, "Date format must be \"YYYY-MM-DD\"")) : null)), /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, visConfiguratorProps, {
label: "Visual Settings",
collapsible: false
}), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.opacity, visConfiguratorProps)), colormapAllowed && /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "Colormap"), /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], {
selectedItems: selectedColormap,
options: colormapOptions,
multiSelect: false,
displayOption: "label",
getOptionValue: "id",
onChange: function onChange(val) {
visConfiguratorProps.onChange({
colormapId: val
});
},
DropDownLineItemRenderComponent: ColorMapListItem,
filterOption: "label",
searchable: true
}))), rescalingAllowed && /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, visConfiguratorProps, {
label: "Rescaling"
}), /*#__PURE__*/_react["default"].createElement(VisConfigSwitch, (0, _extends2["default"])({}, visConfiguratorProps, layer.visConfigSettings.dynamicColor, {
disabled: isDynamicColorsOnly
})), /*#__PURE__*/_react["default"].createElement(VisConfigSwitch, (0, _extends2["default"])({}, layer.visConfigSettings.nonLinearRescaling, visConfiguratorProps, {
label: nonLinearRescaling ? 'Non-Linear Rescaling' : 'Linear Rescaling'
})), nonLinearRescaling ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.gammaContrastFactor, visConfiguratorProps)), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.sigmoidalContrastFactor, visConfiguratorProps)), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.sigmoidalBiasFactor, visConfiguratorProps))) : /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.linearRescalingFactor, visConfiguratorProps)), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.saturationValue, visConfiguratorProps))), filterAllowed && /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, layer.visConfigSettings.filterEnabled, visConfiguratorProps, {
collapsible: true
}), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.filterRange, visConfiguratorProps))), elevationUI);
};
return STACCheckConfiguratorWrapper;
}
var _default = exports["default"] = RasterTileLayerConfiguratorFactory;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfc3R5bGVkQ29tcG9uZW50cyIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJfY29uc3RhbnRzIiwiX2xheWVycyIsIl9sb2NhbGl6YXRpb24iLCJfdXRpbHMiLCJfcmFzdGVyVGlsZUNvbG9ybWFwTGlzdEl0ZW0iLCJfc3R5bGVkQ29tcG9uZW50czIiLCJfc3dpdGNoIiwiX2luZm9IZWxwZXIiLCJfaXRlbVNlbGVjdG9yIiwiX3Zpc0NvbmZpZ1NsaWRlciIsIl9sYXllckNvbmZpZ0dyb3VwIiwiX3Zpc0NvbmZpZ1N3aXRjaCIsIl90ZW1wbGF0ZU9iamVjdCIsIl90ZW1wbGF0ZU9iamVjdDIiLCJfdGVtcGxhdGVPYmplY3QzIiwiX2dldFJlcXVpcmVXaW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biAgICAgICAgICBzdGFjLnJhc3RlclRpbGVTZXJ2ZXJVcmxzPy5sZW5ndGggJiYgKFxuICAgICAgICAgICAgPExheWVyQ29uZmlnR3JvdXBcbiAgICAgICAgICAgICAgey4uLihsYXllci52aXNDb25maWdTZXR0aW5ncy5lbmFibGVUZXJyYWluIHx8IHtsYWJlbDogJ2xheWVyLmNvbG9yJ30pfVxuICAgICAgICAgICAgICB7Li4udmlzQ29uZmlndXJhdG9yUHJvcHN9XG4gICAgICAgICAgICAgIGNvbGxhcHNpYmxlXG4gICAgICAgICAgICA+XG4gICAgICAgICAgICAgIDxDb25maWdHcm91cENvbGxhcHNpYmxlQ29udGVudD5cbiAgICAgICAgICAgICAgICA8VmlzQ29uZmlnU3dpdGNoXG4gICAgICAgICAgICAgICAgICB7Li4udmlzQ29uZmlndXJhdG9yUHJvcHN9XG4gICAgICAgICAgICAgICAgICB7Li4ubGF5ZXIudmlzQ29uZmlnU2V0dGluZ3MuZW5hYmxlVGVycmFpblRvcFZpZXd9XG4gICAgICAgICAgICAgICAgLz5cbiAgICAgICAgICAgICAgPC9Db25maWdHcm91cENvbGxhcHNpYmxlQ29udGVudD5cbiAgICAgICAgICAgIDwvTGF5ZXJDb25maWdHcm91cD5cbiAgICAgICAgICApfVxuICAgICAgPC8+XG4gICAgKTtcblxuICAgIC8vIEZvciBQTVRpbGVzIGluIHJhc3RlciBmb3JtYXQsIG9ubHkgc2hvdyBvcGFjaXR5IGFuZCB0ZXJyYWluIG9wdGlvbnMgZm9yIG5vd1xuICAgIGlmIChzdGFjLnBtdGlsZXNUeXBlID09PSBQTVRpbGVzVHlwZS5SQVNURVIpIHtcbiAgICAgIHJldHVybiAoXG4gICAgICAgIDxTdHlsZWRMYXllckNvbmZpZ3VyYXRvcj5cbiAgICAgICAgICA8TGF5ZXJDb25maWdHcm91cCB7Li4udmlzQ29uZmlndXJhdG9yUHJvcHN9IGxhYmVsPVwiVmlzdWFsIFNldHRpbmdzXCIgY29sbGFwc2libGU9e2ZhbHNlfT5cbiAgICAgICAgICAgIDxWaXNDb25maWdTbGlkZXIgey4uLmxheWVyLnZpc0NvbmZpZ1NldHRpbmdzLm9wYWNpdHl9IHsuLi52aXNDb25maWd1cmF0b3JQcm9wc30gLz5cbiAgICAgICAgICA8L0xheWVyQ29uZmlnR3JvdXA+XG4gICAgICAgICAge2VsZXZhdGlvblVJfVxuICAgICAgICA8L1N0eWxlZExheWVyQ29uZmlndXJhdG9yPlxuICAgICAgKTtcbiAgICB9XG5cbiAgICByZXR1cm4gKFxuICAgICAgPFN0eWxlZExheWVyQ29uZmlndXJhdG9yPlxuICAgICAgICB7YXZhaWxhYmxlUHJlc2V0cyAmJiAoXG4gICAgICAgICAgPExheWVyQ29uZmlnR3JvdXAgey4uLnZpc0NvbmZpZ3VyYXRvclByb3BzfSBsYWJlbD1cIkltYWdlIFNlbGVjdGlvblwiIGNvbGxhcHNpYmxlPXtmYWxzZX0+XG4gICAgICAgICAgICA8U2lkZVBhbmVsU2VjdGlvbj5cbiAgICAgICAgICAgICAgPFBhbmVsTGFiZWxXcmFwcGVyPlxuICAgICAgICAgICAgICAgIDxQYW5lbExhYmVsPlByZXNldDwvUGFuZWxMYWJlbD5cbiAgICAgICAgICAgICAgICA8SW5mb0hlbHBlclxuICAgICAgICAgICAgICAgICAgaWQ9XCJwcmVzZXRcIlxuICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb249XCJTZWxlY3QgYSBwcmVzZXQgdG8gZGVzY3JpYmUgaG93IHRvIGNvbWJpbmUgc3BlY3RyYWwgYmFuZHMuXCJcbiAgICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgICA8L1BhbmVsTGFiZWxXcmFwcGVyPlxuICAgICAgICAgICAgICA8SXRlbVNlbGVjdG9yXG4gICAgICAgICAgICAgICAgc2VsZWN0ZWRJdGVtcz17c2VsZWN0ZWRQcmVzZXR9XG4gICAgICAgICAgICAgICAgb3B0aW9ucz17cHJlc2V0T3B0aW9uc31cbiAgICAgICAgICAgICAgICBtdWx0aVNlbGVjdD17ZmFsc2V9XG4gICAgICAgICAgICAgICAgc2VhcmNoYWJsZT17ZmFsc2V9XG4gICAgICAgICAgICAgICAgZGlzcGxheU9wdGlvbj1cImxhYmVsXCJcbiAgICAgICAgICAgICAgICBnZXRPcHRpb25WYWx1ZT1cImlkXCJcbiAgICAgICAgICAgICAgICBvbkNoYW5nZT17bmV3UHJlc2V0ID0+IHtcbiAgICAgICAgICAgICAgICAgIGNvbnN0IG92ZXJyaWRlcyA9IHVwZGF0ZUNvbG9yUGFyYW1zT25QcmVzZXRDaGFuZ2UoXG4gICAgICAgICAgICAgICAgICAgIHN0YWMsXG4gICAgICAgICAgICAgICAgICAgIHZpc0NvbmZpZ3VyYXRvclByb3BzLmxheWVyLmNvbmZpZy52aXNDb25maWcucHJlc2V0LFxuICAgICAgICAgICAgICAgICAgICBuZXdQcmVzZXQgYXMgc3RyaW5nXG4gICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgdmlzQ29uZmlndXJhdG9yUHJvcHMub25DaGFuZ2Uoey4uLm92ZXJyaWRlcywgcHJlc2V0OiBuZXdQcmVzZXR9KTtcbiAgICAgICAgICAgICAgICB9fVxuICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgICB7c2VsZWN0ZWRQcmVzZXQ/LmRlc2NyaXB0aW9uID8gKFxuICAgICAgICAgICAgICAgIDxEZXNjcmlwdGlvblRleHQ+XG4gICAgICAgICAgICAgICAgICB7c2VsZWN0ZWRQcmVzZXQ/LmRlc2NyaXB0aW9ufVxuICAgICAgICAgICAgICAgICAge3NlbGVjdGVkUHJlc2V0Py5pbmZvVXJsID8gKFxuICAgICAgICAgICAgICAgICAgICA8YSB0YXJnZXQ9XCJfYmxhbmtcIiByZWw9XCJub29wZW5lciBub3JlZmVycmVyXCIgaHJlZj17c2VsZWN0ZWRQcmVzZXQ/LmluZm9Vcmx9PlxuICAgICAgICAgICAgICAgICAgICAgIE1vcmUgSW5mb1xuICAgICAgICAgICAgICAgICAgICA8L2E+XG4gICAgICAgICAgICAgICAgICApIDogbnVsbH1cbiAgICAgICAgICAgICAgICA8L0Rlc2NyaXB0aW9uVGV4dD5cbiAgICAgICAgICAgICAgKSA6IG51bGx9XG4gICAgICAgICAgICA8L1NpZGVQYW5lbFNlY3Rpb24+XG5cbiAgICAgICAgICAgIHtzZWxlY3RlZFByZXNldC5pZCA9PT0gJ3NpbmdsZUJhbmQnICYmIChcbiAgICAgICAgICAgICAgPFNpZGVQYW5lbFNlY3Rpb24+XG4gICAgICAgICAgICAgICAgPFBhbmVsTGFiZWxXcmFwcGVyPlxuICAgICAgICAgICAgICAgICAgPFBhbmVsTGFiZWw+U2luZ2xlIEJhbmQgTmFtZTwvUGFuZWxMYWJlbD5cbiAgICAgICAgICAgICAgICAgIDxJbmZvSGVscGVyXG4gICAgICAgICAgICAgICAgICAgIGlkPXtgJHtsYXllci5pZH0tc2luZ2xlLWJhbmQtbmFtZWB9XG4gICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uPVwiU2VsZWN0IGEgc2luZ2xlIGJhbmQuXCJcbiAgICAgICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICAgICAgPC9QYW5lbExhYmVsV3JhcHBlcj5cbiAgICAgICAgICAgICAgICA8SXRlbVNlbGVjdG9yXG4gICAgICAgICAgICAgICAgICBzZWxlY3RlZEl0ZW1zPXtzZWxlY3RlZFNpbmdsZUJhbmROYW1lfVxuICAgICAgICAgICAgICAgICAgb3B0aW9ucz17c2luZ2xlQmFuZE9wdGlvbnN9XG4gICAgICAgICAgICAgICAgICBtdWx0aVNlbGVjdD17ZmFsc2V9XG4gICAgICAgICAgICAgICAgICBzZWFyY2hhYmxlPXtmYWxzZX1cbiAgICAgICAgICAgICAgICAgIGRpc3BsYXlPcHRpb249XCJsYWJlbFwiXG4gICAgICAgICAgICAgICAgICBnZXRPcHRpb25WYWx1ZT1cImlkXCJcbiAgICAgICAgICAgICAgICAgIG9uQ2hhbmdlPXt2YWwgPT4ge1xuICAgICAgICAgICAgICAgICAgICB2aXNDb25maWd1cmF0b3JQcm9wcy5vbkNoYW5nZSh7c2luZ2xlQmFuZE5hbWU6IHZhbH0pO1xuICAgICAgICAgICAgICAgICAgfX1cbiAgICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgICA8L1NpZGVQYW5lbFNlY3Rpb24+XG4gICAgICAgICAgICApfVxuXG4gICAgICAgICAgICB7U1RBQ19TRUFSQ0hfVUlfRU5BQkxFRCAmJiBzdGFjU2VhcmNoQWxsb3dlZCAmJiAoXG4gICAgICAgICAgICAgIDxDdXN0b21WaXNDb25maWdTd2l0Y2hcbiAgICAgICAgICAgICAgICB7Li4ubGF5ZXIudmlzQ29uZmlnU2V0dGluZ3MudXNlU1RBQ1NlYXJjaGluZ31cbiAgICAgICAgICAgICAgICB7Li4udmlzQ29uZmlndXJhdG9yUHJvcHN9XG4gICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICApfVxuXG4gICAgICAgICAgICB7U1RBQ19TRUFSQ0hfVUlfRU5BQkxFRCAmJiAoXG4gICAgICAgICAgICAgIDw+XG4gICAgICAgICAgICAgICAge3N0YWNTZWFyY2hBbGxvd2VkICYmIHVzZVNUQUNTZWFyY2hpbmcgPyAoXG4gICAgICAgICAgICAgICAgICA8U2lkZVBhbmVsU2VjdGlvbj5cbiAgICAgICAgICAgICAgICAgICAgPFBhbmVsTGFiZWxXcmFwcGVyPlxuICAgICAgICAgICAgICAgICAgICAgIDxQYW5lbExhYmVsPlNUQUMgU2VhcmNoIFByb3ZpZGVyPC9QYW5lbExhYmVsPlxuICAgICAgICAgICAgICAgICAgICA8L1BhbmVsTGFiZWxXcmFwcGVyPlxuICAgICAgICAgICAgICAgICAgICA8SXRlbVNlbGVjdG9yXG4gICAgICAgICAgICAgICAgICAgICAgey4uLmxheWVyLnZpc0NvbmZpZ1NldHRpbmdzLnN0YWNTZWFyY2hQcm92aWRlcn1cbiAgICAgICAgICAgICAgICAgICAgICBzZWxlY3RlZEl0ZW1zPXtmaW5kVmlzQ29uZmlnSXRlbUJ5SWQobGF5ZXIsICdzdGFjU2VhcmNoUHJvdmlkZXInKX1cbiAgICAgICAgICAgICAgICAgICAgICBwbGFjZWhvbGRlcj1cIkNob29zZSBzZWFyY2ggcHJvdmlkZXJcIlxuICAgICAgICAgICAgICAgICAgICAgIG11bHRpU2VsZWN0PXtmYWxzZX1cbiAgICAgICAgICAgICAgICAgICAgICBzZWFyY2hhYmxlPXtmYWxzZX1cbiAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5T3B0aW9uPVwibGFiZWxcIlxuICAgICAgICAgICAgICAgICAgICAgIGdldE9wdGlvblZhbHVlPVwiaWRcIlxuICAgICAgICAgICAgICAgICAgICAgIG9uQ2hhbmdlPXt2YWwgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gVE9ETzogY2hlY2sgd2hlbiBzd2l0Y2hpbmcgbGF5ZXJzIHNvIHRoYXQgeW91IGRvbid0IG1pc21hdGNoIGFsbG93ZWQgbW9zYWljcyB3aXRoIGxheWVyc1xuICAgICAgICAgICAgICAgICAgICAgICAgdmlzQ29uZmlndXJhdG9yUHJvcHMub25DaGFuZ2Uoe3N0YWNTZWFyY2hQcm92aWRlcjogdmFsfSk7XG4gICAgICAgICAgICAgICAgICAgICAgfX1cbiAgICAgICAgICAgICAgICAgICAgLz5cblxuICAgICAgICAgICAgICAgICAgICA8UGFuZWxMYWJlbFdyYXBwZXI+XG4gICAgICAgICAgICAgICAgICAgICAgPFBhbmVsTGFiZWw+RGF0ZSBSYW5nZTwvUGFuZWxMYWJlbD5cbiAgICAgICAgICAgICAgICAgICAgPC9QYW5lbExhYmVsV3JhcHBlcj5cbiAgICAgICAgICAgICAgICAgICAgPElucHV0XG4gICAgICAgICAgICAgICAgICAgICAgdHlwZT1cInRleHRcIlxuICAgICAgICAgICAgICAgICAgICAgIGlkPXtgJHtsYXllci5pZH0tc3RhcnREYXRlYH1cbiAgICAgICAgICAgICAgICA