-
Notifications
You must be signed in to change notification settings - Fork 6
/
source.861fedf3.js.map
1 lines (1 loc) · 99.4 KB
/
source.861fedf3.js.map
1
{"version":3,"sources":["src/browser-cjs.js","src/common/parseHex.js","src/renderer/color.js","src/common/global.js","src/common/configuration.js","src/renderer/point.js","src/renderer/transform.js","src/renderer/graphics.js","replacement/1","src/renderer/shapes.js","src/renderer/colorTheme.js","src/renderer/iconGenerator.js","src/common/sha1.js","src/common/hashUtils.js","src/renderer/canvas/canvasRenderer.js","replacement/2","src/common/dom.js","src/apis/drawIcon.js","src/renderer/svg/svgPath.js","replacement/3","src/renderer/svg/svgRenderer.js","replacement/4","src/renderer/svg/constants.js","src/renderer/svg/svgWriter.js","replacement/5","src/apis/toSvg.js","src/renderer/svg/svgElement.js","replacement/6","src/apis/update.js","utils.js","index.js"],"names":["let","const","GLOBAL","MODULE","hue","colorSaturation","grayscaleSaturation","colorLightness","grayscaleLightness","backColor","iconPadding","_x","_y","_size","_rotation","transformIconPoint","_renderer","currentTransform","addTriangle","addRectangle","addCircle","addPolygon","addRhombus","setBackground","iconSize","beginShape","endShape","_ctx","HASH","VALUE","dataString","_path","_pathsByColor","_target","appendPath","XMLNS","WIDTH","HEIGHT","_s","_el","makeid","length","text","possible","i","charAt","Math","floor","random","GE","el","document","getElementById","SetSearchParam","param","value","url","URL","window","location","href","query_string","search","search_params","URLSearchParams","get","set","delete","toString","history","pushState","title","GetSearchParam","cached_levels_data","cached_level_path","_jdenticon","require","_utils","cell_colors","innerHTML","levels_data","console","log","template","levels_backet","level_ind","concat","level","svg","toSvg","encodeURIComponent","localStorage","getItem","scrollTo","level_path","level_name","replace","split","slice","join","fetch","then","response","json","build_level","task","decodeURIComponent","load_level","build_levels","addEventListener","e","mouseX","pageX","mouseY","pageY","style","left","top","block_data_cache","create_block","params","_params$block_name","_params$is_clickable","_params$is_dragable","_params$is_big","_params$block_type","block_name","block_data","is_clickable","is_dragable","is_big","block_type","action","mz","rid","forEach","element","cid","color_ind","cell_ind","last_interacted_cell","hover_color_index","start_cell_ind","is_move_active","act","preventDefault","touch","touches","clientX","cell","elementFromPoint","clientY","cell_color","Array","from","classList","filter","cell_class","includes","color_index","indexOf","remove","add","last_color_index","input_name","output_name","output_data","in_cell_id","in_cell_color","out_cell_id","out_cell_color","color","level_json","train","input","output","test","empty_block","IntersectionObserver","entries","isIntersecting","threshold","observe","last_color_index_","main_color","fill_color_","circle_color","fill_color","initial_cell_color","timeout","ms","Promise","resolve","setTimeout","x","y","flood_fill","animation","offsetHeight","check","test_output","res_cell_id","res_cell_color","ind","setItem","start_color","arguments","undefined","cell_id"],"mappings":";;AAsC0B,IAAA,EAAA,UAAA,GAAA,SAAA,EAAA,GAAA,OAAA,EAAA,mBAAA,QAAA,iBAAA,OAAA,SAAA,SAAA,GAAA,cAAA,GAAA,SAAA,GAAA,OAAA,GAAA,mBAAA,QAAA,EAAA,cAAA,QAAA,IAAA,OAAA,UAAA,gBAAA,IAAA,GC3BnB,SAAS,EAAS,EAAM,EAAe,GAC1C,OAAO,SAAS,EAAK,OAAO,EAAe,GAAS,ICJxD,SAAS,EAAS,GAEd,OADA,GAAK,GACM,EAAI,KACX,EAAI,GAAK,IAAM,EAAE,SAAS,IAC1B,EAAI,IAAM,EAAE,SAAS,IACrB,KAGR,SAAS,EAAS,EAAI,EAAI,GAEtB,OAAO,EAAS,MADhB,EAAI,EAAI,EAAI,EAAI,EAAI,EAAI,EAAI,EAAI,EAAI,GAE5B,EAAI,GAAM,EAAK,GAAM,EACzB,EAAI,EAAI,EACR,EAAI,EAAI,GAAM,EAAK,IAAO,EAAI,GAC9B,IAgBD,SAAS,EAAW,GACvB,GAAI,oBAAoB,KAAK,GAAQ,CACjCA,IAAI,EACE,EAAc,EAAM,OAE1B,GAAI,EAAc,EAAG,CACjBC,IAAM,EAAI,EAAM,GACV,EAAI,EAAM,GACV,EAAI,EAAM,GACV,EAAI,EAAM,IAAM,GACtB,EAAS,IAAM,EAAI,EAAI,EAAI,EAAI,EAAI,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AAkB4G,EAAC5G,KAAAA,OAAI6G,GAClC,IAAI,EAAAlJ,EAAE,IAAC+J,IAAYH,GAAelB,EAAY,CAC5C,IAAInC,EAAaC,MAAMC,MAAK,EAAAzG,EAAE,IAAC+J,GAASrD,WAAWC,OAAO,SAAAC,GAAU,OAAI/E,EAAYgF,SAASD,KAAa,GACrGgD,IAAaA,EAAcrD,GAG5BA,GAAcqD,KAChB,EAAA5J,EAAE,IAAC+J,GAASrD,UAAUM,OAAOT,IAC7B,EAAAvG,EAAE,IAAC+J,GAASrD,UAAUO,IAAIyB,GAE1BM,WAAW,WACTG,WAAWF,EAAI,EAAGC,EAAGR,EAAYkB,GACjCT,WAAWF,EAAI,EAAGC,EAAGR,EAAYkB,GACjCT,WAAWF,EAAGC,EAAI,EAAGR,EAAYkB,GACjCT,WAAWF,EAAGC,EAAI,EAAGR,EAAYkB,IAChC","file":"source.861fedf3.js","sourceRoot":"source","sourcesContent":["/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\n// This file is compiled to dist/jdenticon-module.js\r\n\r\nimport { defineConfigProperty } from \"./common/configuration\";\r\nimport { configure } from \"./apis/configure\";\r\nimport { drawIcon } from \"./apis/drawIcon\";\r\nimport { toSvg } from \"./apis/toSvg\";\r\nimport { update, updateAll, updateCanvas, updateSvg } from \"./apis/update\";\r\n\r\nconst jdenticon = updateAll;\r\n\r\ndefineConfigProperty(jdenticon);\r\n\r\n// Export public API\r\njdenticon[\"configure\"] = configure;\r\njdenticon[\"drawIcon\"] = drawIcon;\r\njdenticon[\"toSvg\"] = toSvg;\r\njdenticon[\"update\"] = update;\r\njdenticon[\"updateCanvas\"] = updateCanvas;\r\njdenticon[\"updateSvg\"] = updateSvg;\r\n\r\n/**\r\n * Specifies the version of the Jdenticon package in use.\r\n * @type {string}\r\n */\r\njdenticon[\"version\"] = \"#version#\";\r\n\r\n/**\r\n * Specifies which bundle of Jdenticon that is used.\r\n * @type {string}\r\n */\r\njdenticon[\"bundle\"] = \"browser-cjs\";\r\n\r\nmodule.exports = jdenticon;","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\n/**\r\n * Parses a substring of the hash as a number.\r\n * @param {number} startPosition \r\n * @param {number=} octets\r\n */\r\nexport function parseHex(hash, startPosition, octets) {\r\n return parseInt(hash.substr(startPosition, octets), 16);\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { parseHex } from \"../common/parseHex\";\r\n\r\nfunction decToHex(v) {\r\n v |= 0; // Ensure integer value\r\n return v < 0 ? \"00\" :\r\n v < 16 ? \"0\" + v.toString(16) :\r\n v < 256 ? v.toString(16) :\r\n \"ff\";\r\n}\r\n\r\nfunction hueToRgb(m1, m2, h) {\r\n h = h < 0 ? h + 6 : h > 6 ? h - 6 : h;\r\n return decToHex(255 * (\r\n h < 1 ? m1 + (m2 - m1) * h :\r\n h < 3 ? m2 :\r\n h < 4 ? m1 + (m2 - m1) * (4 - h) :\r\n m1));\r\n}\r\n\r\n/**\r\n * @param {number} r Red channel [0, 255]\r\n * @param {number} g Green channel [0, 255]\r\n * @param {number} b Blue channel [0, 255]\r\n */\r\nexport function rgb(r, g, b) {\r\n return \"#\" + decToHex(r) + decToHex(g) + decToHex(b);\r\n}\r\n\r\n/**\r\n * @param {string} color Color value to parse. Currently hexadecimal strings on the format #rgb[a] and #rrggbb[aa] are supported.\r\n * @returns {string}\r\n */\r\nexport function parseColor(color) {\r\n if (/^#[0-9a-f]{3,8}$/i.test(color)) {\r\n let result;\r\n const colorLength = color.length;\r\n\r\n if (colorLength < 6) {\r\n const r = color[1],\r\n g = color[2],\r\n b = color[3],\r\n a = color[4] || \"\";\r\n result = \"#\" + r + r + g + g + b + b + a + a;\r\n }\r\n if (colorLength == 7 || colorLength > 8) {\r\n result = color;\r\n }\r\n \r\n return result;\r\n }\r\n}\r\n\r\n/**\r\n * Converts a hexadecimal color to a CSS3 compatible color.\r\n * @param {string} hexColor Color on the format \"#RRGGBB\" or \"#RRGGBBAA\"\r\n * @returns {string}\r\n */\r\nexport function toCss3Color(hexColor) {\r\n const a = parseHex(hexColor, 7, 2);\r\n let result;\r\n\r\n if (isNaN(a)) {\r\n result = hexColor;\r\n } else {\r\n const r = parseHex(hexColor, 1, 2),\r\n g = parseHex(hexColor, 3, 2),\r\n b = parseHex(hexColor, 5, 2);\r\n result = \"rgba(\" + r + \",\" + g + \",\" + b + \",\" + (a / 255).toFixed(2) + \")\";\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Converts an HSL color to a hexadecimal RGB color.\r\n * @param {number} hue Hue in range [0, 1]\r\n * @param {number} saturation Saturation in range [0, 1]\r\n * @param {number} lightness Lightness in range [0, 1]\r\n * @returns {string}\r\n */\r\nexport function hsl(hue, saturation, lightness) {\r\n // Based on http://www.w3.org/TR/2011/REC-css3-color-20110607/#hsl-color\r\n let result;\r\n\r\n if (saturation == 0) {\r\n const partialHex = decToHex(lightness * 255);\r\n result = partialHex + partialHex + partialHex;\r\n }\r\n else {\r\n const m2 = lightness <= 0.5 ? lightness * (saturation + 1) : lightness + saturation - lightness * saturation,\r\n m1 = lightness * 2 - m2;\r\n result =\r\n hueToRgb(m1, m2, hue * 6 + 2) +\r\n hueToRgb(m1, m2, hue * 6) +\r\n hueToRgb(m1, m2, hue * 6 - 2);\r\n }\r\n\r\n return \"#\" + result;\r\n}\r\n\r\n/**\r\n * Converts an HSL color to a hexadecimal RGB color. This function will correct the lightness for the \"dark\" hues\r\n * @param {number} hue Hue in range [0, 1]\r\n * @param {number} saturation Saturation in range [0, 1]\r\n * @param {number} lightness Lightness in range [0, 1]\r\n * @returns {string}\r\n */\r\nexport function correctedHsl(hue, saturation, lightness) {\r\n // The corrector specifies the perceived middle lightness for each hue\r\n const correctors = [ 0.55, 0.5, 0.5, 0.46, 0.6, 0.55, 0.55 ],\r\n corrector = correctors[(hue * 6 + 0.5) | 0];\r\n \r\n // Adjust the input lightness relative to the corrector\r\n lightness = lightness < 0.5 ? lightness * corrector * 2 : corrector + (lightness - 0.5) * (1 - corrector) * 2;\r\n \r\n return hsl(hue, saturation, lightness);\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\n// In the future we can replace `GLOBAL` with `globalThis`, but for now use the old school global detection for\r\n// backward compatibility.\r\n\r\nexport const GLOBAL = \r\n typeof window !== \"undefined\" ? window :\r\n typeof self !== \"undefined\" ? self :\r\n typeof global !== \"undefined\" ? global :\r\n {};\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { parseColor } from \"../renderer/color\";\r\nimport { GLOBAL } from \"./global\";\r\n\r\n/**\r\n * @typedef {Object} ParsedConfiguration\r\n * @property {number} colorSaturation\r\n * @property {number} grayscaleSaturation\r\n * @property {string} backColor\r\n * @property {number} iconPadding\r\n * @property {function(number):number} hue\r\n * @property {function(number):number} colorLightness\r\n * @property {function(number):number} grayscaleLightness\r\n */\r\n\r\nexport const CONFIG_PROPERTIES = {\r\n GLOBAL: \"jdenticon_config\",\r\n MODULE: \"config\",\r\n};\r\n\r\nvar rootConfigurationHolder = {};\r\n\r\n/**\r\n * Defines the deprecated `config` property on the root Jdenticon object. When the property is set a warning is \r\n * printed in the console. To minimize bundle size, this is only used in Node bundles.\r\n * @param {!Object} rootObject \r\n */\r\nexport function defineConfigPropertyWithWarn(rootObject) {\r\n Object.defineProperty(rootObject, CONFIG_PROPERTIES.MODULE, {\r\n configurable: true,\r\n get: () => rootConfigurationHolder[CONFIG_PROPERTIES.MODULE],\r\n set: newConfiguration => {\r\n rootConfigurationHolder[CONFIG_PROPERTIES.MODULE] = newConfiguration;\r\n console.warn(\"jdenticon.config is deprecated. Use jdenticon.configure() instead.\");\r\n },\r\n });\r\n}\r\n\r\n/**\r\n * Defines the deprecated `config` property on the root Jdenticon object without printing a warning in the console\r\n * when it is being used.\r\n * @param {!Object} rootObject \r\n */\r\nexport function defineConfigProperty(rootObject) {\r\n rootConfigurationHolder = rootObject;\r\n}\r\n\r\n/**\r\n * Sets a new icon style configuration. The new configuration is not merged with the previous one. * \r\n * @param {Object} newConfiguration - New configuration object.\r\n */\r\nexport function configure(newConfiguration) {\r\n if (arguments.length) {\r\n rootConfigurationHolder[CONFIG_PROPERTIES.MODULE] = newConfiguration;\r\n }\r\n return rootConfigurationHolder[CONFIG_PROPERTIES.MODULE];\r\n}\r\n\r\n/**\r\n * Gets the normalized current Jdenticon color configuration. Missing fields have default values.\r\n * @param {Object|number|undefined} paddingOrLocalConfig - Configuration passed to the called API method. A\r\n * local configuration overrides the global configuration in it entirety. This parameter can for backward\r\n * compatibility also contain a padding value. A padding value only overrides the global padding, not the\r\n * entire global configuration.\r\n * @param {number} defaultPadding - Padding used if no padding is specified in neither the configuration nor\r\n * explicitly to the API method.\r\n * @returns {ParsedConfiguration}\r\n */\r\nexport function getConfiguration(paddingOrLocalConfig, defaultPadding) {\r\n const configObject = \r\n typeof paddingOrLocalConfig == \"object\" && paddingOrLocalConfig ||\r\n rootConfigurationHolder[CONFIG_PROPERTIES.MODULE] ||\r\n GLOBAL[CONFIG_PROPERTIES.GLOBAL] ||\r\n { },\r\n\r\n lightnessConfig = configObject[\"lightness\"] || { },\r\n \r\n // In versions < 2.1.0 there was no grayscale saturation -\r\n // saturation was the color saturation.\r\n saturation = configObject[\"saturation\"] || { },\r\n colorSaturation = \"color\" in saturation ? saturation[\"color\"] : saturation,\r\n grayscaleSaturation = saturation[\"grayscale\"],\r\n\r\n backColor = configObject[\"backColor\"],\r\n padding = configObject[\"padding\"];\r\n \r\n /**\r\n * Creates a lightness range.\r\n */\r\n function lightness(configName, defaultRange) {\r\n let range = lightnessConfig[configName];\r\n \r\n // Check if the lightness range is an array-like object. This way we ensure the\r\n // array contain two values at the same time.\r\n if (!(range && range.length > 1)) {\r\n range = defaultRange;\r\n }\r\n\r\n /**\r\n * Gets a lightness relative the specified value in the specified lightness range.\r\n */\r\n return function (value) {\r\n value = range[0] + value * (range[1] - range[0]);\r\n return value < 0 ? 0 : value > 1 ? 1 : value;\r\n };\r\n }\r\n\r\n /**\r\n * Gets a hue allowed by the configured hue restriction,\r\n * provided the originally computed hue.\r\n */\r\n function hueFunction(originalHue) {\r\n const hueConfig = configObject[\"hues\"];\r\n let hue;\r\n \r\n // Check if 'hues' is an array-like object. This way we also ensure that\r\n // the array is not empty, which would mean no hue restriction.\r\n if (hueConfig && hueConfig.length > 0) {\r\n // originalHue is in the range [0, 1]\r\n // Multiply with 0.999 to change the range to [0, 1) and then truncate the index.\r\n hue = hueConfig[0 | (0.999 * originalHue * hueConfig.length)];\r\n }\r\n\r\n return typeof hue == \"number\" ?\r\n \r\n // A hue was specified. We need to convert the hue from\r\n // degrees on any turn - e.g. 746° is a perfectly valid hue -\r\n // to turns in the range [0, 1).\r\n ((((hue / 360) % 1) + 1) % 1) :\r\n\r\n // No hue configured => use original hue\r\n originalHue;\r\n }\r\n \r\n return {\r\n hue: hueFunction,\r\n colorSaturation: typeof colorSaturation == \"number\" ? colorSaturation : 0.5,\r\n grayscaleSaturation: typeof grayscaleSaturation == \"number\" ? grayscaleSaturation : 0,\r\n colorLightness: lightness(\"color\", [0.4, 0.8]),\r\n grayscaleLightness: lightness(\"grayscale\", [0.3, 0.9]),\r\n backColor: parseColor(backColor),\r\n iconPadding: \r\n typeof paddingOrLocalConfig == \"number\" ? paddingOrLocalConfig : \r\n typeof padding == \"number\" ? padding : \r\n defaultPadding\r\n }\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\n/**\r\n * Represents a point.\r\n */\r\nexport class Point {\r\n /**\r\n * @param {number} x \r\n * @param {number} y \r\n */\r\n constructor(x, y) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { Point } from \"./point\";\r\n\r\n/**\r\n * Translates and rotates a point before being passed on to the canvas context. This was previously done by the canvas context itself, \r\n * but this caused a rendering issue in Chrome on sizes > 256 where the rotation transformation of inverted paths was not done properly.\r\n */\r\nexport class Transform {\r\n /**\r\n * @param {number} x The x-coordinate of the upper left corner of the transformed rectangle.\r\n * @param {number} y The y-coordinate of the upper left corner of the transformed rectangle.\r\n * @param {number} size The size of the transformed rectangle.\r\n * @param {number} rotation Rotation specified as 0 = 0 rad, 1 = 0.5π rad, 2 = π rad, 3 = 1.5π rad\r\n */\r\n constructor(x, y, size, rotation) {\r\n this._x = x;\r\n this._y = y;\r\n this._size = size;\r\n this._rotation = rotation;\r\n }\r\n\r\n /**\r\n * Transforms the specified point based on the translation and rotation specification for this Transform.\r\n * @param {number} x x-coordinate\r\n * @param {number} y y-coordinate\r\n * @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.\r\n * @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.\r\n */\r\n transformIconPoint(x, y, w, h) {\r\n const right = this._x + this._size,\r\n bottom = this._y + this._size,\r\n rotation = this._rotation;\r\n return rotation === 1 ? new Point(right - y - (h || 0), this._y + x) :\r\n rotation === 2 ? new Point(right - x - (w || 0), bottom - y - (h || 0)) :\r\n rotation === 3 ? new Point(this._x + y, bottom - x - (w || 0)) :\r\n new Point(this._x + x, this._y + y);\r\n }\r\n}\r\n\r\nexport const NO_TRANSFORM = new Transform(0, 0, 0, 0);\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { NO_TRANSFORM } from \"./transform\";\r\n\r\n/**\r\n * @typedef {import(\"./renderer\").Renderer} Renderer\r\n * @typedef {import(\"./transform\").Transform} Transform\r\n */\r\n\r\n/**\r\n * Provides helper functions for rendering common basic shapes.\r\n */\r\nexport class Graphics {\r\n /**\r\n * @param {Renderer} renderer \r\n */\r\n constructor(renderer) {\r\n /**\r\n * @type {Renderer}\r\n * @private\r\n */\r\n this._renderer = renderer;\r\n\r\n /**\r\n * @type {Transform}\r\n */\r\n this.currentTransform = NO_TRANSFORM;\r\n }\r\n\r\n /**\r\n * Adds a polygon to the underlying renderer.\r\n * @param {Array<number>} points The points of the polygon clockwise on the format [ x0, y0, x1, y1, ..., xn, yn ]\r\n * @param {boolean=} invert Specifies if the polygon will be inverted.\r\n */\r\n addPolygon(points, invert) {\r\n const di = invert ? -2 : 2,\r\n transformedPoints = [];\r\n \r\n for (let i = invert ? points.length - 2 : 0; i < points.length && i >= 0; i += di) {\r\n transformedPoints.push(this.currentTransform.transformIconPoint(points[i], points[i + 1]));\r\n }\r\n \r\n this._renderer.addPolygon(transformedPoints);\r\n }\r\n \r\n /**\r\n * Adds a polygon to the underlying renderer.\r\n * Source: http://stackoverflow.com/a/2173084\r\n * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the entire ellipse.\r\n * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the entire ellipse.\r\n * @param {number} size The size of the ellipse.\r\n * @param {boolean=} invert Specifies if the ellipse will be inverted.\r\n */\r\n addCircle(x, y, size, invert) {\r\n const p = this.currentTransform.transformIconPoint(x, y, size, size);\r\n this._renderer.addCircle(p, size, invert);\r\n }\r\n\r\n /**\r\n * Adds a rectangle to the underlying renderer.\r\n * @param {number} x The x-coordinate of the upper left corner of the rectangle.\r\n * @param {number} y The y-coordinate of the upper left corner of the rectangle.\r\n * @param {number} w The width of the rectangle.\r\n * @param {number} h The height of the rectangle.\r\n * @param {boolean=} invert Specifies if the rectangle will be inverted.\r\n */\r\n addRectangle(x, y, w, h, invert) {\r\n this.addPolygon([\r\n x, y, \r\n x + w, y,\r\n x + w, y + h,\r\n x, y + h\r\n ], invert);\r\n }\r\n\r\n /**\r\n * Adds a right triangle to the underlying renderer.\r\n * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the triangle.\r\n * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the triangle.\r\n * @param {number} w The width of the triangle.\r\n * @param {number} h The height of the triangle.\r\n * @param {number} r The rotation of the triangle (clockwise). 0 = right corner of the triangle in the lower left corner of the bounding rectangle.\r\n * @param {boolean=} invert Specifies if the triangle will be inverted.\r\n */\r\n addTriangle(x, y, w, h, r, invert) {\r\n const points = [\r\n x + w, y, \r\n x + w, y + h, \r\n x, y + h,\r\n x, y\r\n ];\r\n points.splice(((r || 0) % 4) * 2, 2);\r\n this.addPolygon(points, invert);\r\n }\r\n\r\n /**\r\n * Adds a rhombus to the underlying renderer.\r\n * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the rhombus.\r\n * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the rhombus.\r\n * @param {number} w The width of the rhombus.\r\n * @param {number} h The height of the rhombus.\r\n * @param {boolean=} invert Specifies if the rhombus will be inverted.\r\n */\r\n addRhombus(x, y, w, h, invert) {\r\n this.addPolygon([\r\n x + w / 2, y,\r\n x + w, y + h / 2,\r\n x + w / 2, y + h,\r\n x, y + h / 2\r\n ], invert);\r\n }\r\n}","\r\nvar Graphics__prototype = Graphics.prototype;","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\n/**\r\n * @param {number} index\r\n * @param {Graphics} g\r\n * @param {number} cell\r\n * @param {number} positionIndex\r\n * @typedef {import('./graphics').Graphics} Graphics\r\n */\r\nexport function centerShape(index, g, cell, positionIndex) {\r\n index = index % 14;\r\n\r\n let k, m, w, h, inner, outer;\r\n\r\n !index ? (\r\n k = cell * 0.42,\r\n g.addPolygon([\r\n 0, 0,\r\n cell, 0,\r\n cell, cell - k * 2,\r\n cell - k, cell,\r\n 0, cell\r\n ])) :\r\n\r\n index == 1 ? (\r\n w = 0 | (cell * 0.5), \r\n h = 0 | (cell * 0.8),\r\n\r\n g.addTriangle(cell - w, 0, w, h, 2)) :\r\n\r\n index == 2 ? (\r\n w = 0 | (cell / 3),\r\n g.addRectangle(w, w, cell - w, cell - w)) :\r\n\r\n index == 3 ? (\r\n inner = cell * 0.1,\r\n // Use fixed outer border widths in small icons to ensure the border is drawn\r\n outer = \r\n cell < 6 ? 1 :\r\n cell < 8 ? 2 :\r\n (0 | (cell * 0.25)),\r\n \r\n inner = \r\n inner > 1 ? (0 | inner) : // large icon => truncate decimals\r\n inner > 0.5 ? 1 : // medium size icon => fixed width\r\n inner, // small icon => anti-aliased border\r\n\r\n g.addRectangle(outer, outer, cell - inner - outer, cell - inner - outer)) :\r\n\r\n index == 4 ? (\r\n m = 0 | (cell * 0.15),\r\n w = 0 | (cell * 0.5),\r\n g.addCircle(cell - w - m, cell - w - m, w)) :\r\n\r\n index == 5 ? (\r\n inner = cell * 0.1,\r\n outer = inner * 4,\r\n\r\n // Align edge to nearest pixel in large icons\r\n outer > 3 && (outer = 0 | outer),\r\n \r\n g.addRectangle(0, 0, cell, cell),\r\n g.addPolygon([\r\n outer, outer,\r\n cell - inner, outer,\r\n outer + (cell - outer - inner) / 2, cell - inner\r\n ], true)) :\r\n\r\n index == 6 ? \r\n g.addPolygon([\r\n 0, 0,\r\n cell, 0,\r\n cell, cell * 0.7,\r\n cell * 0.4, cell * 0.4,\r\n cell * 0.7, cell,\r\n 0, cell\r\n ]) :\r\n\r\n index == 7 ? \r\n g.addTriangle(cell / 2, cell / 2, cell / 2, cell / 2, 3) :\r\n\r\n index == 8 ? (\r\n g.addRectangle(0, 0, cell, cell / 2),\r\n g.addRectangle(0, cell / 2, cell / 2, cell / 2),\r\n g.addTriangle(cell / 2, cell / 2, cell / 2, cell / 2, 1)) :\r\n\r\n index == 9 ? (\r\n inner = cell * 0.14,\r\n // Use fixed outer border widths in small icons to ensure the border is drawn\r\n outer = \r\n cell < 4 ? 1 :\r\n cell < 6 ? 2 :\r\n (0 | (cell * 0.35)),\r\n\r\n inner = \r\n cell < 8 ? inner : // small icon => anti-aliased border\r\n (0 | inner), // large icon => truncate decimals\r\n\r\n g.addRectangle(0, 0, cell, cell),\r\n g.addRectangle(outer, outer, cell - outer - inner, cell - outer - inner, true)) :\r\n\r\n index == 10 ? (\r\n inner = cell * 0.12,\r\n outer = inner * 3,\r\n\r\n g.addRectangle(0, 0, cell, cell),\r\n g.addCircle(outer, outer, cell - inner - outer, true)) :\r\n\r\n index == 11 ? \r\n g.addTriangle(cell / 2, cell / 2, cell / 2, cell / 2, 3) :\r\n\r\n index == 12 ? (\r\n m = cell * 0.25,\r\n g.addRectangle(0, 0, cell, cell),\r\n g.addRhombus(m, m, cell - m, cell - m, true)) :\r\n\r\n // 13\r\n (\r\n !positionIndex && (\r\n m = cell * 0.4, w = cell * 1.2,\r\n g.addCircle(m, m, w)\r\n )\r\n );\r\n}\r\n\r\n/**\r\n * @param {number} index\r\n * @param {Graphics} g\r\n * @param {number} cell\r\n */\r\nexport function outerShape(index, g, cell) {\r\n index = index % 4;\r\n\r\n let m;\r\n\r\n !index ?\r\n g.addTriangle(0, 0, cell, cell, 0) :\r\n \r\n index == 1 ?\r\n g.addTriangle(0, cell / 2, cell, cell / 2, 0) :\r\n\r\n index == 2 ?\r\n g.addRhombus(0, 0, cell, cell) :\r\n\r\n // 3\r\n (\r\n m = cell / 6,\r\n g.addCircle(m, m, cell - 2 * m)\r\n );\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { correctedHsl } from \"./color\";\r\n\r\n/**\r\n * Gets a set of identicon color candidates for a specified hue and config.\r\n * @param {number} hue\r\n * @param {import(\"../common/configuration\").ParsedConfiguration} config\r\n */\r\nexport function colorTheme(hue, config) {\r\n hue = config.hue(hue);\r\n return [\r\n // Dark gray\r\n correctedHsl(hue, config.grayscaleSaturation, config.grayscaleLightness(0)),\r\n // Mid color\r\n correctedHsl(hue, config.colorSaturation, config.colorLightness(0.5)),\r\n // Light gray\r\n correctedHsl(hue, config.grayscaleSaturation, config.grayscaleLightness(1)),\r\n // Light color\r\n correctedHsl(hue, config.colorSaturation, config.colorLightness(1)),\r\n // Dark color\r\n correctedHsl(hue, config.colorSaturation, config.colorLightness(0))\r\n ];\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { Transform } from \"./transform\";\r\nimport { Graphics } from \"./graphics\";\r\nimport { centerShape, outerShape } from \"./shapes\";\r\nimport { colorTheme } from \"./colorTheme\";\r\nimport { parseHex } from \"../common/parseHex\";\r\nimport { getConfiguration } from \"../common/configuration\";\r\n \r\n/**\r\n * Draws an identicon to a specified renderer.\r\n * @param {import('./renderer').Renderer} renderer\r\n * @param {string} hash\r\n * @param {Object|number=} config\r\n */\r\nexport function iconGenerator(renderer, hash, config) {\r\n const parsedConfig = getConfiguration(config, 0.08);\r\n\r\n // Set background color\r\n if (parsedConfig.backColor) {\r\n renderer.setBackground(parsedConfig.backColor);\r\n }\r\n \r\n // Calculate padding and round to nearest integer\r\n let size = renderer.iconSize;\r\n const padding = (0.5 + size * parsedConfig.iconPadding) | 0;\r\n size -= padding * 2;\r\n \r\n const graphics = new Graphics(renderer);\r\n \r\n // Calculate cell size and ensure it is an integer\r\n const cell = 0 | (size / 4);\r\n \r\n // Since the cell size is integer based, the actual icon will be slightly smaller than specified => center icon\r\n const x = 0 | (padding + size / 2 - cell * 2);\r\n const y = 0 | (padding + size / 2 - cell * 2);\r\n\r\n function renderShape(colorIndex, shapes, index, rotationIndex, positions) {\r\n const shapeIndex = parseHex(hash, index, 1);\r\n let r = rotationIndex ? parseHex(hash, rotationIndex, 1) : 0;\r\n \r\n renderer.beginShape(availableColors[selectedColorIndexes[colorIndex]]);\r\n \r\n for (let i = 0; i < positions.length; i++) {\r\n graphics.currentTransform = new Transform(x + positions[i][0] * cell, y + positions[i][1] * cell, cell, r++ % 4);\r\n shapes(shapeIndex, graphics, cell, i);\r\n }\r\n \r\n renderer.endShape();\r\n }\r\n\r\n // AVAILABLE COLORS\r\n const hue = parseHex(hash, -7) / 0xfffffff,\r\n \r\n // Available colors for this icon\r\n availableColors = colorTheme(hue, parsedConfig),\r\n\r\n // The index of the selected colors\r\n selectedColorIndexes = [];\r\n\r\n let index;\r\n\r\n function isDuplicate(values) {\r\n if (values.indexOf(index) >= 0) {\r\n for (let i = 0; i < values.length; i++) {\r\n if (selectedColorIndexes.indexOf(values[i]) >= 0) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (let i = 0; i < 3; i++) {\r\n index = parseHex(hash, 8 + i, 1) % availableColors.length;\r\n if (isDuplicate([0, 4]) || // Disallow dark gray and dark color combo\r\n isDuplicate([2, 3])) { // Disallow light gray and light color combo\r\n index = 1;\r\n }\r\n selectedColorIndexes.push(index);\r\n }\r\n\r\n // ACTUAL RENDERING\r\n // Sides\r\n renderShape(0, outerShape, 2, 3, [[1, 0], [2, 0], [2, 3], [1, 3], [0, 1], [3, 1], [3, 2], [0, 2]]);\r\n // Corners\r\n renderShape(1, outerShape, 4, 5, [[0, 0], [3, 0], [3, 3], [0, 3]]);\r\n // Center\r\n renderShape(2, centerShape, 1, null, [[1, 1], [2, 1], [2, 2], [1, 2]]);\r\n \r\n renderer.finish();\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\n/**\r\n * Computes a SHA1 hash for any value and returns it as a hexadecimal string.\r\n * \r\n * This function is optimized for minimal code size and rather short messages.\r\n * \r\n * @param {string} message \r\n */\r\nexport function sha1(message) {\r\n const HASH_SIZE_HALF_BYTES = 40;\r\n const BLOCK_SIZE_WORDS = 16;\r\n\r\n // Variables\r\n // `var` is used to be able to minimize the number of `var` keywords.\r\n var i = 0,\r\n f = 0,\r\n \r\n // Use `encodeURI` to UTF8 encode the message without any additional libraries\r\n // We could use `unescape` + `encodeURI` to minimize the code, but that would be slightly risky\r\n // since `unescape` is deprecated.\r\n urlEncodedMessage = encodeURI(message) + \"%80\", // trailing '1' bit padding\r\n \r\n // This can be changed to a preallocated Uint32Array array for greater performance and larger code size\r\n data = [],\r\n dataSize,\r\n \r\n hashBuffer = [],\r\n\r\n a = 0x67452301,\r\n b = 0xefcdab89,\r\n c = ~a,\r\n d = ~b,\r\n e = 0xc3d2e1f0,\r\n hash = [a, b, c, d, e],\r\n\r\n blockStartIndex = 0,\r\n hexHash = \"\";\r\n\r\n /**\r\n * Rotates the value a specified number of bits to the left.\r\n * @param {number} value Value to rotate\r\n * @param {number} shift Bit count to shift.\r\n */\r\n function rotl(value, shift) {\r\n return (value << shift) | (value >>> (32 - shift));\r\n }\r\n\r\n // Message data\r\n for ( ; i < urlEncodedMessage.length; f++) {\r\n data[f >> 2] = data[f >> 2] |\r\n (\r\n (\r\n urlEncodedMessage[i] == \"%\"\r\n // Percent encoded byte\r\n ? parseInt(urlEncodedMessage.substring(i + 1, i += 3), 16)\r\n // Unencoded byte\r\n : urlEncodedMessage.charCodeAt(i++)\r\n )\r\n\r\n // Read bytes in reverse order (big endian words)\r\n << ((3 - (f & 3)) * 8)\r\n );\r\n }\r\n\r\n // f is now the length of the utf8 encoded message\r\n // 7 = 8 bytes (64 bit) for message size, -1 to round down\r\n // >> 6 = integer division with block size\r\n dataSize = (((f + 7) >> 6) + 1) * BLOCK_SIZE_WORDS;\r\n\r\n // Message size in bits.\r\n // SHA1 uses a 64 bit integer to represent the size, but since we only support short messages only the least\r\n // significant 32 bits are set. -8 is for the '1' bit padding byte.\r\n data[dataSize - 1] = f * 8 - 8;\r\n \r\n // Compute hash\r\n for ( ; blockStartIndex < dataSize; blockStartIndex += BLOCK_SIZE_WORDS) {\r\n for (i = 0; i < 80; i++) {\r\n f = rotl(a, 5) + e + (\r\n // Ch\r\n i < 20 ? ((b & c) ^ ((~b) & d)) + 0x5a827999 :\r\n \r\n // Parity\r\n i < 40 ? (b ^ c ^ d) + 0x6ed9eba1 :\r\n \r\n // Maj\r\n i < 60 ? ((b & c) ^ (b & d) ^ (c & d)) + 0x8f1bbcdc :\r\n \r\n // Parity\r\n (b ^ c ^ d) + 0xca62c1d6\r\n ) + ( \r\n hashBuffer[i] = i < BLOCK_SIZE_WORDS\r\n // Bitwise OR is used to coerse `undefined` to 0\r\n ? (data[blockStartIndex + i] | 0)\r\n : rotl(hashBuffer[i - 3] ^ hashBuffer[i - 8] ^ hashBuffer[i - 14] ^ hashBuffer[i - 16], 1)\r\n );\r\n\r\n e = d;\r\n d = c;\r\n c = rotl(b, 30);\r\n b = a;\r\n a = f;\r\n }\r\n\r\n hash[0] = a = ((hash[0] + a) | 0);\r\n hash[1] = b = ((hash[1] + b) | 0);\r\n hash[2] = c = ((hash[2] + c) | 0);\r\n hash[3] = d = ((hash[3] + d) | 0);\r\n hash[4] = e = ((hash[4] + e) | 0);\r\n }\r\n\r\n // Format hex hash\r\n for (i = 0; i < HASH_SIZE_HALF_BYTES; i++) {\r\n hexHash += (\r\n (\r\n // Get word (2^3 half-bytes per word)\r\n hash[i >> 3] >>>\r\n\r\n // Append half-bytes in reverse order\r\n ((7 - (i & 7)) * 4)\r\n ) \r\n // Clamp to half-byte\r\n & 0xf\r\n ).toString(16);\r\n }\r\n\r\n return hexHash;\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { sha1 } from \"./sha1\";\r\n\r\n/**\r\n * Inputs a value that might be a valid hash string for Jdenticon and returns it \r\n * if it is determined valid, otherwise a falsy value is returned.\r\n */\r\nexport function isValidHash(hashCandidate) {\r\n return /^[0-9a-f]{11,}$/i.test(hashCandidate) && hashCandidate;\r\n}\r\n\r\n/**\r\n * Computes a hash for the specified value. Currently SHA1 is used. This function\r\n * always returns a valid hash.\r\n */\r\nexport function computeHash(value) {\r\n return sha1(value == null ? \"\" : \"\" + value);\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { toCss3Color } from \"../color\";\r\n\r\n/**\r\n * @typedef {import(\"../renderer\").Renderer} Renderer\r\n * @typedef {import('../point').Point} Point\r\n */\r\n\r\n/**\r\n * Renderer redirecting drawing commands to a canvas context.\r\n * @implements {Renderer}\r\n */\r\nexport class CanvasRenderer {\r\n /**\r\n * @param {number=} iconSize\r\n */\r\n constructor(ctx, iconSize) {\r\n const canvas = ctx.canvas; \r\n const width = canvas.width;\r\n const height = canvas.height;\r\n \r\n ctx.save();\r\n \r\n if (!iconSize) {\r\n iconSize = Math.min(width, height);\r\n \r\n ctx.translate(\r\n ((width - iconSize) / 2) | 0,\r\n ((height - iconSize) / 2) | 0);\r\n }\r\n\r\n /**\r\n * @private\r\n */\r\n this._ctx = ctx;\r\n this.iconSize = iconSize;\r\n \r\n ctx.clearRect(0, 0, iconSize, iconSize);\r\n }\r\n\r\n /**\r\n * Fills the background with the specified color.\r\n * @param {string} fillColor Fill color on the format #rrggbb[aa].\r\n */\r\n setBackground(fillColor) {\r\n const ctx = this._ctx;\r\n const iconSize = this.iconSize;\r\n\r\n ctx.fillStyle = toCss3Color(fillColor);\r\n ctx.fillRect(0, 0, iconSize, iconSize);\r\n }\r\n\r\n /**\r\n * Marks the beginning of a new shape of the specified color. Should be ended with a call to endShape.\r\n * @param {string} fillColor Fill color on format #rrggbb[aa].\r\n */\r\n beginShape(fillColor) {\r\n const ctx = this._ctx;\r\n ctx.fillStyle = toCss3Color(fillColor);\r\n ctx.beginPath();\r\n }\r\n\r\n /**\r\n * Marks the end of the currently drawn shape. This causes the queued paths to be rendered on the canvas.\r\n */\r\n endShape() {\r\n this._ctx.fill();\r\n }\r\n\r\n /**\r\n * Adds a polygon to the rendering queue.\r\n * @param points An array of Point objects.\r\n */\r\n addPolygon(points) {\r\n const ctx = this._ctx;\r\n ctx.moveTo(points[0].x, points[0].y);\r\n for (let i = 1; i < points.length; i++) {\r\n ctx.lineTo(points[i].x, points[i].y);\r\n }\r\n ctx.closePath();\r\n }\r\n\r\n /**\r\n * Adds a circle to the rendering queue.\r\n * @param {Point} point The upper left corner of the circle bounding box.\r\n * @param {number} diameter The diameter of the circle.\r\n * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).\r\n */\r\n addCircle(point, diameter, counterClockwise) {\r\n const ctx = this._ctx,\r\n radius = diameter / 2;\r\n ctx.moveTo(point.x + radius, point.y + radius);\r\n ctx.arc(point.x + radius, point.y + radius, radius, 0, Math.PI * 2, counterClockwise);\r\n ctx.closePath();\r\n }\r\n\r\n /**\r\n * Called when the icon has been completely drawn.\r\n */\r\n finish() {\r\n this._ctx.restore();\r\n }\r\n}\r\n","\r\nvar CanvasRenderer__prototype = CanvasRenderer.prototype;","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nexport const ICON_TYPE_SVG = 1;\r\n\r\nexport const ICON_TYPE_CANVAS = 2;\r\n\r\nexport const ATTRIBUTES = {\r\n HASH: \"data-jdenticon-hash\",\r\n VALUE: \"data-jdenticon-value\"\r\n};\r\n\r\nexport const IS_RENDERED_PROPERTY = \"jdenticonRendered\";\r\n\r\nexport const ICON_SELECTOR = \"[\" + ATTRIBUTES.HASH +\"],[\" + ATTRIBUTES.VALUE +\"]\";\r\n\r\nexport const documentQuerySelectorAll = /** @type {!Function} */ (\r\n typeof document !== \"undefined\" && document.querySelectorAll.bind(document));\r\n\r\nexport function getIdenticonType(el) {\r\n if (el) {\r\n const tagName = el[\"tagName\"];\r\n\r\n if (/^svg$/i.test(tagName)) {\r\n return ICON_TYPE_SVG;\r\n }\r\n\r\n if (/^canvas$/i.test(tagName) && \"getContext\" in el) {\r\n return ICON_TYPE_CANVAS;\r\n }\r\n }\r\n}\r\n\r\nexport function whenDocumentIsReady(/** @type {Function} */ callback) {\r\n function loadedHandler() {\r\n document.removeEventListener(\"DOMContentLoaded\", loadedHandler);\r\n window.removeEventListener(\"load\", loadedHandler);\r\n setTimeout(callback, 0); // Give scripts a chance to run\r\n }\r\n \r\n if (typeof document !== \"undefined\" &&\r\n typeof window !== \"undefined\" &&\r\n typeof setTimeout !== \"undefined\"\r\n ) {\r\n if (document.readyState === \"loading\") {\r\n document.addEventListener(\"DOMContentLoaded\", loadedHandler);\r\n window.addEventListener(\"load\", loadedHandler);\r\n } else {\r\n // Document already loaded. The load events above likely won't be raised\r\n setTimeout(callback, 0);\r\n }\r\n }\r\n}\r\n","import { iconGenerator } from \"../renderer/iconGenerator\";\r\nimport { isValidHash, computeHash } from \"../common/hashUtils\";\r\nimport { CanvasRenderer } from \"../renderer/canvas/canvasRenderer\";\r\nimport { IS_RENDERED_PROPERTY } from \"../common/dom\";\r\n\r\n/**\r\n * Draws an identicon to a context.\r\n * @param {CanvasRenderingContext2D} ctx - Canvas context on which the icon will be drawn at location (0, 0).\r\n * @param {*} hashOrValue - A hexadecimal hash string or any value that will be hashed by Jdenticon.\r\n * @param {number} size - Icon size in pixels.\r\n * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any\r\n * global configuration in its entirety. For backward compatibility a padding value in the range [0.0, 0.5) can be\r\n * specified in place of a configuration object.\r\n */\r\nexport function drawIcon(ctx, hashOrValue, size, config) {\r\n if (!ctx) {\r\n throw new Error(\"No canvas specified.\");\r\n }\r\n \r\n iconGenerator(new CanvasRenderer(ctx, size), \r\n isValidHash(hashOrValue) || computeHash(hashOrValue), \r\n config);\r\n\r\n const canvas = ctx.canvas;\r\n if (canvas) {\r\n canvas[IS_RENDERED_PROPERTY] = true;\r\n }\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\n/**\r\n * Prepares a measure to be used as a measure in an SVG path, by\r\n * rounding the measure to a single decimal. This reduces the file\r\n * size of the generated SVG with more than 50% in some cases.\r\n */\r\nfunction svgValue(value) {\r\n return ((value * 10 + 0.5) | 0) / 10;\r\n}\r\n\r\n/**\r\n * Represents an SVG path element.\r\n */\r\nexport class SvgPath {\r\n constructor() {\r\n /**\r\n * This property holds the data string (path.d) of the SVG path.\r\n * @type {string}\r\n */\r\n this.dataString = \"\";\r\n }\r\n\r\n /**\r\n * Adds a polygon with the current fill color to the SVG path.\r\n * @param points An array of Point objects.\r\n */\r\n addPolygon(points) {\r\n let dataString = \"\";\r\n for (let i = 0; i < points.length; i++) {\r\n dataString += (i ? \"L\" : \"M\") + svgValue(points[i].x) + \" \" + svgValue(points[i].y);\r\n }\r\n this.dataString += dataString + \"Z\";\r\n }\r\n\r\n /**\r\n * Adds a circle with the current fill color to the SVG path.\r\n * @param {import('../point').Point} point The upper left corner of the circle bounding box.\r\n * @param {number} diameter The diameter of the circle.\r\n * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).\r\n */\r\n addCircle(point, diameter, counterClockwise) {\r\n const sweepFlag = counterClockwise ? 0 : 1,\r\n svgRadius = svgValue(diameter / 2),\r\n svgDiameter = svgValue(diameter),\r\n svgArc = \"a\" + svgRadius + \",\" + svgRadius + \" 0 1,\" + sweepFlag + \" \";\r\n \r\n this.dataString += \r\n \"M\" + svgValue(point.x) + \" \" + svgValue(point.y + diameter / 2) +\r\n svgArc + svgDiameter + \",0\" + \r\n svgArc + (-svgDiameter) + \",0\";\r\n }\r\n}\r\n\r\n","\r\nvar SvgPath__prototype = SvgPath.prototype;","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { SvgPath } from \"./svgPath\";\r\nimport { parseHex } from \"../../common/parseHex\";\r\n\r\n/**\r\n * @typedef {import(\"../point\").Point} Point\r\n * @typedef {import(\"../renderer\").Renderer} Renderer\r\n * @typedef {import(\"./svgElement\").SvgElement} SvgElement\r\n * @typedef {import(\"./svgWriter\").SvgWriter} SvgWriter\r\n */\r\n\r\n/**\r\n * Renderer producing SVG output.\r\n * @implements {Renderer}\r\n */\r\nexport class SvgRenderer {\r\n /**\r\n * @param {SvgElement|SvgWriter} target \r\n */\r\n constructor(target) {\r\n /**\r\n * @type {SvgPath}\r\n * @private\r\n */\r\n this._path;\r\n\r\n /**\r\n * @type {Object.<string,SvgPath>}\r\n * @private\r\n */\r\n this._pathsByColor = { };\r\n\r\n /**\r\n * @type {SvgElement|SvgWriter}\r\n * @private\r\n */\r\n this._target = target;\r\n\r\n /**\r\n * @type {number}\r\n */\r\n this.iconSize = target.iconSize;\r\n }\r\n\r\n /**\r\n * Fills the background with the specified color.\r\n * @param {string} fillColor Fill color on the format #rrggbb[aa].\r\n */\r\n setBackground(fillColor) {\r\n const match = /^(#......)(..)?/.exec(fillColor),\r\n opacity = match[2] ? parseHex(match[2], 0) / 255 : 1;\r\n this._target.setBackground(match[1], opacity);\r\n }\r\n\r\n /**\r\n * Marks the beginning of a new shape of the specified color. Should be ended with a call to endShape.\r\n * @param {string} color Fill color on format #xxxxxx.\r\n */\r\n beginShape(color) {\r\n this._path = this._pathsByColor[color] || (this._pathsByColor[color] = new SvgPath());\r\n }\r\n\r\n /**\r\n * Marks the end of the currently drawn shape.\r\n */\r\n endShape() { }\r\n\r\n /**\r\n * Adds a polygon with the current fill color to the SVG.\r\n * @param points An array of Point objects.\r\n */\r\n addPolygon(points) {\r\n this._path.addPolygon(points);\r\n }\r\n\r\n /**\r\n * Adds a circle with the current fill color to the SVG.\r\n * @param {Point} point The upper left corner of the circle bounding box.\r\n * @param {number} diameter The diameter of the circle.\r\n * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).\r\n */\r\n addCircle(point, diameter, counterClockwise) {\r\n this._path.addCircle(point, diameter, counterClockwise);\r\n }\r\n\r\n /**\r\n * Called when the icon has been completely drawn.\r\n */\r\n finish() { \r\n const pathsByColor = this._pathsByColor;\r\n for (let color in pathsByColor) {\r\n // hasOwnProperty cannot be shadowed in pathsByColor\r\n // eslint-disable-next-line no-prototype-builtins\r\n if (pathsByColor.hasOwnProperty(color)) {\r\n this._target.appendPath(color, pathsByColor[color].dataString);\r\n }\r\n }\r\n }\r\n}\r\n","\r\nvar SvgRenderer__prototype = SvgRenderer.prototype;","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nexport const SVG_CONSTANTS = {\r\n XMLNS: \"http://www.w3.org/2000/svg\",\r\n WIDTH: \"width\",\r\n HEIGHT: \"height\",\r\n}","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { SVG_CONSTANTS } from \"./constants\";\r\n\r\n/**\r\n * Renderer producing SVG output.\r\n */\r\nexport class SvgWriter {\r\n /**\r\n * @param {number} iconSize - Icon width and height in pixels.\r\n */\r\n constructor(iconSize) {\r\n /**\r\n * @type {number}\r\n */\r\n this.iconSize = iconSize;\r\n\r\n /**\r\n * @type {string}\r\n * @private\r\n */\r\n this._s =\r\n '<svg xmlns=\"' + SVG_CONSTANTS.XMLNS + '\" width=\"' + \r\n iconSize + '\" height=\"' + iconSize + '\" viewBox=\"0 0 ' + \r\n iconSize + ' ' + iconSize + '\">';\r\n }\r\n\r\n /**\r\n * Fills the background with the specified color.\r\n * @param {string} fillColor Fill color on the format #rrggbb.\r\n * @param {number} opacity Opacity in the range [0.0, 1.0].\r\n */\r\n setBackground(fillColor, opacity) {\r\n if (opacity) {\r\n this._s += '<rect width=\"100%\" height=\"100%\" fill=\"' + \r\n fillColor + '\" opacity=\"' + opacity.toFixed(2) + '\"/>';\r\n }\r\n }\r\n\r\n /**\r\n * Writes a path to the SVG string.\r\n * @param {string} color Fill color on format #rrggbb.\r\n * @param {string} dataString The SVG path data string.\r\n */\r\n appendPath(color, dataString) {\r\n this._s += '<path fill=\"' + color + '\" d=\"' + dataString + '\"/>';\r\n }\r\n\r\n /**\r\n * Gets the rendered image as an SVG string.\r\n */\r\n toString() {\r\n return this._s + \"</svg>\";\r\n }\r\n}\r\n","\r\nvar SvgWriter__prototype = SvgWriter.prototype;","import { iconGenerator } from \"../renderer/iconGenerator\";\r\nimport { isValidHash, computeHash } from \"../common/hashUtils\";\r\nimport { SvgRenderer } from \"../renderer/svg/svgRenderer\";\r\nimport { SvgWriter } from \"../renderer/svg/svgWriter\";\r\n\r\n/**\r\n * Draws an identicon as an SVG string.\r\n * @param {*} hashOrValue - A hexadecimal hash string or any value that will be hashed by Jdenticon.\r\n * @param {number} size - Icon size in pixels.\r\n * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any\r\n * global configuration in its entirety. For backward compatibility a padding value in the range [0.0, 0.5) can be\r\n * specified in place of a configuration object.\r\n * @returns {string} SVG string\r\n */\r\nexport function toSvg(hashOrValue, size, config) {\r\n const writer = new SvgWriter(size);\r\n iconGenerator(new SvgRenderer(writer), \r\n isValidHash(hashOrValue) || computeHash(hashOrValue),\r\n config);\r\n return writer.toString();\r\n}\r\n","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { SVG_CONSTANTS } from \"./constants\";\r\n\r\n/**\r\n * Creates a new element and adds it to the specified parent.\r\n * @param {Element} parentNode\r\n * @param {string} name\r\n * @param {...(string|number)} keyValuePairs\r\n */\r\nfunction SvgElement_append(parentNode, name, ...keyValuePairs) {\r\n const el = document.createElementNS(SVG_CONSTANTS.XMLNS, name);\r\n \r\n for (let i = 0; i + 1 < keyValuePairs.length; i += 2) {\r\n el.setAttribute(\r\n /** @type {string} */(keyValuePairs[i]),\r\n /** @type {string} */(keyValuePairs[i + 1]),\r\n );\r\n }\r\n\r\n parentNode.appendChild(el);\r\n}\r\n\r\n\r\n/**\r\n * Renderer producing SVG output.\r\n */\r\nexport class SvgElement {\r\n /**\r\n * @param {Element} element - Target element\r\n */\r\n constructor(element) {\r\n // Don't use the clientWidth and clientHeight properties on SVG elements\r\n // since Firefox won't serve a proper value of these properties on SVG\r\n // elements (https://bugzilla.mozilla.org/show_bug.cgi?id=874811)\r\n // Instead use 100px as a hardcoded size (the svg viewBox will rescale \r\n // the icon to the correct dimensions)\r\n const iconSize = this.iconSize = Math.min(\r\n (Number(element.getAttribute(SVG_CONSTANTS.WIDTH)) || 100),\r\n (Number(element.getAttribute(SVG_CONSTANTS.HEIGHT)) || 100)\r\n );\r\n \r\n /**\r\n * @type {Element}\r\n * @private\r\n */\r\n this._el = element;\r\n \r\n // Clear current SVG child elements\r\n while (element.firstChild) {\r\n element.removeChild(element.firstChild);\r\n }\r\n \r\n // Set viewBox attribute to ensure the svg scales nicely.\r\n element.setAttribute(\"viewBox\", \"0 0 \" + iconSize + \" \" + iconSize);\r\n element.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\r\n }\r\n\r\n /**\r\n * Fills the background with the specified color.\r\n * @param {string} fillColor Fill color on the format #rrggbb.\r\n * @param {number} opacity Opacity in the range [0.0, 1.0].\r\n */\r\n setBackground(fillColor, opacity) {\r\n if (opacity) {\r\n SvgElement_append(this._el, \"rect\",\r\n SVG_CONSTANTS.WIDTH, \"100%\",\r\n SVG_CONSTANTS.HEIGHT, \"100%\",\r\n \"fill\", fillColor,\r\n \"opacity\", opacity);\r\n }\r\n }\r\n\r\n /**\r\n * Appends a path to the SVG element.\r\n * @param {string} color Fill color on format #xxxxxx.\r\n * @param {string} dataString The SVG path data string.\r\n */\r\n appendPath(color, dataString) {\r\n SvgElement_append(this._el, \"path\",\r\n \"fill\", color,\r\n \"d\", dataString);\r\n }\r\n}\r\n","\r\nvar SvgElement__prototype = SvgElement.prototype;","/**\r\n * Jdenticon\r\n * https://github.com/dmester/jdenticon\r\n * Copyright © Daniel Mester Pirttijärvi\r\n */\r\n\r\nimport { iconGenerator } from \"../renderer/iconGenerator\";\r\nimport { isValidHash, computeHash } from \"../common/hashUtils\";\r\nimport { ATTRIBUTES, ICON_SELECTOR, IS_RENDERED_PROPERTY, documentQuerySelectorAll } from \"../common/dom\";\r\nimport { SvgRenderer } from \"../renderer/svg/svgRenderer\";\r\nimport { SvgElement } from \"../renderer/svg/svgElement\";\r\nimport { CanvasRenderer } from \"../renderer/canvas/canvasRenderer\";\r\nimport { ICON_TYPE_CANVAS, ICON_TYPE_SVG, getIdenticonType } from \"../common/dom\";\r\n\r\n\r\n/**\r\n * Updates all canvas elements with the `data-jdenticon-hash` or `data-jdenticon-value` attribute.\r\n */\r\nexport function updateAll() {\r\n if (documentQuerySelectorAll) {\r\n update(ICON_SELECTOR);\r\n }\r\n}\r\n\r\n/**\r\n * Updates all canvas elements with the `data-jdenticon-hash` or `data-jdenticon-value` attribute that have not already\r\n * been rendered.\r\n */\r\nexport function updateAllConditional() {\r\n if (documentQuerySelectorAll) {\r\n /** @type {NodeListOf<HTMLElement>} */\r\n const elements = documentQuerySelectorAll(ICON_SELECTOR);\r\n \r\n for (let i = 0; i < elements.length; i++) {\r\n const el = elements[i];\r\n if (!el[IS_RENDERED_PROPERTY]) {\r\n update(el);\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Updates the identicon in the specified `<canvas>` or `<svg>` elements.\r\n * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type\r\n * `<svg>` or `<canvas>`, or a CSS selector to such an element.\r\n * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or\r\n * `data-jdenticon-value` attribute will be evaluated.\r\n * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any\r\n * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be\r\n * specified in place of a configuration object.\r\n */\r\nexport function update(el, hashOrValue, config) {\r\n renderDomElement(el, hashOrValue, config, function (el, iconType) {\r\n if (iconType) {\r\n return iconType == ICON_TYPE_SVG ? \r\n new SvgRenderer(new SvgElement(el)) : \r\n new CanvasRenderer(/** @type {HTMLCanvasElement} */(el).getContext(\"2d\"));\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Updates the identicon in the specified `<canvas>` elements.\r\n * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type\r\n * `<canvas>`, or a CSS selector to such an element.\r\n * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or\r\n * `data-jdenticon-value` attribute will be evaluated.\r\n * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any\r\n * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be\r\n * specified in place of a configuration object.\r\n */\r\nexport function updateCanvas(el, hashOrValue, config) {\r\n renderDomElement(el, hashOrValue, config, function (el, iconType) {\r\n if (iconType == ICON_TYPE_CANVAS) {\r\n return new CanvasRenderer(/** @type {HTMLCanvasElement} */(el).getContext(\"2d\"));\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Updates the identicon in the specified `<svg>` elements.\r\n * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type\r\n * `<svg>`, or a CSS selector to such an element.\r\n * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or\r\n * `data-jdenticon-value` attribute will be evaluated.\r\n * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any\r\n * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be\r\n * specified in place of a configuration object.\r\n */\r\nexport function updateSvg(el, hashOrValue, config) {\r\n renderDomElement(el, hashOrValue, config, function (el, iconType) {\r\n if (iconType == ICON_TYPE_SVG) {\r\n return new SvgRenderer(new SvgElement(el));\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Updates the identicon in the specified canvas or svg elements.\r\n * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type\r\n * `<svg>` or `<canvas>`, or a CSS selector to such an element.\r\n * @param {*} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or\r\n * `data-jdenticon-value` attribute will be evaluated.\r\n * @param {Object|number|undefined} config\r\n * @param {function(Element,number):import(\"../renderer/renderer\").Renderer} rendererFactory - Factory function for creating an icon renderer.\r\n */\r\nfunction renderDomElement(el, hashOrValue, config, rendererFactory) {\r\n if (typeof el === \"string\") {\r\n if (documentQuerySelectorAll) {\r\n const elements = documentQuerySelectorAll(el);\r\n for (let i = 0; i < elements.length; i++) {\r\n renderDomElement(elements[i], hashOrValue, config, rendererFactory);\r\n }\r\n }\r\n return;\r\n }\r\n \r\n // Hash selection. The result from getValidHash or computeHash is \r\n // accepted as a valid hash.\r\n const hash = \r\n // 1. Explicit valid hash\r\n isValidHash(hashOrValue) ||\r\n \r\n // 2. Explicit value (`!= null` catches both null and undefined)\r\n hashOrValue != null && computeHash(hashOrValue) ||\r\n \r\n // 3. `data-jdenticon-hash` attribute\r\n isValidHash(el.getAttribute(ATTRIBUTES.HASH)) ||\r\n \r\n // 4. `data-jdenticon-value` attribute. \r\n // We want to treat an empty attribute as an empty value. \r\n // Some browsers return empty string even if the attribute \r\n // is not specified, so use hasAttribute to determine if \r\n // the attribute is specified.\r\n el.hasAttribute(ATTRIBUTES.VALUE) && computeHash(el.getAttribute(ATTRIBUTES.VALUE));\r\n \r\n if (!hash) {\r\n // No hash specified. Don't render an icon.\r\n return;\r\n }\r\n \r\n const renderer = rendererFactory(el, getIdenticonType(el));\r\n if (renderer) {\r\n // Draw icon\r\n iconGenerator(renderer, hash, config);\r\n el[IS_RENDERED_PROPERTY] = true;\r\n }\r\n}\r\n","//Random string generator\nexport function makeid(length) {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for (var i = 0; i < length; i++)\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n\n return text;\n}\n\n//shortcut caller\nexport function GE(el) {\n return document.getElementById(el);\n}\n\n//add param to url\nexport function SetSearchParam(param, value) {\n var url = new URL(window.location.href);\n var query_string = url.search;\n var search_params = new URLSearchParams(query_string); \n \n var old_value = search_params.get(param);\n \n if (old_value != value) {\n if (value != null)\n search_params.set(param, value);\n else\n search_params.delete(param)\n \n url.search = search_params.toString();\n window.history.pushState(\"\", document.title, url);\n }\n}\n\n//get param from url\nexport function GetSearchParam(param) {\n var url = new URL(window.location.href);\n var query_string = url.search;\n var search_params = new URLSearchParams(query_string); \n \n return search_params.get(param);\n}","import { toSvg } from \"jdenticon\"\nimport { makeid, GE, GetSearchParam, SetSearchParam } from \"./utils.js\"\n\nvar cell_colors = ['is_black', 'is_blue', 'is_red', 'is_green', 'is_yellow', 'is_grey', 'is_magenta', 'is_orange', 'is_aqua', 'is_maroon']\nvar cached_levels_data\nvar cached_level_path\n\nGE('animation').innerHTML = `\n<img id=\"anim_false_0\" class=\"animation_image is_hidden\" src=\"images/false/weary_face.gif\"/>\n<img id=\"anim_false_1\" class=\"animation_image is_hidden\" src=\"images/false/frowning_face.gif\"/>\n<img id=\"anim_false_2\" class=\"animation_image is_hidden\" src=\"images/false/unamused_face.gif\"/>\n<img id=\"anim_false_3\" class=\"animation_image is_hidden\" src=\"images/false/crying_face.gif\"/>\n<img id=\"anim_false_4\" class=\"animation_image is_hidden\" src=\"images/false/pleading_face.gif\"/>\n<img id=\"anim_false_5\" class=\"animation_image is_hidden\" src=\"images/false/thinking_face.gif\"/>\n\n<img id=\"anim_true_0\" class=\"animation_image is_hidden\" src=\"images/true/winking_face.gif\"/>\n<img id=\"anim_true_1\" class=\"animation_image is_hidden\" src=\"images/true/beaming_face_with_smiling_eyes.gif\"/>\n<img id=\"anim_true_2\" class=\"animation_image is_hidden\" src=\"images/true/grinning_face_with_smiling_eyes.gif\"/>\n<img id=\"anim_true_3\" class=\"animation_image is_hidden\" src=\"images/true/hugging_face.gif\"/>\n<img id=\"anim_true_4\" class=\"animation_image is_hidden\" src=\"images/true/partying_face.gif\"/>\n<img id=\"anim_true_5\" class=\"animation_image is_hidden\" src=\"images/true/relieved_face.gif\"/>\n<img id=\"anim_true_6\" class=\"animation_image is_hidden\" src=\"images/true/smiling_face.gif\"/>\n<img id=\"anim_true_7\" class=\"animation_image is_hidden\" src=\"images/true/smiling_face_with_sunglasses.gif\"/>\n<img id=\"anim_true_8\" class=\"animation_image is_hidden\" src=\"images/true/star_struck.gif\"/>\n<img id=\"anim_true_9\" class=\"animation_image is_hidden\" src=\"images/true/upside_down_face.gif\"/> \n`;\n\nwindow['build_levels'] = (levels_data) => {\n if (!levels_data) levels_data = cached_levels_data\n else cached_levels_data = levels_data \n console.log(levels_data);\n \n var template = `\n <img src=\"images/logo.png\" id=\"logo-image\"/>\n <div>\n <a href=\"https://github.com/volotat/ARC-Game\" style=\"color:black\">\n <svg class=\"is_inline\" height=\"48\" aria-hidden=\"true\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"48\" data-view-component=\"true\" class=\"octicon octicon-mark-github v-align-middle\">\n <path fill-rule=\"evenodd\" d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z\"></path>\n </svg>\n <span class=\"is_inline github_text\">Github page</span>\n </a>\n <div>\n <div id=\"levels_data\">`\n\n for (var levels_backet in levels_data) {\n template += \n `<h2>${levels_backet}</h2>\n <div class=\"levels-block\">`\n\n for (var level_ind in levels_data[levels_backet]) {\n var level = levels_data[levels_backet][level_ind]\n var svg = toSvg(level_ind, 100)\n template += \n `<a href=\"?task=${encodeURIComponent(level)}\">\n <div class=\"level-card\">\n <div id=\"${level}\" class=\"task-icon ${localStorage.getItem(`tasks/${level}`)?'solved':''}\">${svg}</div> \n ${level_ind}\n </div>\n </a>`\n } //solved\n template += `</div>`\n }\n template += `</div>`\n GE(\"main_container\").innerHTML = template\n\n window.scrollTo(0, 0)\n \n}\n\nwindow['load_level'] = (level_path) =>{\n cached_level_path = level_path\n\n GE('main_container').innerHTML = 'Загрузка...';\n console.log(level_path)\n let level_name = level_path.replace(/^.*[\\\\\\/]/, '').split('.').slice(0, -1).join('.')\n fetch(level_path)\n .then(response => response.json())\n .then(json => build_level(json, level_name));\n}\n\n\nif (GetSearchParam('task')) {\n var task = decodeURIComponent(GetSearchParam('task'))\n load_level('tasks/' + task)\n} else {\n fetch(\"tasks/levels.json\")\n .then(response => response.json())\n .then(json => build_levels(json));\n}\n\n\nwindow.addEventListener('mousemove', e => {\n var mouseX = e.pageX + 10;\n var mouseY = e.pageY + 10; \n\n GE(\"circle\").style.left = mouseX +'px'\n GE(\"circle\").style.top = mouseY +'px'\n});\n\n\nvar block_data_cache = {};\n\nfunction create_block(params){\n var block_name = params.block_name ?? \"\";\n var block_data = params.block_data;\n var is_clickable = params.is_clickable ?? false;\n var is_dragable = params.is_dragable ?? false;\n var is_big = params.is_big ?? false;\n //var block_size = params.block_size ?? 260;\n var block_type = params.block_type ?? \"task-train-block\";\n\n var template = ''\n var action = \"\";\n if (is_dragable) action = `onclick=\"copy_block_from_to('${block_name}', 'test_result')\" `\n template += `<div class=\"is_inline ${is_dragable?'is_dragable':''} ${block_type}\" ${action}>`\n\n if (is_clickable) \n action = `ontouchmove=\"onMoveOverBlock(event)\" onmousemove=\"onMoveOverBlock(event)\" \n ontouchstart=\"isMoveActive(true)\" ontouchend=\"isMoveActive(false)\"\n onmousedown=\"isMoveActive(true); onMoveOverBlock(event)\" onmouseup=\"isMoveActive(false)\"`;\n else action = '';\n\n template += `<div class=\"block ${is_big?'is_big':''}\" ${action}\n style=\"grid-template-columns: repeat(${block_data[0].length}, 1fr); aspect-ratio: ${block_data[0].length} / ${block_data.length};\">`\n var mz = block_data.length > block_data[0].length ? block_data.length : block_data[0].length\n var rid = 0\n block_data.forEach(element => {\n var cid = 0\n element.forEach(color_ind => {\n \n var cell_ind = `${block_name}_${rid}_${cid}`;\n var action = \"\";\n \n if (is_clickable)\n action = `\n onpointerdown=\"start_interact_with_cell('${cell_ind}')\" \n onpointerover=\"hover_over_cell('${cell_ind}');\" \n onpointerup=\"end_interact_with_cell('${cell_ind}', ${rid}, ${cid})\" `\n \n template += `<div id=\"${cell_ind}\" class=\"cell ${cell_colors[color_ind]} ${is_clickable?'is_clickable':''}\" ${action} style=\"width: calc(var(${\"--\"+block_type+\"-size\"}) / ${mz} - 2px);\"></div>`\n cid += 1\n })\n rid += 1\n })\n template += `</div>`\n\n template += `</div>`\n\n return template\n}\n\nvar is_move_active = false\nwindow['isMoveActive'] = (act) => {\n is_move_active = act\n}\n\nwindow['onMoveOverBlock'] = (e) => {\n e.preventDefault();\n\n if (is_move_active) {\n var touch \n if (e.touches) touch = e.touches[0];\n else touch = e\n console.log(touch.clientX)\n var cell = document.elementFromPoint(touch.clientX, touch.clientY);\n\n var cell_color = Array.from(cell.classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n if (cell_color) {\n var color_index = cell_colors.indexOf(cell_color) \n console.log(cell_color, cell_colors[color_index])\n cell.classList.remove(cell_color)\n cell.classList.add(cell_colors[params.last_color_index])\n }\n }\n}\n\nwindow['copy_block_from_to'] = (input_name, output_name) => {\n var input_data = block_data_cache[input_name]\n var output_data = block_data_cache[output_name]\n\n \n var rid = 0\n output_data.forEach(element => {\n var cid = 0\n element.forEach(color_ind => {\n var in_cell_id = `${input_name}_${rid}_${cid}`;\n if (GE(in_cell_id)){\n var in_cell_color = Array.from(GE(in_cell_id).classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n\n var out_cell_id = `${output_name}_${rid}_${cid}`;\n var out_cell_color = Array.from(GE(out_cell_id).classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n\n GE(out_cell_id).classList.remove(out_cell_color)\n GE(out_cell_id).classList.add(in_cell_color)\n }\n cid += 1\n })\n rid += 1\n })\n}\n\nwindow['set_main_color'] = (color) => {\n last_interacted_cell = null\n params.last_color_index = color\n}\n\nwindow['build_level'] = (level_json, level_name) =>{\n console.log(level_json)\n\n var template = `<h2>${level_name}</h2>`\n\n template += `<div class=\"noselect\">`\n template += `<div id=\"train_container\">`\n level_json.train.forEach(element => {\n template += `<div class=\"train_example\">`\n template += create_block({block_data: element.input, block_type: \"task-train-block\"})\n template += ` <img src='images/arrow.png' class=\"arrow_img\"/> `\n template += create_block({block_data: element.output, block_type: \"task-train-block\"})\n template += `</div>`\n });\n template += `</div>`\n template += `<br><br>`\n\n template += `<div id=\"test_container\">`\n level_json.test.forEach(element => {\n var empty_block = Array.from(Array(element.output.length), () => Array.from(Array(element.output[0].length), () => 0))\n console.log({output: empty_block})\n if (GetSearchParam('mode') == 'edit') empty_block = element.output\n\n template += `<div style=\"margin: 0px 30px 80px 30px;\">`\n template += create_block({block_data: element.input, is_dragable: true, is_big: true, block_name: \"test_input\", block_type: \"task-test-block\"})\n template += ` <img src='images/arrow.png' class=\"arrow_img\"/> `\n template += create_block({block_data: empty_block, is_clickable: true, is_big: true, block_name: \"test_result\", block_type: \"task-test-block\"})\n template += `</div>`\n\n \n block_data_cache[\"test_input\"] = element.input;\n block_data_cache[\"test_output\"] = element.output;\n block_data_cache[\"test_result\"] = empty_block;\n });\n template += `</div>`\n\n template += `\n <button class=\"big_button is_green\" onclick=\"check_result()\">Check</button>\n <br>\n <a href=\"?\"><button class=\"big_button is_blue\">Back</button></a>\n <div id=\"pallete_container\" style=\"height: 140px\"><div>\n `;\n\n template += `</div>`\n\n \n template += `\n <div id=\"pallete\">\n <div id=\"main_color\" class=\"pallete_cell main ${cell_colors[params.last_color_index]} is_inline\"></div>`\n\n cell_colors.forEach(color => {\n template += `<div class=\"pallete_cell ${color} is_inline is_clickable\" \n onclick=\"set_main_color(${cell_colors.indexOf(color)})\" \n onmousedown=\"params.fill_color = '${color}'\"></div>`\n });\n\n template += `</div>`;\n\n GE('main_container').innerHTML = template;\n\n var observer = new IntersectionObserver(function(entries) {\n if(entries[0].isIntersecting === true)\n //console.log('Element is fully visible in screen');\n GE('pallete').classList.add('show')\n else\n GE('pallete').classList.remove('show')\n }, { threshold: [0.2] });\n \n observer.observe(GE(\"test_container\"));\n}\n\nvar last_interacted_cell;\n//var last_color_index;\nvar hover_color_index;\nvar start_cell_ind;\n\nvar params = {\n last_color_index_: 1,\n set last_color_index(value){\n this.last_color_index_ = value\n \n var main_color = Array.from(GE(\"main_color\").classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n GE(\"main_color\").classList.remove(main_color) \n GE(\"main_color\").classList.add(cell_colors[this.last_color_index_]) \n },\n get last_color_index(){ \n return this.last_color_index_\n },\n\n fill_color_: null,\n set fill_color(value){\n this.fill_color_ = value\n \n var circle_color = Array.from(GE(\"circle\").classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n GE(\"circle\").classList.remove(circle_color) \n GE(\"circle\").classList.add(this.fill_color_) \n },\n get fill_color(){ \n return this.fill_color_\n },\n}\n\nwindow['params'] = params\n\nwindow.addEventListener('mouseup', ()=>{\n //if (hover_color_index != null) \n // params.last_color_index = hover_color_index\n hover_color_index = null\n params.fill_color = null\n});\n\n\nvar initial_cell_color = null\nwindow['start_interact_with_cell'] = (cell_ind) => {\n var cell_color = Array.from(GE(cell_ind).classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n var color_index = cell_colors.indexOf(cell_color)\n\n initial_cell_color = cell_color\n hover_color_index = params.last_color_index\n start_cell_ind = cell_ind\n\n GE(cell_ind).classList.remove(cell_color)\n GE(cell_ind).classList.add(cell_colors[hover_color_index])\n //params.last_color_index = hover_color_index\n}\n\nwindow['hover_over_cell'] = (cell_ind) => {\n var cell_color = Array.from(GE(cell_ind).classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n var color_index = cell_colors.indexOf(cell_color)\n if (hover_color_index != null) {\n GE(cell_ind).classList.remove(cell_color)\n GE(cell_ind).classList.add(cell_colors[hover_color_index])\n //params.last_color_index = hover_color_index\n }\n}\n\nwindow['end_interact_with_cell'] = (cell_ind, x, y) => {\n if (params.fill_color != null) {\n flood_fill(x, y, params.fill_color)\n params.fill_color = null\n } else {\n var cell_color = Array.from(GE(cell_ind).classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n var color_index = cell_colors.indexOf(cell_color)\n\n if (start_cell_ind == cell_ind && cell_color == initial_cell_color){\n params.last_color_index = (color_index + 1) % cell_colors.length\n GE(cell_ind).classList.remove(cell_color)\n GE(cell_ind).classList.add(cell_colors[params.last_color_index])\n }\n }\n last_interacted_cell = cell_ind\n}\n\n\nwindow['check_result'] = () => {\n var el = GE('animation');\n el.style.animation = 'none';\n el.offsetHeight; \n el.style.animation = null; \n\n GE('animation').classList.remove('live')\n GE('animation').classList.add('live')\n\n var check = true;\n\n var test_output = block_data_cache['test_output']\n\n var rid = 0\n test_output.forEach(element => {\n var cid = 0\n element.forEach(color_ind => {\n var res_cell_id = `test_result_${rid}_${cid}`;\n var res_cell_color = Array.from(GE(res_cell_id).classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n var res_color_ind = cell_colors.indexOf(res_cell_color)\n\n if (color_ind != res_color_ind) check = false;\n \n cid += 1\n })\n rid += 1\n })\n\n for (var ind = 0; ind<10; ind++) {\n GE(`anim_true_${ind}`).classList.add('is_hidden')\n }\n\n for (var ind = 0; ind<6; ind++) {\n GE(`anim_false_${ind}`).classList.add('is_hidden')\n }\n\n if (check){\n var ind = Math.floor(Math.random() * 10);\n GE(`anim_true_${ind}`).classList.remove('is_hidden')\n\n //save that level is solved\n //...\n localStorage.setItem(cached_level_path, true);\n\n setTimeout(()=>{window.location = \"?\"}, 2600)\n } else {\n var ind = Math.floor(Math.random() * 6);\n GE(`anim_false_${ind}`).classList.remove('is_hidden')\n }\n}\n\nfunction timeout(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\nwindow['flood_fill'] = (x, y, fill_color, start_color = null) =>{\n //console.log('flood_fill', x, y, fill_color, start_color)\n let cell_id = `test_result_${x}_${y}`;\n if (GE(cell_id) && start_color != fill_color) {\n let cell_color = Array.from(GE(cell_id).classList).filter(cell_class => cell_colors.includes(cell_class))[0]\n if (!start_color) start_color = cell_color\n //var color_ind = cell_colors.indexOf(res_cell_color)\n\n if (cell_color == start_color) {\n GE(cell_id).classList.remove(cell_color)\n GE(cell_id).classList.add(fill_color)\n\n setTimeout(()=>{\n flood_fill(x + 1, y, fill_color, start_color)\n flood_fill(x - 1, y, fill_color, start_color)\n flood_fill(x, y + 1, fill_color, start_color)\n flood_fill(x, y - 1, fill_color, start_color)\n }, 10)\n }\n }\n}"]}