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

draft-convert

Package Overview
Dependencies
Maintainers
9
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

draft-convert - npm Package Compare versions

Comparing version 2.1.6 to 2.1.7

2

dist/draft-convert.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOMServer"),require("Draft"),require("Immutable")):"function"==typeof define&&define.amd?define(["React","ReactDOMServer","Draft","Immutable"],t):"object"==typeof exports?exports.DraftConvert=t(require("React"),require("ReactDOMServer"),require("Draft"),require("Immutable")):e.DraftConvert=t(e.React,e.ReactDOMServer,e.Draft,e.Immutable)}(this,function(e,t,n,r){return function(e){function t(r){if(n[r])return n[r].exports;var l=n[r]={exports:{},id:r,loaded:!1};return e[r].call(l.exports,l,l.exports,t),l.loaded=!0,l.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.parseHTML=t.convertFromHTML=t.convertToHTML=void 0;var l=n(14),o=r(l),i=n(13),u=r(i),a=n(8),f=r(a);t.convertToHTML=o.default,t.convertFromHTML=u.default,t.parseHTML=f.default},function(t,n){t.exports=e},function(e,t,n){"use strict";var r=function(e,t,n,r,l,o,i,u){if(!e){var a;if(void 0===t)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,l,o,i,u],c=0;a=new Error(t.replace(/%s/g,function(){return f[c++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}};e.exports=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return e.offset===t.offset?t.length-e.length:e.offset-t.offset}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e){if(d.indexOf(e.type)!==-1)return c.default.renderToStaticMarkup(e);var t=c.default.renderToStaticMarkup(a.default.cloneElement(e,{},"\r")).split("\r");return(0,i.default)(t.length>1,"convertToHTML: Element of type "+e.type+" must render children"),(0,i.default)(t.length<3,"convertToHTML: Element of type "+e.type+" cannot use carriage return character"),{start:t[0],end:t[1]}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var o=n(2),i=r(o),u=n(1),a=r(u),f=n(5),c=r(f),d=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]},function(e,n){e.exports=t},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return function(){var n=e.apply(void 0,arguments);return void 0!==n&&null!==n?n:t.apply(void 0,arguments)}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e){return c.default.isValidElement(e)&&c.default.Children.count(e.props.children)>0}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(void 0===e||null===e)return e;if("string"==typeof e)return e;if(c.default.isValidElement(e)){if(l(e))return s.default.renderToStaticMarkup(e);var n=(0,y.default)(e);if(null!==t&&"object"===("undefined"==typeof n?"undefined":i(n))){var r=n.start,o=n.end;return r+t+o}return n}if((0,a.default)(Object.prototype.hasOwnProperty.call(e,"start")&&Object.prototype.hasOwnProperty.call(e,"end"),"convertToHTML: received conversion data without either an HTML string, ReactElement or an object with start/end tags"),null!==t){var u=e.start,f=e.end;return u+t+f}return e}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=o;var u=n(2),a=r(u),f=n(1),c=r(f),d=n(5),s=r(d),p=n(4),y=r(p)},function(e,t){"use strict";function n(e){var t=void 0;if("undefined"!=typeof DOMParser){var n=new DOMParser;t=n.parseFromString(e,"text/html"),null!==t&&null!==t.body||(t=r(e))}else t=r(e);return t.body}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var r=function(e){var t=document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=e,t}},function(e,t){"use strict";function n(e,t,n,r,l,o){var i=r-n,u=t+n<=e.offset;if(u)return Object.assign({},e,{offset:e.offset+i});var a=t>=e.offset&&t+n<=e.offset+e.length;if(a)return Object.assign({},e,{length:e.length+i});var f=e.offset>=t&&e.offset+e.length<=t+n&&l>0;if(f)return Object.assign({},e,{offset:e.offset+l});var c=e.offset<t&&e.offset+e.length<=t+n&&e.offset+e.length>t&&l>0;if(c)return[Object.assign({},e,{length:t-e.offset}),Object.assign({},e,{offset:t+l,length:e.offset-t+e.length})];var d=e.offset>=t&&e.offset+e.length>t+n&&t+n>e.offset&&o>0;return d?[Object.assign({},e,{offset:e.offset+l,length:t+n-e.offset}),Object.assign({},e,{offset:t+n+l+o,length:e.offset+e.length-(t+n)})]:e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t){e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=r(o),u=n(3),a=r(u),f=n(7),c=r(f),d=n(20),s=r(d),p=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments[1]);return e};t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p,r=[].concat(l(e.text)),o=n;if(n.__isMiddleware&&(o=n(p)),Object.prototype.hasOwnProperty.call(e,"entityRanges")&&e.entityRanges.length>0){for(var u=e.entityRanges.sort(a.default),f=e.inlineStyleRanges,d=function(e){var n=u[e],a=t[n.key],d=r.slice(n.offset,n.offset+n.length).join(""),p=o(a,d),y=[].concat(l((0,c.default)(p,d)||d)),v=(0,s.default)(p,"start"),h=(0,s.default)(p,"end"),g=function(t,r){return r>e||Object.prototype.hasOwnProperty.call(t,"style")?(0,i.default)(t,n.offset,n.length,y.length,v,h):t},m=function(e){return e.reduce(function(e,t,n){var r=g(t,n);return Array.isArray(r)?e.concat(r):e.concat([r])},[])};u=m(u),f=m(f),r=[].concat(l(r.slice(0,n.offset)),l(y),l(r.slice(n.offset+n.length)))},y=0;y<u.length;y++)d(y);return Object.assign({},e,{text:r.join(""),inlineStyleRanges:f,entityRanges:u})}return e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=r(o),u=n(22),a=r(u),f=n(6),c=r(f),d=n(7),s=r(d),p=n(3),y=r(p),v=n(16),h=r(v),g=function(e,t){return e.filter(function(e){return!t.some(function(t){return t.style===e.style})})},m=function(e,t){return t.reduceRight(function(e,t){var n=e[e.length-1];return(0,i.default)(n.style===t.style,"Style "+n.style+" to be removed doesn't match expected "+t.style),e.slice(0,-1)},e)},b=function(e,t){return t.filter(function(t){return e>=t.offset&&e<t.offset+t.length})},M=function(e,t){var n=e.offset<=t.offset,r=e.offset+e.length>=t.offset+t.length;return n&&r},E=function(e,t){var n=t.offset+t.length,r=e.offset+e.length;return n-r},x=function(e,t){for(var n=0;n<e.length;){if(!t.every(M.bind(null,e[n])))return e.slice(n);n++}return[]},O=function(e,t,n){return t+(0,s.default)(e(n.style)).start},_=function(e,t,n){return(0,s.default)(e(n.style)).end+t},T=function(e){return function(t){return e(t)}};T.__isMiddleware=!0,t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T;(0,i.default)(null!==e&&void 0!==e,"Expected raw block to be non-null");var n=void 0;n=t.__isMiddleware===!0?t(h.default):(0,c.default)((0,a.default)(t),(0,a.default)(h.default));for(var r="",o=[],u=e.inlineStyleRanges.sort(y.default),f=[].concat(l(e.text)),d=0;d<f.length;d++){var p=b(d,u),v=g(o,p),M=g(p,o),w=g(o,v),S=x(w,M),j=S.concat(M).sort(E),k=j.reduce(O.bind(null,n),""),R=v.concat(S).reduce(_.bind(null,n),"");r+=R+k+f[d],o=m(o,S.concat(v)),o=o.concat(j),(0,i.default)(o.length===p.length,"Character "+d+": "+(o.length-p.length)+" styles left on stack that should no longer be there")}return r=o.reduceRight(function(e,t){return e+(0,s.default)(n(t.style)).end},r)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(){return{text:"",inlines:[],entities:[],blocks:[]}}function o(e){var t=new Array(1);return e&&(t[0]=e),{text:T,inlines:[(0,m.OrderedSet)()],entities:t,blocks:[]}}function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,m.Map)();return n===!0?{text:"\r",inlines:[(0,m.OrderedSet)()],entities:new Array(1),blocks:[{type:e,data:r,depth:Math.max(0,Math.min(w,t))}],isNewline:!0}:{text:"\n",inlines:[(0,m.OrderedSet)()],entities:new Array(1),blocks:[]}}function u(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,m.Map)();return{text:"\r",inlines:[(0,m.OrderedSet)()],entities:new Array(1),blocks:[{type:e,data:n,depth:Math.max(0,Math.min(w,t))}]}}function a(e,t){switch(e){case"h1":return"header-one";case"h2":return"header-two";case"h3":return"header-three";case"h4":return"header-four";case"h5":return"header-five";case"h6":return"header-six";case"li":return"ol"===t?"ordered-list-item":"unordered-list-item";case"blockquote":return"blockquote";case"pre":return"code-block";case"div":case"p":return"unstyled";default:return null}}function f(e,t,n){return a(e,n)}function c(e,t,n){var r=P[e];return r?n=n.add(r).toOrderedSet():t instanceof HTMLElement&&!function(){var e=t;n=n.withMutations(function(t){"bold"===e.style.fontWeight&&t.add("BOLD"),"italic"===e.style.fontStyle&&t.add("ITALIC"),"underline"===e.style.textDecoration&&t.add("UNDERLINE"),"line-through"===e.style.textDecoration&&t.add("STRIKETHROUGH")}).toOrderedSet()}(),n}function d(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,m.OrderedSet)();return c(e,t,n)}function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.text.slice(0,1),l=e.text.slice(-1),o="\r"===l&&"\r"===r,i="\r"!==e.text&&"\r"!==t.text,u="\r"===e.text&&!e.isNewline&&t.isNewline;if(o&&(i||u)&&(e.text=e.text.slice(0,-1),e.inlines.pop(),e.entities.pop(),e.blocks.pop()),"\r"===e.text.slice(-1)&&n===!0){if(t.text===T||"\n"===t.text)return e;r!==T&&"\n"!==r||(t.text=t.text.slice(1),t.inlines.shift(),t.entities.shift())}var a=0===e.text.length&&t.isNewline;return{text:e.text+t.text,inlines:e.inlines.concat(t.inlines),entities:e.entities.concat(t.entities),blocks:e.blocks.concat(t.blocks),isNewline:a}}function p(e){return L.some(function(t){return e.indexOf("<"+t)!==-1})}function y(e,t,n,r,f,d,p,v,h,b,M,E,x,_,w,S){var k=e.nodeName.toLowerCase(),R=!1,L="unstyled";if("#text"===k){var P=function(){var n=e.textContent;if(""===n.trim()&&null===r)return{v:l()};if(""===n.trim()&&"code-block"!==r)return{v:o(S)};"code-block"!==r&&(n=n.replace(j,T));var i=Array(n.length).fill(S),u=0,a=h(n,M,E,x,_).sort(O.default);return a.forEach(function(e){var t=e.entity,r=e.offset,l=e.length,o=e.result,a=r+u;null!==o&&void 0!==o||(o=n.substr(a,l));var f=n.split("");f.splice.bind(f,a,l).apply(f,o.split("")),n=f.join(""),i.splice.bind(i,a,l).apply(i,Array(o.length).fill(t)),u+=o.length-l}),{v:{text:n,inlines:Array(n.length).fill(t),entities:i,blocks:[]}}}();if("object"===("undefined"==typeof P?"undefined":g(P)))return P.v}if("br"===k){var D=r;return null===D?i("unstyled",d,!0):i(D||"unstyled",d,w.flat)}var H=l(),A=null;t=c(k,e,t),t=p(k,e,t),"ul"!==k&&"ol"!==k||(n&&(d+=1),n=k,r=null);var C=b(k,e,n,r),I=void 0,N=void 0;if(C===!1)return l();if(C=C||{},"string"==typeof C?(I=C,N=(0,m.Map)()):(I="string"==typeof C?C:C.type,N=C.data?(0,m.Map)(C.data):(0,m.Map)()),r||f.indexOf(k)===-1&&!I)if(!n||"ordered-list-item"!==r&&"unordered-list-item"!==r||"li"!==k)r&&"atomic"!==r&&"atomic"===I&&(r=I,R=!0,H=i(I,d,!0,N));else{var q=a(k,n);H=u(q,d),r=q,R=!0,L="ul"===n?"unordered-list-item":"ordered-list-item"}else H=u(I||a(k,n),d,N),r=I||a(k,n),R=!0;var B=e.firstChild;null!=B||!S||"atomic"!==I&&"atomic"!==r||(B=document.createTextNode("a")),null!=B&&(k=B.nodeName.toLowerCase());for(var V=null;B;){V=v(k,B,M,E,x,_),A=y(B,t,n,r,f,d,p,v,h,b,M,E,x,_,w,V||S),H=s(H,A,w.flat);var K=B.nextSibling;if(K&&f.indexOf(k)>=0&&r){var U=b(k,B,n,r),F=void 0,G=void 0;U!==!1&&(U=U||{},"string"==typeof U?(F=U,G=(0,m.Map)()):(F=U.type||a(k,n),G=U.data?(0,m.Map)(U.data):(0,m.Map)()),H=s(H,i(F,d,w.flat,G),w.flat))}K&&(k=K.nodeName.toLowerCase()),B=K}return R&&(H=s(H,u(L,d,(0,m.Map)()),w.flat)),H}function v(e,t,n,r,l,o,i,u,a,f,c){e=e.trim().replace(S,"").replace(k,T);var d=c(e);if(!d)return null;var s=p(e)?L.concat(["div"]):["div"],v=y(d,(0,m.OrderedSet)(),"ul",null,s,-1,t,n,r,l,o,i,u,a,f);return 0===v.text.indexOf("\r")&&(v={text:v.text.slice(1),inlines:v.inlines.slice(1),entities:v.entities.slice(1),blocks:v.blocks}),"\r"===v.text.slice(-1)&&(v.text=v.text.slice(0,-1),v.inlines=v.inlines.slice(0,-1),v.entities=v.entities.slice(0,-1),v.blocks.pop()),0===v.blocks.length&&v.blocks.push({type:"unstyled",data:(0,m.Map)(),depth:0}),v.text.split("\r").length===v.blocks.length+1&&v.blocks.unshift({type:"unstyled",data:(0,m.Map)(),depth:0}),v}function h(e,t,n,r,l,o,i,u,a,f,c,d){var s=v(e,t,n,r,l,o,i,u,a,f,c,d);if(null==s)return[];var p=0;return s.text.split("\r").map(function(e,t){e=q(e);var n=p+e.length,r=N(s).inlines.slice(p,n),l=N(s).entities.slice(p,n),o=(0,m.List)(r.map(function(e,t){var n={style:e,entity:null};return l[t]&&(n.entity=l[t]),b.CharacterMetadata.create(n)}));return p=n+1,new b.ContentBlock({key:d(),type:N(s).blocks[t].type,data:N(s).blocks[t].data,depth:N(s).blocks[t].depth,text:e,characterList:o})})}Object.defineProperty(t,"__esModule",{value:!0});var g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m=n(23),b=n(10),M=n(8),E=r(M),x=n(3),O=r(x),_="&nbsp;",T=" ",w=4,S=new RegExp("\r","g"),j=new RegExp("\n","g"),k=new RegExp(_,"g"),R=new RegExp("\r","g"),L=["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre"],P={b:"BOLD",code:"CODE",del:"STRIKETHROUGH",em:"ITALIC",i:"ITALIC",s:"STRIKETHROUGH",strike:"STRIKETHROUGH",strong:"BOLD",u:"UNDERLINE"},D=function(e,t){return e&&e.__isMiddleware===!0?e(t):e},H=function(e,t,n){},A=function(e,t,n){return n},C=function(e,t){},I=function(e){return[]},N=function(e){if(null!=e)return e;throw new Error("Got unexpected null or undefined")},q=function(e){return e.replace(R,"")},B=function(e){var t=e.htmlToStyle,n=void 0===t?A:t,r=e.htmlToEntity,l=void 0===r?C:r,o=e.textToEntity,i=void 0===o?I:o,u=e.htmlToBlock,a=void 0===u?H:u;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{flat:!1},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E.default,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:b.genKey,u=b.ContentState.createFromText(""),c=function(){if(u.createEntity){var e;return u=(e=u).createEntity.apply(e,arguments),u.getLastCreatedEntityKey()}return b.Entity.create.apply(b.Entity,arguments)},s=function(){if(u.getEntity){var e;return(e=u).getEntity.apply(e,arguments)}return b.Entity.get.apply(b.Entity,arguments)},p=function(){if(u.mergeEntityData){var e;return void(u=(e=u).mergeEntityData.apply(e,arguments))}b.Entity.mergeData.apply(b.Entity,arguments)},y=function(){if(u.replaceEntityData){var e;return void(u=(e=u).replaceEntityData.apply(e,arguments))}b.Entity.replaceData.apply(b.Entity,arguments)},v=h(e,D(n,d),D(l,C),D(i,I),D(a,f),c,s,p,y,t,r,o),g=b.BlockMapBuilder.createFromArray(v),m=v[0].getKey();return u.merge({blockMap:g,selectionBefore:b.SelectionState.createEmpty(m),selectionAfter:b.SelectionState.createEmpty(m)})}};t.default=function(){return arguments.length>=1&&"string"==typeof(arguments.length<=0?void 0:arguments[0])?B({}).apply(void 0,arguments):B.apply(void 0,arguments)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=n(2),o=r(l),i=n(1),u=r(i),a=n(5),f=r(a),c=n(10),d=n(17),s=r(d),p=n(11),y=r(p),v=n(12),h=r(v),g=n(6),m=r(g),b=n(18),M=r(b),E=n(19),x=r(E),O=n(21),_=r(O),T=n(15),w=r(T),S=function(e,t){return t},j=function(e){var t=e.styleToHTML,n=void 0===t?{}:t,r=e.blockToHTML,l=void 0===r?{}:r,i=e.entityToHTML,a=void 0===i?S:i;return function(e){(0,o.default)(null!==e&&void 0!==e,"Expected contentState to be non-null");var t=void 0;t=l.__isMiddleware===!0?l((0,M.default)(w.default)):(0,m.default)((0,M.default)(l),(0,M.default)(w.default));var r=(0,c.convertToRaw)(e),i=[],d=r.blocks.map(function(e){var l=e.type,o=e.depth,c="",d="",p=t(e);if(!p)throw new Error("convertToHTML: missing HTML definition for block with type "+e.type);if(p.nest)for(;o+1!==i.length||l!==i[o].type;)if(o+1===i.length){var v=i[o];c+=(0,_.default)(t(v)).nestEnd,d+=(0,_.default)(t(e)).nestStart,i[o]=e}else if(o+1<i.length){var g=i[i.length-1];c+=(0,_.default)(t(g)).nestEnd,i=i.slice(0,-1)}else d+=(0,_.default)(t(e)).nestStart,i.push(e);else c=i.reduceRight(function(e,n){return e+(0,_.default)(t(n)).nestEnd},""),i=[];var m=(0,h.default)((0,y.default)((0,s.default)(e),r.entityMap,a),n),b=(0,x.default)(t(e)),M=void 0;return M="string"==typeof b?b:b.start+m+b.end,0===m.length&&Object.prototype.hasOwnProperty.call(b,"empty")&&(M=u.default.isValidElement(b.empty)?f.default.renderToStaticMarkup(b.empty):b.empty),c+d+M}).join("");return d=i.reduce(function(e,n){return e+(0,_.default)(t(n)).nestEnd},d)}};t.default=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length&&Object.prototype.hasOwnProperty.call(t[0],"_map")&&null!=t[0].getBlockMap?j({}).apply(void 0,t):j.apply(void 0,t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=n(1),o=r(l);t.default={unstyled:o.default.createElement("p",null),paragraph:o.default.createElement("p",null),"header-one":o.default.createElement("h1",null),"header-two":o.default.createElement("h2",null),"header-three":o.default.createElement("h3",null),"header-four":o.default.createElement("h4",null),"header-five":o.default.createElement("h5",null),"header-six":o.default.createElement("h6",null),blockquote:o.default.createElement("blockquote",null),"unordered-list-item":{element:o.default.createElement("li",null),nest:o.default.createElement("ul",null)},"ordered-list-item":{element:o.default.createElement("li",null),nest:o.default.createElement("ol",null)},media:o.default.createElement("figure",null),atomic:o.default.createElement("figure",null)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e){switch(e){case"BOLD":return i.default.createElement("strong",null);case"ITALIC":return i.default.createElement("em",null);case"UNDERLINE":return i.default.createElement("u",null);case"CODE":return i.default.createElement("code",null);default:return{start:"",end:""}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var o=n(1),i=r(o)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=r(o),u=n(3),a=r(u),f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","\n":"<br/>"};t.default=function(e){for(var t=[].concat(l(e.text)),n=e.entityRanges.sort(a.default),r=e.inlineStyleRanges.sort(a.default),o="",u=function(e){var u=t[e];void 0!==f[u]?!function(){var e=f[u],t=[].concat(l(o)).length;o+=e;var a=function(n){return(0,i.default)(n,t,u.length,e.length,0,0)};n=n.map(a),r=r.map(a)}():o+=u},c=0;c<t.length;c++)u(c);return Object.assign({},e,{text:o,inlineStyleRanges:r,entityRanges:n})}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t){return"function"==typeof e?e(t):e[t.type]}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e){return f.default.isValidElement(e)&&f.default.Children.count(e.props.children)>0}function o(e){return(0,u.default)(null!==e&&void 0!==e,"Expected block HTML value to be non-null"),"string"==typeof e?e:f.default.isValidElement(e)?l(e)?d.default.renderToStaticMarkup(e):(0,p.default)(e):Object.prototype.hasOwnProperty.call(e,"element")&&f.default.isValidElement(e.element)?Object.assign({},e,(0,p.default)(e.element)):((0,u.default)(Object.prototype.hasOwnProperty.call(e,"start")&&Object.prototype.hasOwnProperty.call(e,"end"),"convertToHTML: received block information without either a ReactElement or an object with start/end tags"),e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=n(2),u=r(i),a=n(1),f=r(a),c=n(5),d=r(c),s=n(4),p=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(1),i=r(o),u=n(4),a=r(u),f=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"start";if(i.default.isValidElement(t)){var r=(0,a.default)(t);if("string"==typeof r)return 0;var o=r[n].length,u=i.default.Children.toArray(t.props.children)[0];return o+(u&&i.default.isValidElement(u)?e(u,n):0)}return"object"===("undefined"==typeof t?"undefined":l(t))&&t[n]?t[n].length:0};t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e){if((0,i.default)(null!==e&&void 0!==e,"Expected block HTML value to be non-null"),a.default.isValidElement(e.nest)){var t=(0,c.default)(e.nest),n=t.start,r=t.end;return Object.assign({},e,{nestStart:n,nestEnd:r})}return(0,i.default)(Object.prototype.hasOwnProperty.call(e,"nestStart")&&Object.prototype.hasOwnProperty.call(e,"nestEnd"),"convertToHTML: received block information without either a ReactElement or an object with start/end tags"),e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var o=n(2),i=r(o),u=n(1),a=r(u),f=n(4),c=r(f)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t){return"function"==typeof e?e(t):e[t]}}},function(e,t){e.exports=r}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("Immutable"),require("Draft"),require("ReactDOMServer")):"function"==typeof define&&define.amd?define(["React","Immutable","Draft","ReactDOMServer"],t):"object"==typeof exports?exports.DraftConvert=t(require("React"),require("Immutable"),require("Draft"),require("ReactDOMServer")):e.DraftConvert=t(e.React,e.Immutable,e.Draft,e.ReactDOMServer)}(window,function(e,t,n,r){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,i,l,a){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,i,l,a],s=0;(c=new Error(t.replace(/%s/g,function(){return u[s++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}}},function(e,t){e.exports=r},function(e,t,n){"use strict";n.r(t);var r=n(3),o=n.n(r),i=n(0),l=n.n(i),a=n(4),c=n.n(a),u=n(2);function s(e,t,n,r,o,i){var l=r-n;return t+n<=e.offset?Object.assign({},e,{offset:e.offset+l}):t>=e.offset&&t+n<=e.offset+e.length?Object.assign({},e,{length:e.length+l}):e.offset>=t&&e.offset+e.length<=t+n&&o>0?Object.assign({},e,{offset:e.offset+o}):e.offset<t&&e.offset+e.length<=t+n&&e.offset+e.length>t&&o>0?[Object.assign({},e,{length:t-e.offset}),Object.assign({},e,{offset:t+o,length:e.offset-t+e.length})]:e.offset>=t&&e.offset+e.length>t+n&&t+n>e.offset&&i>0?[Object.assign({},e,{offset:e.offset+o,length:t+n-e.offset}),Object.assign({},e,{offset:t+n+o+i,length:e.offset+e.length-(t+n)})]:e}var f=function(e,t){return e.offset===t.offset?t.length-e.length:e.offset-t.offset};function d(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var p={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","\n":"<br/>"},y=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"];function h(e){if(-1!==y.indexOf(e.type))return c.a.renderToStaticMarkup(e);var t=c.a.renderToStaticMarkup(l.a.cloneElement(e,{},"\r")).split("\r");return o()(t.length>1,"convertToHTML: Element of type ".concat(e.type," must render children")),o()(t.length<3,"convertToHTML: Element of type ".concat(e.type," cannot use carriage return character")),{start:t[0],end:t[1]}}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null==e)return e;if("string"==typeof e)return e;if(l.a.isValidElement(e)){if(function(e){return l.a.isValidElement(e)&&l.a.Children.count(e.props.children)>0}(e))return c.a.renderToStaticMarkup(e);var n=h(e);return null!==t&&"object"===g(n)?n.start+t+n.end:n}return o()(Object.prototype.hasOwnProperty.call(e,"start")&&Object.prototype.hasOwnProperty.call(e,"end"),"convertToHTML: received conversion data without either an HTML string, ReactElement or an object with start/end tags"),null!==t?e.start+t+e.end:e}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var v=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"start";if(l.a.isValidElement(t)){var r=h(t);if("string"==typeof r)return 0;var o=r[n].length,i=l.a.Children.toArray(t.props.children)[0];return o+(i&&l.a.isValidElement(i)?e(i,n):0)}return"object"===m(t)&&t[n]?t[n].length:0};function O(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var E=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;return e},x=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E,r=O(e.text),o=n;if(n.__isMiddleware&&(o=n(E)),Object.prototype.hasOwnProperty.call(e,"entityRanges")&&e.entityRanges.length>0){for(var i=e.entityRanges.sort(f),l=e.inlineStyleRanges,a=function(e){var n=i[e],a=t[n.key],c=r.slice(n.offset,n.offset+n.length).join(""),u=o(a,c),f=O(b(u,c)||c),d=v(u,"start"),p=v(u,"end"),y=function(t){return t.reduce(function(t,r,o){var i=function(t,r){return r>e||Object.prototype.hasOwnProperty.call(t,"style")?s(t,n.offset,n.length,f.length,d,p):t}(r,o);return Array.isArray(i)?t.concat(i):t.concat([i])},[])};i=y(i),l=y(l),r=[].concat(O(r.slice(0,n.offset)),O(f),O(r.slice(n.offset+n.length)))},c=0;c<i.length;c++)a(c);return Object.assign({},e,{text:r.join(""),inlineStyleRanges:l,entityRanges:i})}return e},w=function(e){return function(t){return"function"==typeof e?e(t):e[t]}},j=function(e,t){return function(){var n=e.apply(void 0,arguments);return null!=n?n:t.apply(void 0,arguments)}};function S(e){switch(e){case"BOLD":return l.a.createElement("strong",null);case"ITALIC":return l.a.createElement("em",null);case"UNDERLINE":return l.a.createElement("u",null);case"CODE":return l.a.createElement("code",null);default:return{start:"",end:""}}}function M(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var T=function(e,t){return e.filter(function(e){return!t.some(function(t){return t.style===e.style})})},k=function(e,t){return t.reduceRight(function(e,t){var n=e[e.length-1];return o()(n.style===t.style,"Style ".concat(n.style," to be removed doesn't match expected ").concat(t.style)),e.slice(0,-1)},e)},R=function(e,t){return t.filter(function(t){return e>=t.offset&&e<t.offset+t.length})},L=function(e,t){var n=e.offset<=t.offset,r=e.offset+e.length>=t.offset+t.length;return n&&r},A=function(e,t){return t.offset+t.length-(e.offset+e.length)},D=function(e,t){for(var n=0;n<e.length;){if(!t.every(L.bind(null,e[n])))return e.slice(n);n++}return[]},H=function(e,t,n){return t+b(e(n.style)).start},I=function(e,t,n){return b(e(n.style)).end+t},C=function(e){return function(t){return e(t)}};C.__isMiddleware=!0;var P=function(e){return function(t){return"function"==typeof e?e(t):e[t.type]}};function _(e){return o()(null!=e,"Expected block HTML value to be non-null"),"string"==typeof e?e:l.a.isValidElement(e)?(t=e,l.a.isValidElement(t)&&l.a.Children.count(t.props.children)>0?c.a.renderToStaticMarkup(e):h(e)):Object.prototype.hasOwnProperty.call(e,"element")&&l.a.isValidElement(e.element)?Object.assign({},e,h(e.element)):(o()(Object.prototype.hasOwnProperty.call(e,"start")&&Object.prototype.hasOwnProperty.call(e,"end"),"convertToHTML: received block information without either a ReactElement or an object with start/end tags"),e);var t}function N(e){if(o()(null!=e,"Expected block HTML value to be non-null"),l.a.isValidElement(e.nest)){var t=h(e.nest),n=t.start,r=t.end;return Object.assign({},e,{nestStart:n,nestEnd:r})}return o()(Object.prototype.hasOwnProperty.call(e,"nestStart")&&Object.prototype.hasOwnProperty.call(e,"nestEnd"),"convertToHTML: received block information without either a ReactElement or an object with start/end tags"),e}var q={unstyled:l.a.createElement("p",null),paragraph:l.a.createElement("p",null),"header-one":l.a.createElement("h1",null),"header-two":l.a.createElement("h2",null),"header-three":l.a.createElement("h3",null),"header-four":l.a.createElement("h4",null),"header-five":l.a.createElement("h5",null),"header-six":l.a.createElement("h6",null),blockquote:l.a.createElement("blockquote",null),"unordered-list-item":{element:l.a.createElement("li",null),nest:l.a.createElement("ul",null)},"ordered-list-item":{element:l.a.createElement("li",null),nest:l.a.createElement("ol",null)},media:l.a.createElement("figure",null),atomic:l.a.createElement("figure",null)},B=function(e,t){return t},V=function(e){var t=e.styleToHTML,n=void 0===t?{}:t,r=e.blockToHTML,i=void 0===r?{}:r,a=e.entityToHTML,y=void 0===a?B:a;return function(e){var t;o()(null!=e,"Expected contentState to be non-null"),t=!0===i.__isMiddleware?i(P(q)):j(P(i),P(q));var r=Object(u.convertToRaw)(e),a=[],h=r.blocks.map(function(e){var i=e.type,u=e.depth,h="",g="",m=t(e);if(!m)throw new Error("convertToHTML: missing HTML definition for block with type ".concat(e.type));if(m.nest)for(;u+1!==a.length||i!==a[u].type;)if(u+1===a.length){var v=a[u];h+=N(t(v)).nestEnd,g+=N(t(e)).nestStart,a[u]=e}else if(u+1<a.length){var O=a[a.length-1];h+=N(t(O)).nestEnd,a=a.slice(0,-1)}else g+=N(t(e)).nestStart,a.push(e);else h=a.reduceRight(function(e,n){return e+N(t(n)).nestEnd},""),a=[];var E,L=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C;o()(null!=e,"Expected raw block to be non-null"),t=!0===n.__isMiddleware?n(S):j(w(n),w(S));for(var r="",i=[],l=e.inlineStyleRanges.sort(f),a=M(e.text),c=0;c<a.length;c++){var u=R(c,l),s=T(i,u),d=T(u,i),p=T(i,s),y=D(p,d),h=y.concat(d).sort(A),g=h.reduce(H.bind(null,t),""),m=s.concat(y).reduce(I.bind(null,t),"");r+=m+g+a[c],i=(i=k(i,y.concat(s))).concat(h),o()(i.length===u.length,"Character ".concat(c,": ").concat(i.length-u.length," styles left on stack that should no longer be there"))}return r=i.reduceRight(function(e,n){return e+b(t(n.style)).end},r)}(x(function(e){for(var t=d(e.text),n=e.entityRanges.sort(f),r=e.inlineStyleRanges.sort(f),o="",i=function(e){var i=t[e];if(void 0!==p[i]){var l=p[i],a=d(o).length;o+=l;var c=function(e){return s(e,a,i.length,l.length,0,0)};n=n.map(c),r=r.map(c)}else o+=i},l=0;l<t.length;l++)i(l);return Object.assign({},e,{text:o,inlineStyleRanges:r,entityRanges:n})}(e),r.entityMap,y),n),P=_(t(e));return E="string"==typeof P?P:P.start+L+P.end,0===L.length&&Object.prototype.hasOwnProperty.call(P,"empty")&&(E=l.a.isValidElement(P.empty)?c.a.renderToStaticMarkup(P.empty):P.empty),h+g+E}).join("");return h=a.reduce(function(e,n){return e+N(t(n)).nestEnd},h)}},K=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length&&Object.prototype.hasOwnProperty.call(t[0],"_map")&&null!=t[0].getBlockMap?V({}).apply(void 0,t):V.apply(void 0,t)},U=n(1),G=function(e){var t=document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=e,t};function F(e){var t;"undefined"!=typeof DOMParser?null!==(t=(new DOMParser).parseFromString(e,"text/html"))&&null!==t.body||(t=G(e)):t=G(e);return t.body}var W=" ",z=4,J=new RegExp("\r","g"),Q=new RegExp("\n","g"),X=new RegExp("&nbsp;","g"),Y=new RegExp("\r","g"),Z=["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre"],$={b:"BOLD",code:"CODE",del:"STRIKETHROUGH",em:"ITALIC",i:"ITALIC",s:"STRIKETHROUGH",strike:"STRIKETHROUGH",strong:"BOLD",u:"UNDERLINE"},ee=function(e,t){return e&&!0===e.__isMiddleware?e(t):e},te=function(e,t,n){},ne=function(e,t,n){return n},re=function(e,t){},oe=function(e){return[]},ie=function(e){if(null!=e)return e;throw new Error("Got unexpected null or undefined")},le=function(e){return e.replace(Y,"")};function ae(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Object(U.Map)();return!0===n?{text:"\r",inlines:[Object(U.OrderedSet)()],entities:new Array(1),blocks:[{type:e,data:r,depth:Math.max(0,Math.min(z,t))}],isNewline:!0}:{text:"\n",inlines:[Object(U.OrderedSet)()],entities:new Array(1),blocks:[]}}function ce(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object(U.Map)();return{text:"\r",inlines:[Object(U.OrderedSet)()],entities:new Array(1),blocks:[{type:e,data:n,depth:Math.max(0,Math.min(z,t))}]}}function ue(e,t){switch(e){case"h1":return"header-one";case"h2":return"header-two";case"h3":return"header-three";case"h4":return"header-four";case"h5":return"header-five";case"h6":return"header-six";case"li":return"ol"===t?"ordered-list-item":"unordered-list-item";case"blockquote":return"blockquote";case"pre":return"code-block";case"div":case"p":return"unstyled";default:return null}}function se(e,t,n){return ue(e,n)}function fe(e,t,n){var r=$[e];if(r)n=n.add(r).toOrderedSet();else if(t instanceof HTMLElement){var o=t;n=n.withMutations(function(e){"bold"===o.style.fontWeight&&e.add("BOLD"),"italic"===o.style.fontStyle&&e.add("ITALIC"),"underline"===o.style.textDecoration&&e.add("UNDERLINE"),"line-through"===o.style.textDecoration&&e.add("STRIKETHROUGH")}).toOrderedSet()}return n}function de(e,t){return fe(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object(U.OrderedSet)())}function pe(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.text.slice(0,1),o="\r"===e.text.slice(-1)&&"\r"===r,i="\r"!==e.text&&"\r"!==t.text,l="\r"===e.text&&!e.isNewline&&t.isNewline;if(o&&(i||l)&&(e.text=e.text.slice(0,-1),e.inlines.pop(),e.entities.pop(),e.blocks.pop()),"\r"===e.text.slice(-1)&&!0===n){if(t.text===W||"\n"===t.text)return e;r!==W&&"\n"!==r||(t.text=t.text.slice(1),t.inlines.shift(),t.entities.shift())}var a=0===e.text.length&&t.isNewline;return{text:e.text+t.text,inlines:e.inlines.concat(t.inlines),entities:e.entities.concat(t.entities),blocks:e.blocks.concat(t.blocks),isNewline:a}}function ye(e,t,n,r,o,i,l,a,c,u,s,d,p,y,h,g){var b=e.nodeName.toLowerCase(),m=!1,v="unstyled";if("#text"===b){var O=e.textContent;if(""===O.trim()&&null===r)return{text:"",inlines:[],entities:[],blocks:[]};if(""===O.trim()&&"code-block"!==r)return function(e){var t=new Array(1);return e&&(t[0]=e),{text:W,inlines:[Object(U.OrderedSet)()],entities:t,blocks:[]}}(g);"code-block"!==r&&(O=O.replace(Q,W));var E=Array(O.length).fill(g),x=0;return c(O,s,d,p,y).sort(f).forEach(function(e){var t=e.entity,n=e.offset,r=e.length,o=e.result,i=n+x;null==o&&(o=O.substr(i,r));var l=O.split("");l.splice.bind(l,i,r).apply(l,o.split("")),O=l.join(""),E.splice.bind(E,i,r).apply(E,Array(o.length).fill(t)),x+=o.length-r}),{text:O,inlines:Array(O.length).fill(t),entities:E,blocks:[]}}if("br"===b){var w=r;return null===w?ae("unstyled",i,!0):ae(w||"unstyled",i,h.flat)}var j={text:"",inlines:[],entities:[],blocks:[]};t=l(b,e,t=fe(b,e,t)),"ul"!==b&&"ol"!==b||(n&&(i+=1),n=b,r=null);var S,M,T=u(b,e,n,r);if(!1===T)return{text:"",inlines:[],entities:[],blocks:[]};if("string"==typeof(T=T||{})?(S=T,M=Object(U.Map)()):(S="string"==typeof T?T:T.type,M=T.data?Object(U.Map)(T.data):Object(U.Map)()),r||-1===o.indexOf(b)&&!S)if(!n||"ordered-list-item"!==r&&"unordered-list-item"!==r||"li"!==b)r&&"atomic"!==r&&"atomic"===S&&(r=S,m=!0,j=ae(S,i,!0,M));else{var k=ue(b,n);j=ce(k,i),r=k,m=!0,v="ul"===n?"unordered-list-item":"ordered-list-item"}else j=ce(S||ue(b,n),i,M),r=S||ue(b,n),m=!0;var R=e.firstChild;null!=R||!g||"atomic"!==S&&"atomic"!==r||(R=document.createTextNode("a")),null!=R&&(b=R.nodeName.toLowerCase());for(var L=null;R;){L=a(b,R,s,d,p,y),j=pe(j,ye(R,t,n,r,o,i,l,a,c,u,s,d,p,y,h,L||g),h.flat);var A=R.nextSibling;if(A&&o.indexOf(b)>=0&&r){var D=u(b,R,n,r),H=void 0,I=void 0;!1!==D&&("string"==typeof(D=D||{})?(H=D,I=Object(U.Map)()):(H=D.type||ue(b,n),I=D.data?Object(U.Map)(D.data):Object(U.Map)()),j=pe(j,ae(H,i,h.flat,I),h.flat))}A&&(b=A.nodeName.toLowerCase()),R=A}return m&&(j=pe(j,ce(v,i,Object(U.Map)()),h.flat)),j}function he(e,t,n,r,o,i,l,a,c,u,s){var f=s(e=e.trim().replace(J,"").replace(X,W));if(!f)return null;var d=function(e){return Z.some(function(t){return-1!==e.indexOf("<".concat(t))})}(e)?Z.concat(["div"]):["div"],p=ye(f,Object(U.OrderedSet)(),"ul",null,d,-1,t,n,r,o,i,l,a,c,u);return 0===p.text.indexOf("\r")&&(p={text:p.text.slice(1),inlines:p.inlines.slice(1),entities:p.entities.slice(1),blocks:p.blocks}),"\r"===p.text.slice(-1)&&(p.text=p.text.slice(0,-1),p.inlines=p.inlines.slice(0,-1),p.entities=p.entities.slice(0,-1),p.blocks.pop()),0===p.blocks.length&&p.blocks.push({type:"unstyled",data:Object(U.Map)(),depth:0}),p.text.split("\r").length===p.blocks.length+1&&p.blocks.unshift({type:"unstyled",data:Object(U.Map)(),depth:0}),p}function ge(e,t,n,r,o,i,l,a,c,s,f,d){var p=he(e,t,n,r,o,i,l,a,c,s,f);if(null==p)return[];var y=0;return p.text.split("\r").map(function(e,t){e=le(e);var n=y+e.length,r=ie(p).inlines.slice(y,n),o=ie(p).entities.slice(y,n),i=Object(U.List)(r.map(function(e,t){var n={style:e,entity:null};return o[t]&&(n.entity=o[t]),u.CharacterMetadata.create(n)}));return y=n+1,new u.ContentBlock({key:d(),type:ie(p).blocks[t].type,data:ie(p).blocks[t].data,depth:ie(p).blocks[t].depth,text:e,characterList:i})})}var be=function(e){var t=e.htmlToStyle,n=void 0===t?ne:t,r=e.htmlToEntity,o=void 0===r?re:r,i=e.textToEntity,l=void 0===i?oe:i,a=e.htmlToBlock,c=void 0===a?te:a;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{flat:!1},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:F,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:u.genKey,a=u.ContentState.createFromText(""),s=function(){var e;return a.createEntity?(a=(e=a).createEntity.apply(e,arguments)).getLastCreatedEntityKey():u.Entity.create.apply(u.Entity,arguments)},f=function(){var e;return a.getEntity?(e=a).getEntity.apply(e,arguments):u.Entity.get.apply(u.Entity,arguments)},d=function(){var e;a.mergeEntityData?a=(e=a).mergeEntityData.apply(e,arguments):u.Entity.mergeData.apply(u.Entity,arguments)},p=function(){var e;a.replaceEntityData?a=(e=a).replaceEntityData.apply(e,arguments):u.Entity.replaceData.apply(u.Entity,arguments)},y=ge(e,ee(n,de),ee(o,re),ee(l,oe),ee(c,se),s,f,d,p,t,r,i),h=u.BlockMapBuilder.createFromArray(y),g=y[0].getKey();return a.merge({blockMap:h,selectionBefore:u.SelectionState.createEmpty(g),selectionAfter:u.SelectionState.createEmpty(g)})}},me=function(){return arguments.length>=1&&"string"==typeof(arguments.length<=0?void 0:arguments[0])?be({}).apply(void 0,arguments):be.apply(void 0,arguments)};n.d(t,"convertToHTML",function(){return K}),n.d(t,"convertFromHTML",function(){return me}),n.d(t,"parseHTML",function(){return F})}])});

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

