{"version":3,"sources":["webpack:///../WCC.UI/App/components/fancybox/base.scss?cf68","webpack:///../WCC.UI/App/components/fancybox/base.ts","webpack:///../WCC.UI/App/components/fancybox/helpers.ts","webpack:///../WCC.UI/App/components/fancybox/iframe.html?2cf8","webpack:///../WCC.UI/App/components/fancybox/iframe.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/fancybox/base.scss","webpack:///../WCC.UI/App/components/fancybox/iframe.html"],"names":["api","content","__esModule","default","module","i","options","exports","locals","allowedEvents","defaultValidator","WCCFancyboxBaseVM","constructor","rawConfig","info","effects","_ko$unwrap","_config$events","_config$validate","ready","ko","pureComputed","config","this","buildConfig","isActive","isWritableObservable","active","observable","unwrap","flattenComputed","events","validate","groupName","group","_","uniqueId","data","extend","deferred","mapSingle","name","getOrCreateGroup","register","push","utils","arrayRemoveItem","cleanUpGroups","withEffect","show","hammer","Hammer","element","on","onClick","destroy","DOMHelpers","onNodeEvent","applyBindingsToNode","click","m","e","stopPropagation","buildOptions","omit","item","availableItems","map","filter","undefined","oFocusedItem","items","length","idx","findIndex","_ko$unwrap2","src","isDisposed","internalEvents","afterShow","instance","slide","find","_ko$unwrap3","afterClose","baseOptions","proxy","withProxy","instanceItems","clone","instanceOptions","$","fancybox","open","close","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","groups","Map","get","set","toRemove","forEach","value","key","delete","methods","reduce","result","method","_len","arguments","args","Array","_key","isFunction","expose","WCCFancyboxIframeVM","super","oSrc","oCaption","caption","type","opts","system","SystemHelpers","html","getTemplatesAndResources","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___"],"mappings":"iIAAA,IAAIA,EAAM,EAAQ,gFACFC,EAAU,EAAQ,4IAIC,iBAFvBA,EAAUA,EAAQC,WAAaD,EAAQE,QAAUF,KAG/CA,EAAU,CAAC,CAACG,EAAOC,EAAIJ,EAAS,MAG9C,IAAIK,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPN,EA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CiD,EAAWzG,EAAGU,gBAAgBjB,EAAUiH,SAE9C,OAAO3F,EAAE,IAAIG,OAAOqF,MAAMnG,YAAYX,GAAqC,CACvEwB,KAAMjB,EAAGC,aAAa,KAAM,CACxBuD,IAAKgD,IACLG,KAAM,SACNC,KAAM,CACFF,QAASD,UAMN9D,aAAalD,GAC5B,OAAwBsB,EAAEwF,MAAM5D,aAAalD,IAAYmD,KAAK,MAAO,aAzBxD0D,EAAmB3B,EAAA,CADvCC,cAGQC,EAAA,EAAAC,YAAOC,IAAWC,kBAClBH,EAAA,EAAAC,YAAOC,IAAWE,gBAClBJ,EAAA,EAAAC,YAAOC,IAAWpF,WAJN2G,gB,yLCbrB,WAOC,KAPD,aACI,MAAMO,EAAS,EAAQ,mCAAkBC,cAEzC,OAAO,SAAUC,GACbF,EAAOG,yBAAyBD,GAC3BxB,SAAQ,SAAU0B,GAAQC,SAASC,KAAKC,YAAYH,QAEhE,+B,4JCLD9H,EADkC,EAAQ,wDAChCkI,EAA4B,IAE9B7F,KAAK,CAACxC,EAAOC,EAAI,wFAAyF,KAElHD,EAAOG,QAAUA,G,8GCHjBH,EAAOG,QAFI","file":"221.72a162d2e732ea6a3d3b.js","sourcesContent":["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!./base.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 Hammer from 'hammerjs';\r\nimport { DOMHelpers } from 'helpers/dom';\r\nimport { Func } from 'interfaces/func';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Observable, Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport { withEffect } from 'mixins/withEffect';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport './base.scss';\r\nimport { cleanUpGroups, getOrCreateGroup, withProxy } from './helpers';\r\n\r\nconst allowedEvents = >['onInit', 'afterLoad', 'beforeLoad', 'afterClose', 'beforeClose', 'afterShow', 'beforeShow'];\r\nconst defaultValidator = () => true;\r\n\r\nexport interface WCCFancyboxBaseVMConfigRaw {\r\n group?: SubscribableOrNullableValue\r\n active?: SubscribableOrNullableValue \r\n}\r\n\r\nexport interface WCCFancyboxBaseVMConfig {\r\n data: SubscribableOrNullableValue\r\n group?: SubscribableOrNullableValue\r\n options?: SubscribableOrNullableValue\r\n events?: FancyBoxOptions\r\n\r\n active?: SubscribableOrNullableValue\r\n\r\n validate?: Func\r\n}\r\n\r\n@injectable()\r\nexport default class WCCFancyboxBaseVM {\r\n private options: Subscribable\r\n private events: FancyBoxOptions\r\n private validate: Func\r\n\r\n ready = ko.pureComputed(() => true);\r\n isActive: Observable\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) rawConfig: T,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.effects) effects: EffectsContainer\r\n ) {\r\n const config = this.buildConfig(rawConfig);\r\n\r\n this.isActive = ko.isWritableObservable(config.active) ? >config.active : ko.observable(ko.unwrap(config.active) ?? false);\r\n this.options = ko.flattenComputed(config.options);\r\n this.events = config.events ?? {};\r\n this.validate = config.validate ?? defaultValidator;\r\n\r\n const groupName = ko.flattenComputed(config.group, _.uniqueId('fancybox-'));\r\n const data = ko.flattenComputed(config.data).extend({ deferred: true });\r\n\r\n const group = groupName.mapSingle(name => getOrCreateGroup(name));\r\n\r\n effects.register(group => {\r\n group.push(data);\r\n\r\n return [\r\n () => {\r\n ko.utils.arrayRemoveItem(group, data);\r\n cleanUpGroups();\r\n },\r\n\r\n withEffect(isActive => {\r\n if (isActive)\r\n return this.show(group, data);\r\n }, [this.isActive])\r\n ];\r\n }, [group]);\r\n\r\n effects.register(() => {\r\n const hammer = new Hammer(info.element);\r\n hammer.on('tap', () => this.onClick()); \r\n\r\n return () => hammer.destroy();\r\n });\r\n\r\n effects.register([\r\n DOMHelpers.onNodeEvent(info.element, 'wcc-fancybox.click', () => this.onClick())\r\n ]);\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'click': (m: any, e: JQueryEventObject) => {\r\n e.stopPropagation();\r\n return true;\r\n },\r\n\r\n 'css': {\r\n 'wcc-fancybox': true\r\n }\r\n });\r\n }\r\n\r\n protected buildConfig(rawConfig: T) {\r\n return {\r\n group: rawConfig.group,\r\n active: rawConfig.active,\r\n options: this.buildOptions(rawConfig)\r\n }\r\n }\r\n\r\n protected buildOptions(rawConfig: T) {\r\n return _(rawConfig).omit('$raw', 'group', 'active');\r\n }\r\n\r\n private show(group: Array>, item: Subscribable) {\r\n const items = ko.pureComputed(() => group.map(item => ko.unwrap(item)));\r\n const availableItems = items.filter(item => item != undefined);\r\n\r\n let oFocusedItem: Subscribable | undefined = item;\r\n\r\n return withEffect((items, item) => {\r\n if (items.length > 0) {\r\n if (oFocusedItem == undefined)\r\n oFocusedItem = group[0];\r\n\r\n let idx = items.findIndex(item => item.src == ko.unwrap(oFocusedItem)?.src);\r\n const isDisposed = ko.observable(false);\r\n\r\n const internalEvents = {\r\n afterShow: (instance, slide) => {\r\n oFocusedItem = group.find(item => ko.unwrap(item)?.src == slide.src);\r\n },\r\n\r\n afterClose: () => {\r\n if (!isDisposed()) {\r\n isDisposed(true);\r\n this.isActive(false); \r\n }\r\n }\r\n }\r\n\r\n const baseOptions = this.options();\r\n const events = this.events;\r\n\r\n const proxy = withProxy([internalEvents, baseOptions, events], allowedEvents);\r\n const options = _({}).extend(baseOptions, proxy);\r\n\r\n //fancybox writes shit to items so we have to copy them\r\n const instanceItems = items.map(i => _.clone(i));\r\n const instanceOptions = _.clone(options);\r\n\r\n const instance = $.fancybox.open(instanceItems, instanceOptions, idx);\r\n\r\n return () => {\r\n if (!isDisposed()) {\r\n isDisposed(true);\r\n (instance).close();\r\n }\r\n }\r\n }\r\n }, [availableItems, item]);\r\n }\r\n\r\n private onClick() {\r\n if (this.validate()) {\r\n if (this.isActive())\r\n this.isActive(false);\r\n\r\n this.isActive(true);\r\n }\r\n }\r\n}","import { Subscribable } from 'knockout';\r\n\r\nconst groups = new Map>>();\r\n\r\nexport function getOrCreateGroup(name: string) {\r\n let group = groups.get(name);\r\n\r\n if (group == undefined)\r\n groups.set(name, group = []);\r\n\r\n return group;\r\n}\r\n\r\nexport function cleanUpGroups() {\r\n const toRemove = >[];\r\n\r\n groups.forEach((value: Array, key: string) => {\r\n if (value.length == 0)\r\n toRemove.push(key);\r\n });\r\n\r\n toRemove.forEach(key => groups.delete(key));\r\n}\r\n\r\nexport function withProxy(items: Array, methods: Array) {\r\n return methods.reduce((result, method) => {\r\n (result)[method] = (...args: Array) => {\r\n items.forEach(item => {\r\n if (_.isFunction(item[method]))\r\n (item[method])(...args);\r\n });\r\n }\r\n\r\n return result;\r\n }, {});\r\n}","define([\n \"!!../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./iframe.html\", \n \"!../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","import { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { SubscribableOrNullableValue } from 'knockout';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport WCCFancyboxBaseVM, { WCCFancyboxBaseVMConfig, WCCFancyboxBaseVMConfigRaw } from './base';\r\nimport './iframe.html';\r\n\r\nexport interface WCCFancyboxIframeVMConfig extends WCCFancyboxBaseVMConfigRaw {\n src: SubscribableOrNullableValue\r\n caption?: SubscribableOrNullableValue\r\n}\n\n@injectable()\nexport default class WCCFancyboxIframeVM extends WCCFancyboxBaseVM {\n constructor(\n @inject(wccModules.componentConfig) config: WCCFancyboxIframeVMConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\n @inject(wccModules.effects) effects: EffectsContainer\n ) {\n super(config, info, effects);\n }\n\n protected override buildConfig(rawConfig: WCCFancyboxIframeVMConfig) {\n const oSrc = ko.flattenComputed(rawConfig.src);\r\n const oCaption = ko.flattenComputed(rawConfig.caption);\r\n\n return _({}).extend(super.buildConfig(rawConfig), {\r\n data: ko.pureComputed(() => ({\n src: oSrc(),\n type: 'iframe',\n opts: { \n caption: oCaption()\n }\n }))\r\n });\r\n }\n\n protected override buildOptions(rawConfig: WCCFancyboxIframeVMConfig) {\r\n return _(super.buildOptions(rawConfig)).omit('src', 'caption');\r\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, \".wcc-fancybox{display:block;cursor:pointer}.wcc-fancybox.inline{display:inline-block}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}