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,QAAQ,CAAC,CAAC,CAACC,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;MACtD,IAAI,CAACD,QAAQ,CAAC,CAAC,CAACC,EAAE,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IACtE;IAEAF,cAAcA,CAACL,IAAI,EAAE;MACjB,IAAI,CAACA,IAAI,CAACQ,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAC1B;MACJ;MAEA,MAAMC,KAAK,GAAG,6GAA6G;MAC3H,MAAMC,OAAO,GAAG,CAAC,GAAGV,IAAI,CAACW,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;MAC/C,MAAMG,mBAAmB,GAAG,yCAAyC,GAAGZ,IAAI,GAAG;AAC3F,gCAAgC,GAAGU,OAAO,GAAG;AAC7C;AACA,wCAAwC,GAAGA,OAAO,GAAG;AACrD;AACA,0DAA0D,GAAGA,OAAO,GAAG;AACvE;AACA;AACA,0BAA0B;MAEd,MAAMG,gBAAgB,GAAG,IAAI,CAAClB,GAAG,CAAC,cAAc,CAAC,CAACmB,GAAG,CAAC,CAAC;MAEvD,IAAID,gBAAgB,EAAE;QAClBA,gBAAgB,CAACE,SAAS,GAAGH,mBAAmB;MACpD;IACJ;IAEAI,oBAAoBA,CAACtB,IAAI,EAAE;MACvB,IAAIA,IAAI,EAAE;QACN,IAAI,CAACA,IAAI,CAAC,CAAC;QAEX,MAAMmB,gBAAgB,GAAG,IAAI,CAAClB,GAAG,CAAC,cAAc,CAAC,CAACmB,GAAG,CAAC,CAAC;QAEvD,IAAID,gBAAgB,EAAE;UAClBA,gBAAgB,CAACE,SAAS,GAAG,EAAE;QACnC;MACJ,CAAC,MAAM;QACH,IAAI,CAAClB,IAAI,CAAC,CAAC;MACf;IACJ;EACJ;EAEA,OAAOM,WAAW;AACtB","sources":["webpack://sfra-boilerplate/./cartridges/app_custom_core/cartridge/client/default/js/widgets/global/CuttableContent.js","webpack://sfra-boilerplate/./cartridges/app_custom_core/cartridge/client/default/js/widgets/global/TikTokVideo.js"],"sourcesContent":["import { debounce } from 'widgets/toolbox/debounce';\n\n/**\n * @typedef {typeof import('widgets/Widget').default} Widget\n */\n\n/**\n * @description Cuttable content implementation\n * @param {Widget} Widget Base widget for extending\n * @returns {typeof CuttableContent} CuttedContent class\n */\nexport default function (Widget) {\n    /**\n     * @class CuttableContent\n     * @augments Widget\n     */\n    class CuttableContent extends Widget {\n        prefs() {\n            return {\n                moreClass: 'm-show-more',\n                activeClass: 'm-cut-active',\n                showMore: '',\n                showLess: '',\n                maxHeight: 0,\n                useLess: true,\n                ...super.prefs()\n            };\n        }\n\n        init() {\n            this.toggleButton();\n\n            this.opened = false;\n\n            this.ev('resize', debounce(this.toggleButton.bind(this), 200), window);\n        }\n\n        onRefresh() {\n            this.toggleButton();\n        }\n\n        toggleButton() {\n            this.has('button', button => {\n                this.has('content', content => {\n                    if (this.prefs().maxHeight && this.prefs().maxHeight > content.prop('scrollHeight')) {\n                        button.hide();\n                        this.ref('self').removeClass(this.prefs().activeClass);\n                    } else if (!this.prefs().useLess || !this.opened) {\n                        button.show();\n                        this.ref('self').addClass(this.prefs().activeClass);\n                    }\n                });\n            });\n        }\n\n        toggleContent(link) {\n            const prefs = this.prefs();\n\n            this.has('content', content => content.toggleClass(prefs.moreClass));\n\n            if (this.prefs().useLess) {\n                link.setText(this.opened ? prefs.showMore : prefs.showLess);\n            } else if (!this.opened) {\n                link.hide();\n            }\n\n            this.opened = !this.opened;\n        }\n    }\n\n    return CuttableContent;\n}\n","/* eslint-disable no-useless-escape */\n/**\n * @typedef {typeof import('widgets/Widget').default} Widget\n */\n\n/**\n * @description TikTok Video implementation\n * @param {Widget} Widget Base widget for extending\n * @returns {typeof TikTokVideo} TikTokVideo class\n */\nexport default function (Widget) {\n    /**\n     * @class TikTokVideo\n     * @augments Widget\n     */\n    class TikTokVideo extends Widget {\n        prefs() {\n            return {\n                videoLink: '',\n                ...super.prefs()\n            };\n        }\n\n        init() {\n            this.addTiktokVideo(this.prefs().videoLink);\n\n            this.eventBus().on('addTiktokVideo', 'addTiktokVideo');\n            this.eventBus().on('hideTiktokVideoBlock', 'hideTiktokVideoBlock');\n        }\n\n        addTiktokVideo(link) {\n            if (!link.includes('tiktok')) {\n                return;\n            }\n\n            const regex = /\\bhttps?:\\/\\/(?:m|www|vm)\\.tiktok\\.com\\/.*\\b(?:(?:usr|v|embed|user|video)\\/|\\?shareId=|\\&item_id=)(\\d+)\\b/gm;\n            const videoId = [...link.matchAll(regex)][0][1];\n            const newTiktokVideoBlock = '<blockquote class=\"tiktok-embed\" cite=\"' + link + `\" \n                data-video-id=\"` + videoId + `\" style=\"max-width: 605px; min-width: 325px;\">\n                <iframe\n                    name=\"__tt_embed__v` + videoId + `\"\n                    sandbox=\"allow-popups allow-popups-to-escape-sandbox allow-scripts allow-top-navigation allow-same-origin\"\n                    src=\"https://www.tiktok.com/embed/v2/` + videoId + `?lang=en-US&amp;\"\n                    style=\"width: 100%; height: 707px; display: block; visibility: unset; max-height: 707px;\"\n                ></iframe>   \n            </blockquote>`;\n\n            const tiktokVideoBlock = this.ref('tiktok_block').get();\n\n            if (tiktokVideoBlock) {\n                tiktokVideoBlock.innerHTML = newTiktokVideoBlock;\n            }\n        }\n\n        hideTiktokVideoBlock(hide) {\n            if (hide) {\n                this.hide();\n\n                const tiktokVideoBlock = this.ref('tiktok_block').get();\n\n                if (tiktokVideoBlock) {\n                    tiktokVideoBlock.innerHTML = '';\n                }\n            } else {\n                this.show();\n            }\n        }\n    }\n\n    return TikTokVideo;\n}\n"],"names":["debounce","Widget","CuttableContent","prefs","moreClass","activeClass","showMore","showLess","maxHeight","useLess","init","toggleButton","opened","ev","bind","window","onRefresh","has","button","content","prop","hide","ref","removeClass","show","addClass","toggleContent","link","toggleClass","setText","TikTokVideo","videoLink","addTiktokVideo","eventBus","on","includes","regex","videoId","matchAll","newTiktokVideoBlock","tiktokVideoBlock","get","innerHTML","hideTiktokVideoBlock"],"sourceRoot":""}