Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

richlagetest

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

richlagetest - npm Package Compare versions

Comparing version 0.0.0-cd11ad4d1c76444307ba64ac27800685d0a4de3f to 0.0.0-cf9ac0ce2a6bd3c445354274ff57eb934974f601

dist/loadable/viewer/cjs/button-component.cjs.js

8

dist/loadable/viewer/cjs/viewer-loadable.cjs.js

@@ -1,5 +0,3 @@

"use strict";var _extends=require("@babel/runtime/helpers/extends"),loadable=require("@loadable/component"),wixRichContentCommon=require("wix-rich-content-common");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),loadable__default=_interopDefaultLegacy(loadable),VIDEO_TYPE="wix-draft-plugin-video",VIDEO_TYPE_LEGACY="VIDEO-EMBED",DEFAULTS={config:{toolbar:{hidden:[]}},configViewer:{getVideoUrl:function(src){return"https://video.wixstatic.com/"+src.pathname}}},styles={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},containerClassName=function(theme){return wixRichContentCommon.mergeStyles({styles:styles,theme:theme}).video_container},typeMapper=function typeMapper(){var _ref;return _ref={},_ref[VIDEO_TYPE_LEGACY]={component:loadable__default.default({resolved:{},chunkName:function(){return"video-viewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return Promise.resolve().then((function(){return require(
/* webpackChunkName: "video-viewer" */
"./video-viewer.cjs.js")}))},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./video-viewer"):eval("require.resolve")("./video-viewer")}}),classNameStrategies:{container:containerClassName}},_ref[VIDEO_TYPE]={component:loadable__default.default({resolved:{},chunkName:function(){return"video-viewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return Promise.resolve().then((function(){return require(
/* webpackChunkName: "video-viewer" */
"./video-viewer.cjs.js")}))},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./video-viewer"):eval("require.resolve")("./video-viewer")}}),classNameStrategies:{container:containerClassName}},_ref},pluginVideo=function(config){return{config:_extends__default.default({},DEFAULTS.configViewer,config),type:VIDEO_TYPE,typeMapper:typeMapper}};exports.VIDEO_TYPE=VIDEO_TYPE,exports.pluginVideo=pluginVideo,exports.styles=styles,exports.typeMapper=typeMapper;
"use strict";var _extends=require("@babel/runtime/helpers/extends"),classnames=require("classnames"),lodash=require("lodash"),wixRichContentCommon=require("wix-rich-content-common"),loadable=require("@loadable/component");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),classnames__default=_interopDefaultLegacy(classnames),loadable__default=_interopDefaultLegacy(loadable),LINK_BUTTON_TYPE="wix-draft-plugin-link-button",ACTION_BUTTON_TYPE="wix-draft-plugin-action-button",alignmentStyles={button_align_left:"_20daj",button_align_right:"_308Nj",button_align_center:"_3ZwKi"},Styles={button_container:"iRkxq",button_text:"_3Ybc9",button_size_content:"_1eLXB"},alignmentClassName=function(componentData,theme,styles){var _ref$alignment=(componentData.config||{}).alignment,alignment=void 0===_ref$alignment?"center":_ref$alignment,mergedStyles=wixRichContentCommon.mergeStyles({styles:alignmentStyles,theme:theme});return classnames__default.default(mergedStyles["button_align_"+alignment],styles["align"+lodash.upperFirst(alignment)],theme["align"+lodash.upperFirst(alignment)])},sizeClassName=function(componentData,theme){return wixRichContentCommon.mergeStyles({styles:Styles,theme:theme}).button_size_content},buttonTypeObj={component:loadable__default.default({resolved:{},chunkName:function(){return"components-button-component"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return Promise.resolve().then((function(){return require(
/* webpackChunkName: "components-button-component" */
"./button-component.cjs.js")}))},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./components/button-component"):eval("require.resolve")("./components/button-component")}}),classNameStrategies:{alignment:alignmentClassName,size:sizeClassName}},typeMapper=function(){var _ref;return(_ref={})[LINK_BUTTON_TYPE]=_extends__default.default({},buttonTypeObj),_ref[ACTION_BUTTON_TYPE]=_extends__default.default({},buttonTypeObj),_ref},ALIGN_CENTER="center";Object.freeze({TEXT_COLOR:"textColor",BORDER_COLOR:"borderColor",BACKGROUND_COLOR:"backgroundColor"});var DEFAULT_CONFIG={alignment:ALIGN_CENTER,size:"small",width:"fit-content"},pluginButton=function(type,config){return{config:_extends__default.default({},DEFAULT_CONFIG,config),type:type,typeMapper:typeMapper}},pluginLinkButton=function(config){return pluginButton(LINK_BUTTON_TYPE,config)},pluginActionButton=function(config){return pluginButton(ACTION_BUTTON_TYPE,config)};exports.ACTION_BUTTON_TYPE=ACTION_BUTTON_TYPE,exports.LINK_BUTTON_TYPE=LINK_BUTTON_TYPE,exports.Styles=Styles,exports.alignmentClassName=alignmentClassName,exports.pluginActionButton=pluginActionButton,exports.pluginLinkButton=pluginLinkButton,exports.sizeClassName=sizeClassName,exports.typeMapper=typeMapper;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("@babel/runtime/helpers/extends");var viewerLoadable=require("./viewer-loadable.cjs.js");require("@loadable/component"),require("wix-rich-content-common"),exports.VIDEO_TYPE=viewerLoadable.VIDEO_TYPE,exports.pluginVideo=viewerLoadable.pluginVideo,exports.videoTypeMapper=viewerLoadable.typeMapper;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("@babel/runtime/helpers/extends");var viewerLoadable=require("./viewer-loadable.cjs.js");require("classnames"),require("lodash"),require("wix-rich-content-common"),require("@loadable/component"),exports.ACTION_BUTTON_TYPE=viewerLoadable.ACTION_BUTTON_TYPE,exports.LINK_BUTTON_TYPE=viewerLoadable.LINK_BUTTON_TYPE,exports.buttonTypeMapper=viewerLoadable.typeMapper,exports.pluginActionButton=viewerLoadable.pluginActionButton,exports.pluginLinkButton=viewerLoadable.pluginLinkButton;

@@ -1,1 +0,1 @@

import"@babel/runtime/helpers/extends";export{V as VIDEO_TYPE,p as pluginVideo,t as videoTypeMapper}from"./viewer-loadable2.js";import"@loadable/component";import"wix-rich-content-common";
import"@babel/runtime/helpers/extends";export{A as ACTION_BUTTON_TYPE,L as LINK_BUTTON_TYPE,t as buttonTypeMapper,b as pluginActionButton,p as pluginLinkButton}from"./viewer-loadable2.js";import"classnames";import"lodash";import"wix-rich-content-common";import"@loadable/component";

@@ -1,5 +0,3 @@

import _extends from"@babel/runtime/helpers/extends";import loadable from"@loadable/component";import{mergeStyles}from"wix-rich-content-common";var VIDEO_TYPE="wix-draft-plugin-video",VIDEO_TYPE_LEGACY="VIDEO-EMBED",DEFAULTS={config:{toolbar:{hidden:[]}},configViewer:{getVideoUrl:function(src){return"https://video.wixstatic.com/"+src.pathname}}},styles={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},containerClassName=function(theme){return mergeStyles({styles:styles,theme:theme}).video_container},typeMapper=function typeMapper(){var _ref;return _ref={},_ref[VIDEO_TYPE_LEGACY]={component:loadable({resolved:{},chunkName:function(){return"video-viewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return import(
/* webpackChunkName: "video-viewer" */
"./video-viewer.js")},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./video-viewer"):eval("require.resolve")("./video-viewer")}}),classNameStrategies:{container:containerClassName}},_ref[VIDEO_TYPE]={component:loadable({resolved:{},chunkName:function(){return"video-viewer"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return import(
/* webpackChunkName: "video-viewer" */
"./video-viewer.js")},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./video-viewer"):eval("require.resolve")("./video-viewer")}}),classNameStrategies:{container:containerClassName}},_ref},pluginVideo=function(config){return{config:_extends({},DEFAULTS.configViewer,config),type:VIDEO_TYPE,typeMapper:typeMapper}};export{VIDEO_TYPE as V,pluginVideo as p,styles as s,typeMapper as t};
import _extends from"@babel/runtime/helpers/extends";import classnames from"classnames";import{upperFirst}from"lodash";import{mergeStyles}from"wix-rich-content-common";import loadable from"@loadable/component";var LINK_BUTTON_TYPE="wix-draft-plugin-link-button",ACTION_BUTTON_TYPE="wix-draft-plugin-action-button",alignmentStyles={button_align_left:"_20daj",button_align_right:"_308Nj",button_align_center:"_3ZwKi"},Styles={button_container:"iRkxq",button_text:"_3Ybc9",button_size_content:"_1eLXB"},alignmentClassName=function(componentData,theme,styles){var _ref$alignment=(componentData.config||{}).alignment,alignment=void 0===_ref$alignment?"center":_ref$alignment,mergedStyles=mergeStyles({styles:alignmentStyles,theme:theme});return classnames(mergedStyles["button_align_"+alignment],styles["align"+upperFirst(alignment)],theme["align"+upperFirst(alignment)])},sizeClassName=function(componentData,theme){return mergeStyles({styles:Styles,theme:theme}).button_size_content},buttonTypeObj={component:loadable({resolved:{},chunkName:function(){return"components-button-component"},isReady:function(props){var key=this.resolve(props);return!0===this.resolved[key]&&("undefined"!=typeof __webpack_modules__&&!!__webpack_modules__[key])},importAsync:function(){return import(
/* webpackChunkName: "components-button-component" */
"./button-component.js")},requireAsync:function(props){var _this=this,key=this.resolve(props);return this.resolved[key]=!1,this.importAsync(props).then((function(resolved){return _this.resolved[key]=!0,resolved}))},requireSync:function requireSync(props){var id=this.resolve(props);return"undefined"!=typeof __webpack_require__?__webpack_require__(id):eval("module.require")(id)},resolve:function resolve(){return require.resolveWeak?require.resolveWeak("./components/button-component"):eval("require.resolve")("./components/button-component")}}),classNameStrategies:{alignment:alignmentClassName,size:sizeClassName}},typeMapper=function(){var _ref;return(_ref={})[LINK_BUTTON_TYPE]=_extends({},buttonTypeObj),_ref[ACTION_BUTTON_TYPE]=_extends({},buttonTypeObj),_ref},ALIGN_CENTER="center";Object.freeze({TEXT_COLOR:"textColor",BORDER_COLOR:"borderColor",BACKGROUND_COLOR:"backgroundColor"});var DEFAULT_CONFIG={alignment:ALIGN_CENTER,size:"small",width:"fit-content"},pluginButton=function(type,config){return{config:_extends({},DEFAULT_CONFIG,config),type:type,typeMapper:typeMapper}},pluginLinkButton=function(config){return pluginButton(LINK_BUTTON_TYPE,config)},pluginActionButton=function(config){return pluginButton(ACTION_BUTTON_TYPE,config)};export{ACTION_BUTTON_TYPE as A,LINK_BUTTON_TYPE as L,Styles as S,alignmentClassName as a,pluginActionButton as b,pluginLinkButton as p,sizeClassName as s,typeMapper as t};

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),React=require("react"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),wixRichContentUiComponents=require("wix-rich-content-ui-components"),wixRichContentCommon=require("wix-rich-content-common"),ReactPlayer=require("react-player"),classNames=require("classnames"),ReactDOM=require("react-dom"),lodash=require("lodash"),_assertThisInitialized=require("@babel/runtime/helpers/assertThisInitialized"),pluginVideoSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-video.schema.json"),toDraftData=require("ricos-content/libs/toDraftData"),ricosContent=require("ricos-content");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _ModalsMap,_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),ReactPlayer__default=_interopDefaultLegacy(ReactPlayer),classNames__default=_interopDefaultLegacy(classNames),ReactDOM__default=_interopDefaultLegacy(ReactDOM),_assertThisInitialized__default=_interopDefaultLegacy(_assertThisInitialized),pluginVideoSchema__default=_interopDefaultLegacy(pluginVideoSchema),InsertPluginIcon$1=function(props){return React__default.default.createElement("svg",Object.assign({xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 19 19",width:"19",height:"19"},props),React__default.default.createElement("defs",null,React__default.default.createElement("path",{id:"video-icon-path",d:"M14 7l2.842-1.421A.8.8 0 0 1 18 6.294v6.412a.8.8 0 0 1-1.158.715L14 12v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11a1 1 0 0 1 1 1v2zm0 3.9l2.708 1.354a.2.2 0 0 0 .29-.179V6.922a.2.2 0 0 0-.29-.178L14 8.098V10.9zM2 5v9h11V5H2z"})),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("mask",{id:"video-icon-mask"},React__default.default.createElement("use",{xlinkHref:"#video-icon-path"})),React__default.default.createElement("use",{fillRule:"nonzero",xlinkHref:"#video-icon-path"})))},InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19"},props),React__default.default.createElement("path",{d:"M5.2,9 L5.8,9 C5.9104569,9 6,9.05969537 6,9.13333333 L6,14.8666667 C6,14.9403046 5.9104569,15 5.8,15 L5.2,15 C5.0895431,15 5,14.9403046 5,14.8666667 L5,9.13333333 C5,9.05969537 5.0895431,9 5.2,9 Z M3.2,8 L3.8,8 C3.9104569,8 4,8.06268014 4,8.14 L4,14.86 C4,14.9373198 3.9104569,15 3.8,15 L3.2,15 C3.0895431,15 3,14.9373198 3,14.86 L3,8.14 C3,8.06268014 3.0895431,8 3.2,8 Z M1.2,10 L1.8,10 C1.91045695,10 2,10.0447715 2,10.1 L2,13.9 C2,13.9552284 1.91045695,14 1.8,14 L1.2,14 C1.08954305,14 1,13.9552284 1,13.9 L1,10.1 C1,10.0447715 1.08954305,10 1.2,10 Z M18,11.6153846 C18,13.4846561 16.4846561,15 14.6153846,15 L7.84615385,15 C7.37883602,15 7,14.621164 7,14.1538462 L7,4.84615385 C8.1282051,4.28205128 9.39743587,4 10.8076923,4 C12.9089391,4 15.0384615,6.12783884 15.0384615,8.23076923 C16.7079981,8.4650878 18,9.8893546 18,11.6153846 Z M8,14 L14.5454545,14 C15.9010625,14 17,12.9010625 17,11.5454545 C17,10.3050264 16.0718944,9.25574738 14.8408286,9.08296796 L14.1363636,8.98409667 L14.1363636,8.27272727 C14.1363636,6.69177453 12.4441412,5 10.8636364,5 C9.81175629,5 8.85922746,5.17619715 8,5.52684396 L8,14 Z"}))},MediaReplaceIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlnsXlink:"http://www.w3.org/1999/xlink",width:19,height:19,viewBox:"0 0 19 19"},props),React__default.default.createElement("defs",null,React__default.default.createElement("path",{id:"replace-path",d:"M3 7.8V3.2c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2v2.592A6.607 6.607 0 0 1 9.412 3C13.05 3 16 5.91 16 9.5c0 .168-.006.335-.02.5h-1.016a5.51 5.51 0 0 0 .022-.5c0-3.038-2.495-5.5-5.574-5.5a5.583 5.583 0 0 0-4.967 3H7.8c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H3.2a.2.2 0 0 1-.2-.2zm13 3.4v4.6a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2v-2.592A6.607 6.607 0 0 1 9.588 16C5.95 16 3 13.09 3 9.5c0-.168.006-.335.02-.5h1.016a5.496 5.496 0 0 0-.022.5c0 3.038 2.495 5.5 5.574 5.5a5.583 5.583 0 0 0 4.967-3H11.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2h4.6c.11 0 .2.09.2.2z"})),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("mask",{id:"replace-mask"},React__default.default.createElement("use",{xlinkHref:"#replace-path"})),React__default.default.createElement("use",{fillRule:"nonzero",xlinkHref:"#replace-path"})))},YoutubeIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19"},props),React__default.default.createElement("path",{fillRule:"evenodd",d:"M9.783 3.126c1.117.006 5.217.049 6.359.357.731.196 1.307.776 1.503 1.512C18 6.33 18 9.114 18 9.114s0 2.784-.355 4.118c-.196.736-.772 1.316-1.503 1.513-1.215.327-5.784.355-6.537.357h-.21c-.753-.002-5.322-.03-6.537-.357-.731-.197-1.307-.777-1.503-1.513-.317-1.191-.35-3.538-.355-4.028v-.181c.004-.49.038-2.836.355-4.028.196-.736.772-1.316 1.503-1.512C4 3.175 8.1 3.132 9.218 3.126zM7.76 6.586v5.055l4.444-2.527L7.76 6.586z"}))},styles$3={video_modal_container_big:"_4hyfK",video_modal_container_small:"Wdxcn",video_modal_closeIcon:"_1P3Vk",video_modal_errorIcon:"_4U647",video_modal_header:"_2wuD-",video_modal_header_text:"_35sJQ",video_modal_textInput_customWidth:"_167aE",video_modal_textInput_fullWidth:"cn4jv",video_modal_add_a_Video:"_30xCH",video_modal_or_upload_video_from:"_3Q6uE",video_modal_upload_video:"_20AZa",video_modal_input_button_wrapper:"EmpUt",video_modal_add_button_wrapper:"P3PzB",video_modal_add_button_inline:"_2Z_Pe",video_modal_add_button_inMiddle:"_3TrUw",textInput_input:"_1cb7K",textInput_input_invalid:"_1P6p9",fileInput:"_1qYoT",fileInputLabel:"_30dNJ"},VIDEO_TYPE="wix-draft-plugin-video",videoButtonsTypes={video:"video",soundCloud:"soundCloud",youTube:"youTube"},mediaTypes=[videoButtonsTypes.soundCloud,videoButtonsTypes.youTube],VideoSelectionInputModal=function(_Component){function VideoSelectionInputModal(props){var _this;(_this=_Component.call(this,props)||this).onUrlChange=function(url){return _this.setState({url:url,showError:!1})},_this.onUrlVideoSelection=function(){var _helpers$onVideoSelec,_this$props=_this.props,componentData=_this$props.componentData,helpers=_this$props.helpers,_this$state$url=_this.state.url,src=(void 0===_this$state$url?"":_this$state$url).trim();if(wixRichContentCommon.isValidExactUrl(src)&&ReactPlayer__default.default.canPlay(src)){delete componentData.isCustomVideo;var data=_extends__default.default({},componentData,{tempData:!1,src:src});_this.onConfirm(data),null==helpers||null===(_helpers$onVideoSelec=helpers.onVideoSelected)||void 0===_helpers$onVideoSelec||_helpers$onVideoSelec.call(helpers,src,(function(metadata){return setTimeout((function(){return _this.updateComponentData(_extends__default.default({},data,{metadata:metadata}))}))}),0),_this.closeModal()}else _this.setState({showError:!0})},_this.onUrlInputDoubleClick=function(){_this.setState({url:"https://www.youtube.com/watch?v=vzKryaN44ss"})},_this.closeModal=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.handleKeyPress=function(e){e.charCode===wixRichContentEditorCommon.KEYS_CHARCODE.ENTER&&_this.onUrlVideoSelection()},_this.getOnUploadFinished=function(isCustomVideo){return function(_ref){var data=_ref.data,error=_ref.error;_this.setComponentData(_extends__default.default({},data,{error:error,isCustomVideo:isCustomVideo}))}},_this.addVideoComponent=function(_ref2,isCustomVideo){var data=_ref2.data,error=_ref2.error;void 0===isCustomVideo&&(isCustomVideo=!1),wixRichContentPluginCommons.handleUploadFinished(VIDEO_TYPE,_this.getComponentData,data,error,(function(_ref3){var data=_ref3.data,error=_ref3.error;return _this.onConfirm(_extends__default.default({},data,{error:error,isCustomVideo:isCustomVideo}))}))},_this.setComponentData=function(data){_this.props.pubsub.set("componentData",data,_this.blockKey)},_this.updateComponentData=function(data){_this.props.pubsub.update("componentData",data,_this.blockKey)},_this.onLocalLoad=function(_ref4){var src=_ref4.src,tempData=_ref4.tempData;_this.onConfirm(_extends__default.default({},_this.props.componentData,{src:src,isCustomVideo:!0,tempData:tempData}))},_this.getComponentData=function(){return _this.props.componentData},_this.handleNativeFileUpload=function(){wixRichContentPluginCommons.handleUploadStart(_this.props,_this.getComponentData,_this.inputFile.files[0],_this.onLocalLoad,_this.getOnUploadFinished(!0)),_this.closeModal()},_this.styles=wixRichContentCommon.mergeStyles({styles:styles$3,theme:props.theme});var _componentData=_this.props.componentData;_this.state={url:!_componentData.isCustomVideo&&_componentData.src||""},_this.id="VideoUploadModal_FileInput_"+Math.floor(9999*Math.random());var onConfirm=props.onConfirm,onReplace=props.onReplace;return _this.blockKey=_this.getFocusedBlockKey(),_this.onConfirm=function(obj){if(onConfirm){var newBlock=onConfirm(obj).newBlock;_this.blockKey=newBlock.key}else onReplace(obj,_this.blockKey)},_this}_inheritsLoose__default.default(VideoSelectionInputModal,_Component);var _proto=VideoSelectionInputModal.prototype;return _proto.getFocusedBlockKey=function(){return this.props.pubsub.get("focusedBlock")},_proto.componentDidMount=function(){this.input.focus(),this.input.setSelectionRange(0,this.input.value.length)},_proto.render=function(){var _this2=this,_this$state=this.state,url=_this$state.url,showError=_this$state.showError,_this$props2=this.props,t=_this$props2.t,handleFileSelection=_this$props2.handleFileSelection,handleFileUpload=_this$props2.handleFileUpload,enableCustomUploadOnMobile=_this$props2.enableCustomUploadOnMobile,isMobile=_this$props2.isMobile,languageDir=_this$props2.languageDir;_this$props2.componentData;var handleClick,theme=_this$props2.theme,styles=this.styles,hasCustomFileUpload=handleFileUpload||handleFileSelection;handleFileSelection&&(handleClick=function(evt){return evt.preventDefault(),handleFileSelection((function(_ref5){var data=_ref5.data,error=_ref5.error;_this2.addVideoComponent({data:data,error:error},!0),_this2.closeModal()}))});var uploadVideoSection=React__default.default.createElement("div",null,React__default.default.createElement("div",{className:styles.video_modal_or_upload_video_from},t("VideoUploadModal_CustomVideoHeader")),React__default.default.createElement("div",{className:styles.video_modal_upload_video},React__default.default.createElement("input",{id:this.id,type:"file",accept:"video/*",className:styles.fileInput,ref:function(node){return _this2.inputFile=node},onClick:handleClick,onChange:this.handleNativeFileUpload}),React__default.default.createElement("label",{htmlFor:this.id,className:styles.fileInputLabel,role:"button","data-hook":"videoUploadModalCustomVideo",tabIndex:0},"+ ",t("VideoUploadModal_CustomVideoClickText"))));return React__default.default.createElement("div",{dir:languageDir},React__default.default.createElement("div",{className:styles["video_modal_container_"+(hasCustomFileUpload?"big":"small")],"data-hook":"videoUploadModal"},React__default.default.createElement(wixRichContentUiComponents.CloseIcon,{className:styles.video_modal_closeIcon,onClick:function(){return _this2.closeModal()}}),React__default.default.createElement("h2",{className:styles.video_modal_add_a_Video},t("VideoUploadModal_Title")),React__default.default.createElement("div",{role:"heading","aria-level":3,"aria-labelledby":"video_modal_hdr",className:styles.video_modal_header},React__default.default.createElement("h3",{id:"video_modal_hdr",className:styles.video_modal_header_text},t("VideoUploadModal_Header"))),React__default.default.createElement("div",{className:styles.video_modal_input_button_wrapper},React__default.default.createElement("div",{className:styles["video_modal_textInput_"+(hasCustomFileUpload?"customWidth":"fullWidth")]},React__default.default.createElement(wixRichContentUiComponents.TextInput,{inputRef:function(ref){_this2.input=ref},type:"url",onKeyPress:this.handleKeyPress,onChange:this.onUrlChange,onDoubleClick:this.onUrlInputDoubleClick,value:url,error:showError?t("VideoUploadModal_Input_InvalidUrl"):null,placeholder:t("VideoUploadModal_Input_Placeholder"),theme:styles,"data-hook":"videoUploadModalInput"})),React__default.default.createElement("div",{className:styles.video_modal_add_button_wrapper},React__default.default.createElement(wixRichContentUiComponents.Button,{disabled:!this.state.url,theme:_extends__default.default({},styles,theme),dataHook:"videoUploadModalAddButton",onClick:this.onUrlVideoSelection,text:t("VideoUploadModal_AddButtonText"),size:isMobile?wixRichContentUiComponents.BUTTON_SIZE.medium:wixRichContentUiComponents.BUTTON_SIZE.small}))),(!isMobile||enableCustomUploadOnMobile)&&hasCustomFileUpload&&uploadVideoSection))},VideoSelectionInputModal}(React.Component),Styles={separator:"_3hKgB",videoSettingsTitle:"_31P16",videoSettings_toggleContainer:"_3RIrx",videoSettings_mobile:"_13GtL"},Modals={VIDEO_SELECTION_INPUT:"video-selection-input",VIDEO_SETTINGS:"video-settings"},ModalsMap=((_ModalsMap={})[Modals.VIDEO_SELECTION_INPUT]=VideoSelectionInputModal,_ModalsMap[Modals.VIDEO_SETTINGS]=function(_ref){var _componentData$config,_componentData$config2,_classNames,componentData=_ref.componentData,helpers=_ref.helpers,pubsub=_ref.pubsub,theme=_ref.theme,t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,disableDownload=void 0!==componentData.disableDownload?componentData.disableDownload:!!settings.disableDownload,isSpoilered=null===(_componentData$config=componentData.config)||void 0===_componentData$config||null===(_componentData$config2=_componentData$config.spoiler)||void 0===_componentData$config2?void 0:_componentData$config2.enabled,_useState=React.useState(!disableDownload),isDownloadEnabled=_useState[0],setIsDownloadEnabled=_useState[1],_useState2=React.useState(isSpoilered),isSpoilerEnabled=_useState2[0],setIsSpoilerEnabled=_useState2[1],styles=wixRichContentCommon.mergeStyles({styles:Styles,theme:theme}),closeModal=function(){var _helpers$closeModal;return null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal?void 0:_helpers$closeModal.call(helpers)},getSpoilerConfig=function(enabled){return{config:_extends__default.default({},componentData.config,{spoiler:{enabled:enabled}})}},onDoneClick=function(){var newComponentData=_extends__default.default({},componentData,{disableDownload:!isDownloadEnabled},getSpoilerConfig(isSpoilerEnabled));pubsub.update("componentData",newComponentData),closeModal()},isCustomVideo=!!componentData.isCustomVideo,spoilerToggle={toggleKey:"isSpoilerEnabled",labelKey:"VideoSettings_Spoiler_Toggle",dataHook:"videoSpoilerToggle",tooltipText:"Spoiler_Toggle_Tooltip",checked:isSpoilerEnabled,onToggle:function(){var value=!isSpoilerEnabled;setIsSpoilerEnabled(value),pubsub.update("componentData",_extends__default.default({},componentData,getSpoilerConfig(value)))}},toggleData=isCustomVideo?[{toggleKey:"isDownloadEnabled",labelKey:"VideoPlugin_Settings_VideoCanBeDownloaded_Label",dataHook:"videoDownloadToggle",tooltipText:"VideoPlugin_Settings_VideoCanBeDownloaded_Tooltip",checked:isDownloadEnabled,onToggle:function(){return setIsDownloadEnabled(!isDownloadEnabled)}}]:[];return settings.spoiler&&toggleData.push(spoilerToggle),React__default.default.createElement("div",{"data-hook":"settings",className:classNames__default.default(styles.videoSettings,(_classNames={},_classNames[styles.videoSettings_mobile]=isMobile,_classNames))},isMobile?React__default.default.createElement(wixRichContentUiComponents.SettingsMobileHeader,{t:t,theme:theme,onCancel:closeModal,onSave:onDoneClick}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:styles.videoSettingsTitle},t("VideoPlugin_Settings_Header")),React__default.default.createElement("div",{className:styles.separator})),React__default.default.createElement(wixRichContentUiComponents.SettingsSection,{theme:theme,className:classNames__default.default(styles.videoSettings_toggleContainer)},toggleData.map((function(_ref2){var toggleKey=_ref2.toggleKey,labelKey=_ref2.labelKey,tooltipText=_ref2.tooltipText,dataHook=_ref2.dataHook,onToggle=_ref2.onToggle,checked=_ref2.checked;return React__default.default.createElement(wixRichContentUiComponents.LabeledToggle,{key:toggleKey,theme:theme,checked:checked,label:t(labelKey),onChange:onToggle,tooltipText:t(tooltipText),dataHook:dataHook})}))),!isMobile&&React__default.default.createElement(wixRichContentUiComponents.SettingsPanelFooter,{fixed:!0,theme:theme,cancel:closeModal,save:onDoneClick,t:t}))},_ModalsMap),MediaURLInputModal$1=function(_Component){function MediaURLInputModal(props){var _this;(_this=_Component.call(this,props)||this).onConfirm=function(){var url=_this.state.url;if(url&&ReactPlayer__default.default.canPlay(url)){var _helpers$closeModal,_this$props=_this.props,_componentData=_this$props.componentData,helpers=_this$props.helpers,pubsub=_this$props.pubsub,onConfirm=_this$props.onConfirm;onConfirm?onConfirm(_extends__default.default({},_componentData,{src:url})):pubsub.update("componentData",{src:url}),helpers&&helpers.onVideoSelected&&helpers.onVideoSelected(url,(function(data){return pubsub.update("componentData",{metadata:_extends__default.default({},data)})})),null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers)}else _this.setState({submittedInvalidUrl:!0})},_this.getRenderData=function(){var _this$props2=_this.props,t=_this$props2.t,isMobile=_this$props2.isMobile,type=_this$props2.componentData.type,isYouTube=type===videoButtonsTypes.youTube,isSoundCloud=type===videoButtonsTypes.soundCloud;return{title:isYouTube?"EmbedURL_Social_YouTube_Title":isSoundCloud&&(isMobile?"SoundCloudUploadModal_Header_Mobile":"SoundCloudUploadModal_Header"),placeholder:isYouTube?t("EmbedURL_Social_YouTube_Placeholder"):isSoundCloud&&t("SoundCloudUploadModal_Input_Placeholder"),dataHook:isYouTube?"socialEmbedUploadModal":isSoundCloud?"soundCloudUploadModal":""}};var componentData=_this.props.componentData;return _this.state={url:componentData.src||"",submittedInvalidUrl:!1},_this}return _inheritsLoose__default.default(MediaURLInputModal,_Component),MediaURLInputModal.prototype.render=function(){var _this2=this,_this$state=this.state,url=_this$state.url,submittedInvalidUrl=_this$state.submittedInvalidUrl,_this$props3=this.props,t=_this$props3.t,languageDir=_this$props3.languageDir,helpers=_this$props3.helpers,_this$getRenderData=this.getRenderData(),title=_this$getRenderData.title,placeholder=_this$getRenderData.placeholder,dataHook=_this$getRenderData.dataHook;return React__default.default.createElement(wixRichContentUiComponents.UrlInputModal,{onConfirm:this.onConfirm,input:url,t:t,languageDir:languageDir,title:t(""+title),submittedInvalidUrl:submittedInvalidUrl,dataHook:dataHook,onInputChange:function(url){return _this2.setState({url:url})},errorMessage:t("SoundCloudUploadModal_Input_InvalidUrl"),placeholder:placeholder,onCloseRequested:helpers.closeModal,buttonSize:wixRichContentUiComponents.BUTTON_SIZE.medium})},MediaURLInputModal}(React.Component),VideoUploadModal=function(_Component){function VideoUploadModal(props){var _this;(_this=_Component.call(this,props)||this).closeModal=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.getOnUploadFinished=function(isCustomVideo){return function(_ref){var data=_ref.data,error=_ref.error;_this.setComponentData(_extends__default.default({},data,{error:error,isCustomVideo:isCustomVideo}))}},_this.addVideoComponent=function(_ref2,isCustomVideo){var data=_ref2.data,error=_ref2.error;void 0===isCustomVideo&&(isCustomVideo=!1),wixRichContentPluginCommons.handleUploadFinished(VIDEO_TYPE,_this.getComponentData,data,error,(function(_ref3){var data=_ref3.data,error=_ref3.error;return _this.onConfirm(_extends__default.default({},data,{error:error,isCustomVideo:isCustomVideo}))}))},_this.setComponentData=function(data){_this.props.pubsub.set("componentData",data,_this.blockKey)},_this.onLocalLoad=function(_ref4){var src=_ref4.src,tempData=_ref4.tempData;_this.onConfirm(_extends__default.default({},_this.props.componentData,{src:src,isCustomVideo:!0,tempData:tempData}))},_this.setInputFile=function(ref){return _this.inputFile=ref},_this.getComponentData=function(){return _this.props.componentData},_this.handleNativeFileUpload=function(){wixRichContentPluginCommons.handleUploadStart(_this.props,_this.getComponentData,_this.inputFile.files[0],_this.onLocalLoad,_this.getOnUploadFinished(!0)),_this.closeModal()};var componentData=_this.props.componentData;_this.state={url:!componentData.isCustomVideo&&componentData.src||""},_this.id="VideoUploadModal_FileInput_"+Math.floor(9999*Math.random());var onConfirm=props.onConfirm,onReplace=props.onReplace;return _this.onConfirm=function(obj){if(onConfirm){var newBlock=onConfirm(obj).newBlock;_this.blockKey=newBlock.key}else onReplace(obj,_this.blockKey)},_this}return _inheritsLoose__default.default(VideoUploadModal,_Component),VideoUploadModal.prototype.render=function(){var handleClick,_this2=this,_this$props=this.props,t=_this$props.t,handleFileSelection=_this$props.handleFileSelection,handleFileUpload=_this$props.handleFileUpload,enableCustomUploadOnMobile=_this$props.enableCustomUploadOnMobile,isMobile=_this$props.isMobile,languageDir=_this$props.languageDir,showUploadSection=(!isMobile||enableCustomUploadOnMobile)&&(handleFileUpload||handleFileSelection);return handleFileSelection&&(handleClick=function(evt){return evt.preventDefault(),handleFileSelection((function(_ref5){var data=_ref5.data,error=_ref5.error;_this2.addVideoComponent({data:data,error:error},!0),_this2.closeModal()}))}),React__default.default.createElement(wixRichContentUiComponents.MediaUploadModal,{id:this.id,isMobile:isMobile,inputFileRef:this.setInputFile,handleClick:handleClick,handleNativeFileUpload:this.handleNativeFileUpload,languageDir:languageDir,title:t("VideoCustomUploadModal_Title"),labelText:t("VideoUploadModal_CustomVideoClickText"),dataHook:"videoUploadModalCustomVideo",showUploadSection:showUploadSection,accept:"video/*"})},VideoUploadModal}(React.Component),MediaURLInputModal=function(_ref){var t=_ref.t,languageDir=_ref.languageDir,helpers=_ref.helpers,isMobile=_ref.isMobile,url=_ref.url,submittedInvalidUrl=_ref.submittedInvalidUrl,setUrl=_ref.setUrl,_ref$withMobileHeader=_ref.withMobileHeader,withMobileHeader=void 0!==_ref$withMobileHeader&&_ref$withMobileHeader,onConfirm=_ref.onConfirm,dataHook=_ref.dataHook,title=_ref.title,subTitle=_ref.subTitle,saveLabel=_ref.saveLabel,onDblClick=_ref.onDblClick;return React__default.default.createElement(wixRichContentUiComponents.NewUrlInputModal,{onConfirm:onConfirm,helpers:helpers,input:url,t:t,languageDir:languageDir,title:title,subTitle:subTitle,submittedInvalidUrl:submittedInvalidUrl,dataHook:dataHook,saveLabel:saveLabel,onInputChange:function(url){return setUrl(url)},errorMessage:t("SoundCloudUploadModal_Input_InvalidUrl"),placeholder:t("EmbedURL_Placeholder"),onCloseRequested:helpers.closeModal,buttonSize:wixRichContentUiComponents.BUTTON_SIZE.medium,isMobile:isMobile,withMobileHeader:withMobileHeader,onDblClick:onDblClick})},styles$2={video_modal_container:"_3jdGM",video_modal_content:"GIPKX",video_modal_tab:"_3Dnt_",video_upload_tab:"_1wXO_",fileInput:"_1W3aw",video_modal_add_button_inline:"_33b75",fileInputLabel:"_6ZyY2"},VideoModal$1=function(props){var _props$componentData=props.componentData,isCustomVideo=_props$componentData.isCustomVideo,src=_props$componentData.src,type=_props$componentData.type,closeModal=props.helpers.closeModal,t=props.t,theme=props.theme,isMobile=props.isMobile,videoTabs={embed:t("VideoModal_Tabs_Embed"),upload:t("VideoModal_Tabs_Upload")},initialUrl=isCustomVideo?"":src||"",_useState=React.useState(isCustomVideo?videoTabs.upload:videoTabs.embed),activeTab=_useState[0],setActiveTab=_useState[1],_useState2=React.useState(initialUrl),url=_useState2[0],setUrl=_useState2[1],_useState3=React.useState(!1),submittedInvalidUrl=_useState3[0],setSubmittedInvalidUrl=_useState3[1],isSoundCloud=type===videoButtonsTypes.soundCloud,onUrlInputDoubleClick=function(){return setUrl("https://www.youtube.com/watch?v=vzKryaN44ss")},onConfirm=function(){if(url&&ReactPlayer__default.default.canPlay(url)){var componentData=props.componentData,helpers=props.helpers,pubsub=props.pubsub,_onConfirm=props.onConfirm;_onConfirm?_onConfirm(_extends__default.default({},componentData,{src:url,isCustomVideo:!1})):pubsub.update("componentData",{src:url,isCustomVideo:!1}),helpers&&helpers.onVideoSelected&&helpers.onVideoSelected(url,(function(data){return pubsub.update("componentData",{metadata:_extends__default.default({},data)})})),null==closeModal||closeModal()}else setSubmittedInvalidUrl(!0)},dataHook=isSoundCloud?"soundCloudUploadModal":"videoMediaUrlModal",title=isSoundCloud?t(isMobile?"SoundCloudUploadModal_Header_Mobile":"SoundCloudUploadModal_Header"):null,renderMediaUrlInputModal=function(){return React__default.default.createElement(MediaURLInputModal,Object.assign({},props,{onConfirm:onConfirm,url:url,setUrl:setUrl,submittedInvalidUrl:submittedInvalidUrl,withMobileHeader:isSoundCloud,dataHook:dataHook,title:isSoundCloud&&title,saveLabel:t(isSoundCloud?"Embed_Add_Button_Label":"VideoModal_Embed_ButtonText"),subTitle:!isSoundCloud&&t("VideoModal_Embed_Title"),onDblClick:onUrlInputDoubleClick}))};return isSoundCloud?renderMediaUrlInputModal():React__default.default.createElement("div",{className:styles$2.video_modal_container},React__default.default.createElement("div",{className:styles$2.video_modal_content},isMobile&&React__default.default.createElement(wixRichContentUiComponents.SettingsMobileHeader,{theme:theme,onSave:onConfirm,onCancel:function(){return closeModal()},t:t,title:t("VideoModal_MobileHeader")}),React__default.default.createElement(wixRichContentUiComponents.Tabs,{value:activeTab,onTabSelected:function(tab){return setActiveTab(tab)},className:styles$2.video_modal_tabs_header,theme:theme},React__default.default.createElement(wixRichContentUiComponents.Tab,{label:videoTabs.embed,value:videoTabs.embed,theme:theme},React__default.default.createElement("div",{className:styles$2.video_modal_tab},renderMediaUrlInputModal())),React__default.default.createElement(wixRichContentUiComponents.Tab,{label:videoTabs.upload,value:videoTabs.upload,theme:theme},React__default.default.createElement("div",{className:classNames__default.default(styles$2.video_modal_tab,styles$2.video_upload_tab)},React__default.default.createElement(VideoUploadModal,Object.assign({},props)))))))},VideoModal=function(props){var _experiments$newVideo,type=props.componentData.type,experiments=props.experiments,useNewModal=null==experiments||null===(_experiments$newVideo=experiments.newVideoModal)||void 0===_experiments$newVideo?void 0:_experiments$newVideo.enabled,oldVideoModal=mediaTypes.includes(type)?MediaURLInputModal$1:VideoSelectionInputModal,Component=useNewModal?VideoModal$1:oldVideoModal;return React__default.default.createElement(Component,props)},SelectionModalCustomStyle={content:{maxWidth:"580px",minHeight:"260px"}},ExtendedSelectionModalCustomStyle={content:{maxWidth:"580px",minHeight:"378px"}},modalContentStyles={width:363,padding:20,boxSizing:"border-box",border:"solid 1px rgba(51, 51, 51, 0.1)",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.06)"},videoModalContentStyles=_extends__default.default({height:232},modalContentStyles),embedModalContentStyles=_extends__default.default({height:180},modalContentStyles),createInlineButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,spoilerInInlineToolbar=experiments.spoilerInInlineToolbar,newVideoModal=experiments.newVideoModal,useNewModal=null==newVideoModal?void 0:newVideoModal.enabled,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.replace)||MediaReplaceIcon,defaultCustomStyles=isMobile&&!settings.enableCustomUploadOnMobile||!settings.handleFileSelection&&!settings.handleFileUpload?SelectionModalCustomStyle:ExtendedSelectionModalCustomStyle,newModalCustomStyles=isMobile?wixRichContentUiComponents.MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends__default.default({},wixRichContentUiComponents.DesktopFlyOutModalStyles,{content:videoModalContentStyles}),customStyles=useNewModal?newModalCustomStyles:defaultCustomStyles,spoilerButton=settings.spoiler&&null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[{keyName:"spoiler",type:wixRichContentPluginCommons.BUTTONS.SPOILER,mobile:!0}]:[],settingsButton=null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[]:[{keyName:"settings",type:wixRichContentPluginCommons.BUTTONS.VIDEO_SETTINGS,fullHeight:!0,icon:wixRichContentPluginCommons.PluginSettingsIcon,modalName:Modals.VIDEO_SETTINGS,modalStyles:wixRichContentEditorCommon.getModalStyles({isMobile:isMobile}),t:t,mobile:!0,tooltipTextKey:"SettingsButton_Tooltip",settings:settings,triggerSettingsBi:!0,pluginId:VIDEO_TYPE}];return[{keyName:"sizeSmallCenter",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_CENTER,mobile:!1},{keyName:"sizeContent",type:wixRichContentPluginCommons.BUTTONS.SIZE_CONTENT,mobile:!1},{keyName:"sizeFullWidth",type:wixRichContentPluginCommons.BUTTONS.SIZE_FULL_WIDTH,mobile:!1},{keyName:"separator1",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!1},{keyName:"sizeSmallLeft",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_LEFT,mobile:!1},{keyName:"sizeSimallRight",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_RIGHT,mobile:!1},{keyName:"separator2",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!1}].concat(spoilerButton,[{keyName:"replace",type:wixRichContentPluginCommons.BUTTONS.EXTERNAL_MODAL,icon:icon,modalElement:wixRichContentEditorCommon.decorateComponentWithProps(VideoModal,_extends__default.default({},settings)),modalStylesFn:function(_ref2){var buttonRef=_ref2.buttonRef,modalStyles=wixRichContentEditorCommon.getModalStyles({customStyles:customStyles,fullScreen:!0,isMobile:isMobile}),_buttonRef$getBoundin=buttonRef.getBoundingClientRect(),top=_buttonRef$getBoundin.top,modalLeft=_buttonRef$getBoundin.left-15,modalTop=top>250?top-250:top+38;return _extends__default.default({},modalStyles,{content:_extends__default.default({},modalStyles.content,{top:modalTop,left:modalLeft,margin:0,position:"absolute"})})},modalStyles:isMobile?wixRichContentEditorCommon.getModalStyles({customStyles:wixRichContentUiComponents.MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):void 0,mobile:!0,tooltipTextKey:"ReplaceVideoButton_Tooltip",t:t}],settingsButton,[{keyName:"delete",type:wixRichContentPluginCommons.BUTTONS.DELETE,mobile:!0}])},ReactPlayerWrapper=function(_Component){function ReactPlayerWrapper(props){var _this;return(_this=_Component.call(this,props)||this).isVimeoAndRequireJS=function(){return!wixRichContentCommon.isSSR()&&(url=_this.props.url,MATCH_URL=/vimeo\.com\/.+/,!/vimeo\.com\/external\/[0-9]+\..+/.test(url)&&MATCH_URL.test(url))&&!window.Vimeo&&window.requirejs;var url,MATCH_URL},_this.state={vimeoLoaded:!1,isPlaying:!1},_this}_inheritsLoose__default.default(ReactPlayerWrapper,_Component);var _proto=ReactPlayerWrapper.prototype;return _proto.componentDidMount=function(){var _this2=this;this.isVimeoAndRequireJS()&&window.require(["https://player.vimeo.com/api/player.js"],(function(player){window.Vimeo={Player:player},_this2.setState({vimeoLoaded:!0})}))},_proto.render=function(){var _this3=this;if(!this.state.vimeoLoaded&&this.isVimeoAndRequireJS())return null;var _this$props=this.props,isPlayable=_this$props.isPlayable,styles=_this$props.styles,disabled=_this$props.disabled;return React__default.default.createElement(ReactPlayer__default.default,_extends__default.default({playing:this.state.isPlaying&&!disabled,onPlay:function(){return _this3.setState({isPlaying:!0})},onPause:function(){return _this3.setState({isPlaying:!1})},style:styles},this.props,{light:!isPlayable}))},ReactPlayerWrapper}(React.Component);ReactPlayerWrapper.defaultProps={isPlayable:!0};var getVideoSrc=function(src,settings){if(void 0===settings&&(settings={}),"object"==typeof src){if(settings&&settings.getVideoUrl)return settings.getVideoUrl(src);console.error("must set getVideoUrl in plugin config when using custom video source!",src)}return src},styles$1={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},VideoViewer=function(_Component){function VideoViewer(props){var _this;(_this=_Component.call(this,props)||this).setUrl=function(newUrl){var _this$props$onReload,_this$props,url=_this.normalizeUrl(newUrl);url!==_this.state.url&&(_this.setState({url:url}),null===(_this$props$onReload=(_this$props=_this.props).onReload)||void 0===_this$props$onReload||_this$props$onReload.call(_this$props))},_this.normalizeUrl=function(url){return 0===url.toLowerCase().indexOf("vimeo")?"https://"+url:url},_this.findFormalVideoRatio=function(ratio){var target,baseRatios=[1,5/4,4/3,1.5,1.6,16/9,1.85,2,2.35,2.39,3],videoRatios=[].concat(baseRatios,baseRatios.map((function(x){return 1/x}))),closest=(target=ratio,videoRatios.reduce((function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})));return Math.abs(closest-ratio)>.01?ratio:closest},_this.getVideoRatio=function(wrapper){var element=wrapper.querySelector("iframe, video");return _this.findFormalVideoRatio(element.clientHeight/element.clientWidth)},_this.onReactPlayerReady=function(){var _this$props$onReady,_this$props2,wrapper=ReactDOM__default.default.findDOMNode(_assertThisInitialized__default.default(_this)).parentNode,ratio=_this.getVideoRatio(wrapper);(wrapper.style["padding-bottom"]=100*ratio+"%",_this.props.isLoaded)||((null===(_this$props$onReady=(_this$props2=_this.props).onReady)||void 0===_this$props$onReady?void 0:_this$props$onReady.call(_this$props2))||_this.setState({isLoaded:!0}))},_this.handleContextMenu=function(e){return _this.props.componentData.disableDownload&&e.preventDefault()},_this.disableDownloadProps=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableProps={config:{file:{attributes:{controlsList:"nodownload"}}}},disable={};return void 0!==componentData.disableDownload?disable=componentData.disableDownload?disableProps:{}:void 0!==settings.disableDownload&&(disable=settings.disableDownload?disableProps:{}),disable},wixRichContentCommon.validate(props.componentData,pluginVideoSchema__default.default),_this.state={url:void 0,isLoaded:!1};var _url=getVideoSrc(props.componentData.src,props.settings);return"string"==typeof _url?_this.state={url:_this.normalizeUrl(_url)}:_url&&"function"==typeof _url.then&&_url.then((function(url){return _this.setState({url:_this.normalizeUrl(url)})})),_this}_inheritsLoose__default.default(VideoViewer,_Component);var _proto=VideoViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){var _this2=this;if(!lodash.isEqual(nextProps.componentData,this.props.componentData)&&(wixRichContentCommon.validate(nextProps.componentData,pluginVideoSchema__default.default),nextProps.componentData.src!==this.props.componentData.src)){var url=getVideoSrc(nextProps.componentData.src,nextProps.settings);"string"==typeof url?this.setUrl(url):url&&"function"==typeof url.then&&url.then((function(url){return _this2.setUrl(url)}))}},_proto.componentDidMount=function(){this.setState({key:"mounted"})},_proto.render=function(){var _this$props4=this.props,theme=_this$props4.theme,width=_this$props4.width,height=_this$props4.height,disabled=_this$props4.disabled,setComponentUrl=_this$props4.setComponentUrl;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles$1,theme:theme});var _this$state=this.state,url=_this$state.url,key=_this$state.key;null==setComponentUrl||setComponentUrl(url);var props=_extends__default.default({url:url,onReady:this.onReactPlayerReady,disabled:disabled,width:width,height:height,key:key},this.disableDownloadProps()),isLoaded=this.props.isLoaded||this.state.isLoaded;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ReactPlayerWrapper,_extends__default.default({className:classNames__default.default(this.styles.video_player),onContextMenu:this.handleContextMenu,"data-loaded":isLoaded,controls:!1!==this.props.isLoaded},props)))},VideoViewer}(React.Component);VideoViewer.defaultProps={width:"100%",height:"100%"};var styles={video_player:"_38XzK",videoOverlay:"_2L5av",video_container:"Q31CM",video_overlay:"_37MeN",error:"_3zYcu"},DEFAULTS$1=Object.freeze({config:{size:"content",alignment:"center"}}),VideoComponent=function(_React$Component){function VideoComponent(props){var _this;(_this=_React$Component.call(this,props)||this).setPlayer=function(player){_this.player=player},_this.handleReady=function(){_this.state.isLoaded||_this.props.componentData.tempData||_this.setState({isLoaded:!0})},_this.renderOverlay=function(styles){return React__default.default.createElement("div",{className:classNames__default.default(styles.video_overlay)})},_this.renderLoader=function(){var isCustomVideo=lodash.get(_this.props,"componentData.isCustomVideo");return React__default.default.createElement("div",{className:_this.styles.videoOverlay},React__default.default.createElement(wixRichContentUiComponents.Loader,{type:"medium",isVerySlowFakeLoader:isCustomVideo}))},_this.onReload=function(){_this.setState({isLoaded:!1})},_this.renderPlayer=function(){var _this$props=_this.props,theme=_this$props.theme,componentData=_this$props.componentData,disabled=_this$props.disabled,settings=_this$props.settings,setComponentUrl=_this$props.setComponentUrl;return React__default.default.createElement(VideoViewer,{ref:_this.setPlayer,componentData:componentData,settings:settings,onReady:_this.handleReady,disabled:disabled,theme:theme,setComponentUrl:setComponentUrl,onReload:_this.onReload,isLoaded:_this.state.isLoaded})},_this.onKeyDown=function(e,handler){"Enter"!==e.key&&" "!==e.key||handler()};var isPlayable=!props.blockProps;return _this.state={isLoaded:!1,isPlayable:isPlayable},_this}_inheritsLoose__default.default(VideoComponent,_React$Component);var _proto=VideoComponent.prototype;return _proto.componentDidMount=function(){this.handlePlayerFocus()},_proto.componentDidUpdate=function(){this.handlePlayerFocus()},_proto.handlePlayerFocus=function(){var element=ReactDOM.findDOMNode(this).querySelector("iframe, video");element&&(element.tabIndex=-1)},_proto.render=function(){var _this2=this;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles,theme:this.props.theme});var _this$props2=this.props,className=_this$props2.className,onClick=_this$props2.onClick,t=_this$props2.t,error=_this$props2.componentData.error,_this$state=this.state,isPlayable=_this$state.isPlayable,isLoaded=_this$state.isLoaded,containerClassNames=classNames__default.default(this.styles.video_container,className||"");return React__default.default.createElement("div",{"data-hook":"videoPlayer",onClick:onClick,className:containerClassNames,onKeyDown:function(e){return _this2.onKeyDown(e,onClick)},draggable:!0},!isPlayable&&this.renderOverlay(this.styles,this.props.t),this.renderPlayer(),!isLoaded&&!error&&this.renderLoader(),error&&React__default.default.createElement(wixRichContentUiComponents.MediaItemErrorMsg,{error:error,t:t}))},VideoComponent}(React__default.default.Component);VideoComponent.type={VIDEO_TYPE_LEGACY:"VIDEO-EMBED",VIDEO_TYPE:VIDEO_TYPE};var createInsertButtons=function(_ref){var _toolbar$icons,_buttonsMap,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,disableDownload=_ref.disableDownload,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,componentData=void 0!==disableDownload?_extends__default.default({},DEFAULTS$1,{disableDownload:disableDownload}):DEFAULTS$1,newVideoModal=experiments.newVideoModal,useNewModal=null==newVideoModal?void 0:newVideoModal.enabled,_ref2=settings||{},_ref2$exposeButtons=_ref2.exposeButtons,exposeButtons=void 0===_ref2$exposeButtons?[videoButtonsTypes.video]:_ref2$exposeButtons,toolbar=_ref2.toolbar,enableCustomUploadOnMobile=_ref2.enableCustomUploadOnMobile,handleFileSelection=_ref2.handleFileSelection,handleFileUpload=_ref2.handleFileUpload,icon=(null==toolbar||null===(_toolbar$icons=toolbar.icons)||void 0===_toolbar$icons?void 0:_toolbar$icons.InsertPluginButtonIcon)||InsertPluginIcon$1,videoModalCustomStyles=isMobile?wixRichContentUiComponents.MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends__default.default({},wixRichContentUiComponents.DesktopFlyOutModalStyles,{content:videoModalContentStyles}),embedModalCustomStyles=isMobile?wixRichContentUiComponents.MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends__default.default({},wixRichContentUiComponents.DesktopFlyOutModalStyles,{content:embedModalContentStyles}),customStyles=useNewModal?videoModalCustomStyles:isMobile&&!enableCustomUploadOnMobile||!handleFileSelection&&!handleFileUpload?SelectionModalCustomStyle:ExtendedSelectionModalCustomStyle,modalsStyle=wixRichContentEditorCommon.getModalStyles({customStyles:customStyles,fullScreen:!!useNewModal,isMobile:isMobile}),modalStyles=useNewModal?isMobile?modalsStyle:void 0:modalsStyle,baseButtonProps={type:wixRichContentEditorCommon.BUTTON_TYPES.MODAL,modalElement:wixRichContentEditorCommon.decorateComponentWithProps(VideoModal,settings)},buttonsMap=((_buttonsMap={})[videoButtonsTypes.video]={name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.VIDEO,tooltip:t("VideoPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},componentData:componentData},_buttonsMap[videoButtonsTypes.soundCloud]={name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.SOUND_CLOUD,tooltip:t("SoundCloudPlugin_InsertButton_Tooltip"),getIcon:function(){return InsertPluginIcon},componentData:_extends__default.default({},DEFAULTS$1,{type:videoButtonsTypes.soundCloud})},_buttonsMap[videoButtonsTypes.youTube]={name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.YOUTUBE,tooltip:t("EmbedURL_Social_YouTube_Title"),getIcon:function(){return YoutubeIcon},componentData:_extends__default.default({},DEFAULTS$1,{type:videoButtonsTypes.youTube}),section:"BlockToolbar_Section_Embed_Anywhere"},_buttonsMap),toolbars=useNewModal?[wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE]:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],videoButtons=exposeButtons.map((function(buttonType){return _extends__default.default({},buttonsMap[buttonType],{toolbars:toolbars,modalStyles:modalStyles,modalStylesFn:useNewModal?function(_ref3){var buttonRef=_ref3.buttonRef,toolbarName=_ref3.toolbarName,isSoundCloud=buttonType===videoButtonsTypes.soundCloud;return wixRichContentEditorCommon.getBottomToolbarModalStyles(buttonRef,{customStyles:isSoundCloud?embedModalCustomStyles:videoModalCustomStyles},toolbarName)}:void 0},baseButtonProps)}));if(useNewModal){var externalToolbarButtons=exposeButtons.map((function(buttonType){var styles=buttonType===videoButtonsTypes.soundCloud?wixRichContentUiComponents.DesktopFlyOutModalStyles:videoModalCustomStyles;return _extends__default.default({},buttonsMap[buttonType],{modalStyles:wixRichContentEditorCommon.getModalStyles({customStyles:_extends__default.default({},styles,wixRichContentUiComponents.DesktopOverlayModalStyles),fullScreen:!1,isMobile:isMobile}),toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN]},baseButtonProps)}));videoButtons=[].concat(videoButtons,externalToolbarButtons)}return videoButtons},createToolbar=function(_ref){var t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,disableDownload=_ref.disableDownload,experiments=_ref.experiments;return{InlineButtons:createInlineButtons({t:t,settings:settings,isMobile:isMobile,experiments:experiments}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile,disableDownload:disableDownload,experiments:experiments}),name:"video"}};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createVideoPlugin=function(config){var _config$uiSettings,_config$uiSettings2,helpers=config.helpers,t=config.t,_config$VIDEO_TYPE=config[VIDEO_TYPE],settings=void 0===_config$VIDEO_TYPE?{}:_config$VIDEO_TYPE,isMobile=config.isMobile,spoilerWrapper=config.spoilerWrapper,commonPubsub=config.commonPubsub,experiments=config.experiments,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","t",VIDEO_TYPE,"isMobile","spoilerWrapper","commonPubsub","experiments"].map(_toPropertyKey)),disableDownload=null==config||null===(_config$uiSettings=config.uiSettings)||void 0===_config$uiSettings?void 0:_config$uiSettings.disableDownload,defaultPluginData=void 0!==disableDownload?_extends__default.default({},DEFAULTS$1,{disableDownload:disableDownload}):DEFAULTS$1,type=VIDEO_TYPE;return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({component:VideoComponent,type:type,legacyType:"VIDEO-EMBED",toolbar:createToolbar({t:t,settings:_extends__default.default({},settings,{commonPubsub:commonPubsub,type:type}),isMobile:isMobile,disableDownload:disableDownload,experiments:experiments}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,disableRightClick:null==config||null===(_config$uiSettings2=config.uiSettings)||void 0===_config$uiSettings2?void 0:_config$uiSettings2.disableRightClick,defaultPluginData:defaultPluginData,spoilerWrapper:settings.spoiler&&spoilerWrapper,commonPubsub:commonPubsub},rest))};createVideoPlugin.functionName=VIDEO_TYPE;var DEFAULTS_config={toolbar:{hidden:[]}},createVideoData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var videoData=isRicosSchema?toDraftData.convertNodeDataToDraft("VIDEO",pluginData):pluginData;return lodash.merge({},DEFAULTS$1,videoData)},Video=function(_ref){var context=_ref.context,componentData=_ref.componentData,theme=context.theme,t=context.t,_context$config=context.config,settings=(void 0===_context$config?{}:_context$config)[VIDEO_TYPE]||{};return React__default.default.createElement(VideoComponent,{componentData:componentData,theme:theme,t:t,settings:settings,blockProps:{setFocusToBlock:function(){return null}},setComponentUrl:function(){return null},onClick:function(){}})},videoDataDefaults={containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null},video:{src:null,width:null,height:null},thumbnail:{src:null,width:null,height:null},disableDownload:null,title:null},name=ricosContent.TIPTAP_VIDEO_TYPE;exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.VIDEO_TYPE=VIDEO_TYPE,exports.VIDEO_TYPE_LEGACY="VIDEO-EMBED",exports.VideoViewer=VideoViewer,exports.createVideoPlugin=createVideoPlugin,exports.pluginVideo=function(config){var defaultOptions,pluginConfig=_extends__default.default({},DEFAULTS_config,config);return{config:pluginConfig,type:VIDEO_TYPE,createPlugin:createVideoPlugin,ModalsMap:ModalsMap,createPluginData:createVideoData,tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Video,componentDataDefaults:_extends__default.default({},videoDataDefaults,{id:"",loading:{default:!1}}),createExtensionConfig:function(){return{name:name,defaultOptions:defaultOptions,addCommands:function(){return{}}}}}])}},exports.videoButtonsTypes=videoButtonsTypes;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),lodash=require("lodash"),reactCustomScrollbars=require("react-custom-scrollbars"),wixRichContentUiComponents=require("wix-rich-content-ui-components"),wixRichContentCommon=require("wix-rich-content-common"),classNames=require("classnames");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),styles$3={button_colorPicker:"_2SszI",button_colorPicker_label:"_2AKRF",button_colorPicker_picker:"_2yqbC",button_colorPicker_pickerButton:"_2SqE-",button_marginBottomOpenedColorPicker:"ejyPS",button_marginBottomClosedColorPicker:"_1aNWU"},ColorToggleComponent=function(_PureComponent){function ColorToggleComponent(props){var _this;return(_this=_PureComponent.call(this,props)||this).onClicked=function(){_this.props.toggle(_this.props.pickerType),_this.setState({isOpened:!_this.state.isOpened})},_this.styles=wixRichContentCommon.mergeStyles({styles:styles$3,theme:props.theme}),_this.state={color:props.color||"#FFF",isOpened:!1},_this}return _inheritsLoose__default.default(ColorToggleComponent,_PureComponent),ColorToggleComponent.getDerivedStateFromProps=function(props,state){var color=props.color;return color===state.color?null:_extends__default.default({},state,{color:color})},ColorToggleComponent.prototype.render=function(){var marginButtonClassName=this.props.isToggle?this.styles.button_marginBottomOpenedColorPicker:this.styles.button_marginBottomClosedColorPicker;return React__default.default.createElement("div",{className:classNames__default.default(this.styles.button_colorPicker,marginButtonClassName)},React__default.default.createElement("div",{className:this.styles.button_colorPicker_label},this.props.children),React__default.default.createElement("div",{className:this.styles.button_colorPicker_picker},React__default.default.createElement("button",{style:{background:this.state.color},className:this.styles.button_colorPicker_pickerButton,onClick:this.onClicked})))},ColorToggleComponent}(React.PureComponent),COLOR_PICKER_TYPE=Object.freeze({TEXT_COLOR:"textColor",BORDER_COLOR:"borderColor",BACKGROUND_COLOR:"backgroundColor"}),DEFAULT_CONFIG={alignment:"center",size:"small",width:"fit-content"},DEFAULT_PALETTE=["#FFFFFF","#D5D4D4","#000000","#ABCAFF","#81B0FF","#0261FF"],DEFAULTS={config:DEFAULT_CONFIG,button:{settings:{buttonText:"Click Me"},design:{borderRadius:0,borderWidth:0}}},dcStyle={fontElementMap:"_1R1bR",colorPicker:"XG1h7",colorPicker_button_selected:"lCDmR",colorPicker_button:"_1trlh",colorPicker_header:"_2rSZV",colorPicker_separator:"_2Iw7_",mobile:"_35fEU",colorPicker_button_transparent:"B5upi",colorPicker_palette:"_2bLMH",colorPicker_add_color_button:"_3poGL",colorPicker_add_color_label:"_2V_XK",colorPicker_buttons_container:"_3e853",colorPicker_color_button_hidden:"_3ogyn",colorPicker_reset_color_button:"_1tlpS",colorPicker_reset_color_label:"_1D4WR",colorPicker_bottom_container:"_12y5a",customColorPicker_editable_input_container:"_2IlXV",customColorPicker_input_label:"_1-jdF",customColorPicker_input_container:"_2GYrh",customColorPicker_currentColor:"_2mIOQ",hexColorInput:"_154S3",hashtagIcon:"_3Alur",colorPickerDialog:"_2Q7XP",colorPickerDialog_separator:"_1dJCg",colorPickerDialog_buttons_wrapper:"xCNRU",button_designComponent_row:"_3XUTi",colorPickerDialog_buttons:"_1RFGv",colorPickerDialog_button:"_3TW8L",customColorPicker_container:"zQC0Z",customColorPicker_saturation:"_1KSl_",button_designComponent_colorPicker_container:"_2j39G",customColorPicker_hue:"_3bPTz",huePointer_vertical_line:"_2nEik",button_designComponent_design_component:"_3N5Wk",button_designComponent_section_header_color:"_2-XD3",button_designComponent_section_header_border:"_2Firs",modal_footer:"_2Teom",button_designComponent_input_container_width:"_21Ezj",button_designComponent_input_container_corner:"_2j1aL",sliderWithInput_label:"_3UvLB",sliderWithInput_content:"_3JqJc",sliderWithInput_input:"_8uXHg",slider:"_1sVhh"},DesignComponent=function(_PureComponent){function DesignComponent(props){var _this;(_this=_PureComponent.call(this,props)||this).getUserColors=function(){var _this$props=_this.props,themeData=_this$props.settings.themeData,config=_this$props.config,_ref$colors=(themeData||(null==config?void 0:config.themeData)||{}).colors;return{actionColor:(_ref$colors=void 0===_ref$colors?{}:_ref$colors).actionColor,bgColor:_ref$colors.bgColor,textColor:_ref$colors.textColor}},_this.withColorOptions=function(settings){var _this$props$designObj=_this.props.designObj,designObj=void 0===_this$props$designObj?{}:_this$props$designObj,color=designObj.color,borderColor=designObj.borderColor,background=designObj.background,getTextColors=settings.getTextColors,getBorderColors=settings.getBorderColors,getBackgroundColors=settings.getBackgroundColors,customColors=Object.values(_this.getUserColors()).filter((function(c){return!!c})),hasCustomColors=customColors.length>0,customBackgroundColors=getBackgroundColors&&getBackgroundColors()||hasCustomColors&&customColors||DEFAULT_PALETTE,customTextColors=getTextColors&&getTextColors()||hasCustomColors&&customColors||DEFAULT_PALETTE,customBorderColors=getBorderColors&&getBorderColors()||hasCustomColors&&customColors||DEFAULT_PALETTE;return color&&!customTextColors.includes(color)&&customTextColors.push(color),borderColor&&!customBorderColors.includes(borderColor)&&customBorderColors.push(borderColor),background&&!customBackgroundColors.includes(background)&&customBackgroundColors.push(background),{customBackgroundColors:customBackgroundColors,customTextColors:customTextColors,customBorderColors:customBorderColors}},_this.componentDidUpdate=function(){_this.props.onDesignChange(_this.state.design)},_this.onBackgroundColorAdded=function(_ref2){var color=_ref2.color,_this$props$settings=_this.props.settings,getBackgroundColors=_this$props$settings.getBackgroundColors,onBackgroundColorAdded=_this$props$settings.onBackgroundColorAdded;onBackgroundColorAdded&&onBackgroundColorAdded(color);var customBackgroundColors=getBackgroundColors&&getBackgroundColors()||[].concat(_this.state.customBackgroundColors,[color]);_this.setState({customBackgroundColors:customBackgroundColors})},_this.onBorderColorAdded=function(_ref3){var color=_ref3.color,_this$props$settings2=_this.props.settings,getBorderColors=_this$props$settings2.getBorderColors,onBorderColorAdded=_this$props$settings2.onBorderColorAdded;onBorderColorAdded&&onBorderColorAdded(color);var customBorderColors=getBorderColors&&getBorderColors()||[].concat(_this.state.customBorderColors,[color]);_this.setState({customBorderColors:customBorderColors})},_this.onTextColorAdded=function(_ref4){var color=_ref4.color,_this$props$settings3=_this.props.settings,getTextColors=_this$props$settings3.getTextColors,onTextColorAdded=_this$props$settings3.onTextColorAdded;onTextColorAdded&&onTextColorAdded(color);var customTextColors=getTextColors&&getTextColors()||[].concat(_this.state.customTextColors,[color]);_this.setState({customTextColors:customTextColors})},_this.onBorderWidthChange=function(value){var design=_extends__default.default({},_this.state.design,{borderWidth:value});_this.setState({design:design})},_this.onBorderRadiusChange=function(value){var design=_extends__default.default({},_this.state.design,{borderRadius:value});_this.setState({design:design})},_this.onTextColorChange=function(_ref5){var color=_ref5.color,design=_extends__default.default({},_this.state.design,{color:color});_this.setState({design:design})},_this.onBorderColorChange=function(_ref6){var color=_ref6.color,design=_extends__default.default({},_this.state.design,{borderColor:color});_this.setState({design:design})},_this.onBackgroundColorChange=function(_ref7){var color=_ref7.color,design=_extends__default.default({},_this.state.design,{background:color});_this.setState({design:design})},_this.onToggled=function(pickerType){_this.setState({pickerType:pickerType!==_this.state.pickerType?pickerType:""})},_this.styles=wixRichContentCommon.mergeStyles({styles:dcStyle,theme:props.theme});var _designObj=_this.props.designObj,_this$props2=_this.props,_settings=_this$props2.settings,colors=_this$props2.settings.colors,_this$getUserColors=_this.getUserColors(),_actionColor=_this$getUserColors.actionColor,_bgColor=_this$getUserColors.bgColor;return _this.state=_extends__default.default({design:{borderWidth:_designObj.borderWidth,borderRadius:_designObj.borderRadius,color:(null==_designObj?void 0:_designObj.color)||(null==colors?void 0:colors.color1)||_bgColor,borderColor:(null==_designObj?void 0:_designObj.borderColor)||(null==colors?void 0:colors.color8)||_actionColor,background:(null==_designObj?void 0:_designObj.background)||(null==colors?void 0:colors.color8)||_actionColor}},_this.withColorOptions(_settings),{pickerType:""}),_this.originalDesign=_this.state.design,_this}_inheritsLoose__default.default(DesignComponent,_PureComponent);var _proto=DesignComponent.prototype;return _proto.renderColorPicker=function(color,userColors,onColorAdded,onChange,pickerType,label){var _this$props3=this.props,t=_this$props3.t,isMobile=_this$props3.isMobile,theme=_this$props3.theme,palette=_this$props3.palette,paletteColors=(isMobile?null==palette?void 0:palette.slice(0,5):null==palette?void 0:palette.slice(0,7))||DEFAULT_PALETTE;return React__default.default.createElement("div",null,React__default.default.createElement(ColorToggleComponent,{theme:theme,color:color,pickerType:pickerType,isMobile:isMobile,isToggle:this.state.pickerType===pickerType,toggle:this.onToggled.bind(this)},label),this.state.pickerType===pickerType&&React__default.default.createElement(wixRichContentPluginCommons.ColorPicker,{color:color,palette:paletteColors,userColors:userColors.slice(0,100),onColorAdded:onColorAdded,theme:this.styles,isMobile:isMobile,onChange:onChange.bind(this),t:t},(function(_ref8){var renderUserColors=_ref8.renderUserColors,renderAddColorButton=_ref8.renderAddColorButton;return React__default.default.createElement("div",{className:dcStyle.colorPicker_palette},React__default.default.createElement("div",{className:dcStyle.colorPicker_buttons_container},React__default.default.createElement("div",null,renderUserColors()),React__default.default.createElement("div",null,renderAddColorButton())))})))},_proto.render=function(){var styles=this.styles,_this$props4=this.props,theme=_this$props4.theme,t=_this$props4.t,design=this.state.design;return React__default.default.createElement("div",{className:styles.button_designComponent_design_component},React__default.default.createElement(wixRichContentUiComponents.SettingsSection,{theme:theme,ariaProps:{"aria-label":"border selection",role:"region"}},React__default.default.createElement("div",{className:styles.button_designComponent_row},React__default.default.createElement("div",{className:styles.button_designComponent_section_header_border},t("ButtonModal_Border_Section")),React__default.default.createElement("div",{className:styles.button_designComponent_input_container_width},React__default.default.createElement("div",{className:styles.button_designComponent_slider_with_input},React__default.default.createElement(wixRichContentUiComponents.SliderWithInput,{defaultValue:parseInt(design.borderWidth),min:0,max:15,label:t("ButtonModal_Width_Input"),onChange:this.onBorderWidthChange.bind(this),theme:this.styles}))),React__default.default.createElement("div",{className:styles.button_designComponent_input_container_corner},React__default.default.createElement("div",{className:styles.button_designComponent_slider_with_input},React__default.default.createElement(wixRichContentUiComponents.SliderWithInput,{defaultValue:parseInt(design.borderRadius),min:0,max:15,label:t("ButtonModal_Radius_Input"),onChange:this.onBorderRadiusChange.bind(this),theme:this.styles}))))),React__default.default.createElement(wixRichContentUiComponents.SettingsSection,{theme:theme,ariaProps:{"aria-label":"color selection",role:"region"}},React__default.default.createElement("div",{className:styles.button_designComponent_colorPicker_container},React__default.default.createElement("div",{className:styles.button_designComponent_section_header_color},t("ButtonModal_Color_Section")),this.renderColorPicker(design.color,this.state.customTextColors,this.onTextColorAdded,this.onTextColorChange,COLOR_PICKER_TYPE.TEXT_COLOR,t("ButtonModal_Text_Color")),this.renderColorPicker(design.borderColor,this.state.customBorderColors,this.onBorderColorAdded,this.onBorderColorChange,COLOR_PICKER_TYPE.BORDER_COLOR,t("ButtonModal_Border_Color")),this.renderColorPicker(design.background,this.state.customBackgroundColors,this.onBackgroundColorAdded,this.onBackgroundColorChange,COLOR_PICKER_TYPE.BACKGROUND_COLOR,t("ButtonModal_Background_Color")))))},DesignComponent}(React.PureComponent),styles$2={button_settingsComponent_header_ButtonText:"xkpAc",button_settingsComponent_header_ButtonLink:"_14F9_",settingTab:"_2xyfE",button_settingsComponent_errorMessage:"_2h5Fl",button_settingsComponent_checkBoxes:"_14ORO",checkbox:"_3Hilb",modal_footer:"_3elaw",button_settingsComponent_name_feild:"_188Qs",button_settingsComponent_section_content:"_1C5Yo",textInput_errorIcon:"_1xbb3",textInput_input:"qcafS",checkbox_icon_unchecked:"RtRdo",checkbox_wrapper:"_2fcaQ",checkbox_inputLabel:"_2pmSA",checkbox_infoIcon:"_3FYiR",checkbox_icon:"_1_-x3",checkbox_icon_checked:"_2T4d1",checkbox_label:"Av8Hx"},SettingsComponent=function(_PureComponent){function SettingsComponent(props){var _this;(_this=_PureComponent.call(this,props)||this).componentDidUpdate=function(){_this.props.onSettingsChange(_this.state)},_this.handleKeyPress=function(e){_this.props.onKeyPress(e)},_this.onTextChanged=function(buttonText){return _this.setState({buttonText:buttonText})},_this.onLinkPanelChange=function(_ref){var url=_ref.url,rel=_ref.rel,target=_ref.target;_this.setState({url:url,rel:rel,target:target})};var _this$props=_this.props,settingsObj=_this$props.settingsObj,showLinkPanel=_this$props.showLinkPanel;_this.styles=wixRichContentCommon.mergeStyles({styles:styles$2,theme:props.theme});var linkButtonSettings=showLinkPanel?{url:settingsObj.url,target:settingsObj.target,rel:settingsObj.rel}:{};return _this.state=_extends__default.default({buttonText:settingsObj.buttonText},linkButtonSettings),_this}return _inheritsLoose__default.default(SettingsComponent,_PureComponent),SettingsComponent.prototype.render=function(){var _this2=this,_this$props2=this.props,t=_this$props2.t,showLinkPanel=_this$props2.showLinkPanel,uiSettings=_this$props2.uiSettings,theme=_this$props2.theme,anchorTarget=_this$props2.anchorTarget,relValue=_this$props2.relValue,_this$state=this.state,buttonText=_this$state.buttonText,linkValues={url:_this$state.url,target:_this$state.target,rel:_this$state.rel},_ref3=(uiSettings||{}).linkPanel||{},showNewTabCheckbox=_ref3.showNewTabCheckbox,showNoFollowCheckbox=_ref3.showNoFollowCheckbox,showSponsoredCheckbox=_ref3.showSponsoredCheckbox,textInputBaseProps={inputRef:function(ref){return _this2.input=ref},type:"text",onKeyPress:this.handleKeyPress,theme:this.styles,"data-hook":"ButtonInputModal"};return React__default.default.createElement("div",{className:this.styles.button_settingsComponent_section_content},React__default.default.createElement("div",{className:this.styles.button_settingsComponent_name_feild},React__default.default.createElement("div",{className:this.styles.button_settingsComponent_header_ButtonText},t("ButtonModal_Button_Text")),React__default.default.createElement("div",null,React__default.default.createElement(wixRichContentUiComponents.TextInput,_extends__default.default({},textInputBaseProps,{onChange:this.onTextChanged,value:buttonText,placeholder:t("ButtonModal_InputName_Placeholder")})))),showLinkPanel&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:this.styles.button_settingsComponent_header_ButtonLink},t("ButtonModal_Button_Link")),React__default.default.createElement(wixRichContentEditorCommon.LinkPanelWrapper,{linkValues:linkValues,onChange:this.onLinkPanelChange,showNewTabCheckbox:showNewTabCheckbox,showNoFollowCheckbox:showNoFollowCheckbox,showSponsoredCheckbox:showSponsoredCheckbox,theme:theme,t:t,anchorTarget:anchorTarget,relValue:relValue})))},SettingsComponent}(React.PureComponent),styles$1={button_PreviewComponent_preview_container:"_1pfLf",button_PreviewComponent_header:"_2LNs5",button_PreviewComponent_button:"_17oKq"},alignmentStyles={button_align_left:"_20daj",button_align_right:"_308Nj",button_align_center:"_3ZwKi"},Styles={button_container:"iRkxq",button_text:"_3Ybc9",button_size_content:"_1eLXB"},alignmentClassName=function(componentData,theme,styles){var _ref$alignment=(componentData.config||{}).alignment,alignment=void 0===_ref$alignment?"center":_ref$alignment,mergedStyles=wixRichContentCommon.mergeStyles({styles:alignmentStyles,theme:theme});return classNames__default.default(mergedStyles["button_align_"+alignment],styles["align"+lodash.upperFirst(alignment)],theme["align"+lodash.upperFirst(alignment)])},sizeClassName=function(componentData,theme){return wixRichContentCommon.mergeStyles({styles:Styles,theme:theme}).button_size_content},LINK_BUTTON_TYPE="wix-draft-plugin-link-button",ACTION_BUTTON_TYPE="wix-draft-plugin-action-button",ButtonViewer=function(_ref){var style=_ref.style,anchorTarget=_ref.anchorTarget,onClick=_ref.onClick,theme=_ref.theme,helpers=_ref.helpers,url=_ref.url,_ref$target=_ref.target,target=void 0===_ref$target?anchorTarget:_ref$target,rel=_ref.rel,buttonText=_ref.buttonText,styles=wixRichContentCommon.mergeStyles({styles:Styles,theme:theme}),isActionButton=React.useMemo((function(){return Boolean(onClick)}),[onClick]),onClickHandler=React.useCallback((function(args){var _helpers$onViewerActi;null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,isActionButton?ACTION_BUTTON_TYPE:LINK_BUTTON_TYPE,"Click",""),isActionButton&&(null==onClick||onClick(args))}),[helpers.onViewerAction]),Component=isActionButton?"div":"a",props=lodash.merge({className:styles.button_container,style:style,tabIndex:0,role:"button",onKeyDown:function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),onClickHandler(e))}},!isActionButton&&{href:url,target:target,rel:wixRichContentCommon.getRelValue(rel)});return React__default.default.createElement(Component,Object.assign({},props,{"data-hook":"buttonViewer",onClick:onClickHandler}),React__default.default.createElement("div",{className:styles.button_text},buttonText))},ButtonComponent=function(_Component){function ButtonComponent(){return _Component.apply(this,arguments)||this}return _inheritsLoose__default.default(ButtonComponent,_Component),ButtonComponent.prototype.render=function(){var _button$settings,_this$props$settings$,_this$props$settings$2,_this$props$settings$3,_this$props=this.props,button=_this$props.componentData.button,_this$props$settings=_this$props.settings,onClick=_this$props$settings.onClick,themeData=_this$props$settings.themeData,config=_this$props.config,helpers=_this$props.helpers,anchorTarget=_this$props.anchorTarget,theme=this.props.theme,_ref$colors=(themeData||(null==config?void 0:config.themeData)||{}).colors,actionColor=(_ref$colors=void 0===_ref$colors?{}:_ref$colors).actionColor,bgColor=_ref$colors.bgColor,buttonText=button.settings.buttonText,url=null===(_button$settings=button.settings)||void 0===_button$settings?void 0:_button$settings.url,linkButtonSettings={};url&&(linkButtonSettings={url:wixRichContentCommon.normalizeUrl(url),target:button.settings.target,rel:button.settings.rel});var style=_extends__default.default({border:"0px solid blue",color:(null===(_this$props$settings$=this.props.settings.colors)||void 0===_this$props$settings$?void 0:_this$props$settings$.color1)||bgColor,background:(null===(_this$props$settings$2=this.props.settings.colors)||void 0===_this$props$settings$2?void 0:_this$props$settings$2.color8)||actionColor,borderColor:(null===(_this$props$settings$3=this.props.settings.colors)||void 0===_this$props$settings$3?void 0:_this$props$settings$3.color8)||actionColor},this.props.style,button.design);return React__default.default.createElement(ButtonViewer,_extends__default.default({style:style,buttonText:buttonText,theme:theme,onClick:onClick,helpers:helpers,anchorTarget:anchorTarget},linkButtonSettings))},ButtonComponent}(React.Component);ButtonComponent.alignmentClassName=function(componentData,theme,styles,isMobile){return alignmentClassName(componentData,theme,styles)},ButtonComponent.sizeClassName=function(componentData,theme,styles,isMobile){return sizeClassName(0,theme)};var _ModalsMap,PreviewComponent=function(_PureComponent){function PreviewComponent(props){var _this;return(_this=_PureComponent.call(this,props)||this).styles=wixRichContentCommon.mergeStyles({styles:styles$1,theme:props.theme}),_this}return _inheritsLoose__default.default(PreviewComponent,_PureComponent),PreviewComponent.prototype.render=function(){var t=this.props.t;return React__default.default.createElement("div",{className:this.styles.button_PreviewComponent_preview_container},React__default.default.createElement("div",{className:this.styles.button_PreviewComponent_header},t("ButtonModal_Preview_Label")),React__default.default.createElement("div",{className:this.styles.button_PreviewComponent_button},React__default.default.createElement(ButtonComponent,_extends__default.default({theme:this.props.theme,style:{pointerEvents:"none"}},this.props))))},PreviewComponent}(React.PureComponent),styles={button_inputModal_container:"_3CeGG",button_inputModal_design_component_container:"_16j6_",button_inputModal_focus_manager:"_1AC6h",button_inputModal_separator:"_1xCrk",button_inputModal_scroll:"_2rQY7",button_inputModal_header:"_8nHX-",button_inputModal_header_text:"JYASm",button_inputModal_design_header_text:"xyPQ8",header_icon:"_3RhSs",errorMessage:"_1ouNG",button_inputModal_errorIcon:"_2P439",tabs_headers_option:"WNTP-",scroll_container:"_3eSRM",button_inputModal_tabLabel:"_3KQDi",button_inputModal_scrollbar_thumb:"_3jQ_2",scrollbar_thumb:"_2bEcK",button_inputModal_customize_scrollbar_container:"_22y9g",button_tab_section:"WHGFF"},ButtonInputModal=function(_Component){function ButtonInputModal(props){var _this;(_this=_Component.call(this,props)||this).onSettingsChanged=function(settings){var design=_this.state.design;if(!lodash.isEqual(settings,_this.state.settings)){var _this$props=_this.props,pubsub=_this$props.pubsub,button=_this$props.componentData.button;pubsub.update("componentData",{button:_extends__default.default({},button,{settings:settings,design:design})}),_this.setState({settings:settings})}},_this.onDesignChanged=function(design){var settings=_this.state.settings;if("design"!==_this.state.activeTab&&_this.setState({activeTab:"design"}),!lodash.isEqual(design,_this.state.design)){var _this$props2=_this.props,pubsub=_this$props2.pubsub,button=_this$props2.componentData.button;pubsub.update("componentData",{button:_extends__default.default({},button,{design:design,settings:settings})}),_this.setState({design:design})}},_this.triggerLinkBi=function(){var _this$props$helpers,_this$props$helpers$o,_this$state$settings=_this.state.settings,rel=_this$state$settings.rel,target=_this$state$settings.target,url=_this$state$settings.url;null===(_this$props$helpers=_this.props.helpers)||void 0===_this$props$helpers||null===(_this$props$helpers$o=_this$props$helpers.onPluginAction)||void 0===_this$props$helpers$o||_this$props$helpers$o.call(_this$props$helpers,wixRichContentCommon.ADD_PLUGIN_LINK_BI,{plugin_id:LINK_BUTTON_TYPE,params:{link:url,newTab:wixRichContentCommon.isNewTab(target),category:wixRichContentCommon.WEB_ADDRESS_CATEGORY,rel:rel}})},_this.onConfirm=function(){var closeModal=_this.props.helpers.closeModal,_this$state=_this.state,initialComponentData=_this$state.initialComponentData,design=_this$state.design;!initialComponentData.design.color&&_this.currentColorEqualToConfig()&&_this.removeColorsFromComponentData(design),_this.setState({submitted:!0,isOpen:!1}),_this.triggerLinkBi(),closeModal()},_this.currentColorEqualToConfig=function(){var design=_this.state.design,colors=_this.props.settings.colors;return!(design.color!==(null==colors?void 0:colors.color1)&&"#FEFDFD"!==design.color||design.borderColor!==(null==colors?void 0:colors.color8)&&"#0261FF"!==design.borderColor||design.background!==(null==colors?void 0:colors.color8)&&"#0261FF"!==design.background)},_this.handleKeyPress=function(e){e.charCode===wixRichContentEditorCommon.KEYS_CHARCODE.ENTER&&_this.onConfirm(),e.charCode===wixRichContentEditorCommon.KEYS_CHARCODE.ESCAPE&&_this.onCloseRequested()},_this.onCloseRequested=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,pubsub=_this$props3.pubsub,onCloseRequested=_this$props3.onCloseRequested,closeModal=_this$props3.helpers.closeModal,initialComponentData=_this.state.initialComponentData;initialComponentData.design.color||_this.removeColorsFromComponentData(initialComponentData.design),onCloseRequested?onCloseRequested(_extends__default.default({},componentData,{button:initialComponentData})):pubsub.update("componentData",{button:initialComponentData}),_this.setState({isOpen:!1}),closeModal()},_this.removeColorsFromComponentData=function(design){var pubsub=_this.props.pubsub,designToSave={borderWidth:design.borderWidth,padding:design.padding,borderRadius:design.borderRadius},componentDataToSave=pubsub.get("componentData");componentDataToSave.button.design=designToSave,pubsub.set("componentData",componentDataToSave)},_this.handleOnMouseEnterDesign=function(){_this.setState({isHover:!0,activeTab:"design"})},_this.handleOnMouseLeaveDesign=function(){_this.setState({isHover:!1})},_this.handleOnMouseEnterSettings=function(){_this.setState({activeTab:"settings"})},_this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:props.theme});var _button=_this.props.componentData.button;return _this.state={settings:_extends__default.default({},_button.settings),design:_extends__default.default({},_button.design),initialComponentData:_extends__default.default({},_button),isHover:!1,activeTab:"settings",showLinkPanel:!_this.props.settings.isActionButton},_this.setScrollbarRef=function(element){_this.scrollbarRef=element},_this}return _inheritsLoose__default.default(ButtonInputModal,_Component),ButtonInputModal.prototype.render=function(){var _this2=this,_this$props4=this.props,theme=_this$props4.theme,t=_this$props4.t,uiSettings=_this$props4.uiSettings;_this$props4.doneLabel,_this$props4.cancelLabel;var isMobile=_this$props4.isMobile,showLinkPanel=this.state.showLinkPanel,styles=this.styles,settingTabLabel=React__default.default.createElement("div",{className:styles.button_inputModal_settingTab},React__default.default.createElement("div",{className:styles.button_inputModal_tabTitle},React__default.default.createElement("p",{className:styles.button_inputModal_tabLabel},t("ButtonModal_Settings_Tab")))),designTabLabel=React__default.default.createElement("p",{className:styles.button_inputModal_tabLabel},t("ButtonModal_Design_Tab")),settingsComponent=React__default.default.createElement(SettingsComponent,_extends__default.default({t:t,theme:theme,uiSettings:uiSettings},this.props,{onSettingsChange:this.onSettingsChanged.bind(this),settingsObj:this.state.settings,onKeyPress:this.handleKeyPress,showLinkPanel:showLinkPanel})),designComponent=React__default.default.createElement(DesignComponent,_extends__default.default({},this.props,{theme:theme,t:t,styles:styles,onDesignChange:this.onDesignChanged.bind(this),designObj:this.state.design,onKeyPress:this.handleKeyPress})),mobileView=null;return isMobile&&(mobileView=React__default.default.createElement("div",null,React__default.default.createElement(wixRichContentUiComponents.SettingsMobileHeader,{onSave:this.onConfirm,onCancel:this.onCloseRequested,theme:styles,t:t}),React__default.default.createElement(PreviewComponent,_extends__default.default({buttonObj:this.state},this.props)),React__default.default.createElement("div",{className:styles.button_inputModal_scroll,ref:this.setScrollbarRef},React__default.default.createElement("div",{className:styles.button_inputModal_container,"data-hook":"ButtonInputModal"},React__default.default.createElement("div",{className:styles.button_inputModal_header_text},t("ButtonModal_Settings_Tab")),settingsComponent),React__default.default.createElement("div",{className:styles.button_inputModal_separator}),React__default.default.createElement("div",{className:styles.button_inputModal_design_component_container,"data-hook":"ButtonInputModal"},React__default.default.createElement("div",{className:styles.button_inputModal_design_header_text},t("ButtonModal_Design_Tab")),designComponent)))),React__default.default.createElement("div",null,isMobile?mobileView:React__default.default.createElement("div",{className:styles.button_inputModal_container,"data-hook":"ButtonInputModal"},React__default.default.createElement("div",null,React__default.default.createElement("div",{role:"heading","aria-level":2,"aria-labelledby":"button_modal_hdr",className:styles.button_inputModal_header},React__default.default.createElement("div",{className:styles.button_inputModal_header_text},t("ButtonModal_Header"))),React__default.default.createElement(wixRichContentUiComponents.FocusManager,null,React__default.default.createElement("div",{className:styles.button_inputModal_focus_manager},React__default.default.createElement(wixRichContentUiComponents.Tabs,{value:this.state.activeTab,theme:this.styles},React__default.default.createElement(wixRichContentUiComponents.Tab,{label:settingTabLabel,value:"settings",theme:this.styles},React__default.default.createElement("div",{className:styles.button_tab_section,role:"button",tabIndex:"0",onMouseEnter:this.handleOnMouseEnterSettings},settingsComponent)),React__default.default.createElement(wixRichContentUiComponents.Tab,{label:designTabLabel,value:"design",theme:this.styles},React__default.default.createElement("div",{className:styles.button_tab_section},React__default.default.createElement(reactCustomScrollbars.Scrollbars,{ref:this.setScrollbarRef,renderThumbVertical:function(){return _this2.state.isHover?React__default.default.createElement("div",{className:styles.button_inputModal_scrollbar_thumb}):React__default.default.createElement("div",null)},className:styles.button_inputModal_customize_scrollbar_container,onMouseEnter:this.handleOnMouseEnterDesign,onMouseLeave:this.handleOnMouseLeaveDesign},designComponent))))))),React__default.default.createElement(wixRichContentUiComponents.SettingsPanelFooter,{fixed:!0,save:this.onConfirm,cancel:this.onCloseRequested,theme:styles,t:t,buttonSize:wixRichContentUiComponents.BUTTON_SIZE.small})))},ButtonInputModal}(React.Component);ButtonInputModal.defaultProps={doneLabel:"Save",cancelLabel:"Cancel"};var Modals={BUTTON_INPUT:"button-input"},ModalsMap=((_ModalsMap={})[Modals.BUTTON_INPUT]=ButtonInputModal,_ModalsMap),DesktopCustomModalStyles={content:{width:"420px"}},MobileFullScreenCustomStyle={content:{width:"100vw"}},createInlineButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,settings=_ref.settings,isMobile=_ref.isMobile,relValue=_ref.relValue,anchorTarget=_ref.anchorTarget,customStyles=isMobile?MobileFullScreenCustomStyle:DesktopCustomModalStyles,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.advanced_settings)||wixRichContentPluginCommons.PluginSettingsIcon;return[{keyName:"alignLeft",type:wixRichContentPluginCommons.BUTTONS.ALIGN_LEFT,mobile:!1},{keyName:"alignCenter",type:wixRichContentPluginCommons.BUTTONS.ALIGN_CENTER,mobile:!1},{keyName:"alignRight",type:wixRichContentPluginCommons.BUTTONS.ALIGN_RIGHT,mobile:!1},{keyName:"separator1",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!1},{keyName:"advanced_settings",type:wixRichContentPluginCommons.BUTTONS.EXTERNAL_MODAL,fullHeight:!0,icon:icon,modalName:Modals.BUTTON_INPUT,activeTab:"advanced_settings",modalElement:wixRichContentEditorCommon.decorateComponentWithProps(ButtonInputModal,settings),modalStyles:wixRichContentEditorCommon.getModalStyles({customStyles:customStyles,isMobile:isMobile}),mobile:!0,tooltipTextKey:"SettingsButton_Tooltip",settings:settings,isMobile:isMobile,triggerSettingsBi:!0,relValue:relValue,anchorTarget:anchorTarget,pluginId:ACTION_BUTTON_TYPE},{keyName:"delete",type:wixRichContentPluginCommons.BUTTONS.DELETE,mobile:!0}]},InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:17,height:19,viewBox:"0 0 19 19"},props),React__default.default.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"currentColor",transform:"translate(1)"},React__default.default.createElement("rect",{width:"14.211",height:"7",x:"1.395",y:"5.5",rx:"3.5"}),React__default.default.createElement("path",{d:"M11.034 7.541c1.246-.305 2.063.18 2.453 1.459"})))},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,customTooltip=_ref.customTooltip,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||InsertPluginIcon;return[{type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON,name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.BUTTON,tooltip:customTooltip||t("ButtonPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],componentData:DEFAULTS,section:"BlockToolbar_Section_Advanced"}]},createToolbar=function(_ref){var settings=_ref.settings,t=_ref.t,isMobile=_ref.isMobile,customTooltip=_ref.customTooltip,relValue=_ref.relValue,anchorTarget=_ref.anchorTarget;return{InlineButtons:createInlineButtons({settings:settings,isMobile:isMobile,relValue:relValue,anchorTarget:anchorTarget}),InsertButtons:createInsertButtons({t:t,settings:settings,customTooltip:customTooltip,relValue:relValue,anchorTarget:anchorTarget}),name:"button"}};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createLinkButtonPlugin=function(config){return createButtonPlugin(LINK_BUTTON_TYPE,config)},createActionButtonPlugin=function(config){return createButtonPlugin(ACTION_BUTTON_TYPE,config)},createButtonPlugin=function(type,config){var helpers=config.helpers,theme=config.theme,themeData=config.themeData,t=config.t,anchorTarget=config.anchorTarget,relValue=config.relValue,isMobile=config.isMobile,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","theme","themeData","t","anchorTarget","relValue","isMobile",type].map(_toPropertyKey)),isLinkButton=type===LINK_BUTTON_TYPE;settings.isActionButton=!isLinkButton,settings.themeData=themeData;var styles=wixRichContentCommon.mergeStyles({styles:Styles,theme:theme}),customTooltip=settings.insertButtonTooltip;return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({component:ButtonComponent,settings:settings,theme:theme,themeData:themeData,type:type,anchorTarget:anchorTarget,relValue:relValue,toolbar:createToolbar({settings:settings,helpers:helpers,styles:styles,t:t,isMobile:isMobile,customTooltip:customTooltip,relValue:relValue,anchorTarget:anchorTarget}),helpers:helpers,t:t,defaultPluginData:DEFAULTS,isMobile:isMobile,pluginDecorationProps:function(props,componentData){var _componentData$config,width=null===(_componentData$config=componentData.config)||void 0===_componentData$config?void 0:_componentData$config.width,calulatedProps=props;return lodash.isNumber(width)||(calulatedProps=_extends__default.default({},props,{width:width,style:_extends__default.default({},props.style,{width:width})})),wixRichContentPluginCommons.PLUGIN_DECORATION_PROPS[wixRichContentPluginCommons.PLUGIN_DECORATIONS.RESIZEABLE](calulatedProps)},componentWillReceiveDecorationProps:function(props,nextProps,onPropsChange){var width=wixRichContentPluginCommons.PLUGIN_DECORATION_PROPS[wixRichContentPluginCommons.PLUGIN_DECORATIONS.RESIZEABLE](props).width,nextWidth=wixRichContentPluginCommons.PLUGIN_DECORATION_PROPS[wixRichContentPluginCommons.PLUGIN_DECORATIONS.RESIZEABLE](nextProps).width;width!==nextWidth&&onPropsChange({width:nextWidth,size:"inline"})}},rest))};createButtonPlugin.functionName="wix-rich-content-plugin-button";var buttonTypeObj={component:ButtonComponent,classNameStrategies:{alignment:alignmentClassName,size:sizeClassName}},pluginButton=function(createPlugin,type,config){return{config:_extends__default.default({},DEFAULT_CONFIG,config),type:type,createPlugin:createPlugin,ModalsMap:ModalsMap}};exports.ACTION_BUTTON_TYPE=ACTION_BUTTON_TYPE,exports.LINK_BUTTON_TYPE=LINK_BUTTON_TYPE,exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.buttonTypeMapper=function(){var _ref;return(_ref={})[LINK_BUTTON_TYPE]=_extends__default.default({},buttonTypeObj),_ref[ACTION_BUTTON_TYPE]=_extends__default.default({},buttonTypeObj),_ref},exports.createActionButtonPlugin=createActionButtonPlugin,exports.createLinkButtonPlugin=createLinkButtonPlugin,exports.pluginActionButton=function(config){return pluginButton(createActionButtonPlugin,ACTION_BUTTON_TYPE,config)},exports.pluginLinkButton=function(config){return pluginButton(createLinkButtonPlugin,LINK_BUTTON_TYPE,config)};
//# sourceMappingURL=module.cjs.js.map

