Socket
Socket
Sign inDemoInstall

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-1c3a1503548c1b834eb069a652d8d16a95bb5690 to 0.0.0-230982fa614383ea3540c69c2696628caf960803

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

6

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

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

"use strict";var _extends=require("@babel/runtime/helpers/extends"),classNames=require("classnames"),lodash=require("lodash"),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),IMAGE_TYPE="wix-draft-plugin-image",IMAGE_TYPE_LEGACY="IMAGE",shouldDisableStyles=function(componentData,isMobile){var _ref=componentData.config||{},size=_ref.size,width=_ref.width;return!("inline"===size&&lodash.isNumber(width)&&width<=150)&&isMobile},alignmentClassName=function(componentData,theme,styles,isMobile){var _ref2=componentData.config||{},alignment=_ref2.alignment,size=_ref2.size;if(!alignment||shouldDisableStyles(componentData,isMobile)&&"original"!==size)return"";var align=alignment;if("original"===size&&"center"!==alignment){var width=(componentData.src||{}).width;lodash.isNumber(width)&&width>350&&(align="center")}return classNames__default.default(styles["align"+lodash.upperFirst(align)],theme["align"+lodash.upperFirst(align)])},sizeClassName=function(componentData,theme,styles,isMobile){var size=(componentData.config||{}).size;return!size||isMobile&&"original"===size?"":shouldDisableStyles(componentData,isMobile)?classNames__default.default(styles.sizeFullWidth,theme.sizeFullWidth):classNames__default.default(styles["size"+lodash.upperFirst(lodash.camelCase(size))],theme["size"+lodash.upperFirst(lodash.camelCase(size))])},imageRenderDescriptor={component:loadable__default.default({resolved:{},chunkName:function(){return"image-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: "image-viewer" */
"./image-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("./image-viewer"):eval("require.resolve")("./image-viewer")}}),classNameStrategies:{size:sizeClassName,alignment:alignmentClassName}},typeMapper=function(){var _ref;return(_ref={})[IMAGE_TYPE_LEGACY]=imageRenderDescriptor,_ref[IMAGE_TYPE]=imageRenderDescriptor,_ref},DEFAULTS=Object.freeze({config:{alignment:"center",size:"content",showTitle:!0,showDescription:!0}}),SEO_IMAGE_WIDTH=1e3,pluginImage=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:IMAGE_TYPE,typeMapper:typeMapper}};exports.DEFAULTS=DEFAULTS,exports.IMAGE_TYPE=IMAGE_TYPE,exports.SEO_IMAGE_WIDTH=SEO_IMAGE_WIDTH,exports.pluginImage=pluginImage,exports.typeMapper=typeMapper;
"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),COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",typeMapper=function typeMapper(){var _ref;return _ref={},_ref[COLLAPSIBLE_LIST_TYPE]={component:loadable__default.default({resolved:{},chunkName:function(){return"collapsible-list-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: "collapsible-list-viewer" */
"./collapsible-list-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("./collapsible-list-viewer"):eval("require.resolve")("./collapsible-list-viewer")}})},_ref},EXPANDED="expanded",FIRST_EXPANDED="first_expanded",DEFAULTS=Object.freeze({config:{expandState:FIRST_EXPANDED,expandOnlyOne:!1},pairs:[{key:wixRichContentCommon.generateKey()}]}),pluginCollapsibleList=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,typeMapper:typeMapper}};exports.COLLAPSIBLE_LIST_TYPE=COLLAPSIBLE_LIST_TYPE,exports.EXPANDED=EXPANDED,exports.FIRST_EXPANDED=FIRST_EXPANDED,exports.pluginCollapsibleList=pluginCollapsibleList,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("classnames"),require("lodash"),require("@loadable/component"),exports.IMAGE_TYPE=viewerLoadable.IMAGE_TYPE,exports.imageTypeMapper=viewerLoadable.typeMapper,exports.pluginImage=viewerLoadable.pluginImage;
"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.COLLAPSIBLE_LIST_TYPE=viewerLoadable.COLLAPSIBLE_LIST_TYPE,exports.collapsibleListTypeMapper=viewerLoadable.typeMapper,exports.pluginCollapsibleList=viewerLoadable.pluginCollapsibleList;

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

import"@babel/runtime/helpers/extends";export{I as IMAGE_TYPE,t as imageTypeMapper,p as pluginImage}from"./viewer-loadable2.js";import"classnames";import"lodash";import"@loadable/component";
import"@babel/runtime/helpers/extends";export{C as COLLAPSIBLE_LIST_TYPE,t as collapsibleListTypeMapper,p as pluginCollapsibleList}from"./viewer-loadable2.js";import"@loadable/component";import"wix-rich-content-common";

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

import _extends from"@babel/runtime/helpers/extends";import classNames from"classnames";import{isNumber,upperFirst,camelCase}from"lodash";import loadable from"@loadable/component";var IMAGE_TYPE="wix-draft-plugin-image",IMAGE_TYPE_LEGACY="IMAGE",shouldDisableStyles=function(componentData,isMobile){var _ref=componentData.config||{},size=_ref.size,width=_ref.width;return!("inline"===size&&isNumber(width)&&width<=150)&&isMobile},alignmentClassName=function(componentData,theme,styles,isMobile){var _ref2=componentData.config||{},alignment=_ref2.alignment,size=_ref2.size;if(!alignment||shouldDisableStyles(componentData,isMobile)&&"original"!==size)return"";var align=alignment;if("original"===size&&"center"!==alignment){var width=(componentData.src||{}).width;isNumber(width)&&width>350&&(align="center")}return classNames(styles["align"+upperFirst(align)],theme["align"+upperFirst(align)])},sizeClassName=function(componentData,theme,styles,isMobile){var size=(componentData.config||{}).size;return!size||isMobile&&"original"===size?"":shouldDisableStyles(componentData,isMobile)?classNames(styles.sizeFullWidth,theme.sizeFullWidth):classNames(styles["size"+upperFirst(camelCase(size))],theme["size"+upperFirst(camelCase(size))])},imageRenderDescriptor={component:loadable({resolved:{},chunkName:function(){return"image-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: "image-viewer" */
"./image-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("./image-viewer"):eval("require.resolve")("./image-viewer")}}),classNameStrategies:{size:sizeClassName,alignment:alignmentClassName}},typeMapper=function(){var _ref;return(_ref={})[IMAGE_TYPE_LEGACY]=imageRenderDescriptor,_ref[IMAGE_TYPE]=imageRenderDescriptor,_ref},DEFAULTS=Object.freeze({config:{alignment:"center",size:"content",showTitle:!0,showDescription:!0}}),SEO_IMAGE_WIDTH=1e3,pluginImage=function(config){return{config:_extends({},DEFAULTS.config,config),type:IMAGE_TYPE,typeMapper:typeMapper}};export{DEFAULTS as D,IMAGE_TYPE as I,SEO_IMAGE_WIDTH as S,pluginImage as p,typeMapper as t};
import _extends from"@babel/runtime/helpers/extends";import loadable from"@loadable/component";import{generateKey}from"wix-rich-content-common";var COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",typeMapper=function typeMapper(){var _ref;return _ref={},_ref[COLLAPSIBLE_LIST_TYPE]={component:loadable({resolved:{},chunkName:function(){return"collapsible-list-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: "collapsible-list-viewer" */
"./collapsible-list-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("./collapsible-list-viewer"):eval("require.resolve")("./collapsible-list-viewer")}})},_ref},EXPANDED="expanded",FIRST_EXPANDED="first_expanded",DEFAULTS=Object.freeze({config:{expandState:FIRST_EXPANDED,expandOnlyOne:!1},pairs:[{key:generateKey()}]}),pluginCollapsibleList=function(config){return{config:_extends({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,typeMapper:typeMapper}};export{COLLAPSIBLE_LIST_TYPE as C,EXPANDED as E,FIRST_EXPANDED as F,pluginCollapsibleList as p,typeMapper as t};

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),_extends=require("@babel/runtime/helpers/extends"),lodash=require("lodash"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),classNames=require("classnames"),wixRichContentCommon=require("wix-rich-content-common"),imageUtils=require("wix-rich-content-common/libs/imageUtils"),wixRichContentUiComponents=require("wix-rich-content-ui-components"),_asyncToGenerator=require("@babel/runtime/helpers/asyncToGenerator"),_regeneratorRuntime=require("@babel/runtime/regenerator"),_assertThisInitialized=require("@babel/runtime/helpers/assertThisInitialized"),pluginImageSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-image.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 _objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_extends__default=_interopDefaultLegacy(_extends),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),_asyncToGenerator__default=_interopDefaultLegacy(_asyncToGenerator),_regeneratorRuntime__default=_interopDefaultLegacy(_regeneratorRuntime),_assertThisInitialized__default=_interopDefaultLegacy(_assertThisInitialized),pluginImageSchema__default=_interopDefaultLegacy(pluginImageSchema),styles$2={imageSettings:"-PCJd",imageSettingsTitle:"_3qXJb",imageSettingsImageSection:"_3vNQG",imageSettingsImage:"_1Y0jo",imageSettingsSection:"_2APzQ",imageSettingsLabel:"_22ic1",imageSettings_scrollContainer:"hMCLW",imageSettings_inputsWrapper:"_1W0yQ",imageSettings_mobile:"_41Y3W",imageSettings_footer:"j6-Tp",imageSettings_hidden:"_2tqWq"},DEFAULTS=Object.freeze({config:{alignment:"center",size:"content",showTitle:!0,showDescription:!0}}),_excluded$1=["isExpandEnabled","isDownloadEnabled"],ImageSettings=function(_Component){function ImageSettings(props){var _this;(_this=_Component.call(this,props)||this).toggleState=function(key,onToggle){return function(){var _this$setState,value=!_this.state[key];_this.setState(((_this$setState={})[key]=value,_this$setState),null==onToggle?void 0:onToggle(value))}},_this.renderToggle=function(_ref){var toggleKey=_ref.toggleKey,labelKey=_ref.labelKey,dataHook=_ref.dataHook,tooltipText=_ref.tooltipText,onToggle=_ref.onToggle;return"divider"===_ref.type?React__default.default.createElement(wixRichContentUiComponents.SettingsSeparator,{top:!0}):React__default.default.createElement("div",{key:toggleKey,className:_this.styles.imageSettings_toggleContainer},React__default.default.createElement(wixRichContentUiComponents.LabeledToggle,{theme:_this.props.theme,checked:_this.state[toggleKey],label:_this.props.t(labelKey),onChange:_this.toggleState(toggleKey,onToggle),dataHook:dataHook,tooltipText:tooltipText}))},_this.baseToggleData=[{toggleKey:"isExpandEnabled",labelKey:"ImagePlugin_Settings_ImageOpensInExpandMode_Label",dataHook:"imageExpandToggle",tooltipText:_this.props.t("ImageSettings_Expand_Mode_Toggle")},{toggleKey:"isDownloadEnabled",labelKey:"ImagePlugin_Settings_ImageCanBeDownloaded_Label",dataHook:"imageDownloadToggle",tooltipText:_this.props.t("ImagePlugin_Settings_ImageCanBeDownloaded_Tooltip")}],_this.toggleData=_this.props.shouldShowSpoiler?[].concat(_this.baseToggleData,[{type:"divider"},{toggleKey:"isSpoilerEnabled",labelKey:"ImageSettings_Spoiler_Toggle",dataHook:"imageSpoilerToggle",tooltipText:_this.props.t("Spoiler_Toggle_Tooltip"),onToggle:function(value){_this.props.pubsub.update("componentData",_extends__default.default({},_this.props.componentData,_this.getSpoilerConfig(value)))}}]):_this.baseToggleData,_this.onComponentUpdate=function(){var componentData=_this.props.pubsub.get("componentData");_this.setState({src:componentData.src,error:null==componentData?void 0:componentData.error})},_this.revertComponentData=function(){var _this$props=_this.props,componentData=_this$props.componentData,helpers=_this$props.helpers,pubsub=_this$props.pubsub;if(_this.initialState){var _this$initialState=_this.initialState,isExpandEnabled=_this$initialState.isExpandEnabled,isDownloadEnabled=_this$initialState.isDownloadEnabled,rest=_objectWithoutPropertiesLoose__default.default(_this$initialState,_excluded$1),initialComponentData=_extends__default.default({},componentData,rest,{disableExpand:!isExpandEnabled,disableDownload:!isDownloadEnabled});pubsub.update("componentData",initialComponentData),_this.setState(_extends__default.default({},_this.initialState))}helpers.closeModal()},_this.metadataUpdated=function(metadata,value){_this.setState({metadata:_extends__default.default({},metadata,value)})},_this.onDoneClick=function(){var _this$props2=_this.props,helpers=_this$props2.helpers,componentData=_this$props2.componentData,pubsub=_this$props2.pubsub,newComponentData=_extends__default.default({},componentData,_this.getSpoilerConfig(_this.state.isSpoilerEnabled),{disableDownload:!_this.state.isDownloadEnabled,disableExpand:!_this.state.isExpandEnabled});_this.state.metadata&&(newComponentData.metadata=_this.state.metadata),pubsub.update("componentData",newComponentData),helpers.closeModal()},_this.getSpoilerConfig=function(enabled){return{config:_extends__default.default({},_this.props.componentData.config,{spoiler:{enabled:enabled}})}},_this.setBlockLink=function(item){return _this.props.pubsub.setBlockData({key:"componentLink",item:item})},_this.state=_this.propsToState(props),_this.initialState=_extends__default.default({},_this.state);var t=props.t,theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$2,theme:theme}),_this.updateLabel=t("ImageSettings_Update"),_this.headerText=t("ImageSettings_Header"),_this.captionLabel=t("ImageSettings_Caption_Label"),_this.captionInputPlaceholder=t("ImageSettings_Caption_Input_Placeholder"),_this.altLabel=t("ImageSettings_Alt_Label"),_this.altTooltip="ImageSettings_Alt_Label_Tooltip",_this.altInputPlaceholder=t("ImageSettings_Alt_Input_Placeholder"),_this}_inheritsLoose__default.default(ImageSettings,_Component);var _proto=ImageSettings.prototype;return _proto.propsToState=function(props){var componentData=props.componentData,src=componentData.src,metadata=componentData.metadata,error=componentData.error,disableExpand=componentData.disableExpand,disableDownload=componentData.disableDownload,_componentData$config=componentData.config.spoiler;return{src:src,metadata:metadata,error:error,isExpandEnabled:!disableExpand,isDownloadEnabled:!disableDownload,isSpoilerEnabled:(void 0===_componentData$config?{}:_componentData$config).enabled}},_proto.componentDidMount=function(){this.props.pubsub.subscribe("componentData",this.onComponentUpdate)},_proto.componentWillUnmount=function(){this.props.pubsub.unsubscribe("componentData",this.onComponentUpdate)},_proto.render=function(){var _classNames,_this2=this,_this$props3=this.props,helpers=_this$props3.helpers,theme=_this$props3.theme,t=_this$props3.t,isMobile=_this$props3.isMobile,languageDir=_this$props3.languageDir,_this$state=this.state,src=_this$state.src,error=_this$state.error,_this$state$metadata=_this$state.metadata,metadata=void 0===_this$state$metadata?{}:_this$state$metadata;return React__default.default.createElement("div",{className:this.styles.imageSettings,"data-hook":"settings",dir:languageDir},isMobile?React__default.default.createElement(wixRichContentUiComponents.SettingsMobileHeader,{theme:theme,onCancel:this.revertComponentData,onSave:this.onDoneClick,t:t}):React__default.default.createElement("h3",{className:this.styles.imageSettingsTitle},this.headerText),React__default.default.createElement("div",{className:classNames__default.default(styles$2.imageSettings_scrollContainer,(_classNames={},_classNames[styles$2.imageSettings_mobile]=isMobile,_classNames))},React__default.default.createElement(wixRichContentUiComponents.SettingsSection,{theme:theme,className:this.styles.imageSettingsImageSection,ariaProps:{"aria-label":"image preview",role:"region","data-hook":"imagePreview"}},src?React__default.default.createElement(wixRichContentUiComponents.Image,{alt:metadata.alt||"image preview",resizeMode:"contain",className:this.styles.imageSettingsImage,src:imageUtils.getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,{requiredWidth:1e3,requiredHeight:250,requiredQuality:80}),theme:theme,error:error,t:t}):React__default.default.createElement("div",{className:this.styles.imageSettingsImage},React__default.default.createElement(wixRichContentUiComponents.Loader,{type:"medium"}))),React__default.default.createElement("div",{className:this.styles.imageSettings_inputsWrapper},React__default.default.createElement(wixRichContentUiComponents.SettingsSection,{theme:theme,className:this.styles.imageSettingsSection,ariaProps:{"aria-label":"image caption",role:"region"}},React__default.default.createElement(wixRichContentUiComponents.InputWithLabel,{theme:theme,id:"imageSettingsCaptionInput",label:this.captionLabel,placeholder:this.captionInputPlaceholder,value:metadata.caption||"",onChange:function(caption){return _this2.metadataUpdated(metadata,{caption:caption})},dataHook:"imageSettingsCaptionInput"})),React__default.default.createElement(wixRichContentUiComponents.SettingsSection,{theme:theme,className:this.styles.imageSettingsSection,ariaProps:{"aria-label":"image alt text",role:"region"}},React__default.default.createElement(wixRichContentUiComponents.InputWithLabel,{theme:theme,id:"imageSettingsAltInput",label:this.altLabel,placeholder:this.altInputPlaceholder,t:t,value:metadata.alt||"",onChange:function(alt){return _this2.metadataUpdated(metadata,{alt:alt})},dataHook:"imageSettingsAltInput",tooltipTextKey:this.altTooltip,isMobile:isMobile})),React__default.default.createElement(wixRichContentUiComponents.SettingsSection,{theme:theme,ariaProps:{"aria-label":"link redirect explanation",role:"region"}},React__default.default.createElement("div",{className:this.styles.imageSettingsLabel},this.toggleData.map((function(toggle){return _this2.renderToggle(toggle)})))))),!isMobile&&React__default.default.createElement(wixRichContentUiComponents.SettingsPanelFooter,{fixed:!0,theme:theme,cancel:this.revertComponentData,save:this.onDoneClick,t:t}))},ImageSettings}(React.Component);var mediaImageStudioPackageLoader;function getImageStudioPackage(){var src;return mediaImageStudioPackageLoader||(window.requirejs&&!window.requirejsBackup&&(window.requirejsBackup={define:window.define,require:window.require,requirejs:window.requirejs},window.define=void 0,window.require=void 0,window.requirejs=void 0),src="https://static.parastorage.com/unpkg/@wix/media-image-studio-opener@3.27.0/dist/statics/MediaImageStudio.bundle.min.js",mediaImageStudioPackageLoader=new Promise((function(resolve){var script=document.createElement("script");script.src=src,script.onload=resolve,document.head.appendChild(script)}))),mediaImageStudioPackageLoader.then((function(){return window.requirejsBackup&&(Object.assign(window,window.requirejsBackup),window.requirejsBackup=void 0),window.MediaImageStudio}))}function _setupImageEditor(){return(_setupImageEditor=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee(imageEditorWixSettings,rootElementId,fileName,onSave,onClose){var _yield$getImageStudio,MediaImageStudio,MediaImageStudioEvents,MediaImageStudioMode,mediaImageStudio,imageDataSubscription;return _regeneratorRuntime__default.default.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.next=2,getImageStudioPackage();case 2:return _yield$getImageStudio=_context.sent,MediaImageStudio=_yield$getImageStudio.MediaImageStudio,MediaImageStudioEvents=_yield$getImageStudio.MediaImageStudioEvents,MediaImageStudioMode=_yield$getImageStudio.MediaImageStudioMode,_context.t0=MediaImageStudio,_context.t1=_extends__default.default,_context.t2={},_context.next=11,Promise.resolve(imageEditorWixSettings);case 11:_context.t3=_context.sent,_context.t4={appendTo:document.querySelector("[id="+rootElementId+"]")},_context.t5=(0,_context.t1)(_context.t2,_context.t3,_context.t4),mediaImageStudio=new _context.t0(_context.t5),imageDataSubscription=mediaImageStudio.once(MediaImageStudioEvents.ImageData,(function(imageData){var file=blobToFile(imageData,fileName);onSave(file)})),mediaImageStudio.once(MediaImageStudioEvents.Close,(function(){imageDataSubscription.remove(),mediaImageStudio.kill(),onClose()})),mediaImageStudio.show({mode:MediaImageStudioMode.Transform,fileId:fileName});case 18:case"end":return _context.stop()}}),_callee)})))).apply(this,arguments)}function blobToFile(blob,fileName){return blob.lastModifiedDate=new Date,blob.name=fileName,blob}var _ModalsMap,ImageEditor=function(_Component){function ImageEditor(props){var _this;(_this=_Component.call(this,props)||this).state={mediaImageStudio:void 0,mediaImageStudioEvents:void 0};var _this$props=_this.props,src=_this$props.componentData.src,helpers=_this$props.helpers,pubsub=_this$props.pubsub,imageEditorWixSettings=_this$props.imageEditorWixSettings,onImageEditorOpen=_this$props.onImageEditorOpen,onClose=function(){var _helpers$closeModal;null==helpers||null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers)};return onImageEditorOpen&&onImageEditorOpen(),_this.id="imageEditor",function(_x,_x2,_x3,_x4,_x5){_setupImageEditor.apply(this,arguments)}(imageEditorWixSettings,_this.id,src.file_name,(function(file){null==pubsub||pubsub.getBlockHandler("handleFilesSelected")([file]),onClose()}),onClose),_this}return _inheritsLoose__default.default(ImageEditor,_Component),ImageEditor.prototype.render=function(){return React__default.default.createElement("div",{id:this.id,nofocus:"true"})},ImageEditor}(React.Component),Modals={IMAGE_SETTINGS:"image-settings",IMAGE_EDITOR:"image-editor"},ModalsMap=((_ModalsMap={})[Modals.IMAGE_SETTINGS]=ImageSettings,_ModalsMap[Modals.IMAGE_EDITOR]=ImageEditor,_ModalsMap),InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({width:19,height:19,viewBox:"0 0 19 19"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("path",{d:"M2 6a1 1 0 0 1 1-1h2.75l.668-1.424A1 1 0 0 1 7.323 3h4.354a1 1 0 0 1 .905.576L13.25 5H16a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6zm1 0v8h13V6h-3.5l-1.018-2H7.518L6.5 6H3zm6.5 6a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zm0-1a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"})))},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"})))},ImageEditorIcon=function(props){return React__default.default.createElement("svg",Object.assign({viewBox:"2 2 19 19",fill:"currentColor"},props),React__default.default.createElement("path",{d:"M14.092,8 C14.036,7.843 14,7.676 14,7.5 C14,7.324 14.036,7.157 14.092,7 C14.299,6.419 14.849,6 15.5,6 C16.151,6 16.701,6.419 16.908,7 C16.964,7.157 17,7.324 17,7.5 C17,7.676 16.964,7.843 16.908,8 C16.701,8.581 16.151,9 15.5,9 C14.849,9 14.299,8.581 14.092,8 Z M17.949,7 C17.717,5.86 16.707,5 15.5,5 C14.293,5 13.283,5.86 13.051,7 L3,7 L3,8 L13.051,8 C13.283,9.14 14.293,10 15.5,10 C16.707,10 17.717,9.14 17.949,8 L21,8 L21,7 L17.949,7 Z M15.092,18.0009 C15.036,17.8439 15,17.6769 15,17.5009 C15,17.3249 15.036,17.1579 15.092,17.0009 C15.299,16.4199 15.849,16.0009 16.5,16.0009 C17.151,16.0009 17.701,16.4199 17.908,17.0009 C17.964,17.1579 18,17.3249 18,17.5009 C18,17.6769 17.964,17.8439 17.908,18.0009 C17.701,18.5819 17.151,19.0009 16.5,19.0009 C15.849,19.0009 15.299,18.5819 15.092,18.0009 Z M18.949,17.0009 C18.717,15.8609 17.707,15.0009 16.5,15.0009 C15.293,15.0009 14.283,15.8609 14.051,17.0009 L3,17.0009 L3,18.0009 L14.051,18.0009 C14.283,19.1409 15.293,20.0009 16.5,20.0009 C17.707,20.0009 18.717,19.1409 18.949,18.0009 L21,18.0009 L21,17.0009 L18.949,17.0009 Z M6.092,13 C6.036,12.843 6,12.676 6,12.5 C6,12.324 6.036,12.157 6.092,12 C6.299,11.419 6.849,11 7.5,11 C8.151,11 8.701,11.419 8.908,12 C8.964,12.157 9,12.324 9,12.5 C9,12.676 8.964,12.843 8.908,13 C8.701,13.581 8.151,14 7.5,14 C6.849,14 6.299,13.581 6.092,13 Z M9.949,12 C9.717,10.86 8.707,10 7.5,10 C6.293,10 5.283,10.86 5.051,12 L3,12 L3,13 L5.051,13 C5.283,14.14 6.293,15 7.5,15 C8.707,15 9.717,14.14 9.949,13 L21,13 L21,12 L9.949,12 Z"}))},IMAGE_TYPE="wix-draft-plugin-image",createInlineButtons=function(_ref){var t=_ref.t,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,uiSettings=_ref.uiSettings,isMobile=_ref.isMobile,_ref$settings=_ref.settings,settings=void 0===_ref$settings?{}:_ref$settings,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,icons=lodash.get(settings,"toolbar.icons",{}),modalStyles=wixRichContentEditorCommon.getModalStyles({isMobile:isMobile}),imageEditorStyles=wixRichContentEditorCommon.getModalStyles({customStyles:{content:{maxWidth:"100%",background:"transparent"}}}),imageEditorWixSettings=settings.imageEditorWixSettings,onImageEditorOpen=settings.onImageEditorOpen,imageEditorButton={keyName:"imageEditor",type:wixRichContentPluginCommons.BUTTONS.EXTERNAL_MODAL,icon:icons.imageEditor||ImageEditorIcon,modalName:Modals.IMAGE_EDITOR,modalStyles:imageEditorStyles,t:t,imageEditorWixSettings:imageEditorWixSettings,onImageEditorOpen:onImageEditorOpen,mobile:!1,tooltipTextKey:"ImageEditorButton_Tooltip",mapComponentDataToButtonProps:function(componentData){return{disabled:lodash.isEmpty(componentData.src)||!!componentData.error}}},spoilerInInlineToolbar=experiments.spoilerInInlineToolbar,spoilerButton=settings.spoiler&&null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[{keyName:"spoiler",type:wixRichContentPluginCommons.BUTTONS.SPOILER,mobile:!0}]:[];return[{keyName:"sizeOriginal",type:wixRichContentPluginCommons.BUTTONS.SIZE_ORIGINAL,mobile:!1},{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:"alignLeft",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_LEFT,mobile:!1},{keyName:"alignCenter",type:wixRichContentPluginCommons.BUTTONS.SIZE_CONTENT_CENTER,mobile:!1},{keyName:"alignRight",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_RIGHT,mobile:!1},{keyName:"separator2",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!1}].concat(spoilerButton,imageEditorWixSettings?[imageEditorButton]:[],[{keyName:"settings",type:wixRichContentPluginCommons.BUTTONS.EXTERNAL_MODAL,fullHeight:!0,icon:icons.settings||wixRichContentPluginCommons.PluginSettingsIcon,modalName:Modals.IMAGE_SETTINGS,modalStyles:modalStyles,anchorTarget:anchorTarget,relValue:relValue,t:t,mobile:!0,tooltipTextKey:"SettingsButton_Tooltip",uiSettings:uiSettings,triggerSettingsBi:!0,pluginId:IMAGE_TYPE,shouldShowSpoiler:settings.spoiler},{keyName:"link",type:wixRichContentPluginCommons.BUTTONS.LINK,mobile:!0},{keyName:"replace",type:wixRichContentPluginCommons.BUTTONS.FILES,onFilesSelected:function(pubsub,files){files.length>0&&pubsub.getBlockHandler("handleFilesSelected")(files)},icon:icons.replace||MediaReplaceIcon,mobile:!0,tooltipTextKey:"ReplaceImageButton_Tooltip",t:t},{keyName:"delete",type:wixRichContentPluginCommons.BUTTONS.DELETE,mobile:!0}])},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,disableDownload=_ref.disableDownload,disableExpand=_ref.disableExpand,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,PluginData=void 0!==disableDownload?_extends__default.default({},DEFAULTS,{disableDownload:disableDownload}):DEFAULTS,componentData=void 0!==disableExpand?_extends__default.default({},DEFAULTS,{disableExpand:disableExpand}):PluginData;return[{type:wixRichContentEditorCommon.BUTTON_TYPES.FILE,multi:!0,name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.IMAGE,tooltip:t("ImagePlugin_InsertButton_Tooltip"),toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],getIcon:function(){return icon},componentData:componentData}]},createToolbar=function(_ref){var t=_ref.t,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,uiSettings=_ref.uiSettings,isMobile=_ref.isMobile,settings=_ref.settings,experiments=_ref.experiments,disableDownload=null==uiSettings?void 0:uiSettings.disableDownload,disableExpand=null==settings?void 0:settings.disableExpand;return{InlineButtons:createInlineButtons({t:t,anchorTarget:anchorTarget,relValue:relValue,uiSettings:uiSettings,isMobile:isMobile,settings:settings,experiments:experiments}),InsertButtons:createInsertButtons({t:t,settings:settings,disableDownload:disableDownload,disableExpand:disableExpand}),name:"image"}},styles$1={fontElementMap:"_1hNZF",imageContainer:"_2kEVY",expandContainer:"-D6i8",expandIcon:"_2Lky3",pointer:"_2Ybje",imageWrapper:"_3WJnn",image:"OzAYt",imageOverlay:"_1b5Ar",imageCaption:"EilAw",imagePreload:"_3ii3f",imageHighres:"_3xs9_",onlyHighRes:"_1I_dK",image_loading:"_3aC9X"},expand=function(props){return React__default.default.createElement("svg",Object.assign({viewBox:"0 0 19 19",xmlns:"http://www.w3.org/2000/svg"},props),React__default.default.createElement("path",{d:"M15.071 8.371V4.585l-4.355 4.356a.2.2 0 0 1-.283 0l-.374-.374a.2.2 0 0 1 0-.283l4.356-4.355h-3.786a.2.2 0 0 1-.2-.2V3.2c0-.11.09-.2.2-.2H16v5.371a.2.2 0 0 1-.2.2h-.529a.2.2 0 0 1-.2-.2zm-6.5 6.9v.529a.2.2 0 0 1-.2.2H3v-5.371c0-.11.09-.2.2-.2h.529c.11 0 .2.09.2.2v3.786l4.355-4.356a.2.2 0 0 1 .283 0l.374.374a.2.2 0 0 1 0 .283L4.585 15.07h3.786c.11 0 .2.09.2.2z",fill:"#000",fillRule:"nonzero"}))},styles_inPluginInput="_1k3YS",InPluginInput=function(_Component){function InPluginInput(){var _this;return(_this=_Component.apply(this,arguments)||this).handleFocus=function(e){e.stopPropagation(),_this.props.setFocusToBlock(),_this.props.setInPluginEditingMode(!0)},_this.handleBlur=function(){return _this.props.setInPluginEditingMode(!1)},_this.handleKeyPress=function(e){var _this$props=_this.props,setFocusToBlock=_this$props.setFocusToBlock,value=_this$props.value;"Enter"===e.key&&setFocusToBlock&&""!==value&&(_this.handleBlur(),setFocusToBlock())},_this.onChange=function(e){var _this$props$onChange,_this$props2;return null===(_this$props$onChange=(_this$props2=_this.props).onChange)||void 0===_this$props$onChange?void 0:_this$props$onChange.call(_this$props2,e.target.value)},_this}return _inheritsLoose__default.default(InPluginInput,_Component),InPluginInput.prototype.render=function(){var className=classNames__default.default(styles_inPluginInput,this.props.className);return React__default.default.createElement("textarea",{className:className,value:this.props.value,onChange:this.onChange,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyPress:this.handleKeyPress,dir:"auto",rows:1})},InPluginInput}(React.Component);InPluginInput.defaultProps={setInPluginEditingMode:function(){return!1},setFocusToBlock:function(){return!1}};var ImageViewer=function(_React$Component){function ImageViewer(props){var _this;return(_this=_React$Component.call(this,props)||this).forceOnImageLoad=function(){var executionTimes=0,interval=setInterval((function(){var _this$imageRef,_this$imageRef$curren;null!==(_this$imageRef=_this.imageRef)&&void 0!==_this$imageRef&&null!==(_this$imageRef$curren=_this$imageRef.current)&&void 0!==_this$imageRef$curren&&_this$imageRef$curren.complete&&(_this.onImageLoad(_this.imageRef.current),clearInterval(interval)),10==++executionTimes&&clearInterval(interval)}),200)},_this.onImageLoadError=function(){var src=_this.props.componentData.src;src&&src.fallback&&_this.setState({fallbackImageSrc:{preload:src.fallback,highres:src.fallback}})},_this.renderImage=function(imageClassName,imageSrc,alt,props,isGif,onlyHighRes){var _classNames;return _this.getImage(classNames__default.default(imageClassName,_this.styles.imageHighres,((_classNames={})[_this.styles.onlyHighRes]=onlyHighRes,_classNames)),imageSrc.highres,alt,props,{fadeIn:!isGif,width:imageSrc.highresWidth,height:imageSrc.highresHeight})},_this.renderPreloadImage=function(imageClassName,imageSrc,alt,props){return _this.getImage(classNames__default.default(imageClassName,_this.styles.imagePreload),imageSrc.preload,alt,_extends__default.default({"aria-hidden":!0},props))},_this.onImageLoad=function(element){element.style.opacity=1,_this.preloadRef.current&&(_this.preloadRef.current.style.opacity="0")},_this.handleExpand=function(e){var _helpers$onViewerActi;e.preventDefault();var _this$props=_this.props,onExpand=_this$props.settings.onExpand,_this$props$helpers=_this$props.helpers,helpers=void 0===_this$props$helpers?{}:_this$props$helpers;null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,IMAGE_TYPE,"Click","expand_image"),_this.hasExpand()&&(null==onExpand||onExpand(_this.props.blockKey))},_this.scrollToAnchor=function(e){var _this$props2=_this.props,_this$props2$componen=_this$props2.componentData.config.link,anchor=(_this$props2$componen=void 0===_this$props2$componen?{}:_this$props2$componen).anchor,customAnchorScroll=_this$props2.customAnchorScroll;if(customAnchorScroll)customAnchorScroll(e,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);wixRichContentCommon.addAnchorTagToUrl(anchorString),wixRichContentCommon.anchorScroll(element,_this.context.experiments)}},_this.hasLink=function(){var _this$props$component,_this$props$component2,_this$props$component3;return null===(_this$props$component=_this.props.componentData)||void 0===_this$props$component||null===(_this$props$component2=_this$props$component.config)||void 0===_this$props$component2||null===(_this$props$component3=_this$props$component2.link)||void 0===_this$props$component3?void 0:_this$props$component3.url},_this.hasAnchor=function(){var _this$props$component4,_this$props$component5,_this$props$component6;return null===(_this$props$component4=_this.props.componentData)||void 0===_this$props$component4||null===(_this$props$component5=_this$props$component4.config)||void 0===_this$props$component5||null===(_this$props$component6=_this$props$component5.link)||void 0===_this$props$component6?void 0:_this$props$component6.anchor},_this.onKeyDown=function(e){"Enter"!==e.key&&" "!==e.key||_this.props.getInPluginEditingMode||_this.handleClick(e)},_this.handleClick=function(e){if(_this.hasLink())return null;_this.hasAnchor()?(e.preventDefault(),e.stopPropagation(),_this.scrollToAnchor(e)):_this.handleExpand(e)},_this.handleRef=function(e){_this.state.container||_this.setState({container:e})},_this.handleContextMenu=function(e){var _this$props$component7=_this.props.componentData.disableDownload;return void 0!==_this$props$component7&&_this$props$component7&&e.preventDefault()},_this.hasExpand=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableExpand=!1;return void 0!==componentData.disableExpand?disableExpand=componentData.disableExpand:void 0!==settings.disableExpand&&(disableExpand=settings.disableExpand),!disableExpand&&settings.onExpand},_this.renderExpandIcon=function(){return React__default.default.createElement("div",{className:_this.styles.expandContainer},React__default.default.createElement(expand,{className:_this.styles.expandIcon,onClick:_this.handleExpand}))},wixRichContentCommon.validate(props.componentData,pluginImageSchema__default.default),_this.state={},_this.preloadRef=React__default.default.createRef(),_this.imageRef=React__default.default.createRef(),_this}_inheritsLoose__default.default(ImageViewer,_React$Component);var _proto=ImageViewer.prototype;return _proto.componentDidMount=function(){this.setState({ssrDone:!0}),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&this.forceOnImageLoad()},_proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginImageSchema__default.default)},_proto.calculateHeight=function(width,src){return void 0===width&&(width=1),src&&src.height&&src.width?Math.ceil(src.height/src.width*width):imageUtils.WIX_MEDIA_DEFAULT.SIZE},_proto.getImageDataUrl=function(){return this.props.dataUrl?{preload:this.props.dataUrl,highres:this.props.dataUrl}:null},_proto.getImageUrl=function(src){var _this$context$experim,_this$context$experim2,_this2=this,_ref=this.props||{},helpers=_ref.helpers,seoMode=_ref.seoMode;if(!src&&null!=helpers&&helpers.handleFileSelection)return null;var requiredWidth,requiredHeight,removeUsm=null===(_this$context$experim=this.context.experiments)||void 0===_this$context$experim||null===(_this$context$experim2=_this$context$experim.removeUsmFromImageUrls)||void 0===_this$context$experim2?void 0:_this$context$experim2.enabled,imageUrl={preload:"",highres:""},imageSrcOpts={};if(!this.props.isMobile&&!imageUtils.isPNG(src)){var _this$props$component8=this.props.componentData.config,alignment=(_this$props$component8=void 0===_this$props$component8?{}:_this$props$component8).alignment,width=_this$props$component8.width,usePredefinedWidth=("left"===alignment||"right"===alignment)&&!width;imageSrcOpts=_extends__default.default({removeUsm:removeUsm,imageType:"quailtyPreload"},usePredefinedWidth&&{requiredWidth:300})}if(imageUrl.preload=imageUtils.getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,imageSrcOpts),seoMode)requiredWidth=(null==src?void 0:src.width)&&Math.min(src.width,1e3),requiredHeight=this.calculateHeight(1e3,src);else if(this.state.container){var _getImageDimensions=function(width,isMobile){var requiredHeight,requiredWidth=width||1;return isMobile&&!wixRichContentCommon.isSSR()&&(requiredWidth*=window.devicePixelRatio,requiredWidth*=window.screen.width/document.body.clientWidth),requiredHeight=_this2.calculateHeight(requiredWidth,src),[requiredWidth=Math.ceil(requiredWidth),requiredHeight=Math.ceil(requiredHeight)]}(this.state.container.getBoundingClientRect().width||(null==src?void 0:src.width),this.props.isMobile);requiredWidth=_getImageDimensions[0],requiredHeight=_getImageDimensions[1]}return imageUrl.highres=imageUtils.getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,{removeUsm:removeUsm,requiredWidth:requiredWidth,requiredHeight:requiredHeight,requiredQuality:90,imageType:"highRes"}),!this.state.ssrDone||imageUrl.preload||this.props.isLoading||console.error("image plugin mounted with invalid image source!",src),imageUrl},_proto.getImage=function(imageClassNames,src,alt,props,opts){var _this$context$experim3,_this3=this;void 0===opts&&(opts={});var _opts=opts,_opts$fadeIn=_opts.fadeIn,fadeIn=void 0!==_opts$fadeIn&&_opts$fadeIn,width=_opts.width,height=_opts.height,loading=null!==(_this$context$experim3=this.context.experiments.lazyImagesAndIframes)&&void 0!==_this$context$experim3&&_this$context$experim3.enabled?"lazy":void 0;return React__default.default.createElement("img",Object.assign({},props,{className:imageClassNames,src:src,alt:alt,onError:this.onImageLoadError,onLoad:fadeIn?function(e){return _this3.onImageLoad(e.target)}:void 0,ref:fadeIn?this.imageRef:this.preloadRef,width:width,height:height,loading:loading}))},_proto.renderTitle=function(data,styles){return!!(data.config||{}).showTitle&&React__default.default.createElement("div",{className:classNames__default.default(styles.imageTitle)},data&&data.title||"")},_proto.renderDescription=function(data,styles){return!!(data.config||{}).showDescription&&React__default.default.createElement("div",{className:classNames__default.default(styles.imageDescription)},data&&data.description||"")},_proto.renderCaption=function(caption){var _this$props4=this.props,onCaptionChange=_this$props4.onCaptionChange,setFocusToBlock=_this$props4.setFocusToBlock,setInPluginEditingMode=_this$props4.setInPluginEditingMode,_this$styles=this.styles,imageCaption=_this$styles.imageCaption,link=_this$styles.link,classes=classNames__default.default(imageCaption,this.hasLink()&&link);return onCaptionChange?React__default.default.createElement(InPluginInput,{setInPluginEditingMode:setInPluginEditingMode,className:classes,value:caption,onChange:onCaptionChange,setFocusToBlock:setFocusToBlock}):React__default.default.createElement("span",{dir:"auto",className:classes},caption)},_proto.shouldRenderCaption=function(){var _componentData$metada,_this$props5=this.props,getInPluginEditingMode=_this$props5.getInPluginEditingMode,settings=_this$props5.settings,componentData=_this$props5.componentData,defaultCaption=_this$props5.defaultCaption,caption=null===(_componentData$metada=componentData.metadata)||void 0===_componentData$metada?void 0:_componentData$metada.caption;if(lodash.includes(lodash.get(settings,"toolbar.hidden"),"settings"))return!1;if(void 0===caption||""===caption&&(null==getInPluginEditingMode||!getInPluginEditingMode())||caption===defaultCaption)return!1;var data=componentData||DEFAULTS;return"original"!==data.config.size||!data.src||!data.src.width||data.src.width>=350},_proto.render=function(){var _classNames2,_imageSrc$highres,_imageSrc$highres$end;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles$1,theme:this.props.theme});var _this$props6=this.props,componentData=_this$props6.componentData,className=_this$props6.className,settings=_this$props6.settings,setComponentUrl=_this$props6.setComponentUrl,seoMode=_this$props6.seoMode,_this$state=this.state,fallbackImageSrc=_this$state.fallbackImageSrc,ssrDone=_this$state.ssrDone,data=componentData||DEFAULTS,metadata=componentData.metadata;metadata||(metadata={});var itemClassName=classNames__default.default(this.styles.imageWrapper,className,((_classNames2={})[this.styles.pointer]=this.hasExpand(),_classNames2)),imageClassName=this.styles.image,imageSrc=fallbackImageSrc||this.getImageDataUrl()||this.getImageUrl(data.src),imageProps={};data.src&&settings&&settings.imageProps&&(imageProps=lodash.isFunction(settings.imageProps)?settings.imageProps(data.src):settings.imageProps);var isGif=null==imageSrc||null===(_imageSrc$highres=imageSrc.highres)||void 0===_imageSrc$highres||null===(_imageSrc$highres$end=_imageSrc$highres.endsWith)||void 0===_imageSrc$highres$end?void 0:_imageSrc$highres$end.call(_imageSrc$highres,".gif");null==setComponentUrl||setComponentUrl(null==imageSrc?void 0:imageSrc.highres);var shouldRenderPreloadImage=!seoMode&&imageSrc&&!isGif,shouldRenderImage=imageSrc&&(seoMode||ssrDone)||isGif,accesibilityProps=!this.hasLink()&&{role:"button",tabIndex:0},onlyHiRes=seoMode||isGif;return React__default.default.createElement("div",Object.assign({"data-hook":"imageViewer",className:this.styles.imageContainer,ref:this.handleRef,onContextMenu:this.handleContextMenu,onKeyDown:this.onKeyDown},accesibilityProps),React__default.default.createElement("div",{className:itemClassName,"aria-label":metadata.alt,onClick:this.handleClick,onKeyDown:this.onKeyDown},shouldRenderPreloadImage&&this.renderPreloadImage(imageClassName,imageSrc,metadata.alt,imageProps),shouldRenderImage&&this.renderImage(imageClassName,imageSrc,metadata.alt,imageProps,isGif,onlyHiRes),this.hasExpand()&&this.renderExpandIcon()),this.renderTitle(data,this.styles),this.renderDescription(data,this.styles),this.shouldRenderCaption()&&this.renderCaption(metadata.caption))},ImageViewer}(React__default.default.Component);ImageViewer.contextType=wixRichContentCommon.GlobalContext;var shouldDisableStyles=function(componentData,isMobile){var _ref=componentData.config||{},size=_ref.size,width=_ref.width;return!("inline"===size&&lodash.isNumber(width)&&width<=150)&&isMobile},ImageComponent=function(_React$Component){function ImageComponent(props){var _this;(_this=_React$Component.call(this,props)||this).handleMetadataChange=function(newMetadata){var componentData=_this.props.componentData,metadata=_extends__default.default({},componentData.metadata,newMetadata);_this.props.store.update("componentData",_extends__default.default({},componentData,{metadata:metadata}),_this.props.block.getKey())},_this.handleCaptionChange=function(caption){return _this.handleMetadataChange({caption:caption})};var _this$props=_this.props,block=_this$props.block,store=_this$props.store;if(store){var blockKey=block.getKey();store.setBlockHandler("handleMetadataChange",blockKey,_this.handleMetadataChange.bind(_assertThisInitialized__default.default(_this)))}return _this}return _inheritsLoose__default.default(ImageComponent,_React$Component),ImageComponent.prototype.render=function(){var _this$props$tempData,_this$props2=this.props,settings=_this$props2.settings,componentData=_this$props2.componentData,className=_this$props2.className,blockProps=_this$props2.blockProps,theme=_this$props2.theme,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,getInPluginEditingMode=_this$props2.getInPluginEditingMode,setInPluginEditingMode=_this$props2.setInPluginEditingMode,setComponentUrl=_this$props2.setComponentUrl,t=_this$props2.t,error=_this$props2.error,isLoading=_this$props2.isLoading;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ImageViewer,{theme:theme,isMobile:isMobile,helpers:helpers,getInPluginEditingMode:getInPluginEditingMode,setInPluginEditingMode:setInPluginEditingMode,componentData:componentData,className:className,isLoading:this.props.isLoading,dataUrl:null===(_this$props$tempData=this.props.tempData)||void 0===_this$props$tempData?void 0:_this$props$tempData.dataUrl,settings:settings,defaultCaption:this.props.t("ImageViewer_Caption"),onCaptionChange:this.handleCaptionChange,setFocusToBlock:blockProps.setFocusToBlock,setComponentUrl:setComponentUrl}),(isLoading||componentData.loading)&&React__default.default.createElement(wixRichContentUiComponents.Loader,{type:"medium"}),error&&React__default.default.createElement(wixRichContentUiComponents.MediaItemErrorMsg,{error:error,t:t}))},ImageComponent}(React__default.default.Component);ImageComponent.alignmentClassName=function(componentData,theme,styles,isMobile){return function(componentData,theme,styles,isMobile){var _ref2=componentData.config||{},alignment=_ref2.alignment,size=_ref2.size;if(!alignment||shouldDisableStyles(componentData,isMobile)&&"original"!==size)return"";var align=alignment;if("original"===size&&"center"!==alignment){var width=(componentData.src||{}).width;lodash.isNumber(width)&&width>350&&(align="center")}return classNames__default.default(styles["align"+lodash.upperFirst(align)],theme["align"+lodash.upperFirst(align)])}(componentData,theme,styles,isMobile)},ImageComponent.sizeClassName=function(componentData,theme,styles,isMobile){return function(componentData,theme,styles,isMobile){var size=(componentData.config||{}).size;return!size||isMobile&&"original"===size?"":shouldDisableStyles(componentData,isMobile)?classNames__default.default(styles.sizeFullWidth,theme.sizeFullWidth):classNames__default.default(styles["size"+lodash.upperFirst(lodash.camelCase(size))],theme["size"+lodash.upperFirst(lodash.camelCase(size))])}(componentData,theme,styles,isMobile)};var _excluded=["width"];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 createImagePlugin=function(config){var _config$uiSettings,_config$settings,_config$uiSettings2,type=IMAGE_TYPE,defaultPluginData=void 0!==(null==config||null===(_config$uiSettings=config.uiSettings)||void 0===_config$uiSettings?void 0:_config$uiSettings.disableDownload)?_extends__default.default({},DEFAULTS,{disableDownload:config.uiSettings.disableDownload}):DEFAULTS,PluginData=void 0!==(null==config||null===(_config$settings=config.settings)||void 0===_config$settings?void 0:_config$settings.disableExpand)?_extends__default.default({},defaultPluginData,{disableExpand:config.settings.disableExpand}):defaultPluginData,helpers=config.helpers,t=config.t,anchorTarget=config.anchorTarget,relValue=config.relValue,settings=config[type],uiSettings=config.uiSettings,isMobile=config.isMobile,innerModal=config.innerModal,spoilerWrapper=config.spoilerWrapper,experiments=config.experiments,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","t","anchorTarget","relValue",type,"uiSettings","isMobile","innerModal","spoilerWrapper","experiments"].map(_toPropertyKey));return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({component:wixRichContentPluginCommons.createBaseMediaPlugin(ImageComponent),type:IMAGE_TYPE,legacyType:"IMAGE",pluginDecorationProps:function(props,componentData){var _componentData$config,_componentData$config2,_componentData$src,size=null===(_componentData$config=componentData.config)||void 0===_componentData$config?void 0:_componentData$config.size,width=null===(_componentData$config2=componentData.config)||void 0===_componentData$config2?void 0:_componentData$config2.width,calulatedProps=props;null!==(_componentData$src=componentData.src)&&void 0!==_componentData$src&&_componentData$src.width&&("original"===size||isMobile&&"inline"===size&&lodash.isNumber(width)&&width>150)&&(calulatedProps=_extends__default.default({},props,{width:componentData.src.width,style:_extends__default.default({},componentData.src.style||{},{width:componentData.src.width})}));var resizeableProps=wixRichContentPluginCommons.PLUGIN_DECORATION_PROPS[wixRichContentPluginCommons.PLUGIN_DECORATIONS.RESIZEABLE](calulatedProps);if("inline"===size)return resizeableProps;if("original"===size)return _extends__default.default({},resizeableProps,{style:_extends__default.default({},resizeableProps.style,{maxWidth:"100%"})});var _resizeableProps$styl=resizeableProps.style;_resizeableProps$styl.width;var allButWidth=_objectWithoutPropertiesLoose__default.default(_resizeableProps$styl,_excluded);return _extends__default.default({},resizeableProps,{style:_extends__default.default({},allButWidth)})},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({size:"inline",width:nextWidth})},toolbar:createToolbar({helpers:helpers,anchorTarget:anchorTarget,relValue:relValue,t:t,uiSettings:uiSettings,isMobile:isMobile,settings:settings,experiments:experiments}),helpers:helpers,innerModal:innerModal,anchorTarget:anchorTarget,relValue:relValue,settings:settings||{},uiSettings:uiSettings,t:t,isMobile:isMobile,disableRightClick:null==config||null===(_config$uiSettings2=config.uiSettings)||void 0===_config$uiSettings2?void 0:_config$uiSettings2.disableRightClick,defaultPluginData:PluginData,spoilerWrapper:(null==settings?void 0:settings.spoiler)&&spoilerWrapper},rest))};createImagePlugin.functionName=IMAGE_TYPE;var createImageData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var imageData=isRicosSchema?toDraftData.convertNodeDataToDraft("IMAGE",pluginData):pluginData;return lodash.merge({},DEFAULTS,imageData)},imageDataDefaults={containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null},image:{src:null,width:null,height:null},link:{target:"SELF",url:null,anchor:null,rel:null,customData:null},disableExpand:null,altText:null,caption:null,disableDownload:null},Image=function(_ref){var _node$attrs$image,_node$attrs$image$src,context=_ref.context,componentData=_ref.componentData,updateAttributes=_ref.updateAttributes,node=_ref.node,isMobile=context.isMobile,theme=context.theme,t=context.t,_context$config=context.config,settings=(void 0===_context$config?{}:_context$config)[IMAGE_TYPE]||{},isLoading=node.attrs.loading,error=node.attrs.error,blockKey=node.attrs.id;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ImageViewer,{theme:theme,isMobile:isMobile,helpers:{},componentData:componentData,isLoading:isLoading,dataUrl:isLoading&&(null===(_node$attrs$image=node.attrs.image)||void 0===_node$attrs$image||null===(_node$attrs$image$src=_node$attrs$image.src)||void 0===_node$attrs$image$src?void 0:_node$attrs$image$src.url),settings:settings,defaultCaption:t("ImageViewer_Caption"),onCaptionChange:function(caption){updateAttributes({caption:caption})},setFocusToBlock:function(){return null},setComponentUrl:function(){return null},blockKey:blockKey}),(isLoading||componentData.loading)&&React__default.default.createElement(wixRichContentUiComponents.Loader,{theme:theme,type:"medium"}),error&&React__default.default.createElement(wixRichContentUiComponents.MediaItemErrorMsg,{error:error,t:t}))},name=ricosContent.TIPTAP_IMAGE_TYPE;exports.IMAGE_TYPE=IMAGE_TYPE,exports.IMAGE_TYPE_LEGACY="IMAGE",exports.ImageComponent=ImageComponent,exports.ImageViewer=ImageViewer,exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.createImagePlugin=createImagePlugin,exports.pluginImage=function(config){var defaultOptions,pluginConfig=_extends__default.default({},DEFAULTS.config,config);return{config:pluginConfig,type:IMAGE_TYPE,createPlugin:createImagePlugin,ModalsMap:ModalsMap,createPluginData:createImageData,tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Image,componentDataDefaults:_extends__default.default({},imageDataDefaults,{id:"",loading:{default:!1}}),createExtensionConfig:function(){return{name:name,atom:!1,defaultOptions:defaultOptions,addCommands:function(){return{setImageUrl:function(url){return function(_ref){return _ref.commands.updateAttributes(name,{image:{src:{custom:url}}})}},setImageLoading:function(loading){return function(_ref2){return _ref2.commands.updateAttributes(name,{loading:loading})}}}}}}}])}};
"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"),classNames=require("classnames"),wixRichContentCommon=require("wix-rich-content-common"),wixRichContentUiComponents=require("wix-rich-content-ui-components"),reactBeautifulDnd=require("react-beautiful-dnd");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _ModalsMap,_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",directions_LTR="ltr",directions_RTL="rtl",DEFAULTS=Object.freeze({config:{expandState:"first_expanded",expandOnlyOne:!1},pairs:[{key:wixRichContentCommon.generateKey()}]}),EMPTY_PAIR_VALUE={title:wixRichContentEditorCommon.EditorState.createEmpty(),content:wixRichContentEditorCommon.EditorState.createEmpty()},CollapsibleList=function(store,componentData){var _this=this;this.getData=function(){return _this.componentData},this.getConfig=function(){return _this.getData().config},this.getPairs=function(){return _this.getData().pairs},this.getPair=function(idx){return _this.getPairs()[idx]},this.getTitle=function(idx){return _this.getPair(idx).title||wixRichContentEditorCommon.EditorState.createEmpty()},this.getContent=function(idx){return _this.getPair(idx).content||wixRichContentEditorCommon.EditorState.createEmpty()},this.getDirection=function(){return _this.getConfig().direction},this.changeDirection=function(){var direction=_this.getDirection()===directions_LTR?directions_RTL:directions_LTR,updatedData={config:_extends__default.default({},_this.getConfig(),{direction:direction})};_this.updateData(updatedData)},this.getExpandState=function(){return _this.getConfig().expandState},this.setExpandState=function(expandState){var updatedData={config:_extends__default.default({},_this.getConfig(),{expandState:expandState})};"expanded"===expandState&&(updatedData.config.expandOnlyOne=void 0),_this.updateData(updatedData)},this.getExpandOnlyOne=function(){return _this.getConfig().expandOnlyOne},this.toggleExpandOnlyOne=function(){var updatedData={config:_extends__default.default({},_this.getConfig(),{expandOnlyOne:!_this.getExpandOnlyOne()})};_this.updateData(updatedData)},this.setData=function(data){_this.store.set("componentData",data)},this.updateData=function(data){var componentData=_this.getData();_this.setData(_extends__default.default({},componentData,data))},this.setTitle=function(idx,editorState){var pair={title:editorState};_this.setPair(idx,pair)},this.setContent=function(idx,editorState){var pair={content:editorState};_this.setPair(idx,pair)},this.setPair=function(idx,updatedPair){var pairs=[].concat(_this.getPairs()),currentPair=_this.getPair(idx),newPair=_extends__default.default({},currentPair.title&&currentPair.content?{}:EMPTY_PAIR_VALUE,currentPair,updatedPair);pairs.splice(idx,1,newPair),_this.updateData({pairs:pairs})},this.createNewPair=function(){return{key:wixRichContentCommon.generateKey(),title:wixRichContentEditorCommon.EditorState.createEmpty(),content:wixRichContentEditorCommon.EditorState.createEmpty()}},this.insertNewPair=function(){var pairs=_this.getPairs();_this.updateData({pairs:[].concat(pairs,[_this.createNewPair()])})},this.reorderPairs=function(startIdx,endIdx){var pairs=_this.getPairs(),pairToMove=pairs.splice(startIdx,1)[0];pairs.splice(endIdx,0,pairToMove),_this.updateData({pairs:pairs})},this.deletePair=function(pairIndex){var pairs=_this.getPairs();pairs.splice(pairIndex,1),_this.updateData({pairs:pairs})},this.store=store,this.componentData=componentData},styles$5={title:"_3hUj0",settingsContainer:"_62k0D",separator:"_20bm0",direction_selector:"_1jUkB",direction_selector_option:"_1w4ED"},CollapsibleListSettings=function(_Component){function CollapsibleListSettings(props){var _this;(_this=_Component.call(this,props)||this).renderOption=function(_ref){var item=_ref.item;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(item.icon,null),React__default.default.createElement("p",null,item.label))},_this.renderExpandOptions=function(){var _this$props=_this.props,getDataManager=_this$props.getDataManager,t=_this$props.t,theme=_this$props.theme,isMobile=_this$props.isMobile;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(wixRichContentUiComponents.RadioGroupVertical,{label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Title"),value:getDataManager().getExpandState(),dataSource:[{value:"expanded",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Expanded"),dataHook:"Expanded"},{value:"first_expanded",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_FirstExpanded"),dataHook:"FirstExpanded"},{value:"collapsed",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Collapsed"),dataHook:"Collapsed"}],t:t,theme:theme,onChange:function(value){return getDataManager().setExpandState(value)}}),"expanded"!==getDataManager().getExpandState()&&React__default.default.createElement(wixRichContentUiComponents.LabeledToggle,{label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_InSections"),checked:getDataManager().getExpandOnlyOne(),onChange:getDataManager().toggleExpandOnlyOne,theme:theme,style:isMobile?{paddingTop:"28px"}:{},dataHook:"onePairExpanded"}))},_this.renderSeparator=function(){return React__default.default.createElement(wixRichContentUiComponents.Separator,{horizontal:!0,className:_this.styles.separator})},_this.renderDirectionOptions=function(){var _this$props2=_this.props,getDataManager=_this$props2.getDataManager,t=_this$props2.t;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("p",{className:_this.styles.title},t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_Title")," ",React__default.default.createElement(wixRichContentUiComponents.InfoIcon,{tooltipText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_Title_Tooltip")})),React__default.default.createElement(wixRichContentUiComponents.SelectionList,{theme:_this.styles,dataSource:[{value:directions_LTR,label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_LTR"),icon:wixRichContentPluginCommons.LTRIcon,dataHook:"ltrDirection"},{value:directions_RTL,label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_RTL"),icon:wixRichContentPluginCommons.RTLIcon,dataHook:"rtlDirection"}],renderItem:_this.renderOption,value:getDataManager().getDirection(),onChange:getDataManager().changeDirection,className:_this.styles.direction_selector,optionClassName:_this.styles.direction_selector_option}))};var _theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$5,theme:_theme}),_this}return _inheritsLoose__default.default(CollapsibleListSettings,_Component),CollapsibleListSettings.prototype.render=function(){return React__default.default.createElement("div",{className:this.styles.settingsContainer},this.renderExpandOptions(),this.renderSeparator(),this.renderDirectionOptions())},CollapsibleListSettings}(React.Component),styles$4={collapsibleListModal:"_2gcEm",collapsibleListModalTitle:"_22bSm",collapsibleListModal_scrollContainer:"bpnq3",collapsibleListModal_mobile:"_1QgQS"},CollapsibleListModal=function(_Component){function CollapsibleListModal(props){var _this;(_this=_Component.call(this,props)||this).onComponentUpdate=function(){return _this.forceUpdate()},_this.revertComponentData=function(){var helpers=_this.props.helpers,initialComponentData=_this.state.initialComponentData;initialComponentData&&_this.getDataManager().updateData(initialComponentData),helpers.closeModal()},_this.onDoneClick=function(){_this.props.helpers.closeModal()},_this.getDataManager=function(){var pubsub=_this.props.pubsub;return new CollapsibleList(pubsub.store,pubsub.get("componentData"))},_this.renderDesktopHeader=function(){var t=_this.props.t;return React__default.default.createElement("h3",{className:_this.styles.collapsibleListModalTitle},t("CollapsibleList_CollapsibleListSettings_Common_Header"))},_this.renderMobileHeader=function(){var _this$props=_this.props,t=_this$props.t,theme=_this$props.theme;return React__default.default.createElement(wixRichContentUiComponents.SettingsMobileHeader,{t:t,theme:theme,onCancel:_this.revertComponentData,onSave:_this.onDoneClick})},_this.renderSettings=function(){var _classNames,_this$props2=_this.props,isMobile=_this$props2.isMobile,theme=_this$props2.theme,t=_this$props2.t;return React__default.default.createElement("div",{className:classNames__default.default(styles$4.collapsibleListModal_scrollContainer,(_classNames={},_classNames[styles$4.collapsibleListModal_mobile]=isMobile,_classNames))},React__default.default.createElement(CollapsibleListSettings,{getDataManager:_this.getDataManager,theme:theme,isMobile:isMobile,t:t}))},_this.renderDesktopFooterPanel=function(){var _this$props3=_this.props,theme=_this$props3.theme,t=_this$props3.t;return React__default.default.createElement(wixRichContentUiComponents.SettingsPanelFooter,{fixed:!0,theme:theme,cancel:_this.revertComponentData,save:_this.onDoneClick,t:t})},_this.state=_this.initState(props);var _theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$4,theme:_theme}),_this}_inheritsLoose__default.default(CollapsibleListModal,_Component);var _proto=CollapsibleListModal.prototype;return _proto.initState=function(props){return{initialComponentData:props.pubsub.get("componentData")}},_proto.componentDidMount=function(){var pubsub=this.props.pubsub;pubsub.subscribe("componentData",this.onComponentUpdate),this.setState({initialComponentData:pubsub.get("componentData")})},_proto.componentWillUnmount=function(){this.props.pubsub.unsubscribe("componentData",this.onComponentUpdate)},_proto.render=function(){var _this$props4=this.props,isMobile=_this$props4.isMobile,languageDir=_this$props4.languageDir;return React__default.default.createElement("div",{className:this.styles.collapsibleListModal,"data-hook":"collapsibleListModal",dir:languageDir},isMobile?this.renderMobileHeader():this.renderDesktopHeader(),this.renderSettings(),!isMobile&&this.renderDesktopFooterPanel())},CollapsibleListModal}(React.Component),Modals={COLLAPSIBLE_LIST_MODAL:"collapsible-list-modal"},ModalsMap=((_ModalsMap={})[Modals.COLLAPSIBLE_LIST_MODAL]=CollapsibleListModal,_ModalsMap),modalStyles={customStyles:{overlay:{backgroundColor:"transparent"},content:{borderRadius:"2px",boxShadow:"0 4px 8px 0 rgba(0, 0, 0, 0.1)",border:"solid 1px rgba(255, 255, 255, 0.25)"}}},createInlineButtons=function(_ref){var t=_ref.t,disableKeyboardEvents=_ref.disableKeyboardEvents;return[{keyName:"settings",type:wixRichContentPluginCommons.BUTTONS.EXTERNAL_MODAL,fullHeight:!0,modalName:Modals.COLLAPSIBLE_LIST_MODAL,children:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_TabName"),modalStyles:wixRichContentEditorCommon.getModalStyles(modalStyles),t:t,mobile:!0,triggerSettingsBi:!0,pluginId:COLLAPSIBLE_LIST_TYPE},{keyName:"separator",mobile:!1,type:wixRichContentPluginCommons.BUTTONS.SEPARATOR},{keyName:"delete",type:wixRichContentPluginCommons.BUTTONS.DELETE,mobile:!0,beforeOnClickDelete:function(){null==disableKeyboardEvents||disableKeyboardEvents(!1)}}]},InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({width:"19px",height:"12px",viewBox:"0 0 23 12",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},props),React__default.default.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},React__default.default.createElement("g",{transform:"translate(-265.000000, -379.000000)",fill:"currentColor"},React__default.default.createElement("g",{transform:"translate(265.000000, 379.000000)"},React__default.default.createElement("path",{d:"M10,0.8 L22.6,0.8 C22.7104569,0.8 22.8,0.88954305 22.8,1 L22.8,1.6 C22.8,1.71045695 22.7104569,1.8 22.6,1.8 L10,1.8 C9.88954305,1.8 9.8,1.71045695 9.8,1.6 L9.8,1 C9.8,0.88954305 9.88954305,0.8 10,0.8 Z M10,5.8 L22.6,5.8 C22.7104569,5.8 22.8,5.88954305 22.8,6 L22.8,6.6 C22.8,6.71045695 22.7104569,6.8 22.6,6.8 L10,6.8 C9.88954305,6.8 9.8,6.71045695 9.8,6.6 L9.8,6 C9.8,5.88954305 9.88954305,5.8 10,5.8 Z M10,10.8 L22.6,10.8 C22.7104569,10.8 22.8,10.8895431 22.8,11 L22.8,11.6 C22.8,11.7104569 22.7104569,11.8 22.6,11.8 L10,11.8 C9.88954305,11.8 9.8,11.7104569 9.8,11.6 L9.8,11 C9.8,10.8895431 9.88954305,10.8 10,10.8 Z",fillRule:"nonzero"}),React__default.default.createElement("path",{d:"M2.61252587,5.04452587 C2.55011987,5.10656164 2.44933186,5.10656164 2.38692587,5.04452587 L2.04692587,4.70452587 C2.01688154,4.67451494 2,4.63379134 2,4.59132587 C2,4.54886039 2.01688154,4.50813679 2.04692587,4.47812587 L4.47972587,2.04532587 L2.04772587,-0.386674135 C2.01768154,-0.416685056 2.0008,-0.457408655 2.0008,-0.499874135 C2.0008,-0.542339615 2.01768154,-0.583063214 2.04772587,-0.613074135 L2.38692587,-0.953074135 C2.41693679,-0.983118462 2.45766039,-1 2.50012587,-1 C2.54259134,-1 2.58331494,-0.983118462 2.61332587,-0.953074135 L5.49812587,1.93172587 C5.52817019,1.96173679 5.54505173,2.00246039 5.54505173,2.04492587 C5.54505173,2.08739134 5.52817019,2.12811494 5.49812587,2.15812587 L2.61252587,5.04372587 L2.61252587,5.04452587 Z",transform:"translate(3.772526, 2.045526) rotate(-270.000000) translate(-3.772526, -2.045526) "})))))},ArrowIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M11.999 9L6 14.241 6.657 15 11.999 10.334 17.343 15 18 14.241z",transform:"translate(-129 -185) translate(97 105) translate(23 71) rotate(-90 21 12) matrix(1 0 0 -1 0 24)"})))))))},PlusIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M12.5 6v5.5H18v1h-5.5V18h-1v-5.5H6v-1h5.5V6h1z",transform:"translate(-129 -269) translate(97 105) translate(23 155) rotate(-90 21 12)"}))))))},DndIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M5.37 7.083c-.684-.025-1.22-.596-1.203-1.28.017-.685.58-1.228 1.265-1.22.684.009 1.234.566 1.235 1.25-.014.704-.594 1.263-1.297 1.25zM5.37 2.5c-.684-.026-1.22-.597-1.203-1.28.017-.685.58-1.228 1.265-1.22.684.009 1.234.566 1.235 1.25-.014.703-.594 1.263-1.297 1.25zM5.463 9.167c.684.025 1.22.596 1.203 1.28-.017.685-.58 1.228-1.265 1.22-.684-.009-1.234-.566-1.234-1.25.014-.703.594-1.262 1.296-1.25zM1.203 7.083C.52 7.058-.017 6.487 0 5.803c.017-.685.581-1.228 1.265-1.22.685.009 1.235.566 1.235 1.25-.013.704-.594 1.263-1.297 1.25zM1.203 2.5C.52 2.474-.017 1.903 0 1.22.017.534.581-.009 1.265 0 1.95.01 2.5.566 2.5 1.25c-.013.703-.594 1.263-1.297 1.25zM1.297 9.167c.683.025 1.22.596 1.203 1.28-.017.685-.581 1.228-1.265 1.22C.55 11.658 0 11.1 0 10.417c.015-.703.594-1.262 1.297-1.25z",transform:"translate(-99 -190) translate(99 176) translate(0 14) translate(6.667 4.167)"})))))))},styles$3={ltr:"E6y_Z",rtl:"_2wLEl",iconContainer:"_21s0b",icon:"_2z8L4",isExpanded:"aPvla"};function ExpandCollapseButton(props){var onClick=props.onClick,idx=props.idx,ariaLabel=props.ariaLabel;return React__default.default.createElement("div",{role:"button",tabIndex:"-1",className:styles$3.iconContainer,onClick:onClick,onKeyUp:function(e){return(" "===e.key||"Enter"===e.key)&&onClick(e)},"data-hook":"ExpandCollapseButton_"+idx},React__default.default.createElement(ArrowIcon,{role:"button",tabIndex:"0","aria-label":ariaLabel,className:classNames__default.default(styles$3.icon,props.isExpanded&&styles$3.isExpanded)}))}var styles$2={titleContainer:"_3LwlN",title:"_3CwVy",content:"_3TxVS"},CollapsibleListPair=function(_Component){function CollapsibleListPair(props){var _this;(_this=_Component.call(this,props)||this).focusTitle=function(){var _this$titleEditorRef$;return null===(_this$titleEditorRef$=_this.titleEditorRef.current)||void 0===_this$titleEditorRef$?void 0:_this$titleEditorRef$.focus()},_this.renderTitle=function(){var _this$props=_this.props,idx=_this$props.idx,renderTitle=_this$props.renderTitle;return React__default.default.createElement("div",{className:_this.styles.title},renderTitle(idx,_this.titleEditorRef))},_this.focusContent=function(){var _this$contentEditorRe;return null===(_this$contentEditorRe=_this.contentEditorRef.current)||void 0===_this$contentEditorRe?void 0:_this$contentEditorRe.focus()},_this.renderContent=function(){var _this$props2=_this.props,idx=_this$props2.idx,renderContent=_this$props2.renderContent;return _this$props2.isExpanded&&React__default.default.createElement("div",{className:_this.styles.content},renderContent(idx,_this.contentEditorRef))},_this.onClick=function(e){var _helpers$onViewerActi,_this$props3=_this.props,isExpanded=_this$props3.isExpanded,onCollapseClick=_this$props3.onCollapseClick,onExpandClick=_this$props3.onExpandClick,idx=_this$props3.idx,helpers=_this$props3.helpers,isInEditor=_this$props3.isInEditor;isExpanded?onCollapseClick(idx):onExpandClick(idx),null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,COLLAPSIBLE_LIST_TYPE,"Click",isExpanded?"collapse":"expand"),isInEditor||(e.preventDefault(),setTimeout((function(){return wixRichContentCommon.anchorScroll(_this.pairRef,_this.context.experiments)})))},_this.onKeyDown=function(e){"a"===e.key&&(e.ctrlKey||e.metaKey)&&e.stopPropagation()};var theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$2,theme:theme}),_this.titleEditorRef=React__default.default.createRef(),_this.contentEditorRef=React__default.default.createRef(),_this.pairRef=React__default.default.createRef(),_this}return _inheritsLoose__default.default(CollapsibleListPair,_Component),CollapsibleListPair.prototype.render=function(){var _this2=this,_this$props4=this.props,isExpanded=_this$props4.isExpanded,idx=_this$props4.idx,t=_this$props4.t;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:this.styles.titleContainer,onKeyDown:this.onKeyDown,ref:function(_ref){return _this2.pairRef=_ref}},React__default.default.createElement(ExpandCollapseButton,{isExpanded:isExpanded,onClick:this.onClick,idx:idx,ariaLabel:t(isExpanded?"CollapsibleListPlugin_ExpandButton_AriaLabel":"CollapsibleListPlugin_CollapseButton_AriaLabel")}),this.renderTitle()),this.renderContent())},CollapsibleListPair}(React.Component);CollapsibleListPair.contextType=wixRichContentCommon.GlobalContext;var getPairsAllCollpased=function(pairs){return pairs.map((function(){return!1}))},getDefaultPairsState=function(pairs,defaultPairsExpandState){var pairsState="expanded"===defaultPairsExpandState?function(pairs){return pairs.map((function(){return!0}))}(pairs):getPairsAllCollpased(pairs);return"first_expanded"===defaultPairsExpandState&&(pairsState[0]=!0),pairsState},CollapsibleListPairs=function(_Component){function CollapsibleListPairs(props){var _this;return(_this=_Component.call(this,props)||this).focusPair=function(_ref){var idx=_ref.idx,isTitle=_ref.isTitle,pair=_this.pairsRefs[idx];isTitle?null==pair||pair.focusTitle():(null==pair?void 0:pair.focusContent())||null==pair||pair.focusTitle()},_this.expandPair=function(idx){var _this$props=_this.props,pairs=_this$props.pairs,expandOnlyOne=_this$props.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairs)),pairsState[idx]=!0,_this.setState({pairsState:pairsState})},_this.collapsePair=function(idx){var pairsState=[].concat(_this.state.pairsState);pairsState[idx]=!1,_this.setState({pairsState:pairsState})},_this.insertNewPair=function(){var expandOnlyOne=_this.state.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairsState)),pairsState=[].concat(pairsState,[!0]),_this.setState({pairsState:pairsState})},_this.deletePair=function(idx){var pairsState=_this.state.pairsState;pairsState.splice(idx,1),_this.setState({pairsState:pairsState})},_this.reorderPairs=function(startIdx,endIdx){var pairsState=_this.state.pairsState,pairToMove=pairsState.splice(startIdx,1)[0];pairsState.splice(endIdx,0,pairToMove),_this.setState({pairsState:pairsState})},_this.pairsRefs=[],_this.state=_this.initState(props),_this}_inheritsLoose__default.default(CollapsibleListPairs,_Component);var _proto=CollapsibleListPairs.prototype;return _proto.initState=function(props){var pairs=props.pairs,expandState=props.expandState;return{defaultPairsExpandState:expandState,expandOnlyOne:props.expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}},CollapsibleListPairs.getDerivedStateFromProps=function(props,state){var pairs=props.pairs,expandState=props.expandState,expandOnlyOne=props.expandOnlyOne;return state.defaultPairsExpandState!==expandState||expandOnlyOne&&expandOnlyOne!==state.expandOnlyOne?{defaultPairsExpandState:expandState,expandOnlyOne:expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}:null},_proto.render=function(){var _this2=this,_this$props2=this.props,pairs=_this$props2.pairs,PairWrapper=_this$props2.PairWrapper,t=_this$props2.t,theme=_this$props2.theme,renderTitle=_this$props2.renderTitle,renderContent=_this$props2.renderContent,helpers=_this$props2.helpers,isInEditor=_this$props2.isInEditor,pairsState=this.state.pairsState;return pairs.map((function(pair,idx){return React__default.default.createElement(PairWrapper,{key:pair.key,id:pair.key,index:idx},React__default.default.createElement(CollapsibleListPair,{ref:function(_ref2){return _this2.pairsRefs[idx]=_ref2},t:t,key:pair.key,idx:idx,isExpanded:pairsState[idx],onCollapseClick:_this2.collapsePair,onExpandClick:_this2.expandPair,theme:theme,renderTitle:renderTitle,renderContent:renderContent,helpers:helpers,isInEditor:isInEditor}))}))},CollapsibleListPairs}(React.Component);CollapsibleListPairs.defaultProps={PairWrapper:"div"};var styles$1_new_pair_container="_1AgMx",styles$1_new_pair_button="_1Zqb4",styles$1_new_pair_label="_3iSqB";function NewPairButton(props){return React__default.default.createElement("div",{role:"button",tabIndex:"0",className:styles$1_new_pair_container,onClick:props.onClick,onKeyPress:function(e){return("Enter"===e.key||" "===e.key)&&props.onClick(e)},"data-hook":"CollapsibleListNewPair_button"},React__default.default.createElement("div",{className:styles$1_new_pair_button},React__default.default.createElement(PlusIcon,null),React__default.default.createElement("label",{className:styles$1_new_pair_label},props.label)))}var styles_dndIcon="hDgGn";function DndHandle(props){return React__default.default.createElement("div",_extends__default.default({className:styles_dndIcon},props.dragHandleProps),React__default.default.createElement(DndIcon,null))}var CollapsibleListComponent=function(_React$Component){function CollapsibleListComponent(_props){var _this,_this2=this;(_this=_React$Component.call(this,_props)||this).focusPair=function(pair){return setTimeout((function(){_this.collapsibleListRef.current.focusPair(pair)}))},_this.expandPair=function(idx){return _this.collapsibleListRef.current.expandPair(idx)},_this.focusTitle=function(idx){var pair={idx:idx,isTitle:!0};_this.focusPair(pair)},_this.focusContent=function(idx){var pair={idx:idx,isTitle:!1};_this.focusPair(pair)},_this.onTitleBackspace=function(idx){_this.getDataManager().getPairs().length>1&&(_this.getDataManager().deletePair(idx),_this.collapsibleListRef.current.deletePair(idx),0===idx?_this.focusTitle(idx):_this.focusContent(idx-1))},_this.renderTitle=function(idx,setRef){return React__default.default.createElement(_this2.renderInput,{value:_this.getDataManager().getTitle(idx),setRef:setRef,onChange:function(val){return _this.getDataManager().setTitle(idx,val)},placeholder:_this.titlePlaceholder,onBackspaceAtBeginningOfContent:function(){return _this.onTitleBackspace(idx)},handleReturn:_this.handleTitleReturn(idx),toolbarsToIgnore:["SideToolbar"]})},_this.renderContent=function(idx,setRef){return React__default.default.createElement(_this2.renderInput,{value:_this.getDataManager().getContent(idx),setRef:setRef,onChange:function(val){return _this.getDataManager().setContent(idx,val)},placeholder:_this.contentPlaceholder,onBackspaceAtBeginningOfContent:function(){return _this.focusTitle(idx)}})},_this.renderInput=function(_ref){var value=_ref.value,setRef=_ref.setRef,onChange=_ref.onChange,placeholder=_ref.placeholder,onBackspaceAtBeginningOfContent=_ref.onBackspaceAtBeginningOfContent,handleReturn=_ref.handleReturn,toolbarsToIgnore=_ref.toolbarsToIgnore,renderInnerRCE=_this.props.renderInnerRCE,direction=_this.getDataManager().getDirection();return renderInnerRCE({editorState:value,setRef:setRef,onChange:onChange,renderedIn:COLLAPSIBLE_LIST_TYPE,onBackspaceAtBeginningOfContent:onBackspaceAtBeginningOfContent,direction:direction,additionalProps:{textAlignment:"ltr"===direction?"left":"right",placeholder:placeholder,handleReturn:handleReturn},toolbarsToIgnore:toolbarsToIgnore,onFocus:function(){return _this.props.disableKeyboardEvents(!0)},onBlur:function(){return _this.props.disableKeyboardEvents(!1)}})},_this.handleTitleReturn=function(idx){return function(){return function(){return _this.expandPair(idx),_this.focusContent(idx),"handled"}}},_this.onNewPairButtonClick=function(){var newPairIdx=_this.getDataManager().getPairs().length;_this.getDataManager().insertNewPair(),_this.collapsibleListRef.current.insertNewPair(),_this.focusTitle(newPairIdx)},_this.onDragEnd=function(result){result.destination&&result.source.index!==result.destination.index&&(_this.getDataManager().reorderPairs(result.source.index,result.destination.index),_this.collapsibleListRef.current.reorderPairs(result.source.index,result.destination.index))},_this.getDataManager=function(props){var _ref2=props||_this.props,store=_ref2.store,componentData=_ref2.componentData;return new CollapsibleList(store,componentData)},_this.PairWrapper=function(_ref3){var id=_ref3.id,index=_ref3.index,children=_ref3.children,_this$props=_this.props,isMobile=_this$props.isMobile,blockProps=_this$props.blockProps,isDragDisabled=isMobile||!blockProps.isFocused;return React__default.default.createElement(reactBeautifulDnd.Draggable,{key:id,draggableId:id,index:index,isDragDisabled:isDragDisabled},(function(provided){return React__default.default.createElement("div",_extends__default.default({ref:provided.innerRef},provided.draggableProps),!isDragDisabled&&React__default.default.createElement(DndHandle,{dragHandleProps:provided.dragHandleProps}),children)}))},_this.onFocus=function(e){return e.stopPropagation()};var theme=_props.theme,t=_props.t;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$3,theme:theme}),_this.titlePlaceholder=t("CollapsibleList_ShownText_Placeholder"),_this.contentPlaceholder=t("CollapsibleList_CollapsedText_Placeholder"),_this.addNewPairLabel=t("CollapsibleList_ShownText_Add_Placeholder"),_this.collapsibleListRef=React__default.default.createRef(),_this}return _inheritsLoose__default.default(CollapsibleListComponent,_React$Component),CollapsibleListComponent.prototype.render=function(){var _this3=this,_this$props2=this.props,blockProps=_this$props2.blockProps,theme=_this$props2.theme,t=_this$props2.t,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,pairs=this.getDataManager().getPairs(),expandState=this.getDataManager().getExpandState(),expandOnlyOne=this.getDataManager().getExpandOnlyOne(),direction=this.getDataManager().getDirection();return React__default.default.createElement("div",{className:this.styles[direction],onFocus:this.onFocus,tabIndex:"0","data-hook":"collapsibleListComponent"},React__default.default.createElement(reactBeautifulDnd.DragDropContext,{onDragEnd:this.onDragEnd},React__default.default.createElement(reactBeautifulDnd.Droppable,{droppableId:"droppable"},(function(provided){return React__default.default.createElement("div",_extends__default.default({},provided.droppableProps,{ref:provided.innerRef}),React__default.default.createElement(CollapsibleListPairs,{ref:_this3.collapsibleListRef,theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:_this3.renderTitle,renderContent:_this3.renderContent,PairWrapper:_this3.PairWrapper,helpers:helpers,isInEditor:!0}),provided.placeholder)}))),blockProps.isFocused&&React__default.default.createElement(NewPairButton,{label:this.addNewPairLabel,onClick:this.onNewPairButtonClick}))},CollapsibleListComponent}(React__default.default.Component),createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,locale=_ref.locale,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,componentData=_extends__default.default({},DEFAULTS,{config:_extends__default.default({},DEFAULTS.config,{direction:wixRichContentCommon.isRtl(locale)?directions_RTL:directions_LTR})});return[{type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON,name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.COLLAPSIBLE_LIST,getLabel:function(){return t("CollapsibleList_InsertButton")},tooltip:t("CollapsibleListPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},isActive:function(){return!1},isDisabled:function(){return!1},componentData:componentData,toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],section:"BlockToolbar_Section_Advanced"}]},createToolbar=function(_ref){var t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,locale=_ref.locale,disableKeyboardEvents=_ref.disableKeyboardEvents;return{InlineButtons:createInlineButtons({t:t,disableKeyboardEvents:disableKeyboardEvents}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile,locale:locale}),name:COLLAPSIBLE_LIST_TYPE}};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 createCollapsibleListPlugin=function(config){var localeContent=config.localeContent,locale=config.locale,helpers=config.helpers,t=config.t,_config$COLLAPSIBLE_L=config[COLLAPSIBLE_LIST_TYPE],settings=void 0===_config$COLLAPSIBLE_L?{}:_config$COLLAPSIBLE_L,isMobile=config.isMobile,disableKeyboardEvents=config.disableKeyboardEvents,rest=_objectWithoutPropertiesLoose__default.default(config,["localeContent","locale","helpers","t",COLLAPSIBLE_LIST_TYPE,"isMobile","disableKeyboardEvents"].map(_toPropertyKey));return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({component:CollapsibleListComponent,type:COLLAPSIBLE_LIST_TYPE,toolbar:createToolbar({helpers:helpers,t:t,settings:settings,isMobile:isMobile,locale:localeContent||locale,disableKeyboardEvents:disableKeyboardEvents}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,defaultPluginData:DEFAULTS,noPluginBorder:!0,noPointerEventsOnFocus:!0,locale:localeContent||locale,disableKeyboardEvents:disableKeyboardEvents},rest))};createCollapsibleListPlugin.functionName=COLLAPSIBLE_LIST_TYPE;var CollapsibleListViewer=function(_Component){function CollapsibleListViewer(props){var _this;(_this=_Component.call(this,props)||this).getPair=function(idx){return _this.props.componentData.pairs[idx]},_this.renderInnerRCV=function(contentState){var _this$props=_this.props,innerRCV=_this$props.innerRCV,componentData=_this$props.componentData;return innerRCV({contentState:contentState,textAlignment:function(componentData){return"ltr"===componentData.config.direction?"left":"right"}(componentData),direction:function(componentData){return componentData.config.direction}(componentData)})},_this.renderTitle=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.title)},_this.renderContent=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.content)};var theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$3,theme:theme}),_this}return _inheritsLoose__default.default(CollapsibleListViewer,_Component),CollapsibleListViewer.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,t=_this$props2.t,componentData=_this$props2.componentData,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,config=componentData.config,pairs=componentData.pairs,direction=config.direction,expandState=config.expandState,expandOnlyOne=config.expandOnlyOne;return React__default.default.createElement("div",{className:this.styles[direction]},React__default.default.createElement(CollapsibleListPairs,{theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:this.renderTitle,renderContent:this.renderContent,helpers:helpers}))},CollapsibleListViewer}(React.Component);exports.COLLAPSIBLE_LIST_TYPE=COLLAPSIBLE_LIST_TYPE,exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.collapsibleListViewer=CollapsibleListViewer,exports.createCollapsibleListPlugin=createCollapsibleListPlugin,exports.pluginCollapsibleList=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,createPlugin:createCollapsibleListPlugin,ModalsMap:ModalsMap}};
//# sourceMappingURL=module.cjs.js.map

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

import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import _extends from"@babel/runtime/helpers/extends";import{get,isEmpty,isEqual,includes,isFunction,isNumber,upperFirst,camelCase,merge}from"lodash";import{BUTTONS,PluginSettingsIcon,createBasePlugin,createBaseMediaPlugin,PLUGIN_DECORATION_PROPS,PLUGIN_DECORATIONS}from"wix-rich-content-plugin-commons";import{getModalStyles,BUTTON_TYPES,INSERT_PLUGIN_BUTTONS,TOOLBARS}from"wix-rich-content-editor-common";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import classNames from"classnames";import{mergeStyles,addAnchorTagToUrl,anchorScroll,validate,GlobalContext,isSSR}from"wix-rich-content-common";import{getImageSrc,WIX_MEDIA_DEFAULT,isPNG}from"wix-rich-content-common/libs/imageUtils";import{SettingsSeparator,LabeledToggle,SettingsMobileHeader,SettingsSection,Image as Image$1,Loader,InputWithLabel,SettingsPanelFooter,MediaItemErrorMsg}from"wix-rich-content-ui-components";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import pluginImageSchema from"wix-rich-content-common/dist/statics/schemas/plugin-image.schema.json";import{convertNodeDataToDraft}from"ricos-content/libs/toDraftData";import{TIPTAP_IMAGE_TYPE}from"ricos-content";var styles$2={imageSettings:"-PCJd",imageSettingsTitle:"_3qXJb",imageSettingsImageSection:"_3vNQG",imageSettingsImage:"_1Y0jo",imageSettingsSection:"_2APzQ",imageSettingsLabel:"_22ic1",imageSettings_scrollContainer:"hMCLW",imageSettings_inputsWrapper:"_1W0yQ",imageSettings_mobile:"_41Y3W",imageSettings_footer:"j6-Tp",imageSettings_hidden:"_2tqWq"},DEFAULTS=Object.freeze({config:{alignment:"center",size:"content",showTitle:!0,showDescription:!0}}),_excluded$1=["isExpandEnabled","isDownloadEnabled"],ImageSettings=function(_Component){function ImageSettings(props){var _this;(_this=_Component.call(this,props)||this).toggleState=function(key,onToggle){return function(){var _this$setState,value=!_this.state[key];_this.setState(((_this$setState={})[key]=value,_this$setState),null==onToggle?void 0:onToggle(value))}},_this.renderToggle=function(_ref){var toggleKey=_ref.toggleKey,labelKey=_ref.labelKey,dataHook=_ref.dataHook,tooltipText=_ref.tooltipText,onToggle=_ref.onToggle;return"divider"===_ref.type?React.createElement(SettingsSeparator,{top:!0}):React.createElement("div",{key:toggleKey,className:_this.styles.imageSettings_toggleContainer},React.createElement(LabeledToggle,{theme:_this.props.theme,checked:_this.state[toggleKey],label:_this.props.t(labelKey),onChange:_this.toggleState(toggleKey,onToggle),dataHook:dataHook,tooltipText:tooltipText}))},_this.baseToggleData=[{toggleKey:"isExpandEnabled",labelKey:"ImagePlugin_Settings_ImageOpensInExpandMode_Label",dataHook:"imageExpandToggle",tooltipText:_this.props.t("ImageSettings_Expand_Mode_Toggle")},{toggleKey:"isDownloadEnabled",labelKey:"ImagePlugin_Settings_ImageCanBeDownloaded_Label",dataHook:"imageDownloadToggle",tooltipText:_this.props.t("ImagePlugin_Settings_ImageCanBeDownloaded_Tooltip")}],_this.toggleData=_this.props.shouldShowSpoiler?[].concat(_this.baseToggleData,[{type:"divider"},{toggleKey:"isSpoilerEnabled",labelKey:"ImageSettings_Spoiler_Toggle",dataHook:"imageSpoilerToggle",tooltipText:_this.props.t("Spoiler_Toggle_Tooltip"),onToggle:function(value){_this.props.pubsub.update("componentData",_extends({},_this.props.componentData,_this.getSpoilerConfig(value)))}}]):_this.baseToggleData,_this.onComponentUpdate=function(){var componentData=_this.props.pubsub.get("componentData");_this.setState({src:componentData.src,error:null==componentData?void 0:componentData.error})},_this.revertComponentData=function(){var _this$props=_this.props,componentData=_this$props.componentData,helpers=_this$props.helpers,pubsub=_this$props.pubsub;if(_this.initialState){var _this$initialState=_this.initialState,isExpandEnabled=_this$initialState.isExpandEnabled,isDownloadEnabled=_this$initialState.isDownloadEnabled,rest=_objectWithoutPropertiesLoose(_this$initialState,_excluded$1),initialComponentData=_extends({},componentData,rest,{disableExpand:!isExpandEnabled,disableDownload:!isDownloadEnabled});pubsub.update("componentData",initialComponentData),_this.setState(_extends({},_this.initialState))}helpers.closeModal()},_this.metadataUpdated=function(metadata,value){_this.setState({metadata:_extends({},metadata,value)})},_this.onDoneClick=function(){var _this$props2=_this.props,helpers=_this$props2.helpers,componentData=_this$props2.componentData,pubsub=_this$props2.pubsub,newComponentData=_extends({},componentData,_this.getSpoilerConfig(_this.state.isSpoilerEnabled),{disableDownload:!_this.state.isDownloadEnabled,disableExpand:!_this.state.isExpandEnabled});_this.state.metadata&&(newComponentData.metadata=_this.state.metadata),pubsub.update("componentData",newComponentData),helpers.closeModal()},_this.getSpoilerConfig=function(enabled){return{config:_extends({},_this.props.componentData.config,{spoiler:{enabled:enabled}})}},_this.setBlockLink=function(item){return _this.props.pubsub.setBlockData({key:"componentLink",item:item})},_this.state=_this.propsToState(props),_this.initialState=_extends({},_this.state);var t=props.t,theme=props.theme;return _this.styles=mergeStyles({styles:styles$2,theme:theme}),_this.updateLabel=t("ImageSettings_Update"),_this.headerText=t("ImageSettings_Header"),_this.captionLabel=t("ImageSettings_Caption_Label"),_this.captionInputPlaceholder=t("ImageSettings_Caption_Input_Placeholder"),_this.altLabel=t("ImageSettings_Alt_Label"),_this.altTooltip="ImageSettings_Alt_Label_Tooltip",_this.altInputPlaceholder=t("ImageSettings_Alt_Input_Placeholder"),_this}_inheritsLoose(ImageSettings,_Component);var _proto=ImageSettings.prototype;return _proto.propsToState=function(props){var componentData=props.componentData,src=componentData.src,metadata=componentData.metadata,error=componentData.error,disableExpand=componentData.disableExpand,disableDownload=componentData.disableDownload,_componentData$config=componentData.config.spoiler;return{src:src,metadata:metadata,error:error,isExpandEnabled:!disableExpand,isDownloadEnabled:!disableDownload,isSpoilerEnabled:(void 0===_componentData$config?{}:_componentData$config).enabled}},_proto.componentDidMount=function(){this.props.pubsub.subscribe("componentData",this.onComponentUpdate)},_proto.componentWillUnmount=function(){this.props.pubsub.unsubscribe("componentData",this.onComponentUpdate)},_proto.render=function(){var _classNames,_this2=this,_this$props3=this.props,helpers=_this$props3.helpers,theme=_this$props3.theme,t=_this$props3.t,isMobile=_this$props3.isMobile,languageDir=_this$props3.languageDir,_this$state=this.state,src=_this$state.src,error=_this$state.error,_this$state$metadata=_this$state.metadata,metadata=void 0===_this$state$metadata?{}:_this$state$metadata;return React.createElement("div",{className:this.styles.imageSettings,"data-hook":"settings",dir:languageDir},isMobile?React.createElement(SettingsMobileHeader,{theme:theme,onCancel:this.revertComponentData,onSave:this.onDoneClick,t:t}):React.createElement("h3",{className:this.styles.imageSettingsTitle},this.headerText),React.createElement("div",{className:classNames(styles$2.imageSettings_scrollContainer,(_classNames={},_classNames[styles$2.imageSettings_mobile]=isMobile,_classNames))},React.createElement(SettingsSection,{theme:theme,className:this.styles.imageSettingsImageSection,ariaProps:{"aria-label":"image preview",role:"region","data-hook":"imagePreview"}},src?React.createElement(Image$1,{alt:metadata.alt||"image preview",resizeMode:"contain",className:this.styles.imageSettingsImage,src:getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,{requiredWidth:1e3,requiredHeight:250,requiredQuality:80}),theme:theme,error:error,t:t}):React.createElement("div",{className:this.styles.imageSettingsImage},React.createElement(Loader,{type:"medium"}))),React.createElement("div",{className:this.styles.imageSettings_inputsWrapper},React.createElement(SettingsSection,{theme:theme,className:this.styles.imageSettingsSection,ariaProps:{"aria-label":"image caption",role:"region"}},React.createElement(InputWithLabel,{theme:theme,id:"imageSettingsCaptionInput",label:this.captionLabel,placeholder:this.captionInputPlaceholder,value:metadata.caption||"",onChange:function(caption){return _this2.metadataUpdated(metadata,{caption:caption})},dataHook:"imageSettingsCaptionInput"})),React.createElement(SettingsSection,{theme:theme,className:this.styles.imageSettingsSection,ariaProps:{"aria-label":"image alt text",role:"region"}},React.createElement(InputWithLabel,{theme:theme,id:"imageSettingsAltInput",label:this.altLabel,placeholder:this.altInputPlaceholder,t:t,value:metadata.alt||"",onChange:function(alt){return _this2.metadataUpdated(metadata,{alt:alt})},dataHook:"imageSettingsAltInput",tooltipTextKey:this.altTooltip,isMobile:isMobile})),React.createElement(SettingsSection,{theme:theme,ariaProps:{"aria-label":"link redirect explanation",role:"region"}},React.createElement("div",{className:this.styles.imageSettingsLabel},this.toggleData.map((function(toggle){return _this2.renderToggle(toggle)})))))),!isMobile&&React.createElement(SettingsPanelFooter,{fixed:!0,theme:theme,cancel:this.revertComponentData,save:this.onDoneClick,t:t}))},ImageSettings}(Component);var mediaImageStudioPackageLoader;function getImageStudioPackage(){var src;return mediaImageStudioPackageLoader||(window.requirejs&&!window.requirejsBackup&&(window.requirejsBackup={define:window.define,require:window.require,requirejs:window.requirejs},window.define=void 0,window.require=void 0,window.requirejs=void 0),src="https://static.parastorage.com/unpkg/@wix/media-image-studio-opener@3.27.0/dist/statics/MediaImageStudio.bundle.min.js",mediaImageStudioPackageLoader=new Promise((function(resolve){var script=document.createElement("script");script.src=src,script.onload=resolve,document.head.appendChild(script)}))),mediaImageStudioPackageLoader.then((function(){return window.requirejsBackup&&(Object.assign(window,window.requirejsBackup),window.requirejsBackup=void 0),window.MediaImageStudio}))}function _setupImageEditor(){return(_setupImageEditor=_asyncToGenerator(_regeneratorRuntime.mark((function _callee(imageEditorWixSettings,rootElementId,fileName,onSave,onClose){var _yield$getImageStudio,MediaImageStudio,MediaImageStudioEvents,MediaImageStudioMode,mediaImageStudio,imageDataSubscription;return _regeneratorRuntime.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.next=2,getImageStudioPackage();case 2:return _yield$getImageStudio=_context.sent,MediaImageStudio=_yield$getImageStudio.MediaImageStudio,MediaImageStudioEvents=_yield$getImageStudio.MediaImageStudioEvents,MediaImageStudioMode=_yield$getImageStudio.MediaImageStudioMode,_context.t0=MediaImageStudio,_context.t1=_extends,_context.t2={},_context.next=11,Promise.resolve(imageEditorWixSettings);case 11:_context.t3=_context.sent,_context.t4={appendTo:document.querySelector("[id="+rootElementId+"]")},_context.t5=(0,_context.t1)(_context.t2,_context.t3,_context.t4),mediaImageStudio=new _context.t0(_context.t5),imageDataSubscription=mediaImageStudio.once(MediaImageStudioEvents.ImageData,(function(imageData){var file=blobToFile(imageData,fileName);onSave(file)})),mediaImageStudio.once(MediaImageStudioEvents.Close,(function(){imageDataSubscription.remove(),mediaImageStudio.kill(),onClose()})),mediaImageStudio.show({mode:MediaImageStudioMode.Transform,fileId:fileName});case 18:case"end":return _context.stop()}}),_callee)})))).apply(this,arguments)}function blobToFile(blob,fileName){return blob.lastModifiedDate=new Date,blob.name=fileName,blob}var _ModalsMap,ImageEditor=function(_Component){function ImageEditor(props){var _this;(_this=_Component.call(this,props)||this).state={mediaImageStudio:void 0,mediaImageStudioEvents:void 0};var _this$props=_this.props,src=_this$props.componentData.src,helpers=_this$props.helpers,pubsub=_this$props.pubsub,imageEditorWixSettings=_this$props.imageEditorWixSettings,onImageEditorOpen=_this$props.onImageEditorOpen,onClose=function(){var _helpers$closeModal;null==helpers||null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers)};return onImageEditorOpen&&onImageEditorOpen(),_this.id="imageEditor",function(_x,_x2,_x3,_x4,_x5){_setupImageEditor.apply(this,arguments)}(imageEditorWixSettings,_this.id,src.file_name,(function(file){null==pubsub||pubsub.getBlockHandler("handleFilesSelected")([file]),onClose()}),onClose),_this}return _inheritsLoose(ImageEditor,_Component),ImageEditor.prototype.render=function(){return React.createElement("div",{id:this.id,nofocus:"true"})},ImageEditor}(Component),Modals={IMAGE_SETTINGS:"image-settings",IMAGE_EDITOR:"image-editor"},ModalsMap=((_ModalsMap={})[Modals.IMAGE_SETTINGS]=ImageSettings,_ModalsMap[Modals.IMAGE_EDITOR]=ImageEditor,_ModalsMap),InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({width:19,height:19,viewBox:"0 0 19 19"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("path",{d:"M2 6a1 1 0 0 1 1-1h2.75l.668-1.424A1 1 0 0 1 7.323 3h4.354a1 1 0 0 1 .905.576L13.25 5H16a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6zm1 0v8h13V6h-3.5l-1.018-2H7.518L6.5 6H3zm6.5 6a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zm0-1a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"})))},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"})))},ImageEditorIcon=function(props){return React.createElement("svg",Object.assign({viewBox:"2 2 19 19",fill:"currentColor"},props),React.createElement("path",{d:"M14.092,8 C14.036,7.843 14,7.676 14,7.5 C14,7.324 14.036,7.157 14.092,7 C14.299,6.419 14.849,6 15.5,6 C16.151,6 16.701,6.419 16.908,7 C16.964,7.157 17,7.324 17,7.5 C17,7.676 16.964,7.843 16.908,8 C16.701,8.581 16.151,9 15.5,9 C14.849,9 14.299,8.581 14.092,8 Z M17.949,7 C17.717,5.86 16.707,5 15.5,5 C14.293,5 13.283,5.86 13.051,7 L3,7 L3,8 L13.051,8 C13.283,9.14 14.293,10 15.5,10 C16.707,10 17.717,9.14 17.949,8 L21,8 L21,7 L17.949,7 Z M15.092,18.0009 C15.036,17.8439 15,17.6769 15,17.5009 C15,17.3249 15.036,17.1579 15.092,17.0009 C15.299,16.4199 15.849,16.0009 16.5,16.0009 C17.151,16.0009 17.701,16.4199 17.908,17.0009 C17.964,17.1579 18,17.3249 18,17.5009 C18,17.6769 17.964,17.8439 17.908,18.0009 C17.701,18.5819 17.151,19.0009 16.5,19.0009 C15.849,19.0009 15.299,18.5819 15.092,18.0009 Z M18.949,17.0009 C18.717,15.8609 17.707,15.0009 16.5,15.0009 C15.293,15.0009 14.283,15.8609 14.051,17.0009 L3,17.0009 L3,18.0009 L14.051,18.0009 C14.283,19.1409 15.293,20.0009 16.5,20.0009 C17.707,20.0009 18.717,19.1409 18.949,18.0009 L21,18.0009 L21,17.0009 L18.949,17.0009 Z M6.092,13 C6.036,12.843 6,12.676 6,12.5 C6,12.324 6.036,12.157 6.092,12 C6.299,11.419 6.849,11 7.5,11 C8.151,11 8.701,11.419 8.908,12 C8.964,12.157 9,12.324 9,12.5 C9,12.676 8.964,12.843 8.908,13 C8.701,13.581 8.151,14 7.5,14 C6.849,14 6.299,13.581 6.092,13 Z M9.949,12 C9.717,10.86 8.707,10 7.5,10 C6.293,10 5.283,10.86 5.051,12 L3,12 L3,13 L5.051,13 C5.283,14.14 6.293,15 7.5,15 C8.707,15 9.717,14.14 9.949,13 L21,13 L21,12 L9.949,12 Z"}))},IMAGE_TYPE="wix-draft-plugin-image",IMAGE_TYPE_LEGACY="IMAGE",createInlineButtons=function(_ref){var t=_ref.t,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,uiSettings=_ref.uiSettings,isMobile=_ref.isMobile,_ref$settings=_ref.settings,settings=void 0===_ref$settings?{}:_ref$settings,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,icons=get(settings,"toolbar.icons",{}),modalStyles=getModalStyles({isMobile:isMobile}),imageEditorStyles=getModalStyles({customStyles:{content:{maxWidth:"100%",background:"transparent"}}}),imageEditorWixSettings=settings.imageEditorWixSettings,onImageEditorOpen=settings.onImageEditorOpen,imageEditorButton={keyName:"imageEditor",type:BUTTONS.EXTERNAL_MODAL,icon:icons.imageEditor||ImageEditorIcon,modalName:Modals.IMAGE_EDITOR,modalStyles:imageEditorStyles,t:t,imageEditorWixSettings:imageEditorWixSettings,onImageEditorOpen:onImageEditorOpen,mobile:!1,tooltipTextKey:"ImageEditorButton_Tooltip",mapComponentDataToButtonProps:function(componentData){return{disabled:isEmpty(componentData.src)||!!componentData.error}}},spoilerInInlineToolbar=experiments.spoilerInInlineToolbar,spoilerButton=settings.spoiler&&null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[{keyName:"spoiler",type:BUTTONS.SPOILER,mobile:!0}]:[];return[{keyName:"sizeOriginal",type:BUTTONS.SIZE_ORIGINAL,mobile:!1},{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:"alignLeft",type:BUTTONS.SIZE_SMALL_LEFT,mobile:!1},{keyName:"alignCenter",type:BUTTONS.SIZE_CONTENT_CENTER,mobile:!1},{keyName:"alignRight",type:BUTTONS.SIZE_SMALL_RIGHT,mobile:!1},{keyName:"separator2",type:BUTTONS.SEPARATOR,mobile:!1}].concat(spoilerButton,imageEditorWixSettings?[imageEditorButton]:[],[{keyName:"settings",type:BUTTONS.EXTERNAL_MODAL,fullHeight:!0,icon:icons.settings||PluginSettingsIcon,modalName:Modals.IMAGE_SETTINGS,modalStyles:modalStyles,anchorTarget:anchorTarget,relValue:relValue,t:t,mobile:!0,tooltipTextKey:"SettingsButton_Tooltip",uiSettings:uiSettings,triggerSettingsBi:!0,pluginId:IMAGE_TYPE,shouldShowSpoiler:settings.spoiler},{keyName:"link",type:BUTTONS.LINK,mobile:!0},{keyName:"replace",type:BUTTONS.FILES,onFilesSelected:function(pubsub,files){files.length>0&&pubsub.getBlockHandler("handleFilesSelected")(files)},icon:icons.replace||MediaReplaceIcon,mobile:!0,tooltipTextKey:"ReplaceImageButton_Tooltip",t:t},{keyName:"delete",type:BUTTONS.DELETE,mobile:!0}])},createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,disableDownload=_ref.disableDownload,disableExpand=_ref.disableExpand,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,PluginData=void 0!==disableDownload?_extends({},DEFAULTS,{disableDownload:disableDownload}):DEFAULTS,componentData=void 0!==disableExpand?_extends({},DEFAULTS,{disableExpand:disableExpand}):PluginData;return[{type:BUTTON_TYPES.FILE,multi:!0,name:INSERT_PLUGIN_BUTTONS.IMAGE,tooltip:t("ImagePlugin_InsertButton_Tooltip"),toolbars:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],getIcon:function(){return icon},componentData:componentData}]},createToolbar=function(_ref){var t=_ref.t,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,uiSettings=_ref.uiSettings,isMobile=_ref.isMobile,settings=_ref.settings,experiments=_ref.experiments,disableDownload=null==uiSettings?void 0:uiSettings.disableDownload,disableExpand=null==settings?void 0:settings.disableExpand;return{InlineButtons:createInlineButtons({t:t,anchorTarget:anchorTarget,relValue:relValue,uiSettings:uiSettings,isMobile:isMobile,settings:settings,experiments:experiments}),InsertButtons:createInsertButtons({t:t,settings:settings,disableDownload:disableDownload,disableExpand:disableExpand}),name:"image"}},styles$1={fontElementMap:"_1hNZF",imageContainer:"_2kEVY",expandContainer:"-D6i8",expandIcon:"_2Lky3",pointer:"_2Ybje",imageWrapper:"_3WJnn",image:"OzAYt",imageOverlay:"_1b5Ar",imageCaption:"EilAw",imagePreload:"_3ii3f",imageHighres:"_3xs9_",onlyHighRes:"_1I_dK",image_loading:"_3aC9X"},expand=function(props){return React.createElement("svg",Object.assign({viewBox:"0 0 19 19",xmlns:"http://www.w3.org/2000/svg"},props),React.createElement("path",{d:"M15.071 8.371V4.585l-4.355 4.356a.2.2 0 0 1-.283 0l-.374-.374a.2.2 0 0 1 0-.283l4.356-4.355h-3.786a.2.2 0 0 1-.2-.2V3.2c0-.11.09-.2.2-.2H16v5.371a.2.2 0 0 1-.2.2h-.529a.2.2 0 0 1-.2-.2zm-6.5 6.9v.529a.2.2 0 0 1-.2.2H3v-5.371c0-.11.09-.2.2-.2h.529c.11 0 .2.09.2.2v3.786l4.355-4.356a.2.2 0 0 1 .283 0l.374.374a.2.2 0 0 1 0 .283L4.585 15.07h3.786c.11 0 .2.09.2.2z",fill:"#000",fillRule:"nonzero"}))},styles_inPluginInput="_1k3YS",InPluginInput=function(_Component){function InPluginInput(){var _this;return(_this=_Component.apply(this,arguments)||this).handleFocus=function(e){e.stopPropagation(),_this.props.setFocusToBlock(),_this.props.setInPluginEditingMode(!0)},_this.handleBlur=function(){return _this.props.setInPluginEditingMode(!1)},_this.handleKeyPress=function(e){var _this$props=_this.props,setFocusToBlock=_this$props.setFocusToBlock,value=_this$props.value;"Enter"===e.key&&setFocusToBlock&&""!==value&&(_this.handleBlur(),setFocusToBlock())},_this.onChange=function(e){var _this$props$onChange,_this$props2;return null===(_this$props$onChange=(_this$props2=_this.props).onChange)||void 0===_this$props$onChange?void 0:_this$props$onChange.call(_this$props2,e.target.value)},_this}return _inheritsLoose(InPluginInput,_Component),InPluginInput.prototype.render=function(){var className=classNames(styles_inPluginInput,this.props.className);return React.createElement("textarea",{className:className,value:this.props.value,onChange:this.onChange,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyPress:this.handleKeyPress,dir:"auto",rows:1})},InPluginInput}(Component);InPluginInput.defaultProps={setInPluginEditingMode:function(){return!1},setFocusToBlock:function(){return!1}};var ImageViewer=function(_React$Component){function ImageViewer(props){var _this;return(_this=_React$Component.call(this,props)||this).forceOnImageLoad=function(){var executionTimes=0,interval=setInterval((function(){var _this$imageRef,_this$imageRef$curren;null!==(_this$imageRef=_this.imageRef)&&void 0!==_this$imageRef&&null!==(_this$imageRef$curren=_this$imageRef.current)&&void 0!==_this$imageRef$curren&&_this$imageRef$curren.complete&&(_this.onImageLoad(_this.imageRef.current),clearInterval(interval)),10==++executionTimes&&clearInterval(interval)}),200)},_this.onImageLoadError=function(){var src=_this.props.componentData.src;src&&src.fallback&&_this.setState({fallbackImageSrc:{preload:src.fallback,highres:src.fallback}})},_this.renderImage=function(imageClassName,imageSrc,alt,props,isGif,onlyHighRes){var _classNames;return _this.getImage(classNames(imageClassName,_this.styles.imageHighres,((_classNames={})[_this.styles.onlyHighRes]=onlyHighRes,_classNames)),imageSrc.highres,alt,props,{fadeIn:!isGif,width:imageSrc.highresWidth,height:imageSrc.highresHeight})},_this.renderPreloadImage=function(imageClassName,imageSrc,alt,props){return _this.getImage(classNames(imageClassName,_this.styles.imagePreload),imageSrc.preload,alt,_extends({"aria-hidden":!0},props))},_this.onImageLoad=function(element){element.style.opacity=1,_this.preloadRef.current&&(_this.preloadRef.current.style.opacity="0")},_this.handleExpand=function(e){var _helpers$onViewerActi;e.preventDefault();var _this$props=_this.props,onExpand=_this$props.settings.onExpand,_this$props$helpers=_this$props.helpers,helpers=void 0===_this$props$helpers?{}:_this$props$helpers;null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,IMAGE_TYPE,"Click","expand_image"),_this.hasExpand()&&(null==onExpand||onExpand(_this.props.blockKey))},_this.scrollToAnchor=function(e){var _this$props2=_this.props,_this$props2$componen=_this$props2.componentData.config.link,anchor=(_this$props2$componen=void 0===_this$props2$componen?{}:_this$props2$componen).anchor,customAnchorScroll=_this$props2.customAnchorScroll;if(customAnchorScroll)customAnchorScroll(e,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);addAnchorTagToUrl(anchorString),anchorScroll(element,_this.context.experiments)}},_this.hasLink=function(){var _this$props$component,_this$props$component2,_this$props$component3;return null===(_this$props$component=_this.props.componentData)||void 0===_this$props$component||null===(_this$props$component2=_this$props$component.config)||void 0===_this$props$component2||null===(_this$props$component3=_this$props$component2.link)||void 0===_this$props$component3?void 0:_this$props$component3.url},_this.hasAnchor=function(){var _this$props$component4,_this$props$component5,_this$props$component6;return null===(_this$props$component4=_this.props.componentData)||void 0===_this$props$component4||null===(_this$props$component5=_this$props$component4.config)||void 0===_this$props$component5||null===(_this$props$component6=_this$props$component5.link)||void 0===_this$props$component6?void 0:_this$props$component6.anchor},_this.onKeyDown=function(e){"Enter"!==e.key&&" "!==e.key||_this.props.getInPluginEditingMode||_this.handleClick(e)},_this.handleClick=function(e){if(_this.hasLink())return null;_this.hasAnchor()?(e.preventDefault(),e.stopPropagation(),_this.scrollToAnchor(e)):_this.handleExpand(e)},_this.handleRef=function(e){_this.state.container||_this.setState({container:e})},_this.handleContextMenu=function(e){var _this$props$component7=_this.props.componentData.disableDownload;return void 0!==_this$props$component7&&_this$props$component7&&e.preventDefault()},_this.hasExpand=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableExpand=!1;return void 0!==componentData.disableExpand?disableExpand=componentData.disableExpand:void 0!==settings.disableExpand&&(disableExpand=settings.disableExpand),!disableExpand&&settings.onExpand},_this.renderExpandIcon=function(){return React.createElement("div",{className:_this.styles.expandContainer},React.createElement(expand,{className:_this.styles.expandIcon,onClick:_this.handleExpand}))},validate(props.componentData,pluginImageSchema),_this.state={},_this.preloadRef=React.createRef(),_this.imageRef=React.createRef(),_this}_inheritsLoose(ImageViewer,_React$Component);var _proto=ImageViewer.prototype;return _proto.componentDidMount=function(){this.setState({ssrDone:!0}),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&this.forceOnImageLoad()},_proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginImageSchema)},_proto.calculateHeight=function(width,src){return void 0===width&&(width=1),src&&src.height&&src.width?Math.ceil(src.height/src.width*width):WIX_MEDIA_DEFAULT.SIZE},_proto.getImageDataUrl=function(){return this.props.dataUrl?{preload:this.props.dataUrl,highres:this.props.dataUrl}:null},_proto.getImageUrl=function(src){var _this$context$experim,_this$context$experim2,_this2=this,_ref=this.props||{},helpers=_ref.helpers,seoMode=_ref.seoMode;if(!src&&null!=helpers&&helpers.handleFileSelection)return null;var requiredWidth,requiredHeight,removeUsm=null===(_this$context$experim=this.context.experiments)||void 0===_this$context$experim||null===(_this$context$experim2=_this$context$experim.removeUsmFromImageUrls)||void 0===_this$context$experim2?void 0:_this$context$experim2.enabled,imageUrl={preload:"",highres:""},imageSrcOpts={};if(!this.props.isMobile&&!isPNG(src)){var _this$props$component8=this.props.componentData.config,alignment=(_this$props$component8=void 0===_this$props$component8?{}:_this$props$component8).alignment,width=_this$props$component8.width;imageSrcOpts=_extends({removeUsm:removeUsm,imageType:"quailtyPreload"},("left"===alignment||"right"===alignment)&&!width&&{requiredWidth:300})}if(imageUrl.preload=getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,imageSrcOpts),seoMode)requiredWidth=(null==src?void 0:src.width)&&Math.min(src.width,1e3),requiredHeight=this.calculateHeight(1e3,src);else if(this.state.container){var _getImageDimensions=function(width,isMobile){var requiredHeight,requiredWidth=width||1;return isMobile&&!isSSR()&&(requiredWidth*=window.devicePixelRatio,requiredWidth*=window.screen.width/document.body.clientWidth),requiredHeight=_this2.calculateHeight(requiredWidth,src),[requiredWidth=Math.ceil(requiredWidth),requiredHeight=Math.ceil(requiredHeight)]}(this.state.container.getBoundingClientRect().width||(null==src?void 0:src.width),this.props.isMobile);requiredWidth=_getImageDimensions[0],requiredHeight=_getImageDimensions[1]}return imageUrl.highres=getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,{removeUsm:removeUsm,requiredWidth:requiredWidth,requiredHeight:requiredHeight,requiredQuality:90,imageType:"highRes"}),!this.state.ssrDone||imageUrl.preload||this.props.isLoading||console.error("image plugin mounted with invalid image source!",src),imageUrl},_proto.getImage=function(imageClassNames,src,alt,props,opts){var _this$context$experim3,_this3=this;void 0===opts&&(opts={});var _opts=opts,_opts$fadeIn=_opts.fadeIn,fadeIn=void 0!==_opts$fadeIn&&_opts$fadeIn,width=_opts.width,height=_opts.height,loading=null!==(_this$context$experim3=this.context.experiments.lazyImagesAndIframes)&&void 0!==_this$context$experim3&&_this$context$experim3.enabled?"lazy":void 0;return React.createElement("img",Object.assign({},props,{className:imageClassNames,src:src,alt:alt,onError:this.onImageLoadError,onLoad:fadeIn?function(e){return _this3.onImageLoad(e.target)}:void 0,ref:fadeIn?this.imageRef:this.preloadRef,width:width,height:height,loading:loading}))},_proto.renderTitle=function(data,styles){return!!(data.config||{}).showTitle&&React.createElement("div",{className:classNames(styles.imageTitle)},data&&data.title||"")},_proto.renderDescription=function(data,styles){return!!(data.config||{}).showDescription&&React.createElement("div",{className:classNames(styles.imageDescription)},data&&data.description||"")},_proto.renderCaption=function(caption){var _this$props4=this.props,onCaptionChange=_this$props4.onCaptionChange,setFocusToBlock=_this$props4.setFocusToBlock,setInPluginEditingMode=_this$props4.setInPluginEditingMode,_this$styles=this.styles,imageCaption=_this$styles.imageCaption,link=_this$styles.link,classes=classNames(imageCaption,this.hasLink()&&link);return onCaptionChange?React.createElement(InPluginInput,{setInPluginEditingMode:setInPluginEditingMode,className:classes,value:caption,onChange:onCaptionChange,setFocusToBlock:setFocusToBlock}):React.createElement("span",{dir:"auto",className:classes},caption)},_proto.shouldRenderCaption=function(){var _componentData$metada,_this$props5=this.props,getInPluginEditingMode=_this$props5.getInPluginEditingMode,settings=_this$props5.settings,componentData=_this$props5.componentData,defaultCaption=_this$props5.defaultCaption,caption=null===(_componentData$metada=componentData.metadata)||void 0===_componentData$metada?void 0:_componentData$metada.caption;if(includes(get(settings,"toolbar.hidden"),"settings"))return!1;if(void 0===caption||""===caption&&(null==getInPluginEditingMode||!getInPluginEditingMode())||caption===defaultCaption)return!1;var data=componentData||DEFAULTS;return"original"!==data.config.size||!data.src||!data.src.width||data.src.width>=350},_proto.render=function(){var _classNames2,_imageSrc$highres,_imageSrc$highres$end;this.styles=this.styles||mergeStyles({styles:styles$1,theme:this.props.theme});var _this$props6=this.props,componentData=_this$props6.componentData,className=_this$props6.className,settings=_this$props6.settings,setComponentUrl=_this$props6.setComponentUrl,seoMode=_this$props6.seoMode,_this$state=this.state,fallbackImageSrc=_this$state.fallbackImageSrc,ssrDone=_this$state.ssrDone,data=componentData||DEFAULTS,metadata=componentData.metadata;metadata||(metadata={});var itemClassName=classNames(this.styles.imageWrapper,className,((_classNames2={})[this.styles.pointer]=this.hasExpand(),_classNames2)),imageClassName=this.styles.image,imageSrc=fallbackImageSrc||this.getImageDataUrl()||this.getImageUrl(data.src),imageProps={};data.src&&settings&&settings.imageProps&&(imageProps=isFunction(settings.imageProps)?settings.imageProps(data.src):settings.imageProps);var isGif=null==imageSrc||null===(_imageSrc$highres=imageSrc.highres)||void 0===_imageSrc$highres||null===(_imageSrc$highres$end=_imageSrc$highres.endsWith)||void 0===_imageSrc$highres$end?void 0:_imageSrc$highres$end.call(_imageSrc$highres,".gif");null==setComponentUrl||setComponentUrl(null==imageSrc?void 0:imageSrc.highres);var shouldRenderPreloadImage=!seoMode&&imageSrc&&!isGif,shouldRenderImage=imageSrc&&(seoMode||ssrDone)||isGif,accesibilityProps=!this.hasLink()&&{role:"button",tabIndex:0},onlyHiRes=seoMode||isGif;return React.createElement("div",Object.assign({"data-hook":"imageViewer",className:this.styles.imageContainer,ref:this.handleRef,onContextMenu:this.handleContextMenu,onKeyDown:this.onKeyDown},accesibilityProps),React.createElement("div",{className:itemClassName,"aria-label":metadata.alt,onClick:this.handleClick,onKeyDown:this.onKeyDown},shouldRenderPreloadImage&&this.renderPreloadImage(imageClassName,imageSrc,metadata.alt,imageProps),shouldRenderImage&&this.renderImage(imageClassName,imageSrc,metadata.alt,imageProps,isGif,onlyHiRes),this.hasExpand()&&this.renderExpandIcon()),this.renderTitle(data,this.styles),this.renderDescription(data,this.styles),this.shouldRenderCaption()&&this.renderCaption(metadata.caption))},ImageViewer}(React.Component);ImageViewer.contextType=GlobalContext;var shouldDisableStyles=function(componentData,isMobile){var _ref=componentData.config||{},size=_ref.size,width=_ref.width;return!("inline"===size&&isNumber(width)&&width<=150)&&isMobile},ImageComponent=function(_React$Component){function ImageComponent(props){var _this;(_this=_React$Component.call(this,props)||this).handleMetadataChange=function(newMetadata){var componentData=_this.props.componentData,metadata=_extends({},componentData.metadata,newMetadata);_this.props.store.update("componentData",_extends({},componentData,{metadata:metadata}),_this.props.block.getKey())},_this.handleCaptionChange=function(caption){return _this.handleMetadataChange({caption:caption})};var _this$props=_this.props,block=_this$props.block,store=_this$props.store;if(store){var blockKey=block.getKey();store.setBlockHandler("handleMetadataChange",blockKey,_this.handleMetadataChange.bind(_assertThisInitialized(_this)))}return _this}return _inheritsLoose(ImageComponent,_React$Component),ImageComponent.prototype.render=function(){var _this$props$tempData,_this$props2=this.props,settings=_this$props2.settings,componentData=_this$props2.componentData,className=_this$props2.className,blockProps=_this$props2.blockProps,theme=_this$props2.theme,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,getInPluginEditingMode=_this$props2.getInPluginEditingMode,setInPluginEditingMode=_this$props2.setInPluginEditingMode,setComponentUrl=_this$props2.setComponentUrl,t=_this$props2.t,error=_this$props2.error,isLoading=_this$props2.isLoading;return React.createElement(React.Fragment,null,React.createElement(ImageViewer,{theme:theme,isMobile:isMobile,helpers:helpers,getInPluginEditingMode:getInPluginEditingMode,setInPluginEditingMode:setInPluginEditingMode,componentData:componentData,className:className,isLoading:this.props.isLoading,dataUrl:null===(_this$props$tempData=this.props.tempData)||void 0===_this$props$tempData?void 0:_this$props$tempData.dataUrl,settings:settings,defaultCaption:this.props.t("ImageViewer_Caption"),onCaptionChange:this.handleCaptionChange,setFocusToBlock:blockProps.setFocusToBlock,setComponentUrl:setComponentUrl}),(isLoading||componentData.loading)&&React.createElement(Loader,{type:"medium"}),error&&React.createElement(MediaItemErrorMsg,{error:error,t:t}))},ImageComponent}(React.Component);ImageComponent.alignmentClassName=function(componentData,theme,styles,isMobile){return function(componentData,theme,styles,isMobile){var _ref2=componentData.config||{},alignment=_ref2.alignment,size=_ref2.size;if(!alignment||shouldDisableStyles(componentData,isMobile)&&"original"!==size)return"";var align=alignment;if("original"===size&&"center"!==alignment){var width=(componentData.src||{}).width;isNumber(width)&&width>350&&(align="center")}return classNames(styles["align"+upperFirst(align)],theme["align"+upperFirst(align)])}(componentData,theme,styles,isMobile)},ImageComponent.sizeClassName=function(componentData,theme,styles,isMobile){return function(componentData,theme,styles,isMobile){var size=(componentData.config||{}).size;return!size||isMobile&&"original"===size?"":shouldDisableStyles(componentData,isMobile)?classNames(styles.sizeFullWidth,theme.sizeFullWidth):classNames(styles["size"+upperFirst(camelCase(size))],theme["size"+upperFirst(camelCase(size))])}(componentData,theme,styles,isMobile)};var _excluded=["width"];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 createImagePlugin=function(config){var _config$uiSettings,_config$settings,_config$uiSettings2,type=IMAGE_TYPE,defaultPluginData=void 0!==(null==config||null===(_config$uiSettings=config.uiSettings)||void 0===_config$uiSettings?void 0:_config$uiSettings.disableDownload)?_extends({},DEFAULTS,{disableDownload:config.uiSettings.disableDownload}):DEFAULTS,PluginData=void 0!==(null==config||null===(_config$settings=config.settings)||void 0===_config$settings?void 0:_config$settings.disableExpand)?_extends({},defaultPluginData,{disableExpand:config.settings.disableExpand}):defaultPluginData,helpers=config.helpers,t=config.t,anchorTarget=config.anchorTarget,relValue=config.relValue,settings=config[type],uiSettings=config.uiSettings,isMobile=config.isMobile,innerModal=config.innerModal,spoilerWrapper=config.spoilerWrapper,experiments=config.experiments,rest=_objectWithoutPropertiesLoose(config,["helpers","t","anchorTarget","relValue",type,"uiSettings","isMobile","innerModal","spoilerWrapper","experiments"].map(_toPropertyKey));return createBasePlugin(_extends({component:createBaseMediaPlugin(ImageComponent),type:IMAGE_TYPE,legacyType:"IMAGE",pluginDecorationProps:function(props,componentData){var _componentData$config,_componentData$config2,_componentData$src,size=null===(_componentData$config=componentData.config)||void 0===_componentData$config?void 0:_componentData$config.size,width=null===(_componentData$config2=componentData.config)||void 0===_componentData$config2?void 0:_componentData$config2.width,calulatedProps=props;null!==(_componentData$src=componentData.src)&&void 0!==_componentData$src&&_componentData$src.width&&("original"===size||isMobile&&"inline"===size&&isNumber(width)&&width>150)&&(calulatedProps=_extends({},props,{width:componentData.src.width,style:_extends({},componentData.src.style||{},{width:componentData.src.width})}));var resizeableProps=PLUGIN_DECORATION_PROPS[PLUGIN_DECORATIONS.RESIZEABLE](calulatedProps);if("inline"===size)return resizeableProps;if("original"===size)return _extends({},resizeableProps,{style:_extends({},resizeableProps.style,{maxWidth:"100%"})});var _resizeableProps$styl=resizeableProps.style;_resizeableProps$styl.width;var allButWidth=_objectWithoutPropertiesLoose(_resizeableProps$styl,_excluded);return _extends({},resizeableProps,{style:_extends({},allButWidth)})},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({size:"inline",width:nextWidth})},toolbar:createToolbar({helpers:helpers,anchorTarget:anchorTarget,relValue:relValue,t:t,uiSettings:uiSettings,isMobile:isMobile,settings:settings,experiments:experiments}),helpers:helpers,innerModal:innerModal,anchorTarget:anchorTarget,relValue:relValue,settings:settings||{},uiSettings:uiSettings,t:t,isMobile:isMobile,disableRightClick:null==config||null===(_config$uiSettings2=config.uiSettings)||void 0===_config$uiSettings2?void 0:_config$uiSettings2.disableRightClick,defaultPluginData:PluginData,spoilerWrapper:(null==settings?void 0:settings.spoiler)&&spoilerWrapper},rest))};createImagePlugin.functionName=IMAGE_TYPE;var createImageData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var imageData=isRicosSchema?convertNodeDataToDraft("IMAGE",pluginData):pluginData;return merge({},DEFAULTS,imageData)},imageDataDefaults={containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null},image:{src:null,width:null,height:null},link:{target:"SELF",url:null,anchor:null,rel:null,customData:null},disableExpand:null,altText:null,caption:null,disableDownload:null},Image=function(_ref){var _node$attrs$image,_node$attrs$image$src,context=_ref.context,componentData=_ref.componentData,updateAttributes=_ref.updateAttributes,node=_ref.node,isMobile=context.isMobile,theme=context.theme,t=context.t,_context$config=context.config,settings=(void 0===_context$config?{}:_context$config)[IMAGE_TYPE]||{},isLoading=node.attrs.loading,error=node.attrs.error,blockKey=node.attrs.id;return React.createElement(React.Fragment,null,React.createElement(ImageViewer,{theme:theme,isMobile:isMobile,helpers:{},componentData:componentData,isLoading:isLoading,dataUrl:isLoading&&(null===(_node$attrs$image=node.attrs.image)||void 0===_node$attrs$image||null===(_node$attrs$image$src=_node$attrs$image.src)||void 0===_node$attrs$image$src?void 0:_node$attrs$image$src.url),settings:settings,defaultCaption:t("ImageViewer_Caption"),onCaptionChange:function(caption){updateAttributes({caption:caption})},setFocusToBlock:function(){return null},setComponentUrl:function(){return null},blockKey:blockKey}),(isLoading||componentData.loading)&&React.createElement(Loader,{theme:theme,type:"medium"}),error&&React.createElement(MediaItemErrorMsg,{error:error,t:t}))},name=TIPTAP_IMAGE_TYPE,pluginImage=function(config){var defaultOptions,pluginConfig=_extends({},DEFAULTS.config,config);return{config:pluginConfig,type:IMAGE_TYPE,createPlugin:createImagePlugin,ModalsMap:ModalsMap,createPluginData:createImageData,tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Image,componentDataDefaults:_extends({},imageDataDefaults,{id:"",loading:{default:!1}}),createExtensionConfig:function(){return{name:name,atom:!1,defaultOptions:defaultOptions,addCommands:function(){return{setImageUrl:function(url){return function(_ref){return _ref.commands.updateAttributes(name,{image:{src:{custom:url}}})}},setImageLoading:function(loading){return function(_ref2){return _ref2.commands.updateAttributes(name,{loading:loading})}}}}}}}])}};export{IMAGE_TYPE,IMAGE_TYPE_LEGACY,ImageComponent,ImageViewer,Modals,ModalsMap,createImagePlugin,pluginImage};
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{LTRIcon,RTLIcon,BUTTONS,createBasePlugin}from"wix-rich-content-plugin-commons";import{EditorState,getModalStyles,BUTTON_TYPES,INSERT_PLUGIN_BUTTONS,TOOLBARS}from"wix-rich-content-editor-common";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import classNames from"classnames";import{generateKey,mergeStyles,anchorScroll,GlobalContext,isRtl}from"wix-rich-content-common";import{RadioGroupVertical,LabeledToggle,Separator,InfoIcon,SelectionList,SettingsMobileHeader,SettingsPanelFooter}from"wix-rich-content-ui-components";import{Draggable,DragDropContext,Droppable}from"react-beautiful-dnd";var _ModalsMap,COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",directions_LTR="ltr",directions_RTL="rtl",DEFAULTS=Object.freeze({config:{expandState:"first_expanded",expandOnlyOne:!1},pairs:[{key:generateKey()}]}),EMPTY_PAIR_VALUE={title:EditorState.createEmpty(),content:EditorState.createEmpty()},CollapsibleList=function(store,componentData){var _this=this;this.getData=function(){return _this.componentData},this.getConfig=function(){return _this.getData().config},this.getPairs=function(){return _this.getData().pairs},this.getPair=function(idx){return _this.getPairs()[idx]},this.getTitle=function(idx){return _this.getPair(idx).title||EditorState.createEmpty()},this.getContent=function(idx){return _this.getPair(idx).content||EditorState.createEmpty()},this.getDirection=function(){return _this.getConfig().direction},this.changeDirection=function(){var direction=_this.getDirection()===directions_LTR?directions_RTL:directions_LTR,updatedData={config:_extends({},_this.getConfig(),{direction:direction})};_this.updateData(updatedData)},this.getExpandState=function(){return _this.getConfig().expandState},this.setExpandState=function(expandState){var updatedData={config:_extends({},_this.getConfig(),{expandState:expandState})};"expanded"===expandState&&(updatedData.config.expandOnlyOne=void 0),_this.updateData(updatedData)},this.getExpandOnlyOne=function(){return _this.getConfig().expandOnlyOne},this.toggleExpandOnlyOne=function(){var updatedData={config:_extends({},_this.getConfig(),{expandOnlyOne:!_this.getExpandOnlyOne()})};_this.updateData(updatedData)},this.setData=function(data){_this.store.set("componentData",data)},this.updateData=function(data){var componentData=_this.getData();_this.setData(_extends({},componentData,data))},this.setTitle=function(idx,editorState){var pair={title:editorState};_this.setPair(idx,pair)},this.setContent=function(idx,editorState){var pair={content:editorState};_this.setPair(idx,pair)},this.setPair=function(idx,updatedPair){var pairs=[].concat(_this.getPairs()),currentPair=_this.getPair(idx),newPair=_extends({},currentPair.title&&currentPair.content?{}:EMPTY_PAIR_VALUE,currentPair,updatedPair);pairs.splice(idx,1,newPair),_this.updateData({pairs:pairs})},this.createNewPair=function(){return{key:generateKey(),title:EditorState.createEmpty(),content:EditorState.createEmpty()}},this.insertNewPair=function(){var pairs=_this.getPairs();_this.updateData({pairs:[].concat(pairs,[_this.createNewPair()])})},this.reorderPairs=function(startIdx,endIdx){var pairs=_this.getPairs(),pairToMove=pairs.splice(startIdx,1)[0];pairs.splice(endIdx,0,pairToMove),_this.updateData({pairs:pairs})},this.deletePair=function(pairIndex){var pairs=_this.getPairs();pairs.splice(pairIndex,1),_this.updateData({pairs:pairs})},this.store=store,this.componentData=componentData},styles$5={title:"_3hUj0",settingsContainer:"_62k0D",separator:"_20bm0",direction_selector:"_1jUkB",direction_selector_option:"_1w4ED"},CollapsibleListSettings=function(_Component){function CollapsibleListSettings(props){var _this;(_this=_Component.call(this,props)||this).renderOption=function(_ref){var item=_ref.item;return React.createElement(React.Fragment,null,React.createElement(item.icon,null),React.createElement("p",null,item.label))},_this.renderExpandOptions=function(){var _this$props=_this.props,getDataManager=_this$props.getDataManager,t=_this$props.t,theme=_this$props.theme,isMobile=_this$props.isMobile;return React.createElement(React.Fragment,null,React.createElement(RadioGroupVertical,{label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Title"),value:getDataManager().getExpandState(),dataSource:[{value:"expanded",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Expanded"),dataHook:"Expanded"},{value:"first_expanded",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_FirstExpanded"),dataHook:"FirstExpanded"},{value:"collapsed",labelText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_Collapsed"),dataHook:"Collapsed"}],t:t,theme:theme,onChange:function(value){return getDataManager().setExpandState(value)}}),"expanded"!==getDataManager().getExpandState()&&React.createElement(LabeledToggle,{label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_CollapseView_InSections"),checked:getDataManager().getExpandOnlyOne(),onChange:getDataManager().toggleExpandOnlyOne,theme:theme,style:isMobile?{paddingTop:"28px"}:{},dataHook:"onePairExpanded"}))},_this.renderSeparator=function(){return React.createElement(Separator,{horizontal:!0,className:_this.styles.separator})},_this.renderDirectionOptions=function(){var _this$props2=_this.props,getDataManager=_this$props2.getDataManager,t=_this$props2.t;return React.createElement(React.Fragment,null,React.createElement("p",{className:_this.styles.title},t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_Title")," ",React.createElement(InfoIcon,{tooltipText:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_Title_Tooltip")})),React.createElement(SelectionList,{theme:_this.styles,dataSource:[{value:directions_LTR,label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_LTR"),icon:LTRIcon,dataHook:"ltrDirection"},{value:directions_RTL,label:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_Direction_RTL"),icon:RTLIcon,dataHook:"rtlDirection"}],renderItem:_this.renderOption,value:getDataManager().getDirection(),onChange:getDataManager().changeDirection,className:_this.styles.direction_selector,optionClassName:_this.styles.direction_selector_option}))};var _theme=props.theme;return _this.styles=mergeStyles({styles:styles$5,theme:_theme}),_this}return _inheritsLoose(CollapsibleListSettings,_Component),CollapsibleListSettings.prototype.render=function(){return React.createElement("div",{className:this.styles.settingsContainer},this.renderExpandOptions(),this.renderSeparator(),this.renderDirectionOptions())},CollapsibleListSettings}(Component),styles$4={collapsibleListModal:"_2gcEm",collapsibleListModalTitle:"_22bSm",collapsibleListModal_scrollContainer:"bpnq3",collapsibleListModal_mobile:"_1QgQS"},Modals={COLLAPSIBLE_LIST_MODAL:"collapsible-list-modal"},ModalsMap=((_ModalsMap={})[Modals.COLLAPSIBLE_LIST_MODAL]=function(_Component){function CollapsibleListModal(props){var _this;(_this=_Component.call(this,props)||this).onComponentUpdate=function(){return _this.forceUpdate()},_this.revertComponentData=function(){var helpers=_this.props.helpers,initialComponentData=_this.state.initialComponentData;initialComponentData&&_this.getDataManager().updateData(initialComponentData),helpers.closeModal()},_this.onDoneClick=function(){_this.props.helpers.closeModal()},_this.getDataManager=function(){var pubsub=_this.props.pubsub;return new CollapsibleList(pubsub.store,pubsub.get("componentData"))},_this.renderDesktopHeader=function(){var t=_this.props.t;return React.createElement("h3",{className:_this.styles.collapsibleListModalTitle},t("CollapsibleList_CollapsibleListSettings_Common_Header"))},_this.renderMobileHeader=function(){var _this$props=_this.props,t=_this$props.t,theme=_this$props.theme;return React.createElement(SettingsMobileHeader,{t:t,theme:theme,onCancel:_this.revertComponentData,onSave:_this.onDoneClick})},_this.renderSettings=function(){var _classNames,_this$props2=_this.props,isMobile=_this$props2.isMobile,theme=_this$props2.theme,t=_this$props2.t;return React.createElement("div",{className:classNames(styles$4.collapsibleListModal_scrollContainer,(_classNames={},_classNames[styles$4.collapsibleListModal_mobile]=isMobile,_classNames))},React.createElement(CollapsibleListSettings,{getDataManager:_this.getDataManager,theme:theme,isMobile:isMobile,t:t}))},_this.renderDesktopFooterPanel=function(){var _this$props3=_this.props,theme=_this$props3.theme,t=_this$props3.t;return React.createElement(SettingsPanelFooter,{fixed:!0,theme:theme,cancel:_this.revertComponentData,save:_this.onDoneClick,t:t})},_this.state=_this.initState(props);var _theme=props.theme;return _this.styles=mergeStyles({styles:styles$4,theme:_theme}),_this}_inheritsLoose(CollapsibleListModal,_Component);var _proto=CollapsibleListModal.prototype;return _proto.initState=function(props){return{initialComponentData:props.pubsub.get("componentData")}},_proto.componentDidMount=function(){var pubsub=this.props.pubsub;pubsub.subscribe("componentData",this.onComponentUpdate),this.setState({initialComponentData:pubsub.get("componentData")})},_proto.componentWillUnmount=function(){this.props.pubsub.unsubscribe("componentData",this.onComponentUpdate)},_proto.render=function(){var _this$props4=this.props,isMobile=_this$props4.isMobile,languageDir=_this$props4.languageDir;return React.createElement("div",{className:this.styles.collapsibleListModal,"data-hook":"collapsibleListModal",dir:languageDir},isMobile?this.renderMobileHeader():this.renderDesktopHeader(),this.renderSettings(),!isMobile&&this.renderDesktopFooterPanel())},CollapsibleListModal}(Component),_ModalsMap),modalStyles={customStyles:{overlay:{backgroundColor:"transparent"},content:{borderRadius:"2px",boxShadow:"0 4px 8px 0 rgba(0, 0, 0, 0.1)",border:"solid 1px rgba(255, 255, 255, 0.25)"}}},createInlineButtons=function(_ref){var t=_ref.t,disableKeyboardEvents=_ref.disableKeyboardEvents;return[{keyName:"settings",type:BUTTONS.EXTERNAL_MODAL,fullHeight:!0,modalName:Modals.COLLAPSIBLE_LIST_MODAL,children:t("CollapsibleList_CollapsibleListSettings_Tab_Settings_TabName"),modalStyles:getModalStyles(modalStyles),t:t,mobile:!0,triggerSettingsBi:!0,pluginId:COLLAPSIBLE_LIST_TYPE},{keyName:"separator",mobile:!1,type:BUTTONS.SEPARATOR},{keyName:"delete",type:BUTTONS.DELETE,mobile:!0,beforeOnClickDelete:function(){null==disableKeyboardEvents||disableKeyboardEvents(!1)}}]},InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({width:"19px",height:"12px",viewBox:"0 0 23 12",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},props),React.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},React.createElement("g",{transform:"translate(-265.000000, -379.000000)",fill:"currentColor"},React.createElement("g",{transform:"translate(265.000000, 379.000000)"},React.createElement("path",{d:"M10,0.8 L22.6,0.8 C22.7104569,0.8 22.8,0.88954305 22.8,1 L22.8,1.6 C22.8,1.71045695 22.7104569,1.8 22.6,1.8 L10,1.8 C9.88954305,1.8 9.8,1.71045695 9.8,1.6 L9.8,1 C9.8,0.88954305 9.88954305,0.8 10,0.8 Z M10,5.8 L22.6,5.8 C22.7104569,5.8 22.8,5.88954305 22.8,6 L22.8,6.6 C22.8,6.71045695 22.7104569,6.8 22.6,6.8 L10,6.8 C9.88954305,6.8 9.8,6.71045695 9.8,6.6 L9.8,6 C9.8,5.88954305 9.88954305,5.8 10,5.8 Z M10,10.8 L22.6,10.8 C22.7104569,10.8 22.8,10.8895431 22.8,11 L22.8,11.6 C22.8,11.7104569 22.7104569,11.8 22.6,11.8 L10,11.8 C9.88954305,11.8 9.8,11.7104569 9.8,11.6 L9.8,11 C9.8,10.8895431 9.88954305,10.8 10,10.8 Z",fillRule:"nonzero"}),React.createElement("path",{d:"M2.61252587,5.04452587 C2.55011987,5.10656164 2.44933186,5.10656164 2.38692587,5.04452587 L2.04692587,4.70452587 C2.01688154,4.67451494 2,4.63379134 2,4.59132587 C2,4.54886039 2.01688154,4.50813679 2.04692587,4.47812587 L4.47972587,2.04532587 L2.04772587,-0.386674135 C2.01768154,-0.416685056 2.0008,-0.457408655 2.0008,-0.499874135 C2.0008,-0.542339615 2.01768154,-0.583063214 2.04772587,-0.613074135 L2.38692587,-0.953074135 C2.41693679,-0.983118462 2.45766039,-1 2.50012587,-1 C2.54259134,-1 2.58331494,-0.983118462 2.61332587,-0.953074135 L5.49812587,1.93172587 C5.52817019,1.96173679 5.54505173,2.00246039 5.54505173,2.04492587 C5.54505173,2.08739134 5.52817019,2.12811494 5.49812587,2.15812587 L2.61252587,5.04372587 L2.61252587,5.04452587 Z",transform:"translate(3.772526, 2.045526) rotate(-270.000000) translate(-3.772526, -2.045526) "})))))},ArrowIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"M11.999 9L6 14.241 6.657 15 11.999 10.334 17.343 15 18 14.241z",transform:"translate(-129 -185) translate(97 105) translate(23 71) rotate(-90 21 12) matrix(1 0 0 -1 0 24)"})))))))},PlusIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"M12.5 6v5.5H18v1h-5.5V18h-1v-5.5H6v-1h5.5V6h1z",transform:"translate(-129 -269) translate(97 105) translate(23 155) rotate(-90 21 12)"}))))))},DndIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"M5.37 7.083c-.684-.025-1.22-.596-1.203-1.28.017-.685.58-1.228 1.265-1.22.684.009 1.234.566 1.235 1.25-.014.704-.594 1.263-1.297 1.25zM5.37 2.5c-.684-.026-1.22-.597-1.203-1.28.017-.685.58-1.228 1.265-1.22.684.009 1.234.566 1.235 1.25-.014.703-.594 1.263-1.297 1.25zM5.463 9.167c.684.025 1.22.596 1.203 1.28-.017.685-.58 1.228-1.265 1.22-.684-.009-1.234-.566-1.234-1.25.014-.703.594-1.262 1.296-1.25zM1.203 7.083C.52 7.058-.017 6.487 0 5.803c.017-.685.581-1.228 1.265-1.22.685.009 1.235.566 1.235 1.25-.013.704-.594 1.263-1.297 1.25zM1.203 2.5C.52 2.474-.017 1.903 0 1.22.017.534.581-.009 1.265 0 1.95.01 2.5.566 2.5 1.25c-.013.703-.594 1.263-1.297 1.25zM1.297 9.167c.683.025 1.22.596 1.203 1.28-.017.685-.581 1.228-1.265 1.22C.55 11.658 0 11.1 0 10.417c.015-.703.594-1.262 1.297-1.25z",transform:"translate(-99 -190) translate(99 176) translate(0 14) translate(6.667 4.167)"})))))))},styles$3={ltr:"E6y_Z",rtl:"_2wLEl",iconContainer:"_21s0b",icon:"_2z8L4",isExpanded:"aPvla"};function ExpandCollapseButton(props){var onClick=props.onClick,idx=props.idx,ariaLabel=props.ariaLabel;return React.createElement("div",{role:"button",tabIndex:"-1",className:styles$3.iconContainer,onClick:onClick,onKeyUp:function(e){return(" "===e.key||"Enter"===e.key)&&onClick(e)},"data-hook":"ExpandCollapseButton_"+idx},React.createElement(ArrowIcon,{role:"button",tabIndex:"0","aria-label":ariaLabel,className:classNames(styles$3.icon,props.isExpanded&&styles$3.isExpanded)}))}var styles$2={titleContainer:"_3LwlN",title:"_3CwVy",content:"_3TxVS"},CollapsibleListPair=function(_Component){function CollapsibleListPair(props){var _this;(_this=_Component.call(this,props)||this).focusTitle=function(){var _this$titleEditorRef$;return null===(_this$titleEditorRef$=_this.titleEditorRef.current)||void 0===_this$titleEditorRef$?void 0:_this$titleEditorRef$.focus()},_this.renderTitle=function(){var _this$props=_this.props,idx=_this$props.idx,renderTitle=_this$props.renderTitle;return React.createElement("div",{className:_this.styles.title},renderTitle(idx,_this.titleEditorRef))},_this.focusContent=function(){var _this$contentEditorRe;return null===(_this$contentEditorRe=_this.contentEditorRef.current)||void 0===_this$contentEditorRe?void 0:_this$contentEditorRe.focus()},_this.renderContent=function(){var _this$props2=_this.props,idx=_this$props2.idx,renderContent=_this$props2.renderContent;return _this$props2.isExpanded&&React.createElement("div",{className:_this.styles.content},renderContent(idx,_this.contentEditorRef))},_this.onClick=function(e){var _helpers$onViewerActi,_this$props3=_this.props,isExpanded=_this$props3.isExpanded,onCollapseClick=_this$props3.onCollapseClick,onExpandClick=_this$props3.onExpandClick,idx=_this$props3.idx,helpers=_this$props3.helpers,isInEditor=_this$props3.isInEditor;isExpanded?onCollapseClick(idx):onExpandClick(idx),null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,COLLAPSIBLE_LIST_TYPE,"Click",isExpanded?"collapse":"expand"),isInEditor||(e.preventDefault(),setTimeout((function(){return anchorScroll(_this.pairRef,_this.context.experiments)})))},_this.onKeyDown=function(e){"a"===e.key&&(e.ctrlKey||e.metaKey)&&e.stopPropagation()};var theme=props.theme;return _this.styles=mergeStyles({styles:styles$2,theme:theme}),_this.titleEditorRef=React.createRef(),_this.contentEditorRef=React.createRef(),_this.pairRef=React.createRef(),_this}return _inheritsLoose(CollapsibleListPair,_Component),CollapsibleListPair.prototype.render=function(){var _this2=this,_this$props4=this.props,isExpanded=_this$props4.isExpanded,idx=_this$props4.idx,t=_this$props4.t;return React.createElement(React.Fragment,null,React.createElement("div",{className:this.styles.titleContainer,onKeyDown:this.onKeyDown,ref:function(_ref){return _this2.pairRef=_ref}},React.createElement(ExpandCollapseButton,{isExpanded:isExpanded,onClick:this.onClick,idx:idx,ariaLabel:t(isExpanded?"CollapsibleListPlugin_ExpandButton_AriaLabel":"CollapsibleListPlugin_CollapseButton_AriaLabel")}),this.renderTitle()),this.renderContent())},CollapsibleListPair}(Component);CollapsibleListPair.contextType=GlobalContext;var getPairsAllCollpased=function(pairs){return pairs.map((function(){return!1}))},getDefaultPairsState=function(pairs,defaultPairsExpandState){var pairsState="expanded"===defaultPairsExpandState?function(pairs){return pairs.map((function(){return!0}))}(pairs):getPairsAllCollpased(pairs);return"first_expanded"===defaultPairsExpandState&&(pairsState[0]=!0),pairsState},CollapsibleListPairs=function(_Component){function CollapsibleListPairs(props){var _this;return(_this=_Component.call(this,props)||this).focusPair=function(_ref){var idx=_ref.idx,isTitle=_ref.isTitle,pair=_this.pairsRefs[idx];isTitle?null==pair||pair.focusTitle():(null==pair?void 0:pair.focusContent())||null==pair||pair.focusTitle()},_this.expandPair=function(idx){var _this$props=_this.props,pairs=_this$props.pairs,expandOnlyOne=_this$props.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairs)),pairsState[idx]=!0,_this.setState({pairsState:pairsState})},_this.collapsePair=function(idx){var pairsState=[].concat(_this.state.pairsState);pairsState[idx]=!1,_this.setState({pairsState:pairsState})},_this.insertNewPair=function(){var expandOnlyOne=_this.state.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairsState)),pairsState=[].concat(pairsState,[!0]),_this.setState({pairsState:pairsState})},_this.deletePair=function(idx){var pairsState=_this.state.pairsState;pairsState.splice(idx,1),_this.setState({pairsState:pairsState})},_this.reorderPairs=function(startIdx,endIdx){var pairsState=_this.state.pairsState,pairToMove=pairsState.splice(startIdx,1)[0];pairsState.splice(endIdx,0,pairToMove),_this.setState({pairsState:pairsState})},_this.pairsRefs=[],_this.state=_this.initState(props),_this}_inheritsLoose(CollapsibleListPairs,_Component);var _proto=CollapsibleListPairs.prototype;return _proto.initState=function(props){var pairs=props.pairs,expandState=props.expandState;return{defaultPairsExpandState:expandState,expandOnlyOne:props.expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}},CollapsibleListPairs.getDerivedStateFromProps=function(props,state){var pairs=props.pairs,expandState=props.expandState,expandOnlyOne=props.expandOnlyOne;return state.defaultPairsExpandState!==expandState||expandOnlyOne&&expandOnlyOne!==state.expandOnlyOne?{defaultPairsExpandState:expandState,expandOnlyOne:expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}:null},_proto.render=function(){var _this2=this,_this$props2=this.props,pairs=_this$props2.pairs,PairWrapper=_this$props2.PairWrapper,t=_this$props2.t,theme=_this$props2.theme,renderTitle=_this$props2.renderTitle,renderContent=_this$props2.renderContent,helpers=_this$props2.helpers,isInEditor=_this$props2.isInEditor,pairsState=this.state.pairsState;return pairs.map((function(pair,idx){return React.createElement(PairWrapper,{key:pair.key,id:pair.key,index:idx},React.createElement(CollapsibleListPair,{ref:function(_ref2){return _this2.pairsRefs[idx]=_ref2},t:t,key:pair.key,idx:idx,isExpanded:pairsState[idx],onCollapseClick:_this2.collapsePair,onExpandClick:_this2.expandPair,theme:theme,renderTitle:renderTitle,renderContent:renderContent,helpers:helpers,isInEditor:isInEditor}))}))},CollapsibleListPairs}(Component);CollapsibleListPairs.defaultProps={PairWrapper:"div"};var styles$1_new_pair_container="_1AgMx",styles$1_new_pair_button="_1Zqb4",styles$1_new_pair_label="_3iSqB";function NewPairButton(props){return React.createElement("div",{role:"button",tabIndex:"0",className:styles$1_new_pair_container,onClick:props.onClick,onKeyPress:function(e){return("Enter"===e.key||" "===e.key)&&props.onClick(e)},"data-hook":"CollapsibleListNewPair_button"},React.createElement("div",{className:styles$1_new_pair_button},React.createElement(PlusIcon,null),React.createElement("label",{className:styles$1_new_pair_label},props.label)))}var styles_dndIcon="hDgGn";function DndHandle(props){return React.createElement("div",_extends({className:styles_dndIcon},props.dragHandleProps),React.createElement(DndIcon,null))}var CollapsibleListComponent=function(_React$Component){function CollapsibleListComponent(_props){var _this,_this2=this;(_this=_React$Component.call(this,_props)||this).focusPair=function(pair){return setTimeout((function(){_this.collapsibleListRef.current.focusPair(pair)}))},_this.expandPair=function(idx){return _this.collapsibleListRef.current.expandPair(idx)},_this.focusTitle=function(idx){var pair={idx:idx,isTitle:!0};_this.focusPair(pair)},_this.focusContent=function(idx){var pair={idx:idx,isTitle:!1};_this.focusPair(pair)},_this.onTitleBackspace=function(idx){_this.getDataManager().getPairs().length>1&&(_this.getDataManager().deletePair(idx),_this.collapsibleListRef.current.deletePair(idx),0===idx?_this.focusTitle(idx):_this.focusContent(idx-1))},_this.renderTitle=function(idx,setRef){return React.createElement(_this2.renderInput,{value:_this.getDataManager().getTitle(idx),setRef:setRef,onChange:function(val){return _this.getDataManager().setTitle(idx,val)},placeholder:_this.titlePlaceholder,onBackspaceAtBeginningOfContent:function(){return _this.onTitleBackspace(idx)},handleReturn:_this.handleTitleReturn(idx),toolbarsToIgnore:["SideToolbar"]})},_this.renderContent=function(idx,setRef){return React.createElement(_this2.renderInput,{value:_this.getDataManager().getContent(idx),setRef:setRef,onChange:function(val){return _this.getDataManager().setContent(idx,val)},placeholder:_this.contentPlaceholder,onBackspaceAtBeginningOfContent:function(){return _this.focusTitle(idx)}})},_this.renderInput=function(_ref){var value=_ref.value,setRef=_ref.setRef,onChange=_ref.onChange,placeholder=_ref.placeholder,onBackspaceAtBeginningOfContent=_ref.onBackspaceAtBeginningOfContent,handleReturn=_ref.handleReturn,toolbarsToIgnore=_ref.toolbarsToIgnore,renderInnerRCE=_this.props.renderInnerRCE,direction=_this.getDataManager().getDirection();return renderInnerRCE({editorState:value,setRef:setRef,onChange:onChange,renderedIn:COLLAPSIBLE_LIST_TYPE,onBackspaceAtBeginningOfContent:onBackspaceAtBeginningOfContent,direction:direction,additionalProps:{textAlignment:"ltr"===direction?"left":"right",placeholder:placeholder,handleReturn:handleReturn},toolbarsToIgnore:toolbarsToIgnore,onFocus:function(){return _this.props.disableKeyboardEvents(!0)},onBlur:function(){return _this.props.disableKeyboardEvents(!1)}})},_this.handleTitleReturn=function(idx){return function(){return function(){return _this.expandPair(idx),_this.focusContent(idx),"handled"}}},_this.onNewPairButtonClick=function(){var newPairIdx=_this.getDataManager().getPairs().length;_this.getDataManager().insertNewPair(),_this.collapsibleListRef.current.insertNewPair(),_this.focusTitle(newPairIdx)},_this.onDragEnd=function(result){result.destination&&result.source.index!==result.destination.index&&(_this.getDataManager().reorderPairs(result.source.index,result.destination.index),_this.collapsibleListRef.current.reorderPairs(result.source.index,result.destination.index))},_this.getDataManager=function(props){var _ref2=props||_this.props,store=_ref2.store,componentData=_ref2.componentData;return new CollapsibleList(store,componentData)},_this.PairWrapper=function(_ref3){var id=_ref3.id,index=_ref3.index,children=_ref3.children,_this$props=_this.props,isMobile=_this$props.isMobile,blockProps=_this$props.blockProps,isDragDisabled=isMobile||!blockProps.isFocused;return React.createElement(Draggable,{key:id,draggableId:id,index:index,isDragDisabled:isDragDisabled},(function(provided){return React.createElement("div",_extends({ref:provided.innerRef},provided.draggableProps),!isDragDisabled&&React.createElement(DndHandle,{dragHandleProps:provided.dragHandleProps}),children)}))},_this.onFocus=function(e){return e.stopPropagation()};var theme=_props.theme,t=_props.t;return _this.styles=mergeStyles({styles:styles$3,theme:theme}),_this.titlePlaceholder=t("CollapsibleList_ShownText_Placeholder"),_this.contentPlaceholder=t("CollapsibleList_CollapsedText_Placeholder"),_this.addNewPairLabel=t("CollapsibleList_ShownText_Add_Placeholder"),_this.collapsibleListRef=React.createRef(),_this}return _inheritsLoose(CollapsibleListComponent,_React$Component),CollapsibleListComponent.prototype.render=function(){var _this3=this,_this$props2=this.props,blockProps=_this$props2.blockProps,theme=_this$props2.theme,t=_this$props2.t,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,pairs=this.getDataManager().getPairs(),expandState=this.getDataManager().getExpandState(),expandOnlyOne=this.getDataManager().getExpandOnlyOne(),direction=this.getDataManager().getDirection();return React.createElement("div",{className:this.styles[direction],onFocus:this.onFocus,tabIndex:"0","data-hook":"collapsibleListComponent"},React.createElement(DragDropContext,{onDragEnd:this.onDragEnd},React.createElement(Droppable,{droppableId:"droppable"},(function(provided){return React.createElement("div",_extends({},provided.droppableProps,{ref:provided.innerRef}),React.createElement(CollapsibleListPairs,{ref:_this3.collapsibleListRef,theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:_this3.renderTitle,renderContent:_this3.renderContent,PairWrapper:_this3.PairWrapper,helpers:helpers,isInEditor:!0}),provided.placeholder)}))),blockProps.isFocused&&React.createElement(NewPairButton,{label:this.addNewPairLabel,onClick:this.onNewPairButtonClick}))},CollapsibleListComponent}(React.Component),createInsertButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,locale=_ref.locale,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,componentData=_extends({},DEFAULTS,{config:_extends({},DEFAULTS.config,{direction:isRtl(locale)?directions_RTL:directions_LTR})});return[{type:BUTTON_TYPES.BUTTON,name:INSERT_PLUGIN_BUTTONS.COLLAPSIBLE_LIST,getLabel:function(){return t("CollapsibleList_InsertButton")},tooltip:t("CollapsibleListPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},isActive:function(){return!1},isDisabled:function(){return!1},componentData:componentData,toolbars:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],section:"BlockToolbar_Section_Advanced"}]},createToolbar=function(_ref){var t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,locale=_ref.locale,disableKeyboardEvents=_ref.disableKeyboardEvents;return{InlineButtons:createInlineButtons({t:t,disableKeyboardEvents:disableKeyboardEvents}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile,locale:locale}),name:COLLAPSIBLE_LIST_TYPE}};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 createCollapsibleListPlugin=function(config){var localeContent=config.localeContent,locale=config.locale,helpers=config.helpers,t=config.t,_config$COLLAPSIBLE_L=config[COLLAPSIBLE_LIST_TYPE],settings=void 0===_config$COLLAPSIBLE_L?{}:_config$COLLAPSIBLE_L,isMobile=config.isMobile,disableKeyboardEvents=config.disableKeyboardEvents,rest=_objectWithoutPropertiesLoose(config,["localeContent","locale","helpers","t",COLLAPSIBLE_LIST_TYPE,"isMobile","disableKeyboardEvents"].map(_toPropertyKey));return createBasePlugin(_extends({component:CollapsibleListComponent,type:COLLAPSIBLE_LIST_TYPE,toolbar:createToolbar({helpers:helpers,t:t,settings:settings,isMobile:isMobile,locale:localeContent||locale,disableKeyboardEvents:disableKeyboardEvents}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,defaultPluginData:DEFAULTS,noPluginBorder:!0,noPointerEventsOnFocus:!0,locale:localeContent||locale,disableKeyboardEvents:disableKeyboardEvents},rest))};createCollapsibleListPlugin.functionName=COLLAPSIBLE_LIST_TYPE;var CollapsibleListViewer=function(_Component){function CollapsibleListViewer(props){var _this;(_this=_Component.call(this,props)||this).getPair=function(idx){return _this.props.componentData.pairs[idx]},_this.renderInnerRCV=function(contentState){var _this$props=_this.props,innerRCV=_this$props.innerRCV,componentData=_this$props.componentData;return innerRCV({contentState:contentState,textAlignment:function(componentData){return"ltr"===componentData.config.direction?"left":"right"}(componentData),direction:function(componentData){return componentData.config.direction}(componentData)})},_this.renderTitle=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.title)},_this.renderContent=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.content)};var theme=props.theme;return _this.styles=mergeStyles({styles:styles$3,theme:theme}),_this}return _inheritsLoose(CollapsibleListViewer,_Component),CollapsibleListViewer.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,t=_this$props2.t,componentData=_this$props2.componentData,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,config=componentData.config,pairs=componentData.pairs,direction=config.direction,expandState=config.expandState,expandOnlyOne=config.expandOnlyOne;return React.createElement("div",{className:this.styles[direction]},React.createElement(CollapsibleListPairs,{theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:this.renderTitle,renderContent:this.renderContent,helpers:helpers}))},CollapsibleListViewer}(Component),pluginCollapsibleList=function(config){return{config:_extends({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,createPlugin:createCollapsibleListPlugin,ModalsMap:ModalsMap}};export{COLLAPSIBLE_LIST_TYPE,Modals,ModalsMap,CollapsibleListViewer as collapsibleListViewer,createCollapsibleListPlugin,pluginCollapsibleList};
//# sourceMappingURL=module.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),classNames=require("classnames"),lodash=require("lodash"),wixRichContentCommon=require("wix-rich-content-common"),imageUtils=require("wix-rich-content-common/libs/imageUtils"),pluginImageSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-image.schema.json");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),pluginImageSchema__default=_interopDefaultLegacy(pluginImageSchema),IMAGE_TYPE="wix-draft-plugin-image",DEFAULTS=Object.freeze({config:{alignment:"center",size:"content",showTitle:!0,showDescription:!0}}),styles$1={fontElementMap:"_1hNZF",imageContainer:"_2kEVY",expandContainer:"-D6i8",expandIcon:"_2Lky3",pointer:"_2Ybje",imageWrapper:"_3WJnn",image:"OzAYt",imageOverlay:"_1b5Ar",imageCaption:"EilAw",imagePreload:"_3ii3f",imageHighres:"_3xs9_",onlyHighRes:"_1I_dK",image_loading:"_3aC9X"},expand=function(props){return React__default.default.createElement("svg",Object.assign({viewBox:"0 0 19 19",xmlns:"http://www.w3.org/2000/svg"},props),React__default.default.createElement("path",{d:"M15.071 8.371V4.585l-4.355 4.356a.2.2 0 0 1-.283 0l-.374-.374a.2.2 0 0 1 0-.283l4.356-4.355h-3.786a.2.2 0 0 1-.2-.2V3.2c0-.11.09-.2.2-.2H16v5.371a.2.2 0 0 1-.2.2h-.529a.2.2 0 0 1-.2-.2zm-6.5 6.9v.529a.2.2 0 0 1-.2.2H3v-5.371c0-.11.09-.2.2-.2h.529c.11 0 .2.09.2.2v3.786l4.355-4.356a.2.2 0 0 1 .283 0l.374.374a.2.2 0 0 1 0 .283L4.585 15.07h3.786c.11 0 .2.09.2.2z",fill:"#000",fillRule:"nonzero"}))},styles_inPluginInput="_1k3YS",InPluginInput=function(_Component){function InPluginInput(){var _this;return(_this=_Component.apply(this,arguments)||this).handleFocus=function(e){e.stopPropagation(),_this.props.setFocusToBlock(),_this.props.setInPluginEditingMode(!0)},_this.handleBlur=function(){return _this.props.setInPluginEditingMode(!1)},_this.handleKeyPress=function(e){var _this$props=_this.props,setFocusToBlock=_this$props.setFocusToBlock,value=_this$props.value;"Enter"===e.key&&setFocusToBlock&&""!==value&&(_this.handleBlur(),setFocusToBlock())},_this.onChange=function(e){var _this$props$onChange,_this$props2;return null===(_this$props$onChange=(_this$props2=_this.props).onChange)||void 0===_this$props$onChange?void 0:_this$props$onChange.call(_this$props2,e.target.value)},_this}return _inheritsLoose__default.default(InPluginInput,_Component),InPluginInput.prototype.render=function(){var className=classNames__default.default(styles_inPluginInput,this.props.className);return React__default.default.createElement("textarea",{className:className,value:this.props.value,onChange:this.onChange,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyPress:this.handleKeyPress,dir:"auto",rows:1})},InPluginInput}(React.Component);InPluginInput.defaultProps={setInPluginEditingMode:function(){return!1},setFocusToBlock:function(){return!1}};var ImageViewer=function(_React$Component){function ImageViewer(props){var _this;return(_this=_React$Component.call(this,props)||this).forceOnImageLoad=function(){var executionTimes=0,interval=setInterval((function(){var _this$imageRef,_this$imageRef$curren;null!==(_this$imageRef=_this.imageRef)&&void 0!==_this$imageRef&&null!==(_this$imageRef$curren=_this$imageRef.current)&&void 0!==_this$imageRef$curren&&_this$imageRef$curren.complete&&(_this.onImageLoad(_this.imageRef.current),clearInterval(interval)),10==++executionTimes&&clearInterval(interval)}),200)},_this.onImageLoadError=function(){var src=_this.props.componentData.src;src&&src.fallback&&_this.setState({fallbackImageSrc:{preload:src.fallback,highres:src.fallback}})},_this.renderImage=function(imageClassName,imageSrc,alt,props,isGif,onlyHighRes){var _classNames;return _this.getImage(classNames__default.default(imageClassName,_this.styles.imageHighres,((_classNames={})[_this.styles.onlyHighRes]=onlyHighRes,_classNames)),imageSrc.highres,alt,props,{fadeIn:!isGif,width:imageSrc.highresWidth,height:imageSrc.highresHeight})},_this.renderPreloadImage=function(imageClassName,imageSrc,alt,props){return _this.getImage(classNames__default.default(imageClassName,_this.styles.imagePreload),imageSrc.preload,alt,_extends__default.default({"aria-hidden":!0},props))},_this.onImageLoad=function(element){element.style.opacity=1,_this.preloadRef.current&&(_this.preloadRef.current.style.opacity="0")},_this.handleExpand=function(e){var _helpers$onViewerActi;e.preventDefault();var _this$props=_this.props,onExpand=_this$props.settings.onExpand,_this$props$helpers=_this$props.helpers,helpers=void 0===_this$props$helpers?{}:_this$props$helpers;null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,IMAGE_TYPE,"Click","expand_image"),_this.hasExpand()&&(null==onExpand||onExpand(_this.props.blockKey))},_this.scrollToAnchor=function(e){var _this$props2=_this.props,_this$props2$componen=_this$props2.componentData.config.link,anchor=(_this$props2$componen=void 0===_this$props2$componen?{}:_this$props2$componen).anchor,customAnchorScroll=_this$props2.customAnchorScroll;if(customAnchorScroll)customAnchorScroll(e,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);wixRichContentCommon.addAnchorTagToUrl(anchorString),wixRichContentCommon.anchorScroll(element,_this.context.experiments)}},_this.hasLink=function(){var _this$props$component,_this$props$component2,_this$props$component3;return null===(_this$props$component=_this.props.componentData)||void 0===_this$props$component||null===(_this$props$component2=_this$props$component.config)||void 0===_this$props$component2||null===(_this$props$component3=_this$props$component2.link)||void 0===_this$props$component3?void 0:_this$props$component3.url},_this.hasAnchor=function(){var _this$props$component4,_this$props$component5,_this$props$component6;return null===(_this$props$component4=_this.props.componentData)||void 0===_this$props$component4||null===(_this$props$component5=_this$props$component4.config)||void 0===_this$props$component5||null===(_this$props$component6=_this$props$component5.link)||void 0===_this$props$component6?void 0:_this$props$component6.anchor},_this.onKeyDown=function(e){"Enter"!==e.key&&" "!==e.key||_this.props.getInPluginEditingMode||_this.handleClick(e)},_this.handleClick=function(e){if(_this.hasLink())return null;_this.hasAnchor()?(e.preventDefault(),e.stopPropagation(),_this.scrollToAnchor(e)):_this.handleExpand(e)},_this.handleRef=function(e){_this.state.container||_this.setState({container:e})},_this.handleContextMenu=function(e){var _this$props$component7=_this.props.componentData.disableDownload;return void 0!==_this$props$component7&&_this$props$component7&&e.preventDefault()},_this.hasExpand=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableExpand=!1;return void 0!==componentData.disableExpand?disableExpand=componentData.disableExpand:void 0!==settings.disableExpand&&(disableExpand=settings.disableExpand),!disableExpand&&settings.onExpand},_this.renderExpandIcon=function(){return React__default.default.createElement("div",{className:_this.styles.expandContainer},React__default.default.createElement(expand,{className:_this.styles.expandIcon,onClick:_this.handleExpand}))},wixRichContentCommon.validate(props.componentData,pluginImageSchema__default.default),_this.state={},_this.preloadRef=React__default.default.createRef(),_this.imageRef=React__default.default.createRef(),_this}_inheritsLoose__default.default(ImageViewer,_React$Component);var _proto=ImageViewer.prototype;return _proto.componentDidMount=function(){this.setState({ssrDone:!0}),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&this.forceOnImageLoad()},_proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginImageSchema__default.default)},_proto.calculateHeight=function(width,src){return void 0===width&&(width=1),src&&src.height&&src.width?Math.ceil(src.height/src.width*width):imageUtils.WIX_MEDIA_DEFAULT.SIZE},_proto.getImageDataUrl=function(){return this.props.dataUrl?{preload:this.props.dataUrl,highres:this.props.dataUrl}:null},_proto.getImageUrl=function(src){var _this$context$experim,_this$context$experim2,_this2=this,_ref=this.props||{},helpers=_ref.helpers,seoMode=_ref.seoMode;if(!src&&null!=helpers&&helpers.handleFileSelection)return null;var requiredWidth,requiredHeight,removeUsm=null===(_this$context$experim=this.context.experiments)||void 0===_this$context$experim||null===(_this$context$experim2=_this$context$experim.removeUsmFromImageUrls)||void 0===_this$context$experim2?void 0:_this$context$experim2.enabled,imageUrl={preload:"",highres:""},imageSrcOpts={};if(!this.props.isMobile&&!imageUtils.isPNG(src)){var _this$props$component8=this.props.componentData.config,alignment=(_this$props$component8=void 0===_this$props$component8?{}:_this$props$component8).alignment,width=_this$props$component8.width,usePredefinedWidth=("left"===alignment||"right"===alignment)&&!width;imageSrcOpts=_extends__default.default({removeUsm:removeUsm,imageType:"quailtyPreload"},usePredefinedWidth&&{requiredWidth:300})}if(imageUrl.preload=imageUtils.getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,imageSrcOpts),seoMode)requiredWidth=(null==src?void 0:src.width)&&Math.min(src.width,1e3),requiredHeight=this.calculateHeight(1e3,src);else if(this.state.container){var _getImageDimensions=function(width,isMobile){var requiredHeight,requiredWidth=width||1;return isMobile&&!wixRichContentCommon.isSSR()&&(requiredWidth*=window.devicePixelRatio,requiredWidth*=window.screen.width/document.body.clientWidth),requiredHeight=_this2.calculateHeight(requiredWidth,src),[requiredWidth=Math.ceil(requiredWidth),requiredHeight=Math.ceil(requiredHeight)]}(this.state.container.getBoundingClientRect().width||(null==src?void 0:src.width),this.props.isMobile);requiredWidth=_getImageDimensions[0],requiredHeight=_getImageDimensions[1]}return imageUrl.highres=imageUtils.getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,{removeUsm:removeUsm,requiredWidth:requiredWidth,requiredHeight:requiredHeight,requiredQuality:90,imageType:"highRes"}),!this.state.ssrDone||imageUrl.preload||this.props.isLoading||console.error("image plugin mounted with invalid image source!",src),imageUrl},_proto.getImage=function(imageClassNames,src,alt,props,opts){var _this$context$experim3,_this3=this;void 0===opts&&(opts={});var _opts=opts,_opts$fadeIn=_opts.fadeIn,fadeIn=void 0!==_opts$fadeIn&&_opts$fadeIn,width=_opts.width,height=_opts.height,loading=null!==(_this$context$experim3=this.context.experiments.lazyImagesAndIframes)&&void 0!==_this$context$experim3&&_this$context$experim3.enabled?"lazy":void 0;return React__default.default.createElement("img",Object.assign({},props,{className:imageClassNames,src:src,alt:alt,onError:this.onImageLoadError,onLoad:fadeIn?function(e){return _this3.onImageLoad(e.target)}:void 0,ref:fadeIn?this.imageRef:this.preloadRef,width:width,height:height,loading:loading}))},_proto.renderTitle=function(data,styles){return!!(data.config||{}).showTitle&&React__default.default.createElement("div",{className:classNames__default.default(styles.imageTitle)},data&&data.title||"")},_proto.renderDescription=function(data,styles){return!!(data.config||{}).showDescription&&React__default.default.createElement("div",{className:classNames__default.default(styles.imageDescription)},data&&data.description||"")},_proto.renderCaption=function(caption){var _this$props4=this.props,onCaptionChange=_this$props4.onCaptionChange,setFocusToBlock=_this$props4.setFocusToBlock,setInPluginEditingMode=_this$props4.setInPluginEditingMode,_this$styles=this.styles,imageCaption=_this$styles.imageCaption,link=_this$styles.link,classes=classNames__default.default(imageCaption,this.hasLink()&&link);return onCaptionChange?React__default.default.createElement(InPluginInput,{setInPluginEditingMode:setInPluginEditingMode,className:classes,value:caption,onChange:onCaptionChange,setFocusToBlock:setFocusToBlock}):React__default.default.createElement("span",{dir:"auto",className:classes},caption)},_proto.shouldRenderCaption=function(){var _componentData$metada,_this$props5=this.props,getInPluginEditingMode=_this$props5.getInPluginEditingMode,settings=_this$props5.settings,componentData=_this$props5.componentData,defaultCaption=_this$props5.defaultCaption,caption=null===(_componentData$metada=componentData.metadata)||void 0===_componentData$metada?void 0:_componentData$metada.caption;if(lodash.includes(lodash.get(settings,"toolbar.hidden"),"settings"))return!1;if(void 0===caption||""===caption&&(null==getInPluginEditingMode||!getInPluginEditingMode())||caption===defaultCaption)return!1;var data=componentData||DEFAULTS;return"original"!==data.config.size||!data.src||!data.src.width||data.src.width>=350},_proto.render=function(){var _classNames2,_imageSrc$highres,_imageSrc$highres$end;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles$1,theme:this.props.theme});var _this$props6=this.props,componentData=_this$props6.componentData,className=_this$props6.className,settings=_this$props6.settings,setComponentUrl=_this$props6.setComponentUrl,seoMode=_this$props6.seoMode,_this$state=this.state,fallbackImageSrc=_this$state.fallbackImageSrc,ssrDone=_this$state.ssrDone,data=componentData||DEFAULTS,metadata=componentData.metadata;metadata||(metadata={});var itemClassName=classNames__default.default(this.styles.imageWrapper,className,((_classNames2={})[this.styles.pointer]=this.hasExpand(),_classNames2)),imageClassName=this.styles.image,imageSrc=fallbackImageSrc||this.getImageDataUrl()||this.getImageUrl(data.src),imageProps={};data.src&&settings&&settings.imageProps&&(imageProps=lodash.isFunction(settings.imageProps)?settings.imageProps(data.src):settings.imageProps);var isGif=null==imageSrc||null===(_imageSrc$highres=imageSrc.highres)||void 0===_imageSrc$highres||null===(_imageSrc$highres$end=_imageSrc$highres.endsWith)||void 0===_imageSrc$highres$end?void 0:_imageSrc$highres$end.call(_imageSrc$highres,".gif");null==setComponentUrl||setComponentUrl(null==imageSrc?void 0:imageSrc.highres);var shouldRenderPreloadImage=!seoMode&&imageSrc&&!isGif,shouldRenderImage=imageSrc&&(seoMode||ssrDone)||isGif,accesibilityProps=!this.hasLink()&&{role:"button",tabIndex:0},onlyHiRes=seoMode||isGif;return React__default.default.createElement("div",Object.assign({"data-hook":"imageViewer",className:this.styles.imageContainer,ref:this.handleRef,onContextMenu:this.handleContextMenu,onKeyDown:this.onKeyDown},accesibilityProps),React__default.default.createElement("div",{className:itemClassName,"aria-label":metadata.alt,onClick:this.handleClick,onKeyDown:this.onKeyDown},shouldRenderPreloadImage&&this.renderPreloadImage(imageClassName,imageSrc,metadata.alt,imageProps),shouldRenderImage&&this.renderImage(imageClassName,imageSrc,metadata.alt,imageProps,isGif,onlyHiRes),this.hasExpand()&&this.renderExpandIcon()),this.renderTitle(data,this.styles),this.renderDescription(data,this.styles),this.shouldRenderCaption()&&this.renderCaption(metadata.caption))},ImageViewer}(React__default.default.Component);ImageViewer.contextType=wixRichContentCommon.GlobalContext;var shouldDisableStyles=function(componentData,isMobile){var _ref=componentData.config||{},size=_ref.size,width=_ref.width;return!("inline"===size&&lodash.isNumber(width)&&width<=150)&&isMobile},imageRenderDescriptor={component:ImageViewer,classNameStrategies:{size:function(componentData,theme,styles,isMobile){var size=(componentData.config||{}).size;return!size||isMobile&&"original"===size?"":shouldDisableStyles(componentData,isMobile)?classNames__default.default(styles.sizeFullWidth,theme.sizeFullWidth):classNames__default.default(styles["size"+lodash.upperFirst(lodash.camelCase(size))],theme["size"+lodash.upperFirst(lodash.camelCase(size))])},alignment:function(componentData,theme,styles,isMobile){var _ref2=componentData.config||{},alignment=_ref2.alignment,size=_ref2.size;if(!alignment||shouldDisableStyles(componentData,isMobile)&&"original"!==size)return"";var align=alignment;if("original"===size&&"center"!==alignment){var width=(componentData.src||{}).width;lodash.isNumber(width)&&width>350&&(align="center")}return classNames__default.default(styles["align"+lodash.upperFirst(align)],theme["align"+lodash.upperFirst(align)])}}},typeMapper=function(){var _ref;return(_ref={}).IMAGE=imageRenderDescriptor,_ref[IMAGE_TYPE]=imageRenderDescriptor,_ref};exports.IMAGE_TYPE=IMAGE_TYPE,exports.imageTypeMapper=typeMapper,exports.pluginImage=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:IMAGE_TYPE,typeMapper:typeMapper}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),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),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),ArrowIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("g",null,React__default.default.createElement("path",{d:"M11.999 9L6 14.241 6.657 15 11.999 10.334 17.343 15 18 14.241z",transform:"translate(-129 -185) translate(97 105) translate(23 71) rotate(-90 21 12) matrix(1 0 0 -1 0 24)"})))))))},styles$1={ltr:"E6y_Z",rtl:"_2wLEl",iconContainer:"_21s0b",icon:"_2z8L4",isExpanded:"aPvla"};function ExpandCollapseButton(props){var onClick=props.onClick,idx=props.idx,ariaLabel=props.ariaLabel;return React__default.default.createElement("div",{role:"button",tabIndex:"-1",className:styles$1.iconContainer,onClick:onClick,onKeyUp:function(e){return(" "===e.key||"Enter"===e.key)&&onClick(e)},"data-hook":"ExpandCollapseButton_"+idx},React__default.default.createElement(ArrowIcon,{role:"button",tabIndex:"0","aria-label":ariaLabel,className:classNames__default.default(styles$1.icon,props.isExpanded&&styles$1.isExpanded)}))}var styles={titleContainer:"_3LwlN",title:"_3CwVy",content:"_3TxVS"},COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",CollapsibleListPair=function(_Component){function CollapsibleListPair(props){var _this;(_this=_Component.call(this,props)||this).focusTitle=function(){var _this$titleEditorRef$;return null===(_this$titleEditorRef$=_this.titleEditorRef.current)||void 0===_this$titleEditorRef$?void 0:_this$titleEditorRef$.focus()},_this.renderTitle=function(){var _this$props=_this.props,idx=_this$props.idx,renderTitle=_this$props.renderTitle;return React__default.default.createElement("div",{className:_this.styles.title},renderTitle(idx,_this.titleEditorRef))},_this.focusContent=function(){var _this$contentEditorRe;return null===(_this$contentEditorRe=_this.contentEditorRef.current)||void 0===_this$contentEditorRe?void 0:_this$contentEditorRe.focus()},_this.renderContent=function(){var _this$props2=_this.props,idx=_this$props2.idx,renderContent=_this$props2.renderContent;return _this$props2.isExpanded&&React__default.default.createElement("div",{className:_this.styles.content},renderContent(idx,_this.contentEditorRef))},_this.onClick=function(e){var _helpers$onViewerActi,_this$props3=_this.props,isExpanded=_this$props3.isExpanded,onCollapseClick=_this$props3.onCollapseClick,onExpandClick=_this$props3.onExpandClick,idx=_this$props3.idx,helpers=_this$props3.helpers,isInEditor=_this$props3.isInEditor;isExpanded?onCollapseClick(idx):onExpandClick(idx),null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,COLLAPSIBLE_LIST_TYPE,"Click",isExpanded?"collapse":"expand"),isInEditor||(e.preventDefault(),setTimeout((function(){return wixRichContentCommon.anchorScroll(_this.pairRef,_this.context.experiments)})))},_this.onKeyDown=function(e){"a"===e.key&&(e.ctrlKey||e.metaKey)&&e.stopPropagation()};var theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:theme}),_this.titleEditorRef=React__default.default.createRef(),_this.contentEditorRef=React__default.default.createRef(),_this.pairRef=React__default.default.createRef(),_this}return _inheritsLoose__default.default(CollapsibleListPair,_Component),CollapsibleListPair.prototype.render=function(){var _this2=this,_this$props4=this.props,isExpanded=_this$props4.isExpanded,idx=_this$props4.idx,t=_this$props4.t;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:this.styles.titleContainer,onKeyDown:this.onKeyDown,ref:function(_ref){return _this2.pairRef=_ref}},React__default.default.createElement(ExpandCollapseButton,{isExpanded:isExpanded,onClick:this.onClick,idx:idx,ariaLabel:t(isExpanded?"CollapsibleListPlugin_ExpandButton_AriaLabel":"CollapsibleListPlugin_CollapseButton_AriaLabel")}),this.renderTitle()),this.renderContent())},CollapsibleListPair}(React.Component);CollapsibleListPair.contextType=wixRichContentCommon.GlobalContext;var DEFAULTS=Object.freeze({config:{expandState:"first_expanded",expandOnlyOne:!1},pairs:[{key:wixRichContentCommon.generateKey()}]}),getPairsAllCollpased=function(pairs){return pairs.map((function(){return!1}))},getDefaultPairsState=function(pairs,defaultPairsExpandState){var pairsState="expanded"===defaultPairsExpandState?function(pairs){return pairs.map((function(){return!0}))}(pairs):getPairsAllCollpased(pairs);return"first_expanded"===defaultPairsExpandState&&(pairsState[0]=!0),pairsState},CollapsibleListPairs=function(_Component){function CollapsibleListPairs(props){var _this;return(_this=_Component.call(this,props)||this).focusPair=function(_ref){var idx=_ref.idx,isTitle=_ref.isTitle,pair=_this.pairsRefs[idx];isTitle?null==pair||pair.focusTitle():(null==pair?void 0:pair.focusContent())||null==pair||pair.focusTitle()},_this.expandPair=function(idx){var _this$props=_this.props,pairs=_this$props.pairs,expandOnlyOne=_this$props.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairs)),pairsState[idx]=!0,_this.setState({pairsState:pairsState})},_this.collapsePair=function(idx){var pairsState=[].concat(_this.state.pairsState);pairsState[idx]=!1,_this.setState({pairsState:pairsState})},_this.insertNewPair=function(){var expandOnlyOne=_this.state.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairsState)),pairsState=[].concat(pairsState,[!0]),_this.setState({pairsState:pairsState})},_this.deletePair=function(idx){var pairsState=_this.state.pairsState;pairsState.splice(idx,1),_this.setState({pairsState:pairsState})},_this.reorderPairs=function(startIdx,endIdx){var pairsState=_this.state.pairsState,pairToMove=pairsState.splice(startIdx,1)[0];pairsState.splice(endIdx,0,pairToMove),_this.setState({pairsState:pairsState})},_this.pairsRefs=[],_this.state=_this.initState(props),_this}_inheritsLoose__default.default(CollapsibleListPairs,_Component);var _proto=CollapsibleListPairs.prototype;return _proto.initState=function(props){var pairs=props.pairs,expandState=props.expandState;return{defaultPairsExpandState:expandState,expandOnlyOne:props.expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}},CollapsibleListPairs.getDerivedStateFromProps=function(props,state){var pairs=props.pairs,expandState=props.expandState,expandOnlyOne=props.expandOnlyOne;return state.defaultPairsExpandState!==expandState||expandOnlyOne&&expandOnlyOne!==state.expandOnlyOne?{defaultPairsExpandState:expandState,expandOnlyOne:expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}:null},_proto.render=function(){var _this2=this,_this$props2=this.props,pairs=_this$props2.pairs,PairWrapper=_this$props2.PairWrapper,t=_this$props2.t,theme=_this$props2.theme,renderTitle=_this$props2.renderTitle,renderContent=_this$props2.renderContent,helpers=_this$props2.helpers,isInEditor=_this$props2.isInEditor,pairsState=this.state.pairsState;return pairs.map((function(pair,idx){return React__default.default.createElement(PairWrapper,{key:pair.key,id:pair.key,index:idx},React__default.default.createElement(CollapsibleListPair,{ref:function(_ref2){return _this2.pairsRefs[idx]=_ref2},t:t,key:pair.key,idx:idx,isExpanded:pairsState[idx],onCollapseClick:_this2.collapsePair,onExpandClick:_this2.expandPair,theme:theme,renderTitle:renderTitle,renderContent:renderContent,helpers:helpers,isInEditor:isInEditor}))}))},CollapsibleListPairs}(React.Component);CollapsibleListPairs.defaultProps={PairWrapper:"div"};var CollapsibleListViewer=function(_Component){function CollapsibleListViewer(props){var _this;(_this=_Component.call(this,props)||this).getPair=function(idx){return _this.props.componentData.pairs[idx]},_this.renderInnerRCV=function(contentState){var _this$props=_this.props,innerRCV=_this$props.innerRCV,componentData=_this$props.componentData;return innerRCV({contentState:contentState,textAlignment:function(componentData){return"ltr"===componentData.config.direction?"left":"right"}(componentData),direction:function(componentData){return componentData.config.direction}(componentData)})},_this.renderTitle=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.title)},_this.renderContent=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.content)};var theme=props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles$1,theme:theme}),_this}return _inheritsLoose__default.default(CollapsibleListViewer,_Component),CollapsibleListViewer.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,t=_this$props2.t,componentData=_this$props2.componentData,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,config=componentData.config,pairs=componentData.pairs,direction=config.direction,expandState=config.expandState,expandOnlyOne=config.expandOnlyOne;return React__default.default.createElement("div",{className:this.styles[direction]},React__default.default.createElement(CollapsibleListPairs,{theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:this.renderTitle,renderContent:this.renderContent,helpers:helpers}))},CollapsibleListViewer}(React.Component),typeMapper=function(){var _ref;return(_ref={})[COLLAPSIBLE_LIST_TYPE]={component:CollapsibleListViewer},_ref};exports.COLLAPSIBLE_LIST_TYPE=COLLAPSIBLE_LIST_TYPE,exports.collapsibleListTypeMapper=typeMapper,exports.pluginCollapsibleList=function(config){return{config:_extends__default.default({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,typeMapper:typeMapper}};
//# sourceMappingURL=module.viewer.cjs.js.map

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

import _extends from"@babel/runtime/helpers/extends";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import classNames from"classnames";import{isEqual,includes,get,isFunction,isNumber,upperFirst,camelCase}from"lodash";import{addAnchorTagToUrl,anchorScroll,validate,mergeStyles,GlobalContext,isSSR}from"wix-rich-content-common";import{WIX_MEDIA_DEFAULT,isPNG,getImageSrc}from"wix-rich-content-common/libs/imageUtils";import pluginImageSchema from"wix-rich-content-common/dist/statics/schemas/plugin-image.schema.json";var IMAGE_TYPE="wix-draft-plugin-image",DEFAULTS=Object.freeze({config:{alignment:"center",size:"content",showTitle:!0,showDescription:!0}}),styles$1={fontElementMap:"_1hNZF",imageContainer:"_2kEVY",expandContainer:"-D6i8",expandIcon:"_2Lky3",pointer:"_2Ybje",imageWrapper:"_3WJnn",image:"OzAYt",imageOverlay:"_1b5Ar",imageCaption:"EilAw",imagePreload:"_3ii3f",imageHighres:"_3xs9_",onlyHighRes:"_1I_dK",image_loading:"_3aC9X"},expand=function(props){return React.createElement("svg",Object.assign({viewBox:"0 0 19 19",xmlns:"http://www.w3.org/2000/svg"},props),React.createElement("path",{d:"M15.071 8.371V4.585l-4.355 4.356a.2.2 0 0 1-.283 0l-.374-.374a.2.2 0 0 1 0-.283l4.356-4.355h-3.786a.2.2 0 0 1-.2-.2V3.2c0-.11.09-.2.2-.2H16v5.371a.2.2 0 0 1-.2.2h-.529a.2.2 0 0 1-.2-.2zm-6.5 6.9v.529a.2.2 0 0 1-.2.2H3v-5.371c0-.11.09-.2.2-.2h.529c.11 0 .2.09.2.2v3.786l4.355-4.356a.2.2 0 0 1 .283 0l.374.374a.2.2 0 0 1 0 .283L4.585 15.07h3.786c.11 0 .2.09.2.2z",fill:"#000",fillRule:"nonzero"}))},styles_inPluginInput="_1k3YS",InPluginInput=function(_Component){function InPluginInput(){var _this;return(_this=_Component.apply(this,arguments)||this).handleFocus=function(e){e.stopPropagation(),_this.props.setFocusToBlock(),_this.props.setInPluginEditingMode(!0)},_this.handleBlur=function(){return _this.props.setInPluginEditingMode(!1)},_this.handleKeyPress=function(e){var _this$props=_this.props,setFocusToBlock=_this$props.setFocusToBlock,value=_this$props.value;"Enter"===e.key&&setFocusToBlock&&""!==value&&(_this.handleBlur(),setFocusToBlock())},_this.onChange=function(e){var _this$props$onChange,_this$props2;return null===(_this$props$onChange=(_this$props2=_this.props).onChange)||void 0===_this$props$onChange?void 0:_this$props$onChange.call(_this$props2,e.target.value)},_this}return _inheritsLoose(InPluginInput,_Component),InPluginInput.prototype.render=function(){var className=classNames(styles_inPluginInput,this.props.className);return React.createElement("textarea",{className:className,value:this.props.value,onChange:this.onChange,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyPress:this.handleKeyPress,dir:"auto",rows:1})},InPluginInput}(Component);InPluginInput.defaultProps={setInPluginEditingMode:function(){return!1},setFocusToBlock:function(){return!1}};var ImageViewer=function(_React$Component){function ImageViewer(props){var _this;return(_this=_React$Component.call(this,props)||this).forceOnImageLoad=function(){var executionTimes=0,interval=setInterval((function(){var _this$imageRef,_this$imageRef$curren;null!==(_this$imageRef=_this.imageRef)&&void 0!==_this$imageRef&&null!==(_this$imageRef$curren=_this$imageRef.current)&&void 0!==_this$imageRef$curren&&_this$imageRef$curren.complete&&(_this.onImageLoad(_this.imageRef.current),clearInterval(interval)),10==++executionTimes&&clearInterval(interval)}),200)},_this.onImageLoadError=function(){var src=_this.props.componentData.src;src&&src.fallback&&_this.setState({fallbackImageSrc:{preload:src.fallback,highres:src.fallback}})},_this.renderImage=function(imageClassName,imageSrc,alt,props,isGif,onlyHighRes){var _classNames;return _this.getImage(classNames(imageClassName,_this.styles.imageHighres,((_classNames={})[_this.styles.onlyHighRes]=onlyHighRes,_classNames)),imageSrc.highres,alt,props,{fadeIn:!isGif,width:imageSrc.highresWidth,height:imageSrc.highresHeight})},_this.renderPreloadImage=function(imageClassName,imageSrc,alt,props){return _this.getImage(classNames(imageClassName,_this.styles.imagePreload),imageSrc.preload,alt,_extends({"aria-hidden":!0},props))},_this.onImageLoad=function(element){element.style.opacity=1,_this.preloadRef.current&&(_this.preloadRef.current.style.opacity="0")},_this.handleExpand=function(e){var _helpers$onViewerActi;e.preventDefault();var _this$props=_this.props,onExpand=_this$props.settings.onExpand,_this$props$helpers=_this$props.helpers,helpers=void 0===_this$props$helpers?{}:_this$props$helpers;null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,IMAGE_TYPE,"Click","expand_image"),_this.hasExpand()&&(null==onExpand||onExpand(_this.props.blockKey))},_this.scrollToAnchor=function(e){var _this$props2=_this.props,_this$props2$componen=_this$props2.componentData.config.link,anchor=(_this$props2$componen=void 0===_this$props2$componen?{}:_this$props2$componen).anchor,customAnchorScroll=_this$props2.customAnchorScroll;if(customAnchorScroll)customAnchorScroll(e,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);addAnchorTagToUrl(anchorString),anchorScroll(element,_this.context.experiments)}},_this.hasLink=function(){var _this$props$component,_this$props$component2,_this$props$component3;return null===(_this$props$component=_this.props.componentData)||void 0===_this$props$component||null===(_this$props$component2=_this$props$component.config)||void 0===_this$props$component2||null===(_this$props$component3=_this$props$component2.link)||void 0===_this$props$component3?void 0:_this$props$component3.url},_this.hasAnchor=function(){var _this$props$component4,_this$props$component5,_this$props$component6;return null===(_this$props$component4=_this.props.componentData)||void 0===_this$props$component4||null===(_this$props$component5=_this$props$component4.config)||void 0===_this$props$component5||null===(_this$props$component6=_this$props$component5.link)||void 0===_this$props$component6?void 0:_this$props$component6.anchor},_this.onKeyDown=function(e){"Enter"!==e.key&&" "!==e.key||_this.props.getInPluginEditingMode||_this.handleClick(e)},_this.handleClick=function(e){if(_this.hasLink())return null;_this.hasAnchor()?(e.preventDefault(),e.stopPropagation(),_this.scrollToAnchor(e)):_this.handleExpand(e)},_this.handleRef=function(e){_this.state.container||_this.setState({container:e})},_this.handleContextMenu=function(e){var _this$props$component7=_this.props.componentData.disableDownload;return void 0!==_this$props$component7&&_this$props$component7&&e.preventDefault()},_this.hasExpand=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableExpand=!1;return void 0!==componentData.disableExpand?disableExpand=componentData.disableExpand:void 0!==settings.disableExpand&&(disableExpand=settings.disableExpand),!disableExpand&&settings.onExpand},_this.renderExpandIcon=function(){return React.createElement("div",{className:_this.styles.expandContainer},React.createElement(expand,{className:_this.styles.expandIcon,onClick:_this.handleExpand}))},validate(props.componentData,pluginImageSchema),_this.state={},_this.preloadRef=React.createRef(),_this.imageRef=React.createRef(),_this}_inheritsLoose(ImageViewer,_React$Component);var _proto=ImageViewer.prototype;return _proto.componentDidMount=function(){this.setState({ssrDone:!0}),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&this.forceOnImageLoad()},_proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginImageSchema)},_proto.calculateHeight=function(width,src){return void 0===width&&(width=1),src&&src.height&&src.width?Math.ceil(src.height/src.width*width):WIX_MEDIA_DEFAULT.SIZE},_proto.getImageDataUrl=function(){return this.props.dataUrl?{preload:this.props.dataUrl,highres:this.props.dataUrl}:null},_proto.getImageUrl=function(src){var _this$context$experim,_this$context$experim2,_this2=this,_ref=this.props||{},helpers=_ref.helpers,seoMode=_ref.seoMode;if(!src&&null!=helpers&&helpers.handleFileSelection)return null;var requiredWidth,requiredHeight,removeUsm=null===(_this$context$experim=this.context.experiments)||void 0===_this$context$experim||null===(_this$context$experim2=_this$context$experim.removeUsmFromImageUrls)||void 0===_this$context$experim2?void 0:_this$context$experim2.enabled,imageUrl={preload:"",highres:""},imageSrcOpts={};if(!this.props.isMobile&&!isPNG(src)){var _this$props$component8=this.props.componentData.config,alignment=(_this$props$component8=void 0===_this$props$component8?{}:_this$props$component8).alignment,width=_this$props$component8.width;imageSrcOpts=_extends({removeUsm:removeUsm,imageType:"quailtyPreload"},("left"===alignment||"right"===alignment)&&!width&&{requiredWidth:300})}if(imageUrl.preload=getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,imageSrcOpts),seoMode)requiredWidth=(null==src?void 0:src.width)&&Math.min(src.width,1e3),requiredHeight=this.calculateHeight(1e3,src);else if(this.state.container){var _getImageDimensions=function(width,isMobile){var requiredHeight,requiredWidth=width||1;return isMobile&&!isSSR()&&(requiredWidth*=window.devicePixelRatio,requiredWidth*=window.screen.width/document.body.clientWidth),requiredHeight=_this2.calculateHeight(requiredWidth,src),[requiredWidth=Math.ceil(requiredWidth),requiredHeight=Math.ceil(requiredHeight)]}(this.state.container.getBoundingClientRect().width||(null==src?void 0:src.width),this.props.isMobile);requiredWidth=_getImageDimensions[0],requiredHeight=_getImageDimensions[1]}return imageUrl.highres=getImageSrc(src,null==helpers?void 0:helpers.getImageUrl,{removeUsm:removeUsm,requiredWidth:requiredWidth,requiredHeight:requiredHeight,requiredQuality:90,imageType:"highRes"}),!this.state.ssrDone||imageUrl.preload||this.props.isLoading||console.error("image plugin mounted with invalid image source!",src),imageUrl},_proto.getImage=function(imageClassNames,src,alt,props,opts){var _this$context$experim3,_this3=this;void 0===opts&&(opts={});var _opts=opts,_opts$fadeIn=_opts.fadeIn,fadeIn=void 0!==_opts$fadeIn&&_opts$fadeIn,width=_opts.width,height=_opts.height,loading=null!==(_this$context$experim3=this.context.experiments.lazyImagesAndIframes)&&void 0!==_this$context$experim3&&_this$context$experim3.enabled?"lazy":void 0;return React.createElement("img",Object.assign({},props,{className:imageClassNames,src:src,alt:alt,onError:this.onImageLoadError,onLoad:fadeIn?function(e){return _this3.onImageLoad(e.target)}:void 0,ref:fadeIn?this.imageRef:this.preloadRef,width:width,height:height,loading:loading}))},_proto.renderTitle=function(data,styles){return!!(data.config||{}).showTitle&&React.createElement("div",{className:classNames(styles.imageTitle)},data&&data.title||"")},_proto.renderDescription=function(data,styles){return!!(data.config||{}).showDescription&&React.createElement("div",{className:classNames(styles.imageDescription)},data&&data.description||"")},_proto.renderCaption=function(caption){var _this$props4=this.props,onCaptionChange=_this$props4.onCaptionChange,setFocusToBlock=_this$props4.setFocusToBlock,setInPluginEditingMode=_this$props4.setInPluginEditingMode,_this$styles=this.styles,imageCaption=_this$styles.imageCaption,link=_this$styles.link,classes=classNames(imageCaption,this.hasLink()&&link);return onCaptionChange?React.createElement(InPluginInput,{setInPluginEditingMode:setInPluginEditingMode,className:classes,value:caption,onChange:onCaptionChange,setFocusToBlock:setFocusToBlock}):React.createElement("span",{dir:"auto",className:classes},caption)},_proto.shouldRenderCaption=function(){var _componentData$metada,_this$props5=this.props,getInPluginEditingMode=_this$props5.getInPluginEditingMode,settings=_this$props5.settings,componentData=_this$props5.componentData,defaultCaption=_this$props5.defaultCaption,caption=null===(_componentData$metada=componentData.metadata)||void 0===_componentData$metada?void 0:_componentData$metada.caption;if(includes(get(settings,"toolbar.hidden"),"settings"))return!1;if(void 0===caption||""===caption&&(null==getInPluginEditingMode||!getInPluginEditingMode())||caption===defaultCaption)return!1;var data=componentData||DEFAULTS;return"original"!==data.config.size||!data.src||!data.src.width||data.src.width>=350},_proto.render=function(){var _classNames2,_imageSrc$highres,_imageSrc$highres$end;this.styles=this.styles||mergeStyles({styles:styles$1,theme:this.props.theme});var _this$props6=this.props,componentData=_this$props6.componentData,className=_this$props6.className,settings=_this$props6.settings,setComponentUrl=_this$props6.setComponentUrl,seoMode=_this$props6.seoMode,_this$state=this.state,fallbackImageSrc=_this$state.fallbackImageSrc,ssrDone=_this$state.ssrDone,data=componentData||DEFAULTS,metadata=componentData.metadata;metadata||(metadata={});var itemClassName=classNames(this.styles.imageWrapper,className,((_classNames2={})[this.styles.pointer]=this.hasExpand(),_classNames2)),imageClassName=this.styles.image,imageSrc=fallbackImageSrc||this.getImageDataUrl()||this.getImageUrl(data.src),imageProps={};data.src&&settings&&settings.imageProps&&(imageProps=isFunction(settings.imageProps)?settings.imageProps(data.src):settings.imageProps);var isGif=null==imageSrc||null===(_imageSrc$highres=imageSrc.highres)||void 0===_imageSrc$highres||null===(_imageSrc$highres$end=_imageSrc$highres.endsWith)||void 0===_imageSrc$highres$end?void 0:_imageSrc$highres$end.call(_imageSrc$highres,".gif");null==setComponentUrl||setComponentUrl(null==imageSrc?void 0:imageSrc.highres);var shouldRenderPreloadImage=!seoMode&&imageSrc&&!isGif,shouldRenderImage=imageSrc&&(seoMode||ssrDone)||isGif,accesibilityProps=!this.hasLink()&&{role:"button",tabIndex:0},onlyHiRes=seoMode||isGif;return React.createElement("div",Object.assign({"data-hook":"imageViewer",className:this.styles.imageContainer,ref:this.handleRef,onContextMenu:this.handleContextMenu,onKeyDown:this.onKeyDown},accesibilityProps),React.createElement("div",{className:itemClassName,"aria-label":metadata.alt,onClick:this.handleClick,onKeyDown:this.onKeyDown},shouldRenderPreloadImage&&this.renderPreloadImage(imageClassName,imageSrc,metadata.alt,imageProps),shouldRenderImage&&this.renderImage(imageClassName,imageSrc,metadata.alt,imageProps,isGif,onlyHiRes),this.hasExpand()&&this.renderExpandIcon()),this.renderTitle(data,this.styles),this.renderDescription(data,this.styles),this.shouldRenderCaption()&&this.renderCaption(metadata.caption))},ImageViewer}(React.Component);ImageViewer.contextType=GlobalContext;var shouldDisableStyles=function(componentData,isMobile){var _ref=componentData.config||{},size=_ref.size,width=_ref.width;return!("inline"===size&&isNumber(width)&&width<=150)&&isMobile},imageRenderDescriptor={component:ImageViewer,classNameStrategies:{size:function(componentData,theme,styles,isMobile){var size=(componentData.config||{}).size;return!size||isMobile&&"original"===size?"":shouldDisableStyles(componentData,isMobile)?classNames(styles.sizeFullWidth,theme.sizeFullWidth):classNames(styles["size"+upperFirst(camelCase(size))],theme["size"+upperFirst(camelCase(size))])},alignment:function(componentData,theme,styles,isMobile){var _ref2=componentData.config||{},alignment=_ref2.alignment,size=_ref2.size;if(!alignment||shouldDisableStyles(componentData,isMobile)&&"original"!==size)return"";var align=alignment;if("original"===size&&"center"!==alignment){var width=(componentData.src||{}).width;isNumber(width)&&width>350&&(align="center")}return classNames(styles["align"+upperFirst(align)],theme["align"+upperFirst(align)])}}},typeMapper=function(){var _ref;return(_ref={}).IMAGE=imageRenderDescriptor,_ref[IMAGE_TYPE]=imageRenderDescriptor,_ref},pluginImage=function(config){return{config:_extends({},DEFAULTS.config,config),type:IMAGE_TYPE,typeMapper:typeMapper}};export{IMAGE_TYPE,typeMapper as imageTypeMapper,pluginImage};
import _extends from"@babel/runtime/helpers/extends";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import{anchorScroll,mergeStyles,GlobalContext,generateKey}from"wix-rich-content-common";import classNames from"classnames";var ArrowIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},props),React.createElement("g",{fillRule:"evenodd"},React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"M11.999 9L6 14.241 6.657 15 11.999 10.334 17.343 15 18 14.241z",transform:"translate(-129 -185) translate(97 105) translate(23 71) rotate(-90 21 12) matrix(1 0 0 -1 0 24)"})))))))},styles$1={ltr:"E6y_Z",rtl:"_2wLEl",iconContainer:"_21s0b",icon:"_2z8L4",isExpanded:"aPvla"};function ExpandCollapseButton(props){var onClick=props.onClick,idx=props.idx,ariaLabel=props.ariaLabel;return React.createElement("div",{role:"button",tabIndex:"-1",className:styles$1.iconContainer,onClick:onClick,onKeyUp:function(e){return(" "===e.key||"Enter"===e.key)&&onClick(e)},"data-hook":"ExpandCollapseButton_"+idx},React.createElement(ArrowIcon,{role:"button",tabIndex:"0","aria-label":ariaLabel,className:classNames(styles$1.icon,props.isExpanded&&styles$1.isExpanded)}))}var styles={titleContainer:"_3LwlN",title:"_3CwVy",content:"_3TxVS"},COLLAPSIBLE_LIST_TYPE="wix-rich-content-plugin-collapsible-list",CollapsibleListPair=function(_Component){function CollapsibleListPair(props){var _this;(_this=_Component.call(this,props)||this).focusTitle=function(){var _this$titleEditorRef$;return null===(_this$titleEditorRef$=_this.titleEditorRef.current)||void 0===_this$titleEditorRef$?void 0:_this$titleEditorRef$.focus()},_this.renderTitle=function(){var _this$props=_this.props,idx=_this$props.idx,renderTitle=_this$props.renderTitle;return React.createElement("div",{className:_this.styles.title},renderTitle(idx,_this.titleEditorRef))},_this.focusContent=function(){var _this$contentEditorRe;return null===(_this$contentEditorRe=_this.contentEditorRef.current)||void 0===_this$contentEditorRe?void 0:_this$contentEditorRe.focus()},_this.renderContent=function(){var _this$props2=_this.props,idx=_this$props2.idx,renderContent=_this$props2.renderContent;return _this$props2.isExpanded&&React.createElement("div",{className:_this.styles.content},renderContent(idx,_this.contentEditorRef))},_this.onClick=function(e){var _helpers$onViewerActi,_this$props3=_this.props,isExpanded=_this$props3.isExpanded,onCollapseClick=_this$props3.onCollapseClick,onExpandClick=_this$props3.onExpandClick,idx=_this$props3.idx,helpers=_this$props3.helpers,isInEditor=_this$props3.isInEditor;isExpanded?onCollapseClick(idx):onExpandClick(idx),null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,COLLAPSIBLE_LIST_TYPE,"Click",isExpanded?"collapse":"expand"),isInEditor||(e.preventDefault(),setTimeout((function(){return anchorScroll(_this.pairRef,_this.context.experiments)})))},_this.onKeyDown=function(e){"a"===e.key&&(e.ctrlKey||e.metaKey)&&e.stopPropagation()};var theme=props.theme;return _this.styles=mergeStyles({styles:styles,theme:theme}),_this.titleEditorRef=React.createRef(),_this.contentEditorRef=React.createRef(),_this.pairRef=React.createRef(),_this}return _inheritsLoose(CollapsibleListPair,_Component),CollapsibleListPair.prototype.render=function(){var _this2=this,_this$props4=this.props,isExpanded=_this$props4.isExpanded,idx=_this$props4.idx,t=_this$props4.t;return React.createElement(React.Fragment,null,React.createElement("div",{className:this.styles.titleContainer,onKeyDown:this.onKeyDown,ref:function(_ref){return _this2.pairRef=_ref}},React.createElement(ExpandCollapseButton,{isExpanded:isExpanded,onClick:this.onClick,idx:idx,ariaLabel:t(isExpanded?"CollapsibleListPlugin_ExpandButton_AriaLabel":"CollapsibleListPlugin_CollapseButton_AriaLabel")}),this.renderTitle()),this.renderContent())},CollapsibleListPair}(Component);CollapsibleListPair.contextType=GlobalContext;var DEFAULTS=Object.freeze({config:{expandState:"first_expanded",expandOnlyOne:!1},pairs:[{key:generateKey()}]}),getPairsAllCollpased=function(pairs){return pairs.map((function(){return!1}))},getDefaultPairsState=function(pairs,defaultPairsExpandState){var pairsState="expanded"===defaultPairsExpandState?function(pairs){return pairs.map((function(){return!0}))}(pairs):getPairsAllCollpased(pairs);return"first_expanded"===defaultPairsExpandState&&(pairsState[0]=!0),pairsState},CollapsibleListPairs=function(_Component){function CollapsibleListPairs(props){var _this;return(_this=_Component.call(this,props)||this).focusPair=function(_ref){var idx=_ref.idx,isTitle=_ref.isTitle,pair=_this.pairsRefs[idx];isTitle?null==pair||pair.focusTitle():(null==pair?void 0:pair.focusContent())||null==pair||pair.focusTitle()},_this.expandPair=function(idx){var _this$props=_this.props,pairs=_this$props.pairs,expandOnlyOne=_this$props.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairs)),pairsState[idx]=!0,_this.setState({pairsState:pairsState})},_this.collapsePair=function(idx){var pairsState=[].concat(_this.state.pairsState);pairsState[idx]=!1,_this.setState({pairsState:pairsState})},_this.insertNewPair=function(){var expandOnlyOne=_this.state.expandOnlyOne,pairsState=_this.state.pairsState;expandOnlyOne&&(pairsState=getPairsAllCollpased(pairsState)),pairsState=[].concat(pairsState,[!0]),_this.setState({pairsState:pairsState})},_this.deletePair=function(idx){var pairsState=_this.state.pairsState;pairsState.splice(idx,1),_this.setState({pairsState:pairsState})},_this.reorderPairs=function(startIdx,endIdx){var pairsState=_this.state.pairsState,pairToMove=pairsState.splice(startIdx,1)[0];pairsState.splice(endIdx,0,pairToMove),_this.setState({pairsState:pairsState})},_this.pairsRefs=[],_this.state=_this.initState(props),_this}_inheritsLoose(CollapsibleListPairs,_Component);var _proto=CollapsibleListPairs.prototype;return _proto.initState=function(props){var pairs=props.pairs,expandState=props.expandState;return{defaultPairsExpandState:expandState,expandOnlyOne:props.expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}},CollapsibleListPairs.getDerivedStateFromProps=function(props,state){var pairs=props.pairs,expandState=props.expandState,expandOnlyOne=props.expandOnlyOne;return state.defaultPairsExpandState!==expandState||expandOnlyOne&&expandOnlyOne!==state.expandOnlyOne?{defaultPairsExpandState:expandState,expandOnlyOne:expandOnlyOne,pairsState:getDefaultPairsState(pairs,expandState)}:null},_proto.render=function(){var _this2=this,_this$props2=this.props,pairs=_this$props2.pairs,PairWrapper=_this$props2.PairWrapper,t=_this$props2.t,theme=_this$props2.theme,renderTitle=_this$props2.renderTitle,renderContent=_this$props2.renderContent,helpers=_this$props2.helpers,isInEditor=_this$props2.isInEditor,pairsState=this.state.pairsState;return pairs.map((function(pair,idx){return React.createElement(PairWrapper,{key:pair.key,id:pair.key,index:idx},React.createElement(CollapsibleListPair,{ref:function(_ref2){return _this2.pairsRefs[idx]=_ref2},t:t,key:pair.key,idx:idx,isExpanded:pairsState[idx],onCollapseClick:_this2.collapsePair,onExpandClick:_this2.expandPair,theme:theme,renderTitle:renderTitle,renderContent:renderContent,helpers:helpers,isInEditor:isInEditor}))}))},CollapsibleListPairs}(Component);CollapsibleListPairs.defaultProps={PairWrapper:"div"};var CollapsibleListViewer=function(_Component){function CollapsibleListViewer(props){var _this;(_this=_Component.call(this,props)||this).getPair=function(idx){return _this.props.componentData.pairs[idx]},_this.renderInnerRCV=function(contentState){var _this$props=_this.props,innerRCV=_this$props.innerRCV,componentData=_this$props.componentData;return innerRCV({contentState:contentState,textAlignment:function(componentData){return"ltr"===componentData.config.direction?"left":"right"}(componentData),direction:function(componentData){return componentData.config.direction}(componentData)})},_this.renderTitle=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.title)},_this.renderContent=function(idx){var pair=_this.getPair(idx);return _this.renderInnerRCV(pair.content)};var theme=props.theme;return _this.styles=mergeStyles({styles:styles$1,theme:theme}),_this}return _inheritsLoose(CollapsibleListViewer,_Component),CollapsibleListViewer.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,t=_this$props2.t,componentData=_this$props2.componentData,isMobile=_this$props2.isMobile,helpers=_this$props2.helpers,config=componentData.config,pairs=componentData.pairs,direction=config.direction,expandState=config.expandState,expandOnlyOne=config.expandOnlyOne;return React.createElement("div",{className:this.styles[direction]},React.createElement(CollapsibleListPairs,{theme:theme,t:t,isMobile:isMobile,pairs:pairs,expandState:expandState,expandOnlyOne:expandOnlyOne,renderTitle:this.renderTitle,renderContent:this.renderContent,helpers:helpers}))},CollapsibleListViewer}(Component),typeMapper=function(){var _ref;return(_ref={})[COLLAPSIBLE_LIST_TYPE]={component:CollapsibleListViewer},_ref},pluginCollapsibleList=function(config){return{config:_extends({},DEFAULTS.config,config),type:COLLAPSIBLE_LIST_TYPE,typeMapper:typeMapper}};export{COLLAPSIBLE_LIST_TYPE,typeMapper as collapsibleListTypeMapper,pluginCollapsibleList};
//# sourceMappingURL=module.viewer.js.map

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

