{"version":3,"sources":["webpack:///../WCC.UI/App/components/topic/attachments/attachments.html?80a7","webpack:///../WCC.UI/App/components/topic/attachments/attachments.scss?bc11","webpack:///../WCC.UI/App/components/topic/attachments/attachments.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/topic/attachments/attachments.scss","webpack:///../WCC.UI/App/components/topic/attachments/attachments.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","components","preload","TopicAttachmentsVM","constructor","config","info","storage","topicId","ko","flattenComputed","isAlwaysActive","alwaysActive","this","theme","attachmentsManager","get","TopicAttachmentsManager","view","AttachmentsView","all","attachments","pluck","m","isLoadingAttachments","loading","extend","deferred","boxConfig","itemWidth","offset","outerOffset","attachmentsTheme","images","filter","a","fileType","enums","AttachmentTypes","Image","value","videos","AttachmentsHelpers","isYouTube","isVimeo","isVideo","files","isFile","links","isLink","hasAttachments","pureComputed","length","areAttachmentsShown","observable","isAttachmentsToggleShown","attachmentsToggleLabel","labels","HideResourcesList","ViewResourcesList","isActive","isReady","isBodyShown","applyBindingsToNode","element","is","toggle","__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,43BCDnCC,EAAWC,QAAQ,oBAAqB,mBAexC,IAA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X,KAAKiD,YAAcrD,EAAG0C,aAAa,IAAMtC,KAAKgD,WAAaX,KAE3DzC,EAAGsD,oBAAoBzD,EAAK0D,QAAS,CACjC,IAAO,CACH,oBAAsB,EACtB,6BAA8BJ,EAC9B,4BAA6B/C,KAAKC,MAAMmD,GAAG,SAC3C,8BAA+BpD,KAAKC,MAAMmD,GAAG,cAKzDC,SACIrD,KAAKwC,oBAAoBa,WA5DZ/D,EAAkBgE,EAAA,CADtCC,cAcQC,EAAA,EAAAC,YAAOC,IAAWC,kBAClBH,EAAA,EAAAC,YAAOC,IAAWE,gBAClBJ,EAAA,EAAAC,YAAOC,IAAWhE,WAfNJ,gB,qQChCrB,WAOC,KAPD,aACI,MAAMuE,EAAS,EAAQ,mCAAkBC,cAEzC,OAAO,SAAUC,GACbF,EAAOG,yBAAyBD,GAC3BE,SAAQ,SAAUC,GAAQC,SAASC,KAAKC,YAAYH,QAEhE,+B,4KCLDhF,EADkC,EAAQ,wDAChCoF,EAA4B,IAE9BC,KAAK,CAACxF,EAAOC,EAAI,kdAAmd,KAE5eD,EAAOG,QAAUA,G,4HCHjBH,EAAOG,QAFI","file":"320.0ccb01e3f0601264f9b1.js","sourcesContent":["define([\n \"!!../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./attachments.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!./attachments.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 { AttachmentsBoxVMConfig } from 'components/attachments/box/box';\r\nimport { WCCAttachmentLayoutVMTheme } from 'components/attachments/layouts/base/base.interfaces';\r\nimport { wccModules } from 'enums/wccModules';\r\nimport { AttachmentsHelpers } from 'helpers/attachments';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Observable, Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport { IWCCStorageManager } from 'managers/iStorage';\r\nimport TopicAttachmentsManager, { AttachmentsView } from 'managers/topic/attachments';\r\nimport WCCFile from 'models/attachments/file';\r\nimport WCCImage from 'models/attachments/image';\r\nimport WCCLink from 'models/attachments/link';\r\nimport WCCVideo from 'models/attachments/video';\r\nimport WCCVimeoVideo from 'models/attachments/vimeo';\r\nimport WCCYoutubeVideo from 'models/attachments/youtube';\r\nimport './attachments.html';\r\nimport './attachments.scss';\r\n\r\ncomponents.preload('sliding-container', 'attachments-box');\r\n\r\ntype TopicAttachmentsVMTheme = 'light' | 'overlay';\r\n\r\nexport interface TopicAttachmentsVMConfig {\n topicId?: SubscribableOrNullableValue<string>\r\n itemWidth?: SubscribableOrNullableValue<number>\r\n offset?: SubscribableOrNullableValue<number>\r\n outerOffset?: SubscribableOrNullableValue<number>\r\n alwaysActive?: SubscribableOrNullableValue<boolean>\r\n theme?: SubscribableOrNullableValue<TopicAttachmentsVMTheme>\r\n attachmentsTheme?: SubscribableOrNullableValue<WCCAttachmentLayoutVMTheme>\r\n}\n\n@injectable()\nexport default class TopicAttachmentsVM {\n private theme: Subscribable<TopicAttachmentsVMTheme>\n\n attachmentsToggleLabel: Subscribable<string>\n\n boxConfig: AttachmentsBoxVMConfig\n\n isBodyShown: Subscribable<boolean>\n areAttachmentsShown: Observable<boolean>\n isAttachmentsToggleShown: Subscribable<boolean>\n isReady: Subscribable<boolean>\n\n constructor(\r\n @inject(wccModules.componentConfig) config: TopicAttachmentsVMConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.storage) storage: IWCCStorageManager\r\n ) {\r\n const topicId = ko.flattenComputed(config.topicId);\n const isAlwaysActive = ko.flattenComputed(config.alwaysActive, false);\n this.theme = ko.flattenComputed(config.theme, 'light');\n\n const attachmentsManager = storage.get(TopicAttachmentsManager, { topicId, view: AttachmentsView.all });\n const attachments = attachmentsManager.pluck(m => m.attachments, []);\n const isLoadingAttachments = attachmentsManager.pluck(m => m.loading, true).extend({ deferred: true });\n\n this.boxConfig = {\n attachments: attachments,\r\n itemWidth: config.itemWidth,\r\n offset: config.offset,\r\n outerOffset: config.outerOffset,\r\n theme: config.attachmentsTheme\r\n }\n\n const images = attachments.filter<WCCImage>(a => a.fileType() === enums.AttachmentTypes.Image.value);\n const videos = attachments.filter<WCCYoutubeVideo | WCCVimeoVideo | WCCVideo>(a => AttachmentsHelpers.isYouTube(a.fileType()) || AttachmentsHelpers.isVimeo(a.fileType()) || AttachmentsHelpers.isVideo(a.fileType()));\n const files = attachments.filter<WCCFile>(a => a.isFile());\n const links = attachments.filter<WCCLink>(a => a.isLink());\n const hasAttachments = ko.pureComputed(() => images().length > 0 || videos().length > 0 || files().length > 0 || links().length > 0);\n\n this.areAttachmentsShown = ko.observable<boolean>(true);\n this.isAttachmentsToggleShown = ko.observable<boolean>(false);//isAlwaysActive.not(); // switched toggle off.\n this.attachmentsToggleLabel = ko.pureComputed(() => this.areAttachmentsShown() ? labels.HideResourcesList : labels.ViewResourcesList);\n\n const isActive = ko.pureComputed(() => isAlwaysActive() || this.areAttachmentsShown());\n\n this.isReady = ko.pureComputed(() => !isLoadingAttachments());\n\n this.isBodyShown = ko.pureComputed(() => this.isReady() && hasAttachments());\n\r\n ko.applyBindingsToNode(info.element, {\n 'css': {\n 'topic__attachments': true,\n 'topic__attachments--active': isActive,\n 'topic__attachments--light': this.theme.is('light'),\n 'topic__attachments--overlay': this.theme.is('overlay')\n }\n });\r\n }\r\n\r\n toggle() {\n this.areAttachmentsShown.toggle();\n }\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, \".topic__attachments{display:flex;flex-direction:column;overflow:hidden;gap:3px}.topic__attachments.topic__attachments--active .topic__attachments__body{margin-top:0}.topic__attachments__toggle-control{font-weight:bold;font-size:13px;padding:10px;transition:transform ease-in-out 250ms;background-color:#fff;border-radius:4px;transform:scale(1);text-align:center;cursor:pointer}@media(hover: hover){.topic__attachments__toggle-control:hover{transform:scale(0.95)}}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"<script id=\\\"wcc-components-topic-attachments\\\" type=\\\"text/template\\\">\\r\\n <!-- ko if: isBodyShown -->\\r\\n <div class=\\\"topic__attachments__body\\\">\\r\\n <sliding-container params=\\\"expand: areAttachmentsShown\\\">\\r\\n <attachments-box params=\\\"model: boxConfig\\\"></attachments-box>\\r\\n </sliding-container>\\r\\n </div>\\r\\n\\r\\n <!-- ko if: isAttachmentsToggleShown -->\\r\\n <div class=\\\"topic__attachments__footer\\\">\\r\\n <div class=\\\"topic__attachments__toggle-control\\\" data-bind=\\\"click: toggle, text: attachmentsToggleLabel\\\"></div>\\r\\n </div>\\r\\n <!-- /ko -->\\r\\n <!-- /ko -->\\r\\n\\r\\n <wcs-spinner class=\\\"topic__attachments__loader\\\" params=\\\"visible: !isReady()\\\"></wcs-spinner>\\r\\n</script>\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}