
BoldBI Embedded: ' + errorMsg + '
';
- document.getElementById(embedContainerId).innerHTML = errorMessage;
- }
- else {
- alert(errorMsg);
- }
- if (!this._isNullOrUndefined(this.embedOptions.onError) && this.embedOptions.onError != '') {
- const errormessage = new Error('BoldBI Embedded: ' + errorMsg);
- this.onErrorClient(errormessage);
- }
- else {
- throw new Error('BoldBI Embedded: ' + errorMsg);
- }
- }
- //The method uses to passes the client side error.
- onErrorClient(errorMessage) {
- const errorDetail = {
- errorStatus: true,
- StatusMessage: errorMessage,
- StatusCode: 500
- };
- const clientFnc = window[this.embedOptions.onError];
- if (clientFnc instanceof Function) {
- clientFnc.call(this, errorDetail);
- }
- if (this.embedOptions.onError instanceof Function) {
- this.embedOptions.onError.call(this, errorDetail);
- }
- }
- _removeElementsClass(id, childElement, targeClass) {
- let nodeList = [];
- if (this._isEmptyOrSpaces(id)) {
- nodeList = document.querySelector(childElement);
- }
- else if (this._isEmptyOrSpaces(childElement)) {
- nodeList.push(document.getElementById(id));
- }
- else {
- nodeList = document.getElementById(id).querySelectorAll(childElement);
- }
- nodeList.forEach(function (element) {
- this._removeClass(element, targeClass);
- }.bind(this));
- }
- _hasClass(el, className) {
- if (el.classList) {
- return el.classList.contains(className);
- }
- const regex = RegExp;
- return !!el.className.match(new regex('(\\s|^)' + className + '(\\s|$)'));
- }
- _addClass(el, className) {
- if (el.classList) {
- el.classList.add(className);
- }
- else if (!this._hasClass(el, className)) {
- el.className += ' ' + className;
- }
- }
- _removeClass(el, className) {
- if (el.classList) {
- el.classList.remove(className);
- }
- else if (this._hasClass(el, className)) {
- const regex = RegExp;
- const reg = new regex('(\\s|^)' + className + '(\\s|$)');
- el.className = el.className.replace(reg, ' ');
- }
- }
- _arraySlice(arr, key, value) {
- arr.forEach(function (item, index, object) {
- if (item[`${key}`] == value) {
- object.splice(index, 1);
- }
- }.bind(this));
- return arr;
- }
- _getFilterData(filterQuery) {
- const processData = { masterData: [] };
- const decryptfilterParam = decodeURI(filterQuery).
- replace(/~&~/g, String.fromCharCode(251) + String.fromCharCode(251)).
- replace(/~=~/g, String.fromCharCode(250) + String.fromCharCode(250)).
- replace(/~[?]~/g, String.fromCharCode(253) + String.fromCharCode(253)).
- replace(/~[/]~/g, String.fromCharCode(254) + String.fromCharCode(254)).
- replace(/&&/g, '&').
- replace(/&/g, '|,|').
- replace(/=/g, '|:|').
- replace(/~,~/g, String.fromCharCode(252) + String.fromCharCode(252));
- const splitFilterParamObj = decryptfilterParam.split('|,|');
- for (let index = 0; index < splitFilterParamObj.length; index++) {
- const splitFilterQuery = splitFilterParamObj[`${index}`].split('|:|');
- if (splitFilterQuery.length >= 2 && splitFilterQuery[0].trim().toUpperCase() == 'FILTERQUERY') {
- const filterValue = splitFilterQuery[1];
- const filterData = bbEmbed.parseJSON(filterValue);
- if (filterData != '' && filterData.length != 0) {
- processData.masterData = this._lengthensSelectedFilterInfo(filterData);
- this._unEscapeSelectedFilterDataforURLFilter(processData.masterData);
- }
- continue;
- }
- }
- return this._createFilterCollection(processData.masterData);
- }
- _createFilterCollection(masterdata) {
- if (masterdata) {
- const collection = [];
- masterdata.forEach(function (filter) {
- let columnName = filter.ColumnName;
- let values = [];
- if (filter.InitialDateFilter.DisplayDateFilterList.length > 0) {
- values = filter.InitialDateFilter.DisplayDateFilterList;
- if (filter.IsRange) {
- values = [values[0] + ' - ' + values[1]];
- }
- }
- if (filter.InitialMeasureFilter.Values.length > 0) {
- values = filter.InitialMeasureFilter.Values;
- }
- if (filter.InitialDimensionFilter.Text.length > 0) {
- values = filter.InitialDimensionFilter.Text;
- columnName = columnName + ' (' + filter.InitialDimensionFilter.DimesnionFilterCondition + ')';
- }
- if (filter.InitialDimensionFilter.Text.length > 0) {
- values = filter.InitialDimensionFilter.Text;
- }
- collection.push({ 'ColumnName': columnName, 'Values': values });
- }.bind(this));
- return collection;
- }
- }
- _lengthensSelectedFilterInfo(shortenFilterInfoList) {
- const unMinifiedList = [];
- const shortenListLen = shortenFilterInfoList.length;
- for (let index = 0; index < shortenListLen; index++) {
- const minObj = shortenFilterInfoList[`${index}`];
- const unMinifyObj = new SelectedFilterValue();
- if (this._hasValue(minObj, shortenEnum.UniqueColumnName)) {
- unMinifyObj[lengthenEnum.UniqueColumnName] = minObj[shortenEnum.UniqueColumnName];
- }
- if (this._hasValue(minObj, shortenEnum.ReportName)) {
- unMinifyObj[lengthenEnum.ReportName] = minObj[shortenEnum.ReportName];
- }
- if (this._hasValue(minObj, shortenEnum.IsStdDateTime)) {
- unMinifyObj[lengthenEnum.IsStdDateTime] = minObj[shortenEnum.IsStdDateTime];
- }
- if (this._hasValue(minObj, shortenEnum.IsRange)) {
- unMinifyObj[lengthenEnum.IsRange] = minObj[shortenEnum.IsRange];
- }
- if (this._hasValue(minObj, shortenEnum.IsGroupBarFilter)) {
- unMinifyObj[lengthenEnum.IsGroupBarFilter] = minObj[shortenEnum.IsGroupBarFilter];
- }
- if (this._hasValue(minObj, shortenEnum.IsMultiSelection)) {
- unMinifyObj[lengthenEnum.IsMultiSelection] = minObj[shortenEnum.IsMultiSelection];
- }
- if (this._hasValue(minObj, shortenEnum.ColumnName)) {
- unMinifyObj[lengthenEnum.ColumnName] = minObj[shortenEnum.ColumnName];
- }
- if (this._hasValue(minObj, shortenEnum.FieldId)) {
- unMinifyObj[lengthenEnum.FieldId] = minObj[shortenEnum.FieldId];
- }
- if (this._hasValue(minObj, shortenEnum.IsPoPWidget)) {
- unMinifyObj[lengthenEnum.IsPoPWidget] = minObj[shortenEnum.IsPoPWidget];
- }
- if (this._hasValue(minObj, shortenEnum.InitialDateFilter)) {
- if (this._hasValue(minObj[shortenEnum.InitialDateFilter], shortenEnum.DateFilterCondition)) {
- unMinifyObj.InitialDateFilter[lengthenEnum.DateFilterCondition] =
- minObj[shortenEnum.InitialDateFilter][shortenEnum.DateFilterCondition];
- }
- if (this._hasValue(minObj[shortenEnum.InitialDateFilter], shortenEnum.DateFilterList)) {
- unMinifyObj.InitialDateFilter[lengthenEnum.DateFilterList] =
- minObj[shortenEnum.InitialDateFilter][shortenEnum.DateFilterList];
- }
- if (this._hasValue(minObj[shortenEnum.InitialDateFilter], shortenEnum.DateFilterType)) {
- unMinifyObj.InitialDateFilter[lengthenEnum.DateFilterType] =
- minObj[shortenEnum.InitialDateFilter][shortenEnum.DateFilterType];
- }
- if (this._hasValue(minObj[shortenEnum.InitialDateFilter], shortenEnum.DisplayDateFilterList)) {
- unMinifyObj.InitialDateFilter[lengthenEnum.DisplayDateFilterList] =
- minObj[shortenEnum.InitialDateFilter][shortenEnum.DisplayDateFilterList];
- }
- if (this._hasValue(minObj[shortenEnum.InitialDateFilter], shortenEnum.DateFormat)) {
- unMinifyObj.InitialDateFilter[lengthenEnum.DateFormat] =
- minObj[shortenEnum.InitialDateFilter][shortenEnum.DateFormat];
- }
- if (this._hasValue(minObj[shortenEnum.InitialDateFilter], shortenEnum.SelectedRangeforRelativeFilter)) {
- unMinifyObj.InitialDateFilter[lengthenEnum.SelectedRangeforRelativeFilter] =
- minObj[shortenEnum.InitialDateFilter][shortenEnum.SelectedRangeforRelativeFilter];
- }
- }
- if (this._hasValue(minObj, shortenEnum.InitialDimensionFilter)) {
- if (this._hasValue(minObj[shortenEnum.InitialDimensionFilter], shortenEnum.DimesnionFilterCondition)) {
- unMinifyObj.InitialDimensionFilter[lengthenEnum.DimesnionFilterCondition] =
- minObj[shortenEnum.InitialDimensionFilter][shortenEnum.DimesnionFilterCondition];
- }
- if (this._hasValue(minObj[shortenEnum.InitialDimensionFilter], shortenEnum.Text)) {
- unMinifyObj.InitialDimensionFilter[lengthenEnum.Text] = minObj[shortenEnum.InitialDimensionFilter][shortenEnum.Text];
- }
- }
- if (this._hasValue(minObj, shortenEnum.InitialMeasureFilter)) {
- if (this._hasValue(minObj[shortenEnum.InitialMeasureFilter], shortenEnum.MeasureFilterCondition)) {
- unMinifyObj.InitialMeasureFilter[lengthenEnum.MeasureFilterCondition] =
- minObj[shortenEnum.InitialMeasureFilter][shortenEnum.MeasureFilterCondition];
- }
- if (this._hasValue(minObj[shortenEnum.InitialMeasureFilter], shortenEnum.Values)) {
- unMinifyObj.InitialMeasureFilter[lengthenEnum.Values] = minObj[shortenEnum.InitialMeasureFilter][shortenEnum.Values];
- }
- }
- if (this._hasValue(minObj, shortenEnum.PoPFilter)) {
- if (this._hasValue(minObj[shortenEnum.PoPFilter], shortenEnum.DateFieldId)) {
- unMinifyObj.PoPFilter[lengthenEnum.DateFieldId] = minObj[shortenEnum.PoPFilter][shortenEnum.DateFieldId];
- }
- if (this._hasValue(minObj[shortenEnum.PoPFilter], shortenEnum.PrimaryType)) {
- unMinifyObj.PoPFilter[lengthenEnum.PrimaryType] = minObj[shortenEnum.PoPFilter][shortenEnum.PrimaryType];
- }
- if (this._hasValue(minObj[shortenEnum.PoPFilter], shortenEnum.SecondaryType)) {
- unMinifyObj.PoPFilter[lengthenEnum.SecondaryType] = minObj[shortenEnum.PoPFilter][shortenEnum.SecondaryType];
- }
- if (this._hasValue(minObj[shortenEnum.PoPFilter], shortenEnum.PrimaryCustomRange)) {
- unMinifyObj.PoPFilter[lengthenEnum.PrimaryCustomRange][lengthenEnum.StartRange] = minObj[shortenEnum.PoPFilter][shortenEnum.PrimaryCustomRange][shortenEnum.StartRange];
- unMinifyObj.PoPFilter[lengthenEnum.PrimaryCustomRange][lengthenEnum.EndRange] = minObj[shortenEnum.PoPFilter][shortenEnum.PrimaryCustomRange][shortenEnum.EndRange];
- }
- if (this._hasValue(minObj[shortenEnum.PoPFilter], shortenEnum.SecondaryCustomRange)) {
- if (minObj[shortenEnum.PoPFilter][shortenEnum.SecondaryCustomRange].length > 0) {
- unMinifyObj.PoPFilter[lengthenEnum.SecondaryCustomRange][0][lengthenEnum.StartRange] = minObj[shortenEnum.PoPFilter][shortenEnum.SecondaryCustomRange][0][shortenEnum.StartRange];
- unMinifyObj.PoPFilter[lengthenEnum.SecondaryCustomRange][0][lengthenEnum.EndRange] = minObj[shortenEnum.PoPFilter][shortenEnum.SecondaryCustomRange][0][shortenEnum.EndRange];
- }
- }
- }
- if (this._hasValue(unMinifyObj, lengthenEnum.UniqueColumnName) && this._hasValue(unMinifyObj, lengthenEnum.ReportName)) {
- unMinifiedList.push(unMinifyObj);
- }
- }
- return unMinifiedList;
- }
- _hasValue(filterObj, property) {
- return !this._isNullOrUndefined(filterObj) && !this._isNullOrUndefined(filterObj[`${property}`]);
- }
- _unEscapeSelectedFilterDataforURLFilter(filterInfoList) {
- for (let index = 0; index < filterInfoList.length; index++) {
- const filterInfo = filterInfoList[`${index}`];
- if ((!this._isNullOrUndefined(filterInfo.InitialDimensionFilter.Text) && filterInfo.InitialDimensionFilter.Text.length != 0)) {
- for (let i = 0; i < filterInfo.InitialDimensionFilter.Text.length; i++) {
- filterInfo.InitialDimensionFilter.Text[`${i}`] = filterInfo.InitialDimensionFilter.Text[`${i}`].replaceAll(String.fromCharCode(252) + String.fromCharCode(252), ',').
- replaceAll(String.fromCharCode(251) + String.fromCharCode(251), '&').
- replaceAll(String.fromCharCode(250) + String.fromCharCode(250), '=').
- replaceAll(String.fromCharCode(253) + String.fromCharCode(253), '?').
- replaceAll(String.fromCharCode(254) + String.fromCharCode(254), '/');
- }
- }
- }
- return filterInfoList;
- }
- _getWidgetFilterInfo() {
- const widgetId = this._widgetsCollection;
- const widgetDetails = [];
- if (Array.isArray(widgetId) == true) {
- for (let i = 0; i < widgetId.length; i++) {
- let filtersDetails = BoldBI._gettinstance(document.getElementById(this.embedOptions.embedContainerId), 'embeddedBoldBIWidget_' + widgetId[`${i}`]);
- filtersDetails = Array.isArray(filtersDetails) ? filtersDetails : [filtersDetails];
- const filtervalue = [];
- let filterscolumn;
- for (let k = 0; k < filtersDetails.length; k++) {
- if (filtersDetails[`${k}`].includes('=')) {
- filterscolumn = {
- columnName: filtersDetails[`${k}`].split('=')[0].toString(),
- values: filtersDetails[`${k}`].split('=')[1].split(',')
- };
- }
- else {
- filterscolumn = {
- values: filtersDetails
- };
- }
- filtervalue[filtervalue.length] = filterscolumn;
- }
- const widgetValue = {
- id: widgetId[`${i}`],
- filters: filtervalue
- };
- widgetDetails[widgetDetails.length] = widgetValue;
- }
- }
- return widgetDetails;
- }
- addStyles() {
- const that = this;
- that._loadDepedentFiles();
- }
- destroyStyles() {
- const that = this;
- document.querySelectorAll('link').forEach(function (node) {
- that.cssFiles.forEach(function (file) {
- if (node.href.toLowerCase().indexOf(file.toLowerCase()) != -1) {
- node.parentNode.removeChild(node);
- }
- });
- });
- }
- static _putinstance(element, key, obj) {
- //_storage = new WeakMap();
- if (!BoldBI._storage.has(element)) {
- BoldBI._storage.set(element, new Map());
- }
- BoldBI._storage.get(element).set(key, obj);
- }
- static _gettinstance(element, key) {
- if (BoldBI._storage.has(element)) {
- return BoldBI._storage.get(element).get(key);
- }
- }
- static _hasinstance(element, key) {
- return BoldBI._storage.has(element) && BoldBI._storage.get(element).has(key);
- }
- static _removeinstance(element, key) {
- if (BoldBI._storage.has(element)) {
- const ret = BoldBI._storage.get(element).delete(key);
- if (BoldBI._storage.get(element).size != 0) {
- BoldBI._storage.delete(element);
- }
- return ret;
- }
- }
-}
-BoldBI.Mode = Object.freeze({ 'View': 'view', 'Design': 'design', 'Connection': 'connection', 'DataSource': 'datasource' });
-BoldBI.EmbedType = Object.freeze({ 'Component': 'component', 'IFrame': 'iframe' });
-BoldBI.Environment = Object.freeze({ 'Enterprise': 'onpremise', 'Cloud': 'cloud' });
-BoldBI.Theme = Object.freeze({ 'Off': 'off', 'Light': 'light', 'Dark': 'dark' });
-BoldBI._storage = new WeakMap();
-BoldBI._widgetsCollection = [];
-class widgetBI {
- constructor() {
- this.containerID = '';
- this.widgetCollection = [];
- }
- setFilterParameters(filters) {
- const widgetId = this.widgetCollection;
- if (Array.isArray(widgetId) == true) {
- if (BoldBI._hasinstance(document.getElementById(this.containerID), 'embeddedBoldBIWidget_' + widgetId[widgetId.length - 1])) {
- BoldBI._putinstance(document.getElementById(this.containerID), 'embeddedBoldBIWidget_' + widgetId[widgetId.length - 1], filters);
- }
- }
- }
-}
\ No newline at end of file
+(()=>{"use strict";var e={123:(e,t)=>{var i,s,n,o;Object.defineProperty(t,"__esModule",{value:!0}),t.Theme=t.Environment=t.EmbedType=t.Mode=void 0,function(e){e.View="view",e.Design="design",e.Connection="connection",e.DataSource="datasource"}(i||(t.Mode=i={})),function(e){e.Component="component",e.IFrame="iframe"}(s||(t.EmbedType=s={})),function(e){e.Enterprise="onpremise",e.Cloud="cloud"}(n||(t.Environment=n={})),function(e){e.Off="off",e.Light="light",e.Dark="dark"}(o||(t.Theme=o={}))},176:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.successMessages=t.errorMessages=void 0,t.errorMessages={EmbedModeInvalid:"Invalid embedded mode.",EmptyWidgetID:"Widget id and name cannot not be empty.",EmptyWidgetName:"Widget name cannot not be empty.",InvalidAllWidgetNames:"All the widget names are invalid.",UnableWidgetRender:"Unable to render the widget in design mode.",PinboardNameEmpty:"The pinboard name cannot be empty.",EmptyWidgetList:"Please provide the widget details with the containerID in an array.",ArrayWidgetNames:"Unable to refresh the widget. The widgetName should be in an array.",WidgetNameSpecialChar:"Please avoid using special characters in widget name.",InvalidDbrdAndWidget:"Please provide a valid dashboard ID and widget ID.",InvalidWidgetName:"Please provide a valid widget name.",InvalidDashboardID:"Please provide a valid dashboard ID.",InvalidChildDbrdID:"Please provide a valid child dashboard ID.",InvalidViewName:"Please provide a valid view name.",InvalidQueryString:"Please provide a valid query string.",EmptyViewDetails:"View details must not be empty.",InvalidViewID:"Please provide a valid view ID.",InvalidEmbedType:"Invalid EmbedType.",UnablePinboardRender:"Unable to render the pinboard in design mode.",InitFetch:"Data fetching has been initiated.",InvalidBoldBIURL:"Invalid Bold BI serverUrl.",EnvironmentMemberError:"Server not found. If you are using Cloud BI Server, please ensure that the Environment member is set on the client side.",ServerNotFound:"server Not Found.",InvalidDbrdDetails:"The provided dashboard details are invalid.",InvalidPinboardName:"Please provide a valid pinboard name.",AccessDeniedItem:"Access denied for the item.",NotRenderMultitabDashboard:"A multitab dashboard cannot be rendered in designer mode.",ErrorInBoldBIDesigner:"BoldBIDashboardDesigner is not defined.",DbrdDownloadError:"There was an error while downloading the dashboards.",bbEmbedNotDefined:"bbEmbed is not defined.",LayoutFailure:"The change in layout failed due to ",DragAndDropError:"Drag and drop failure due to ",DbrdPathTokenAPIError:"The token API does not support rendering a dashboard with the specified dashboardPath.",DataSourceTokenAPIError:"The Token API does not support rendering the dashboard with the datasourceName.",ViewNameTokenAPIError:"The Token API does not support rendering a dashboard with the viewName.",InvalidAccessToken:"Please provide a valid access token.",InvalidApiKey:"Please provide a valid API Key.",ViewDetailsNotFound:"View details not found.",WidgetNameTokenAPIError:"The Token API does not support rendering widgets with the widgetName.",EnsureServerOrSDKVersion:"Unable to ensure the server version and SDK version for cloud environment.",ErrorLoadMultipleWidget:"Error: To render multiple widgets, please use the loadMultipleWidget() method.",EmptyDbrdCreate:"Please provide the DashboardId in BoldBI.Create().",ExistedViewName:"The view name already exists.",InvalidReplyCommentID:"Please provide a valid ID for the reply comment.",InvalidCommentText:"Please provide a comment that is valid.",InvalidDbrdOrWidgetID:"Please provide a valid dashboard or widget ID.",InvalidCommentID:"Please provide a valid comment ID.",NetworkIssue:"Not connected. Please check the network.",NotFound:"Not Found.",ViewIDNotFound:"The view id was not found. Please provide a valid view id.",PageNotFound:"The requested page could not be found (404).",InternalServerError:"Internal Server Error (500).",UncaughtError:"An uncaught error has occurred.",AuthorizationServerMissing:"Access has been denied because the authorization server URL is missing in the BoldBI.Create() method.",InvalidEmbedContainerID:"Please provide the valid embed container Id.",EmptyServerURL:"The server URL cannot be empty.",InvalidServerURL:"Please provide a valid server URL.",InvalidDashboardPath:"Invalid dashboard path: ",EmptyDbrdOrViewID:"Dashboard ID, path, and view ID cannot be empty.",EmptyDatasourceDetails:"Data source ID and name cannot be empty.",MultitabDbrdWidgetRender:"Unable to render the widget from multitab dashboard.",UnableAddWidget:"Unable to add the widget due to ",PageUnavailable:"The page you are looking for was unavailable.",ObjectRefNotSet:"Object reference not set to an instance of an object.",AvoidSplChar:"Please avoid using special characters.",EmptyViewName:"Please enter the name of the view.",NotMatchVersion:"The Embedded SDK version does not match the Bold BI Server version.",CantReadNull:"Cannot read property append of null",NotImplementedMethod:"The LoadDashboardView method has not been implemented.",InvalidThemeName:"Please provide a valid dashboard theme name",BoldBIEmbedded:"BoldBI Embedded: ",ProvideCreatePermission:"Please provide permission to create the dashboard.",AnonymousEmailandGroup:"Please provide a user email and group name to access the group for an anonymous user",AnonymousEmail:"Please provide an anonymous user email.",AnonymousGroup:"Please provide a group name to access the group for an anonymous user.",DomainMaskingError:"Please remove the authorization URL or token API when when domain masking is enabled."},t.successMessages={UpdateFilterViewMsg:"and you can add custom functionalities using viewId:",NonDefaultViewInfoMsg:"If enabled, the current view will be set as your default view for this dashboard.",DefaultViewInfoMsg:"Based on your dashboard settings in Bold BI, these filters will be applied by default the next time the dashboard is rendered.",MatchVersion:"The embedded SDK version matches the Bold BI Server version."}},806:(e,t,i)=>{t.tN=void 0;const s=i(176),n=i(123),o=i(917);let a,d;class r{constructor(e){this.loadPinboard=this.Invoke((function(){if(!this.invalidDetail){if(""==this.embedOptions.pinboardName)throw new Error(s.errorMessages.PinboardNameEmpty);if(this.embedOptions.mode!=r.Mode.View)throw new Error(s.errorMessages.UnablePinboardRender);if(this.embedOptions.dashboardIds=[],this.embedOptions.dashboardPaths=[],!this._checkWidgetList())if(this.embedOptions.embedType==r.EmbedType.Component)this._setEmbedDefaults(),this.isPinboardRendering=!0,this._showLoader(),this._isDependencyLoaded(this);else if(this.embedOptions.embedType==r.EmbedType.IFrame){const e=document.createElement("iframe");e.frameBorder=0,e.width=this.embedOptions.width,e.height=this.embedOptions.height,e.id=this.embedOptions.embedContainerId+"_"+this.embedOptions.dashboardId,e.allowfullscreen=this.embedOptions.dashboardSettings.showFullScreen,e.setAttribute("src",this.embedOptions.serverUrl+"/dashboards/"+this.embedOptions.dashboardId+"?isembed=true"),document.getElementById(this.embedOptions.embedContainerId).appendChild(e)}}})),this.loadDatasource=this.Invoke((function(){if(!this.invalidDetail&&((this.embedOptions.dashboardId||this.embedOptions.dashboardPath)&&(this.embedOptions.dashboardId=this.embedOptions.dashboardPath=""),""!=this.embedOptions.pinboardName&&(this.embedOptions.pinboardName=""),!this._checkWidgetList())){if(this.embedOptions.mode!=r.Mode.DataSource&&this.embedOptions.mode!=r.Mode.Connection)throw new Error(s.errorMessages.EmbedModeInvalid);if(this.embedOptions.embedType==r.EmbedType.Component)this.isWidgetMode=!1,this.widgetName="",this.isDashboardViewMode=!1,this.dashboardViewName="",this._showLoader(),this._isDependencyLoaded(this);else if(this.embedOptions.embedType==r.EmbedType.IFrame){const e=document.createElement("iframe");e.frameBorder=0,e.width=this.embedOptions.width,e.height=this.embedOptions.height,e.id=this.embedOptions.embedContainerId+"_"+this.embedOptions.datasourceId,e.allowfullscreen=this.embedOptions.dashboardSettings.showFullScreen,e.setAttribute("src",this.embedOptions.serverUrl+"/datasource-designer/"+this.embedOptions.datasourceId+"?isembed=true"),document.getElementById(this.embedOptions.embedContainerId).appendChild(e)}}})),this._initializeUrls=this.Invoke((function(){if(this.embedOptions.enableDomainMasking){if(""===this.embedOptions.authorizationServer.url&&""===this.embedOptions.token)return this.designerRootUrl=this.embedOptions.serverUrl,!0;throw new Error(s.errorMessages.DomainMaskingError)}if(this.embedOptions.serverUrl.indexOf("/bi")<=0)throw new Error(s.errorMessages.InvalidBoldBIURL);return this.embedOptions.environment==r.Environment.Enterprise?(this.rootUrl=this.embedOptions.serverUrl.substr(0,this.embedOptions.serverUrl.indexOf("/bi/")>=0?this.embedOptions.serverUrl.indexOf("/bi/")+3:this.embedOptions.serverUrl.indexOf("/bi")+3),this.baseUrl=this.embedOptions.serverUrl,this.siteIdentifier=this.embedOptions.serverUrl.indexOf("/site/")>=0?this.embedOptions.serverUrl.substr(this.embedOptions.serverUrl.indexOf("/site/")+1):"",this.dashboardServerApiUrl=this.rootUrl+"/api"+(this._isEmptyOrSpaces(this.siteIdentifier)?"":"/"+this.siteIdentifier),this.designerRootUrl=this.rootUrl+"/designer",this.customThemeUrl=this.rootUrl.replace(/\/bi(?!.*\/bi)/,"/ums/theme/styles")):(this.rootUrl=this.embedOptions.serverUrl.endsWith("/")?this.embedOptions.serverUrl.slice(0,-1):this.embedOptions.serverUrl,this.baseUrl=this.embedOptions.serverUrl,this.siteIdentifier="",this.dashboardServerApiUrl=this.rootUrl+"/api"),this.scheduleEndpointUrl=this.baseUrl+"/datasources/recurrence-type-page",!0})),this._addJquerydependentFiles=this.Invoke((function(){if(this._checkDepedentFileExists(this.jQueryDepedentFile,!1)||null!=window.jQuery&&"1.10.2"==window.jQuery().jquery){const e=setInterval((()=>{window.jQuery&&(clearInterval(e),a=window.bbEmbed=window.$,void 0!==window.bb$&&(a=window.bbEmbed=window.bb$),this._addWrapperDependentFiles(this,this.wrapperDependentScriptFiles),this._loadDepedentFiles())}),1e3)}else{const t=document.createElement("script");if(this.embedOptions.environment==r.Environment.Enterprise){var e=this.embedOptions.enableDomainMasking?this.maskedCdnUrl+this.embedSDKWrapperVersion+"/script/"+this.jQueryDepedentFile:this.rootUrl+"/cdn/scripts/designer/"+this.jQueryDepedentFile;t.setAttribute("src",e)}else t.setAttribute("src",this.cdnLink+"/scripts/designer/"+this.jQueryDepedentFile);this.embedOptions.nonce&&(t.nonce=this.embedOptions.nonce),document.head.appendChild(t),t.onload=()=>{try{const e=document.createElement("script");e.append(this.jqConflictFile),this.embedOptions.nonce&&(e.nonce=this.embedOptions.nonce),document.head.appendChild(e),a=window.bbEmbed=window.bb$,this._addWrapperDependentFiles(this,this.wrapperDependentScriptFiles),this._loadDepedentFiles()}catch(e){this._throwError(s.errorMessages.ServerNotFound),this.invalidDetail=!0}},t.onerror=e=>this._handleEnvironmentError(e)}})),this._renderDashboard=this.Invoke((function(e){const t=this,i=e.Data;if(!e.Status&&!this.embedOptions.enableDomainMasking)throw e.errorMessage==s.errorMessages.PageUnavailable&&(e.Status=!1,e.Message=e.errorMessage),e.Message===s.errorMessages.ObjectRefNotSet&&("view"!==this.embedOptions.mode&&"design"!==this.embedOptions.mode||(this._isEmptyOrSpaces(this.embedOptions.dashboardId)&&this._isEmptyOrSpaces(this.embedOptions.dashboardPath)||(e.Message=s.errorMessages.InvalidDbrdDetails),this._isEmptyOrSpaces(this.embedOptions.pinboardName)||(e.Message=s.errorMessages.InvalidPinboardName))),new Error(e.Message);{if(Array.isArray(e.Data)&&this._isEmptyOrSpaces(this.embedOptions.dashboardId)&&this._isEmptyOrSpaces(this.embedOptions.dashboardPath)){for(const t of e.Data)if("ErrorMessage"in t){const i=`BoldBI Embedded: ${t.ErrorMessage}`;if(this._isNullOrUndefined(this.embedOptions.onError)||""===this.embedOptions.onError)console.error(i);else{const e=new Error(i);this.onErrorClient(e)}e.Data=e.Data.filter((e=>e!==t))}if(i.filter((e=>"ErrorMessage"in e&&e.ErrorMessage.includes("Access denied for the item"))).length===i.length)throw new Error(s.errorMessages.AccessDeniedItem);if(!e.Data.length)throw new Error(s.errorMessages.InvalidDbrdDetails)}const d=e.Data;if(""!=this.embedOptions.pinboardName&&0==this.pinboardIds.length){if(!d.ColumnInfo)throw new Error(s.errorMessages.InvalidPinboardName);this._renderPinboard(d)}else if(!this._isNullOrUndefined(d)&&d.length){if(this.isWidgetMode){const e=document.getElementById(this.embedOptions.embedContainerId);throw r._hasinstance(e,"embeddedBoldBI")&&r._removeinstance(e,"embeddedBoldBI"),new Error(s.errorMessages.MultitabDbrdWidgetRender)}if(this.embedOptions.mode!=r.Mode.View){const e=document.getElementById(this.embedOptions.embedContainerId);throw r._hasinstance(e,"embeddedBoldBI")&&r._removeinstance(e,"embeddedBoldBI"),new Error(s.errorMessages.NotRenderMultitabDashboard)}this._renderMultiTabDashboard(d)}else{let i;this.embedOptions.enableDomainMasking||(d.ItemDetail=this.embedOptions.mode!=r.Mode.Connection?this.embedOptions.token?e.Data.ItemDetail:JSON.parse(e.Data.ItemDetail):null),this.embedOptions.token||this.embedOptions.enableDomainMasking||this.embedOptions.isPublicDashboard||((this.embedOptions.mode==r.Mode.View||d.ItemDetail&&d.ItemDetail.IsEnableDefaultView)&&(this.isDefaultView=d.ItemDetail.IsEnableDefaultView,this.embedOptions.dashboardSettings=this.embedOptions.dashboardSettings||{},this.embedOptions.dashboardSettings.filterOverviewSettings=this.embedOptions.dashboardSettings.filterOverviewSettings||{},d.ItemDetail.ItemViews&&(this.embedOptions.dashboardSettings.filterOverviewSettings.viewId=d.ItemDetail.ItemViews[0].ViewId,this.embedOptions.dashboardSettings.filterOverviewSettings.viewName=d.ItemDetail.ItemViews[0].ViewName,this.embedOptions.filterParameters=d.ItemDetail.ItemViews[0].QueryString)),this.embedOptions.mode==r.Mode.View&&(this.dashboardUrl="/dashboard/"+d.ItemDetail.Id+"/"+d.ItemDetail.CategoryName+"/"+d.ItemDetail.Name+"?"),this.embedOptions.mode==r.Mode.View&&this.embedOptions.viewId&&(this.embedOptions.dashboardId=d.ItemDetail.Id)),this.accessToken=t.embedOptions.enableDomainMasking?null:t.embedOptions.token?t.embedOptions.token:d.access_token;let l,h="";if(this.pinboardIds.length>0){const e=this.embedOptions.token?d.Id:d.WidgetId;a.map(this.pinboardIds,(function(s){if(s.widgetId==e){const e=t._getDashboardInstance(s.pinboardContainerId+"_embeddedbi");t._isNullOrUndefined(e)&&(i=s.pinboardContainerId)}})),l=t.embedOptions.token?d.ItemId:""}else if(this.isMultiTab){const e=this.embedOptions.token?d.DashboardId.toString().replaceAll("-",""):d.ItemDetail.Id.toString().replaceAll("-","");i="multi_"+e,t._isNullOrUndefined(t.embedOptions.dashboardSettings.dashboardName)||"string"==typeof t.embedOptions.dashboardSettings.dashboardName||a.map(t.embedOptions.dashboardSettings.dashboardName,(function(e){d.ItemDetail.Id==e.dashboardId&&(h=e.dashboardName)})),l=t.embedOptions.token?d.DashboardId:""}else i=this.embedOptions.embedContainerId,t._isNullOrUndefined(t.embedOptions.dashboardSettings.dashboardName)||"string"!=typeof t.embedOptions.dashboardSettings.dashboardName||(h=t.embedOptions.dashboardSettings.dashboardName);const m=this.pinboardIds.length>0?a("#"+i).height():this.isMultiTab?this.embedOptions.height.indexOf("%")>0?this.embedOptions.height.includes("calc")?"calc(100% - 36px)":"calc("+this.embedOptions.height+" - 36px)":parseInt(this.embedOptions.height,10)-36+"px":this.embedOptions.height;let b;this.embedOptions.enableDomainMasking||this.embedOptions.isPublicDashboard||void 0===e.Data.UserDetail||(d.UserDetail=JSON.parse(e.Data.UserDetail)),this.embedOptions.mode==r.Mode.Connection&&a('').appendTo("head"),this._onBoldBIAuthorizionComplete(d),""==this.embedOptions.widgetList&&(document.getElementById(i).style.height=m,document.getElementById(i).style.width=""!=this.embedOptions.pinboardName?document.getElementById(i).style.width:this.isMultiTab?"100%":this.embedOptions.width),this.embedOptions.mode!=r.Mode.View||this.embedOptions.authorizationServer.url||this.embedOptions.authorizationServer.data||this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)||(this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveIcon=!1,this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveAsIcon=!1),this.embedOptions.mode!=r.Mode.Design||this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)||(this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveIcon=!1,this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveAsIcon=!1,this.embedOptions.dashboardSettings.filterOverviewSettings.showViewSavedFilterIcon=!1);const c=this.embedOptions.environment===r.Environment.Enterprise?this.rootUrl.replace(/\/bi(?!.*\/bi)/,"/ums/user-interface/fonts")+"?family="+this.embedOptions.dashboardSettings.fontFamily:this.rootUrl+"/user-interface/fonts?family="+this.embedOptions.dashboardSettings.fontFamily;if(b={siteUrl:this.baseUrl,serviceUrl:this.designerRootUrl,dataServiceUrl:this.designerRootUrl,serverUrl:this.dashboardServerApiUrl,hasAPIKey:!t.embedOptions.enableDomainMasking&&!this.embedOptions.isPublicDashboard&&!this._isJwtFormat(this.accessToken),viewerSettings:{serviceUrl:this.designerRootUrl+"/v1.0/design"},nonce:this.embedOptions.nonce,localeSettings:{culture:this.embedOptions.localeSettings.culture,dateFormat:this._isEmptyOrSpaces(this.embedOptions.localeSettings.dateFormat)?"M/d/yyyy":this.embedOptions.localeSettings.dateFormat,timeFormat:this._isEmptyOrSpaces(this.embedOptions.localeSettings.timeFormat)?"h:mm:ss tt":this.embedOptions.localeSettings.timeFormat},mode:this.embedOptions.mode,localData:{loadFromData:this.embedOptions.localData.loadFromData,layoutData:this.embedOptions.localData.layoutData,widgetData:this.embedOptions.localData.widgetData},environment:this.embedOptions.environment,IsEmbed:!0,_isPublic:this.embedOptions.mode!=r.Mode.Connection?this.embedOptions.enableDomainMasking||this._isNullOrUndefined(d.ItemDetail)?"":d.ItemDetail.IsPublic:"",itemId:this.embedOptions.mode!=r.Mode.Connection?this.embedOptions.enableDomainMasking?this.embedOptions.dashboardId:this._isNullOrUndefined(this.embedOptions.token)||this._isEmptyOrSpaces(this.embedOptions.token)?d.ItemDetail.Id:l||this.embedOptions.dashboardId:"",dashboardPath:this.embedOptions.mode==r.Mode.DataSource||this.embedOptions.mode==r.Mode.Connection?"":this.embedOptions.enableDomainMasking?this.embedOptions.dashboardId+"/0":this._isNullOrUndefined(this.embedOptions.token)||this._isEmptyOrSpaces(this.embedOptions.token)?d.ItemDetail.ItemLocation:l?l+"/0":this.embedOptions.dashboardId+"/"+d.dashboardVersion,serviceAuthorizationToken:this._isNullOrUndefined(this.embedOptions.token)||this._isEmptyOrSpaces(this.embedOptions.token)?this.embedOptions.enableDomainMasking?"":d.access_token:this.embedOptions.token,dashboardName:this.embedOptions.mode==r.Mode.DataSource||this.embedOptions.mode==r.Mode.Connection||this.embedOptions.enableDomainMasking||this._isNullOrUndefined(d.ItemDetail)?"":this._isEmptyOrSpaces(h)?d.ItemDetail.Name:h,dashboardDescription:this.embedOptions.mode==r.Mode.DataSource||this.embedOptions.mode==r.Mode.Connection||this.embedOptions.enableDomainMasking||this._isNullOrUndefined(d.ItemDetail)?"":d.ItemDetail.Description,IsProxy:!!this.embedOptions.enableDomainMasking,theme:this._isEmptyOrSpaces(this.multiTabTheme)?this.embedOptions.theme:this.multiTabTheme,enableTheme:void 0!==this.embedOptions.dashboardSettings.enableTheme&&this.embedOptions.dashboardSettings.enableTheme,enableFilterOverview:this.embedOptions.dashboardSettings.enableFilterOverview,isPinWidget:this.pinboardIds.length>0,layoutSetting:this.embedOptions.layoutSettings,export:{Image:this.embedOptions.exportSettings.showImage,Excel:this.embedOptions.exportSettings.showExcel,Pdf:this.embedOptions.exportSettings.showPDF,CustomFontFamilyUrl:this.embedOptions.dashboardSettings.fontFamily?c:"",IsDefaultFont:!1},dashboardExportMenuSettings:{showCSV:this.embedOptions.exportSettings.showCSV,showExcel:this.embedOptions.exportSettings.showExcel,showImage:this.embedOptions.exportSettings.showImage,showPDF:this.embedOptions.exportSettings.showPDF},widgetExportMenuSettings:{showCSV:this.embedOptions.exportSettings.showCSV,showExcel:this.embedOptions.exportSettings.showExcel,showImage:this.embedOptions.exportSettings.showImage,showPDF:this.embedOptions.exportSettings.showPDF},filterParameters:(this._isEmptyOrSpaces(this.embedOptions.filterParameters)?"":"&")+(this.isMultiTab&&window.multiTabFilterParameter?window.multiTabFilterParameter:this.embedOptions.filterParameters),designCanvasSettings:this.embedOptions.designCanvasSettings,widgetContainerSettings:this.embedOptions.widgetContainerSettings,viewDataSettings:{checkShowAllColumns:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.viewDataSettings)&&this.embedOptions.dashboardSettings.viewDataSettings.showAllColumns},viewDataActions:{allowExporting:!!this._isNullOrUndefined(this.embedOptions.dashboardSettings.viewDataSettings)||this.embedOptions.dashboardSettings.viewDataSettings.enableExporting,allowColumnSelection:!!this._isNullOrUndefined(this.embedOptions.dashboardSettings.viewDataSettings)||this.embedOptions.dashboardSettings.viewDataSettings.enableColumnSelection},dashboardThemeSettings:{appearance:this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings)||this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings.appearance)?"light":this.embedOptions.dashboardSettings.themeSettings.appearance,applicationTheme:this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings)||this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings.application)?null:this.embedOptions.dashboardSettings.themeSettings.application,dashboardTheme:this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings)?null:this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings.dashboard)?this.embedOptions.dashboardSettings.themeSettings.isLocalTheme?"boldBITheme":null:this.embedOptions.dashboardSettings.themeSettings.dashboard},filterOverviewSettings:{showSaveIcon:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)&&this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveIcon,showSaveAsIcon:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)&&this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveAsIcon,showViewSavedFilterIcon:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)&&this.embedOptions.dashboardSettings.filterOverviewSettings.showViewSavedFilterIcon,viewId:this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)||this._isEmptyOrSpaces(this.embedOptions.dashboardSettings.filterOverviewSettings.viewId)?null:this.embedOptions.dashboardSettings.filterOverviewSettings.viewId,viewName:this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)||this._isEmptyOrSpaces(this.embedOptions.dashboardSettings.filterOverviewSettings.viewName)?null:this.embedOptions.dashboardSettings.filterOverviewSettings.viewName},hideMetrics:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.showMetrics)&&!this.embedOptions.dashboardSettings.showMetrics,widgets:this._getWidgetFilterInfo(),actionComplete:function(e){t._onBoldBIDashboardInstaceActionComplete(e)},beforeBannerIconRender:function(e){t._onBoldBIDashboardBeforeBannerIconRender(e)},beforeOtherOptionContextMenuRender:function(e){t._onBoldBIDashboardBeforeOtherOptionContextMenuRender(e)},_onSaveFilter:function(e){t._onBoldBIDashboardSaveFilter(e)},_onSaveAsFilter:function(e){t._onBoldBIDashboardSaveAsFilter(e)},_onViewSavedFilters:function(e){t._onBoldBIDashboardOpenViewSection(e)},onBannerIconClick:function(e){t._onBoldBIDashboardBannerIconClick(e)},beforeWidgetIconRendered:function(e){t._onBoldBIDashboardBeforeWidgetIconRendered(e)},onWidgetIconClick:function(e){t._onBoldBIDashboardWidgetIconClick(e)},_onFavoriteStateChange:function(e){t._onBoldBIDashboardUpdatefavorite(e)},beforeNavigateUrlLinking:function(e){t._onBoldBIBeforeNavigateUrlLinking(e)},beforeControlMenuOpen:function(e){t._onBoldBIBeforeControlMenuOpen(e)},beforeDashboardMobileMenuOpen:function(e){t._onBoldBIBeforeDashboardMobileMenuOpen(e)},ajaxBeforeLoad:function(e){t._onBoldBIAjaxBeforeLoad(e)},beforeDesignerToolbarButtonsRendered:function(e){t._onBoldBIbeforeDesignerToolbarButtonsRendered(e)},onControlMenuClick:function(e){t._onBoldBIonControlMenuClick(e)},beforeDatasourceToolbarButtonsRendered:function(e){t._onBoldBIbeforeDatasourceToolbarButtonsRendered(e)},beforeDatasourceToolbarIconsRendered:function(e){t._onBoldBIbeforeDatasourceToolbarIconsRendered(e)},beforeDesignerToolbarIconsRendered:function(e){t._onBoldBIbeforeDesignerToolbarIconsRendered(e)},toolbarClick:function(e){t._onBoldBItoolbarClick(e)},beforeWidgetItemsListed:function(e){t._onBoldBIbeforeWidgetItemsListed(e)},beforeWidgetLayoutRender:function(e){t._onBoldBIbeforeWidgetLayoutRender(e)}},this.loadMultipleWidget){var n=this.embedOptions.widgetList;n.forEach((e=>{const t=document.createElement("div");t.id=`${e.containerId}_embeddedbi`,t.style.width="100%",t.style.height="100%",document.getElementById(e.containerId).append(t)}));const t=Object.values(JSON.parse(e.Data.WidgetList));var o=n.map(((e,i)=>({widgetId:t[i],container:`${e.containerId}_embeddedbi`})));b.loadMultipleWidget=this.loadMultipleWidget,b.multipleWidgetsCollection=o}if(""==this.embedOptions.widgetList&&(b.actionBegin=function(e){t._onBoldBIDashboardInstaceActionBegin(e,i)}),(this.embedOptions.mode!=r.Mode.View||this.isWidgetMode||this.isMultipleWidgetMode||this.isPinboardRendering)&&this.embedOptions.mode!=r.Mode.Design||(b.languageSettings={hideLanguageDropdown:!this._isNullOrUndefined(this.embedOptions.languageSettings.hideLanguageDropdown)&&this.embedOptions.languageSettings.hideLanguageDropdown,languageCode:this.embedOptions.languageSettings.languageCode}),this.embedOptions.enableDomainMasking||(this.embedOptions.mode==r.Mode.View&&!this.isPinboardRendering||this.embedOptions.mode==r.Mode.Design)&&(b.enableMobileView=!this._isNullOrUndefined(this.embedOptions.restrictMobileView)&&this.embedOptions.restrictMobileView,!this.embedOptions.isPublicDashboard&&d.IsAnonymousUser&&(b.anonymousUserEmail=d.email)),this.embedOptions.mode==r.Mode.Design){b.customBrandSettings={hideHelpLink:!this._isNullOrUndefined(this.embedOptions.customBrandSettings.hideHelpLink)&&this.embedOptions.customBrandSettings.hideHelpLink,customBrandName:this.embedOptions.customBrandSettings.customBrandName,customDomain:this.embedOptions.customBrandSettings.customDomain},(this.embedOptions.token&&!this.embedOptions.dashboardId||!this.embedOptions.token&&!this.embedOptions.enableDomainMasking&&!this._isNullOrUndefined(d)&&d.ItemDetail.IsDraft)&&(b.dashboardPath="");const e=this._isNullOrUndefined(d)||this.embedOptions.enableDomainMasking||this._isEmptyOrSpaces(d.DatasourceId)?"":d.DatasourceId;this._isEmptyOrSpaces(e)||(b.datasource=e),this.embedOptions.datasources.length>0&&(b.datasources=this.embedOptions.datasources),b.disableAutoRecover=this.embedOptions.disableAutoRecover,b.schedule={endPoint:this.scheduleEndpointUrl,summaryText:""},b.serverSettings={isAdmin:!this.embedOptions.enableDomainMasking&&void 0!==d.IsAdmin&&d.IsAdmin},b.intermediateDbStatus=this.embedOptions.enableDomainMasking?void 0:d.IntermediateDbStatus,b.connectionList=this.embedOptions.enableDomainMasking?void 0:d.ConnectionList,b.isAllowUserToCreateDatasource=this.embedOptions.enableDomainMasking?void 0:d.CanCreateDatasource,b.enablePublicDashboardSetting=!1,b.beforeNavigateToDashboard=function(e){t._onBoldBIBeforeNavigateToDashboard(e)},b.toolbarSettings={showToolbar:this.embedOptions.toolbarSettings.showToolbar},b.predefinedWidgets=this.embedOptions.preConfiguredWidgets,this.embedOptions.environment==r.Environment.Enterprise?b.configuration=this.embedOptions.enableDomainMasking?" ":this.rootUrl+"/webdesignerservice/scripts/settings/"+d.Branding+"/settings.min.js":b.configuration=this.cdnLink+"/scripts/settings/"+d.Branding+"/settings.min.js",b.designerSettings={widgetsPanel:{hideExistingWidgets:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)&&this.embedOptions.dashboardSettings.widgetsPanel.hideExistingWidgets,hideDefaultWidgets:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)&&this.embedOptions.dashboardSettings.widgetsPanel.hideDefaultWidgets,defaultPanelDisplayText:this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)?"":this.embedOptions.dashboardSettings.widgetsPanel.defaultPanelDisplayText,existingPanelDisplayText:this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)?"":this.embedOptions.dashboardSettings.widgetsPanel.existingPanelDisplayText,defaultPanelSearchPlaceholder:this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)?"":this.embedOptions.dashboardSettings.widgetsPanel.defaultPanelSearchPlaceholder,existingPanelSearchPlaceholder:this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)?"":this.embedOptions.dashboardSettings.widgetsPanel.existingPanelSearchPlaceholder,existingDashboards:this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)?[]:this.embedOptions.dashboardSettings.widgetsPanel.existingDashboards,dragAndDropSettings:{rowSpan:this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)||this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings)?null:this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings.rowSpan,columnSpan:this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)||this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings)?null:this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings.columnSpan,isWidgetMode:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel)&&!this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings)&&this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings.isWidgetMode}},dataSourceConfig:{hideDataSourceConfig:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.dataSourceConfig)&&this.embedOptions.dashboardSettings.dataSourceConfig.hideDataSourceConfig,hideSampleDataSources:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.dataSourceConfig)&&this.embedOptions.dashboardSettings.dataSourceConfig.hideSampleDataSources,hideDataSourceList:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.dataSourceConfig)&&this.embedOptions.dashboardSettings.dataSourceConfig.hideDataSourceList,hideExpression:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.dataSourceConfig)&&this.embedOptions.dashboardSettings.dataSourceConfig.hideExpression}},b.userSettings={hidePreviewAs:!this._isNullOrUndefined(this.embedOptions.dashboardSettings.showPreviewAs)&&!this.embedOptions.dashboardSettings.showPreviewAs}}if(this.embedOptions.mode==r.Mode.Connection&&(b.connectionList=d.ConnectionList),this.embedOptions.mode==r.Mode.DataSource&&(b.itemId=this._isNullOrUndefined(this.embedOptions.token)||this._isEmptyOrSpaces(this.embedOptions.token)?d.ItemDetail.Id:this.embedOptions.datasourceId,b.datasourceName=this._isNullOrUndefined(this.embedOptions.token)||this._isEmptyOrSpaces(this.embedOptions.token)?d.ItemDetail.Name:this.embedOptions.datasourceName,b.datasource=this._isNullOrUndefined(this.embedOptions.token)||this._isEmptyOrSpaces(this.embedOptions.token)?d.ItemDetail.Id:this.embedOptions.datasourceId),this.isMultipleWidgetMode=""!=this.embedOptions.widgetList&&this.isMultipleWidgetMode,this.isWidgetMode&&(b.isPinWidget=this.isWidgetMode,b.widgetId=this._isNullOrUndefined(this.embedOptions.token)||this._isEmptyOrSpaces(this.embedOptions.token)?d.WidgetId:this.widgetName),0==this.embedOptions.dashboardSettings.showHeader?b.isHideHeader=!0:b.isHideHeader=!1,this.isMultiTab&&(b.dashboardSettings={parentId:this.parentDbrdId,isMultiTab:null!=this.parentDbrdId&&""!==this.parentDbrdId}),this.embedOptions.dynamicConnection.isEnabled&&(b.customIdentity=this.embedOptions.dynamicConnection.identity),this.embedOptions.autoRefreshSettings.enabled&&(b.enableAutoRefresh=!0,b.autoRefreshSettings={intervalSettings:{mode:"Hourly",hourlySchedule:{hours:this.embedOptions.autoRefreshSettings.hourlySchedule.hours,minutes:this.embedOptions.autoRefreshSettings.hourlySchedule.minutes,seconds:this.embedOptions.autoRefreshSettings.hourlySchedule.seconds}}}),!this.loadMultipleWidget&&this.embedOptions.embedAiAssistant.enableAiAssistant&&(b.isAiSummariesEnabledGlobally=this.embedOptions.embedAiAssistant.enableAiSummary,b.embedAiAssistant={enableAiAssistant:!0,aiAssistantPosition:this.embedOptions.embedAiAssistant.aiAssistantPosition,hideAIDataUsage:this.embedOptions.embedAiAssistant.hideAiDataUsage},b.isAiSummariesEnabledGlobally&&(b.embedAiAssistant.enableWidgetSummary=this.embedOptions.embedAiAssistant.enableWidgetSummary,b.embedAiAssistant.enableDashboardSummary=this.embedOptions.embedAiAssistant.enableDashboardSummary)),!(window.bbEmbed instanceof Function))throw new Error(s.errorMessages.bbEmbedNotDefined);{let e,n=window.bbEmbed.call(t,"#"+(t.pinboardIds.length>0?i+"_embeddedbi":t.childContainer.id));if(0===n.length&&(n=window.bbEmbed.call(t,"#"+i+"_embeddedbi"),e=i+"_embeddedbi"),window.BoldBIDashboardDesigner instanceof Function){const i=this._getDashboardInstance(e);null!=i?(i.model=Object.assign(i.model,b),i.redrawDashboard()):window.BoldBIDashboardDesigner.call(t,n,b)}else this._throwError(s.errorMessages.ErrorInBoldBIDesigner);if(1==this.isMultipleWidgetMode){const e=JSON.parse(d.WidgetList);let t=-1;if(Object.keys(e).forEach((i=>{if(t++,""==e[String(i)]){const n=s.errorMessages.InvalidWidgetName;delete e[String(i)];const o=this.embedOptions.widgetList[Number(t)].containerId;this.errorOnContainer(n,o),this.embedOptions.widgetList.splice(t,1),t--}})),0==this.embedOptions.widgetList.length){if(this._isNullOrUndefined(this.embedOptions.onError)||""==this.embedOptions.onError)throw new Error(s.errorMessages.InvalidAllWidgetNames);{const e=new Error(s.errorMessages.InvalidAllWidgetNames);this.onErrorClient(e)}}d.WidgetList=JSON.stringify(e)}}""==this.embedOptions.widgetList&&this._removeElementsClass(i,".preloader-wrap","viewer-blue-loader"),this.isMultiTab&&!this.embedOptions.token&&!this.embedOptions.isPublicDashboard&&d.ItemDetail.ItemViews&&(this.embedOptions.dashboardSettings.filterOverviewSettings.viewId=this.embedOptions.dashboardSettings.filterOverviewSettings.viewName=this.embedOptions.filterParameters=null)}}})),this._changeLayoutSuccess=this.Invoke((function(e){if(e.Status&&""!=this.homepageItemId&&this.isVirtualHomepage)this.afterVirtualHomepageSave(this.homepageItemId);else if(!e.Status)throw new Error(s.errorMessages.LayoutFailure+e.Message)})),this._createPinboardDom=this.Invoke((function(e){const t=this;if(a("#widget-container").attr("data-homepage-id",e.Id).attr("data-current-layout",e.ColumnInfo.Layout).attr("data-item-type",e.ItemType).attr("data-virtual-homepage",e.IsVirtualHomepage),"widget"==e.ItemType.toLowerCase()){const i=e.ColumnInfo.Column;a.each(i,(function(e){a("#widget-container").append("
'))})),this._dragAndDropSuccess=this.Invoke((function(e){if(!e.Status)throw new Error(s.errorMessages.DragAndDropError+e.Message)})),this._renderMultiTabDashboard=this.Invoke((function(e){this.isMultiTab=!0;const t=this,i=a("#"+t.embedOptions.embedContainerId);i.html(""),"undefined"!=typeof ejdashboard&&ejdashboard.base&&"function"==typeof ejdashboard.base.registerLicense&&ejdashboard.base.registerLicense("ORg4AjUWIQA/Gnt2V1hiQlRPd11dXmJWd1p/THNYflR1fV9DaUwxOX1dQl9gSXZQd0VkXHpfeXJURWY=");const s=t.embedOptions.embedContainerId+"_parent_multi_tab_dashboard",n=a('
');i.append(n);const o=t.embedOptions.embedContainerId+"_multi_tab_dashboard",r=a('
');n.append(r);const l=a(''),h=a('
');a.map(e,(function(e){let i={};t.embedOptions.token?(i.Id=e.DashboardId,i.Name=e.DashboardName,i.TabName=e.TabName||i.DashboardName):(i=JSON.parse(e.ItemDetail),i.TabName=e.TabName||i.Name),t.parentDbrdId=t.embedOptions.token?t.embedOptions.dashboardId:e.parentId;const s=i.Id.replaceAll("-","");t.dashboardDetails[`${s}`]=e,t._isNullOrUndefined(t.embedOptions.dashboardSettings.dashboardName)||"string"==typeof t.embedOptions.dashboardSettings.dashboardName||a.map(t.embedOptions.dashboardSettings.dashboardName,(function(e){i.Name=s==e.dashboardId.replaceAll("-","")?t._isEmptyOrSpaces(e.dashboardName)?i.Name:e.dashboardName:i.Name})),l.append(a("
"+i.TabName+"
"));const n=a('
');h.append(a("
").append(n.append('
')))})),r.append(l).append(h),d=new ejdashboard.navigations.Tab({enableAnimation:!1,selected:a.proxy(this._tabSelected,this)}),d.appendTo("#"+o),a(".e-tab-header .e-toolbar-item .e-tab-text").css({display:"inline-block",width:"150px","white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis",color:"#000","font-family":"var(--font-family)","text-transform":"none"}),a('').appendTo("head"),a(".e-control.e-tab .e-tab-header .e-indicator").addClass("embed-multi-tab-indicator"),a.map(a(".e-tab-header .e-toolbar-item .e-tab-text"),(function(e,t){a(e).attr("title",a(e).text()),a(a(".e-content").find("#e-content-multi_tab_dashboard_"+t).children()).css({height:"100%",width:"100%",overflow:"hidden",display:"block",position:"absolute",left:a(".e-content.e-lib.e-touch").width()*t})})),a(".multitab-dbrd .e-content").attr("style","height: 100% !important"),a.map(a(".multitab-dbrd .e-content").children(),(function(e){a(e).css({height:"100%"})})),a(i).css({"overflow-x":"hidden","overflow-y":"hidden",width:t.embedOptions.width}),a("#"+o).css({width:a(".e-content.e-lib.e-touch").width(),height:this.embedOptions.height}),a(".e-tab-header")[0].ej2_instances[0].refreshOverflow(),d.resizeContext(),a.map(e,(function(e,i){if(0==i){const i={Apistatus:!0,Data:e,Status:!0};t._renderDashboard(i)}}))})),this._getAuthorizationToken=this.Invoke((function(e){const t=this,i=e||this.embedOptions.dashboardId,n=this.embedOptions.dashboardIds.join(","),o=this.embedOptions.dashboardPaths.join(",");let d="embed_nonce="+this._uuidv4Generartor()+"&embed_dashboard_id="+i+"&embed_dashboard_ids="+n+"&embed_dashboard_path="+this.embedOptions.dashboardPath+"&embed_dashboard_paths="+o+"&pinboard_name="+(this.pinBoardRendered?this.embedOptions.pinboardName:"")+"&embed_mode="+this.embedOptions.mode+"&embed_timestamp="+Math.round((new Date).getTime()/1e3)+"&embed_expirationtime="+this.embedOptions.expirationTime;if(this.embedOptions.anonymousToken.isEnabled){const{groupName:e,userEmail:t}=this.embedOptions.anonymousToken;d+=`&embed_user_email=${t}&embed_anonymous_token=true&embed_authorize_group=${e}`}if(this.embedOptions.viewId?d=d+"&embed_dashboardview_id="+this.embedOptions.viewId:this.embedOptions.viewName&&(d=d+"&embed_dashboardview_name="+this.embedOptions.viewName),this.isWidgetMode)if(0==this.isMultipleWidgetMode)d=d+"&embed_widget_isenabled="+this.isWidgetMode+"&embed_widget_name="+this.widgetName;else{const e=[];this.embedOptions.widgetList.forEach((function(t){e.push(t.widgetName.toLowerCase())})),d=d+"&embed_widget_isenabled="+this.isWidgetMode+"&embed_widget_list="+e}this.isMultiTab&&(d=d+"&isMultiTab="+this.isMultiTab),this._isEmptyOrSpaces(this.embedOptions.datasourceId)?this._isEmptyOrSpaces(this.embedOptions.datasourceName)||(d=d+"&embed_datasource_name="+this.embedOptions.datasourceName):d=d+"&embed_datasource_id="+this.embedOptions.datasourceId;const l={embedQuerString:encodeURI(d),dashboardServerApiUrl:this.dashboardServerApiUrl};if(""!=this.embedOptions.authorizationServer.url)this._xhrRequestHelper("POST",this.embedOptions.authorizationServer.url,l,this.embedOptions.authorizationServer.headers,this._renderDashboard);else if(this._isNullOrUndefined(this.embedOptions.authorizationServer.data)||""==this.embedOptions.authorizationServer.data||""!=this.embedOptions.authorizationServer.url)if(this.embedOptions.enableDomainMasking)this._renderDashboard(this.embedOptions.authorizationServer.data);else{if(""!=this.embedOptions.authorizationServer.url&&""!=this.embedOptions.authorizationServer.data||this.embedOptions.mode!=r.Mode.View||!this._isEmptyOrSpaces(this.embedOptions.pinboardName)||!(this.embedOptions.dashboardId||this.embedOptions.dashboardPath||this.embedOptions.dashboardIds||this.embedOptions.dashboardPaths))throw new Error(s.errorMessages.AuthorizationServerMissing);a.ajax({async:!0,type:"POST",url:this.dashboardServerApiUrl+this.embedAuthorizeEndPoint,data:JSON.stringify(d),contentType:"application/json",success:a.proxy(t._renderDashboard,t)})}else this._renderDashboard(this.embedOptions.authorizationServer.data);this.pinBoardRendered=!0})),this._validateOptions=this.Invoke((function(e){if(this.embedOptions.embedContainer=e.embedContainerId,e.enableDomainMasking)return!0;if(this._isNullOrUndefined(e.onError)||(this.embedOptions.onError=e.onError),this._isEmptyOrSpaces(e.embedContainerId)&&this._isNullOrUndefined(e.widgetList))throw this.invalidDetail=!0,new Error(s.errorMessages.InvalidEmbedContainerID);if(this._isEmptyOrSpaces(e.serverUrl))throw this.invalidDetail=!0,new Error(s.errorMessages.EmptyServerURL);if(!this._isUrl(e.serverUrl))throw this.invalidDetail=!0,new Error(s.errorMessages.InvalidServerURL);if(!this._isEmptyOrSpaces(e.pinboardName))return!0;if(e.mode==r.Mode.Connection)return!0;if(e.dashboardPath||e.dashboardPaths&&e.mode!==r.Mode.DataSource){const t=e.dashboardPath?[e.dashboardPath]:e.dashboardPaths;t.forEach(((e,i)=>{t[Number(i)]=`${e.startsWith("/")?"":"/"}${e}`.replace(/\/+$/,"");const n=t[Number(i)].split("/");if(3!==n.length||""!==n[0]||""===n[1]||""===n[2])throw new Error(s.errorMessages.InvalidDashboardPath+e)})),e.dashboardPath?e.dashboardPath=t[0]:e.dashboardPaths=t}if(this._isEmptyOrSpaces(e.dashboardId)&&(!e.dashboardIds||!e.dashboardIds.length)&&(!e.dashboardPaths||!e.dashboardPaths.length)&&this._isEmptyOrSpaces(e.dashboardPath)&&e.mode!==r.Mode.Design&&this._isEmptyOrSpaces(e.datasourceId)&&this._isEmptyOrSpaces(e.datasourceName)){if(e.mode==r.Mode.DataSource)throw this.invalidDetail=!0,new Error(s.errorMessages.EmptyDatasourceDetails);if(this._isEmptyOrSpaces(e.pinboardName)&&!this._isNullOrUndefined(e.pinboardName))throw this.invalidDetail=!0,new Error(s.errorMessages.PinboardNameEmpty);if(this._isEmptyOrSpaces(e.viewId))throw this.invalidDetail=!0,new Error(s.errorMessages.EmptyDbrdOrViewID)}return!0})),Object.assign(this,o.DefaultConstructor,e),this.loadDashboard=this.Invoke((function(e){this._loadDashboard(e)})),this.loadMultitabDashboard=this.Invoke((function(e){this._loadMultitabDashboard(e)})),this.loadView=this.Invoke((function(){this._loadView()})),this.loadDashboardWidget=this.Invoke((function(e,t){this._loadDashboardWidget(e,t)})),this.loadMultipleWidgets=this.Invoke((function(e){this._loadMultipleWidgets(e)})),this.loadDesigner=this.Invoke((function(e){this._loadDesigner(e)})),this.refreshWidgetData=this.Invoke((function(e,t,i){this._refreshWidgetData(e,t,i)})),this.addWidgetToPinboard=this.Invoke((function(e,t,i){this._addWidgetToPinboard(e,t,i)})),this.saveFilterView=this.Invoke((function(e,t){this._saveFilterViews(e,t)})),this.saveAsFilterView=this.Invoke((function(e,t){this._saveAsFilterViews(e,t)})),this.updateFilterView=this.Invoke((function(e,t){this._updateFilterViews(e,t)})),this.getViewsByDashboardId=this.Invoke((function(e,t){this._getViewsByDashboardId(e,t)})),this.getViewByViewId=this.Invoke((function(e,t){this._getViewByViewId(e,t)})),this.deleteFilterView=this.Invoke((function(e,t){this._deleteFilterView(e,t)}))}_loadDashboard(e){if(!this._isInvalidEmbed(r.Mode.View,"EmbedModeInvalid")){if(null!=e&&(this.embedOptions.dashboardId=e),this.embedOptions.anonymousToken.isEnabled){const{groupName:e,userEmail:t}=this.embedOptions.anonymousToken;if(this._isEmptyOrSpaces(e)&&this._isEmptyOrSpaces(t))throw new Error(s.errorMessages.AnonymousEmailandGroup);if(this._isEmptyOrSpaces(e))throw new Error(s.errorMessages.AnonymousGroup);if(this._isEmptyOrSpaces(t))throw new Error(s.errorMessages.AnonymousEmail)}this._checkWidgetList()||(this.embedOptions.embedType==r.EmbedType.Component?(this.embedOptions.dashboardIds=[],this.embedOptions.dashboardPaths=[],this.isDashboardRendering=!0,this._setEmbedDefaults(),this._showLoader(),this._isDependencyLoaded(this)):this.embedOptions.embedType==r.EmbedType.IFrame&&this._createIframe(`${this.embedOptions.serverUrl}/dashboards/${this.embedOptions.dashboardId}?isembed=true`))}}_loadMultitabDashboard(e){this._isInvalidEmbed(r.Mode.View,"EmbedModeInvalid")||(null!=e&&(this.embedOptions.dashboardIds=e),this.embedOptions.embedType==r.EmbedType.Component&&(this.embedOptions.viewId="",this.embedOptions.viewName="",this._setEmbedDefaults(),this._showLoader(),this._isDependencyLoaded(this)))}_loadView(){if(!this._isInvalidEmbed(r.Mode.View,"EmbedModeInvalid")){if(""==this.embedOptions.viewId&&""==this.embedOptions.viewName)throw new Error(s.errorMessages.EmptyViewDetails);this.embedOptions.embedType==r.EmbedType.Component&&(this.embedOptions.dashboardIds=[],this.embedOptions.dashboardPaths=[],this.isDashboardViewRendering=!0,this._setEmbedDefaults(),this._showLoader(),this._isDependencyLoaded(this))}}_loadDashboardWidget(e,t){if(this._isEmptyOrSpaces(e))throw new Error(s.errorMessages.EmptyWidgetID);this._isInvalidEmbed(r.Mode.View,"UnableWidgetRender")||(""!=this.embedOptions.pinboardName&&this.pinBoardRendered&&(this.embedOptions.pinboardName=""),this._checkWidgetList()||(this.embedOptions.embedType==r.EmbedType.Component?(this.embedOptions.viewId="",this.embedOptions.viewName="",this.embedOptions.dashboardIds=[],this.embedOptions.dashboardPaths=[],this._setEmbedDefaults(),this.isWidgetMode=!0,this.widgetName=e,this._showLoader(),this._isDependencyLoaded(this,t)):this.embedOptions.embedType==r.EmbedType.IFrame&&this._createIframe(`${this.embedOptions.serverUrl}/dashboards/${this.embedOptions.dashboardId}?isembed=true`)))}_loadMultipleWidgets(e){if(""==this.embedOptions.widgetList)throw new Error(s.errorMessages.EmptyWidgetList);if(!this._isInvalidEmbed(r.Mode.View,"EmbedModeInvalid")&&(null!=e&&(this.embedOptions.dashboardId=e),this.embedOptions.embedType==r.EmbedType.Component)){this._setEmbedDefaults(),this.isWidgetMode=!0,this.isMultipleWidgetMode=!0,this.loadMultipleWidget=!0;const t=setInterval((()=>{window.jQuery&&(clearInterval(t),this._widgetNamesEmpty()&&this._isDependencyLoaded(this,e))}),1e3)}}_loadDesigner(e){this._isInvalidEmbed(r.Mode.Design,"EmbedModeInvalid")||(null!=e&&(this.embedOptions.dashboardId=e),this._checkWidgetList()||(this.embedOptions.embedType==r.EmbedType.Component?(this.isDashboardRendering=!0,this._setEmbedDefaults(),this._showLoader(),this._isDependencyLoaded(this)):this.embedOptions.embedType==r.EmbedType.IFrame&&this._createIframe(`${this.embedOptions.serverUrl}/dashboard-designer/${this.embedOptions.dashboardId}?isembed=true`)))}_createIframe(e){var t;const i=document.createElement("iframe");i.frameBorder=0,i.width=this.embedOptions.width,i.height=this.embedOptions.height,i.id=`${this.embedOptions.embedContainerId}_${this.embedOptions.dashboardId}`,i.allowfullscreen=this.embedOptions.dashboardSettings.showFullScreen,i.setAttribute("src",e),null===(t=document.getElementById(this.embedOptions.embedContainerId))||void 0===t||t.appendChild(i)}_setEmbedDefaults(){this.isWidgetMode=!1,this.widgetName="",this.isDashboardViewMode=!1,this.dashboardViewName=""}_isInvalidEmbed(e,t){if(this.invalidDetail)return!0;if(this.embedOptions.mode!==e)throw new Error(s.errorMessages[t]);return""!=this.embedOptions.pinboardName&&(this.embedOptions.pinboardName=""),!1}_refreshWidgetData(e,t,i){if(1!=Array.isArray(e))throw new Error(s.errorMessages.ArrayWidgetNames);if(this.isMultiTab){const s=a("#"+this.embedOptions.embedContainerId).find(".e-content .bbembed-multitab-dbrd");for(let n=0;n
0){const i=a(s[`${n}`]).attr("id"),o=this._getDashboardInstance(i);null!=o&&o.refreshWidget(e,t);break}}else if(this.isMultipleWidgetMode)this._multipleWidgets("refreshWidget",e,t);else{const i=this._getDashboardInstance();null!=i&&i.refreshWidget(e,t)}}_addWidgetToPinboard(e,t,i){if(this._isEmptyOrSpaces(e)||this._isEmptyOrSpaces(t)||this._isEmptyOrSpaces(i))throw this._isEmptyOrSpaces(e)||this._isEmptyOrSpaces(t)?new Error(s.errorMessages.InvalidDbrdAndWidget):new Error(s.errorMessages.InvalidWidgetName);{if(!/^[a-zA-Z0-9!@$^ ()_=\-}{.`~]*$/.test(i))throw new Error(s.errorMessages.WidgetNameSpecialChar);const n=a("#widget-container").attr("data-homepage-id"),o=this,d="embed_nonce="+this._uuidv4Generartor()+"&homepageId="+n+"&isPinUpdate="+!0+"&pinWidgetId="+t+"&pinDashbooardId="+e+"&pinWidgetName="+(this._isNullOrUndefined(i)?null:i)+"&pinboard_name="+this.embedOptions.pinboardName+"&embed_mode="+this.embedOptions.mode+"&embed_timestamp="+Math.round((new Date).getTime()/1e3)+"&embed_expirationtime="+this.embedOptions.expirationTime,r={embedQuerString:encodeURI(d),dashboardServerApiUrl:this.dashboardServerApiUrl};this._xhrRequestHelper("POST",this.embedOptions.authorizationServer.url,r,this.embedOptions.authorizationServer.headers,(function(e){e.Status?o._addWidgetInPinboard(e.Data):e.Status||o._throwError(s.errorMessages.UnableAddWidget+e.Message)}))}}_makeAjaxRequest(e,t,i,s,n={},o){const d=this._validatetoken(this.accessToken),r=this;a.ajax({async:!1,type:e,url:t,headers:{Authorization:d},data:JSON.stringify(i),contentType:"application/json",success:function(e){r[o](e,s,r,n)},error:function(e){r.ajaxErrorFnc(e)}})}_saveFilterViews(e,t){const i=this._isValidGuid(e.ItemId),n=!!this.isMultiTab&&this._isValidGuid(e.ChildItemId);if(this._isEmptyOrSpaces(e.ViewName)||this._isEmptyOrSpaces(e.QueryString)||!(this.isMultiTab&&n&&i||i)){if(!i)throw new Error(s.errorMessages.InvalidDashboardID);if(this.isMultiTab&&!n)throw new Error(s.errorMessages.InvalidChildDbrdID);if(this._isEmptyOrSpaces(e.ViewName))throw new Error(s.errorMessages.InvalidViewName);if(this._isEmptyOrSpaces(e.QueryString))throw new Error(s.errorMessages.InvalidQueryString)}else{const i={ViewName:e.ViewName,ItemId:e.ItemId,QueryString:e.QueryString,IsPublic:!1,ChildItemId:this.isMultiTab?e.ChildItemId:null,IsDefault:!!e.IsDefault&&e.IsDefault};this._makeAjaxRequest("POST",`${this.dashboardServerApiUrl}/v4.0/dashboards/views`,i,t,e,"_saveViewSuccess")}}_saveAsFilterViews(e,t){const i=this._isValidGuid(e.ItemId),n=!!this.isMultiTab&&this._isValidGuid(e.ChildItemId);if(this._isEmptyOrSpaces(e.ViewName)||this._isEmptyOrSpaces(e.QueryString)||!(this.isMultiTab&&n&&i||i)){if(!i)throw new Error(s.errorMessages.InvalidDashboardID);if(this.isMultiTab&&!n)throw new Error(s.errorMessages.InvalidChildDbrdID);if(this._isEmptyOrSpaces(e.ViewName))throw new Error(s.errorMessages.InvalidViewName);if(this._isEmptyOrSpaces(e.QueryString))throw new Error(s.errorMessages.InvalidQueryString)}else{const i={ViewName:e.ViewName,ItemId:e.ItemId,QueryString:e.QueryString,ChildItemId:this.isMultiTab?e.ChildItemId:null,IsDefault:!!e.IsDefault&&e.IsDefault};this._makeAjaxRequest("POST",`${this.dashboardServerApiUrl}/v4.0/dashboards/views`,i,t,e,"_saveViewSuccess")}}_updateFilterViews(e,t){const i=this._isValidGuid(e.DashboardId),n=this._isValidGuid(e.ViewId);if(i&&!this._isEmptyOrSpaces(e.QueryString)&&n){const i={ViewId:e.ViewId,DashboardId:e.DashboardId,QueryString:e.QueryString,IsDefault:e.IsDefault};this._makeAjaxRequest("PUT",`${this.dashboardServerApiUrl}/v4.0/dashboards/views`,i,t,e,"_updateFilterViewsSuccess")}else{if(!i)throw new Error(s.errorMessages.InvalidDashboardID);if(!n)throw new Error(s.errorMessages.InvalidViewID);if(this._isEmptyOrSpaces(e.QueryString))throw new Error(s.errorMessages.InvalidQueryString)}}_getViewsByDashboardId(e,t){const i=this._isValidGuid(e);if(i){const i={DashboardId:e};this._makeAjaxRequest("GET",`${this.dashboardServerApiUrl}/v4.0/dashboards/${e}/views`,i,t,null,"_getViewsByDashboardIdSuccess")}else if(!i)throw new Error(s.errorMessages.InvalidDashboardID)}_getViewByViewId(e,t){const i=this._isValidGuid(e);if(i){const i={ViewId:e};this._makeAjaxRequest("GET",`${this.dashboardServerApiUrl}/v4.0/dashboards/views/${e}`,i,t,null,"_getViewByViewIdSuccess")}else if(!i)throw new Error(s.errorMessages.InvalidViewID)}_deleteFilterView(e,t){const i=this._isValidGuid(e);if(i){const i={ViewId:e};this._makeAjaxRequest("DELETE",`${this.dashboardServerApiUrl}/v4.0/dashboards/views/${e}`,i,t,e,"_deleteFilterViewSuccess")}else if(!i)throw new Error(s.errorMessages.InvalidViewID)}_saveViewSuccess(e,t,i,s){const n=i;if(e.Status){const i={ItemId:s.ItemId,ViewId:e.Data,ViewName:s.ViewName};n._updateInFilterOverviewUI(i.ViewName,e.Data),window[`${t}`]instanceof Function?window[`${t}`].call(n,i,e.StatusMessage):t.call(n,i,e.StatusMessage)}else window[`${t}`]instanceof Function?window[`${t}`].call(n,null,e.StatusMessage):t.call(n,null,e.StatusMessage)}_updateFilterViewsSuccess(e,t,i,s){const n=i;if(e.Status){const i={};i.ViewId=s.ViewId,window[`${t}`]instanceof Function?window[`${t}`].call(n,i,e.StatusMessage):t.call(n,i,e.StatusMessage)}}_deleteFilterViewSuccess(e,t,i,s){var n=i;window[`${t}`]instanceof Function?window[`${t}`].call(n,s):t.call(n,s)}_getViewByViewIdSuccess(e,t,i){const s=i,n={};e&&(n.ViewId=e.ViewId,n.ViewName=e.ViewName,n.QueryString=e.QueryString),window[`${t}`]instanceof Function?window[`${t}`].call(s,n):t.call(s,n)}_getViewsByDashboardIdSuccess(e,t,i){const s=i;if(e){const i=[];for(let t=0;t0)a(".pinBoardDbrd").each((function(){const t=e._getDashboardInstance(this.id);null!=t&&t.destroy()})),r._removeinstance(document.getElementById(this.embedOptions.embedContainerId),"embeddedBoldBI"),document.getElementById(this.embedOptions.embedContainerId).innerHTML="";else{this.isMultipleWidgetMode&&this._multipleWidgets("destroy");const e=this.embedOptions.embedContainerId,t=this._getDashboardInstance();null!=t&&t.destroy(),r._removeinstance(document.getElementById(e),"embeddedBoldBI"),document.getElementById(e).innerHTML=""}1==this.embedOptions.isRemoveStyle&&document.querySelectorAll("link").forEach((function(t){e.cssFiles.forEach((function(e){-1!=t.href.toLowerCase().indexOf(e.toLowerCase())&&t.parentNode.removeChild(t)}))}))}loadDashboardView(){throw new Error(s.errorMessages.NotImplementedMethod)}exportDashboardAsPdf(e){if(this.isMultiTab){let t=e.dashboardId;t=t.replaceAll("-","");const i="multi_"+t+"_embeddedbi",s=this._getDashboardInstance(i);null!=s&&s.exportAsPdf(e.fileName,e.pageSize,e.pageOrientation,e.showAppliedFilters)}else{const t=this._getDashboardInstance();null!=t&&(e?t.exportAsPdf(e.fileName,e.pageSize,e.pageOrientation,e.showAppliedFilters):t.exportAsPdf())}}exportDashboardAsImage(e){if(parseInt(e.resolutionDpi,10)>300&&(e.resolutionDpi="300"),this.isMultiTab){let t=e.dashboardId;t=t.replaceAll("-","");const i="multi_"+t+"_embeddedbi",s=this._getDashboardInstance(i);null!=s&&s.exportAsImage(e.fileName,e.exportImageFormat,e.resolutionDpi,e.showAppliedFilters)}else{const t=this._getDashboardInstance();null!=t&&(e?t.exportAsImage(e.fileName,e.exportImageFormat,e.resolutionDpi,e.showAppliedFilters):t.exportAsImage())}}exportDashboardAsExcel(e){if(this.isMultiTab){let t=e.dashboardId;t=t.replaceAll("-","");const i="multi_"+t+"_embeddedbi",s=this._getDashboardInstance(i);null!=s&&s.exportAsExcel(e.fileName,e.fileType)}else{const t=this._getDashboardInstance();null!=t&&(e?t.exportAsExcel(e.fileName,e.fileType):t.exportAsExcel())}}exportWidgetAsPdf(e){const t=this;if(this.isMultiTab){let t=e.dashboardId;t=t.replaceAll("-","");const i="multi_"+t+"_embeddedbi",s=this._getDashboardInstance(i);null!=s&&s.exportWidgetAsPdf(e.widgetName,e.fileName,e.pageSize,e.pageOrientation,e.showAppliedFilters)}else if(a(".pinBoardDbrd").length>0){const i=a(".pinBoardDbrd").length;for(let s=0;s300&&(e.resolutionDpi="300"),this.isMultiTab){let t=e.dashboardId;t=t.replaceAll("-","");const i="multi_"+t+"_embeddedbi",s=this._getDashboardInstance(i);null!=s&&s.exportWidgetAsImage(e.widgetName,e.fileName,e.exportImageFormat,e.resolutionDpi,e.showAppliedFilters)}else if(a(".pinBoardDbrd").length>0){const i=a(".pinBoardDbrd").length;for(let s=0;s0){const i=a(".pinBoardDbrd").length;for(let s=0;s0){const i=a(".pinBoardDbrd").length;for(let s=0;s0)a(".pinBoardDbrd").each((function(){const i=t._getDashboardInstance(this.id);null!=i&&i.option("filterParameters",e)}));else if(this.isMultipleWidgetMode)this._multipleWidgets("filterParameters",e);else{const t=this._getDashboardInstance();null!=t&&t.option("filterParameters",e)}}updateDashboardTheme(e){if(e&&""!==e.trim()){const t=this;this.embedOptions.dashboardSettings=this.embedOptions.dashboardSettings||{},this.embedOptions.dashboardSettings.themeSettings=this.embedOptions.dashboardSettings.themeSettings||{},this.embedOptions.dashboardSettings.themeSettings.dashboard=e,document.querySelectorAll("link").forEach((function(e){e.href.includes("/dashboard?theme=")&&e.parentNode.removeChild(e)}));const i=document.createElement("link");if(i.rel="stylesheet",this.embedOptions.environment==r.Environment.Enterprise?i.href=this.customThemeUrl+"/dashboard?theme="+e:i.href=this.rootUrl+"/theme/styles/dashboard?theme="+e,a('link[href="'+i.href+'"]').length<1&&document.head.appendChild(i),this.isMultiTab){const t=a("#"+this.embedOptions.embedContainerId).find(".e-content .bbembed-multitab-dbrd");for(let i=0;i0)a(".pinBoardDbrd").each((function(){const i=t._getDashboardInstance(this.id);null!=i&&i.option("dashboardThemeSettings.dashboardTheme",e)}));else{const t=this._getDashboardInstance();null!=t&&t.option("dashboardThemeSettings.dashboardTheme",e)}}else this._throwError(s.errorMessages.InvalidThemeName)}resizeDashboard(e){const t=this;if(this.embedOptions.isDynamicWidth&&this.embedOptions.isDynamicHeight&&this._onBrowserWindowResize(),this.isMultiTab){a("#"+t.embedOptions.embedContainerId+"_multi_tab_dashboard").css("width",a("#"+t.embedOptions.embedContainerId).width()),window.multiTabFilterParameter=e;const i=a("#"+this.embedOptions.embedContainerId).find(".e-content .bbembed-multitab-dbrd");for(let e=0;e{n.resizeDashboard()}),200)}}this._tabSelected()}else if(a(".pinBoardDbrd").length>0)a(".pinBoardDbrd").each((function(){const e=t._getDashboardInstance(this.id);if(null!=e){const i=window[t.embedOptions.onResize];i instanceof Function&&i.call(t,e),t.embedOptions.onResize instanceof Function&&t.embedOptions.onResize.call(t,e),e.resizeDashboard()}}));else if(this.isMultipleWidgetMode)this._multipleWidgets("resizeDashboard");else{const e=this._getDashboardInstance();if(null!=e){const i=window[t.embedOptions.onResize];i instanceof Function&&i.call(this,e),this.embedOptions.onResize instanceof Function&&this.embedOptions.onResize.call(this,e),setTimeout((()=>{e.resizeDashboard()}),200)}}}refreshDashboard(){const e=this;if(this.isMultiTab){const e=a("#"+this.embedOptions.embedContainerId).find(".e-content .bbembed-multitab-dbrd");for(let t=0;t0)a(".pinBoardDbrd").each((function(){const t=e._getDashboardInstance(this.id);null!=t&&t.updateDashboard()}));else if(this.isMultipleWidgetMode)this._multipleWidgets("updateDashboard");else{const e=this._getDashboardInstance();null!=e&&e.updateDashboard()}}clearAllFilter(){if(this.isMultiTab){const e=a("#"+this.embedOptions.embedContainerId).find(".e-content .bbembed-multitab-dbrd");for(let t=0;t0){const i=a(n[`${o}`]).attr("id"),d=this._getDashboardInstance(i);null!=d&&(s=d.getWidgetData(e,t),s.toLowerCase().includes("widget")>0&&(window[`${t}`]instanceof Function?window[`${t}`].call(this,s):t.call(this,s)));break}}else{const i=this._getDashboardInstance();null!=i&&(s=i.getWidgetData(e,t),s.toLowerCase().includes("widget")>0&&(window[`${t}`]instanceof Function?window[`${t}`].call(this,s):t.call(this,s)))}}getWidgetDataWithFilters(e,t,i,n){let o;const d=JSON.stringify({dashboardId:t,widgetName:e,filter:i});if(this._isEmptyOrSpaces(t))return o={status:!1,message:s.errorMessages.InvalidDashboardID,request:d},o;if(this._isEmptyOrSpaces(e))return o={status:!1,message:s.errorMessages.InvalidWidgetName,request:d},o;const r=this;var l=this._validatetoken(r.accessToken);return a.ajax({type:"POST",url:this.designerRootUrl+"/v1.0/design/loadwidgetdata",data:d,contentType:"application/json; charset=utf-8",beforeSend:function(e){e.setRequestHeader("Authorization",l),e.setRequestHeader("Caller",r.dashboardServerApiUrl)},success:function(e){o=e.Status?{status:e.Status,data:e.Data,message:e.Message,request:d}:{status:e.Status,message:e.Message,request:d},n.call(r,o)},error:function(e,t){o={status:!1,message:t,request:e},n.call(r,o)}}),o={status:!0,message:s.errorMessages.InitFetch,request:d},o}getDashboardCategories(e,t){const i=this._isNullOrUndefined(t)||this._isEmptyOrSpaces(t)?this._getDashboardInstance():this._getDashboardInstance(t+"_embeddedbi");if(null!=i){const t=i.GetDashboardCategories(e);window[`${e}`]instanceof Function?window[`${e}`].call(this,t):e.call(this,t)}}createDashboardCategory(e,t,i,s){const n=this._isNullOrUndefined(s)||this._isEmptyOrSpaces(s)?this._getDashboardInstance():this._getDashboardInstance(s+"_embeddedbi");if(null!=n){const s=n.CreateDashboardCategory(e,t,i);window[`${i}`]instanceof Function?window[`${i}`].call(this,s):i.call(this,s)}}saveDashboard(e,t){const i=this._isNullOrUndefined(t)||this._isEmptyOrSpaces(t)?this._getDashboardInstance():this._getDashboardInstance(t+"_embeddedbi");null!=i&&(i.model.serverSettings.enableMarkAsPublic=!!e.IsPublic&&e.IsPublic,i.saveDashboardToServer(e))}getWidgetInstance(e){const t=new l;t.containerID=this.embedOptions.embedContainerId,this._widgetsCollection[this._widgetsCollection.length]=e;const i=Object.assign(t);return t.widgetCollection=this._widgetsCollection,r._hasinstance(document.getElementById(this.embedOptions.embedContainerId),"embeddedBoldBIWidget_"+e)||r._putinstance(document.getElementById(this.embedOptions.embedContainerId),"embeddedBoldBIWidget_"+e,i),i}updateWidgetFilters(e){const t=this,i=this._getWidgetFilterInfo();if(this.isMultiTab){const e=a("#"+this.embedOptions.embedContainerId).find(".e-content .bbembed-multitab-dbrd");for(let t=0;t0)a(".pinBoardDbrd").each((function(){const e=t._getDashboardInstance(this.id);null!=e&&e.option("widgets",i)}));else if(this.isMultipleWidgetMode)this._multipleWidgets("widgets",i);else{const t=this._isNullOrUndefined(e)||this._isEmptyOrSpaces(e)?this._getDashboardInstance():this._getDashboardInstance(e+"_embeddedbi");null!=t&&t.option("widgets",i)}}_initializeEmbedOptions(e){this.embedOptions=Object.assign(this.embedOptions,e)}_setDimensions(){const e=document.getElementById(this.embedOptions.embedContainerId);if(e.style.width&&e.style.height)this.embedOptions.width=e.style.width,this.embedOptions.height=e.style.height;else{const t=e.parentNode;this.embedOptions.width=`${(null==t?void 0:t.clientWidth)||window.innerWidth}px`,this.embedOptions.height=`${(null==t?void 0:t.clientHeight)||window.innerHeight}px`,Object.assign(this.embedOptions,{isDynamicWidth:!0,isDynamicHeight:!0})}}_onBrowserWindowResize(){if(this.embedOptions.isDynamicWidth&&this.embedOptions.isDynamicHeight){const e=document.getElementById(this.embedOptions.embedContainerId),t=e.parentNode;e.style.width=`${(null==t?void 0:t.clientWidth)||window.innerWidth}px`,e.style.height=`${(null==t?void 0:t.clientHeight)||window.innerHeight}px`}}_loadCloudDepedentFiles(e){const t=e.Data;this.cdnLink=t.CdnUrl,this.designerRootUrl=t.DesignerServerUrl,this._addJquerydependentFiles()}_handleEnvironmentError(e){"error"==e.type&&(this._throwError(s.errorMessages.EnvironmentMemberError),this.invalidDetail=!0)}_getCloudLinks(){this._isEmptyOrSpaces(this.embedOptions.cloudCdnTimeStamp)?this._xhrRequestHelper("Get",this.dashboardServerApiUrl+"/system-settings/get-url",{},{},this._loadCloudDepedentFiles):(this.cdnLink=`https://cdn.boldbi.com/ds/${this.embedOptions.cloudCdnTimeStamp}/cdn`,this.designerRootUrl="https://data.boldbi.com",this._addJquerydependentFiles())}_loadDepedentFiles(){this.embedOptions.dashboardSettings.themeSettings&&!this.embedOptions.dashboardSettings.themeSettings.isLocalTheme&&this.embedOptions.dashboardSettings.themeSettings.dashboard?this._addedDependentFiles(this,this.dashboardThemeCssFiles,!0):this.embedOptions.dashboardSettings.themeSettings&&!this.embedOptions.dashboardSettings.themeSettings.isLocalTheme?this._addedDependentFiles(this,this.applicationThemeCssFiles,!0):this.embedOptions.dashboardSettings.themeSettings||this._addedDependentFiles(this,this.applicationThemeCssFiles,!0),this.embedOptions.mode==r.Mode.Design||this.embedOptions.mode==r.Mode.DataSource||this.embedOptions.mode==r.Mode.Connection?this._addedDependentFiles(this,this.designerScriptFiles,!1):this._addedDependentFiles(this,this.viewerScriptFiles,!1),this._isNullOrUndefined(this.embedOptions.dashboardSettings.fontFamily)||this._isEmptyOrSpaces(this.embedOptions.dashboardSettings.fontFamily)||this._addedDependentFiles(this,this.fontFamilyCssFiles,!0),""!=this.embedOptions.pinboardName&&this._addedDependentFiles(this,this.pinBoardScriptFiles,!1),this._addedDependentFiles(this,this.cssFiles,!0),""!=this.embedOptions.pinboardName&&this._addedDependentFiles(this,this.pinboardCssFiles,!0),this.embedOptions.mode!=r.Mode.Design&&this.embedOptions.mode!=r.Mode.DataSource&&this.embedOptions.mode!=r.Mode.Connection||this._addedDependentFiles(this,this.designerCssFiles,!0),this.embedOptions.isBingMapRequired&&this._loadBingmapDependentFiles(),this._loadDependentDesignerFiles(this)}_loadBingmapDependentFiles(){a('