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D,OAAQA,IAAMgC,IAAAA,QAAAA,MAAoB,EAAI,KAC3CwD,MAAM,EAAGF,EAAYxB,EAPV,GAQXxB,KAAI,SAACC,GACJ,OACE,EAAC,IAAD,CAAMC,KAAMR,IAAAA,MAAAA,KAAeO,IACxBA,IAASP,IAAAA,QAAAA,KAAmBA,IAAAA,WAAAA,MAAqB,oCAAsCU,GAAAA,CAASH,OAQzG,GAAI+C,EAAW,CACb,IAAMrC,EAAQZ,EAAMgD,OAASE,EAAMF,OAEnCE,EAAME,KACJ,OACEjD,KAAK,IACLqC,QAAS,SAACa,GACRA,EAAEC,iBACF3D,IAAAA,MAAAA,KAAeH,EAAgB,CAAEO,KAAAA,MAGlCJ,IAAAA,WAAAA,MAAqB,sCAAuC,CAAEiB,MAAAA,MAKrEqB,EAAMK,IACJ,QACA,SAAK7C,UAAU,gBACZe,GAAAA,CAAK,oBACLb,IAAAA,WAAAA,MAAqB,oCAAsCK,EAAM,KAAOL,IAAAA,QAAAA,KAAmB,QAAU,IAAM,QAAS,CACnHiB,MAAOsC,EAAMF,OACbO,MAAOC,GAAAA,CAAgBN,WChDjCvD,IAAAA,OAAAA,cAA2B,CAAE8D,KAAM,qBAAsBC,UAAWzC,IACpEc,EAAAA,EAAAA,QAAO4B,IAAAA,UAAoB,YAAY,SAAU1B,GAC/C,IAAM/B,EAAOL,KAAKK,KAClB+B,EAAMK,IACJ,QACA,EAAC,IAAD,CAAYnC,KAAMR,IAAAA,MAAU,aAAc,CAAEU,SAAUH,EAAK0D,SAAWpD,KAAK,oBACxEb,IAAAA,WAAAA,MAAqB,uCAExB,QHIJoC,EAAAA,EAAAA,QAAO8B,IAAAA,UAA4B,qBAAqB,SAAU5B,GAChEA,EAAMK,IAAI,YAAa,CACrBwB,KAAM,YACNtD,KAAM,mBACNuD,MAAOpE,IAAAA,WAAAA,MAAqB,gE","sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/webpack/runtime/compat get default export","webpack://@flarum/likes/webpack/runtime/define property getters","webpack://@flarum/likes/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/likes/webpack/runtime/make namespace object","webpack://@flarum/likes/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/likes/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/models/Post']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/Model']\"","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/NotificationGrid']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/Link']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/likes/../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@flarum/likes/../../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@flarum/likes/./src/forum/components/PostLikesModal.js","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/Notification']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/utils/string']\"","webpack://@flarum/likes/./src/forum/components/PostLikedNotification.js","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/UserPage']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/LinkButton']\"","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/PostsUserPage']\"","webpack://@flarum/likes/./src/forum/components/LikesUserPage.tsx","webpack://@flarum/likes/./src/forum/index.js","webpack://@flarum/likes/./src/forum/addLikeAction.js","webpack://@flarum/likes/./src/forum/addLikesList.js","webpack://@flarum/likes/./src/forum/addLikesTabToUserProfile.tsx"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/NotificationGrid'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/punctuateSeries'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport Link from 'flarum/common/components/Link';\nimport avatar from 'flarum/common/helpers/avatar';\nimport username from 'flarum/common/helpers/username';\n\nexport default class PostLikesModal extends Modal {\n className() {\n return 'PostLikesModal Modal--small';\n }\n\n title() {\n return app.translator.trans('flarum-likes.forum.post_likes.title');\n }\n\n content() {\n return (\n
\n \n
\n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Notification'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/string'];","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class PostLikedNotification extends Notification {\n icon() {\n return 'far fa-thumbs-up';\n }\n\n href() {\n return app.route.post(this.attrs.notification.subject());\n }\n\n content() {\n const notification = this.attrs.notification;\n const user = notification.fromUser();\n\n return app.translator.trans('flarum-likes.forum.notifications.post_liked_text', { user, count: 1 });\n }\n\n excerpt() {\n return truncate(this.attrs.notification.subject().contentPlain(), 200);\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/PostsUserPage'];","import app from 'flarum/forum/app';\nimport PostsUserPage from 'flarum/forum/components/PostsUserPage';\n\n/**\n * The `LikesUserPage` component shows posts which user the user liked.\n */\nexport default class LikesUserPage extends PostsUserPage {\n /**\n * Load a new page of the user's activity feed.\n *\n * @param offset The position to start getting results from.\n * @protected\n */\n loadResults(offset: number) {\n return app.store.find('posts', {\n filter: {\n type: 'comment',\n likedBy: this.user.id(),\n },\n page: { offset, limit: this.loadLimit },\n sort: '-createdAt',\n });\n }\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Post from 'flarum/common/models/Post';\nimport Model from 'flarum/common/Model';\nimport NotificationGrid from 'flarum/forum/components/NotificationGrid';\n\nimport addLikeAction from './addLikeAction';\nimport addLikesList from './addLikesList';\nimport PostLikedNotification from './components/PostLikedNotification';\nimport addLikesTabToUserProfile from './addLikesTabToUserProfile';\n\napp.initializers.add('flarum-likes', () => {\n app.notificationComponents.postLiked = PostLikedNotification;\n\n Post.prototype.canLike = Model.attribute('canLike');\n Post.prototype.likes = Model.hasMany('likes');\n\n addLikeAction();\n addLikesList();\n addLikesTabToUserProfile();\n\n extend(NotificationGrid.prototype, 'notificationTypes', function (items) {\n items.add('postLiked', {\n name: 'postLiked',\n icon: 'far fa-thumbs-up',\n label: app.translator.trans('flarum-likes.forum.settings.notify_post_liked_label'),\n });\n });\n});\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Button from 'flarum/common/components/Button';\nimport CommentPost from 'flarum/forum/components/CommentPost';\n\nexport default function () {\n extend(CommentPost.prototype, 'actionItems', function (items) {\n const post = this.attrs.post;\n\n if (post.isHidden() || !post.canLike()) return;\n\n const likes = post.likes();\n\n let isLiked = app.session.user && likes && likes.some((user) => user === app.session.user);\n\n items.add(\n 'like',\n Button.component(\n {\n className: 'Button Button--link',\n onclick: () => {\n isLiked = !isLiked;\n\n post.save({ isLiked });\n\n // We've saved the fact that we do or don't like the post, but in order\n // to provide instantaneous feedback to the user, we'll need to add or\n // remove the like from the relationship data manually.\n const data = post.data.relationships.likes.data;\n data.some((like, i) => {\n if (like.id === app.session.user.id()) {\n data.splice(i, 1);\n return true;\n }\n });\n\n if (isLiked) {\n data.unshift({ type: 'users', id: app.session.user.id() });\n }\n },\n },\n app.translator.trans(isLiked ? 'flarum-likes.forum.post.unlike_link' : 'flarum-likes.forum.post.like_link')\n )\n );\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Link from 'flarum/common/components/Link';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\nimport icon from 'flarum/common/helpers/icon';\n\nimport PostLikesModal from './components/PostLikesModal';\n\nexport default function () {\n extend(CommentPost.prototype, 'footerItems', function (items) {\n const post = this.attrs.post;\n const likes = post.likes();\n\n if (likes && likes.length) {\n const limit = 4;\n const overLimit = likes.length > limit;\n\n // Construct a list of names of users who have liked this post. Make sure the\n // current user is first in the list, and cap a maximum of 4 items.\n const names = likes\n .sort((a) => (a === app.session.user ? -1 : 1))\n .slice(0, overLimit ? limit - 1 : limit)\n .map((user) => {\n return (\n \n {user === app.session.user ? app.translator.trans('flarum-likes.forum.post.you_text') : username(user)}\n \n );\n });\n\n // If there are more users that we've run out of room to display, add a \"x\n // others\" name to the end of the list. Clicking on it will display a modal\n // with a full list of names.\n if (overLimit) {\n const count = likes.length - names.length;\n\n names.push(\n {\n e.preventDefault();\n app.modal.show(PostLikesModal, { post });\n }}\n >\n {app.translator.trans('flarum-likes.forum.post.others_link', { count })}\n \n );\n }\n\n items.add(\n 'liked',\n
\n {icon('far fa-thumbs-up')}\n {app.translator.trans('flarum-likes.forum.post.liked_by' + (likes[0] === app.session.user ? '_self' : '') + '_text', {\n count: names.length,\n users: punctuateSeries(names),\n })}\n
\n );\n }\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport LikesUserPage from './components/LikesUserPage';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport type Mithril from 'mithril';\n\nexport default function addLikesTabToUserProfile() {\n app.routes['user.likes'] = { path: '/u/:username/likes', component: LikesUserPage };\n extend(UserPage.prototype, 'navItems', function (items: ItemList) {\n const user = this.user;\n items.add(\n 'likes',\n \n {app.translator.trans('flarum-likes.forum.user.likes_link')}\n ,\n 88\n );\n });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","PostLikesModal","className","title","app","content","this","attrs","post","likes","map","user","href","avatar","username","Modal","PostLikedNotification","icon","notification","subject","fromUser","count","excerpt","truncate","contentPlain","Notification","LikesUserPage","loadResults","offset","filter","type","likedBy","id","page","limit","loadLimit","sort","PostsUserPage","Post","Model","extend","CommentPost","items","isHidden","canLike","isLiked","some","add","Button","onclick","save","data","relationships","like","i","splice","unshift","length","overLimit","names","slice","push","e","preventDefault","users","punctuateSeries","path","component","UserPage","slug","NotificationGrid","name","label"],"sourceRoot":""}