'use strict';
"use strict";

@@ -6,34 +6,32 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _updateMutation = require('./util/updateMutation');
var _updateMutation = _interopRequireDefault(require("./util/updateMutation"));
var _updateMutation2 = _interopRequireDefault(_updateMutation);
var _rangeSort = _interopRequireDefault(require("./util/rangeSort"));
var _rangeSort = require('./util/rangeSort');
var _getElementHTML = _interopRequireDefault(require("./util/getElementHTML"));
var _rangeSort2 = _interopRequireDefault(_rangeSort);
var _getElementTagLength = _interopRequireDefault(require("./util/getElementTagLength"));
var _getElementHTML = require('./util/getElementHTML');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _getElementHTML2 = _interopRequireDefault(_getElementHTML);
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
var _getElementTagLength = require('./util/getElementTagLength');
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
var _getElementTagLength2 = _interopRequireDefault(_getElementTagLength);
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var converter = function converter() {
var entity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var originalText = arguments[1];
var originalText = arguments.length > 1 ? arguments[1] : undefined;
return originalText;
};
exports.default = function (block, entityMap) {
var _default = function _default(block, entityMap) {
var entityConverter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : converter;
var resultText = [].concat(_toConsumableArray(block.text));
var resultText = _toConsumableArray(block.text);

@@ -47,4 +45,3 @@ var getEntityHTML = entityConverter;

if (Object.prototype.hasOwnProperty.call(block, 'entityRanges') && block.entityRanges.length > 0) {
var entities = block.entityRanges.sort(_rangeSort2.default);
var entities = block.entityRanges.sort(_rangeSort["default"]);
var styles = block.inlineStyleRanges;

@@ -55,15 +52,15 @@

var entity = entityMap[entityRange.key];
var originalText = resultText.slice(entityRange.offset, entityRange.offset + entityRange.length).join('');
var entityHTML = getEntityHTML(entity, originalText);
var converted = [].concat(_toConsumableArray((0, _getElementHTML2.default)(entityHTML, originalText) || originalText));
var prefixLength = (0, _getElementTagLength2.default)(entityHTML, 'start');
var suffixLength = (0, _getElementTagLength2.default)(entityHTML, 'end');
var converted = _toConsumableArray((0, _getElementHTML["default"])(entityHTML, originalText) || originalText);
var prefixLength = (0, _getElementTagLength["default"])(entityHTML, 'start');
var suffixLength = (0, _getElementTagLength["default"])(entityHTML, 'end');
var updateLaterMutation = function updateLaterMutation(mutation, mutationIndex) {
if (mutationIndex > index || Object.prototype.hasOwnProperty.call(mutation, 'style')) {
return (0, _updateMutation2.default)(mutation, entityRange.offset, entityRange.length, converted.length, prefixLength, suffixLength);
return (0, _updateMutation["default"])(mutation, entityRange.offset, entityRange.length, converted.length, prefixLength, suffixLength);
}
return mutation;

@@ -75,2 +72,3 @@ };

var updatedMutation = updateLaterMutation(mutation, mutationIndex);
if (Array.isArray(updatedMutation)) {

@@ -86,3 +84,2 @@ return acc.concat(updatedMutation);

styles = updateLaterMutations(styles);
resultText = [].concat(_toConsumableArray(resultText.slice(0, entityRange.offset)), _toConsumableArray(converted), _toConsumableArray(resultText.slice(entityRange.offset + entityRange.length)));

@@ -103,2 +100,4 @@ };

return block;
};
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,31 +6,26 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _invariant = require('invariant');
var _invariant = _interopRequireDefault(require("invariant"));
var _invariant2 = _interopRequireDefault(_invariant);
var _styleObjectFunction = _interopRequireDefault(require("./util/styleObjectFunction"));
var _styleObjectFunction = require('./util/styleObjectFunction');
var _accumulateFunction = _interopRequireDefault(require("./util/accumulateFunction"));
var _styleObjectFunction2 = _interopRequireDefault(_styleObjectFunction);
var _getElementHTML = _interopRequireDefault(require("./util/getElementHTML"));
var _accumulateFunction = require('./util/accumulateFunction');
var _rangeSort = _interopRequireDefault(require("./util/rangeSort"));
var _accumulateFunction2 = _interopRequireDefault(_accumulateFunction);
var _defaultInlineHTML = _interopRequireDefault(require("./default/defaultInlineHTML"));
var _getElementHTML = require('./util/getElementHTML');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _getElementHTML2 = _interopRequireDefault(_getElementHTML);
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
var _rangeSort = require('./util/rangeSort');
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
var _rangeSort2 = _interopRequireDefault(_rangeSort);
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
var _defaultInlineHTML = require('./default/defaultInlineHTML');
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
var _defaultInlineHTML2 = _interopRequireDefault(_defaultInlineHTML);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var subtractStyles = function subtractStyles(original, toRemove) {

@@ -47,5 +42,3 @@ return original.filter(function (el) {

var styleToRemove = stack[stack.length - 1];
(0, _invariant2.default)(styleToRemove.style === style.style, 'Style ' + styleToRemove.style + ' to be removed doesn\'t match expected ' + style.style);
(0, _invariant["default"])(styleToRemove.style === style.style, "Style ".concat(styleToRemove.style, " to be removed doesn't match expected ").concat(style.style));
return stack.slice(0, -1);

@@ -65,3 +58,2 @@ }, styleStack);

var secondEndWithinFirst = firstRange.offset + firstRange.length >= secondRange.offset + secondRange.length;
return secondStartWithinFirst && secondEndWithinFirst;

@@ -79,2 +71,3 @@ };

var i = 0;
while (i < remainingStyles.length) {

@@ -87,2 +80,3 @@ if (newStyles.every(rangeIsSubset.bind(null, remainingStyles[i]))) {

}
return [];

@@ -92,7 +86,7 @@ };

var appendStartMarkup = function appendStartMarkup(inlineHTML, string, styleRange) {
return string + (0, _getElementHTML2.default)(inlineHTML(styleRange.style)).start;
return string + (0, _getElementHTML["default"])(inlineHTML(styleRange.style)).start;
};
var prependEndMarkup = function prependEndMarkup(inlineHTML, string, styleRange) {
return (0, _getElementHTML2.default)(inlineHTML(styleRange.style)).end + string;
return (0, _getElementHTML["default"])(inlineHTML(styleRange.style)).end + string;
};

@@ -105,14 +99,14 @@

};
defaultCustomInlineHTML.__isMiddleware = true;
exports.default = function (rawBlock) {
var _default = function _default(rawBlock) {
var customInlineHTML = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultCustomInlineHTML;
(0, _invariant["default"])(rawBlock !== null && rawBlock !== undefined, 'Expected raw block to be non-null');
var inlineHTML;
(0, _invariant2.default)(rawBlock !== null && rawBlock !== undefined, 'Expected raw block to be non-null');
var inlineHTML = void 0;
if (customInlineHTML.__isMiddleware === true) {
inlineHTML = customInlineHTML(_defaultInlineHTML2.default);
inlineHTML = customInlineHTML(_defaultInlineHTML["default"]);
} else {
inlineHTML = (0, _accumulateFunction2.default)((0, _styleObjectFunction2.default)(customInlineHTML), (0, _styleObjectFunction2.default)(_defaultInlineHTML2.default));
inlineHTML = (0, _accumulateFunction["default"])((0, _styleObjectFunction["default"])(customInlineHTML), (0, _styleObjectFunction["default"])(_defaultInlineHTML["default"]));
}

@@ -122,38 +116,31 @@

var styleStack = [];
var sortedRanges = rawBlock.inlineStyleRanges.sort(_rangeSort["default"]);
var sortedRanges = rawBlock.inlineStyleRanges.sort(_rangeSort2.default);
var originalTextArray = _toConsumableArray(rawBlock.text);
var originalTextArray = [].concat(_toConsumableArray(rawBlock.text));
for (var i = 0; i < originalTextArray.length; i++) {
var styles = characterStyles(i, sortedRanges);
var endingStyles = subtractStyles(styleStack, styles);
var newStyles = subtractStyles(styles, styleStack);
var remainingStyles = subtractStyles(styleStack, endingStyles);
// reset styles: look for any already existing styles that will need to
var remainingStyles = subtractStyles(styleStack, endingStyles); // reset styles: look for any already existing styles that will need to
// end before styles that are being added on this character. to solve this
// close out those current tags and all nested children,
// then open new ones nested within the new styles.
var resetStyles = getStylesToReset(remainingStyles, newStyles);
var openingStyles = resetStyles.concat(newStyles).sort(latestStyleLast);
var openingStyleTags = openingStyles.reduce(appendStartMarkup.bind(null, inlineHTML), '');
var endingStyleTags = endingStyles.concat(resetStyles).reduce(prependEndMarkup.bind(null, inlineHTML), '');
result += endingStyleTags + openingStyleTags + originalTextArray[i];
styleStack = popEndingStyles(styleStack, resetStyles.concat(endingStyles));
styleStack = styleStack.concat(openingStyles);
(0, _invariant2.default)(styleStack.length === styles.length, 'Character ' + i + ': ' + (styleStack.length - styles.length) + ' styles left on stack that should no longer be there');
(0, _invariant["default"])(styleStack.length === styles.length, "Character ".concat(i, ": ").concat(styleStack.length - styles.length, " styles left on stack that should no longer be there"));
}
result = styleStack.reduceRight(function (res, openStyle) {
return res + (0, _getElementHTML2.default)(inlineHTML(openStyle.style)).end;
return res + (0, _getElementHTML["default"])(inlineHTML(openStyle.style)).end;
}, result);
return result;
};
return result;
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,37 +6,32 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the /src directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
var _immutable = require("immutable");
var _immutable = require('immutable');
var _draftJs = require("draft-js");
var _draftJs = require('draft-js');
var _parseHTML = _interopRequireDefault(require("./util/parseHTML"));
var _parseHTML = require('./util/parseHTML');
var _rangeSort = _interopRequireDefault(require("./util/rangeSort"));
var _parseHTML2 = _interopRequireDefault(_parseHTML);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _rangeSort = require('./util/rangeSort');
var _rangeSort2 = _interopRequireDefault(_rangeSort);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the /src directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
var NBSP = '&nbsp;';
var SPACE = ' ';
var SPACE = ' '; // Arbitrary max indent
// Arbitrary max indent
var MAX_DEPTH = 4;
var MAX_DEPTH = 4; // used for replacing characters in HTML
// used for replacing characters in HTML
/* eslint-disable no-control-regex */
var REGEX_CR = new RegExp('\r', 'g');

@@ -47,5 +42,5 @@ var REGEX_LF = new RegExp('\n', 'g');

/* eslint-enable no-control-regex */
// Block tag flow is different because LIs do not have
// a deterministic style ;_;
var blockTags = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li', 'blockquote', 'pre'];

@@ -92,2 +87,3 @@ var inlineTags = {

}
throw new Error('Got unexpected null or undefined');

@@ -111,5 +107,7 @@ };

var entities = new Array(1);
if (inEntity) {
entities[0] = inEntity;
}
return {

@@ -151,3 +149,2 @@ text: SPACE,

var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (0, _immutable.Map)();
return {

@@ -169,12 +166,18 @@ text: '\r',

return 'header-one';
case 'h2':
return 'header-two';
case 'h3':
return 'header-three';
case 'h4':
return 'header-four';
case 'h5':
return 'header-five';
case 'h6':
return 'header-six';
case 'li':

@@ -184,10 +187,15 @@ if (lastList === 'ol') {

}
return 'unordered-list-item';
case 'blockquote':
return 'blockquote';
case 'pre':
return 'code-block';
case 'div':
case 'p':
return 'unstyled';
default:

@@ -204,26 +212,26 @@ return null;

var styleToCheck = inlineTags[tag];
if (styleToCheck) {
currentStyle = currentStyle.add(styleToCheck).toOrderedSet();
} else if (node instanceof HTMLElement) {
(function () {
var htmlElement = node;
currentStyle = currentStyle.withMutations(function (style) {
if (htmlElement.style.fontWeight === 'bold') {
style.add('BOLD');
}
var htmlElement = node;
currentStyle = currentStyle.withMutations(function (style) {
if (htmlElement.style.fontWeight === 'bold') {
style.add('BOLD');
}
if (htmlElement.style.fontStyle === 'italic') {
style.add('ITALIC');
}
if (htmlElement.style.fontStyle === 'italic') {
style.add('ITALIC');
}
if (htmlElement.style.textDecoration === 'underline') {
style.add('UNDERLINE');
}
if (htmlElement.style.textDecoration === 'underline') {
style.add('UNDERLINE');
}
if (htmlElement.style.textDecoration === 'line-through') {
style.add('STRIKETHROUGH');
}
}).toOrderedSet();
})();
if (htmlElement.style.textDecoration === 'line-through') {
style.add('STRIKETHROUGH');
}
}).toOrderedSet();
}
return currentStyle;

@@ -234,3 +242,2 @@ }

var inlineStyles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (0, _immutable.OrderedSet)();
return processInlineTag(tag, node, inlineStyles);

@@ -241,3 +248,2 @@ }

var flat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
// Sometimes two blocks will touch in the DOM and we need to strip the

@@ -247,5 +253,5 @@ // extra delimiter to preserve niceness.

var lastInA = A.text.slice(-1);
var adjacentDividers = lastInA === '\r' && firstInB === '\r';
var isJoiningBlocks = A.text !== '\r' && B.text !== '\r'; // when joining two full blocks like this we want to pop one divider
var addingNewlineToEmptyBlock = A.text === '\r' && !A.isNewline && B.isNewline; // when joining a newline to an empty block we want to remove the newline

@@ -258,5 +264,5 @@

A.blocks.pop();
}
} // Kill whitespace after blocks if flat mode is on
// Kill whitespace after blocks if flat mode is on
if (A.text.slice(-1) === '\r' && flat === true) {

@@ -273,3 +279,2 @@ if (B.text === SPACE || B.text === '\n') {

var isNewline = A.text.length === 0 && B.isNewline;
return {

@@ -283,3 +288,2 @@ text: A.text + B.text,

}
/*

@@ -290,5 +294,7 @@ * Check to see if we have anything like <p> <blockquote> <h1>... to create

*/
function containsSemanticBlockMarkup(html) {
return blockTags.some(function (tag) {
return html.indexOf('<' + tag) !== -1;
return html.indexOf("<".concat(tag)) !== -1;
});

@@ -300,63 +306,49 @@ }

var newBlock = false;
var nextBlockType = 'unstyled';
var nextBlockType = 'unstyled'; // Base Case
// Base Case
if (nodeName === '#text') {
var _ret2 = function () {
var text = node.textContent;
if (text.trim() === '' && inBlock === null) {
return {
v: getEmptyChunk()
};
}
var text = node.textContent;
if (text.trim() === '' && inBlock !== 'code-block') {
return {
v: getWhitespaceChunk(inEntity)
};
}
if (inBlock !== 'code-block') {
// Can't use empty string because MSWord
text = text.replace(REGEX_LF, SPACE);
}
if (text.trim() === '' && inBlock === null) {
return getEmptyChunk();
}
var entities = Array(text.length).fill(inEntity);
if (text.trim() === '' && inBlock !== 'code-block') {
return getWhitespaceChunk(inEntity);
}
var offsetChange = 0;
var textEntities = checkEntityText(text, createEntity, getEntity, mergeEntityData, replaceEntityData).sort(_rangeSort2.default);
if (inBlock !== 'code-block') {
// Can't use empty string because MSWord
text = text.replace(REGEX_LF, SPACE);
}
textEntities.forEach(function (_ref) {
var entity = _ref.entity,
offset = _ref.offset,
length = _ref.length,
result = _ref.result;
var entities = Array(text.length).fill(inEntity);
var offsetChange = 0;
var textEntities = checkEntityText(text, createEntity, getEntity, mergeEntityData, replaceEntityData).sort(_rangeSort["default"]);
textEntities.forEach(function (_ref) {
var entity = _ref.entity,
offset = _ref.offset,
length = _ref.length,
result = _ref.result;
var adjustedOffset = offset + offsetChange;
var adjustedOffset = offset + offsetChange;
if (result === null || result === undefined) {
result = text.substr(adjustedOffset, length);
}
if (result === null || result === undefined) {
result = text.substr(adjustedOffset, length);
}
var textArray = text.split('');
textArray.splice.bind(textArray, adjustedOffset, length).apply(textArray, result.split(''));
text = textArray.join('');
entities.splice.bind(entities, adjustedOffset, length).apply(entities, Array(result.length).fill(entity));
offsetChange += result.length - length;
});
return {
text: text,
inlines: Array(text.length).fill(inlineStyle),
entities: entities,
blocks: []
};
} // BR tags
var textArray = text.split('');
textArray.splice.bind(textArray, adjustedOffset, length).apply(textArray, result.split(''));
text = textArray.join('');
entities.splice.bind(entities, adjustedOffset, length).apply(entities, Array(result.length).fill(entity));
offsetChange += result.length - length;
});
return {
v: {
text: text,
inlines: Array(text.length).fill(inlineStyle),
entities: entities,
blocks: []
}
};
}();
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
}
// BR tags
if (nodeName === 'br') {

@@ -374,9 +366,7 @@ var _blockType = inBlock;

var chunk = getEmptyChunk();
var newChunk = null;
var newChunk = null; // Inline tags
// Inline tags
inlineStyle = processInlineTag(nodeName, node, inlineStyle);
inlineStyle = processCustomInlineStyles(nodeName, node, inlineStyle);
inlineStyle = processCustomInlineStyles(nodeName, node, inlineStyle); // Handle lists
// Handle lists
if (nodeName === 'ul' || nodeName === 'ol') {

@@ -386,10 +376,11 @@ if (lastList) {

}
lastList = nodeName;
inBlock = null;
}
} // Block Tags
// Block Tags
var blockInfo = checkBlockType(nodeName, node, lastList, inBlock);
var blockType = void 0;
var blockDataMap = void 0;
var blockType;
var blockDataMap;

@@ -409,2 +400,3 @@ if (blockInfo === false) {

}
if (!inBlock && (fragmentBlockTags.indexOf(nodeName) !== -1 || blockType)) {

@@ -425,8 +417,6 @@ chunk = getBlockDividerChunk(blockType || getBlockTypeForTag(nodeName, lastList), depth, blockDataMap);

blockDataMap);
}
} // Recurse through children
// Recurse through children
var child = node.firstChild;
// hack to allow conversion of atomic blocks from HTML (e.g. <figure><img
var child = node.firstChild; // hack to allow conversion of atomic blocks from HTML (e.g. <figure><img
// src="..." /></figure>). since metadata must be stored on an entity text

