{"version":3,"sources":["discourse/initializers/clickable-topic-list-item.js"],"names":["window","define","_exports","_pluginApi","_interceptClick","Object","defineProperty","value","default","require","getObjectForTheme","_default","name","initialize","withPluginApi","api","modifyClass","pluginId","click","event","result","this","showEntrance","topic","target","$","hasClass","selected","is","addObject","removeObject","wantsNewWindow","navigateToTopic","attr","lastUnreadUrl","closest","length","togglePinnedForUser","unhandledRowClick"],"mappings":"AAAI,WAAYA,QAChBC,OAAO,2DAA4D,CAAC,UAAW,2BAA4B,kCAAkC,SAAUC,EAAUC,EAAYC,GAC3K;AAEAC,OAAOC,eAAeJ,EAAU,aAAc,CAC5CK,OAAO,IAETL,EAASM,aAAU;AACFC,QAAQ,sCAAsCC,kBAAkB;AAEjF,IAAIC,EAAW,CACbC,KAAM,4BACNC,cACE,EAAIV,EAAWW,eAAe,UAAUC,IACtCA,EAAIC,YAAY,4BAA6B,CAC3CC,SAAU,4BACVC,MAAMC,GACJ,MAAMC,EAASC,KAAKC,aAAaH;AACjC,IAAe,IAAXC,EAAkB,OAAOA;AAC7B,MAAMG,EAAQF,KAAKE,MACbC,EAASC,EAAEN,EAAMK;AACvB,GAAIA,EAAOE,SAAS,eAAgB,CAClC,MAAMC,EAAWN,KAAKM;AAClBH,EAAOI,GAAG,YACZD,EAASE,UAAUN,GAEnBI,EAASG,aAAaP,EAE1B,CACA,OAAIC,EAAOE,SAAS,qBACd,EAAItB,EAAgB2B,gBAAgBZ,IAGjCE,KAAKW,gBAAgBT,EAAOC,EAAOS,KAAK,SAI7CT,EAAOE,SAAS,oBAAsBF,EAAOE,SAAS,qBAAuBF,EAAOE,SAAS,oBAQ7FF,EAAOE,SAAS,UAAYF,EAAOE,SAAS,eAP1C,EAAItB,EAAgB2B,gBAAgBZ,IAGjCE,KAAKW,gBAAgBT,EAAOA,EAAMW,eAUK,IAA5CV,EAAOW,QAAQ,kBAAkBC,QACnCf,KAAKE,MAAMc,uBACJ,GAEFhB,KAAKiB,kBAAkBnB,EAAOI,EACvC,IAEFR,EAAIC,YAAY,mCAAoC,CAClDC,SAAU,4BACVC,MAAMC,GAEJ,IAAiC,IAA7BE,KAAKC,aAAaH,GAAkB,OAAO;AAC/C,MAAMI,EAAQF,KAAKE;AAInB,OAHeE,EAAEN,EAAMK,QAGZI,GAAG,UACR,EAAIxB,EAAgB2B,gBAAgBZ,IAGjCE,KAAKW,gBAAgBT,EAAOA,EAAMW,eAEpCb,KAAKiB,kBAAkBnB,EAAOE,KAAKE,MAC5C,GACA,GAEN;AAEFrB,EAASM,QAAUG,CACrB","sourceRoot":"theme-5/","sourcesContent":["if ('define' in window) {\ndefine(\"discourse/theme-5/initializers/clickable-topic-list-item\", [\"exports\", \"discourse/lib/plugin-api\", \"discourse/lib/intercept-click\"], function (_exports, _pluginApi, _interceptClick) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const settings = require(\"discourse/lib/theme-settings-store\").getObjectForTheme(5);\n  const themePrefix = key => `theme_translations.5.${key}`;\n  var _default = {\n    name: \"clickable-topic-list-item\",\n    initialize() {\n      (0, _pluginApi.withPluginApi)(\"0.8.14\", api => {\n        api.modifyClass(\"component:topic-list-item\", {\n          pluginId: \"discourse-clickable-topic\",\n          click(event) {\n            const result = this.showEntrance(event);\n            if (result === false) return result;\n            const topic = this.topic;\n            const target = $(event.target);\n            if (target.hasClass(\"bulk-select\")) {\n              const selected = this.selected;\n              if (target.is(\":checked\")) {\n                selected.addObject(topic);\n              } else {\n                selected.removeObject(topic);\n              }\n            }\n            if (target.hasClass(\"raw-topic-link\")) {\n              if ((0, _interceptClick.wantsNewWindow)(event)) {\n                return true;\n              }\n              return this.navigateToTopic(topic, target.attr(\"href\"));\n            }\n\n            // make full row click target on Desktop\n            if (target.hasClass(\"topic-list-data\") || target.hasClass(\"link-bottom-line\") || target.hasClass(\"topic-list-item\")) {\n              if ((0, _interceptClick.wantsNewWindow)(event)) {\n                return true;\n              }\n              return this.navigateToTopic(topic, topic.lastUnreadUrl);\n            }\n\n            // make full row click target on mobile\n            if (target.hasClass(\"right\") || target.hasClass(\"clearfix\")) {\n              if ((0, _interceptClick.wantsNewWindow)(event)) {\n                return true;\n              }\n              return this.navigateToTopic(topic, topic.lastUnreadUrl);\n            }\n            if (target.closest(\"a.topic-status\").length === 1) {\n              this.topic.togglePinnedForUser();\n              return false;\n            }\n            return this.unhandledRowClick(event, topic);\n          }\n        });\n        api.modifyClass(\"component:latest-topic-list-item\", {\n          pluginId: \"discourse-clickable-topic\",\n          click(event) {\n            // for discourse events, undefined has a different meaning than false\n            if (this.showEntrance(event) === false) return false;\n            const topic = this.topic;\n            const target = $(event.target);\n\n            // make full row click target\n            if (target.is(\"div\")) {\n              if ((0, _interceptClick.wantsNewWindow)(event)) {\n                return true;\n              }\n              return this.navigateToTopic(topic, topic.lastUnreadUrl);\n            }\n            return this.unhandledRowClick(event, this.topic);\n          }\n        });\n      });\n    }\n  };\n  _exports.default = _default;\n});\n}\n"]}