flarum-bot 3757bde4fc Bundled output for commit f67ca5782a0b22d194526b6b11a2086443863921
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2023-06-07 10:45:14 +00:00

1 line
12 KiB
Plaintext
Generated

{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,mC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,mC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,8B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCmBxDC,IAAAA,aAAAA,IAAqB,iBAAiB,KACpCA,IAAAA,OAAa,iBAELC,OAAO,iEAGb,MAAMC,EAA8B,IAAIC,OAAOH,IAAAA,MAAAA,UAAoB,aAAc,CAC/EI,aAAc,GAAFC,OAAKL,IAAAA,MAAAA,UAAoB,UAAS,gBAC9CM,QAASN,IAAAA,M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EpC,KAEApB,EAAAA,EAAAA,QAAOiB,IAAAA,UAAqB,eAAgBqC,IAC1CA,EAAMC,OAAO,UAAU,IAGzBrE,IAAAA,OAAAA,MAAiBgB,IACf,MAAMP,EAAWO,EAAQP,SAErBA,EAASG,MACXH,EAASG,KAAKK,KAAK,gBAAgB,KACX,IAAAqD,EAAAC,EAAlBvE,IAAAA,QAAAA,MACFA,IAAAA,QAAAA,KAAAA,eAAgC,CAC9BwE,wBAAmE,OAA5CF,EAAEtE,IAAAA,QAAAA,KAAAA,2BAA0CsE,EAAI,EACvEG,qBAA6D,OAAzCF,EAAEvE,IAAAA,QAAAA,KAAAA,wBAAuCuE,EAAI,IAGrEvE,IAAAA,cAAAA,QACAgC,EAAEC,QAAQ,GAEd,GACA,G","sources":["webpack://@flarum/pusher/webpack/bootstrap","webpack://@flarum/pusher/webpack/runtime/compat get default export","webpack://@flarum/pusher/webpack/runtime/define property getters","webpack://@flarum/pusher/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/pusher/webpack/runtime/make namespace object","webpack://@flarum/pusher/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/pusher/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/pusher/external root \"flarum.core.compat['forum/components/DiscussionList']\"","webpack://@flarum/pusher/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@flarum/pusher/external root \"flarum.core.compat['forum/components/IndexPage']\"","webpack://@flarum/pusher/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/pusher/./src/forum/index.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['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","import * as PusherTypes from 'pusher-js';\nimport app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionList from 'flarum/forum/components/DiscussionList';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport Button from 'flarum/common/components/Button';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport type { Children } from 'mithril';\nimport type Tag from 'flarum/tags/common/models/Tag';\n\nexport type PusherBinding = {\n channels: {\n main: PusherTypes.Channel;\n user: PusherTypes.Channel | null;\n };\n pusher: PusherTypes.default;\n};\n\napp.initializers.add('flarum-pusher', () => {\n app.pusher = (async () => {\n // @ts-expect-error\n await import('//cdn.jsdelivr.net/npm/pusher-js@7.0.3/dist/web/pusher.min.js' /* webpackIgnore: true, webpackPrefetch: true */);\n\n // @ts-expect-error Imported dynamically\n const socket: PusherTypes.default = new Pusher(app.forum.attribute('pusherKey'), {\n authEndpoint: `${app.forum.attribute('apiUrl')}/pusher/auth`,\n cluster: app.forum.attribute('pusherCluster'),\n auth: {\n headers: {\n 'X-CSRF-Token': app.session.csrfToken,\n },\n },\n });\n\n return {\n channels: {\n main: socket.subscribe('public'),\n user: app.session.user ? socket.subscribe(`private-user${app.session.user.id()}`) : null,\n },\n pusher: socket,\n };\n })();\n\n app.pushedUpdates = [];\n\n extend(DiscussionList.prototype, 'oncreate', function () {\n app.pusher.then((binding: PusherBinding) => {\n const pusher = binding.pusher;\n\n pusher.bind('newPost', (data: { tagIds: string[]; discussionId: number }) => {\n const params = app.discussions.getParams();\n\n if (!params.q && !params.sort && !params.filter) {\n if (params.tags) {\n const tag = app.store.getBy<Tag>('tags', 'slug', params.tags);\n const tagId = tag?.id();\n\n if (!tagId || !data.tagIds.includes(tagId)) return;\n }\n\n const id = String(data.discussionId);\n\n if ((!app.current.get('discussion') || id !== app.current.get('discussion').id()) && app.pushedUpdates.indexOf(id) === -1) {\n app.pushedUpdates.push(id);\n\n if (app.current.matches(IndexPage)) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n }\n }\n });\n });\n });\n\n extend(DiscussionList.prototype, 'onremove', function () {\n app.pusher.then((binding: PusherBinding) => {\n binding.pusher.unbind('newPost');\n });\n });\n\n extend(DiscussionList.prototype, 'view', function (this: DiscussionList, vdom: Children) {\n if (app.pushedUpdates) {\n const count = app.pushedUpdates.length;\n\n if (count && typeof vdom === 'object' && vdom && 'children' in vdom && vdom.children instanceof Array) {\n vdom.children.unshift(\n <Button\n className=\"Button Button--block DiscussionList-update\"\n onclick={() => {\n this.attrs.state.refresh().then(() => {\n this.loadingUpdated = false;\n app.pushedUpdates = [];\n app.setTitleCount(0);\n m.redraw();\n });\n this.loadingUpdated = true;\n }}\n loading={this.loadingUpdated}\n >\n {app.translator.trans('flarum-pusher.forum.discussion_list.show_updates_text', { count })}\n </Button>\n );\n }\n }\n });\n\n extend(DiscussionPage.prototype, 'oncreate', function (this: DiscussionPage) {\n app.pusher.then((binding: PusherBinding) => {\n const pusher = binding.pusher;\n\n pusher.bind('newPost', (data: { discussionId: number }) => {\n const id = String(data.discussionId);\n const discussionId = this.discussion?.id();\n\n if (this.discussion && discussionId === id && this.stream) {\n const oldCount = this.discussion.commentCount() ?? 0;\n\n app.store.find('discussions', discussionId).then(() => {\n this.stream?.update().then(m.redraw);\n\n if (!document.hasFocus()) {\n app.setTitleCount(Math.max(0, (this.discussion?.commentCount() ?? 0) - oldCount));\n\n window.addEventListener('focus', () => app.setTitleCount(0), { once: true });\n }\n });\n }\n });\n });\n });\n\n extend(DiscussionPage.prototype, 'onremove', function () {\n app.pusher.then((binding: PusherBinding) => {\n binding.pusher.unbind('newPost');\n });\n });\n\n extend(IndexPage.prototype, 'actionItems', (items: ItemList<Children>) => {\n items.remove('refresh');\n });\n\n app.pusher.then((binding: PusherBinding) => {\n const channels = binding.channels;\n\n if (channels.user) {\n channels.user.bind('notification', () => {\n if (app.session.user) {\n app.session.user.pushAttributes({\n unreadNotificationCount: app.session.user.unreadNotificationCount() ?? 0 + 1,\n newNotificationCount: app.session.user.newNotificationCount() ?? 0 + 1,\n });\n }\n app.notifications.clear();\n m.redraw();\n });\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","app","import","socket","Pusher","authEndpoint","concat","cluster","auth","headers","channels","main","subscribe","user","pusher","extend","DiscussionList","binding","bind","data","params","q","sort","filter","tags","tag","tagId","id","tagIds","includes","String","discussionId","IndexPage","m","redraw","unbind","vdom","count","children","Array","unshift","Button","className","onclick","this","attrs","state","refresh","then","loadingUpdated","loading","DiscussionPage","_this$discussion","discussion","stream","_this$discussion$comm","oldCount","commentCount","_this$stream","_this$discussion$comm2","_this$discussion2","update","document","hasFocus","Math","max","window","addEventListener","once","items","remove","_app$session$user$unr","_app$session$user$new","unreadNotificationCount","newNotificationCount"],"sourceRoot":""}