@@ -448,12 +438,8 @@ // must exist for the entity to apply to. the way chunks are joined strips

entityId = checkEntityNode(nodeName, child, createEntity, getEntity, mergeEntityData, replaceEntityData);
newChunk = genFragment(child, inlineStyle, lastList, inBlock, fragmentBlockTags, depth, processCustomInlineStyles, checkEntityNode, checkEntityText, checkBlockType, createEntity, getEntity, mergeEntityData, replaceEntityData, options, entityId || inEntity);
chunk = joinChunks(chunk, newChunk, options.flat);
var sibling = child.nextSibling;
var sibling = child.nextSibling; // Put in a newline to break up blocks inside blocks
// Put in a newline to break up blocks inside blocks
if (sibling && fragmentBlockTags.indexOf(nodeName) >= 0 && inBlock) {
var newBlockInfo = checkBlockType(nodeName, child, lastList, inBlock);
var newBlockType = void 0;

@@ -476,5 +462,7 @@ var newBlockData = void 0;

}
if (sibling) {
nodeName = sibling.nodeName.toLowerCase();
}
child = sibling;

@@ -492,18 +480,16 @@ }

html = html.trim().replace(REGEX_CR, '').replace(REGEX_NBSP, SPACE);
var safeBody = DOMBuilder(html);
var safeBody = DOMBuilder(html);
if (!safeBody) {
return null;
}
// Sometimes we aren't dealing with content that contains nice semantic
} // Sometimes we aren't dealing with content that contains nice semantic
// tags. In this case, use divs to separate everything out into paragraphs
// and hope for the best.
var workingBlocks = containsSemanticBlockMarkup(html) ? blockTags.concat(['div']) : ['div'];
// Start with -1 block depth to offset the fact that we are passing in a fake
var workingBlocks = containsSemanticBlockMarkup(html) ? blockTags.concat(['div']) : ['div']; // Start with -1 block depth to offset the fact that we are passing in a fake
// UL block to sta rt with.
var chunk = genFragment(safeBody, (0, _immutable.OrderedSet)(), 'ul', null, workingBlocks, -1, processCustomInlineStyles, checkEntityNode, checkEntityText, checkBlockType, createEntity, getEntity, mergeEntityData, replaceEntityData, options);
// join with previous block to prevent weirdness on paste
var chunk = genFragment(safeBody, (0, _immutable.OrderedSet)(), 'ul', null, workingBlocks, -1, processCustomInlineStyles, checkEntityNode, checkEntityText, checkBlockType, createEntity, getEntity, mergeEntityData, replaceEntityData, options); // join with previous block to prevent weirdness on paste
if (chunk.text.indexOf('\r') === 0) {

@@ -516,5 +502,5 @@ chunk = {

};
}
} // Kill block delimiter at the end
// Kill block delimiter at the end
if (chunk.text.slice(-1) === '\r') {

@@ -525,14 +511,22 @@ chunk.text = chunk.text.slice(0, -1);

chunk.blocks.pop();
}
} // If we saw no block tags, put an unstyled one in
// If we saw no block tags, put an unstyled one in
if (chunk.blocks.length === 0) {
chunk.blocks.push({ type: 'unstyled', data: (0, _immutable.Map)(), depth: 0 });
}
// Sometimes we start with text that isn't in a block, which is then
chunk.blocks.push({
type: 'unstyled',
data: (0, _immutable.Map)(),
depth: 0
});
} // Sometimes we start with text that isn't in a block, which is then
// followed by blocks. Need to fix up the blocks to add in
// an unstyled block for this content
if (chunk.text.split('\r').length === chunk.blocks.length + 1) {
chunk.blocks.unshift({ type: 'unstyled', data: (0, _immutable.Map)(), depth: 0 });
chunk.blocks.unshift({
type: 'unstyled',
data: (0, _immutable.Map)(),
depth: 0
});
}

