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AIhBqC,eAAgB,SAAUzB,GACxB,OAAOL,EAAK5E,KAAK6E,UAAWP,EAAO,GAAItE,KAAKiF,WAAYA,KAE1D0B,cAAe,SAAU9B,GACvB,OAAOD,EAAKN,EAAO,GAAItE,KAAK6E,UAAWA,GAAY7E,KAAKiF,cAG5D,CACEA,WAAY,CAAED,MAAOc,OAAOc,OAAO9B,IACnCD,UAAW,CAAEG,MAAOc,OAAOc,OAAO/B,MAK9BD,CApHa,CACrB2B,KAAM,SAAUvB,GAId,MAHiB,MAAbA,EAAM,KACRA,EAAQA,EAAMoB,MAAM,GAAI,IAEnBpB,EAAMM,QAAQ,mBAAoBC,qBAE3CM,MAAO,SAAUb,GACf,OAAOK,mBAAmBL,GAAOM,QAC/B,2CACAC,sBA0G2B,CAAEsB,KAAM,MAGzC","sources":["webpack://dclt.web/./wwwroot/app/src/js/snow-fx.js","webpack://dclt.web/./node_modules/js-cookie/dist/js.cookie.mjs"],"sourcesContent":["import { ResizeObserver as Polyfill } from '@juggle/resize-observer';\r\nconst ResizeObserver = window.ResizeObserver || Polyfill;\r\nimport Cookies from 'js-cookie';\r\n\r\nconst randomBetween = (min, max, round) => {\r\n var num = Math.random() * (max - min + 1) + min;\r\n return round ? Math.floor(num) : num;\r\n};\r\n\r\nlet windowWidth = 0,\r\n windowHeight = 0,\r\n s = null;\r\n\r\nclass SnowOverlay {\r\n constructor(el) {\r\n // set up canvas\r\n this.canvas = el;\r\n this.ctx = this.canvas.getContext('2d');\r\n this.spacing = 75;\r\n this.flakes = [];\r\n this.resizeRequested = false;\r\n // check window size\r\n windowWidth = 0;\r\n windowHeight = 0;\r\n this.resize(false);\r\n this.seedWidth = windowWidth;\r\n this.seedHeight = windowHeight;\r\n // add flakes\r\n for(let fY = this.spacing; fY < windowHeight; fY += this.spacing) {\r\n for(let fX = this.spacing; fX < windowWidth; fX += this.spacing) {\r\n this.flakes.push(new Flake(fX, fY, this.spacing));\r\n }\r\n }\r\n // update canvas\r\n window.requestAnimationFrame(() => {\r\n this.redraw();\r\n });\r\n // resize listener\r\n window.addEventListener('vpResize', () => {\r\n if(s != null) {\r\n if(!this.resizeRequested) {\r\n this.resizeRequested = true;\r\n window.requestAnimationFrame(() => {\r\n this.resize(true);\r\n });\r\n }\r\n }\r\n }, false);\r\n }\r\n\r\n resize(addFlakes = false) {\r\n let prevWidth = windowWidth,\r\n prevHeight = windowHeight;\r\n windowWidth = this.canvas.offsetWidth;\r\n windowHeight = this.canvas.offsetHeight;\r\n console.log(windowWidth + \" : \" + windowHeight);\r\n if(prevWidth != windowWidth || prevHeight != windowHeight) {\r\n this.canvas.width = windowWidth;\r\n this.canvas.height = windowHeight;\r\n if(addFlakes && (windowWidth - this.seedWidth) > this.spacing) {\r\n // add extra flakes for width\r\n for(let fY = this.spacing; fY < prevHeight; fY += this.spacing) {\r\n for(let fX = prevWidth; fX < windowWidth; fX += this.spacing) {\r\n this.flakes.push(new Flake(fX, fY, this.spacing));\r\n }\r\n }\r\n this.seedWidth = windowWidth;\r\n }\r\n if(addFlakes && (windowHeight - this.seedHeight) > this.spacing) {\r\n // add extra flakes for height\r\n for(let fY = prevHeight; fY < windowHeight; fY += this.spacing) {\r\n for(let fX = this.spacing; fX < windowWidth; fX += this.spacing) {\r\n this.flakes.push(new Flake(fX, fY, this.spacing));\r\n }\r\n }\r\n this.seedHeight = windowHeight;\r\n }\r\n }\r\n this.resizeRequested = false;\r\n }\r\n \r\n redraw() {\r\n // clear canvas\r\n this.ctx.clearRect(0, 0, windowWidth, windowHeight);\r\n this.ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n // loop through flakes\r\n for(let i=0; i < this.flakes.length; i++) {\r\n let f = this.flakes[i];\r\n f.update();\r\n // draw on canvas\r\n this.ctx.beginPath();\r\n this.ctx.arc(f.x, f.y, f.weight, 0, 2 * Math.PI, false);\r\n this.ctx.fillStyle = 'rgba(255, 255, 255, ' + f.alpha + ')';\r\n this.ctx.fill();\r\n }\r\n // call next redraw\r\n window.requestAnimationFrame(() => {\r\n this.redraw();\r\n });\r\n }\r\n}\r\n\r\nclass Flake {\r\n constructor(getX, getY, getSpacing) {\r\n const maxWeight = 5,\r\n maxSpeed = 2;\r\n this.spacing = getSpacing;\r\n this.x = getX + randomBetween(-this.spacing, this.spacing, true);\r\n this.y = getY + randomBetween(-this.spacing, this.spacing, true);\r\n this.r = randomBetween(0, 1);\r\n this.a = randomBetween(0, Math.PI);\r\n this.aStep = 0.01;\r\n this.weight = randomBetween(2, maxWeight);\r\n this.size = 2.5 * this.weight;\r\n this.alpha = (this.weight / maxWeight);\r\n this.speed = (this.weight / maxWeight) * maxSpeed;\r\n }\r\n update() {\r\n this.x += Math.cos(this.a) * this.r;\r\n this.a += this.aStep;\r\n this.y += this.speed;\r\n if(this.y > windowHeight) this.y = -10;\r\n }\r\n}\r\n\r\n// set things up\r\n\r\nconst toggle = document.querySelector('#snow-fx-toggle');\r\n\r\nlet detectReducedMotionPref = window.matchMedia('(prefers-reduced-motion: reduce)');\r\nif(detectReducedMotionPref.matches) {\r\n // remove toggle\r\n toggle.parentNode.removeChild(toggle);\r\n} else {\r\n\r\n let snowActive = false;\r\n\r\n // check for cookie setting\r\n if(Cookies.get('dclt-disable-snow-fx')) {\r\n toggle.checked = false;\r\n toggle.removeAttribute('checked');\r\n }\r\n\r\n const toggleSnow = (mode) => {\r\n if(mode) {\r\n // start snow\r\n snowActive = true;\r\n let snow = document.createElement('canvas');\r\n snow.setAttribute('id','snow-overlay');\r\n snow.setAttribute('aria-hidden','true');\r\n document.body.appendChild(snow);\r\n s = new SnowOverlay(document.querySelector('#snow-overlay'));\r\n } else {\r\n // stop snow\r\n snowActive = false;\r\n let snow = document.querySelector('#snow-overlay');\r\n document.body.removeChild(snow);\r\n s = null;\r\n }\r\n }\r\n\r\n // check toggle state\r\n if(toggle.checked) toggleSnow(true);\r\n\r\n // add toggle behaviours\r\n toggle.onclick = () => {\r\n if(toggle.checked) {\r\n Cookies.remove('dclt-disable-snow-fx');\r\n if(!snowActive) {\r\n toggleSnow(true);\r\n }\r\n } else {\r\n Cookies.set('dclt-disable-snow-fx', 'value', { expires: 7 }); // store choice for a week\r\n if(snowActive) {\r\n toggleSnow(false);\r\n }\r\n }\r\n }\r\n\r\n}","/*! js-cookie v3.0.1 | MIT */\n/* eslint-disable no-var */\nfunction assign (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n target[key] = source[key];\n }\n }\n return target\n}\n/* eslint-enable no-var */\n\n/* eslint-disable no-var */\nvar defaultConverter = {\n read: function (value) {\n if (value[0] === '\"') {\n value = value.slice(1, -1);\n }\n return value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent)\n },\n write: function (value) {\n return encodeURIComponent(value).replace(\n /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n decodeURIComponent\n )\n }\n};\n/* eslint-enable no-var */\n\n/* eslint-disable no-var */\n\nfunction init (converter, defaultAttributes) {\n function set (key, value, attributes) {\n if (typeof document === 'undefined') {\n return\n }\n\n attributes = assign({}, defaultAttributes, attributes);\n\n if (typeof attributes.expires === 'number') {\n attributes.expires = new Date(Date.now() + attributes.expires * 864e5);\n }\n if (attributes.expires) {\n attributes.expires = attributes.expires.toUTCString();\n }\n\n key = encodeURIComponent(key)\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n .replace(/[()]/g, escape);\n\n var stringifiedAttributes = '';\n for (var attributeName in attributes) {\n if (!attributes[attributeName]) {\n continue\n }\n\n stringifiedAttributes += '; ' + attributeName;\n\n if (attributes[attributeName] === true) {\n continue\n }\n\n // Considers RFC 6265 section 5.2:\n // ...\n // 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n // character:\n // Consume the characters of the unparsed-attributes up to,\n // not including, the first %x3B (\";\") character.\n // ...\n stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n }\n\n return (document.cookie =\n key + '=' + converter.write(value, key) + stringifiedAttributes)\n }\n\n function get (key) {\n if (typeof document === 'undefined' || (arguments.length && !key)) {\n return\n }\n\n // To prevent the for loop in the first place assign an empty array\n // in case there are no cookies at all.\n var cookies = document.cookie ? document.cookie.split('; ') : [];\n var jar = {};\n for (var i = 0; i < cookies.length; i++) {\n var parts = cookies[i].split('=');\n var value = parts.slice(1).join('=');\n\n try {\n var foundKey = decodeURIComponent(parts[0]);\n jar[foundKey] = converter.read(value, foundKey);\n\n if (key === foundKey) {\n break\n }\n } catch (e) {}\n }\n\n return key ? jar[key] : jar\n }\n\n return Object.create(\n {\n set: set,\n get: get,\n remove: function (key, attributes) {\n set(\n key,\n '',\n assign({}, attributes, {\n expires: -1\n })\n );\n },\n withAttributes: function (attributes) {\n return init(this.converter, assign({}, this.attributes, attributes))\n },\n withConverter: function (converter) {\n return init(assign({}, this.converter, converter), this.attributes)\n }\n },\n {\n attributes: { value: Object.freeze(defaultAttributes) },\n converter: { value: Object.freeze(converter) }\n }\n )\n}\n\nvar api = init(defaultConverter, { path: '/' });\n/* eslint-enable no-var */\n\nexport default api;\n"],"names":["window","ResizeObserver","Polyfill","randomBetween","min","max","round","num","Math","random","floor","windowWidth","windowHeight","s","SnowOverlay","constructor","el","this","canvas","ctx","getContext","spacing","flakes","resizeRequested","resize","seedWidth","seedHeight","fY","fX","push","Flake","requestAnimationFrame","redraw","addEventListener","addFlakes","prevWidth","prevHeight","offsetWidth","offsetHeight","console","log","width","height","clearRect","setTransform","i","length","f","update","beginPath","arc","x","y","weight","PI","fillStyle","alpha","fill","getX","getY","getSpacing","r","a","aStep","size","speed","cos","toggle","document","querySelector","matchMedia","matches","parentNode","removeChild","snowActive","Cookies","checked","removeAttribute","toggleSnow","mode","snow","createElement","setAttribute","body","appendChild","onclick","expires","assign","target","arguments","source","key","api","init","converter","defaultAttributes","set","value","attributes","Date","now","toUTCString","encodeURIComponent","replace","decodeURIComponent","escape","stringifiedAttributes","attributeName","split","cookie","write","Object","create","get","cookies","jar","parts","slice","join","foundKey","read","e","remove","withAttributes","withConverter","freeze","path"],"sourceRoot":""}