import { ImagePluginEditorConfig } from './types';
import { CollapsibleListPluginEditorConfig } from './types';
import { EditorPluginCreator } from 'wix-rich-content-common';
export declare const pluginImage: EditorPluginCreator<ImagePluginEditorConfig>;
export declare const pluginCollapsibleList: EditorPluginCreator<CollapsibleListPluginEditorConfig>;
//# sourceMappingURL=editor.d.ts.map
export { default as InsertPluginIcon } from './InsertPluginIcon';
export { default as MediaReplaceIcon } from './MediaReplaceIcon';
export { default as ImageEditorIcon } from './ImageEditorIcon';
export { default as ArrowIcon } from './ArrowIcon';
export { default as PlusIcon } from './PlusIcon';
export { default as DndIcon } from './DndIcon';
//# sourceMappingURL=index.d.ts.map

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

export { createImagePlugin } from './createImagePlugin';
export { default as ImageViewer } from './image-viewer';
export { IMAGE_TYPE_LEGACY, IMAGE_TYPE } from './types';
export { createCollapsibleListPlugin } from './createCollapsibleListPlugin';
export { default as collapsibleListViewer } from './collapsible-list-viewer';
export { COLLAPSIBLE_LIST_TYPE } from './types';
export { Modals, ModalsMap } from './modals';
export { pluginImage } from './editor';
export { Component as ImageComponent } from './image-component';
export { pluginCollapsibleList } from './editor';
//# sourceMappingURL=index.d.ts.map

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

