dash-button-web 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2473,7 +2473,1405 @@ function Keycloak (config) {
2473
2473
  }
2474
2474
  }
2475
2475
 
2476
- const dashButtonCss = ".button{display:flex;height:50px;padding:0;background:#3e7671;border:none;outline:none;border-radius:5px;overflow:hidden;font-size:16px;font-weight:500;cursor:pointer;min-width:220px;max-width:220px}.button:hover{background:#008168}.button:active{background:#3e7671}.button-text{display:block;margin:auto;padding:0 24px;color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:80px}.button-icon{margin:auto;padding:10px}.button-profile{display:inline-flex;align-items:center;color:#fff}.button-profile img{height:50px}.button-text-full-width{width:auto!important}.button-link{text-decoration:none!important}.gg-menu-grid-r{color:#fff;box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs,1));width:16px;height:16px}.gg-menu-grid-r::before{content:\"\";display:block;box-sizing:border-box;position:absolute;width:4px;height:4px;background:currentColor;box-shadow:0 6px 0,\n 6px 6px 0,\n 12px 6px 0,\n 6px 12px 0,\n 12px 12px 0,\n 6px 0 0,\n 12px 0 0,\n 0 12px 0}.dropdown{position:relative;display:inline-block}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:180px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;border-radius:5px}.dropdown-content a{color:#71797E;padding:16px 20px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1;color:#000;opacity:0.7}.dropdown:hover .dropdown-content{display:block}.modal{display:none;position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4);text-align:center}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:40%}.modal-body{max-height:50vh;overflow-y:auto}.close{color:#aaaaaa;float:right;font-size:28px;font-weight:bold}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer}.modal-app{background-color:#c3e9bc;padding:15px;margin:10px;border-radius:5px}.external-app-link{text-decoration:none;color:#000}.gray-text{color:#606060}.green-text{color:#3e7671}#countdown{position:relative;margin:auto;margin-top:30px;height:40px;width:40px;text-align:center}#countdown-number{color:#2e2e2e;display:inline-block;line-height:40px}svg{position:absolute;top:0;right:0;width:40px;height:40px;transform:rotateY(-180deg) rotateZ(-90deg)}svg circle{stroke-dasharray:113px;stroke-dashoffset:0px;stroke-linecap:round;stroke-width:4px;stroke:#008168;fill:none;animation:countdown 6s linear infinite forwards}@keyframes countdown{from{stroke-dashoffset:0px}to{stroke-dashoffset:113px}}.lds-ring{color:#fff}.lds-ring{display:flex;justify-content:center;align-items:center;margin:auto;position:relative}.lds-ring div{box-sizing:border-box;display:block;position:absolute;width:30px;height:30px;margin:3px;border:3px solid currentColor;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;border-color:currentColor transparent transparent transparent}.lds-ring div:nth-child(1){animation-delay:-0.45s}.lds-ring div:nth-child(2){animation-delay:-0.3s}.lds-ring div:nth-child(3){animation-delay:-0.15s}@keyframes lds-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
2476
+ /**
2477
+ * Jdenticon 3.3.0
2478
+ * http://jdenticon.com
2479
+ *
2480
+ * Built: 2024-05-10T09:48:41.921Z
2481
+ *
2482
+ * MIT License
2483
+ *
2484
+ * Copyright (c) 2014-2024 Daniel Mester Pirttijärvi
2485
+ *
2486
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2487
+ * of this software and associated documentation files (the "Software"), to deal
2488
+ * in the Software without restriction, including without limitation the rights
2489
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2490
+ * copies of the Software, and to permit persons to whom the Software is
2491
+ * furnished to do so, subject to the following conditions:
2492
+ *
2493
+ * The above copyright notice and this permission notice shall be included in all
2494
+ * copies or substantial portions of the Software.
2495
+ *
2496
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2497
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2498
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2499
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2500
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2501
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2502
+ * SOFTWARE.
2503
+ */
2504
+
2505
+ /**
2506
+ * Parses a substring of the hash as a number.
2507
+ * @param {number} startPosition
2508
+ * @param {number=} octets
2509
+ */
2510
+ function parseHex(hash, startPosition, octets) {
2511
+ return parseInt(hash.substr(startPosition, octets), 16);
2512
+ }
2513
+
2514
+ function decToHex(v) {
2515
+ v |= 0; // Ensure integer value
2516
+ return v < 0 ? "00" :
2517
+ v < 16 ? "0" + v.toString(16) :
2518
+ v < 256 ? v.toString(16) :
2519
+ "ff";
2520
+ }
2521
+
2522
+ function hueToRgb(m1, m2, h) {
2523
+ h = h < 0 ? h + 6 : h > 6 ? h - 6 : h;
2524
+ return decToHex(255 * (
2525
+ h < 1 ? m1 + (m2 - m1) * h :
2526
+ h < 3 ? m2 :
2527
+ h < 4 ? m1 + (m2 - m1) * (4 - h) :
2528
+ m1));
2529
+ }
2530
+
2531
+ /**
2532
+ * @param {string} color Color value to parse. Currently hexadecimal strings on the format #rgb[a] and #rrggbb[aa] are supported.
2533
+ * @returns {string}
2534
+ */
2535
+ function parseColor(color) {
2536
+ if (/^#[0-9a-f]{3,8}$/i.test(color)) {
2537
+ var result;
2538
+ var colorLength = color.length;
2539
+
2540
+ if (colorLength < 6) {
2541
+ var r = color[1],
2542
+ g = color[2],
2543
+ b = color[3],
2544
+ a = color[4] || "";
2545
+ result = "#" + r + r + g + g + b + b + a + a;
2546
+ }
2547
+ if (colorLength == 7 || colorLength > 8) {
2548
+ result = color;
2549
+ }
2550
+
2551
+ return result;
2552
+ }
2553
+ }
2554
+
2555
+ /**
2556
+ * Converts a hexadecimal color to a CSS3 compatible color.
2557
+ * @param {string} hexColor Color on the format "#RRGGBB" or "#RRGGBBAA"
2558
+ * @returns {string}
2559
+ */
2560
+ function toCss3Color(hexColor) {
2561
+ var a = parseHex(hexColor, 7, 2);
2562
+ var result;
2563
+
2564
+ if (isNaN(a)) {
2565
+ result = hexColor;
2566
+ } else {
2567
+ var r = parseHex(hexColor, 1, 2),
2568
+ g = parseHex(hexColor, 3, 2),
2569
+ b = parseHex(hexColor, 5, 2);
2570
+ result = "rgba(" + r + "," + g + "," + b + "," + (a / 255).toFixed(2) + ")";
2571
+ }
2572
+
2573
+ return result;
2574
+ }
2575
+
2576
+ /**
2577
+ * Converts an HSL color to a hexadecimal RGB color.
2578
+ * @param {number} hue Hue in range [0, 1]
2579
+ * @param {number} saturation Saturation in range [0, 1]
2580
+ * @param {number} lightness Lightness in range [0, 1]
2581
+ * @returns {string}
2582
+ */
2583
+ function hsl(hue, saturation, lightness) {
2584
+ // Based on http://www.w3.org/TR/2011/REC-css3-color-20110607/#hsl-color
2585
+ var result;
2586
+
2587
+ if (saturation == 0) {
2588
+ var partialHex = decToHex(lightness * 255);
2589
+ result = partialHex + partialHex + partialHex;
2590
+ }
2591
+ else {
2592
+ var m2 = lightness <= 0.5 ? lightness * (saturation + 1) : lightness + saturation - lightness * saturation,
2593
+ m1 = lightness * 2 - m2;
2594
+ result =
2595
+ hueToRgb(m1, m2, hue * 6 + 2) +
2596
+ hueToRgb(m1, m2, hue * 6) +
2597
+ hueToRgb(m1, m2, hue * 6 - 2);
2598
+ }
2599
+
2600
+ return "#" + result;
2601
+ }
2602
+
2603
+ /**
2604
+ * Converts an HSL color to a hexadecimal RGB color. This function will correct the lightness for the "dark" hues
2605
+ * @param {number} hue Hue in range [0, 1]
2606
+ * @param {number} saturation Saturation in range [0, 1]
2607
+ * @param {number} lightness Lightness in range [0, 1]
2608
+ * @returns {string}
2609
+ */
2610
+ function correctedHsl(hue, saturation, lightness) {
2611
+ // The corrector specifies the perceived middle lightness for each hue
2612
+ var correctors = [ 0.55, 0.5, 0.5, 0.46, 0.6, 0.55, 0.55 ],
2613
+ corrector = correctors[(hue * 6 + 0.5) | 0];
2614
+
2615
+ // Adjust the input lightness relative to the corrector
2616
+ lightness = lightness < 0.5 ? lightness * corrector * 2 : corrector + (lightness - 0.5) * (1 - corrector) * 2;
2617
+
2618
+ return hsl(hue, saturation, lightness);
2619
+ }
2620
+
2621
+ // In the future we can replace `GLOBAL` with `globalThis`, but for now use the old school global detection for
2622
+ // backward compatibility.
2623
+
2624
+ var GLOBAL =
2625
+ typeof window !== "undefined" ? window :
2626
+ typeof self !== "undefined" ? self :
2627
+ typeof commonjsGlobal !== "undefined" ? commonjsGlobal :
2628
+ {};
2629
+
2630
+ /**
2631
+ * @typedef {Object} ParsedConfiguration
2632
+ * @property {number} colorSaturation
2633
+ * @property {number} grayscaleSaturation
2634
+ * @property {string} backColor
2635
+ * @property {number} iconPadding
2636
+ * @property {function(number):number} hue
2637
+ * @property {function(number):number} colorLightness
2638
+ * @property {function(number):number} grayscaleLightness
2639
+ */
2640
+
2641
+ var CONFIG_PROPERTIES = {
2642
+ W/*GLOBAL*/: "jdenticon_config",
2643
+ n/*MODULE*/: "config",
2644
+ };
2645
+
2646
+ var rootConfigurationHolder = {};
2647
+
2648
+ /**
2649
+ * Defines the deprecated `config` property on the root Jdenticon object without printing a warning in the console
2650
+ * when it is being used.
2651
+ * @param {!Object} rootObject
2652
+ */
2653
+ function defineConfigProperty(rootObject) {
2654
+ rootConfigurationHolder = rootObject;
2655
+ }
2656
+
2657
+ /**
2658
+ * Sets a new icon style configuration. The new configuration is not merged with the previous one. *
2659
+ * @param {Object} newConfiguration - New configuration object.
2660
+ */
2661
+ function configure(newConfiguration) {
2662
+ if (arguments.length) {
2663
+ rootConfigurationHolder[CONFIG_PROPERTIES.n/*MODULE*/] = newConfiguration;
2664
+ }
2665
+ return rootConfigurationHolder[CONFIG_PROPERTIES.n/*MODULE*/];
2666
+ }
2667
+
2668
+ /**
2669
+ * Gets the normalized current Jdenticon color configuration. Missing fields have default values.
2670
+ * @param {Object|number|undefined} paddingOrLocalConfig - Configuration passed to the called API method. A
2671
+ * local configuration overrides the global configuration in it entirety. This parameter can for backward
2672
+ * compatibility also contain a padding value. A padding value only overrides the global padding, not the
2673
+ * entire global configuration.
2674
+ * @param {number} defaultPadding - Padding used if no padding is specified in neither the configuration nor
2675
+ * explicitly to the API method.
2676
+ * @returns {ParsedConfiguration}
2677
+ */
2678
+ function getConfiguration(paddingOrLocalConfig, defaultPadding) {
2679
+ var configObject =
2680
+ typeof paddingOrLocalConfig == "object" && paddingOrLocalConfig ||
2681
+ rootConfigurationHolder[CONFIG_PROPERTIES.n/*MODULE*/] ||
2682
+ GLOBAL[CONFIG_PROPERTIES.W/*GLOBAL*/] ||
2683
+ { },
2684
+
2685
+ lightnessConfig = configObject["lightness"] || { },
2686
+
2687
+ // In versions < 2.1.0 there was no grayscale saturation -
2688
+ // saturation was the color saturation.
2689
+ saturation = configObject["saturation"] || { },
2690
+ colorSaturation = "color" in saturation ? saturation["color"] : saturation,
2691
+ grayscaleSaturation = saturation["grayscale"],
2692
+
2693
+ backColor = configObject["backColor"],
2694
+ padding = configObject["padding"];
2695
+
2696
+ /**
2697
+ * Creates a lightness range.
2698
+ */
2699
+ function lightness(configName, defaultRange) {
2700
+ var range = lightnessConfig[configName];
2701
+
2702
+ // Check if the lightness range is an array-like object. This way we ensure the
2703
+ // array contain two values at the same time.
2704
+ if (!(range && range.length > 1)) {
2705
+ range = defaultRange;
2706
+ }
2707
+
2708
+ /**
2709
+ * Gets a lightness relative the specified value in the specified lightness range.
2710
+ */
2711
+ return function (value) {
2712
+ value = range[0] + value * (range[1] - range[0]);
2713
+ return value < 0 ? 0 : value > 1 ? 1 : value;
2714
+ };
2715
+ }
2716
+
2717
+ /**
2718
+ * Gets a hue allowed by the configured hue restriction,
2719
+ * provided the originally computed hue.
2720
+ */
2721
+ function hueFunction(originalHue) {
2722
+ var hueConfig = configObject["hues"];
2723
+ var hue;
2724
+
2725
+ // Check if 'hues' is an array-like object. This way we also ensure that
2726
+ // the array is not empty, which would mean no hue restriction.
2727
+ if (hueConfig && hueConfig.length > 0) {
2728
+ // originalHue is in the range [0, 1]
2729
+ // Multiply with 0.999 to change the range to [0, 1) and then truncate the index.
2730
+ hue = hueConfig[0 | (0.999 * originalHue * hueConfig.length)];
2731
+ }
2732
+
2733
+ return typeof hue == "number" ?
2734
+
2735
+ // A hue was specified. We need to convert the hue from
2736
+ // degrees on any turn - e.g. 746° is a perfectly valid hue -
2737
+ // to turns in the range [0, 1).
2738
+ ((((hue / 360) % 1) + 1) % 1) :
2739
+
2740
+ // No hue configured => use original hue
2741
+ originalHue;
2742
+ }
2743
+
2744
+ return {
2745
+ X/*hue*/: hueFunction,
2746
+ o/*colorSaturation*/: typeof colorSaturation == "number" ? colorSaturation : 0.5,
2747
+ F/*grayscaleSaturation*/: typeof grayscaleSaturation == "number" ? grayscaleSaturation : 0,
2748
+ p/*colorLightness*/: lightness("color", [0.4, 0.8]),
2749
+ G/*grayscaleLightness*/: lightness("grayscale", [0.3, 0.9]),
2750
+ H/*backColor*/: parseColor(backColor),
2751
+ Y/*iconPadding*/:
2752
+ typeof paddingOrLocalConfig == "number" ? paddingOrLocalConfig :
2753
+ typeof padding == "number" ? padding :
2754
+ defaultPadding
2755
+ }
2756
+ }
2757
+
2758
+ /**
2759
+ * Represents a point.
2760
+ */
2761
+ function Point(x, y) {
2762
+ this.x = x;
2763
+ this.y = y;
2764
+ }
2765
+
2766
+ /**
2767
+ * Translates and rotates a point before being passed on to the canvas context. This was previously done by the canvas context itself,
2768
+ * but this caused a rendering issue in Chrome on sizes > 256 where the rotation transformation of inverted paths was not done properly.
2769
+ */
2770
+ function Transform(x, y, size, rotation) {
2771
+ this.q/*_x*/ = x;
2772
+ this.t/*_y*/ = y;
2773
+ this.I/*_size*/ = size;
2774
+ this.Z/*_rotation*/ = rotation;
2775
+ }
2776
+
2777
+ /**
2778
+ * Transforms the specified point based on the translation and rotation specification for this Transform.
2779
+ * @param {number} x x-coordinate
2780
+ * @param {number} y y-coordinate
2781
+ * @param {number=} w The width of the transformed rectangle. If greater than 0, this will ensure the returned point is of the upper left corner of the transformed rectangle.
2782
+ * @param {number=} h The height of the transformed rectangle. If greater than 0, this will ensure the returned point is of the upper left corner of the transformed rectangle.
2783
+ */
2784
+ Transform.prototype.J/*transformIconPoint*/ = function transformIconPoint (x, y, w, h) {
2785
+ var right = this.q/*_x*/ + this.I/*_size*/,
2786
+ bottom = this.t/*_y*/ + this.I/*_size*/,
2787
+ rotation = this.Z/*_rotation*/;
2788
+ return rotation === 1 ? new Point(right - y - (h || 0), this.t/*_y*/ + x) :
2789
+ rotation === 2 ? new Point(right - x - (w || 0), bottom - y - (h || 0)) :
2790
+ rotation === 3 ? new Point(this.q/*_x*/ + y, bottom - x - (w || 0)) :
2791
+ new Point(this.q/*_x*/ + x, this.t/*_y*/ + y);
2792
+ };
2793
+
2794
+ var NO_TRANSFORM = new Transform(0, 0, 0, 0);
2795
+
2796
+
2797
+
2798
+ /**
2799
+ * Provides helper functions for rendering common basic shapes.
2800
+ */
2801
+ function Graphics(renderer) {
2802
+ /**
2803
+ * @type {Renderer}
2804
+ * @private
2805
+ */
2806
+ this.K/*_renderer*/ = renderer;
2807
+
2808
+ /**
2809
+ * @type {Transform}
2810
+ */
2811
+ this.u/*currentTransform*/ = NO_TRANSFORM;
2812
+ }
2813
+ var Graphics__prototype = Graphics.prototype;
2814
+
2815
+ /**
2816
+ * Adds a polygon to the underlying renderer.
2817
+ * @param {Array<number>} points The points of the polygon clockwise on the format [ x0, y0, x1, y1, ..., xn, yn ]
2818
+ * @param {boolean=} invert Specifies if the polygon will be inverted.
2819
+ */
2820
+ Graphics__prototype.g/*addPolygon*/ = function addPolygon (points, invert) {
2821
+ var this$1$1 = this;
2822
+
2823
+ var di = invert ? -2 : 2,
2824
+ transformedPoints = [];
2825
+
2826
+ for (var i = invert ? points.length - 2 : 0; i < points.length && i >= 0; i += di) {
2827
+ transformedPoints.push(this$1$1.u/*currentTransform*/.J/*transformIconPoint*/(points[i], points[i + 1]));
2828
+ }
2829
+
2830
+ this.K/*_renderer*/.g/*addPolygon*/(transformedPoints);
2831
+ };
2832
+
2833
+ /**
2834
+ * Adds a polygon to the underlying renderer.
2835
+ * Source: http://stackoverflow.com/a/2173084
2836
+ * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the entire ellipse.
2837
+ * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the entire ellipse.
2838
+ * @param {number} size The size of the ellipse.
2839
+ * @param {boolean=} invert Specifies if the ellipse will be inverted.
2840
+ */
2841
+ Graphics__prototype.h/*addCircle*/ = function addCircle (x, y, size, invert) {
2842
+ var p = this.u/*currentTransform*/.J/*transformIconPoint*/(x, y, size, size);
2843
+ this.K/*_renderer*/.h/*addCircle*/(p, size, invert);
2844
+ };
2845
+
2846
+ /**
2847
+ * Adds a rectangle to the underlying renderer.
2848
+ * @param {number} x The x-coordinate of the upper left corner of the rectangle.
2849
+ * @param {number} y The y-coordinate of the upper left corner of the rectangle.
2850
+ * @param {number} w The width of the rectangle.
2851
+ * @param {number} h The height of the rectangle.
2852
+ * @param {boolean=} invert Specifies if the rectangle will be inverted.
2853
+ */
2854
+ Graphics__prototype.i/*addRectangle*/ = function addRectangle (x, y, w, h, invert) {
2855
+ this.g/*addPolygon*/([
2856
+ x, y,
2857
+ x + w, y,
2858
+ x + w, y + h,
2859
+ x, y + h
2860
+ ], invert);
2861
+ };
2862
+
2863
+ /**
2864
+ * Adds a right triangle to the underlying renderer.
2865
+ * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the triangle.
2866
+ * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the triangle.
2867
+ * @param {number} w The width of the triangle.
2868
+ * @param {number} h The height of the triangle.
2869
+ * @param {number} r The rotation of the triangle (clockwise). 0 = right corner of the triangle in the lower left corner of the bounding rectangle.
2870
+ * @param {boolean=} invert Specifies if the triangle will be inverted.
2871
+ */
2872
+ Graphics__prototype.j/*addTriangle*/ = function addTriangle (x, y, w, h, r, invert) {
2873
+ var points = [
2874
+ x + w, y,
2875
+ x + w, y + h,
2876
+ x, y + h,
2877
+ x, y
2878
+ ];
2879
+ points.splice(((r || 0) % 4) * 2, 2);
2880
+ this.g/*addPolygon*/(points, invert);
2881
+ };
2882
+
2883
+ /**
2884
+ * Adds a rhombus to the underlying renderer.
2885
+ * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the rhombus.
2886
+ * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the rhombus.
2887
+ * @param {number} w The width of the rhombus.
2888
+ * @param {number} h The height of the rhombus.
2889
+ * @param {boolean=} invert Specifies if the rhombus will be inverted.
2890
+ */
2891
+ Graphics__prototype.L/*addRhombus*/ = function addRhombus (x, y, w, h, invert) {
2892
+ this.g/*addPolygon*/([
2893
+ x + w / 2, y,
2894
+ x + w, y + h / 2,
2895
+ x + w / 2, y + h,
2896
+ x, y + h / 2
2897
+ ], invert);
2898
+ };
2899
+
2900
+ /**
2901
+ * @param {number} index
2902
+ * @param {Graphics} g
2903
+ * @param {number} cell
2904
+ * @param {number} positionIndex
2905
+ */
2906
+ function centerShape(index, g, cell, positionIndex) {
2907
+ index = index % 14;
2908
+
2909
+ var k, m, w, h, inner, outer;
2910
+
2911
+ !index ? (
2912
+ k = cell * 0.42,
2913
+ g.g/*addPolygon*/([
2914
+ 0, 0,
2915
+ cell, 0,
2916
+ cell, cell - k * 2,
2917
+ cell - k, cell,
2918
+ 0, cell
2919
+ ])) :
2920
+
2921
+ index == 1 ? (
2922
+ w = 0 | (cell * 0.5),
2923
+ h = 0 | (cell * 0.8),
2924
+
2925
+ g.j/*addTriangle*/(cell - w, 0, w, h, 2)) :
2926
+
2927
+ index == 2 ? (
2928
+ w = 0 | (cell / 3),
2929
+ g.i/*addRectangle*/(w, w, cell - w, cell - w)) :
2930
+
2931
+ index == 3 ? (
2932
+ inner = cell * 0.1,
2933
+ // Use fixed outer border widths in small icons to ensure the border is drawn
2934
+ outer =
2935
+ cell < 6 ? 1 :
2936
+ cell < 8 ? 2 :
2937
+ (0 | (cell * 0.25)),
2938
+
2939
+ inner =
2940
+ inner > 1 ? (0 | inner) : // large icon => truncate decimals
2941
+ inner > 0.5 ? 1 : // medium size icon => fixed width
2942
+ inner, // small icon => anti-aliased border
2943
+
2944
+ g.i/*addRectangle*/(outer, outer, cell - inner - outer, cell - inner - outer)) :
2945
+
2946
+ index == 4 ? (
2947
+ m = 0 | (cell * 0.15),
2948
+ w = 0 | (cell * 0.5),
2949
+ g.h/*addCircle*/(cell - w - m, cell - w - m, w)) :
2950
+
2951
+ index == 5 ? (
2952
+ inner = cell * 0.1,
2953
+ outer = inner * 4,
2954
+
2955
+ // Align edge to nearest pixel in large icons
2956
+ outer > 3 && (outer = 0 | outer),
2957
+
2958
+ g.i/*addRectangle*/(0, 0, cell, cell),
2959
+ g.g/*addPolygon*/([
2960
+ outer, outer,
2961
+ cell - inner, outer,
2962
+ outer + (cell - outer - inner) / 2, cell - inner
2963
+ ], true)) :
2964
+
2965
+ index == 6 ?
2966
+ g.g/*addPolygon*/([
2967
+ 0, 0,
2968
+ cell, 0,
2969
+ cell, cell * 0.7,
2970
+ cell * 0.4, cell * 0.4,
2971
+ cell * 0.7, cell,
2972
+ 0, cell
2973
+ ]) :
2974
+
2975
+ index == 7 ?
2976
+ g.j/*addTriangle*/(cell / 2, cell / 2, cell / 2, cell / 2, 3) :
2977
+
2978
+ index == 8 ? (
2979
+ g.i/*addRectangle*/(0, 0, cell, cell / 2),
2980
+ g.i/*addRectangle*/(0, cell / 2, cell / 2, cell / 2),
2981
+ g.j/*addTriangle*/(cell / 2, cell / 2, cell / 2, cell / 2, 1)) :
2982
+
2983
+ index == 9 ? (
2984
+ inner = cell * 0.14,
2985
+ // Use fixed outer border widths in small icons to ensure the border is drawn
2986
+ outer =
2987
+ cell < 4 ? 1 :
2988
+ cell < 6 ? 2 :
2989
+ (0 | (cell * 0.35)),
2990
+
2991
+ inner =
2992
+ cell < 8 ? inner : // small icon => anti-aliased border
2993
+ (0 | inner), // large icon => truncate decimals
2994
+
2995
+ g.i/*addRectangle*/(0, 0, cell, cell),
2996
+ g.i/*addRectangle*/(outer, outer, cell - outer - inner, cell - outer - inner, true)) :
2997
+
2998
+ index == 10 ? (
2999
+ inner = cell * 0.12,
3000
+ outer = inner * 3,
3001
+
3002
+ g.i/*addRectangle*/(0, 0, cell, cell),
3003
+ g.h/*addCircle*/(outer, outer, cell - inner - outer, true)) :
3004
+
3005
+ index == 11 ?
3006
+ g.j/*addTriangle*/(cell / 2, cell / 2, cell / 2, cell / 2, 3) :
3007
+
3008
+ index == 12 ? (
3009
+ m = cell * 0.25,
3010
+ g.i/*addRectangle*/(0, 0, cell, cell),
3011
+ g.L/*addRhombus*/(m, m, cell - m, cell - m, true)) :
3012
+
3013
+ // 13
3014
+ (
3015
+ !positionIndex && (
3016
+ m = cell * 0.4, w = cell * 1.2,
3017
+ g.h/*addCircle*/(m, m, w)
3018
+ )
3019
+ );
3020
+ }
3021
+
3022
+ /**
3023
+ * @param {number} index
3024
+ * @param {Graphics} g
3025
+ * @param {number} cell
3026
+ */
3027
+ function outerShape(index, g, cell) {
3028
+ index = index % 4;
3029
+
3030
+ var m;
3031
+
3032
+ !index ?
3033
+ g.j/*addTriangle*/(0, 0, cell, cell, 0) :
3034
+
3035
+ index == 1 ?
3036
+ g.j/*addTriangle*/(0, cell / 2, cell, cell / 2, 0) :
3037
+
3038
+ index == 2 ?
3039
+ g.L/*addRhombus*/(0, 0, cell, cell) :
3040
+
3041
+ // 3
3042
+ (
3043
+ m = cell / 6,
3044
+ g.h/*addCircle*/(m, m, cell - 2 * m)
3045
+ );
3046
+ }
3047
+
3048
+ /**
3049
+ * Gets a set of identicon color candidates for a specified hue and config.
3050
+ * @param {number} hue
3051
+ * @param {ParsedConfiguration} config
3052
+ */
3053
+ function colorTheme(hue, config) {
3054
+ hue = config.X/*hue*/(hue);
3055
+ return [
3056
+ // Dark gray
3057
+ correctedHsl(hue, config.F/*grayscaleSaturation*/, config.G/*grayscaleLightness*/(0)),
3058
+ // Mid color
3059
+ correctedHsl(hue, config.o/*colorSaturation*/, config.p/*colorLightness*/(0.5)),
3060
+ // Light gray
3061
+ correctedHsl(hue, config.F/*grayscaleSaturation*/, config.G/*grayscaleLightness*/(1)),
3062
+ // Light color
3063
+ correctedHsl(hue, config.o/*colorSaturation*/, config.p/*colorLightness*/(1)),
3064
+ // Dark color
3065
+ correctedHsl(hue, config.o/*colorSaturation*/, config.p/*colorLightness*/(0))
3066
+ ];
3067
+ }
3068
+
3069
+ /**
3070
+ * Draws an identicon to a specified renderer.
3071
+ * @param {Renderer} renderer
3072
+ * @param {string} hash
3073
+ * @param {Object|number=} config
3074
+ */
3075
+ function iconGenerator(renderer, hash, config) {
3076
+ var parsedConfig = getConfiguration(config, 0.08);
3077
+
3078
+ // Set background color
3079
+ if (parsedConfig.H/*backColor*/) {
3080
+ renderer.m/*setBackground*/(parsedConfig.H/*backColor*/);
3081
+ }
3082
+
3083
+ // Calculate padding and round to nearest integer
3084
+ var size = renderer.k/*iconSize*/;
3085
+ var padding = (0.5 + size * parsedConfig.Y/*iconPadding*/) | 0;
3086
+ size -= padding * 2;
3087
+
3088
+ var graphics = new Graphics(renderer);
3089
+
3090
+ // Calculate cell size and ensure it is an integer
3091
+ var cell = 0 | (size / 4);
3092
+
3093
+ // Since the cell size is integer based, the actual icon will be slightly smaller than specified => center icon
3094
+ var x = 0 | (padding + size / 2 - cell * 2);
3095
+ var y = 0 | (padding + size / 2 - cell * 2);
3096
+
3097
+ function renderShape(colorIndex, shapes, index, rotationIndex, positions) {
3098
+ var shapeIndex = parseHex(hash, index, 1);
3099
+ var r = rotationIndex ? parseHex(hash, rotationIndex, 1) : 0;
3100
+
3101
+ renderer.M/*beginShape*/(availableColors[selectedColorIndexes[colorIndex]]);
3102
+
3103
+ for (var i = 0; i < positions.length; i++) {
3104
+ graphics.u/*currentTransform*/ = new Transform(x + positions[i][0] * cell, y + positions[i][1] * cell, cell, r++ % 4);
3105
+ shapes(shapeIndex, graphics, cell, i);
3106
+ }
3107
+
3108
+ renderer.N/*endShape*/();
3109
+ }
3110
+
3111
+ // AVAILABLE COLORS
3112
+ var hue = parseHex(hash, -7) / 0xfffffff,
3113
+
3114
+ // Available colors for this icon
3115
+ availableColors = colorTheme(hue, parsedConfig),
3116
+
3117
+ // The index of the selected colors
3118
+ selectedColorIndexes = [];
3119
+
3120
+ var index;
3121
+
3122
+ function isDuplicate(values) {
3123
+ if (values.indexOf(index) >= 0) {
3124
+ for (var i = 0; i < values.length; i++) {
3125
+ if (selectedColorIndexes.indexOf(values[i]) >= 0) {
3126
+ return true;
3127
+ }
3128
+ }
3129
+ }
3130
+ }
3131
+
3132
+ for (var i = 0; i < 3; i++) {
3133
+ index = parseHex(hash, 8 + i, 1) % availableColors.length;
3134
+ if (isDuplicate([0, 4]) || // Disallow dark gray and dark color combo
3135
+ isDuplicate([2, 3])) { // Disallow light gray and light color combo
3136
+ index = 1;
3137
+ }
3138
+ selectedColorIndexes.push(index);
3139
+ }
3140
+
3141
+ // ACTUAL RENDERING
3142
+ // Sides
3143
+ renderShape(0, outerShape, 2, 3, [[1, 0], [2, 0], [2, 3], [1, 3], [0, 1], [3, 1], [3, 2], [0, 2]]);
3144
+ // Corners
3145
+ renderShape(1, outerShape, 4, 5, [[0, 0], [3, 0], [3, 3], [0, 3]]);
3146
+ // Center
3147
+ renderShape(2, centerShape, 1, null, [[1, 1], [2, 1], [2, 2], [1, 2]]);
3148
+
3149
+ renderer.finish();
3150
+ }
3151
+
3152
+ /**
3153
+ * Computes a SHA1 hash for any value and returns it as a hexadecimal string.
3154
+ *
3155
+ * This function is optimized for minimal code size and rather short messages.
3156
+ *
3157
+ * @param {string} message
3158
+ */
3159
+ function sha1(message) {
3160
+ var HASH_SIZE_HALF_BYTES = 40;
3161
+ var BLOCK_SIZE_WORDS = 16;
3162
+
3163
+ // Variables
3164
+ // `var` is used to be able to minimize the number of `var` keywords.
3165
+ var i = 0,
3166
+ f = 0,
3167
+
3168
+ // Use `encodeURI` to UTF8 encode the message without any additional libraries
3169
+ // We could use `unescape` + `encodeURI` to minimize the code, but that would be slightly risky
3170
+ // since `unescape` is deprecated.
3171
+ urlEncodedMessage = encodeURI(message) + "%80", // trailing '1' bit padding
3172
+
3173
+ // This can be changed to a preallocated Uint32Array array for greater performance and larger code size
3174
+ data = [],
3175
+ dataSize,
3176
+
3177
+ hashBuffer = [],
3178
+
3179
+ a = 0x67452301,
3180
+ b = 0xefcdab89,
3181
+ c = ~a,
3182
+ d = ~b,
3183
+ e = 0xc3d2e1f0,
3184
+ hash = [a, b, c, d, e],
3185
+
3186
+ blockStartIndex = 0,
3187
+ hexHash = "";
3188
+
3189
+ /**
3190
+ * Rotates the value a specified number of bits to the left.
3191
+ * @param {number} value Value to rotate
3192
+ * @param {number} shift Bit count to shift.
3193
+ */
3194
+ function rotl(value, shift) {
3195
+ return (value << shift) | (value >>> (32 - shift));
3196
+ }
3197
+
3198
+ // Message data
3199
+ for ( ; i < urlEncodedMessage.length; f++) {
3200
+ data[f >> 2] = data[f >> 2] |
3201
+ (
3202
+ (
3203
+ urlEncodedMessage[i] == "%"
3204
+ // Percent encoded byte
3205
+ ? parseInt(urlEncodedMessage.substring(i + 1, i += 3), 16)
3206
+ // Unencoded byte
3207
+ : urlEncodedMessage.charCodeAt(i++)
3208
+ )
3209
+
3210
+ // Read bytes in reverse order (big endian words)
3211
+ << ((3 - (f & 3)) * 8)
3212
+ );
3213
+ }
3214
+
3215
+ // f is now the length of the utf8 encoded message
3216
+ // 7 = 8 bytes (64 bit) for message size, -1 to round down
3217
+ // >> 6 = integer division with block size
3218
+ dataSize = (((f + 7) >> 6) + 1) * BLOCK_SIZE_WORDS;
3219
+
3220
+ // Message size in bits.
3221
+ // SHA1 uses a 64 bit integer to represent the size, but since we only support short messages only the least
3222
+ // significant 32 bits are set. -8 is for the '1' bit padding byte.
3223
+ data[dataSize - 1] = f * 8 - 8;
3224
+
3225
+ // Compute hash
3226
+ for ( ; blockStartIndex < dataSize; blockStartIndex += BLOCK_SIZE_WORDS) {
3227
+ for (i = 0; i < 80; i++) {
3228
+ f = rotl(a, 5) + e + (
3229
+ // Ch
3230
+ i < 20 ? ((b & c) ^ ((~b) & d)) + 0x5a827999 :
3231
+
3232
+ // Parity
3233
+ i < 40 ? (b ^ c ^ d) + 0x6ed9eba1 :
3234
+
3235
+ // Maj
3236
+ i < 60 ? ((b & c) ^ (b & d) ^ (c & d)) + 0x8f1bbcdc :
3237
+
3238
+ // Parity
3239
+ (b ^ c ^ d) + 0xca62c1d6
3240
+ ) + (
3241
+ hashBuffer[i] = i < BLOCK_SIZE_WORDS
3242
+ // Bitwise OR is used to coerse `undefined` to 0
3243
+ ? (data[blockStartIndex + i] | 0)
3244
+ : rotl(hashBuffer[i - 3] ^ hashBuffer[i - 8] ^ hashBuffer[i - 14] ^ hashBuffer[i - 16], 1)
3245
+ );
3246
+
3247
+ e = d;
3248
+ d = c;
3249
+ c = rotl(b, 30);
3250
+ b = a;
3251
+ a = f;
3252
+ }
3253
+
3254
+ hash[0] = a = ((hash[0] + a) | 0);
3255
+ hash[1] = b = ((hash[1] + b) | 0);
3256
+ hash[2] = c = ((hash[2] + c) | 0);
3257
+ hash[3] = d = ((hash[3] + d) | 0);
3258
+ hash[4] = e = ((hash[4] + e) | 0);
3259
+ }
3260
+
3261
+ // Format hex hash
3262
+ for (i = 0; i < HASH_SIZE_HALF_BYTES; i++) {
3263
+ hexHash += (
3264
+ (
3265
+ // Get word (2^3 half-bytes per word)
3266
+ hash[i >> 3] >>>
3267
+
3268
+ // Append half-bytes in reverse order
3269
+ ((7 - (i & 7)) * 4)
3270
+ )
3271
+ // Clamp to half-byte
3272
+ & 0xf
3273
+ ).toString(16);
3274
+ }
3275
+
3276
+ return hexHash;
3277
+ }
3278
+
3279
+ /**
3280
+ * Inputs a value that might be a valid hash string for Jdenticon and returns it
3281
+ * if it is determined valid, otherwise a falsy value is returned.
3282
+ */
3283
+ function isValidHash(hashCandidate) {
3284
+ return /^[0-9a-f]{11,}$/i.test(hashCandidate) && hashCandidate;
3285
+ }
3286
+
3287
+ /**
3288
+ * Computes a hash for the specified value. Currently SHA1 is used. This function
3289
+ * always returns a valid hash.
3290
+ */
3291
+ function computeHash(value) {
3292
+ return sha1(value == null ? "" : "" + value);
3293
+ }
3294
+
3295
+
3296
+
3297
+ /**
3298
+ * Renderer redirecting drawing commands to a canvas context.
3299
+ * @implements {Renderer}
3300
+ */
3301
+ function CanvasRenderer(ctx, iconSize) {
3302
+ var canvas = ctx.canvas;
3303
+ var width = canvas.width;
3304
+ var height = canvas.height;
3305
+
3306
+ ctx.save();
3307
+
3308
+ if (!iconSize) {
3309
+ iconSize = Math.min(width, height);
3310
+
3311
+ ctx.translate(
3312
+ ((width - iconSize) / 2) | 0,
3313
+ ((height - iconSize) / 2) | 0);
3314
+ }
3315
+
3316
+ /**
3317
+ * @private
3318
+ */
3319
+ this.l/*_ctx*/ = ctx;
3320
+ this.k/*iconSize*/ = iconSize;
3321
+
3322
+ ctx.clearRect(0, 0, iconSize, iconSize);
3323
+ }
3324
+ var CanvasRenderer__prototype = CanvasRenderer.prototype;
3325
+
3326
+ /**
3327
+ * Fills the background with the specified color.
3328
+ * @param {string} fillColor Fill color on the format #rrggbb[aa].
3329
+ */
3330
+ CanvasRenderer__prototype.m/*setBackground*/ = function setBackground (fillColor) {
3331
+ var ctx = this.l/*_ctx*/;
3332
+ var iconSize = this.k/*iconSize*/;
3333
+
3334
+ ctx.fillStyle = toCss3Color(fillColor);
3335
+ ctx.fillRect(0, 0, iconSize, iconSize);
3336
+ };
3337
+
3338
+ /**
3339
+ * Marks the beginning of a new shape of the specified color. Should be ended with a call to endShape.
3340
+ * @param {string} fillColor Fill color on format #rrggbb[aa].
3341
+ */
3342
+ CanvasRenderer__prototype.M/*beginShape*/ = function beginShape (fillColor) {
3343
+ var ctx = this.l/*_ctx*/;
3344
+ ctx.fillStyle = toCss3Color(fillColor);
3345
+ ctx.beginPath();
3346
+ };
3347
+
3348
+ /**
3349
+ * Marks the end of the currently drawn shape. This causes the queued paths to be rendered on the canvas.
3350
+ */
3351
+ CanvasRenderer__prototype.N/*endShape*/ = function endShape () {
3352
+ this.l/*_ctx*/.fill();
3353
+ };
3354
+
3355
+ /**
3356
+ * Adds a polygon to the rendering queue.
3357
+ * @param points An array of Point objects.
3358
+ */
3359
+ CanvasRenderer__prototype.g/*addPolygon*/ = function addPolygon (points) {
3360
+ var ctx = this.l/*_ctx*/;
3361
+ ctx.moveTo(points[0].x, points[0].y);
3362
+ for (var i = 1; i < points.length; i++) {
3363
+ ctx.lineTo(points[i].x, points[i].y);
3364
+ }
3365
+ ctx.closePath();
3366
+ };
3367
+
3368
+ /**
3369
+ * Adds a circle to the rendering queue.
3370
+ * @param {Point} point The upper left corner of the circle bounding box.
3371
+ * @param {number} diameter The diameter of the circle.
3372
+ * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).
3373
+ */
3374
+ CanvasRenderer__prototype.h/*addCircle*/ = function addCircle (point, diameter, counterClockwise) {
3375
+ var ctx = this.l/*_ctx*/,
3376
+ radius = diameter / 2;
3377
+ ctx.moveTo(point.x + radius, point.y + radius);
3378
+ ctx.arc(point.x + radius, point.y + radius, radius, 0, Math.PI * 2, counterClockwise);
3379
+ ctx.closePath();
3380
+ };
3381
+
3382
+ /**
3383
+ * Called when the icon has been completely drawn.
3384
+ */
3385
+ CanvasRenderer__prototype.finish = function finish () {
3386
+ this.l/*_ctx*/.restore();
3387
+ };
3388
+
3389
+ var ICON_TYPE_SVG = 1;
3390
+
3391
+ var ICON_TYPE_CANVAS = 2;
3392
+
3393
+ var ATTRIBUTES = {
3394
+ O/*HASH*/: "data-jdenticon-hash",
3395
+ v/*VALUE*/: "data-jdenticon-value"
3396
+ };
3397
+
3398
+ var IS_RENDERED_PROPERTY = "jdenticonRendered";
3399
+
3400
+ var ICON_SELECTOR = "[" + ATTRIBUTES.O/*HASH*/ +"],[" + ATTRIBUTES.v/*VALUE*/ +"]";
3401
+
3402
+ var documentQuerySelectorAll = /** @type {!Function} */ (
3403
+ typeof document !== "undefined" && document.querySelectorAll.bind(document));
3404
+
3405
+ function getIdenticonType(el) {
3406
+ if (el) {
3407
+ var tagName = el["tagName"];
3408
+
3409
+ if (/^svg$/i.test(tagName)) {
3410
+ return ICON_TYPE_SVG;
3411
+ }
3412
+
3413
+ if (/^canvas$/i.test(tagName) && "getContext" in el) {
3414
+ return ICON_TYPE_CANVAS;
3415
+ }
3416
+ }
3417
+ }
3418
+
3419
+ /**
3420
+ * Draws an identicon to a context.
3421
+ * @param {CanvasRenderingContext2D} ctx - Canvas context on which the icon will be drawn at location (0, 0).
3422
+ * @param {*} hashOrValue - A hexadecimal hash string or any value that will be hashed by Jdenticon.
3423
+ * @param {number} size - Icon size in pixels.
3424
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3425
+ * global configuration in its entirety. For backward compatibility a padding value in the range [0.0, 0.5) can be
3426
+ * specified in place of a configuration object.
3427
+ */
3428
+ function drawIcon(ctx, hashOrValue, size, config) {
3429
+ if (!ctx) {
3430
+ throw new Error("No canvas specified.");
3431
+ }
3432
+
3433
+ iconGenerator(new CanvasRenderer(ctx, size),
3434
+ isValidHash(hashOrValue) || computeHash(hashOrValue),
3435
+ config);
3436
+
3437
+ var canvas = ctx.canvas;
3438
+ if (canvas) {
3439
+ canvas[IS_RENDERED_PROPERTY] = true;
3440
+ }
3441
+ }
3442
+
3443
+ /**
3444
+ * Prepares a measure to be used as a measure in an SVG path, by
3445
+ * rounding the measure to a single decimal. This reduces the file
3446
+ * size of the generated SVG with more than 50% in some cases.
3447
+ */
3448
+ function svgValue(value) {
3449
+ return ((value * 10 + 0.5) | 0) / 10;
3450
+ }
3451
+
3452
+ /**
3453
+ * Represents an SVG path element.
3454
+ */
3455
+ function SvgPath() {
3456
+ /**
3457
+ * This property holds the data string (path.d) of the SVG path.
3458
+ * @type {string}
3459
+ */
3460
+ this.A/*dataString*/ = "";
3461
+ }
3462
+ var SvgPath__prototype = SvgPath.prototype;
3463
+
3464
+ /**
3465
+ * Adds a polygon with the current fill color to the SVG path.
3466
+ * @param points An array of Point objects.
3467
+ */
3468
+ SvgPath__prototype.g/*addPolygon*/ = function addPolygon (points) {
3469
+ var dataString = "";
3470
+ for (var i = 0; i < points.length; i++) {
3471
+ dataString += (i ? "L" : "M") + svgValue(points[i].x) + " " + svgValue(points[i].y);
3472
+ }
3473
+ this.A/*dataString*/ += dataString + "Z";
3474
+ };
3475
+
3476
+ /**
3477
+ * Adds a circle with the current fill color to the SVG path.
3478
+ * @param {Point} point The upper left corner of the circle bounding box.
3479
+ * @param {number} diameter The diameter of the circle.
3480
+ * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).
3481
+ */
3482
+ SvgPath__prototype.h/*addCircle*/ = function addCircle (point, diameter, counterClockwise) {
3483
+ var sweepFlag = counterClockwise ? 0 : 1,
3484
+ svgRadius = svgValue(diameter / 2),
3485
+ svgDiameter = svgValue(diameter),
3486
+ svgArc = "a" + svgRadius + "," + svgRadius + " 0 1," + sweepFlag + " ";
3487
+
3488
+ this.A/*dataString*/ +=
3489
+ "M" + svgValue(point.x) + " " + svgValue(point.y + diameter / 2) +
3490
+ svgArc + svgDiameter + ",0" +
3491
+ svgArc + (-svgDiameter) + ",0";
3492
+ };
3493
+
3494
+
3495
+
3496
+ /**
3497
+ * Renderer producing SVG output.
3498
+ * @implements {Renderer}
3499
+ */
3500
+ function SvgRenderer(target) {
3501
+
3502
+ /**
3503
+ * @type {Object.<string,SvgPath>}
3504
+ * @private
3505
+ */
3506
+ this.C/*_pathsByColor*/ = { };
3507
+
3508
+ /**
3509
+ * @type {SvgElement|SvgWriter}
3510
+ * @private
3511
+ */
3512
+ this.P/*_target*/ = target;
3513
+
3514
+ /**
3515
+ * @type {number}
3516
+ */
3517
+ this.k/*iconSize*/ = target.k/*iconSize*/;
3518
+ }
3519
+ var SvgRenderer__prototype = SvgRenderer.prototype;
3520
+
3521
+ /**
3522
+ * Fills the background with the specified color.
3523
+ * @param {string} fillColor Fill color on the format #rrggbb[aa].
3524
+ */
3525
+ SvgRenderer__prototype.m/*setBackground*/ = function setBackground (fillColor) {
3526
+ var match = /^(#......)(..)?/.exec(fillColor),
3527
+ opacity = match[2] ? parseHex(match[2], 0) / 255 : 1;
3528
+ this.P/*_target*/.m/*setBackground*/(match[1], opacity);
3529
+ };
3530
+
3531
+ /**
3532
+ * Marks the beginning of a new shape of the specified color. Should be ended with a call to endShape.
3533
+ * @param {string} color Fill color on format #xxxxxx.
3534
+ */
3535
+ SvgRenderer__prototype.M/*beginShape*/ = function beginShape (color) {
3536
+ this.B/*_path*/ = this.C/*_pathsByColor*/[color] || (this.C/*_pathsByColor*/[color] = new SvgPath());
3537
+ };
3538
+
3539
+ /**
3540
+ * Marks the end of the currently drawn shape.
3541
+ */
3542
+ SvgRenderer__prototype.N/*endShape*/ = function endShape () { };
3543
+
3544
+ /**
3545
+ * Adds a polygon with the current fill color to the SVG.
3546
+ * @param points An array of Point objects.
3547
+ */
3548
+ SvgRenderer__prototype.g/*addPolygon*/ = function addPolygon (points) {
3549
+ this.B/*_path*/.g/*addPolygon*/(points);
3550
+ };
3551
+
3552
+ /**
3553
+ * Adds a circle with the current fill color to the SVG.
3554
+ * @param {Point} point The upper left corner of the circle bounding box.
3555
+ * @param {number} diameter The diameter of the circle.
3556
+ * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).
3557
+ */
3558
+ SvgRenderer__prototype.h/*addCircle*/ = function addCircle (point, diameter, counterClockwise) {
3559
+ this.B/*_path*/.h/*addCircle*/(point, diameter, counterClockwise);
3560
+ };
3561
+
3562
+ /**
3563
+ * Called when the icon has been completely drawn.
3564
+ */
3565
+ SvgRenderer__prototype.finish = function finish () {
3566
+ var this$1$1 = this;
3567
+
3568
+ var pathsByColor = this.C/*_pathsByColor*/;
3569
+ for (var color in pathsByColor) {
3570
+ // hasOwnProperty cannot be shadowed in pathsByColor
3571
+ // eslint-disable-next-line no-prototype-builtins
3572
+ if (pathsByColor.hasOwnProperty(color)) {
3573
+ this$1$1.P/*_target*/.R/*appendPath*/(color, pathsByColor[color].A/*dataString*/);
3574
+ }
3575
+ }
3576
+ };
3577
+
3578
+ var SVG_CONSTANTS = {
3579
+ S/*XMLNS*/: "http://www.w3.org/2000/svg",
3580
+ T/*WIDTH*/: "width",
3581
+ U/*HEIGHT*/: "height",
3582
+ };
3583
+
3584
+ /**
3585
+ * Renderer producing SVG output.
3586
+ */
3587
+ function SvgWriter(iconSize) {
3588
+ /**
3589
+ * @type {number}
3590
+ */
3591
+ this.k/*iconSize*/ = iconSize;
3592
+
3593
+ /**
3594
+ * @type {string}
3595
+ * @private
3596
+ */
3597
+ this.D/*_s*/ =
3598
+ '<svg xmlns="' + SVG_CONSTANTS.S/*XMLNS*/ + '" width="' +
3599
+ iconSize + '" height="' + iconSize + '" viewBox="0 0 ' +
3600
+ iconSize + ' ' + iconSize + '">';
3601
+ }
3602
+ var SvgWriter__prototype = SvgWriter.prototype;
3603
+
3604
+ /**
3605
+ * Fills the background with the specified color.
3606
+ * @param {string} fillColor Fill color on the format #rrggbb.
3607
+ * @param {number} opacity Opacity in the range [0.0, 1.0].
3608
+ */
3609
+ SvgWriter__prototype.m/*setBackground*/ = function setBackground (fillColor, opacity) {
3610
+ if (opacity) {
3611
+ this.D/*_s*/ += '<rect width="100%" height="100%" fill="' +
3612
+ fillColor + '" opacity="' + opacity.toFixed(2) + '"/>';
3613
+ }
3614
+ };
3615
+
3616
+ /**
3617
+ * Writes a path to the SVG string.
3618
+ * @param {string} color Fill color on format #rrggbb.
3619
+ * @param {string} dataString The SVG path data string.
3620
+ */
3621
+ SvgWriter__prototype.R/*appendPath*/ = function appendPath (color, dataString) {
3622
+ this.D/*_s*/ += '<path fill="' + color + '" d="' + dataString + '"/>';
3623
+ };
3624
+
3625
+ /**
3626
+ * Gets the rendered image as an SVG string.
3627
+ */
3628
+ SvgWriter__prototype.toString = function toString () {
3629
+ return this.D/*_s*/ + "</svg>";
3630
+ };
3631
+
3632
+ /**
3633
+ * Draws an identicon as an SVG string.
3634
+ * @param {*} hashOrValue - A hexadecimal hash string or any value that will be hashed by Jdenticon.
3635
+ * @param {number} size - Icon size in pixels.
3636
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3637
+ * global configuration in its entirety. For backward compatibility a padding value in the range [0.0, 0.5) can be
3638
+ * specified in place of a configuration object.
3639
+ * @returns {string} SVG string
3640
+ */
3641
+ function toSvg(hashOrValue, size, config) {
3642
+ var writer = new SvgWriter(size);
3643
+ iconGenerator(new SvgRenderer(writer),
3644
+ isValidHash(hashOrValue) || computeHash(hashOrValue),
3645
+ config);
3646
+ return writer.toString();
3647
+ }
3648
+
3649
+ /**
3650
+ * Creates a new element and adds it to the specified parent.
3651
+ * @param {Element} parentNode
3652
+ * @param {string} name
3653
+ * @param {...(string|number)} keyValuePairs
3654
+ */
3655
+ function SvgElement_append(parentNode, name) {
3656
+ var keyValuePairs = [], len = arguments.length - 2;
3657
+ while ( len-- > 0 ) keyValuePairs[ len ] = arguments[ len + 2 ];
3658
+
3659
+ var el = document.createElementNS(SVG_CONSTANTS.S/*XMLNS*/, name);
3660
+
3661
+ for (var i = 0; i + 1 < keyValuePairs.length; i += 2) {
3662
+ el.setAttribute(
3663
+ /** @type {string} */(keyValuePairs[i]),
3664
+ /** @type {string} */(keyValuePairs[i + 1])
3665
+ );
3666
+ }
3667
+
3668
+ parentNode.appendChild(el);
3669
+ }
3670
+
3671
+
3672
+ /**
3673
+ * Renderer producing SVG output.
3674
+ */
3675
+ function SvgElement(element) {
3676
+ // Don't use the clientWidth and clientHeight properties on SVG elements
3677
+ // since Firefox won't serve a proper value of these properties on SVG
3678
+ // elements (https://bugzilla.mozilla.org/show_bug.cgi?id=874811)
3679
+ // Instead use 100px as a hardcoded size (the svg viewBox will rescale
3680
+ // the icon to the correct dimensions)
3681
+ var iconSize = this.k/*iconSize*/ = Math.min(
3682
+ (Number(element.getAttribute(SVG_CONSTANTS.T/*WIDTH*/)) || 100),
3683
+ (Number(element.getAttribute(SVG_CONSTANTS.U/*HEIGHT*/)) || 100)
3684
+ );
3685
+
3686
+ /**
3687
+ * @type {Element}
3688
+ * @private
3689
+ */
3690
+ this.V/*_el*/ = element;
3691
+
3692
+ // Clear current SVG child elements
3693
+ while (element.firstChild) {
3694
+ element.removeChild(element.firstChild);
3695
+ }
3696
+
3697
+ // Set viewBox attribute to ensure the svg scales nicely.
3698
+ element.setAttribute("viewBox", "0 0 " + iconSize + " " + iconSize);
3699
+ element.setAttribute("preserveAspectRatio", "xMidYMid meet");
3700
+ }
3701
+ var SvgElement__prototype = SvgElement.prototype;
3702
+
3703
+ /**
3704
+ * Fills the background with the specified color.
3705
+ * @param {string} fillColor Fill color on the format #rrggbb.
3706
+ * @param {number} opacity Opacity in the range [0.0, 1.0].
3707
+ */
3708
+ SvgElement__prototype.m/*setBackground*/ = function setBackground (fillColor, opacity) {
3709
+ if (opacity) {
3710
+ SvgElement_append(this.V/*_el*/, "rect",
3711
+ SVG_CONSTANTS.T/*WIDTH*/, "100%",
3712
+ SVG_CONSTANTS.U/*HEIGHT*/, "100%",
3713
+ "fill", fillColor,
3714
+ "opacity", opacity);
3715
+ }
3716
+ };
3717
+
3718
+ /**
3719
+ * Appends a path to the SVG element.
3720
+ * @param {string} color Fill color on format #xxxxxx.
3721
+ * @param {string} dataString The SVG path data string.
3722
+ */
3723
+ SvgElement__prototype.R/*appendPath*/ = function appendPath (color, dataString) {
3724
+ SvgElement_append(this.V/*_el*/, "path",
3725
+ "fill", color,
3726
+ "d", dataString);
3727
+ };
3728
+
3729
+ /**
3730
+ * Updates all canvas elements with the `data-jdenticon-hash` or `data-jdenticon-value` attribute.
3731
+ */
3732
+ function updateAll() {
3733
+ if (documentQuerySelectorAll) {
3734
+ update(ICON_SELECTOR);
3735
+ }
3736
+ }
3737
+
3738
+ /**
3739
+ * Updates the identicon in the specified `<canvas>` or `<svg>` elements.
3740
+ * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type
3741
+ * `<svg>` or `<canvas>`, or a CSS selector to such an element.
3742
+ * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or
3743
+ * `data-jdenticon-value` attribute will be evaluated.
3744
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3745
+ * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be
3746
+ * specified in place of a configuration object.
3747
+ */
3748
+ function update(el, hashOrValue, config) {
3749
+ renderDomElement(el, hashOrValue, config, function (el, iconType) {
3750
+ if (iconType) {
3751
+ return iconType == ICON_TYPE_SVG ?
3752
+ new SvgRenderer(new SvgElement(el)) :
3753
+ new CanvasRenderer(/** @type {HTMLCanvasElement} */(el).getContext("2d"));
3754
+ }
3755
+ });
3756
+ }
3757
+
3758
+ /**
3759
+ * Updates the identicon in the specified `<canvas>` elements.
3760
+ * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type
3761
+ * `<canvas>`, or a CSS selector to such an element.
3762
+ * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or
3763
+ * `data-jdenticon-value` attribute will be evaluated.
3764
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3765
+ * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be
3766
+ * specified in place of a configuration object.
3767
+ */
3768
+ function updateCanvas(el, hashOrValue, config) {
3769
+ renderDomElement(el, hashOrValue, config, function (el, iconType) {
3770
+ if (iconType == ICON_TYPE_CANVAS) {
3771
+ return new CanvasRenderer(/** @type {HTMLCanvasElement} */(el).getContext("2d"));
3772
+ }
3773
+ });
3774
+ }
3775
+
3776
+ /**
3777
+ * Updates the identicon in the specified `<svg>` elements.
3778
+ * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type
3779
+ * `<svg>`, or a CSS selector to such an element.
3780
+ * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or
3781
+ * `data-jdenticon-value` attribute will be evaluated.
3782
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3783
+ * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be
3784
+ * specified in place of a configuration object.
3785
+ */
3786
+ function updateSvg(el, hashOrValue, config) {
3787
+ renderDomElement(el, hashOrValue, config, function (el, iconType) {
3788
+ if (iconType == ICON_TYPE_SVG) {
3789
+ return new SvgRenderer(new SvgElement(el));
3790
+ }
3791
+ });
3792
+ }
3793
+
3794
+ /**
3795
+ * Updates the identicon in the specified canvas or svg elements.
3796
+ * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type
3797
+ * `<svg>` or `<canvas>`, or a CSS selector to such an element.
3798
+ * @param {*} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or
3799
+ * `data-jdenticon-value` attribute will be evaluated.
3800
+ * @param {Object|number|undefined} config
3801
+ * @param {function(Element,number):Renderer} rendererFactory - Factory function for creating an icon renderer.
3802
+ */
3803
+ function renderDomElement(el, hashOrValue, config, rendererFactory) {
3804
+ if (typeof el === "string") {
3805
+ if (documentQuerySelectorAll) {
3806
+ var elements = documentQuerySelectorAll(el);
3807
+ for (var i = 0; i < elements.length; i++) {
3808
+ renderDomElement(elements[i], hashOrValue, config, rendererFactory);
3809
+ }
3810
+ }
3811
+ return;
3812
+ }
3813
+
3814
+ // Hash selection. The result from getValidHash or computeHash is
3815
+ // accepted as a valid hash.
3816
+ var hash =
3817
+ // 1. Explicit valid hash
3818
+ isValidHash(hashOrValue) ||
3819
+
3820
+ // 2. Explicit value (`!= null` catches both null and undefined)
3821
+ hashOrValue != null && computeHash(hashOrValue) ||
3822
+
3823
+ // 3. `data-jdenticon-hash` attribute
3824
+ isValidHash(el.getAttribute(ATTRIBUTES.O/*HASH*/)) ||
3825
+
3826
+ // 4. `data-jdenticon-value` attribute.
3827
+ // We want to treat an empty attribute as an empty value.
3828
+ // Some browsers return empty string even if the attribute
3829
+ // is not specified, so use hasAttribute to determine if
3830
+ // the attribute is specified.
3831
+ el.hasAttribute(ATTRIBUTES.v/*VALUE*/) && computeHash(el.getAttribute(ATTRIBUTES.v/*VALUE*/));
3832
+
3833
+ if (!hash) {
3834
+ // No hash specified. Don't render an icon.
3835
+ return;
3836
+ }
3837
+
3838
+ var renderer = rendererFactory(el, getIdenticonType(el));
3839
+ if (renderer) {
3840
+ // Draw icon
3841
+ iconGenerator(renderer, hash, config);
3842
+ el[IS_RENDERED_PROPERTY] = true;
3843
+ }
3844
+ }
3845
+
3846
+ // This file is compiled to dist/jdenticon-module.js
3847
+
3848
+ var jdenticon = updateAll;
3849
+
3850
+ defineConfigProperty(jdenticon);
3851
+
3852
+ // Export public API
3853
+ jdenticon["configure"] = configure;
3854
+ jdenticon["drawIcon"] = drawIcon;
3855
+ jdenticon["toSvg"] = toSvg;
3856
+ jdenticon["update"] = update;
3857
+ jdenticon["updateCanvas"] = updateCanvas;
3858
+ jdenticon["updateSvg"] = updateSvg;
3859
+
3860
+ /**
3861
+ * Specifies the version of the Jdenticon package in use.
3862
+ * @type {string}
3863
+ */
3864
+ jdenticon["version"] = "3.3.0";
3865
+
3866
+ /**
3867
+ * Specifies which bundle of Jdenticon that is used.
3868
+ * @type {string}
3869
+ */
3870
+ jdenticon["bundle"] = "browser-cjs";
3871
+
3872
+ var jdenticonModule = jdenticon;
3873
+
3874
+ const dashButtonCss = ".button{display:flex;height:50px;padding:0;background:#3e7671;border:none;outline:none;border-radius:5px;overflow:hidden;font-size:16px;font-weight:500;cursor:pointer;min-width:220px;max-width:220px}.button:hover{background:#008168}.button:active{background:#3e7671}.button-text{display:block;margin:auto;padding:0 24px;color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:80px;text-transform:capitalize}.button-icon{margin:auto;padding:10px}.button-profile{margin:auto}.button-profile svg{display:flex;margin-left:4px;background-color:#fff;border-radius:4px}.button-text-full-width{width:auto!important}.button-link{text-decoration:none!important}.gg-menu-grid-r{color:#fff;box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs,1));width:16px;height:16px}.gg-menu-grid-r::before{content:\"\";display:block;box-sizing:border-box;position:absolute;width:4px;height:4px;background:currentColor;box-shadow:0 6px 0,\n 6px 6px 0,\n 12px 6px 0,\n 6px 12px 0,\n 12px 12px 0,\n 6px 0 0,\n 12px 0 0,\n 0 12px 0}.dropdown{position:relative;display:inline-block}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:180px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;border-radius:5px}.dropdown-content a{color:#71797E;padding:16px 20px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1;color:#000;opacity:0.7}.dropdown:hover .dropdown-content{display:block}.modal{display:none;position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4);text-align:center}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:40%}.modal-body{max-height:50vh;overflow-y:auto}.close{color:#aaaaaa;float:right;font-size:28px;font-weight:bold}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer}.modal-app{background-color:#c3e9bc;padding:15px;margin:10px;border-radius:5px}.external-app-link{text-decoration:none;color:#000}.gray-text{color:#606060}.green-text{color:#3e7671}#countdown{position:relative;margin:auto;margin-top:30px;height:40px;width:40px;text-align:center}#countdown-number{color:#2e2e2e;display:inline-block;line-height:40px}#countdown svg{position:absolute;top:0;right:0;width:40px;height:40px;transform:rotateY(-180deg) rotateZ(-90deg)}#countdown svg circle{stroke-dasharray:113px;stroke-dashoffset:0px;stroke-linecap:round;stroke-width:4px;stroke:#008168;fill:none;animation:countdown 6s linear infinite forwards}@keyframes countdown{from{stroke-dashoffset:0px}to{stroke-dashoffset:113px}}.lds-ring{color:#fff}.lds-ring{display:flex;justify-content:center;align-items:center;margin:auto;position:relative}.lds-ring div{box-sizing:border-box;display:block;position:absolute;width:30px;height:30px;margin:3px;border:3px solid currentColor;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;border-color:currentColor transparent transparent transparent}.lds-ring div:nth-child(1){animation-delay:-0.45s}.lds-ring div:nth-child(2){animation-delay:-0.3s}.lds-ring div:nth-child(3){animation-delay:-0.15s}@keyframes lds-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.menu-bar-icons{color:#008168;display:inline-block;margin-bottom:-3px}.gg-microsoft{transform:scale(var(--ggs,1));margin-right:12px}.gg-microsoft,.gg-microsoft::after,.gg-microsoft::before{box-sizing:border-box;position:relative;width:18px;height:18px}.gg-microsoft::after,.gg-microsoft::before{content:\"\";position:absolute;width:8px;border-top:8px solid;border-bottom:8px solid}.gg-microsoft::after{right:0}.gg-ereader{box-sizing:border-box;position:relative;transform:scale(var(--ggs,1));width:20px;height:18px;border:2px solid;border-radius:3px;margin-right:9px}.gg-ereader::after,.gg-ereader::before{content:\"\";display:block;box-sizing:border-box;position:absolute;border-radius:3px;width:2px;height:18px;right:9px;top:-2px;background:currentColor}.gg-ereader::after{width:5px;height:2px;box-shadow:0 4px 0,0 8px 0;top:2px;right:2px}.gg-display-flex{box-sizing:border-box;position:relative;transform:scale(var(--ggs,1));height:14px;width:16px;border:2px solid transparent;margin-right:13px;box-shadow:0 0 0 2px,\n inset -2px 0 0 0,\n inset 2px 0 0 0}.gg-align-bottom{box-sizing:border-box;position:relative;height:12px;width:12px;border-bottom:2px solid;transform:scale(var(--ggs,1));margin-top:4px;margin-right:16px}.gg-align-bottom::after,.gg-align-bottom::before{content:\"\";display:block;box-sizing:border-box;position:absolute;width:4px;background:currentColor;bottom:2px}.gg-align-bottom::before{left:1px;height:12px}.gg-align-bottom::after{height:6px;right:1px;opacity:.5}.gg-log-out{box-sizing:border-box;position:relative;width:6px;height:16px;border:2px solid;transform:scale(var(--ggs,1));border-right:0;border-top-left-radius:2px;border-bottom-left-radius:2px;margin-right:22px}.gg-log-out::after,.gg-log-out::before{content:\"\";display:block;box-sizing:border-box;position:absolute}.gg-log-out::after{border-top:2px solid;border-left:2px solid;transform:rotate(-45deg);width:8px;height:8px;left:4px;bottom:2px}.gg-log-out::before{border-radius:3px;width:10px;height:2px;background:currentColor;left:5px;bottom:5px}";
2477
3875
  const DashButtonStyle0 = dashButtonCss;
2478
3876
 
2479
3877
  const DashButtonComponent = class {
@@ -2490,6 +3888,7 @@ const DashButtonComponent = class {
2490
3888
  this.portalUrl = "";
2491
3889
  this.marketplaceUrl = "https://marketplace-zdzw.cloud.zdzw-project.com";
2492
3890
  this.plmUrl = "https://productlicensemanager-zdzw.cloud.zdzw-project.com";
3891
+ this.usageTrackingUrl = "https://usage-tracking-ui-zdzw.cloud.zdzw-project.com";
2493
3892
  this.showUnauthorizedModal = false;
2494
3893
  this.postTextDelayDuration = undefined;
2495
3894
  this.keycloak = new Keycloak({
@@ -2498,10 +3897,11 @@ const DashButtonComponent = class {
2498
3897
  clientId: this.clientId,
2499
3898
  });
2500
3899
  this.isAuth = false;
2501
- this.givenName = "";
3900
+ this.givenUserName = "";
2502
3901
  this.silentCheckSsoRedirectUri = window.location.origin + '/assets/verificar-sso.html';
2503
3902
  this.appList = [];
2504
3903
  this.showPostLoginLoadingSpinner = false;
3904
+ this.avatarSvg = jdenticonModule.toSvg("init-avatar", 40);
2505
3905
  }
2506
3906
  ;
2507
3907
  componentWillLoad() {
@@ -2576,7 +3976,10 @@ const DashButtonComponent = class {
2576
3976
  this.isAuth = true;
2577
3977
  localStorage.setItem("keycloak", JSON.stringify(this.keycloak));
2578
3978
  document.cookie = "ZDZW_cookie=" + JSON.parse(localStorage.getItem('keycloak')).token;
2579
- this.givenName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.given_name;
3979
+ // Set userName
3980
+ this.givenUserName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.preferred_username;
3981
+ // Set user avatar
3982
+ this.avatarSvg = jdenticonModule.toSvg(JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.sub, 40);
2580
3983
  }
2581
3984
  });
2582
3985
  }
@@ -2612,7 +4015,7 @@ const DashButtonComponent = class {
2612
4015
  appModal.style.display = "none";
2613
4016
  }
2614
4017
  render() {
2615
- return h("div", { key: '7843bbee4940a6a252e61442f8d77d467ee769c2' }, h("div", { key: 'd0940bd721a4eab5533cb7b136fabe8353cbb535' }, (() => {
4018
+ return h("div", { key: 'ba94f3503dbaaa921cb29d1e15e576c96a2b86c6' }, h("div", { key: '24aff9e285c7477761f048e1868e8aed724aa7ea' }, (() => {
2616
4019
  if (this.isAuth && this.showPostLoginText) {
2617
4020
  // User set post-text-delay-duration for displaying loading spinner
2618
4021
  if (this.showPostLoginLoadingSpinner) {
@@ -2623,14 +4026,14 @@ const DashButtonComponent = class {
2623
4026
  }
2624
4027
  }
2625
4028
  else if (this.isAuth) {
2626
- return (h("div", { id: "profile-btn", class: "dropdown" }, h("button", { type: "button", class: "button" }, h("span", { class: "button-profile" }, h("img", { src: "https://i.pravatar.cc/100?img=32", alt: "" })), h("span", { id: "given-name", class: "button-text" }, this.givenName), h("div", { class: "button-icon" }, h("span", { class: "gg-menu-grid-r" }))), h("div", { class: "dropdown-content" }, h("a", { onClick: this.showModal.bind(this), id: "applications-btn" }, "Applications"), h("a", { href: this.portalUrl, target: '_blank', id: "applications-btn" }, "Portal"), h("a", { href: this.marketplaceUrl, target: '_blank', id: "applications-btn" }, "Marketplace"), h("a", { onClick: this.logout.bind(this), id: "logout-btn" }, "Logout"))));
4029
+ return (h("div", { id: "profile-btn", class: "dropdown" }, h("button", { type: "button", class: "button" }, h("span", { class: "button-profile" }, h("div", { innerHTML: this.avatarSvg })), h("span", { id: "given-name", class: "button-text" }, this.givenUserName), h("div", { class: "button-icon" }, h("span", { class: "gg-menu-grid-r" }))), h("div", { class: "dropdown-content" }, h("a", { onClick: this.showModal.bind(this), id: "applications-btn" }, h("i", { class: "menu-bar-icons gg-microsoft" }), "Applications"), h("a", { href: this.portalUrl, target: '_blank', id: "applications-btn" }, h("i", { class: "menu-bar-icons gg-ereader" }), "Portal"), h("a", { href: this.marketplaceUrl, target: '_blank', id: "applications-btn" }, h("i", { class: "menu-bar-icons gg-display-flex" }), "Marketplace"), h("a", { href: this.usageTrackingUrl, target: '_blank', id: "applications-btn" }, h("i", { class: "menu-bar-icons gg-align-bottom" }), "Usage Tracking"), h("a", { onClick: this.logout.bind(this), id: "logout-btn" }, h("i", { class: "menu-bar-icons gg-log-out" }), "Logout"))));
2627
4030
  }
2628
4031
  else {
2629
4032
  return (h("button", { onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { class: "button-text" }, "Login")));
2630
4033
  }
2631
- })()), h("div", { key: '2c2f55d80917b2dc2b7a9279f2f76bc3a7f2e202', id: "appListModal", class: "modal" }, h("div", { key: '90d14c23cdbb1a129ba99f00518cff0a0a65baeb', class: "modal-content" }, h("span", { key: '6879c9fdc1d9a4a7075616f96ff63d95f8eaaea7', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '06a0268e396c3aeda8cf90e93e3dde405743abcd' }, "Applications"), h("div", { key: '2f77c0e5d35acdb101cfe9caf2b6e26be241dae9', class: "modal-body" }, this.appList.length > 0 ? this.appList.map(app => {
4034
+ })()), h("div", { key: 'ea4d022e81fc6e7506c6c774c60b8c8ad5a727b5', id: "appListModal", class: "modal" }, h("div", { key: '13baaa2ee3cc0dac2c259f03d12ff5359c537e27', class: "modal-content" }, h("span", { key: '3dec21d8be01de78931ef1a4f52b54795589d032', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '6b9b8000e7e8d66402b4cebd83c102e1a6790674' }, "Applications"), h("div", { key: 'bdf1eee7bdee6e8b13c97a01cbccc80d6e4658cf', class: "modal-body" }, this.appList.length > 0 ? this.appList.map(app => {
2632
4035
  return (h("a", { class: "external-app-link", target: '_blank', href: "https://" + app.shortname + "-zdzw" + this.portalUrl.replace(/(^\w+:|^)\/\//, '').replace('portal-frontend-zdzw', '') }, h("div", { class: "modal-app" }, h("div", null, app.name))));
2633
- }) : h("div", null, h("h3", { class: "gray-text" }, "Not installed application found."), " ", h("p", { class: "gray-text" }, "Please contact administration."))))), h("div", { key: 'bd4688753740aa007b07c2eae3addb53735d8f0a', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: 'e4456ad3eca347536e671acd7194e7b9edde14c9', class: "modal-content" }, h("img", { key: '2332a30194ff8629bfee4e80c87b6a537962b97c', src: "data:image/png;base64,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" }), h("h2", { key: 'b0e4790f74c08bbc7f3b3ebfdc1f5a910eff8c2f', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '8de093a380855028b879686a9ab1b345dea4e356', class: "green-text" }, "Please contact the administration."), (this.portalUrl && this.showUnauthorizedModal) ?
4036
+ }) : h("div", null, h("h3", { class: "gray-text" }, "Not installed application found."), " ", h("p", { class: "gray-text" }, "Please contact administration."))))), h("div", { key: '0716882a9de0dea9d7e5111a82df972f172b9ed9', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: 'a6e1210bac100315259cc32bf06f53bb9c9276fe', class: "modal-content" }, h("img", { key: 'db854af453ead6b1737f9adfc274f25540d85d94', src: "data:image/png;base64,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" }), h("h2", { key: 'b7fefcf4dfbd20b181c73df0d6fdcb9bbee92609', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '9c9187a3f0432073509141952ee7e2efb6619b2c', class: "green-text" }, "Please contact the administration."), (this.portalUrl && this.showUnauthorizedModal) ?
2634
4037
  h("div", null, h("h4", { class: "gray-text" }, "You will be automatically redirected to the portal."), h("div", { id: "countdown" }, h("div", { id: "countdown-number" }), h("svg", null, h("circle", { r: "18", cx: "20", cy: "20" }))))
2635
4038
  : h("div", null))));
2636
4039
  }