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-00f8dddc44fd82f2d21396aebcac5d11f74a298c to 0.0.0-2a4e8015935e3f676a45994de210472c6a11a441

dist/src/components/Anchor.d.ts

4

dist/module.cjs.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),lodash=require("lodash");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),styles_toolbar="_2M9cT",styles_button="_1lTtq",getSelectionRects=function(selection){var range=selection.getRangeAt(0),innerRects=function(range){for(var _iterator=document.createNodeIterator(range.commonAncestorContainer,NodeFilter.SHOW_ALL),innerSelectionNodes=[];_iterator.nextNode()&&_iterator.referenceNode!==range.startContainer;);for(;_iterator.nextNode()&&_iterator.referenceNode!==range.endContainer;)_iterator.referenceNode.nodeType===Node.TEXT_NODE&&innerSelectionNodes.push(_iterator.referenceNode);return innerSelectionNodes}(range).map((function(n){var r=document.createRange();return r.selectNodeContents(n),r.getBoundingClientRect()})),clientRects=range.getClientRects();return[clientRects[0]].concat(innerRects,[clientRects[clientRects.length-1]])};function addTextSelectionListener(container,callback){var handleSelection=function(){var selectedText,position,selection=document.getSelection(),selectionAnchor=null==selection?void 0:selection.anchorNode,selectionFocus=null==selection?void 0:selection.focusNode;selection&&selection.rangeCount>0&&!selection.isCollapsed&&container.contains(selectionAnchor)&&container.contains(selectionFocus)&&(selectedText=function(selection){return selection.toString().replace(/(\r\n|\r|\n){2,}/g," ")}(selection),position=function(selection){var rects=getSelectionRects(selection),left=999999,right=0;rects.forEach((function(rect){left=Math.min(left,rect.left),right=Math.max(right,rect.right)}));var y=rects[0].top+window.scrollY;return{x:(left+right)/2+window.scrollX,y:y}}(selection)),callback(selectedText,position)};return document.addEventListener("selectionchange",handleSelection),function(){return document.removeEventListener("selectionchange",handleSelection)}}var TextSelectionToolbar=function(_React$Component){function TextSelectionToolbar(props){var _this;return(_this=_React$Component.call(this,props)||this).addTextSelectionListener=function(container){container&&!_this.removeTextSelectionListener&&(_this.removeTextSelectionListener=addTextSelectionListener(container,_this.setSelectedText))},_this.setSelectedText=lodash.debounce((function(selectedText,selectedTextPosition){return _this.setState({selectedText:selectedText,selectedTextPosition:selectedTextPosition})}),50),_this.state={selectedText:""},_this}_inheritsLoose__default.default(TextSelectionToolbar,_React$Component);var _proto=TextSelectionToolbar.prototype;return _proto.componentDidMount=function(){this.addTextSelectionListener(this.props.container)},_proto.componentWillUnmount=function(){this.removeTextSelectionListener()},_proto.componentWillReceiveProps=function(nextPros){this.addTextSelectionListener(nextPros.container)},_proto.render=function(){var _this$state=this.state,selectedText=_this$state.selectedText,selectedTextPosition=_this$state.selectedTextPosition,_this$props=this.props,container=_this$props.container,children=_this$props.children;if(!selectedText||!selectedTextPosition)return null;var left=container.getBoundingClientRect().left,containerOffset=this.props.container.getBoundingClientRect().top,style={top:selectedTextPosition.y-containerOffset-5-window.scrollY,left:selectedTextPosition.x-left};return React__default.default.createElement("div",{className:styles_toolbar,style:style},children(selectedText))},TextSelectionToolbar}(React__default.default.Component),twitter=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("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.653 4.268c.854-.52 1.493-1.336 1.8-2.297-.804.483-1.683.825-2.6 1.01-1.153-1.245-2.939-1.65-4.506-1.023-1.566.627-2.597 2.16-2.6 3.867.001.318.037.636.106.946-3.298-.168-6.37-1.748-8.453-4.346-.37.633-.563 1.355-.56 2.09-.117 1.34.452 2.647 1.507 3.463C1.608 7.87.88 7.696.173 7.458v.052c.142 2.038 1.63 3.717 3.614 4.077-.298.098-.608.147-.92.146-.233.001-.466-.024-.694-.074.55 1.699 2.103 2.858 3.867 2.888-1.446 1.158-3.237 1.786-5.08 1.78-.32 0-.641-.02-.96-.058 3.593 2.332 8.156 2.492 11.9.417 3.744-2.076 6.073-6.056 6.073-10.381 0-.18-.013-.36-.013-.54.801-.588 1.492-1.316 2.04-2.15-.745.336-1.536.556-2.347.653z"}))};exports.TextSelectionToolbar=TextSelectionToolbar,exports.TwitterButton=function(_ref){var selectedText=_ref.selectedText,onClick=_ref.onClick,handleOnClick=function(selectedText){null==onClick||onClick(selectedText),function(selectedText){var text="“"+selectedText+"“—",url=window.location.href;text.length+url.length>279&&(text=function(text,maxTextLength){var content=text.substring(0,maxTextLength-2);return(content=content.slice(0,content.lastIndexOf(" ")))+"…“—"}(text,279-url.length));var TWEET_ON_TWITTER_URL="https://twitter.com/intent/tweet?text="+encodeURI(text)+"&url="+encodeURI(url);window.open(TWEET_ON_TWITTER_URL)}(selectedText)};return React__default.default.createElement("button",{"data-hook":"twitter-button",className:styles_button,onClick:function(){return handleOnClick(selectedText)}},React__default.default.createElement(twitter,null))};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),englishResources=require("wix-rich-content-common/dist/statics/viewer/locale/messages_en.json"),wixRichContentCommon=require("wix-rich-content-common"),_extends=require("@babel/runtime/helpers/extends"),classNames=require("classnames"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),require$$0=require("punycode"),lodash=require("lodash"),deprecateHelpers=require("wix-rich-content-common/libs/deprecateHelpers");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(k){if("default"!==k){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:!0,get:function(){return e[k]}})}})),n.default=e,Object.freeze(n)}var _inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),englishResources__default=_interopDefaultLegacy(englishResources),_extends__default=_interopDefaultLegacy(_extends),classNames__default=_interopDefaultLegacy(classNames),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),require$$0__default=_interopDefaultLegacy(require$$0),draftDefaultStyles_renderedInTable="n4Axb";function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}function createCommonjsModule(fn){var module={exports:{}};return fn(module,module.exports),module.exports}var arrayEqual=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(arr1,arr2){if(arr1.length!==arr2.length)return!1;for(var i=0;i<arr1.length;i++)if(arr1[i]!==arr2[i])return!1;return!0};exports.default=_default})),ContentNode_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_arrayEqual=(obj=arrayEqual)&&obj.__esModule?obj:{default:obj};function _toArray(arr){return function(arr){if(Array.isArray(arr))return arr}(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}var _default=function(){function ContentNode(props){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,ContentNode),this.content=props.content||[],this.start=void 0!==props.start?props.start:null,this.end=void 0!==props.end?props.end:null,this.entity=void 0!==props.entity?props.entity:null,this.decorator=void 0!==props.decorator?props.decorator:null,this.decoratorProps=props.decoratorProps||null,this.decoratedText=void 0!==props.decoratedText?props.decoratedText:null,this.contentState=props.contentState,this.style=props.style||null,this.styles=props.styles||null,this.block=props.block||{}}var Constructor,protoProps,staticProps;return Constructor=ContentNode,(protoProps=[{key:"getCurrentContent",value:function(){return this.content[this.content.length-1]}},{key:"addToCurrentContent",value:function(string){this.content[this.content.length-1]=this.content[this.content.length-1]+string}},{key:"handleFlatPush",value:function(string,stack){var current=this.getCurrentContent();if(current instanceof ContentNode&&(0,_arrayEqual.default)(stack,current.styles))current.addToCurrentContent(string);else{var newNode=new ContentNode({styles:_toConsumableArray(stack),content:[string]});this.content.push(newNode)}}},{key:"pushContent",value:function(string){var stack=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],flat=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!stack||stack.length<1)return"string"==typeof string&&"string"==typeof this.getCurrentContent()?this.addToCurrentContent(string):this.content.push(string),this;if(flat)return this.handleFlatPush(string,stack),this;var _stack=_toArray(stack),head=_stack[0],rest=_stack.slice(1),current=this.getCurrentContent();if(current instanceof ContentNode&&current.style===head)current.pushContent(string,rest,flat);else{var newNode=new ContentNode({style:head});newNode.pushContent(string,rest,flat),this.content.push(newNode)}return this}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),ContentNode}();exports.default=_default})),RawParser_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _punycode=_interopRequireDefault(require$$0__default.default),_ContentNode=_interopRequireDefault(ContentNode_1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}(arr)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}var getString=function(array,from,to){return _punycode.default.ucs2.encode(array.slice(from,to))};function addIndexes(indexes,ranges){return ranges.forEach((function(range){indexes.push(range.offset),indexes.push(range.offset+range.length)})),indexes}var RawParser=function(){function RawParser(_ref){var _ref$flat=_ref.flat,flat=void 0!==_ref$flat&&_ref$flat;!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,RawParser),this.flat=flat}var Constructor,protoProps,staticProps;return Constructor=RawParser,(protoProps=[{key:"relevantStyles",value:function(offset){return this.ranges.filter((function(range){return offset>=range.offset&&offset<range.offset+range.length})).map((function(style){return style.style}))}},{key:"nodeIterator",value:function(node,start,end){var _this=this,indexes=this.relevantIndexes.slice(this.relevantIndexes.indexOf(start),this.relevantIndexes.indexOf(end));return indexes.forEach((function(index,key){var characterStyles=_this.relevantStyles(index),distance=indexes[key+1]?indexes[key+1]-index:1,text=getString(_this.textArray,index,index+distance);node.pushContent(text,characterStyles,_this.flat),!indexes[key+1]&&index<end&&node.pushContent(getString(_this.textArray,index+1,end),_this.relevantStyles(end-1),_this.flat)})),node}},{key:"parse",value:function(block){var _this2=this,text=block.text,ranges=block.inlineStyleRanges,entityRanges=block.entityRanges,_block$decoratorRange=block.decoratorRanges,decoratorRanges=void 0===_block$decoratorRange?[]:_block$decoratorRange;this.textArray=_punycode.default.ucs2.decode(text),this.ranges=ranges,this.iterator=0,this.relevantIndexes=function(text,inlineRanges){var entityRanges=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],decoratorRanges=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],relevantIndexes=[];return relevantIndexes=addIndexes(relevantIndexes,inlineRanges),relevantIndexes=addIndexes(relevantIndexes,entityRanges),(relevantIndexes=addIndexes(relevantIndexes,decoratorRanges)).push(0),relevantIndexes.push(text.length),relevantIndexes.filter((function(value,index,self){return self.indexOf(value)===index})).sort((function(aa,bb){return aa-bb}))}(text,ranges,entityRanges,decoratorRanges);var parsedNodes=function(entityRanges){var decoratorRanges=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],textArray=arguments.length>2?arguments[2]:void 0,block=arguments.length>3?arguments[3]:void 0,lastIndex=0,mergedRanges=[].concat(_toConsumableArray(entityRanges),_toConsumableArray(decoratorRanges)).sort((function(a,b){return a.offset-b.offset})),nodes=[];return mergedRanges.length<1?(nodes.push(new _ContentNode.default({block:block,start:0,end:textArray.length})),nodes):(mergedRanges.forEach((function(range){range.offset>lastIndex&&nodes.push(new _ContentNode.default({block:block,start:lastIndex,end:range.offset})),nodes.push(new _ContentNode.default({block:block,entity:range.key,decorator:range.component,decoratorProps:range.decoratorProps,decoratedText:range.component?getString(textArray,range.offset,range.offset+range.length):void 0,start:range.offset,end:range.offset+range.length,contentState:range.contentState})),lastIndex=range.offset+range.length})),lastIndex<textArray.length&&nodes.push(new _ContentNode.default({block:block,start:lastIndex,end:textArray.length})),nodes)}(entityRanges,decoratorRanges,this.textArray,block).map((function(node){return _this2.nodeIterator(node,node.start,node.end)}));return new _ContentNode.default({block:block,content:parsedNodes})}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),RawParser}();exports.default=RawParser})),createStyleRenderer_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(wrapper,stylesMap){return function(children,styleArray,params){var style=function(styleArray,stylesMap){return styleArray.map((function(style){return stylesMap[style]})).reduce((function(prev,next){var mergedStyles={};if(void 0!==next){var key="text-decoration"in next?"text-decoration":"textDecoration";next[key]!==prev[key]&&(mergedStyles[key]=[prev[key],next[key]].join(" ").trim())}return Object.assign(prev,next,mergedStyles)}),{})}(styleArray,stylesMap);return wrapper(Object.assign({},{children:children},params,{style:style}))}};exports.default=_default})),createBlockRenderer_1=createCommonjsModule((function(module,exports){function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}(arr)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var getKey=function(_ref,key){var keys=_ref.keys;return key||(keys?keys.join(","):void 0)},getBlock=function(element,wrapper,withDepth){return function(children,properties,key){var props=Object.assign({},properties);return withDepth||delete props.depth,wrapper.apply(void 0,[element,Object.assign({},props,{key:getKey(props,key)})].concat(_toConsumableArray(children)))}},_default=function(callback,blockMap){var renderer={};return Object.keys(blockMap).forEach((function(item){var block=blockMap[item];block.wrapper?renderer[item]=function(children,props,key){return function(callback,block,_ref2){var children=_ref2.children,props=_ref2.props,key=_ref2.key,wrapperBlockFn=getBlock(block.wrapper,callback),blockFn=getBlock(block.element,callback,!0);return wrapperBlockFn(children.map((function(child,ii){return blockFn(child,{},props.keys&&props.keys[ii])})),props,key)}(callback,block,{children:children,props:props,key:key})}:renderer[item]=getBlock(block.element,callback)})),renderer};exports.default=_default})),warn_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(msg){};exports.default=_default})),checkCleanup_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(block,prevType,_ref2){var cleanup=_ref2.cleanup;return!(!cleanup||function(block,options){return text=block.text,!!(options.trim?text.trim():text)||!(!block.data||!Object.keys(block.data).length)||!(!block.entityRanges||!block.entityRanges.length);var text}(block,cleanup))&&(!(cleanup.after&&"all"!==cleanup.after&&!cleanup.after.includes(prevType))&&(!(!cleanup.except||cleanup.except.includes(block.type))||!(!cleanup.types||"all"!==cleanup.types&&!cleanup.types.includes(block.type))))};exports.default=_default})),getKeyGenerator_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(){var key=0;return function(){var current=key;return key+=1,current}};exports.default=_default})),checkJoin_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(input,options){return Array.isArray(input)&&options.joinOutput?input.join(""):input};exports.default=_default})),pushString_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(string,array,index){var tempArray=array;return array[index]?tempArray[index]+=string:tempArray[index]=string,tempArray};exports.default=_default})),defaultOptions_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default={joinOutput:!1,cleanup:{after:["atomic"],types:["unstyled"],trim:!1,split:!0}};exports.default=_default})),CompositeDecorator=createCommonjsModule((function(module,exports){function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(){function CompositeDraftDecorator(decorators){var obj,key,value;!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,CompositeDraftDecorator),value=void 0,(key="decorators")in(obj=this)?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,this.decorators=decorators.slice()}var Constructor,protoProps,staticProps;return Constructor=CompositeDraftDecorator,(protoProps=[{key:"getDecorations",value:function(block,contentState){var decorations=Array(block.getText().length).fill(null);return this.decorators.forEach((function(decorator,ii){var counter=0;(0,decorator.strategy)(block,(function(start,end){(function(decorations,start,end){for(var ii=start;ii<end;ii++)if(null!=decorations[ii])return!1;return!0})(decorations,start,end)&&(function(targetArr,start,end,componentKey){for(var ii=start;ii<end;ii++)targetArr[ii]=componentKey}(decorations,start,end,ii+"."+counter),counter++)}),contentState)})),decorations}},{key:"getComponentForKey",value:function(key){var componentKey=parseInt(key.split(".")[0],10);return this.decorators[componentKey].component}},{key:"getPropsForKey",value:function(key){var componentKey=parseInt(key.split(".")[0],10);return this.decorators[componentKey].props}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),CompositeDraftDecorator}();exports.default=_default})),MultiDecorator_1=createCommonjsModule((function(module,exports){function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(){function MultiDecorator(decorators){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,MultiDecorator),this.decorators=decorators}var Constructor,protoProps,staticProps;return Constructor=MultiDecorator,staticProps=[{key:"getInnerKey",value:function(key){return key.split("-").slice(1).join("-")}}],(protoProps=[{key:"getDecorations",value:function(block,contentState){var decorations=new Array(block.getText().length).fill(null);return this.decorators.forEach((function(decorator,i){decorator.getDecorations(block,contentState).forEach((function(key,offset){key&&(decorations[offset]=i+"-"+key)}))})),decorations}},{key:"getComponentForKey",value:function(key){return this.getDecoratorForKey(key).getComponentForKey(MultiDecorator.getInnerKey(key))}},{key:"getPropsForKey",value:function(key){return this.getDecoratorForKey(key).getPropsForKey(MultiDecorator.getInnerKey(key))}},{key:"getDecoratorForKey",value:function(key){var parts=key.split("-"),index=Number(parts[0]);return this.decorators[index]}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),MultiDecorator}();exports.default=_default})),stubContentBlock_1=createCommonjsModule((function(module,exports){function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var ContentBlockStub=function(){function ContentBlockStub(block){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,ContentBlockStub),Object.assign(this,block)}var Constructor,protoProps,staticProps;return Constructor=ContentBlockStub,(protoProps=[{key:"get",value:function(name){return this[name]}},{key:"getText",value:function(){return this.text}},{key:"getType",value:function(){return this.type}},{key:"getKey",value:function(){return this.key}},{key:"getLength",value:function(){return this.text.length}},{key:"getDepth",value:function(){return this.depth}},{key:"getData",value:function(){return this.data}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),ContentBlockStub}(),_default=function(block){return new ContentBlockStub(block)};exports.default=_default})),withDecorators_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _punycode=_interopRequireDefault(require$$0__default.default),_CompositeDecorator=_interopRequireDefault(CompositeDecorator),_MultiDecorator=_interopRequireDefault(MultiDecorator_1),_stubContentBlock=_interopRequireDefault(stubContentBlock_1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}(arr)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}var offsetRanges=function(ranges,block){return ranges.forEach((function(range){var pre=block.text.substring(0,range.offset),decorated=block.text.substring(range.offset,range.offset+range.length);range.offset=_punycode.default.ucs2.decode(pre).length,range.length=_punycode.default.ucs2.decode(decorated).length})),ranges},decoratorIsCustom=function(decorator){return"function"==typeof decorator.getDecorations&&"function"==typeof decorator.getComponentForKey&&"function"==typeof decorator.getPropsForKey},decorateBlock=function(block,decorators,contentState,_ref){var createContentBlock=_ref.createContentBlock,decoratorRanges=[],decorator=function(decorators){var compositeDecorator=new _CompositeDecorator.default(decorators.filter((function(decorator){return!decoratorIsCustom(decorator)}))),customDecorators=decorators.filter((function(decorator){return decoratorIsCustom(decorator)})),decor=[].concat(_toConsumableArray(customDecorators),[compositeDecorator]);return new _MultiDecorator.default(decor)}(decorators),contentBlock=createContentBlock?createContentBlock(block):(0,_stubContentBlock.default)(block),decorations=decorator.getDecorations(contentBlock,contentState),offset=0;return decorations.forEach((function(key,index){if(key){var nextIndex=index+1,next=decorations[nextIndex];next&&next===key||(decoratorRanges.push({offset:offset,length:nextIndex-offset,component:decorator.getComponentForKey(key),decoratorProps:decorator.getPropsForKey(key)||{},contentState:contentState}),offset=nextIndex)}else offset+=1})),Object.assign({},block,{decoratorRanges:offsetRanges(decoratorRanges,block)})},_default=function(raw,decorators,options){var contentState=options.convertFromRaw&&options.convertFromRaw(raw);return raw.blocks.map((function(block){return decorateBlock(block,decorators,contentState,options||{})}))};exports.default=_default})),render_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.render=exports.renderNode=void 0;var _RawParser=_interopRequireDefault(RawParser_1),_warn=_interopRequireDefault(warn_1),_checkCleanup=_interopRequireDefault(checkCleanup_1),_getKeyGenerator=_interopRequireDefault(getKeyGenerator_1),_checkJoin=_interopRequireDefault(checkJoin_1),_pushString=_interopRequireDefault(pushString_1),_defaultOptions=_interopRequireDefault(defaultOptions_1),_withDecorators=_interopRequireDefault(withDecorators_1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var renderNode=function renderNode(node,inlineRenderers,entityRenderers,styleRenderers,entityMap,options,keyGenerator){if(node.styles&&styleRenderers)return styleRenderers((0,_checkJoin.default)(node.content,options),node.styles,{key:keyGenerator()});var children=[],index=0;if(node.content.forEach((function(part){"string"==typeof part?children=(0,_pushString.default)(part,children,index):(children[index+=1]=renderNode(part,inlineRenderers,entityRenderers,styleRenderers,entityMap,options,keyGenerator),index+=1)})),node.style&&inlineRenderers[node.style])return inlineRenderers[node.style]((0,_checkJoin.default)(children,options),{key:keyGenerator()});if(null!==node.entity){var entity=entityMap[node.entity],entityRenderer=entity&&(entityRenderers[entity.type]||"atomic"===node.block.type&&entityRenderers.atomicFallbackRenderer);if(entityRenderer)return entityRenderer((0,_checkJoin.default)(children,options),entity.data,{key:node.entity,block:node.block},entity.type)}if(null!==node.decorator){var decoratorOffsetKey=[node.block.key,node.start,0].join(".");return node.decorator(Object.assign({children:(0,_checkJoin.default)(children,options),decoratedText:node.decoratedText,contentState:node.contentState,entityKey:node.entity,offsetKey:decoratorOffsetKey,key:decoratorOffsetKey},node.decoratorProps))}return children};exports.renderNode=renderNode;var byDepth=function(blocks){var group=[],depthStack=[],prevDepth=0,unwind=function(targetDepth){var i=prevDepth-targetDepth;for(depthStack.length<i&&(i=depthStack.length);i>0;i-=1){var tmp=group;(group=depthStack.pop())[group.length-1].children=tmp}};return blocks.forEach((function(block){prevDepth<block.depth?(depthStack.push(group),group=[]):prevDepth>block.depth&&unwind(block.depth),prevDepth=block.depth,group.push(block)})),0!==prevDepth&&unwind(0),group},renderGroup=function(group,blockRenderers,rendered,params){var type=params.prevType,depth=params.prevDepth,keys=params.prevKeys,data=params.prevData;if(0!==group.length){if(blockRenderers[type]){var props={depth:depth,keys:keys};return data&&data.some((function(item){return!!item}))&&(props.data=data),void rendered.push(blockRenderers[type](group,props))}rendered.push(group)}},renderBlocks=function renderBlocks(blocks){var inlineRenderers=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},blockRenderers=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},entityRenderers=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},stylesRenderer=arguments.length>4?arguments[4]:void 0,entityMap=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},userOptions=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},options=Object.assign({},_defaultOptions.default,userOptions),rendered=[],group=[],prevType=null,prevDepth=0,prevKeys=[],prevData=[],splitGroup=!1,Parser=new _RawParser.default({flat:!!stylesRenderer});return blocks.forEach((function(block){if((0,_checkCleanup.default)(block,prevType,options))!0===options.cleanup.split&&(splitGroup=!0);else{var node=Parser.parse(block),renderedNode=renderNode(node,inlineRenderers,entityRenderers,stylesRenderer,entityMap,options,(0,_getKeyGenerator.default)());if((prevType&&prevType!==block.type||splitGroup)&&(renderGroup(group,blockRenderers,rendered,{prevType:prevType,prevDepth:prevDepth,prevKeys:prevKeys,prevData:prevData}),prevData=[],prevKeys=[],group=[],splitGroup=!1),block.children){var children=renderBlocks(block.children,inlineRenderers,blockRenderers,entityRenderers,stylesRenderer,entityMap,options);renderedNode.push(children)}group.push(renderedNode),prevType=block.type,prevDepth=block.depth,prevKeys.push(block.key),prevData.push(block.data)}})),renderGroup(group,blockRenderers,rendered,{prevType:prevType,prevDepth:prevDepth,prevKeys:prevKeys,prevData:prevData}),(0,_checkJoin.default)(rendered,options)};exports.render=function(raw){var renderers=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!raw||!Array.isArray(raw.blocks))return(0,_warn.default)("invalid raw object"),null;if(!raw.blocks.length)return null;var inlineRenderers=renderers.inline,blockRenderers=renderers.blocks,entityRenderers=renderers.entities,stylesRenderer=renderers.styles,decorators=renderers.decorators,blocksWithDecorators=decorators?(0,_withDecorators.default)(raw,decorators,options):raw.blocks,blocks=byDepth(blocksWithDecorators);return renderBlocks(blocks,inlineRenderers,blockRenderers,entityRenderers,stylesRenderer,raw.entityMap,options)}})),redraft=getDefaultExportFromCjs(createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"RawParser",{enumerable:!0,get:function(){return _RawParser.default}}),Object.defineProperty(exports,"createStylesRenderer",{enumerable:!0,get:function(){return _createStyleRenderer.default}}),Object.defineProperty(exports,"createBlockRenderer",{enumerable:!0,get:function(){return _createBlockRenderer.default}}),Object.defineProperty(exports,"renderNode",{enumerable:!0,get:function(){return render_1.renderNode}}),Object.defineProperty(exports,"CompositeDecorator",{enumerable:!0,get:function(){return _CompositeDecorator.default}}),exports.default=void 0;var _RawParser=_interopRequireDefault(RawParser_1),_createStyleRenderer=_interopRequireDefault(createStyleRenderer_1),_createBlockRenderer=_interopRequireDefault(createBlockRenderer_1),_CompositeDecorator=_interopRequireDefault(CompositeDecorator);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=render_1.render;exports.default=_default}))),kebabToCamelObjectKeys=function(obj){return void 0===obj&&(obj={}),Object.keys(obj).reduce((function(result,key){var s;return result[(s=key,s.replace(/-([a-z])/,(function(_,p1){return p1.toUpperCase()})))]=obj[key],result}),{})},hasText=function hasText(child){return!!child&&("string"==typeof child?child.trim().length>0:Array.isArray(child)?hasText(child[0])||hasText(child[1]):"object"==typeof child&&hasText(child.props.children))},getPaywallSeoClass=function(_ref,blockIndex){var _ref$className=_ref.className,className=void 0===_ref$className?"paywall":_ref$className,_ref$index=_ref.index;return blockIndex<(void 0===_ref$index?3:_ref$index)&&className},isPaywallSeo=function(seoMode){return"object"==typeof seoMode&&"object"==typeof seoMode.paywall},viewerStyles={fontElementMap:"_27i2k",wrapper:"kvdbP",pluginContainerMobile:"_3iGUk",desktop:"_1O7aH",editor:"_1hN1O",android:"_23La5",atomic:"_2vd5k",toolbar:"_3j-bQ",underline:"_3zM-5",block:"_3RIlU",elementSpacing:"_1j-51",blockStyleSpacing:"_3Dd1B",text:"mm8Nw _1j-51",child:"_2PHJq",orderedList:"_2ULPL",unorderedList:"_3Kjjs",center:"_37Oe5",contentCenterAlignment:"_3LGTx",justify:"_78FBa",quote:"_3cMZT _3Dd1B",headerOne:"_3qzEG _1j-51",headerTwo:"eSWI6 _1j-51",headerThree:"_3qMKZ _1j-51",headerFour:"_2TrLF _1j-51",headerFive:"_1zZGG _1j-51",headerSix:"_1joqJ _1j-51",code:"_3-Hex _3Dd1B",codeBlock:"_3M8UJ _3Dd1B",renderedInTable:"_3sj65",normalText:"_3iu3e",anchor:"_3mt3E",embed:"_1-N88",horizontalScrollbar:"_34Kbu",overrideLinkColor:"_2nl-9"},combineMappers=function(mappers){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return mappers&&mappers.length&&!mappers.some((function(resolver){return"function"!=typeof resolver}))?mappers.reduce((function(map,mapper){return Object.assign(map,mapper.apply(void 0,args))}),{}):(console.warn(mappers+" is expected to be a function array"),{})},DefaultInteractionWrapper=function(_ref){return _ref.children},withInteraction=function(element,interactions,context){var _config$PREVIEW,_config$PREVIEW$conte,config=context.config;if(null===(_config$PREVIEW=config.PREVIEW)||void 0===_config$PREVIEW||null===(_config$PREVIEW$conte=_config$PREVIEW.contentInteractionMappers)||void 0===_config$PREVIEW$conte||!_config$PREVIEW$conte.length||!config.PREVIEW.onPreviewExpand||!lodash.isArray(interactions))return element;var BlockInteractionWrapper=function(_ref2){var interactions=_ref2.interactions,context=_ref2.context;return function(_ref3){var children=_ref3.children,_ref4=context.config.PREVIEW||{},_ref4$contentInteract=_ref4.contentInteractionMappers,contentInteractionMappers=void 0===_ref4$contentInteract?[]:_ref4$contentInteract,_ref4$onPreviewExpand=_ref4.onPreviewExpand,interactionMap=combineMappers(contentInteractionMappers,void 0===_ref4$onPreviewExpand?function(){}:_ref4$onPreviewExpand);return interactions.reduce((function(child,_ref5){var type=_ref5.type,settings=_ref5.settings,Interaction=interactionMap[type]||DefaultInteractionWrapper;return React__default.default.createElement(Interaction,_extends__default.default({},settings,context),child)}),children)}}({interactions:interactions,context:context});return React__default.default.createElement(BlockInteractionWrapper,null,element)},draftPublic="public-DraftStyleDefault",getBlockClassName=function(isNewList,direction,listType,depth){var className=function(listType,depth,textDirection){return draftPublic+"-"+listType+"ListItem\n "+draftPublic+"-depth"+depth+"\n "+draftPublic+"-list-"+textDirection}(listType,depth,direction);return isNewList&&(className+=" "+draftPublic+"-reset"),className},List=function(_ref){var ordered=_ref.ordered,items=_ref.items,mergedStyles=_ref.mergedStyles,textDirection=_ref.textDirection,blockProps=_ref.blockProps,getBlockStyleClasses=_ref.getBlockStyleClasses,blockDataToStyle=_ref.blockDataToStyle,context=_ref.context,Component=ordered?"ol":"ul",listType=ordered?"ordered":"unordered",containerClassName=draftPublic+"-"+Component,listItemTypeClassName=listType+"List",prevDepth=0;return React__default.default.createElement(Component,{className:containerClassName},items.map((function(children,childIndex){var dataEntry=blockProps.data.length>childIndex?blockProps.data[childIndex]:{},interactions=blockProps.data[childIndex].interactions,paragraphGroup=[],result=[],alignment=(null==dataEntry?void 0:dataEntry.textAlignment)||context.textAlignment,textClassName=getBlockStyleClasses(mergedStyles,textDirection||dataEntry.textDirection,alignment),hasJustifyText="justify"===alignment&&hasText(children),elementProps=function(key){var _classNames;return{className:classNames__default.default(mergedStyles.elementSpacing,textClassName,(_classNames={},_classNames[viewerStyles.hasJustifyText]=hasJustifyText,_classNames[viewerStyles.contentCenterAlignment]="center"===alignment,_classNames)),key:key}};React__default.default.Children.forEach(children,(function(child,i){child&&("string"==typeof child.type&&/h\d/.exec(child.type)?(paragraphGroup.length&&(result.push(React__default.default.createElement("p",elementProps(i),paragraphGroup)),paragraphGroup=[]),result.push(React__default.default.cloneElement(child,elementProps(i)))):paragraphGroup.push(child))})),paragraphGroup.length&&result.push(React__default.default.createElement("p",elementProps("just_some_key"),paragraphGroup));var depth=dataEntry.depth,isNewList=0===childIndex||depth>prevDepth,listItemDirection=wixRichContentCommon.getDirectionFromAlignmentAndTextDirection(alignment,textDirection||dataEntry.textDirection),className=getBlockClassName(isNewList,listItemDirection,listType,depth);prevDepth=depth;var blockIndex=dataEntry.index,wrappedBlock=withInteraction(0===result.length?" ":result,interactions,context);return React__default.default.createElement("li",{id:"viewer-"+blockProps.keys[childIndex],className:classNames__default.default(context.theme[listItemTypeClassName],viewerStyles[listItemTypeClassName],viewerStyles[alignment],getBlockStyleClasses(mergedStyles,listItemDirection,alignment,className,!0),isPaywallSeo(context.seoMode)&&getPaywallSeoClass(context.seoMode.paywall,blockIndex)),key:blockProps.keys[childIndex],style:blockDataToStyle(blockProps.data[childIndex])},wrappedBlock)})))},Anchor=React__default.default.memo((function(_ref){var anchorKey=_ref.anchorKey,type=_ref.type;return React__default.default.createElement("div",{key:anchorKey,type:type,"data-hook":anchorKey})})),PluginViewer=function(_PureComponent){function PluginViewer(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_PureComponent.call.apply(_PureComponent,[this].concat(args))||this).getContainerClassNames=function(){var _classNames,_this$props=_this.props,pluginComponent=_this$props.pluginComponent,componentData=_this$props.componentData,styles=_this$props.styles,_this$props$context=_this$props.context,theme=_this$props$context.theme,isMobile=_this$props$context.isMobile;_this$props.type;var _ref=pluginComponent.classNameStrategies||{},size=_ref.size,alignment=_ref.alignment,textWrap=_ref.textWrap,custom=_ref.custom,hasLink=_this.componentHasLink(),html=componentData.html;return classNames__default.default(styles.pluginContainerReadOnly,((_classNames={})[styles.pluginContainerMobile]=isMobile,_classNames[styles.anchor]=hasLink,_classNames[theme.anchor]=hasLink&&theme.anchor,_classNames[styles.embed]=hasLink&&html,_classNames[styles.horizontalScrollbar]=pluginComponent.withHorizontalScroll,_classNames),lodash.isFunction(alignment)?alignment(componentData,theme,styles,isMobile):wixRichContentCommon.alignmentClassName(componentData,theme,styles,isMobile),lodash.isFunction(size)?size(componentData,theme,styles,isMobile):wixRichContentCommon.sizeClassName(componentData,theme,styles,isMobile),lodash.isFunction(textWrap)?textWrap(componentData,theme,styles,isMobile):wixRichContentCommon.textWrapClassName(componentData,theme,styles,isMobile),lodash.isFunction(custom)?custom(componentData,theme,styles,isMobile):null)},_this.componentHasLink=function(){var _this$props2,_this$props2$componen,_this$props2$componen2,_this$props2$componen3;return null===(_this$props2=_this.props)||void 0===_this$props2||null===(_this$props2$componen=_this$props2.componentData)||void 0===_this$props2$componen||null===(_this$props2$componen2=_this$props2$componen.config)||void 0===_this$props2$componen2||null===(_this$props2$componen3=_this$props2$componen2.link)||void 0===_this$props2$componen3?void 0:_this$props2$componen3.url},_this.componentHasAnchor=function(){var _this$props3,_this$props3$componen,_this$props3$componen2,_this$props3$componen3;return null===(_this$props3=_this.props)||void 0===_this$props3||null===(_this$props3$componen=_this$props3.componentData)||void 0===_this$props3$componen||null===(_this$props3$componen2=_this$props3$componen.config)||void 0===_this$props3$componen2||null===(_this$props3$componen3=_this$props3$componen2.link)||void 0===_this$props3$componen3?void 0:_this$props3$componen3.anchor},_this.innerRCV=function(_ref2){var contentState=_ref2.contentState,textAlignment=_ref2.textAlignment,direction=_ref2.direction,renderedIn=_ref2.renderedIn,innerRCEViewerProps=_this.props.innerRCEViewerProps,renderedInTable=renderedIn===wixRichContentCommon.TABLE_TYPE;return React__default.default.createElement(RichContentViewer,_extends__default.default({initialState:contentState,textAlignment:textAlignment,direction:direction},innerRCEViewerProps,{isInnerRcv:!0,renderedInTable:renderedInTable}))},_this}return _inheritsLoose__default.default(PluginViewer,_PureComponent),PluginViewer.prototype.render=function(){var _this$props4=this.props,id=_this$props4.id,type=_this$props4.type,pluginComponent=_this$props4.pluginComponent,componentData=_this$props4.componentData,children=_this$props4.children,styles=_this$props4.styles,entityIndex=_this$props4.entityIndex,context=_this$props4.context,blockIndex=_this$props4.blockIndex,SpoilerViewerWrapper=_this$props4.SpoilerViewerWrapper,blockKey=_this$props4.blockKey,Component=pluginComponent.component,elementType=pluginComponent.elementType,container=(pluginComponent.classNameStrategies||{}).container,anchorTarget=context.anchorTarget,config=context.config,theme=context.theme,isMobile=context.isMobile,settings=(null==config?void 0:config[type])||{},componentProps=_extends__default.default({type:type,componentData:componentData,settings:settings,children:children,entityIndex:entityIndex},context,{innerRCV:this.innerRCV,blockKey:blockKey});if(Component){if("inline"!==elementType){var _containerProps,_containerProps$style,customStyles,_componentData$config=componentData.config,_config=void 0===_componentData$config?{}:_componentData$config,hasLink=this.componentHasLink(),hasAnchor=this.componentHasAnchor(),ContainerElement=hasLink||hasAnchor?"a":"div",containerProps={};if(hasLink){var _config$link=_config.link,url=_config$link.url,_config$link$target=_config$link.target,target=void 0===_config$link$target?anchorTarget:_config$link$target,rel=_config$link.rel;containerProps={href:wixRichContentCommon.normalizeUrl(url),target:target,rel:wixRichContentCommon.getRelValue(rel)}}if(hasAnchor)containerProps={href:"#viewer-"+_config.link.anchor,target:"_self"};if("inline"!==_config.size&&type!==wixRichContentCommon.HTML_TYPE&&type!==wixRichContentCommon.MAP_TYPE||(customStyles={width:_config.width}),type===wixRichContentCommon.IMAGE_TYPE){var _componentData$src=componentData.src,src=void 0===_componentData$src?{}:_componentData$src,size=_config.size;src.width&&("original"===size||isMobile&&"inline"===size&&_config.width&&_config.width>150)&&(customStyles={width:src.width,maxWidth:"100%"})}type!==wixRichContentCommon.ACTION_BUTTON_TYPE&&type!==wixRichContentCommon.LINK_BUTTON_TYPE||!lodash.isNumber(_config.width)||(componentProps.style={width:_config.width}),customStyles&&(containerProps.style=customStyles);var ContainerClassName=this.getContainerClassNames(),ContainerComponent=React__default.default.createElement(ContainerElement,_extends__default.default({className:ContainerClassName},containerProps),lodash.isFunction(container)?React__default.default.createElement("div",{className:container(theme)},React__default.default.createElement(Component,componentProps)):React__default.default.createElement(Component,componentProps));return React__default.default.createElement("div",{id:id,className:classNames__default.default(styles.atomic,isPaywallSeo(context.seoMode)&&getPaywallSeoClass(context.seoMode.paywall,blockIndex))},SpoilerViewerWrapper?React__default.default.createElement(SpoilerViewerWrapper,_extends__default.default({},componentProps,{className:ContainerClassName,width:null===(_containerProps=containerProps)||void 0===_containerProps||null===(_containerProps$style=_containerProps.style)||void 0===_containerProps$style?void 0:_containerProps$style.width}),ContainerComponent):ContainerComponent)}return SpoilerViewerWrapper?React__default.default.createElement(SpoilerViewerWrapper,componentProps,React__default.default.createElement(Component,componentProps)):React__default.default.createElement(Component,componentProps)}return null},PluginViewer}(React.PureComponent);PluginViewer.defaultProps={styles:{}};var textColorInlineStyleMapper=wixRichContentCommon.getDynamicInlineStyleMapper(wixRichContentCommon.RICOS_TEXT_COLOR_TYPE),textHighlightInlineStyleMapper=wixRichContentCommon.getDynamicInlineStyleMapper(wixRichContentCommon.RICOS_TEXT_HIGHLIGHT_TYPE),fontSizeInlineStyleMapper=wixRichContentCommon.getDynamicInlineStyleMapper(wixRichContentCommon.RICOS_FONT_SIZE_TYPE),staticInlineStyleMapper=function(mergedStyles){return{BOLD:function(children,_ref){var key=_ref.key;return React__default.default.createElement("strong",{key:key},children)},ITALIC:function(children,_ref2){var key=_ref2.key;return React__default.default.createElement("em",{key:key},children)},UNDERLINE:function(children,_ref3){var key=_ref3.key;return React__default.default.createElement("u",{key:key,className:mergedStyles.underline},children)},CODE:function(children,_ref4){var key=_ref4.key;return React__default.default.createElement("span",{key:key,className:mergedStyles.code},children)},NOT_BOLD:function(children,_ref5){var key=_ref5.key;return React__default.default.createElement("span",{style:{fontWeight:"normal"},key:key},children)},NOT_ITALIC:function(children,_ref6){var key=_ref6.key;return React__default.default.createElement("span",{style:{fontStyle:"normal"},key:key},children)}}},_excluded=["addAnchors"],isEmptyBlock=function(_ref){_ref[0];var data=_ref[1];return data&&0===data.length},getBlockStyleClasses=function(mergedStyles,textDirection,textAlignment,classes,isListItem){var rtl="rtl"===textDirection,alignmentClass=textAlignment||(rtl?"right":"left"),directionClass=(isListItem?rtl:"ltr"!==(textDirection||"ltr"))?mergedStyles.rtl:mergedStyles.ltr;return classNames__default.default(classes,directionClass,mergedStyles[alignmentClass])},blockDataToStyle=function(_ref2){var dynamicStyles=_ref2.dynamicStyles;return kebabToCamelObjectKeys(dynamicStyles)},getInline=function(contentState,config,inlineStyleMappers,mergedStyles){return combineMappers([].concat(inlineStyleMappers,function(contentState,config){return[staticInlineStyleMapper,fontSizeInlineStyleMapper({},contentState),textColorInlineStyleMapper(config,contentState),textHighlightInlineStyleMapper(config,contentState)]}(contentState,config)),mergedStyles)},getBlocks=function(mergedStyles,textDirection,context,addAnchorsPrefix,documentStyle){var getList=function(ordered){return function(items,blockProps){var fixedItems=items.map((function(item){return item.length?item:[" "]})),props={key:blockProps.keys[0],items:fixedItems,ordered:ordered,mergedStyles:mergedStyles,textDirection:textDirection,blockProps:blockProps,getBlockStyleClasses:getBlockStyleClasses,blockDataToStyle:blockDataToStyle,context:context};return React__default.default.createElement(List,Object.assign({},props))}},blockFactory=function(type,style){return function(children,blockProps){return children.map((function(child,i){var _blockProps$data$i,_blockProps$data$i2,_blockProps$data$i3,_blockProps$data$i4,alignment=(null===(_blockProps$data$i=blockProps.data[i])||void 0===_blockProps$data$i?void 0:_blockProps$data$i.textAlignment)||context.textAlignment,depth=blockProps.data[i].depth,blockDirection=wixRichContentCommon.getDirectionFromAlignmentAndTextDirection(alignment,textDirection||(null===(_blockProps$data$i2=blockProps.data[i])||void 0===_blockProps$data$i2?void 0:_blockProps$data$i2.textDirection)),hasJustifyText="justify"===alignment&&hasText(child),directionBlockClassName="public-DraftStyleDefault-text-"+blockDirection,directionTextClassName="public-DraftStyleDefault-"+(textDirection||(null===(_blockProps$data$i3=blockProps.data[i])||void 0===_blockProps$data$i3?void 0:_blockProps$data$i3.textDirection)||"ltr"),ChildTag="string"==typeof type?type:type(child),blockIndex=blockProps.data[i].index,interactions=blockProps.data[i].interactions,_child=isEmptyBlock(child)?React__default.default.createElement("br",{role:"presentation"}):child,nodeStyle=kebabToCamelObjectKeys(null==documentStyle?void 0:documentStyle["text"===style?"paragraph":style]),content=lodash.isEmpty(nodeStyle)?_child:React__default.default.createElement("span",{className:viewerStyles.overrideLinkColor,style:nodeStyle},_child),inner=React__default.default.createElement(React__default.default.Fragment,{key:blockProps.keys[i]},React__default.default.createElement(ChildTag,{id:"viewer-"+blockProps.keys[i],className:classNames__default.default(getBlockStyleClasses(mergedStyles,textDirection||(null===(_blockProps$data$i4=blockProps.data[i])||void 0===_blockProps$data$i4?void 0:_blockProps$data$i4.textDirection),alignment,mergedStyles[style]),wixRichContentCommon.depthClassName(depth),directionBlockClassName,isPaywallSeo(context.seoMode)&&getPaywallSeoClass(context.seoMode.paywall,blockIndex)),style:blockDataToStyle(blockProps.data[i])},React__default.default.createElement("span",{className:classNames__default.default(viewerStyles.child,directionTextClassName,hasJustifyText&&viewerStyles.hasJustifyText)},content))),wrappedBlock=withInteraction(inner,interactions,context),wrapperKey=blockProps.keys[i]+"_wrap",resultBlock=React__default.default.createElement(React__default.default.Fragment,{key:wrapperKey},wrappedBlock);if(addAnchorsPrefix){var anchorKey=""+addAnchorsPrefix+(blockIndex+1);resultBlock=React__default.default.createElement(React__default.default.Fragment,{key:wrapperKey},wrappedBlock,React__default.default.createElement(Anchor,{type:isEmptyBlock(child)?"empty-line":"string"==typeof type?type:"paragraph",key:anchorKey,anchorKey:anchorKey}))}return resultBlock}))}};return{unstyled:blockFactory((function(child){return isEmptyBlock(child)?"div":"p"}),"text"),blockquote:blockFactory("blockquote","quote"),"header-one":blockFactory("h1","headerOne"),"header-two":blockFactory("h2","headerTwo"),"header-three":blockFactory("h3","headerThree"),"header-four":blockFactory("h4","headerFour"),"header-five":blockFactory("h5","headerFive"),"header-six":blockFactory("h6","headerSix"),"code-block":blockFactory("pre","codeBlock"),"unordered-list-item":getList(!1),"ordered-list-item":getList(!0)}},getEntities=function(typeMappers,context,styles,addAnchorsPrefix,innerRCEViewerProps,SpoilerViewerWrapper){return _extends__default.default({EMOJI_TYPE:function(emojiUnicode,data,_ref3){var key=_ref3.key;return React__default.default.createElement("span",{key:key,style:{fontFamily:"cursive"}},emojiUnicode)}},function(SpoilerViewerWrapper,typeMappers,context,styles,addAnchorsPrefix,innerRCEViewerProps){var res={};return Object.keys(typeMappers).forEach((function(type,i){res[type]=function(children,entity,_ref4){var content,blockKey,anchorElement,key=_ref4.key,block=_ref4.block,pluginComponent=typeMappers[type],isInline="inline"===pluginComponent.elementType,interactions=entity.interactions,pluginViewer=React__default.default.createElement(PluginViewer,{id:"viewer-"+block.key,type:type,pluginComponent:pluginComponent,componentData:entity,entityIndex:key,context:context,styles:styles,blockIndex:(content=context.contentState,blockKey=block.key,content.blocks.findIndex((function(block){return block.key===blockKey}))),typeMap:typeMappers,innerRCEViewerProps:innerRCEViewerProps,SpoilerViewerWrapper:SpoilerViewerWrapper,withHorizontalScroll:!0,blockKey:block.key},isInline?children:null),wrappedPluginViewer=withInteraction(pluginViewer,interactions,context);if(addAnchorsPrefix&&!isInline){var anchorType=type.replace("wix-draft-plugin-","").toLowerCase(),anchorKey=""+addAnchorsPrefix+(block.data.index+1);anchorElement=React__default.default.createElement(Anchor,{type:anchorType,anchorKey:anchorKey})}return React__default.default.createElement(React__default.default.Fragment,{key:i+"_"+key},wrappedPluginViewer,anchorElement)}})),res}(SpoilerViewerWrapper,typeMappers,context,styles,addAnchorsPrefix,innerRCEViewerProps))},redraftOptions={cleanup:{after:wixRichContentCommon.BLOCK_TYPES.filter((function(t){return-1===t.indexOf("header")})),split:!0,except:["unordered-list-item","ordered-list-item","unstyled","header-one","header-two","header-three","header-four","header-five","header-six"]},convertFromRaw:function(contentState){return contentState}},convertToReact=function(mergedStyles,textDirection,typeMappers,context,decorators,inlineStyleMappers,config,initSpoilers,SpoilerViewerWrapper,options,innerRCEViewerProps,externalDocumentStyle){if(void 0===options&&(options={}),!(raw=context.contentState)||!raw.blocks||1===raw.blocks.length&&""===raw.blocks[0].text&&"unstyled"===raw.blocks[0].type)return null;var raw,contentState,_options=options,addAnchors=_options.addAnchors,restOptions=_objectWithoutPropertiesLoose__default.default(_options,_excluded),normalizedContentState=context.contentState?(contentState=context.contentState,_extends__default.default({},contentState,{blocks:contentState.blocks.map((function(block,index){if("atomic"===block.type)return _extends__default.default({},block,{data:{index:index}});var textDirection=wixRichContentCommon.getTextDirection(block.text),data=_extends__default.default({},block.data,{depth:block.depth,index:index},"rtl"===textDirection&&{textDirection:textDirection}),text=block.text;return lodash.endsWith(text,"\n")&&(text+="\n"),_extends__default.default({},block,{depth:0,data:data,text:text})}))})):context.contentState,newContentState=initSpoilers?initSpoilers(normalizedContentState):normalizedContentState,addAnchorsPrefix=addAnchors&&(!0===addAnchors?"rcv-block":addAnchors),documentStyle=externalDocumentStyle||(null==newContentState?void 0:newContentState.documentStyle),result=redraft(newContentState,{inline:getInline(newContentState,config,inlineStyleMappers,mergedStyles),blocks:getBlocks(mergedStyles,textDirection,context,addAnchorsPrefix,documentStyle),entities:getEntities(typeMappers,context,mergedStyles,addAnchorsPrefix,_extends__default.default({},innerRCEViewerProps,{documentStyle:documentStyle}),SpoilerViewerWrapper),decorators:decorators},_extends__default.default({},redraftOptions,restOptions));if(addAnchors){var firstAnchorKey=addAnchorsPrefix+"-first",lastAnchorKey=addAnchorsPrefix+"-last";result=React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(Anchor,{type:"first",anchorKey:firstAnchorKey}),result,React__default.default.createElement(Anchor,{type:"last",anchorKey:lastAnchorKey}))}return result},viewerAlignmentStyles={alignLeft:"_17-_F",textWrapNowrap:"_3OKLB",alignRight:"_3VL_9",alignCenter:"_3CWa-",sizeFullWidth:"_28A1_",renderedInTable:"erqrj",sizeContent:"_3mymk",sizeSmall:"_3vo3y",sizeSmallCenter:"_3fofE",flex:"_2orjS",left:"_3M0Fe",center:"_1oG79",right:"_2wn-L"},rtlStyle={rtl:"ZF7FS",ltr:"_1FoOD"},RichContentViewer=function(_Component){function RichContentViewer(props){var _this;(_this=_Component.call(this,props)||this).getContextualData=function(_ref,contentState){var _this$props$initialSt,_config$uiSettings,t=_ref.t,theme=_ref.theme,_ref$isMobile=_ref.isMobile,isMobile=void 0!==_ref$isMobile&&_ref$isMobile,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,customAnchorScroll=_ref.customAnchorScroll,config=_ref.config,_ref$helpers=_ref.helpers,helpers=void 0===_ref$helpers?{}:_ref$helpers,locale=_ref.locale,disabled=_ref.disabled,seoMode=_ref.seoMode,iframeSandboxDomain=_ref.iframeSandboxDomain,textAlignment=_ref.textAlignment;deprecateHelpers.deprecateHelpers(helpers,config);var version=wixRichContentCommon.Version.currentVersion,contentId=null===(_this$props$initialSt=_this.props.initialState)||void 0===_this$props$initialSt?void 0:_this$props$initialSt.ID;return{t:t,theme:theme,isMobile:isMobile,anchorTarget:anchorTarget,relValue:relValue,customAnchorScroll:customAnchorScroll,config:config,helpers:_extends__default.default({},helpers,{onViewerLoaded:function(args){var _helpers$onViewerLoad;return null===(_helpers$onViewerLoad=helpers.onViewerLoaded)||void 0===_helpers$onViewerLoad?void 0:_helpers$onViewerLoad.call(helpers,_extends__default.default({},args,{version:version,contentId:contentId}))},onViewerAction:function(pluginId,actionName,value){var _helpers$onViewerActi;return null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi?void 0:_helpers$onViewerActi.call(helpers,pluginId,actionName,value,contentId)}}),locale:locale,disabled:disabled,seoMode:seoMode,contentState:contentState,iframeSandboxDomain:iframeSandboxDomain,disableRightClick:null==config||null===(_config$uiSettings=config.uiSettings)||void 0===_config$uiSettings?void 0:_config$uiSettings.disableRightClick,textAlignment:textAlignment}};var styles=_extends__default.default({},viewerStyles,viewerAlignmentStyles,rtlStyle);_this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:props.theme}),_this.typeMappers=combineMappers(props.typeMappers);var _props$experiments=props.experiments,experiments=void 0===_props$experiments?{}:_props$experiments,_props$isMobile=props.isMobile,isMobile=void 0!==_props$isMobile&&_props$isMobile,t=props.t;return _this.state={context:{experiments:experiments,isMobile:isMobile,t:t}},_this}_inheritsLoose__default.default(RichContentViewer,_Component),RichContentViewer.getDerivedStateFromProps=function(props){return{raw:RichContentViewer.getInitialState(props)}},RichContentViewer.getDerivedStateFromError=function(error){return{error:error}};var _proto=RichContentViewer.prototype;return _proto.componentDidCatch=function(error,errorInfo){console.error({error:error,errorInfo:errorInfo})},_proto.componentDidMount=function(){this.reportDebuggingInfo()},_proto.reportDebuggingInfo=function(){var _this2=this;"undefined"!=typeof window&&/debug/i.test(window.location.search)&&!window.__RICOS_INFO__&&Promise.resolve().then((function(){return _interopNamespace(require(
/* webpackChunkName: "debugging-info" */
"wix-rich-content-common/libs/debugging-info"))})).then((function(_ref2){(0,_ref2.reportDebuggingInfo)({version:wixRichContentCommon.Version.currentVersion,reporter:"Rich Content Viewer",plugins:Object.keys(_this2.typeMappers),getContent:function(){return _this2.props.initialState},getConfig:function(){return _this2.props.config}})}))},_proto.render=function(){var _this$props=this.props,onError=_this$props.onError,_this$props$config=_this$props.config,config=void 0===_this$props$config?{}:_this$props$config,onHover=_this$props.onHover,isMobile=_this$props.isMobile,isInnerRcv=_this$props.isInnerRcv,textDirection=_this$props.textDirection,direction=_this$props.direction,inlineStyleMappers=_this$props.inlineStyleMappers,locale=_this$props.locale,addAnchors=_this$props.addAnchors,renderedInTable=_this$props.renderedInTable,platform=_this$props.platform,t=_this$props.t,typeMappers=_this$props.typeMappers,_this$props$setRef=_this$props.setRef,setRef=void 0===_this$props$setRef?function(){}:_this$props$setRef,_this$props$onMouseOv=_this$props.onMouseOver,onMouseOver=void 0===_this$props$onMouseOv?function(){}:_this$props$onMouseOv,decorators=[].concat(this.props.decorators,[wixRichContentCommon.createJustificationFixDecorator()]);try{var _classNames,_classNames2,_config$SPOILER_TYPE,_config$SPOILER_TYPE2;if(this.state.error)return onError(this.state.error),null;var styles=this.styles,wrapperClassName=classNames__default.default(styles.wrapper,((_classNames={})[styles.desktop]=!platform||"desktop"===platform,_classNames)),tableClassNames=classNames__default.default(styles.renderedInTable,viewerStyles.renderedInTable,draftDefaultStyles_renderedInTable),editorClassName=classNames__default.default(styles.editor,renderedInTable&&tableClassNames,((_classNames2={})[styles.rtl]="rtl"===textDirection,_classNames2)),initSpoilers=null===(_config$SPOILER_TYPE=config[wixRichContentCommon.SPOILER_TYPE])||void 0===_config$SPOILER_TYPE?void 0:_config$SPOILER_TYPE.initSpoilersContentState,SpoilerViewerWrapper=null===(_config$SPOILER_TYPE2=config[wixRichContentCommon.SPOILER_TYPE])||void 0===_config$SPOILER_TYPE2?void 0:_config$SPOILER_TYPE2.SpoilerViewerWrapper,contextualData=this.getContextualData(this.props,this.state.raw),innerRCEViewerProps={typeMappers:typeMappers,inlineStyleMappers:inlineStyleMappers,decorators:decorators,config:config,t:t,renderedInTable:renderedInTable,isMobile:isMobile},output=convertToReact(styles,textDirection,this.typeMappers,contextualData,decorators,inlineStyleMappers,config,initSpoilers,SpoilerViewerWrapper,{addAnchors:addAnchors},innerRCEViewerProps,this.props.documentStyle),dataId=isInnerRcv?{}:{"data-id":"rich-content-viewer"};return React__default.default.createElement(wixRichContentCommon.GlobalContext.Provider,{value:this.state.context},React__default.default.createElement("div",Object.assign({className:wrapperClassName,dir:direction||wixRichContentCommon.getLangDir(locale),onMouseEnter:function(e){return onHover&&onHover(e)},ref:setRef,onMouseOver:onMouseOver},dataId),React__default.default.createElement("div",{className:editorClassName},output),React__default.default.createElement(wixRichContentCommon.AccessibilityListener,{isMobile:isMobile})))}catch(err){return onError(err),null}},RichContentViewer}(React.Component);RichContentViewer.defaultProps={theme:{},decorators:[],typeMappers:[],inlineStyleMappers:[],locale:"en",onError:function(err){throw err},normalize:{},config:{}},RichContentViewer.getInitialState=function(props){var _config$IMAGE_TYPE,_config$GALLERY_TYPE,_config$VIDEO_TYPE,initialState=props.initialState,anchorTarget=props.anchorTarget,relValue=props.relValue,_props$normalize=props.normalize,_props$normalize$disa=_props$normalize.disableInlineImages,disableInlineImages=void 0!==_props$normalize$disa&&_props$normalize$disa,_props$normalize$remo=_props$normalize.removeInvalidInlinePlugins,removeInvalidInlinePlugins=void 0!==_props$normalize$remo&&_props$normalize$remo,config=props.config,uiSettings=config.uiSettings,disableImagesExpand=null===(_config$IMAGE_TYPE=config[wixRichContentCommon.IMAGE_TYPE])||void 0===_config$IMAGE_TYPE?void 0:_config$IMAGE_TYPE.disableExpand,disableGalleryExpand=null===(_config$GALLERY_TYPE=config[wixRichContentCommon.GALLERY_TYPE])||void 0===_config$GALLERY_TYPE?void 0:_config$GALLERY_TYPE.disableExpand,disableDownload=(null===(_config$VIDEO_TYPE=config[wixRichContentCommon.VIDEO_TYPE])||void 0===_config$VIDEO_TYPE?void 0:_config$VIDEO_TYPE.disableDownload)||(null==uiSettings?void 0:uiSettings.disableRightClick)||(null==uiSettings?void 0:uiSettings.disableDownload);return initialState?wixRichContentCommon.normalizeInitialState(initialState,{anchorTarget:anchorTarget,relValue:relValue,disableInlineImages:disableInlineImages,removeInvalidInlinePlugins:removeInvalidInlinePlugins,disableDownload:disableDownload,disableImagesExpand:disableImagesExpand,disableGalleryExpand:disableGalleryExpand}):void 0};var WrappedViewer=wixRichContentCommon.withI18n(RichContentViewer,englishResources__default.default,{forceRemount:!1}),I18nRichContentViewer=function(_Component){function I18nRichContentViewer(){return _Component.apply(this,arguments)||this}return _inheritsLoose__default.default(I18nRichContentViewer,_Component),I18nRichContentViewer.prototype.render=function(){return React__default.default.createElement(WrappedViewer,Object.assign({},this.props))},I18nRichContentViewer}(React.Component);I18nRichContentViewer.displayName="RichContentViewer",exports.RichContentViewer=I18nRichContentViewer,exports.convertToHTML=function(reactOutput,renderToStaticMarkup){return reactOutput?reactOutput.reduce((function(html,blocks){return(blocks instanceof Array?blocks:[blocks]).forEach((function(c){return html+=renderToStaticMarkup(c)})),html}),""):null},exports.convertToReact=convertToReact;
//# sourceMappingURL=module.cjs.js.map

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

