/** * Draft v0.11.7 * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("immutable"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["immutable","react","react-dom"],t):"object"==typeof exports?exports.Draft=t(require("immutable"),require("react"),require("react-dom")):e.Draft=t(e.Immutable,e.React,e.ReactDOM)}(window,(function(e,t,n){return i={},r.m=o=[function(t,n){t.exports=e},function(e,t,n){"use strict";e.exports=function(e,t){for(var n=arguments.length,r=new Array(2a.getBlockForKey(o).getText().length-i?(s=a.getKeyAfter(o),0):i+t,r.merge({focusKey:s,focusOffset:n})}},function(e,t,n){"use strict";var r;function o(e){for(var t=1;t=e.start}));1!=d.length&&i(!1);var h=d[0];if("IMMUTABLE"===p)return n.merge({anchorOffset:h.start,focusOffset:h.end,isBackward:!1});c||(u?f=h.end:l=h.start);var y=r.getRemovalRange(l,f,t.getText().slice(h.start,h.end),h.start,a);return n.merge({anchorOffset:y.start,focusOffset:y.end,isBackward:!1})}e.exports=function(e,t,n,r,o){var i=r.getStartOffset(),s=r.getEndOffset(),c=t.getEntityAt(i),u=n.getEntityAt(s-1);if(!c&&!u)return r;var l=r;if(c&&c===u)l=a(e,t,l,o,c,!0,!0);else if(c&&u){var f=a(e,t,l,o,c,!1,!0),p=a(e,n,l,o,u,!1,!1);l=l.merge({anchorOffset:f.getAnchorOffset(),focusOffset:p.getFocusOffset(),isBackward:!1})}else if(c){var g=a(e,t,l,o,c,!1,!0);l=l.merge({anchorOffset:g.getStartOffset(),isBackward:!1})}else if(u){var d=a(e,n,l,o,u,!1,!1);l=l.merge({focusOffset:d.getEndOffset(),isBackward:!1})}return l}},function(e,t,n){"use strict";e.exports={getRemovalRange:function(e,t,n,r,o){var i=n.split(" ");i=i.map((function(e,t){if("forward"===o){if(0 * Dual licensed under GPLv2 or MIT */!function(o,i){"use strict";var a="function",s="undefined",c="model",u="name",l="type",f="vendor",p="version",g="architecture",d="console",h="mobile",y="tablet",v="smarttv",m="wearable",b={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.replace(/[^\d\.]/g,"").split(".")[0]:i},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},S={rgx:function(e,t){for(var n,r,o,s,c,u,l=0;l=|~>|~|>|)?\s*(.+)/,c=/^(\d*)(.*)/;function u(e,t){if(""===(e=e.trim()))return!0;var n,r=t.split(o),i=p(e),a=i.modifier,s=i.rangeComponents;switch(a){case"<":return l(r,s);case"<=":return-1===(n=v(r,s))||0===n;case">=":return f(r,s);case">":return 1===v(r,s);case"~":case"~>":return function(e,t){var n=t.slice(),r=t.slice();1="+o,t)&&u("<="+i,t)}(e=n[0].trim(),t)}(e.trim(),t.trim())}};e.exports=m},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!e)return null;var o={};for(var i in e)r.call(e,i)&&(o[i]=t.call(n,e[i],i,e));return o}},function(e,t,n){"use strict";e.exports=function(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}},function(e,t,n){"use strict";var r=n(11)("draft_tree_data_support");e.exports=n(r?107:121)},function(e,t,n){"use strict";var r=n(14);function o(){return(o=r||function(e){for(var t=1;td(t)&&o.logSelectionStateFailure({anonymizedDom:g(t),extraParams:JSON.stringify({offset:n}),selectionState:JSON.stringify(r.toJS())});var c=t===e.focusNode;try{0d(t)&&(o.logSelectionStateFailure({anonymizedDom:g(t),extraParams:JSON.stringify({offset:n}),selectionState:JSON.stringify(i.toJS())}),r.handleExtensionCausedError()),a.setStart(t,n),f)try{e.addRange(a)}catch(e){}else e.addRange(a)}e.exports={setDraftEditorSelection:function(e,t,n,r,o){var i=c(t);if(a(i.documentElement,t)){var s=i.defaultView.getSelection(),u=e.getAnchorKey(),l=e.getAnchorOffset(),f=e.getFocusKey(),p=e.getFocusOffset(),g=e.getIsBackward();if(!s.extend&&g){var d=u,v=l;u=f,l=p,f=d,p=v,g=!1}var m=u===n&&r<=l&&l<=o,b=f===n&&r<=p&&p<=o;if(m&&b)return s.removeAllRanges(),y(s,t,l-r,e),void h(s,t,p-r,e);if(g){if(b&&(s.removeAllRanges(),y(s,t,p-r,e)),m){var S=s.focusNode,w=s.focusOffset;s.removeAllRanges(),y(s,t,l-r,e),h(s,S,w,e)}}else m&&(s.removeAllRanges(),y(s,t,l-r,e)),b&&h(s,t,p-r,e)}},addFocusToSelection:h}},function(e,t,n){"use strict";var r=n(114);e.exports=function(e){return r(e)&&3==e.nodeType}},function(e,t,n){"use strict";e.exports=function(e){var t=(e?e.ownerDocument||e:document).defaultView||window;return!(!e||!("function"==typeof t.Node?e instanceof t.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}},function(e,t,n){"use strict";var r=n(116),o=n(117);function i(e){return null==e?e:String(e)}e.exports=function(e,t){var n;if(window.getComputedStyle&&(n=window.getComputedStyle(e,null)))return i(n.getPropertyValue(o(t)));if(document.defaultView&&document.defaultView.getComputedStyle){if(n=document.defaultView.getComputedStyle(e,null))return i(n.getPropertyValue(o(t)));if("display"===t)return"none"}return e.currentStyle?i("float"===t?e.currentStyle.cssFloat||e.currentStyle.styleFloat:e.currentStyle[r(t)]):i(e.style&&e.style[r(t)])}},function(e,t,n){"use strict";var r=/-(.)/g;e.exports=function(e){return e.replace(r,(function(e,t){return t.toUpperCase()}))}},function(e,t,n){"use strict";var r=/([A-Z])/g;e.exports=function(e){return e.replace(r,"-$1").toLowerCase()}},function(e,t,n){"use strict";var r=n(36);e.exports=function(e){var t=e.ownerDocument.documentElement;if(!("getBoundingClientRect"in e)||!r(t,e))return{left:0,right:0,top:0,bottom:0};var n=e.getBoundingClientRect();return{left:Math.round(n.left)-t.clientLeft,right:Math.round(n.right)-t.clientLeft,top:Math.round(n.top)-t.clientTop,bottom:Math.round(n.bottom)-t.clientTop}}},function(e,t,n){"use strict";var r="undefined"!=typeof navigator&&-1_:;・、。〈-】〔-〟:-?!-/[-`{-・⸮؟٪-٬؛،؍﴾﴿᠁।၊။‐-‧‰-⁞¡-±´-¸º»¿]"}}},function(e,t,n){"use strict";var r=n(72),o=n(2),i=n(73),a=n(20);e.exports=function(e){var t=a(e,(function(e){var t=e.getSelection(),n=t.getStartOffset(),o=t.getStartKey(),a=e.getCurrentContent().getBlockForKey(o).getText().slice(n),s=r.getForward(a);return i(e,s.length||1)}),"forward");return t===e.getCurrentContent()?e:o.push(e,t,"remove-range")}},function(e,t,n){"use strict";var r=n(3),o=n(2);e.exports=function(e){var t=r.splitBlock(e.getCurrentContent(),e.getSelection());return o.push(e,t,"split-block")}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e){var t=e.getSelection(),n=t.getEndKey(),o=e.getCurrentContent().getBlockForKey(n).getLength();return r.set(e,{selection:t.merge({anchorKey:n,anchorOffset:o,focusKey:n,focusOffset:o,isBackward:!1}),forceSelection:!0})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e){var t=e.getSelection(),n=t.getStartKey();return r.set(e,{selection:t.merge({anchorKey:n,anchorOffset:0,focusKey:n,focusOffset:0,isBackward:!1}),forceSelection:!0})}},function(e,t,n){"use strict";var r=n(2),o=n(16),i=n(73),a=n(20);e.exports=function(e){var t=a(e,(function(e){var t=e.getSelection(),n=e.getCurrentContent(),r=t.getAnchorKey(),a=t.getAnchorOffset(),s=n.getBlockForKey(r).getText()[a];return i(e,s?o.getUTF16Length(s,0):1)}),"forward");if(t===e.getCurrentContent())return e;var n=e.getSelection();return r.push(e,t.set("selectionBefore",n),n.isCollapsed()?"delete-character":"remove-range")}},function(e,t,n){"use strict";var r=n(3),o=n(2),i=n(21);e.exports=function(e){var t=e.getSelection();if(!t.isCollapsed())return e;var n=t.getAnchorOffset();if(0===n)return e;var a,s,c=t.getAnchorKey(),u=e.getCurrentContent(),l=u.getBlockForKey(c).getLength();if(l<=1)return e;s=n===l?(a=t.set("anchorOffset",n-1),t):(a=t.set("focusOffset",n+1)).set("anchorOffset",n+1);var f=i(u,a),p=r.removeRange(u,a,"backward"),g=p.getSelectionAfter(),d=g.getAnchorOffset()-1,h=g.merge({anchorOffset:d,focusOffset:d}),y=r.replaceWithFragment(p,h,f),v=o.push(e,y,"insert-fragment");return o.acceptSelection(v,s)}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){var o=r.undo(t);if("spellcheck-change"!==t.getLastChangeType())e.preventDefault(),t.getNativelyRenderedContent()?(n(r.set(t,{nativelyRenderedContent:null})),setTimeout((function(){n(o)}),0)):n(o);else{var i=o.getCurrentContent();n(r.set(o,{nativelyRenderedContent:i}))}}},function(e,t,n){"use strict";var r=n(17),o=n(6),i=n(66),a=n(3),s=n(156),c=n(2),u=n(76),l=n(35),f=n(68),p=n(31),g=n(161);function d(e,t,n){var r=a.replaceWithFragment(e.getCurrentContent(),e.getSelection(),t);return c.push(e,r.set("entityMap",n),"insert-fragment")}e.exports=function(e,t){t.preventDefault();var n=new i(t.clipboardData);if(!n.isRichText()){var h=n.getFiles(),y=n.getText();if(0=s;)n.shift(),u=n[0];0