{"version":3,"file":"main.CxfzFq.js","sources":["theme-29/virtual:theme","theme-29/discourse/components/topic-votes.gjs","theme-29/discourse/initializers/topic-list-voting-column.gjs","theme-29/virtual:entrypoint:main"],"sourcesContent":["import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(29);\n\nexport function themePrefix(key) {\n  return `theme_translations.29.${key}`;\n}\n","import Component from \"@glimmer/component\";\nimport { and } from \"truth-helpers\";\nimport icon from \"discourse/helpers/d-icon\";\nimport { i18n } from \"discourse-i18n\";\n\nexport default class TopicVoteColumn extends Component {\n  get topicVotes() {\n    return this.args.topic.vote_count;\n  }\n\n  get hasVotes() {\n    return this.args.topic.vote_count > 0;\n  }\n\n  get isHot() {\n    const hotVotesMinimum = parseInt(settings.hot_votes_minimum || \"5\", 10);\n    if (hotVotesMinimum <= 0) {\n      return false;\n    } else {\n      return this.topicVotes >= hotVotesMinimum;\n    }\n  }\n\n  get hasVoted() {\n    return this.args.topic.user_voted;\n  }\n\n  <template>\n    {{#if @topic.can_vote}}\n      <div\n        class=\"topic-votes__wrapper\n          {{if this.hasVotes '--has-votes'}}\n          {{if this.isHot '--is-hot'}}\"\n        title={{i18n \"topic_voting.vote_count\" count=this.topicVotes}}\n      >\n\n        {{#if (and this.hasVoted settings.bells_and_whistles_styling)}}\n          <span\n            class=\"topic-votes__voted-icon\"\n            title={{i18n \"topic_voting.user_has_voted\"}}\n          >\n            {{icon \"stamp\"}}\n          </span>\n        {{/if}}\n        {{icon \"caret-up\"}}\n\n        <span class=\"topic-votes__count\">{{this.topicVotes}}</span>\n      </div>\n    {{/if}}\n  </template>\n}\n","import SortableColumn from \"discourse/components/topic-list/header/sortable-column\";\nimport { withPluginApi } from \"discourse/lib/plugin-api\";\nimport TopicVoteColumn from \"../components/topic-votes\";\n\nconst TopicVotingHeader = <template>\n  <SortableColumn\n    @sortable={{@sortable}}\n    @order=\"votes\"\n    @activeOrder={{@activeOrder}}\n    @changeSort={{@changeSort}}\n    @ascending={{@ascending}}\n    @name=\"topic_voting.vote_title_plural\"\n  />\n</template>;\n\nconst TopicVotingItem = <template>\n  <td class=\"topic-votes\">\n    <TopicVoteColumn @topic={{@topic}} />\n  </td>\n</template>;\n\nexport default {\n  name: \"topic-list-voting-column\",\n\n  initialize(container) {\n    const siteSettings = container.lookup(\"service:site-settings\");\n\n    if (!siteSettings.topic_voting_enabled) {\n      return;\n    }\n\n    const discovery = container.lookup(\"service:discovery\");\n\n    withPluginApi((api) => {\n      api.registerValueTransformer(\n        \"topic-list-columns\",\n        ({ value: columns }) => {\n          const currentCategory = discovery.category;\n\n          if (currentCategory?.can_vote || settings.show_everywhere) {\n            columns.add(\n              \"topic-voting\",\n              { header: TopicVotingHeader, item: TopicVotingItem },\n              { after: \"replies\" }\n            );\n          }\n          return columns;\n        }\n      );\n    });\n  },\n};\n","import * as Mod1 from \"./discourse/components/topic-votes\";\nimport * as Mod2 from \"./discourse/initializers/topic-list-voting-column\";\nconst compatModules = {\n  \"discourse/components/topic-votes\": Mod1,\n  \"discourse/initializers/topic-list-voting-column\": Mod2,\n};\nexport { compatModules };\nexport default compatModules;\n"],"names":["settings","getObjectForTheme","TopicVoteColumn","Component","topicVotes","this","args","topic","vote_count","hasVotes","isHot","hotVotesMinimum","parseInt","hot_votes_minimum","hasVoted","user_voted","setComponentTemplate","createTemplateFactory","id","block","moduleName","scope","i18n","and","icon","isStrictMode","TopicVotingHeader","SortableColumn","templateOnly","TopicVotingItem","topicListVotingColumn","name","initialize","container","lookup","topic_voting_enabled","discovery","withPluginApi","api","registerValueTransformer","value","columns","currentCategory","category","can_vote","show_everywhere","add","header","item","after","compatModules","Mod1"],"mappings":"woCAEaA,EAAWC,EAAkB;ACG3B,MAAMC,UAAwBC,EAC3C,cAAIC,GACF,OAAOC,KAAKC,KAAKC,MAAMC,UACzB,CAEA,YAAIC,GACF,OAAOJ,KAAKC,KAAKC,MAAMC,WAAa,CACtC,CAEA,SAAIE,GACF,MAAMC,EAAkBC,SAASZ,EAASa,mBAAqB,IAAK;AACpE,QAAIF,GAAmB,IAGdN,KAAKD,YAAcO,CAE9B,CAEA,YAAIG,GACF,OAAOT,KAAKC,KAAKC,MAAMQ,UACzB,QAEAC,EAAAC,EAAA,CAAAC,GAAA,KAAAC,MAAA,gwBAAAC,WAAA,4BAAAC,MAAAA,KAAAA,CAAAC,OAAAC,MAAAvB,WAAAwB,SAAAC,cAAA,IAsBApB,KAAU;;;AC7CZ,MAAMqB,EAAAV,EAAAC,EAAA,CAAAC,GAAA,KAAAC,MAAA,wOAAAC,WAAA,4BAAAC,MAAAA,KAAAA,CAAAM,mBAAAF,cAAA,IAAAG,KAWAC,EAAAb,EAAAC,EAAA,CAAAC,GAAA,KAAAC,MAAA,8HAAAC,WAAA,4BAAAC,MAAAA,KAAAA,CAAAnB,oBAAAuB,cAAA,IAAAG;AAMN,IAAAE,EAAe,CACbC,KAAM,2BAENC,UAAAA,CAAWC,GAGT,IAFqBA,EAAUC,OAAO,yBAEpBC,qBAChB;AAGF,MAAMC,EAAYH,EAAUC,OAAO;8BAEnCG,CAAeC,IACbA,EAAIC,yBACF,qBACA,EAAGC,MAAOC,MACR,MAAMC,EAAkBN,EAAUO;AASlC,OAPID,GAAiBE,UAAY5C,EAAS6C,kBACxCJ,EAAQK,IACN,eACA,CAAEC,OAAQrB,EAAmBsB,KAAMnB,GACnC,CAAEoB,MAAO,YAGNR,KAIf;AChDG,MAACS,EAAgB,CACpB,mCAAoCC,EACpC;"}