@@ -1,2 +0,2 @@

import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{handleUploadFinished,handleUploadStart,BUTTONS,PluginSettingsIcon,createBasePlugin}from"wix-rich-content-plugin-commons";import{KEYS_CHARCODE,decorateComponentWithProps,getModalStyles,BUTTON_TYPES,INSERT_PLUGIN_BUTTONS,TOOLBARS,getBottomToolbarModalStyles}from"wix-rich-content-editor-common";import React,{Component,useState}from"react";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import{CloseIcon,TextInput,Button,BUTTON_SIZE,SettingsMobileHeader,SettingsSection,LabeledToggle,SettingsPanelFooter,UrlInputModal,MediaUploadModal,NewUrlInputModal,Tabs,Tab,MOBILE_FULL_SCREEN_CUSTOM_STYLE,DesktopFlyOutModalStyles,Loader,MediaItemErrorMsg,DesktopOverlayModalStyles}from"wix-rich-content-ui-components";import{isValidExactUrl,mergeStyles,isSSR,validate}from"wix-rich-content-common";import ReactPlayer from"react-player";import classNames from"classnames";import ReactDOM,{findDOMNode}from"react-dom";import{isEqual,get,merge}from"lodash";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import pluginVideoSchema from"wix-rich-content-common/dist/statics/schemas/plugin-video.schema.json";import{convertNodeDataToDraft}from"ricos-content/libs/toDraftData";import{TIPTAP_VIDEO_TYPE}from"ricos-content";var _ModalsMap,InsertPluginIcon$1=function(props){return React.createElement("svg",Object.assign({xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 19 19",width:"19",height:"19"},props),React.createElement("defs",null,React.createElement("path",{id:"video-icon-path",d:"M14 7l2.842-1.421A.8.8 0 0 1 18 6.294v6.412a.8.8 0 0 1-1.158.715L14 12v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11a1 1 0 0 1 1 1v2zm0 3.9l2.708 1.354a.2.2 0 0 0 .29-.179V6.922a.2.2 0 0 0-.29-.178L14 8.098V10.9zM2 5v9h11V5H2z"})),React.createElement("g",{fillRule:"evenodd"},React.createElement("mask",{id:"video-icon-mask"},React.createElement("use",{xlinkHref:"#video-icon-path"})),React.createElement("use",{fillRule:"nonzero",xlinkHref:"#video-icon-path"})))},InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19"},props),React.createElement("path",{d:"M5.2,9 L5.8,9 C5.9104569,9 6,9.05969537 6,9.13333333 L6,14.8666667 C6,14.9403046 5.9104569,15 5.8,15 L5.2,15 C5.0895431,15 5,14.9403046 5,14.8666667 L5,9.13333333 C5,9.05969537 5.0895431,9 5.2,9 Z M3.2,8 L3.8,8 C3.9104569,8 4,8.06268014 4,8.14 L4,14.86 C4,14.9373198 3.9104569,15 3.8,15 L3.2,15 C3.0895431,15 3,14.9373198 3,14.86 L3,8.14 C3,8.06268014 3.0895431,8 3.2,8 Z M1.2,10 L1.8,10 C1.91045695,10 2,10.0447715 2,10.1 L2,13.9 C2,13.9552284 1.91045695,14 1.8,14 L1.2,14 C1.08954305,14 1,13.9552284 1,13.9 L1,10.1 C1,10.0447715 1.08954305,10 1.2,10 Z M18,11.6153846 C18,13.4846561 16.4846561,15 14.6153846,15 L7.84615385,15 C7.37883602,15 7,14.621164 7,14.1538462 L7,4.84615385 C8.1282051,4.28205128 9.39743587,4 10.8076923,4 C12.9089391,4 15.0384615,6.12783884 15.0384615,8.23076923 C16.7079981,8.4650878 18,9.8893546 18,11.6153846 Z M8,14 L14.5454545,14 C15.9010625,14 17,12.9010625 17,11.5454545 C17,10.3050264 16.0718944,9.25574738 14.8408286,9.08296796 L14.1363636,8.98409667 L14.1363636,8.27272727 C14.1363636,6.69177453 12.4441412,5 10.8636364,5 C9.81175629,5 8.85922746,5.17619715 8,5.52684396 L8,14 Z"}))},MediaReplaceIcon=function(props){return React.createElement("svg",Object.assign({xmlnsXlink:"http://www.w3.org/1999/xlink",width:19,height:19,viewBox:"0 0 19 19"},props),React.createElement("defs",null,React.createElement("path",{id:"replace-path",d:"M3 7.8V3.2c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2v2.592A6.607 6.607 0 0 1 9.412 3C13.05 3 16 5.91 16 9.5c0 .168-.006.335-.02.5h-1.016a5.51 5.51 0 0 0 .022-.5c0-3.038-2.495-5.5-5.574-5.5a5.583 5.583 0 0 0-4.967 3H7.8c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H3.2a.2.2 0 0 1-.2-.2zm13 3.4v4.6a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2v-2.592A6.607 6.607 0 0 1 9.588 16C5.95 16 3 13.09 3 9.5c0-.168.006-.335.02-.5h1.016a5.496 5.496 0 0 0-.022.5c0 3.038 2.495 5.5 5.574 5.5a5.583 5.583 0 0 0 4.967-3H11.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2h4.6c.11 0 .2.09.2.2z"})),React.createElement("g",{fillRule:"evenodd"},React.createElement("mask",{id:"replace-mask"},React.createElement("use",{xlinkHref:"#replace-path"})),React.createElement("use",{fillRule:"nonzero",xlinkHref:"#replace-path"})))},YoutubeIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19"},props),React.createElement("path",{fillRule:"evenodd",d:"M9.783 3.126c1.117.006 5.217.049 6.359.357.731.196 1.307.776 1.503 1.512C18 6.33 18 9.114 18 9.114s0 2.784-.355 4.118c-.196.736-.772 1.316-1.503 1.513-1.215.327-5.784.355-6.537.357h-.21c-.753-.002-5.322-.03-6.537-.357-.731-.197-1.307-.777-1.503-1.513-.317-1.191-.35-3.538-.355-4.028v-.181c.004-.49.038-2.836.355-4.028.196-.736.772-1.316 1.503-1.512C4 3.175 8.1 3.132 9.218 3.126zM7.76 6.586v5.055l4.444-2.527L7.76 6.586z"}))},styles$3={video_modal_container_big:"_4hyfK",video_modal_container_small:"Wdxcn",video_modal_closeIcon:"_1P3Vk",video_modal_errorIcon:"_4U647",video_modal_header:"_2wuD-",video_modal_header_text:"_35sJQ",video_modal_textInput_customWidth:"_167aE",video_modal_textInput_fullWidth:"cn4jv",video_modal_add_a_Video:"_30xCH",video_modal_or_upload_video_from:"_3Q6uE",video_modal_upload_video:"_20AZa",video_modal_input_button_wrapper:"EmpUt",video_modal_add_button_wrapper:"P3PzB",video_modal_add_button_inline:"_2Z_Pe",video_modal_add_button_inMiddle:"_3TrUw",textInput_input:"_1cb7K",textInput_input_invalid:"_1P6p9",fileInput:"_1qYoT",fileInputLabel:"_30dNJ"},VIDEO_TYPE="wix-draft-plugin-video",VIDEO_TYPE_LEGACY="VIDEO-EMBED",videoButtonsTypes={video:"video",soundCloud:"soundCloud",youTube:"youTube"},mediaTypes=[videoButtonsTypes.soundCloud,videoButtonsTypes.youTube],VideoSelectionInputModal=function(_Component){function VideoSelectionInputModal(props){var _this;(_this=_Component.call(this,props)||this).onUrlChange=function(url){return _this.setState({url:url,showError:!1})},_this.onUrlVideoSelection=function(){var _helpers$onVideoSelec,_this$props=_this.props,componentData=_this$props.componentData,helpers=_this$props.helpers,_this$state$url=_this.state.url,src=(void 0===_this$state$url?"":_this$state$url).trim();if(isValidExactUrl(src)&&ReactPlayer.canPlay(src)){delete componentData.isCustomVideo;var data=_extends({},componentData,{tempData:!1,src:src});_this.onConfirm(data),null==helpers||null===(_helpers$onVideoSelec=helpers.onVideoSelected)||void 0===_helpers$onVideoSelec||_helpers$onVideoSelec.call(helpers,src,(function(metadata){return setTimeout((function(){return _this.updateComponentData(_extends({},data,{metadata:metadata}))}))}),0),_this.closeModal()}else _this.setState({showError:!0})},_this.onUrlInputDoubleClick=function(){_this.setState({url:"https://www.youtube.com/watch?v=vzKryaN44ss"})},_this.closeModal=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.handleKeyPress=function(e){e.charCode===KEYS_CHARCODE.ENTER&&_this.onUrlVideoSelection()},_this.getOnUploadFinished=function(isCustomVideo){return function(_ref){var data=_ref.data,error=_ref.error;_this.setComponentData(_extends({},data,{error:error,isCustomVideo:isCustomVideo}))}},_this.addVideoComponent=function(_ref2,isCustomVideo){var data=_ref2.data,error=_ref2.error;void 0===isCustomVideo&&(isCustomVideo=!1),handleUploadFinished(VIDEO_TYPE,_this.getComponentData,data,error,(function(_ref3){var data=_ref3.data,error=_ref3.error;return _this.onConfirm(_extends({},data,{error:error,isCustomVideo:isCustomVideo}))}))},_this.setComponentData=function(data){_this.props.pubsub.set("componentData",data,_this.blockKey)},_this.updateComponentData=function(data){_this.props.pubsub.update("componentData",data,_this.blockKey)},_this.onLocalLoad=function(_ref4){var src=_ref4.src,tempData=_ref4.tempData;_this.onConfirm(_extends({},_this.props.componentData,{src:src,isCustomVideo:!0,tempData:tempData}))},_this.getComponentData=function(){return _this.props.componentData},_this.handleNativeFileUpload=function(){handleUploadStart(_this.props,_this.getComponentData,_this.inputFile.files[0],_this.onLocalLoad,_this.getOnUploadFinished(!0)),_this.closeModal()},_this.styles=mergeStyles({styles:styles$3,theme:props.theme});var _componentData=_this.props.componentData;_this.state={url:!_componentData.isCustomVideo&&_componentData.src||""},_this.id="VideoUploadModal_FileInput_"+Math.floor(9999*Math.random());var onConfirm=props.onConfirm,onReplace=props.onReplace;return _this.blockKey=_this.getFocusedBlockKey(),_this.onConfirm=function(obj){if(onConfirm){var newBlock=onConfirm(obj).newBlock;_this.blockKey=newBlock.key}else onReplace(obj,_this.blockKey)},_this}_inheritsLoose(VideoSelectionInputModal,_Component);var _proto=VideoSelectionInputModal.prototype;return _proto.getFocusedBlockKey=function(){return this.props.pubsub.get("focusedBlock")},_proto.componentDidMount=function(){this.input.focus(),this.input.setSelectionRange(0,this.input.value.length)},_proto.render=function(){var _this2=this,_this$state=this.state,url=_this$state.url,showError=_this$state.showError,_this$props2=this.props,t=_this$props2.t,handleFileSelection=_this$props2.handleFileSelection,handleFileUpload=_this$props2.handleFileUpload,enableCustomUploadOnMobile=_this$props2.enableCustomUploadOnMobile,isMobile=_this$props2.isMobile,languageDir=_this$props2.languageDir;_this$props2.componentData;var handleClick,theme=_this$props2.theme,styles=this.styles,hasCustomFileUpload=handleFileUpload||handleFileSelection;handleFileSelection&&(handleClick=function(evt){return evt.preventDefault(),handleFileSelection((function(_ref5){var data=_ref5.data,error=_ref5.error;_this2.addVideoComponent({data:data,error:error},!0),_this2.closeModal()}))});var uploadVideoSection=React.createElement("div",null,React.createElement("div",{className:styles.video_modal_or_upload_video_from},t("VideoUploadModal_CustomVideoHeader")),React.createElement("div",{className:styles.video_modal_upload_video},React.createElement("input",{id:this.id,type:"file",accept:"video/*",className:styles.fileInput,ref:function(node){return _this2.inputFile=node},onClick:handleClick,onChange:this.handleNativeFileUpload}),React.createElement("label",{htmlFor:this.id,className:styles.fileInputLabel,role:"button","data-hook":"videoUploadModalCustomVideo",tabIndex:0},"+ ",t("VideoUploadModal_CustomVideoClickText"))));return React.createElement("div",{dir:languageDir},React.createElement("div",{className:styles["video_modal_container_"+(hasCustomFileUpload?"big":"small")],"data-hook":"videoUploadModal"},React.createElement(CloseIcon,{className:styles.video_modal_closeIcon,onClick:function(){return _this2.closeModal()}}),React.createElement("h2",{className:styles.video_modal_add_a_Video},t("VideoUploadModal_Title")),React.createElement("div",{role:"heading","aria-level":3,"aria-labelledby":"video_modal_hdr",className:styles.video_modal_header},React.createElement("h3",{id:"video_modal_hdr",className:styles.video_modal_header_text},t("VideoUploadModal_Header"))),React.createElement("div",{className:styles.video_modal_input_button_wrapper},React.createElement("div",{className:styles["video_modal_textInput_"+(hasCustomFileUpload?"customWidth":"fullWidth")]},React.createElement(TextInput,{inputRef:function(ref){_this2.input=ref},type:"url",onKeyPress:this.handleKeyPress,onChange:this.onUrlChange,onDoubleClick:this.onUrlInputDoubleClick,value:url,error:showError?t("VideoUploadModal_Input_InvalidUrl"):null,placeholder:t("VideoUploadModal_Input_Placeholder"),theme:styles,"data-hook":"videoUploadModalInput"})),React.createElement("div",{className:styles.video_modal_add_button_wrapper},React.createElement(Button,{disabled:!this.state.url,theme:_extends({},styles,theme),dataHook:"videoUploadModalAddButton",onClick:this.onUrlVideoSelection,text:t("VideoUploadModal_AddButtonText"),size:isMobile?BUTTON_SIZE.medium:BUTTON_SIZE.small}))),(!isMobile||enableCustomUploadOnMobile)&&hasCustomFileUpload&&uploadVideoSection))},VideoSelectionInputModal}(Component),Styles={separator:"_3hKgB",videoSettingsTitle:"_31P16",videoSettings_toggleContainer:"_3RIrx",videoSettings_mobile:"_13GtL"},Modals={VIDEO_SELECTION_INPUT:"video-selection-input",VIDEO_SETTINGS:"video-settings"},ModalsMap=((_ModalsMap={})[Modals.VIDEO_SELECTION_INPUT]=VideoSelectionInputModal,_ModalsMap[Modals.VIDEO_SETTINGS]=function(_ref){var _componentData$config,_componentData$config2,_classNames,componentData=_ref.componentData,helpers=_ref.helpers,pubsub=_ref.pubsub,theme=_ref.theme,t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,disableDownload=void 0!==componentData.disableDownload?componentData.disableDownload:!!settings.disableDownload,isSpoilered=null===(_componentData$config=componentData.config)||void 0===_componentData$config||null===(_componentData$config2=_componentData$config.spoiler)||void 0===_componentData$config2?void 0:_componentData$config2.enabled,_useState=useState(!disableDownload),isDownloadEnabled=_useState[0],setIsDownloadEnabled=_useState[1],_useState2=useState(isSpoilered),isSpoilerEnabled=_useState2[0],setIsSpoilerEnabled=_useState2[1],styles=mergeStyles({styles:Styles,theme:theme}),closeModal=function(){var _helpers$closeModal;return null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal?void 0:_helpers$closeModal.call(helpers)},getSpoilerConfig=function(enabled){return{config:_extends({},componentData.config,{spoiler:{enabled:enabled}})}},onDoneClick=function(){var newComponentData=_extends({},componentData,{disableDownload:!isDownloadEnabled},getSpoilerConfig(isSpoilerEnabled));pubsub.update("componentData",newComponentData),closeModal()},isCustomVideo=!!componentData.isCustomVideo,spoilerToggle={toggleKey:"isSpoilerEnabled",labelKey:"VideoSettings_Spoiler_Toggle",dataHook:"videoSpoilerToggle",tooltipText:"Spoiler_Toggle_Tooltip",checked:isSpoilerEnabled,onToggle:function(){var value=!isSpoilerEnabled;setIsSpoilerEnabled(value),pubsub.update("componentData",_extends({},componentData,getSpoilerConfig(value)))}},toggleData=isCustomVideo?[{toggleKey:"isDownloadEnabled",labelKey:"VideoPlugin_Settings_VideoCanBeDownloaded_Label",dataHook:"videoDownloadToggle",tooltipText:"VideoPlugin_Settings_VideoCanBeDownloaded_Tooltip",checked:isDownloadEnabled,onToggle:function(){return setIsDownloadEnabled(!isDownloadEnabled)}}]:[];return settings.spoiler&&toggleData.push(spoilerToggle),React.createElement("div",{"data-hook":"settings",className:classNames(styles.videoSettings,(_classNames={},_classNames[styles.videoSettings_mobile]=isMobile,_classNames))},isMobile?React.createElement(SettingsMobileHeader,{t:t,theme:theme,onCancel:closeModal,onSave:onDoneClick}):React.createElement(React.Fragment,null,React.createElement("div",{className:styles.videoSettingsTitle},t("VideoPlugin_Settings_Header")),React.createElement("div",{className:styles.separator})),React.createElement(SettingsSection,{theme:theme,className:classNames(styles.videoSettings_toggleContainer)},toggleData.map((function(_ref2){var toggleKey=_ref2.toggleKey,labelKey=_ref2.labelKey,tooltipText=_ref2.tooltipText,dataHook=_ref2.dataHook,onToggle=_ref2.onToggle,checked=_ref2.checked;return React.createElement(LabeledToggle,{key:toggleKey,theme:theme,checked:checked,label:t(labelKey),onChange:onToggle,tooltipText:t(tooltipText),dataHook:dataHook})}))),!isMobile&&React.createElement(SettingsPanelFooter,{fixed:!0,theme:theme,cancel:closeModal,save:onDoneClick,t:t}))},_ModalsMap),MediaURLInputModal$1=function(_Component){function MediaURLInputModal(props){var _this;(_this=_Component.call(this,props)||this).onConfirm=function(){var url=_this.state.url;if(url&&ReactPlayer.canPlay(url)){var _helpers$closeModal,_this$props=_this.props,_componentData=_this$props.componentData,helpers=_this$props.helpers,pubsub=_this$props.pubsub,onConfirm=_this$props.onConfirm;onConfirm?onConfirm(_extends({},_componentData,{src:url})):pubsub.update("componentData",{src:url}),helpers&&helpers.onVideoSelected&&helpers.onVideoSelected(url,(function(data){return pubsub.update("componentData",{metadata:_extends({},data)})})),null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers)}else _this.setState({submittedInvalidUrl:!0})},_this.getRenderData=function(){var _this$props2=_this.props,t=_this$props2.t,isMobile=_this$props2.isMobile,type=_this$props2.componentData.type,isYouTube=type===videoButtonsTypes.youTube,isSoundCloud=type===videoButtonsTypes.soundCloud;return{title:isYouTube?"EmbedURL_Social_YouTube_Title":isSoundCloud&&(isMobile?"SoundCloudUploadModal_Header_Mobile":"SoundCloudUploadModal_Header"),placeholder:isYouTube?t("EmbedURL_Social_YouTube_Placeholder"):isSoundCloud&&t("SoundCloudUploadModal_Input_Placeholder"),dataHook:isYouTube?"socialEmbedUploadModal":isSoundCloud?"soundCloudUploadModal":""}};var componentData=_this.props.componentData;return _this.state={url:componentData.src||"",submittedInvalidUrl:!1},_this}return _inheritsLoose(MediaURLInputModal,_Component),MediaURLInputModal.prototype.render=function(){var _this2=this,_this$state=this.state,url=_this$state.url,submittedInvalidUrl=_this$state.submittedInvalidUrl,_this$props3=this.props,t=_this$props3.t,languageDir=_this$props3.languageDir,helpers=_this$props3.helpers,_this$getRenderData=this.getRenderData(),title=_this$getRenderData.title,placeholder=_this$getRenderData.placeholder,dataHook=_this$getRenderData.dataHook;return React.createElement(UrlInputModal,{onConfirm:this.onConfirm,input:url,t:t,languageDir:languageDir,title:t(""+title),submittedInvalidUrl:submittedInvalidUrl,dataHook:dataHook,onInputChange:function(url){return _this2.setState({url:url})},errorMessage:t("SoundCloudUploadModal_Input_InvalidUrl"),placeholder:placeholder,onCloseRequested:helpers.closeModal,buttonSize:BUTTON_SIZE.medium})},MediaURLInputModal}(Component),VideoUploadModal=function(_Component){function VideoUploadModal(props){var _this;(_this=_Component.call(this,props)||this).closeModal=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.getOnUploadFinished=function(isCustomVideo){return function(_ref){var data=_ref.data,error=_ref.error;_this.setComponentData(_extends({},data,{error:error,isCustomVideo:isCustomVideo}))}},_this.addVideoComponent=function(_ref2,isCustomVideo){var data=_ref2.data,error=_ref2.error;void 0===isCustomVideo&&(isCustomVideo=!1),handleUploadFinished(VIDEO_TYPE,_this.getComponentData,data,error,(function(_ref3){var data=_ref3.data,error=_ref3.error;return _this.onConfirm(_extends({},data,{error:error,isCustomVideo:isCustomVideo}))}))},_this.setComponentData=function(data){_this.props.pubsub.set("componentData",data,_this.blockKey)},_this.onLocalLoad=function(_ref4){var src=_ref4.src,tempData=_ref4.tempData;_this.onConfirm(_extends({},_this.props.componentData,{src:src,isCustomVideo:!0,tempData:tempData}))},_this.setInputFile=function(ref){return _this.inputFile=ref},_this.getComponentData=function(){return _this.props.componentData},_this.handleNativeFileUpload=function(){handleUploadStart(_this.props,_this.getComponentData,_this.inputFile.files[0],_this.onLocalLoad,_this.getOnUploadFinished(!0)),_this.closeModal()};var componentData=_this.props.componentData;_this.state={url:!componentData.isCustomVideo&&componentData.src||""},_this.id="VideoUploadModal_FileInput_"+Math.floor(9999*Math.random());var onConfirm=props.onConfirm,onReplace=props.onReplace;return _this.onConfirm=function(obj){if(onConfirm){var newBlock=onConfirm(obj).newBlock;_this.blockKey=newBlock.key}else onReplace(obj,_this.blockKey)},_this}return _inheritsLoose(VideoUploadModal,_Component),VideoUploadModal.prototype.render=function(){var handleClick,_this2=this,_this$props=this.props,t=_this$props.t,handleFileSelection=_this$props.handleFileSelection,handleFileUpload=_this$props.handleFileUpload,enableCustomUploadOnMobile=_this$props.enableCustomUploadOnMobile,isMobile=_this$props.isMobile,languageDir=_this$props.languageDir,showUploadSection=(!isMobile||enableCustomUploadOnMobile)&&(handleFileUpload||handleFileSelection);return handleFileSelection&&(handleClick=function(evt){return evt.preventDefault(),handleFileSelection((function(_ref5){var data=_ref5.data,error=_ref5.error;_this2.addVideoComponent({data:data,error:error},!0),_this2.closeModal()}))}),React.createElement(MediaUploadModal,{id:this.id,isMobile:isMobile,inputFileRef:this.setInputFile,handleClick:handleClick,handleNativeFileUpload:this.handleNativeFileUpload,languageDir:languageDir,title:t("VideoCustomUploadModal_Title"),labelText:t("VideoUploadModal_CustomVideoClickText"),dataHook:"videoUploadModalCustomVideo",showUploadSection:showUploadSection,accept:"video/*"})},VideoUploadModal}(Component),MediaURLInputModal=function(_ref){var t=_ref.t,languageDir=_ref.languageDir,helpers=_ref.helpers,isMobile=_ref.isMobile,url=_ref.url,submittedInvalidUrl=_ref.submittedInvalidUrl,setUrl=_ref.setUrl,_ref$withMobileHeader=_ref.withMobileHeader,withMobileHeader=void 0!==_ref$withMobileHeader&&_ref$withMobileHeader,onConfirm=_ref.onConfirm,dataHook=_ref.dataHook,title=_ref.title,subTitle=_ref.subTitle,saveLabel=_ref.saveLabel,onDblClick=_ref.onDblClick;return React.createElement(NewUrlInputModal,{onConfirm:onConfirm,helpers:helpers,input:url,t:t,languageDir:languageDir,title:title,subTitle:subTitle,submittedInvalidUrl:submittedInvalidUrl,dataHook:dataHook,saveLabel:saveLabel,onInputChange:function(url){return setUrl(url)},errorMessage:t("SoundCloudUploadModal_Input_InvalidUrl"),placeholder:t("EmbedURL_Placeholder"),onCloseRequested:helpers.closeModal,buttonSize:BUTTON_SIZE.medium,isMobile:isMobile,withMobileHeader:withMobileHeader,onDblClick:onDblClick})},styles$2={video_modal_container:"_3jdGM",video_modal_content:"GIPKX",video_modal_tab:"_3Dnt_",video_upload_tab:"_1wXO_",fileInput:"_1W3aw",video_modal_add_button_inline:"_33b75",fileInputLabel:"_6ZyY2"},VideoModal$1=function(props){var _props$componentData=props.componentData,isCustomVideo=_props$componentData.isCustomVideo,src=_props$componentData.src,type=_props$componentData.type,closeModal=props.helpers.closeModal,t=props.t,theme=props.theme,isMobile=props.isMobile,videoTabs={embed:t("VideoModal_Tabs_Embed"),upload:t("VideoModal_Tabs_Upload")},initialUrl=isCustomVideo?"":src||"",_useState=useState(isCustomVideo?videoTabs.upload:videoTabs.embed),activeTab=_useState[0],setActiveTab=_useState[1],_useState2=useState(initialUrl),url=_useState2[0],setUrl=_useState2[1],_useState3=useState(!1),submittedInvalidUrl=_useState3[0],setSubmittedInvalidUrl=_useState3[1],isSoundCloud=type===videoButtonsTypes.soundCloud,onUrlInputDoubleClick=function(){return setUrl("https://www.youtube.com/watch?v=vzKryaN44ss")},onConfirm=function(){if(url&&ReactPlayer.canPlay(url)){var componentData=props.componentData,helpers=props.helpers,pubsub=props.pubsub,_onConfirm=props.onConfirm;_onConfirm?_onConfirm(_extends({},componentData,{src:url,isCustomVideo:!1})):pubsub.update("componentData",{src:url,isCustomVideo:!1}),helpers&&helpers.onVideoSelected&&helpers.onVideoSelected(url,(function(data){return pubsub.update("componentData",{metadata:_extends({},data)})})),null==closeModal||closeModal()}else setSubmittedInvalidUrl(!0)},dataHook=isSoundCloud?"soundCloudUploadModal":"videoMediaUrlModal",title=isSoundCloud?t(isMobile?"SoundCloudUploadModal_Header_Mobile":"SoundCloudUploadModal_Header"):null,renderMediaUrlInputModal=function(){return React.createElement(MediaURLInputModal,Object.assign({},props,{onConfirm:onConfirm,url:url,setUrl:setUrl,submittedInvalidUrl:submittedInvalidUrl,withMobileHeader:isSoundCloud,dataHook:dataHook,title:isSoundCloud&&title,saveLabel:t(isSoundCloud?"Embed_Add_Button_Label":"VideoModal_Embed_ButtonText"),subTitle:!isSoundCloud&&t("VideoModal_Embed_Title"),onDblClick:onUrlInputDoubleClick}))};return isSoundCloud?renderMediaUrlInputModal():React.createElement("div",{className:styles$2.video_modal_container},React.createElement("div",{className:styles$2.video_modal_content},isMobile&&React.createElement(SettingsMobileHeader,{theme:theme,onSave:onConfirm,onCancel:function(){return closeModal()},t:t,title:t("VideoModal_MobileHeader")}),React.createElement(Tabs,{value:activeTab,onTabSelected:function(tab){return setActiveTab(tab)},className:styles$2.video_modal_tabs_header,theme:theme},React.createElement(Tab,{label:videoTabs.embed,value:videoTabs.embed,theme:theme},React.createElement("div",{className:styles$2.video_modal_tab},renderMediaUrlInputModal())),React.createElement(Tab,{label:videoTabs.upload,value:videoTabs.upload,theme:theme},React.createElement("div",{className:classNames(styles$2.video_modal_tab,styles$2.video_upload_tab)},React.createElement(VideoUploadModal,Object.assign({},props)))))))},VideoModal=function(props){var _experiments$newVideo,type=props.componentData.type,experiments=props.experiments,useNewModal=null==experiments||null===(_experiments$newVideo=experiments.newVideoModal)||void 0===_experiments$newVideo?void 0:_experiments$newVideo.enabled,oldVideoModal=mediaTypes.includes(type)?MediaURLInputModal$1:VideoSelectionInputModal,Component=useNewModal?VideoModal$1:oldVideoModal;return React.createElement(Component,props)},SelectionModalCustomStyle={content:{maxWidth:"580px",minHeight:"260px"}},ExtendedSelectionModalCustomStyle={content:{maxWidth:"580px",minHeight:"378px"}},modalContentStyles={width:363,padding:20,boxSizing:"border-box",border:"solid 1px rgba(51, 51, 51, 0.1)",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.06)"},videoModalContentStyles=_extends({height:232},modalContentStyles),embedModalContentStyles=_extends({height:180},modalContentStyles),createInlineButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,spoilerInInlineToolbar=experiments.spoilerInInlineToolbar,newVideoModal=experiments.newVideoModal,useNewModal=null==newVideoModal?void 0:newVideoModal.enabled,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.replace)||MediaReplaceIcon,defaultCustomStyles=isMobile&&!settings.enableCustomUploadOnMobile||!settings.handleFileSelection&&!settings.handleFileUpload?SelectionModalCustomStyle:ExtendedSelectionModalCustomStyle,newModalCustomStyles=isMobile?MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends({},DesktopFlyOutModalStyles,{content:videoModalContentStyles}),customStyles=useNewModal?newModalCustomStyles:defaultCustomStyles,spoilerButton=settings.spoiler&&null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[{keyName:"spoiler",type:BUTTONS.SPOILER,mobile:!0}]:[],settingsButton=null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[]:[{keyName:"settings",type:BUTTONS.VIDEO_SETTINGS,fullHeight:!0,icon:PluginSettingsIcon,modalName:Modals.VIDEO_SETTINGS,modalStyles:getModalStyles({isMobile:isMobile}),t:t,mobile:!0,tooltipTextKey:"SettingsButton_Tooltip",settings:settings,triggerSettingsBi:!0,pluginId:VIDEO_TYPE}];return[{keyName:"sizeSmallCenter",type:BUTTONS.SIZE_SMALL_CENTER,mobile:!1},{keyName:"sizeContent",type:BUTTONS.SIZE_CONTENT,mobile:!1},{keyName:"sizeFullWidth",type:BUTTONS.SIZE_FULL_WIDTH,mobile:!1},{keyName:"separator1",type:BUTTONS.SEPARATOR,mobile:!1},{keyName:"sizeSmallLeft",type:BUTTONS.SIZE_SMALL_LEFT,mobile:!1},{keyName:"sizeSimallRight",type:BUTTONS.SIZE_SMALL_RIGHT,mobile:!1},{keyName:"separator2",type:BUTTONS.SEPARATOR,mobile:!1}].concat(spoilerButton,[{keyName:"replace",type:BUTTONS.EXTERNAL_MODAL,icon:icon,modalElement:decorateComponentWithProps(VideoModal,_extends({},settings)),modalStylesFn:function(_ref2){var buttonRef=_ref2.buttonRef,modalStyles=getModalStyles({customStyles:customStyles,fullScreen:!0,isMobile:isMobile}),_buttonRef$getBoundin=buttonRef.getBoundingClientRect(),top=_buttonRef$getBoundin.top,modalLeft=_buttonRef$getBoundin.left-15,modalTop=top>250?top-250:top+38;return _extends({},modalStyles,{content:_extends({},modalStyles.content,{top:modalTop,left:modalLeft,margin:0,position:"absolute"})})},modalStyles:isMobile?getModalStyles({customStyles:MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):void 0,mobile:!0,tooltipTextKey:"ReplaceVideoButton_Tooltip",t:t}],settingsButton,[{keyName:"delete",type:BUTTONS.DELETE,mobile:!0}])},ReactPlayerWrapper=function(_Component){function ReactPlayerWrapper(props){var _this;return(_this=_Component.call(this,props)||this).isVimeoAndRequireJS=function(){return!isSSR()&&(url=_this.props.url,MATCH_URL=/vimeo\.com\/.+/,!/vimeo\.com\/external\/[0-9]+\..+/.test(url)&&MATCH_URL.test(url))&&!window.Vimeo&&window.requirejs;var url,MATCH_URL},_this.state={vimeoLoaded:!1,isPlaying:!1},_this}_inheritsLoose(ReactPlayerWrapper,_Component);var _proto=ReactPlayerWrapper.prototype;return _proto.componentDidMount=function(){var _this2=this;this.isVimeoAndRequireJS()&&window.require(["https://player.vimeo.com/api/player.js"],(function(player){window.Vimeo={Player:player},_this2.setState({vimeoLoaded:!0})}))},_proto.render=function(){var _this3=this;if(!this.state.vimeoLoaded&&this.isVimeoAndRequireJS())return null;var _this$props=this.props,isPlayable=_this$props.isPlayable,styles=_this$props.styles,disabled=_this$props.disabled;return React.createElement(ReactPlayer,_extends({playing:this.state.isPlaying&&!disabled,onPlay:function(){return _this3.setState({isPlaying:!0})},onPause:function(){return _this3.setState({isPlaying:!1})},style:styles},this.props,{light:!isPlayable}))},ReactPlayerWrapper}(Component);ReactPlayerWrapper.defaultProps={isPlayable:!0};var getVideoSrc=function(src,settings){if(void 0===settings&&(settings={}),"object"==typeof src){if(settings&&settings.getVideoUrl)return settings.getVideoUrl(src);console.error("must set getVideoUrl in plugin config when using custom video source!",src)}return src},styles$1={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},VideoViewer=function(_Component){function VideoViewer(props){var _this;(_this=_Component.call(this,props)||this).setUrl=function(newUrl){var _this$props$onReload,_this$props,url=_this.normalizeUrl(newUrl);url!==_this.state.url&&(_this.setState({url:url}),null===(_this$props$onReload=(_this$props=_this.props).onReload)||void 0===_this$props$onReload||_this$props$onReload.call(_this$props))},_this.normalizeUrl=function(url){return 0===url.toLowerCase().indexOf("vimeo")?"https://"+url:url},_this.findFormalVideoRatio=function(ratio){var target,baseRatios=[1,5/4,4/3,1.5,1.6,16/9,1.85,2,2.35,2.39,3],videoRatios=[].concat(baseRatios,baseRatios.map((function(x){return 1/x}))),closest=(target=ratio,videoRatios.reduce((function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})));return Math.abs(closest-ratio)>.01?ratio:closest},_this.getVideoRatio=function(wrapper){var element=wrapper.querySelector("iframe, video");return _this.findFormalVideoRatio(element.clientHeight/element.clientWidth)},_this.onReactPlayerReady=function(){var _this$props$onReady,_this$props2,wrapper=ReactDOM.findDOMNode(_assertThisInitialized(_this)).parentNode,ratio=_this.getVideoRatio(wrapper);(wrapper.style["padding-bottom"]=100*ratio+"%",_this.props.isLoaded)||((null===(_this$props$onReady=(_this$props2=_this.props).onReady)||void 0===_this$props$onReady?void 0:_this$props$onReady.call(_this$props2))||_this.setState({isLoaded:!0}))},_this.handleContextMenu=function(e){return _this.props.componentData.disableDownload&&e.preventDefault()},_this.disableDownloadProps=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableProps={config:{file:{attributes:{controlsList:"nodownload"}}}},disable={};return void 0!==componentData.disableDownload?disable=componentData.disableDownload?disableProps:{}:void 0!==settings.disableDownload&&(disable=settings.disableDownload?disableProps:{}),disable},validate(props.componentData,pluginVideoSchema),_this.state={url:void 0,isLoaded:!1};var _url=getVideoSrc(props.componentData.src,props.settings);return"string"==typeof _url?_this.state={url:_this.normalizeUrl(_url)}:_url&&"function"==typeof _url.then&&_url.then((function(url){return _this.setState({url:_this.normalizeUrl(url)})})),_this}_inheritsLoose(VideoViewer,_Component);var _proto=VideoViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){var _this2=this;if(!isEqual(nextProps.componentData,this.props.componentData)&&(validate(nextProps.componentData,pluginVideoSchema),nextProps.componentData.src!==this.props.componentData.src)){var url=getVideoSrc(nextProps.componentData.src,nextProps.settings);"string"==typeof url?this.setUrl(url):url&&"function"==typeof url.then&&url.then((function(url){return _this2.setUrl(url)}))}},_proto.componentDidMount=function(){this.setState({key:"mounted"})},_proto.render=function(){var _this$props4=this.props,theme=_this$props4.theme,width=_this$props4.width,height=_this$props4.height,disabled=_this$props4.disabled,setComponentUrl=_this$props4.setComponentUrl;this.styles=this.styles||mergeStyles({styles:styles$1,theme:theme});var _this$state=this.state,url=_this$state.url,key=_this$state.key;null==setComponentUrl||setComponentUrl(url);var props=_extends({url:url,onReady:this.onReactPlayerReady,disabled:disabled,width:width,height:height,key:key},this.disableDownloadProps()),isLoaded=this.props.isLoaded||this.state.isLoaded;return React.createElement(React.Fragment,null,React.createElement(ReactPlayerWrapper,_extends({className:classNames(this.styles.video_player),onContextMenu:this.handleContextMenu,"data-loaded":isLoaded,controls:!1!==this.props.isLoaded},props)))},VideoViewer}(Component);VideoViewer.defaultProps={width:"100%",height:"100%"};var styles={video_player:"_38XzK",videoOverlay:"_2L5av",video_container:"Q31CM",video_overlay:"_37MeN",error:"_3zYcu"},DEFAULTS$1=Object.freeze({config:{size:"content",alignment:"center"}}),VideoComponent=function(_React$Component){function VideoComponent(props){var _this;(_this=_React$Component.call(this,props)||this).setPlayer=function(player){_this.player=player},_this.handleReady=function(){_this.state.isLoaded||_this.props.componentData.tempData||_this.setState({isLoaded:!0})},_this.renderOverlay=function(styles){return React.createElement("div",{className:classNames(styles.video_overlay)})},_this.renderLoader=function(){var isCustomVideo=get(_this.props,"componentData.isCustomVideo");return React.createElement("div",{className:_this.styles.videoOverlay},React.createElement(Loader,{type:"medium",isVerySlowFakeLoader:isCustomVideo}))},_this.onReload=function(){_this.setState({isLoaded:!1})},_this.renderPlayer=function(){var _this$props=_this.props,theme=_this$props.theme,componentData=_this$props.componentData,disabled=_this$props.disabled,settings=_this$props.settings,setComponentUrl=_this$props.setComponentUrl;return React.createElement(VideoViewer,{ref:_this.setPlayer,componentData:componentData,settings:settings,onReady:_this.handleReady,disabled:disabled,theme:theme,setComponentUrl:setComponentUrl,onReload:_this.onReload,isLoaded:_this.state.isLoaded})},_this.onKeyDown=function(e,handler){"Enter"!==e.key&&" "!==e.key||handler()};var isPlayable=!props.blockProps;return _this.state={isLoaded:!1,isPlayable:isPlayable},_this}_inheritsLoose(VideoComponent,_React$Component);var _proto=VideoComponent.prototype;return _proto.componentDidMount=function(){this.handlePlayerFocus()},_proto.componentDidUpdate=function(){this.handlePlayerFocus()},_proto.handlePlayerFocus=function(){var element=findDOMNode(this).querySelector("iframe, video");element&&(element.tabIndex=-1)},_proto.render=function(){var _this2=this;this.styles=this.styles||mergeStyles({styles:styles,theme:this.props.theme});var _this$props2=this.props,className=_this$props2.className,onClick=_this$props2.onClick,t=_this$props2.t,error=_this$props2.componentData.error,_this$state=this.state,isPlayable=_this$state.isPlayable,isLoaded=_this$state.isLoaded,containerClassNames=classNames(this.styles.video_container,className||"");return React.createElement("div",{"data-hook":"videoPlayer",onClick:onClick,className:containerClassNames,onKeyDown:function(e){return _this2.onKeyDown(e,onClick)},draggable:!0},!isPlayable&&this.renderOverlay(this.styles,this.props.t),this.renderPlayer(),!isLoaded&&!error&&this.renderLoader(),error&&React.createElement(MediaItemErrorMsg,{error:error,t:t}))},VideoComponent}(React.Component);VideoComponent.type={VIDEO_TYPE_LEGACY:"VIDEO-EMBED",VIDEO_TYPE:VIDEO_TYPE};var createInsertButtons=function(_ref){var _toolbar$icons,_buttonsMap,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,disableDownload=_ref.disableDownload,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,componentData=void 0!==disableDownload?_extends({},DEFAULTS$1,{disableDownload:disableDownload}):DEFAULTS$1,newVideoModal=experiments.newVideoModal,useNewModal=null==newVideoModal?void 0:newVideoModal.enabled,_ref2=settings||{},_ref2$exposeButtons=_ref2.exposeButtons,exposeButtons=void 0===_ref2$exposeButtons?[videoButtonsTypes.video]:_ref2$exposeButtons,toolbar=_ref2.toolbar,enableCustomUploadOnMobile=_ref2.enableCustomUploadOnMobile,handleFileSelection=_ref2.handleFileSelection,handleFileUpload=_ref2.handleFileUpload,icon=(null==toolbar||null===(_toolbar$icons=toolbar.icons)||void 0===_toolbar$icons?void 0:_toolbar$icons.InsertPluginButtonIcon)||InsertPluginIcon$1,videoModalCustomStyles=isMobile?MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends({},DesktopFlyOutModalStyles,{content:videoModalContentStyles}),embedModalCustomStyles=isMobile?MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends({},DesktopFlyOutModalStyles,{content:embedModalContentStyles}),modalsStyle=getModalStyles({customStyles:useNewModal?videoModalCustomStyles:isMobile&&!enableCustomUploadOnMobile||!handleFileSelection&&!handleFileUpload?SelectionModalCustomStyle:ExtendedSelectionModalCustomStyle,fullScreen:!!useNewModal,isMobile:isMobile}),modalStyles=useNewModal?isMobile?modalsStyle:void 0:modalsStyle,baseButtonProps={type:BUTTON_TYPES.MODAL,modalElement:decorateComponentWithProps(VideoModal,settings)},buttonsMap=((_buttonsMap={})[videoButtonsTypes.video]={name:INSERT_PLUGIN_BUTTONS.VIDEO,tooltip:t("VideoPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},componentData:componentData},_buttonsMap[videoButtonsTypes.soundCloud]={name:INSERT_PLUGIN_BUTTONS.SOUND_CLOUD,tooltip:t("SoundCloudPlugin_InsertButton_Tooltip"),getIcon:function(){return InsertPluginIcon},componentData:_extends({},DEFAULTS$1,{type:videoButtonsTypes.soundCloud})},_buttonsMap[videoButtonsTypes.youTube]={name:INSERT_PLUGIN_BUTTONS.YOUTUBE,tooltip:t("EmbedURL_Social_YouTube_Title"),getIcon:function(){return YoutubeIcon},componentData:_extends({},DEFAULTS$1,{type:videoButtonsTypes.youTube}),section:"BlockToolbar_Section_Embed_Anywhere"},_buttonsMap),toolbars=useNewModal?[TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE]:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],videoButtons=exposeButtons.map((function(buttonType){return _extends({},buttonsMap[buttonType],{toolbars:toolbars,modalStyles:modalStyles,modalStylesFn:useNewModal?function(_ref3){var buttonRef=_ref3.buttonRef,toolbarName=_ref3.toolbarName;return getBottomToolbarModalStyles(buttonRef,{customStyles:buttonType===videoButtonsTypes.soundCloud?embedModalCustomStyles:videoModalCustomStyles},toolbarName)}:void 0},baseButtonProps)}));if(useNewModal){var externalToolbarButtons=exposeButtons.map((function(buttonType){var styles=buttonType===videoButtonsTypes.soundCloud?DesktopFlyOutModalStyles:videoModalCustomStyles;return _extends({},buttonsMap[buttonType],{modalStyles:getModalStyles({customStyles:_extends({},styles,DesktopOverlayModalStyles),fullScreen:!1,isMobile:isMobile}),toolbars:[TOOLBARS.INSERT_PLUGIN]},baseButtonProps)}));videoButtons=[].concat(videoButtons,externalToolbarButtons)}return videoButtons},createToolbar=function(_ref){var t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,disableDownload=_ref.disableDownload,experiments=_ref.experiments;return{InlineButtons:createInlineButtons({t:t,settings:settings,isMobile:isMobile,experiments:experiments}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile,disableDownload:disableDownload,experiments:experiments}),name:"video"}};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createVideoPlugin=function(config){var _config$uiSettings,_config$uiSettings2,helpers=config.helpers,t=config.t,_config$VIDEO_TYPE=config[VIDEO_TYPE],settings=void 0===_config$VIDEO_TYPE?{}:_config$VIDEO_TYPE,isMobile=config.isMobile,spoilerWrapper=config.spoilerWrapper,commonPubsub=config.commonPubsub,experiments=config.experiments,rest=_objectWithoutPropertiesLoose(config,["helpers","t",VIDEO_TYPE,"isMobile","spoilerWrapper","commonPubsub","experiments"].map(_toPropertyKey)),disableDownload=null==config||null===(_config$uiSettings=config.uiSettings)||void 0===_config$uiSettings?void 0:_config$uiSettings.disableDownload,defaultPluginData=void 0!==disableDownload?_extends({},DEFAULTS$1,{disableDownload:disableDownload}):DEFAULTS$1;return createBasePlugin(_extends({component:VideoComponent,type:VIDEO_TYPE,legacyType:"VIDEO-EMBED",toolbar:createToolbar({t:t,settings:_extends({},settings,{commonPubsub:commonPubsub,type:VIDEO_TYPE}),isMobile:isMobile,disableDownload:disableDownload,experiments:experiments}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,disableRightClick:null==config||null===(_config$uiSettings2=config.uiSettings)||void 0===_config$uiSettings2?void 0:_config$uiSettings2.disableRightClick,defaultPluginData:defaultPluginData,spoilerWrapper:settings.spoiler&&spoilerWrapper,commonPubsub:commonPubsub},rest))};createVideoPlugin.functionName=VIDEO_TYPE;var DEFAULTS_config={toolbar:{hidden:[]}},createVideoData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var videoData=isRicosSchema?convertNodeDataToDraft("VIDEO",pluginData):pluginData;return merge({},DEFAULTS$1,videoData)},Video=function(_ref){var context=_ref.context,componentData=_ref.componentData,theme=context.theme,t=context.t,_context$config=context.config,settings=(void 0===_context$config?{}:_context$config)[VIDEO_TYPE]||{};return React.createElement(VideoComponent,{componentData:componentData,theme:theme,t:t,settings:settings,blockProps:{setFocusToBlock:function(){return null}},setComponentUrl:function(){return null},onClick:function(){}})},videoDataDefaults={containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null},video:{src:null,width:null,height:null},thumbnail:{src:null,width:null,height:null},disableDownload:null,title:null},name=TIPTAP_VIDEO_TYPE,pluginVideo=function(config){var defaultOptions,pluginConfig=_extends({},DEFAULTS_config,config);return{config:pluginConfig,type:VIDEO_TYPE,createPlugin:createVideoPlugin,ModalsMap:ModalsMap,createPluginData:createVideoData,tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Video,componentDataDefaults:_extends({},videoDataDefaults,{id:"",loading:{default:!1}}),createExtensionConfig:function(){return{name:name,defaultOptions:defaultOptions,addCommands:function(){return{}}}}}])}};export{Modals,ModalsMap,VIDEO_TYPE,VIDEO_TYPE_LEGACY,VideoViewer,createVideoPlugin,pluginVideo,videoButtonsTypes};
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{ColorPicker,BUTTONS,PluginSettingsIcon,createBasePlugin,PLUGIN_DECORATION_PROPS,PLUGIN_DECORATIONS}from"wix-rich-content-plugin-commons";import{LinkPanelWrapper,KEYS_CHARCODE,decorateComponentWithProps,getModalStyles,BUTTON_TYPES,INSERT_PLUGIN_BUTTONS,TOOLBARS}from"wix-rich-content-editor-common";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{PureComponent,useMemo,useCallback,Component}from"react";import{upperFirst,merge,isEqual,isNumber}from"lodash";import{Scrollbars}from"react-custom-scrollbars";import{SettingsSection,SliderWithInput,TextInput,SettingsMobileHeader,FocusManager,Tabs,Tab,SettingsPanelFooter,BUTTON_SIZE}from"wix-rich-content-ui-components";import{mergeStyles,getRelValue,normalizeUrl,ADD_PLUGIN_LINK_BI,isNewTab,WEB_ADDRESS_CATEGORY}from"wix-rich-content-common";import classNames from"classnames";var styles$3={button_colorPicker:"_2SszI",button_colorPicker_label:"_2AKRF",button_colorPicker_picker:"_2yqbC",button_colorPicker_pickerButton:"_2SqE-",button_marginBottomOpenedColorPicker:"ejyPS",button_marginBottomClosedColorPicker:"_1aNWU"},ColorToggleComponent=function(_PureComponent){function ColorToggleComponent(props){var _this;return(_this=_PureComponent.call(this,props)||this).onClicked=function(){_this.props.toggle(_this.props.pickerType),_this.setState({isOpened:!_this.state.isOpened})},_this.styles=mergeStyles({styles:styles$3,theme:props.theme}),_this.state={color:props.color||"#FFF",isOpened:!1},_this}return _inheritsLoose(ColorToggleComponent,_PureComponent),ColorToggleComponent.getDerivedStateFromProps=function(props,state){var color=props.color;return color===state.color?null:_extends({},state,{color:color})},ColorToggleComponent.prototype.render=function(){var marginButtonClassName=this.props.isToggle?this.styles.button_marginBottomOpenedColorPicker:this.styles.button_marginBottomClosedColorPicker;return React.createElement("div",{className:classNames(this.styles.button_colorPicker,marginButtonClassName)},React.createElement("div",{className:this.styles.button_colorPicker_label},this.props.children),React.createElement("div",{className:this.styles.button_colorPicker_picker},React.createElement("button",{style:{background:this.state.color},className:this.styles.button_colorPicker_pickerButton,onClick:this.onClicked})))},ColorToggleComponent}(PureComponent),COLOR_PICKER_TYPE=Object.freeze({TEXT_COLOR:"textColor",BORDER_COLOR:"borderColor",BACKGROUND_COLOR:"backgroundColor"}),DEFAULT_CONFIG={alignment:"center",size:"small",width:"fit-content"},DEFAULT_PALETTE=["#FFFFFF","#D5D4D4","#000000","#ABCAFF","#81B0FF","#0261FF"],DEFAULTS={config:DEFAULT_CONFIG,button:{settings:{buttonText:"Click Me"},design:{borderRadius:0,borderWidth:0}}},dcStyle={fontElementMap:"_1R1bR",colorPicker:"XG1h7",colorPicker_button_selected:"lCDmR",colorPicker_button:"_1trlh",colorPicker_header:"_2rSZV",colorPicker_separator:"_2Iw7_",mobile:"_35fEU",colorPicker_button_transparent:"B5upi",colorPicker_palette:"_2bLMH",colorPicker_add_color_button:"_3poGL",colorPicker_add_color_label:"_2V_XK",colorPicker_buttons_container:"_3e853",colorPicker_color_button_hidden:"_3ogyn",colorPicker_reset_color_button:"_1tlpS",colorPicker_reset_color_label:"_1D4WR",colorPicker_bottom_container:"_12y5a",customColorPicker_editable_input_container:"_2IlXV",customColorPicker_input_label:"_1-jdF",customColorPicker_input_container:"_2GYrh",customColorPicker_currentColor:"_2mIOQ",hexColorInput:"_154S3",hashtagIcon:"_3Alur",colorPickerDialog:"_2Q7XP",colorPickerDialog_separator:"_1dJCg",colorPickerDialog_buttons_wrapper:"xCNRU",button_designComponent_row:"_3XUTi",colorPickerDialog_buttons:"_1RFGv",colorPickerDialog_button:"_3TW8L",customColorPicker_container:"zQC0Z",customColorPicker_saturation:"_1KSl_",button_designComponent_colorPicker_container:"_2j39G",customColorPicker_hue:"_3bPTz",huePointer_vertical_line:"_2nEik",button_designComponent_design_component:"_3N5Wk",button_designComponent_section_header_color:"_2-XD3",button_designComponent_section_header_border:"_2Firs",modal_footer:"_2Teom",button_designComponent_input_container_width:"_21Ezj",button_designComponent_input_container_corner:"_2j1aL",sliderWithInput_label:"_3UvLB",sliderWithInput_content:"_3JqJc",sliderWithInput_input:"_8uXHg",slider:"_1sVhh"},DesignComponent=function(_PureComponent){function DesignComponent(props){var _this;(_this=_PureComponent.call(this,props)||this).getUserColors=function(){var _this$props=_this.props,themeData=_this$props.settings.themeData,config=_this$props.config,_ref$colors=(themeData||(null==config?void 0:config.themeData)||{}).colors;return{actionColor:(_ref$colors=void 0===_ref$colors?{}:_ref$colors).actionColor,bgColor:_ref$colors.bgColor,textColor:_ref$colors.textColor}},_this.withColorOptions=function(settings){var _this$props$designObj=_this.props.designObj,designObj=void 0===_this$props$designObj?{}:_this$props$designObj,color=designObj.color,borderColor=designObj.borderColor,background=designObj.background,getTextColors=settings.getTextColors,getBorderColors=settings.getBorderColors,getBackgroundColors=settings.getBackgroundColors,customColors=Object.values(_this.getUserColors()).filter((function(c){return!!c})),hasCustomColors=customColors.length>0,customBackgroundColors=getBackgroundColors&&getBackgroundColors()||hasCustomColors&&customColors||DEFAULT_PALETTE,customTextColors=getTextColors&&getTextColors()||hasCustomColors&&customColors||DEFAULT_PALETTE,customBorderColors=getBorderColors&&getBorderColors()||hasCustomColors&&customColors||DEFAULT_PALETTE;return color&&!customTextColors.includes(color)&&customTextColors.push(color),borderColor&&!customBorderColors.includes(borderColor)&&customBorderColors.push(borderColor),background&&!customBackgroundColors.includes(background)&&customBackgroundColors.push(background),{customBackgroundColors:customBackgroundColors,customTextColors:customTextColors,customBorderColors:customBorderColors}},_this.componentDidUpdate=function(){_this.props.onDesignChange(_this.state.design)},_this.onBackgroundColorAdded=function(_ref2){var color=_ref2.color,_this$props$settings=_this.props.settings,getBackgroundColors=_this$props$settings.getBackgroundColors,onBackgroundColorAdded=_this$props$settings.onBackgroundColorAdded;onBackgroundColorAdded&&onBackgroundColorAdded(color);var customBackgroundColors=getBackgroundColors&&getBackgroundColors()||[].concat(_this.state.customBackgroundColors,[color]);_this.setState({customBackgroundColors:customBackgroundColors})},_this.onBorderColorAdded=function(_ref3){var color=_ref3.color,_this$props$settings2=_this.props.settings,getBorderColors=_this$props$settings2.getBorderColors,onBorderColorAdded=_this$props$settings2.onBorderColorAdded;onBorderColorAdded&&onBorderColorAdded(color);var customBorderColors=getBorderColors&&getBorderColors()||[].concat(_this.state.customBorderColors,[color]);_this.setState({customBorderColors:customBorderColors})},_this.onTextColorAdded=function(_ref4){var color=_ref4.color,_this$props$settings3=_this.props.settings,getTextColors=_this$props$settings3.getTextColors,onTextColorAdded=_this$props$settings3.onTextColorAdded;onTextColorAdded&&onTextColorAdded(color);var customTextColors=getTextColors&&getTextColors()||[].concat(_this.state.customTextColors,[color]);_this.setState({customTextColors:customTextColors})},_this.onBorderWidthChange=function(value){var design=_extends({},_this.state.design,{borderWidth:value});_this.setState({design:design})},_this.onBorderRadiusChange=function(value){var design=_extends({},_this.state.design,{borderRadius:value});_this.setState({design:design})},_this.onTextColorChange=function(_ref5){var color=_ref5.color,design=_extends({},_this.state.design,{color:color});_this.setState({design:design})},_this.onBorderColorChange=function(_ref6){var color=_ref6.color,design=_extends({},_this.state.design,{borderColor:color});_this.setState({design:design})},_this.onBackgroundColorChange=function(_ref7){var color=_ref7.color,design=_extends({},_this.state.design,{background:color});_this.setState({design:design})},_this.onToggled=function(pickerType){_this.setState({pickerType:pickerType!==_this.state.pickerType?pickerType:""})},_this.styles=mergeStyles({styles:dcStyle,theme:props.theme});var _designObj=_this.props.designObj,_this$props2=_this.props,_settings=_this$props2.settings,colors=_this$props2.settings.colors,_this$getUserColors=_this.getUserColors(),_actionColor=_this$getUserColors.actionColor,_bgColor=_this$getUserColors.bgColor;return _this.state=_extends({design:{borderWidth:_designObj.borderWidth,borderRadius:_designObj.borderRadius,color:(null==_designObj?void 0:_designObj.color)||(null==colors?void 0:colors.color1)||_bgColor,borderColor:(null==_designObj?void 0:_designObj.borderColor)||(null==colors?void 0:colors.color8)||_actionColor,background:(null==_designObj?void 0:_designObj.background)||(null==colors?void 0:colors.color8)||_actionColor}},_this.withColorOptions(_settings),{pickerType:""}),_this.originalDesign=_this.state.design,_this}_inheritsLoose(DesignComponent,_PureComponent);var _proto=DesignComponent.prototype;return _proto.renderColorPicker=function(color,userColors,onColorAdded,onChange,pickerType,label){var _this$props3=this.props,t=_this$props3.t,isMobile=_this$props3.isMobile,theme=_this$props3.theme,palette=_this$props3.palette,paletteColors=(isMobile?null==palette?void 0:palette.slice(0,5):null==palette?void 0:palette.slice(0,7))||DEFAULT_PALETTE;return React.createElement("div",null,React.createElement(ColorToggleComponent,{theme:theme,color:color,pickerType:pickerType,isMobile:isMobile,isToggle:this.state.pickerType===pickerType,toggle:this.onToggled.bind(this)},label),this.state.pickerType===pickerType&&React.createElement(ColorPicker,{color:color,palette:paletteColors,userColors:userColors.slice(0,100),onColorAdded:onColorAdded,theme:this.styles,isMobile:isMobile,onChange:onChange.bind(this),t:t},(function(_ref8){var renderUserColors=_ref8.renderUserColors,renderAddColorButton=_ref8.renderAddColorButton;return React.createElement("div",{className:dcStyle.colorPicker_palette},React.createElement("div",{className:dcStyle.colorPicker_buttons_container},React.createElement("div",null,renderUserColors()),React.createElement("div",null,renderAddColorButton())))})))},_proto.render=function(){var styles=this.styles,_this$props4=this.props,theme=_this$props4.theme,t=_this$props4.t,design=this.state.design;return React.createElement("div",{className:styles.button_designComponent_design_component},React.createElement(SettingsSection,{theme:theme,ariaProps:{"aria-label":"border selection",role:"region"}},React.createElement("div",{className:styles.button_designComponent_row},React.createElement("div",{className:styles.button_designComponent_section_header_border},t("ButtonModal_Border_Section")),React.createElement("div",{className:styles.button_designComponent_input_container_width},React.createElement("div",{className:styles.button_designComponent_slider_with_input},React.createElement(SliderWithInput,{defaultValue:parseInt(design.borderWidth),min:0,max:15,label:t("ButtonModal_Width_Input"),onChange:this.onBorderWidthChange.bind(this),theme:this.styles}))),React.createElement("div",{className:styles.button_designComponent_input_container_corner},React.createElement("div",{className:styles.button_designComponent_slider_with_input},React.createElement(SliderWithInput,{defaultValue:parseInt(design.borderRadius),min:0,max:15,label:t("ButtonModal_Radius_Input"),onChange:this.onBorderRadiusChange.bind(this),theme:this.styles}))))),React.createElement(SettingsSection,{theme:theme,ariaProps:{"aria-label":"color selection",role:"region"}},React.createElement("div",{className:styles.button_designComponent_colorPicker_container},React.createElement("div",{className:styles.button_designComponent_section_header_color},t("ButtonModal_Color_Section")),this.renderColorPicker(design.color,this.state.customTextColors,this.onTextColorAdded,this.onTextColorChange,COLOR_PICKER_TYPE.TEXT_COLOR,t("ButtonModal_Text_Color")),this.renderColorPicker(design.borderColor,this.state.customBorderColors,this.onBorderColorAdded,this.onBorderColorChange,COLOR_PICKER_TYPE.BORDER_COLOR,t("ButtonModal_Border_Color")),this.renderColorPicker(design.background,this.state.customBackgroundColors,this.onBackgroundColorAdded,this.onBackgroundColorChange,COLOR_PICKER_TYPE.BACKGROUND_COLOR,t("ButtonModal_Background_Color")))))},DesignComponent}(PureComponent),styles$2={button_settingsComponent_header_ButtonText:"xkpAc",button_settingsComponent_header_ButtonLink:"_14F9_",settingTab:"_2xyfE",button_settingsComponent_errorMessage:"_2h5Fl",button_settingsComponent_checkBoxes:"_14ORO",checkbox:"_3Hilb",modal_footer:"_3elaw",button_settingsComponent_name_feild:"_188Qs",button_settingsComponent_section_content:"_1C5Yo",textInput_errorIcon:"_1xbb3",textInput_input:"qcafS",checkbox_icon_unchecked:"RtRdo",checkbox_wrapper:"_2fcaQ",checkbox_inputLabel:"_2pmSA",checkbox_infoIcon:"_3FYiR",checkbox_icon:"_1_-x3",checkbox_icon_checked:"_2T4d1",checkbox_label:"Av8Hx"},SettingsComponent=function(_PureComponent){function SettingsComponent(props){var _this;(_this=_PureComponent.call(this,props)||this).componentDidUpdate=function(){_this.props.onSettingsChange(_this.state)},_this.handleKeyPress=function(e){_this.props.onKeyPress(e)},_this.onTextChanged=function(buttonText){return _this.setState({buttonText:buttonText})},_this.onLinkPanelChange=function(_ref){var url=_ref.url,rel=_ref.rel,target=_ref.target;_this.setState({url:url,rel:rel,target:target})};var _this$props=_this.props,settingsObj=_this$props.settingsObj,showLinkPanel=_this$props.showLinkPanel;_this.styles=mergeStyles({styles:styles$2,theme:props.theme});var linkButtonSettings=showLinkPanel?{url:settingsObj.url,target:settingsObj.target,rel:settingsObj.rel}:{};return _this.state=_extends({buttonText:settingsObj.buttonText},linkButtonSettings),_this}return _inheritsLoose(SettingsComponent,_PureComponent),SettingsComponent.prototype.render=function(){var _this2=this,_this$props2=this.props,t=_this$props2.t,showLinkPanel=_this$props2.showLinkPanel,uiSettings=_this$props2.uiSettings,theme=_this$props2.theme,anchorTarget=_this$props2.anchorTarget,relValue=_this$props2.relValue,_this$state=this.state,buttonText=_this$state.buttonText,linkValues={url:_this$state.url,target:_this$state.target,rel:_this$state.rel},_ref3=(uiSettings||{}).linkPanel||{},showNewTabCheckbox=_ref3.showNewTabCheckbox,showNoFollowCheckbox=_ref3.showNoFollowCheckbox,showSponsoredCheckbox=_ref3.showSponsoredCheckbox,textInputBaseProps={inputRef:function(ref){return _this2.input=ref},type:"text",onKeyPress:this.handleKeyPress,theme:this.styles,"data-hook":"ButtonInputModal"};return React.createElement("div",{className:this.styles.button_settingsComponent_section_content},React.createElement("div",{className:this.styles.button_settingsComponent_name_feild},React.createElement("div",{className:this.styles.button_settingsComponent_header_ButtonText},t("ButtonModal_Button_Text")),React.createElement("div",null,React.createElement(TextInput,_extends({},textInputBaseProps,{onChange:this.onTextChanged,value:buttonText,placeholder:t("ButtonModal_InputName_Placeholder")})))),showLinkPanel&&React.createElement(React.Fragment,null,React.createElement("div",{className:this.styles.button_settingsComponent_header_ButtonLink},t("ButtonModal_Button_Link")),React.createElement(LinkPanelWrapper,{linkValues:linkValues,onChange:this.onLinkPanelChange,showNewTabCheckbox:showNewTabCheckbox,showNoFollowCheckbox:showNoFollowCheckbox,showSponsoredCheckbox:showSponsoredCheckbox,theme:theme,t:t,anchorTarget:anchorTarget,relValue:relValue})))},SettingsComponent}(PureComponent),styles$1={button_PreviewComponent_preview_container:"_1pfLf",button_PreviewComponent_header:"_2LNs5",button_PreviewComponent_button:"_17oKq"},alignmentStyles={button_align_left:"_20daj",button_align_right:"_308Nj",button_align_center:"_3ZwKi"},Styles={button_container:"iRkxq",button_text:"_3Ybc9",button_size_content:"_1eLXB"},alignmentClassName=function(componentData,theme,styles){var _ref$alignment=(componentData.config||{}).alignment,alignment=void 0===_ref$alignment?"center":_ref$alignment,mergedStyles=mergeStyles({styles:alignmentStyles,theme:theme});return classNames(mergedStyles["button_align_"+alignment],styles["align"+upperFirst(alignment)],theme["align"+upperFirst(alignment)])},sizeClassName=function(componentData,theme){return mergeStyles({styles:Styles,theme:theme}).button_size_content},LINK_BUTTON_TYPE="wix-draft-plugin-link-button",ACTION_BUTTON_TYPE="wix-draft-plugin-action-button",ButtonViewer=function(_ref){var style=_ref.style,anchorTarget=_ref.anchorTarget,onClick=_ref.onClick,theme=_ref.theme,helpers=_ref.helpers,url=_ref.url,_ref$target=_ref.target,target=void 0===_ref$target?anchorTarget:_ref$target,rel=_ref.rel,buttonText=_ref.buttonText,styles=mergeStyles({styles:Styles,theme:theme}),isActionButton=useMemo((function(){return Boolean(onClick)}),[onClick]),onClickHandler=useCallback((function(args){var _helpers$onViewerActi;null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,isActionButton?ACTION_BUTTON_TYPE:LINK_BUTTON_TYPE,"Click",""),isActionButton&&(null==onClick||onClick(args))}),[helpers.onViewerAction]),Component=isActionButton?"div":"a",props=merge({className:styles.button_container,style:style,tabIndex:0,role:"button",onKeyDown:function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),onClickHandler(e))}},!isActionButton&&{href:url,target:target,rel:getRelValue(rel)});return React.createElement(Component,Object.assign({},props,{"data-hook":"buttonViewer",onClick:onClickHandler}),React.createElement("div",{className:styles.button_text},buttonText))},ButtonComponent=function(_Component){function ButtonComponent(){return _Component.apply(this,arguments)||this}return _inheritsLoose(ButtonComponent,_Component),ButtonComponent.prototype.render=function(){var _button$settings,_this$props$settings$,_this$props$settings$2,_this$props$settings$3,_this$props=this.props,button=_this$props.componentData.button,_this$props$settings=_this$props.settings,onClick=_this$props$settings.onClick,themeData=_this$props$settings.themeData,config=_this$props.config,helpers=_this$props.helpers,anchorTarget=_this$props.anchorTarget,theme=this.props.theme,_ref$colors=(themeData||(null==config?void 0:config.themeData)||{}).colors,actionColor=(_ref$colors=void 0===_ref$colors?{}:_ref$colors).actionColor,bgColor=_ref$colors.bgColor,buttonText=button.settings.buttonText,url=null===(_button$settings=button.settings)||void 0===_button$settings?void 0:_button$settings.url,linkButtonSettings={};url&&(linkButtonSettings={url:normalizeUrl(url),target:button.settings.target,rel:button.settings.rel});var style=_extends({border:"0px solid blue",color:(null===(_this$props$settings$=this.props.settings.colors)||void 0===_this$props$settings$?void 0:_this$props$settings$.color1)||bgColor,background:(null===(_this$props$settings$2=this.props.settings.colors)||void 0===_this$props$settings$2?void 0:_this$props$settings$2.color8)||actionColor,borderColor:(null===(_this$props$settings$3=this.props.settings.colors)||void 0===_this$props$settings$3?void 0:_this$props$settings$3.color8)||actionColor},this.props.style,button.design);return React.createElement(ButtonViewer,_extends({style:style,buttonText:buttonText,theme:theme,onClick:onClick,helpers:helpers,anchorTarget:anchorTarget},linkButtonSettings))},ButtonComponent}(Component);ButtonComponent.alignmentClassName=function(componentData,theme,styles,isMobile){return alignmentClassName(componentData,theme,styles)},ButtonComponent.sizeClassName=function(componentData,theme,styles,isMobile){return sizeClassName(0,theme)};var _ModalsMap,PreviewComponent=function(_PureComponent){function PreviewComponent(props){var _this;return(_this=_PureComponent.call(this,props)||this).styles=mergeStyles({styles:styles$1,theme:props.theme}),_this}return _inheritsLoose(PreviewComponent,_PureComponent),PreviewComponent.prototype.render=function(){var t=this.props.t;return React.createElement("div",{className:this.styles.button_PreviewComponent_preview_container},React.createElement("div",{className:this.styles.button_PreviewComponent_header},t("ButtonModal_Preview_Label")),React.createElement("div",{className:this.styles.button_PreviewComponent_button},React.createElement(ButtonComponent,_extends({theme:this.props.theme,style:{pointerEvents:"none"}},this.props))))},PreviewComponent}(PureComponent),styles={button_inputModal_container:"_3CeGG",button_inputModal_design_component_container:"_16j6_",button_inputModal_focus_manager:"_1AC6h",button_inputModal_separator:"_1xCrk",button_inputModal_scroll:"_2rQY7",button_inputModal_header:"_8nHX-",button_inputModal_header_text:"JYASm",button_inputModal_design_header_text:"xyPQ8",header_icon:"_3RhSs",errorMessage:"_1ouNG",button_inputModal_errorIcon:"_2P439",tabs_headers_option:"WNTP-",scroll_container:"_3eSRM",button_inputModal_tabLabel:"_3KQDi",button_inputModal_scrollbar_thumb:"_3jQ_2",scrollbar_thumb:"_2bEcK",button_inputModal_customize_scrollbar_container:"_22y9g",button_tab_section:"WHGFF"},ButtonInputModal=function(_Component){function ButtonInputModal(props){var _this;(_this=_Component.call(this,props)||this).onSettingsChanged=function(settings){var design=_this.state.design;if(!isEqual(settings,_this.state.settings)){var _this$props=_this.props,pubsub=_this$props.pubsub,button=_this$props.componentData.button;pubsub.update("componentData",{button:_extends({},button,{settings:settings,design:design})}),_this.setState({settings:settings})}},_this.onDesignChanged=function(design){var settings=_this.state.settings;if("design"!==_this.state.activeTab&&_this.setState({activeTab:"design"}),!isEqual(design,_this.state.design)){var _this$props2=_this.props,pubsub=_this$props2.pubsub,button=_this$props2.componentData.button;pubsub.update("componentData",{button:_extends({},button,{design:design,settings:settings})}),_this.setState({design:design})}},_this.triggerLinkBi=function(){var _this$props$helpers,_this$props$helpers$o,_this$state$settings=_this.state.settings,rel=_this$state$settings.rel,target=_this$state$settings.target,url=_this$state$settings.url;null===(_this$props$helpers=_this.props.helpers)||void 0===_this$props$helpers||null===(_this$props$helpers$o=_this$props$helpers.onPluginAction)||void 0===_this$props$helpers$o||_this$props$helpers$o.call(_this$props$helpers,ADD_PLUGIN_LINK_BI,{plugin_id:LINK_BUTTON_TYPE,params:{link:url,newTab:isNewTab(target),category:WEB_ADDRESS_CATEGORY,rel:rel}})},_this.onConfirm=function(){var closeModal=_this.props.helpers.closeModal,_this$state=_this.state,initialComponentData=_this$state.initialComponentData,design=_this$state.design;!initialComponentData.design.color&&_this.currentColorEqualToConfig()&&_this.removeColorsFromComponentData(design),_this.setState({submitted:!0,isOpen:!1}),_this.triggerLinkBi(),closeModal()},_this.currentColorEqualToConfig=function(){var design=_this.state.design,colors=_this.props.settings.colors;return!(design.color!==(null==colors?void 0:colors.color1)&&"#FEFDFD"!==design.color||design.borderColor!==(null==colors?void 0:colors.color8)&&"#0261FF"!==design.borderColor||design.background!==(null==colors?void 0:colors.color8)&&"#0261FF"!==design.background)},_this.handleKeyPress=function(e){e.charCode===KEYS_CHARCODE.ENTER&&_this.onConfirm(),e.charCode===KEYS_CHARCODE.ESCAPE&&_this.onCloseRequested()},_this.onCloseRequested=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,pubsub=_this$props3.pubsub,onCloseRequested=_this$props3.onCloseRequested,closeModal=_this$props3.helpers.closeModal,initialComponentData=_this.state.initialComponentData;initialComponentData.design.color||_this.removeColorsFromComponentData(initialComponentData.design),onCloseRequested?onCloseRequested(_extends({},componentData,{button:initialComponentData})):pubsub.update("componentData",{button:initialComponentData}),_this.setState({isOpen:!1}),closeModal()},_this.removeColorsFromComponentData=function(design){var pubsub=_this.props.pubsub,designToSave={borderWidth:design.borderWidth,padding:design.padding,borderRadius:design.borderRadius},componentDataToSave=pubsub.get("componentData");componentDataToSave.button.design=designToSave,pubsub.set("componentData",componentDataToSave)},_this.handleOnMouseEnterDesign=function(){_this.setState({isHover:!0,activeTab:"design"})},_this.handleOnMouseLeaveDesign=function(){_this.setState({isHover:!1})},_this.handleOnMouseEnterSettings=function(){_this.setState({activeTab:"settings"})},_this.styles=mergeStyles({styles:styles,theme:props.theme});var _button=_this.props.componentData.button;return _this.state={settings:_extends({},_button.settings),design:_extends({},_button.design),initialComponentData:_extends({},_button),isHover:!1,activeTab:"settings",showLinkPanel:!_this.props.settings.isActionButton},_this.setScrollbarRef=function(element){_this.scrollbarRef=element},_this}return _inheritsLoose(ButtonInputModal,_Component),ButtonInputModal.prototype.render=function(){var _this2=this,_this$props4=this.props,theme=_this$props4.theme,t=_this$props4.t,uiSettings=_this$props4.uiSettings;_this$props4.doneLabel,_this$props4.cancelLabel;var isMobile=_this$props4.isMobile,showLinkPanel=this.state.showLinkPanel,styles=this.styles,settingTabLabel=React.createElement("div",{className:styles.button_inputModal_settingTab},React.createElement("div",{className:styles.button_inputModal_tabTitle},React.createElement("p",{className:styles.button_inputModal_tabLabel},t("ButtonModal_Settings_Tab")))),designTabLabel=React.createElement("p",{className:styles.button_inputModal_tabLabel},t("ButtonModal_Design_Tab")),settingsComponent=React.createElement(SettingsComponent,_extends({t:t,theme:theme,uiSettings:uiSettings},this.props,{onSettingsChange:this.onSettingsChanged.bind(this),settingsObj:this.state.settings,onKeyPress:this.handleKeyPress,showLinkPanel:showLinkPanel})),designComponent=React.createElement(DesignComponent,_extends({},this.props,{theme:theme,t:t,styles:styles,onDesignChange:this.onDesignChanged.bind(this),designObj:this.state.design,onKeyPress:this.handleKeyPress})),mobileView=null;return isMobile&&(mobileView=React.createElement("div",null,React.createElement(SettingsMobileHeader,{onSave:this.onConfirm,onCancel:this.onCloseRequested,theme:styles,t:t}),React.createElement(PreviewComponent,_extends({buttonObj:this.state},this.props)),React.createElement("div",{className:styles.button_inputModal_scroll,ref:this.setScrollbarRef},React.createElement("div",{className:styles.button_inputModal_container,"data-hook":"ButtonInputModal"},React.createElement("div",{className:styles.button_inputModal_header_text},t("ButtonModal_Settings_Tab")),settingsComponent),React.createElement("div",{className:styles.button_inputModal_separator}),React.createElement("div",{className:styles.button_inputModal_design_component_container,"data-hook":"ButtonInputModal"},React.createElement("div",{className:styles.button_inputModal_design_header_text},t("ButtonModal_Design_Tab")),designComponent)))),React.createElement("div",null,isMobile?mobileView:React.createElement("div",{className:styles.button_inputModal_container,"data-hook":"ButtonInputModal"},React.createElement("div",null,React.createElement("div",{role:"heading","aria-level":2,"aria-labelledby":"button_modal_hdr",className:styles.button_inputModal_header},React.createElement("div",{className:styles.button_inputModal_header_text},t("ButtonModal_Header"))),React.createElement(FocusManager,null,React.createElement("div",{className:styles.button_inputModal_focus_manager},React.createElement(Tabs,{value:this.state.activeTab,theme:this.styles},React.createElement(Tab,{label:settingTabLabel,value:"settings",theme:this.styles},React.createElement("div",{className:styles.button_tab_section,role:"button",tabIndex:"0",onMouseEnter:this.handleOnMouseEnterSettings},settingsComponent)),React.createElement(Tab,{label:designTabLabel,value:"design",theme:this.styles},React.createElement("div",{className:styles.button_tab_section},React.createElement(Scrollbars,{ref:this.setScrollbarRef,renderThumbVertical:function(){return _this2.state.isHover?React.createElement("div",{className:styles.button_inputModal_scrollbar_thumb}):React.createElement("div",null)},className:styles.button_inputModal_customize_scrollbar_container,onMouseEnter:this.handleOnMouseEnterDesign,onMouseLeave:this.handleOnMouseLeaveDesign},designComponent))))))),React.createElement(SettingsPanelFooter,{fixed:!0,save:this.onConfirm,cancel:this.onCloseRequested,theme:styles,t:t,buttonSize:BUTTON_SIZE.small})))},ButtonInputModal}(Component);ButtonInputModal.defaultProps={doneLabel:"Save",cancelLabel:"Cancel"};var Modals={BUTTON_INPUT:"button-input"},ModalsMap=((_ModalsMap={})[Modals.BUTTON_INPUT]=ButtonInputModal,_ModalsMap),DesktopCustomModalStyles={content:{width:"420px"}},MobileFullScreenCustomStyle={content:{width:"100vw"}},createInlineButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,settings=_ref.settings,isMobile=_ref.isMobile,relValue=_ref.relValue,anchorTarget=_ref.anchorTarget,customStyles=isMobile?MobileFullScreenCustomStyle:DesktopCustomModalStyles,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.advanced_settings)||PluginSettingsIcon;return[{keyName:"alignLeft",type:BUTTONS.ALIGN_LEFT,mobile:!1},{keyName:"alignCenter",type:BUTTONS.ALIGN_CENTER,mobile:!1},{keyName:"alignRight",type:BUTTONS.ALIGN_RIGHT,mobile:!1},{keyName:"separator1",type:BUTTONS.SEPARATOR,mobile:!1},{keyName:"advanced_settings",type:BUTTONS.EXTERNAL_MODAL,fullHeight:!0,icon:icon,modalName:Modals.BUTTON_INPUT,activeTab:"advanced_settings",modalElement:decorateComponentWithProps(ButtonInputModal,settings),modalStyles:getModalStyles({customStyles:customStyles,isMobile:isMobile}),mobile:!0,tooltipTextKey:"SettingsButton_Tooltip",settings:settings,isMobile:isMobile,triggerSettingsBi:!0,relValue:relValue,anchorTarget:anchorTarget,pluginId:ACTION_BUTTON_TYPE},{keyName:"delete",type:BUTTONS.DELETE,mobile:!0}]},InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:17,height:19,viewBox:"0 0 19 19"},props),React.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"currentColor",transform:"translate(1)"},React.createElement("rect",{width:"14.211",height:"7",x:"1.395",y:"5.5",rx:"3.5"}),React.createElement("path",{d:"M11.034 7.541c1.246-.305 2.063.18 2.453 1.459"})))},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,customTooltip=_ref.customTooltip,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||InsertPluginIcon;return[{type:BUTTON_TYPES.BUTTON,name:INSERT_PLUGIN_BUTTONS.BUTTON,tooltip:customTooltip||t("ButtonPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},toolbars:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],componentData:DEFAULTS,section:"BlockToolbar_Section_Advanced"}]},createToolbar=function(_ref){var settings=_ref.settings,t=_ref.t,isMobile=_ref.isMobile,customTooltip=_ref.customTooltip,relValue=_ref.relValue,anchorTarget=_ref.anchorTarget;return{InlineButtons:createInlineButtons({settings:settings,isMobile:isMobile,relValue:relValue,anchorTarget:anchorTarget}),InsertButtons:createInsertButtons({t:t,settings:settings,customTooltip:customTooltip,relValue:relValue,anchorTarget:anchorTarget}),name:"button"}};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createLinkButtonPlugin=function(config){return createButtonPlugin(LINK_BUTTON_TYPE,config)},createActionButtonPlugin=function(config){return createButtonPlugin(ACTION_BUTTON_TYPE,config)},createButtonPlugin=function(type,config){var helpers=config.helpers,theme=config.theme,themeData=config.themeData,t=config.t,anchorTarget=config.anchorTarget,relValue=config.relValue,isMobile=config.isMobile,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose(config,["helpers","theme","themeData","t","anchorTarget","relValue","isMobile",type].map(_toPropertyKey)),isLinkButton=type===LINK_BUTTON_TYPE;settings.isActionButton=!isLinkButton,settings.themeData=themeData;var styles=mergeStyles({styles:Styles,theme:theme}),customTooltip=settings.insertButtonTooltip;return createBasePlugin(_extends({component:ButtonComponent,settings:settings,theme:theme,themeData:themeData,type:type,anchorTarget:anchorTarget,relValue:relValue,toolbar:createToolbar({settings:settings,helpers:helpers,styles:styles,t:t,isMobile:isMobile,customTooltip:customTooltip,relValue:relValue,anchorTarget:anchorTarget}),helpers:helpers,t:t,defaultPluginData:DEFAULTS,isMobile:isMobile,pluginDecorationProps:function(props,componentData){var _componentData$config,width=null===(_componentData$config=componentData.config)||void 0===_componentData$config?void 0:_componentData$config.width,calulatedProps=props;return isNumber(width)||(calulatedProps=_extends({},props,{width:width,style:_extends({},props.style,{width:width})})),PLUGIN_DECORATION_PROPS[PLUGIN_DECORATIONS.RESIZEABLE](calulatedProps)},componentWillReceiveDecorationProps:function(props,nextProps,onPropsChange){var width=PLUGIN_DECORATION_PROPS[PLUGIN_DECORATIONS.RESIZEABLE](props).width,nextWidth=PLUGIN_DECORATION_PROPS[PLUGIN_DECORATIONS.RESIZEABLE](nextProps).width;width!==nextWidth&&onPropsChange({width:nextWidth,size:"inline"})}},rest))};createButtonPlugin.functionName="wix-rich-content-plugin-button";var buttonTypeObj={component:ButtonComponent,classNameStrategies:{alignment:alignmentClassName,size:sizeClassName}},typeMapper=function(){var _ref;return(_ref={})[LINK_BUTTON_TYPE]=_extends({},buttonTypeObj),_ref[ACTION_BUTTON_TYPE]=_extends({},buttonTypeObj),_ref},pluginButton=function(createPlugin,type,config){return{config:_extends({},DEFAULT_CONFIG,config),type:type,createPlugin:createPlugin,ModalsMap:ModalsMap}},pluginLinkButton=function(config){return pluginButton(createLinkButtonPlugin,LINK_BUTTON_TYPE,config)},pluginActionButton=function(config){return pluginButton(createActionButtonPlugin,ACTION_BUTTON_TYPE,config)};export{ACTION_BUTTON_TYPE,LINK_BUTTON_TYPE,Modals,ModalsMap,typeMapper as buttonTypeMapper,createActionButtonPlugin,createLinkButtonPlugin,pluginActionButton,pluginLinkButton};
//# sourceMappingURL=module.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_assertThisInitialized=require("@babel/runtime/helpers/assertThisInitialized"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),ReactDOM=require("react-dom"),ReactPlayer=require("react-player"),wixRichContentCommon=require("wix-rich-content-common"),classNames=require("classnames"),pluginVideoSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-video.schema.json"),lodash=require("lodash");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_assertThisInitialized__default=_interopDefaultLegacy(_assertThisInitialized),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),ReactDOM__default=_interopDefaultLegacy(ReactDOM),ReactPlayer__default=_interopDefaultLegacy(ReactPlayer),classNames__default=_interopDefaultLegacy(classNames),pluginVideoSchema__default=_interopDefaultLegacy(pluginVideoSchema),VIDEO_TYPE="wix-draft-plugin-video",DEFAULTS_configViewer={getVideoUrl:function(src){return"https://video.wixstatic.com/"+src.pathname}},ReactPlayerWrapper=function(_Component){function ReactPlayerWrapper(props){var _this;return(_this=_Component.call(this,props)||this).isVimeoAndRequireJS=function(){return!wixRichContentCommon.isSSR()&&(url=_this.props.url,MATCH_URL=/vimeo\.com\/.+/,!/vimeo\.com\/external\/[0-9]+\..+/.test(url)&&MATCH_URL.test(url))&&!window.Vimeo&&window.requirejs;var url,MATCH_URL},_this.state={vimeoLoaded:!1,isPlaying:!1},_this}_inheritsLoose__default.default(ReactPlayerWrapper,_Component);var _proto=ReactPlayerWrapper.prototype;return _proto.componentDidMount=function(){var _this2=this;this.isVimeoAndRequireJS()&&window.require(["https://player.vimeo.com/api/player.js"],(function(player){window.Vimeo={Player:player},_this2.setState({vimeoLoaded:!0})}))},_proto.render=function(){var _this3=this;if(!this.state.vimeoLoaded&&this.isVimeoAndRequireJS())return null;var _this$props=this.props,isPlayable=_this$props.isPlayable,styles=_this$props.styles,disabled=_this$props.disabled;return React__default.default.createElement(ReactPlayer__default.default,_extends__default.default({playing:this.state.isPlaying&&!disabled,onPlay:function(){return _this3.setState({isPlaying:!0})},onPause:function(){return _this3.setState({isPlaying:!1})},style:styles},this.props,{light:!isPlayable}))},ReactPlayerWrapper}(React.Component);ReactPlayerWrapper.defaultProps={isPlayable:!0};var getVideoSrc=function(src,settings){if(void 0===settings&&(settings={}),"object"==typeof src){if(settings&&settings.getVideoUrl)return settings.getVideoUrl(src);console.error("must set getVideoUrl in plugin config when using custom video source!",src)}return src},styles={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},VideoViewer=function(_Component){function VideoViewer(props){var _this;(_this=_Component.call(this,props)||this).setUrl=function(newUrl){var _this$props$onReload,_this$props,url=_this.normalizeUrl(newUrl);url!==_this.state.url&&(_this.setState({url:url}),null===(_this$props$onReload=(_this$props=_this.props).onReload)||void 0===_this$props$onReload||_this$props$onReload.call(_this$props))},_this.normalizeUrl=function(url){return 0===url.toLowerCase().indexOf("vimeo")?"https://"+url:url},_this.findFormalVideoRatio=function(ratio){var target,baseRatios=[1,5/4,4/3,1.5,1.6,16/9,1.85,2,2.35,2.39,3],videoRatios=[].concat(baseRatios,baseRatios.map((function(x){return 1/x}))),closest=(target=ratio,videoRatios.reduce((function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})));return Math.abs(closest-ratio)>.01?ratio:closest},_this.getVideoRatio=function(wrapper){var element=wrapper.querySelector("iframe, video");return _this.findFormalVideoRatio(element.clientHeight/element.clientWidth)},_this.onReactPlayerReady=function(){var _this$props$onReady,_this$props2,wrapper=ReactDOM__default.default.findDOMNode(_assertThisInitialized__default.default(_this)).parentNode,ratio=_this.getVideoRatio(wrapper);(wrapper.style["padding-bottom"]=100*ratio+"%",_this.props.isLoaded)||((null===(_this$props$onReady=(_this$props2=_this.props).onReady)||void 0===_this$props$onReady?void 0:_this$props$onReady.call(_this$props2))||_this.setState({isLoaded:!0}))},_this.handleContextMenu=function(e){return _this.props.componentData.disableDownload&&e.preventDefault()},_this.disableDownloadProps=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableProps={config:{file:{attributes:{controlsList:"nodownload"}}}},disable={};return void 0!==componentData.disableDownload?disable=componentData.disableDownload?disableProps:{}:void 0!==settings.disableDownload&&(disable=settings.disableDownload?disableProps:{}),disable},wixRichContentCommon.validate(props.componentData,pluginVideoSchema__default.default),_this.state={url:void 0,isLoaded:!1};var _url=getVideoSrc(props.componentData.src,props.settings);return"string"==typeof _url?_this.state={url:_this.normalizeUrl(_url)}:_url&&"function"==typeof _url.then&&_url.then((function(url){return _this.setState({url:_this.normalizeUrl(url)})})),_this}_inheritsLoose__default.default(VideoViewer,_Component);var _proto=VideoViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){var _this2=this;if(!lodash.isEqual(nextProps.componentData,this.props.componentData)&&(wixRichContentCommon.validate(nextProps.componentData,pluginVideoSchema__default.default),nextProps.componentData.src!==this.props.componentData.src)){var url=getVideoSrc(nextProps.componentData.src,nextProps.settings);"string"==typeof url?this.setUrl(url):url&&"function"==typeof url.then&&url.then((function(url){return _this2.setUrl(url)}))}},_proto.componentDidMount=function(){this.setState({key:"mounted"})},_proto.render=function(){var _this$props4=this.props,theme=_this$props4.theme,width=_this$props4.width,height=_this$props4.height,disabled=_this$props4.disabled,setComponentUrl=_this$props4.setComponentUrl;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles,theme:theme});var _this$state=this.state,url=_this$state.url,key=_this$state.key;null==setComponentUrl||setComponentUrl(url);var props=_extends__default.default({url:url,onReady:this.onReactPlayerReady,disabled:disabled,width:width,height:height,key:key},this.disableDownloadProps()),isLoaded=this.props.isLoaded||this.state.isLoaded;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ReactPlayerWrapper,_extends__default.default({className:classNames__default.default(this.styles.video_player),onContextMenu:this.handleContextMenu,"data-loaded":isLoaded,controls:!1!==this.props.isLoaded},props)))},VideoViewer}(React.Component);VideoViewer.defaultProps={width:"100%",height:"100%"};var containerClassName=function(theme){return wixRichContentCommon.mergeStyles({styles:styles,theme:theme}).video_container},typeMapper=function(){var _ref;return(_ref={})["VIDEO-EMBED"]={component:VideoViewer,classNameStrategies:{container:containerClassName}},_ref[VIDEO_TYPE]={component:VideoViewer,classNameStrategies:{container:containerClassName}},_ref};exports.VIDEO_TYPE=VIDEO_TYPE,exports.pluginVideo=function(config){return{config:_extends__default.default({},DEFAULTS_configViewer,config),type:VIDEO_TYPE,typeMapper:typeMapper}},exports.videoTypeMapper=typeMapper;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),classnames=require("classnames"),lodash=require("lodash"),wixRichContentCommon=require("wix-rich-content-common"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),classnames__default=_interopDefaultLegacy(classnames),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),LINK_BUTTON_TYPE="wix-draft-plugin-link-button",ACTION_BUTTON_TYPE="wix-draft-plugin-action-button",alignmentStyles={button_align_left:"_20daj",button_align_right:"_308Nj",button_align_center:"_3ZwKi"},Styles={button_container:"iRkxq",button_text:"_3Ybc9",button_size_content:"_1eLXB"},alignmentClassName=function(componentData,theme,styles){var _ref$alignment=(componentData.config||{}).alignment,alignment=void 0===_ref$alignment?"center":_ref$alignment,mergedStyles=wixRichContentCommon.mergeStyles({styles:alignmentStyles,theme:theme});return classnames__default.default(mergedStyles["button_align_"+alignment],styles["align"+lodash.upperFirst(alignment)],theme["align"+lodash.upperFirst(alignment)])},sizeClassName=function(componentData,theme){return wixRichContentCommon.mergeStyles({styles:Styles,theme:theme}).button_size_content},ButtonViewer=function(_ref){var style=_ref.style,anchorTarget=_ref.anchorTarget,onClick=_ref.onClick,theme=_ref.theme,helpers=_ref.helpers,url=_ref.url,_ref$target=_ref.target,target=void 0===_ref$target?anchorTarget:_ref$target,rel=_ref.rel,buttonText=_ref.buttonText,styles=wixRichContentCommon.mergeStyles({styles:Styles,theme:theme}),isActionButton=React.useMemo((function(){return Boolean(onClick)}),[onClick]),onClickHandler=React.useCallback((function(args){var _helpers$onViewerActi;null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,isActionButton?ACTION_BUTTON_TYPE:LINK_BUTTON_TYPE,"Click",""),isActionButton&&(null==onClick||onClick(args))}),[helpers.onViewerAction]),Component=isActionButton?"div":"a",props=lodash.merge({className:styles.button_container,style:style,tabIndex:0,role:"button",onKeyDown:function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),onClickHandler(e))}},!isActionButton&&{href:url,target:target,rel:wixRichContentCommon.getRelValue(rel)});return React__default.default.createElement(Component,Object.assign({},props,{"data-hook":"buttonViewer",onClick:onClickHandler}),React__default.default.createElement("div",{className:styles.button_text},buttonText))},ButtonComponent=function(_Component){function ButtonComponent(){return _Component.apply(this,arguments)||this}return _inheritsLoose__default.default(ButtonComponent,_Component),ButtonComponent.prototype.render=function(){var _button$settings,_this$props$settings$,_this$props$settings$2,_this$props$settings$3,_this$props=this.props,button=_this$props.componentData.button,_this$props$settings=_this$props.settings,onClick=_this$props$settings.onClick,themeData=_this$props$settings.themeData,config=_this$props.config,helpers=_this$props.helpers,anchorTarget=_this$props.anchorTarget,theme=this.props.theme,_ref$colors=(themeData||(null==config?void 0:config.themeData)||{}).colors,actionColor=(_ref$colors=void 0===_ref$colors?{}:_ref$colors).actionColor,bgColor=_ref$colors.bgColor,buttonText=button.settings.buttonText,url=null===(_button$settings=button.settings)||void 0===_button$settings?void 0:_button$settings.url,linkButtonSettings={};url&&(linkButtonSettings={url:wixRichContentCommon.normalizeUrl(url),target:button.settings.target,rel:button.settings.rel});var style=_extends__default.default({border:"0px solid blue",color:(null===(_this$props$settings$=this.props.settings.colors)||void 0===_this$props$settings$?void 0:_this$props$settings$.color1)||bgColor,background:(null===(_this$props$settings$2=this.props.settings.colors)||void 0===_this$props$settings$2?void 0:_this$props$settings$2.color8)||actionColor,borderColor:(null===(_this$props$settings$3=this.props.settings.colors)||void 0===_this$props$settings$3?void 0:_this$props$settings$3.color8)||actionColor},this.props.style,button.design);return React__default.default.createElement(ButtonViewer,_extends__default.default({style:style,buttonText:buttonText,theme:theme,onClick:onClick,helpers:helpers,anchorTarget:anchorTarget},linkButtonSettings))},ButtonComponent}(React.Component);ButtonComponent.alignmentClassName=function(componentData,theme,styles,isMobile){return alignmentClassName(componentData,theme,styles)},ButtonComponent.sizeClassName=function(componentData,theme,styles,isMobile){return sizeClassName(0,theme)};var buttonTypeObj={component:ButtonComponent,classNameStrategies:{alignment:alignmentClassName,size:sizeClassName}},typeMapper=function(){var _ref;return(_ref={})[LINK_BUTTON_TYPE]=_extends__default.default({},buttonTypeObj),_ref[ACTION_BUTTON_TYPE]=_extends__default.default({},buttonTypeObj),_ref};Object.freeze({TEXT_COLOR:"textColor",BORDER_COLOR:"borderColor",BACKGROUND_COLOR:"backgroundColor"});var DEFAULT_CONFIG={alignment:"center",size:"small",width:"fit-content"},pluginButton=function(type,config){return{config:_extends__default.default({},DEFAULT_CONFIG,config),type:type,typeMapper:typeMapper}};exports.ACTION_BUTTON_TYPE=ACTION_BUTTON_TYPE,exports.LINK_BUTTON_TYPE=LINK_BUTTON_TYPE,exports.buttonTypeMapper=typeMapper,exports.pluginActionButton=function(config){return pluginButton(ACTION_BUTTON_TYPE,config)},exports.pluginLinkButton=function(config){return pluginButton(LINK_BUTTON_TYPE,config)};
//# sourceMappingURL=module.viewer.cjs.js.map

@@ -1,2 +0,2 @@

import _extends from"@babel/runtime/helpers/extends";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import ReactDOM from"react-dom";import ReactPlayer from"react-player";import{isSSR,validate,mergeStyles}from"wix-rich-content-common";import classNames from"classnames";import pluginVideoSchema from"wix-rich-content-common/dist/statics/schemas/plugin-video.schema.json";import{isEqual}from"lodash";var VIDEO_TYPE="wix-draft-plugin-video",DEFAULTS_configViewer={getVideoUrl:function(src){return"https://video.wixstatic.com/"+src.pathname}},ReactPlayerWrapper=function(_Component){function ReactPlayerWrapper(props){var _this;return(_this=_Component.call(this,props)||this).isVimeoAndRequireJS=function(){return!isSSR()&&(url=_this.props.url,MATCH_URL=/vimeo\.com\/.+/,!/vimeo\.com\/external\/[0-9]+\..+/.test(url)&&MATCH_URL.test(url))&&!window.Vimeo&&window.requirejs;var url,MATCH_URL},_this.state={vimeoLoaded:!1,isPlaying:!1},_this}_inheritsLoose(ReactPlayerWrapper,_Component);var _proto=ReactPlayerWrapper.prototype;return _proto.componentDidMount=function(){var _this2=this;this.isVimeoAndRequireJS()&&window.require(["https://player.vimeo.com/api/player.js"],(function(player){window.Vimeo={Player:player},_this2.setState({vimeoLoaded:!0})}))},_proto.render=function(){var _this3=this;if(!this.state.vimeoLoaded&&this.isVimeoAndRequireJS())return null;var _this$props=this.props,isPlayable=_this$props.isPlayable,styles=_this$props.styles,disabled=_this$props.disabled;return React.createElement(ReactPlayer,_extends({playing:this.state.isPlaying&&!disabled,onPlay:function(){return _this3.setState({isPlaying:!0})},onPause:function(){return _this3.setState({isPlaying:!1})},style:styles},this.props,{light:!isPlayable}))},ReactPlayerWrapper}(Component);ReactPlayerWrapper.defaultProps={isPlayable:!0};var getVideoSrc=function(src,settings){if(void 0===settings&&(settings={}),"object"==typeof src){if(settings&&settings.getVideoUrl)return settings.getVideoUrl(src);console.error("must set getVideoUrl in plugin config when using custom video source!",src)}return src},styles={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},VideoViewer=function(_Component){function VideoViewer(props){var _this;(_this=_Component.call(this,props)||this).setUrl=function(newUrl){var _this$props$onReload,_this$props,url=_this.normalizeUrl(newUrl);url!==_this.state.url&&(_this.setState({url:url}),null===(_this$props$onReload=(_this$props=_this.props).onReload)||void 0===_this$props$onReload||_this$props$onReload.call(_this$props))},_this.normalizeUrl=function(url){return 0===url.toLowerCase().indexOf("vimeo")?"https://"+url:url},_this.findFormalVideoRatio=function(ratio){var target,baseRatios=[1,5/4,4/3,1.5,1.6,16/9,1.85,2,2.35,2.39,3],videoRatios=[].concat(baseRatios,baseRatios.map((function(x){return 1/x}))),closest=(target=ratio,videoRatios.reduce((function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})));return Math.abs(closest-ratio)>.01?ratio:closest},_this.getVideoRatio=function(wrapper){var element=wrapper.querySelector("iframe, video");return _this.findFormalVideoRatio(element.clientHeight/element.clientWidth)},_this.onReactPlayerReady=function(){var _this$props$onReady,_this$props2,wrapper=ReactDOM.findDOMNode(_assertThisInitialized(_this)).parentNode,ratio=_this.getVideoRatio(wrapper);(wrapper.style["padding-bottom"]=100*ratio+"%",_this.props.isLoaded)||((null===(_this$props$onReady=(_this$props2=_this.props).onReady)||void 0===_this$props$onReady?void 0:_this$props$onReady.call(_this$props2))||_this.setState({isLoaded:!0}))},_this.handleContextMenu=function(e){return _this.props.componentData.disableDownload&&e.preventDefault()},_this.disableDownloadProps=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableProps={config:{file:{attributes:{controlsList:"nodownload"}}}},disable={};return void 0!==componentData.disableDownload?disable=componentData.disableDownload?disableProps:{}:void 0!==settings.disableDownload&&(disable=settings.disableDownload?disableProps:{}),disable},validate(props.componentData,pluginVideoSchema),_this.state={url:void 0,isLoaded:!1};var _url=getVideoSrc(props.componentData.src,props.settings);return"string"==typeof _url?_this.state={url:_this.normalizeUrl(_url)}:_url&&"function"==typeof _url.then&&_url.then((function(url){return _this.setState({url:_this.normalizeUrl(url)})})),_this}_inheritsLoose(VideoViewer,_Component);var _proto=VideoViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){var _this2=this;if(!isEqual(nextProps.componentData,this.props.componentData)&&(validate(nextProps.componentData,pluginVideoSchema),nextProps.componentData.src!==this.props.componentData.src)){var url=getVideoSrc(nextProps.componentData.src,nextProps.settings);"string"==typeof url?this.setUrl(url):url&&"function"==typeof url.then&&url.then((function(url){return _this2.setUrl(url)}))}},_proto.componentDidMount=function(){this.setState({key:"mounted"})},_proto.render=function(){var _this$props4=this.props,theme=_this$props4.theme,width=_this$props4.width,height=_this$props4.height,disabled=_this$props4.disabled,setComponentUrl=_this$props4.setComponentUrl;this.styles=this.styles||mergeStyles({styles:styles,theme:theme});var _this$state=this.state,url=_this$state.url,key=_this$state.key;null==setComponentUrl||setComponentUrl(url);var props=_extends({url:url,onReady:this.onReactPlayerReady,disabled:disabled,width:width,height:height,key:key},this.disableDownloadProps()),isLoaded=this.props.isLoaded||this.state.isLoaded;return React.createElement(React.Fragment,null,React.createElement(ReactPlayerWrapper,_extends({className:classNames(this.styles.video_player),onContextMenu:this.handleContextMenu,"data-loaded":isLoaded,controls:!1!==this.props.isLoaded},props)))},VideoViewer}(Component);VideoViewer.defaultProps={width:"100%",height:"100%"};var containerClassName=function(theme){return mergeStyles({styles:styles,theme:theme}).video_container},typeMapper=function(){var _ref;return(_ref={})["VIDEO-EMBED"]={component:VideoViewer,classNameStrategies:{container:containerClassName}},_ref[VIDEO_TYPE]={component:VideoViewer,classNameStrategies:{container:containerClassName}},_ref},pluginVideo=function(config){return{config:_extends({},DEFAULTS_configViewer,config),type:VIDEO_TYPE,typeMapper:typeMapper}};export{VIDEO_TYPE,pluginVideo,typeMapper as videoTypeMapper};
import _extends from"@babel/runtime/helpers/extends";import classnames from"classnames";import{upperFirst,merge}from"lodash";import{mergeStyles,getRelValue,normalizeUrl}from"wix-rich-content-common";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{useMemo,useCallback,Component}from"react";var LINK_BUTTON_TYPE="wix-draft-plugin-link-button",ACTION_BUTTON_TYPE="wix-draft-plugin-action-button",alignmentStyles={button_align_left:"_20daj",button_align_right:"_308Nj",button_align_center:"_3ZwKi"},Styles={button_container:"iRkxq",button_text:"_3Ybc9",button_size_content:"_1eLXB"},alignmentClassName=function(componentData,theme,styles){var _ref$alignment=(componentData.config||{}).alignment,alignment=void 0===_ref$alignment?"center":_ref$alignment,mergedStyles=mergeStyles({styles:alignmentStyles,theme:theme});return classnames(mergedStyles["button_align_"+alignment],styles["align"+upperFirst(alignment)],theme["align"+upperFirst(alignment)])},sizeClassName=function(componentData,theme){return mergeStyles({styles:Styles,theme:theme}).button_size_content},ButtonViewer=function(_ref){var style=_ref.style,anchorTarget=_ref.anchorTarget,onClick=_ref.onClick,theme=_ref.theme,helpers=_ref.helpers,url=_ref.url,_ref$target=_ref.target,target=void 0===_ref$target?anchorTarget:_ref$target,rel=_ref.rel,buttonText=_ref.buttonText,styles=mergeStyles({styles:Styles,theme:theme}),isActionButton=useMemo((function(){return Boolean(onClick)}),[onClick]),onClickHandler=useCallback((function(args){var _helpers$onViewerActi;null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,isActionButton?ACTION_BUTTON_TYPE:LINK_BUTTON_TYPE,"Click",""),isActionButton&&(null==onClick||onClick(args))}),[helpers.onViewerAction]),Component=isActionButton?"div":"a",props=merge({className:styles.button_container,style:style,tabIndex:0,role:"button",onKeyDown:function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),onClickHandler(e))}},!isActionButton&&{href:url,target:target,rel:getRelValue(rel)});return React.createElement(Component,Object.assign({},props,{"data-hook":"buttonViewer",onClick:onClickHandler}),React.createElement("div",{className:styles.button_text},buttonText))},ButtonComponent=function(_Component){function ButtonComponent(){return _Component.apply(this,arguments)||this}return _inheritsLoose(ButtonComponent,_Component),ButtonComponent.prototype.render=function(){var _button$settings,_this$props$settings$,_this$props$settings$2,_this$props$settings$3,_this$props=this.props,button=_this$props.componentData.button,_this$props$settings=_this$props.settings,onClick=_this$props$settings.onClick,themeData=_this$props$settings.themeData,config=_this$props.config,helpers=_this$props.helpers,anchorTarget=_this$props.anchorTarget,theme=this.props.theme,_ref$colors=(themeData||(null==config?void 0:config.themeData)||{}).colors,actionColor=(_ref$colors=void 0===_ref$colors?{}:_ref$colors).actionColor,bgColor=_ref$colors.bgColor,buttonText=button.settings.buttonText,url=null===(_button$settings=button.settings)||void 0===_button$settings?void 0:_button$settings.url,linkButtonSettings={};url&&(linkButtonSettings={url:normalizeUrl(url),target:button.settings.target,rel:button.settings.rel});var style=_extends({border:"0px solid blue",color:(null===(_this$props$settings$=this.props.settings.colors)||void 0===_this$props$settings$?void 0:_this$props$settings$.color1)||bgColor,background:(null===(_this$props$settings$2=this.props.settings.colors)||void 0===_this$props$settings$2?void 0:_this$props$settings$2.color8)||actionColor,borderColor:(null===(_this$props$settings$3=this.props.settings.colors)||void 0===_this$props$settings$3?void 0:_this$props$settings$3.color8)||actionColor},this.props.style,button.design);return React.createElement(ButtonViewer,_extends({style:style,buttonText:buttonText,theme:theme,onClick:onClick,helpers:helpers,anchorTarget:anchorTarget},linkButtonSettings))},ButtonComponent}(Component);ButtonComponent.alignmentClassName=function(componentData,theme,styles,isMobile){return alignmentClassName(componentData,theme,styles)},ButtonComponent.sizeClassName=function(componentData,theme,styles,isMobile){return sizeClassName(0,theme)};var buttonTypeObj={component:ButtonComponent,classNameStrategies:{alignment:alignmentClassName,size:sizeClassName}},typeMapper=function(){var _ref;return(_ref={})[LINK_BUTTON_TYPE]=_extends({},buttonTypeObj),_ref[ACTION_BUTTON_TYPE]=_extends({},buttonTypeObj),_ref};Object.freeze({TEXT_COLOR:"textColor",BORDER_COLOR:"borderColor",BACKGROUND_COLOR:"backgroundColor"});var DEFAULT_CONFIG={alignment:"center",size:"small",width:"fit-content"},pluginButton=function(type,config){return{config:_extends({},DEFAULT_CONFIG,config),type:type,typeMapper:typeMapper}},pluginLinkButton=function(config){return pluginButton(LINK_BUTTON_TYPE,config)},pluginActionButton=function(config){return pluginButton(ACTION_BUTTON_TYPE,config)};export{ACTION_BUTTON_TYPE,LINK_BUTTON_TYPE,typeMapper as buttonTypeMapper,pluginActionButton,pluginLinkButton};
//# sourceMappingURL=module.viewer.js.map

