UNPKG

606 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../ts/visualsCommon/DOMConstants.ts","../ts/visualsCommon/serviceError.ts","VisualsCommon.js","../ts/visualsCommon/services/build.ts","../ts/visualsCommon/services/geoTaggingAnalyzerService.ts","../ts/visualsCommon/typedefs/buildConstants.ts","../ts/visualsCommon/clientError.ts","../ts/visualsCommon/arrayExtensions.ts","../ts/visualsCommon/Controls/DomFactory.ts","../ts/visualsCommon/Double.ts","../ts/visualsCommon/color.ts","../ts/visualsCommon/CssConstants.ts","../ts/visualsCommon/debug.ts","../ts/visualsCommon/Errors.ts","../ts/visualsCommon/JQueryExtensions.ts","../ts/visualsCommon/Lazy.ts","../ts/visualsCommon/Prototype.ts","../ts/visualsCommon/Formatting.ts","../ts/visualsCommon/services/requires.ts","../ts/visualsCommon/services/jqueryPromiseFactory.ts","../ts/visualsCommon/services/localStorageService.ts","../ts/visualsCommon/Utility/wordBreaker.ts","../ts/visualsCommon/services/textMeasurementService.ts","../ts/visualsCommon/Utility/keyUtils.ts","../ts/visualsCommon/Utility/ThrottleUtility.ts","../ts/visualsCommon/Utility/TimerPromiseFactory.ts","../ts/visualsCommon/Utility/Utility.ts","../ts/visualsCommon/tracing/traceItem.ts","../ts/visualsCommon/Utility/urlUtils.ts","../ts/visualsCommon/Utility/browserUtils.ts","../ts/visualsCommon/Utility/StandaloneUtility.ts","../ts/visualsCommon/Utility/styleUtils.ts","../ts/visualsCommon/tracing/trace.ts","../ts/visualsCommon/tracing/traceType.ts","../ts/visualsCommon/services/dependencies.ts","../ts/visualsCommon/TraceType.ts"],"names":["jsCommon","DOMConstants","escKeyCode","enterKeyCode","tabKeyCode","upArrowKeyCode","downArrowKeyCode","leftArrowKeyCode","rightArrowKeyCode","homeKeyCode","endKeyCode","backSpaceKeyCode","deleteKeyCode","spaceKeyCode","shiftKeyCode","ctrlKeyCode","altKeyCode","aKeyCode","cKeyCode","sKeyCode","vKeyCode","wKeyCode","xKeyCode","yKeyCode","zKeyCode","DocumentBody","Anchor","EditableTextElements","EditableNumericElements","disabledAttributeOrValue","readonlyAttributeOrValue","idAttribute","styleAttribute","hrefAttribute","targetAttribute","blankValue","selfValue","classAttribute","titleAttribute","srcAttribute","contextmenuEventName","blurEventName","keyUpEventName","inputEventName","changeEventName","cutEventName","keyDownEventName","mouseMoveEventName","mouseDownEventName","mouseEnterEventName","mouseLeaveEventName","mouseOverEventName","mouseOutEventName","mouseClickEventName","pasteEventName","scrollEventName","dropEventName","focusEventName","focusInEventName","focusOutEventName","selectEventName","messageEventName","loadEventName","beforeUnload","inputAndSelectEventNames","powerbi","PowerBIErrorResourceType","ServiceErrorToClientError","serviceError","this","m_serviceError","Object","defineProperty","prototype","get","codeName","enumerable","configurable","httpRequestId","set","value","getDetails","resourceProvider","errorDetails","statusCode","PowerBIErrorDetailHelper","GetDetailsFromTransformError","GetDetailsFromServerErrorStatusCode","addAdditionalInfo","addMessageAndStackTrace","message","stackTrace","pbiErrorDetails","localize","i","length","element","localizedCode","getOptional","serverErrorPrefix","code","additionErrorInfoKeyValuePair","errorInfoKey","errorInfoValue","detail","type","ResourceCodeReference","additionalErrorInfo","push","key","val","additionalInfo","createGeoTaggingAnalyzerService","getLocalized","GeoTaggingAnalyzerService","CategoryTypes","Address","City","Continent","CountryRegion","County","Longitude","Latitude","Place","PostalCode","StateOrProvince","EnglishBackup","GeotaggingString_Continent","GeotaggingString_Continents","GeotaggingString_Country","GeotaggingString_Countries","GeotaggingString_State","GeotaggingString_States","GeotaggingString_City","GeotaggingString_Cities","GeotaggingString_Town","GeotaggingString_Towns","GeotaggingString_Province","GeotaggingString_Provinces","GeotaggingString_County","GeotaggingString_Counties","GeotaggingString_Village","GeotaggingString_Villages","GeotaggingString_Post","GeotaggingString_Zip","GeotaggingString_Code","GeotaggingString_Place","GeotaggingString_Places","GeotaggingString_Address","GeotaggingString_Addresses","GeotaggingString_Street","GeotaggingString_Streets","GeotaggingString_Longitude","GeotaggingString_Longitude_Short","GeotaggingString_Latitude","GeotaggingString_Latitude_Short","GeotaggingString_PostalCode","GeotaggingString_PostalCodes","GeotaggingString_ZipCode","GeotaggingString_ZipCodes","GeotaggingString_Territory","GeotaggingString_Territories","GeotaggingString_VRMBackCompat_CountryRegion","GeotaggingString_VRMBackCompat_StateOrProvince","toLowerCase","isLongitudeOrLatitude","fieldRefName","isLongitude","isLatitude","isGeographic","isGeocodable","isAddress","isCity","isContinent","isCountry","isCounty","isStateOrProvince","isPlace","isPostalCode","isTerritory","isGeoshapable","isGeoshapableEnglish","isEnglishCity","isEnglishCountry","isEnglishCounty","isEnglishStateOrProvince","isEnglishPostalCode","isEnglishTerritory","hasMatches","result","whiteSpaceRegex","fieldNameWithoutWhitespace","replace","fieldName","possibleMatches","useStrict","nonWordRegex","len","possibleMatch","indexofpossibleMatch","indexOf","wordEndFlag","wordBeginFlag","test","getFieldType","getEnglishFieldType","isEnglishAddress","isEnglishPlace","isEnglishContinent","whiteSpaceRegexPattern","RegExp","isEnglishLongitude","isEnglishLatitude","DEBUG","UnknownClientError","errorCode","details","HttpClientError","httpStatusCode","requestId","toString","IgnorableClientError","ArrayExtensions","intersect","target","other","diff","distinct","source","union","unionSingle","range","startIndex","endIndex","take","count","copy","sequenceEqual","left","right","comparison","emptyToNull","array","predicate","rotate","offset","slice","rotated","Array","apply","createWithId","extendWithId","extended","withId","findWithId","id","item","createWithName","extendWithName","withName","findItemWithName","name","index","indexWithName","insertSorted","list","diff_1","splice","unshift","removeFirst","clear","pop","isUndefinedOrEmpty","swap","firstIndex","secondIndex","temp","isInArray","lookupItem","compareCallback","_","any","isArrayOrInheritedArray","obj","nextPrototype","isArray","getPrototypeOf","InJs","DomFactory","div","$","span","checkbox","ul","li","button","select","textBox","img","iframe","applyDefault","defaultValue","undefined","Double","pow10","exp","POSITIVE_POWERS","Infinity","NEGATIVE_POWERS","log10","Math","log","LOG_E_10","floorWithPrecision","getPrecision","x","decimalDigits","DEFAULT_PRECISION_IN_DECIMAL_DIGITS","abs","MIN_EXP","precisionExp","max","equalWithPrecision","y","precision","DEFAULT_PRECISION","lessWithPrecision","lessOrEqualWithPrecision","greaterWithPrecision","greaterOrEqualWithPrecision","roundX","round","floor","ceilWithPrecision","ceil","floorToPrecision","ceilToPrecision","roundToPrecision","parseFloat","toPrecision","ensureInRange","min","project","fromMin","fromSize","toMin","toSize","NaN","relativeX","projectedX","removeDecimalNoise","isInteger","toIncrement","increment","MIN_VALUE","Number","MAX_VALUE","MAX_EXP","EPSILON","Color","rgbString","rotateFactor","originalRgb","parseColorString","originalHsv","rgbToHsv","rotatedHsv","rotateHsv","rotatedRgb","hsvToRgb","hexString","normalizeToHexString","color","rgb","exec","R","parseInt","G","B","A","rgbColor","s","h","r","g","b","v","delta","H","S","V","hsvColor","p","q","t","fractionalSector","sectorNumber","sectorPos","newH","darken","flooredNumber","componentToHex","hexComponent","clamped","hex","toUpperCase","CssConstants","createClassAndSelector","className","class","selector","pixelUnits","heightProperty","widthProperty","topProperty","bottomProperty","leftProperty","rightProperty","marginTopProperty","marginLeftProperty","displayProperty","backgroundProperty","backgroundColorProperty","backgroundRepeatProperty","backgroundSizeProperty","backgroundImageProperty","textShadowProperty","textAlignProperty","borderTopWidthProperty","borderBottomWidthProperty","borderLeftWidthProperty","borderRightWidthProperty","fontSizeProperty","fontWeightProperty","colorProperty","opacityProperty","paddingLeftProperty","paddingRightProperty","positionProperty","maxWidthProperty","minWidthProperty","overflowProperty","overflowXProperty","overflowYProperty","transformProperty","webkitTransformProperty","cursorProperty","visibilityProperty","absoluteValue","zeroPixelValue","autoValue","hiddenValue","noneValue","blockValue","inlineBlockValue","transparentValue","boldValue","visibleValue","tableRowValue","coverValue","pointerValue","scrollValue","debug","assert","condition","assertFail","assertValue","assertNonEmpty","assertAnyValue","assertFailFunction","alert","getStackTrace","leadingFramesToRemove","stackSegments","Error","error","stack","split","join","Errors","infoNavAppAlreadyPresent","getExceptionStackTrace","invalidOperation","argument","argumentName","argumentNull","argumentUndefined","argumentOutOfRange","pureVirtualMethodException","methodName","notImplementedException","fn","multiline","text","html","togglePanelControl","each","addClass","find","hover","toggleClass","prepend","click","end","next","slideToggle","hide","JQueryConstants","VisibleSelector","Lazy","factoryMethod","Utility","throwIfNullOrUndefined","getValue","Prototype","inherit","extension","wrapCtor","inherited","inheritSingle","proto","overrideArray","override","overwritten","Formatting","findDateFormat","format","cultureName","Date","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","fixDateTimeFormat","regexCache","map","requires","dependency","to","noop","loadStyleSheets","cssFiles","scriptsToRun","javaScriptFilesWithCallback","javaScriptFiles","javascriptFile","loadJavaScriptFiles","hrefList","forEach","href","styleSheetLoaded","loadStyleSheet","scripts","callback","parseIfLoadingComplete","loadingCount","parseJavaScriptSourceCodes","sourceCodeList","makeCallbackIfParsingComplete","parsingCount","script","file","javaScriptFilesLoaded","javaScriptFilesLoading","isExternalUrl","loadJavaScriptSourceCode","sourceCode","link","linkElement","cloneNode","firstScriptInHeadElement","headElement","insertBefore","appendChild","src","onload","webGet","responseText","parseJavaScript","onComplete","sourceCodeOrFileName","targetCallback","onLoadCallback","promiseAsCallback","then","loadExternalJavaScriptFile","parseInternalJavaScriptCode","scriptElement","setAttribute","innerHTML","setTimeout","asyncLoop","listeners","listener","onerror","xhr","XMLHttpRequest","open","send","e","url","origin","location","protocol","host","args","_i","arguments","asyncSteps","steps","j","func","doc","document","head","getElementsByTagName","createElement","createJQueryPromiseFactory","JQueryPromiseFactory","defer","JQueryDeferredWrapper","Deferred","reject","reason","deferred","promise","resolve","all","promises","unwrappedPromises","jQuery","JQueryPromiseWrapper","when","unwrappedPromise","a","wrapCallback","always","arg","LocalStorageService","getData","localStorage","JSON","parse","exception","setData","data","stringify","EphemeralStorageService","clearCacheInterval","cache","defaultClearCacheInterval","clearCache","_this","clearCacheTimerId","localStorageService","ephemeralStorageService","WordBreaker","search","content","backward","hasBreakers","ilen","start","BREAKERS_REGEX","lastIndex","wordCount","getMaxWordWidth","textWidthMeasurer","properties","words","maxWidth","words_1","w","getWidth","truncate","truncator","splitByWidth","maxNumLines","usedWidth","wordsInLine","words_2","word","wordWidth","SPACE","TextMeasurementService","ensureDOM","spanElement","append","svgTextElement","d3","style","height","width","position","canvasCtx","getContext","fallbackFontFamily","window","getComputedStyle","node","fontFamily","removeSpanElement","remove","measureSvgTextWidth","textProperties","font","fontStyle","fontVariant","fontWeight","fontSize","measureText","measureSvgTextRect","attr","visibility","font-family","font-variant","font-size","font-weight","font-style","white-space","whiteSpace","getBBox","measureSvgTextHeight","estimateSvgTextRect","propertiesKey","rect","estimatedTextProperties","estimateSvgTextBaselineDelta","estimateSvgTextHeight","tightFightForNumeric","measureSvgTextElementWidth","svgElement","getSvgMeasurementProperties","getMeasurementProperties","css","textContent","getDivElementWidth","getTailoredTextOrDefault","strLength","copiedTextProperties","ellipsis","substr","svgEllipsis","textElement","originalText","tailoredText","wordBreak","maxHeight","linePadding","firstDY","labelText","dy","wordBreakOverflowingText","compact","spanItem","selectAll","OverflowingText","d","inArray","enter","classed","PixelConverter","KeyUtils","isArrowKey","keyCode","ThrottleUtility","delay","timerFactory","TimerPromiseFactory","instance","run","create","done","timerComplete","delayInMs","HttpStatusCode","HttpConstants","ApplicationOctetStream","MultiPartFormData","StringExtensions","isNullOrUndefinedOrWhiteSpaceString","reg","equalIgnoreCase","normalizeCase","startsWithIgnoreCase","normalizedSearchString","startsWith","containsIgnoreCase","substring","isNullOrEmpty","str","trim","containsWhitespace","expr","isWhitespace","trimTrailingWhitespace","trimWhitespace","getLengthDifference","repeat","char","replaceAll","textToFind","textToReplace","pattern","escapeStringForRegex","ensureUniqueNames","names","usedNames","names_1","name_1","uniqueNames","_a","names_2","name_2","uniqueName","counter","findUniqueName","baseName","constructCommaSeparatedList","maxValue","replacedList","targetValue","replaceValue","commaSeparatedList","normalizeFileName","fileName","stringifyAsPrettyJSON","object","deriveClsCompliantName","input","fallback","stripTagDelimiters","HtmlTagRegex","context","parameterName","throwException","getComponentName","Undefined","throwIfNullOrEmpty","throwIfNullOrEmptyString","throwIfNullEmptyOrWhitespaceString","throwIfNotTrue","isString","isBoolean","isNumber","isDate","isObject","isNullOrUndefined","urlCombine","baseUrl","path","finalUrl","charAt","getAbsoluteUri","clusterUri","getStaticResourceUri","staticContentLocation","Trace","createClassSelector","createIdSelector","generateGuid","guid","idx","guidDigitsItem","random","getCookieValue","keyValuePairs","cookie","keyValue","getDomainForUrl","hrefObject","getHrefObjectFromUrl","prop","getHostNameForUrl","getUrlWithoutQueryString","getProtocolFromUrl","aObject","convertWcfToJsDictionary","wcfDictionary","keyValuePair","getDateFromWcfJsonString","jsonDate","fromUtcMilliseconds","begIndex","milliseconds","retValue","setUTCMilliseconds","getOuterHtml","compareInt","getIndexOfMinValue","currentMinValue","extractUrlFromCssBackgroundImage","isValidImageDataUrl","regex","isLocalUrl","saveAsFile","contentBlob","Blob","URL","urlLink","createObjectURL","fileNameLink","navigator","msSaveOrOpenBlob","hyperlink","body","removeChild","getType","__type","parts","TypeNamespace","isEventSupported","eventName","isSupported","removeAttribute","toPixel","pixelAmount","getPropertyCount","getOwnPropertyNames","getFileExtension","filePath","lastIndexOf","extractFileNameFromPath","canUseClipboard","MSApp","is64BitOperatingSystem","userAgent","parseNumber","isFinite","isNaN","getURLParamValue","results","getLocalTimeZoneString","localTimeZoneString","timeSummer","UTC","summerOffset","getTimezoneOffset","timeWinter","winterOffset","JsonContentType","JpegContentType","XJavascriptContentType","JsonDataType","BlobDataType","HttpGetMethod","HttpPostMethod","HttpPutMethod","HttpDeleteMethod","HttpContentTypeHeader","HttpAcceptHeader","VersionUtility","compareVersions","versionA","versionB","versionParts","partA","partB","PerformanceUtil","PerfMarker","_name","_start","begin","performance","mark","console","time","measure","timeEnd","DeferUtility","deferUntilNextFrame","isWaiting","requestAnimationFrame","TraceItem","sessionId","timeStamp","resultString","traceTypeStrings","toUTCString","UrlUtils","isValidUrl","match","RegExpExtensions","urlRegex","isValidImageUrl","findAllValidUrls","matches","urlRanges","getBase64ContentFromDataUri","uri","base64Token","indexBase64TokenStart","indexBase64Start","BrowserUtils","isChrome","vendorName","vendor","isInternetExplorerOrEdge","getInternetExplorerVersion","appName","re","EnumExtensions","hasFlag","flag","setFlag","resetFlag","enumType","endsWith","suffix","LogicExtensions","XOR","JsonComparer","equals","TextSizeDefaults","getScale","textSize","TextSizeMin","TextSizeRange","TextSizeMax","px","PixelString","fromPoint","pt","fromPointToPixel","PxPtRatio","toPoint","visuals","utility","StyleUtils","getRotateAngleFromElement","rawElemStyle","transformString","transform","webkitTransform","getTranslateTransformFromElement","getPadding","top","bottom","ConsoleTracer","logTrace","trace","TraceType","Information","UnexpectedError","Fatal","ExpectedError","Warning","Verbose","warning","logTraceInternal","includeStackTrace","verbose","addListener","removeListener","resetListeners","defaultListener","reset","lastTraceIndex","getTraces","traces","disableDefaultListener","enableDefaultListener","traceMaxCount","ensurePowerView","action","PowerViewPackage","ensureMap","locale","mapPackageWithLocale","MapPackage","isEmpty","MSMapcontrol","concat","mapControlLoaded","MSMapcontrolLoaded","WaitForMSMapLoad","waitForMapControlLoaded","task","build","globalMapControlLoaded"],"mappings":"AA0BA,GAAOA,WAAP,SAAOA,GAIH,GAAcC,IAAd,SAAcA,GAKGA,EAAAC,WAAa,GACbD,EAAAE,aAAe,GACfF,EAAAG,WAAa,EACbH,EAAAI,eAAiB,GACjBJ,EAAAK,iBAAmB,GACnBL,EAAAM,iBAAmB,GACnBN,EAAAO,kBAAoB,GACpBP,EAAAQ,YAAc,GACdR,EAAAS,WAAa,GACbT,EAAAU,iBAAmB,EACnBV,EAAAW,cAAgB,GAChBX,EAAAY,aAAe,GACfZ,EAAAa,aAAe,GACfb,EAAAc,YAAc,GACdd,EAAAe,WAAa,GAEbf,EAAAgB,SAAW,GACXhB,EAAAiB,SAAW,GACXjB,EAAAkB,SAAW,GACXlB,EAAAmB,SAAW,GACXnB,EAAAoB,SAAW,GACXpB,EAAAqB,SAAW,GACXrB,EAAA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ASohB,EAAsBJ,GAGtC,QAAAS,KACCC,GAAqB,EACjBC,IACHA,EAAiBjc,UACRic,EAAmBxwB,QAI9B,QAAAywB,KACC,GAAIC,EAQJ,OAPKH,IAGJG,EAAOtxB,EAAE8U,WACTwc,EAAKnc,WAHLmc,EAAOF,EAAmBpxB,EAAE8U,WAMtBwc,EAAKpc,UAvDV,GAAM8b,GAAe,4GAKjBG,GAAqB,EACrBC,EAAyC,KAEvCV,GACFzgB,iBACIle,QAAQw/B,MAAQ,8BAEpBzhB,UACI/d,QAAQw/B,MAAO,iCAEzBvhB,8BACYE,eAAgB8gB,EAAcze,eAAgB8e,IAIxCvjC,GAAA0iC,gBAAeA,CAI/B,IAAMM,IACR9gB,8BACYE,eAAgB8gB,EAAcze,eAAgB8e,IAIxCvjC,GAAA6iC,UAASA,EAQZ7iC,EAAAojC,iBAAgBA,EAQhBpjC,EAAAujC,wBAAuBA,GAlDjCvjC,WAAAA,aAgEP,IAAI0jC,wBAAyB,WAE5B1jC,SAASojC,oBClEHrxB,MAAP,SAAOA,IAKH,SAAYqvB,GACRA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,QAAA,GAAA,UACAA,EAAAA,EAAA,QAAA,GAAA,UACAA,EAAAA,EAAA,MAAA,GAAA,QACAA,EAAAA,EAAA,cAAA,GAAA,gBACAA,EAAAA,EAAA,gBAAA,GAAA,kBACAA,EAAAA,EAAA,MAAA,GAAA,SAPQrvB,EAAAqvB,YAAArvB,EAAAqvB,cAAArvB,GAAAqvB,WALTrvB,OAAAA","file":"VisualsCommon.min.js","sourcesContent":["/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n /**\r\n * DOM constants.\r\n */\r\n export module DOMConstants {\r\n\r\n /** \r\n * Integer codes corresponding to individual keys on the keyboard.\r\n */\r\n export const escKeyCode = 27;\r\n export const enterKeyCode = 13;\r\n export const tabKeyCode = 9;\r\n export const upArrowKeyCode = 38;\r\n export const downArrowKeyCode = 40;\r\n export const leftArrowKeyCode = 37;\r\n export const rightArrowKeyCode = 39;\r\n export const homeKeyCode = 36;\r\n export const endKeyCode = 35;\r\n export const backSpaceKeyCode = 8;\r\n export const deleteKeyCode = 46;\r\n export const spaceKeyCode = 32;\r\n export const shiftKeyCode = 16;\r\n export const ctrlKeyCode = 17;\r\n export const altKeyCode = 18;\r\n\r\n export const aKeyCode = 65;\r\n export const cKeyCode = 67;\r\n export const sKeyCode = 83;\r\n export const vKeyCode = 86;\r\n export const wKeyCode = 87;\r\n export const xKeyCode = 88;\r\n export const yKeyCode = 89;\r\n export const zKeyCode = 90;\r\n\r\n /** \r\n * DOM Elements.\r\n */\r\n export const DocumentBody = 'body';\r\n export const Anchor = 'a';\r\n export const EditableTextElements = ':text, textarea';\r\n export const EditableNumericElements = '[type=\"number\"]';\r\n\r\n /** \r\n * DOM Attributes and values.\r\n */\r\n export const disabledAttributeOrValue = 'disabled';\r\n export const readonlyAttributeOrValue = 'readonly';\r\n export const idAttribute = 'id';\r\n export const styleAttribute = 'style';\r\n export const hrefAttribute = 'href';\r\n export const targetAttribute = 'target';\r\n export const blankValue = '_blank';\r\n export const selfValue = '_self';\r\n export const classAttribute = 'class';\r\n export const titleAttribute = 'title';\r\n export const srcAttribute = 'src';\r\n\r\n /**\r\n * DOM event names.\r\n */\r\n export const contextmenuEventName = 'contextmenu';\r\n export const blurEventName = 'blur';\r\n export const keyUpEventName = 'keyup';\r\n export const inputEventName = 'input';\r\n export const changeEventName = 'change';\r\n export const cutEventName = 'cut';\r\n export const keyDownEventName = 'keydown';\r\n export const mouseMoveEventName = 'mousemove';\r\n export const mouseDownEventName = 'mousedown';\r\n export const mouseEnterEventName = 'mouseenter';\r\n export const mouseLeaveEventName = 'mouseleave';\r\n export const mouseOverEventName = 'mouseover';\r\n export const mouseOutEventName = 'mouseout';\r\n export const mouseClickEventName = 'click';\r\n export const pasteEventName = 'paste';\r\n export const scrollEventName = 'scroll';\r\n export const dropEventName = 'drop';\r\n export const focusEventName = 'focus';\r\n export const focusInEventName = 'focusin';\r\n export const focusOutEventName = 'focusout';\r\n export const selectEventName = 'select';\r\n export const messageEventName = 'message';\r\n export const loadEventName = 'load';\r\n export const beforeUnload = 'beforeunload';\r\n \r\n /**\r\n * Common DOM event combination names.\r\n */\r\n export const inputAndSelectEventNames = 'input, select';\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n import IStringResourceProvider = jsCommon.IStringResourceProvider;\r\n\r\n export interface ServiceError {\r\n statusCode: number;\r\n\r\n /**\r\n * This error code corresponds with a PowerBIServiceException that happened on the server.\r\n */\r\n errorCode?: string;\r\n \r\n /**\r\n * Message and stack trace should only be sent in non-production environments.\r\n */\r\n message?: string;\r\n stackTrace?: string;\r\n errorDetails?: PowerBIErrorDetail[];\r\n parameters?: ErrorParameter[];\r\n }\r\n\r\n export interface PowerBIErrorDetail {\r\n code: string;\r\n detail: PowerBIErrorDetailValue;\r\n }\r\n\r\n export interface ErrorParameter {\r\n Key: string;\r\n Value: string;\r\n }\r\n\r\n export interface PowerBIErrorDetailValue {\r\n type: PowerBIErrorResourceType;\r\n value: string;\r\n }\r\n\r\n export enum PowerBIErrorResourceType {\r\n ResourceCodeReference = 0,\r\n EmbeddedString = 1,\r\n }\r\n\r\n export const enum ServiceErrorStatusCode {\r\n GeneralError = 0,\r\n CsdlFetching = 1,\r\n CsdlConvertXmlToConceptualSchema = 2,\r\n CsdlCreateClientSchema = 3,\r\n ExecuteSemanticQueryError = 4,\r\n ExecuteSemanticQueryInvalidStreamFormat = 5,\r\n ExecuteSemanticQueryTransformError = 6,\r\n }\r\n\r\n export class ServiceErrorToClientError implements IClientError {\r\n private m_serviceError: ServiceError;\r\n private httpRequestId: string;\r\n private static codeName = 'ServiceErrorToClientError';\r\n\r\n public get code(): string {\r\n return ServiceErrorToClientError.codeName;\r\n }\r\n\r\n public get ignorable(): boolean {\r\n return false;\r\n }\r\n\r\n public get requestId(): string {\r\n return this.httpRequestId;\r\n }\r\n\r\n public set requestId(value: string) {\r\n this.httpRequestId = value;\r\n }\r\n\r\n constructor(serviceError: ServiceError) {\r\n this.m_serviceError = serviceError;\r\n }\r\n\r\n public getDetails(resourceProvider: IStringResourceProvider): ErrorDetails {\r\n let errorDetails: ErrorDetails;\r\n if (this.m_serviceError.statusCode === ServiceErrorStatusCode.ExecuteSemanticQueryTransformError) {\r\n errorDetails = PowerBIErrorDetailHelper.GetDetailsFromTransformError(resourceProvider, this.m_serviceError);\r\n }\r\n else {\r\n errorDetails = PowerBIErrorDetailHelper.GetDetailsFromServerErrorStatusCode(resourceProvider, this.m_serviceError.statusCode);\r\n }\r\n\r\n PowerBIErrorDetailHelper.addAdditionalInfo(errorDetails, this.m_serviceError.errorDetails, resourceProvider);\r\n PowerBIErrorDetailHelper.addMessageAndStackTrace(errorDetails, this.m_serviceError.message || null, this.m_serviceError.stackTrace || null, resourceProvider);\r\n\r\n return errorDetails;\r\n }\r\n }\r\n\r\n export class PowerBIErrorDetailHelper {\r\n private static serverErrorPrefix = \"ServerError_\";\r\n public static addAdditionalInfo(errorDetails: ErrorDetails, pbiErrorDetails: PowerBIErrorDetail[], localize: IStringResourceProvider): ErrorDetails {\r\n if (pbiErrorDetails) {\r\n for (let i = 0; i < pbiErrorDetails.length; i++) {\r\n let element = pbiErrorDetails[i];\r\n let localizedCode = localize.getOptional(PowerBIErrorDetailHelper.serverErrorPrefix + element.code);\r\n let additionErrorInfoKeyValuePair = {\r\n errorInfoKey: localizedCode ? localizedCode : element.code,\r\n errorInfoValue: element.detail.type === PowerBIErrorResourceType.ResourceCodeReference ? localize.get(PowerBIErrorDetailHelper.serverErrorPrefix + element.detail.value) : element.detail.value\r\n };\r\n\r\n errorDetails.additionalErrorInfo.push(additionErrorInfoKeyValuePair);\r\n }\r\n }\r\n return errorDetails;\r\n }\r\n\r\n public static addMessageAndStackTrace(errorDetails: ErrorDetails, message: string, stackTrace: string, localize: IStringResourceProvider): ErrorDetails {\r\n if (message) {\r\n let additionErrorInfoKeyValuePair = {\r\n errorInfoKey: localize.get(\"AdditionalErrorInfo_ErrorDetailsText\"),\r\n errorInfoValue: message\r\n };\r\n errorDetails.additionalErrorInfo.push(additionErrorInfoKeyValuePair);\r\n }\r\n if (stackTrace) {\r\n let additionErrorInfoKeyValuePair = {\r\n errorInfoKey: localize.get(\"AdditionalErrorInfo_StackTraceText\"),\r\n errorInfoValue: stackTrace\r\n };\r\n errorDetails.additionalErrorInfo.push(additionErrorInfoKeyValuePair);\r\n }\r\n return errorDetails;\r\n }\r\n\r\n public static GetDetailsFromTransformError(localize: IStringResourceProvider, serviceError: ServiceError): ErrorDetails {\r\n let message = localize.get('ServiceError_CannotLoadVisual');\r\n let key = localize.get('ServiceError_CannotLoadVisual');\r\n let val = serviceError.message;\r\n\r\n let additionalInfo: ErrorInfoKeyValuePair[] = [];\r\n additionalInfo.push({ errorInfoKey: key, errorInfoValue: val, });\r\n\r\n let errorDetails: ErrorDetails = {\r\n message: message,\r\n additionalErrorInfo: additionalInfo,\r\n };\r\n\r\n return errorDetails;\r\n }\r\n\r\n public static GetDetailsFromServerErrorStatusCode(localize: IStringResourceProvider, statusCode: number): ErrorDetails {\r\n // TODO: Localize\r\n let message: string = \"\";\r\n let key: string = \"\";\r\n let val: string = \"\";\r\n\r\n switch (statusCode) {\r\n case ServiceErrorStatusCode.CsdlConvertXmlToConceptualSchema:\r\n message = localize.get('ServiceError_ModelCannotLoad');\r\n key = localize.get('ServiceError_ModelConvertFailureKey');\r\n val = localize.get('ServiceError_ModelConvertFailureValue');\r\n break;\r\n case ServiceErrorStatusCode.CsdlCreateClientSchema:\r\n message = localize.get('ServiceError_ModelCannotLoad');\r\n key = localize.get('ServiceError_ModelCreationFailureKey');\r\n val = localize.get('ServiceError_ModelCreationFailureValue');\r\n break;\r\n case ServiceErrorStatusCode.CsdlFetching:\r\n message = localize.get('ServiceError_ModelCannotLoad');\r\n key = localize.get('ServiceError_ModelFetchingFailureKey');\r\n val = localize.get('ServiceError_ModelFetchingFailureValue');\r\n break;\r\n case ServiceErrorStatusCode.ExecuteSemanticQueryError:\r\n message = localize.get('ServiceError_CannotLoadVisual');\r\n key = localize.get('ServiceError_ExecuteSemanticQueryErrorKey');\r\n val = localize.get('ServiceError_ExecuteSemanticQueryErrorValue');\r\n break;\r\n case ServiceErrorStatusCode.ExecuteSemanticQueryInvalidStreamFormat:\r\n message = localize.get('ServiceError_CannotLoadVisual');\r\n key = localize.get('ServiceError_ExecuteSemanticQueryInvalidStreamFormatKey');\r\n val = localize.get('ServiceError_ExecuteSemanticQueryInvalidStreamFormatValue');\r\n break;\r\n case ServiceErrorStatusCode.GeneralError:\r\n default:\r\n message = localize.get('ServiceError_GeneralError');\r\n key = localize.get('ServiceError_GeneralErrorKey');\r\n val = localize.get('ServiceError_GeneralErrorValue');\r\n break;\r\n }\r\n\r\n let additionalInfo: ErrorInfoKeyValuePair[] = [];\r\n additionalInfo.push({ errorInfoKey: key, errorInfoValue: val, });\r\n\r\n let errorDetails: ErrorDetails = {\r\n message: message,\r\n additionalErrorInfo: additionalInfo,\r\n };\r\n\r\n return errorDetails;\r\n }\r\n }\r\n} ","/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n///<reference path=\"../../Typedefs/jquery/jquery.d.ts\"/>\n///<reference path=\"../../Typedefs/d3/d3.d.ts\"/>\n///<reference path=\"../../Typedefs/lodash/lodash.d.ts\"/> \n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * DOM constants.\n */\n var DOMConstants;\n (function (DOMConstants) {\n /**\n * Integer codes corresponding to individual keys on the keyboard.\n */\n DOMConstants.escKeyCode = 27;\n DOMConstants.enterKeyCode = 13;\n DOMConstants.tabKeyCode = 9;\n DOMConstants.upArrowKeyCode = 38;\n DOMConstants.downArrowKeyCode = 40;\n DOMConstants.leftArrowKeyCode = 37;\n DOMConstants.rightArrowKeyCode = 39;\n DOMConstants.homeKeyCode = 36;\n DOMConstants.endKeyCode = 35;\n DOMConstants.backSpaceKeyCode = 8;\n DOMConstants.deleteKeyCode = 46;\n DOMConstants.spaceKeyCode = 32;\n DOMConstants.shiftKeyCode = 16;\n DOMConstants.ctrlKeyCode = 17;\n DOMConstants.altKeyCode = 18;\n DOMConstants.aKeyCode = 65;\n DOMConstants.cKeyCode = 67;\n DOMConstants.sKeyCode = 83;\n DOMConstants.vKeyCode = 86;\n DOMConstants.wKeyCode = 87;\n DOMConstants.xKeyCode = 88;\n DOMConstants.yKeyCode = 89;\n DOMConstants.zKeyCode = 90;\n /**\n * DOM Elements.\n */\n DOMConstants.DocumentBody = 'body';\n DOMConstants.Anchor = 'a';\n DOMConstants.EditableTextElements = ':text, textarea';\n DOMConstants.EditableNumericElements = '[type=\"number\"]';\n /**\n * DOM Attributes and values.\n */\n DOMConstants.disabledAttributeOrValue = 'disabled';\n DOMConstants.readonlyAttributeOrValue = 'readonly';\n DOMConstants.idAttribute = 'id';\n DOMConstants.styleAttribute = 'style';\n DOMConstants.hrefAttribute = 'href';\n DOMConstants.targetAttribute = 'target';\n DOMConstants.blankValue = '_blank';\n DOMConstants.selfValue = '_self';\n DOMConstants.classAttribute = 'class';\n DOMConstants.titleAttribute = 'title';\n DOMConstants.srcAttribute = 'src';\n /**\n * DOM event names.\n */\n DOMConstants.contextmenuEventName = 'contextmenu';\n DOMConstants.blurEventName = 'blur';\n DOMConstants.keyUpEventName = 'keyup';\n DOMConstants.inputEventName = 'input';\n DOMConstants.changeEventName = 'change';\n DOMConstants.cutEventName = 'cut';\n DOMConstants.keyDownEventName = 'keydown';\n DOMConstants.mouseMoveEventName = 'mousemove';\n DOMConstants.mouseDownEventName = 'mousedown';\n DOMConstants.mouseEnterEventName = 'mouseenter';\n DOMConstants.mouseLeaveEventName = 'mouseleave';\n DOMConstants.mouseOverEventName = 'mouseover';\n DOMConstants.mouseOutEventName = 'mouseout';\n DOMConstants.mouseClickEventName = 'click';\n DOMConstants.pasteEventName = 'paste';\n DOMConstants.scrollEventName = 'scroll';\n DOMConstants.dropEventName = 'drop';\n DOMConstants.focusEventName = 'focus';\n DOMConstants.focusInEventName = 'focusin';\n DOMConstants.focusOutEventName = 'focusout';\n DOMConstants.selectEventName = 'select';\n DOMConstants.messageEventName = 'message';\n DOMConstants.loadEventName = 'load';\n DOMConstants.beforeUnload = 'beforeunload';\n /**\n * Common DOM event combination names.\n */\n DOMConstants.inputAndSelectEventNames = 'input, select';\n })(DOMConstants = jsCommon.DOMConstants || (jsCommon.DOMConstants = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n (function (PowerBIErrorResourceType) {\n PowerBIErrorResourceType[PowerBIErrorResourceType[\"ResourceCodeReference\"] = 0] = \"ResourceCodeReference\";\n PowerBIErrorResourceType[PowerBIErrorResourceType[\"EmbeddedString\"] = 1] = \"EmbeddedString\";\n })(powerbi.PowerBIErrorResourceType || (powerbi.PowerBIErrorResourceType = {}));\n var PowerBIErrorResourceType = powerbi.PowerBIErrorResourceType;\n var ServiceErrorToClientError = (function () {\n function ServiceErrorToClientError(serviceError) {\n this.m_serviceError = serviceError;\n }\n Object.defineProperty(ServiceErrorToClientError.prototype, \"code\", {\n get: function () {\n return ServiceErrorToClientError.codeName;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ServiceErrorToClientError.prototype, \"ignorable\", {\n get: function () {\n return false;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ServiceErrorToClientError.prototype, \"requestId\", {\n get: function () {\n return this.httpRequestId;\n },\n set: function (value) {\n this.httpRequestId = value;\n },\n enumerable: true,\n configurable: true\n });\n ServiceErrorToClientError.prototype.getDetails = function (resourceProvider) {\n var errorDetails;\n if (this.m_serviceError.statusCode === 6 /* ExecuteSemanticQueryTransformError */) {\n errorDetails = PowerBIErrorDetailHelper.GetDetailsFromTransformError(resourceProvider, this.m_serviceError);\n }\n else {\n errorDetails = PowerBIErrorDetailHelper.GetDetailsFromServerErrorStatusCode(resourceProvider, this.m_serviceError.statusCode);\n }\n PowerBIErrorDetailHelper.addAdditionalInfo(errorDetails, this.m_serviceError.errorDetails, resourceProvider);\n PowerBIErrorDetailHelper.addMessageAndStackTrace(errorDetails, this.m_serviceError.message || null, this.m_serviceError.stackTrace || null, resourceProvider);\n return errorDetails;\n };\n ServiceErrorToClientError.codeName = 'ServiceErrorToClientError';\n return ServiceErrorToClientError;\n }());\n powerbi.ServiceErrorToClientError = ServiceErrorToClientError;\n var PowerBIErrorDetailHelper = (function () {\n function PowerBIErrorDetailHelper() {\n }\n PowerBIErrorDetailHelper.addAdditionalInfo = function (errorDetails, pbiErrorDetails, localize) {\n if (pbiErrorDetails) {\n for (var i = 0; i < pbiErrorDetails.length; i++) {\n var element = pbiErrorDetails[i];\n var localizedCode = localize.getOptional(PowerBIErrorDetailHelper.serverErrorPrefix + element.code);\n var additionErrorInfoKeyValuePair = {\n errorInfoKey: localizedCode ? localizedCode : element.code,\n errorInfoValue: element.detail.type === PowerBIErrorResourceType.ResourceCodeReference ? localize.get(PowerBIErrorDetailHelper.serverErrorPrefix + element.detail.value) : element.detail.value\n };\n errorDetails.additionalErrorInfo.push(additionErrorInfoKeyValuePair);\n }\n }\n return errorDetails;\n };\n PowerBIErrorDetailHelper.addMessageAndStackTrace = function (errorDetails, message, stackTrace, localize) {\n if (message) {\n var additionErrorInfoKeyValuePair = {\n errorInfoKey: localize.get(\"AdditionalErrorInfo_ErrorDetailsText\"),\n errorInfoValue: message\n };\n errorDetails.additionalErrorInfo.push(additionErrorInfoKeyValuePair);\n }\n if (stackTrace) {\n var additionErrorInfoKeyValuePair = {\n errorInfoKey: localize.get(\"AdditionalErrorInfo_StackTraceText\"),\n errorInfoValue: stackTrace\n };\n errorDetails.additionalErrorInfo.push(additionErrorInfoKeyValuePair);\n }\n return errorDetails;\n };\n PowerBIErrorDetailHelper.GetDetailsFromTransformError = function (localize, serviceError) {\n var message = localize.get('ServiceError_CannotLoadVisual');\n var key = localize.get('ServiceError_CannotLoadVisual');\n var val = serviceError.message;\n var additionalInfo = [];\n additionalInfo.push({ errorInfoKey: key, errorInfoValue: val, });\n var errorDetails = {\n message: message,\n additionalErrorInfo: additionalInfo,\n };\n return errorDetails;\n };\n PowerBIErrorDetailHelper.GetDetailsFromServerErrorStatusCode = function (localize, statusCode) {\n // TODO: Localize\n var message = \"\";\n var key = \"\";\n var val = \"\";\n switch (statusCode) {\n case 2 /* CsdlConvertXmlToConceptualSchema */:\n message = localize.get('ServiceError_ModelCannotLoad');\n key = localize.get('ServiceError_ModelConvertFailureKey');\n val = localize.get('ServiceError_ModelConvertFailureValue');\n break;\n case 3 /* CsdlCreateClientSchema */:\n message = localize.get('ServiceError_ModelCannotLoad');\n key = localize.get('ServiceError_ModelCreationFailureKey');\n val = localize.get('ServiceError_ModelCreationFailureValue');\n break;\n case 1 /* CsdlFetching */:\n message = localize.get('ServiceError_ModelCannotLoad');\n key = localize.get('ServiceError_ModelFetchingFailureKey');\n val = localize.get('ServiceError_ModelFetchingFailureValue');\n break;\n case 4 /* ExecuteSemanticQueryError */:\n message = localize.get('ServiceError_CannotLoadVisual');\n key = localize.get('ServiceError_ExecuteSemanticQueryErrorKey');\n val = localize.get('ServiceError_ExecuteSemanticQueryErrorValue');\n break;\n case 5 /* ExecuteSemanticQueryInvalidStreamFormat */:\n message = localize.get('ServiceError_CannotLoadVisual');\n key = localize.get('ServiceError_ExecuteSemanticQueryInvalidStreamFormatKey');\n val = localize.get('ServiceError_ExecuteSemanticQueryInvalidStreamFormatValue');\n break;\n case 0 /* GeneralError */:\n default:\n message = localize.get('ServiceError_GeneralError');\n key = localize.get('ServiceError_GeneralErrorKey');\n val = localize.get('ServiceError_GeneralErrorValue');\n break;\n }\n var additionalInfo = [];\n additionalInfo.push({ errorInfoKey: key, errorInfoValue: val, });\n var errorDetails = {\n message: message,\n additionalErrorInfo: additionalInfo,\n };\n return errorDetails;\n };\n PowerBIErrorDetailHelper.serverErrorPrefix = \"ServerError_\";\n return PowerBIErrorDetailHelper;\n }());\n powerbi.PowerBIErrorDetailHelper = PowerBIErrorDetailHelper;\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n powerbi.CategoryTypes = {\n Address: \"Address\",\n City: \"City\",\n Continent: \"Continent\",\n CountryRegion: \"Country\",\n County: \"County\",\n Longitude: \"Longitude\",\n Latitude: \"Latitude\",\n Place: \"Place\",\n PostalCode: \"PostalCode\",\n StateOrProvince: \"StateOrProvince\"\n };\n function createGeoTaggingAnalyzerService(getLocalized) {\n return new GeoTaggingAnalyzerService(getLocalized);\n }\n powerbi.createGeoTaggingAnalyzerService = createGeoTaggingAnalyzerService;\n var EnglishBackup = {\n GeotaggingString_Continent: \"continent\",\n GeotaggingString_Continents: \"continents\",\n GeotaggingString_Country: \"country\",\n GeotaggingString_Countries: \"countries\",\n GeotaggingString_State: \"state\",\n GeotaggingString_States: \"states\",\n GeotaggingString_City: \"city\",\n GeotaggingString_Cities: \"cities\",\n GeotaggingString_Town: \"town\",\n GeotaggingString_Towns: \"towns\",\n GeotaggingString_Province: \"province\",\n GeotaggingString_Provinces: \"provinces\",\n GeotaggingString_County: \"county\",\n GeotaggingString_Counties: \"counties\",\n GeotaggingString_Village: \"village\",\n GeotaggingString_Villages: \"villages\",\n GeotaggingString_Post: \"post\",\n GeotaggingString_Zip: \"zip\",\n GeotaggingString_Code: \"code\",\n GeotaggingString_Place: \"place\",\n GeotaggingString_Places: \"places\",\n GeotaggingString_Address: \"address\",\n GeotaggingString_Addresses: \"addresses\",\n GeotaggingString_Street: \"street\",\n GeotaggingString_Streets: \"streets\",\n GeotaggingString_Longitude: \"longitude\",\n GeotaggingString_Longitude_Short: \"lon\",\n GeotaggingString_Latitude: \"latitude\",\n GeotaggingString_Latitude_Short: \"lat\",\n GeotaggingString_PostalCode: \"postal code\",\n GeotaggingString_PostalCodes: \"postal codes\",\n GeotaggingString_ZipCode: \"zip code\",\n GeotaggingString_ZipCodes: \"zip codes\",\n GeotaggingString_Territory: \"territory\",\n GeotaggingString_Territories: \"territories\",\n GeotaggingString_VRMBackCompat_CountryRegion: \"CountryRegion\",\n GeotaggingString_VRMBackCompat_StateOrProvince: \"StateOrProvince\",\n };\n var GeoTaggingAnalyzerService = (function () {\n function GeoTaggingAnalyzerService(getLocalized) {\n this.GeotaggingString_VRMBackCompat_CountryRegion = \"CountryRegion\";\n this.GeotaggingString_VRMBackCompat_StateOrProvince = \"StateOrProvince\";\n this.GeotaggingString_Continent = getLocalized(\"GeotaggingString_Continent\").toLowerCase();\n this.GeotaggingString_Continents = getLocalized(\"GeotaggingString_Continents\").toLowerCase();\n this.GeotaggingString_Country = getLocalized(\"GeotaggingString_Country\").toLowerCase();\n this.GeotaggingString_Countries = getLocalized(\"GeotaggingString_Countries\").toLowerCase();\n this.GeotaggingString_State = getLocalized(\"GeotaggingString_State\").toLowerCase();\n this.GeotaggingString_States = getLocalized(\"GeotaggingString_States\").toLowerCase();\n this.GeotaggingString_City = getLocalized(\"GeotaggingString_City\").toLowerCase();\n this.GeotaggingString_Cities = getLocalized(\"GeotaggingString_Cities\").toLowerCase();\n this.GeotaggingString_Town = getLocalized(\"GeotaggingString_Town\").toLowerCase();\n this.GeotaggingString_Towns = getLocalized(\"GeotaggingString_Towns\").toLowerCase();\n this.GeotaggingString_Province = getLocalized(\"GeotaggingString_Province\").toLowerCase();\n this.GeotaggingString_Provinces = getLocalized(\"GeotaggingString_Provinces\").toLowerCase();\n this.GeotaggingString_County = getLocalized(\"GeotaggingString_County\").toLowerCase();\n this.GeotaggingString_Counties = getLocalized(\"GeotaggingString_Counties\").toLowerCase();\n this.GeotaggingString_Village = getLocalized(\"GeotaggingString_Village\").toLowerCase();\n this.GeotaggingString_Villages = getLocalized(\"GeotaggingString_Villages\").toLowerCase();\n this.GeotaggingString_Post = getLocalized(\"GeotaggingString_Post\").toLowerCase();\n this.GeotaggingString_Zip = getLocalized(\"GeotaggingString_Zip\").toLowerCase();\n this.GeotaggingString_Code = getLocalized(\"GeotaggingString_Code\").toLowerCase();\n this.GeotaggingString_Place = getLocalized(\"GeotaggingString_Place\").toLowerCase();\n this.GeotaggingString_Places = getLocalized(\"GeotaggingString_Places\").toLowerCase();\n this.GeotaggingString_Address = getLocalized(\"GeotaggingString_Address\").toLowerCase();\n this.GeotaggingString_Addresses = getLocalized(\"GeotaggingString_Addresses\").toLowerCase();\n this.GeotaggingString_Street = getLocalized(\"GeotaggingString_Street\").toLowerCase();\n this.GeotaggingString_Streets = getLocalized(\"GeotaggingString_Streets\").toLowerCase();\n this.GeotaggingString_Longitude = getLocalized(\"GeotaggingString_Longitude\").toLowerCase();\n this.GeotaggingString_Longitude_Short = getLocalized(\"GeotaggingString_Longitude_Short\").toLowerCase();\n this.GeotaggingString_Latitude = getLocalized(\"GeotaggingString_Latitude\").toLowerCase();\n this.GeotaggingString_Latitude_Short = getLocalized(\"GeotaggingString_Latitude_Short\").toLowerCase();\n this.GeotaggingString_PostalCode = getLocalized(\"GeotaggingString_PostalCode\").toLowerCase();\n this.GeotaggingString_PostalCodes = getLocalized(\"GeotaggingString_PostalCodes\").toLowerCase();\n this.GeotaggingString_ZipCode = getLocalized(\"GeotaggingString_ZipCode\").toLowerCase();\n this.GeotaggingString_ZipCodes = getLocalized(\"GeotaggingString_ZipCodes\").toLowerCase();\n this.GeotaggingString_Territory = getLocalized(\"GeotaggingString_Territory\").toLowerCase();\n this.GeotaggingString_Territories = getLocalized(\"GeotaggingString_Territories\").toLowerCase();\n }\n GeoTaggingAnalyzerService.prototype.isLongitudeOrLatitude = function (fieldRefName) {\n return this.isLongitude(fieldRefName) ||\n this.isLatitude(fieldRefName);\n };\n GeoTaggingAnalyzerService.prototype.isGeographic = function (fieldRefName) {\n return this.isLongitudeOrLatitude(fieldRefName) ||\n this.isGeocodable(fieldRefName);\n };\n GeoTaggingAnalyzerService.prototype.isGeocodable = function (fieldRefName) {\n return this.isAddress(fieldRefName) ||\n this.isCity(fieldRefName) ||\n this.isContinent(fieldRefName) ||\n this.isCountry(fieldRefName) ||\n this.isCounty(fieldRefName) ||\n this.isStateOrProvince(fieldRefName) ||\n this.isPlace(fieldRefName) ||\n this.isPostalCode(fieldRefName) ||\n this.isTerritory(fieldRefName);\n };\n GeoTaggingAnalyzerService.prototype.isGeoshapable = function (fieldRefName) {\n return this.isCity(fieldRefName) ||\n this.isCountry(fieldRefName) ||\n this.isCounty(fieldRefName) ||\n this.isStateOrProvince(fieldRefName) ||\n this.isPostalCode(fieldRefName) ||\n this.isTerritory(fieldRefName) ||\n this.isGeoshapableEnglish(fieldRefName);\n };\n GeoTaggingAnalyzerService.prototype.isGeoshapableEnglish = function (fieldRefName) {\n return this.isEnglishCity(fieldRefName) ||\n this.isEnglishCountry(fieldRefName) ||\n this.isEnglishCounty(fieldRefName) ||\n this.isEnglishStateOrProvince(fieldRefName) ||\n this.isEnglishPostalCode(fieldRefName) ||\n this.isEnglishTerritory(fieldRefName);\n };\n GeoTaggingAnalyzerService.prototype.isAddress = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_Address,\n this.GeotaggingString_Addresses,\n this.GeotaggingString_Street,\n this.GeotaggingString_Streets\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isPlace = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_Place,\n this.GeotaggingString_Places\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isCity = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_City,\n this.GeotaggingString_Cities,\n this.GeotaggingString_Town,\n this.GeotaggingString_Towns,\n this.GeotaggingString_Village,\n this.GeotaggingString_Villages\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isStateOrProvince = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_State,\n this.GeotaggingString_States,\n this.GeotaggingString_Province,\n this.GeotaggingString_Provinces,\n this.GeotaggingString_VRMBackCompat_StateOrProvince,\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isCountry = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_Country,\n this.GeotaggingString_Countries,\n this.GeotaggingString_VRMBackCompat_CountryRegion\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isCounty = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_County,\n this.GeotaggingString_Counties\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isContinent = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_Continent,\n this.GeotaggingString_Continents\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isPostalCode = function (fieldRefName) {\n var result = (GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_Post,\n this.GeotaggingString_Zip])\n && GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Code])) ||\n GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_PostalCode,\n this.GeotaggingString_PostalCodes,\n this.GeotaggingString_ZipCode,\n this.GeotaggingString_ZipCodes\n ]);\n //Check again for strings without whitespace\n if (!result) {\n var whiteSpaceRegex = /\\s+/;\n var fieldNameWithoutWhitespace = fieldRefName.replace(whiteSpaceRegex, \"\");\n result = GeoTaggingAnalyzerService.hasMatches(fieldNameWithoutWhitespace, [\n this.GeotaggingString_PostalCode.replace(whiteSpaceRegex, ''),\n this.GeotaggingString_PostalCodes.replace(whiteSpaceRegex, ''),\n this.GeotaggingString_ZipCode.replace(whiteSpaceRegex, ''),\n this.GeotaggingString_ZipCodes.replace(whiteSpaceRegex, '')\n ]);\n }\n return result;\n };\n GeoTaggingAnalyzerService.prototype.isLongitude = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Longitude])\n || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Longitude_Short], true /* useStrict */);\n };\n GeoTaggingAnalyzerService.prototype.isLatitude = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Latitude])\n || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Latitude_Short], true /* useStrict */);\n };\n GeoTaggingAnalyzerService.prototype.isTerritory = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n this.GeotaggingString_Territory,\n this.GeotaggingString_Territories\n ]);\n };\n GeoTaggingAnalyzerService.hasMatches = function (fieldName, possibleMatches, useStrict) {\n var nonWordRegex = /\\W/;\n var value = fieldName.toLowerCase();\n for (var i = 0, len = possibleMatches.length; i < len; i++) {\n var possibleMatch = possibleMatches[i].toLowerCase();\n if (!useStrict) {\n if (value.indexOf(possibleMatch) > -1)\n return true;\n }\n else {\n var indexofpossibleMatch = value.indexOf(possibleMatch);\n if (indexofpossibleMatch > -1) {\n var wordEndFlag = void 0, wordBeginFlag = void 0;\n wordEndFlag = wordBeginFlag = true;\n if (indexofpossibleMatch - 1 > 0)\n wordBeginFlag = nonWordRegex.test(value[indexofpossibleMatch - 1]);\n if (indexofpossibleMatch + possibleMatch.length < value.length)\n wordEndFlag = nonWordRegex.test(value[indexofpossibleMatch + possibleMatch.length]);\n if (wordBeginFlag && wordEndFlag)\n return true;\n }\n }\n }\n return false;\n };\n GeoTaggingAnalyzerService.prototype.getFieldType = function (fieldName) {\n if (fieldName == null)\n return undefined;\n if (this.isLatitude(fieldName))\n return powerbi.CategoryTypes.Latitude;\n if (this.isLongitude(fieldName))\n return powerbi.CategoryTypes.Longitude;\n if (this.isPostalCode(fieldName))\n return powerbi.CategoryTypes.PostalCode;\n if (this.isAddress(fieldName))\n return powerbi.CategoryTypes.Address;\n if (this.isPlace(fieldName))\n return powerbi.CategoryTypes.Place;\n if (this.isCity(fieldName))\n return powerbi.CategoryTypes.City;\n if (this.isCountry(fieldName))\n return powerbi.CategoryTypes.CountryRegion;\n if (this.isCounty(fieldName))\n return powerbi.CategoryTypes.County;\n if (this.isStateOrProvince(fieldName))\n return powerbi.CategoryTypes.StateOrProvince;\n if (this.isContinent(fieldName))\n return powerbi.CategoryTypes.Continent;\n return this.getEnglishFieldType(fieldName);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishAddress = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_Address,\n EnglishBackup.GeotaggingString_Addresses,\n EnglishBackup.GeotaggingString_Street,\n EnglishBackup.GeotaggingString_Streets\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishPlace = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_Place,\n EnglishBackup.GeotaggingString_Places\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishCity = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_City,\n EnglishBackup.GeotaggingString_Cities,\n EnglishBackup.GeotaggingString_Town,\n EnglishBackup.GeotaggingString_Towns,\n EnglishBackup.GeotaggingString_Village,\n EnglishBackup.GeotaggingString_Villages\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishStateOrProvince = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_State,\n EnglishBackup.GeotaggingString_States,\n EnglishBackup.GeotaggingString_Province,\n EnglishBackup.GeotaggingString_Provinces,\n EnglishBackup.GeotaggingString_VRMBackCompat_StateOrProvince,\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishCountry = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_Country,\n EnglishBackup.GeotaggingString_Countries,\n EnglishBackup.GeotaggingString_VRMBackCompat_CountryRegion\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishCounty = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_County,\n EnglishBackup.GeotaggingString_Counties\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishContinent = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_Continent,\n EnglishBackup.GeotaggingString_Continents\n ]);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishPostalCode = function (fieldRefName) {\n var result = (GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_Post,\n EnglishBackup.GeotaggingString_Zip])\n && GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Code])) ||\n GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_PostalCode,\n EnglishBackup.GeotaggingString_PostalCodes,\n EnglishBackup.GeotaggingString_ZipCode,\n EnglishBackup.GeotaggingString_ZipCodes\n ]);\n //Check again for strings without whitespace\n if (!result) {\n var whiteSpaceRegexPattern = new RegExp('\\s');\n result = GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_PostalCode.replace(whiteSpaceRegexPattern, ''),\n EnglishBackup.GeotaggingString_PostalCodes.replace(whiteSpaceRegexPattern, ''),\n EnglishBackup.GeotaggingString_ZipCode.replace(whiteSpaceRegexPattern, ''),\n EnglishBackup.GeotaggingString_ZipCodes.replace(whiteSpaceRegexPattern, '')\n ]);\n }\n return result;\n };\n GeoTaggingAnalyzerService.prototype.isEnglishLongitude = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Longitude])\n || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Longitude_Short], true /* useStrict */);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishLatitude = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Latitude])\n || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Latitude_Short], true /* useStrict */);\n };\n GeoTaggingAnalyzerService.prototype.isEnglishTerritory = function (fieldRefName) {\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\n EnglishBackup.GeotaggingString_Territory,\n EnglishBackup.GeotaggingString_Territories\n ]);\n };\n GeoTaggingAnalyzerService.prototype.getEnglishFieldType = function (fieldName) {\n if (fieldName == null)\n return undefined;\n if (this.isEnglishLatitude(fieldName))\n return powerbi.CategoryTypes.Latitude;\n if (this.isEnglishLongitude(fieldName))\n return powerbi.CategoryTypes.Longitude;\n if (this.isEnglishPostalCode(fieldName))\n return powerbi.CategoryTypes.PostalCode;\n if (this.isEnglishAddress(fieldName))\n return powerbi.CategoryTypes.Address;\n if (this.isEnglishPlace(fieldName))\n return powerbi.CategoryTypes.Place;\n if (this.isEnglishCity(fieldName))\n return powerbi.CategoryTypes.City;\n if (this.isEnglishCountry(fieldName))\n return powerbi.CategoryTypes.CountryRegion;\n if (this.isEnglishCounty(fieldName))\n return powerbi.CategoryTypes.County;\n if (this.isEnglishStateOrProvince(fieldName))\n return powerbi.CategoryTypes.StateOrProvince;\n if (this.isEnglishContinent(fieldName))\n return powerbi.CategoryTypes.Continent;\n return undefined;\n };\n return GeoTaggingAnalyzerService;\n }());\n powerbi.GeoTaggingAnalyzerService = GeoTaggingAnalyzerService;\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nif (typeof DEBUG === 'undefined')\n var DEBUG = true;\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n /**\n this base class should be derived to give a generic error message but with a unique error code.\n */\n var UnknownClientError = (function () {\n function UnknownClientError(code) {\n debug.assertValue(code, 'code');\n this.errorCode = code;\n }\n Object.defineProperty(UnknownClientError.prototype, \"code\", {\n get: function () {\n return this.errorCode;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UnknownClientError.prototype, \"ignorable\", {\n get: function () {\n return false;\n },\n enumerable: true,\n configurable: true\n });\n UnknownClientError.prototype.getDetails = function (resourceProvider) {\n var details = {\n message: resourceProvider.get('ClientError_UnknownClientErrorValue'),\n additionalErrorInfo: [{ errorInfoKey: resourceProvider.get('ClientError_UnknownClientErrorKey'), errorInfoValue: resourceProvider.get('ClientError_UnknownClientErrorValue'), }],\n };\n return details;\n };\n return UnknownClientError;\n }());\n powerbi.UnknownClientError = UnknownClientError;\n var HttpClientError = (function () {\n function HttpClientError(httpStatusCode, requestId) {\n debug.assertValue(httpStatusCode, 'httpStatusCode');\n debug.assertValue(requestId, 'requestId');\n this.httpStatusCode = httpStatusCode;\n this.httpRequestId = requestId;\n }\n Object.defineProperty(HttpClientError.prototype, \"code\", {\n get: function () {\n return 'HttpClientError';\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HttpClientError.prototype, \"ignorable\", {\n get: function () {\n return false;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HttpClientError.prototype, \"requestId\", {\n get: function () {\n return this.httpRequestId;\n },\n enumerable: true,\n configurable: true\n });\n HttpClientError.prototype.getDetails = function (resourceProvider) {\n // Use a general error message for a HTTP request failure, since we currently do not know of any specifc error cases at this point in time.\n var details = {\n message: null,\n additionalErrorInfo: [\n { errorInfoKey: resourceProvider.get('DsrError_Key'), errorInfoValue: resourceProvider.get('DsrError_UnknownErrorValue') },\n { errorInfoKey: resourceProvider.get('ClientError_HttpResponseStatusCodeKey'), errorInfoValue: this.httpStatusCode.toString() }],\n };\n return details;\n };\n return HttpClientError;\n }());\n powerbi.HttpClientError = HttpClientError;\n var IgnorableClientError = (function () {\n function IgnorableClientError() {\n }\n Object.defineProperty(IgnorableClientError.prototype, \"code\", {\n get: function () {\n return 'IgnorableClientError';\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(IgnorableClientError.prototype, \"ignorable\", {\n get: function () {\n return true;\n },\n enumerable: true,\n configurable: true\n });\n IgnorableClientError.prototype.getDetails = function (resourceProvider) {\n var details = {\n message: '',\n additionalErrorInfo: [],\n };\n return details;\n };\n return IgnorableClientError;\n }());\n powerbi.IgnorableClientError = IgnorableClientError;\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var ArrayExtensions;\n (function (ArrayExtensions) {\n /**\n * Returns items that exist in target and other.\n */\n function intersect(target, other) {\n var result = [];\n for (var i = target.length - 1; i >= 0; --i) {\n if (other.indexOf(target[i]) !== -1) {\n result.push(target[i]);\n }\n }\n return result;\n }\n ArrayExtensions.intersect = intersect;\n /**\n * Return elements exists in target but not exists in other.\n */\n function diff(target, other) {\n var result = [];\n for (var i = target.length - 1; i >= 0; --i) {\n var value = target[i];\n if (other.indexOf(value) === -1) {\n result.push(value);\n }\n }\n return result;\n }\n ArrayExtensions.diff = diff;\n /**\n * Return an array with only the distinct items in the source.\n */\n function distinct(source) {\n var result = [];\n for (var i = 0, len = source.length; i < len; i++) {\n var value = source[i];\n if (result.indexOf(value) === -1) {\n result.push(value);\n }\n }\n return result;\n }\n ArrayExtensions.distinct = distinct;\n /**\n * Pushes content of source onto target,\n * for parts of course that do not already exist in target.\n */\n function union(target, source) {\n for (var i = 0, len = source.length; i < len; ++i) {\n unionSingle(target, source[i]);\n }\n }\n ArrayExtensions.union = union;\n /**\n * Pushes value onto target, if value does not already exist in target.\n */\n function unionSingle(target, value) {\n if (target.indexOf(value) < 0) {\n target.push(value);\n }\n }\n ArrayExtensions.unionSingle = unionSingle;\n /**\n * Returns an array with a range of items from source,\n * including the startIndex & endIndex.\n */\n function range(source, startIndex, endIndex) {\n debug.assert(startIndex >= 0 && startIndex < source.length, 'startIndex is out of range.');\n debug.assert(endIndex >= 0 && endIndex < source.length, 'endIndex is out of range.');\n var result = [];\n for (var i = startIndex; i <= endIndex; ++i) {\n result.push(source[i]);\n }\n return result;\n }\n ArrayExtensions.range = range;\n /**\n * Returns an array that includes items from source, up to the specified count.\n */\n function take(source, count) {\n debug.assert(count >= 0, 'Count is negative.');\n debug.assert(count <= source.length, 'Count is too large.');\n var result = [];\n for (var i = 0; i < count; ++i) {\n result.push(source[i]);\n }\n return result;\n }\n ArrayExtensions.take = take;\n function copy(source) {\n debug.assertValue(source, 'source');\n return take(source, source.length);\n }\n ArrayExtensions.copy = copy;\n /**\n * Returns a value indicating whether the arrays have the same values in the same sequence.\n */\n function sequenceEqual(left, right, comparison) {\n debug.assertValue(comparison, 'comparison');\n if (left === right) {\n return true;\n }\n if (!!left !== !!right) {\n return false;\n }\n var len = left.length;\n if (len !== right.length) {\n return false;\n }\n var i = 0;\n while (i < len && comparison(left[i], right[i])) {\n ++i;\n }\n return i === len;\n }\n ArrayExtensions.sequenceEqual = sequenceEqual;\n /**\n * Returns null if the specified array is empty.\n * Otherwise returns the specified array.\n */\n function emptyToNull(array) {\n if (array && array.length === 0) {\n return null;\n }\n return array;\n }\n ArrayExtensions.emptyToNull = emptyToNull;\n function indexOf(array, predicate) {\n debug.assertValue(array, 'array');\n debug.assertValue(predicate, 'predicate');\n for (var i = 0, len = array.length; i < len; ++i) {\n if (predicate(array[i])) {\n return i;\n }\n }\n return -1;\n }\n ArrayExtensions.indexOf = indexOf;\n /**\n * Returns a copy of the array rotated by the specified offset.\n */\n function rotate(array, offset) {\n if (offset === 0)\n return array.slice();\n var rotated = array.slice(offset);\n Array.prototype.push.apply(rotated, array.slice(0, offset));\n return rotated;\n }\n ArrayExtensions.rotate = rotate;\n function createWithId() {\n return extendWithId([]);\n }\n ArrayExtensions.createWithId = createWithId;\n function extendWithId(array) {\n debug.assertValue(array, 'array');\n var extended = array;\n extended.withId = withId;\n return extended;\n }\n ArrayExtensions.extendWithId = extendWithId;\n /**\n * Finds and returns the first item with a matching ID.\n */\n function findWithId(array, id) {\n for (var i = 0, len = array.length; i < len; i++) {\n var item = array[i];\n if (item.id === id)\n return item;\n }\n }\n ArrayExtensions.findWithId = findWithId;\n function withId(id) {\n return ArrayExtensions.findWithId(this, id);\n }\n function createWithName() {\n return extendWithName([]);\n }\n ArrayExtensions.createWithName = createWithName;\n function extendWithName(array) {\n debug.assertValue(array, 'array');\n var extended = array;\n extended.withName = withName;\n return extended;\n }\n ArrayExtensions.extendWithName = extendWithName;\n function findItemWithName(array, name) {\n var index = indexWithName(array, name);\n if (index >= 0)\n return array[index];\n }\n ArrayExtensions.findItemWithName = findItemWithName;\n function indexWithName(array, name) {\n for (var i = 0, len = array.length; i < len; i++) {\n var item = array[i];\n if (item.name === name)\n return i;\n }\n return -1;\n }\n ArrayExtensions.indexWithName = indexWithName;\n /**\n * Inserts a number in sorted order into a list of numbers already in sorted order.\n * @returns True if the item was added, false if it already existed.\n */\n function insertSorted(list, value) {\n debug.assertValue(list, 'list');\n debug.assertValue(value, 'value');\n var len = list.length;\n // NOTE: iterate backwards because incoming values tend to be sorted already.\n for (var i = len - 1; i >= 0; i--) {\n var diff_1 = list[i] - value;\n if (diff_1 === 0)\n return false;\n if (diff_1 > 0)\n continue;\n // diff < 0\n list.splice(i + 1, 0, value);\n return true;\n }\n list.unshift(value);\n return true;\n }\n ArrayExtensions.insertSorted = insertSorted;\n /**\n * Removes the first occurrence of a value from a list if it exists.\n * @returns True if the value was removed, false if it did not exist in the list.\n */\n function removeFirst(list, value) {\n var index = list.indexOf(value);\n if (index < 0)\n return false;\n list.splice(index, 1);\n return true;\n }\n ArrayExtensions.removeFirst = removeFirst;\n /**\n * Finds and returns the first item with a matching name.\n */\n function withName(name) {\n var array = this;\n return findItemWithName(array, name);\n }\n /**\n * Deletes all items from the array.\n */\n function clear(array) {\n if (!array)\n return;\n while (array.length > 0)\n array.pop();\n }\n ArrayExtensions.clear = clear;\n function isUndefinedOrEmpty(array) {\n if (!array || array.length === 0) {\n return true;\n }\n return false;\n }\n ArrayExtensions.isUndefinedOrEmpty = isUndefinedOrEmpty;\n function swap(array, firstIndex, secondIndex) {\n var temp = array[firstIndex];\n array[firstIndex] = array[secondIndex];\n array[secondIndex] = temp;\n }\n ArrayExtensions.swap = swap;\n function isInArray(array, lookupItem, compareCallback) {\n return _.any(array, function (item) { return compareCallback(item, lookupItem); });\n }\n ArrayExtensions.isInArray = isInArray;\n /** Checks if the given object is an Array, and looking all the way up the prototype chain. */\n function isArrayOrInheritedArray(obj) {\n debug.assertValue(obj, 'obj');\n var nextPrototype = obj;\n while (nextPrototype != null) {\n if (_.isArray(nextPrototype))\n return true;\n nextPrototype = Object.getPrototypeOf(nextPrototype);\n }\n return false;\n }\n ArrayExtensions.isArrayOrInheritedArray = isArrayOrInheritedArray;\n })(ArrayExtensions = jsCommon.ArrayExtensions || (jsCommon.ArrayExtensions = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar InJs;\n(function (InJs) {\n var DomFactory;\n (function (DomFactory) {\n function div() {\n return $('<div/>');\n }\n DomFactory.div = div;\n function span() {\n return $('<span/>');\n }\n DomFactory.span = span;\n function checkbox() {\n return $('<input type=\"checkbox\"/>');\n }\n DomFactory.checkbox = checkbox;\n function ul() {\n return $('<ul/>');\n }\n DomFactory.ul = ul;\n function li() {\n return $('<li/>');\n }\n DomFactory.li = li;\n function button() {\n return $('<input type=\"button\"/>');\n }\n DomFactory.button = button;\n function select() {\n return $('<select/>');\n }\n DomFactory.select = select;\n function textBox() {\n return $('<input type=\"text\"/>');\n }\n DomFactory.textBox = textBox;\n function img() {\n return $('<img/>');\n }\n DomFactory.img = img;\n function iframe() {\n return $('<iframe/>');\n }\n DomFactory.iframe = iframe;\n })(DomFactory = InJs.DomFactory || (InJs.DomFactory = {}));\n})(InJs || (InJs = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n /**\n * Module Double contains a set of constants and precision based utility methods\n * for dealing with doubles and their decimal garbage in the javascript.\n */\n var Double;\n (function (Double) {\n // Constants.\n Double.MIN_VALUE = -Number.MAX_VALUE;\n Double.MAX_VALUE = Number.MAX_VALUE;\n Double.MIN_EXP = -308;\n Double.MAX_EXP = 308;\n Double.EPSILON = 1E-323;\n Double.DEFAULT_PRECISION = 0.0001;\n Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS = 12;\n Double.LOG_E_10 = Math.log(10);\n Double.POSITIVE_POWERS = [\n 1E0, 1E1, 1E2, 1E3, 1E4, 1E5, 1E6, 1E7, 1E8, 1E9, 1E10, 1E11, 1E12, 1E13, 1E14, 1E15, 1E16, 1E17, 1E18, 1E19, 1E20, 1E21, 1E22, 1E23, 1E24, 1E25, 1E26, 1E27, 1E28, 1E29, 1E30, 1E31, 1E32, 1E33, 1E34, 1E35, 1E36, 1E37, 1E38, 1E39, 1E40, 1E41, 1E42, 1E43, 1E44, 1E45, 1E46, 1E47, 1E48, 1E49, 1E50, 1E51, 1E52, 1E53, 1E54, 1E55, 1E56, 1E57, 1E58, 1E59, 1E60, 1E61, 1E62, 1E63, 1E64, 1E65, 1E66, 1E67, 1E68, 1E69, 1E70, 1E71, 1E72, 1E73, 1E74, 1E75, 1E76, 1E77, 1E78, 1E79, 1E80, 1E81, 1E82, 1E83, 1E84, 1E85, 1E86, 1E87, 1E88, 1E89, 1E90, 1E91, 1E92, 1E93, 1E94, 1E95, 1E96, 1E97, 1E98, 1E99,\n 1E100, 1E101, 1E102, 1E103, 1E104, 1E105, 1E106, 1E107, 1E108, 1E109, 1E110, 1E111, 1E112, 1E113, 1E114, 1E115, 1E116, 1E117, 1E118, 1E119, 1E120, 1E121, 1E122, 1E123, 1E124, 1E125, 1E126, 1E127, 1E128, 1E129, 1E130, 1E131, 1E132, 1E133, 1E134, 1E135, 1E136, 1E137, 1E138, 1E139, 1E140, 1E141, 1E142, 1E143, 1E144, 1E145, 1E146, 1E147, 1E148, 1E149, 1E150, 1E151, 1E152, 1E153, 1E154, 1E155, 1E156, 1E157, 1E158, 1E159, 1E160, 1E161, 1E162, 1E163, 1E164, 1E165, 1E166, 1E167, 1E168, 1E169, 1E170, 1E171, 1E172, 1E173, 1E174, 1E175, 1E176, 1E177, 1E178, 1E179, 1E180, 1E181, 1E182, 1E183, 1E184, 1E185, 1E186, 1E187, 1E188, 1E189, 1E190, 1E191, 1E192, 1E193, 1E194, 1E195, 1E196, 1E197, 1E198, 1E199,\n 1E200, 1E201, 1E202, 1E203, 1E204, 1E205, 1E206, 1E207, 1E208, 1E209, 1E210, 1E211, 1E212, 1E213, 1E214, 1E215, 1E216, 1E217, 1E218, 1E219, 1E220, 1E221, 1E222, 1E223, 1E224, 1E225, 1E226, 1E227, 1E228, 1E229, 1E230, 1E231, 1E232, 1E233, 1E234, 1E235, 1E236, 1E237, 1E238, 1E239, 1E240, 1E241, 1E242, 1E243, 1E244, 1E245, 1E246, 1E247, 1E248, 1E249, 1E250, 1E251, 1E252, 1E253, 1E254, 1E255, 1E256, 1E257, 1E258, 1E259, 1E260, 1E261, 1E262, 1E263, 1E264, 1E265, 1E266, 1E267, 1E268, 1E269, 1E270, 1E271, 1E272, 1E273, 1E274, 1E275, 1E276, 1E277, 1E278, 1E279, 1E280, 1E281, 1E282, 1E283, 1E284, 1E285, 1E286, 1E287, 1E288, 1E289, 1E290, 1E291, 1E292, 1E293, 1E294, 1E295, 1E296, 1E297, 1E298, 1E299,\n 1E300, 1E301, 1E302, 1E303, 1E304, 1E305, 1E306, 1E307, 1E308];\n Double.NEGATIVE_POWERS = [\n 1E0, 1E-1, 1E-2, 1E-3, 1E-4, 1E-5, 1E-6, 1E-7, 1E-8, 1E-9, 1E-10, 1E-11, 1E-12, 1E-13, 1E-14, 1E-15, 1E-16, 1E-17, 1E-18, 1E-19, 1E-20, 1E-21, 1E-22, 1E-23, 1E-24, 1E-25, 1E-26, 1E-27, 1E-28, 1E-29, 1E-30, 1E-31, 1E-32, 1E-33, 1E-34, 1E-35, 1E-36, 1E-37, 1E-38, 1E-39, 1E-40, 1E-41, 1E-42, 1E-43, 1E-44, 1E-45, 1E-46, 1E-47, 1E-48, 1E-49, 1E-50, 1E-51, 1E-52, 1E-53, 1E-54, 1E-55, 1E-56, 1E-57, 1E-58, 1E-59, 1E-60, 1E-61, 1E-62, 1E-63, 1E-64, 1E-65, 1E-66, 1E-67, 1E-68, 1E-69, 1E-70, 1E-71, 1E-72, 1E-73, 1E-74, 1E-75, 1E-76, 1E-77, 1E-78, 1E-79, 1E-80, 1E-81, 1E-82, 1E-83, 1E-84, 1E-85, 1E-86, 1E-87, 1E-88, 1E-89, 1E-90, 1E-91, 1E-92, 1E-93, 1E-94, 1E-95, 1E-96, 1E-97, 1E-98, 1E-99,\n 1E-100, 1E-101, 1E-102, 1E-103, 1E-104, 1E-105, 1E-106, 1E-107, 1E-108, 1E-109, 1E-110, 1E-111, 1E-112, 1E-113, 1E-114, 1E-115, 1E-116, 1E-117, 1E-118, 1E-119, 1E-120, 1E-121, 1E-122, 1E-123, 1E-124, 1E-125, 1E-126, 1E-127, 1E-128, 1E-129, 1E-130, 1E-131, 1E-132, 1E-133, 1E-134, 1E-135, 1E-136, 1E-137, 1E-138, 1E-139, 1E-140, 1E-141, 1E-142, 1E-143, 1E-144, 1E-145, 1E-146, 1E-147, 1E-148, 1E-149, 1E-150, 1E-151, 1E-152, 1E-153, 1E-154, 1E-155, 1E-156, 1E-157, 1E-158, 1E-159, 1E-160, 1E-161, 1E-162, 1E-163, 1E-164, 1E-165, 1E-166, 1E-167, 1E-168, 1E-169, 1E-170, 1E-171, 1E-172, 1E-173, 1E-174, 1E-175, 1E-176, 1E-177, 1E-178, 1E-179, 1E-180, 1E-181, 1E-182, 1E-183, 1E-184, 1E-185, 1E-186, 1E-187, 1E-188, 1E-189, 1E-190, 1E-191, 1E-192, 1E-193, 1E-194, 1E-195, 1E-196, 1E-197, 1E-198, 1E-199,\n 1E-200, 1E-201, 1E-202, 1E-203, 1E-204, 1E-205, 1E-206, 1E-207, 1E-208, 1E-209, 1E-210, 1E-211, 1E-212, 1E-213, 1E-214, 1E-215, 1E-216, 1E-217, 1E-218, 1E-219, 1E-220, 1E-221, 1E-222, 1E-223, 1E-224, 1E-225, 1E-226, 1E-227, 1E-228, 1E-229, 1E-230, 1E-231, 1E-232, 1E-233, 1E-234, 1E-235, 1E-236, 1E-237, 1E-238, 1E-239, 1E-240, 1E-241, 1E-242, 1E-243, 1E-244, 1E-245, 1E-246, 1E-247, 1E-248, 1E-249, 1E-250, 1E-251, 1E-252, 1E-253, 1E-254, 1E-255, 1E-256, 1E-257, 1E-258, 1E-259, 1E-260, 1E-261, 1E-262, 1E-263, 1E-264, 1E-265, 1E-266, 1E-267, 1E-268, 1E-269, 1E-270, 1E-271, 1E-272, 1E-273, 1E-274, 1E-275, 1E-276, 1E-277, 1E-278, 1E-279, 1E-280, 1E-281, 1E-282, 1E-283, 1E-284, 1E-285, 1E-286, 1E-287, 1E-288, 1E-289, 1E-290, 1E-291, 1E-292, 1E-293, 1E-294, 1E-295, 1E-296, 1E-297, 1E-298, 1E-299,\n 1E-300, 1E-301, 1E-302, 1E-303, 1E-304, 1E-305, 1E-306, 1E-307, 1E-308, 1E-309, 1E-310, 1E-311, 1E-312, 1E-313, 1E-314, 1E-315, 1E-316, 1E-317, 1E-318, 1E-319, 1E-320, 1E-321, 1E-322, 1E-323, 1E-324];\n /**\n * Returns powers of 10.\n * Unlike the Math.pow this function produces no decimal garbage.\n * @param exp Exponent.\n */\n function pow10(exp) {\n debug.assertValue(exp, \"exp\");\n // Positive & zero\n if (exp >= 0) {\n if (exp < Double.POSITIVE_POWERS.length) {\n return Double.POSITIVE_POWERS[exp];\n }\n else {\n return Infinity;\n }\n }\n // Negative\n exp = -exp;\n if (exp > 0 && exp < Double.NEGATIVE_POWERS.length) {\n return Double.NEGATIVE_POWERS[exp];\n }\n else {\n return 0;\n }\n }\n Double.pow10 = pow10;\n /**\n * Returns the 10 base logarithm of the number.\n * Unlike Math.log function this produces integer results with no decimal garbage.\n * @param val Positive value or zero.\n */\n function log10(val) {\n debug.assert(val >= 0, \"val\");\n // Fast Log10() algorithm \n if (val > 1 && val < 1E16) {\n if (val < 1E8) {\n if (val < 1E4) {\n if (val < 1E2) {\n if (val < 1E1) {\n return 0;\n }\n else {\n return 1;\n }\n }\n else {\n if (val < 1E3) {\n return 2;\n }\n else {\n return 3;\n }\n }\n }\n else {\n if (val < 1E6) {\n if (val < 1E5) {\n return 4;\n }\n else {\n return 5;\n }\n }\n else {\n if (val < 1E7) {\n return 6;\n }\n else {\n return 7;\n }\n }\n }\n }\n else {\n if (val < 1E12) {\n if (val < 1E10) {\n if (val < 1E9) {\n return 8;\n }\n else {\n return 9;\n }\n }\n else {\n if (val < 1E11) {\n return 10;\n }\n else {\n return 11;\n }\n }\n }\n else {\n if (val < 1E14) {\n if (val < 1E13) {\n return 12;\n }\n else {\n return 13;\n }\n }\n else {\n if (val < 1E15) {\n return 14;\n }\n else {\n return 15;\n }\n }\n }\n }\n }\n if (val > 1E-16 && val < 1) {\n if (val < 1E-8) {\n if (val < 1E-12) {\n if (val < 1E-14) {\n if (val < 1E-15) {\n return -16;\n }\n else {\n return -15;\n }\n }\n else {\n if (val < 1E-13) {\n return -14;\n }\n else {\n return -13;\n }\n }\n }\n else {\n if (val < 1E-10) {\n if (val < 1E-11) {\n return -12;\n }\n else {\n return -11;\n }\n }\n else {\n if (val < 1E-9) {\n return -10;\n }\n else {\n return -9;\n }\n }\n }\n }\n else {\n if (val < 1E-4) {\n if (val < 1E-6) {\n if (val < 1E-7) {\n return -8;\n }\n else {\n return -7;\n }\n }\n else {\n if (val < 1E-5) {\n return -6;\n }\n else {\n return -5;\n }\n }\n }\n else {\n if (val < 1E-2) {\n if (val < 1E-3) {\n return -4;\n }\n else {\n return -3;\n }\n }\n else {\n if (val < 1E-1) {\n return -2;\n }\n else {\n return -1;\n }\n }\n }\n }\n }\n // JS Math provides only natural log function so we need to calc the 10 base logarithm:\n // logb(x) = logk(x)/logk(b); \n var log10 = Math.log(val) / Double.LOG_E_10;\n return Double.floorWithPrecision(log10);\n }\n Double.log10 = log10;\n /**\n * Returns a power of 10 representing precision of the number based on the number of meaningful decimal digits.\n * For example the precision of 56,263.3767 with the 6 meaningful decimal digit is 0.1.\n * @param x Value.\n * @param decimalDigits How many decimal digits are meaningfull.\n */\n function getPrecision(x, decimalDigits) {\n if (decimalDigits === undefined) {\n decimalDigits = Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS;\n }\n else {\n debug.assert(decimalDigits >= 0, \"decimalDigits\");\n }\n if (!x) {\n return undefined;\n }\n var exp = Double.log10(Math.abs(x));\n if (exp < Double.MIN_EXP) {\n return 0;\n }\n var precisionExp = Math.max(exp - decimalDigits, -Double.NEGATIVE_POWERS.length + 1);\n return Double.pow10(precisionExp);\n }\n Double.getPrecision = getPrecision;\n /**\n * Checks if a delta between 2 numbers is less than provided precision.\n * @param x One value.\n * @param y Another value.\n * @param precision Precision value.\n */\n function equalWithPrecision(x, y, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n return x === y || Math.abs(x - y) < precision;\n }\n Double.equalWithPrecision = equalWithPrecision;\n /**\n * Checks if a first value is less than another taking\n * into account the loose precision based equality.\n * @param x One value.\n * @param y Another value.\n * @param precision Precision value.\n */\n function lessWithPrecision(x, y, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n return x < y && Math.abs(x - y) > precision;\n }\n Double.lessWithPrecision = lessWithPrecision;\n /**\n * Checks if a first value is less or equal than another taking\n * into account the loose precision based equality.\n * @param x One value.\n * @param y Another value.\n * @param precision Precision value.\n */\n function lessOrEqualWithPrecision(x, y, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n return x < y || Math.abs(x - y) < precision;\n }\n Double.lessOrEqualWithPrecision = lessOrEqualWithPrecision;\n /**\n * Checks if a first value is greater than another taking\n * into account the loose precision based equality.\n * @param x One value.\n * @param y Another value.\n * @param precision Precision value.\n */\n function greaterWithPrecision(x, y, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n return x > y && Math.abs(x - y) > precision;\n }\n Double.greaterWithPrecision = greaterWithPrecision;\n /**\n * Checks if a first value is greater or equal to another taking\n * into account the loose precision based equality.\n * @param x One value.\n * @param y Another value.\n * @param precision Precision value.\n */\n function greaterOrEqualWithPrecision(x, y, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n return x > y || Math.abs(x - y) < precision;\n }\n Double.greaterOrEqualWithPrecision = greaterOrEqualWithPrecision;\n /**\n * Floors the number unless it's withing the precision distance from the higher int.\n * @param x One value.\n * @param precision Precision value.\n */\n function floorWithPrecision(x, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n var roundX = Math.round(x);\n if (Math.abs(x - roundX) < precision) {\n return roundX;\n }\n else {\n return Math.floor(x);\n }\n }\n Double.floorWithPrecision = floorWithPrecision;\n /**\n * Ceils the number unless it's withing the precision distance from the lower int.\n * @param x One value.\n * @param precision Precision value.\n */\n function ceilWithPrecision(x, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n var roundX = Math.round(x);\n if (Math.abs(x - roundX) < precision) {\n return roundX;\n }\n else {\n return Math.ceil(x);\n }\n }\n Double.ceilWithPrecision = ceilWithPrecision;\n /**\n * Floors the number to the provided precision.\n * For example 234,578 floored to 1,000 precision is 234,000.\n * @param x One value.\n * @param precision Precision value.\n */\n function floorToPrecision(x, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n if (precision === 0 || x === 0) {\n return x;\n }\n //Precision must be a Power of 10\n return Math.floor(x / precision) * precision;\n }\n Double.floorToPrecision = floorToPrecision;\n /**\n * Ceils the number to the provided precision.\n * For example 234,578 floored to 1,000 precision is 235,000.\n * @param x One value.\n * @param precision Precision value.\n */\n function ceilToPrecision(x, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n if (precision === 0 || x === 0) {\n return x;\n }\n //Precision must be a Power of 10\n return Math.ceil(x / precision) * precision;\n }\n Double.ceilToPrecision = ceilToPrecision;\n /**\n * Rounds the number to the provided precision.\n * For example 234,578 floored to 1,000 precision is 235,000.\n * @param x One value.\n * @param precision Precision value.\n */\n function roundToPrecision(x, precision) {\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\n debug.assert(precision >= 0, \"precision\");\n if (precision === 0 || x === 0) {\n return x;\n }\n //Precision must be a Power of 10\n var result = Math.round(x / precision) * precision;\n var decimalDigits = Math.round(Double.log10(Math.abs(x)) - Double.log10(precision)) + 1;\n if (decimalDigits > 0 && decimalDigits < 16) {\n result = parseFloat(result.toPrecision(decimalDigits));\n }\n return result;\n }\n Double.roundToPrecision = roundToPrecision;\n /**\n * Returns the value making sure that it's restricted to the provided range.\n * @param x One value.\n * @param min Range min boundary.\n * @param max Range max boundary.\n */\n function ensureInRange(x, min, max) {\n debug.assert(min <= max, \"min must be less or equal to max\");\n if (x === undefined || x === null) {\n return x;\n }\n if (x < min) {\n return min;\n }\n if (x > max) {\n return max;\n }\n return x;\n }\n Double.ensureInRange = ensureInRange;\n /**\n * Rounds the value - this method is actually faster than Math.round - used in the graphics utils.\n * @param x Value to round.\n */\n function round(x) {\n debug.assert(x >= 0, \"x must be greater or equal to 0\");\n return (0.5 + x) << 0;\n }\n Double.round = round;\n /**\n * Projects the value from the source range into the target range.\n * @param value Value to project.\n * @param fromMin Minimum of the source range.\n * @param toMin Minimum of the target range.\n * @param toMax Maximum of the target range.\n */\n function project(value, fromMin, fromSize, toMin, toSize) {\n if (fromSize === 0 || toSize === 0) {\n if (fromMin <= value && value <= fromMin + fromSize) {\n return toMin;\n }\n else {\n return NaN;\n }\n }\n var relativeX = (value - fromMin) / fromSize;\n var projectedX = toMin + relativeX * toSize;\n return projectedX;\n }\n Double.project = project;\n /**\n * Removes decimal noise.\n * @param value Value to be processed.\n */\n function removeDecimalNoise(value) {\n return roundToPrecision(value, getPrecision(value));\n }\n Double.removeDecimalNoise = removeDecimalNoise;\n /**\n * Checks whether the number is integer.\n * @param value Value to be checked.\n */\n function isInteger(value) {\n return value !== null && value % 1 === 0;\n }\n Double.isInteger = isInteger;\n /**\n * Dividing by increment will give us count of increments\n * Round out the rough edges into even integer\n * Multiply back by increment to get rounded value\n * e.g. Rounder.toIncrement(0.647291, 0.05) => 0.65\n * @param value - value to round to nearest increment\n * @param increment - smallest increment to round toward\n */\n function toIncrement(value, increment) {\n return Math.round(value / increment) * increment;\n }\n Double.toIncrement = toIncrement;\n })(Double = powerbi.Double || (powerbi.Double = {}));\n function applyDefault(value, defaultValue) {\n return value !== undefined ? value : defaultValue;\n }\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var Double = powerbi.Double;\n var Color;\n (function (Color) {\n function rotate(rgbString, rotateFactor) {\n if (rotateFactor === 0)\n return rgbString;\n var originalRgb = parseColorString(rgbString);\n var originalHsv = rgbToHsv(originalRgb);\n var rotatedHsv = rotateHsv(originalHsv, rotateFactor);\n var rotatedRgb = hsvToRgb(rotatedHsv);\n return hexString(rotatedRgb);\n }\n Color.rotate = rotate;\n function normalizeToHexString(color) {\n var rgb = parseColorString(color);\n return hexString(rgb);\n }\n Color.normalizeToHexString = normalizeToHexString;\n function parseColorString(color) {\n debug.assertValue(color, 'color');\n if (color.indexOf('#') >= 0) {\n if (color.length === 7) {\n // #RRGGBB\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(color);\n if (result == null || result.length < 4)\n return;\n return {\n R: parseInt(result[1], 16),\n G: parseInt(result[2], 16),\n B: parseInt(result[3], 16),\n };\n }\n else if (color.length === 4) {\n // #RGB\n var result = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i.exec(color);\n if (result == null || result.length < 4)\n return;\n return {\n R: parseInt(result[1] + result[1], 16),\n G: parseInt(result[2] + result[2], 16),\n B: parseInt(result[3] + result[3], 16),\n };\n }\n }\n else if (color.indexOf('rgb(') >= 0) {\n // rgb(R, G, B)\n var result = /^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/.exec(color);\n if (result == null || result.length < 4)\n return;\n return {\n R: parseInt(result[1], 10),\n G: parseInt(result[2], 10),\n B: parseInt(result[3], 10),\n };\n }\n else if (color.indexOf('rgba(') >= 0) {\n // rgba(R, G, B, A)\n var result = /^rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*(\\d*(?:\\.\\d+)?)\\)$/.exec(color);\n if (result == null || result.length < 5)\n return;\n return {\n R: parseInt(result[1], 10),\n G: parseInt(result[2], 10),\n B: parseInt(result[3], 10),\n A: parseFloat(result[4]),\n };\n }\n }\n Color.parseColorString = parseColorString;\n function rgbToHsv(rgbColor) {\n var s, h;\n var r = rgbColor.R / 255, g = rgbColor.G / 255, b = rgbColor.B / 255;\n var min = Math.min(r, Math.min(g, b));\n var max = Math.max(r, Math.max(g, b));\n var v = max;\n var delta = max - min;\n if (max === 0 || delta === 0) {\n // R, G, and B must be 0.0, or all the same.\n // In this case, S is 0.0, and H is undefined.\n // Using H = 0.0 is as good as any...\n s = 0;\n h = 0;\n }\n else {\n s = delta / max;\n if (r === max) {\n // Between Yellow and Magenta\n h = (g - b) / delta;\n }\n else if (g === max) {\n // Between Cyan and Yellow\n h = 2 + (b - r) / delta;\n }\n else {\n // Between Magenta and Cyan\n h = 4 + (r - g) / delta;\n }\n }\n // Scale h to be between 0.0 and 1.\n // This may require adding 1, if the value\n // is negative.\n h /= 6;\n if (h < 0) {\n h += 1;\n }\n return {\n H: h,\n S: s,\n V: v,\n };\n }\n function hsvToRgb(hsvColor) {\n var r, g, b;\n var h = hsvColor.H, s = hsvColor.S, v = hsvColor.V;\n if (s === 0) {\n // If s is 0, all colors are the same.\n // This is some flavor of gray.\n r = v;\n g = v;\n b = v;\n }\n else {\n var p = void 0, q = void 0, t = void 0, fractionalSector = void 0, sectorNumber = void 0, sectorPos = void 0;\n // The color wheel consists of 6 sectors.\n // Figure out which sector you//re in.\n sectorPos = h * 6;\n sectorNumber = Math.floor(sectorPos);\n // get the fractional part of the sector.\n // That is, how many degrees into the sector\n // are you?\n fractionalSector = sectorPos - sectorNumber;\n // Calculate values for the three axes\n // of the color.\n p = v * (1.0 - s);\n q = v * (1.0 - (s * fractionalSector));\n t = v * (1.0 - (s * (1 - fractionalSector)));\n // Assign the fractional colors to r, g, and b\n // based on the sector the angle is in.\n switch (sectorNumber) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n case 5:\n r = v;\n g = p;\n b = q;\n break;\n }\n }\n return {\n R: Math.floor(r * 255),\n G: Math.floor(g * 255),\n B: Math.floor(b * 255),\n };\n }\n function rotateHsv(hsvColor, rotateFactor) {\n var newH = hsvColor.H + rotateFactor;\n return {\n H: newH > 1 ? newH - 1 : newH,\n S: hsvColor.S,\n V: hsvColor.V,\n };\n }\n function darken(color, diff) {\n var flooredNumber = Math.floor(diff);\n return {\n R: Math.max(0, color.R - flooredNumber),\n G: Math.max(0, color.G - flooredNumber),\n B: Math.max(0, color.B - flooredNumber),\n };\n }\n Color.darken = darken;\n function rgbString(color) {\n if (color.A == null)\n return \"rgb(\" + color.R + \",\" + color.G + \",\" + color.B + \")\";\n return \"rgba(\" + color.R + \",\" + color.G + \",\" + color.B + \",\" + color.A + \")\";\n }\n Color.rgbString = rgbString;\n function hexString(color) {\n return \"#\" + componentToHex(color.R) + componentToHex(color.G) + componentToHex(color.B);\n }\n Color.hexString = hexString;\n function componentToHex(hexComponent) {\n var clamped = Double.ensureInRange(hexComponent, 0, 255);\n var hex = clamped.toString(16).toUpperCase();\n return hex.length === 1 ? \"0\" + hex : hex;\n }\n })(Color = jsCommon.Color || (jsCommon.Color = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * CSS constants.\n */\n var CssConstants;\n (function (CssConstants) {\n function createClassAndSelector(className) {\n return {\n class: className,\n selector: '.' + className,\n };\n }\n CssConstants.createClassAndSelector = createClassAndSelector;\n CssConstants.styleAttribute = 'style';\n CssConstants.pixelUnits = 'px';\n CssConstants.heightProperty = 'height';\n CssConstants.widthProperty = 'width';\n CssConstants.topProperty = 'top';\n CssConstants.bottomProperty = 'bottom';\n CssConstants.leftProperty = 'left';\n CssConstants.rightProperty = 'right';\n CssConstants.marginTopProperty = 'margin-top';\n CssConstants.marginLeftProperty = 'margin-left';\n CssConstants.displayProperty = 'display';\n CssConstants.backgroundProperty = 'background';\n CssConstants.backgroundColorProperty = 'background-color';\n CssConstants.backgroundRepeatProperty = 'background-repeat';\n CssConstants.backgroundSizeProperty = 'background-size';\n CssConstants.backgroundImageProperty = 'background-image';\n CssConstants.textShadowProperty = 'text-shadow';\n CssConstants.textAlignProperty = 'text-align';\n CssConstants.borderTopWidthProperty = 'border-top-width';\n CssConstants.borderBottomWidthProperty = 'border-bottom-width';\n CssConstants.borderLeftWidthProperty = 'border-left-width';\n CssConstants.borderRightWidthProperty = 'border-right-width';\n CssConstants.fontSizeProperty = 'font-size';\n CssConstants.fontWeightProperty = 'font-weight';\n CssConstants.colorProperty = 'color';\n CssConstants.opacityProperty = 'opacity';\n CssConstants.paddingLeftProperty = 'padding-left';\n CssConstants.paddingRightProperty = 'padding-right';\n CssConstants.positionProperty = 'position';\n CssConstants.maxWidthProperty = 'max-width';\n CssConstants.minWidthProperty = 'min-width';\n CssConstants.overflowProperty = 'overflow';\n CssConstants.overflowXProperty = 'overflow-x';\n CssConstants.overflowYProperty = 'overflow-y';\n CssConstants.transformProperty = 'transform';\n CssConstants.webkitTransformProperty = '-webkit-transform';\n CssConstants.cursorProperty = 'cursor';\n CssConstants.visibilityProperty = 'visibility';\n CssConstants.absoluteValue = 'absolute';\n CssConstants.zeroPixelValue = '0px';\n CssConstants.autoValue = 'auto';\n CssConstants.hiddenValue = 'hidden';\n CssConstants.noneValue = 'none';\n CssConstants.blockValue = 'block';\n CssConstants.inlineBlockValue = 'inline-block';\n CssConstants.transparentValue = 'transparent';\n CssConstants.boldValue = 'bold';\n CssConstants.visibleValue = 'visible';\n CssConstants.tableRowValue = 'table-row';\n CssConstants.coverValue = 'cover';\n CssConstants.pointerValue = 'pointer';\n CssConstants.scrollValue = 'scroll';\n })(CssConstants = jsCommon.CssConstants || (jsCommon.CssConstants = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * Defines a Debug object. Calls to any functions in this object removed by the minifier.\n * The functions within this class are not minified away, so we use the preprocessor-style\n * comments to have the minifier remove those as well.\n */\n///#DEBUG\nvar debug;\n(function (debug) {\n /**\n * Asserts that the condition is true, fails otherwise.\n */\n function assert(condition, message) {\n if (condition !== true) {\n assertFail(message || ('condition: ' + condition));\n }\n }\n debug.assert = assert;\n /**\n * Asserts that the value is neither null nor undefined, fails otherwise.\n */\n function assertValue(value, message) {\n if (value === null || value === undefined) {\n assertFail(message || ('condition: ' + value));\n }\n }\n debug.assertValue = assertValue;\n /**\n * Asserts that the value is neither null nor undefined, and has a length property that returns greater than zero, fails otherwise.\n */\n function assertNonEmpty(value, message) {\n if (!(value != null && value.length > 0)) {\n assertFail(message || ('condition: ' + value));\n }\n }\n debug.assertNonEmpty = assertNonEmpty;\n /**\n * Makes no assertion on the given value.\n * This is documentation/placeholder that a value is possibly null or undefined (unlike assertValue).\n */\n function assertAnyValue(value, message) {\n }\n debug.assertAnyValue = assertAnyValue;\n function assertFail(message) {\n (debug.assertFailFunction || alert)('Debug Assert failed: ' + message);\n }\n debug.assertFail = assertFail;\n})(debug || (debug = {}));\n///#ENDDEBUG \n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var Errors;\n (function (Errors) {\n function infoNavAppAlreadyPresent() {\n return {\n name: 'infoNavAppAlreadyPresent',\n message: 'Cannot initialize embedded scenario when the InfoNav App is already present in this context',\n stack: getExceptionStackTrace()\n };\n }\n Errors.infoNavAppAlreadyPresent = infoNavAppAlreadyPresent;\n function invalidOperation(message) {\n return {\n name: 'invalidOperation',\n message: message,\n stack: getExceptionStackTrace()\n };\n }\n Errors.invalidOperation = invalidOperation;\n function argument(argumentName, message) {\n return {\n name: 'invalidArgumentError',\n argument: argumentName,\n message: message,\n stack: getExceptionStackTrace()\n };\n }\n Errors.argument = argument;\n function argumentNull(argumentName) {\n return {\n name: 'argumentNull',\n argument: argumentName,\n message: 'Argument was null',\n stack: getExceptionStackTrace()\n };\n }\n Errors.argumentNull = argumentNull;\n function argumentUndefined(argumentName) {\n return {\n name: 'argumentUndefined',\n argument: argumentName,\n message: 'Argument was undefined',\n stack: getExceptionStackTrace()\n };\n }\n Errors.argumentUndefined = argumentUndefined;\n function argumentOutOfRange(argumentName) {\n return {\n name: 'argumentOutOfRange',\n argument: argumentName,\n message: 'Argument was out of range',\n stack: getExceptionStackTrace()\n };\n }\n Errors.argumentOutOfRange = argumentOutOfRange;\n function pureVirtualMethodException(className, methodName) {\n return {\n name: 'pureVirtualMethodException',\n message: 'This method must be overriden by the derived class:' + className + '.' + methodName,\n stack: getExceptionStackTrace()\n };\n }\n Errors.pureVirtualMethodException = pureVirtualMethodException;\n function notImplementedException(message) {\n return {\n name: 'notImplementedException',\n message: message,\n stack: getExceptionStackTrace()\n };\n }\n Errors.notImplementedException = notImplementedException;\n function getExceptionStackTrace() {\n return getStackTrace(/*leadingFramesToRemove*/ 2);\n }\n })(Errors = jsCommon.Errors || (jsCommon.Errors = {}));\n /**\n * Captures the stack trace, if available.\n * It optionally takes the number of frames to remove from the stack trace.\n * By default, it removes the last frame to consider the calling type's\n * constructor and the temporary error used to capture the stack trace (below).\n * More levels can be requested as needed e..g. when an error is created\n * from a helper method. <Min requirement: IE10, Chrome, Firefox, Opera>.\n */\n function getStackTrace(leadingFramesToRemove) {\n if (leadingFramesToRemove === void 0) { leadingFramesToRemove = 1; }\n var stackTrace, stackSegments;\n try {\n // needs to throw for stack trace to work in IE\n throw new Error();\n }\n catch (error) {\n stackTrace = error.stack;\n if (stackTrace != null) {\n stackSegments = stackTrace.split('\\n');\n stackSegments.splice(1, leadingFramesToRemove);\n // Finally\n stackTrace = stackSegments.join('\\n');\n }\n }\n return stackTrace;\n }\n jsCommon.getStackTrace = getStackTrace;\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n$.fn.multiline = function (text) {\n this.text(text);\n this.html(this.html().replace(/\\n/g, '<br/>'));\n return this;\n};\n$.fn.togglePanelControl = function () {\n return this.each(function () {\n $(this).addClass(\"ui-accordion ui-accordion-icons ui-widget ui-helper-reset\")\n .find(\".accordionHeader\")\n .addClass(\"ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom\")\n .hover(function () {\n $(this).toggleClass(\"ui-state-hover\");\n })\n .prepend('<span class=\"ui-icon ui-icon-triangle-1-e\"></span>')\n .click(function () {\n $(this)\n .toggleClass(\"ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom\")\n .find(\"> .ui-icon\").toggleClass(\"ui-icon-triangle-1-e ui-icon-triangle-1-s\").end()\n .next().slideToggle();\n return false;\n })\n .next()\n .addClass(\"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom\")\n .hide();\n });\n};\nvar jsCommon;\n(function (jsCommon) {\n var JQueryConstants;\n (function (JQueryConstants) {\n JQueryConstants.VisibleSelector = ':visible';\n })(JQueryConstants = jsCommon.JQueryConstants || (jsCommon.JQueryConstants = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * Represents a lazily instantiated value.\n */\n var Lazy = (function () {\n function Lazy(factoryMethod) {\n jsCommon.Utility.throwIfNullOrUndefined(factoryMethod, this, 'constructor', 'factoryMethod');\n this.factoryMethod = factoryMethod;\n }\n Lazy.prototype.getValue = function () {\n if (this.factoryMethod !== null) {\n this.value = this.factoryMethod();\n // Optimization: Release the factoryMethod, as it could be holding a large object graph.\n this.factoryMethod = null;\n }\n return this.value;\n };\n return Lazy;\n }());\n jsCommon.Lazy = Lazy;\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n var Prototype;\n (function (Prototype) {\n /**\n * Returns a new object with the provided obj as its prototype.\n */\n function inherit(obj, extension) {\n debug.assertValue(obj, 'obj');\n function wrapCtor() { }\n ;\n wrapCtor.prototype = obj;\n var inherited = new wrapCtor();\n if (extension)\n extension(inherited);\n return inherited;\n }\n Prototype.inherit = inherit;\n /**\n * Returns a new object with the provided obj as its prototype\n * if, and only if, the prototype has not been previously set\n */\n function inheritSingle(obj) {\n debug.assertValue(obj, 'obj');\n var proto = Object.getPrototypeOf(obj);\n if (proto === Object.prototype || proto === Array.prototype)\n obj = inherit(obj);\n return obj;\n }\n Prototype.inheritSingle = inheritSingle;\n /**\n * Uses the provided callback function to selectively replace contents in the provided array.\n * @return A new array with those values overriden\n * or undefined if no overrides are necessary.\n */\n function overrideArray(prototype, override) {\n if (!prototype)\n return;\n var overwritten;\n for (var i = 0, len = prototype.length; i < len; i++) {\n var value = override(prototype[i]);\n if (value) {\n if (!overwritten)\n overwritten = inherit(prototype);\n overwritten[i] = value;\n }\n }\n return overwritten;\n }\n Prototype.overrideArray = overrideArray;\n })(Prototype = powerbi.Prototype || (powerbi.Prototype = {}));\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var Formatting;\n (function (Formatting) {\n var regexCache;\n /**\n * Translate .NET format into something supported by jQuery.Globalize.\n */\n function findDateFormat(value, format, cultureName) {\n switch (format) {\n case \"m\":\n // Month + day\n format = \"M\";\n break;\n case \"O\":\n case \"o\":\n // Roundtrip\n format = \"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'0000'\";\n break;\n case \"R\":\n case \"r\":\n // RFC1123 pattern - - time must be converted to UTC before formatting \n value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());\n format = \"ddd, dd MMM yyyy HH':'mm':'ss 'GMT'\";\n break;\n case \"s\":\n // Sortable - should use invariant culture\n format = \"S\";\n break;\n case \"u\":\n // Universal sortable - should convert to UTC before applying the \"yyyy'-'MM'-'dd HH':'mm':'ss'Z' format.\n value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());\n format = \"yyyy'-'MM'-'dd HH':'mm':'ss'Z'\";\n break;\n case \"U\":\n // Universal full - the pattern is same as F but the time must be converted to UTC before formatting\n value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());\n format = \"F\";\n break;\n case \"y\":\n case \"Y\":\n // Year and month\n switch (cultureName) {\n case \"default\":\n case \"en\":\n case \"en-US\":\n format = \"MMMM, yyyy\"; // Fix the default year-month pattern for english\n break;\n default:\n format = \"Y\"; // For other cultures - use the localized pattern\n }\n break;\n }\n return { value: value, format: format };\n }\n Formatting.findDateFormat = findDateFormat;\n /**\n * Translates unsupported .NET custom format expressions to the custom expressions supported by JQuery.Globalize.\n */\n function fixDateTimeFormat(format) {\n // Fix for the \"K\" format (timezone): \n //The js dates don't have a kind property so we'll support only local kind which is equavalent to zzz format.\n format = format.replace(/%K/g, \"zzz\");\n format = format.replace(/K/g, \"zzz\");\n format = format.replace(/fffffff/g, \"fff0000\");\n format = format.replace(/ffffff/g, \"fff000\");\n format = format.replace(/fffff/g, \"fff00\");\n format = format.replace(/ffff/g, \"fff0\");\n // Fix for the 5 digit year: \"yyyyy\" format. \n //The Globalize doesn't support dates greater than 9999 so we replace the \"yyyyy\" with \"0yyyy\".\n format = format.replace(/yyyyy/g, \"0yyyy\");\n // Fix for the 3 digit year: \"yyy\" format. \n //The Globalize doesn't support this formatting so we need to replace it with the 4 digit year \"yyyy\" format.\n format = format.replace(/(^y|^)yyy(^y|$)/g, \"yyyy\");\n if (!regexCache) {\n // Creating Regexes for cases \"Using single format specifier\" \n //- http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers\n // This is not supported from The Globalize.\n // The case covers all single \"%\" lead specifier (like \"%d\" but not %dd) \n // The cases as single \"%d\" are filtered in if the bellow.\n // (?!S) where S is the specifier make sure that we only one symbol for specifier.\n regexCache = [\"d\", \"f\", \"F\", \"g\", \"h\", \"H\", \"K\", \"m\", \"M\", \"s\", \"t\", \"y\", \"z\", \":\", \"/\"].map(function (s) {\n return { r: new RegExp(\"\\%\" + s + \"(?!\" + s + \")\", \"g\"), s: s };\n });\n }\n if (format.indexOf(\"%\") !== -1 && format.length > 2) {\n for (var i = 0; i < regexCache.length; i++) {\n format = format.replace(regexCache[i].r, regexCache[i].s);\n }\n }\n return format;\n }\n Formatting.fixDateTimeFormat = fixDateTimeFormat;\n })(Formatting = jsCommon.Formatting || (jsCommon.Formatting = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var doc = document, headElement = doc.head, firstScriptInHeadElement = headElement.getElementsByTagName('script')[0], linkElement = doc.createElement('link'), scriptElement = doc.createElement('script'), styleSheetLoaded = [], javaScriptFilesLoaded = [], javaScriptFilesLoading = [];\n linkElement.setAttribute('rel', 'stylesheet');\n function requires(dependency, to) {\n if (to === void 0) { to = $.noop; }\n loadStyleSheets(dependency.cssFiles || []);\n var scriptsToRun = dependency.javaScriptFilesWithCallback || [];\n if (dependency.javaScriptFiles) {\n for (var i = 0, len = dependency.javaScriptFiles.length; i < len; ++i) {\n scriptsToRun.push({ javascriptFile: dependency.javaScriptFiles[i] });\n }\n }\n loadJavaScriptFiles(scriptsToRun, to);\n }\n jsCommon.requires = requires;\n /**\n * Private Helpers.\n */\n function loadStyleSheets(hrefList) {\n hrefList.forEach(function (href) {\n if (styleSheetLoaded.indexOf(href) === -1) {\n styleSheetLoaded.push(href);\n loadStyleSheet(href);\n }\n });\n }\n function loadJavaScriptFiles(scripts, callback) {\n var loadingCount = scripts.length, parsingCount = loadingCount, sourceCodeList = [];\n function parseIfLoadingComplete() {\n if (!--loadingCount) {\n parseJavaScriptSourceCodes(scripts, sourceCodeList);\n }\n }\n function makeCallbackIfParsingComplete() {\n if (!--parsingCount) {\n callback();\n }\n }\n scripts.forEach(function (script, index) {\n var file = script.javascriptFile;\n if (javaScriptFilesLoaded.indexOf(file) === -1) {\n if (file in javaScriptFilesLoading) {\n javaScriptFilesLoading[file].push(function () {\n parseIfLoadingComplete();\n makeCallbackIfParsingComplete();\n });\n }\n else {\n javaScriptFilesLoading[file] = [function () {\n makeCallbackIfParsingComplete();\n }];\n if (isExternalUrl(file)) {\n sourceCodeList[index] = script;\n parseIfLoadingComplete();\n }\n else {\n loadJavaScriptSourceCode(file, function (sourceCode) {\n sourceCodeList[index] = { javascriptFile: sourceCode };\n parseIfLoadingComplete();\n });\n }\n }\n }\n else {\n parseIfLoadingComplete();\n makeCallbackIfParsingComplete();\n }\n });\n }\n function loadStyleSheet(href) {\n var link = linkElement.cloneNode();\n link.href = href;\n if (firstScriptInHeadElement) {\n headElement.insertBefore(link, firstScriptInHeadElement);\n }\n else {\n headElement.appendChild(link);\n }\n }\n function loadJavaScriptSourceCode(src, onload) {\n webGet(src, function () {\n onload(this.responseText);\n });\n }\n function parseJavaScript(script, onComplete) {\n if (onComplete === void 0) { onComplete = $.noop; }\n if (!script) {\n onComplete();\n return;\n }\n var sourceCodeOrFileName = script.javascriptFile;\n var targetCallback = onComplete;\n if (script.onLoadCallback) {\n var promiseAsCallback = function () {\n script.onLoadCallback().then(onComplete);\n };\n targetCallback = promiseAsCallback;\n }\n isExternalUrl(sourceCodeOrFileName)\n ? loadExternalJavaScriptFile(sourceCodeOrFileName, targetCallback)\n : parseInternalJavaScriptCode(sourceCodeOrFileName, targetCallback);\n }\n function parseInternalJavaScriptCode(sourceCode, onComplete) {\n if (onComplete === void 0) { onComplete = $.noop; }\n var script;\n if (sourceCode) {\n script = scriptElement.cloneNode();\n script.setAttribute('type', 'text/javascript');\n script.innerHTML = sourceCode;\n headElement.appendChild(script);\n }\n setTimeout(onComplete, 0);\n }\n function loadExternalJavaScriptFile(src, onload) {\n var script;\n if (src) {\n script = scriptElement.cloneNode();\n script.setAttribute('src', src);\n script.setAttribute('charset', 'utf-8');\n script.onload = onload;\n headElement.appendChild(script);\n }\n }\n function parseJavaScriptSourceCodes(scripts, sourceCodeList) {\n asyncLoop(sourceCodeList, parseJavaScript, /*on all files parsed*/ function () {\n scripts.forEach(function (script) {\n var file = script.javascriptFile;\n var listeners = javaScriptFilesLoading[file];\n if (listeners) {\n listeners.forEach(function (listener) {\n listener();\n });\n }\n delete javaScriptFilesLoading[file];\n if (javaScriptFilesLoaded.indexOf(file) === -1) {\n javaScriptFilesLoaded.push(file);\n }\n });\n });\n }\n function webGet(src, onload, onerror) {\n var xhr = new XMLHttpRequest();\n try {\n xhr.open('GET', src, true);\n xhr.onload = onload;\n xhr.onerror = onerror;\n xhr.send(null);\n }\n catch (e) {\n }\n }\n function isExternalUrl(url) {\n var origin = location.protocol + '//' + location.host + '/';\n return /^http[s]?:\\/\\/.+/i.test(url) && url.indexOf(origin) !== 0;\n }\n function _() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i - 0] = arguments[_i];\n }\n }\n function asyncSteps() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i - 0] = arguments[_i];\n }\n if (args.length === 0) {\n return;\n }\n var steps = [], i = args.length;\n while (i--) {\n (function (j) {\n steps[j] = function () {\n args[j](steps[j + 1] || _);\n };\n })(i);\n }\n steps[0]();\n }\n function asyncLoop(enumerable, func, callback) {\n var steps = [], i = 0, len = enumerable.length;\n for (; i < len - 1; i++) {\n (function (i) {\n steps[i] = function (next) {\n func(enumerable[i], next);\n };\n }(i));\n }\n steps[len - 1] = function (next) {\n func(enumerable[len - 1], callback);\n };\n asyncSteps.apply(null, steps);\n }\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n function createJQueryPromiseFactory() {\n return new JQueryPromiseFactory();\n }\n powerbi.createJQueryPromiseFactory = createJQueryPromiseFactory;\n /**\n * jQuery-based implementation of IPromiseFactory.\n * This is useful for cases when Angular is not present, or when immediate promise resolving (not tied to Angular digest cycle) is desired.\n */\n var JQueryPromiseFactory = (function () {\n function JQueryPromiseFactory() {\n }\n JQueryPromiseFactory.prototype.defer = function () {\n return new JQueryDeferredWrapper($.Deferred());\n };\n JQueryPromiseFactory.prototype.reject = function (reason) {\n var deferred = this.defer();\n deferred.reject(reason);\n return deferred.promise;\n };\n JQueryPromiseFactory.prototype.resolve = function (value) {\n var deferred = this.defer();\n deferred.resolve(value);\n return deferred.promise;\n };\n JQueryPromiseFactory.prototype.all = function (promises) {\n var unwrappedPromises = jQuery.map(promises, function (value) {\n return value && value.promise ? value.promise : value;\n });\n return new JQueryPromiseWrapper($.when.apply($, unwrappedPromises));\n };\n JQueryPromiseFactory.prototype.when = function (value) {\n var unwrappedPromise = value && value.promise ? value.promise : value;\n return new JQueryPromiseWrapper($.when(unwrappedPromise));\n };\n return JQueryPromiseFactory;\n }());\n /**\n * Implements IDeferred via a wrapped a jQuery Deferred.\n */\n var JQueryDeferredWrapper = (function () {\n function JQueryDeferredWrapper(deferred) {\n debug.assertValue(deferred, 'deferred');\n this.deferred = deferred;\n this.promise = new JQueryPromiseWrapper(deferred.promise());\n }\n JQueryDeferredWrapper.prototype.resolve = function (value) {\n this.deferred.resolve(value);\n };\n JQueryDeferredWrapper.prototype.reject = function (reason) {\n this.deferred.reject(reason);\n };\n return JQueryDeferredWrapper;\n }());\n /**\n * Implements IDeferred via a wrapped a jQuery Promise.\n */\n var JQueryPromiseWrapper = (function () {\n function JQueryPromiseWrapper(promise) {\n debug.assertValue(promise, 'promise');\n this.promise = promise;\n }\n JQueryPromiseWrapper.prototype.then = function (a, b) {\n return new JQueryPromiseWrapper(this.promise.then(JQueryPromiseWrapper.wrapCallback(a), JQueryPromiseWrapper.wrapCallback(b)));\n };\n JQueryPromiseWrapper.prototype.catch = function (callback) {\n return this.then(null, callback);\n };\n JQueryPromiseWrapper.prototype.finally = function (callback) {\n this.promise.always(JQueryPromiseWrapper.wrapCallback(callback));\n return this;\n };\n /**\n * Wraps a callback, which may return a IPromise.\n */\n JQueryPromiseWrapper.wrapCallback = function (callback) {\n if (callback)\n return function (arg) {\n var value = callback(arg);\n // If the callback returns a Promise, unwrap that to allow jQuery to chain.\n if (value instanceof JQueryPromiseWrapper)\n return value.promise;\n return value;\n };\n return callback;\n };\n return JQueryPromiseWrapper;\n }());\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n var LocalStorageService = (function () {\n function LocalStorageService() {\n }\n LocalStorageService.prototype.getData = function (key) {\n try {\n if (localStorage) {\n var value = localStorage[key];\n if (value) {\n return JSON.parse(value);\n }\n }\n }\n catch (exception) { }\n return null;\n };\n LocalStorageService.prototype.setData = function (key, data) {\n try {\n if (localStorage) {\n localStorage[key] = JSON.stringify(data);\n }\n }\n catch (e) { }\n };\n return LocalStorageService;\n }());\n var EphemeralStorageService = (function () {\n function EphemeralStorageService(clearCacheInterval) {\n this.cache = {};\n this.clearCacheInterval = (clearCacheInterval != null)\n ? clearCacheInterval\n : EphemeralStorageService.defaultClearCacheInterval;\n this.clearCache();\n }\n EphemeralStorageService.prototype.getData = function (key) {\n return this.cache[key];\n };\n EphemeralStorageService.prototype.setData = function (key, data) {\n var _this = this;\n this.cache[key] = data;\n if (this.clearCacheTimerId == null) {\n this.clearCacheTimerId = setTimeout(function () { return _this.clearCache(); }, this.clearCacheInterval);\n }\n };\n EphemeralStorageService.prototype.clearCache = function () {\n this.cache = {};\n this.clearCacheTimerId = undefined;\n };\n EphemeralStorageService.defaultClearCacheInterval = (1000 * 60 * 60 * 24); // 1 day\n return EphemeralStorageService;\n }());\n powerbi.EphemeralStorageService = EphemeralStorageService;\n powerbi.localStorageService = new LocalStorageService();\n powerbi.ephemeralStorageService = new EphemeralStorageService();\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var WordBreaker;\n (function (WordBreaker) {\n var SPACE = ' ';\n var BREAKERS_REGEX = /[\\s\\n]+/g;\n function search(index, content, backward) {\n if (backward) {\n for (var i = index - 1; i > -1; i--) {\n if (hasBreakers(content[i]))\n return i + 1;\n }\n }\n else {\n for (var i = index, ilen = content.length; i < ilen; i++) {\n if (hasBreakers(content[i]))\n return i;\n }\n }\n return backward ? 0 : content.length;\n }\n /**\n * Find the word nearest the cursor specified within content\n * @param index - point within content to search forward/backward from\n * @param content - string to search\n */\n function find(index, content) {\n debug.assert(index >= 0 && index <= content.length, 'index within content string bounds');\n var result = { start: 0, end: 0 };\n if (content.length === 0)\n return result;\n result.start = search(index, content, true);\n result.end = search(index, content, false);\n return result;\n }\n WordBreaker.find = find;\n /**\n * Test for presence of breakers within content\n * @param content - string to test\n */\n function hasBreakers(content) {\n BREAKERS_REGEX.lastIndex = 0;\n return BREAKERS_REGEX.test(content);\n }\n WordBreaker.hasBreakers = hasBreakers;\n /**\n * Count the number of pieces when broken by BREAKERS_REGEX\n * ~2.7x faster than WordBreaker.split(content).length\n * @param content - string to break and count\n */\n function wordCount(content) {\n var count = 1;\n BREAKERS_REGEX.lastIndex = 0;\n BREAKERS_REGEX.exec(content);\n while (BREAKERS_REGEX.lastIndex !== 0) {\n count++;\n BREAKERS_REGEX.exec(content);\n }\n return count;\n }\n WordBreaker.wordCount = wordCount;\n function getMaxWordWidth(content, textWidthMeasurer, properties) {\n var words = split(content);\n var maxWidth = 0;\n for (var _i = 0, words_1 = words; _i < words_1.length; _i++) {\n var w = words_1[_i];\n properties.text = w;\n maxWidth = Math.max(maxWidth, textWidthMeasurer(properties));\n }\n return maxWidth;\n }\n WordBreaker.getMaxWordWidth = getMaxWordWidth;\n function split(content) {\n return content.split(BREAKERS_REGEX);\n }\n function getWidth(content, properties, textWidthMeasurer) {\n properties.text = content;\n return textWidthMeasurer(properties);\n }\n function truncate(content, properties, truncator, maxWidth) {\n properties.text = content;\n return truncator(properties, maxWidth);\n }\n /**\n * Split content by breakers (words) and greedy fit as many words\n * into each index in the result based on max width and number of lines\n * e.g. Each index in result corresponds to a line of content\n * when used by AxisHelper.LabelLayoutStrategy.wordBreak\n * @param content - string to split\n * @param properties - text properties to be used by @param:textWidthMeasurer\n * @param textWidthMeasurer - function to calculate width of given text content\n * @param maxWidth - maximum allowed width of text content in each result\n * @param maxNumLines - maximum number of results we will allow, valid values must be greater than 0\n * @param truncator - (optional) if specified, used as a function to truncate content to a given width\n */\n function splitByWidth(content, properties, textWidthMeasurer, maxWidth, maxNumLines, truncator) {\n // Default truncator returns string as-is\n truncator = truncator ? truncator : function (properties, maxWidth) { return properties.text; };\n var result = [];\n var words = split(content);\n var usedWidth = 0;\n var wordsInLine = [];\n for (var _i = 0, words_2 = words; _i < words_2.length; _i++) {\n var word = words_2[_i];\n // Last line? Just add whatever is left\n if ((maxNumLines > 0) && (result.length >= maxNumLines - 1)) {\n wordsInLine.push(word);\n continue;\n }\n // Determine width if we add this word\n // Account for SPACE we will add when joining...\n var wordWidth = wordsInLine.length === 0\n ? getWidth(word, properties, textWidthMeasurer)\n : getWidth(SPACE + word, properties, textWidthMeasurer);\n // If width would exceed max width,\n // then push used words and start new split result\n if (usedWidth + wordWidth > maxWidth) {\n // Word alone exceeds max width, just add it.\n if (wordsInLine.length === 0) {\n result.push(truncate(word, properties, truncator, maxWidth));\n usedWidth = 0;\n wordsInLine = [];\n continue;\n }\n result.push(truncate(wordsInLine.join(SPACE), properties, truncator, maxWidth));\n usedWidth = 0;\n wordsInLine = [];\n }\n // ...otherwise, add word and continue\n wordsInLine.push(word);\n usedWidth += wordWidth;\n }\n // Push remaining words onto result\n result.push(truncate(wordsInLine.join(SPACE), properties, truncator, maxWidth));\n return result;\n }\n WordBreaker.splitByWidth = splitByWidth;\n })(WordBreaker = jsCommon.WordBreaker || (jsCommon.WordBreaker = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n var TextMeasurementService;\n (function (TextMeasurementService) {\n var ellipsis = '…';\n var OverflowingText = jsCommon.CssConstants.createClassAndSelector('overflowingText');\n var spanElement;\n var svgTextElement;\n var canvasCtx;\n var fallbackFontFamily;\n /**\n * Idempotent function for adding the elements to the DOM.\n */\n function ensureDOM() {\n if (spanElement)\n return;\n spanElement = $('<span/>');\n $('body').append(spanElement);\n //The style hides the svg element from the canvas, preventing canvas from scrolling down to show svg black square.\n svgTextElement = d3.select($('body').get(0))\n .append('svg')\n .style({\n 'height': '0px',\n 'width': '0px',\n 'position': 'absolute'\n })\n .append('text');\n canvasCtx = $('<canvas/>').get(0).getContext(\"2d\");\n fallbackFontFamily = window.getComputedStyle(svgTextElement.node()).fontFamily;\n }\n /**\n * Removes spanElement from DOM.\n */\n function removeSpanElement() {\n if (spanElement && spanElement.remove) {\n spanElement.remove();\n }\n spanElement = null;\n }\n TextMeasurementService.removeSpanElement = removeSpanElement;\n /**\n * This method measures the width of the text with the given SVG text properties.\n * @param textProperties The text properties to use for text measurement.\n */\n function measureSvgTextWidth(textProperties) {\n debug.assertValue(textProperties, 'textProperties');\n debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf(\"px\") !== -1, \"TextProperties' text size should be in px.\");\n ensureDOM();\n canvasCtx.font =\n (textProperties.fontStyle || \"\") + \" \" +\n (textProperties.fontVariant || \"\") + \" \" +\n (textProperties.fontWeight || \"\") + \" \" +\n textProperties.fontSize + \" \" +\n (textProperties.fontFamily || fallbackFontFamily);\n return canvasCtx.measureText(textProperties.text).width;\n }\n TextMeasurementService.measureSvgTextWidth = measureSvgTextWidth;\n /**\n * This method return the rect with the given SVG text properties.\n * @param textProperties The text properties to use for text measurement.\n */\n function measureSvgTextRect(textProperties) {\n debug.assertValue(textProperties, 'textProperties');\n debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf(\"px\") !== -1, \"TextProperties' text size should be in px.\");\n ensureDOM();\n svgTextElement.style(null);\n svgTextElement\n .text(textProperties.text)\n .attr({\n 'visibility': 'hidden',\n 'font-family': textProperties.fontFamily || fallbackFontFamily,\n 'font-variant': textProperties.fontVariant,\n 'font-size': textProperties.fontSize,\n 'font-weight': textProperties.fontWeight,\n 'font-style': textProperties.fontStyle,\n 'white-space': textProperties.whiteSpace || 'nowrap'\n });\n // We're expecting the browser to give a synchronous measurement here\n // We're using SVGTextElement because it works across all browsers \n return svgTextElement.node().getBBox();\n }\n TextMeasurementService.measureSvgTextRect = measureSvgTextRect;\n /**\n * This method measures the height of the text with the given SVG text properties.\n * @param textProperties The text properties to use for text measurement.\n */\n function measureSvgTextHeight(textProperties) {\n return measureSvgTextRect(textProperties).height;\n }\n TextMeasurementService.measureSvgTextHeight = measureSvgTextHeight;\n /**\n * This method returns the text Rect with the given SVG text properties.\n * Does NOT return text width; obliterates text value\n * @param {TextProperties} textProperties - The text properties to use for text measurement\n */\n function estimateSvgTextRect(textProperties) {\n debug.assertValue(textProperties, 'textProperties');\n debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf(\"px\") !== -1, \"TextProperties' text size should be in px.\");\n var propertiesKey = textProperties.fontFamily + textProperties.fontSize;\n var rect = powerbi.ephemeralStorageService.getData(propertiesKey);\n if (rect == null) {\n // To estimate we check the height of a particular character, once it is cached, subsequent\n // calls should always get the height from the cache (regardless of the text).\n var estimatedTextProperties = {\n fontFamily: textProperties.fontFamily,\n fontSize: textProperties.fontSize,\n text: \"M\",\n };\n rect = TextMeasurementService.measureSvgTextRect(estimatedTextProperties);\n // NOTE: In some cases (disconnected/hidden DOM) we may provide incorrect measurement results (zero sized bounding-box), so\n // we only store values in the cache if we are confident they are correct.\n if (rect.height > 0)\n powerbi.ephemeralStorageService.setData(propertiesKey, rect);\n }\n return rect;\n }\n /**\n * This method returns the text Rect with the given SVG text properties.\n * @param {TextProperties} textProperties - The text properties to use for text measurement\n */\n function estimateSvgTextBaselineDelta(textProperties) {\n var rect = estimateSvgTextRect(textProperties);\n return rect.y + rect.height;\n }\n TextMeasurementService.estimateSvgTextBaselineDelta = estimateSvgTextBaselineDelta;\n /**\n * This method estimates the height of the text with the given SVG text properties.\n * @param {TextProperties} textProperties - The text properties to use for text measurement\n */\n function estimateSvgTextHeight(textProperties, tightFightForNumeric) {\n if (tightFightForNumeric === void 0) { tightFightForNumeric = false; }\n var height = estimateSvgTextRect(textProperties).height;\n //TODO: replace it with new baseline calculation\n if (tightFightForNumeric)\n height *= 0.7;\n return height;\n }\n TextMeasurementService.estimateSvgTextHeight = estimateSvgTextHeight;\n /**\n * This method measures the width of the svgElement.\n * @param svgElement The SVGTextElement to be measured.\n */\n function measureSvgTextElementWidth(svgElement) {\n debug.assertValue(svgElement, 'svgElement');\n return measureSvgTextWidth(getSvgMeasurementProperties(svgElement));\n }\n TextMeasurementService.measureSvgTextElementWidth = measureSvgTextElementWidth;\n /**\n * This method fetches the text measurement properties of the given DOM element.\n * @param element The selector for the DOM Element.\n */\n function getMeasurementProperties(element) {\n debug.assertValue(element, 'element');\n return {\n text: element.val() || element.text(),\n fontFamily: element.css('font-family'),\n fontSize: element.css('font-size'),\n fontWeight: element.css('font-weight'),\n fontStyle: element.css('font-style'),\n fontVariant: element.css('font-variant'),\n whiteSpace: element.css('white-space')\n };\n }\n TextMeasurementService.getMeasurementProperties = getMeasurementProperties;\n /**\n * This method fetches the text measurement properties of the given SVG text element.\n * @param svgElement The SVGTextElement to be measured.\n */\n function getSvgMeasurementProperties(svgElement) {\n debug.assertValue(svgElement, 'svgElement');\n var style = window.getComputedStyle(svgElement, null);\n return {\n text: svgElement.textContent,\n fontFamily: style.fontFamily,\n fontSize: style.fontSize,\n fontWeight: style.fontWeight,\n fontStyle: style.fontStyle,\n fontVariant: style.fontVariant,\n whiteSpace: style.whiteSpace\n };\n }\n TextMeasurementService.getSvgMeasurementProperties = getSvgMeasurementProperties;\n /**\n * This method returns the width of a div element.\n * @param element The div element.\n */\n function getDivElementWidth(element) {\n debug.assert(element.is('div'), 'Given element is not a div type. Cannot get width');\n return getComputedStyle(element[0]).width;\n }\n TextMeasurementService.getDivElementWidth = getDivElementWidth;\n /**\n * Compares labels text size to the available size and renders ellipses when the available size is smaller.\n * @param textProperties The text properties (including text content) to use for text measurement.\n * @param maxWidth The maximum width available for rendering the text.\n */\n function getTailoredTextOrDefault(textProperties, maxWidth) {\n debug.assertValue(textProperties, 'properties');\n debug.assertValue(textProperties.text, 'properties.text');\n debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf(\"px\") !== -1, \"TextProperties' text size should be in px.\");\n ensureDOM();\n var strLength = textProperties.text.length;\n if (strLength === 0)\n return textProperties.text;\n var width = measureSvgTextWidth(textProperties);\n if (width < maxWidth)\n return textProperties.text;\n // Create a copy of the textProperties so we don't modify the one that's passed in.\n var copiedTextProperties = powerbi.Prototype.inherit(textProperties);\n // Take the properties and apply them to svgTextElement\n // Then, do the binary search to figure out the substring we want\n // Set the substring on textElement argument\n var text = copiedTextProperties.text = ellipsis + copiedTextProperties.text;\n var min = 1;\n var max = text.length;\n var i = ellipsis.length;\n while (min <= max) {\n // num | 0 prefered to Math.floor(num) for performance benefits\n i = (min + max) / 2 | 0;\n copiedTextProperties.text = text.substr(0, i);\n width = measureSvgTextWidth(copiedTextProperties);\n if (maxWidth > width)\n min = i + 1;\n else if (maxWidth < width)\n max = i - 1;\n else\n break;\n }\n // Since the search algorithm almost never finds an exact match,\n // it will pick one of the closest two, which could result in a\n // value bigger with than 'maxWidth' thus we need to go back by \n // one to guarantee a smaller width than 'maxWidth'.\n copiedTextProperties.text = text.substr(0, i);\n width = measureSvgTextWidth(copiedTextProperties);\n if (width > maxWidth)\n i--;\n return text.substr(ellipsis.length, i - ellipsis.length) + ellipsis;\n }\n TextMeasurementService.getTailoredTextOrDefault = getTailoredTextOrDefault;\n /**\n * Compares labels text size to the available size and renders ellipses when the available size is smaller.\n * @param textElement The SVGTextElement containing the text to render.\n * @param maxWidth The maximum width available for rendering the text.\n */\n function svgEllipsis(textElement, maxWidth) {\n debug.assertValue(textElement, 'textElement');\n var properties = getSvgMeasurementProperties(textElement);\n var originalText = properties.text;\n var tailoredText = getTailoredTextOrDefault(properties, maxWidth);\n if (originalText !== tailoredText) {\n textElement.textContent = tailoredText;\n }\n }\n TextMeasurementService.svgEllipsis = svgEllipsis;\n /**\n * Word break textContent of <text> SVG element into <tspan>s\n * Each tspan will be the height of a single line of text\n * @param textElement - the SVGTextElement containing the text to wrap\n * @param maxWidth - the maximum width available\n * @param maxHeight - the maximum height available (defaults to single line)\n * @param linePadding - (optional) padding to add to line height\n */\n function wordBreak(textElement, maxWidth, maxHeight, linePadding) {\n if (linePadding === void 0) { linePadding = 0; }\n debug.assertValue(textElement, 'textElement');\n var properties = getSvgMeasurementProperties(textElement);\n var height = estimateSvgTextHeight(properties) + linePadding;\n var maxNumLines = Math.max(1, Math.floor(maxHeight / height));\n var node = d3.select(textElement);\n // Save y of parent textElement to apply as first tspan dy\n var firstDY = node.attr('y');\n // Store and clear text content\n var labelText = textElement.textContent;\n textElement.textContent = null;\n // Append a tspan for each word broken section\n var words = jsCommon.WordBreaker.splitByWidth(labelText, properties, measureSvgTextWidth, maxWidth, maxNumLines);\n for (var i = 0, ilen = words.length; i < ilen; i++) {\n properties.text = words[i];\n node\n .append('tspan')\n .attr({\n 'x': 0,\n 'dy': i === 0 ? firstDY : height,\n })\n .text(getTailoredTextOrDefault(properties, maxWidth));\n }\n }\n TextMeasurementService.wordBreak = wordBreak;\n /**\n * Word break textContent of span element into <span>s\n * Each span will be the height of a single line of text\n * @param textElement - the element containing the text to wrap\n * @param maxWidth - the maximum width available\n * @param maxHeight - the maximum height available (defaults to single line)\n * @param linePadding - (optional) padding to add to line height\n */\n function wordBreakOverflowingText(textElement, maxWidth, maxHeight, linePadding) {\n if (linePadding === void 0) { linePadding = 0; }\n debug.assertValue(textElement, 'textElement');\n var properties = getSvgMeasurementProperties(textElement);\n var height = estimateSvgTextHeight(properties) + linePadding;\n var maxNumLines = Math.max(1, Math.floor(maxHeight / height));\n // Store and clear text content\n var labelText = textElement.textContent;\n textElement.textContent = null;\n // Append a span for each word broken section\n var words = jsCommon.WordBreaker.splitByWidth(labelText, properties, measureSvgTextWidth, maxWidth, maxNumLines);\n // splitByWidth() occasionally returns unnecessary empty strings, so get rid of them.\n // TODO: Fix splitByWidth.\n words = _.compact(words);\n var spanItem = d3.select(textElement)\n .selectAll(OverflowingText.selector)\n .data(words, function (d) { return $.inArray(d, words); });\n spanItem\n .enter()\n .append(\"span\")\n .classed(OverflowingText.class, true)\n .text(function (d) { return d; })\n .style(\"width\", jsCommon.PixelConverter.toString(maxWidth));\n }\n TextMeasurementService.wordBreakOverflowingText = wordBreakOverflowingText;\n })(TextMeasurementService = powerbi.TextMeasurementService || (powerbi.TextMeasurementService = {}));\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var DOMConstants = jsCommon.DOMConstants;\n var KeyUtils;\n (function (KeyUtils) {\n function isArrowKey(keyCode) {\n return keyCode === DOMConstants.downArrowKeyCode\n || keyCode === DOMConstants.upArrowKeyCode\n || keyCode === DOMConstants.leftArrowKeyCode\n || keyCode === DOMConstants.rightArrowKeyCode;\n }\n KeyUtils.isArrowKey = isArrowKey;\n })(KeyUtils = jsCommon.KeyUtils || (jsCommon.KeyUtils = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * Responsible for throttling input function.\n */\n var ThrottleUtility = (function () {\n function ThrottleUtility(delay) {\n this.timerFactory = jsCommon.TimerPromiseFactory.instance;\n this.delay = 0;\n if (delay) {\n this.delay = delay;\n }\n }\n ThrottleUtility.prototype.run = function (fn) {\n var _this = this;\n if (!this.fn) {\n this.fn = fn;\n this.timerFactory.create(this.delay).done(function () { return _this.timerComplete(_this.fn); });\n }\n else {\n this.fn = fn;\n }\n };\n /**\n * Note: Public for testing purpose.\n */\n ThrottleUtility.prototype.timerComplete = function (fn) {\n // run fn\n fn();\n // clear fn\n this.fn = null;\n };\n return ThrottleUtility;\n }());\n jsCommon.ThrottleUtility = ThrottleUtility;\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * Responsible for creating timer promises.\n */\n var TimerPromiseFactory = (function () {\n function TimerPromiseFactory() {\n }\n /**\n * {@inheritDoc}\n */\n TimerPromiseFactory.prototype.create = function (delayInMs) {\n debug.assertValue(delayInMs, 'delayInMs');\n debug.assert(delayInMs >= 0, 'delayInMs must be a positive value.');\n var deferred = $.Deferred();\n window.setTimeout(function () { return deferred.resolve(); }, delayInMs);\n return deferred;\n };\n TimerPromiseFactory.instance = new TimerPromiseFactory();\n return TimerPromiseFactory;\n }());\n jsCommon.TimerPromiseFactory = TimerPromiseFactory;\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * Http Status code we are interested.\n */\n (function (HttpStatusCode) {\n HttpStatusCode[HttpStatusCode[\"OK\"] = 200] = \"OK\";\n HttpStatusCode[HttpStatusCode[\"BadRequest\"] = 400] = \"BadRequest\";\n HttpStatusCode[HttpStatusCode[\"Unauthorized\"] = 401] = \"Unauthorized\";\n HttpStatusCode[HttpStatusCode[\"Forbidden\"] = 403] = \"Forbidden\";\n HttpStatusCode[HttpStatusCode[\"RequestEntityTooLarge\"] = 413] = \"RequestEntityTooLarge\";\n })(jsCommon.HttpStatusCode || (jsCommon.HttpStatusCode = {}));\n var HttpStatusCode = jsCommon.HttpStatusCode;\n /**\n * Other HTTP Constants.\n */\n var HttpConstants;\n (function (HttpConstants) {\n HttpConstants.ApplicationOctetStream = 'application/octet-stream';\n HttpConstants.MultiPartFormData = 'multipart/form-data';\n })(HttpConstants = jsCommon.HttpConstants || (jsCommon.HttpConstants = {}));\n /**\n * Extensions to String class.\n */\n var StringExtensions;\n (function (StringExtensions) {\n var HtmlTagRegex = new RegExp('[<>]', 'g');\n function format() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i - 0] = arguments[_i];\n }\n var s = args[0];\n if (isNullOrUndefinedOrWhiteSpaceString(s))\n return s;\n for (var i = 0; i < args.length - 1; i++) {\n var reg = new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\");\n s = s.replace(reg, args[i + 1]);\n }\n return s;\n }\n StringExtensions.format = format;\n /**\n * Compares two strings for equality, ignoring case.\n */\n function equalIgnoreCase(a, b) {\n return StringExtensions.normalizeCase(a) === StringExtensions.normalizeCase(b);\n }\n StringExtensions.equalIgnoreCase = equalIgnoreCase;\n function startsWithIgnoreCase(a, b) {\n var normalizedSearchString = StringExtensions.normalizeCase(b);\n return StringExtensions.normalizeCase(a).indexOf(normalizedSearchString) === 0;\n }\n StringExtensions.startsWithIgnoreCase = startsWithIgnoreCase;\n function startsWith(a, b) {\n return a.indexOf(b) === 0;\n }\n StringExtensions.startsWith = startsWith;\n /** Determines whether a string contains a specified substring (while ignoring case). */\n function containsIgnoreCase(source, substring) {\n if (source == null)\n return false;\n return source.toLowerCase().indexOf(substring.toLowerCase().toString()) !== -1;\n }\n StringExtensions.containsIgnoreCase = containsIgnoreCase;\n /**\n * Normalizes case for a string.\n * Used by equalIgnoreCase method.\n */\n function normalizeCase(value) {\n Utility.throwIfNullOrUndefined(value, StringExtensions, 'normalizeCase', 'value');\n return value.toUpperCase();\n }\n StringExtensions.normalizeCase = normalizeCase;\n /**\n * Is string null or empty or undefined?\n * @return True if the value is null or undefined or empty string,\n * otherwise false.\n */\n function isNullOrEmpty(value) {\n return (value == null) || (value.length === 0);\n }\n StringExtensions.isNullOrEmpty = isNullOrEmpty;\n /**\n * Returns true if the string is null, undefined, empty, or only includes white spaces.\n * @return True if the str is null, undefined, empty, or only includes white spaces,\n * otherwise false.\n */\n function isNullOrUndefinedOrWhiteSpaceString(str) {\n return StringExtensions.isNullOrEmpty(str) || StringExtensions.isNullOrEmpty(str.trim());\n }\n StringExtensions.isNullOrUndefinedOrWhiteSpaceString = isNullOrUndefinedOrWhiteSpaceString;\n /**\n * Returns a value indicating whether the str contains any whitespace.\n */\n function containsWhitespace(str) {\n Utility.throwIfNullOrUndefined(str, this, 'containsWhitespace', 'str');\n var expr = /\\s/;\n return expr.test(str);\n }\n StringExtensions.containsWhitespace = containsWhitespace;\n /**\n * Returns a value indicating whether the str is a whitespace string.\n */\n function isWhitespace(str) {\n Utility.throwIfNullOrUndefined(str, this, 'isWhitespace', 'str');\n return str.trim() === '';\n }\n StringExtensions.isWhitespace = isWhitespace;\n /**\n * Returns the string with any trailing whitespace from str removed.\n */\n function trimTrailingWhitespace(str) {\n Utility.throwIfNullOrUndefined(str, this, 'trimTrailingWhitespace', 'str');\n return str.replace(/\\s+$/, '');\n }\n StringExtensions.trimTrailingWhitespace = trimTrailingWhitespace;\n /**\n * Returns the string with any leading and trailing whitespace from str removed.\n */\n function trimWhitespace(str) {\n Utility.throwIfNullOrUndefined(str, this, 'trimWhitespace', 'str');\n return str.replace(/^\\s+/, '').replace(/\\s+$/, '');\n }\n StringExtensions.trimWhitespace = trimWhitespace;\n /**\n * Returns length difference between the two provided strings.\n */\n function getLengthDifference(left, right) {\n Utility.throwIfNullOrUndefined(left, this, 'getLengthDifference', 'left');\n Utility.throwIfNullOrUndefined(right, this, 'getLengthDifference', 'right');\n return Math.abs(left.length - right.length);\n }\n StringExtensions.getLengthDifference = getLengthDifference;\n /**\n * Repeat char or string several times.\n * @param char The string to repeat.\n * @param count How many times to repeat the string.\n */\n function repeat(char, count) {\n var result = \"\";\n for (var i = 0; i < count; i++) {\n result += char;\n }\n return result;\n }\n StringExtensions.repeat = repeat;\n /**\n * Replace all the occurrences of the textToFind in the text with the textToReplace.\n * @param text The original string.\n * @param textToFind Text to find in the original string.\n * @param textToReplace New text replacing the textToFind.\n */\n function replaceAll(text, textToFind, textToReplace) {\n if (!textToFind)\n return text;\n var pattern = escapeStringForRegex(textToFind);\n return text.replace(new RegExp(pattern, 'gi'), textToReplace);\n }\n StringExtensions.replaceAll = replaceAll;\n function ensureUniqueNames(names) {\n debug.assertValue(names, 'names');\n var usedNames = {};\n // Make sure we are giving fair chance for all columns to stay with their original name\n // First we fill the used names map to contain all the original unique names from the list.\n for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {\n var name_1 = names_1[_i];\n usedNames[name_1] = false;\n }\n var uniqueNames = [];\n // Now we go over all names and find a unique name for each\n for (var _a = 0, names_2 = names; _a < names_2.length; _a++) {\n var name_2 = names_2[_a];\n var uniqueName = name_2;\n // If the (original) column name is already taken lets try to find another name\n if (usedNames[uniqueName]) {\n var counter = 0;\n // Find a name that is not already in the map\n while (usedNames[uniqueName] !== undefined) {\n uniqueName = name_2 + \".\" + (++counter);\n }\n }\n uniqueNames.push(uniqueName);\n usedNames[uniqueName] = true;\n }\n return uniqueNames;\n }\n StringExtensions.ensureUniqueNames = ensureUniqueNames;\n /**\n * Returns a name that is not specified in the values.\n */\n function findUniqueName(usedNames, baseName) {\n debug.assertValue(usedNames, 'usedNames');\n debug.assertValue(baseName, 'baseName');\n // Find a unique name\n var i = 0, uniqueName = baseName;\n while (usedNames[uniqueName]) {\n uniqueName = baseName + (++i);\n }\n return uniqueName;\n }\n StringExtensions.findUniqueName = findUniqueName;\n function constructCommaSeparatedList(list, resourceProvider, maxValue) {\n if (!list || list.length === 0)\n return '';\n if (maxValue === null || maxValue === undefined)\n maxValue = Number.MAX_VALUE;\n var length = Math.min(maxValue, list.length);\n var replacedList = [];\n // Only need to replace user entries of {0} and {1} since we build the list in pairs.\n for (var j = 0; j < 2; j++) {\n var targetValue = '{' + j + '}';\n var replaceValue = '_|_<' + j + '>_|_';\n for (var i = 0; i < length; i++) {\n if (list[i].indexOf(targetValue) > -1) {\n list[i] = list[i].replace(targetValue, replaceValue);\n replacedList.push({ targetValue: targetValue, replaceValue: replaceValue });\n }\n }\n }\n var commaSeparatedList = '';\n for (var i = 0; i < length; i++) {\n if (i === 0)\n commaSeparatedList = list[i];\n else\n commaSeparatedList = StringExtensions.format(resourceProvider.get('FilterRestatement_Comma'), commaSeparatedList, list[i]);\n }\n for (var i = 0; i < replacedList.length; i++) {\n commaSeparatedList = commaSeparatedList.replace(replacedList[i].replaceValue, replacedList[i].targetValue);\n }\n return commaSeparatedList;\n }\n StringExtensions.constructCommaSeparatedList = constructCommaSeparatedList;\n function escapeStringForRegex(s) {\n return s.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1');\n }\n StringExtensions.escapeStringForRegex = escapeStringForRegex;\n /**\n * Remove file name reserved characters <>:\"/\\|?* from input string.\n */\n function normalizeFileName(fileName) {\n debug.assertValue(fileName, 'fileName');\n return fileName.replace(/[\\<\\>\\:\"\\/\\\\\\|\\?*]/g, '');\n }\n StringExtensions.normalizeFileName = normalizeFileName;\n /**\n * Similar to JSON.stringify, but strips away escape sequences so that the resulting\n * string is human-readable (and parsable by JSON formatting/validating tools).\n */\n function stringifyAsPrettyJSON(object) {\n //let specialCharacterRemover = (key: string, value: string) => value.replace(/[^\\w\\s]/gi, '');\n return JSON.stringify(object /*, specialCharacterRemover*/);\n }\n StringExtensions.stringifyAsPrettyJSON = stringifyAsPrettyJSON;\n /**\n * Derive a CLS-compliant name from a specified string. If no allowed characters are present, return a fallback string instead.\n * TODO (6708134): this should have a fully Unicode-aware implementation\n */\n function deriveClsCompliantName(input, fallback) {\n debug.assertValue(input, 'input');\n var result = input.replace(/^[^A-Za-z]*/g, '').replace(/[ :\\.\\/\\\\\\-\\u00a0\\u1680\\u180e\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]/g, '_').replace(/[\\W]/g, '');\n return result.length > 0 ? result : fallback;\n }\n StringExtensions.deriveClsCompliantName = deriveClsCompliantName;\n /** Performs cheap sanitization by stripping away HTML tag (<>) characters. */\n function stripTagDelimiters(s) {\n return s.replace(HtmlTagRegex, '');\n }\n StringExtensions.stripTagDelimiters = stripTagDelimiters;\n })(StringExtensions = jsCommon.StringExtensions || (jsCommon.StringExtensions = {}));\n /**\n * The general utility class.\n */\n var Utility = (function () {\n function Utility() {\n }\n /**\n * Ensures the specified value is not null or undefined. Throws a relevent exception if it is.\n * @param value The value to check.\n * @param context The context from which the check originated.\n * @param methodName The name of the method that initiated the check.\n * @param parameterName The parameter name of the value to check.\n */\n Utility.throwIfNullOrUndefined = function (value, context, methodName, parameterName) {\n if (value === null) {\n Utility.throwException(jsCommon.Errors.argumentNull(Utility.getComponentName(context) + methodName + '.' + parameterName));\n }\n else if (typeof (value) === Utility.Undefined) {\n Utility.throwException(jsCommon.Errors.argumentUndefined(Utility.getComponentName(context) + methodName + '.' + parameterName));\n }\n };\n /**\n * Ensures the specified value is not null, undefined or empty. Throws a relevent exception if it is.\n * @param value The value to check.\n * @param context The context from which the check originated.\n * @param methodName The name of the method that initiated the check.\n * @param parameterName The parameter name of the value to check.\n */\n Utility.throwIfNullOrEmpty = function (value, context, methodName, parameterName) {\n Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);\n if (!value.length) {\n Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));\n }\n };\n /**\n * Ensures the specified string is not null, undefined or empty. Throws a relevent exception if it is.\n * @param value The value to check.\n * @param context The context from which the check originated.\n * @param methodName The name of the method that initiated the check.\n * @param parameterName The parameter name of the value to check.\n */\n Utility.throwIfNullOrEmptyString = function (value, context, methodName, parameterName) {\n Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);\n if (value.length < 1) {\n Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));\n }\n };\n /**\n * Ensures the specified value is not null, undefined, whitespace or empty. Throws a relevent exception if it is.\n * @param value The value to check.\n * @param context The context from which the check originated.\n * @param methodName The name of the method that initiated the check.\n * @param parameterName The parameter name of the value to check.\n */\n Utility.throwIfNullEmptyOrWhitespaceString = function (value, context, methodName, parameterName) {\n Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);\n if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(value)) {\n Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));\n }\n };\n /**\n * Ensures the specified condition is true. Throws relevant exception if it isn't.\n * @param condition The condition to check.\n * @param context The context from which the check originated.\n * @param methodName The name of the method that initiated the check.\n * @param parameterName The parameter name against which the condition is checked.\n */\n Utility.throwIfNotTrue = function (condition, context, methodName, parameterName) {\n if (!condition) {\n Utility.throwException(jsCommon.Errors.argument(parameterName, Utility.getComponentName(context) + methodName + '.' + parameterName));\n }\n };\n /**\n * Checks whether the provided value is a 'string'.\n * @param value The value to test.\n */\n Utility.isString = function (value) {\n return ((typeof value) === 'string');\n };\n /**\n * Checks whether the provided value is a 'boolean'.\n * @param value The value to test.\n */\n Utility.isBoolean = function (value) {\n return ((typeof value) === 'boolean');\n };\n /**\n * Checks whether the provided value is a 'number'.\n * @param value The value to test.\n */\n Utility.isNumber = function (value) {\n return ((typeof value) === 'number');\n };\n /**\n * Checks whether the provided value is a Date instance.\n * @param value The value to test.\n */\n Utility.isDate = function (value) {\n return Utility.isObject(value) && (value instanceof Date);\n };\n /**\n * Checks whether the provided value is an 'object'.\n * @param value The value to test.\n */\n Utility.isObject = function (value) {\n return (value != null) && ((typeof value) === 'object');\n };\n /**\n * Checks whether the provided value is null or undefined.\n * @param value The value to test.\n */\n Utility.isNullOrUndefined = function (value) {\n return (value === null) || (typeof (value) === Utility.Undefined);\n };\n /**\n * Combine a base url and a path.\n * @param baseUrl The base url.\n * @param path The path to add on to the base url.\n * @returns The combined url.\n */\n Utility.urlCombine = function (baseUrl, path) {\n Utility.throwIfNullOrUndefined(baseUrl, null, \"urlCombine\", \"baseUrl\");\n Utility.throwIfNullOrUndefined(path, null, \"urlCombine\", \"path\");\n // should any of the components be empty, fail gracefuly - this is important when using the test page\n if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(path)) {\n return baseUrl;\n }\n if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(baseUrl)) {\n return path;\n }\n var finalUrl = baseUrl;\n if (finalUrl.charAt(finalUrl.length - 1) === '/') {\n if (path.charAt(0) === '/')\n path = path.slice(1);\n }\n else {\n if (path.charAt(0) !== '/')\n path = '/' + path;\n }\n return finalUrl + path;\n };\n Utility.getAbsoluteUri = function (path) {\n Utility.throwIfNullOrUndefined(path, null, \"getAbsoluteUri\", \"path\");\n var url = path;\n // Make absolute\n if (url && url.indexOf('http') === -1) {\n url = Utility.urlCombine(clusterUri, url);\n }\n return url;\n };\n Utility.getStaticResourceUri = function (path) {\n Utility.throwIfNullOrUndefined(path, null, \"getStaticResourceUri\", \"path\");\n var url = path;\n // Make absolute\n if (url && url.indexOf('http') === -1) {\n url = jsCommon.Utility.urlCombine(Utility.staticContentLocation, url);\n }\n return url;\n };\n Utility.getComponentName = function (context) {\n return !context ? '' : (typeof context).toString() + '.';\n };\n Utility.throwException = function (e) {\n jsCommon.Trace.error(StringExtensions.format(\"Throwing exception: {0}\", JSON.stringify(e)), \n /*includeStackTrace*/ e.stack != null ? false : true);\n throw e;\n };\n Utility.createClassSelector = function (className) {\n Utility.throwIfNullOrEmptyString(className, null, 'CreateClassSelector', 'className');\n return '.' + className;\n };\n Utility.createIdSelector = function (id) {\n Utility.throwIfNullOrEmptyString(id, null, 'CreateIdSelector', 'id');\n return '#' + id;\n };\n /**\n * Creates a client-side Guid string.\n * @returns A string representation of a Guid.\n */\n Utility.generateGuid = function () {\n var guid = \"\", idx = 0;\n for (idx = 0; idx < 32; idx += 1) {\n var guidDigitsItem = Math.random() * 16 | 0;\n switch (idx) {\n case 8:\n case 12:\n case 16:\n case 20:\n guid += \"-\";\n break;\n }\n guid += guidDigitsItem.toString(16);\n }\n return guid;\n };\n /**\n * Try extract a cookie from {@link document.cookie} identified by key.\n */\n Utility.getCookieValue = function (key) {\n // the cookie is of the format <key1=value1>; <key2=value2>. Split by ';', then by '=' \n // to search for the key\n var keyValuePairs = document.cookie.split(';');\n for (var i = 0; i < keyValuePairs.length; i++) {\n var keyValue = keyValuePairs[i];\n var split = keyValue.split('=');\n if (split.length > 0 && split[0].trim() === key) {\n return keyValue.substr(keyValue.indexOf('=') + 1);\n }\n }\n return null;\n };\n /**\n * Extracts the protocol://hostname section of a url.\n * @param url The URL from which to extract the section.\n * @returns The protocol://hostname portion of the given URL.\n */\n Utility.getDomainForUrl = function (url) {\n var hrefObject = Utility.getHrefObjectFromUrl(url);\n return hrefObject.prop('protocol') + '//' + hrefObject.prop('hostname');\n };\n /**\n * Extracts the hostname and absolute path sections of a url.\n * @param url The URL from which to extract the section.\n * @returns The hostname and absolute path portion of the given URL.\n */\n Utility.getHostNameForUrl = function (url) {\n var hrefObject = Utility.getHrefObjectFromUrl(url);\n return Utility.urlCombine(hrefObject.prop('hostname'), hrefObject.prop('pathname'));\n };\n /**\n * Return the original url with query string stripped.\n * @param url The URL from which to extract the section.\n * @returns the original url with query string stripped.\n */\n Utility.getUrlWithoutQueryString = function (url) {\n var hrefObject = Utility.getHrefObjectFromUrl(url);\n return hrefObject.prop('protocol') + '//' + Utility.urlCombine(hrefObject.prop('host'), hrefObject.prop('pathname'));\n };\n /**\n * Extracts the protocol section of a url.\n * @param url The URL from which to extract the section.\n * @returns The protocol for the current URL.\n */\n Utility.getProtocolFromUrl = function (url) {\n return Utility.getHrefObjectFromUrl(url).prop('protocol').replace(':', '');\n };\n /**\n * Returns a formatted href object from a URL.\n * @param url The URL used to generate the object.\n * @returns A jQuery object with the url.\n */\n Utility.getHrefObjectFromUrl = function (url) {\n var aObject = $('<a>');\n aObject = aObject.prop('href', url);\n return aObject;\n };\n /**\n * Converts a WCF representation of a dictionary to a JavaScript dictionary.\n * @param wcfDictionary The WCF dictionary to convert.\n * @returns The native JavaScript representation of this dictionary.\n */\n Utility.convertWcfToJsDictionary = function (wcfDictionary) {\n // convert the WCF JSON representation of a dictionary\n // to JS dictionary.\n // WCF representation: [{\"Key\": Key, \"Value\": Value}..]\n // JS representation: [Key: Value ..]\n var result = {};\n for (var i = 0; i < wcfDictionary.length; i++) {\n var keyValuePair = wcfDictionary[i];\n result[keyValuePair['Key']] = keyValuePair['Value'];\n }\n return result;\n };\n Utility.getDateFromWcfJsonString = function (jsonDate, fromUtcMilliseconds) {\n if (StringExtensions.isNullOrEmpty(jsonDate)) {\n return null;\n }\n var begIndex = jsonDate.indexOf('(');\n var endIndex = jsonDate.indexOf(')');\n if (begIndex !== -1 && endIndex !== -1) {\n var milliseconds = parseInt(jsonDate.substring(begIndex + 1, endIndex), 10);\n if (fromUtcMilliseconds) {\n return new Date(milliseconds);\n }\n else {\n var retValue = new Date(0);\n retValue.setUTCMilliseconds(milliseconds);\n return retValue;\n }\n }\n return null;\n };\n /**\n * Get the outer html of the given jquery object.\n * @param content The jquery object.\n * @returns The entire html representation of the object.\n */\n Utility.getOuterHtml = function (content) {\n return $('<div>').append(content).html();\n };\n /**\n * Comparison Method: Compares two integer numbers.\n * @param a An integer value.\n * @param b An integer value.\n * @returns The comparison result.\n */\n Utility.compareInt = function (a, b) {\n return a - b;\n };\n /**\n * Return the index of the smallest value in a numerical array.\n * @param a A numeric array.\n * @returns The index of the smallest value in the array.\n */\n Utility.getIndexOfMinValue = function (a) {\n var retValue = 0;\n var currentMinValue = a[0];\n for (var i = 0; i < a.length; i++) {\n if (a[i] < currentMinValue) {\n currentMinValue = a[i];\n retValue = i;\n }\n }\n return retValue;\n };\n /**\n * Extracts a url from a background image attribute in the format of: url('www.foobar.com/image.png').\n * @param input The value of the background-image attribute.\n * @returns The extracted url.\n */\n Utility.extractUrlFromCssBackgroundImage = function (input) {\n return input.replace(/\"/g, \"\").replace(/url\\(|\\)$/ig, \"\");\n };\n /**\n * Verifies image data url of images.\n */\n Utility.isValidImageDataUrl = function (url) {\n var regex = new RegExp('data:(image\\/(png|jpg|jpeg|gif|svg))');\n return regex.test(url);\n };\n Utility.isLocalUrl = function (url) {\n return _.startsWith(url, \"data:\") || _.startsWith(url, \"blob:\");\n };\n /**\n * Downloads a content string as a file.\n * @param content Content stream.\n * @param fileName File name to use.\n */\n Utility.saveAsFile = function (content, fileName) {\n var contentBlob = new Blob([content], { type: HttpConstants.ApplicationOctetStream });\n var url = window['webkitURL'] || URL;\n var urlLink = url.createObjectURL(contentBlob);\n var fileNameLink = fileName || urlLink;\n // IE support, use msSaveOrOpenBlob API\n if (window.navigator.msSaveOrOpenBlob) {\n window.navigator.msSaveOrOpenBlob(contentBlob, fileNameLink);\n return;\n }\n // WebKit-based browser support requires generating an anchor tag with\n // download attribute set to blob store and triggering a click event to invoke \n // a download to file action\n var hyperlink = document.createElement('a');\n hyperlink.href = urlLink;\n hyperlink.target = '_blank';\n hyperlink['download'] = fileNameLink;\n document.body.appendChild(hyperlink);\n hyperlink.click();\n document.body.removeChild(hyperlink);\n };\n /**\n * Helper method to get the simple type name from a typed object.\n * @param obj The typed object.\n * @returns The simple type name for the object.\n */\n Utility.getType = function (obj) {\n Utility.throwIfNullEmptyOrWhitespaceString(obj.__type, this, 'getType', 'obj');\n var parts = obj.__type.split(\":\");\n if (parts.length !== 2) {\n jsCommon.Errors.argument(\"obj.__type\", \"Type String not in expected format [Type]#[Namespace]: \" + obj.__type);\n }\n if (parts[1] !== Utility.TypeNamespace) {\n jsCommon.Errors.argument(\"obj.__type\", \"Type Namespace not expected: \" + parts[1]);\n }\n return parts[0];\n };\n /**\n * Check if an element supports a specific event type.\n * @param eventName The name of the event.\n * @param element The element to test for event support.\n * @returns Whether the even is supported on the provided element.\n */\n Utility.isEventSupported = function (eventName, element) {\n eventName = 'on' + eventName;\n var isSupported = (eventName in element);\n if (!isSupported) {\n // if we can't use setAttribute try a generic element\n if (!element.setAttribute) {\n element = document.createElement('div');\n }\n if (element.setAttribute && element.removeAttribute) {\n element.setAttribute(eventName, '');\n isSupported = typeof element[eventName] === 'function';\n // if the property was created - remove it\n if (typeof element[eventName] !== 'undefined') {\n element[eventName] = null;\n }\n element.removeAttribute(eventName);\n }\n }\n element = null;\n return isSupported;\n };\n Utility.toPixel = function (pixelAmount) {\n Utility.throwIfNullOrUndefined(pixelAmount, this, \"toPixel\", \"pixelAmount\");\n return pixelAmount.toString() + jsCommon.CssConstants.pixelUnits;\n };\n Utility.getPropertyCount = function (object) {\n Utility.throwIfNullOrUndefined(object, this, \"getPropertyCount\", \"object\");\n return Object.getOwnPropertyNames(object).length;\n };\n /**\n * Check if an element supports a specific event type.\n * @param filePath File path.\n * @returns File extension.\n */\n Utility.getFileExtension = function (filePath) {\n if (filePath) {\n var index = filePath.lastIndexOf('.');\n if (index >= 0)\n return filePath.substr(index + 1);\n }\n return '';\n };\n /**\n * Extract the filename out of a full path delimited by '\\' or '/'.\n * @param filePath File path.\n * @returns filename File name.\n */\n Utility.extractFileNameFromPath = function (filePath) {\n return filePath.replace(/^.*[\\\\\\/]/, '');\n };\n /**\n * This method indicates whether window.clipboardData is supported.\n * For example, clipboard support for Windows Store apps is currently disabled\n * since window.clipboardData is unsupported (it raises access denied error)\n * since clipboard in Windows Store is being\n * achieved through Windows.ApplicationModel.DataTransfer.Clipboard class.\n */\n Utility.canUseClipboard = function () {\n return (typeof MSApp === \"undefined\");\n };\n Utility.is64BitOperatingSystem = function () {\n return navigator.userAgent.indexOf(\"WOW64\") !== -1 ||\n navigator.userAgent.indexOf(\"Win64\") !== -1;\n };\n Utility.parseNumber = function (value, defaultValue) {\n if (value === null)\n return null;\n if (value === undefined)\n return defaultValue;\n var result = Number(value);\n if (isFinite(result))\n return result;\n if (isNaN(result) && !(typeof value === \"number\" || value === \"NaN\"))\n return defaultValue;\n return result;\n };\n Utility.getURLParamValue = function (name) {\n var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);\n if (results == null) {\n return null;\n }\n else {\n return results[1] || 0;\n }\n };\n /**\n * Return local timezone.\n * This function uses summer and winter offset to determine local time zone.\n * The result localTimeZoneString must be a subset of the strings used by server,\n * as documented here: https://msdn.microsoft.com/en-us/library/gg154758.aspx (Dynamic Daylight Savings Time (Compact 2013)).\n * @return Local timezone string or UTC if timezone cannot be found.\n */\n Utility.getLocalTimeZoneString = function () {\n var timeSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0));\n var summerOffset = -1 * timeSummer.getTimezoneOffset();\n var timeWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0));\n var winterOffset = -1 * timeWinter.getTimezoneOffset();\n var localTimeZoneString;\n if (-720 === summerOffset && -720 === winterOffset) {\n localTimeZoneString = 'Dateline Standard Time';\n }\n else if (-660 === summerOffset && -660 === winterOffset) {\n localTimeZoneString = 'UTC-11';\n }\n else if (-660 === summerOffset && -660 === winterOffset) {\n localTimeZoneString = 'Samoa Standard Time';\n }\n else if (-600 === summerOffset && -600 === winterOffset) {\n localTimeZoneString = 'Hawaiian Standard Time';\n }\n else if (-480 === summerOffset && -540 === winterOffset) {\n localTimeZoneString = 'Alaskan Standard Time';\n }\n else if (-420 === summerOffset && -480 === winterOffset) {\n localTimeZoneString = 'Pacific Standard Time';\n }\n else if (-420 === summerOffset && -420 === winterOffset) {\n localTimeZoneString = 'US Mountain Standard Time';\n }\n else if (-360 === summerOffset && -420 === winterOffset) {\n localTimeZoneString = 'Mountain Standard Time';\n }\n else if (-360 === summerOffset && -360 === winterOffset) {\n localTimeZoneString = 'Central America Standard Time';\n }\n else if (-300 === summerOffset && -360 === winterOffset) {\n localTimeZoneString = 'Central Standard Time';\n }\n else if (-300 === summerOffset && -300 === winterOffset) {\n localTimeZoneString = 'SA Pacific Standard Time';\n }\n else if (-240 === summerOffset && -300 === winterOffset) {\n localTimeZoneString = 'Eastern Standard Time';\n }\n else if (-270 === summerOffset && -270 === winterOffset) {\n localTimeZoneString = 'Venezuela Standard Time';\n }\n else if (-240 === summerOffset && -240 === winterOffset) {\n localTimeZoneString = 'SA Western Standard Time';\n }\n else if (-240 === summerOffset && -180 === winterOffset) {\n localTimeZoneString = 'Central Brazilian Standard Time';\n }\n else if (-180 === summerOffset && -240 === winterOffset) {\n localTimeZoneString = 'Atlantic Standard Time';\n }\n else if (-180 === summerOffset && -180 === winterOffset) {\n localTimeZoneString = 'Montevideo Standard Time';\n }\n else if (-180 === summerOffset && -120 === winterOffset) {\n localTimeZoneString = 'E. South America Standard Time';\n }\n else if (-150 === summerOffset && -210 === winterOffset) {\n localTimeZoneString = 'Mid-Atlantic Standard Time';\n }\n else if (-120 === summerOffset && -120 === winterOffset) {\n localTimeZoneString = 'SA Eastern Standard Time';\n }\n else if (0 === summerOffset && 0 === winterOffset) {\n localTimeZoneString = 'UTC';\n }\n else if (60 === summerOffset && 0 === winterOffset) {\n localTimeZoneString = 'GMT Standard Time';\n }\n else if (60 === summerOffset && 120 === winterOffset) {\n localTimeZoneString = 'Namibia Standard Time';\n }\n else if (120 === summerOffset && 60 === winterOffset) {\n localTimeZoneString = 'Romance Standard Time';\n }\n else if (120 === summerOffset && 120 === winterOffset) {\n localTimeZoneString = 'South Africa Standard Time';\n }\n else if (180 === summerOffset && 120 === winterOffset) {\n localTimeZoneString = 'GTB Standard Time';\n }\n else if (180 === summerOffset && 180 === winterOffset) {\n localTimeZoneString = 'E. Africa Standard Time';\n }\n else if (240 === summerOffset && 180 === winterOffset) {\n localTimeZoneString = 'Russian Standard Time';\n }\n else if (240 === summerOffset && 240 === winterOffset) {\n localTimeZoneString = 'Arabian Standard Time';\n }\n else if (270 === summerOffset && 210 === winterOffset) {\n localTimeZoneString = 'Iran Standard Time';\n }\n else if (270 === summerOffset && 270 === winterOffset) {\n localTimeZoneString = 'Afghanistan Standard Time';\n }\n else if (300 === summerOffset && 240 === winterOffset) {\n localTimeZoneString = 'Pakistan Standard Time';\n }\n else if (300 === summerOffset && 300 === winterOffset) {\n localTimeZoneString = 'West Asia Standard Time';\n }\n else if (330 === summerOffset && 330 === winterOffset) {\n localTimeZoneString = 'India Standard Time';\n }\n else if (345 === summerOffset && 345 === winterOffset) {\n localTimeZoneString = 'Nepal Standard Time';\n }\n else if (360 === summerOffset && 300 === winterOffset) {\n localTimeZoneString = 'N. Central Asia Standard Time';\n }\n else if (360 === summerOffset && 360 === winterOffset) {\n localTimeZoneString = 'Central Asia Standard Time';\n }\n else if (390 === summerOffset && 390 === winterOffset) {\n localTimeZoneString = 'Myanmar Standard Time';\n }\n else if (420 === summerOffset && 360 === winterOffset) {\n localTimeZoneString = 'North Asia Standard Time';\n }\n else if (420 === summerOffset && 420 === winterOffset) {\n localTimeZoneString = 'SE Asia Standard Time';\n }\n else if (480 === summerOffset && 420 === winterOffset) {\n localTimeZoneString = 'North Asia East Standard Time';\n }\n else if (480 === summerOffset && 480 === winterOffset) {\n localTimeZoneString = 'China Standard Time';\n }\n else if (540 === summerOffset && 480 === winterOffset) {\n localTimeZoneString = 'Yakutsk Standard Time';\n }\n else if (540 === summerOffset && 540 === winterOffset) {\n localTimeZoneString = 'Tokyo Standard Time';\n }\n else if (570 === summerOffset && 570 === winterOffset) {\n localTimeZoneString = 'Cen. Australia Standard Time';\n }\n else if (600 === summerOffset && 600 === winterOffset) {\n localTimeZoneString = 'E. Australia Standard Time';\n }\n else if (600 === summerOffset && 660 === winterOffset) {\n localTimeZoneString = 'AUS Eastern Standard Time';\n }\n else if (660 === summerOffset && 600 === winterOffset) {\n localTimeZoneString = 'Tasmania Standard Time';\n }\n else if (660 === summerOffset && 660 === winterOffset) {\n localTimeZoneString = 'West Pacific Standard Time';\n }\n else if (690 === summerOffset && 690 === winterOffset) {\n localTimeZoneString = 'Central Pacific Standard Time';\n }\n else if (720 === summerOffset && 660 === winterOffset) {\n localTimeZoneString = 'Magadan Standard Time';\n }\n else if (720 === summerOffset && 720 === winterOffset) {\n localTimeZoneString = 'Fiji Standard Time';\n }\n else if (720 === summerOffset && 780 === winterOffset) {\n localTimeZoneString = 'New Zealand Standard Time';\n }\n else if (780 === summerOffset && 780 === winterOffset) {\n localTimeZoneString = 'Tonga Standard Time';\n }\n else {\n localTimeZoneString = 'UTC';\n }\n return localTimeZoneString;\n };\n Utility.TypeNamespace = 'http://schemas.microsoft.com/sqlbi/2013/01/NLRuntimeService';\n Utility.JsonContentType = 'application/json';\n Utility.JpegContentType = 'image/jpeg';\n Utility.XJavascriptContentType = 'application/x-javascript';\n Utility.JsonDataType = 'json';\n Utility.BlobDataType = 'blob';\n Utility.HttpGetMethod = 'GET';\n Utility.HttpPostMethod = 'POST';\n Utility.HttpPutMethod = 'PUT';\n Utility.HttpDeleteMethod = 'DELETE';\n Utility.HttpContentTypeHeader = 'Content-Type';\n Utility.HttpAcceptHeader = 'Accept';\n Utility.Undefined = 'undefined';\n Utility.staticContentLocation = window.location.protocol + '//' + window.location.host;\n return Utility;\n }());\n jsCommon.Utility = Utility;\n var VersionUtility = (function () {\n function VersionUtility() {\n }\n /**\n * Compares 2 version strings.\n * @param versionA The first version string.\n * @param versionB The second version string.\n * @returns A result for the comparison.\n */\n VersionUtility.compareVersions = function (versionA, versionB) {\n var a = versionA.split('.').map(parseFloat);\n var b = versionB.split('.').map(parseFloat);\n var versionParts = Math.max(a.length, b.length);\n for (var i = 0; i < versionParts; i++) {\n var partA = a[i] || 0;\n var partB = b[i] || 0;\n if (partA > partB)\n return 1;\n if (partA < partB)\n return -1;\n }\n return 0;\n };\n return VersionUtility;\n }());\n jsCommon.VersionUtility = VersionUtility;\n var PerformanceUtil;\n (function (PerformanceUtil) {\n var PerfMarker = (function () {\n function PerfMarker(name) {\n this._name = name;\n this._start = PerfMarker.begin(name);\n }\n PerfMarker.begin = function (name) {\n if (window.performance === undefined || performance.mark === undefined)\n return;\n if (console.time) {\n console.time(name);\n }\n name = 'Begin ' + name;\n performance.mark(name);\n return name;\n };\n PerfMarker.prototype.end = function () {\n if (window.performance === undefined || performance.mark === undefined || performance.measure === undefined)\n return;\n var name = this._name;\n var end = 'End ' + name;\n performance.mark(end);\n performance.measure(name, this._start, end);\n if (console.timeEnd) {\n console.timeEnd(name);\n }\n };\n return PerfMarker;\n }());\n PerformanceUtil.PerfMarker = PerfMarker;\n function create(name) {\n return new PerfMarker(name);\n }\n PerformanceUtil.create = create;\n })(PerformanceUtil = jsCommon.PerformanceUtil || (jsCommon.PerformanceUtil = {}));\n var DeferUtility;\n (function (DeferUtility) {\n /**\n * Wraps a callback and returns a new function.\n * The function can be called many times but the callback\n * will only be executed once on the next frame.\n * Use this to throttle big UI updates and access to DOM.\n */\n function deferUntilNextFrame(callback) {\n var isWaiting, args, context;\n if (!window.requestAnimationFrame) {\n window.requestAnimationFrame = function (func) { return setTimeout(func, 1000 / 50); };\n }\n return function () {\n if (!isWaiting) {\n isWaiting = true;\n args = arguments;\n context = this;\n window.requestAnimationFrame(function () {\n isWaiting = false;\n callback.apply(context, args);\n });\n }\n };\n }\n DeferUtility.deferUntilNextFrame = deferUntilNextFrame;\n })(DeferUtility = jsCommon.DeferUtility || (jsCommon.DeferUtility = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var TraceItem = (function () {\n function TraceItem(text, type, sessionId, requestId) {\n this.text = text;\n this.type = type;\n this.sessionId = sessionId;\n this.requestId = requestId;\n this.timeStamp = new Date();\n }\n TraceItem.prototype.toString = function () {\n var resultString = '';\n resultString += (jsCommon.StringExtensions.format('{0} ({1}): {2}', TraceItem.traceTypeStrings[this.type], this.timeStamp.toUTCString(), this.text));\n if (this.requestId)\n resultString += ('\\n(Request id: ' + this.requestId + ')');\n return resultString;\n };\n TraceItem.traceTypeStrings = [\n 'INFORMATION',\n 'VERBOSE',\n 'WARNING',\n 'ERROR',\n 'EXPECTEDERROR',\n 'UNEXPECTEDERROR',\n 'FATAL',\n ];\n return TraceItem;\n }());\n jsCommon.TraceItem = TraceItem;\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var UrlUtils;\n (function (UrlUtils) {\n var urlRegex = /http[s]?:\\/\\/(\\S)+/gi;\n function isValidUrl(value) {\n if (jsCommon.StringExtensions.isNullOrEmpty(value))\n return false;\n var match = jsCommon.RegExpExtensions.run(urlRegex, value);\n if (!!match && match.index === 0)\n return true;\n return false;\n }\n UrlUtils.isValidUrl = isValidUrl;\n /* Tests whether a URL is valid.\n * @param url The url to be tested.\n * @returns Whether the provided url is valid.\n **/\n function isValidImageUrl(url) {\n // VSTS: 7252099 / 7112236\n // For now, passes for any valid Url\n return isValidUrl(url);\n }\n UrlUtils.isValidImageUrl = isValidImageUrl;\n function findAllValidUrls(text) {\n if (jsCommon.StringExtensions.isNullOrEmpty(text))\n return [];\n // Find all urls in the text.\n // TODO: This could potentially be expensive, maybe include a cap here for text with many urls?\n var urlRanges = [];\n var matches;\n var start = 0;\n while ((matches = jsCommon.RegExpExtensions.run(urlRegex, text, start)) !== null) {\n var url = matches[0];\n var end = matches.index + url.length;\n urlRanges.push({\n start: matches.index,\n end: end,\n text: url,\n });\n start = end;\n }\n return urlRanges;\n }\n UrlUtils.findAllValidUrls = findAllValidUrls;\n function getBase64ContentFromDataUri(uri) {\n if (uri.indexOf('data:') !== 0)\n throw new Error(\"Expected data uri\");\n // Locate the base 64 content from the URL (e.g. \"data:image/png;base64,xxxxx=\")\n var base64Token = \";base64,\";\n var indexBase64TokenStart = uri.indexOf(base64Token);\n if (indexBase64TokenStart < 0)\n throw new Error(\"Expected base 64 content in data url\");\n var indexBase64Start = indexBase64TokenStart + base64Token.length;\n return uri.substr(indexBase64Start, uri.length - indexBase64Start);\n }\n UrlUtils.getBase64ContentFromDataUri = getBase64ContentFromDataUri;\n })(UrlUtils = jsCommon.UrlUtils || (jsCommon.UrlUtils = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var BrowserUtils;\n (function (BrowserUtils) {\n function isChrome() {\n var vendorName = window.navigator.vendor || \"\";\n var userAgent = window.navigator.userAgent.toLowerCase();\n return vendorName.toLowerCase().indexOf('google') > -1 &&\n userAgent.indexOf('chrome') > -1 &&\n userAgent.indexOf('edge') === -1 &&\n userAgent.indexOf('opr') === -1;\n }\n BrowserUtils.isChrome = isChrome;\n function isInternetExplorerOrEdge() {\n var userAgent = window.navigator.userAgent.toLowerCase();\n return userAgent.indexOf('msie') > -1\n || userAgent.indexOf('trident') > -1\n || userAgent.indexOf('edge') > -1;\n }\n BrowserUtils.isInternetExplorerOrEdge = isInternetExplorerOrEdge;\n /**\n * Get the current version of IE\n * @returns The version of Internet Explorer or a 0 (indicating the use of another browser).\n */\n function getInternetExplorerVersion() {\n var retValue = 0;\n if (navigator.appName === 'Microsoft Internet Explorer' || window.navigator.userAgent.indexOf('MSIE') >= 0) {\n var re = new RegExp('MSIE ([0-9]{1,}[\\\\.0-9]{0,})');\n var result = re.exec(window.navigator.userAgent);\n if (result) {\n retValue = parseFloat(result[1]);\n }\n }\n return retValue;\n }\n BrowserUtils.getInternetExplorerVersion = getInternetExplorerVersion;\n })(BrowserUtils = jsCommon.BrowserUtils || (jsCommon.BrowserUtils = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * Extensions for Enumerations.\n */\n var EnumExtensions;\n (function (EnumExtensions) {\n /**\n * Gets a value indicating whether the value has the bit flags set.\n */\n function hasFlag(value, flag) {\n debug.assert(!!flag, 'flag must be specified and nonzero.');\n return (value & flag) === flag;\n }\n EnumExtensions.hasFlag = hasFlag;\n /**\n * Sets a value of a flag without modifying any other flags.\n */\n function setFlag(value, flag) {\n debug.assert(!!flag, \"flag must be specified and nonzero.\");\n return value |= flag;\n }\n EnumExtensions.setFlag = setFlag;\n /**\n * Resets a value of a flag without modifying any other flags.\n */\n function resetFlag(value, flag) {\n debug.assert(!!flag, \"flag must be specified and nonzero.\");\n return value &= ~flag;\n }\n EnumExtensions.resetFlag = resetFlag;\n /**\n * According to the TypeScript Handbook, this is safe to do.\n */\n function toString(enumType, value) {\n return enumType[value];\n }\n EnumExtensions.toString = toString;\n })(EnumExtensions = jsCommon.EnumExtensions || (jsCommon.EnumExtensions = {}));\n /**\n * Extensions to String class.\n */\n var StringExtensions;\n (function (StringExtensions) {\n /**\n * Checks if a string ends with a sub-string.\n */\n function endsWith(str, suffix) {\n debug.assertValue(str, 'str');\n debug.assertValue(suffix, 'suffix');\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\n }\n StringExtensions.endsWith = endsWith;\n })(StringExtensions = jsCommon.StringExtensions || (jsCommon.StringExtensions = {}));\n var LogicExtensions;\n (function (LogicExtensions) {\n function XOR(a, b) {\n return (a || b) && !(a && b);\n }\n LogicExtensions.XOR = XOR;\n })(LogicExtensions = jsCommon.LogicExtensions || (jsCommon.LogicExtensions = {}));\n var JsonComparer;\n (function (JsonComparer) {\n /**\n * Performs JSON-style comparison of two objects.\n */\n function equals(x, y) {\n if (x === y)\n return true;\n return JSON.stringify(x) === JSON.stringify(y);\n }\n JsonComparer.equals = equals;\n })(JsonComparer = jsCommon.JsonComparer || (jsCommon.JsonComparer = {}));\n /**\n * Values are in terms of 'pt'\n * Convert to pixels using PixelConverter.fromPoint\n */\n var TextSizeDefaults;\n (function (TextSizeDefaults) {\n /**\n * Stored in terms of 'pt'\n * Convert to pixels using PixelConverter.fromPoint\n */\n TextSizeDefaults.TextSizeMin = 8;\n /**\n * Stored in terms of 'pt'\n * Convert to pixels using PixelConverter.fromPoint\n */\n TextSizeDefaults.TextSizeMax = 40;\n var TextSizeRange = TextSizeDefaults.TextSizeMax - TextSizeDefaults.TextSizeMin;\n /**\n * Returns the percentage of this value relative to the TextSizeMax\n * @param textSize - should be given in terms of 'pt'\n */\n function getScale(textSize) {\n return (textSize - TextSizeDefaults.TextSizeMin) / TextSizeRange;\n }\n TextSizeDefaults.getScale = getScale;\n })(TextSizeDefaults = jsCommon.TextSizeDefaults || (jsCommon.TextSizeDefaults = {}));\n var PixelConverter;\n (function (PixelConverter) {\n var PxPtRatio = 4 / 3;\n var PixelString = 'px';\n /**\n * Appends 'px' to the end of number value for use as pixel string in styles\n */\n function toString(px) {\n return px + PixelString;\n }\n PixelConverter.toString = toString;\n /**\n * Converts point value (pt) to pixels\n * Returns a string for font-size property\n * e.g. fromPoint(8) => '24px'\n */\n function fromPoint(pt) {\n return toString(fromPointToPixel(pt));\n }\n PixelConverter.fromPoint = fromPoint;\n /**\n * Converts point value (pt) to pixels\n * Returns a number for font-size property\n * e.g. fromPoint(8) => 24px\n */\n function fromPointToPixel(pt) {\n return (PxPtRatio * pt);\n }\n PixelConverter.fromPointToPixel = fromPointToPixel;\n /**\n * Converts pixel value (px) to pt\n * e.g. toPoint(24) => 8\n */\n function toPoint(px) {\n return px / PxPtRatio;\n }\n PixelConverter.toPoint = toPoint;\n })(PixelConverter = jsCommon.PixelConverter || (jsCommon.PixelConverter = {}));\n var RegExpExtensions;\n (function (RegExpExtensions) {\n /**\n * Runs exec on regex starting from 0 index\n * This is the expected behavior but RegExp actually remember\n * the last index they stopped at (found match at) and will\n * return unexpected results when run in sequence.\n * @param regex - regular expression object\n * @param value - string to search wiht regex\n * @param start - index within value to start regex\n */\n function run(regex, value, start) {\n debug.assertValue(regex, 'regex');\n regex.lastIndex = start || 0;\n return regex.exec(value);\n }\n RegExpExtensions.run = run;\n })(RegExpExtensions = jsCommon.RegExpExtensions || (jsCommon.RegExpExtensions = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar powerbi;\n(function (powerbi) {\n var visuals;\n (function (visuals) {\n var utility;\n (function (utility) {\n var StyleUtils;\n (function (StyleUtils) {\n function getRotateAngleFromElement(element) {\n var rawElemStyle = element.get(0).style;\n var transformString = rawElemStyle.transform || rawElemStyle.webkitTransform;\n if (transformString) {\n var transform = transformString.match(/rotate\\((-?\\d+(?:\\.\\d*)?)deg\\)/);\n if (transform) {\n return parseFloat(transform[1]);\n }\n }\n return 0;\n }\n StyleUtils.getRotateAngleFromElement = getRotateAngleFromElement;\n function getTranslateTransformFromElement(element) {\n var rawElemStyle = element.get(0).style;\n // IE will recognize \"webkitTransform\" as \"WebkitTransform\" and set that as style property. \n // This means transform property is not read.\n // We put the \"transform\" before the \"webkitTransform\" to counteract the weirdness of IE. \n var transformString = rawElemStyle.transform || rawElemStyle.webkitTransform;\n var retValue = { x: 0, y: 0 };\n if (transformString && transformString.length > 0) {\n var transform = transformString.match(/translate\\((-?\\d+(?:\\.\\d*)?)px, (-?\\d+(?:\\.\\d*)?)px\\)/);\n if (transform) {\n retValue.x = parseFloat(transform[1]);\n retValue.y = parseFloat(transform[2]);\n }\n }\n return retValue;\n }\n StyleUtils.getTranslateTransformFromElement = getTranslateTransformFromElement;\n function getPadding(element) {\n if (!element)\n return;\n return {\n left: parseFloat(element.css('padding-left')) || 0,\n right: parseFloat(element.css('padding-right')) || 0,\n top: parseFloat(element.css('padding-top')) || 0,\n bottom: parseFloat(element.css('padding-bottom')) || 0,\n };\n }\n StyleUtils.getPadding = getPadding;\n })(StyleUtils = utility.StyleUtils || (utility.StyleUtils = {}));\n })(utility = visuals.utility || (visuals.utility = {}));\n })(visuals = powerbi.visuals || (powerbi.visuals = {}));\n})(powerbi || (powerbi = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n var ConsoleTracer = (function () {\n function ConsoleTracer() {\n }\n ConsoleTracer.prototype.logTrace = function (trace) {\n if (DEBUG) {\n switch (trace.type) {\n case jsCommon.TraceType.Information:\n console.info(trace.toString());\n break;\n case jsCommon.TraceType.UnexpectedError:\n case jsCommon.TraceType.Error:\n case jsCommon.TraceType.Fatal:\n console.error(trace.toString());\n break;\n case jsCommon.TraceType.ExpectedError:\n case jsCommon.TraceType.Warning:\n console.warn(trace.toString());\n break;\n case jsCommon.TraceType.Verbose:\n console.log(trace.toString());\n break;\n default:\n console.log(trace.toString());\n break;\n }\n }\n };\n return ConsoleTracer;\n }());\n jsCommon.ConsoleTracer = ConsoleTracer;\n var Trace;\n (function (Trace) {\n var traceMaxCount = 1000;\n var traces = new Array(traceMaxCount);\n var lastTraceIndex = -1;\n var defaultListener = new ConsoleTracer();\n var listeners = new Array(defaultListener);\n /**\n * Trace a warning. Please ensure that no PII is being logged.\n */\n function warning(text, requestId) {\n debug.assertValue(text, 'text');\n logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Warning, requestId));\n }\n Trace.warning = warning;\n /**\n * Trace an error. Please ensure that no PII is being logged.\n */\n function error(text, includeStackTrace, requestId) {\n debug.assertValue(text, 'text');\n if (includeStackTrace)\n text = jsCommon.StringExtensions.format(\"{0}.\\nStack:\\n{1}\", text, jsCommon.getStackTrace());\n logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Error, requestId));\n }\n Trace.error = error;\n /**\n * Trace an information. Please ensure that no PII is being logged.\n */\n function verbose(text, requestId) {\n debug.assertValue(text, 'text');\n logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Verbose, requestId));\n }\n Trace.verbose = verbose;\n function addListener(listener) {\n debug.assertValue(listener, 'listener');\n listeners.push(listener);\n }\n Trace.addListener = addListener;\n function removeListener(listener) {\n debug.assertValue(listener, 'listener');\n var index = listeners.indexOf(listener);\n if (index >= 0)\n listeners.splice(index, 1);\n }\n Trace.removeListener = removeListener;\n function resetListeners() {\n listeners = new Array(defaultListener);\n }\n Trace.resetListeners = resetListeners;\n function reset() {\n lastTraceIndex = -1;\n }\n Trace.reset = reset;\n function getTraces() {\n if (lastTraceIndex < 0)\n return;\n var result = new Array(lastTraceIndex + 1);\n for (var i = 0; i <= lastTraceIndex; i++)\n result[i] = traces[i];\n return result;\n }\n Trace.getTraces = getTraces;\n /**\n * Note: Used for unit-test only.\n */\n function disableDefaultListener() {\n removeListener(defaultListener);\n }\n Trace.disableDefaultListener = disableDefaultListener;\n function enableDefaultListener() {\n addListener(defaultListener);\n }\n Trace.enableDefaultListener = enableDefaultListener;\n function logTraceInternal(trace) {\n if ((lastTraceIndex + 1) >= traceMaxCount)\n reset();\n traces[++lastTraceIndex] = trace;\n for (var i = 0, len = listeners.length; i < len; i++)\n listeners[i].logTrace(trace);\n }\n })(Trace = jsCommon.Trace || (jsCommon.Trace = {}));\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.\n */\n (function (TraceType) {\n TraceType[TraceType[\"Information\"] = 0] = \"Information\";\n TraceType[TraceType[\"Verbose\"] = 1] = \"Verbose\";\n TraceType[TraceType[\"Warning\"] = 2] = \"Warning\";\n TraceType[TraceType[\"Error\"] = 3] = \"Error\";\n TraceType[TraceType[\"ExpectedError\"] = 4] = \"ExpectedError\";\n TraceType[TraceType[\"UnexpectedError\"] = 5] = \"UnexpectedError\";\n TraceType[TraceType[\"Fatal\"] = 6] = \"Fatal\";\n })(jsCommon.TraceType || (jsCommon.TraceType = {}));\n var TraceType = jsCommon.TraceType;\n})(jsCommon || (jsCommon = {}));\n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar jsCommon;\n(function (jsCommon) {\n /**\n * JavaScript files.\n */\n var MSMapcontrol = 'https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&onscriptload=globalMapControlLoaded';\n /**\n * Map loading logic.\n */\n var MSMapcontrolLoaded = false;\n var WaitForMSMapLoad = null;\n var PowerViewPackage = {\n javaScriptFiles: [\n powerbi.build + '/externals/pv/webclient.js'\n ],\n cssFiles: [\n powerbi.build + '/externals/pv/Styles/_all.css'\n ],\n javaScriptFilesWithCallback: [\n { javascriptFile: MSMapcontrol, onLoadCallback: waitForMapControlLoaded }\n ]\n };\n function ensurePowerView(action) {\n if (action === void 0) { action = _.noop; }\n jsCommon.requires(PowerViewPackage, action);\n }\n jsCommon.ensurePowerView = ensurePowerView;\n var MapPackage = {\n javaScriptFilesWithCallback: [\n { javascriptFile: MSMapcontrol, onLoadCallback: waitForMapControlLoaded }\n ]\n };\n function ensureMap(locale, action) {\n var mapPackageWithLocale = powerbi.Prototype.inherit(MapPackage);\n if (!_.isEmpty(locale)) {\n mapPackageWithLocale.javaScriptFilesWithCallback[0].javascriptFile = MSMapcontrol.concat('&mkt=' + locale);\n }\n jsCommon.requires(mapPackageWithLocale, action);\n }\n jsCommon.ensureMap = ensureMap;\n function mapControlLoaded() {\n MSMapcontrolLoaded = true;\n if (WaitForMSMapLoad) {\n WaitForMSMapLoad.resolve();\n WaitForMSMapLoad = undefined;\n }\n }\n jsCommon.mapControlLoaded = mapControlLoaded;\n function waitForMapControlLoaded() {\n var task;\n if (!MSMapcontrolLoaded) {\n task = WaitForMSMapLoad = $.Deferred();\n }\n else {\n task = $.Deferred();\n task.resolve();\n }\n return task.promise();\n }\n jsCommon.waitForMapControlLoaded = waitForMapControlLoaded;\n})(jsCommon || (jsCommon = {}));\n/* tslint:disable:no-unused-variable */\nvar globalMapControlLoaded = function () {\n // Map requires a function in the global namespace to callback once loaded\n jsCommon.mapControlLoaded();\n};\n/* tslint:enable:no-unused-variable */ \n/*\n * Power BI Visualizations\n *\n * Copyright (c) Microsoft Corporation\n * All rights reserved.\n * MIT License\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar InJs;\n(function (InJs) {\n /**\n * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.\n */\n (function (TraceType) {\n TraceType[TraceType[\"information\"] = 0] = \"information\";\n TraceType[TraceType[\"verbose\"] = 1] = \"verbose\";\n TraceType[TraceType[\"warning\"] = 2] = \"warning\";\n TraceType[TraceType[\"error\"] = 3] = \"error\";\n TraceType[TraceType[\"expectedError\"] = 4] = \"expectedError\";\n TraceType[TraceType[\"unexpectedError\"] = 5] = \"unexpectedError\";\n TraceType[TraceType[\"fatal\"] = 6] = \"fatal\";\n })(InJs.TraceType || (InJs.TraceType = {}));\n var TraceType = InJs.TraceType;\n})(InJs || (InJs = {}));\n\n\n","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n export declare let build;\r\n} ","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n export const CategoryTypes = {\r\n Address: \"Address\",\r\n City: \"City\",\r\n Continent: \"Continent\",\r\n CountryRegion: \"Country\", // The text has to stay \"Country\" because it is used as a key in the geocoding caching dictionary\r\n County: \"County\",\r\n Longitude: \"Longitude\",\r\n Latitude: \"Latitude\",\r\n Place: \"Place\",\r\n PostalCode: \"PostalCode\",\r\n StateOrProvince: \"StateOrProvince\"\r\n };\r\n\r\n export interface IGeoTaggingAnalyzerService {\r\n isLongitudeOrLatitude(fieldRefName: string): boolean;\r\n isGeographic(fieldRefName: string): boolean;\r\n isGeocodable(fieldRefName: string): boolean;\r\n getFieldType(fieldName: string): string;\r\n isGeoshapable(fieldRefName: string): boolean;\r\n }\r\n\r\n export function createGeoTaggingAnalyzerService(getLocalized: (string) => string): IGeoTaggingAnalyzerService {\r\n return new GeoTaggingAnalyzerService(getLocalized);\r\n }\r\n\r\n const EnglishBackup = {\r\n GeotaggingString_Continent: \"continent\",\r\n GeotaggingString_Continents: \"continents\",\r\n GeotaggingString_Country: \"country\",\r\n GeotaggingString_Countries: \"countries\",\r\n GeotaggingString_State: \"state\",\r\n GeotaggingString_States: \"states\",\r\n GeotaggingString_City: \"city\",\r\n GeotaggingString_Cities: \"cities\",\r\n GeotaggingString_Town: \"town\",\r\n GeotaggingString_Towns: \"towns\",\r\n GeotaggingString_Province: \"province\",\r\n GeotaggingString_Provinces: \"provinces\",\r\n GeotaggingString_County: \"county\",\r\n GeotaggingString_Counties: \"counties\",\r\n GeotaggingString_Village: \"village\",\r\n GeotaggingString_Villages: \"villages\",\r\n GeotaggingString_Post: \"post\",\r\n GeotaggingString_Zip: \"zip\",\r\n GeotaggingString_Code: \"code\",\r\n GeotaggingString_Place: \"place\",\r\n GeotaggingString_Places: \"places\",\r\n GeotaggingString_Address: \"address\",\r\n GeotaggingString_Addresses: \"addresses\",\r\n GeotaggingString_Street: \"street\",\r\n GeotaggingString_Streets: \"streets\",\r\n GeotaggingString_Longitude: \"longitude\",\r\n GeotaggingString_Longitude_Short: \"lon\",\r\n GeotaggingString_Latitude: \"latitude\",\r\n GeotaggingString_Latitude_Short: \"lat\",\r\n GeotaggingString_PostalCode: \"postal code\",\r\n GeotaggingString_PostalCodes: \"postal codes\",\r\n GeotaggingString_ZipCode: \"zip code\",\r\n GeotaggingString_ZipCodes: \"zip codes\",\r\n GeotaggingString_Territory: \"territory\",\r\n GeotaggingString_Territories: \"territories\",\r\n GeotaggingString_VRMBackCompat_CountryRegion: \"CountryRegion\",\r\n GeotaggingString_VRMBackCompat_StateOrProvince: \"StateOrProvince\",\r\n };\r\n\r\n export class GeoTaggingAnalyzerService implements IGeoTaggingAnalyzerService {\r\n private GeotaggingString_Continent;\r\n private GeotaggingString_Continents;\r\n private GeotaggingString_Country;\r\n private GeotaggingString_Countries;\r\n private GeotaggingString_State;\r\n private GeotaggingString_States;\r\n private GeotaggingString_City;\r\n private GeotaggingString_Cities;\r\n private GeotaggingString_Town;\r\n private GeotaggingString_Towns;\r\n private GeotaggingString_Province;\r\n private GeotaggingString_Provinces;\r\n private GeotaggingString_County;\r\n private GeotaggingString_Counties;\r\n private GeotaggingString_Village;\r\n private GeotaggingString_Villages;\r\n private GeotaggingString_Post;\r\n private GeotaggingString_Zip;\r\n private GeotaggingString_Code;\r\n private GeotaggingString_Place;\r\n private GeotaggingString_Places;\r\n private GeotaggingString_Address;\r\n private GeotaggingString_Addresses;\r\n private GeotaggingString_Street;\r\n private GeotaggingString_Streets;\r\n private GeotaggingString_Longitude;\r\n private GeotaggingString_Longitude_Short;\r\n private GeotaggingString_Latitude;\r\n private GeotaggingString_Latitude_Short;\r\n private GeotaggingString_PostalCode;\r\n private GeotaggingString_PostalCodes;\r\n private GeotaggingString_ZipCode;\r\n private GeotaggingString_ZipCodes;\r\n private GeotaggingString_Territory;\r\n private GeotaggingString_Territories;\r\n private GeotaggingString_VRMBackCompat_CountryRegion = \"CountryRegion\";\r\n private GeotaggingString_VRMBackCompat_StateOrProvince = \"StateOrProvince\";\r\n\r\n constructor(getLocalized: (string) => string) {\r\n this.GeotaggingString_Continent = getLocalized(\"GeotaggingString_Continent\").toLowerCase();\r\n this.GeotaggingString_Continents = getLocalized(\"GeotaggingString_Continents\").toLowerCase();\r\n this.GeotaggingString_Country = getLocalized(\"GeotaggingString_Country\").toLowerCase();\r\n this.GeotaggingString_Countries = getLocalized(\"GeotaggingString_Countries\").toLowerCase();\r\n this.GeotaggingString_State = getLocalized(\"GeotaggingString_State\").toLowerCase();\r\n this.GeotaggingString_States = getLocalized(\"GeotaggingString_States\").toLowerCase();\r\n this.GeotaggingString_City = getLocalized(\"GeotaggingString_City\").toLowerCase();\r\n this.GeotaggingString_Cities = getLocalized(\"GeotaggingString_Cities\").toLowerCase();\r\n this.GeotaggingString_Town = getLocalized(\"GeotaggingString_Town\").toLowerCase();\r\n this.GeotaggingString_Towns = getLocalized(\"GeotaggingString_Towns\").toLowerCase();\r\n this.GeotaggingString_Province = getLocalized(\"GeotaggingString_Province\").toLowerCase();\r\n this.GeotaggingString_Provinces = getLocalized(\"GeotaggingString_Provinces\").toLowerCase();\r\n this.GeotaggingString_County = getLocalized(\"GeotaggingString_County\").toLowerCase();\r\n this.GeotaggingString_Counties = getLocalized(\"GeotaggingString_Counties\").toLowerCase();\r\n this.GeotaggingString_Village = getLocalized(\"GeotaggingString_Village\").toLowerCase();\r\n this.GeotaggingString_Villages = getLocalized(\"GeotaggingString_Villages\").toLowerCase();\r\n this.GeotaggingString_Post = getLocalized(\"GeotaggingString_Post\").toLowerCase();\r\n this.GeotaggingString_Zip = getLocalized(\"GeotaggingString_Zip\").toLowerCase();\r\n this.GeotaggingString_Code = getLocalized(\"GeotaggingString_Code\").toLowerCase();\r\n this.GeotaggingString_Place = getLocalized(\"GeotaggingString_Place\").toLowerCase();\r\n this.GeotaggingString_Places = getLocalized(\"GeotaggingString_Places\").toLowerCase();\r\n this.GeotaggingString_Address = getLocalized(\"GeotaggingString_Address\").toLowerCase();\r\n this.GeotaggingString_Addresses = getLocalized(\"GeotaggingString_Addresses\").toLowerCase();\r\n this.GeotaggingString_Street = getLocalized(\"GeotaggingString_Street\").toLowerCase();\r\n this.GeotaggingString_Streets = getLocalized(\"GeotaggingString_Streets\").toLowerCase();\r\n this.GeotaggingString_Longitude = getLocalized(\"GeotaggingString_Longitude\").toLowerCase();\r\n this.GeotaggingString_Longitude_Short = getLocalized(\"GeotaggingString_Longitude_Short\").toLowerCase();\r\n this.GeotaggingString_Latitude = getLocalized(\"GeotaggingString_Latitude\").toLowerCase();\r\n this.GeotaggingString_Latitude_Short = getLocalized(\"GeotaggingString_Latitude_Short\").toLowerCase();\r\n this.GeotaggingString_PostalCode = getLocalized(\"GeotaggingString_PostalCode\").toLowerCase();\r\n this.GeotaggingString_PostalCodes = getLocalized(\"GeotaggingString_PostalCodes\").toLowerCase();\r\n this.GeotaggingString_ZipCode = getLocalized(\"GeotaggingString_ZipCode\").toLowerCase();\r\n this.GeotaggingString_ZipCodes = getLocalized(\"GeotaggingString_ZipCodes\").toLowerCase();\r\n this.GeotaggingString_Territory = getLocalized(\"GeotaggingString_Territory\").toLowerCase();\r\n this.GeotaggingString_Territories = getLocalized(\"GeotaggingString_Territories\").toLowerCase();\r\n }\r\n\r\n public isLongitudeOrLatitude(fieldRefName: string): boolean {\r\n return this.isLongitude(fieldRefName) ||\r\n this.isLatitude(fieldRefName);\r\n }\r\n\r\n public isGeographic(fieldRefName: string): boolean {\r\n return this.isLongitudeOrLatitude(fieldRefName) ||\r\n this.isGeocodable(fieldRefName);\r\n }\r\n\r\n public isGeocodable(fieldRefName: string): boolean {\r\n return this.isAddress(fieldRefName) ||\r\n this.isCity(fieldRefName) ||\r\n this.isContinent(fieldRefName) ||\r\n this.isCountry(fieldRefName) ||\r\n this.isCounty(fieldRefName) ||\r\n this.isStateOrProvince(fieldRefName) ||\r\n this.isPlace(fieldRefName) ||\r\n this.isPostalCode(fieldRefName) ||\r\n this.isTerritory(fieldRefName);\r\n }\r\n\r\n public isGeoshapable(fieldRefName: string): boolean {\r\n return this.isCity(fieldRefName) ||\r\n this.isCountry(fieldRefName) ||\r\n this.isCounty(fieldRefName) ||\r\n this.isStateOrProvince(fieldRefName) ||\r\n this.isPostalCode(fieldRefName) ||\r\n this.isTerritory(fieldRefName) ||\r\n this.isGeoshapableEnglish(fieldRefName);\r\n }\r\n\r\n private isGeoshapableEnglish(fieldRefName: string): boolean {\r\n return this.isEnglishCity(fieldRefName) ||\r\n this.isEnglishCountry(fieldRefName) ||\r\n this.isEnglishCounty(fieldRefName) ||\r\n this.isEnglishStateOrProvince(fieldRefName) ||\r\n this.isEnglishPostalCode(fieldRefName) ||\r\n this.isEnglishTerritory(fieldRefName);\r\n }\r\n\r\n private isAddress(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_Address,\r\n this.GeotaggingString_Addresses,\r\n this.GeotaggingString_Street,\r\n this.GeotaggingString_Streets\r\n ]);\r\n }\r\n\r\n private isPlace(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_Place,\r\n this.GeotaggingString_Places\r\n ]);\r\n }\r\n\r\n private isCity(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_City,\r\n this.GeotaggingString_Cities,\r\n this.GeotaggingString_Town,\r\n this.GeotaggingString_Towns,\r\n this.GeotaggingString_Village,\r\n this.GeotaggingString_Villages\r\n ]);\r\n }\r\n\r\n private isStateOrProvince(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_State,\r\n this.GeotaggingString_States,\r\n this.GeotaggingString_Province,\r\n this.GeotaggingString_Provinces,\r\n this.GeotaggingString_VRMBackCompat_StateOrProvince,\r\n ]);\r\n }\r\n\r\n private isCountry(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_Country,\r\n this.GeotaggingString_Countries,\r\n this.GeotaggingString_VRMBackCompat_CountryRegion\r\n ]);\r\n }\r\n\r\n private isCounty(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_County,\r\n this.GeotaggingString_Counties\r\n ]);\r\n }\r\n\r\n private isContinent(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_Continent,\r\n this.GeotaggingString_Continents\r\n ]);\r\n }\r\n\r\n private isPostalCode(fieldRefName: string): boolean {\r\n let result =\r\n (GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_Post,\r\n this.GeotaggingString_Zip])\r\n && GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Code])) ||\r\n GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_PostalCode,\r\n this.GeotaggingString_PostalCodes,\r\n this.GeotaggingString_ZipCode,\r\n this.GeotaggingString_ZipCodes\r\n ]);\r\n\r\n //Check again for strings without whitespace\r\n if (!result) {\r\n let whiteSpaceRegex = /\\s+/;\r\n let fieldNameWithoutWhitespace = fieldRefName.replace(whiteSpaceRegex, \"\");\r\n result = GeoTaggingAnalyzerService.hasMatches(fieldNameWithoutWhitespace, [\r\n this.GeotaggingString_PostalCode.replace(whiteSpaceRegex, ''),\r\n this.GeotaggingString_PostalCodes.replace(whiteSpaceRegex, ''),\r\n this.GeotaggingString_ZipCode.replace(whiteSpaceRegex, ''),\r\n this.GeotaggingString_ZipCodes.replace(whiteSpaceRegex, '')\r\n ]);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private isLongitude(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Longitude])\r\n || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Longitude_Short], true /* useStrict */);\r\n }\r\n\r\n private isLatitude(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Latitude])\r\n || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Latitude_Short], true /* useStrict */);\r\n }\r\n\r\n private isTerritory(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n this.GeotaggingString_Territory,\r\n this.GeotaggingString_Territories\r\n ]);\r\n }\r\n\r\n private static hasMatches(fieldName: string, possibleMatches: string[], useStrict?: boolean): boolean {\r\n let nonWordRegex = /\\W/;\r\n let value = fieldName.toLowerCase();\r\n for (let i = 0, len = possibleMatches.length; i < len; i++) {\r\n let possibleMatch = possibleMatches[i].toLowerCase();\r\n if (!useStrict) {\r\n if (value.indexOf(possibleMatch) > -1)\r\n return true;\r\n }\r\n else {\r\n let indexofpossibleMatch = value.indexOf(possibleMatch);\r\n if (indexofpossibleMatch > -1) {\r\n let wordEndFlag, wordBeginFlag: boolean;\r\n wordEndFlag = wordBeginFlag = true;\r\n if (indexofpossibleMatch - 1 > 0)\r\n wordBeginFlag = nonWordRegex.test(value[indexofpossibleMatch - 1]);\r\n if (indexofpossibleMatch + possibleMatch.length < value.length)\r\n wordEndFlag = nonWordRegex.test(value[indexofpossibleMatch + possibleMatch.length]);\r\n if (wordBeginFlag && wordEndFlag)\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n public getFieldType(fieldName: string): string {\r\n if (fieldName == null)\r\n return undefined;\r\n if (this.isLatitude(fieldName))\r\n return CategoryTypes.Latitude;\r\n if (this.isLongitude(fieldName))\r\n return CategoryTypes.Longitude;\r\n if (this.isPostalCode(fieldName))\r\n return CategoryTypes.PostalCode;\r\n if (this.isAddress(fieldName))\r\n return CategoryTypes.Address;\r\n if (this.isPlace(fieldName))\r\n return CategoryTypes.Place;\r\n if (this.isCity(fieldName))\r\n return CategoryTypes.City;\r\n if (this.isCountry(fieldName))\r\n return CategoryTypes.CountryRegion;\r\n if (this.isCounty(fieldName))\r\n return CategoryTypes.County;\r\n if (this.isStateOrProvince(fieldName))\r\n return CategoryTypes.StateOrProvince;\r\n if (this.isContinent(fieldName))\r\n return CategoryTypes.Continent;\r\n return this.getEnglishFieldType(fieldName);\r\n }\r\n\r\n private isEnglishAddress(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_Address,\r\n EnglishBackup.GeotaggingString_Addresses,\r\n EnglishBackup.GeotaggingString_Street,\r\n EnglishBackup.GeotaggingString_Streets\r\n ]);\r\n }\r\n\r\n private isEnglishPlace(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_Place,\r\n EnglishBackup.GeotaggingString_Places\r\n ]);\r\n }\r\n\r\n private isEnglishCity(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_City,\r\n EnglishBackup.GeotaggingString_Cities,\r\n EnglishBackup.GeotaggingString_Town,\r\n EnglishBackup.GeotaggingString_Towns,\r\n EnglishBackup.GeotaggingString_Village,\r\n EnglishBackup.GeotaggingString_Villages\r\n ]);\r\n }\r\n\r\n private isEnglishStateOrProvince(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_State,\r\n EnglishBackup.GeotaggingString_States,\r\n EnglishBackup.GeotaggingString_Province,\r\n EnglishBackup.GeotaggingString_Provinces,\r\n EnglishBackup.GeotaggingString_VRMBackCompat_StateOrProvince,\r\n ]);\r\n }\r\n\r\n private isEnglishCountry(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_Country,\r\n EnglishBackup.GeotaggingString_Countries,\r\n EnglishBackup.GeotaggingString_VRMBackCompat_CountryRegion\r\n ]);\r\n }\r\n\r\n private isEnglishCounty(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_County,\r\n EnglishBackup.GeotaggingString_Counties\r\n ]);\r\n }\r\n\r\n private isEnglishContinent(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_Continent,\r\n EnglishBackup.GeotaggingString_Continents\r\n ]);\r\n }\r\n\r\n private isEnglishPostalCode(fieldRefName: string): boolean {\r\n let result =\r\n (GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_Post,\r\n EnglishBackup.GeotaggingString_Zip])\r\n && GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Code])) ||\r\n GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_PostalCode,\r\n EnglishBackup.GeotaggingString_PostalCodes,\r\n EnglishBackup.GeotaggingString_ZipCode,\r\n EnglishBackup.GeotaggingString_ZipCodes\r\n ]);\r\n\r\n //Check again for strings without whitespace\r\n if (!result) {\r\n let whiteSpaceRegexPattern = new RegExp('\\s');\r\n result = GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_PostalCode.replace(whiteSpaceRegexPattern, ''),\r\n EnglishBackup.GeotaggingString_PostalCodes.replace(whiteSpaceRegexPattern, ''),\r\n EnglishBackup.GeotaggingString_ZipCode.replace(whiteSpaceRegexPattern, ''),\r\n EnglishBackup.GeotaggingString_ZipCodes.replace(whiteSpaceRegexPattern, '')\r\n ]);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private isEnglishLongitude(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Longitude])\r\n || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Longitude_Short], true /* useStrict */);\r\n }\r\n\r\n private isEnglishLatitude(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Latitude])\r\n || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Latitude_Short], true /* useStrict */);\r\n }\r\n\r\n protected isEnglishTerritory(fieldRefName: string): boolean {\r\n return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [\r\n EnglishBackup.GeotaggingString_Territory,\r\n EnglishBackup.GeotaggingString_Territories\r\n ]);\r\n }\r\n\r\n private getEnglishFieldType(fieldName: string): string {\r\n if (fieldName == null)\r\n return undefined;\r\n if (this.isEnglishLatitude(fieldName))\r\n return CategoryTypes.Latitude;\r\n if (this.isEnglishLongitude(fieldName))\r\n return CategoryTypes.Longitude;\r\n if (this.isEnglishPostalCode(fieldName))\r\n return CategoryTypes.PostalCode;\r\n if (this.isEnglishAddress(fieldName))\r\n return CategoryTypes.Address;\r\n if (this.isEnglishPlace(fieldName))\r\n return CategoryTypes.Place;\r\n if (this.isEnglishCity(fieldName))\r\n return CategoryTypes.City;\r\n if (this.isEnglishCountry(fieldName))\r\n return CategoryTypes.CountryRegion;\r\n if (this.isEnglishCounty(fieldName))\r\n return CategoryTypes.County;\r\n if (this.isEnglishStateOrProvince(fieldName))\r\n return CategoryTypes.StateOrProvince;\r\n if (this.isEnglishContinent(fieldName))\r\n return CategoryTypes.Continent;\r\n return undefined;\r\n }\r\n }\r\n} ","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\ndeclare var DEBUG: boolean;\r\n\r\nif (typeof DEBUG === 'undefined') var DEBUG = true;","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n import IStringResourceProvider = jsCommon.IStringResourceProvider;\r\n\r\n export interface ILocalizableError {\r\n getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;\r\n }\r\n\r\n export interface IClientError extends ILocalizableError {\r\n code: string;\r\n debugInfo?: string;\r\n ignorable?: boolean;\r\n requestId?: string;\r\n }\r\n\r\n export interface IClientWarning extends ILocalizableError {\r\n code: string;\r\n columnNameFromIndex: (index: number) => string;\r\n }\r\n\r\n /**\r\n this base class should be derived to give a generic error message but with a unique error code.\r\n */\r\n export abstract class UnknownClientError implements IClientError {\r\n private errorCode: string;\r\n\r\n public get code(): string {\r\n return this.errorCode;\r\n }\r\n public get ignorable(): boolean {\r\n return false;\r\n }\r\n\r\n constructor(code: string) {\r\n debug.assertValue(code, 'code');\r\n\r\n this.errorCode = code;\r\n }\r\n\r\n public getDetails(resourceProvider: IStringResourceProvider): ErrorDetails {\r\n let details: ErrorDetails = {\r\n message: resourceProvider.get('ClientError_UnknownClientErrorValue'),\r\n additionalErrorInfo: [{ errorInfoKey: resourceProvider.get('ClientError_UnknownClientErrorKey'), errorInfoValue: resourceProvider.get('ClientError_UnknownClientErrorValue'), }],\r\n };\r\n\r\n return details;\r\n }\r\n }\r\n\r\n export class HttpClientError implements IClientError {\r\n private httpRequestId: string;\r\n private httpStatusCode: number;\r\n \r\n constructor(httpStatusCode: number, requestId: string) {\r\n debug.assertValue(httpStatusCode, 'httpStatusCode');\r\n debug.assertValue(requestId, 'requestId');\r\n this.httpStatusCode = httpStatusCode;\r\n this.httpRequestId = requestId;\r\n }\r\n\r\n public get code(): string {\r\n return 'HttpClientError';\r\n }\r\n\r\n public get ignorable(): boolean {\r\n return false;\r\n }\r\n\r\n public get requestId(): string {\r\n return this.httpRequestId;\r\n }\r\n\r\n public getDetails(resourceProvider: IStringResourceProvider): ErrorDetails {\r\n // Use a general error message for a HTTP request failure, since we currently do not know of any specifc error cases at this point in time.\r\n let details: ErrorDetails = {\r\n message: null,\r\n additionalErrorInfo: [\r\n { errorInfoKey: resourceProvider.get('DsrError_Key'), errorInfoValue: resourceProvider.get('DsrError_UnknownErrorValue')},\r\n { errorInfoKey: resourceProvider.get('ClientError_HttpResponseStatusCodeKey'), errorInfoValue: this.httpStatusCode.toString() }],\r\n };\r\n\r\n return details;\r\n }\r\n }\r\n\r\n export class IgnorableClientError implements IClientError {\r\n public get code(): string {\r\n return 'IgnorableClientError';\r\n }\r\n public get ignorable(): boolean {\r\n return true;\r\n }\r\n\r\n public getDetails(resourceProvider: IStringResourceProvider): ErrorDetails {\r\n let details: ErrorDetails = {\r\n message: '',\r\n additionalErrorInfo: [],\r\n };\r\n\r\n return details;\r\n }\r\n }\r\n} ","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n export interface ArrayIdItems<T> extends Array<T> {\r\n withId(id: number): T;\r\n }\r\n\r\n export interface ArrayNamedItems<T> extends Array<T> {\r\n withName(name: string): T;\r\n }\r\n\r\n export module ArrayExtensions {\r\n /**\r\n * Returns items that exist in target and other.\r\n */\r\n export function intersect<T>(target: T[], other: T[]): T[] {\r\n let result: T[] = [];\r\n for (let i = target.length - 1; i >= 0; --i) {\r\n if (other.indexOf(target[i]) !== -1) {\r\n result.push(target[i]);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * Return elements exists in target but not exists in other.\r\n */\r\n export function diff<T>(target: T[], other: T[]): T[] {\r\n let result: T[] = [];\r\n for (let i = target.length - 1; i >= 0; --i) {\r\n let value: T = target[i];\r\n if (other.indexOf(value) === -1) {\r\n result.push(value);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /** \r\n * Return an array with only the distinct items in the source. \r\n */\r\n export function distinct<T>(source: T[]): T[] {\r\n let result: T[] = [];\r\n for (let i = 0, len = source.length; i < len; i++) {\r\n let value: T = source[i];\r\n if (result.indexOf(value) === -1) {\r\n result.push(value);\r\n }\r\n }\r\n return result;\r\n }\r\n \r\n /**\r\n * Pushes content of source onto target,\r\n * for parts of course that do not already exist in target.\r\n */\r\n export function union<T>(target: T[], source: T[]): void {\r\n for (let i = 0, len = source.length; i < len; ++i) {\r\n unionSingle(target, source[i]);\r\n }\r\n }\r\n\r\n /**\r\n * Pushes value onto target, if value does not already exist in target.\r\n */\r\n export function unionSingle<T>(target: T[], value: T): void {\r\n if (target.indexOf(value) < 0) {\r\n target.push(value);\r\n }\r\n }\r\n \r\n /**\r\n * Returns an array with a range of items from source,\r\n * including the startIndex & endIndex.\r\n */\r\n export function range<T>(source: T[], startIndex: number, endIndex: number): T[] {\r\n debug.assert(startIndex >= 0 && startIndex < source.length, 'startIndex is out of range.');\r\n debug.assert(endIndex >= 0 && endIndex < source.length, 'endIndex is out of range.');\r\n\r\n let result: T[] = [];\r\n for (let i = startIndex; i <= endIndex; ++i) {\r\n result.push(source[i]);\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * Returns an array that includes items from source, up to the specified count.\r\n */\r\n export function take<T>(source: T[], count: number): T[] {\r\n debug.assert(count >= 0, 'Count is negative.');\r\n debug.assert(count <= source.length, 'Count is too large.');\r\n\r\n let result: T[] = [];\r\n for (let i = 0; i < count; ++i) {\r\n result.push(source[i]);\r\n }\r\n return result;\r\n }\r\n\r\n export function copy<T>(source: T[]): T[] {\r\n debug.assertValue(source, 'source');\r\n\r\n return take(source, source.length);\r\n }\r\n\r\n /**\r\n * Returns a value indicating whether the arrays have the same values in the same sequence.\r\n */\r\n export function sequenceEqual<T>(left: T[], right: T[], comparison: (x: T, y: T) => boolean): boolean {\r\n debug.assertValue(comparison, 'comparison');\r\n\r\n if (left === right) {\r\n return true;\r\n }\r\n\r\n if (!!left !== !!right) {\r\n return false;\r\n }\r\n\r\n let len = left.length;\r\n if (len !== right.length) {\r\n return false;\r\n }\r\n\r\n let i = 0;\r\n while (i < len && comparison(left[i], right[i])) {\r\n ++i;\r\n }\r\n\r\n return i === len;\r\n }\r\n\r\n /**\r\n * Returns null if the specified array is empty. \r\n * Otherwise returns the specified array.\r\n */\r\n export function emptyToNull<T>(array: T[]): T[] {\r\n if (array && array.length === 0) {\r\n return null;\r\n }\r\n return array;\r\n }\r\n\r\n export function indexOf<T>(array: T[], predicate: (T) => boolean): number {\r\n debug.assertValue(array, 'array');\r\n debug.assertValue(predicate, 'predicate');\r\n\r\n for (let i = 0, len = array.length; i < len; ++i) {\r\n if (predicate(array[i])) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * Returns a copy of the array rotated by the specified offset.\r\n */\r\n export function rotate<T>(array: T[], offset: number): T[] {\r\n if (offset === 0)\r\n return array.slice();\r\n\r\n let rotated = array.slice(offset);\r\n Array.prototype.push.apply(rotated, array.slice(0, offset));\r\n\r\n return rotated;\r\n }\r\n\r\n export function createWithId<T>(): ArrayIdItems<T> {\r\n return extendWithId<T>([]);\r\n }\r\n\r\n export function extendWithId<T>(array: { id: number }[]): ArrayIdItems<T> {\r\n debug.assertValue(array, 'array');\r\n\r\n let extended: ArrayIdItems<T> = <any>array;\r\n extended.withId = withId;\r\n\r\n return extended;\r\n }\r\n\r\n /**\r\n * Finds and returns the first item with a matching ID.\r\n */\r\n export function findWithId<T>(array: T[], id: number): T {\r\n for (let i = 0, len = array.length; i < len; i++) {\r\n let item = array[i];\r\n if ((<any>item).id === id)\r\n return item;\r\n }\r\n }\r\n\r\n function withId<T>(id: number): T {\r\n return ArrayExtensions.findWithId<T>(this, id);\r\n }\r\n\r\n export function createWithName<T>(): ArrayNamedItems<T> {\r\n return extendWithName<T>([]);\r\n }\r\n\r\n export function extendWithName<T>(array: { name: string }[]): ArrayNamedItems<T> {\r\n debug.assertValue(array, 'array');\r\n\r\n let extended: ArrayNamedItems<T> = <any>array;\r\n extended.withName = withName;\r\n\r\n return extended;\r\n }\r\n\r\n export function findItemWithName<T>(array: T[], name: string): T {\r\n let index = indexWithName(array, name);\r\n if (index >= 0)\r\n return array[index];\r\n }\r\n\r\n export function indexWithName<T>(array: T[], name: string): number {\r\n for (let i = 0, len = array.length; i < len; i++) {\r\n let item = array[i];\r\n if ((<any>item).name === name)\r\n return i;\r\n }\r\n\r\n return -1;\r\n }\r\n\r\n /**\r\n * Inserts a number in sorted order into a list of numbers already in sorted order.\r\n * @returns True if the item was added, false if it already existed.\r\n */\r\n export function insertSorted(list: number[], value: number): boolean {\r\n debug.assertValue(list, 'list');\r\n debug.assertValue(value, 'value');\r\n\r\n let len = list.length;\r\n\r\n // NOTE: iterate backwards because incoming values tend to be sorted already.\r\n for (let i = len - 1; i >= 0; i--) {\r\n let diff = list[i] - value;\r\n\r\n if (diff === 0)\r\n return false;\r\n\r\n if (diff > 0)\r\n continue;\r\n\r\n // diff < 0\r\n list.splice(i + 1, 0, value);\r\n return true;\r\n }\r\n\r\n list.unshift(value);\r\n return true;\r\n }\r\n\r\n /**\r\n * Removes the first occurrence of a value from a list if it exists.\r\n * @returns True if the value was removed, false if it did not exist in the list.\r\n */\r\n export function removeFirst<T>(list: T[], value: T): boolean {\r\n let index = list.indexOf(value);\r\n if (index < 0)\r\n return false;\r\n\r\n list.splice(index, 1);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Finds and returns the first item with a matching name.\r\n */\r\n function withName<T>(name: string): T {\r\n let array: T[] = this;\r\n return findItemWithName(array, name);\r\n }\r\n\r\n /**\r\n * Deletes all items from the array.\r\n */\r\n export function clear(array: any[]): void {\r\n if (!array)\r\n return;\r\n\r\n while (array.length > 0)\r\n array.pop();\r\n }\r\n\r\n export function isUndefinedOrEmpty(array: any[]): boolean {\r\n if (!array || array.length === 0) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n export function swap<T>(array: T[], firstIndex: number, secondIndex: number): void {\r\n let temp = array[firstIndex];\r\n array[firstIndex] = array[secondIndex];\r\n array[secondIndex] = temp;\r\n }\r\n\r\n export function isInArray<T>(array: T[], lookupItem: T, compareCallback: (item1: T, item2: T) => boolean): boolean {\r\n return _.any(array, item => compareCallback(item, lookupItem));\r\n }\r\n\r\n /** Checks if the given object is an Array, and looking all the way up the prototype chain. */\r\n export function isArrayOrInheritedArray(obj: {}): obj is Array<any> {\r\n debug.assertValue(obj, 'obj');\r\n\r\n let nextPrototype = obj;\r\n while (nextPrototype != null) {\r\n if (_.isArray(nextPrototype))\r\n return true;\r\n\r\n nextPrototype = Object.getPrototypeOf(nextPrototype);\r\n }\r\n\r\n return false;\r\n }\r\n }\r\n} ","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule InJs {\r\n export module DomFactory {\r\n\r\n export function div(): JQuery {\r\n return $('<div/>');\r\n }\r\n\r\n export function span(): JQuery {\r\n return $('<span/>');\r\n }\r\n\r\n export function checkbox(): JQuery {\r\n return $('<input type=\"checkbox\"/>');\r\n }\r\n\r\n export function ul(): JQuery {\r\n return $('<ul/>');\r\n }\r\n\r\n export function li(): JQuery {\r\n return $('<li/>');\r\n }\r\n\r\n export function button(): JQuery {\r\n return $('<input type=\"button\"/>');\r\n }\r\n\r\n export function select(): JQuery {\r\n return $('<select/>');\r\n }\r\n\r\n export function textBox(): JQuery {\r\n return $('<input type=\"text\"/>');\r\n }\r\n\r\n export function img(): JQuery {\r\n return $('<img/>');\r\n }\r\n\r\n export function iframe(): JQuery {\r\n return $('<iframe/>');\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n\r\n /**\r\n * Module Double contains a set of constants and precision based utility methods \r\n * for dealing with doubles and their decimal garbage in the javascript.\r\n */\r\n export module Double {\r\n\r\n // Constants.\r\n export const MIN_VALUE = -Number.MAX_VALUE;\r\n export const MAX_VALUE = Number.MAX_VALUE;\r\n export const MIN_EXP = -308;\r\n export const MAX_EXP = 308;\r\n export const EPSILON = 1E-323;\r\n export const DEFAULT_PRECISION = 0.0001;\r\n export const DEFAULT_PRECISION_IN_DECIMAL_DIGITS = 12;\r\n export const LOG_E_10 = Math.log(10);\r\n export const POSITIVE_POWERS = [\r\n 1E0, 1E1, 1E2, 1E3, 1E4, 1E5, 1E6, 1E7, 1E8, 1E9, 1E10, 1E11, 1E12, 1E13, 1E14, 1E15, 1E16, 1E17, 1E18, 1E19, 1E20, 1E21, 1E22, 1E23, 1E24, 1E25, 1E26, 1E27, 1E28, 1E29, 1E30, 1E31, 1E32, 1E33, 1E34, 1E35, 1E36, 1E37, 1E38, 1E39, 1E40, 1E41, 1E42, 1E43, 1E44, 1E45, 1E46, 1E47, 1E48, 1E49, 1E50, 1E51, 1E52, 1E53, 1E54, 1E55, 1E56, 1E57, 1E58, 1E59, 1E60, 1E61, 1E62, 1E63, 1E64, 1E65, 1E66, 1E67, 1E68, 1E69, 1E70, 1E71, 1E72, 1E73, 1E74, 1E75, 1E76, 1E77, 1E78, 1E79, 1E80, 1E81, 1E82, 1E83, 1E84, 1E85, 1E86, 1E87, 1E88, 1E89, 1E90, 1E91, 1E92, 1E93, 1E94, 1E95, 1E96, 1E97, 1E98, 1E99,\r\n 1E100, 1E101, 1E102, 1E103, 1E104, 1E105, 1E106, 1E107, 1E108, 1E109, 1E110, 1E111, 1E112, 1E113, 1E114, 1E115, 1E116, 1E117, 1E118, 1E119, 1E120, 1E121, 1E122, 1E123, 1E124, 1E125, 1E126, 1E127, 1E128, 1E129, 1E130, 1E131, 1E132, 1E133, 1E134, 1E135, 1E136, 1E137, 1E138, 1E139, 1E140, 1E141, 1E142, 1E143, 1E144, 1E145, 1E146, 1E147, 1E148, 1E149, 1E150, 1E151, 1E152, 1E153, 1E154, 1E155, 1E156, 1E157, 1E158, 1E159, 1E160, 1E161, 1E162, 1E163, 1E164, 1E165, 1E166, 1E167, 1E168, 1E169, 1E170, 1E171, 1E172, 1E173, 1E174, 1E175, 1E176, 1E177, 1E178, 1E179, 1E180, 1E181, 1E182, 1E183, 1E184, 1E185, 1E186, 1E187, 1E188, 1E189, 1E190, 1E191, 1E192, 1E193, 1E194, 1E195, 1E196, 1E197, 1E198, 1E199,\r\n 1E200, 1E201, 1E202, 1E203, 1E204, 1E205, 1E206, 1E207, 1E208, 1E209, 1E210, 1E211, 1E212, 1E213, 1E214, 1E215, 1E216, 1E217, 1E218, 1E219, 1E220, 1E221, 1E222, 1E223, 1E224, 1E225, 1E226, 1E227, 1E228, 1E229, 1E230, 1E231, 1E232, 1E233, 1E234, 1E235, 1E236, 1E237, 1E238, 1E239, 1E240, 1E241, 1E242, 1E243, 1E244, 1E245, 1E246, 1E247, 1E248, 1E249, 1E250, 1E251, 1E252, 1E253, 1E254, 1E255, 1E256, 1E257, 1E258, 1E259, 1E260, 1E261, 1E262, 1E263, 1E264, 1E265, 1E266, 1E267, 1E268, 1E269, 1E270, 1E271, 1E272, 1E273, 1E274, 1E275, 1E276, 1E277, 1E278, 1E279, 1E280, 1E281, 1E282, 1E283, 1E284, 1E285, 1E286, 1E287, 1E288, 1E289, 1E290, 1E291, 1E292, 1E293, 1E294, 1E295, 1E296, 1E297, 1E298, 1E299,\r\n 1E300, 1E301, 1E302, 1E303, 1E304, 1E305, 1E306, 1E307, 1E308];\r\n export const NEGATIVE_POWERS = [\r\n 1E0, 1E-1, 1E-2, 1E-3, 1E-4, 1E-5, 1E-6, 1E-7, 1E-8, 1E-9, 1E-10, 1E-11, 1E-12, 1E-13, 1E-14, 1E-15, 1E-16, 1E-17, 1E-18, 1E-19, 1E-20, 1E-21, 1E-22, 1E-23, 1E-24, 1E-25, 1E-26, 1E-27, 1E-28, 1E-29, 1E-30, 1E-31, 1E-32, 1E-33, 1E-34, 1E-35, 1E-36, 1E-37, 1E-38, 1E-39, 1E-40, 1E-41, 1E-42, 1E-43, 1E-44, 1E-45, 1E-46, 1E-47, 1E-48, 1E-49, 1E-50, 1E-51, 1E-52, 1E-53, 1E-54, 1E-55, 1E-56, 1E-57, 1E-58, 1E-59, 1E-60, 1E-61, 1E-62, 1E-63, 1E-64, 1E-65, 1E-66, 1E-67, 1E-68, 1E-69, 1E-70, 1E-71, 1E-72, 1E-73, 1E-74, 1E-75, 1E-76, 1E-77, 1E-78, 1E-79, 1E-80, 1E-81, 1E-82, 1E-83, 1E-84, 1E-85, 1E-86, 1E-87, 1E-88, 1E-89, 1E-90, 1E-91, 1E-92, 1E-93, 1E-94, 1E-95, 1E-96, 1E-97, 1E-98, 1E-99,\r\n 1E-100, 1E-101, 1E-102, 1E-103, 1E-104, 1E-105, 1E-106, 1E-107, 1E-108, 1E-109, 1E-110, 1E-111, 1E-112, 1E-113, 1E-114, 1E-115, 1E-116, 1E-117, 1E-118, 1E-119, 1E-120, 1E-121, 1E-122, 1E-123, 1E-124, 1E-125, 1E-126, 1E-127, 1E-128, 1E-129, 1E-130, 1E-131, 1E-132, 1E-133, 1E-134, 1E-135, 1E-136, 1E-137, 1E-138, 1E-139, 1E-140, 1E-141, 1E-142, 1E-143, 1E-144, 1E-145, 1E-146, 1E-147, 1E-148, 1E-149, 1E-150, 1E-151, 1E-152, 1E-153, 1E-154, 1E-155, 1E-156, 1E-157, 1E-158, 1E-159, 1E-160, 1E-161, 1E-162, 1E-163, 1E-164, 1E-165, 1E-166, 1E-167, 1E-168, 1E-169, 1E-170, 1E-171, 1E-172, 1E-173, 1E-174, 1E-175, 1E-176, 1E-177, 1E-178, 1E-179, 1E-180, 1E-181, 1E-182, 1E-183, 1E-184, 1E-185, 1E-186, 1E-187, 1E-188, 1E-189, 1E-190, 1E-191, 1E-192, 1E-193, 1E-194, 1E-195, 1E-196, 1E-197, 1E-198, 1E-199,\r\n 1E-200, 1E-201, 1E-202, 1E-203, 1E-204, 1E-205, 1E-206, 1E-207, 1E-208, 1E-209, 1E-210, 1E-211, 1E-212, 1E-213, 1E-214, 1E-215, 1E-216, 1E-217, 1E-218, 1E-219, 1E-220, 1E-221, 1E-222, 1E-223, 1E-224, 1E-225, 1E-226, 1E-227, 1E-228, 1E-229, 1E-230, 1E-231, 1E-232, 1E-233, 1E-234, 1E-235, 1E-236, 1E-237, 1E-238, 1E-239, 1E-240, 1E-241, 1E-242, 1E-243, 1E-244, 1E-245, 1E-246, 1E-247, 1E-248, 1E-249, 1E-250, 1E-251, 1E-252, 1E-253, 1E-254, 1E-255, 1E-256, 1E-257, 1E-258, 1E-259, 1E-260, 1E-261, 1E-262, 1E-263, 1E-264, 1E-265, 1E-266, 1E-267, 1E-268, 1E-269, 1E-270, 1E-271, 1E-272, 1E-273, 1E-274, 1E-275, 1E-276, 1E-277, 1E-278, 1E-279, 1E-280, 1E-281, 1E-282, 1E-283, 1E-284, 1E-285, 1E-286, 1E-287, 1E-288, 1E-289, 1E-290, 1E-291, 1E-292, 1E-293, 1E-294, 1E-295, 1E-296, 1E-297, 1E-298, 1E-299,\r\n 1E-300, 1E-301, 1E-302, 1E-303, 1E-304, 1E-305, 1E-306, 1E-307, 1E-308, 1E-309, 1E-310, 1E-311, 1E-312, 1E-313, 1E-314, 1E-315, 1E-316, 1E-317, 1E-318, 1E-319, 1E-320, 1E-321, 1E-322, 1E-323, 1E-324];\r\n\r\n /**\r\n * Returns powers of 10. \r\n * Unlike the Math.pow this function produces no decimal garbage.\r\n * @param exp Exponent.\r\n */\r\n export function pow10(exp: number): number {\r\n debug.assertValue(exp, \"exp\");\r\n\r\n // Positive & zero\r\n if (exp >= 0) {\r\n if (exp < Double.POSITIVE_POWERS.length) {\r\n return Double.POSITIVE_POWERS[exp];\r\n } else {\r\n return Infinity;\r\n }\r\n }\r\n // Negative\r\n exp = -exp;\r\n if (exp > 0 && exp < Double.NEGATIVE_POWERS.length) { // if exp==int.MIN_VALUE then changing the sign will overflow and keep the number negative - we need to check for exp > 0 to filter out this corner case\r\n return Double.NEGATIVE_POWERS[exp];\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /** \r\n * Returns the 10 base logarithm of the number.\r\n * Unlike Math.log function this produces integer results with no decimal garbage.\r\n * @param val Positive value or zero.\r\n */\r\n export function log10(val: number): number {\r\n debug.assert(val >= 0, \"val\");\r\n\r\n // Fast Log10() algorithm \r\n if (val > 1 && val < 1E16) {\r\n if (val < 1E8) {\r\n if (val < 1E4) {\r\n if (val < 1E2) {\r\n if (val < 1E1) {\r\n return 0;\r\n } else {\r\n return 1;\r\n }\r\n } else {\r\n if (val < 1E3) {\r\n return 2;\r\n } else {\r\n return 3;\r\n }\r\n }\r\n } else {\r\n if (val < 1E6) {\r\n if (val < 1E5) {\r\n return 4;\r\n } else {\r\n return 5;\r\n }\r\n } else {\r\n if (val < 1E7) {\r\n return 6;\r\n } else {\r\n return 7;\r\n }\r\n }\r\n }\r\n } else {\r\n if (val < 1E12) {\r\n if (val < 1E10) {\r\n if (val < 1E9) {\r\n return 8;\r\n } else {\r\n return 9;\r\n }\r\n } else {\r\n if (val < 1E11) {\r\n return 10;\r\n } else {\r\n return 11;\r\n }\r\n }\r\n } else {\r\n if (val < 1E14) {\r\n if (val < 1E13) {\r\n return 12;\r\n } else {\r\n return 13;\r\n }\r\n } else {\r\n if (val < 1E15) {\r\n return 14;\r\n } else {\r\n return 15;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (val > 1E-16 && val < 1) {\r\n if (val < 1E-8) {\r\n if (val < 1E-12) {\r\n if (val < 1E-14) {\r\n if (val < 1E-15) {\r\n return -16;\r\n } else {\r\n return -15;\r\n }\r\n } else {\r\n if (val < 1E-13) {\r\n return -14;\r\n } else {\r\n return -13;\r\n }\r\n }\r\n } else {\r\n if (val < 1E-10) {\r\n if (val < 1E-11) {\r\n return -12;\r\n } else {\r\n return -11;\r\n }\r\n } else {\r\n if (val < 1E-9) {\r\n return -10;\r\n } else {\r\n return -9;\r\n }\r\n }\r\n }\r\n } else {\r\n if (val < 1E-4) {\r\n if (val < 1E-6) {\r\n if (val < 1E-7) {\r\n return -8;\r\n } else {\r\n return -7;\r\n }\r\n } else {\r\n if (val < 1E-5) {\r\n return -6;\r\n } else {\r\n return -5;\r\n }\r\n }\r\n } else {\r\n if (val < 1E-2) {\r\n if (val < 1E-3) {\r\n return -4;\r\n } else {\r\n return -3;\r\n }\r\n } else {\r\n if (val < 1E-1) {\r\n return -2;\r\n } else {\r\n return -1;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // JS Math provides only natural log function so we need to calc the 10 base logarithm:\r\n // logb(x) = logk(x)/logk(b); \r\n let log10 = Math.log(val) / Double.LOG_E_10;\r\n return Double.floorWithPrecision(log10);\r\n }\r\n\r\n /**\r\n * Returns a power of 10 representing precision of the number based on the number of meaningful decimal digits. \r\n * For example the precision of 56,263.3767 with the 6 meaningful decimal digit is 0.1.\r\n * @param x Value.\r\n * @param decimalDigits How many decimal digits are meaningfull.\r\n */\r\n export function getPrecision(x: number, decimalDigits?: number): number {\r\n if (decimalDigits === undefined) {\r\n decimalDigits = Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS;\r\n } else {\r\n debug.assert(decimalDigits >= 0, \"decimalDigits\");\r\n }\r\n if (!x) {\r\n return undefined;\r\n }\r\n\r\n let exp = Double.log10(Math.abs(x));\r\n\r\n if (exp < Double.MIN_EXP) {\r\n return 0;\r\n }\r\n let precisionExp = Math.max(exp - decimalDigits, -Double.NEGATIVE_POWERS.length + 1);\r\n return Double.pow10(precisionExp);\r\n }\r\n\r\n /** \r\n * Checks if a delta between 2 numbers is less than provided precision.\r\n * @param x One value.\r\n * @param y Another value.\r\n * @param precision Precision value.\r\n */\r\n export function equalWithPrecision(x: number, y: number, precision?: number): boolean {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n\r\n return x === y || Math.abs(x - y) < precision;\r\n }\r\n\r\n /** \r\n * Checks if a first value is less than another taking \r\n * into account the loose precision based equality.\r\n * @param x One value.\r\n * @param y Another value.\r\n * @param precision Precision value.\r\n */\r\n export function lessWithPrecision(x: number, y: number, precision?: number): boolean {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n\r\n return x < y && Math.abs(x - y) > precision;\r\n }\r\n\r\n /** \r\n * Checks if a first value is less or equal than another taking \r\n * into account the loose precision based equality.\r\n * @param x One value.\r\n * @param y Another value.\r\n * @param precision Precision value.\r\n */\r\n export function lessOrEqualWithPrecision(x: number, y: number, precision?: number): boolean {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n\r\n return x < y || Math.abs(x - y) < precision;\r\n }\r\n\r\n /** \r\n * Checks if a first value is greater than another taking \r\n * into account the loose precision based equality.\r\n * @param x One value.\r\n * @param y Another value.\r\n * @param precision Precision value.\r\n */\r\n export function greaterWithPrecision(x: number, y: number, precision?: number): boolean {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n\r\n return x > y && Math.abs(x - y) > precision;\r\n }\r\n\r\n /** \r\n * Checks if a first value is greater or equal to another taking \r\n * into account the loose precision based equality.\r\n * @param x One value.\r\n * @param y Another value.\r\n * @param precision Precision value.\r\n */\r\n export function greaterOrEqualWithPrecision(x: number, y: number, precision?: number): boolean {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n\r\n return x > y || Math.abs(x - y) < precision;\r\n }\r\n\r\n /** \r\n * Floors the number unless it's withing the precision distance from the higher int.\r\n * @param x One value.\r\n * @param precision Precision value.\r\n */\r\n export function floorWithPrecision(x: number, precision?: number): number {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n\r\n let roundX = Math.round(x);\r\n if (Math.abs(x - roundX) < precision) {\r\n return roundX;\r\n } else {\r\n return Math.floor(x);\r\n }\r\n }\r\n\r\n /** \r\n * Ceils the number unless it's withing the precision distance from the lower int.\r\n * @param x One value.\r\n * @param precision Precision value.\r\n */\r\n export function ceilWithPrecision(x: number, precision?: number): number {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n\r\n let roundX = Math.round(x);\r\n if (Math.abs(x - roundX) < precision) {\r\n return roundX;\r\n } else {\r\n return Math.ceil(x);\r\n }\r\n }\r\n\r\n /** \r\n * Floors the number to the provided precision.\r\n * For example 234,578 floored to 1,000 precision is 234,000.\r\n * @param x One value.\r\n * @param precision Precision value.\r\n */\r\n export function floorToPrecision(x: number, precision?: number): number {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n if (precision === 0 || x === 0) {\r\n return x;\r\n }\r\n //Precision must be a Power of 10\r\n return Math.floor(x / precision) * precision;\r\n }\r\n\r\n /** \r\n * Ceils the number to the provided precision.\r\n * For example 234,578 floored to 1,000 precision is 235,000.\r\n * @param x One value.\r\n * @param precision Precision value.\r\n */\r\n export function ceilToPrecision(x: number, precision?: number): number {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n if (precision === 0 || x === 0) {\r\n return x;\r\n }\r\n //Precision must be a Power of 10\r\n return Math.ceil(x / precision) * precision;\r\n }\r\n\r\n /** \r\n * Rounds the number to the provided precision. \r\n * For example 234,578 floored to 1,000 precision is 235,000.\r\n * @param x One value.\r\n * @param precision Precision value.\r\n */\r\n export function roundToPrecision(x: number, precision?: number): number {\r\n precision = applyDefault(precision, Double.DEFAULT_PRECISION);\r\n debug.assert(precision >= 0, \"precision\");\r\n if (precision === 0 || x === 0) {\r\n return x;\r\n } \r\n //Precision must be a Power of 10\r\n let result = Math.round(x / precision) * precision;\r\n let decimalDigits = Math.round(Double.log10(Math.abs(x)) - Double.log10(precision)) + 1;\r\n if (decimalDigits > 0 && decimalDigits < 16) {\r\n result = parseFloat(result.toPrecision(decimalDigits));\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /** \r\n * Returns the value making sure that it's restricted to the provided range.\r\n * @param x One value.\r\n * @param min Range min boundary.\r\n * @param max Range max boundary.\r\n */\r\n export function ensureInRange(x: number, min: number, max: number): number {\r\n debug.assert(min <= max, \"min must be less or equal to max\");\r\n if (x === undefined || x === null) {\r\n return x;\r\n }\r\n if (x < min) {\r\n return min;\r\n }\r\n if (x > max) {\r\n return max;\r\n }\r\n return x;\r\n }\r\n\r\n /** \r\n * Rounds the value - this method is actually faster than Math.round - used in the graphics utils.\r\n * @param x Value to round.\r\n */\r\n export function round(x: number): number {\r\n debug.assert(x >= 0, \"x must be greater or equal to 0\");\r\n\r\n return (0.5 + x) << 0;\r\n }\r\n\r\n /** \r\n * Projects the value from the source range into the target range.\r\n * @param value Value to project.\r\n * @param fromMin Minimum of the source range.\r\n * @param toMin Minimum of the target range.\r\n * @param toMax Maximum of the target range.\r\n */\r\n export function project(value: number, fromMin: number, fromSize: number, toMin: number, toSize: number): number {\r\n if (fromSize === 0 || toSize === 0) {\r\n if (fromMin <= value && value <= fromMin + fromSize) {\r\n return toMin;\r\n } else {\r\n return NaN;\r\n }\r\n }\r\n let relativeX = (value - fromMin) / fromSize;\r\n let projectedX = toMin + relativeX * toSize;\r\n return projectedX;\r\n }\r\n\r\n /** \r\n * Removes decimal noise.\r\n * @param value Value to be processed.\r\n */\r\n export function removeDecimalNoise(value: number): number {\r\n return roundToPrecision(value, getPrecision(value));\r\n }\r\n\r\n /** \r\n * Checks whether the number is integer.\r\n * @param value Value to be checked.\r\n */\r\n export function isInteger(value: number): boolean {\r\n return value !== null && value % 1 === 0;\r\n }\r\n\r\n /**\r\n * Dividing by increment will give us count of increments\r\n * Round out the rough edges into even integer\r\n * Multiply back by increment to get rounded value\r\n * e.g. Rounder.toIncrement(0.647291, 0.05) => 0.65\r\n * @param value - value to round to nearest increment\r\n * @param increment - smallest increment to round toward\r\n */\r\n export function toIncrement(value: number, increment: number): number {\r\n return Math.round(value / increment) * increment;\r\n }\r\n }\r\n\r\n function applyDefault(value: number, defaultValue: number): number {\r\n return value !== undefined ? value : defaultValue;\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n import Double = powerbi.Double;\r\n\r\n export module Color {\r\n export function rotate(rgbString: string, rotateFactor: number): string {\r\n if (rotateFactor === 0)\r\n return rgbString;\r\n\r\n let originalRgb = parseColorString(rgbString);\r\n let originalHsv = rgbToHsv(originalRgb);\r\n let rotatedHsv = rotateHsv(originalHsv, rotateFactor);\r\n let rotatedRgb = hsvToRgb(rotatedHsv);\r\n return hexString(rotatedRgb);\r\n }\r\n\r\n export function normalizeToHexString(color: string): string {\r\n let rgb = parseColorString(color);\r\n return hexString(rgb);\r\n }\r\n\r\n export function parseColorString(color: string): RgbColor {\r\n debug.assertValue(color, 'color');\r\n\r\n if (color.indexOf('#') >= 0) {\r\n if (color.length === 7) {\r\n // #RRGGBB\r\n let result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(color);\r\n if (result == null || result.length < 4)\r\n return;\r\n\r\n return {\r\n R: parseInt(result[1], 16),\r\n G: parseInt(result[2], 16),\r\n B: parseInt(result[3], 16),\r\n };\r\n } else if (color.length === 4) {\r\n // #RGB\r\n let result = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i.exec(color);\r\n if (result == null || result.length < 4)\r\n return;\r\n\r\n return {\r\n R: parseInt(result[1] + result[1], 16),\r\n G: parseInt(result[2] + result[2], 16),\r\n B: parseInt(result[3] + result[3], 16),\r\n };\r\n }\r\n }\r\n else if (color.indexOf('rgb(') >= 0) {\r\n // rgb(R, G, B)\r\n let result = /^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/.exec(color);\r\n if (result == null || result.length < 4)\r\n return;\r\n\r\n return {\r\n R: parseInt(result[1], 10),\r\n G: parseInt(result[2], 10),\r\n B: parseInt(result[3], 10),\r\n };\r\n }\r\n else if (color.indexOf('rgba(') >= 0) {\r\n // rgba(R, G, B, A)\r\n let result = /^rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*(\\d*(?:\\.\\d+)?)\\)$/.exec(color);\r\n if (result == null || result.length < 5)\r\n return;\r\n\r\n return {\r\n R: parseInt(result[1], 10),\r\n G: parseInt(result[2], 10),\r\n B: parseInt(result[3], 10),\r\n A: parseFloat(result[4]),\r\n };\r\n }\r\n }\r\n\r\n function rgbToHsv(rgbColor: RgbColor): HsvColor {\r\n let s, h;\r\n let r = rgbColor.R / 255,\r\n g = rgbColor.G / 255,\r\n b = rgbColor.B / 255;\r\n\r\n let min = Math.min(r, Math.min(g, b));\r\n let max = Math.max(r, Math.max(g, b));\r\n\r\n let v = max;\r\n let delta = max - min;\r\n if (max === 0 || delta === 0) {\r\n // R, G, and B must be 0.0, or all the same.\r\n // In this case, S is 0.0, and H is undefined.\r\n // Using H = 0.0 is as good as any...\r\n s = 0;\r\n h = 0;\r\n }\r\n else {\r\n s = delta / max;\r\n if (r === max) {\r\n // Between Yellow and Magenta\r\n h = (g - b) / delta;\r\n }\r\n else if (g === max) {\r\n // Between Cyan and Yellow\r\n h = 2 + (b - r) / delta;\r\n }\r\n else {\r\n // Between Magenta and Cyan\r\n h = 4 + (r - g) / delta;\r\n }\r\n }\r\n\r\n // Scale h to be between 0.0 and 1.\r\n // This may require adding 1, if the value\r\n // is negative.\r\n h /= 6;\r\n if (h < 0) {\r\n h += 1;\r\n }\r\n\r\n return {\r\n H: h,\r\n S: s,\r\n V: v,\r\n };\r\n }\r\n\r\n function hsvToRgb(hsvColor: HsvColor): RgbColor {\r\n let r, g, b;\r\n let h = hsvColor.H,\r\n s = hsvColor.S,\r\n v = hsvColor.V;\r\n\r\n if (s === 0) {\r\n // If s is 0, all colors are the same.\r\n // This is some flavor of gray.\r\n r = v;\r\n g = v;\r\n b = v;\r\n }\r\n else {\r\n let p, q, t, fractionalSector, sectorNumber, sectorPos;\r\n\r\n // The color wheel consists of 6 sectors.\r\n // Figure out which sector you//re in.\r\n sectorPos = h * 6;\r\n sectorNumber = Math.floor(sectorPos);\r\n\r\n // get the fractional part of the sector.\r\n // That is, how many degrees into the sector\r\n // are you?\r\n fractionalSector = sectorPos - sectorNumber;\r\n\r\n // Calculate values for the three axes\r\n // of the color.\r\n p = v * (1.0 - s);\r\n q = v * (1.0 - (s * fractionalSector));\r\n t = v * (1.0 - (s * (1 - fractionalSector)));\r\n\r\n // Assign the fractional colors to r, g, and b\r\n // based on the sector the angle is in.\r\n switch (sectorNumber) {\r\n case 0:\r\n r = v;\r\n g = t;\r\n b = p;\r\n break;\r\n\r\n case 1:\r\n r = q;\r\n g = v;\r\n b = p;\r\n break;\r\n\r\n case 2:\r\n r = p;\r\n g = v;\r\n b = t;\r\n break;\r\n\r\n case 3:\r\n r = p;\r\n g = q;\r\n b = v;\r\n break;\r\n\r\n case 4:\r\n r = t;\r\n g = p;\r\n b = v;\r\n break;\r\n\r\n case 5:\r\n r = v;\r\n g = p;\r\n b = q;\r\n break;\r\n }\r\n }\r\n\r\n return {\r\n R: Math.floor(r * 255),\r\n G: Math.floor(g * 255),\r\n B: Math.floor(b * 255),\r\n };\r\n }\r\n\r\n function rotateHsv(hsvColor: HsvColor, rotateFactor: number): HsvColor {\r\n let newH = hsvColor.H + rotateFactor;\r\n\r\n return {\r\n H: newH > 1 ? newH - 1 : newH,\r\n S: hsvColor.S,\r\n V: hsvColor.V,\r\n };\r\n }\r\n\r\n export function darken(color: RgbColor, diff: number): RgbColor {\r\n let flooredNumber = Math.floor(diff);\r\n return {\r\n R: Math.max(0, color.R - flooredNumber),\r\n G: Math.max(0, color.G - flooredNumber),\r\n B: Math.max(0, color.B - flooredNumber),\r\n };\r\n }\r\n\r\n export function rgbString(color: RgbColor): string {\r\n if (color.A == null)\r\n return \"rgb(\" + color.R + \",\" + color.G + \",\" + color.B + \")\";\r\n return \"rgba(\" + color.R + \",\" + color.G + \",\" + color.B + \",\" + color.A + \")\";\r\n }\r\n\r\n export function hexString(color: RgbColor): string {\r\n return \"#\" + componentToHex(color.R) + componentToHex(color.G) + componentToHex(color.B);\r\n }\r\n\r\n function componentToHex(hexComponent: number): string {\r\n let clamped = Double.ensureInRange(hexComponent, 0, 255);\r\n let hex = clamped.toString(16).toUpperCase();\r\n return hex.length === 1 ? \"0\" + hex : hex;\r\n }\r\n\r\n export interface RgbColor {\r\n R: number;\r\n G: number;\r\n B: number;\r\n A?: number;\r\n }\r\n\r\n interface HsvColor {\r\n H: number;\r\n S: number;\r\n V: number;\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n /**\r\n * CSS constants.\r\n */\r\n export module CssConstants {\r\n export interface ClassAndSelector {\r\n class: string;\r\n selector: string;\r\n }\r\n\r\n export function createClassAndSelector(className: string): ClassAndSelector {\r\n return {\r\n class: className,\r\n selector: '.' + className,\r\n };\r\n }\r\n\r\n export const styleAttribute = 'style';\r\n export const pixelUnits = 'px';\r\n\r\n export const heightProperty = 'height';\r\n export const widthProperty = 'width';\r\n export const topProperty = 'top';\r\n export const bottomProperty = 'bottom';\r\n export const leftProperty = 'left';\r\n export const rightProperty = 'right';\r\n export const marginTopProperty = 'margin-top';\r\n export const marginLeftProperty = 'margin-left';\r\n export const displayProperty = 'display';\r\n export const backgroundProperty = 'background';\r\n export const backgroundColorProperty = 'background-color';\r\n export const backgroundRepeatProperty = 'background-repeat';\r\n export const backgroundSizeProperty = 'background-size';\r\n export const backgroundImageProperty = 'background-image';\r\n export const textShadowProperty = 'text-shadow';\r\n export const textAlignProperty = 'text-align';\r\n export const borderTopWidthProperty = 'border-top-width';\r\n export const borderBottomWidthProperty = 'border-bottom-width';\r\n export const borderLeftWidthProperty = 'border-left-width';\r\n export const borderRightWidthProperty = 'border-right-width';\r\n export const fontSizeProperty = 'font-size';\r\n export const fontWeightProperty = 'font-weight';\r\n export const colorProperty = 'color';\r\n export const opacityProperty = 'opacity';\r\n export const paddingLeftProperty = 'padding-left';\r\n export const paddingRightProperty = 'padding-right';\r\n export const positionProperty = 'position';\r\n export const maxWidthProperty = 'max-width';\r\n export const minWidthProperty = 'min-width';\r\n export const overflowProperty = 'overflow';\r\n export const overflowXProperty = 'overflow-x';\r\n export const overflowYProperty = 'overflow-y';\r\n export const transformProperty = 'transform';\r\n export const webkitTransformProperty = '-webkit-transform';\r\n export const cursorProperty = 'cursor';\r\n export const visibilityProperty = 'visibility';\r\n\r\n export const absoluteValue = 'absolute';\r\n export const zeroPixelValue = '0px';\r\n export const autoValue = 'auto';\r\n export const hiddenValue = 'hidden';\r\n export const noneValue = 'none';\r\n export const blockValue = 'block';\r\n export const inlineBlockValue = 'inline-block';\r\n export const transparentValue = 'transparent';\r\n export const boldValue = 'bold';\r\n export const visibleValue = 'visible';\r\n export const tableRowValue = 'table-row';\r\n export const coverValue = 'cover';\r\n export const pointerValue = 'pointer';\r\n export const scrollValue = 'scroll';\r\n }\r\n\r\n export interface ExtendedCSSProperties extends CSSStyleDeclaration {\r\n scrollbarShadowColor: string;\r\n scrollbarHighlightColor: string;\r\n layoutGridChar: string;\r\n layoutGridType: string;\r\n textAutospace: string;\r\n textKashidaSpace: string;\r\n writingMode: string;\r\n scrollbarFaceColor: string;\r\n backgroundPositionY: string;\r\n lineBreak: string;\r\n imeMode: string;\r\n msBlockProgression: string;\r\n layoutGridLine: string;\r\n scrollbarBaseColor: string;\r\n layoutGrid: string;\r\n layoutFlow: string;\r\n textKashida: string;\r\n filter: string;\r\n zoom: string;\r\n scrollbarArrowColor: string;\r\n behavior: string;\r\n backgroundPositionX: string;\r\n accelerator: string;\r\n layoutGridMode: string;\r\n textJustifyTrim: string;\r\n scrollbar3dLightColor: string;\r\n msInterpolationMode: string;\r\n scrollbarTrackColor: string;\r\n scrollbarDarkShadowColor: string;\r\n styleFloat: string;\r\n getAttribute(attributeName: string, flags?: number): any;\r\n setAttribute(attributeName: string, AttributeValue: any, flags?: number): void;\r\n removeAttribute(attributeName: string, flags?: number): boolean;\r\n\r\n pixelWidth: number;\r\n posHeight: number;\r\n posLeft: number;\r\n pixelTop: number;\r\n pixelBottom: number;\r\n textDecorationNone: boolean;\r\n pixelLeft: number;\r\n posTop: number;\r\n posBottom: number;\r\n textDecorationOverline: boolean;\r\n posWidth: number;\r\n textDecorationLineThrough: boolean;\r\n pixelHeight: number;\r\n textDecorationBlink: boolean;\r\n posRight: number;\r\n pixelRight: number;\r\n textDecorationUnderline: boolean;\r\n\r\n webkitTransform: string;\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\n/**\r\n * Defines a Debug object. Calls to any functions in this object removed by the minifier.\r\n * The functions within this class are not minified away, so we use the preprocessor-style\r\n * comments to have the minifier remove those as well.\r\n */\r\n \r\n///#DEBUG\r\n\r\nmodule debug {\r\n\r\n export let assertFailFunction: {\r\n (message: string): void;\r\n };\r\n\r\n /** \r\n * Asserts that the condition is true, fails otherwise.\r\n */\r\n export function assert(condition: boolean, message: string): void {\r\n if (condition !== true) {\r\n assertFail(message || ('condition: ' + condition));\r\n }\r\n }\r\n\r\n /**\r\n * Asserts that the value is neither null nor undefined, fails otherwise. \r\n */\r\n export function assertValue<T>(value: T, message: string): void {\r\n if (value === null || value === undefined) {\r\n assertFail(message || ('condition: ' + value));\r\n }\r\n }\r\n\r\n /**\r\n * Asserts that the value is neither null nor undefined, and has a length property that returns greater than zero, fails otherwise. \r\n */\r\n export function assertNonEmpty<T>(value: T[], message: string): void {\r\n if (!(value != null && value.length > 0)) {\r\n assertFail(message || ('condition: ' + value));\r\n }\r\n }\r\n\r\n /**\r\n * Makes no assertion on the given value.\r\n * This is documentation/placeholder that a value is possibly null or undefined (unlike assertValue).\r\n */\r\n export function assertAnyValue<T>(value: T, message: string): void {\r\n }\r\n\r\n export function assertFail(message: string): void {\r\n (assertFailFunction || alert)('Debug Assert failed: ' + message);\r\n }\r\n}\r\n\r\n///#ENDDEBUG","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n export interface IError extends Error {\r\n stack?: string;\r\n argument?: string;\r\n }\r\n\r\n export module Errors {\r\n export function infoNavAppAlreadyPresent(): IError {\r\n return {\r\n name: 'infoNavAppAlreadyPresent',\r\n message: 'Cannot initialize embedded scenario when the InfoNav App is already present in this context',\r\n stack: getExceptionStackTrace()\r\n };\r\n }\r\n\r\n export function invalidOperation(message: string): IError {\r\n return {\r\n name: 'invalidOperation',\r\n message: message,\r\n stack: getExceptionStackTrace()\r\n };\r\n }\r\n\r\n export function argument(argumentName: string, message: string): IError {\r\n return {\r\n name: 'invalidArgumentError',\r\n argument: argumentName,\r\n message: message,\r\n stack: getExceptionStackTrace()\r\n };\r\n }\r\n\r\n export function argumentNull(argumentName: string): IError {\r\n return {\r\n name: 'argumentNull',\r\n argument: argumentName,\r\n message: 'Argument was null',\r\n stack: getExceptionStackTrace()\r\n };\r\n }\r\n\r\n export function argumentUndefined(argumentName: string): IError {\r\n return {\r\n name: 'argumentUndefined',\r\n argument: argumentName,\r\n message: 'Argument was undefined',\r\n stack: getExceptionStackTrace()\r\n };\r\n }\r\n\r\n export function argumentOutOfRange(argumentName: string): IError {\r\n return {\r\n name: 'argumentOutOfRange',\r\n argument: argumentName,\r\n message: 'Argument was out of range',\r\n stack: getExceptionStackTrace()\r\n };\r\n }\r\n\r\n export function pureVirtualMethodException(className: string, methodName: string): IError {\r\n return {\r\n name: 'pureVirtualMethodException',\r\n message: 'This method must be overriden by the derived class:' + className + '.' + methodName,\r\n stack: getExceptionStackTrace()\r\n };\r\n }\r\n\r\n export function notImplementedException(message: string): IError {\r\n return {\r\n name: 'notImplementedException',\r\n message: message,\r\n stack: getExceptionStackTrace()\r\n };\r\n }\r\n\r\n function getExceptionStackTrace(): string {\r\n return getStackTrace(/*leadingFramesToRemove*/2);\r\n }\r\n }\r\n\r\n /**\r\n * Captures the stack trace, if available.\r\n * It optionally takes the number of frames to remove from the stack trace.\r\n * By default, it removes the last frame to consider the calling type's\r\n * constructor and the temporary error used to capture the stack trace (below).\r\n * More levels can be requested as needed e..g. when an error is created\r\n * from a helper method. <Min requirement: IE10, Chrome, Firefox, Opera>.\r\n */\r\n export function getStackTrace(leadingFramesToRemove = 1): string {\r\n let stackTrace: string,\r\n stackSegments: string[];\r\n\r\n try {\r\n // needs to throw for stack trace to work in IE\r\n throw new Error();\r\n } catch (error) {\r\n stackTrace = error.stack;\r\n if (stackTrace != null) {\r\n stackSegments = stackTrace.split('\\n');\r\n stackSegments.splice(1, leadingFramesToRemove);\r\n // Finally\r\n stackTrace = stackSegments.join('\\n');\r\n }\r\n }\r\n\r\n return stackTrace;\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\n$.fn.multiline = function (text) {\r\n this.text(text);\r\n this.html(this.html().replace(/\\n/g, '<br/>'));\r\n return this;\r\n};\r\n\r\n$.fn.togglePanelControl = function () {\r\n return this.each(function () {\r\n $(this).addClass(\"ui-accordion ui-accordion-icons ui-widget ui-helper-reset\")\r\n .find(\".accordionHeader\")\r\n .addClass(\"ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom\")\r\n .hover(function() {\r\n $(this).toggleClass(\"ui-state-hover\");\r\n })\r\n .prepend('<span class=\"ui-icon ui-icon-triangle-1-e\"></span>')\r\n .click(function() {\r\n $(this)\r\n .toggleClass(\"ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom\")\r\n .find(\"> .ui-icon\").toggleClass(\"ui-icon-triangle-1-e ui-icon-triangle-1-s\").end()\r\n .next().slideToggle();\r\n return false;\r\n })\r\n .next()\r\n .addClass(\"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom\")\r\n .hide();\r\n });\r\n};\r\n\r\nmodule jsCommon {\r\n /** \r\n * Represents a promise that may be rejected by its consumer.\r\n */ \r\n export interface IRejectablePromise extends JQueryPromise<void> {\r\n reject(...args: any[]): void;\r\n }\r\n\r\n export module JQueryConstants {\r\n export const VisibleSelector: string = ':visible';\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n\r\n /** \r\n * Represents a lazily instantiated value.\r\n */\r\n export class Lazy<T> {\r\n private value: T;\r\n private factoryMethod: () => T;\r\n\r\n constructor(factoryMethod: () => T) {\r\n Utility.throwIfNullOrUndefined(factoryMethod, this, 'constructor', 'factoryMethod');\r\n\r\n this.factoryMethod = factoryMethod;\r\n }\r\n\r\n public getValue(): T {\r\n if (this.factoryMethod !== null) {\r\n this.value = this.factoryMethod();\r\n\r\n // Optimization: Release the factoryMethod, as it could be holding a large object graph.\r\n this.factoryMethod = null;\r\n }\r\n\r\n return this.value;\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved.\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n export module Prototype {\r\n /**\r\n * Returns a new object with the provided obj as its prototype.\r\n */\r\n export function inherit<T>(obj: T, extension?: (inherited: T) => void): T {\r\n debug.assertValue(obj, 'obj');\r\n\r\n function wrapCtor(): void { };\r\n wrapCtor.prototype = obj;\r\n\r\n let inherited = new wrapCtor();\r\n\r\n if (extension)\r\n extension(inherited);\r\n\r\n return inherited;\r\n }\r\n\r\n /**\r\n * Returns a new object with the provided obj as its prototype\r\n * if, and only if, the prototype has not been previously set\r\n */\r\n export function inheritSingle<T>(obj: T): T {\r\n debug.assertValue(obj, 'obj');\r\n\r\n let proto = Object.getPrototypeOf(obj);\r\n if (proto === Object.prototype || proto === Array.prototype)\r\n obj = inherit(obj);\r\n\r\n return obj;\r\n }\r\n\r\n /**\r\n * Uses the provided callback function to selectively replace contents in the provided array.\r\n * @return A new array with those values overriden\r\n * or undefined if no overrides are necessary.\r\n */\r\n export function overrideArray<T, TArray>(prototype: TArray, override: (T) => T): TArray {\r\n if (!prototype)\r\n return;\r\n\r\n let overwritten: TArray;\r\n\r\n for (let i = 0, len = (<T[]><any>prototype).length; i < len; i++) {\r\n let value = override(prototype[i]);\r\n if (value) {\r\n if (!overwritten)\r\n overwritten = inherit(prototype);\r\n\r\n overwritten[i] = value;\r\n }\r\n }\r\n\r\n return overwritten;\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n\r\n export module Formatting {\r\n\r\n interface IRegexInt {\r\n // Regex for replace.\r\n r: RegExp;\r\n // The string to replace.\r\n s: string;\r\n }\r\n\r\n let regexCache: IRegexInt[];\r\n\r\n /** \r\n * Translate .NET format into something supported by jQuery.Globalize.\r\n */\r\n export function findDateFormat(value: Date, format: string, cultureName: string)\r\n {\r\n switch (format) {\r\n case \"m\":\r\n // Month + day\r\n format = \"M\";\r\n break;\r\n case \"O\":\r\n case \"o\":\r\n // Roundtrip\r\n format = \"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'0000'\";\r\n break;\r\n case \"R\":\r\n case \"r\":\r\n // RFC1123 pattern - - time must be converted to UTC before formatting \r\n value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());\r\n format = \"ddd, dd MMM yyyy HH':'mm':'ss 'GMT'\";\r\n break;\r\n case \"s\":\r\n // Sortable - should use invariant culture\r\n format = \"S\";\r\n break;\r\n case \"u\":\r\n // Universal sortable - should convert to UTC before applying the \"yyyy'-'MM'-'dd HH':'mm':'ss'Z' format.\r\n value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());\r\n format = \"yyyy'-'MM'-'dd HH':'mm':'ss'Z'\";\r\n break;\r\n case \"U\":\r\n // Universal full - the pattern is same as F but the time must be converted to UTC before formatting\r\n value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());\r\n format = \"F\";\r\n break;\r\n case \"y\":\r\n case \"Y\":\r\n // Year and month\r\n switch (cultureName) {\r\n case \"default\":\r\n case \"en\":\r\n case \"en-US\":\r\n format = \"MMMM, yyyy\"; // Fix the default year-month pattern for english\r\n break;\r\n default:\r\n format = \"Y\"; // For other cultures - use the localized pattern\r\n }\r\n break;\r\n }\r\n return { value: value, format: format };\r\n }\r\n \r\n /** \r\n * Translates unsupported .NET custom format expressions to the custom expressions supported by JQuery.Globalize.\r\n */\r\n export function fixDateTimeFormat(format: string): string {\r\n // Fix for the \"K\" format (timezone): \r\n //The js dates don't have a kind property so we'll support only local kind which is equavalent to zzz format.\r\n format = format.replace(/%K/g, \"zzz\"); \r\n format = format.replace(/K/g, \"zzz\");\r\n format = format.replace(/fffffff/g, \"fff0000\");\r\n format = format.replace(/ffffff/g, \"fff000\");\r\n format = format.replace(/fffff/g, \"fff00\");\r\n format = format.replace(/ffff/g, \"fff0\");\r\n // Fix for the 5 digit year: \"yyyyy\" format. \r\n //The Globalize doesn't support dates greater than 9999 so we replace the \"yyyyy\" with \"0yyyy\".\r\n format = format.replace(/yyyyy/g, \"0yyyy\"); \r\n // Fix for the 3 digit year: \"yyy\" format. \r\n //The Globalize doesn't support this formatting so we need to replace it with the 4 digit year \"yyyy\" format.\r\n format = format.replace(/(^y|^)yyy(^y|$)/g, \"yyyy\"); \r\n\r\n if (!regexCache) {\r\n // Creating Regexes for cases \"Using single format specifier\" \r\n //- http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers\r\n // This is not supported from The Globalize.\r\n // The case covers all single \"%\" lead specifier (like \"%d\" but not %dd) \r\n // The cases as single \"%d\" are filtered in if the bellow.\r\n // (?!S) where S is the specifier make sure that we only one symbol for specifier.\r\n regexCache = [\"d\", \"f\", \"F\", \"g\", \"h\", \"H\", \"K\", \"m\", \"M\", \"s\", \"t\", \"y\", \"z\", \":\", \"/\"].map((s) => {\r\n return { r: new RegExp(\"\\%\" + s + \"(?!\" + s + \")\", \"g\"), s: s };\r\n });\r\n }\r\n\r\n if (format.indexOf(\"%\") !== -1 && format.length > 2) {\r\n for (let i = 0; i < regexCache.length; i++) {\r\n format = format.replace(regexCache[i].r, regexCache[i].s);\r\n }\r\n }\r\n return format;\r\n }\r\n\r\n }\r\n\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n\r\n let doc: HTMLDocument = document,\r\n headElement: HTMLElement = doc.head,\r\n firstScriptInHeadElement: HTMLElement = headElement.getElementsByTagName('script')[0],\r\n linkElement: HTMLElement = doc.createElement('link'),\r\n scriptElement: HTMLElement = doc.createElement('script'),\r\n styleSheetLoaded: string[] = [],\r\n javaScriptFilesLoaded: string[] = [],\r\n javaScriptFilesLoading: any[] = [];\r\n\r\n linkElement.setAttribute('rel', 'stylesheet');\r\n\r\n /**\r\n * Public API.\r\n */\r\n\texport interface IJavaScriptDependency {\r\n\t\tjavascriptFile: string;\r\n\r\n // Callback that indicates when the script is loaded, after writing a <script> tag\r\n\t\tonLoadCallback?: () => JQueryPromise<void>;\r\n\t}\r\n\r\n export interface IDependency {\r\n javaScriptFiles?: string[];\r\n cssFiles?: string[];\r\n\t\tjavaScriptFilesWithCallback?: IJavaScriptDependency[];\r\n }\r\n\r\n export function requires(dependency: IDependency, to: () => void = $.noop): void {\r\n loadStyleSheets(dependency.cssFiles || []);\r\n\r\n\t\tlet scriptsToRun = dependency.javaScriptFilesWithCallback || [];\r\n\r\n\t\tif (dependency.javaScriptFiles) {\r\n\t\t\tfor(let i=0, len=dependency.javaScriptFiles.length; i<len; ++i) {\r\n\t\t\t\tscriptsToRun.push({javascriptFile:dependency.javaScriptFiles[i]});\r\n\t\t\t}\r\n\t\t}\r\n loadJavaScriptFiles(scriptsToRun, to);\r\n }\r\n\r\n /**\r\n * Private Helpers.\r\n */\r\n function loadStyleSheets(hrefList: string[]): void {\r\n hrefList.forEach(href => {\r\n if (styleSheetLoaded.indexOf(href) === -1) {\r\n styleSheetLoaded.push(href);\r\n loadStyleSheet(href);\r\n }\r\n });\r\n }\r\n\r\n function loadJavaScriptFiles(scripts: IJavaScriptDependency[], callback: () => void): void {\r\n let loadingCount = scripts.length,\r\n parsingCount = loadingCount,\r\n sourceCodeList: IJavaScriptDependency[] = [];\r\n\r\n function parseIfLoadingComplete(): void {\r\n if (!--loadingCount) {\r\n parseJavaScriptSourceCodes(scripts, sourceCodeList);\r\n }\r\n }\r\n\r\n function makeCallbackIfParsingComplete(): void {\r\n if (!--parsingCount) {\r\n callback();\r\n }\r\n }\r\n\r\n scripts.forEach((script: IJavaScriptDependency, index: number) => {\r\n let file = script.javascriptFile;\r\n if (javaScriptFilesLoaded.indexOf(file) === -1) { // not loaded\r\n\r\n if (file in javaScriptFilesLoading) { // loading\r\n javaScriptFilesLoading[file].push(() => {\r\n parseIfLoadingComplete();\r\n makeCallbackIfParsingComplete();\r\n });\r\n\r\n } else { // not loading\r\n javaScriptFilesLoading[file] = [() => {\r\n makeCallbackIfParsingComplete();\r\n }];\r\n\r\n if (isExternalUrl(file)) { // external JS file\r\n sourceCodeList[index] = script;\r\n parseIfLoadingComplete();\r\n\r\n } else { // internal JS file\r\n loadJavaScriptSourceCode(file, (sourceCode: string) => {\r\n sourceCodeList[index] = {javascriptFile: sourceCode};\r\n parseIfLoadingComplete();\r\n });\r\n }\r\n }\r\n\r\n } else { // loaded\r\n parseIfLoadingComplete();\r\n makeCallbackIfParsingComplete();\r\n }\r\n });\r\n }\r\n\r\n function loadStyleSheet(href: string): void {\r\n let link = <any>linkElement.cloneNode();\r\n link.href = href;\r\n if (firstScriptInHeadElement) {\r\n headElement.insertBefore(link, firstScriptInHeadElement);\r\n } else {\r\n headElement.appendChild(link);\r\n }\r\n }\r\n\r\n function loadJavaScriptSourceCode(src: string, onload: (code: string) => void): void {\r\n webGet(src, function (): void {\r\n onload(this.responseText);\r\n });\r\n }\r\n\r\n function parseJavaScript(script: IJavaScriptDependency, onComplete: () => void = $.noop): void {\r\n if (!script) {\r\n onComplete();\r\n return;\r\n }\r\n\r\n\t\tlet sourceCodeOrFileName = script.javascriptFile;\r\n\r\n\t\tlet targetCallback = onComplete;\r\n\t\tif (script.onLoadCallback) {\r\n\t\t\tlet promiseAsCallback = () => {\r\n\t\t\t\tscript.onLoadCallback().then(onComplete);\r\n\t\t\t};\r\n\t\t\ttargetCallback = promiseAsCallback;\r\n\t\t}\r\n\r\n isExternalUrl(sourceCodeOrFileName)\r\n ? loadExternalJavaScriptFile(sourceCodeOrFileName, targetCallback)\r\n : parseInternalJavaScriptCode(sourceCodeOrFileName, targetCallback);\r\n }\r\n\r\n function parseInternalJavaScriptCode(sourceCode: string, onComplete: () => void = $.noop): void {\r\n let script: HTMLElement;\r\n if (sourceCode) {\r\n script = <any>scriptElement.cloneNode();\r\n script.setAttribute('type', 'text/javascript');\r\n script.innerHTML = sourceCode;\r\n headElement.appendChild(script);\r\n }\r\n setTimeout(onComplete, 0);\r\n }\r\n\r\n function loadExternalJavaScriptFile(src, onload: () => void): void {\r\n let script: HTMLElement;\r\n if (src) {\r\n script = <any>scriptElement.cloneNode();\r\n script.setAttribute('src', src);\r\n script.setAttribute('charset', 'utf-8');\r\n script.onload = onload;\r\n headElement.appendChild(script);\r\n }\r\n }\r\n\r\n function parseJavaScriptSourceCodes(scripts: IJavaScriptDependency[], sourceCodeList: IJavaScriptDependency[]): void {\r\n asyncLoop(sourceCodeList, parseJavaScript, /*on all files parsed*/() => {\r\n scripts.forEach((script: IJavaScriptDependency) => {\r\n let file = script.javascriptFile;\r\n let listeners = javaScriptFilesLoading[file];\r\n if (listeners) {\r\n listeners.forEach((listener) => {\r\n listener();\r\n });\r\n }\r\n\r\n delete javaScriptFilesLoading[file];\r\n if (javaScriptFilesLoaded.indexOf(file) === -1) {\r\n javaScriptFilesLoaded.push(file);\r\n }\r\n });\r\n });\r\n }\r\n\r\n function webGet(src: string, onload: () => void, onerror?: (error: any) => void): void {\r\n let xhr = new XMLHttpRequest();\r\n\r\n try {\r\n xhr.open('GET', src, true);\r\n xhr.onload = onload;\r\n xhr.onerror = onerror;\r\n xhr.send(null);\r\n }\r\n catch (e) {\r\n // handle it\r\n }\r\n }\r\n\r\n function isExternalUrl(url: string): boolean {\r\n let origin = location.protocol + '//' + location.host + '/';\r\n return /^http[s]?:\\/\\/.+/i.test(url) && url.indexOf(origin) !== 0;\r\n }\r\n\r\n function _(...args: any[]): any { }\r\n\r\n function asyncSteps(...args: Function[]): void {\r\n if (args.length === 0) {\r\n return;\r\n }\r\n\r\n let steps = [],\r\n i = args.length;\r\n\r\n while (i--) {\r\n (function (j) {\r\n steps[j] = function () {\r\n args[j](steps[j + 1] || _);\r\n };\r\n })(i);\r\n }\r\n steps[0]();\r\n }\r\n\r\n function asyncLoop(enumerable: any[], func: (item, next) => void, callback: () => void): void {\r\n let steps = [],\r\n i = 0,\r\n len = enumerable.length;\r\n\r\n for (; i < len - 1; i++) {\r\n (function (i) {\r\n steps[i] = (next) => {\r\n func(enumerable[i], next);\r\n };\r\n } (i));\r\n }\r\n\r\n steps[len - 1] = (next) => {\r\n func(enumerable[len - 1], callback);\r\n };\r\n\r\n asyncSteps.apply(null, steps);\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n export function createJQueryPromiseFactory(): IPromiseFactory {\r\n return new JQueryPromiseFactory();\r\n }\r\n\r\n /**\r\n * jQuery-based implementation of IPromiseFactory.\r\n * This is useful for cases when Angular is not present, or when immediate promise resolving (not tied to Angular digest cycle) is desired.\r\n */\r\n class JQueryPromiseFactory implements IPromiseFactory {\r\n public defer<TSuccess, TError>(): IDeferred2<TSuccess, TError> {\r\n return new JQueryDeferredWrapper($.Deferred());\r\n }\r\n\r\n public reject<TError>(reason?: TError): IPromise2<any, TError> {\r\n let deferred = this.defer();\r\n deferred.reject(reason);\r\n return deferred.promise;\r\n }\r\n\r\n public resolve<TSuccess>(value: TSuccess): IPromise2<TSuccess, any> {\r\n let deferred = this.defer();\r\n deferred.resolve(value);\r\n return deferred.promise;\r\n }\r\n\r\n public all(promises: IPromise2<any, any>[]): IPromise<any[]>;\r\n\r\n public all(promises: any): IPromise<any[]> {\r\n let unwrappedPromises = jQuery.map(promises, (value) => {\r\n return value && value.promise ? value.promise : value;\r\n });\r\n\r\n return new JQueryPromiseWrapper($.when.apply($, unwrappedPromises));\r\n }\r\n\r\n public when<T>(value: T | IPromise<T>): IPromise<T>;\r\n\r\n public when<T>(value: any): IPromise<T> {\r\n let unwrappedPromise = value && value.promise ? value.promise : value;\r\n return new JQueryPromiseWrapper($.when(unwrappedPromise));\r\n }\r\n }\r\n\r\n /** \r\n * Implements IDeferred via a wrapped a jQuery Deferred.\r\n */\r\n class JQueryDeferredWrapper<TSuccess, TError> implements IDeferred2<TSuccess, TError> {\r\n public promise: IPromise2<TSuccess, TError>;\r\n private deferred: JQueryDeferred<any>;\r\n\r\n constructor(deferred: JQueryDeferred<any>) {\r\n debug.assertValue(deferred, 'deferred');\r\n\r\n this.deferred = deferred;\r\n this.promise = new JQueryPromiseWrapper(deferred.promise());\r\n }\r\n\r\n public resolve(value: TSuccess | IPromise<any>): void {\r\n this.deferred.resolve(value);\r\n }\r\n\r\n public reject(reason?: TError): void {\r\n this.deferred.reject(reason);\r\n }\r\n }\r\n\r\n /** \r\n * Implements IDeferred via a wrapped a jQuery Promise.\r\n */\r\n class JQueryPromiseWrapper<TSuccess, TError> implements IPromise2<TSuccess, TError> {\r\n private promise: JQueryPromise<any>;\r\n\r\n constructor(promise: JQueryPromise<any>) {\r\n debug.assertValue(promise, 'promise');\r\n\r\n this.promise = promise;\r\n }\r\n\r\n public then(a: (arg: any) => any, b: (arg: any) => any): IPromise2<any, any> {\r\n return new JQueryPromiseWrapper(\r\n this.promise.then(\r\n JQueryPromiseWrapper.wrapCallback(a),\r\n JQueryPromiseWrapper.wrapCallback(b)));\r\n }\r\n\r\n public catch(callback): IPromise2<any, any> {\r\n return this.then(null, callback);\r\n }\r\n\r\n public finally(callback): IPromise2<any, any> {\r\n this.promise.always(\r\n JQueryPromiseWrapper.wrapCallback(callback));\r\n return this;\r\n }\r\n\r\n /** \r\n * Wraps a callback, which may return a IPromise. \r\n */\r\n private static wrapCallback(callback: (arg: any) => any): (arg: any) => any {\r\n if (callback)\r\n return arg => {\r\n let value = callback(arg);\r\n\r\n // If the callback returns a Promise, unwrap that to allow jQuery to chain.\r\n if (value instanceof JQueryPromiseWrapper)\r\n return (<JQueryPromiseWrapper<any, any>>value).promise;\r\n\r\n return value;\r\n };\r\n\r\n return callback;\r\n }\r\n }\r\n}\r\n ","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n\r\n export interface IStorageService {\r\n getData(key: string): any;\r\n setData(key: string, data: any): void;\r\n }\r\n\r\n class LocalStorageService implements IStorageService {\r\n public getData(key: string): any {\r\n try {\r\n if (localStorage) {\r\n let value = localStorage[key];\r\n if (value) {\r\n return JSON.parse(value);\r\n }\r\n }\r\n }\r\n catch (exception) {}\r\n\r\n return null;\r\n }\r\n\r\n public setData(key: string, data: any) {\r\n try {\r\n if (localStorage) {\r\n localStorage[key] = JSON.stringify(data);\r\n }\r\n }\r\n catch (e) {}\r\n }\r\n }\r\n\r\n export class EphemeralStorageService implements IStorageService {\r\n private cache: { [key: string]: any } = {};\r\n private clearCacheTimerId: number;\r\n private clearCacheInterval: number;\r\n public static defaultClearCacheInterval: number = (1000 * 60 * 60 * 24); // 1 day\r\n\r\n constructor(clearCacheInterval?: number) {\r\n this.clearCacheInterval = (clearCacheInterval != null)\r\n ? clearCacheInterval\r\n : EphemeralStorageService.defaultClearCacheInterval;\r\n\r\n this.clearCache();\r\n }\r\n\r\n public getData(key: string): any {\r\n return this.cache[key];\r\n }\r\n\r\n public setData(key: string, data: any) {\r\n this.cache[key] = data;\r\n\r\n if (this.clearCacheTimerId == null) {\r\n this.clearCacheTimerId = setTimeout(() => this.clearCache(), this.clearCacheInterval);\r\n }\r\n }\r\n\r\n private clearCache(): void {\r\n this.cache = {};\r\n this.clearCacheTimerId = undefined;\r\n }\r\n }\r\n\r\n export var localStorageService: IStorageService = new LocalStorageService();\r\n export const ephemeralStorageService: IStorageService = new EphemeralStorageService();\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n export module WordBreaker {\r\n import TextProperties = powerbi.TextProperties;\r\n import ITextAsSVGMeasurer = powerbi.ITextAsSVGMeasurer;\r\n import ITextTruncator = powerbi.ITextTruncator;\r\n \r\n export interface WordBreakerResult {\r\n start: number;\r\n end: number;\r\n }\r\n\r\n const SPACE = ' ';\r\n const BREAKERS_REGEX = /[\\s\\n]+/g;\r\n\r\n function search(index: number, content: string, backward: boolean): number {\r\n if (backward) {\r\n for (let i = index - 1; i > -1; i--) {\r\n if (hasBreakers(content[i]))\r\n return i + 1;\r\n }\r\n } else {\r\n for (let i = index, ilen = content.length; i < ilen; i++) {\r\n if (hasBreakers(content[i]))\r\n return i;\r\n }\r\n }\r\n\r\n return backward ? 0 : content.length;\r\n }\r\n\r\n /**\r\n * Find the word nearest the cursor specified within content\r\n * @param index - point within content to search forward/backward from\r\n * @param content - string to search\r\n */\r\n export function find(index: number, content: string): WordBreakerResult {\r\n debug.assert(index >= 0 && index <= content.length, 'index within content string bounds');\r\n\r\n let result = { start: 0, end: 0 };\r\n if (content.length === 0)\r\n return result;\r\n\r\n result.start = search(index, content, true);\r\n result.end = search(index, content, false);\r\n return result;\r\n }\r\n\r\n /**\r\n * Test for presence of breakers within content\r\n * @param content - string to test\r\n */\r\n export function hasBreakers(content: string): boolean {\r\n BREAKERS_REGEX.lastIndex = 0;\r\n return BREAKERS_REGEX.test(content);\r\n }\r\n\r\n /**\r\n * Count the number of pieces when broken by BREAKERS_REGEX\r\n * ~2.7x faster than WordBreaker.split(content).length\r\n * @param content - string to break and count\r\n */\r\n export function wordCount(content: string): number {\r\n let count = 1;\r\n BREAKERS_REGEX.lastIndex = 0;\r\n BREAKERS_REGEX.exec(content);\r\n while (BREAKERS_REGEX.lastIndex !== 0) {\r\n count++;\r\n BREAKERS_REGEX.exec(content);\r\n }\r\n\r\n return count;\r\n }\r\n\r\n export function getMaxWordWidth(content: string, textWidthMeasurer: ITextAsSVGMeasurer, properties: TextProperties): number {\r\n let words = split(content);\r\n let maxWidth = 0;\r\n for (let w of words) {\r\n properties.text = w;\r\n maxWidth = Math.max(maxWidth, textWidthMeasurer(properties));\r\n }\r\n return maxWidth;\r\n }\r\n\r\n function split(content: string): string[] {\r\n return content.split(BREAKERS_REGEX);\r\n }\r\n\r\n function getWidth(content: string, properties: TextProperties, textWidthMeasurer: ITextAsSVGMeasurer): number {\r\n properties.text = content;\r\n return textWidthMeasurer(properties);\r\n }\r\n\r\n function truncate(content: string, properties: TextProperties, truncator: ITextTruncator, maxWidth: number): string {\r\n properties.text = content;\r\n return truncator(properties, maxWidth);\r\n }\r\n\r\n /**\r\n * Split content by breakers (words) and greedy fit as many words\r\n * into each index in the result based on max width and number of lines\r\n * e.g. Each index in result corresponds to a line of content\r\n * when used by AxisHelper.LabelLayoutStrategy.wordBreak\r\n * @param content - string to split\r\n * @param properties - text properties to be used by @param:textWidthMeasurer\r\n * @param textWidthMeasurer - function to calculate width of given text content\r\n * @param maxWidth - maximum allowed width of text content in each result\r\n * @param maxNumLines - maximum number of results we will allow, valid values must be greater than 0\r\n * @param truncator - (optional) if specified, used as a function to truncate content to a given width\r\n */\r\n export function splitByWidth(\r\n content: string,\r\n properties: TextProperties,\r\n textWidthMeasurer: ITextAsSVGMeasurer,\r\n maxWidth: number,\r\n maxNumLines: number,\r\n truncator?: ITextTruncator): string[] {\r\n // Default truncator returns string as-is\r\n truncator = truncator ? truncator : (properties: TextProperties, maxWidth: number) => properties.text;\r\n\r\n let result: string[] = [];\r\n let words = split(content);\r\n\r\n let usedWidth = 0;\r\n let wordsInLine: string[] = [];\r\n\r\n for (let word of words) {\r\n // Last line? Just add whatever is left\r\n if ((maxNumLines > 0) && (result.length >= maxNumLines - 1)) {\r\n wordsInLine.push(word);\r\n continue;\r\n }\r\n\r\n // Determine width if we add this word\r\n // Account for SPACE we will add when joining...\r\n let wordWidth = wordsInLine.length === 0\r\n ? getWidth(word, properties, textWidthMeasurer)\r\n : getWidth(SPACE + word, properties, textWidthMeasurer);\r\n\r\n // If width would exceed max width,\r\n // then push used words and start new split result\r\n if (usedWidth + wordWidth > maxWidth) {\r\n // Word alone exceeds max width, just add it.\r\n if (wordsInLine.length === 0) {\r\n result.push(truncate(word, properties, truncator, maxWidth));\r\n\r\n usedWidth = 0;\r\n wordsInLine = [];\r\n continue;\r\n }\r\n \r\n result.push(truncate(wordsInLine.join(SPACE), properties, truncator, maxWidth));\r\n\r\n usedWidth = 0;\r\n wordsInLine = [];\r\n }\r\n\r\n // ...otherwise, add word and continue\r\n wordsInLine.push(word);\r\n usedWidth += wordWidth;\r\n }\r\n\r\n // Push remaining words onto result\r\n result.push(truncate(wordsInLine.join(SPACE), properties, truncator, maxWidth));\r\n\r\n return result;\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi {\r\n export interface ITextMeasurer {\r\n (textElement: SVGTextElement): number;\r\n }\r\n\r\n export interface ITextAsSVGMeasurer {\r\n (textProperties: TextProperties): number;\r\n }\r\n\r\n export interface ITextTruncator {\r\n (properties: TextProperties, maxWidth: number): string;\r\n }\r\n\r\n export interface TextProperties {\r\n text?: string;\r\n fontFamily: string;\r\n fontSize: string;\r\n fontWeight?: string;\r\n fontStyle?: string;\r\n fontVariant?: string;\r\n whiteSpace?: string;\r\n }\r\n\r\n interface CanvasContext {\r\n font: string;\r\n measureText(text: string): { width: number };\r\n }\r\n\r\n interface CanvasElement extends HTMLElement {\r\n getContext(name: string);\r\n }\r\n\r\n export module TextMeasurementService {\r\n const ellipsis = '…';\r\n const OverflowingText = jsCommon.CssConstants.createClassAndSelector('overflowingText');\r\n\r\n let spanElement: JQuery;\r\n let svgTextElement: D3.Selection;\r\n let canvasCtx: CanvasContext;\r\n let fallbackFontFamily: string;\r\n\r\n /**\r\n * Idempotent function for adding the elements to the DOM. \r\n */\r\n function ensureDOM(): void {\r\n if (spanElement)\r\n return;\r\n\r\n spanElement = $('<span/>');\r\n $('body').append(spanElement);\r\n //The style hides the svg element from the canvas, preventing canvas from scrolling down to show svg black square.\r\n svgTextElement = d3.select($('body').get(0))\r\n .append('svg')\r\n .style({\r\n 'height': '0px',\r\n 'width': '0px',\r\n 'position': 'absolute'\r\n })\r\n .append('text');\r\n canvasCtx = (<CanvasElement>$('<canvas/>').get(0)).getContext(\"2d\");\r\n fallbackFontFamily = window.getComputedStyle(svgTextElement.node()).fontFamily;\r\n }\r\n\r\n /**\r\n * Removes spanElement from DOM.\r\n */\r\n export function removeSpanElement() {\r\n if (spanElement && spanElement.remove) {\r\n spanElement.remove();\r\n }\r\n\r\n spanElement = null;\r\n }\r\n\r\n /**\r\n * This method measures the width of the text with the given SVG text properties.\r\n * @param textProperties The text properties to use for text measurement.\r\n */\r\n export function measureSvgTextWidth(textProperties: TextProperties): number {\r\n debug.assertValue(textProperties, 'textProperties');\r\n debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf(\"px\") !== -1, \"TextProperties' text size should be in px.\");\r\n\r\n ensureDOM();\r\n\r\n canvasCtx.font =\r\n (textProperties.fontStyle || \"\") + \" \" +\r\n (textProperties.fontVariant || \"\") + \" \" +\r\n (textProperties.fontWeight || \"\") + \" \" +\r\n textProperties.fontSize + \" \" +\r\n (textProperties.fontFamily || fallbackFontFamily);\r\n\r\n return canvasCtx.measureText(textProperties.text).width;\r\n }\r\n\r\n /**\r\n * This method return the rect with the given SVG text properties.\r\n * @param textProperties The text properties to use for text measurement.\r\n */\r\n export function measureSvgTextRect(textProperties: TextProperties): SVGRect {\r\n debug.assertValue(textProperties, 'textProperties');\r\n debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf(\"px\") !== -1, \"TextProperties' text size should be in px.\");\r\n\r\n ensureDOM();\r\n\r\n svgTextElement.style(null);\r\n svgTextElement\r\n .text(textProperties.text)\r\n .attr({\r\n 'visibility': 'hidden',\r\n 'font-family': textProperties.fontFamily || fallbackFontFamily,\r\n 'font-variant': textProperties.fontVariant,\r\n 'font-size': textProperties.fontSize,\r\n 'font-weight': textProperties.fontWeight,\r\n 'font-style': textProperties.fontStyle,\r\n 'white-space': textProperties.whiteSpace || 'nowrap'\r\n });\r\n\r\n // We're expecting the browser to give a synchronous measurement here\r\n // We're using SVGTextElement because it works across all browsers \r\n return svgTextElement.node<SVGTextElement>().getBBox();\r\n }\r\n\r\n /**\r\n * This method measures the height of the text with the given SVG text properties.\r\n * @param textProperties The text properties to use for text measurement.\r\n */\r\n export function measureSvgTextHeight(textProperties: TextProperties): number {\r\n return measureSvgTextRect(textProperties).height;\r\n }\r\n\r\n /**\r\n * This method returns the text Rect with the given SVG text properties.\r\n * Does NOT return text width; obliterates text value\r\n * @param {TextProperties} textProperties - The text properties to use for text measurement\r\n */\r\n function estimateSvgTextRect(textProperties: TextProperties): SVGRect {\r\n debug.assertValue(textProperties, 'textProperties');\r\n debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf(\"px\") !== -1, \"TextProperties' text size should be in px.\");\r\n\r\n let propertiesKey = textProperties.fontFamily + textProperties.fontSize;\r\n let rect: SVGRect = ephemeralStorageService.getData(propertiesKey);\r\n\r\n if (rect == null) {\r\n // To estimate we check the height of a particular character, once it is cached, subsequent\r\n // calls should always get the height from the cache (regardless of the text).\r\n let estimatedTextProperties: TextProperties = {\r\n fontFamily: textProperties.fontFamily,\r\n fontSize: textProperties.fontSize,\r\n text: \"M\",\r\n };\r\n\r\n rect = TextMeasurementService.measureSvgTextRect(estimatedTextProperties);\r\n\r\n // NOTE: In some cases (disconnected/hidden DOM) we may provide incorrect measurement results (zero sized bounding-box), so\r\n // we only store values in the cache if we are confident they are correct.\r\n if (rect.height > 0)\r\n ephemeralStorageService.setData(propertiesKey, rect);\r\n }\r\n\r\n return rect;\r\n }\r\n\r\n /**\r\n * This method returns the text Rect with the given SVG text properties.\r\n * @param {TextProperties} textProperties - The text properties to use for text measurement\r\n */\r\n export function estimateSvgTextBaselineDelta(textProperties: TextProperties): number {\r\n let rect = estimateSvgTextRect(textProperties);\r\n return rect.y + rect.height;\r\n }\r\n\r\n /**\r\n * This method estimates the height of the text with the given SVG text properties.\r\n * @param {TextProperties} textProperties - The text properties to use for text measurement\r\n */\r\n export function estimateSvgTextHeight(textProperties: TextProperties, tightFightForNumeric: boolean = false): number {\r\n let height = estimateSvgTextRect(textProperties).height;\r\n\r\n //TODO: replace it with new baseline calculation\r\n if (tightFightForNumeric)\r\n height *= 0.7;\r\n\r\n return height;\r\n }\r\n\r\n /**\r\n * This method measures the width of the svgElement.\r\n * @param svgElement The SVGTextElement to be measured.\r\n */\r\n export function measureSvgTextElementWidth(svgElement: SVGTextElement): number {\r\n debug.assertValue(svgElement, 'svgElement');\r\n return measureSvgTextWidth(getSvgMeasurementProperties(svgElement));\r\n }\r\n\r\n /**\r\n * This method fetches the text measurement properties of the given DOM element.\r\n * @param element The selector for the DOM Element.\r\n */\r\n export function getMeasurementProperties(element: JQuery): TextProperties {\r\n debug.assertValue(element, 'element');\r\n\r\n return {\r\n text: element.val() || element.text(),\r\n fontFamily: element.css('font-family'),\r\n fontSize: element.css('font-size'),\r\n fontWeight: element.css('font-weight'),\r\n fontStyle: element.css('font-style'),\r\n fontVariant: element.css('font-variant'),\r\n whiteSpace: element.css('white-space')\r\n };\r\n }\r\n\r\n /**\r\n * This method fetches the text measurement properties of the given SVG text element.\r\n * @param svgElement The SVGTextElement to be measured.\r\n */\r\n export function getSvgMeasurementProperties(svgElement: SVGTextElement): TextProperties {\r\n debug.assertValue(svgElement, 'svgElement');\r\n\r\n let style = window.getComputedStyle(svgElement, null);\r\n return {\r\n text: svgElement.textContent,\r\n fontFamily: style.fontFamily,\r\n fontSize: style.fontSize,\r\n fontWeight: style.fontWeight,\r\n fontStyle: style.fontStyle,\r\n fontVariant: style.fontVariant,\r\n whiteSpace: style.whiteSpace\r\n };\r\n }\r\n\r\n /**\r\n * This method returns the width of a div element.\r\n * @param element The div element.\r\n */\r\n export function getDivElementWidth(element: JQuery): string {\r\n debug.assert(element.is('div'), 'Given element is not a div type. Cannot get width');\r\n return getComputedStyle(element[0]).width;\r\n }\r\n\r\n /**\r\n * Compares labels text size to the available size and renders ellipses when the available size is smaller.\r\n * @param textProperties The text properties (including text content) to use for text measurement.\r\n * @param maxWidth The maximum width available for rendering the text.\r\n */\r\n export function getTailoredTextOrDefault(textProperties: TextProperties, maxWidth: number): string {\r\n debug.assertValue(textProperties, 'properties');\r\n debug.assertValue(textProperties.text, 'properties.text');\r\n debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf(\"px\") !== -1, \"TextProperties' text size should be in px.\");\r\n\r\n ensureDOM();\r\n\r\n let strLength = textProperties.text.length;\r\n\r\n if (strLength === 0)\r\n return textProperties.text;\r\n\r\n let width = measureSvgTextWidth(textProperties);\r\n\r\n if (width < maxWidth)\r\n return textProperties.text;\r\n\r\n // Create a copy of the textProperties so we don't modify the one that's passed in.\r\n let copiedTextProperties = Prototype.inherit(textProperties);\r\n\r\n // Take the properties and apply them to svgTextElement\r\n // Then, do the binary search to figure out the substring we want\r\n // Set the substring on textElement argument\r\n let text = copiedTextProperties.text = ellipsis + copiedTextProperties.text;\r\n\r\n let min = 1;\r\n let max = text.length;\r\n let i = ellipsis.length;\r\n\r\n while (min <= max) {\r\n // num | 0 prefered to Math.floor(num) for performance benefits\r\n i = (min + max) / 2 | 0;\r\n\r\n copiedTextProperties.text = text.substr(0, i);\r\n width = measureSvgTextWidth(copiedTextProperties);\r\n\r\n if (maxWidth > width)\r\n min = i + 1;\r\n else if (maxWidth < width)\r\n max = i - 1;\r\n else\r\n break;\r\n }\r\n\r\n // Since the search algorithm almost never finds an exact match,\r\n // it will pick one of the closest two, which could result in a\r\n // value bigger with than 'maxWidth' thus we need to go back by \r\n // one to guarantee a smaller width than 'maxWidth'.\r\n copiedTextProperties.text = text.substr(0, i);\r\n width = measureSvgTextWidth(copiedTextProperties);\r\n if (width > maxWidth)\r\n i--;\r\n\r\n return text.substr(ellipsis.length, i - ellipsis.length) + ellipsis;\r\n }\r\n\r\n /**\r\n * Compares labels text size to the available size and renders ellipses when the available size is smaller.\r\n * @param textElement The SVGTextElement containing the text to render.\r\n * @param maxWidth The maximum width available for rendering the text.\r\n */\r\n export function svgEllipsis(textElement: SVGTextElement, maxWidth: number): void {\r\n debug.assertValue(textElement, 'textElement');\r\n\r\n let properties = getSvgMeasurementProperties(textElement);\r\n let originalText = properties.text;\r\n let tailoredText = getTailoredTextOrDefault(properties, maxWidth);\r\n\r\n if (originalText !== tailoredText) {\r\n textElement.textContent = tailoredText;\r\n }\r\n }\r\n\r\n /**\r\n * Word break textContent of <text> SVG element into <tspan>s\r\n * Each tspan will be the height of a single line of text\r\n * @param textElement - the SVGTextElement containing the text to wrap\r\n * @param maxWidth - the maximum width available\r\n * @param maxHeight - the maximum height available (defaults to single line)\r\n * @param linePadding - (optional) padding to add to line height\r\n */\r\n export function wordBreak(textElement: SVGTextElement, maxWidth: number, maxHeight: number, linePadding: number = 0): void {\r\n debug.assertValue(textElement, 'textElement');\r\n\r\n let properties = getSvgMeasurementProperties(textElement);\r\n let height = estimateSvgTextHeight(properties) + linePadding;\r\n let maxNumLines = Math.max(1, Math.floor(maxHeight / height));\r\n let node = d3.select(textElement);\r\n\r\n // Save y of parent textElement to apply as first tspan dy\r\n let firstDY = node.attr('y');\r\n\r\n // Store and clear text content\r\n let labelText = textElement.textContent;\r\n textElement.textContent = null;\r\n\r\n // Append a tspan for each word broken section\r\n let words = jsCommon.WordBreaker.splitByWidth(labelText, properties, measureSvgTextWidth, maxWidth, maxNumLines);\r\n for (let i = 0, ilen = words.length; i < ilen; i++) {\r\n properties.text = words[i];\r\n node\r\n .append('tspan')\r\n .attr({\r\n 'x': 0,\r\n 'dy': i === 0 ? firstDY : height,\r\n })\r\n // Truncate\r\n .text(getTailoredTextOrDefault(properties, maxWidth));\r\n }\r\n }\r\n\r\n /**\r\n * Word break textContent of span element into <span>s\r\n * Each span will be the height of a single line of text\r\n * @param textElement - the element containing the text to wrap\r\n * @param maxWidth - the maximum width available\r\n * @param maxHeight - the maximum height available (defaults to single line)\r\n * @param linePadding - (optional) padding to add to line height\r\n */\r\n export function wordBreakOverflowingText(textElement: any, maxWidth: number, maxHeight: number, linePadding: number = 0): void {\r\n debug.assertValue(textElement, 'textElement');\r\n\r\n let properties = getSvgMeasurementProperties(<SVGTextElement>textElement);\r\n let height = estimateSvgTextHeight(properties) + linePadding;\r\n let maxNumLines = Math.max(1, Math.floor(maxHeight / height));\r\n\r\n // Store and clear text content\r\n let labelText = textElement.textContent;\r\n textElement.textContent = null;\r\n\r\n // Append a span for each word broken section\r\n let words = jsCommon.WordBreaker.splitByWidth(labelText, properties, measureSvgTextWidth, maxWidth, maxNumLines);\r\n\r\n // splitByWidth() occasionally returns unnecessary empty strings, so get rid of them.\r\n // TODO: Fix splitByWidth.\r\n words = _.compact(words);\r\n\r\n let spanItem = d3.select(textElement)\r\n .selectAll(OverflowingText.selector)\r\n .data(words, (d: String) => $.inArray(d, words));\r\n\r\n spanItem\r\n .enter()\r\n .append(\"span\")\r\n .classed(OverflowingText.class, true)\r\n .text((d: string) => d)\r\n .style(\"width\", jsCommon.PixelConverter.toString(maxWidth));\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n import DOMConstants = jsCommon.DOMConstants;\r\n\r\n export module KeyUtils {\r\n export function isArrowKey(keyCode: number): boolean {\r\n return keyCode === DOMConstants.downArrowKeyCode\r\n || keyCode === DOMConstants.upArrowKeyCode\r\n || keyCode === DOMConstants.leftArrowKeyCode\r\n || keyCode === DOMConstants.rightArrowKeyCode;\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n /**\r\n * Responsible for throttling input function.\r\n */\r\n export class ThrottleUtility {\r\n private fn: () => void;\r\n private timerFactory: ITimerPromiseFactory;\r\n private delay: number;\r\n\r\n constructor(delay?: number) {\r\n this.timerFactory = TimerPromiseFactory.instance;\r\n this.delay = 0;\r\n if (delay) {\r\n this.delay = delay;\r\n }\r\n }\r\n\r\n public run(fn: () => void): void {\r\n if (!this.fn) {\r\n this.fn = fn;\r\n this.timerFactory.create(this.delay).done(() => this.timerComplete(this.fn));\r\n } else {\r\n this.fn = fn;\r\n }\r\n }\r\n\r\n /**\r\n * Note: Public for testing purpose.\r\n */\r\n public timerComplete(fn: () => void) {\r\n // run fn\r\n fn();\r\n \r\n // clear fn\r\n this.fn = null;\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n\r\n export interface ITimerPromiseFactory {\r\n /** \r\n * Creates a promise that will be resolved after the specified delayInMs.\r\n * @return Promise.\r\n */\r\n create(delayInMs: number): IRejectablePromise;\r\n }\r\n\r\n /** \r\n * Responsible for creating timer promises.\r\n */\r\n export class TimerPromiseFactory implements ITimerPromiseFactory {\r\n public static instance = new TimerPromiseFactory();\r\n\r\n /**\r\n * {@inheritDoc}\r\n */\r\n public create(delayInMs: number): IRejectablePromise {\r\n debug.assertValue(delayInMs, 'delayInMs');\r\n debug.assert(delayInMs >= 0, 'delayInMs must be a positive value.');\r\n\r\n let deferred = $.Deferred<void>();\r\n\r\n window.setTimeout(\r\n () => deferred.resolve(),\r\n delayInMs);\r\n\r\n return deferred;\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\n/**\r\n * Defined in host.\r\n */\r\ndeclare var clusterUri: string;\r\n\r\nmodule jsCommon {\r\n\r\n /**\r\n * Http Status code we are interested.\r\n */\r\n export enum HttpStatusCode {\r\n OK = 200,\r\n BadRequest = 400,\r\n Unauthorized = 401,\r\n Forbidden = 403,\r\n RequestEntityTooLarge = 413,\r\n }\r\n\r\n /**\r\n * Other HTTP Constants.\r\n */\r\n export module HttpConstants {\r\n export const ApplicationOctetStream = 'application/octet-stream';\r\n export const MultiPartFormData = 'multipart/form-data';\r\n }\r\n\r\n /**\r\n * Extensions to String class.\r\n */\r\n export module StringExtensions {\r\n const HtmlTagRegex = new RegExp('[<>]', 'g');\r\n\r\n export function format(...args: string[]) {\r\n let s = args[0];\r\n\r\n if (isNullOrUndefinedOrWhiteSpaceString(s))\r\n return s;\r\n\r\n for (let i = 0; i < args.length - 1; i++) {\r\n let reg = new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\");\r\n s = s.replace(reg, args[i + 1]);\r\n }\r\n return s;\r\n }\r\n\r\n /**\r\n * Compares two strings for equality, ignoring case.\r\n */\r\n export function equalIgnoreCase(a: string, b: string): boolean {\r\n return StringExtensions.normalizeCase(a) === StringExtensions.normalizeCase(b);\r\n }\r\n\r\n export function startsWithIgnoreCase(a: string, b: string): boolean {\r\n let normalizedSearchString = StringExtensions.normalizeCase(b);\r\n return StringExtensions.normalizeCase(a).indexOf(normalizedSearchString) === 0;\r\n }\r\n\r\n export function startsWith(a: string, b: string): boolean {\r\n return a.indexOf(b) === 0;\r\n }\r\n\r\n /** Determines whether a string contains a specified substring (while ignoring case). */\r\n export function containsIgnoreCase(source: string, substring: string): boolean {\r\n if (source == null)\r\n return false;\r\n\r\n return source.toLowerCase().indexOf(substring.toLowerCase().toString()) !== -1;\r\n }\r\n\r\n /** \r\n * Normalizes case for a string.\r\n * Used by equalIgnoreCase method. \r\n */\r\n export function normalizeCase(value: string): string {\r\n Utility.throwIfNullOrUndefined(value, StringExtensions, 'normalizeCase', 'value');\r\n\r\n return value.toUpperCase();\r\n }\r\n\r\n /** \r\n * Is string null or empty or undefined?\r\n * @return True if the value is null or undefined or empty string,\r\n * otherwise false.\r\n */\r\n export function isNullOrEmpty(value: string): boolean {\r\n return (value == null) || (value.length === 0);\r\n }\r\n\r\n /** \r\n * Returns true if the string is null, undefined, empty, or only includes white spaces.\r\n * @return True if the str is null, undefined, empty, or only includes white spaces,\r\n * otherwise false.\r\n */\r\n export function isNullOrUndefinedOrWhiteSpaceString(str: string): boolean {\r\n return StringExtensions.isNullOrEmpty(str) || StringExtensions.isNullOrEmpty(str.trim());\r\n }\r\n\r\n /**\r\n * Returns a value indicating whether the str contains any whitespace.\r\n */\r\n export function containsWhitespace(str: string): boolean {\r\n Utility.throwIfNullOrUndefined(str, this, 'containsWhitespace', 'str');\r\n\r\n let expr: RegExp = /\\s/;\r\n return expr.test(str);\r\n }\r\n\r\n /**\r\n * Returns a value indicating whether the str is a whitespace string.\r\n */\r\n export function isWhitespace(str: string): boolean {\r\n Utility.throwIfNullOrUndefined(str, this, 'isWhitespace', 'str');\r\n\r\n return str.trim() === '';\r\n }\r\n\r\n /** \r\n * Returns the string with any trailing whitespace from str removed.\r\n */\r\n export function trimTrailingWhitespace(str: string): string {\r\n Utility.throwIfNullOrUndefined(str, this, 'trimTrailingWhitespace', 'str');\r\n return str.replace(/\\s+$/, '');\r\n }\r\n\r\n /**\r\n * Returns the string with any leading and trailing whitespace from str removed.\r\n */\r\n export function trimWhitespace(str: string): string {\r\n Utility.throwIfNullOrUndefined(str, this, 'trimWhitespace', 'str');\r\n return str.replace(/^\\s+/, '').replace(/\\s+$/, '');\r\n }\r\n\r\n /** \r\n * Returns length difference between the two provided strings.\r\n */\r\n export function getLengthDifference(left: string, right: string) {\r\n Utility.throwIfNullOrUndefined(left, this, 'getLengthDifference', 'left');\r\n Utility.throwIfNullOrUndefined(right, this, 'getLengthDifference', 'right');\r\n\r\n return Math.abs(left.length - right.length);\r\n }\r\n\r\n /**\r\n * Repeat char or string several times.\r\n * @param char The string to repeat.\r\n * @param count How many times to repeat the string.\r\n */\r\n export function repeat(char: string, count: number): string {\r\n let result = \"\";\r\n for (let i = 0; i < count; i++) {\r\n result += char;\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * Replace all the occurrences of the textToFind in the text with the textToReplace.\r\n * @param text The original string.\r\n * @param textToFind Text to find in the original string.\r\n * @param textToReplace New text replacing the textToFind.\r\n */\r\n export function replaceAll(text: string, textToFind: string, textToReplace: string): string {\r\n if (!textToFind)\r\n return text;\r\n\r\n let pattern = escapeStringForRegex(textToFind);\r\n return text.replace(new RegExp(pattern, 'gi'), textToReplace);\r\n }\r\n\r\n export function ensureUniqueNames(names: string[]): string[] {\r\n debug.assertValue(names, 'names');\r\n\r\n let usedNames: { [name: string]: boolean } = {};\r\n\r\n // Make sure we are giving fair chance for all columns to stay with their original name\r\n // First we fill the used names map to contain all the original unique names from the list.\r\n for (let name of names) {\r\n usedNames[name] = false;\r\n }\r\n\r\n let uniqueNames: string[] = [];\r\n\r\n // Now we go over all names and find a unique name for each\r\n for (let name of names) {\r\n let uniqueName = name;\r\n\r\n // If the (original) column name is already taken lets try to find another name\r\n if (usedNames[uniqueName]) {\r\n let counter = 0;\r\n // Find a name that is not already in the map\r\n while (usedNames[uniqueName] !== undefined) {\r\n uniqueName = name + \".\" + (++counter);\r\n }\r\n }\r\n\r\n uniqueNames.push(uniqueName);\r\n usedNames[uniqueName] = true;\r\n }\r\n\r\n return uniqueNames;\r\n }\r\n\r\n /**\r\n * Returns a name that is not specified in the values.\r\n */\r\n export function findUniqueName(\r\n usedNames: { [name: string]: boolean },\r\n baseName: string): string {\r\n debug.assertValue(usedNames, 'usedNames');\r\n debug.assertValue(baseName, 'baseName');\r\n\r\n // Find a unique name\r\n let i = 0,\r\n uniqueName: string = baseName;\r\n while (usedNames[uniqueName]) {\r\n uniqueName = baseName + (++i);\r\n }\r\n\r\n return uniqueName;\r\n }\r\n\r\n export function constructCommaSeparatedList(list: string[], resourceProvider: IStringResourceProvider, maxValue?: number): string {\r\n if (!list || list.length === 0)\r\n return '';\r\n\r\n if (maxValue === null || maxValue === undefined)\r\n maxValue = Number.MAX_VALUE;\r\n\r\n let length = Math.min(maxValue, list.length);\r\n\r\n let replacedList = [];\r\n // Only need to replace user entries of {0} and {1} since we build the list in pairs.\r\n for (let j = 0; j < 2; j++) {\r\n let targetValue = '{' + j + '}';\r\n let replaceValue = '_|_<' + j + '>_|_';\r\n for (let i = 0; i < length; i++) {\r\n if (list[i].indexOf(targetValue) > -1) {\r\n list[i] = list[i].replace(targetValue, replaceValue);\r\n replacedList.push({ targetValue: targetValue, replaceValue: replaceValue });\r\n }\r\n }\r\n }\r\n\r\n let commaSeparatedList: string = '';\r\n for (let i = 0; i < length; i++) {\r\n if (i === 0)\r\n commaSeparatedList = list[i];\r\n else\r\n commaSeparatedList = StringExtensions.format(resourceProvider.get('FilterRestatement_Comma'), commaSeparatedList, list[i]);\r\n }\r\n\r\n for (let i = 0; i < replacedList.length; i++) {\r\n commaSeparatedList = commaSeparatedList.replace(replacedList[i].replaceValue, replacedList[i].targetValue);\r\n }\r\n\r\n return commaSeparatedList;\r\n }\r\n\r\n export function escapeStringForRegex(s: string): string {\r\n return s.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1');\r\n }\r\n\r\n /**\r\n * Remove file name reserved characters <>:\"/\\|?* from input string.\r\n */\r\n export function normalizeFileName(fileName: string): string { \r\n debug.assertValue(fileName, 'fileName'); \r\n return fileName.replace(/[\\<\\>\\:\"\\/\\\\\\|\\?*]/g, '');\r\n }\r\n\r\n /**\r\n * Similar to JSON.stringify, but strips away escape sequences so that the resulting\r\n * string is human-readable (and parsable by JSON formatting/validating tools).\r\n */\r\n export function stringifyAsPrettyJSON(object: any): string {\r\n //let specialCharacterRemover = (key: string, value: string) => value.replace(/[^\\w\\s]/gi, '');\r\n return JSON.stringify(object /*, specialCharacterRemover*/);\r\n }\r\n\r\n /**\r\n * Derive a CLS-compliant name from a specified string. If no allowed characters are present, return a fallback string instead.\r\n * TODO (6708134): this should have a fully Unicode-aware implementation\r\n */\r\n export function deriveClsCompliantName(input: string, fallback: string): string {\r\n debug.assertValue(input, 'input');\r\n\r\n let result = input.replace(/^[^A-Za-z]*/g, '').replace(/[ :\\.\\/\\\\\\-\\u00a0\\u1680\\u180e\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]/g, '_').replace(/[\\W]/g, '');\r\n\r\n return result.length > 0 ? result : fallback;\r\n }\r\n\r\n /** Performs cheap sanitization by stripping away HTML tag (<>) characters. */\r\n export function stripTagDelimiters(s: string): string {\r\n return s.replace(HtmlTagRegex, '');\r\n }\r\n }\r\n\r\n /**\r\n * Interface used for interacting with WCF typed objects.\r\n */\r\n export interface TypedObject {\r\n __type: string;\r\n }\r\n\r\n export interface TextMatch {\r\n start: number;\r\n end: number;\r\n text: string;\r\n }\r\n\r\n /** \r\n * The general utility class.\r\n */\r\n export class Utility {\r\n private static TypeNamespace = 'http://schemas.microsoft.com/sqlbi/2013/01/NLRuntimeService';\r\n\r\n public static JsonContentType = 'application/json';\r\n public static JpegContentType = 'image/jpeg';\r\n public static XJavascriptContentType = 'application/x-javascript';\r\n public static JsonDataType = 'json';\r\n public static BlobDataType = 'blob';\r\n public static HttpGetMethod = 'GET';\r\n public static HttpPostMethod = 'POST';\r\n public static HttpPutMethod = 'PUT';\r\n public static HttpDeleteMethod = 'DELETE';\r\n public static HttpContentTypeHeader = 'Content-Type';\r\n public static HttpAcceptHeader = 'Accept';\r\n public static Undefined = 'undefined';\r\n\r\n private static staticContentLocation: string = window.location.protocol + '//' + window.location.host;\r\n \r\n /**\r\n * Ensures the specified value is not null or undefined. Throws a relevent exception if it is.\r\n * @param value The value to check.\r\n * @param context The context from which the check originated.\r\n * @param methodName The name of the method that initiated the check.\r\n * @param parameterName The parameter name of the value to check.\r\n */\r\n public static throwIfNullOrUndefined(value, context, methodName, parameterName) {\r\n if (value === null) {\r\n Utility.throwException(Errors.argumentNull(Utility.getComponentName(context) + methodName + '.' + parameterName));\r\n }\r\n else if (typeof (value) === Utility.Undefined) {\r\n Utility.throwException(Errors.argumentUndefined(Utility.getComponentName(context) + methodName + '.' + parameterName));\r\n }\r\n }\r\n\r\n /**\r\n * Ensures the specified value is not null, undefined or empty. Throws a relevent exception if it is.\r\n * @param value The value to check.\r\n * @param context The context from which the check originated.\r\n * @param methodName The name of the method that initiated the check.\r\n * @param parameterName The parameter name of the value to check.\r\n */\r\n public static throwIfNullOrEmpty(value: any, context: any, methodName: string, parameterName: string) {\r\n Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);\r\n if (!value.length) {\r\n Utility.throwException(Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));\r\n }\r\n }\r\n\r\n /**\r\n * Ensures the specified string is not null, undefined or empty. Throws a relevent exception if it is.\r\n * @param value The value to check.\r\n * @param context The context from which the check originated.\r\n * @param methodName The name of the method that initiated the check.\r\n * @param parameterName The parameter name of the value to check.\r\n */\r\n public static throwIfNullOrEmptyString(value: string, context: any, methodName: string, parameterName: string) {\r\n Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);\r\n if (value.length < 1) {\r\n Utility.throwException(Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));\r\n }\r\n }\r\n\r\n /**\r\n * Ensures the specified value is not null, undefined, whitespace or empty. Throws a relevent exception if it is.\r\n * @param value The value to check.\r\n * @param context The context from which the check originated.\r\n * @param methodName The name of the method that initiated the check.\r\n * @param parameterName The parameter name of the value to check.\r\n */\r\n public static throwIfNullEmptyOrWhitespaceString(value: string, context: any, methodName: string, parameterName: string) {\r\n Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);\r\n if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(value)) {\r\n Utility.throwException(Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));\r\n }\r\n }\r\n\r\n /**\r\n * Ensures the specified condition is true. Throws relevant exception if it isn't.\r\n * @param condition The condition to check.\r\n * @param context The context from which the check originated.\r\n * @param methodName The name of the method that initiated the check.\r\n * @param parameterName The parameter name against which the condition is checked.\r\n */\r\n public static throwIfNotTrue(condition: boolean, context: any, methodName: string, parameterName: string) {\r\n if (!condition) {\r\n Utility.throwException(Errors.argument(parameterName, Utility.getComponentName(context) + methodName + '.' + parameterName));\r\n }\r\n }\r\n\r\n /**\r\n * Checks whether the provided value is a 'string'.\r\n * @param value The value to test.\r\n */\r\n public static isString(value: any): boolean {\r\n return ((typeof value) === 'string');\r\n }\r\n\r\n /**\r\n * Checks whether the provided value is a 'boolean'.\r\n * @param value The value to test.\r\n */\r\n public static isBoolean(value: any): boolean {\r\n return ((typeof value) === 'boolean');\r\n }\r\n\r\n /**\r\n * Checks whether the provided value is a 'number'.\r\n * @param value The value to test.\r\n */\r\n public static isNumber(value: any): boolean {\r\n return ((typeof value) === 'number');\r\n }\r\n\r\n /**\r\n * Checks whether the provided value is a Date instance.\r\n * @param value The value to test.\r\n */\r\n public static isDate(value: any): boolean {\r\n return Utility.isObject(value) && (value instanceof Date);\r\n }\r\n\r\n /**\r\n * Checks whether the provided value is an 'object'.\r\n * @param value The value to test.\r\n */\r\n public static isObject(value: any): boolean {\r\n return (value != null) && ((typeof value) === 'object');\r\n }\r\n\r\n /**\r\n * Checks whether the provided value is null or undefined.\r\n * @param value The value to test.\r\n */\r\n public static isNullOrUndefined(value: any): boolean {\r\n return (value === null) || (typeof (value) === Utility.Undefined);\r\n }\r\n\r\n /**\r\n * Combine a base url and a path.\r\n * @param baseUrl The base url.\r\n * @param path The path to add on to the base url.\r\n * @returns The combined url.\r\n */\r\n public static urlCombine(baseUrl: string, path: string) {\r\n Utility.throwIfNullOrUndefined(baseUrl, null, \"urlCombine\", \"baseUrl\");\r\n Utility.throwIfNullOrUndefined(path, null, \"urlCombine\", \"path\");\r\n\r\n // should any of the components be empty, fail gracefuly - this is important when using the test page\r\n if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(path)) {\r\n return baseUrl;\r\n }\r\n\r\n if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(baseUrl)) {\r\n return path;\r\n }\r\n\r\n let finalUrl = baseUrl;\r\n\r\n if (finalUrl.charAt(finalUrl.length - 1) === '/') {\r\n if (path.charAt(0) === '/')\r\n path = path.slice(1);\r\n } else {\r\n if (path.charAt(0) !== '/')\r\n path = '/' + path;\r\n }\r\n\r\n return finalUrl + path;\r\n }\r\n\r\n public static getAbsoluteUri(path: string): string {\r\n Utility.throwIfNullOrUndefined(path, null, \"getAbsoluteUri\", \"path\");\r\n\r\n let url = path;\r\n // Make absolute\r\n if (url && url.indexOf('http') === - 1) {\r\n url = Utility.urlCombine(clusterUri, url);\r\n }\r\n return url;\r\n }\r\n\r\n public static getStaticResourceUri(path: string) {\r\n Utility.throwIfNullOrUndefined(path, null, \"getStaticResourceUri\", \"path\");\r\n\r\n let url = path;\r\n // Make absolute\r\n if (url && url.indexOf('http') === - 1) {\r\n url = jsCommon.Utility.urlCombine(Utility.staticContentLocation, url);\r\n }\r\n return url;\r\n }\r\n\r\n public static getComponentName(context) {\r\n return !context ? '' : (typeof context).toString() + '.';\r\n }\r\n\r\n public static throwException(e) {\r\n Trace.error(\r\n StringExtensions.format(\"Throwing exception: {0}\", JSON.stringify(e)), \r\n /*includeStackTrace*/ e.stack != null ? false : true);\r\n throw e;\r\n }\r\n\r\n public static createClassSelector(className: string): string {\r\n Utility.throwIfNullOrEmptyString(className, null, 'CreateClassSelector', 'className');\r\n return '.' + className;\r\n }\r\n\r\n public static createIdSelector(id: string): string {\r\n Utility.throwIfNullOrEmptyString(id, null, 'CreateIdSelector', 'id');\r\n return '#' + id;\r\n }\r\n\r\n /**\r\n * Creates a client-side Guid string.\r\n * @returns A string representation of a Guid.\r\n */\r\n public static generateGuid(): string {\r\n let guid = \"\",\r\n idx = 0;\r\n\r\n for (idx = 0; idx < 32; idx += 1) {\r\n let guidDigitsItem = Math.random() * 16 | 0;\r\n switch (idx) {\r\n case 8:\r\n case 12:\r\n case 16:\r\n case 20:\r\n guid += \"-\";\r\n break;\r\n }\r\n guid += guidDigitsItem.toString(16);\r\n }\r\n\r\n return guid;\r\n }\r\n\r\n /**\r\n * Try extract a cookie from {@link document.cookie} identified by key.\r\n */\r\n public static getCookieValue(key: string): string {\r\n // the cookie is of the format <key1=value1>; <key2=value2>. Split by ';', then by '=' \r\n // to search for the key\r\n let keyValuePairs = document.cookie.split(';');\r\n for (let i = 0; i < keyValuePairs.length; i++) {\r\n let keyValue = keyValuePairs[i];\r\n let split = keyValue.split('=');\r\n if (split.length > 0 && split[0].trim() === key) {\r\n return keyValue.substr(keyValue.indexOf('=') + 1);\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Extracts the protocol://hostname section of a url.\r\n * @param url The URL from which to extract the section.\r\n * @returns The protocol://hostname portion of the given URL.\r\n */\r\n public static getDomainForUrl(url: string): string {\r\n let hrefObject = Utility.getHrefObjectFromUrl(url);\r\n return hrefObject.prop('protocol') + '//' + hrefObject.prop('hostname');\r\n }\r\n\r\n /**\r\n * Extracts the hostname and absolute path sections of a url.\r\n * @param url The URL from which to extract the section.\r\n * @returns The hostname and absolute path portion of the given URL.\r\n */\r\n public static getHostNameForUrl(url: string): string {\r\n let hrefObject = Utility.getHrefObjectFromUrl(url);\r\n return Utility.urlCombine(hrefObject.prop('hostname'), hrefObject.prop('pathname'));\r\n }\r\n\r\n /**\r\n * Return the original url with query string stripped.\r\n * @param url The URL from which to extract the section.\r\n * @returns the original url with query string stripped.\r\n */\r\n public static getUrlWithoutQueryString(url: string): string {\r\n let hrefObject = Utility.getHrefObjectFromUrl(url);\r\n return hrefObject.prop('protocol') + '//' + Utility.urlCombine(hrefObject.prop('host'), hrefObject.prop('pathname'));\r\n }\r\n\r\n /**\r\n * Extracts the protocol section of a url.\r\n * @param url The URL from which to extract the section.\r\n * @returns The protocol for the current URL.\r\n */\r\n public static getProtocolFromUrl(url: string): string {\r\n return Utility.getHrefObjectFromUrl(url).prop('protocol').replace(':', '');\r\n }\r\n\r\n /**\r\n * Returns a formatted href object from a URL.\r\n * @param url The URL used to generate the object.\r\n * @returns A jQuery object with the url.\r\n */\r\n public static getHrefObjectFromUrl(url: string): JQuery {\r\n let aObject = $('<a>');\r\n aObject = aObject.prop('href', url);\r\n return aObject;\r\n }\r\n\r\n /**\r\n * Converts a WCF representation of a dictionary to a JavaScript dictionary.\r\n * @param wcfDictionary The WCF dictionary to convert.\r\n * @returns The native JavaScript representation of this dictionary.\r\n */\r\n public static convertWcfToJsDictionary(wcfDictionary: any[]): { [index: string]: any; } {\r\n // convert the WCF JSON representation of a dictionary\r\n // to JS dictionary.\r\n // WCF representation: [{\"Key\": Key, \"Value\": Value}..]\r\n // JS representation: [Key: Value ..]\r\n\r\n let result: { [index: string]: any; } = {};\r\n\r\n for (let i = 0; i < wcfDictionary.length; i++) {\r\n let keyValuePair = wcfDictionary[i];\r\n result[keyValuePair['Key']] = keyValuePair['Value'];\r\n }\r\n\r\n return result;\r\n }\r\n\r\n public static getDateFromWcfJsonString(jsonDate: string, fromUtcMilliseconds: boolean): Date {\r\n if (StringExtensions.isNullOrEmpty(jsonDate)) {\r\n return null;\r\n }\r\n let begIndex = jsonDate.indexOf('(');\r\n let endIndex = jsonDate.indexOf(')');\r\n if (begIndex !== -1 && endIndex !== -1) {\r\n let milliseconds = parseInt(jsonDate.substring(begIndex + 1, endIndex), 10);\r\n\r\n if (fromUtcMilliseconds) {\r\n return new Date(milliseconds);\r\n }\r\n else {\r\n let retValue = new Date(0);\r\n retValue.setUTCMilliseconds(milliseconds);\r\n return retValue;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Get the outer html of the given jquery object.\r\n * @param content The jquery object.\r\n * @returns The entire html representation of the object.\r\n */\r\n public static getOuterHtml(content: JQuery): string {\r\n return $('<div>').append(content).html();\r\n }\r\n\r\n /**\r\n * Comparison Method: Compares two integer numbers.\r\n * @param a An integer value.\r\n * @param b An integer value.\r\n * @returns The comparison result.\r\n */\r\n public static compareInt(a: number, b: number): number {\r\n return a - b;\r\n }\r\n \r\n /**\r\n * Return the index of the smallest value in a numerical array.\r\n * @param a A numeric array.\r\n * @returns The index of the smallest value in the array.\r\n */\r\n public static getIndexOfMinValue(a: number[]) {\r\n let retValue = 0;\r\n let currentMinValue = a[0];\r\n\r\n for (let i = 0; i < a.length; i++) {\r\n if (a[i] < currentMinValue) {\r\n currentMinValue = a[i];\r\n retValue = i;\r\n }\r\n }\r\n\r\n return retValue;\r\n }\r\n \r\n /**\r\n * Extracts a url from a background image attribute in the format of: url('www.foobar.com/image.png').\r\n * @param input The value of the background-image attribute.\r\n * @returns The extracted url.\r\n */\r\n public static extractUrlFromCssBackgroundImage(input: string) {\r\n return input.replace(/\"/g, \"\").replace(/url\\(|\\)$/ig, \"\");\r\n }\r\n \r\n /**\r\n * Verifies image data url of images.\r\n */\r\n public static isValidImageDataUrl(url: string): boolean {\r\n let regex: RegExp = new RegExp('data:(image\\/(png|jpg|jpeg|gif|svg))');\r\n return regex.test(url);\r\n }\r\n \r\n public static isLocalUrl(url: string): boolean {\r\n return _.startsWith(url, \"data:\") || _.startsWith(url, \"blob:\");\r\n }\r\n\r\n /**\r\n * Downloads a content string as a file.\r\n * @param content Content stream.\r\n * @param fileName File name to use.\r\n */\r\n public static saveAsFile(content: any, fileName: string): void {\r\n let contentBlob = new Blob([content], { type: HttpConstants.ApplicationOctetStream });\r\n let url = window['webkitURL'] || URL;\r\n let urlLink = url.createObjectURL(contentBlob);\r\n let fileNameLink = fileName || urlLink;\r\n\r\n // IE support, use msSaveOrOpenBlob API\r\n if (window.navigator.msSaveOrOpenBlob) {\r\n window.navigator.msSaveOrOpenBlob(contentBlob, fileNameLink);\r\n return;\r\n }\r\n\r\n // WebKit-based browser support requires generating an anchor tag with\r\n // download attribute set to blob store and triggering a click event to invoke \r\n // a download to file action\r\n let hyperlink = document.createElement('a');\r\n hyperlink.href = urlLink;\r\n hyperlink.target = '_blank';\r\n hyperlink['download'] = fileNameLink;\r\n document.body.appendChild(hyperlink);\r\n hyperlink.click();\r\n\r\n document.body.removeChild(hyperlink);\r\n }\r\n\r\n /**\r\n * Helper method to get the simple type name from a typed object.\r\n * @param obj The typed object.\r\n * @returns The simple type name for the object.\r\n */\r\n public static getType(obj: TypedObject) {\r\n Utility.throwIfNullEmptyOrWhitespaceString(obj.__type, this, 'getType', 'obj');\r\n\r\n let parts = obj.__type.split(\":\");\r\n\r\n if (parts.length !== 2) {\r\n Errors.argument(\"obj.__type\", \"Type String not in expected format [Type]#[Namespace]: \" + obj.__type);\r\n }\r\n\r\n if (parts[1] !== Utility.TypeNamespace) {\r\n Errors.argument(\"obj.__type\", \"Type Namespace not expected: \" + parts[1]);\r\n }\r\n\r\n return parts[0];\r\n }\r\n\r\n /** \r\n * Check if an element supports a specific event type.\r\n * @param eventName The name of the event.\r\n * @param element The element to test for event support.\r\n * @returns Whether the even is supported on the provided element.\r\n */\r\n public static isEventSupported(eventName: string, element: Element): boolean {\r\n eventName = 'on' + eventName;\r\n let isSupported = (eventName in element);\r\n\r\n if (!isSupported) {\r\n // if we can't use setAttribute try a generic element\r\n if (!element.setAttribute) {\r\n element = document.createElement('div');\r\n }\r\n if (element.setAttribute && element.removeAttribute) {\r\n element.setAttribute(eventName, '');\r\n isSupported = typeof element[eventName] === 'function';\r\n\r\n // if the property was created - remove it\r\n if (typeof element[eventName] !== 'undefined') {\r\n element[eventName] = null;\r\n }\r\n\r\n element.removeAttribute(eventName);\r\n }\r\n }\r\n\r\n element = null;\r\n return isSupported;\r\n }\r\n\r\n public static toPixel(pixelAmount: number): string {\r\n Utility.throwIfNullOrUndefined(pixelAmount, this, \"toPixel\", \"pixelAmount\");\r\n\r\n return pixelAmount.toString() + CssConstants.pixelUnits;\r\n }\r\n\r\n public static getPropertyCount(object: any) {\r\n Utility.throwIfNullOrUndefined(object, this, \"getPropertyCount\", \"object\");\r\n return Object.getOwnPropertyNames(object).length;\r\n }\r\n\r\n /** \r\n * Check if an element supports a specific event type.\r\n * @param filePath File path.\r\n * @returns File extension.\r\n */\r\n public static getFileExtension(filePath: string): string {\r\n if (filePath) {\r\n let index = filePath.lastIndexOf('.');\r\n if (index >= 0)\r\n return filePath.substr(index + 1);\r\n }\r\n return '';\r\n }\r\n\r\n /** \r\n * Extract the filename out of a full path delimited by '\\' or '/'.\r\n * @param filePath File path.\r\n * @returns filename File name.\r\n */\r\n public static extractFileNameFromPath(filePath: string): string {\r\n return filePath.replace(/^.*[\\\\\\/]/, '');\r\n }\r\n\r\n /**\r\n * This method indicates whether window.clipboardData is supported.\r\n * For example, clipboard support for Windows Store apps is currently disabled \r\n * since window.clipboardData is unsupported (it raises access denied error)\r\n * since clipboard in Windows Store is being \r\n * achieved through Windows.ApplicationModel.DataTransfer.Clipboard class.\r\n */\r\n public static canUseClipboard(): boolean {\r\n return (typeof MSApp === \"undefined\");\r\n }\r\n\r\n public static is64BitOperatingSystem(): boolean {\r\n return navigator.userAgent.indexOf(\"WOW64\") !== -1 ||\r\n navigator.userAgent.indexOf(\"Win64\") !== -1;\r\n }\r\n\r\n public static parseNumber(value: any, defaultValue?: number): number {\r\n if (value === null)\r\n return null;\r\n if (value === undefined)\r\n return defaultValue;\r\n \r\n let result = Number(value);\r\n if (isFinite(result))\r\n return result;\r\n if (isNaN(result) && !(typeof value === \"number\" || value === \"NaN\"))\r\n return defaultValue;\r\n return result;\r\n }\r\n\r\n public static getURLParamValue(name:string) {\r\n let results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);\r\n if (results == null) {\r\n return null;\r\n }\r\n else {\r\n return results[1] || 0;\r\n }\r\n }\r\n\r\n /**\r\n * Return local timezone.\r\n * This function uses summer and winter offset to determine local time zone.\r\n * The result localTimeZoneString must be a subset of the strings used by server, \r\n * as documented here: https://msdn.microsoft.com/en-us/library/gg154758.aspx (Dynamic Daylight Savings Time (Compact 2013)).\r\n * @return Local timezone string or UTC if timezone cannot be found.\r\n */\r\n public static getLocalTimeZoneString(): string {\r\n let timeSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0));\r\n let summerOffset = -1 * timeSummer.getTimezoneOffset();\r\n let timeWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0));\r\n let winterOffset = -1 * timeWinter.getTimezoneOffset();\r\n let localTimeZoneString;\r\n\r\n if (-720 === summerOffset && -720 === winterOffset) { localTimeZoneString = 'Dateline Standard Time'; }\r\n else if (-660 === summerOffset && -660 === winterOffset) { localTimeZoneString = 'UTC-11'; }\r\n else if (-660 === summerOffset && -660 === winterOffset) { localTimeZoneString = 'Samoa Standard Time'; }\r\n else if (-600 === summerOffset && -600 === winterOffset) { localTimeZoneString = 'Hawaiian Standard Time'; }\r\n else if (-480 === summerOffset && -540 === winterOffset) { localTimeZoneString = 'Alaskan Standard Time'; }\r\n else if (-420 === summerOffset && -480 === winterOffset) { localTimeZoneString = 'Pacific Standard Time'; }\r\n else if (-420 === summerOffset && -420 === winterOffset) { localTimeZoneString = 'US Mountain Standard Time'; }\r\n else if (-360 === summerOffset && -420 === winterOffset) { localTimeZoneString = 'Mountain Standard Time'; }\r\n else if (-360 === summerOffset && -360 === winterOffset) { localTimeZoneString = 'Central America Standard Time'; }\r\n else if (-300 === summerOffset && -360 === winterOffset) { localTimeZoneString = 'Central Standard Time'; }\r\n else if (-300 === summerOffset && -300 === winterOffset) { localTimeZoneString = 'SA Pacific Standard Time'; }\r\n else if (-240 === summerOffset && -300 === winterOffset) { localTimeZoneString = 'Eastern Standard Time'; }\r\n else if (-270 === summerOffset && -270 === winterOffset) { localTimeZoneString = 'Venezuela Standard Time'; }\r\n else if (-240 === summerOffset && -240 === winterOffset) { localTimeZoneString = 'SA Western Standard Time'; }\r\n else if (-240 === summerOffset && -180 === winterOffset) { localTimeZoneString = 'Central Brazilian Standard Time'; }\r\n else if (-180 === summerOffset && -240 === winterOffset) { localTimeZoneString = 'Atlantic Standard Time'; }\r\n else if (-180 === summerOffset && -180 === winterOffset) { localTimeZoneString = 'Montevideo Standard Time'; }\r\n else if (-180 === summerOffset && -120 === winterOffset) { localTimeZoneString = 'E. South America Standard Time'; }\r\n else if (-150 === summerOffset && -210 === winterOffset) { localTimeZoneString = 'Mid-Atlantic Standard Time'; }\r\n else if (-120 === summerOffset && -120 === winterOffset) { localTimeZoneString = 'SA Eastern Standard Time'; }\r\n else if (0 === summerOffset && 0 === winterOffset) { localTimeZoneString = 'UTC'; }\r\n else if (60 === summerOffset && 0 === winterOffset) { localTimeZoneString = 'GMT Standard Time'; }\r\n else if (60 === summerOffset && 120 === winterOffset) { localTimeZoneString = 'Namibia Standard Time'; }\r\n else if (120 === summerOffset && 60 === winterOffset) { localTimeZoneString = 'Romance Standard Time'; }\r\n else if (120 === summerOffset && 120 === winterOffset) { localTimeZoneString = 'South Africa Standard Time'; }\r\n else if (180 === summerOffset && 120 === winterOffset) { localTimeZoneString = 'GTB Standard Time'; }\r\n else if (180 === summerOffset && 180 === winterOffset) { localTimeZoneString = 'E. Africa Standard Time'; }\r\n else if (240 === summerOffset && 180 === winterOffset) { localTimeZoneString = 'Russian Standard Time'; }\r\n else if (240 === summerOffset && 240 === winterOffset) { localTimeZoneString = 'Arabian Standard Time'; }\r\n else if (270 === summerOffset && 210 === winterOffset) { localTimeZoneString = 'Iran Standard Time'; }\r\n else if (270 === summerOffset && 270 === winterOffset) { localTimeZoneString = 'Afghanistan Standard Time'; }\r\n else if (300 === summerOffset && 240 === winterOffset) { localTimeZoneString = 'Pakistan Standard Time'; }\r\n else if (300 === summerOffset && 300 === winterOffset) { localTimeZoneString = 'West Asia Standard Time'; }\r\n else if (330 === summerOffset && 330 === winterOffset) { localTimeZoneString = 'India Standard Time'; }\r\n else if (345 === summerOffset && 345 === winterOffset) { localTimeZoneString = 'Nepal Standard Time'; }\r\n else if (360 === summerOffset && 300 === winterOffset) { localTimeZoneString = 'N. Central Asia Standard Time'; }\r\n else if (360 === summerOffset && 360 === winterOffset) { localTimeZoneString = 'Central Asia Standard Time'; }\r\n else if (390 === summerOffset && 390 === winterOffset) { localTimeZoneString = 'Myanmar Standard Time'; }\r\n else if (420 === summerOffset && 360 === winterOffset) { localTimeZoneString = 'North Asia Standard Time'; }\r\n else if (420 === summerOffset && 420 === winterOffset) { localTimeZoneString = 'SE Asia Standard Time'; }\r\n else if (480 === summerOffset && 420 === winterOffset) { localTimeZoneString = 'North Asia East Standard Time'; }\r\n else if (480 === summerOffset && 480 === winterOffset) { localTimeZoneString = 'China Standard Time'; }\r\n else if (540 === summerOffset && 480 === winterOffset) { localTimeZoneString = 'Yakutsk Standard Time'; }\r\n else if (540 === summerOffset && 540 === winterOffset) { localTimeZoneString = 'Tokyo Standard Time'; }\r\n else if (570 === summerOffset && 570 === winterOffset) { localTimeZoneString = 'Cen. Australia Standard Time'; }\r\n else if (600 === summerOffset && 600 === winterOffset) { localTimeZoneString = 'E. Australia Standard Time'; }\r\n else if (600 === summerOffset && 660 === winterOffset) { localTimeZoneString = 'AUS Eastern Standard Time'; }\r\n else if (660 === summerOffset && 600 === winterOffset) { localTimeZoneString = 'Tasmania Standard Time'; }\r\n else if (660 === summerOffset && 660 === winterOffset) { localTimeZoneString = 'West Pacific Standard Time'; }\r\n else if (690 === summerOffset && 690 === winterOffset) { localTimeZoneString = 'Central Pacific Standard Time'; }\r\n else if (720 === summerOffset && 660 === winterOffset) { localTimeZoneString = 'Magadan Standard Time'; }\r\n else if (720 === summerOffset && 720 === winterOffset) { localTimeZoneString = 'Fiji Standard Time'; }\r\n else if (720 === summerOffset && 780 === winterOffset) { localTimeZoneString = 'New Zealand Standard Time'; }\r\n else if (780 === summerOffset && 780 === winterOffset) { localTimeZoneString = 'Tonga Standard Time'; }\r\n else { localTimeZoneString = 'UTC'; }\r\n return localTimeZoneString;\r\n }\r\n }\r\n\r\n export class VersionUtility {\r\n /**\r\n * Compares 2 version strings.\r\n * @param versionA The first version string.\r\n * @param versionB The second version string.\r\n * @returns A result for the comparison.\r\n */\r\n static compareVersions(versionA: string, versionB: string): number {\r\n let a = versionA.split('.').map(parseFloat);\r\n let b = versionB.split('.').map(parseFloat);\r\n\r\n let versionParts = Math.max(a.length, b.length);\r\n\r\n for (let i = 0; i < versionParts; i++) {\r\n let partA = a[i] || 0;\r\n let partB = b[i] || 0;\r\n\r\n if (partA > partB)\r\n return 1;\r\n\r\n if (partA < partB)\r\n return -1;\r\n }\r\n\r\n return 0;\r\n }\r\n }\r\n\r\n export module PerformanceUtil {\r\n export class PerfMarker {\r\n private _name: string;\r\n private _start: string;\r\n\r\n constructor(name: string) {\r\n this._name = name;\r\n this._start = PerfMarker.begin(name);\r\n }\r\n\r\n private static begin(name: string) {\r\n if (window.performance === undefined || performance.mark === undefined) return;\r\n if (console.time) {\r\n console.time(name);\r\n }\r\n name = 'Begin ' + name;\r\n performance.mark(name);\r\n return name;\r\n }\r\n\r\n public end() {\r\n if (window.performance === undefined || performance.mark === undefined || performance.measure === undefined) return;\r\n let name = this._name;\r\n let end = 'End ' + name;\r\n performance.mark(end);\r\n performance.measure(name, this._start, end);\r\n if (console.timeEnd) {\r\n console.timeEnd(name);\r\n }\r\n }\r\n }\r\n\r\n export function create(name: string): PerfMarker {\r\n return new PerfMarker(name);\r\n }\r\n }\r\n\r\n export module DeferUtility {\r\n /**\r\n * Wraps a callback and returns a new function.\r\n * The function can be called many times but the callback\r\n * will only be executed once on the next frame.\r\n * Use this to throttle big UI updates and access to DOM.\r\n */\r\n export function deferUntilNextFrame(callback: Function): Function {\r\n let isWaiting, args, context;\r\n\r\n if (!window.requestAnimationFrame) {\r\n window.requestAnimationFrame = (func) => setTimeout(func, 1000 / 50);\r\n }\r\n\r\n return function() {\r\n if (!isWaiting) {\r\n isWaiting = true;\r\n args = arguments;\r\n context = this;\r\n window.requestAnimationFrame(() => {\r\n isWaiting = false;\r\n callback.apply(context, args);\r\n });\r\n }\r\n };\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n export class TraceItem {\r\n public type: TraceType;\r\n public sessionId: string;\r\n public requestId: string;\r\n public text: string;\r\n public timeStamp: Date;\r\n\r\n /** \r\n * Note: DO NOT USE for backward compability only.\r\n */\r\n public _activityId: string;\r\n\r\n private static traceTypeStrings: string[] = [\r\n 'INFORMATION',\r\n 'VERBOSE',\r\n 'WARNING',\r\n 'ERROR',\r\n 'EXPECTEDERROR',\r\n 'UNEXPECTEDERROR',\r\n 'FATAL',\r\n ];\r\n\r\n constructor(text: string, type: TraceType, sessionId: string, requestId?: string) {\r\n this.text = text;\r\n this.type = type;\r\n this.sessionId = sessionId;\r\n this.requestId = requestId;\r\n this.timeStamp = new Date();\r\n }\r\n\r\n public toString(): string {\r\n let resultString: string = '';\r\n\r\n resultString += (StringExtensions.format(\r\n '{0} ({1}): {2}',\r\n TraceItem.traceTypeStrings[this.type],\r\n this.timeStamp.toUTCString(),\r\n this.text));\r\n\r\n if (this.requestId)\r\n resultString += ('\\n(Request id: ' + this.requestId + ')');\r\n\r\n return resultString;\r\n }\r\n }\r\n} ","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n\r\n export module UrlUtils {\r\n const urlRegex = /http[s]?:\\/\\/(\\S)+/gi;\r\n\r\n export function isValidUrl(value: string): boolean {\r\n if (StringExtensions.isNullOrEmpty(value))\r\n return false;\r\n\r\n let match = RegExpExtensions.run(urlRegex, value);\r\n if (!!match && match.index === 0)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /* Tests whether a URL is valid.\r\n * @param url The url to be tested.\r\n * @returns Whether the provided url is valid.\r\n **/\r\n export function isValidImageUrl(url: string): boolean {\r\n // VSTS: 7252099 / 7112236\r\n // For now, passes for any valid Url\r\n\r\n return isValidUrl(url);\r\n }\r\n\r\n export function findAllValidUrls(text: string): TextMatch[] {\r\n if (StringExtensions.isNullOrEmpty(text))\r\n return [];\r\n\r\n // Find all urls in the text.\r\n // TODO: This could potentially be expensive, maybe include a cap here for text with many urls?\r\n let urlRanges: TextMatch[] = [];\r\n let matches: RegExpExecArray;\r\n let start = 0;\r\n while ((matches = RegExpExtensions.run(urlRegex, text, start)) !== null) {\r\n let url = matches[0];\r\n let end = matches.index + url.length;\r\n urlRanges.push({\r\n start: matches.index,\r\n end: end,\r\n text: url,\r\n });\r\n start = end;\r\n }\r\n\r\n return urlRanges;\r\n }\r\n\r\n export function getBase64ContentFromDataUri(uri: string): string {\r\n if (uri.indexOf('data:') !== 0)\r\n throw new Error(\"Expected data uri\");\r\n\r\n // Locate the base 64 content from the URL (e.g. \"data:image/png;base64,xxxxx=\")\r\n const base64Token = \";base64,\";\r\n let indexBase64TokenStart = uri.indexOf(base64Token);\r\n if (indexBase64TokenStart < 0)\r\n throw new Error(\"Expected base 64 content in data url\");\r\n\r\n let indexBase64Start = indexBase64TokenStart + base64Token.length;\r\n return uri.substr(indexBase64Start, uri.length - indexBase64Start);\r\n }\r\n\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n export module BrowserUtils {\r\n export function isChrome(): boolean {\r\n let vendorName = window.navigator.vendor || \"\";\r\n let userAgent = window.navigator.userAgent.toLowerCase();\r\n\r\n return vendorName.toLowerCase().indexOf('google') > -1 &&\r\n userAgent.indexOf('chrome') > -1 &&\r\n userAgent.indexOf('edge') === -1 &&\r\n userAgent.indexOf('opr') === -1;\r\n }\r\n\r\n export function isInternetExplorerOrEdge(): boolean {\r\n let userAgent = window.navigator.userAgent.toLowerCase();\r\n return userAgent.indexOf('msie') > -1\r\n || userAgent.indexOf('trident') > -1\r\n || userAgent.indexOf('edge') > -1;\r\n }\r\n \r\n /**\r\n * Get the current version of IE\r\n * @returns The version of Internet Explorer or a 0 (indicating the use of another browser).\r\n */\r\n export function getInternetExplorerVersion(): number {\r\n var retValue = 0;\r\n if (navigator.appName === 'Microsoft Internet Explorer' || window.navigator.userAgent.indexOf('MSIE') >= 0) {\r\n var re = new RegExp('MSIE ([0-9]{1,}[\\\\.0-9]{0,})');\r\n var result = re.exec(window.navigator.userAgent);\r\n if (result) {\r\n retValue = parseFloat(result[1]);\r\n }\r\n }\r\n\r\n return retValue;\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n // NOTE: this file includes standalone utilities that should have no dependencies on external libraries, including jQuery.\r\n\r\n /**\r\n * Interface to help define objects indexed by number to a particular type.\r\n */\r\n export interface INumberDictionary<T> {\r\n [key: number]: T;\r\n }\r\n\r\n /**\r\n * Interface to help define objects indexed by name to a particular type.\r\n */\r\n export interface IStringDictionary<T> {\r\n [key: string]: T;\r\n }\r\n\r\n /**\r\n * Extensions for Enumerations.\r\n */\r\n export module EnumExtensions {\r\n /**\r\n * Gets a value indicating whether the value has the bit flags set.\r\n */\r\n export function hasFlag(value: number, flag: number): boolean {\r\n debug.assert(!!flag, 'flag must be specified and nonzero.');\r\n\r\n return (value & flag) === flag;\r\n }\r\n\r\n /**\r\n * Sets a value of a flag without modifying any other flags.\r\n */ \r\n export function setFlag(value: number, flag: number): number {\r\n debug.assert(!!flag, \"flag must be specified and nonzero.\");\r\n return value |= flag;\r\n }\r\n\r\n /**\r\n * Resets a value of a flag without modifying any other flags.\r\n */ \r\n export function resetFlag(value: number, flag: number): number {\r\n debug.assert(!!flag, \"flag must be specified and nonzero.\");\r\n return value &= ~flag;\r\n }\r\n\r\n /**\r\n * According to the TypeScript Handbook, this is safe to do.\r\n */\r\n export function toString(enumType: any, value: number): string {\r\n return enumType[value];\r\n }\r\n }\r\n\r\n /**\r\n * Extensions to String class.\r\n */\r\n export module StringExtensions {\r\n /**\r\n * Checks if a string ends with a sub-string.\r\n */\r\n export function endsWith(str: string, suffix: string): boolean {\r\n debug.assertValue(str, 'str');\r\n debug.assertValue(suffix, 'suffix');\r\n\r\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\r\n }\r\n }\r\n\r\n export module LogicExtensions {\r\n export function XOR(a: boolean, b: boolean): boolean {\r\n return (a || b) && !(a && b);\r\n }\r\n }\r\n\r\n export module JsonComparer {\r\n /**\r\n * Performs JSON-style comparison of two objects.\r\n */\r\n export function equals<T>(x: T, y: T): boolean {\r\n if (x === y)\r\n return true;\r\n\r\n return JSON.stringify(x) === JSON.stringify(y);\r\n }\r\n }\r\n\r\n /**\r\n * Values are in terms of 'pt'\r\n * Convert to pixels using PixelConverter.fromPoint\r\n */\r\n export module TextSizeDefaults {\r\n /**\r\n * Stored in terms of 'pt'\r\n * Convert to pixels using PixelConverter.fromPoint\r\n */\r\n export const TextSizeMin: number = 8;\r\n\r\n /**\r\n * Stored in terms of 'pt'\r\n * Convert to pixels using PixelConverter.fromPoint\r\n */\r\n export const TextSizeMax: number = 40;\r\n\r\n const TextSizeRange: number = TextSizeMax - TextSizeMin;\r\n\r\n /**\r\n * Returns the percentage of this value relative to the TextSizeMax\r\n * @param textSize - should be given in terms of 'pt'\r\n */\r\n export function getScale(textSize: number) {\r\n return (textSize - TextSizeMin) / TextSizeRange;\r\n }\r\n\r\n }\r\n\r\n export module PixelConverter {\r\n const PxPtRatio: number = 4 / 3;\r\n const PixelString: string = 'px';\r\n\r\n /**\r\n * Appends 'px' to the end of number value for use as pixel string in styles\r\n */\r\n export function toString(px: number): string {\r\n return px + PixelString;\r\n }\r\n\r\n /**\r\n * Converts point value (pt) to pixels\r\n * Returns a string for font-size property\r\n * e.g. fromPoint(8) => '24px'\r\n */\r\n export function fromPoint(pt: number): string {\r\n return toString(fromPointToPixel(pt));\r\n }\r\n\r\n /**\r\n * Converts point value (pt) to pixels\r\n * Returns a number for font-size property\r\n * e.g. fromPoint(8) => 24px\r\n */\r\n export function fromPointToPixel(pt: number): number {\r\n return (PxPtRatio * pt);\r\n }\r\n\r\n /**\r\n * Converts pixel value (px) to pt\r\n * e.g. toPoint(24) => 8\r\n */\r\n export function toPoint(px: number): number {\r\n return px / PxPtRatio;\r\n }\r\n }\r\n\r\n export module RegExpExtensions {\r\n /**\r\n * Runs exec on regex starting from 0 index\r\n * This is the expected behavior but RegExp actually remember\r\n * the last index they stopped at (found match at) and will\r\n * return unexpected results when run in sequence.\r\n * @param regex - regular expression object\r\n * @param value - string to search wiht regex\r\n * @param start - index within value to start regex\r\n */\r\n export function run(regex: RegExp, value: string, start?: number): RegExpExecArray {\r\n debug.assertValue(regex, 'regex');\r\n\r\n regex.lastIndex = start || 0;\r\n return regex.exec(value);\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule powerbi.visuals.utility {\r\n import ExtendedCSSProperties = jsCommon.ExtendedCSSProperties;\r\n import IThickness = powerbi.visuals.shapes.IThickness;\r\n\r\n export module StyleUtils {\r\n export function getRotateAngleFromElement(element: JQuery): number {\r\n let rawElemStyle = <ExtendedCSSProperties>element.get(0).style;\r\n\r\n let transformString = rawElemStyle.transform || rawElemStyle.webkitTransform;\r\n if (transformString) {\r\n let transform = transformString.match(/rotate\\((-?\\d+(?:\\.\\d*)?)deg\\)/);\r\n if (transform) {\r\n return parseFloat(transform[1]);\r\n }\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n export function getTranslateTransformFromElement(element: JQuery): IPoint {\r\n let rawElemStyle = <ExtendedCSSProperties>element.get(0).style;\r\n \r\n // IE will recognize \"webkitTransform\" as \"WebkitTransform\" and set that as style property. \r\n // This means transform property is not read.\r\n // We put the \"transform\" before the \"webkitTransform\" to counteract the weirdness of IE. \r\n let transformString = rawElemStyle.transform || rawElemStyle.webkitTransform;\r\n\r\n let retValue: IPoint = { x: 0, y: 0 };\r\n\r\n if (transformString && transformString.length > 0) {\r\n let transform = transformString.match(/translate\\((-?\\d+(?:\\.\\d*)?)px, (-?\\d+(?:\\.\\d*)?)px\\)/);\r\n if (transform) {\r\n retValue.x = parseFloat(transform[1]);\r\n retValue.y = parseFloat(transform[2]);\r\n }\r\n }\r\n\r\n return retValue;\r\n }\r\n\r\n export function getPadding(element: JQuery): IThickness {\r\n if (!element)\r\n return;\r\n\r\n return {\r\n left: parseFloat(element.css('padding-left')) || 0,\r\n right: parseFloat(element.css('padding-right')) || 0,\r\n top: parseFloat(element.css('padding-top')) || 0,\r\n bottom: parseFloat(element.css('padding-bottom')) || 0,\r\n };\r\n }\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n export interface ITraceListener {\r\n logTrace(trace: TraceItem): void;\r\n }\r\n\r\n export class ConsoleTracer implements ITraceListener {\r\n public logTrace(trace: TraceItem): void {\r\n if (DEBUG) {\r\n switch (trace.type) {\r\n case TraceType.Information:\r\n console.info(trace.toString());\r\n break;\r\n case TraceType.UnexpectedError:\r\n case TraceType.Error:\r\n case TraceType.Fatal:\r\n console.error(trace.toString());\r\n break;\r\n case TraceType.ExpectedError:\r\n case TraceType.Warning:\r\n console.warn(trace.toString());\r\n break;\r\n case TraceType.Verbose:\r\n console.log(trace.toString());\r\n break;\r\n default:\r\n console.log(trace.toString());\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n export module Trace {\r\n const traceMaxCount = 1000;\r\n let traces = new Array<TraceItem>(traceMaxCount);\r\n let lastTraceIndex: number = -1;\r\n let defaultListener = new ConsoleTracer();\r\n let listeners = new Array<ITraceListener>(defaultListener);\r\n\r\n /**\r\n * Trace a warning. Please ensure that no PII is being logged.\r\n */\r\n export function warning(text: string, requestId?: string): void {\r\n debug.assertValue(text, 'text');\r\n logTraceInternal(new TraceItem(text, TraceType.Warning, requestId));\r\n }\r\n\r\n /** \r\n * Trace an error. Please ensure that no PII is being logged.\r\n */\r\n export function error(text: string, includeStackTrace?: boolean, requestId?: string): void {\r\n debug.assertValue(text, 'text');\r\n if (includeStackTrace)\r\n text = StringExtensions.format(\"{0}.\\nStack:\\n{1}\", text, getStackTrace());\r\n logTraceInternal(new TraceItem(text, TraceType.Error, requestId));\r\n }\r\n\r\n /** \r\n * Trace an information. Please ensure that no PII is being logged.\r\n */\r\n export function verbose(text: string, requestId?: string): void {\r\n debug.assertValue(text, 'text');\r\n logTraceInternal(new TraceItem(text, TraceType.Verbose, requestId));\r\n }\r\n\r\n export function addListener(listener: ITraceListener): void {\r\n debug.assertValue(listener, 'listener');\r\n listeners.push(listener);\r\n }\r\n\r\n export function removeListener(listener: ITraceListener): void {\r\n debug.assertValue(listener, 'listener');\r\n\r\n let index = listeners.indexOf(listener);\r\n if (index >= 0)\r\n listeners.splice(index, 1);\r\n }\r\n\r\n export function resetListeners(): void {\r\n listeners = new Array<ITraceListener>(defaultListener);\r\n }\r\n\r\n export function reset(): void {\r\n lastTraceIndex = -1;\r\n }\r\n\r\n export function getTraces(): Array<TraceItem> {\r\n if (lastTraceIndex < 0)\r\n return;\r\n\r\n let result = new Array<TraceItem>(lastTraceIndex+1);\r\n for (let i = 0; i <= lastTraceIndex; i++)\r\n result[i] = traces[i];\r\n\r\n return result;\r\n }\r\n\r\n /** \r\n * Note: Used for unit-test only. \r\n */\r\n export function disableDefaultListener(): void {\r\n removeListener(defaultListener);\r\n }\r\n\r\n export function enableDefaultListener(): void {\r\n addListener(defaultListener);\r\n }\r\n\r\n function logTraceInternal(trace: TraceItem): void {\r\n if ((lastTraceIndex + 1) >= traceMaxCount)\r\n reset();\r\n\r\n traces[++lastTraceIndex] = trace;\r\n\r\n for (let i = 0, len = listeners.length; i < len; i++)\r\n listeners[i].logTrace(trace);\r\n }\r\n }\r\n} ","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n /** \r\n * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.\r\n */\r\n export enum TraceType {\r\n Information = 0,\r\n Verbose = 1,\r\n Warning = 2,\r\n Error = 3,\r\n ExpectedError = 4,\r\n UnexpectedError = 5,\r\n Fatal = 6,\r\n }\r\n}","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule jsCommon {\r\n /**\r\n * JavaScript files.\r\n */ \r\n const MSMapcontrol = 'https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&onscriptload=globalMapControlLoaded';\r\n\r\n /**\r\n * Map loading logic.\r\n */\r\n let MSMapcontrolLoaded = false;\r\n let WaitForMSMapLoad: JQueryDeferred<void> = null;\r\n\r\n const PowerViewPackage: IDependency = {\r\n javaScriptFiles: [\r\n powerbi.build + '/externals/pv/webclient.js'\r\n ],\r\n cssFiles: [\r\n powerbi.build +'/externals/pv/Styles/_all.css'\r\n ],\r\n\t\tjavaScriptFilesWithCallback: [\r\n { javascriptFile: MSMapcontrol, onLoadCallback: waitForMapControlLoaded }\r\n ]\r\n };\r\n\r\n export function ensurePowerView(action: () => void = _.noop): void {\r\n requires(PowerViewPackage, action);\r\n }\r\n\r\n const MapPackage: IDependency = {\r\n\t\tjavaScriptFilesWithCallback: [\r\n { javascriptFile: MSMapcontrol, onLoadCallback: waitForMapControlLoaded }\r\n ]\r\n };\r\n\r\n export function ensureMap(locale: string, action: () => void): void {\r\n let mapPackageWithLocale = powerbi.Prototype.inherit(MapPackage);\r\n if (!_.isEmpty(locale)) {\r\n mapPackageWithLocale.javaScriptFilesWithCallback[0].javascriptFile = MSMapcontrol.concat('&mkt=' + locale);\r\n }\r\n requires(mapPackageWithLocale, action);\r\n }\r\n\r\n\texport function mapControlLoaded(): void {\r\n\t\tMSMapcontrolLoaded = true;\r\n\t\tif (WaitForMSMapLoad) {\r\n\t\t\tWaitForMSMapLoad.resolve();\r\n WaitForMSMapLoad = undefined;\r\n\t\t}\r\n\t}\r\n\r\n\texport function waitForMapControlLoaded(): JQueryPromise<void> {\r\n\t\tlet task: JQueryDeferred<void>;\r\n\t\tif (!MSMapcontrolLoaded) {\r\n\t\t\ttask = WaitForMSMapLoad = $.Deferred<void>();\r\n\t\t} else {\r\n\t\t\ttask = $.Deferred<void>();\r\n\t\t\ttask.resolve();\r\n\t\t}\r\n\r\n\t\treturn task.promise();\r\n\t}\r\n}\r\n\r\n/* tslint:disable:no-unused-variable */\r\nlet globalMapControlLoaded = function() {\r\n\t// Map requires a function in the global namespace to callback once loaded\r\n\tjsCommon.mapControlLoaded();\r\n};\r\n/* tslint:enable:no-unused-variable */","/*\r\n * Power BI Visualizations\r\n *\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. \r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"\"Software\"\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in \r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n */\r\n\r\nmodule InJs\r\n{\r\n /** \r\n * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.\r\n */\r\n export enum TraceType {\r\n information = 0,\r\n verbose = 1,\r\n warning = 2,\r\n error = 3,\r\n expectedError = 4,\r\n unexpectedError = 5,\r\n fatal = 6,\r\n }\r\n}"],"sourceRoot":"/source/"}
\No newline at end of file