{"version":3,"sources":["webpack:///../WCC.UI/App/components/voteBubble/voteBubble.html?dff1","webpack:///../WCC.UI/App/components/voteBubble/voteBubble.scss?2f96","webpack:///../WCC.UI/App/components/voteBubble/voteBubble.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/voteBubble/voteBubble.scss","webpack:///../WCC.UI/App/components/voteBubble/voteBubble.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","VoteBubbleVM","constructor","config","info","isUpvoteMode","ko","flattenComputed","upvote","isDownvoteMode","downvote","isUnknownMode","pureComputed","value","icon","this","title","strictComputed","undefined","toString","hasTitle","isNotNull","hasIcon","size","fontSize","mapNotNull","isUpvote","_value","isDownvote","_value2","clickHandler","click","applyBindingsToNode","element","_this$clickHandler","call","toPx","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","system","SystemHelpers","html","getTemplatesAndResources","forEach","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___","push"],"mappings":"yIAAA,UAAO,CACC,yGACA,wDAIC,KAJyC,EAAF,SAAYA,EAASC,GAGzD,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,sECNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,oJAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAAIN,EAAS,MAG9C,IAAIO,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPH,EAAIJ,EAASO,GAI1BF,EAAOG,QAAUR,EAAQS,QAAU,I,+vBCDnC,IAAqBC,EAArB,MASIC,YACwCC,EACFC,GAElC,MAAMC,EAAeC,EAAGC,gBAAgBJ,EAAOK,QAAQ,GACjDC,EAAiBH,EAAGC,gBAAgBJ,EAAOO,UAAU,GACrDC,EAAgBL,EAAGM,aAAa,KAAOP,MAAmBI,KAE1DI,EAAQP,EAAGC,gBAAgBJ,EAAOU,O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AAKC,YAAYH,QAEhE,+B,oKCLDlD,EADkC,EAAQ,wDAChCsD,EAA4B,IAE9BC,KAAK,CAAC1D,EAAOC,EAAI,6sBAA8sB,KAEvuBD,EAAOG,QAAUA,G,oHCHjBH,EAAOG,QAFI","file":"328.b98a4b3a681f0bec6e03.js","sourcesContent":["define([\n \"!!../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./voteBubble.html\", \n \"!../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./voteBubble.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport './voteBubble.html';\r\nimport './voteBubble.scss';\r\n\r\nexport interface VoteBubbleVMConfig {\r\n upvote?: SubscribableOrNullableValue\r\n downvote?: SubscribableOrNullableValue\r\n value?: SubscribableOrNullableValue\r\n icon?: SubscribableOrNullableValue\r\n size?: SubscribableOrNullableValue\r\n\r\n click?: Action<[number | undefined]>\r\n}\r\n\r\n@injectable()\r\nexport default class VoteBubbleVM {\r\n private clickHandler?: Action<[number | undefined]>\r\n\r\n title: Subscribable\r\n icon: Subscribable\r\n\r\n hasTitle: Subscribable\r\n hasIcon: Subscribable\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) config: VoteBubbleVMConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo\r\n ) {\r\n const isUpvoteMode = ko.flattenComputed(config.upvote, false);\r\n const isDownvoteMode = ko.flattenComputed(config.downvote, false);\r\n const isUnknownMode = ko.pureComputed(() => !isUpvoteMode() && !isDownvoteMode());\r\n\r\n const value = ko.flattenComputed(config.value);\r\n const icon = ko.flattenComputed(config.icon);\r\n\r\n this.title = ko.strictComputed((value, icon) => {\r\n if (value != undefined) {\r\n if (value > 0)\r\n return `+${value}`;\r\n\r\n return value.toString();\r\n }\r\n }, [value, icon]);\r\n\r\n this.icon = ko.pureComputed(() => this.title() == undefined ? icon() : undefined);\r\n\r\n this.hasTitle = this.title.isNotNull();\r\n this.hasIcon = this.icon.isNotNull();\r\n\r\n const size = ko.flattenComputed(config.size);\r\n const fontSize = size.mapNotNull(size => size * 0.5);\r\n\r\n const isUpvote = ko.pureComputed(() => isUpvoteMode() || isUnknownMode() && (value() ?? 0) > 0);\r\n const isDownvote = ko.pureComputed(() => isDownvoteMode() || isUnknownMode() && (value() ?? 0) < 0);\r\n\r\n this.clickHandler = config.click;\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'click': () => this.clickHandler?.(value()),\r\n\r\n 'css': {\r\n 'vote-bubble wcc-animated zoomIn': true,\r\n 'vote-bubble--upvote': isUpvote,\r\n 'vote-bubble--downvote': isDownvote,\r\n 'vote-bubble--control': this.clickHandler != undefined\r\n },\r\n\r\n 'style': {\r\n 'width': size.toPx(true),\r\n 'height': size.toPx(true),\r\n 'font-size': fontSize.toPx(true)\r\n }\r\n });\r\n }\r\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".vote-bubble{display:flex;justify-content:center;align-items:center;width:40px;height:40px;transition:background-color ease-in-out 250ms;border:1px solid #c6c6c6;border-radius:100%;font-size:16px;color:#fff;animation-duration:350ms}.vote-bubble:nth-child(5n+1){animation-delay:50ms}.vote-bubble:nth-child(5n+2){animation-delay:100ms}.vote-bubble:nth-child(5n+3){animation-delay:150ms}.vote-bubble:nth-child(5n+4){animation-delay:200ms}.vote-bubble--upvote{background-color:#89c242}.vote-bubble--downvote{background-color:#fb403b}.vote-bubble--control{cursor:pointer}.vote-bubble--control.vote-bubble--upvote:hover{background-color:#7cb139}.vote-bubble--control.vote-bubble--downvote:hover{background-color:#fa0f09}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}