1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[65],{90065:(t,e,i)=>{i.r(e),i.d(e,{Quill:()=>r.Ay,default:()=>a});var o=i(12115),n=i(15958),r=i(38405);class s extends o.Component{constructor(t){super(t),this.editingAreaRef=(0,o.createRef)(),this.containerRef=(0,o.createRef)(),this.dirtyProps=["modules","formats","bounds","theme","children"],this.cleanProps=["id","className","style","placeholder","tabIndex","onChange","onChangeSelection","onFocus","onBlur","onKeyPress","onKeyDown","onKeyUp"],this.state={generation:0},this.selection=null,this.onEditorChange=(t,e,i,o)=>{"text-change"===t?this.onEditorChangeText?.(this.editor.root.innerHTML,e,o,this.unprivilegedEditor):"selection-change"===t&&this.onEditorChangeSelection?.(e,o,this.unprivilegedEditor)};let e=this.isControlled()?t.value:t.defaultValue;this.value=e??""}validateProps(t){if(o.Children.count(t.children)>1)throw Error("The Quill editing area can only be composed of a single React element.");if(o.Children.count(t.children)){let e=o.Children.only(t.children);if(e?.type==="textarea")throw Error("Quill does not support editing on a <textarea>. Use a <div> instead.")}if(this.lastDeltaChangeSet&&t.value===this.lastDeltaChangeSet)throw Error("You are passing the `delta` object from the `onChange` event back as `value`. You most probably want `editor.getContents()` instead. See: https://github.com/zenoamaro/react-quill#using-deltas")}shouldComponentUpdate(t,e){if(this.validateProps(t),!this.editor||this.state.generation!==e.generation)return!0;if("value"in t){let e=this.getEditorContents(),i=t.value??"";this.isEqualValue(i,e)||this.setEditorContents(this.editor,i)}return t.readOnly!==this.props.readOnly&&this.setEditorReadOnly(this.editor,t.readOnly),[...this.cleanProps,...this.dirtyProps].some(e=>!(0,n.A)(t[e],this.props[e]))}shouldComponentRegenerate(t){return this.dirtyProps.some(e=>!(0,n.A)(t[e],this.props[e]))}componentDidMount(){this.instantiateEditor(),this.setEditorContents(this.editor,this.getEditorContents())}componentWillUnmount(){this.destroyEditor()}componentDidUpdate(t,e){if(this.editor&&this.shouldComponentRegenerate(t)){let t=this.editor.getContents(),e=this.editor.getSelection();this.regenerationSnapshot={delta:t,selection:e},this.setState({generation:this.state.generation+1}),this.destroyEditor()}if(this.state.generation!==e.generation){let{delta:t,selection:e}=this.regenerationSnapshot;delete this.regenerationSnapshot,this.instantiateEditor();let i=this.editor;i.setContents(t),h(()=>this.setEditorSelection(i,e))}}instantiateEditor(){this.editor?this.hookEditor(this.editor):this.editor=this.createEditor(this.getEditingArea(),this.getEditorConfig())}destroyEditor(){if(!this.editor)return;this.unhookEditor(this.editor);let t=this.props.modules?.toolbar;if(!("object"==typeof t&&t&&"container"in t&&"string"==typeof t.container||"string"==typeof t)){let t=this.containerRef.current?.querySelector(".ql-toolbar");t&&t.remove()}delete this.editor}isControlled(){return"value"in this.props}getEditorConfig(){return{bounds:this.props.bounds,formats:this.props.formats,modules:this.props.modules,placeholder:this.props.placeholder,readOnly:this.props.readOnly,tabIndex:this.props.tabIndex,theme:this.props.theme}}getEditor(){if(!this.editor)throw Error("Accessing non-instantiated editor");return this.editor}createEditor(t,e){let i=new r.Ay(t,e);return null!=e.tabIndex&&this.setEditorTabIndex(i,e.tabIndex),this.hookEditor(i),i}hookEditor(t){this.unprivilegedEditor=this.makeUnprivilegedEditor(t),t.on("editor-change",this.onEditorChange)}unhookEditor(t){t.off("editor-change",this.onEditorChange)}getEditorContents(){return this.value}getEditorSelection(){return this.selection}isDelta(t){return t&&t.ops}isEqualValue(t,e){return this.isDelta(t)&&this.isDelta(e)?(0,n.A)(t.ops,e.ops):(0,n.A)(t,e)}setEditorContents(t,e){this.value=e;let i=this.getEditorSelection();"string"==typeof e?t.setContents(t.clipboard.convert({html:e})):t.setContents(e),h(()=>this.setEditorSelection(t,i))}setEditorSelection(t,e){if(this.selection=e,e){let i=t.getLength();e.index=Math.max(0,Math.min(e.index,i-1)),e.length=Math.max(0,Math.min(e.length,i-1-e.index)),t.setSelection(e)}}setEditorTabIndex(t,e){t?.scroll?.domNode&&(t.scroll.domNode.tabIndex=e)}setEditorReadOnly(t,e){e?t.disable():t.enable()}makeUnprivilegedEditor(t){return{getHTML:()=>t.root.innerHTML,getSemanticHTML:t.getSemanticHTML.bind(t),getLength:t.getLength.bind(t),getText:t.getText.bind(t),getContents:t.getContents.bind(t),getSelection:t.getSelection.bind(t),getBounds:t.getBounds.bind(t)}}getEditingArea(){let t=this.editingAreaRef.current;if(!t)throw Error("Cannot find element for editing area");if(3===t.nodeType)throw Error("Editing area cannot be a text node");return t}renderEditingArea(){let{children:t,preserveWhitespace:e}=this.props,{generation:i}=this.state,n={key:i,ref:this.editingAreaRef};return o.Children.count(t)?o.cloneElement(o.Children.only(t),n):e?o.createElement("pre",{...n}):o.createElement("div",{...n})}render(){return o.createElement("div",{ref:this.containerRef,id:this.props.id,style:this.props.style,key:this.state.generation,className:`quill ${this.props.className??""}`,onKeyPress:this.props.onKeyPress,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp},this.renderEditingArea())}onEditorChangeText(t,e,i,o){if(!this.editor)return;let n=this.isDelta(this.value)?o.getContents():o.getHTML();n!==this.getEditorContents()&&(this.lastDeltaChangeSet=e,this.value=n,this.props.onChange?.(t,e,i,o))}
1onEditorChangeSelection(t,e,i){if(!this.editor)return;let o=this.getEditorSelection(),r=!o&&t,s=o&&!t;!(0,n.A)(t,o)&&(this.selection=t,this.props.onChangeSelection?.(t,e,i),r?this.props.onFocus?.(t,e,i):s&&this.props.onBlur?.(o,e,i))}focus(){this.editor&&this.editor.focus()}blur(){this.editor&&(this.selection=null,this.editor.blur())}}function h(t){Promise.resolve().then(t)}s.displayName="React Quill",s.Quill=r.Ay,s.defaultProps={theme:"snow",modules:{},readOnly:!1};let a=s}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.