import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React from"react";import{debounce}from"lodash";var styles_toolbar="_2M9cT",styles_button="_1lTtq",getSelectionRects=function(selection){var range=selection.getRangeAt(0),innerRects=function(range){for(var _iterator=document.createNodeIterator(range.commonAncestorContainer,NodeFilter.SHOW_ALL),innerSelectionNodes=[];_iterator.nextNode()&&_iterator.referenceNode!==range.startContainer;);for(;_iterator.nextNode()&&_iterator.referenceNode!==range.endContainer;)_iterator.referenceNode.nodeType===Node.TEXT_NODE&&innerSelectionNodes.push(_iterator.referenceNode);return innerSelectionNodes}(range).map((function(n){var r=document.createRange();return r.selectNodeContents(n),r.getBoundingClientRect()})),clientRects=range.getClientRects();return[clientRects[0]].concat(innerRects,[clientRects[clientRects.length-1]])};function addTextSelectionListener(container,callback){var handleSelection=function(){var selectedText,position,selection=document.getSelection(),selectionAnchor=null==selection?void 0:selection.anchorNode,selectionFocus=null==selection?void 0:selection.focusNode;selection&&selection.rangeCount>0&&!selection.isCollapsed&&container.contains(selectionAnchor)&&container.contains(selectionFocus)&&(selectedText=function(selection){return selection.toString().replace(/(\r\n|\r|\n){2,}/g," ")}(selection),position=function(selection){var rects=getSelectionRects(selection),left=999999,right=0;rects.forEach((function(rect){left=Math.min(left,rect.left),right=Math.max(right,rect.right)}));var y=rects[0].top+window.scrollY;return{x:(left+right)/2+window.scrollX,y:y}}(selection)),callback(selectedText,position)};return document.addEventListener("selectionchange",handleSelection),function(){return document.removeEventListener("selectionchange",handleSelection)}}var TextSelectionToolbar=function(_React$Component){function TextSelectionToolbar(props){var _this;return(_this=_React$Component.call(this,props)||this).addTextSelectionListener=function(container){container&&!_this.removeTextSelectionListener&&(_this.removeTextSelectionListener=addTextSelectionListener(container,_this.setSelectedText))},_this.setSelectedText=debounce((function(selectedText,selectedTextPosition){return _this.setState({selectedText:selectedText,selectedTextPosition:selectedTextPosition})}),50),_this.state={selectedText:""},_this}_inheritsLoose(TextSelectionToolbar,_React$Component);var _proto=TextSelectionToolbar.prototype;return _proto.componentDidMount=function(){this.addTextSelectionListener(this.props.container)},_proto.componentWillUnmount=function(){this.removeTextSelectionListener()},_proto.componentWillReceiveProps=function(nextPros){this.addTextSelectionListener(nextPros.container)},_proto.render=function(){var _this$state=this.state,selectedText=_this$state.selectedText,selectedTextPosition=_this$state.selectedTextPosition,_this$props=this.props,container=_this$props.container,children=_this$props.children;if(!selectedText||!selectedTextPosition)return null;var left=container.getBoundingClientRect().left,containerOffset=this.props.container.getBoundingClientRect().top,style={top:selectedTextPosition.y-containerOffset-5-window.scrollY,left:selectedTextPosition.x-left};return React.createElement("div",{className:styles_toolbar,style:style},children(selectedText))},TextSelectionToolbar}(React.Component),twitter=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("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.653 4.268c.854-.52 1.493-1.336 1.8-2.297-.804.483-1.683.825-2.6 1.01-1.153-1.245-2.939-1.65-4.506-1.023-1.566.627-2.597 2.16-2.6 3.867.001.318.037.636.106.946-3.298-.168-6.37-1.748-8.453-4.346-.37.633-.563 1.355-.56 2.09-.117 1.34.452 2.647 1.507 3.463C1.608 7.87.88 7.696.173 7.458v.052c.142 2.038 1.63 3.717 3.614 4.077-.298.098-.608.147-.92.146-.233.001-.466-.024-.694-.074.55 1.699 2.103 2.858 3.867 2.888-1.446 1.158-3.237 1.786-5.08 1.78-.32 0-.641-.02-.96-.058 3.593 2.332 8.156 2.492 11.9.417 3.744-2.076 6.073-6.056 6.073-10.381 0-.18-.013-.36-.013-.54.801-.588 1.492-1.316 2.04-2.15-.745.336-1.536.556-2.347.653z"}))};var TwitterButton=function(_ref){var selectedText=_ref.selectedText,onClick=_ref.onClick,handleOnClick=function(selectedText){null==onClick||onClick(selectedText),function(selectedText){var text="“"+selectedText+"“—",url=window.location.href;text.length+url.length>279&&(text=function(text,maxTextLength){var content=text.substring(0,maxTextLength-2);return(content=content.slice(0,content.lastIndexOf(" ")))+"…“—"}(text,279-url.length));var TWEET_ON_TWITTER_URL="https://twitter.com/intent/tweet?text="+encodeURI(text)+"&url="+encodeURI(url);window.open(TWEET_ON_TWITTER_URL)}(selectedText)};return React.createElement("button",{"data-hook":"twitter-button",className:styles_button,onClick:function(){return handleOnClick(selectedText)}},React.createElement(twitter,null))};export{TextSelectionToolbar,TwitterButton};
import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{PureComponent,Component}from"react";import englishResources from"wix-rich-content-common/dist/statics/viewer/locale/messages_en.json";import{getDirectionFromAlignmentAndTextDirection,alignmentClassName,sizeClassName,textWrapClassName,normalizeUrl,getRelValue,HTML_TYPE,MAP_TYPE,IMAGE_TYPE,ACTION_BUTTON_TYPE,LINK_BUTTON_TYPE,TABLE_TYPE,getDynamicInlineStyleMapper,RICOS_TEXT_COLOR_TYPE,RICOS_TEXT_HIGHLIGHT_TYPE,RICOS_FONT_SIZE_TYPE,BLOCK_TYPES,getTextDirection,depthClassName,Version,mergeStyles,createJustificationFixDecorator,SPOILER_TYPE,GlobalContext,getLangDir,AccessibilityListener,GALLERY_TYPE,VIDEO_TYPE,normalizeInitialState,withI18n}from"wix-rich-content-common";import _extends from"@babel/runtime/helpers/extends";import classNames from"classnames";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import require$$0 from"punycode";import{isArray,isFunction,isNumber,endsWith,isEmpty}from"lodash";import{deprecateHelpers}from"wix-rich-content-common/libs/deprecateHelpers";var draftDefaultStyles_renderedInTable="n4Axb";function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}function createCommonjsModule(fn){var module={exports:{}};return fn(module,module.exports),module.exports}var arrayEqual=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(arr1,arr2){if(arr1.length!==arr2.length)return!1;for(var i=0;i<arr1.length;i++)if(arr1[i]!==arr2[i])return!1;return!0};exports.default=_default})),ContentNode_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_arrayEqual=(obj=arrayEqual)&&obj.__esModule?obj:{default:obj};function _toArray(arr){return function(arr){if(Array.isArray(arr))return arr}(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}var _default=function(){function ContentNode(props){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,ContentNode),this.content=props.content||[],this.start=void 0!==props.start?props.start:null,this.end=void 0!==props.end?props.end:null,this.entity=void 0!==props.entity?props.entity:null,this.decorator=void 0!==props.decorator?props.decorator:null,this.decoratorProps=props.decoratorProps||null,this.decoratedText=void 0!==props.decoratedText?props.decoratedText:null,this.contentState=props.contentState,this.style=props.style||null,this.styles=props.styles||null,this.block=props.block||{}}var Constructor,protoProps,staticProps;return Constructor=ContentNode,(protoProps=[{key:"getCurrentContent",value:function(){return this.content[this.content.length-1]}},{key:"addToCurrentContent",value:function(string){this.content[this.content.length-1]=this.content[this.content.length-1]+string}},{key:"handleFlatPush",value:function(string,stack){var current=this.getCurrentContent();if(current instanceof ContentNode&&(0,_arrayEqual.default)(stack,current.styles))current.addToCurrentContent(string);else{var newNode=new ContentNode({styles:_toConsumableArray(stack),content:[string]});this.content.push(newNode)}}},{key:"pushContent",value:function(string){var stack=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],flat=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!stack||stack.length<1)return"string"==typeof string&&"string"==typeof this.getCurrentContent()?this.addToCurrentContent(string):this.content.push(string),this;if(flat)return this.handleFlatPush(string,stack),this;var _stack=_toArray(stack),head=_stack[0],rest=_stack.slice(1),current=this.getCurrentContent();if(current instanceof ContentNode&&current.style===head)current.pushContent(string,rest,flat);else{var newNode=new ContentNode({style:head});newNode.pushContent(string,rest,flat),this.content.push(newNode)}return this}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),ContentNode}();exports.default=_default})),RawParser_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _punycode=_interopRequireDefault(require$$0),_ContentNode=_interopRequireDefault(ContentNode_1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}(arr)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}var getString=function(array,from,to){return _punycode.default.ucs2.encode(array.slice(from,to))};function addIndexes(indexes,ranges){return ranges.forEach((function(range){indexes.push(range.offset),indexes.push(range.offset+range.length)})),indexes}var RawParser=function(){function RawParser(_ref){var _ref$flat=_ref.flat,flat=void 0!==_ref$flat&&_ref$flat;!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,RawParser),this.flat=flat}var Constructor,protoProps,staticProps;return Constructor=RawParser,(protoProps=[{key:"relevantStyles",value:function(offset){return this.ranges.filter((function(range){return offset>=range.offset&&offset<range.offset+range.length})).map((function(style){return style.style}))}},{key:"nodeIterator",value:function(node,start,end){var _this=this,indexes=this.relevantIndexes.slice(this.relevantIndexes.indexOf(start),this.relevantIndexes.indexOf(end));return indexes.forEach((function(index,key){var characterStyles=_this.relevantStyles(index),distance=indexes[key+1]?indexes[key+1]-index:1,text=getString(_this.textArray,index,index+distance);node.pushContent(text,characterStyles,_this.flat),!indexes[key+1]&&index<end&&node.pushContent(getString(_this.textArray,index+1,end),_this.relevantStyles(end-1),_this.flat)})),node}},{key:"parse",value:function(block){var _this2=this,text=block.text,ranges=block.inlineStyleRanges,entityRanges=block.entityRanges,_block$decoratorRange=block.decoratorRanges,decoratorRanges=void 0===_block$decoratorRange?[]:_block$decoratorRange;this.textArray=_punycode.default.ucs2.decode(text),this.ranges=ranges,this.iterator=0,this.relevantIndexes=function(text,inlineRanges){var entityRanges=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],decoratorRanges=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],relevantIndexes=[];return relevantIndexes=addIndexes(relevantIndexes,inlineRanges),relevantIndexes=addIndexes(relevantIndexes,entityRanges),(relevantIndexes=addIndexes(relevantIndexes,decoratorRanges)).push(0),relevantIndexes.push(text.length),relevantIndexes.filter((function(value,index,self){return self.indexOf(value)===index})).sort((function(aa,bb){return aa-bb}))}(text,ranges,entityRanges,decoratorRanges);var parsedNodes=function(entityRanges){var decoratorRanges=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],textArray=arguments.length>2?arguments[2]:void 0,block=arguments.length>3?arguments[3]:void 0,lastIndex=0,mergedRanges=[].concat(_toConsumableArray(entityRanges),_toConsumableArray(decoratorRanges)).sort((function(a,b){return a.offset-b.offset})),nodes=[];return mergedRanges.length<1?(nodes.push(new _ContentNode.default({block:block,start:0,end:textArray.length})),nodes):(mergedRanges.forEach((function(range){range.offset>lastIndex&&nodes.push(new _ContentNode.default({block:block,start:lastIndex,end:range.offset})),nodes.push(new _ContentNode.default({block:block,entity:range.key,decorator:range.component,decoratorProps:range.decoratorProps,decoratedText:range.component?getString(textArray,range.offset,range.offset+range.length):void 0,start:range.offset,end:range.offset+range.length,contentState:range.contentState})),lastIndex=range.offset+range.length})),lastIndex<textArray.length&&nodes.push(new _ContentNode.default({block:block,start:lastIndex,end:textArray.length})),nodes)}(entityRanges,decoratorRanges,this.textArray,block).map((function(node){return _this2.nodeIterator(node,node.start,node.end)}));return new _ContentNode.default({block:block,content:parsedNodes})}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),RawParser}();exports.default=RawParser})),createStyleRenderer_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(wrapper,stylesMap){return function(children,styleArray,params){var style=function(styleArray,stylesMap){return styleArray.map((function(style){return stylesMap[style]})).reduce((function(prev,next){var mergedStyles={};if(void 0!==next){var key="text-decoration"in next?"text-decoration":"textDecoration";next[key]!==prev[key]&&(mergedStyles[key]=[prev[key],next[key]].join(" ").trim())}return Object.assign(prev,next,mergedStyles)}),{})}(styleArray,stylesMap);return wrapper(Object.assign({},{children:children},params,{style:style}))}};exports.default=_default})),createBlockRenderer_1=createCommonjsModule((function(module,exports){function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}(arr)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var getKey=function(_ref,key){var keys=_ref.keys;return key||(keys?keys.join(","):void 0)},getBlock=function(element,wrapper,withDepth){return function(children,properties,key){var props=Object.assign({},properties);return withDepth||delete props.depth,wrapper.apply(void 0,[element,Object.assign({},props,{key:getKey(props,key)})].concat(_toConsumableArray(children)))}},_default=function(callback,blockMap){var renderer={};return Object.keys(blockMap).forEach((function(item){var block=blockMap[item];block.wrapper?renderer[item]=function(children,props,key){return function(callback,block,_ref2){var children=_ref2.children,props=_ref2.props,key=_ref2.key,wrapperBlockFn=getBlock(block.wrapper,callback),blockFn=getBlock(block.element,callback,!0);return wrapperBlockFn(children.map((function(child,ii){return blockFn(child,{},props.keys&&props.keys[ii])})),props,key)}(callback,block,{children:children,props:props,key:key})}:renderer[item]=getBlock(block.element,callback)})),renderer};exports.default=_default})),warn_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(msg){};exports.default=_default})),checkCleanup_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(block,prevType,_ref2){var cleanup=_ref2.cleanup;return!(!cleanup||function(block,options){return text=block.text,!!(options.trim?text.trim():text)||!(!block.data||!Object.keys(block.data).length)||!(!block.entityRanges||!block.entityRanges.length);var text}(block,cleanup))&&(!(cleanup.after&&"all"!==cleanup.after&&!cleanup.after.includes(prevType))&&(!(!cleanup.except||cleanup.except.includes(block.type))||!(!cleanup.types||"all"!==cleanup.types&&!cleanup.types.includes(block.type))))};exports.default=_default})),getKeyGenerator_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(){var key=0;return function(){var current=key;return key+=1,current}};exports.default=_default})),checkJoin_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(input,options){return Array.isArray(input)&&options.joinOutput?input.join(""):input};exports.default=_default})),pushString_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(string,array,index){var tempArray=array;return array[index]?tempArray[index]+=string:tempArray[index]=string,tempArray};exports.default=_default})),defaultOptions_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default={joinOutput:!1,cleanup:{after:["atomic"],types:["unstyled"],trim:!1,split:!0}};exports.default=_default})),CompositeDecorator=createCommonjsModule((function(module,exports){function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(){function CompositeDraftDecorator(decorators){var obj,key,value;!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,CompositeDraftDecorator),value=void 0,(key="decorators")in(obj=this)?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,this.decorators=decorators.slice()}var Constructor,protoProps,staticProps;return Constructor=CompositeDraftDecorator,(protoProps=[{key:"getDecorations",value:function(block,contentState){var decorations=Array(block.getText().length).fill(null);return this.decorators.forEach((function(decorator,ii){var counter=0;(0,decorator.strategy)(block,(function(start,end){(function(decorations,start,end){for(var ii=start;ii<end;ii++)if(null!=decorations[ii])return!1;return!0})(decorations,start,end)&&(function(targetArr,start,end,componentKey){for(var ii=start;ii<end;ii++)targetArr[ii]=componentKey}(decorations,start,end,ii+"."+counter),counter++)}),contentState)})),decorations}},{key:"getComponentForKey",value:function(key){var componentKey=parseInt(key.split(".")[0],10);return this.decorators[componentKey].component}},{key:"getPropsForKey",value:function(key){var componentKey=parseInt(key.split(".")[0],10);return this.decorators[componentKey].props}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),CompositeDraftDecorator}();exports.default=_default})),MultiDecorator_1=createCommonjsModule((function(module,exports){function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(){function MultiDecorator(decorators){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,MultiDecorator),this.decorators=decorators}var Constructor,protoProps,staticProps;return Constructor=MultiDecorator,staticProps=[{key:"getInnerKey",value:function(key){return key.split("-").slice(1).join("-")}}],(protoProps=[{key:"getDecorations",value:function(block,contentState){var decorations=new Array(block.getText().length).fill(null);return this.decorators.forEach((function(decorator,i){decorator.getDecorations(block,contentState).forEach((function(key,offset){key&&(decorations[offset]=i+"-"+key)}))})),decorations}},{key:"getComponentForKey",value:function(key){return this.getDecoratorForKey(key).getComponentForKey(MultiDecorator.getInnerKey(key))}},{key:"getPropsForKey",value:function(key){return this.getDecoratorForKey(key).getPropsForKey(MultiDecorator.getInnerKey(key))}},{key:"getDecoratorForKey",value:function(key){var parts=key.split("-"),index=Number(parts[0]);return this.decorators[index]}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),MultiDecorator}();exports.default=_default})),stubContentBlock_1=createCommonjsModule((function(module,exports){function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var ContentBlockStub=function(){function ContentBlockStub(block){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,ContentBlockStub),Object.assign(this,block)}var Constructor,protoProps,staticProps;return Constructor=ContentBlockStub,(protoProps=[{key:"get",value:function(name){return this[name]}},{key:"getText",value:function(){return this.text}},{key:"getType",value:function(){return this.type}},{key:"getKey",value:function(){return this.key}},{key:"getLength",value:function(){return this.text.length}},{key:"getDepth",value:function(){return this.depth}},{key:"getData",value:function(){return this.data}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),ContentBlockStub}(),_default=function(block){return new ContentBlockStub(block)};exports.default=_default})),withDecorators_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _punycode=_interopRequireDefault(require$$0),_CompositeDecorator=_interopRequireDefault(CompositeDecorator),_MultiDecorator=_interopRequireDefault(MultiDecorator_1),_stubContentBlock=_interopRequireDefault(stubContentBlock_1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}(arr)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}var offsetRanges=function(ranges,block){return ranges.forEach((function(range){var pre=block.text.substring(0,range.offset),decorated=block.text.substring(range.offset,range.offset+range.length);range.offset=_punycode.default.ucs2.decode(pre).length,range.length=_punycode.default.ucs2.decode(decorated).length})),ranges},decoratorIsCustom=function(decorator){return"function"==typeof decorator.getDecorations&&"function"==typeof decorator.getComponentForKey&&"function"==typeof decorator.getPropsForKey},decorateBlock=function(block,decorators,contentState,_ref){var createContentBlock=_ref.createContentBlock,decoratorRanges=[],decorator=function(decorators){var compositeDecorator=new _CompositeDecorator.default(decorators.filter((function(decorator){return!decoratorIsCustom(decorator)}))),customDecorators=decorators.filter((function(decorator){return decoratorIsCustom(decorator)})),decor=[].concat(_toConsumableArray(customDecorators),[compositeDecorator]);return new _MultiDecorator.default(decor)}(decorators),contentBlock=createContentBlock?createContentBlock(block):(0,_stubContentBlock.default)(block),decorations=decorator.getDecorations(contentBlock,contentState),offset=0;return decorations.forEach((function(key,index){if(key){var nextIndex=index+1,next=decorations[nextIndex];next&&next===key||(decoratorRanges.push({offset:offset,length:nextIndex-offset,component:decorator.getComponentForKey(key),decoratorProps:decorator.getPropsForKey(key)||{},contentState:contentState}),offset=nextIndex)}else offset+=1})),Object.assign({},block,{decoratorRanges:offsetRanges(decoratorRanges,block)})},_default=function(raw,decorators,options){var contentState=options.convertFromRaw&&options.convertFromRaw(raw);return raw.blocks.map((function(block){return decorateBlock(block,decorators,contentState,options||{})}))};exports.default=_default})),render_1=createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.render=exports.renderNode=void 0;var _RawParser=_interopRequireDefault(RawParser_1),_warn=_interopRequireDefault(warn_1),_checkCleanup=_interopRequireDefault(checkCleanup_1),_getKeyGenerator=_interopRequireDefault(getKeyGenerator_1),_checkJoin=_interopRequireDefault(checkJoin_1),_pushString=_interopRequireDefault(pushString_1),_defaultOptions=_interopRequireDefault(defaultOptions_1),_withDecorators=_interopRequireDefault(withDecorators_1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var renderNode=function renderNode(node,inlineRenderers,entityRenderers,styleRenderers,entityMap,options,keyGenerator){if(node.styles&&styleRenderers)return styleRenderers((0,_checkJoin.default)(node.content,options),node.styles,{key:keyGenerator()});var children=[],index=0;if(node.content.forEach((function(part){"string"==typeof part?children=(0,_pushString.default)(part,children,index):(children[index+=1]=renderNode(part,inlineRenderers,entityRenderers,styleRenderers,entityMap,options,keyGenerator),index+=1)})),node.style&&inlineRenderers[node.style])return inlineRenderers[node.style]((0,_checkJoin.default)(children,options),{key:keyGenerator()});if(null!==node.entity){var entity=entityMap[node.entity],entityRenderer=entity&&(entityRenderers[entity.type]||"atomic"===node.block.type&&entityRenderers.atomicFallbackRenderer);if(entityRenderer)return entityRenderer((0,_checkJoin.default)(children,options),entity.data,{key:node.entity,block:node.block},entity.type)}if(null!==node.decorator){var decoratorOffsetKey=[node.block.key,node.start,0].join(".");return node.decorator(Object.assign({children:(0,_checkJoin.default)(children,options),decoratedText:node.decoratedText,contentState:node.contentState,entityKey:node.entity,offsetKey:decoratorOffsetKey,key:decoratorOffsetKey},node.decoratorProps))}return children};exports.renderNode=renderNode;var byDepth=function(blocks){var group=[],depthStack=[],prevDepth=0,unwind=function(targetDepth){var i=prevDepth-targetDepth;for(depthStack.length<i&&(i=depthStack.length);i>0;i-=1){var tmp=group;(group=depthStack.pop())[group.length-1].children=tmp}};return blocks.forEach((function(block){prevDepth<block.depth?(depthStack.push(group),group=[]):prevDepth>block.depth&&unwind(block.depth),prevDepth=block.depth,group.push(block)})),0!==prevDepth&&unwind(0),group},renderGroup=function(group,blockRenderers,rendered,params){var type=params.prevType,depth=params.prevDepth,keys=params.prevKeys,data=params.prevData;if(0!==group.length){if(blockRenderers[type]){var props={depth:depth,keys:keys};return data&&data.some((function(item){return!!item}))&&(props.data=data),void rendered.push(blockRenderers[type](group,props))}rendered.push(group)}},renderBlocks=function renderBlocks(blocks){var inlineRenderers=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},blockRenderers=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},entityRenderers=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},stylesRenderer=arguments.length>4?arguments[4]:void 0,entityMap=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},userOptions=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},options=Object.assign({},_defaultOptions.default,userOptions),rendered=[],group=[],prevType=null,prevDepth=0,prevKeys=[],prevData=[],splitGroup=!1,Parser=new _RawParser.default({flat:!!stylesRenderer});return blocks.forEach((function(block){if((0,_checkCleanup.default)(block,prevType,options))!0===options.cleanup.split&&(splitGroup=!0);else{var node=Parser.parse(block),renderedNode=renderNode(node,inlineRenderers,entityRenderers,stylesRenderer,entityMap,options,(0,_getKeyGenerator.default)());if((prevType&&prevType!==block.type||splitGroup)&&(renderGroup(group,blockRenderers,rendered,{prevType:prevType,prevDepth:prevDepth,prevKeys:prevKeys,prevData:prevData}),prevData=[],prevKeys=[],group=[],splitGroup=!1),block.children){var children=renderBlocks(block.children,inlineRenderers,blockRenderers,entityRenderers,stylesRenderer,entityMap,options);renderedNode.push(children)}group.push(renderedNode),prevType=block.type,prevDepth=block.depth,prevKeys.push(block.key),prevData.push(block.data)}})),renderGroup(group,blockRenderers,rendered,{prevType:prevType,prevDepth:prevDepth,prevKeys:prevKeys,prevData:prevData}),(0,_checkJoin.default)(rendered,options)};exports.render=function(raw){var renderers=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!raw||!Array.isArray(raw.blocks))return(0,_warn.default)("invalid raw object"),null;if(!raw.blocks.length)return null;var inlineRenderers=renderers.inline,blockRenderers=renderers.blocks,entityRenderers=renderers.entities,stylesRenderer=renderers.styles,decorators=renderers.decorators,blocksWithDecorators=decorators?(0,_withDecorators.default)(raw,decorators,options):raw.blocks,blocks=byDepth(blocksWithDecorators);return renderBlocks(blocks,inlineRenderers,blockRenderers,entityRenderers,stylesRenderer,raw.entityMap,options)}})),redraft=getDefaultExportFromCjs(createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"RawParser",{enumerable:!0,get:function(){return _RawParser.default}}),Object.defineProperty(exports,"createStylesRenderer",{enumerable:!0,get:function(){return _createStyleRenderer.default}}),Object.defineProperty(exports,"createBlockRenderer",{enumerable:!0,get:function(){return _createBlockRenderer.default}}),Object.defineProperty(exports,"renderNode",{enumerable:!0,get:function(){return render_1.renderNode}}),Object.defineProperty(exports,"CompositeDecorator",{enumerable:!0,get:function(){return _CompositeDecorator.default}}),exports.default=void 0;var _RawParser=_interopRequireDefault(RawParser_1),_createStyleRenderer=_interopRequireDefault(createStyleRenderer_1),_createBlockRenderer=_interopRequireDefault(createBlockRenderer_1),_CompositeDecorator=_interopRequireDefault(CompositeDecorator);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=render_1.render;exports.default=_default}))),kebabToCamelObjectKeys=function(obj){return void 0===obj&&(obj={}),Object.keys(obj).reduce((function(result,key){var s;return result[(s=key,s.replace(/-([a-z])/,(function(_,p1){return p1.toUpperCase()})))]=obj[key],result}),{})},hasText=function hasText(child){return!!child&&("string"==typeof child?child.trim().length>0:Array.isArray(child)?hasText(child[0])||hasText(child[1]):"object"==typeof child&&hasText(child.props.children))},getPaywallSeoClass=function(_ref,blockIndex){var _ref$className=_ref.className,className=void 0===_ref$className?"paywall":_ref$className,_ref$index=_ref.index;return blockIndex<(void 0===_ref$index?3:_ref$index)&&className},isPaywallSeo=function(seoMode){return"object"==typeof seoMode&&"object"==typeof seoMode.paywall},viewerStyles={fontElementMap:"_27i2k",wrapper:"kvdbP",pluginContainerMobile:"_3iGUk",desktop:"_1O7aH",editor:"_1hN1O",android:"_23La5",atomic:"_2vd5k",toolbar:"_3j-bQ",underline:"_3zM-5",block:"_3RIlU",elementSpacing:"_1j-51",blockStyleSpacing:"_3Dd1B",text:"mm8Nw _1j-51",child:"_2PHJq",orderedList:"_2ULPL",unorderedList:"_3Kjjs",center:"_37Oe5",contentCenterAlignment:"_3LGTx",justify:"_78FBa",quote:"_3cMZT _3Dd1B",headerOne:"_3qzEG _1j-51",headerTwo:"eSWI6 _1j-51",headerThree:"_3qMKZ _1j-51",headerFour:"_2TrLF _1j-51",headerFive:"_1zZGG _1j-51",headerSix:"_1joqJ _1j-51",code:"_3-Hex _3Dd1B",codeBlock:"_3M8UJ _3Dd1B",renderedInTable:"_3sj65",normalText:"_3iu3e",anchor:"_3mt3E",embed:"_1-N88",horizontalScrollbar:"_34Kbu",overrideLinkColor:"_2nl-9"},combineMappers=function(mappers){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return mappers&&mappers.length&&!mappers.some((function(resolver){return"function"!=typeof resolver}))?mappers.reduce((function(map,mapper){return Object.assign(map,mapper.apply(void 0,args))}),{}):(console.warn(mappers+" is expected to be a function array"),{})},DefaultInteractionWrapper=function(_ref){return _ref.children},withInteraction=function(element,interactions,context){var _config$PREVIEW,_config$PREVIEW$conte,config=context.config;if(null===(_config$PREVIEW=config.PREVIEW)||void 0===_config$PREVIEW||null===(_config$PREVIEW$conte=_config$PREVIEW.contentInteractionMappers)||void 0===_config$PREVIEW$conte||!_config$PREVIEW$conte.length||!config.PREVIEW.onPreviewExpand||!isArray(interactions))return element;var BlockInteractionWrapper=function(_ref2){var interactions=_ref2.interactions,context=_ref2.context;return function(_ref3){var children=_ref3.children,_ref4=context.config.PREVIEW||{},_ref4$contentInteract=_ref4.contentInteractionMappers,contentInteractionMappers=void 0===_ref4$contentInteract?[]:_ref4$contentInteract,_ref4$onPreviewExpand=_ref4.onPreviewExpand,interactionMap=combineMappers(contentInteractionMappers,void 0===_ref4$onPreviewExpand?function(){}:_ref4$onPreviewExpand);return interactions.reduce((function(child,_ref5){var type=_ref5.type,settings=_ref5.settings,Interaction=interactionMap[type]||DefaultInteractionWrapper;return React.createElement(Interaction,_extends({},settings,context),child)}),children)}}({interactions:interactions,context:context});return React.createElement(BlockInteractionWrapper,null,element)},draftPublic="public-DraftStyleDefault",getBlockClassName=function(isNewList,direction,listType,depth){var className=function(listType,depth,textDirection){return draftPublic+"-"+listType+"ListItem\n "+draftPublic+"-depth"+depth+"\n "+draftPublic+"-list-"+textDirection}(listType,depth,direction);return isNewList&&(className+=" "+draftPublic+"-reset"),className},List=function(_ref){var ordered=_ref.ordered,items=_ref.items,mergedStyles=_ref.mergedStyles,textDirection=_ref.textDirection,blockProps=_ref.blockProps,getBlockStyleClasses=_ref.getBlockStyleClasses,blockDataToStyle=_ref.blockDataToStyle,context=_ref.context,Component=ordered?"ol":"ul",listType=ordered?"ordered":"unordered",containerClassName=draftPublic+"-"+Component,listItemTypeClassName=listType+"List",prevDepth=0;return React.createElement(Component,{className:containerClassName},items.map((function(children,childIndex){var dataEntry=blockProps.data.length>childIndex?blockProps.data[childIndex]:{},interactions=blockProps.data[childIndex].interactions,paragraphGroup=[],result=[],alignment=(null==dataEntry?void 0:dataEntry.textAlignment)||context.textAlignment,textClassName=getBlockStyleClasses(mergedStyles,textDirection||dataEntry.textDirection,alignment),hasJustifyText="justify"===alignment&&hasText(children),elementProps=function(key){var _classNames;return{className:classNames(mergedStyles.elementSpacing,textClassName,(_classNames={},_classNames[viewerStyles.hasJustifyText]=hasJustifyText,_classNames[viewerStyles.contentCenterAlignment]="center"===alignment,_classNames)),key:key}};React.Children.forEach(children,(function(child,i){child&&("string"==typeof child.type&&/h\d/.exec(child.type)?(paragraphGroup.length&&(result.push(React.createElement("p",elementProps(i),paragraphGroup)),paragraphGroup=[]),result.push(React.cloneElement(child,elementProps(i)))):paragraphGroup.push(child))})),paragraphGroup.length&&result.push(React.createElement("p",elementProps("just_some_key"),paragraphGroup));var depth=dataEntry.depth,isNewList=0===childIndex||depth>prevDepth,listItemDirection=getDirectionFromAlignmentAndTextDirection(alignment,textDirection||dataEntry.textDirection),className=getBlockClassName(isNewList,listItemDirection,listType,depth);prevDepth=depth;var blockIndex=dataEntry.index,wrappedBlock=withInteraction(0===result.length?" ":result,interactions,context);return React.createElement("li",{id:"viewer-"+blockProps.keys[childIndex],className:classNames(context.theme[listItemTypeClassName],viewerStyles[listItemTypeClassName],viewerStyles[alignment],getBlockStyleClasses(mergedStyles,listItemDirection,alignment,className,!0),isPaywallSeo(context.seoMode)&&getPaywallSeoClass(context.seoMode.paywall,blockIndex)),key:blockProps.keys[childIndex],style:blockDataToStyle(blockProps.data[childIndex])},wrappedBlock)})))},Anchor=React.memo((function(_ref){var anchorKey=_ref.anchorKey,type=_ref.type;return React.createElement("div",{key:anchorKey,type:type,"data-hook":anchorKey})})),PluginViewer=function(_PureComponent){function PluginViewer(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_PureComponent.call.apply(_PureComponent,[this].concat(args))||this).getContainerClassNames=function(){var _classNames,_this$props=_this.props,pluginComponent=_this$props.pluginComponent,componentData=_this$props.componentData,styles=_this$props.styles,_this$props$context=_this$props.context,theme=_this$props$context.theme,isMobile=_this$props$context.isMobile;_this$props.type;var _ref=pluginComponent.classNameStrategies||{},size=_ref.size,alignment=_ref.alignment,textWrap=_ref.textWrap,custom=_ref.custom,hasLink=_this.componentHasLink(),html=componentData.html;return classNames(styles.pluginContainerReadOnly,((_classNames={})[styles.pluginContainerMobile]=isMobile,_classNames[styles.anchor]=hasLink,_classNames[theme.anchor]=hasLink&&theme.anchor,_classNames[styles.embed]=hasLink&&html,_classNames[styles.horizontalScrollbar]=pluginComponent.withHorizontalScroll,_classNames),isFunction(alignment)?alignment(componentData,theme,styles,isMobile):alignmentClassName(componentData,theme,styles,isMobile),isFunction(size)?size(componentData,theme,styles,isMobile):sizeClassName(componentData,theme,styles,isMobile),isFunction(textWrap)?textWrap(componentData,theme,styles,isMobile):textWrapClassName(componentData,theme,styles,isMobile),isFunction(custom)?custom(componentData,theme,styles,isMobile):null)},_this.componentHasLink=function(){var _this$props2,_this$props2$componen,_this$props2$componen2,_this$props2$componen3;return null===(_this$props2=_this.props)||void 0===_this$props2||null===(_this$props2$componen=_this$props2.componentData)||void 0===_this$props2$componen||null===(_this$props2$componen2=_this$props2$componen.config)||void 0===_this$props2$componen2||null===(_this$props2$componen3=_this$props2$componen2.link)||void 0===_this$props2$componen3?void 0:_this$props2$componen3.url},_this.componentHasAnchor=function(){var _this$props3,_this$props3$componen,_this$props3$componen2,_this$props3$componen3;return null===(_this$props3=_this.props)||void 0===_this$props3||null===(_this$props3$componen=_this$props3.componentData)||void 0===_this$props3$componen||null===(_this$props3$componen2=_this$props3$componen.config)||void 0===_this$props3$componen2||null===(_this$props3$componen3=_this$props3$componen2.link)||void 0===_this$props3$componen3?void 0:_this$props3$componen3.anchor},_this.innerRCV=function(_ref2){var contentState=_ref2.contentState,textAlignment=_ref2.textAlignment,direction=_ref2.direction,renderedIn=_ref2.renderedIn,innerRCEViewerProps=_this.props.innerRCEViewerProps,renderedInTable=renderedIn===TABLE_TYPE;return React.createElement(RichContentViewer,_extends({initialState:contentState,textAlignment:textAlignment,direction:direction},innerRCEViewerProps,{isInnerRcv:!0,renderedInTable:renderedInTable}))},_this}return _inheritsLoose(PluginViewer,_PureComponent),PluginViewer.prototype.render=function(){var _this$props4=this.props,id=_this$props4.id,type=_this$props4.type,pluginComponent=_this$props4.pluginComponent,componentData=_this$props4.componentData,children=_this$props4.children,styles=_this$props4.styles,entityIndex=_this$props4.entityIndex,context=_this$props4.context,blockIndex=_this$props4.blockIndex,SpoilerViewerWrapper=_this$props4.SpoilerViewerWrapper,blockKey=_this$props4.blockKey,Component=pluginComponent.component,elementType=pluginComponent.elementType,container=(pluginComponent.classNameStrategies||{}).container,anchorTarget=context.anchorTarget,config=context.config,theme=context.theme,isMobile=context.isMobile,settings=(null==config?void 0:config[type])||{},componentProps=_extends({type:type,componentData:componentData,settings:settings,children:children,entityIndex:entityIndex},context,{innerRCV:this.innerRCV,blockKey:blockKey});if(Component){if("inline"!==elementType){var _containerProps,_containerProps$style,customStyles,_componentData$config=componentData.config,_config=void 0===_componentData$config?{}:_componentData$config,hasLink=this.componentHasLink(),hasAnchor=this.componentHasAnchor(),ContainerElement=hasLink||hasAnchor?"a":"div",containerProps={};if(hasLink){var _config$link=_config.link,url=_config$link.url,_config$link$target=_config$link.target,target=void 0===_config$link$target?anchorTarget:_config$link$target,rel=_config$link.rel;containerProps={href:normalizeUrl(url),target:target,rel:getRelValue(rel)}}if(hasAnchor)containerProps={href:"#viewer-"+_config.link.anchor,target:"_self"};if("inline"!==_config.size&&type!==HTML_TYPE&&type!==MAP_TYPE||(customStyles={width:_config.width}),type===IMAGE_TYPE){var _componentData$src=componentData.src,src=void 0===_componentData$src?{}:_componentData$src,size=_config.size;src.width&&("original"===size||isMobile&&"inline"===size&&_config.width&&_config.width>150)&&(customStyles={width:src.width,maxWidth:"100%"})}type!==ACTION_BUTTON_TYPE&&type!==LINK_BUTTON_TYPE||!isNumber(_config.width)||(componentProps.style={width:_config.width}),customStyles&&(containerProps.style=customStyles);var ContainerClassName=this.getContainerClassNames(),ContainerComponent=React.createElement(ContainerElement,_extends({className:ContainerClassName},containerProps),isFunction(container)?React.createElement("div",{className:container(theme)},React.createElement(Component,componentProps)):React.createElement(Component,componentProps));return React.createElement("div",{id:id,className:classNames(styles.atomic,isPaywallSeo(context.seoMode)&&getPaywallSeoClass(context.seoMode.paywall,blockIndex))},SpoilerViewerWrapper?React.createElement(SpoilerViewerWrapper,_extends({},componentProps,{className:ContainerClassName,width:null===(_containerProps=containerProps)||void 0===_containerProps||null===(_containerProps$style=_containerProps.style)||void 0===_containerProps$style?void 0:_containerProps$style.width}),ContainerComponent):ContainerComponent)}return SpoilerViewerWrapper?React.createElement(SpoilerViewerWrapper,componentProps,React.createElement(Component,componentProps)):React.createElement(Component,componentProps)}return null},PluginViewer}(PureComponent);PluginViewer.defaultProps={styles:{}};var textColorInlineStyleMapper=getDynamicInlineStyleMapper(RICOS_TEXT_COLOR_TYPE),textHighlightInlineStyleMapper=getDynamicInlineStyleMapper(RICOS_TEXT_HIGHLIGHT_TYPE),fontSizeInlineStyleMapper=getDynamicInlineStyleMapper(RICOS_FONT_SIZE_TYPE),staticInlineStyleMapper=function(mergedStyles){return{BOLD:function(children,_ref){var key=_ref.key;return React.createElement("strong",{key:key},children)},ITALIC:function(children,_ref2){var key=_ref2.key;return React.createElement("em",{key:key},children)},UNDERLINE:function(children,_ref3){var key=_ref3.key;return React.createElement("u",{key:key,className:mergedStyles.underline},children)},CODE:function(children,_ref4){var key=_ref4.key;return React.createElement("span",{key:key,className:mergedStyles.code},children)},NOT_BOLD:function(children,_ref5){var key=_ref5.key;return React.createElement("span",{style:{fontWeight:"normal"},key:key},children)},NOT_ITALIC:function(children,_ref6){var key=_ref6.key;return React.createElement("span",{style:{fontStyle:"normal"},key:key},children)}}},_excluded=["addAnchors"],isEmptyBlock=function(_ref){_ref[0];var data=_ref[1];return data&&0===data.length},getBlockStyleClasses=function(mergedStyles,textDirection,textAlignment,classes,isListItem){var rtl="rtl"===textDirection,alignmentClass=textAlignment||(rtl?"right":"left"),directionClass=(isListItem?rtl:"ltr"!==(textDirection||"ltr"))?mergedStyles.rtl:mergedStyles.ltr;return classNames(classes,directionClass,mergedStyles[alignmentClass])},blockDataToStyle=function(_ref2){var dynamicStyles=_ref2.dynamicStyles;return kebabToCamelObjectKeys(dynamicStyles)},getInline=function(contentState,config,inlineStyleMappers,mergedStyles){return combineMappers([].concat(inlineStyleMappers,function(contentState,config){return[staticInlineStyleMapper,fontSizeInlineStyleMapper({},contentState),textColorInlineStyleMapper(config,contentState),textHighlightInlineStyleMapper(config,contentState)]}(contentState,config)),mergedStyles)},getBlocks=function(mergedStyles,textDirection,context,addAnchorsPrefix,documentStyle){var getList=function(ordered){return function(items,blockProps){var fixedItems=items.map((function(item){return item.length?item:[" "]})),props={key:blockProps.keys[0],items:fixedItems,ordered:ordered,mergedStyles:mergedStyles,textDirection:textDirection,blockProps:blockProps,getBlockStyleClasses:getBlockStyleClasses,blockDataToStyle:blockDataToStyle,context:context};return React.createElement(List,Object.assign({},props))}},blockFactory=function(type,style){return function(children,blockProps){return children.map((function(child,i){var _blockProps$data$i,_blockProps$data$i2,_blockProps$data$i3,_blockProps$data$i4,alignment=(null===(_blockProps$data$i=blockProps.data[i])||void 0===_blockProps$data$i?void 0:_blockProps$data$i.textAlignment)||context.textAlignment,depth=blockProps.data[i].depth,blockDirection=getDirectionFromAlignmentAndTextDirection(alignment,textDirection||(null===(_blockProps$data$i2=blockProps.data[i])||void 0===_blockProps$data$i2?void 0:_blockProps$data$i2.textDirection)),hasJustifyText="justify"===alignment&&hasText(child),directionBlockClassName="public-DraftStyleDefault-text-"+blockDirection,directionTextClassName="public-DraftStyleDefault-"+(textDirection||(null===(_blockProps$data$i3=blockProps.data[i])||void 0===_blockProps$data$i3?void 0:_blockProps$data$i3.textDirection)||"ltr"),ChildTag="string"==typeof type?type:type(child),blockIndex=blockProps.data[i].index,interactions=blockProps.data[i].interactions,_child=isEmptyBlock(child)?React.createElement("br",{role:"presentation"}):child,nodeStyle=kebabToCamelObjectKeys(null==documentStyle?void 0:documentStyle["text"===style?"paragraph":style]),content=isEmpty(nodeStyle)?_child:React.createElement("span",{className:viewerStyles.overrideLinkColor,style:nodeStyle},_child),inner=React.createElement(React.Fragment,{key:blockProps.keys[i]},React.createElement(ChildTag,{id:"viewer-"+blockProps.keys[i],className:classNames(getBlockStyleClasses(mergedStyles,textDirection||(null===(_blockProps$data$i4=blockProps.data[i])||void 0===_blockProps$data$i4?void 0:_blockProps$data$i4.textDirection),alignment,mergedStyles[style]),depthClassName(depth),directionBlockClassName,isPaywallSeo(context.seoMode)&&getPaywallSeoClass(context.seoMode.paywall,blockIndex)),style:blockDataToStyle(blockProps.data[i])},React.createElement("span",{className:classNames(viewerStyles.child,directionTextClassName,hasJustifyText&&viewerStyles.hasJustifyText)},content))),wrappedBlock=withInteraction(inner,interactions,context),wrapperKey=blockProps.keys[i]+"_wrap",resultBlock=React.createElement(React.Fragment,{key:wrapperKey},wrappedBlock);if(addAnchorsPrefix){var anchorKey=""+addAnchorsPrefix+(blockIndex+1);resultBlock=React.createElement(React.Fragment,{key:wrapperKey},wrappedBlock,React.createElement(Anchor,{type:isEmptyBlock(child)?"empty-line":"string"==typeof type?type:"paragraph",key:anchorKey,anchorKey:anchorKey}))}return resultBlock}))}};return{unstyled:blockFactory((function(child){return isEmptyBlock(child)?"div":"p"}),"text"),blockquote:blockFactory("blockquote","quote"),"header-one":blockFactory("h1","headerOne"),"header-two":blockFactory("h2","headerTwo"),"header-three":blockFactory("h3","headerThree"),"header-four":blockFactory("h4","headerFour"),"header-five":blockFactory("h5","headerFive"),"header-six":blockFactory("h6","headerSix"),"code-block":blockFactory("pre","codeBlock"),"unordered-list-item":getList(!1),"ordered-list-item":getList(!0)}},getEntities=function(typeMappers,context,styles,addAnchorsPrefix,innerRCEViewerProps,SpoilerViewerWrapper){return _extends({EMOJI_TYPE:function(emojiUnicode,data,_ref3){var key=_ref3.key;return React.createElement("span",{key:key,style:{fontFamily:"cursive"}},emojiUnicode)}},function(SpoilerViewerWrapper,typeMappers,context,styles,addAnchorsPrefix,innerRCEViewerProps){var res={};return Object.keys(typeMappers).forEach((function(type,i){res[type]=function(children,entity,_ref4){var content,blockKey,anchorElement,key=_ref4.key,block=_ref4.block,pluginComponent=typeMappers[type],isInline="inline"===pluginComponent.elementType,interactions=entity.interactions,pluginViewer=React.createElement(PluginViewer,{id:"viewer-"+block.key,type:type,pluginComponent:pluginComponent,componentData:entity,entityIndex:key,context:context,styles:styles,blockIndex:(content=context.contentState,blockKey=block.key,content.blocks.findIndex((function(block){return block.key===blockKey}))),typeMap:typeMappers,innerRCEViewerProps:innerRCEViewerProps,SpoilerViewerWrapper:SpoilerViewerWrapper,withHorizontalScroll:!0,blockKey:block.key},isInline?children:null),wrappedPluginViewer=withInteraction(pluginViewer,interactions,context);if(addAnchorsPrefix&&!isInline){var anchorType=type.replace("wix-draft-plugin-","").toLowerCase(),anchorKey=""+addAnchorsPrefix+(block.data.index+1);anchorElement=React.createElement(Anchor,{type:anchorType,anchorKey:anchorKey})}return React.createElement(React.Fragment,{key:i+"_"+key},wrappedPluginViewer,anchorElement)}})),res}(SpoilerViewerWrapper,typeMappers,context,styles,addAnchorsPrefix,innerRCEViewerProps))},redraftOptions={cleanup:{after:BLOCK_TYPES.filter((function(t){return-1===t.indexOf("header")})),split:!0,except:["unordered-list-item","ordered-list-item","unstyled","header-one","header-two","header-three","header-four","header-five","header-six"]},convertFromRaw:function(contentState){return contentState}},convertToReact=function(mergedStyles,textDirection,typeMappers,context,decorators,inlineStyleMappers,config,initSpoilers,SpoilerViewerWrapper,options,innerRCEViewerProps,externalDocumentStyle){if(void 0===options&&(options={}),!(raw=context.contentState)||!raw.blocks||1===raw.blocks.length&&""===raw.blocks[0].text&&"unstyled"===raw.blocks[0].type)return null;var raw,contentState,_options=options,addAnchors=_options.addAnchors,restOptions=_objectWithoutPropertiesLoose(_options,_excluded),normalizedContentState=context.contentState?(contentState=context.contentState,_extends({},contentState,{blocks:contentState.blocks.map((function(block,index){if("atomic"===block.type)return _extends({},block,{data:{index:index}});var textDirection=getTextDirection(block.text),data=_extends({},block.data,{depth:block.depth,index:index},"rtl"===textDirection&&{textDirection:textDirection}),text=block.text;return endsWith(text,"\n")&&(text+="\n"),_extends({},block,{depth:0,data:data,text:text})}))})):context.contentState,newContentState=initSpoilers?initSpoilers(normalizedContentState):normalizedContentState,addAnchorsPrefix=addAnchors&&(!0===addAnchors?"rcv-block":addAnchors),documentStyle=externalDocumentStyle||(null==newContentState?void 0:newContentState.documentStyle),result=redraft(newContentState,{inline:getInline(newContentState,config,inlineStyleMappers,mergedStyles),blocks:getBlocks(mergedStyles,textDirection,context,addAnchorsPrefix,documentStyle),entities:getEntities(typeMappers,context,mergedStyles,addAnchorsPrefix,_extends({},innerRCEViewerProps,{documentStyle:documentStyle}),SpoilerViewerWrapper),decorators:decorators},_extends({},redraftOptions,restOptions));if(addAnchors){var firstAnchorKey=addAnchorsPrefix+"-first",lastAnchorKey=addAnchorsPrefix+"-last";result=React.createElement(React.Fragment,null,React.createElement(Anchor,{type:"first",anchorKey:firstAnchorKey}),result,React.createElement(Anchor,{type:"last",anchorKey:lastAnchorKey}))}return result},convertToHTML=function(reactOutput,renderToStaticMarkup){return reactOutput?reactOutput.reduce((function(html,blocks){return(blocks instanceof Array?blocks:[blocks]).forEach((function(c){return html+=renderToStaticMarkup(c)})),html}),""):null},viewerAlignmentStyles={alignLeft:"_17-_F",textWrapNowrap:"_3OKLB",alignRight:"_3VL_9",alignCenter:"_3CWa-",sizeFullWidth:"_28A1_",renderedInTable:"erqrj",sizeContent:"_3mymk",sizeSmall:"_3vo3y",sizeSmallCenter:"_3fofE",flex:"_2orjS",left:"_3M0Fe",center:"_1oG79",right:"_2wn-L"},rtlStyle={rtl:"ZF7FS",ltr:"_1FoOD"},RichContentViewer=function(_Component){function RichContentViewer(props){var _this;(_this=_Component.call(this,props)||this).getContextualData=function(_ref,contentState){var _this$props$initialSt,_config$uiSettings,t=_ref.t,theme=_ref.theme,_ref$isMobile=_ref.isMobile,isMobile=void 0!==_ref$isMobile&&_ref$isMobile,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,customAnchorScroll=_ref.customAnchorScroll,config=_ref.config,_ref$helpers=_ref.helpers,helpers=void 0===_ref$helpers?{}:_ref$helpers,locale=_ref.locale,disabled=_ref.disabled,seoMode=_ref.seoMode,iframeSandboxDomain=_ref.iframeSandboxDomain,textAlignment=_ref.textAlignment;deprecateHelpers(helpers,config);var version=Version.currentVersion,contentId=null===(_this$props$initialSt=_this.props.initialState)||void 0===_this$props$initialSt?void 0:_this$props$initialSt.ID;return{t:t,theme:theme,isMobile:isMobile,anchorTarget:anchorTarget,relValue:relValue,customAnchorScroll:customAnchorScroll,config:config,helpers:_extends({},helpers,{onViewerLoaded:function(args){var _helpers$onViewerLoad;return null===(_helpers$onViewerLoad=helpers.onViewerLoaded)||void 0===_helpers$onViewerLoad?void 0:_helpers$onViewerLoad.call(helpers,_extends({},args,{version:version,contentId:contentId}))},onViewerAction:function(pluginId,actionName,value){var _helpers$onViewerActi;return null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi?void 0:_helpers$onViewerActi.call(helpers,pluginId,actionName,value,contentId)}}),locale:locale,disabled:disabled,seoMode:seoMode,contentState:contentState,iframeSandboxDomain:iframeSandboxDomain,disableRightClick:null==config||null===(_config$uiSettings=config.uiSettings)||void 0===_config$uiSettings?void 0:_config$uiSettings.disableRightClick,textAlignment:textAlignment}};var styles=_extends({},viewerStyles,viewerAlignmentStyles,rtlStyle);_this.styles=mergeStyles({styles:styles,theme:props.theme}),_this.typeMappers=combineMappers(props.typeMappers);var _props$experiments=props.experiments,experiments=void 0===_props$experiments?{}:_props$experiments,_props$isMobile=props.isMobile,isMobile=void 0!==_props$isMobile&&_props$isMobile,t=props.t;return _this.state={context:{experiments:experiments,isMobile:isMobile,t:t}},_this}_inheritsLoose(RichContentViewer,_Component),RichContentViewer.getDerivedStateFromProps=function(props){return{raw:RichContentViewer.getInitialState(props)}},RichContentViewer.getDerivedStateFromError=function(error){return{error:error}};var _proto=RichContentViewer.prototype;return _proto.componentDidCatch=function(error,errorInfo){console.error({error:error,errorInfo:errorInfo})},_proto.componentDidMount=function(){this.reportDebuggingInfo()},_proto.reportDebuggingInfo=function(){var _this2=this;"undefined"!=typeof window&&/debug/i.test(window.location.search)&&!window.__RICOS_INFO__&&import(
/* webpackChunkName: "debugging-info" */
"wix-rich-content-common/libs/debugging-info").then((function(_ref2){(0,_ref2.reportDebuggingInfo)({version:Version.currentVersion,reporter:"Rich Content Viewer",plugins:Object.keys(_this2.typeMappers),getContent:function(){return _this2.props.initialState},getConfig:function(){return _this2.props.config}})}))},_proto.render=function(){var _this$props=this.props,onError=_this$props.onError,_this$props$config=_this$props.config,config=void 0===_this$props$config?{}:_this$props$config,onHover=_this$props.onHover,isMobile=_this$props.isMobile,isInnerRcv=_this$props.isInnerRcv,textDirection=_this$props.textDirection,direction=_this$props.direction,inlineStyleMappers=_this$props.inlineStyleMappers,locale=_this$props.locale,addAnchors=_this$props.addAnchors,renderedInTable=_this$props.renderedInTable,platform=_this$props.platform,t=_this$props.t,typeMappers=_this$props.typeMappers,_this$props$setRef=_this$props.setRef,setRef=void 0===_this$props$setRef?function(){}:_this$props$setRef,_this$props$onMouseOv=_this$props.onMouseOver,onMouseOver=void 0===_this$props$onMouseOv?function(){}:_this$props$onMouseOv,decorators=[].concat(this.props.decorators,[createJustificationFixDecorator()]);try{var _classNames,_classNames2,_config$SPOILER_TYPE,_config$SPOILER_TYPE2;if(this.state.error)return onError(this.state.error),null;var styles=this.styles,wrapperClassName=classNames(styles.wrapper,((_classNames={})[styles.desktop]=!platform||"desktop"===platform,_classNames)),tableClassNames=classNames(styles.renderedInTable,viewerStyles.renderedInTable,draftDefaultStyles_renderedInTable),editorClassName=classNames(styles.editor,renderedInTable&&tableClassNames,((_classNames2={})[styles.rtl]="rtl"===textDirection,_classNames2)),initSpoilers=null===(_config$SPOILER_TYPE=config[SPOILER_TYPE])||void 0===_config$SPOILER_TYPE?void 0:_config$SPOILER_TYPE.initSpoilersContentState,SpoilerViewerWrapper=null===(_config$SPOILER_TYPE2=config[SPOILER_TYPE])||void 0===_config$SPOILER_TYPE2?void 0:_config$SPOILER_TYPE2.SpoilerViewerWrapper,contextualData=this.getContextualData(this.props,this.state.raw),innerRCEViewerProps={typeMappers:typeMappers,inlineStyleMappers:inlineStyleMappers,decorators:decorators,config:config,t:t,renderedInTable:renderedInTable,isMobile:isMobile},output=convertToReact(styles,textDirection,this.typeMappers,contextualData,decorators,inlineStyleMappers,config,initSpoilers,SpoilerViewerWrapper,{addAnchors:addAnchors},innerRCEViewerProps,this.props.documentStyle),dataId=isInnerRcv?{}:{"data-id":"rich-content-viewer"};return React.createElement(GlobalContext.Provider,{value:this.state.context},React.createElement("div",Object.assign({className:wrapperClassName,dir:direction||getLangDir(locale),onMouseEnter:function(e){return onHover&&onHover(e)},ref:setRef,onMouseOver:onMouseOver},dataId),React.createElement("div",{className:editorClassName},output),React.createElement(AccessibilityListener,{isMobile:isMobile})))}catch(err){return onError(err),null}},RichContentViewer}(Component);RichContentViewer.defaultProps={theme:{},decorators:[],typeMappers:[],inlineStyleMappers:[],locale:"en",onError:function(err){throw err},normalize:{},config:{}},RichContentViewer.getInitialState=function(props){var _config$IMAGE_TYPE,_config$GALLERY_TYPE,_config$VIDEO_TYPE,initialState=props.initialState,anchorTarget=props.anchorTarget,relValue=props.relValue,_props$normalize=props.normalize,_props$normalize$disa=_props$normalize.disableInlineImages,disableInlineImages=void 0!==_props$normalize$disa&&_props$normalize$disa,_props$normalize$remo=_props$normalize.removeInvalidInlinePlugins,removeInvalidInlinePlugins=void 0!==_props$normalize$remo&&_props$normalize$remo,config=props.config,uiSettings=config.uiSettings,disableImagesExpand=null===(_config$IMAGE_TYPE=config[IMAGE_TYPE])||void 0===_config$IMAGE_TYPE?void 0:_config$IMAGE_TYPE.disableExpand,disableGalleryExpand=null===(_config$GALLERY_TYPE=config[GALLERY_TYPE])||void 0===_config$GALLERY_TYPE?void 0:_config$GALLERY_TYPE.disableExpand,disableDownload=(null===(_config$VIDEO_TYPE=config[VIDEO_TYPE])||void 0===_config$VIDEO_TYPE?void 0:_config$VIDEO_TYPE.disableDownload)||(null==uiSettings?void 0:uiSettings.disableRightClick)||(null==uiSettings?void 0:uiSettings.disableDownload);return initialState?normalizeInitialState(initialState,{anchorTarget:anchorTarget,relValue:relValue,disableInlineImages:disableInlineImages,removeInvalidInlinePlugins:removeInvalidInlinePlugins,disableDownload:disableDownload,disableImagesExpand:disableImagesExpand,disableGalleryExpand:disableGalleryExpand}):void 0};var WrappedViewer=withI18n(RichContentViewer,englishResources,{forceRemount:!1}),I18nRichContentViewer=function(_Component){function I18nRichContentViewer(){return _Component.apply(this,arguments)||this}return _inheritsLoose(I18nRichContentViewer,_Component),I18nRichContentViewer.prototype.render=function(){return React.createElement(WrappedViewer,Object.assign({},this.props))},I18nRichContentViewer}(Component);I18nRichContentViewer.displayName="RichContentViewer";export{I18nRichContentViewer as RichContentViewer,convertToHTML,convertToReact};
//# sourceMappingURL=module.js.map

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

import TextSelectionToolbar from './TextSelectionToolbar';
import TwitterButton from './TwitterButton';
export { TextSelectionToolbar, TwitterButton };
export { default as RichContentViewer } from './I18nRichContentViewer';
export { convertToReact, convertToHTML } from './utils/convertContentState';
export { RichContentViewerProps } from './RichContentViewer';
//# sourceMappingURL=index.d.ts.map

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

{"name":"richlagetest","version":"0.0.0-00f8dddc44fd82f2d21396aebcac5d11f74a298c"}
{"name":"richlagetest","version":"0.0.0-2a4e8015935e3f676a45994de210472c6a11a441"}

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