{"version":3,"sources":["webpack:///../WCC.UI/App/components/topic/threadMedia/threadMedia.html?418b","webpack:///../WCC.UI/App/components/topic/threadMedia/threadMedia.scss?48b0","webpack:///../WCC.UI/App/components/topic/threadMedia/threadMedia.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/topic/threadMedia/threadMedia.scss","webpack:///../WCC.UI/App/components/topic/threadMedia/threadMedia.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","components","preload","ThreadMediaVM","constructor","config","info","id","_","uniqueId","removeAttachment","attachment","_this$mediaManager","this","mediaManager","ko","flattenComputed","media","mediaSize","isCaptionEditorNeeded","captionEditor","attachments","pluck","m","uploads","mainAttachmentes","filter","a","isAudio","audios","pureComputed","concat","mediaGrid","Grid","source","columnWidth","offset","threshold","hasMedia","any","audioGrid","hasAudio","applyBindingsToNode","element","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","system","SystemHelpers","html","getTemplatesAndResources","forEach","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___","push"],"mappings":"iJAAA,UAAO,CACC,iHACA,wDAIC,KAJ4C,EAAF,SAAYA,EAASC,GAG5D,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,8ECNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,4JAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAAIN,EAAS,MAG9C,IAAIO,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPH,EAAIJ,EAASO,GAI1BF,EAAOG,QAAUR,EAAQS,QAAU,I,w0BCPnCC,EAAWC,QAAQ,WAAY,YAAa,yBAA0B,sBAAuB,YAAa,0BAA2B,YAAa,qBAAsB,WAAY,cASpL,IAAqBC,EAArB,MAaIC,YACwCC,EACFC,GAZtC,KAAAC,GAAKC,EAAEC,SAAS,iBAiDhB,KAAAC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Content":["define([\n \"!!../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./threadMedia.html\", \n \"!../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/sass-loader/dist/cjs.js!./threadMedia.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { Grid } from 'components/grid/grid';\r\nimport { wccModules } from 'enums/wccModules';\r\nimport { ThreadMedia } from 'interfaces/threadMedia';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport TopicMediaManager from 'managers/topic/media';\r\nimport WCCAttachment from 'models/attachments/attachment';\r\nimport WCCAudio from 'models/attachments/audio';\r\nimport './threadMedia.html';\r\nimport './threadMedia.scss';\r\n\r\ncomponents.preload('grid-new', 'wcc-audio', 'wcc-generic-attachment', 'attachment-controls', 'wcc-image', 'attachment-title-editor', 'wcc-video', 'attachment-caption', 'wcc-file', 'wcc-upload');\r\n\r\nexport interface ThreadMediaVMConfig {\r\n media: SubscribableOrNullableValue\r\n mediaSize: SubscribableOrNullableValue\r\n captionEditor: SubscribableOrNullableValue\r\n}\r\n\r\n@injectable()\r\nexport default class ThreadMediaVM {\r\n private mediaManager: Subscribable\r\n\r\n id = _.uniqueId(`thread-media-`);\r\n\r\n mediaGrid: Grid\r\n audioGrid: Grid\r\n\r\n hasMedia: Subscribable\r\n hasAudio: Subscribable\r\n\r\n isCaptionEditorNeeded: Subscribable\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) config: ThreadMediaVMConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n ) {\r\n this.mediaManager = ko.flattenComputed(config.media);\r\n const mediaSize = ko.flattenComputed(config.mediaSize, 150);\r\n this.isCaptionEditorNeeded = ko.flattenComputed(config.captionEditor, false);\r\n\r\n const attachments = this.mediaManager.pluck(m => m.attachments, []);\r\n const uploads = this.mediaManager.pluck(m => m.uploads, []); \r\n\r\n const mainAttachmentes = attachments.filter(a => !a.isAudio());\r\n const audios = attachments.filter(a => a.isAudio()); \r\n\r\n const media = ko.pureComputed(() => (>mainAttachmentes()).concat(uploads()));\r\n\r\n this.mediaGrid = new Grid({\r\n source: media,\r\n columnWidth: mediaSize,\r\n offset: 5,\r\n threshold: 50\r\n });\r\n\r\n this.hasMedia = media.any();\r\n \r\n this.audioGrid = new Grid({\r\n source: audios,\r\n offset: 5\r\n });\r\n\r\n this.hasAudio = audios.any();\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'css': {\r\n 'thread-media': true\r\n }\r\n });\r\n }\r\n\r\n removeAttachment = (attachment: WCCAttachment) => {\r\n this.mediaManager()?.removeAttachment(attachment);\r\n }\r\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".thread-media{display:block}.thread-media__block{margin:10px}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}