@@ -1,3 +0,4 @@

import { ContainerClassNameStrategy } from 'wix-rich-content-common';
export declare const containerClassName: ContainerClassNameStrategy;
import { ClassNameStrategy } from 'wix-rich-content-common';
export declare const alignmentClassName: ClassNameStrategy;
export declare const sizeClassName: ClassNameStrategy;
//# sourceMappingURL=classNameStrategies.d.ts.map

@@ -1,4 +0,17 @@

/// <reference types="react" />
export declare const videoModalContentStyles: React.CSSProperties;
export declare const embedModalContentStyles: React.CSSProperties;
export declare const ALIGN_CENTER = "center";
export declare const settingsTabValue = "settings";
export declare const designTabValue = "design";
export declare const BUTTON_TYPES: string[];
export declare const DEFAULT_COLOR = "#000000";
export declare const DEFAULT_SELECTION_COLOR = "#000000";
export declare const COLOR_PICKER_TYPE: Readonly<{
TEXT_COLOR: string;
BORDER_COLOR: string;
BACKGROUND_COLOR: string;
}>;
export declare const DEFAULT_CONFIG: {
alignment: string;
size: string;
width: string;
};
//# sourceMappingURL=constants.d.ts.map

@@ -0,11 +1,18 @@

export declare const DEFAULT_PALETTE: string[];
export declare const DEFAULTS: {
config: {
toolbar: {
hidden: never[];
alignment: string;
size: string;
width: string;
};
button: {
settings: {
buttonText: string;
};
design: {
borderRadius: number;
borderWidth: number;
};
};
configViewer: {
getVideoUrl: (src: any) => string;
};
};
//# sourceMappingURL=defaults.d.ts.map

@@ -1,4 +0,5 @@

import { VideoPluginEditorConfig } from './types';
import { LinkButtonPluginEditorConfig, ActionButtonPluginEditorConfig } from './types';
import { EditorPluginCreator } from 'wix-rich-content-common';
export declare const pluginVideo: EditorPluginCreator<VideoPluginEditorConfig>;
export declare const pluginLinkButton: EditorPluginCreator<LinkButtonPluginEditorConfig>;
export declare const pluginActionButton: EditorPluginCreator<ActionButtonPluginEditorConfig>;
//# sourceMappingURL=editor.d.ts.map

@@ -1,6 +0,3 @@

export { default as VideoInsertPluginIcon } from './VideoInsertPluginIcon';
export { default as SoundCloudInsertPluginIcon } from './SoundCloudInsertPluginIcon';
export { default as MediaReplaceIcon } from './MediaReplaceIcon';
export { default as VideoCameraIcon } from './VideoCameraIcon';
export { default as YoutubeIcon } from './YoutubeIcon';
export { default as InsertPluginIcon } from './InsertPluginIcon';
export { default as EyeDropperIcon } from './EyeDropperIcon';
//# sourceMappingURL=index.d.ts.map

@@ -1,6 +0,6 @@

export { createVideoPlugin } from './createVideoPlugin';
export { default as VideoViewer } from './video-viewer';
export { VIDEO_TYPE_LEGACY, VIDEO_TYPE, videoButtonsTypes } from './types';
export { createActionButtonPlugin, createLinkButtonPlugin } from './createButtonPlugin';
export { typeMapper as buttonTypeMapper } from './typeMapper';
export { LINK_BUTTON_TYPE, ACTION_BUTTON_TYPE } from './types';
export { Modals, ModalsMap } from './modals';
export { pluginVideo } from './editor';
export { pluginActionButton, pluginLinkButton } from './editor';
//# sourceMappingURL=index.d.ts.map

@@ -1,11 +0,9 @@

/// <reference types="react" />
import VideoSelectionInputModal from './toolbar/videoSelectionInputModal';
import ButtonInputModal from './toolbar/buttonInputModal';
declare const Modals: {
VIDEO_SELECTION_INPUT: string;
VIDEO_SETTINGS: string;
BUTTON_INPUT: string;
};
declare const ModalsMap: {
[x: string]: typeof VideoSelectionInputModal | import("react").FC<import("./types").VideoSettingsProps>;
[x: string]: typeof ButtonInputModal;
};
export { Modals, ModalsMap };
//# sourceMappingURL=modals.d.ts.map

@@ -1,29 +0,18 @@

/// <reference types="i18next" />
import { EditorPluginConfig, ViewerPluginConfig, ComponentData, Helpers, Pubsub, TranslationFunction, RichContentTheme } from 'wix-rich-content-common';
export declare const VIDEO_TYPE = "wix-draft-plugin-video";
export declare const VIDEO_TYPE_LEGACY = "VIDEO-EMBED";
export declare const videoButtonsTypes: {
video: string;
soundCloud: string;
youTube: string;
};
export declare const mediaTypes: string[];
export interface VideoPluginEditorConfig extends EditorPluginConfig {
import { EditorPluginConfig, ViewerPluginConfig } from 'wix-rich-content-common';
export declare const LINK_BUTTON_TYPE = "wix-draft-plugin-link-button";
export declare const ACTION_BUTTON_TYPE = "wix-draft-plugin-action-button";
export declare type ButtonPluginEditorConfig = LinkButtonPluginEditorConfig | ActionButtonPluginEditorConfig;
export declare type ButtonPluginViewerConfig = LinkButtonPluginViewerConfig | ActionButtonPluginViewerConfig;
export interface LinkButtonPluginEditorConfig extends EditorPluginConfig {
[key: string]: any;
}
export interface VideoPluginViewerConfig extends ViewerPluginConfig {
export interface LinkButtonPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
}
export declare type VideoData = ComponentData & {
disableDownload?: boolean;
};
export interface VideoSettingsProps {
componentData: VideoData;
helpers: Helpers;
pubsub: Pubsub;
theme: RichContentTheme;
t: TranslationFunction;
isMobile: boolean;
settings: VideoPluginEditorConfig;
export interface ActionButtonPluginEditorConfig extends EditorPluginConfig {
[key: string]: any;
}
export interface ActionButtonPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
}
//# sourceMappingURL=types.d.ts.map

@@ -1,6 +0,7 @@

import { VIDEO_TYPE, VideoPluginViewerConfig } from './types';
import { typeMapper } from './typeMapper-loadable';
import { LINK_BUTTON_TYPE, ACTION_BUTTON_TYPE, LinkButtonPluginEditorConfig, ActionButtonPluginEditorConfig } from './types';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { VIDEO_TYPE, typeMapper as videoTypeMapper };
export declare const pluginVideo: ViewerPluginCreator<VideoPluginViewerConfig>;
export { typeMapper as buttonTypeMapper, LINK_BUTTON_TYPE, ACTION_BUTTON_TYPE };
export declare const pluginLinkButton: ViewerPluginCreator<LinkButtonPluginEditorConfig>;
export declare const pluginActionButton: ViewerPluginCreator<ActionButtonPluginEditorConfig>;
//# sourceMappingURL=viewer-loadable.d.ts.map

@@ -1,6 +0,7 @@

import { VIDEO_TYPE, VideoPluginViewerConfig } from './types';
import { typeMapper } from './typeMapper';
import { LINK_BUTTON_TYPE, ACTION_BUTTON_TYPE, LinkButtonPluginEditorConfig, ActionButtonPluginEditorConfig } from './types';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { VIDEO_TYPE, typeMapper as videoTypeMapper };
export declare const pluginVideo: ViewerPluginCreator<VideoPluginViewerConfig>;
export { typeMapper as buttonTypeMapper, LINK_BUTTON_TYPE, ACTION_BUTTON_TYPE };
export declare const pluginLinkButton: ViewerPluginCreator<LinkButtonPluginEditorConfig>;
export declare const pluginActionButton: ViewerPluginCreator<ActionButtonPluginEditorConfig>;
//# sourceMappingURL=viewer.d.ts.map

@@ -1,1 +0,1 @@

{"name":"richlagetest","version":"0.0.0-cd11ad4d1c76444307ba64ac27800685d0a4de3f"}
{"name":"richlagetest","version":"0.0.0-cf9ac0ce2a6bd3c445354274ff57eb934974f601"}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc