{"version":3,"sources":["webpack:///../WCC.UI/App/components/attachments/file/file.html?d923","webpack:///../WCC.UI/App/components/attachments/file/file.scss?b747","webpack:///../WCC.UI/App/components/attachments/file/file.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/attachments/file/file.scss","webpack:///../WCC.UI/App/components/attachments/file/file.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","WCCFileVM","constructor","configOrFile","info","layoutFactory","config","WCCFile","this","getConfigFromFile","file","ko","flattenComputed","ratio","fileURL","pluck","f","fileUrl","fileName","originalFileName","fileIcon","fileExtension","ext","AttachmentsHelpers","getFileIcon","layoutConfig","create","layout","url","title","icon","theme","isReady","isNotNull","applyBindingsToNode","element","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","attachmentLayoutFactory","system","SystemHelpers","html","getTemplatesAndResources","forEach","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___","push"],"mappings":"yIAAA,UAAO,CACC,yGACA,wDAIC,KAJ4C,EAAF,SAAYA,EAASC,GAG5D,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,sECNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,oJAIC,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,21BCCnC,IAAqBC,EAArB,MAGIC,YACwCC,EACFC,EACUC,GAE5C,MAAMC,EAASH,aAAwBI,IAAUC,KAAKC,kBAAkBN,GAAgBA,EAElFO,EAAOC,EAAGC,gBAAgBN,EAAOI,MACjCG,EAAQF,EAAGC,gBAAgBN,EAAOO,OAElCC,EAAUJ,EAAKK,MAAMC,GAAKA,EAAEC,SAC5BC,EAAWR,EAAKK,MAAMC,GAAKA,EAAEG,kBAG7BC,EADgBV,EAAKK,MAAMC,GAAKA,EAAEK,eACTN,MAAMO,GAAOC,qBAAmBC,YAAYF,IAE3Ed,KAAKiB,aAAepB,EAAcqB,OAAO,CACrCC,OAAQrB,EAAOqB,OAEfrB,OAAQ,CACJsB,IAAKd,EACLe,MAAOX,EACPY,KAAMV,EACNP,MAAOA,EACPkB,MAAOzB,EAAOyB,SAItB,MAAMC,EAAUtB,EAAKuB,YAErBtB,EAAGuB,oBAAoB9B,EAAK+B,QAAS,CACjC,QAAWH,EAEX,IAAO,CACH,YAAY,KAKhBvB,kBAAkBC,GACtB,MAAO,CAAEA,UA3CIT,EAASmC,EAAA,CAD7BC,cAKQC,EAAA,EAAAC,YAAOC,IAAWC,kBAClBH,EAAA,EAAAC,YAAOC,IAAWE,gBAClBJ,EAAA,EAAAC,YAAOC,IAAWG,2BANN1C,gB,sICnBrB,WAOC,KAPD,aACI,MAAM2C,EAAS,EAAQ,mCAAkBC,cAEzC,OAAO,SAAUC,GACbF,EAAOG,yBAAyBD,GAC3BE,SAAQ,SAAUC,GAAQC,SAASC,KAAKC,YAAYH,QAEhE,+B,oKCLDlD,EADkC,EAAQ,wDAChCsD,EAA4B,IAE9BC,KAAK,CAAC1D,EAAOC,EAAI,6CAA8C,KAEvED,EAAOG,QAAUA,G,oHCHjBH,EAAOG,QAFI","file":"265.1ffcd283661b7576bfe1.js","sourcesContent":["define([\n \"!!../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./file.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!./file.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 { wccModules } from 'enums/wccModules';\r\nimport { AttachmentsHelpers } from 'helpers/attachments';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport WCCFile from 'models/attachments/file';\r\nimport { CustomElementConfig } from '../../../extensions/knockout/bindings/customElement';\r\nimport { WCCAttachmentLayoutVMTheme } from '../layouts/base/base.interfaces';\r\nimport { IAttachmentLayoutFactory, WCCAttachmentLayout } from '../layouts/iFactory';\r\nimport './file.html';\r\nimport './file.scss';\r\n\r\nexport interface WCCFileVMConfig {\r\n file?: SubscribableOrNullableValue\r\n layout?: SubscribableOrNullableValue\r\n ratio?: SubscribableOrNullableValue\r\n theme?: SubscribableOrNullableValue\r\n}\r\n\r\n@injectable()\r\nexport default class WCCFileVM {\r\n layoutConfig: Subscribable\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) configOrFile: WCCFileVMConfig | WCCFile,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.attachmentLayoutFactory) layoutFactory: IAttachmentLayoutFactory\r\n ) {\r\n const config = configOrFile instanceof WCCFile ? this.getConfigFromFile(configOrFile) : configOrFile;\r\n\r\n const file = ko.flattenComputed(config.file);\r\n const ratio = ko.flattenComputed(config.ratio);\r\n\r\n const fileURL = file.pluck(f => f.fileUrl);\r\n const fileName = file.pluck(f => f.originalFileName);\r\n\r\n const fileExtension = file.pluck(f => f.fileExtension);\r\n const fileIcon = fileExtension.pluck(ext => AttachmentsHelpers.getFileIcon(ext));\r\n\r\n this.layoutConfig = layoutFactory.create({\r\n layout: config.layout,\r\n\r\n config: {\r\n url: fileURL,\r\n title: fileName,\r\n icon: fileIcon,\r\n ratio: ratio,\r\n theme: config.theme\r\n }\r\n });\r\n \r\n const isReady = file.isNotNull();\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'visible': isReady,\r\n\r\n 'css': {\r\n 'wcc-file': true\r\n }\r\n });\r\n }\r\n\r\n private getConfigFromFile(file: WCCFile): WCCFileVMConfig {\r\n return { file }\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, \".wcc-file{position:relative;display:block}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}