import ImageSettingsModal from './toolbar/image-settings';
import ImageEditorModal from './imageStudio/image-editor';
import CollapsibleListModal from './components/modal-components/CollapsibleListModal';
declare const Modals: {
IMAGE_SETTINGS: string;
IMAGE_EDITOR: string;
COLLAPSIBLE_LIST_MODAL: string;
};
declare const ModalsMap: {
[x: string]: typeof ImageSettingsModal | typeof ImageEditorModal;
[x: string]: typeof CollapsibleListModal;
};
export { Modals, ModalsMap };
//# sourceMappingURL=modals.d.ts.map
import { EditorPluginConfig, ViewerPluginConfig } from 'wix-rich-content-common';
export declare const IMAGE_TYPE = "wix-draft-plugin-image";
export declare const IMAGE_TYPE_LEGACY = "IMAGE";
export declare type ImageEditorWixSettings = {
initiator: string;
siteToken: string;
metaSiteId: string;
mediaRoot: string;
};
export interface ImageConfig {
size?: string;
alignment?: string;
showTitle?: boolean;
showDescription?: boolean;
link?: {
anchor: unknown;
url: string;
};
width?: number;
export declare const COLLAPSIBLE_LIST_TYPE = "wix-rich-content-plugin-collapsible-list";
export interface CollapsibleListPluginEditorConfig extends EditorPluginConfig {
[key: string]: any;
}
export interface ImagePluginEditorConfig extends EditorPluginConfig, ImageConfig {
export interface CollapsibleListPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
spoiler?: {
buttonContent: string | undefined;
description: string | undefined;
enabled: boolean | undefined;
};
defaultData?: {
config?: ImageConfig;
disableExpand?: boolean;
};
imageProps?: HTMLImageElement;
createGalleryForMultipleImages?: boolean;
imageEditor?: boolean;
consumer?: string;
imageEditorWixSettings?: ImageEditorWixSettings;
onImageEditorOpen?: () => void;
}
declare type ImageSrc = Record<string, unknown>;
export interface ImagePluginViewerConfig extends ViewerPluginConfig, ImageConfig {
onExpand?: (blockkey: string) => unknown;
disableExpand?: boolean;
imageProps?: ((src: ImageSrc) => HTMLImageElement) | HTMLImageElement;
}
export interface ImageData {
config: ImageConfig;
src: {
fallback: string;
width: number;
};
metadata?: {
caption?: unknown;
alt?: string | undefined;
};
[key: string]: unknown;
disableDownload?: boolean;
disableExpand?: boolean;
}
export {};
//# sourceMappingURL=types.d.ts.map
import { typeMapper } from './typeMapper-loadable';
import { IMAGE_TYPE, ImagePluginViewerConfig } from './types';
import { COLLAPSIBLE_LIST_TYPE, CollapsibleListPluginViewerConfig } from './types';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { typeMapper as imageTypeMapper, IMAGE_TYPE };
export declare const pluginImage: ViewerPluginCreator<ImagePluginViewerConfig>;
export { COLLAPSIBLE_LIST_TYPE, typeMapper as collapsibleListTypeMapper };
export declare const pluginCollapsibleList: ViewerPluginCreator<CollapsibleListPluginViewerConfig>;
//# sourceMappingURL=viewer-loadable.d.ts.map
import { typeMapper } from './typeMapper';
import { IMAGE_TYPE, ImagePluginViewerConfig } from './types';
import { COLLAPSIBLE_LIST_TYPE, CollapsibleListPluginViewerConfig } from './types';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { typeMapper as imageTypeMapper, IMAGE_TYPE };
export declare const pluginImage: ViewerPluginCreator<ImagePluginViewerConfig>;
export { COLLAPSIBLE_LIST_TYPE, typeMapper as collapsibleListTypeMapper };
export declare const pluginCollapsibleList: ViewerPluginCreator<CollapsibleListPluginViewerConfig>;
//# sourceMappingURL=viewer.d.ts.map

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

{"name":"richlagetest","version":"0.0.0-1c3a1503548c1b834eb069a652d8d16a95bb5690"}
{"name":"richlagetest","version":"0.0.0-230982fa614383ea3540c69c2696628caf960803"}

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