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gB,IAC3D,oBAAoB,MAAc,oBAAoB,OACxDA,EAAOC,QAAQC,KAAK,YAExB,KACA,IAAAlB,QAAO,cAA8B,aAAa,SAAUM,GAC1D,MAAMC,EAAavB,KAAKC,MAAMsB,WAC9B,GAAIA,EAAWL,aAAelB,KAAKC,MAAM+B,OAAOG,IAAMZ,EAAWa,qBAAsB,CACrF,MAAMC,EAAYd,EAAWc,YAC7B,GAAIA,EAAW,CACb,MAAMC,GAAU,IAAAC,UAASF,EAAUG,eAAgB,KAGnDlB,EAAMjB,IAAI,UAAWc,EAAE,MAAO,KAAMmB,IAAW,IACjD,CACF,CACF,KCpBA,IAAAtB,QAAO,cAA8B,gBAAgB,SAAUf,GACzDD,KAAKC,MAAMsB,WAAWL,aACxBjB,EAAMwC,UAAY,IAAUxC,EAAMwC,UAAW,8BAEjD,GJEgB,G","sources":["webpack://@flarum/sticky/webpack/bootstrap","webpack://@flarum/sticky/webpack/runtime/compat get default export","webpack://@flarum/sticky/webpack/runtime/define property getters","webpack://@flarum/sticky/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/sticky/webpack/runtime/make namespace object","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/models/Discussion')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/components/Badge')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'forum/utils/DiscussionControls')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'forum/components/DiscussionPage')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/components/Button')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'forum/states/DiscussionListState')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'forum/components/DiscussionListItem')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'forum/components/IndexPage')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/utils/string')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/utils/classList')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'forum/components/EventPost')\"","webpack://@flarum/sticky/./src/forum/components/DiscussionStickiedPost.js","webpack://@flarum/sticky/./src/common/query/discussions/StickyGambit.ts","webpack://@flarum/sticky/./src/common/extend.ts","webpack://@flarum/sticky/./src/forum/extend.ts","webpack://@flarum/sticky/./src/forum/index.js","webpack://@flarum/sticky/./src/forum/addStickyBadge.js","webpack://@flarum/sticky/./src/forum/addStickyControl.js","webpack://@flarum/sticky/./src/forum/addStickyExcerpt.js","webpack://@flarum/sticky/./src/forum/addStickyClass.js"],"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.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Discussion');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Badge');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/utils/DiscussionControls');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionPage');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Button');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/states/DiscussionListState');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionListItem');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/IndexPage');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/string');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/classList');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/EventPost');","import EventPost from 'flarum/forum/components/EventPost';\nexport default class DiscussionStickiedPost extends EventPost {\n icon() {\n return 'fas fa-thumbtack';\n }\n descriptionKey() {\n return this.attrs.post.content().sticky ? 'flarum-sticky.forum.post_stream.discussion_stickied_text' : 'flarum-sticky.forum.post_stream.discussion_unstickied_text';\n }\n}\nflarum.reg.add('flarum-sticky', 'forum/components/DiscussionStickiedPost', DiscussionStickiedPost);","export default class StickyGambit {\n pattern() {\n return 'is:sticky';\n }\n toFilter(_matches, negate) {\n const key = (negate ? '-' : '') + 'sticky';\n return {\n [key]: true\n };\n }\n filterKey() {\n return 'sticky';\n }\n fromFilter(value, negate) {\n return \"\".concat(negate ? '-' : '', \"is:sticky\");\n }\n}\nflarum.reg.add('flarum-sticky', 'common/query/discussions/StickyGambit', StickyGambit);","import Extend from 'flarum/common/extenders';\nimport StickyGambit from './query/discussions/StickyGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', StickyGambit)];","import Extend from 'flarum/common/extenders';\nimport Discussion from 'flarum/common/models/Discussion';\nimport DiscussionStickiedPost from './components/DiscussionStickiedPost';\nimport commonExtend from '../common/extend';\nexport default [...commonExtend, new Extend.PostTypes() //\n.add('discussionStickied', DiscussionStickiedPost), new Extend.Model(Discussion) //\n.attribute('isSticky').attribute('canSticky')];","import app from 'flarum/forum/app';\nimport addStickyBadge from './addStickyBadge';\nimport addStickyControl from './addStickyControl';\nimport addStickyExcerpt from './addStickyExcerpt';\nimport addStickyClass from './addStickyClass';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-sticky', () => {\n addStickyBadge();\n addStickyControl();\n addStickyExcerpt();\n addStickyClass();\n});","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Badge from 'flarum/common/components/Badge';\nexport default function addStickyBadge() {\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.isSticky()) {\n badges.add('sticky', m(Badge, {\n type: \"sticky\",\n label: app.translator.trans('flarum-sticky.forum.badge.sticky_tooltip'),\n icon: \"fas fa-thumbtack\"\n }), 10);\n }\n });\n}","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionControls from 'flarum/forum/utils/DiscussionControls';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport Button from 'flarum/common/components/Button';\nexport default function addStickyControl() {\n extend(DiscussionControls, 'moderationControls', function (items, discussion) {\n if (discussion.canSticky()) {\n items.add('sticky', m(Button, {\n icon: \"fas fa-thumbtack\",\n onclick: this.stickyAction.bind(discussion)\n }, app.translator.trans(\"flarum-sticky.forum.discussion_controls.\".concat(discussion.isSticky() ? 'unsticky' : 'sticky', \"_button\"))));\n }\n });\n DiscussionControls.stickyAction = function () {\n this.save({\n isSticky: !this.isSticky()\n }).then(() => {\n if (app.current.matches(DiscussionPage)) {\n app.current.get('stream').update();\n }\n m.redraw();\n });\n };\n}","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionListState from 'flarum/forum/states/DiscussionListState';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport { truncate } from 'flarum/common/utils/string';\nexport default function addStickyExcerpt() {\n extend(DiscussionListState.prototype, 'requestParams', function (params) {\n if (app.current.matches(IndexPage) || app.current.matches(DiscussionPage)) {\n params.include.push('firstPost');\n }\n });\n extend(DiscussionListItem.prototype, 'infoItems', function (items) {\n const discussion = this.attrs.discussion;\n if (discussion.isSticky() && !this.attrs.params.q && !discussion.lastReadPostNumber()) {\n const firstPost = discussion.firstPost();\n if (firstPost) {\n const excerpt = truncate(firstPost.contentPlain(), 175);\n\n // Wrapping in
because ItemList entries need to be vnodes\n items.add('excerpt', m(\"div\", null, excerpt), -100);\n }\n }\n });\n}","import { extend } from 'flarum/common/extend';\nimport classList from 'flarum/common/utils/classList';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nexport default function addStickyClass() {\n extend(DiscussionListItem.prototype, 'elementAttrs', function (attrs) {\n if (this.attrs.discussion.isSticky()) {\n attrs.className = classList(attrs.className, 'DiscussionListItem--sticky');\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","reg","DiscussionStickiedPost","icon","descriptionKey","this","attrs","post","content","sticky","add","StickyGambit","pattern","toFilter","_matches","negate","filterKey","fromFilter","concat","gambit","attribute","extend","badges","isSticky","m","type","label","items","discussion","canSticky","onclick","stickyAction","bind","save","then","update","redraw","params","include","push","q","lastReadPostNumber","firstPost","excerpt","truncate","contentPlain","className"],"sourceRoot":""}