{"version":3,"sources":["webpack:///./src/components/course_tree/node_detail/PollNodeDetail.vue?2ae0","webpack:///./src/components/course_tree/node_detail/PollNodeDetail.vue","webpack:///./src/components/course_tree/node_detail/PollNodeDetail.vue?9bf7"],"names":["_hoisted_1","key","class","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","style","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","render","_ctx","_cache","$props","$setup","$data","$options","_component_SlotSkeleton","_component_Btn","_component_router_link","_component_Timestamp","_component_CopyToClipboard","_component_ProcessedTextFragment","_component_RadioGroup","_component_Pie","firstLoading","to","name","params","courseId","default","size","variant","$t","_","node","state","PollNodeState","DRAFT","creator","full_name","value","created","canEdit","onClick","onEdit","outline","tooltip","permalink","text","choices","length","CLOSED","options","pollChoicesAsOptions","modelValue","draftSelectedChoiceId","selectedChoice","id","$event","disabled","canVote","itemSide","option","onVote","showResults","chartData","pollVotesData","chartOptions","height","register","mixins","props","type","Object","required","children","Array","emits","this","$emit","fromFirstPage","data","methods","choiceId","withLoading","mainStore","votePollNodeChoice","nodeId","remove","computed","responsive","maintainAspectRatio","pollChoicesSelectionFrequency","map","c","datum","frequency","votes","sort","a","b","String","colors","reduce","acc","e","color","labels","r","slice","datasets","backgroundColor","filter","selected","textPreview","OPEN","o","content","components","Timestamp","ProcessedTextFragment","Btn","SlotSkeleton","CopyToClipboard","RadioGroup","Pie","__exports__"],"mappings":"uIAEMA,EAAa,CACjBC,IAAK,EACLC,MAAO,QAEHC,EAAa,CACjBF,IAAK,EACLC,MAAO,QAEHE,EAAa,CAAEF,MAAO,QACtBG,EAA0B,gCAAoB,OAAQ,CAAEH,MAAO,2BAA6B,gBAAiB,GAC7GI,EAAa,CAAEJ,MAAO,oCACtBK,EAAa,CAAEL,MAAO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KACXR,MAAO4E,EAAE3D,UAIZ6D,WAAY,CACXC,YAAA,KACAC,wBAAA,KACAC,MAAA,KACAC,eAAA,KAEAC,kBAAA,KACAC,aAAA,KACAC,IAAA,U,qBClIF,MAAMC,EAA2B,IAAgB,EAAQ,CAAC,CAAC,SAASrH,KAErD","file":"js/chunk-2d22c533.8445824f.js","sourcesContent":["import { resolveComponent as _resolveComponent, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, normalizeClass as _normalizeClass, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = {\n key: 0,\n class: \"mt-6\"\n}\nconst _hoisted_2 = {\n key: 1,\n class: \"mt-2\"\n}\nconst _hoisted_3 = { class: \"mb-4\" }\nconst _hoisted_4 = /*#__PURE__*/_createElementVNode(\"span\", { class: \"material-icons-outlined\" }, \"chevron_left\", -1)\nconst _hoisted_5 = { class: \"flex md:items-center items-start\" }\nconst _hoisted_6 = { class: \"flex md:flex-row flex-col md:space-x-2 md:mt-0 mt-1 w-full\" }\nconst _hoisted_7 = { class: \"flex flex-col\" }\nconst _hoisted_8 = {\n style: {\"line-height\":\"1.1\"},\n class: \"mb-0 hidden md:block\"\n}\nconst _hoisted_9 = {\n style: {\"line-height\":\"1.1\"},\n class: \"mb-0 md:hidden\"\n}\nconst _hoisted_10 = { class: \"flex space-x-2 ml-0.5\" }\nconst _hoisted_11 = {\n key: 0,\n class: \"text-sm\"\n}\nconst _hoisted_12 = {\n key: 1,\n class: \"text-muted text-sm\"\n}\nconst _hoisted_13 = { class: \"ml-auto flex items-center\" }\nconst _hoisted_14 = /*#__PURE__*/_createElementVNode(\"span\", { class: \"text-xl material-icons\" }, \" edit \", -1)\nconst _hoisted_15 = { class: \"mx-2 md:mx-4\" }\nconst _hoisted_16 = { class: \"mt-8\" }\nconst _hoisted_17 = {\n key: 0,\n class: \"mt-4 hidden-in-dragging-element\"\n}\nconst _hoisted_18 = { class: \"\" }\nconst _hoisted_19 = {\n key: 0,\n class: \"italic flex items-center space-x-1 text-muted text-sm mb-1\"\n}\nconst _hoisted_20 = /*#__PURE__*/_createElementVNode(\"span\", {\n class: \"-ml-0.5 material-icons-outlined\",\n style: {\"font-size\":\"16px !important\"}\n}, \"block\", -1)\nconst _hoisted_21 = {\n key: 0,\n class: \"flex items-center space-x-2 ml-8\"\n}\nconst _hoisted_22 = { class: \"text-sm text-muted italic\" }\nconst _hoisted_23 = {\n key: 1,\n class: \"flex flex-col items-center ml-auto space-y-2\"\n}\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_SlotSkeleton = _resolveComponent(\"SlotSkeleton\")!\n const _component_Btn = _resolveComponent(\"Btn\")!\n const _component_router_link = _resolveComponent(\"router-link\")!\n const _component_Timestamp = _resolveComponent(\"Timestamp\")!\n const _component_CopyToClipboard = _resolveComponent(\"CopyToClipboard\")!\n const _component_ProcessedTextFragment = _resolveComponent(\"ProcessedTextFragment\")!\n const _component_RadioGroup = _resolveComponent(\"RadioGroup\")!\n const _component_Pie = _resolveComponent(\"Pie\")!\n\n return (_ctx.firstLoading)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(_component_SlotSkeleton),\n _createVNode(_component_SlotSkeleton, { class: \"mb-4 mt-2\" }),\n _createVNode(_component_SlotSkeleton)\n ]))\n : (_openBlock(), _createElementBlock(\"div\", _hoisted_2, [\n _createElementVNode(\"div\", _hoisted_3, [\n _createVNode(_component_router_link, {\n to: { name: 'CourseTreeDispatcher', params: { courseId: _ctx.courseId } }\n }, {\n default: _withCtx(() => [\n _createVNode(_component_Btn, {\n size: 'xs',\n variant: 'primary-borderless'\n }, {\n default: _withCtx(() => [\n _hoisted_4,\n _createTextVNode(\" \" + _toDisplayString(_ctx.$t(\"course_tree.back_to_tree\")), 1)\n ]),\n _: 1\n })\n ]),\n _: 1\n }, 8, [\"to\"])\n ]),\n _createElementVNode(\"div\", _hoisted_5, [\n _createElementVNode(\"div\", {\n style: {\"min-width\":\"3.5rem\",\"max-width\":\"3.5rem\"},\n class: _normalizeClass([\"flex rounded-full w-14 h-14 mr-3\", {\n\t\t\t\t\t'bg-gray-200': _ctx.node.state === _ctx.PollNodeState.DRAFT,\n\t\t\t\t\t'bg-primary bg-opacity-15': _ctx.node.state !== _ctx.PollNodeState.DRAFT,\n\t\t\t\t}])\n }, [\n _createElementVNode(\"span\", {\n style: {\"font-size\":\"40px !important\"},\n class: _normalizeClass([\"m-auto material-icons-outlined\", {\n\t\t\t\t\t\t'text-gray-500': _ctx.node.state === _ctx.PollNodeState.DRAFT,\n\t\t\t\t\t\t'text-primary': _ctx.node.state !== _ctx.PollNodeState.DRAFT,\n\t\t\t\t\t}])\n }, \"campaign\", 2)\n ], 2),\n _createElementVNode(\"div\", _hoisted_6, [\n _createElementVNode(\"div\", _hoisted_7, [\n _createElementVNode(\"h1\", _hoisted_8, _toDisplayString(_ctx.$t(\"course_tree.poll_title\")), 1),\n _createElementVNode(\"h3\", _hoisted_9, _toDisplayString(_ctx.$t(\"course_tree.poll_title\")), 1),\n _createElementVNode(\"div\", _hoisted_10, [\n (_ctx.node.creator)\n ? (_openBlock(), _createElementBlock(\"p\", _hoisted_11, _toDisplayString(_ctx.node.creator.full_name), 1))\n : _createCommentVNode(\"\", true),\n _createVNode(_component_Timestamp, {\n \"date-only\": true,\n class: \"text-sm text-muted\",\n value: _ctx.node.created\n }, null, 8, [\"value\"]),\n (_ctx.node.state === _ctx.PollNodeState.DRAFT)\n ? (_openBlock(), _createElementBlock(\"p\", _hoisted_12, _toDisplayString(_ctx.$t(\"course_tree.draft\")), 1))\n : _createCommentVNode(\"\", true)\n ])\n ]),\n _createElementVNode(\"div\", _hoisted_13, [\n (_ctx.canEdit)\n ? (_openBlock(), _createBlock(_component_Btn, {\n key: 0,\n onClick: _ctx.onEdit,\n variant: 'icon',\n outline: true,\n class: \"icon-btn-primary hover:opacity-100 transition-opacity duration-100 ease opacity-50\",\n tooltip: _ctx.$t('misc.edit')\n }, {\n default: _withCtx(() => [\n _hoisted_14\n ]),\n _: 1\n }, 8, [\"onClick\", \"tooltip\"]))\n : _createCommentVNode(\"\", true),\n _createVNode(_component_CopyToClipboard, {\n class: \"hover:opacity-100 transition-opacity duration-100 ease opacity-50\",\n \"icon-only\": true,\n tooltip: _ctx.$t('exercise_solution.share'),\n value: _ctx.permalink\n }, null, 8, [\"tooltip\", \"value\"])\n ])\n ])\n ]),\n _createElementVNode(\"div\", _hoisted_15, [\n _createElementVNode(\"div\", _hoisted_16, [\n _createVNode(_component_ProcessedTextFragment, {\n value: _ctx.node.text\n }, null, 8, [\"value\"])\n ]),\n (_ctx.node.choices.length > 0)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_17, [\n _createElementVNode(\"div\", _hoisted_18, [\n (_ctx.node.state === _ctx.PollNodeState.CLOSED)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_19, [\n _hoisted_20,\n _createElementVNode(\"p\", null, _toDisplayString(_ctx.$t(\"course_tree.poll_closed\")), 1)\n ]))\n : _createCommentVNode(\"\", true),\n _createVNode(_component_RadioGroup, {\n class: \"-ml-2 flex\",\n options: _ctx.pollChoicesAsOptions,\n modelValue: _ctx.draftSelectedChoiceId ?? _ctx.selectedChoice?.id,\n \"onUpdate:modelValue\": _cache[1] || (_cache[1] = ($event: any) => (_ctx.draftSelectedChoiceId = $event)),\n disabled: !_ctx.canVote\n }, {\n itemSide: _withCtx(({ option }) => [\n (_ctx.canVote && option.value == _ctx.draftSelectedChoiceId)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_21, [\n _createVNode(_component_Btn, {\n size: 'xs',\n outline: true,\n onClick: _cache[0] || (_cache[0] = ($event: any) => (_ctx.onVote(_ctx.draftSelectedChoiceId)))\n }, {\n default: _withCtx(() => [\n _createTextVNode(_toDisplayString(_ctx.$t(\"course_tree.save_poll_choice\")), 1)\n ]),\n _: 1\n }),\n _createElementVNode(\"p\", _hoisted_22, _toDisplayString(_ctx.$t(\"course_tree.poll_choice_not_saved_yet\")), 1)\n ]))\n : _createCommentVNode(\"\", true)\n ]),\n _: 1\n }, 8, [\"options\", \"modelValue\", \"disabled\"]),\n (_ctx.showResults)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_23, [\n _createVNode(_component_Pie, {\n chartData: _ctx.pollVotesData,\n chartOptions: _ctx.chartOptions,\n height: 280\n }, null, 8, [\"chartData\", \"chartOptions\"])\n ]))\n : _createCommentVNode(\"\", true)\n ])\n ]))\n : _createCommentVNode(\"\", true)\n ])\n ]))\n}","\nimport Btn from \"@/components/ui/Btn.vue\";\nimport CopyToClipboard from \"@/components/ui/CopyToClipboard.vue\";\nimport ProcessedTextFragment from \"@/components/ui/ProcessedTextFragment.vue\";\nimport RadioGroup from \"@/components/ui/RadioGroup.vue\";\nimport SlotSkeleton from \"@/components/ui/skeletons/SlotSkeleton.vue\";\nimport Timestamp from \"@/components/ui/Timestamp.vue\";\nimport { getTranslatedString as _ } from \"@/i18n\";\nimport { courseIdMixin, loadingMixin, nodeMixin } from \"@/mixins\";\nimport {\n\tCourseTreeNode as ICourseTreeNode,\n\tFileNode,\n\tPollNode,\n\tPollNodeChoice,\n\tPollNodeState,\n} from \"@/models\";\nimport { defineComponent, PropType } from \"@vue/runtime-core\";\nimport CourseTreeNode from \"../node/CourseTreeNode.vue\";\nimport { nodeEmits, nodeProps } from \"../shared\";\nimport { getColorFromString, md5, setErrorNotification } from \"@/utils\";\n\nimport { Pie } from \"vue-chartjs\";\nimport { Chart as ChartJS, ArcElement, Tooltip, Legend } from \"chart.js\";\nimport { TChartData } from \"vue-chartjs/dist/types\";\nimport { DataFrequency, makeLabelText } from \"@/reports/misc\";\nimport { SelectableOption } from \"@/interfaces\";\nimport { mapStores } from \"pinia\";\nimport { useMainStore } from \"@/stores/mainStore\";\n\nChartJS.register(ArcElement, Tooltip, Legend);\nexport default defineComponent({\n\tname: \"PollNodeDetail\",\n\tmixins: [loadingMixin, nodeMixin, courseIdMixin],\n\tprops: {\n\t\tnode: {\n\t\t\ttype: Object as PropType,\n\t\t\trequired: true,\n\t\t},\n\t\tchildren: {\n\t\t\ttype: Array as PropType,\n\t\t\tdefault: () => [],\n\t\t},\n\t\t...nodeProps,\n\t},\n\temits: {\n\t\t...nodeEmits,\n\t},\n\tcreated() {\n\t\t// TODO possibly extract shared logic\n\t\tthis.$emit(\"loadChildren\", { node: this.node, fromFirstPage: true });\n\t\tthis.$emit(\"loadComments\", this.node);\n\t},\n\tdata() {\n\t\treturn {\n\t\t\tPollNodeState,\n\t\t\tdraftSelectedChoiceId: null as null | string,\n\t\t};\n\t},\n\tmethods: {\n\t\tonEdit() {\n\t\t\tthis.$emit(\"editNode\", this.node);\n\t\t},\n\t\tasync onVote(choiceId: string) {\n\t\t\tawait this.withLoading(async () => {\n\t\t\t\tawait this.mainStore.votePollNodeChoice({\n\t\t\t\t\tcourseId: this.courseId,\n\t\t\t\t\tnodeId: this.node.id,\n\t\t\t\t\tchoiceId,\n\t\t\t\t\tremove: false,\n\t\t\t\t});\n\t\t\t}, setErrorNotification);\n\t\t},\n\t},\n\tcomputed: {\n\t\t...mapStores(useMainStore),\n\t\tchartOptions() {\n\t\t\treturn { responsive: false, maintainAspectRatio: false };\n\t\t},\n\t\tpollChoicesSelectionFrequency(): DataFrequency[] {\n\t\t\treturn this.node.choices\n\t\t\t\t.map(c => ({ datum: c, frequency: c.votes ?? 0 }))\n\t\t\t\t.sort((a, b) => (String(a.datum.id) < String(b.datum.id) ? -1 : 1));\n\t\t},\n\t\t// TODO extract shared logic\n\t\tpollVotesData(): TChartData<\"pie\", number[], unknown> {\n\t\t\tconst colors = this.node.choices.reduce((acc, e) => {\n\t\t\t\tconst text = md5(e.text);\n\t\t\t\tconst color = getColorFromString(text);\n\t\t\t\tacc[e.text] = color + \"B3\";\n\t\t\t\treturn acc;\n\t\t\t}, {} as Record);\n\t\t\treturn {\n\t\t\t\tlabels: this.pollChoicesSelectionFrequency.map(\n\t\t\t\t\tr =>\n\t\t\t\t\t\tmakeLabelText(r.datum.text).slice(0, 100) +\n\t\t\t\t\t\t(makeLabelText(r.datum.text).length <= 100 ? \"\" : \"...\"),\n\t\t\t\t),\n\t\t\t\tdatasets: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdata: this.pollChoicesSelectionFrequency.map(r => r.frequency),\n\t\t\t\t\t\tbackgroundColor: this.pollChoicesSelectionFrequency.map(\n\t\t\t\t\t\t\tr => colors[r.datum.text],\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t\tselectedChoice() {\n\t\t\t// ! assumess only one choice can be selected\n\t\t\treturn this.node.choices.filter(c => c.selected)[0];\n\t\t},\n\t\ttextPreview() {\n\t\t\treturn this.node.text;\n\t\t},\n\t\tcanVote() {\n\t\t\treturn this.node.state === PollNodeState.OPEN && !this.selectedChoice;\n\t\t},\n\t\tshowResults() {\n\t\t\treturn !this.canVote;\n\t\t},\n\t\tpollChoicesAsOptions(): SelectableOption[] {\n\t\t\treturn this.node.choices.map(o => ({\n\t\t\t\tcontent: o.text,\n\t\t\t\tvalue: o.id,\n\t\t\t}));\n\t\t},\n\t},\n\tcomponents: {\n\t\tTimestamp,\n\t\tProcessedTextFragment,\n\t\tBtn,\n\t\tSlotSkeleton,\n\t\t//CourseTreeNode,\n\t\tCopyToClipboard,\n\t\tRadioGroup,\n\t\tPie,\n\t},\n});\n","import { render } from \"./PollNodeDetail.vue?vue&type=template&id=03d3957c&ts=true\"\nimport script from \"./PollNodeDetail.vue?vue&type=script&lang=ts\"\nexport * from \"./PollNodeDetail.vue?vue&type=script&lang=ts\"\n\nimport exportComponent from \"/tmp/build/node_modules/vue-loader-v16/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__"],"sourceRoot":""}