@@ -547,7 +541,8 @@

// example of how we try to do this in-browser, see getSafeBodyFromHTML.
var chunk = getChunkForHTML(html, processCustomInlineStyles, checkEntityNode, checkEntityText, checkBlockType, createEntity, getEntity, mergeEntityData, replaceEntityData, options, DOMBuilder, generateKey);
var chunk = getChunkForHTML(html, processCustomInlineStyles, checkEntityNode, checkEntityText, checkBlockType, createEntity, getEntity, mergeEntityData, replaceEntityData, options, DOMBuilder, generateKey);
if (chunk == null) {
return [];
}
var start = 0;

@@ -561,10 +556,14 @@ return chunk.text.split('\r').map(function (textBlock, blockIndex) {

var characterList = (0, _immutable.List)(inlines.map(function (style, entityIndex) {
var data = { style: style, entity: null };
var data = {
style: style,
entity: null
};
if (entities[entityIndex]) {
data.entity = entities[entityIndex];
}
return _draftJs.CharacterMetadata.create(data);
}));
start = end + 1;
return new _draftJs.ContentBlock({

@@ -583,9 +582,9 @@ key: generateKey(),

var _ref2$htmlToStyle = _ref2.htmlToStyle,
htmlToStyle = _ref2$htmlToStyle === undefined ? defaultHTMLToStyle : _ref2$htmlToStyle,
htmlToStyle = _ref2$htmlToStyle === void 0 ? defaultHTMLToStyle : _ref2$htmlToStyle,
_ref2$htmlToEntity = _ref2.htmlToEntity,
htmlToEntity = _ref2$htmlToEntity === undefined ? defaultHTMLToEntity : _ref2$htmlToEntity,
htmlToEntity = _ref2$htmlToEntity === void 0 ? defaultHTMLToEntity : _ref2$htmlToEntity,
_ref2$textToEntity = _ref2.textToEntity,
textToEntity = _ref2$textToEntity === undefined ? defaultTextToEntity : _ref2$textToEntity,
textToEntity = _ref2$textToEntity === void 0 ? defaultTextToEntity : _ref2$textToEntity,
_ref2$htmlToBlock = _ref2.htmlToBlock,
htmlToBlock = _ref2$htmlToBlock === undefined ? defaultHTMLToBlock : _ref2$htmlToBlock;
htmlToBlock = _ref2$htmlToBlock === void 0 ? defaultHTMLToBlock : _ref2$htmlToBlock;
return function (html) {

@@ -595,6 +594,7 @@ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {

};
var DOMBuilder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _parseHTML2.default;
var DOMBuilder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _parseHTML["default"];
var generateKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _draftJs.genKey;
var contentState = _draftJs.ContentState.createFromText('');
var createEntityWithContentState = function createEntityWithContentState() {

@@ -646,2 +646,3 @@ if (contentState.createEntity) {

var blockMap = _draftJs.BlockMapBuilder.createFromArray(contentBlocks);
var firstBlockKey = contentBlocks[0].getKey();

@@ -656,7 +657,10 @@ return contentState.merge({

exports.default = function () {
var _default = function _default() {
if (arguments.length >= 1 && typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {
return convertFromHTML({}).apply(undefined, arguments);
return convertFromHTML({}).apply(void 0, arguments);
}
return convertFromHTML.apply(undefined, arguments);
};
return convertFromHTML.apply(void 0, arguments);
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,51 +6,30 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _invariant = require('invariant');
var _invariant = _interopRequireDefault(require("invariant"));
var _invariant2 = _interopRequireDefault(_invariant);
var _react = _interopRequireDefault(require("react"));
var _react = require('react');
var _server = _interopRequireDefault(require("react-dom/server"));
var _react2 = _interopRequireDefault(_react);
var _draftJs = require("draft-js");
var _server = require('react-dom/server');
var _encodeBlock = _interopRequireDefault(require("./encodeBlock"));
var _server2 = _interopRequireDefault(_server);
var _blockEntities = _interopRequireDefault(require("./blockEntities"));
var _draftJs = require('draft-js');
var _blockInlineStyles = _interopRequireDefault(require("./blockInlineStyles"));
var _encodeBlock = require('./encodeBlock');
var _accumulateFunction = _interopRequireDefault(require("./util/accumulateFunction"));
var _encodeBlock2 = _interopRequireDefault(_encodeBlock);
var _blockTypeObjectFunction = _interopRequireDefault(require("./util/blockTypeObjectFunction"));
var _blockEntities = require('./blockEntities');
var _getBlockTags = _interopRequireDefault(require("./util/getBlockTags"));
var _blockEntities2 = _interopRequireDefault(_blockEntities);
var _getNestedBlockTags = _interopRequireDefault(require("./util/getNestedBlockTags"));
var _blockInlineStyles = require('./blockInlineStyles');
var _defaultBlockHTML = _interopRequireDefault(require("./default/defaultBlockHTML"));
var _blockInlineStyles2 = _interopRequireDefault(_blockInlineStyles);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _accumulateFunction = require('./util/accumulateFunction');
var _accumulateFunction2 = _interopRequireDefault(_accumulateFunction);
var _blockTypeObjectFunction = require('./util/blockTypeObjectFunction');
var _blockTypeObjectFunction2 = _interopRequireDefault(_blockTypeObjectFunction);
var _getBlockTags = require('./util/getBlockTags');
var _getBlockTags2 = _interopRequireDefault(_getBlockTags);
var _getNestedBlockTags = require('./util/getNestedBlockTags');
var _getNestedBlockTags2 = _interopRequireDefault(_getNestedBlockTags);
var _defaultBlockHTML = require('./default/defaultBlockHTML');
var _defaultBlockHTML2 = _interopRequireDefault(_defaultBlockHTML);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// import Immutable from 'immutable'; // eslint-disable-line no-unused-vars

@@ -63,32 +42,28 @@ var defaultEntityToHTML = function defaultEntityToHTML(entity, originalText) {

var _ref$styleToHTML = _ref.styleToHTML,
styleToHTML = _ref$styleToHTML === undefined ? {} : _ref$styleToHTML,
styleToHTML = _ref$styleToHTML === void 0 ? {} : _ref$styleToHTML,
_ref$blockToHTML = _ref.blockToHTML,
blockToHTML = _ref$blockToHTML === undefined ? {} : _ref$blockToHTML,
blockToHTML = _ref$blockToHTML === void 0 ? {} : _ref$blockToHTML,
_ref$entityToHTML = _ref.entityToHTML,
entityToHTML = _ref$entityToHTML === undefined ? defaultEntityToHTML : _ref$entityToHTML;
entityToHTML = _ref$entityToHTML === void 0 ? defaultEntityToHTML : _ref$entityToHTML;
return function (contentState) {
(0, _invariant2.default)(contentState !== null && contentState !== undefined, 'Expected contentState to be non-null');
(0, _invariant["default"])(contentState !== null && contentState !== undefined, 'Expected contentState to be non-null');
var getBlockHTML;
var getBlockHTML = void 0;
if (blockToHTML.__isMiddleware === true) {
getBlockHTML = blockToHTML((0, _blockTypeObjectFunction2.default)(_defaultBlockHTML2.default));
getBlockHTML = blockToHTML((0, _blockTypeObjectFunction["default"])(_defaultBlockHTML["default"]));
} else {
getBlockHTML = (0, _accumulateFunction2.default)((0, _blockTypeObjectFunction2.default)(blockToHTML), (0, _blockTypeObjectFunction2.default)(_defaultBlockHTML2.default));
getBlockHTML = (0, _accumulateFunction["default"])((0, _blockTypeObjectFunction["default"])(blockToHTML), (0, _blockTypeObjectFunction["default"])(_defaultBlockHTML["default"]));
}
var rawState = (0, _draftJs.convertToRaw)(contentState);
var listStack = [];
var result = rawState.blocks.map(function (block) {
var type = block.type,
depth = block.depth;
var closeNestTags = '';
var openNestTags = '';
var blockHTMLResult = getBlockHTML(block);
var blockHTMLResult = getBlockHTML(block);
if (!blockHTMLResult) {
throw new Error('convertToHTML: missing HTML definition for block with type ' + block.type);
throw new Error("convertToHTML: missing HTML definition for block with type ".concat(block.type));
}

@@ -99,3 +74,3 @@

closeNestTags = listStack.reduceRight(function (string, nestedBlock) {
return string + (0, _getNestedBlockTags2.default)(getBlockHTML(nestedBlock)).nestEnd;
return string + (0, _getNestedBlockTags["default"])(getBlockHTML(nestedBlock)).nestEnd;
}, '');

@@ -108,11 +83,11 @@ listStack = [];

var blockToClose = listStack[depth];
closeNestTags += (0, _getNestedBlockTags2.default)(getBlockHTML(blockToClose)).nestEnd;
openNestTags += (0, _getNestedBlockTags2.default)(getBlockHTML(block)).nestStart;
closeNestTags += (0, _getNestedBlockTags["default"])(getBlockHTML(blockToClose)).nestEnd;
openNestTags += (0, _getNestedBlockTags["default"])(getBlockHTML(block)).nestStart;
listStack[depth] = block;
} else if (depth + 1 < listStack.length) {
var _blockToClose = listStack[listStack.length - 1];
closeNestTags += (0, _getNestedBlockTags2.default)(getBlockHTML(_blockToClose)).nestEnd;
closeNestTags += (0, _getNestedBlockTags["default"])(getBlockHTML(_blockToClose)).nestEnd;
listStack = listStack.slice(0, -1);
} else {
openNestTags += (0, _getNestedBlockTags2.default)(getBlockHTML(block)).nestStart;
openNestTags += (0, _getNestedBlockTags["default"])(getBlockHTML(block)).nestStart;
listStack.push(block);

@@ -123,8 +98,6 @@ }

var innerHTML = (0, _blockInlineStyles2.default)((0, _blockEntities2.default)((0, _encodeBlock2.default)(block), rawState.entityMap, entityToHTML), styleToHTML);
var innerHTML = (0, _blockInlineStyles["default"])((0, _blockEntities["default"])((0, _encodeBlock["default"])(block), rawState.entityMap, entityToHTML), styleToHTML);
var blockHTML = (0, _getBlockTags["default"])(getBlockHTML(block));
var html;
var blockHTML = (0, _getBlockTags2.default)(getBlockHTML(block));
var html = void 0;
if (typeof blockHTML === 'string') {

@@ -137,4 +110,4 @@ html = blockHTML;

if (innerHTML.length === 0 && Object.prototype.hasOwnProperty.call(blockHTML, 'empty')) {
if (_react2.default.isValidElement(blockHTML.empty)) {
html = _server2.default.renderToStaticMarkup(blockHTML.empty);
if (_react["default"].isValidElement(blockHTML.empty)) {
html = _server["default"].renderToStaticMarkup(blockHTML.empty);
} else {

@@ -147,7 +120,5 @@ html = blockHTML.empty;

}).join('');
result = listStack.reduce(function (res, nestBlock) {
return res + (0, _getNestedBlockTags2.default)(getBlockHTML(nestBlock)).nestEnd;
return res + (0, _getNestedBlockTags["default"])(getBlockHTML(nestBlock)).nestEnd;
}, result);
return result;

@@ -157,4 +128,4 @@ };

exports.default = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
var _default = function _default() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];

@@ -165,6 +136,8 @@ }

// skip higher-order function and use defaults
return convertToHTML({}).apply(undefined, args);
return convertToHTML({}).apply(void 0, args);
}
return convertToHTML.apply(undefined, args);
};
return convertToHTML.apply(void 0, args);
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,29 +6,29 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
unstyled: _react2.default.createElement('p', null),
paragraph: _react2.default.createElement('p', null),
'header-one': _react2.default.createElement('h1', null),
'header-two': _react2.default.createElement('h2', null),
'header-three': _react2.default.createElement('h3', null),
'header-four': _react2.default.createElement('h4', null),
'header-five': _react2.default.createElement('h5', null),
'header-six': _react2.default.createElement('h6', null),
blockquote: _react2.default.createElement('blockquote', null),
var _default = {
unstyled: _react["default"].createElement("p", null),
paragraph: _react["default"].createElement("p", null),
'header-one': _react["default"].createElement("h1", null),
'header-two': _react["default"].createElement("h2", null),
'header-three': _react["default"].createElement("h3", null),
'header-four': _react["default"].createElement("h4", null),
'header-five': _react["default"].createElement("h5", null),
'header-six': _react["default"].createElement("h6", null),
blockquote: _react["default"].createElement("blockquote", null),
'unordered-list-item': {
element: _react2.default.createElement('li', null),
nest: _react2.default.createElement('ul', null)
element: _react["default"].createElement("li", null),
nest: _react["default"].createElement("ul", null)
},
'ordered-list-item': {
element: _react2.default.createElement('li', null),
nest: _react2.default.createElement('ol', null)
element: _react["default"].createElement("li", null),
nest: _react["default"].createElement("ol", null)
},
media: _react2.default.createElement('figure', null),
atomic: _react2.default.createElement('figure', null)
};
media: _react["default"].createElement("figure", null),
atomic: _react["default"].createElement("figure", null)
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,20 +6,22 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = defaultInlineHTML;
exports["default"] = defaultInlineHTML;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function defaultInlineHTML(style) {
switch (style) {
case 'BOLD':
return _react2.default.createElement('strong', null);
return _react["default"].createElement("strong", null);
case 'ITALIC':
return _react2.default.createElement('em', null);
return _react["default"].createElement("em", null);
case 'UNDERLINE':
return _react2.default.createElement('u', null);
return _react["default"].createElement("u", null);
case 'CODE':
return _react2.default.createElement('code', null);
return _react["default"].createElement("code", null);
default:

@@ -26,0 +28,0 @@ return {

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

'use strict';
"use strict";

@@ -6,15 +6,18 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _updateMutation = require('./util/updateMutation');
var _updateMutation = _interopRequireDefault(require("./util/updateMutation"));
var _updateMutation2 = _interopRequireDefault(_updateMutation);
var _rangeSort = _interopRequireDefault(require("./util/rangeSort"));
var _rangeSort = require('./util/rangeSort');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _rangeSort2 = _interopRequireDefault(_rangeSort);
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
var ENTITY_MAP = {

@@ -30,27 +33,27 @@ '&': '&amp;',

exports.default = function (block) {
var blockText = [].concat(_toConsumableArray(block.text));
var _default = function _default(block) {
var blockText = _toConsumableArray(block.text);
var entities = block.entityRanges.sort(_rangeSort2.default);
var styles = block.inlineStyleRanges.sort(_rangeSort2.default);
var entities = block.entityRanges.sort(_rangeSort["default"]);
var styles = block.inlineStyleRanges.sort(_rangeSort["default"]);
var resultText = '';
var _loop = function _loop(index) {
var char = blockText[index];
var _char = blockText[index];
if (ENTITY_MAP[char] !== undefined) {
(function () {
var encoded = ENTITY_MAP[char];
var resultIndex = [].concat(_toConsumableArray(resultText)).length;
resultText += encoded;
if (ENTITY_MAP[_char] !== undefined) {
var encoded = ENTITY_MAP[_char];
var updateForChar = function updateForChar(mutation) {
return (0, _updateMutation2.default)(mutation, resultIndex, char.length, encoded.length, 0, 0);
};
var resultIndex = _toConsumableArray(resultText).length;
entities = entities.map(updateForChar);
styles = styles.map(updateForChar);
})();
resultText += encoded;
var updateForChar = function updateForChar(mutation) {
return (0, _updateMutation["default"])(mutation, resultIndex, _char.length, encoded.length, 0, 0);
};
entities = entities.map(updateForChar);
styles = styles.map(updateForChar);
} else {
resultText += char;
resultText += _char;
}

@@ -68,2 +71,4 @@ };

});
};
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,20 +6,27 @@ Object.defineProperty(exports, "__esModule", {

});
exports.parseHTML = exports.convertFromHTML = exports.convertToHTML = undefined;
Object.defineProperty(exports, "convertToHTML", {
enumerable: true,
get: function get() {
return _convertToHTML["default"];
}
});
Object.defineProperty(exports, "convertFromHTML", {
enumerable: true,
get: function get() {
return _convertFromHTML["default"];
}
});
Object.defineProperty(exports, "parseHTML", {
enumerable: true,
get: function get() {
return _parseHTML["default"];
}
});
var _convertToHTML = require('./convertToHTML');
var _convertToHTML = _interopRequireDefault(require("./convertToHTML"));
var _convertToHTML2 = _interopRequireDefault(_convertToHTML);
var _convertFromHTML = _interopRequireDefault(require("./convertFromHTML"));
var _convertFromHTML = require('./convertFromHTML');
var _parseHTML = _interopRequireDefault(require("./util/parseHTML"));
var _convertFromHTML2 = _interopRequireDefault(_convertFromHTML);
var _parseHTML = require('./util/parseHTML');
var _parseHTML2 = _interopRequireDefault(_parseHTML);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.convertToHTML = _convertToHTML2.default;
exports.convertFromHTML = _convertFromHTML2.default;
exports.parseHTML = _parseHTML2.default;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -6,6 +6,8 @@ "use strict";

});
exports["default"] = void 0;
exports.default = function (newFn, rest) {
var _default = function _default(newFn, rest) {
return function () {
var newResult = newFn.apply(undefined, arguments);
var newResult = newFn.apply(void 0, arguments);
if (newResult !== undefined && newResult !== null) {

@@ -15,4 +17,6 @@ return newResult;

return rest.apply(undefined, arguments);
return rest.apply(void 0, arguments);
};
};
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
exports.default = function (typeObject) {
var _default = function _default(typeObject) {
return function (block) {

@@ -17,2 +18,4 @@ if (typeof typeObject === 'function') {

};
};
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,28 +6,20 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = getBlockTags;
exports["default"] = getBlockTags;
var _invariant = require('invariant');
var _invariant = _interopRequireDefault(require("invariant"));
var _invariant2 = _interopRequireDefault(_invariant);
var _react = _interopRequireDefault(require("react"));
var _react = require('react');
var _server = _interopRequireDefault(require("react-dom/server"));
var _react2 = _interopRequireDefault(_react);
var _splitReactElement = _interopRequireDefault(require("./splitReactElement"));
var _server = require('react-dom/server');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _server2 = _interopRequireDefault(_server);
var _splitReactElement = require('./splitReactElement');
var _splitReactElement2 = _interopRequireDefault(_splitReactElement);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function hasChildren(element) {
return _react2.default.isValidElement(element) && _react2.default.Children.count(element.props.children) > 0;
return _react["default"].isValidElement(element) && _react["default"].Children.count(element.props.children) > 0;
}
function getBlockTags(blockHTML) {
(0, _invariant2.default)(blockHTML !== null && blockHTML !== undefined, 'Expected block HTML value to be non-null');
(0, _invariant["default"])(blockHTML !== null && blockHTML !== undefined, 'Expected block HTML value to be non-null');

@@ -38,17 +30,16 @@ if (typeof blockHTML === 'string') {

if (_react2.default.isValidElement(blockHTML)) {
if (_react["default"].isValidElement(blockHTML)) {
if (hasChildren(blockHTML)) {
return _server2.default.renderToStaticMarkup(blockHTML);
return _server["default"].renderToStaticMarkup(blockHTML);
}
return (0, _splitReactElement2.default)(blockHTML);
return (0, _splitReactElement["default"])(blockHTML);
}
if (Object.prototype.hasOwnProperty.call(blockHTML, 'element') && _react2.default.isValidElement(blockHTML.element)) {
return Object.assign({}, blockHTML, (0, _splitReactElement2.default)(blockHTML.element));
if (Object.prototype.hasOwnProperty.call(blockHTML, 'element') && _react["default"].isValidElement(blockHTML.element)) {
return Object.assign({}, blockHTML, (0, _splitReactElement["default"])(blockHTML.element));
}
(0, _invariant2.default)(Object.prototype.hasOwnProperty.call(blockHTML, 'start') && Object.prototype.hasOwnProperty.call(blockHTML, 'end'), 'convertToHTML: received block information without either a ReactElement or an object with start/end tags');
(0, _invariant["default"])(Object.prototype.hasOwnProperty.call(blockHTML, 'start') && Object.prototype.hasOwnProperty.call(blockHTML, 'end'), 'convertToHTML: received block information without either a ReactElement or an object with start/end tags');
return blockHTML;
}

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

'use strict';
"use strict";

@@ -6,27 +6,18 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = getElementHTML;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _invariant = _interopRequireDefault(require("invariant"));
exports.default = getElementHTML;
var _react = _interopRequireDefault(require("react"));
var _invariant = require('invariant');
var _server = _interopRequireDefault(require("react-dom/server"));
var _invariant2 = _interopRequireDefault(_invariant);
var _splitReactElement = _interopRequireDefault(require("./splitReactElement"));
var _react = require('react');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _react2 = _interopRequireDefault(_react);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _server = require('react-dom/server');
var _server2 = _interopRequireDefault(_server);
var _splitReactElement = require('./splitReactElement');
var _splitReactElement2 = _interopRequireDefault(_splitReactElement);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function hasChildren(element) {
return _react2.default.isValidElement(element) && _react2.default.Children.count(element.props.children) > 0;
return _react["default"].isValidElement(element) && _react["default"].Children.count(element.props.children) > 0;
}

@@ -45,13 +36,12 @@

if (_react2.default.isValidElement(element)) {
if (_react["default"].isValidElement(element)) {
if (hasChildren(element)) {
return _server2.default.renderToStaticMarkup(element);
return _server["default"].renderToStaticMarkup(element);
}
var tags = (0, _splitReactElement2.default)(element);
var tags = (0, _splitReactElement["default"])(element);
if (text !== null && (typeof tags === 'undefined' ? 'undefined' : _typeof(tags)) === 'object') {
if (text !== null && _typeof(tags) === 'object') {
var start = tags.start,
end = tags.end;
return start + text + end;

@@ -63,3 +53,3 @@ }

(0, _invariant2.default)(Object.prototype.hasOwnProperty.call(element, 'start') && Object.prototype.hasOwnProperty.call(element, 'end'), 'convertToHTML: received conversion data without either an HTML string, ReactElement or an object with start/end tags');
(0, _invariant["default"])(Object.prototype.hasOwnProperty.call(element, 'start') && Object.prototype.hasOwnProperty.call(element, 'end'), 'convertToHTML: received conversion data without either an HTML string, ReactElement or an object with start/end tags');

@@ -69,3 +59,2 @@ if (text !== null) {

_end = element.end;
return _start + text + _end;

@@ -72,0 +61,0 @@ }

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

'use strict';
"use strict";

@@ -6,20 +6,18 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _react = _interopRequireDefault(require("react"));
var _react = require('react');
var _splitReactElement = _interopRequireDefault(require("./splitReactElement"));
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _splitReactElement = require('./splitReactElement');
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _splitReactElement2 = _interopRequireDefault(_splitReactElement);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getElementTagLength = function getElementTagLength(element) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'start';
if (_react2.default.isValidElement(element)) {
var splitElement = (0, _splitReactElement2.default)(element);
if (_react["default"].isValidElement(element)) {
var splitElement = (0, _splitReactElement["default"])(element);
if (typeof splitElement === 'string') {

@@ -31,7 +29,8 @@ return 0;

var child = _react2.default.Children.toArray(element.props.children)[0];
return length + (child && _react2.default.isValidElement(child) ? getElementTagLength(child, type) : 0);
var child = _react["default"].Children.toArray(element.props.children)[0];
return length + (child && _react["default"].isValidElement(child) ? getElementTagLength(child, type) : 0);
}
if ((typeof element === 'undefined' ? 'undefined' : _typeof(element)) === 'object') {
if (_typeof(element) === 'object') {
return element[type] ? element[type].length : 0;

@@ -43,2 +42,3 @@ }

exports.default = getElementTagLength;
var _default = getElementTagLength;
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,23 +6,17 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = getNestedBlockTags;
exports["default"] = getNestedBlockTags;
var _invariant = require('invariant');
var _invariant = _interopRequireDefault(require("invariant"));
var _invariant2 = _interopRequireDefault(_invariant);
var _react = _interopRequireDefault(require("react"));
var _react = require('react');
var _splitReactElement2 = _interopRequireDefault(require("./splitReactElement"));
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _splitReactElement2 = require('./splitReactElement');
var _splitReactElement3 = _interopRequireDefault(_splitReactElement2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getNestedBlockTags(blockHTML) {
(0, _invariant2.default)(blockHTML !== null && blockHTML !== undefined, 'Expected block HTML value to be non-null');
(0, _invariant["default"])(blockHTML !== null && blockHTML !== undefined, 'Expected block HTML value to be non-null');
if (_react2.default.isValidElement(blockHTML.nest)) {
var _splitReactElement = (0, _splitReactElement3.default)(blockHTML.nest),
if (_react["default"].isValidElement(blockHTML.nest)) {
var _splitReactElement = (0, _splitReactElement2["default"])(blockHTML.nest),
start = _splitReactElement.start,

@@ -37,5 +31,4 @@ end = _splitReactElement.end;

(0, _invariant2.default)(Object.prototype.hasOwnProperty.call(blockHTML, 'nestStart') && Object.prototype.hasOwnProperty.call(blockHTML, 'nestEnd'), 'convertToHTML: received block information without either a ReactElement or an object with start/end tags');
(0, _invariant["default"])(Object.prototype.hasOwnProperty.call(blockHTML, 'nestStart') && Object.prototype.hasOwnProperty.call(blockHTML, 'nestEnd'), 'convertToHTML: received block information without either a ReactElement or an object with start/end tags');
return blockHTML;
}

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

'use strict';
"use strict";

@@ -6,3 +6,4 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = parseHTML;
exports["default"] = parseHTML;
var fallback = function fallback(html) {

@@ -15,6 +16,8 @@ var doc = document.implementation.createHTMLDocument('');

function parseHTML(html) {
var doc = void 0;
var doc;
if (typeof DOMParser !== 'undefined') {
var parser = new DOMParser();
doc = parser.parseFromString(html, 'text/html');
if (doc === null || doc.body === null) {

@@ -26,3 +29,4 @@ doc = fallback(html);

}
return doc.body;
}

@@ -6,8 +6,12 @@ "use strict";

});
exports["default"] = void 0;
exports.default = function (r1, r2) {
var _default = function _default(r1, r2) {
if (r1.offset === r2.offset) {
return r2.length - r1.length;
}
return r1.offset - r2.offset;
};
};
exports["default"] = _default;

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

'use strict';
"use strict";

@@ -6,18 +6,12 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = splitReactElement;
exports["default"] = splitReactElement;
var _invariant = require('invariant');
var _invariant = _interopRequireDefault(require("invariant"));
var _invariant2 = _interopRequireDefault(_invariant);
var _react = _interopRequireDefault(require("react"));
var _react = require('react');
var _server = _interopRequireDefault(require("react-dom/server"));
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _server = require('react-dom/server');
var _server2 = _interopRequireDefault(_server);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// see http://w3c.github.io/html/syntax.html#writing-html-documents-elements

@@ -28,11 +22,9 @@ var VOID_TAGS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];

if (VOID_TAGS.indexOf(element.type) !== -1) {
return _server2.default.renderToStaticMarkup(element);
return _server["default"].renderToStaticMarkup(element);
}
var tags = _server2.default.renderToStaticMarkup(_react2.default.cloneElement(element, {}, '\r')).split('\r');
var tags = _server["default"].renderToStaticMarkup(_react["default"].cloneElement(element, {}, '\r')).split('\r');
(0, _invariant2.default)(tags.length > 1, 'convertToHTML: Element of type ' + element.type + ' must render children');
(0, _invariant2.default)(tags.length < 3, 'convertToHTML: Element of type ' + element.type + ' cannot use carriage return character');
(0, _invariant["default"])(tags.length > 1, "convertToHTML: Element of type ".concat(element.type, " must render children"));
(0, _invariant["default"])(tags.length < 3, "convertToHTML: Element of type ".concat(element.type, " cannot use carriage return character"));
return {

@@ -39,0 +31,0 @@ start: tags[0],

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

'use strict';
"use strict";

@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
exports.default = function (object) {
var _default = function _default(object) {
return function (style) {

@@ -16,2 +17,4 @@ if (typeof object === 'function') {

};
};
};
exports["default"] = _default;

@@ -6,3 +6,4 @@ "use strict";

});
exports.default = updateMutation;
exports["default"] = updateMutation;
function updateMutation(mutation, originalOffset, originalLength, newLength, prefixLength, suffixLength) {

@@ -14,4 +15,4 @@ // three cases we can reasonably adjust - disjoint mutations that

var lengthDiff = newLength - originalLength;
var mutationAfterChange = originalOffset + originalLength <= mutation.offset;
var mutationAfterChange = originalOffset + originalLength <= mutation.offset;
if (mutationAfterChange) {

@@ -24,2 +25,3 @@ return Object.assign({}, mutation, {

var mutationContainsChange = originalOffset >= mutation.offset && originalOffset + originalLength <= mutation.offset + mutation.length;
if (mutationContainsChange) {

@@ -32,2 +34,3 @@ return Object.assign({}, mutation, {

var mutationWithinPrefixChange = mutation.offset >= originalOffset && mutation.offset + mutation.length <= originalOffset + originalLength && prefixLength > 0;
if (mutationWithinPrefixChange) {

@@ -40,2 +43,3 @@ return Object.assign({}, mutation, {

var mutationContainsPrefix = mutation.offset < originalOffset && mutation.offset + mutation.length <= originalOffset + originalLength && mutation.offset + mutation.length > originalOffset && prefixLength > 0;
if (mutationContainsPrefix) {

@@ -51,2 +55,3 @@ return [Object.assign({}, mutation, {

var mutationContainsSuffix = mutation.offset >= originalOffset && mutation.offset + mutation.length > originalOffset + originalLength && originalOffset + originalLength > mutation.offset && suffixLength > 0;
if (mutationContainsSuffix) {

@@ -53,0 +58,0 @@ return [Object.assign({}, mutation, {

{
"name": "draft-convert",
"version": "2.1.6",
"version": "2.1.7",
"description": "Extensibly serialize & deserialize Draft.js ContentState",

@@ -8,6 +8,5 @@ "main": "lib/index.js",

"scripts": {
"build": "npm run build:commonjs && npm run build:umd && npm run build:umd:min",
"build": "npm run build:commonjs && npm run build:umd",
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:umd": "webpack --config webpack.config.development.js ./src/index.js ./dist/draft-convert.js",
"build:umd:min": "webpack --config webpack.config.production.js ./src/index.js ./dist/draft-convert.min.js",
"build:umd": "wp",
"jest": "jest",

@@ -47,12 +46,12 @@ "jest:watch": "jest --watch",

"devDependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.7.7",
"babel-eslint": "^7.1.1",
"babel-jest": "^18.0.0",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.4",
"@babel/preset-env": "^7.5.4",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.6",
"cross-env": "^3.1.4",
"draft-js": "^0.8.1",
"eslint": "3.12.0",
"eslint": "6.0.1",
"eslint-config-hubspot": "^7.0.0",

@@ -62,3 +61,3 @@ "eslint-config-prettier": "^2.2.0",

"jasmine": "^2.2.0",
"jest": "^18.1.0",
"jest": "^24.8.0",
"prettier": "^1.8.2",

@@ -68,3 +67,4 @@ "react": "^15.4.2",

"rimraf": "2.5.4",
"webpack": "^1.13.0"
"webpack": "^4.35.3",
"webpack-nano": "^0.6.2"
},

@@ -71,0 +71,0 @@ "jest": {

Sorry, the diff of this file is too big to display

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