1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3389],{33389:function(e,n,o){o.r(n),o.d(n,{Editor:function(){return Editor},default:function(){return editor},translate:function(){return translate}});var i=o(35944),l=o(67294),r=o(73935),s=o(83820),a=o(66357),c=o.n(a),d=o(35889),h=o(38079),p=o(36799),u=o(46858),m=o(89100),v=o(75410),g=o(67012),C=o(78162),w=o(71636),y=o(34805),f=o(16362),b=o(74781),x=o(72077),k=o(79282),L=o(7776),E=o(9946),T=o.n(E);function make(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(e);for(let e in Array.isArray(n)?i.classList.add(...n):n&&i.classList.add(n),o)i[e]=o[e];return i}let AlignmentBlockTune=class AlignmentBlockTune{static get DEFAULT_ALIGNMENT(){return"left"}static get isTune(){return!0}getAlignment(){var e,n;return(null===(e=this.settings)||void 0===e?void 0:e.blocks)&&this.settings.blocks.hasOwnProperty(this.block.name)?this.settings.blocks[this.block.name]:(null===(n=this.settings)||void 0===n?void 0:n.default)?this.settings.default:AlignmentBlockTune.DEFAULT_ALIGNMENT}wrap(e){return this.wrapper=make("div"),this.wrapper.classList.toggle(this._CSS.alignment[this.data]),this.wrapper.append(e),this.wrapper}render(){let e=make("div");return this.alignmentSettings.map(n=>{let o=document.createElement("button");return o.classList.add(this.api.styles.settingsButton),o.innerHTML="".concat(n.icon,' <span class="ce-align-tune-title">').concat(n.title,"</span>"),o.type="button",o.classList.toggle(this.api.styles.settingsButtonActive,n.name===this.data),e.appendChild(o),o}).forEach((e,n,o)=>{e.addEventListener("click",()=>{this.data=this.alignmentSettings[n].name,o.forEach((e,n)=>{let{name:o}=this.alignmentSettings[n];e.classList.toggle(this.api.styles.settingsButtonActive,o===this.data),this.wrapper.classList.toggle(this._CSS.alignment[o],o===this.data)})})}),e}save(){return this.data}constructor({api:e,data:n,config:o,block:i}){this.api=e,this.block=i,this.settings=o,this.data=n||this.getAlignment(),this.alignmentSettings=[{name:"left",icon:'<svg xmlns="http://www.w3.org/2000/svg" id="Layer" enable-background="new 0 0 64 64" height="20" viewBox="0 0 64 64" width="20"><path d="m54 8h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m54 52h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m10 23h28c1.104 0 2-.896 2-2s-.896-2-2-2h-28c-1.104 0-2 .896-2 2s.896 2 2 2z"/><path d="m54 30h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m10 45h28c1.104 0 2-.896 2-2s-.896-2-2-2h-28c-1.104 0-2 .896-2 2s.896 2 2 2z"/></svg>',title:this.api.i18n.t("Left")},{name:"center",icon:'<svg xmlns="http://www.w3.org/2000/svg" id="Layer" enable-background="new 0 0 64 64" height="20" viewBox="0 0 64 64" width="20"><path d="m54 8h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m54 52h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m46 23c1.104 0 2-.896 2-2s-.896-2-2-2h-28c-1.104 0-2 .896-2 2s.896 2 2 2z"/><path d="m54 30h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m46 45c1.104 0 2-.896 2-2s-.896-2-2-2h-28c-1.104 0-2 .896-2 2s.896 2 2 2z"/></svg>',title:this.api.i18n.t("Center")},{name:"right",icon:'<svg xmlns="http://www.w3.org/2000/svg" id="Layer" enable-background="new 0 0 64 64" height="20" viewBox="0 0 64 64" width="20"><path d="m54 8h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m54 52h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m54 19h-28c-1.104 0-2 .896-2 2s.896 2 2 2h28c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m54 30h-44c-1.104 0-2 .896-2 2s.896 2 2 2h44c1.104 0 2-.896 2-2s-.896-2-2-2z"/><path d="m54 41h-28c-1.104 0-2 .896-2 2s.896 2 2 2h28c1.104 0 2-.896 2-2s-.896-2-2-2z"/></svg>',title:this.api.i18n.t("Right")}],this._CSS={alignment:{left:"ce-tune-alignment--left",center:"ce-tune-alignment--center",right:"ce-tune-alignment--right"}}}};var I=o(16606),P=o.n(I),M=class{static get toolbox(){return{title:"Math",icon:'<svg id="Layer_1" enable-background="new 0 0 506.1 506.1" height="512" viewBox="0 0 506.1 506.1" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m367.278 240.136v-62.051c0-8.836-7.163-16-16-16s-16 7.164-16 16v147.377c0 15.024 18.993 21.77 28.457 10.03 34.691 18.107 77.146-6.988 77.146-46.831.001-37.966-39-63.416-73.603-48.525zm20.802 69.327c-11.47 0-20.802-9.332-20.802-20.802s9.332-20.802 20.802-20.802 20.802 9.332 20.802 20.802-9.332 20.802-20.802 20.802z"/><path d="m112.397 200.262h-14.014c-8.836 0-16 7.164-16 16s7.164 16 16 16h14.014c8.291 0 15.037 6.746 15.037 15.037v4.998c-30.589-10.389-62.216 12.536-62.216 44.609 0 34.402 35.954 57.331 67.13 42.629 10.128 9.747 27.086 2.537 27.086-11.521v-80.715c0-25.936-21.101-47.037-47.037-47.037zm-.071 111.752c-8.331 0-15.108-6.777-15.108-15.108s6.777-15.108 15.108-15.108 15.108 6.7
177 15.108 15.108-6.778 15.108-15.108 15.108z"/><path d="m287.786 243.114c-6.248-6.248-16.379-6.249-22.627 0l-18.11 18.11-18.11-18.11c-6.249-6.249-16.379-6.249-22.627 0-6.249 6.249-6.249 16.379 0 22.627l18.11 18.11-18.11 18.11c-6.248 6.248-6.248 16.379 0 22.627s16.378 6.249 22.627 0l18.11-18.11 18.11 18.11c6.246 6.248 16.377 6.249 22.627 0 6.249-6.249 6.249-16.379 0-22.627l-18.11-18.11 18.11-18.11c6.249-6.248 6.249-16.379 0-22.627z"/></svg>'}}render(){let e=document.createElement("div"),n=document.createElement("div"),o=document.createElement("input");if(void 0===P()){let e=document.createElement("span");return e.className="errorMessage",e.innerText="[Erorr] KaTeX is not found! Add KaTeX to this webpage to continue!",e}return e.classList.add("math-input-wrapper"),n.classList.add("math-preview"),o.classList.add("math-input"),o.value=this.data?this.data:"",o.setAttribute("placeholder","Enter LaTeX here"),P().render(o.value,n,{throwOnError:!1}),o.addEventListener("keyup",e=>{e.preventDefault(),P().render(o.value,n,{throwOnError:!1})}),e.appendChild(n),e.appendChild(o),e}save(e){return{math:e.childNodes[1].value}}constructor({data:e}){this.data=e.math}},B=o(69547),S=o.n(B),A=o(35841),R=o.n(A);let N='<svg width="12" height="12" viewBox="0 0 256 256">\n<g style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;" transform="translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)">\n <rect x="-9.61" y="35.97" rx="0" ry="0" width="109.22" height="18.05" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(0.7071 -0.7071 0.7071 0.7071 -18.6396 44.9976) "/>\n <rect x="35.97" y="-9.61" rx="0" ry="0" width="18.05" height="109.22" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(0.7071 -0.7071 0.7071 0.7071 -18.6396 44.9996) "/>\n</g>\n</svg>',H='\n<svg width="15" height="15" viewBox="0 0 28 28" fill="none">\n<path d="M27.5 14L0.5 0.5L4.55 12.7L21.88 14L4.54 15.3L0.5 27.5L27.5 14Z" fill="white"/>\n</svg>\n';let InlineAITool=class InlineAITool{static get isInline(){return!0}static get shortcut(){return"CMD+SHIFT+I"}render(){return this.button=document.createElement("button"),this.button.type="button",this.button.classList.add("ce-inline-tool","ce-inline-tool--ai"),this.button.innerHTML='\n<svg width="25" height="25" viewBox="0 0 362 362" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M180.909 361.818C280.822 361.818 361.818 280.822 361.818 180.909C361.818 80.9957 280.822 0 180.909 0C80.9957 0 0 80.9957 0 180.909C0 280.822 80.9957 361.818 180.909 361.818ZM116.7 313.075C169.763 313.075 212.779 253.902 212.779 180.909C212.779 107.915 169.763 48.7422 116.7 48.7422C63.6376 48.7422 20.6217 107.915 20.6217 180.909C20.6217 253.902 63.6376 313.075 116.7 313.075Z" fill="rgba(0,0,0,.4)"/>\n<path d="M84.8514 251.09C99.6605 251.09 111.665 232.205 111.665 208.909C111.665 185.613 99.6605 166.728 84.8514 166.728C70.0423 166.728 58.0371 185.613 58.0371 208.909C58.0371 232.205 70.0423 251.09 84.8514 251.09Z" fill="rgba(0,0,0,.4)"/>\n</svg>\n\n',this.button.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.aiOptionsVisible?this.hideOptions():this.showOptions()}),this.button}showOptions(){var e;let n=this.button.closest(".ce-popover__container");if(!n)return;let o=n.querySelector(".ce-popover__items");if(!o)return;n.querySelectorAll(".ai-options-container").forEach(e=>e.remove());let i=document.createElement("div");i.className="ai-options-container",n.appendChild(i),this.options.forEach(e=>{let n=document.createElement("div");n.className="ce-popover-item ai-option-item",n.innerHTML='<div class="ce-popover-item__title">'.concat(e.label,"</div>"),n.addEventListener("click",n=>{n.stopPropagation(),n.preventDefault(),this.handlePrompt(e)}
1),i.appendChild(n)});let l=document.createElement("div");l.className="ce-popover-item ai-option-item",l.innerHTML='<div class="ce-popover-item__title">'.concat(null===(e=this.labels)||void 0===e?void 0:e.quickEdit,"</div>"),l.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.hideOptions(),this.showCustomPromptInput()}),i.appendChild(l);let r=o.offsetHeight+i.offsetHeight;n.style.height="".concat(r+10,"px"),document.body.classList.add("newt-ai-toolbar-active"),this.aiOptionsVisible=!0,document.addEventListener("click",this.boundClickOutside)}hideOptions(){let e=this.button.closest(".ce-popover__container");e&&(e.style.height="38px",e.querySelectorAll(".ai-options-container").forEach(e=>e.remove()),this.aiOptionsVisible=!1,document.body.classList.remove("newt-ai-toolbar-active"),document.removeEventListener("click",this.boundClickOutside))}showCustomPromptInput(){var e;this.overlayElement||(this.overlayElement=document.createElement("div"),this.overlayElement.className="newt-ai-overlay",this.overlayElement.style.position="absolute",this.overlayElement.style.zIndex="1000",this.overlayElement.style.backdropFilter="blur(15px)",this.overlayElement.style.borderRadius="10px",this.overlayElement.style.minWidth="250px",document.body.appendChild(this.overlayElement));let n=document.querySelector(".ce-inline-toolbar");if(!n)return;let o=n.getBoundingClientRect();this.overlayPosition={top:o.bottom+window.scrollY+5,left:o.left+window.scrollX},this.originalOverlayPosition={...this.overlayPosition},this.overlayElement.style.top="".concat(this.overlayPosition.top,"px"),this.overlayElement.style.left="".concat(this.overlayPosition.left,"px"),this.overlayElement.innerHTML="";let i=document.createElement("div");i.style.padding="2px 0 1px 0",i.style.display="flex",i.style.alignItems="center",i.style.gap="4px",i.style.width="100%";let l=document.createElement("input");l.type="text",l.placeholder=null===(e=this.labels)||void 0===e?void 0:e.egMakeItLonger,l.style.flex="1",l.style.padding="6px 8px 6px 6px",l.style.border="unset",l.style.backgroundColor="transparent",l.style.borderRadius="7px",l.style.fontSize="14px";let r=window.getSelection();if(r.rangeCount>0){let e=r.getRangeAt(0);this.originalRange=e.cloneRange(),this.originalText=e.toString().trim();let n=e.startContainer;for(;n&&(n.nodeType===Node.TEXT_NODE||!n.hasAttribute||!n.hasAttribute("contenteditable"));)n=n.parentNode;if(n&&(this.originalBlock=n,this.fullBlockContent=this.originalBlock.innerText||""),this.originalText){let n=document.createElement("span");n.className="newt-ai-preview-selected blue-highlight",n.textContent=this.originalText,e.deleteContents(),e.insertNode(n),r.removeAllRanges(),r.addRange(e)}}setTimeout(()=>l.focus(),0);let s=document.createElement("button");s.innerHTML=H,s.className="ai-newt-inline-btn",s.style.padding="6px 8px",s.style.backgroundColor="#2575ed",s.style.height="27px",s.style.color="white",s.style.border="none",s.style.borderRadius="7px",s.style.cursor="pointer";let a=document.createElement("button");a.innerHTML=N,a.className="ai-newt-inline-btn",a.style.padding="6px 8px",a.style.backgroundColor="#f1f1f1",a.style.height="27px",a.style.color="#333",a.style.border="none",a.style.borderRadius="7px",a.style.cursor="pointer";let submitCustomPrompt=()=>{let e=l.value.trim();if(e){let n=document.querySelectorAll(".newt-ai-preview-selected");if(n.length>0&&n.forEach(e=>{e.remove()}),this.originalBlock&&this.originalRange){this.originalBlock.focus();let e=window.getSelection();e.removeAllRanges(),e.addRange(this.originalRange)}this.handlePrompt({label:"Custom",prompt:e},!1)}},cancelAction=()=>{let e=document.querySelectorAll(".newt-ai-preview-selected");e.length>0&&e.forEach(e=>{let n=this.originalText||"";e.replaceWith(document.createTextNode(n))}),this.cleanup()};l.addEventListener("keydown",e=>{"Enter"===e.key?(e.preventDefault(),submitCustomPrompt()):"Escape"===e.key&&(e.preventDefault(),cancelAction())}),s.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),submitCustomPrompt()}),a.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),cancelAction()}),i.appendChild(l),i.appendChild(s),i.appendChild(a),this.overlayElement.appendChild(i),n&&(n.style.display="none");let c=document.querySelector(".ce-inline-tool--ai");c&&c.addEventListener("click",e=>{e.stopPropagation()})}async handlePrompt(e){var n,o,i,l,r;let s,a,c,d=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!d&&(!this.originalBlock||!this.fullBlockContent)){let e=window.getSelection();if(e&&e.rangeCount>0){this.originalText||(this.originalText=e.getRangeAt(0).toString().trim());let n=e.getRangeAt(0).startContainer;for(;n&&n!==document.body&&(n.nodeType!==Node.ELEMENT_NODE||!n.hasAttribute||!n.hasAttribute("contenteditable"));)n=n.parentNode;n&&n!==document.body||(n=e.getRangeAt(0).startContainer.parentElement.closest(".ce-block__content")),n&&n.nodeType===Node.ELEMENT_NODE&&(this.originalBlock=n,this.fullBlockContent=n.innerText||"")}}if(d||this.overlayElement&&""!==this.overlayElement.innerHTML)d&&(this.overlayPosition={...this.originalOverlayPosition});else{let e=document.querySelector(".ce-inline-toolbar");
1if(!e)return;let n=e.getBoundingClientRect();this.overlayPosition={top:n.bottom+window.scrollY+5,left:n.left+window.scrollX},this.originalOverlayPosition={...this.overlayPosition}}this.overlayElement||(this.overlayElement=document.createElement("div"),this.overlayElement.className="newt-ai-overlay ce-popover-loading",this.overlayElement.style.position="absolute",this.overlayElement.style.zIndex="1000",this.overlayElement.style.backdropFilter="blur(15px)",this.overlayElement.style.borderRadius="10px",this.overlayElement.style.minWidth="200px",document.body.appendChild(this.overlayElement)),this.overlayElement.style.top="".concat(this.overlayPosition.top,"px"),this.overlayElement.style.left="".concat(this.overlayPosition.left,"px"),this.overlayElement.innerHTML="";let h=document.createElement("div");Object.assign(h.style,{display:"flex",justifyContent:"center",alignItems:"center",padding:"3px 5px",height:"100%"});let p=document.createElement("div");if(Object.assign(p.style,{width:"16px",height:"16px",border:"2px solid #e0e0e0",borderTopColor:"#2575ed",borderRadius:"50%",marginRight:"10px",marginLeft:"5px",animation:"newt-ai-spin 1s linear infinite"}),!document.querySelector("#newt-ai-spinner-keyframes")){let e=document.createElement("style");e.id="newt-ai-spinner-keyframes",e.textContent="\n @keyframes newt-ai-spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ",document.head.appendChild(e)}h.appendChild(p);let u=document.createElement("span");Object.assign(u.style,{color:"#555",fontSize:"16px",fontWeight:"500"}),h.appendChild(u);let m=document.createElement("span");m.textContent="|",Object.assign(m.style,{color:u.style.color,marginLeft:"2px"}),h.appendChild(m),this.overlayElement.appendChild(h);let v=[null===(n=this.labels)||void 0===n?void 0:n.analyzing,null===(o=this.labels)||void 0===o?void 0:o.processing,null===(i=this.labels)||void 0===i?void 0:i.thinking,null===(l=this.labels)||void 0===l?void 0:l.generating],g=0;if(!function typeWord(){let e=v[g],n=0;u.textContent="",function typeChar(){n<=e.length?(u.textContent=e.slice(0,n),n++,setTimeout(typeChar,50)):setTimeout(()=>{g=(g+1)%v.length,typeWord()},4e3-50*e.length)}()}(),setInterval(()=>{m.style.visibility="hidden"===m.style.visibility?"visible":"hidden"},500),!d){let e=document.querySelector(".ce-inline-toolbar");e&&(e.style.display="none")}if(!d&&!this.originalText){let e=window.getSelection();e&&e.rangeCount>0&&(this.originalRange=e.getRangeAt(0).cloneRange(),this.originalText=this.originalRange.toString().trim())}let C=d&&this.originalTextForRetry?this.originalTextForRetry:this.originalText;if(this.oldText=C,0===this.previewNodes.length){let e;let n=window.getSelection();if((e=this.originalRange&&!d?this.originalRange.cloneRange():n.getRangeAt(0)).commonAncestorContainer.contains(this.overlayElement)||(null===(r=this.overlayElement)||void 0===r?void 0:r.contains(e.commonAncestorContainer))){if(this.originalBlock){let o=document.createRange();o.selectNodeContents(this.originalBlock),n.removeAllRanges(),n.addRange(o),e=n.getRangeAt(0)}else{let o=document.querySelector(".ce-block__content");if(o){let i=document.createRange();i.selectNodeContents(o),i.collapse(!1),n.removeAllRanges(),n.addRange(i),e=n.getRangeAt(0)}}}e.deleteContents(),(s=document.createElement("span")).className="newt-ai-preview-old pink-highlight",s.textContent=this.oldText,(a=document.createElement("span")).className="newt-ai-preview-new green-highlight",a.textContent="",e.insertNode(a),e.insertNode(s),this.previewNodes=[s,a]}else{let e=window.getSelection();if(!(a=document.querySelector(".newt-ai-preview-new"))){let n=e.getRangeAt(0);(a=document.createElement("span")).className="newt-ai-preview-new green-highlight",a.textContent="",n.insertNode(a),this.previewNodes=[a]}}document.body.classList.add("newt-ai-preview-active"),!this.fullBlockContent&&this.originalBlock&&(this.fullBlockContent=this.originalBlock.innerText||"");let w="",y="";if(this.fullBlockContent){let e=this.fullBlockContent;this.originalText&&this.fullBlockContent.includes(this.originalText)&&(e=this.fullBlockContent.replace(this.originalText,"<selected_text>".concat(this.originalText,"</selected_text>"))),w+='For context: the user has selected a portion of text within a larger block of content (the selected portion wrapped in <selected_text> tags if present), and might ask something for that selected part (like rephrasing, rewrite, describe, etc.), make sure to maintain appropriate context with the surrounding content. Full block content: "'.concat(e,'"')}if(this.originalText)c="".concat(e.prompt,': "').concat(this.originalText,'"');else{let n=d&&this.originalTextForRetry?this.originalTextForRetry:this.oldText;c="".concat(y).concat(e.prompt,": ").concat(n)}let f=[];d&&this.previousResponses.length>0&&(f=[{text:c,from:"user"},{text:this.previousResponses[this.previousResponses.length-1],from:"ai"}],y="(Try again) ",c="".concat(y).concat(c));let b=await this.chatPrompt(c,{prompt:e.prompt,composerInlineText:!0,modelPro:this.modelProInline,systemPrompt:w,isPro:this.isPro,context:f.length>0?f:void 0,fullBlockContent:this.fullBlockContent||void 0,search:!1,searchCountry:this.searchCountry,searchLocation:this.searchLocation});if(!b||!b.ok){let e=!1,n=!1;try{let o=await b.clone().json();o&&!1===o.ok&&"Insufficient credits"===o.error&&(e=!0),o&&!1===o.ok&&"User is not Pro"===o.error&&(n=!0)}catch(e){console.log("Could not parse error response as JSON:",e)}if(e)throw Error("Insufficient credits");if(n)throw Error("User is not Pro");throw Error("Server returned ".concat(null==b?void 0:b.status,": ").concat(null==b?void 0:b.statusText))}if(!b.body)throw console.error("Chat prompt response has no body"),Error("Response has no readable stream");let x=b.body.getReader(),k=new TextDecoder,L="";try{for(;;){let{done:e,value:n}=await x.read();if(e)break;let o=k.decode(n,{stream:!e});o=o.replace(/<think>[\s\S]*?<\/think>/g,""),L+=o,this.oldText&&/^[a-z]/.test(this.oldText[0])&&L&&/^[A-Z]/.test(L[0])&&(L=L[0].toLowerCase()+L.slice(1)),a&&(a.textContent=L)}}catch(e){throw console.error("Error reading response stream:",e),e}this.newText=L,this.previousResponses.push(this.newText),a&&this.positionOverlayBelowPreview(a),this.overlayElement.innerHTML="",this.overlayElement.classList.remove("ce-popover-loading"),["Accept","Reject","Try Again"].forEach((n,o)=>{var i,l;let r="Try Again"===n,s=document.createElement("button");
1s.type="button",s.className="ce-popover-item",s.style.width=r?"unset":"100%",s.style.textAlign="left",s.style.border="none",s.style.padding="8px 16px",s.style.cursor="pointer",s.style.backgroundColor="transparent",0===o&&(s.className="newt-ai-accept ".concat(s.className)),1===o&&(s.className="newt-ai-reject ".concat(s.className)),s.innerHTML=r?'<svg width="15" height="15" viewBox="0 0 256 256">\n<g style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;" transform="translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)">\n <path d="M 75.702 53.014 c -2.142 7.995 -7.27 14.678 -14.439 18.816 c -7.168 4.138 -15.519 5.239 -23.514 3.095 c -16.505 -4.423 -26.335 -21.448 -21.913 -37.953 C 20.258 20.467 37.286 10.64 53.79 15.06 c 4.213 1.129 8.076 3.118 11.413 5.809 l -8.349 8.35 h 26.654 V 2.565 l -8.354 8.354 c -5.1 -4.405 -11.133 -7.61 -17.74 -9.381 C 33.451 -4.882 8.735 9.389 2.314 33.35 c -6.42 23.961 7.851 48.678 31.811 55.098 C 38.001 89.486 41.934 90 45.842 90 c 7.795 0 15.488 -2.044 22.42 -6.046 c 10.407 -6.008 17.851 -15.709 20.962 -27.317 L 75.702 53.014 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round"/>\n</g>\n</svg>':'<div class="ce-popover-item__title">\n '.concat("Accept"===n?null===(i=this.labels)||void 0===i?void 0:i.accept:"Reject"===n?null===(l=this.labels)||void 0===l?void 0:l.reject:n,"\n </div>"),s.addEventListener("click",o=>{if(o.stopPropagation(),o.preventDefault(),"Accept"===n)document.body.classList.remove("newt-ai-preview-active"),2===this.previewNodes.length&&(this.previewNodes[0].remove(),this.previewNodes[1].replaceWith(document.createTextNode(this.newText))),this.previousResponses=[],this.forceCloseInlineToolbar(),this.cleanup();else if("Reject"===n){if(document.body.classList.remove("newt-ai-preview-active"),2===this.previewNodes.length)this.previewNodes[0].remove(),this.previewNodes[1].replaceWith(document.createTextNode(this.oldText));else if(1===this.previewNodes.length)this.previewNodes[0].replaceWith(document.createTextNode(this.oldText));else{let e=window.getSelection();if(e&&e.rangeCount>0){let n=e.getRangeAt(0);n.deleteContents(),n.insertNode(document.createTextNode(this.oldText))}}this.previousResponses=[],this.forceCloseInlineToolbar(),this.cleanup()}else if("Try Again"===n){let n=this.oldText;this.previewNodes.forEach(e=>e.remove()),this.previewNodes=[],n&&(this.oldText=n,this.originalTextForRetry=n),this.handlePrompt(e,!0)}}),this.overlayElement.appendChild(s)})}catch(e){console.error("Error during AI prompt:",e),this.overlayElement.innerHTML="",this.overlayElement.classList.remove("ce-popover-loading");let n=document.createElement("div");n.style.padding="5px",n.style.color="#f00",n.style.whiteSpace="nowrap";let o=e.message&&e.message.includes("Insufficient credits"),i=e.message&&e.message.includes("User is not Pro");if(o?n.textContent="Insufficient credits":i?n.textContent="Upgrade to Pro":e.message&&e.message.includes("NetworkError")?n.textContent="Network error":e.message&&e.message.includes("Server returned")?n.textContent=e.message:n.textContent="Error processing request",this.overlayElement.appendChild(n),o){let e=document.createElement("button");e.className="ce-popover-item",e.style.width="100%",e.innerHTML='<div class="ce-popover-item__title">Get more</div>',e.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.triggerCreditsPurchasePaywall&&this.triggerCreditsPurchasePaywall(),this.handleCleanup()}),this.overlayElement.appendChild(e)}else if(i){let e=document.createElement("button");e.className="ce-popover-item",e.style.width="100%",e.innerHTML='<div class="ce-popover-item__title">Upgrade</div>',e.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.triggerPremiumPaywall&&this.triggerPremiumPaywall(),this.handleCleanup()}),this.overlayElement.appendChild(e)}else{let e=document.createElement("button");
1e.className="ce-popover-item",e.style.width="100%",e.innerHTML='<div class="ce-popover-item__title">Try Again</div>',e.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.previewNodes.forEach(e=>e.remove()),this.previewNodes=[],this.handlePrompt(opt,!0)}),this.overlayElement.appendChild(e)}let l=document.createElement("button");l.className="ce-popover-item",l.style.width="100%",l.innerHTML='<div class="ce-popover-item__title">Cancel</div>',l.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),this.handleCleanup()}),this.overlayElement.appendChild(l)}handleCleanup(){document.body.classList.remove("newt-ai-preview-active"),2===this.previewNodes.length&&(this.previewNodes[0].remove(),this.previewNodes[1].replaceWith(document.createTextNode(this.oldText))),this.previousResponses=[],this.forceCloseInlineToolbar(),this.cleanup()}positionOverlayBelowPreview(e){if(!e||!this.overlayElement)return;let n=e.getBoundingClientRect(),o=parseInt(this.overlayElement.style.top,0)||0,i=n.bottom+window.scrollY+0;i>o&&(this.overlayElement.style.top="".concat(i,"px"),this.overlayPosition.top=i)}forceCloseInlineToolbar(){let e=document.querySelector(".ce-inline-toolbar");if(e)for(e.style.left="0px",e.style.top="0px",e.classList.remove("ce-inline-toolbar--showed"),e.classList.remove("ce-inline-toolbar--active");e.firstChild;)e.removeChild(e.firstChild);setTimeout(()=>{document.body.click(),document.querySelectorAll(".ce-inline-toolbar .ce-popover__container").forEach(e=>{e.remove()}),document.querySelectorAll(".ce-toolbar").forEach(e=>{e.classList.remove("ce-toolbar--opened")})},10)}cleanup(){var e;document.body.classList.remove("newt-ai-preview-active"),document.body.classList.remove("newt-ai-toolbar-active"),this.originalBlock=null,this.originalRange=null,this.aiOptionsVisible=!1,document.querySelectorAll(".newt-ai-preview-old, .newt-ai-preview-new, .newt-ai-preview-selected").forEach(e=>{e.classList.contains("newt-ai-preview-selected")&&this.originalText?e.replaceWith(document.createTextNode(this.originalText)):e.remove()}),this.previewNodes=[],this.overlayElement&&(this.overlayElement.remove(),this.overlayElement=null);let n=document.querySelector(".ce-inline-toolbar");n&&(n.style.display="");let o=null===(e=this.button)||void 0===e?void 0:e.closest(".ce-popover__container");o&&(o.querySelectorAll(".ai-options-container").forEach(e=>e.remove()),o.style.height="38px"),document.removeEventListener("click",this.boundClickOutside)}onClickOutside(e){var n;!document.body.classList.contains("newt-ai-preview-active")&&(this.button.contains(e.target)||(null===(n=this.button.closest(".ce-popover__container"))||void 0===n?void 0:n.contains(e.target))||this.hideOptions())}dispatch(){}showCustomPromptInput(){var e;this.overlayElement||(this.overlayElement=document.createElement("div"),this.overlayElement.className="newt-ai-overlay",this.overlayElement.style.position="absolute",this.overlayElement.style.zIndex="999999",this.overlayElement.style.backdropFilter="blur(15px)",this.overlayElement.style.borderRadius="10px",this.overlayElement.style.minWidth="250px",document.body.appendChild(this.overlayElement));let n=document.querySelector(".ce-inline-toolbar");if(!n)return;let o=n.getBoundingClientRect();this.overlayPosition={top:o.bottom+window.scrollY+5,left:o.left+window.scrollX},this.originalOverlayPosition={...this.overlayPosition},this.overlayElement.style.top="".concat(this.overlayPosition.top,"px"),this.overlayElement.style.left="".concat(this.overlayPosition.left,"px"),this.overlayElement.innerHTML="";let i=document.createElement("div");i.style.padding="2px 0 1px 0",i.style.display="flex",i.style.alignItems="center",i.style.gap="4px",i.style.width="100%";let l=document.createElement("input");l.type="text",l.placeholder=null===(e=this.labels)||void 0===e?void 0:e.egMakeItLonger,l.style.flex="1",l.style.padding="6px 8px 6px 6px",l.style.border="unset",l.style.backgroundColor="transparent",l.style.borderRadius="7px",l.style.fontSize="14px";let r=window.getSelection();if(r.rangeCount>0){let e=r.getRangeAt(0);this.originalRange=e.cloneRange(),this.originalText=e.toString().trim();let n=e.startContainer;for(;n&&(n.nodeType===Node.TEXT_NODE||!n.hasAttribute||!n.hasAttribute("contenteditable"));)n=n.parentNode;if(n&&(this.originalBlock=n,this.fullBlockContent=this.originalBlock.innerText||""),this.originalText){let n=document.createElement("span");n.className="newt-ai-preview-selected blue-highlight",n.textContent=this.originalText,e.deleteContents(),e.insertN
1ode(n),r.removeAllRanges(),r.addRange(e)}}setTimeout(()=>l.focus(),0);let s=document.createElement("button");s.innerHTML=H,s.className="ai-newt-inline-btn",s.style.padding="6px 8px",s.style.backgroundColor="#2575ed",s.style.height="27px",s.style.color="white",s.style.border="none",s.style.borderRadius="7px",s.style.cursor="pointer";let a=document.createElement("button");a.innerHTML=N,a.className="ai-newt-inline-btn",a.style.padding="6px 8px",a.style.backgroundColor="#f1f1f1",a.style.height="27px",a.style.color="#333",a.style.border="none",a.style.borderRadius="7px",a.style.cursor="pointer";let submitCustomPrompt=()=>{let e=l.value.trim();if(e){let n=document.querySelectorAll(".newt-ai-preview-selected");if(n.length>0&&n.forEach(e=>{e.remove()}),this.originalBlock&&this.originalRange){this.originalBlock.focus();let e=window.getSelection();e.removeAllRanges(),e.addRange(this.originalRange)}this.handlePrompt({label:"Custom",prompt:e},!1)}},cancelAction=()=>{let e=document.querySelectorAll(".newt-ai-preview-selected");e.length>0&&e.forEach(e=>{let n=this.originalText||"";e.replaceWith(document.createTextNode(n))}),this.cleanup()};l.addEventListener("keydown",e=>{"Enter"===e.key?(e.preventDefault(),submitCustomPrompt()):"Escape"===e.key&&(e.preventDefault(),cancelAction())}),s.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),submitCustomPrompt()}),a.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),cancelAction()}),i.appendChild(l),i.appendChild(s),i.appendChild(a),this.overlayElement.appendChild(i),n&&(n.style.display="none");let c=document.querySelector(".ce-inline-tool--ai");c&&c.addEventListener("click",e=>{e.stopPropagation()})}constructor({api:e,config:n}){this.api=e,this.options=n.options||[],this.labels=n.labels||{},this.modelProInline=n.modelProInline,this.isPro=n.isPro,this.triggerPremiumPaywall=n.triggerPremiumPaywall,this.triggerCreditsPurchasePaywall=n.triggerCreditsPurchasePaywall,this.chatPrompt=n.chatPrompt,this.searchEnabled=n.searchEnabled,this.searchCountry=n.searchCountry,this.searchLocation=n.searchLocation,this.button=null,this.overlayElement=null,this.boundClickOutside=this.onClickOutside.bind(this),this.phase="options",this.currentPrompt="",this.oldText="",this.newText="",this.previewNodes=[],this.overlayPosition={top:0,left:0},this.originalText="",this.originalBlock=null,this.originalRange=null,this.aiOptionsVisible=!1,this.originalOverlayPosition={top:0,left:0},this.previousResponses=[],this.fullBlockContent=""}};var Z=o(59466),_=o.n(Z),z=o(65956),D=o(47387),q=o(82464),O=o(16669),V=o(25259);let j=new Audio("https://tias.xyz/assets/type.mp3"),F=new Audio("https://tias.xyz/assets/new_line.mp3");function playSound(e){e&&(e.currentTime=0,e.play())}function playTypewriterSound(e){"Enter"===e?playSound(F):playSound(j)}let OptimizedImageRecreateHandler=class OptimizedImageRecreateHandler{initialize(){document.addEventListener("click",this.handleSettingsClick,!0),this.setupPopoverObserver()}destroy(){document.removeEventListener("click",this.handleSettingsClick,!0),this.popoverObserver&&this.popoverObserver.disconnect(),this.debounceTimer&&clearTimeout(this.debounceTimer)}setupPopoverObserver(){let processPopovers=()=>{if(this.isProcessing)return;this.isProcessing=!0;let e=document.querySelectorAll(".ce-popover--opened");e.forEach(e=>{if(this.recreateButtonMap.has(e))return;let n=e.querySelector('[data-item-name="withBackground"]');if(!n)return;let o=this.findAssociatedImageBlock(e);o&&(this.injectRecreateButton(e,o),this.recreateButtonMap.set(e,!0))}),this.isProcessing=!1};this.popoverObserver=new MutationObserver(()=>{this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(processPopovers,10)});let e=document.getElementById("editor-container");e&&this.popoverObserver.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]})}findAssociatedImageBlock(e){for(let e of this.pendingPopovers)if(e.querySelector(".image-tool"))return this.pendingPopovers.delete(e),e;let n=document.querySelector(".ce-block--selected");return(null==n?void 0:n.querySelector(".image-tool"))?n:null}injectRecreateButton(e,n){if(e.querySelector('[data-item-name="recreateImage"]'))return;
1let o=e.querySelector('[data-item-name="withBackground"]');if(!o)return;let i=document.createElement("div");i.className="ce-popover-item",i.setAttribute("data-item-name","recreateImage"),i.innerHTML='\n <div class="ce-popover-item__icon">'.concat('\n <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24">\n <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-6.219-8.56"/>\n <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 4v4h-4"/>\n <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 20l5-5m0 5l-5-5"/>\n </svg>\n ','</div>\n <div class="ce-popover-item__title">Recreate image</div>\n '),i.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation();let i=n.querySelector("img");if(!(null==i?void 0:i.src)){console.error("Could not find image source");return}e.classList.remove("ce-popover--opened"),this.openRecreateModal({imageUrl:i.src,onReplace:(e,o,i,l)=>{this.replaceImage(n,e,o,i,l)},onInsert:(e,o,i,l)=>{this.insertImageAfterBlock(n,e,o,i,l)},onAppend:(e,n,o,i)=>{this.appendNewImage(e,n,o,i)}})}),o.insertAdjacentElement("afterend",i)}replaceImage(e,n,o,i,l){let r=e.querySelector("img");if(r){r.src=n,r.alt=l||"AI generated image",o&&r.setAttribute("data-colors",JSON.stringify(o)),i&&r.setAttribute("data-hash",i);let s=e.querySelector(".cdx-input");s&&l&&(s.value=l,s.dispatchEvent(new Event("input",{bubbles:!0})));let a=new CustomEvent("change",{bubbles:!0});e.dispatchEvent(a)}}insertImageAfterBlock(e,n,o,i,l){if(!this.editorInstance){console.error("EditorJS instance not available");return}let r=Array.from(document.querySelectorAll(".ce-block")),s=r.indexOf(e);if(-1===s){console.error("Could not find block index");return}this.editorInstance.blocks.insert("image",{file:{url:n,colors:o,hash:i},caption:l||"",withBorder:!1,withBackground:!1,stretched:!1},{},s+1,!0)}appendNewImage(e,n,o,i){if(!this.editorInstance){console.error("EditorJS instance not available");return}this.editorInstance.blocks.insert("image",{file:{url:e,colors:n,hash:o},caption:i||"",withBorder:!1,withBackground:!1,stretched:!1})}constructor(e,n){this.recreateButtonMap=new WeakMap,this.pendingPopovers=new Set,this.isProcessing=!1,this.debounceTimer=null,this.handleSettingsClick=e=>{let n=e.target,o=n.closest(".ce-toolbar__settings-btn");if(!o)return;let i=o.closest(".ce-block");i&&i.querySelector(".image-tool")&&(this.pendingPopovers.add(i),setTimeout(()=>{this.pendingPopovers.delete(i)},1e3))},this.popoverObserver=null,this.openRecreateModal=e,this.editorInstance=n}};async function checkUrl(e){return e}let U={text:{en:"Text",es:"Texto"},heading:{en:"Heading",es:"T\xedtulo"},list:{en:"List",es:"Lista"},aiImage:{en:"AI Image",es:"Imagen AI"},image:{en:"Image",es:"Imagen"},quote:{en:"Quote",es:"Cita"},table:{en:"Table",es:"Tabla"},delimiter:{en:"Delimiter",es:"Delimitador"},warning:{en:"Warning",es:"Advertencia"},button:{en:"Button",es:"Bot\xf3n"},alert:{en:"Alert",es:"Alerta"},rewrite:{en:"Rewrite",es:"Reescribir"},visualize:{en:"Visualize",es:"Visualizar"},expand:{en:"Expand",es:"Expandir"},convertTo:{en:"Convert to",es:"Convertir a"},left:{en:"Left",es:"Izquierda"},message:{en:"Message",es:"Mensaje"},center:{en:"Center",es:"Centrar"},right:{en:"Right",es:"Derecha"},moveUp:{en:"Move up",es:"Arriba"},moveDown:{en:"Move down",es:"Abajo"},delete:{en:"Delete",es:"Eliminar"},typeHere:{en:"Type here",es:"Escribe aqu\xed"},link:{en:"Link",es:"Enlace"},marker:{en:"Marker",es:"Marcador"},checklist:{en:"CheckList",es:"CheckList"},code:{en:"Code",es:"C\xf3digo"},title:{en:"Title",es:"T\xedtulo"},addALink:{en:"Add a link",es:"Agregar un enlace"},blockNotDisplayedCorrectly:{en:"The block can not be displayed correctly in this version of Newt. Try again later.",es:"El bloque no se puede mostrar correctamente en esta versi\xf3n de Newt. Intenta de nuevo m\xe1s tarde."},clickToTune:{en:"Click to tune",es:"Click para ajustar"},orDragToMove:{en:"or drag to move",es:"o arrastra para mover"},add:{en:"Add",es:"Agregar"},caption:{en:"Image Caption",es:"T\xedtulo de Imagen"},rephrase:{en:"Rephrase",es:"Reescribir"},shorter:{en:"Shorter",es:"M\xe1s corto"},longer:{en:"Longer",es:"M\xe1s largo"},showNotTell:{en:"Show, not tell",es:"Mostrar, no contar"},describe:{en:"Describe",es:"Describir"},rewriteThisSelection:{en:"Rewrite this selection",es:"Reescribir esta selecci\xf3n"},makeThisSelectionShorter:{en:"Make this selection shorter",es:"Haz esta selecci\xf3n m\xe1s corta"},makeThisSelectionLonger:{en:"Make this selection longer",es:"Haz esta selecci\xf3n m\xe1s larga"}
1,makeThisSelectionShowNotTell:{en:"Rewrite this selection to âshowâ rather than âtellâ by adding vivid sensory details, concrete actions, and dialogueâbring the scene and emotions to life instead of just stating them",es:"Reescribe esta selecci\xf3n para âmostrarâ en lugar de âcontarâ a\xf1adiendo detalles sensoriales v\xedvidos, acciones concretas y di\xe1logos: da vida a la escena y las emociones en lugar de simplemente afirmarlas"},describeThisSelection:{en:"Describe this selection in more detail",es:"Describe esta selecci\xf3n con m\xe1s detalle"},analyzing:{en:"Analyzing",es:"Analizando"},processing:{en:"Processing",es:"Procesando"},thinking:{en:"Thinking",es:"Pensando"},generating:{en:"Generating",es:"Generando"},accept:{en:"Accept",es:"Aceptar"},reject:{en:"Reject",es:"Rechazar"},quickEdit:{en:"Quick Edit",es:"Edici\xf3n r\xe1pida"},egSummarizeIt:{en:"e.g. Summarize it",es:"ej. Resumir"},egMakeItShorter:{en:"e.g. Make it shorter",es:"ej. Hacerlo m\xe1s corto"},inputRewriteSnackbarText:{en:"Input text in the current block to rewrite.",es:"Ingresa texto en el bloque actual para reescribir."},inputVisualizeSnackbarText:{en:"Input text in the current block to visualize.",es:"Ingresa texto en el bloque actual para visualizar."},inputExpandSnackbarText:{en:"Input some text in the editor to expand",es:"Ingresa algo de texto en el editor para expandir"}},translate=function(e){var n,o;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";return(null==U?void 0:null===(n=U[e])||void 0===n?void 0:n[i])||(null==U?void 0:null===(o=U[e])||void 0===o?void 0:o.es)||e},aiSparkIcon=e=>'\n<svg width="25" height="25" viewBox="0 0 362 362" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M180.909 361.818C280.822 361.818 361.818 280.822 361.818 180.909C361.818 80.9957 280.822 0 180.909 0C80.9957 0 0 80.9957 0 180.909C0 280.822 80.9957 361.818 180.909 361.818ZM116.7 313.075C169.763 313.075 212.779 253.902 212.779 180.909C212.779 107.915 169.763 48.7422 116.7 48.7422C63.6376 48.7422 20.6217 107.915 20.6217 180.909C20.6217 253.902 63.6376 313.075 116.7 313.075Z" fill="rgba(0,0,0,.4)"/>\n<path d="M84.8514 251.09C99.6605 251.09 111.665 232.205 111.665 208.909C111.665 185.613 99.6605 166.728 84.8514 166.728C70.0423 166.728 58.0371 185.613 58.0371 208.909C58.0371 232.205 70.0423 251.09 84.8514 251.09Z" fill="rgba(0,0,0,.4)"/>\n</svg>\n\n',aiInlineIcon=e=>'\n<svg class="newt-toolbar-icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.00003 18.9994C6.00003 18.9994 6.00003 19 7.00003 19V20H6.00003V18.9994Z" fill="'.concat(e,'"/>\n<path d="M17.2742 13.2364L12.3523 18.1579C11.3652 19.1449 9.96432 19.5815 8.93785 19.7869C8.4055 19.8934 7.92885 19.9463 7.58472 19.9728C7.41197 19.9861 7.27081 19.9929 7.17057 19.9963C7.12041 19.9981 7.08036 19.999 7.05158 19.9995L7.01697 19.9999L7.00624 20L7.00256 20L7.00115 20C7.00115 20 7.00003 20 7.00003 19L6.00003 18.9994L6.00004 18.9974L6.00005 18.9938L6.00011 18.983L6.00055 18.9484C6.00102 18.9196 6.00192 18.8796 6.00365 18.8294C6.00711 18.7291 6.01388 18.5879 6.02717 18.4151C6.05365 18.0709 6.10652 17.5941 6.21299 17.0616C6.41827 16.0351 6.85455 14.6339 7.84134 13.6471L12.7631 8.72565L17.2742 13.2364Z" fill="').concat(e,'"/>\n<path d="M18.6885 11.8222L20.9966 9.51423L21 9.10489C21.0035 8.68474 20.8583 8.16089 20.6698 7.70746C20.473 7.23442 20.1674 6.68854 19.7393 6.26052C19.3113 5.83251 18.7654 5.52691 18.2923 5.3302C17.8389 5.14166 17.315 4.99652 16.8949 5.00003L16.4856 5.00346L14.1774 7.31148L18.6885 11.8222Z" fill="').concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M3.97975 3.97969L5.02569 0.841858H5.97437L7.02032 3.97969L10.1581 5.02563V5.97431L7.02032 7.02026L5.97437 10.1581H5.02569L3.97975 7.02026L0.841919 5.97431V5.02563L3.97975 3.97969Z" fill="').concat(e,'"/>\n</svg>\n'),aiRewriteIcon=e=>'\n<svg width="21" height="17" class="newt-toolbar-icon" viewBox="0 0 21 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.99999C0 2.44771 0.447715 1.99999 1 1.99999H5C5.55228 1.99999 6 2.44771 6 2.99999C6 3.55228 5.55228 3.99999 5 3.99999H4V15H5C5.55228 15 6 15.4477 6 16C6 16.5523 5.55228 17 5 17H1C0.447715 17 0 16.5523 0 16C0 15.4477 0.447715 15 1 15H2V3.99999H1C0.447715 3.99999 0 3.55228 0 2.99999Z" fill="'.concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5 5.99999C11.9304 5.99999 12.3126 6.27542 12.4487 6.68377L13.4156 9.58442L16.3162 10.5513C16.7246 10.6874 17 11.0696 17 11.5C17 11.9304 16.7246 12.3126 16.3162 12.4487L13.4156 13.4156L12.4487 16.3162C12.3126 16.7246 11.9304 17 11.5 17C11.0696 17 10.6874 16.7246 10.5513 16.3162L9.58443 13.4156L6.68377 12.4487C6.27543 12.3126 6 11.9304 6 11.5C6 11.0696 6.27543 10.6874 6.68377 10.5513
1L9.58443 9.58442L10.5513 6.68377C10.6874 6.27542 11.0696 5.99999 11.5 5.99999ZM11.5 10.1623L11.3237 10.6912C11.2241 10.9898 10.9898 11.2241 10.6912 11.3237L10.1623 11.5L10.6912 11.6763C10.9898 11.7758 11.2241 12.0102 11.3237 12.3088L11.5 12.8377L11.6763 12.3088C11.7759 12.0102 12.0102 11.7758 12.3088 11.6763L12.8377 11.5L12.3088 11.3237C12.0102 11.2241 11.7759 10.9898 11.6763 10.6912L11.5 10.1623Z" fill="').concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M17 0.399994C17.2583 0.399994 17.4875 0.565252 17.5692 0.810257L18.2243 2.77565L20.1897 3.43078C20.4347 3.51245 20.6 3.74174 20.6 3.99999C20.6 4.25825 20.4347 4.48754 20.1897 4.5692L18.2243 5.22434L17.5692 7.18973C17.4875 7.43474 17.2583 7.59999 17 7.59999C16.7417 7.59999 16.5125 7.43474 16.4308 7.18973L15.7757 5.22434L13.8103 4.5692C13.5653 4.48754 13.4 4.25825 13.4 3.99999C13.4 3.74174 13.5653 3.51245 13.8103 3.43078L15.7757 2.77565L16.4308 0.810257C16.5125 0.565252 16.7417 0.399994 17 0.399994Z" fill="').concat(e,'"/>\n</svg>\n'),linkShareIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M18.5355 19.5355C20 18.0711 20 15.714 20 11C20 10.3985 20 9.83537 19.997 9.30758C19.5862 9.71026 19.0949 10.136 18.5683 10.5922L16.0794 12.7493C15.7752 13.0132 15.4343 13.309 15.1257 13.5071C14.8241 13.7006 14.0564 14.1293 13.1692 13.7242C12.2819 13.3191 12.1032 12.4581 12.0519 12.1035C12.0008 11.7497 11.9997 11.3119 11.9999 10.917C10.6707 11.1476 9.40376 11.6706 8.47335 12.3979L8.42351 12.4369C8.05532 12.7248 7.70248 13.0006 7.41851 13.1851C7.27461 13.2786 7.05476 13.4119 6.79732 13.4989C6.5621 13.5783 5.97989 13.7241 5.3799 13.3723C4.83887 13.055 4.65163 12.5503 4.58718 12.2661C4.52494 11.9916 4.53037 11.733 4.53913 11.5701C4.55605 11.2557 4.61832 10.8537 4.67926 10.4602L4.68911 10.3965C5.16402 7.32548 6.50112 5.23021 8.23816 3.9232C9.43756 3.02074 10.763 2.54214 11.9999 2.33772L11.9999 2.11325C11.9997 1.75005 11.9995 1.34729 12.0379 1.00554C11.4122 1 10.7347 1 10 1C5.28595 1 2.92893 1 1.46447 2.46447C0 3.92893 0 6.28595 0 11C0 15.714 0 18.0711 1.46447 19.5355C2.92893 21 5.28595 21 10 21C14.714 21 17.0711 21 18.5355 19.5355Z" fill="'.concat(e,'"/>\n<path d="M15.1549 1.43415L17.5121 3.47712C19.1348 4.88345 19.9462 5.58662 19.9462 6.49988C19.9462 7.41314 19.1348 8.1163 17.5121 9.52264L15.1549 11.5656C14.4413 12.184 14.0846 12.4932 13.7922 12.3597C13.4999 12.2262 13.4999 11.7541 13.4999 10.8099V9.28559C11.3755 9.28559 9.12573 9.98406 7.54957 11.2161C6.72623 11.8597 6.31457 12.1815 6.13869 12.0784C5.96281 11.9752 6.03237 11.5254 6.17149 10.6257C7.0161 5.164 10.8002 3.71416 13.4999 3.71416V2.18984C13.4999 1.24562 13.4999 0.773513 13.7922 0.640034C14.0846 0.506555 14.4413 0.815754 15.1549 1.43415Z" fill="').concat(e,'"/>\n</svg>\n'),mathIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.46447 1.46447C0 2.92893 0 5.28595 0 10C0 14.714 0 17.0711 1.46447 18.5355C2.92893 20 5.28595 20 10 20C14.714 20 17.0711 20 18.5355 18.5355C20 17.0711 20 14.714 20 10C20 5.28595 20 2.92893 18.5355 1.46447ZM13.5303 6.46967C13.8232 6.76256 13.8232 7.23744 13.5303 7.53033L7.53033 13.5303C7.23744 13.8232 6.76256 13.8232 6.46967 13.5303C6.17678 13.2374 6.17678 12.7626 6.46967 12.4697L12.4697 6.46967C12.7626 6.17678 13.2374 6.17678 13.5303 6.46967ZM8.5 7.5C8.5 8.05229 8.05229 8.5 7.5 8.5C6.94772 8.5 6.5 8.05229 6.5 7.5C6.5 6.94772 6.94772 6.5 7.5 6.5C8.05229 6.5 8.5 6.94772 8.5 7.5ZM12.5 13.5C13.0523 13.5 13.5 13.0523 13.5 12.5C13.5 11.9477 13.0523 11.5 12.5 11.5C11.9477 11.5 11.5 11.9477 11.5 12.5C11.5 13.0523 11.9477 13.5 12.5 13.5Z" fill="'.concat(e,'"/>\n</svg>\n'),aiVisualizecon=e=>'\n<svg width="20" height="20" class="newt-toolbar-icon" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.4142 11L6.57422 15.84L4 13.7806L1.34383 15.9056L0.0944371 14.3438L4 11.2194L6.42579 13.16L10 9.58579L11.4142 11Z" fill="'.concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M5.7587 2L9 2V4H5.8C4.94342 4 4.36113 4.00078 3.91104 4.03756C3.47262 4.07338 3.24842 4.1383 3.09202 4.21799C2.7157 4.40974 2.40973 4.7157 2.21799 5.09202C2.1383 5.24842 2.07337 5.47263 2.03755 5.91104C2.00078 6.36113 2 6.94343 2 7.8V14.2C2 15.0566 2.00078 15.6389 2.03755 16.089C2.07337 16.5274 2.1383 16.7516 2.21799 16.908C2.40973 17.2843 2.7157 17.5903 3.09202 17.782C3.24842 17.8617 3.47262 17.9266 3.91104 17.9625C4.36113 17.9992 4.94342 18 5.8 18H12.2C13.0566 18 13.6389 17.9992 14.089 17.9625C14.5274 17.9266 14.7516 17.8617 14.908 17.782C15.2843 17.5903 15.5903 17.2843 15.782 16.908C15.8617 16.7516 15.9266 16.5274 15.9624 16.089C15.9992 15.6389 16 15.0566 16 14.2V11H18V14.2413C18 15.0463 18 15.7106 17.9558 16.2518C17.9099 16.8139 17.8113 17.3306 17.564 17.816C17.1805 18.5686 16.5686 19.1805 15.816 19.564C15.3306 19.8113 14.8139 19.9099 14.2518 19.9558C13.7106 20 13.0463 20 12.2413 20H5.75868C4.95372 20 4.28936 20 3.74817 19.9558C3.18608 19.9099 2.66937 19.8113 2.18404 19.564C1.43139 19.1805 0.819468 18.5686 0.435975 17.816C0.188684 17.3306 0.0901197 16.8139 0.0441945 16.2518C-2.28137e-05 15.7106 -1.23241e-05 15.0463 4.31291e-07 14.2413V7.75871C-1.23241e-05 6.95374 -2.28137e-05 6.28937 0.0441945 5.74818C0.0901197 5.18608 0.188684 4.66938 0.435975 4.18404C0.819468 3.43139 1.43139 2.81947 2.18404 2.43598C2.66937 2.18869 3.18608 2.09012 3.74817 2.0442C4.28937 1.99998 4.95373 1.99999 5.7587 2Z" fill="').concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9594 3.95943L13.0513 0.683777H14.9487L16.0406 3.95943L19.3162 5.05132V6.94869L16.0406 8.04057L14.9487 11.3162H13.0513L11.9594 8.04057L8.68377 6.94869V5.05132L11.9594 3.95943ZM14 4.16228L13.6987 5.06623L13.0662 5.69869L12.1623 6L13.0662 6.30132L13.6987 6.93378L14 7.83773L14.3013 6.93378L14.9338 6.30132L15.8377 6L14.9338 5.69869L13.6987 5.06623L14 4.16228Z" fill="').concat(e,'"/>\n</svg>\n'),aiExpandIcon=e=>
1'\n<svg width="18" height="20" class="newt-toolbar-icon" viewBox="0 0 18 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 13C12.5345 13 11.5 13.9691 11.5 15.5C11.5 17.0309 12.5345 18 13.5 18C14.4655 18 15.5 17.0309 15.5 15.5C15.5 13.9691 14.4655 13 13.5 13ZM9.49999 15.5C9.49999 13.1649 11.1518 11 13.5 11C15.8482 11 17.5 13.1649 17.5 15.5C17.5 17.8351 15.8482 20 13.5 20C11.1518 20 9.49999 17.8351 9.49999 15.5Z" fill="'.concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.5 0.399994C10.7582 0.399994 10.9875 0.565252 11.0692 0.810257L11.8493 3.15065L14.1897 3.93078C14.4347 4.01245 14.6 4.24174 14.6 4.49999C14.6 4.75825 14.4347 4.98754 14.1897 5.0692L11.8493 5.84934L11.0692 8.18973C10.9875 8.43474 10.7582 8.59999 10.5 8.59999C10.2417 8.59999 10.0124 8.43474 9.93078 8.18973L9.15065 5.84934L6.81025 5.0692C6.56525 4.98754 6.39999 4.75825 6.39999 4.49999C6.39999 4.24174 6.56525 4.01245 6.81025 3.93078L9.15065 3.15065L9.93078 0.810257C10.0124 0.565252 10.2417 0.399994 10.5 0.399994Z" fill="').concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M17.124 19.9923C16.576 20.0608 16.0762 19.6721 16.0077 19.124L15.0077 11.124C14.9392 10.576 15.3279 10.0762 15.876 10.0077C16.424 9.93921 16.9238 10.3279 16.9923 10.876L17.9923 18.876C18.0608 19.424 17.672 19.9238 17.124 19.9923Z" fill="').concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.75149 7.75977C2.86193 7.31348 3.26245 6.99999 3.7222 6.99999H5.27775C5.73751 6.99999 6.13803 7.31348 6.24847 7.75977L8.9706 18.7598C9.10327 19.2959 8.77621 19.838 8.2401 19.9707C7.70399 20.1034 7.16183 19.7763 7.02916 19.2402L6.47478 17H2.5251L1.97071 19.2402C1.83803 19.7763 1.29588 20.1034 0.759764 19.9707C0.223651 19.838 -0.1034 19.2959 0.0292739 18.7598L2.75149 7.75977ZM3.02005 15H5.97985L4.49998 9.01988L3.02005 15Z" fill="').concat(e,'"/>\n</svg>\n'),aiImageIcon=e=>'\n<svg width="21" class="newt-toolbar-icon" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M11.75 3H5.7587C4.95374 2.99999 4.28937 2.99998 3.74818 3.0442C3.18608 3.09012 2.66937 3.18869 2.18404 3.43598C1.43139 3.81947 0.819469 4.43139 0.435975 5.18404C0.188684 5.66938 0.0901201 6.18608 0.0441949 6.74818C-2.21543e-05 7.28937 -1.19522e-05 7.95372 4.11648e-07 8.75869V15.2413C-2.11471e-06 15.4058 -4.55102e-06 15.5644 0.00037041 15.7173L3.96608 12.1922L6.42581 14.16L11.6988 8.88706L7.99994 7.5V4.5L11.75 3Z" fill="'.concat(e,'"/>\n<path d="M12.6584 10.7559L6.57425 16.84L4.03398 14.8078L0.203163 18.2129C0.260802 18.4197 0.33631 18.6204 0.435975 18.816C0.819469 19.5686 1.43139 20.1805 2.18404 20.564C2.66937 20.8113 3.18608 20.9099 3.74818 20.9558C4.28937 21 4.95372 21 5.75868 21H12.2413C13.0463 21 13.7106 21 14.2518 20.9558C14.8139 20.9099 15.3306 20.8113 15.816 20.564C16.5686 20.1805 17.1805 19.5686 17.564 18.816C17.8113 18.3306 17.9099 17.8139 17.9558 17.2518C18 16.7106 18 16.0463 18 15.2413V9L16.4999 13H13.4999L12.6584 10.7559Z" fill="').concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M13.3547 4.35472L14.5257 0.841888H15.4743L16.6453 4.35472L20.1581 5.52566V6.47434L16.6453 7.64529L15.4743 11.1581H14.5257L13.3547 7.64529L9.84189 6.47434V5.52566L13.3547 4.35472Z" fill="').concat(e,'"/>\n</svg>\n'),textIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="22" viewBox="0 0 20 22" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M13.75 1C13.75 0.585786 13.4142 0.25 13 0.25C12.5858 0.25 12.25 0.585786 12.25 1V21C12.25 21.4142 12.5858 21.75 13 21.75C13.4142 21.75 13.75 21.4142 13.75 21V18.9944C16.3859 18.9668 17.8541 18.8028 18.8284 17.8284C20 16.6569 20 14.7712 20 11C20 7.22876 20 5.34315 18.8284 4.17157C17.8541 3.19724 16.3859 3.03321 13.75 3.00559V1Z" fill="'.concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8 19C4.22876 19 2.34315 19 1.17157 17.8284C0 16.6569 0 14.7712 0 11C0 7.22876 0 5.34315 1.17157 4.17157C2.34315 3 4.22876 3 8 3H11V19H8ZM4.81782 6.78733C5.11779 6.74992 5.48429 6.74996 5.88383 6.75H8.1162C8.51575 6.74996 8.88223 6.74992 9.18219 6.78733C9.51086 6.82833 9.86123 6.9242 10.1624 7.19187C10.2138 7.23753
110.2625 7.28618 10.3081 7.33756C10.5758 7.63878 10.6717 7.98915 10.7127 8.31782C10.7501 8.61779 10.7501 8.98428 10.75 9.38383L10.75 9.42501C10.75 9.83922 10.4142 10.175 10 10.175C9.58579 10.175 9.25001 9.83922 9.25001 9.42501C9.25001 8.97047 9.24864 8.69931 9.22421 8.50348C9.19979 8.30765 8.99653 8.2758 8.99653 8.2758C8.8007 8.25137 8.52954 8.25001 8.07501 8.25001H7.75001V13.75H9.00001C9.41422 13.75 9.75001 14.0858 9.75001 14.5C9.75001 14.9142 9.41422 15.25 9.00001 15.25H5.00001C4.58579 15.25 4.25001 14.9142 4.25001 14.5C4.25001 14.0858 4.58579 13.75 5.00001 13.75H6.25001V8.25001H5.925C5.47047 8.25001 5.19931 8.25137 5.00348 8.2758C5.00348 8.2758 4.80023 8.30765 4.7758 8.50348C4.75137 8.69931 4.75001 8.97047 4.75001 9.42501C4.75001 9.83922 4.41422 10.175 4.00001 10.175C3.58579 10.175 3.25001 9.83922 3.25001 9.42501L3.25 9.38383C3.24996 8.98428 3.24992 8.61779 3.28733 8.31782C3.32833 7.98915 3.4242 7.63878 3.69187 7.33756C3.73753 7.28618 3.78618 7.23753 3.83756 7.19187C4.13878 6.9242 4.48915 6.82833 4.81782 6.78733Z" fill="').concat(e,'"/>\n</svg>\n'),delimiterIcon=e=>'<svg class="newt-toolbar-icon" width="20" height="16" viewBox="0 0 20 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.17157 1.17157C0 2.34315 0 4.22876 0 8C0 11.7712 0 13.6569 1.17157 14.8284C2.34315 16 4.22876 16 8 16H12C15.7712 16 17.6569 16 18.8284 14.8284C20 13.6569 20 11.7712 20 8C20 4.22876 20 2.34315 18.8284 1.17157C17.6569 0 15.7712 0 12 0H8C4.22876 0 2.34315 0 1.17157 1.46447ZM10.7502 6C10.7502 5.58579 10.4144 5.25 10.0002 5.25C9.58602 5.25 9.25023 5.58579 9.25023 6V6.70118L8.64281 6.35048C8.28409 6.14337 7.8254 6.26628 7.61829 6.625C7.41119 6.98372 7.53409 7.44241 7.89281 7.64952L8.49975 7.99993L7.89258 8.35048C7.53386 8.55759 7.41095 9.01628 7.61806 9.375C7.82517 9.73372 8.28386 9.85663 8.64258 9.64952L9.25023 9.29869V10C9.25023 10.4142 9.58602 10.75 10.0002 10.75C10.4144 10.75 10.7502 10.4142 10.7502 10V9.29925L11.3569 9.64952C11.7156 9.85663 12.1743 9.73372 12.3814 9.375C12.5885 9.01628 12.4656 8.55759 12.1069 8.35048L11.4997 7.99993L12.1067 7.64952C12.4654 7.44241 12.5883 6.98372 12.3812 6.625C12.1741 6.26628 11.7154 6.14337 11.3567 6.35048L10.7502 6.70061V6ZM4.73266 5.25C5.14687 5.25 5.48266 5.58579 5.48266 6V6.70061L6.0891 6.35048C6.44782 6.14337 6.90651 6.26628 7.11362 6.625C7.32073 6.98372 7.19782 7.44241 6.8391 7.64952L6.23217 7.99993L6.83934 8.35048C7.19806 8.55759 7.32096 9.01628 7.11386 9.375C6.90675 9.73372 6.44806 9.85663 6.08934 9.64952L5.48266 9.29925V10C5.48266 10.4142 5.14687 10.75 4.73266 10.75C4.31844 10.75 3.98266 10.4142 3.98266 10V9.29869L3.375 9.64952C3.01628 9.85663 2.55759 9.73372 2.35048 9.375C2.14337 9.01628 2.26628 8.55759 2.625 8.35048L3.23217 7.99993L2.62523 7.64952C2.26652 7.44241 2.14361 6.98372 2.35072 6.625C2.55782 6.26628 3.01652 6.14337 3.37523 6.35048L3.98266 6.70118V6C3.98266 5.58579 4.31844 5.25 4.73266 5.25ZM16.0181 6C16.0181 5.58579 15.6823 5.25 15.2681 5.25C14.8539 5.25 14.5181 5.58579 14.5181 6V6.70118L13.9106 6.35048C13.5519 6.14337 13.0932 6.26628 12.8861 6.625C12.679 6.98372 12.8019 7.44241 13.1606 7.64952L13.7676 7.99993L13.1604 8.35048C12.8017 8.55759 12.6788 9.01628 12.8859 9.375C13.093 9.73372 13.5517 9.85663 13.9104 9.64952L14.5181 9.29869V10C14.5181 10.4142 14.8539 10.75 15.2681 10.75C15.6823 10.75 16.0181 10.4142 16.0181 10V9.29925L16.6247 9.64952C16.9835 9.85663 17.4422 9.73372 17.6493 9.375C17.8564 9.01628 17.7335 8.55759 17.3747 8.35048L16.7676 7.99993L17.3745 7.64952C17.7332 7.44241 17.8561 6.98372 17.649 6.625C17.4419 6.26628 16.9832 6.14337 16.6245 6.35048L16.0181 6.70061V6Z" fill="'.concat(e,'"/>\n</svg>\n'),warningIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10 0C5.28595 0 2.92893 0 1.46447 1.46447C0 2.92893 0 5.28595 0 10C0 14.714 0 17.0711 1.46447 18.5355C2.92893 20 5.28595 20 10 20C14.714 20 17.0711 20 18.5355 18.5355C20 17.0711 20 14.714 20 10C20 5.28595 20 2.92893 18.5355 1.46447C17.0711 0 14.714 0 10 0ZM10 4.25C10.4142 4.25 10.75 4.58579 10.75 5V11C10.75 11.4142 10.4142 11.75 10 11.75C9.58579 11.75 9.25 11.4142 9.25 11V5C9.25 4.58579 9.58579 4.25 10 4.25ZM10 15C10.5523 15 11 14.5523 11 14C11 13.4477 10.5523 13 10 13C9.44771 13 9 13.4477 9 14C9 14.5523 9.44771 15 10 15Z" fill="'.concat(e,'"/>\n</svg>\n'),listIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.46447 1.46447C0 2.92893 0 5.28595 0 10C0 14.714 0 17.0711 1.46447 18.5355C2.92893 20 5.28595 20 10 20C14.714 20 17.0711 20 18.5355 18.5355C20 17.0711 20 14.714 20 10C20 5.28595 20 2.92893 18.5355 1.46447ZM8.5431 5.51724C8.82877 5.2173 8.81719 4.74256 8.51724 4.4569C8.21729 4.17123 7.74256 4.18281 7.4569 4.48276L5.14286 6.9125L4.5431 6.28276C4.25744 5.98281 3.78271 5.97123 3.48276 6.2569C3.18281 6.54256 3.17123 7.01729 3.4569 7.31724L4.59976 8.51724C4.74131 8.66588 4.9376 8.75 5.14286 8.75C5.34812 8.75 5.5444 8.66588 5.68596 8.51724
1L8.5431 5.51724ZM11 6.25C10.5858 6.25 10.25 6.58579 10.25 7C10.25 7.41422 10.5858 7.75 11 7.75H16C16.4142 7.75 16.75 7.41422 16.75 7C16.75 6.58579 16.4142 6.25 16 6.25H11ZM8.5431 12.5172C8.82877 12.2173 8.81719 11.7426 8.51724 11.4569C8.21729 11.1712 7.74256 11.1828 7.4569 11.4828L5.14286 13.9125L4.5431 13.2828C4.25744 12.9828 3.78271 12.9712 3.48276 13.2569C3.18281 13.5426 3.17123 14.0173 3.4569 14.3172L4.59976 15.5172C4.74131 15.6659 4.9376 15.75 5.14286 15.75C5.34812 15.75 5.5444 15.6659 5.68596 15.5172L8.5431 12.5172ZM11 13.25C10.5858 13.25 10.25 13.5858 10.25 14C10.25 14.4142 10.5858 14.75 11 14.75H16C16.4142 14.75 16.75 14.4142 16.75 14C16.75 13.5858 16.4142 13.25 16 13.25H11Z" fill="'.concat(e,'"/>\n</svg>\n'),headlineIcon=e=>'\n<svg class="newt-toolbar-icon" width="18" height="20" viewBox="0 0 18 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M0.954915 2.06107C0 3.3754 0 5.25027 0 9V11C0 14.7497 0 16.6246 0.954915 17.9389C1.26331 18.3634 1.6366 18.7367 2.06107 19.0451C3.3754 20 5.25027 20 9 20C12.7497 20 14.6246 20 15.9389 19.0451C16.3634 18.7367 16.7367 18.3634 17.0451 17.9389C18 16.6246 18 14.7497 18 11V9C18 5.25027 18 3.3754 17.0451 2.06107C16.7367 1.6366 16.3634 1.26331 15.9389 0.954915C14.6246 0 12.7497 0 9 0C5.25027 0 3.3754 0 2.06107 0.954915C1.6366 1.26331 1.26331 1.6366 0.954915 2.06107ZM4 6.25C3.58579 6.25 3.25 6.58579 3.25 7C3.25 7.41421 3.58579 7.75 4 7.75H14C14.4142 7.75 14.75 7.41421 14.75 7C14.75 6.58579 14.4142 6.25 14 6.25H4Z" fill="'.concat(e,'"/>\n</svg>\n'),uploadImageIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M19.9998 10.6978C19.9983 12.1674 19.9871 13.4165 19.9036 14.4414C19.8067 15.6308 19.6081 16.6246 19.1636 17.45C18.9676 17.814 18.7267 18.1401 18.4334 18.4334C17.601 19.2657 16.5405 19.6428 15.1966 19.8235C13.8835 20 12.2007 20 10.0534 20H9.94663C7.79929 20 6.11646 20 4.80345 19.8235C3.45951 19.6428 2.39902 19.2657 1.56664 18.4334C0.828705 17.6954 0.447626 16.777 0.244978 15.6376C0.0459066 14.5184 0.00949045 13.1259 0.00192493 11.3967C1.91969e-07 10.9569 1.91935e-07 10.4917 1.91935e-07 10.0009V9.94662C-1.15877e-05 7.79929 -2.08169e-05 6.11646 0.176509 4.80345C0.357197 3.45951 0.734258 2.39902 1.56664 1.56664C2.39902 0.734258 3.45951 0.357197 4.80345 0.176509C5.97111 0.0195199 7.47346 0.00214952 9.30203 0.000235947C9.68734 -0.00016728 10 0.312358 10 0.697673C10 1.08299 9.6872 1.3952 9.30189 1.39561C7.44749 1.39757 6.06751 1.41446 4.98937 1.55941C3.80016 1.7193 3.08321 2.02339 2.5533 2.5533C2.02339 3.08321 1.7193 3.80016 1.55941 4.98937C1.39683 6.19866 1.39535 7.7877 1.39535 10C1.39535 10.2702 1.39535 10.5314 1.39567 10.7844L2.32696 9.96955C3.17465 9.22783 4.45225 9.27037 5.24872 10.0668L9.23917 14.0573C9.87845 14.6966 10.8848 14.7837 11.6245 14.2639L11.9019 14.0689C12.9663 13.3209 14.4064 13.4076 15.3734 14.2779L18.0064 16.6476C18.2714 16.091 18.4288 15.3597 18.5128 14.3281C18.592 13.3561 18.6029 12.1755 18.6044 10.6979C18.6048 10.3126 18.917 10 19.3023 10C19.6876 10 20.0002 10.3125 19.9998 10.6978Z" fill="'.concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5 9C13.3787 9 12.318 9 11.659 8.34099C11 7.68198 11 6.62132 11 4.5C11 2.37868 11 1.31802 11.659 0.65901C12.318 0 13.3787 0 15.5 0C17.6213 0 18.682 0 19.341 0.65901C20 1.31802 20 2.37868 20 4.5C20 6.62132 20 7.68198 19.341 8.34099C18.682 9 17.6213 9 15.5 9ZM17.5303 3.46967L16.0303 1.96967C15.7374 1.67678 15.2626 1.67678 14.9697 1.96967L13.4697 3.46967C13.1768 3.76256 13.1768 4.23744 13.4697 4.53033C13.7626 4.82322 14.2374 4.82322 14.5303 4.53033L14.75 4.31066V6.5C14.75 6.91421 15.0858 7.25 15.5 7.25C15.9142 7.25 16.25 6.91421 16.25 6.5V4.31066L16.4697 4.53033C16.7626 4.82322 17.2374 4.82322 17.5303 4.53033C17.8232 4.23744 17.8232 3.76256 17.5303 3.46967Z" fill="').concat(e,'"/>\n</svg>\n'),buttonIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.46447 1.46447C0 2.92893 0 5.28595 0 10C0 14.714 0 17.0711 1.46447 18.5355C2.92893 20 5.28595 20 10 20C14.714 20 17.0711 20 18.5355 18.5355C20 17.0711 20 14.714 20 10C20 5.28595 20 2.92893 18.5355 1.46447ZM10.3975 12.0385L12.859 14.4999C13.1138 14.7548 13.2413 14.8822 13.3834 14.9411C13.573 15.0196 13.7859 15.0196 13.9755 14.9411C14.1176 14.8822 14.2451 14.7548 14.4999 14.4999C14.7548 14.2451 14.8822 14.1176 14.9411 13.9755C15.0196 13.7859 15.0196 13.573 14.9411 13.3834C14.8822 13.2413 14.7548 13.1138 14.4999 12.859L12.0385 10.3975L12.7902 9.64588C13.5597 8.87636 13.9444 8.4916 13.8536 8.07806C13.7628 7.66451 13.2522 7.47641 12.231 7.10019L8.82529 5.84544C6.78816 5.09492 5.7696 4.71966 5.24463 5.24463C4.71966 5.7696 5.09492 6.78816 5.84544 8.82529L7.10019 12.231C7.47641 13.2522 7.66452 13.7628 8.07806 13.8536C8.4916 13.9444 8.87636 13.5597 9.64587 12.7902L10.3975 12.0385Z" fill="'.concat(e,'"/>\n</svg>\n'),codeIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.46447 1.46447C0 2.92893 0 5.28595 0 10C0 14.714 0 17.0711 1.46447 18.5355C2.92893 20 5.28595 20 10 20C14.714 20 17.0711 20 18.5355 18.5355C20 17.0711 20 14.714 20 10C20 5.28595 20 2.92893 18.5355 1.46447ZM11.4881 4.44591C11.8882 4.55311 12.1256 4.96437 12.0184 5.36447L9.4302 15.0237C9.32299 15.4238 8.91174 15.6613 8.51164 15.5541C8.11154 15.4468 7.8741 15.0356 7.98131 14.6355L10.5695 4.97624C10.6767 4.57614 11.088 4.3387 11.4881 4.44591ZM12.9697 6.46967C13.2626 6.17678 13.7374 6.17678 14.0303 6.46967L14.2387 6.67801C14.874 7.3133 15.4038 7.84308 15.7678 8.32019C16.1521 8.82379 16.4216 9.35587 16.4216 10C16.4216 10.6441 16.1521 11.1762 15.7678 11.6798C15.4038 12.1569 14.874 12.6867 14.2387 13.322L14.0303 13.5303C13.7374 13.8232 13.2626 13.8232 12.9697 13.5303C12.6768 13.2374 12.6768 12.7626 12.9697 12.4697L13.1412 12.2981C13.8229 11.6164 14.2797 11.1574 14.5753 10.7699C14.8577 10.3998 14.9216 10.1843 14.9216 10C14.9216 9.81571 14.8577 9.60024 14.5753 9.23007C14.2797 8.84258 13.8229 8.38356 13.1412 7.70191L12.9697 7.53033C12.6768 7.23744 12.6768 6.76257 12.9697 6.46967ZM5.96986 6.46967C6.26275 6.17678 6.73762 6.17678 7.03052 6.46967C7.32341 6.76257 7.32341 7.23744 7.03052 7.53033L6.85894 7.70191C6.17729 8.38356 5.72052 8.84258 5.42488 9.23007C5.14245 9.60024 5.07861 9.81571 5.07861 10C5.07861 10.1843 5.
114245 10.3998 5.42488 10.7699C5.72052 11.1574 6.17729 11.6164 6.85894 12.2981L7.03052 12.4697C7.32341 12.7626 7.32341 13.2374 7.03052 13.5303C6.73762 13.8232 6.26275 13.8232 5.96986 13.5303L5.76151 13.322C5.12617 12.6867 4.59638 12.1569 4.23235 11.6798C3.84811 11.1762 3.57861 10.6441 3.57861 10C3.57861 9.35587 3.84811 8.82379 4.23235 8.32019C4.59638 7.84308 5.12617 7.31331 5.76151 6.67801L5.96986 6.46967Z" fill="'.concat(e,'"/>\n</svg>\n'),tableIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M0 4.5C0 2.37868 0 1.31802 0.65901 0.65901C1.31802 0 2.37868 0 4.5 0C6.62132 0 7.68198 0 8.34099 0.65901C9 1.31802 9 2.37868 9 4.5C9 6.62132 9 7.68198 8.34099 8.34099C7.68198 9 6.62132 9 4.5 9C2.37868 9 1.31802 9 0.65901 8.34099C0 7.68198 0 6.62132 0 4.5Z" fill="'.concat(e,'"/>\n<path d="M11 15.5C11 13.3787 11 12.318 11.659 11.659C12.318 11 13.3787 11 15.5 11C17.6213 11 18.682 11 19.341 11.659C20 12.318 20 13.3787 20 15.5C20 17.6213 20 18.682 19.341 19.341C18.682 20 17.6213 20 15.5 20C13.3787 20 12.318 20 11.659 19.341C11 18.682 11 17.6213 11 15.5Z" fill="').concat(e,'"/>\n<path d="M0 15.5C0 13.3787 0 12.318 0.65901 11.659C1.31802 11 2.37868 11 4.5 11C6.62132 11 7.68198 11 8.34099 11.659C9 12.318 9 13.3787 9 15.5C9 17.6213 9 18.682 8.34099 19.341C7.68198 20 6.62132 20 4.5 20C2.37868 20 1.31802 20 0.65901 19.341C0 18.682 0 17.6213 0 15.5Z" fill="').concat(e,'"/>\n<path d="M11 4.5C11 2.37868 11 1.31802 11.659 0.65901C12.318 0 13.3787 0 15.5 0C17.6213 0 18.682 0 19.341 0.65901C20 1.31802 20 2.37868 20 4.5C20 6.62132 20 7.68198 19.341 8.34099C18.682 9 17.6213 9 15.5 9C13.3787 9 12.318 9 11.659 8.34099C11 7.68198 11 6.62132 11 4.5Z" fill="').concat(e,'"/>\n</svg>\n'),quoteIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M11.0867 19.3877L11.6288 18.4718C12.0492 17.7614 12.2595 17.4062 12.5972 17.2098C12.9349 17.0134 13.36 17.0061 14.2104 16.9915C15.4658 16.9698 16.2531 16.8929 16.9134 16.6194C18.1386 16.1119 19.1119 15.1386 19.6194 13.9134C20 12.9946 20 11.8297 20 9.5V8.5C20 8.13033 20 7.78153 19.9989 7.45187C19.9976 7.02454 19.4751 6.78307 19.0971 6.9825C18.4709 7.31294 17.7573 7.5 17 7.5C14.5147 7.5 12.5 5.48528 12.5 3C12.5 2.24271 12.6871 1.52911 13.0175 0.902885C13.2169 0.524944 12.9755 0.00243675 12.5481 0.00106117C12.2185 -9.66247e-09 11.8697 0 11.5 0H8.5C5.22657 0 3.58985 -5.96046e-08 2.38751 0.736799C1.71473 1.14908 1.14908 1.71473 0.736799 2.38751C0 3.58985 0 5.22657 0 8.5V9.5C0 11.8297 0 12.9946 0.380602 13.9134C0.888072 15.1386 1.86144 16.1119 3.08658 16.6194C3.74689 16.8929 4.53422 16.9698 5.78958 16.9915C6.63992 17.0061 7.06509 17.0134 7.40279 17.2098C7.74049 17.4063 7.95073 17.7614 8.37121 18.4718L8.91331 19.3877C9.39647 20.204 10.6035 20.204 11.0867 19.3877Z" fill="'.concat(e,'"/>\n<circle cx="17" cy="3" r="3" fill="').concat(e,'"/>\n</svg>\n'),alertIcon=e=>'\n<svg class="newt-toolbar-icon" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M20 3C20 4.65685 18.6569 6 17 6C15.3431 6 14 4.65685 14 3C14 1.34315 15.3431 0 17 0C18.6569 0 20 1.34315 20 3Z" fill="'.concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M4.25 12C4.25 11.5858 4.58579 11.25 5 11.25H14C14.4142 11.25 14.75 11.5858 14.75 12C14.75 12.4142 14.4142 12.75 14 12.75H5C4.58579 12.75 4.25 12.4142 4.25 12Z" fill="').concat(e,'"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.46447 18.5355C2.92893 20 5.28595 20 10 20C14.714 20 17.0711 20 18.5355 18.5355C20 17.0711 20 14.714 20 10C20 8.60124 20 7.40999 19.9617 6.38802C19.1703 7.08042 18.1342 7.5 17 7.5C14.5147 7.5 12.5 5.48528 12.5 3C12.5 1.86584 12.9196 0.829672 13.612 0.0382589C12.59 5.58794e-08 11.3988 0 10 0C5.28595 0 2.92893 0 1.46447 1.46447C0 2.92893 0 5.28595 0 10C0 14.714 0 17.0711 1.46447 18.5355ZM4.25 15.5C4.25 15.0858 4.58579 14.75 5 14.75H11C11.4142 14.75 11.75 15.0858 11.75 15.5C11.75 15.9142 11.4142 16.25 11 16.25H5C4.58579 16.25 4.25 15.9142 4.25 15.5Z" fill="').concat(e,'"/>\n</svg>\n'),stopEnter=e=>{("Enter"===e.key||"Enter"===e.key)&&e.stopPropagation()},InlineAssistantUI=e=>{let{container:n,blockIndex:o,currentBlock:l,allBlocks:s,editorInstance:a,onChange:c,onClose:d,onNewChapter:h,firstPrompt:p,systemPrompt:u,onInsertImageUrl:m,firstImage:v}=e;return(0,r.createPortal)((0,i.BX)("div",{className:"composerInlineWrapper or-spacer",style:{background:"rgba(0,0,0,0.03)",border:"1px solid rgba(0,0,0,0.11)",marginBottom:10},onKeyDownCapture:stopEnter,children:[(0,i.tZ)("div",{className:"mask"}),(0,i.tZ)(D.h,{systemPrompt:u,firstPrompt:p,currentBlock:l,allBlocks:s,onInsertImageUrl:m,onRewrite:e=>{a.blocks.delete(o),e.forEach((e,n)=>a.blocks.insert(e.type,e.data,{},o+n,!0)),a.save().then(e=>null==c?void 0:c(e)),d()},onInsert:e=>{e.forEach((e,n)=>a.blocks.insert(e.type,e.data,{},o+n,!0)),a.save().then(e=>null==c?void 0:c(e)),d()},onAppend:e=>{let n=a.blocks.getBlocksCount();e.forEach((e,o)=>a.blocks.insert(e.type,e.data,{},n+o,!0)),a.save().then(e=>null==c?void 0:c(e)),d()},onNewChapter:h,onApplyPlainText:null,darkMode:!1,openComposerImage:null,onClose:d})]}),n)};let EditorNewt=class EditorNewt extends l.PureComponent{componentDidMount(){var e,n,o,i,l;let{data:r,instanceRef:a,onChange:E,compact:I=!1}=this.props,P=this.props.key1,B=this.props.key2,A=this.props.isPremium;this.props.isPro;let t=e=>translate(e,this.props.language),N="rgba(0,0,0,.4)",H=!this.props.compact&&["bold","italic","underline","inlineCode","link","aiInlineTool"],Z={paragraph:{class:h.Z,inlineToolbar:H,config:{placeholder:t("typeHere"),preserveBlank:!0,autocomplete:this.props.autocomplete||!1},shortcut:"CMD+SHIFT+P",tunes:["align"],toolbox:{icon:textIcon(N)}}
1,header:{class:p.Z,inlineToolbar:H,config:{placeholder:t("typeHere")},tunes:["align"],toolbox:{icon:headlineIcon(N)}},list:{class:u.Z,inlineToolbar:H,config:{placeholder:t("typeHere"),defaultStyle:"unordered"},toolbox:{title:"List",icon:listIcon(N)}},quote:{class:m.Z,inlineToolbar:H,config:{placeholder:t("typeHere")},toolbox:{icon:quoteIcon(N)}},table:{class:v.Z,inlineToolbar:H,toolbox:{icon:tableIcon(N)}},embed:{class:g.Z,inlineToolbar:H,config:{services:{youtube:!0,instagram:!0,twitter:!0,codepen:{regex:/https?:\/\/codepen.io\/([^\/\?\&]*)\/pen\/([^\/\?\&]*)/,embedUrl:"https://codepen.io/<%= remote_id %>?height=300&theme-id=0&default-tab=result&embed-version=2",html:"<iframe height='300' scrolling='no' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;border-radius:4px;'></iframe>",height:300,width:600,id:e=>e.join("/embed/")}}}},code:{class:_(),inlineToolbar:H,config:{placeholder:t("typeHere")},toolbox:{title:"Code",icon:codeIcon(N)}},linkTool:{class:C.Z,toolbox:{icon:linkShareIcon(N)},config:{endpoint:"https://services.newt.to/utils/scraplink"},shortcut:"CMD+SHIFT+A"},simpleImage:{class:w.Z,config:{placeholder:I?"Paste image URL only...":t("typeHere")}},delimiter:{class:f.Z,toolbox:{icon:delimiterIcon(N)}}
1,warning:{class:b.Z,inlineToolbar:H,toolbox:{icon:warningIcon(N)}},AnyButton:{class:T(),toolbox:{icon:buttonIcon(N)}},math:{class:M,toolbox:{icon:mathIcon(N)}},align:{class:AlignmentBlockTune,toolbox:{title:t("align")}},alert:{class:c(),inlineToolbar:H,shortcut:"CMD+SHIFT+1",toolbox:{icon:alertIcon(N)}},inlineCode:{class:k.Z,shortcut:"CMD+SHIFT+M"},marker:{class:L.Z,shortcut:"CMD+SHIFT+H"},underline:{class:x.Z,shortcut:"CMD+U"},aiInlineTool:{class:InlineAITool,inlineToolbar:H,config:{options:[{label:t("rephrase"),prompt:t("rewriteThisSelection")},{label:t("shorter"),prompt:t("makeThisSelectionShorter")},{label:t("longer"),prompt:t("makeThisSelectionLonger")},{label:t("showNotTell"),prompt:t("makeThisSelectionShowNotTell")},{label:t("describe"),prompt:t("describeThisSelection")}],modelPro:null===(e=this.props.composerSettings)||void 0===e?void 0:e.modelPro,modelProInline:null===(n=this.props.composerSettings)||void 0===n?void 0:n.modelProInline,labels:{analyzing:t("analyzing"),generating:t("generating"),processing:t("processing"),thinking:t("thinking"),accept:t("accept"),reject:t("reject"),quickEdit:t("quickEdit"),egSummarizeIt:t("egSummarizeIt"),egMakeItLonger:t("egMakeItShorter")},isPro:this.props.isPro,triggerPremiumPaywall:this.props.triggerPremiumPaywall,triggerCreditsPurchasePaywall:this.props.triggerCreditsPurchasePaywall,chatPrompt:V.Z.chatPrompt,searchEnabled:null===(o=this.props.composerSettings)||void 0===o?void 0:o.searchEnabled,searchCountry:null===(i=this.props.composerSettings)||void 0===i?void 0:i.searchCountry,searchLocation:null===(l=this.props.composerSettings)||void 0===l?void 0:l.searchLocation}}};I||(Z.image={class:y.Z,inlineToolbar:H,toolbox:{icon:uploadImageIcon(N)},config:{uploader:{uploadByFile(e){return e?I?V.Z.uploadImageToTempComposer(e).then(function(){let{url:e="",colors:n,hash:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e?{success:1,file:{url:e,colors:n,hash:o}}:{success:0}}).catch(e=>(console.error("Error uploading image:",e),{success:0})):A?d.Z.uploadBookChapterImage(e,P,B).then(function(){let{url:e="",colors:n,hash:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e?{success:1,file:{url:e,colors:n,hash:o}}:{success:0}}):(this.props.triggerPremiumPaywall(),new Promise(e=>{e({success:0})})):new Promise(e=>{e({success:0})})},uploadByUrl:e=>checkUrl(e).then(e=>e?{success:1,file:{url:e}}:{success:0})}}}),this.instance=new s.Z({holder:this.props.holderId||"newt-native-editor",data:r,inlineToolbar:H,tools:Z,i18n:{messages:{ui:{blockTunes:{toggler:{"Click to tune":t("clickToTune"),"or drag to move":t("orDragToMove")}},inlineToolbar:{converter:{"Convert to":t("convertTo")}},toolbar:{toolbox:{Add:t("add")}},popover:{"Convert to":t("convertTo")}},toolNames:{Text:t("text"),Heading:t("heading"),List:t("list"),Warning:t("warning"),Checklist:t("checklist"),Quote:t
1("quote"),Code:t("code"),Delimiter:t("delimiter"),Table:t("table"),Link:t("link"),Marker:t("marker"),Bold:t("bold"),Italic:t("italic"),InlineCode:t("inlineCode"),AnyButton:t("button"),alert:t("alert")},tools:{image:{Caption:t("caption")},warning:{Title:t("title"),Message:t("message")},link:{"Add a link":t("addALink")},stub:{"The block can not be displayed correctly.":t("blockNotDisplayedCorrectly")}},blockTunes:{align:{Left:t("left"),Center:t("center"),Right:t("right")},convertTo:{"Convert to":t("convertTo")},delete:{Delete:t("delete")},moveUp:{"Move up":t("moveUp")},moveDown:{"Move down":t("moveDown")}}}},onReady:()=>{I||new(S())(this.instance),new(R())({editor:this.instance}).initialize(r)},onChange:async()=>{if(!(document.querySelector(".inline-ai-actions")||document.querySelector(".ce-popover-loading")||document.querySelector(".inline-ai-dropdown")||document.querySelector(".newt-ai-preview-old, .newt-ai-preview-new")||document.body.classList.contains("newt-ai-preview-active")))try{let e=await this.instance.save();if(e&&E){if(e.blocks){let n=e.blocks.filter((n,o)=>{var i;if("paragraph"!==n.type||(null===(i=n.data)||void 0===i?void 0:i.text)&&n.data.text.trim())return!0;let l=e.blocks.length,r=e.blocks.filter(e=>{var n;return"paragraph"===e.type&&(!(null===(n=e.data)||void 0===n?void 0:n.text)||!e.data.text.trim())});return 1===l||o===l-1&&1===r.length}),o={...e,blocks:n.length>0?n:[{type:"paragraph",data:{text:""}}]};E(o)}else E(e)}}catch(e){console.error("Error saving editor content:",e)}},logLevel:"ERROR"}),null==a||a(this.instance),I&&this.addCompactModeImageRestrictions()}componentWillUnmount(){var e,n,o;null===(n=this.instance)||void 0===n||null===(e=n.destroy)||void 0===e||e.call(n),null===(o=this.compactModeCleanup)||void 0===o||o.call(this)}addCompactModeImageRestrictions(){let e=document.getElementById(this.props.holderId||"newt-native-editor");if(!e)return;let handleDragOver=e=>{var n;let o=Array.from((null===(n=e.dataTransfer)||void 0===n?void 0:n.items)||[]),i=o.some(e=>"file"===e.kind&&e.type.startsWith("image/"));i&&(e.preventDefault(),e.stopPropagation())},handleDrop=e=>{var n;let o=Array.from((null===(n=e.dataTransfer)||void 0===n?void 0:n.items)||[]),i=o.some(e=>"file"===e.kind&&e.type.startsWith("image/"));if(i)return e.preventDefault(),e.stopPropagation(),!1},handlePaste=e=>{var n;let o=Array.from((null===(n=e.clipboardData)||void 0===n?void 0:n.items)||[]),i=o.some(e=>"file"===e.kind&&e.type.startsWith("image/"));if(i)return e.preventDefault(),e.stopPropagation(),!1},handleFileInput=e=>{var n;let o=e.target;if("file"===o.type&&(null===(n=o.accept)||void 0===n?void 0:n.includes("image")))return e.preventDefault(),e.stopPropagation(),!1};e.addEventListener("dragover",handleDragOver),e.addEventListener("drop",handleDrop),e.addEventListener("paste",handlePaste),document.addEventListener("change",handleFileInput,!0),document.addEventListener("click",e=>{let n=e.target;if("INPUT"===n.tagName&&"file"===n.type){var o;if(null===(o=n.accept)||void 0===o?void 0:o.includes("image"))return e.preventDefault(),e.stopPropagation(),!1}},!0),this.compactModeCleanup=()=>{e.removeEventListener("dragover",handleDragOver),e.removeEventListener("drop",handleDrop),e.removeEventListener("paste",handlePaste),document.removeEventListener("change",handleFileInput,!0)}}insertNewImageAfterBlock(e,n,o,i,l){if(!this.instance)return;let r=this.instance.blocks,s=Array.from(document.querySelectorAll(".ce-block")).indexOf(l);r.insert("image",{file:{url:e,colors:n,hash:o},caption:i||"",withBorder:!1,withBackground:!1,stretched:!1},{},s+1,!0)}appendNewImage(e,n,o,i){this.instance&&this.instance.blocks.insert("image",{file:{url:e,colors:n,hash:o},caption:i||"",withBorder:!1,withBackground:!1,stretched:!1})}replaceImageInBlock(e,n,o,i,l){let r=l.querySelector("img");if(r&&(r.src=e),i){let e=l.querySelector(".cdx-input");e&&(e.textContent=i)}this.instance&&this.instance.saver.save().then(()=>{}).catch(()=>{})}render(){return(0,i.tZ)("div",{id:this.props.holderId||"newt-native-editor"})}};let Editor=class Editor extends l.Component{componentDidMount(){this.obs=new MutationObserver(()=>this.injectToolboxItems());let e=document.getElementById("editor-container-".concat(this.props.holderId||"newt-native-editor"));e&&this.obs.observe(e,{subtree:!0,childList:!0}),this.injectToolboxItems(),document.addEventListener("keydown",this.handleKeyDown,!0),setTimeout(()=>{this.initializeImageRecreateHandler()},500)}componentWillUnmount(){var e;null===(e=this.obs)||void 0===e||e.disconnect(),document.removeEventListener("keydown",this.handleKeyDown,!0),this.imageRecreateHandler&&this.imageRecreateHandler.destroy()}async injectSettingsItems(){let e=this.editorRef.current;document.querySelectorAll(".ce-settings").forEach(n=>{var o,i;if(n.querySelector('.ce-popover-item[data-item-name="ai-extra"]'))return;let l=null===(o=e.blocks)||void 0===o?void 0:o.getCurrentBlockIndex(),r=null===(i=e.blocks)||void 0===i?void 0:i.getBlockByIndex(l);if(!r||!["paragraph","header"].includes(r.name))return;let s=n.querySelector(".ce-popover__items"),a=null==s?void 0:s.querySelector('[data-item-name="convert-to"]');if(!s||!a)return;let c="rgba(0,0,0,.4)",d=document.createElement("div");
1d.className="ce-popover-item",d.setAttribute("data-item-name","ai-extra"),d.innerHTML='\n <div class="ce-popover-item__icon ce-popover-item__icon--tool">\n '.concat(aiRewriteIcon(c),'\n </div>\n <div class="ce-popover-item__title">').concat(this.t("rewrite"),"</div>\n "),d.addEventListener("click",n=>{var o,i,r,s;n.stopPropagation();let a=e.blocks.getBlockByIndex(l),c=null==a?void 0:null===(i=a.holder)||void 0===i?void 0:null===(o=i.innerText)||void 0===o?void 0:o.trim();if(!c){null===(r=(s=this.props).showSnackbar)||void 0===r||r.call(s,this.t("inputRewriteSnackbarText")),e.toolbar.close();return}this.openInlineAt(l,this.t("rewrite")),e.toolbar.close()}),a.before(d);let h=document.createElement("div");h.className="ce-popover-item",h.setAttribute("data-item-name","ai-visualize"),h.innerHTML='\n <div class="ce-popover-item__icon ce-popover-item__icon--tool">\n '.concat(aiVisualizecon(c),'\n </div>\n <div class="ce-popover-item__title">').concat(this.t("visualize"),"</div>\n "),h.addEventListener("click",n=>{var o,i,r,s;n.stopPropagation();let a=e.blocks.getBlockByIndex(l),c=null==a?void 0:null===(i=a.holder)||void 0===i?void 0:null===(o=i.innerText)||void 0===o?void 0:o.trim();if(!c){null===(r=(s=this.props).showSnackbar)||void 0===r||r.call(s,this.t("inputVisualizeSnackbarText")),e.toolbar.close();return}this.openImageModalAt(l,"visualize"),e.toolbar.close()}),a.before(h);let p=document.createElement("div");p.className="ce-popover-item",p.setAttribute("data-item-name","ai-expand"),p.innerHTML='\n <div class="ce-popover-item__icon ce-popover-item__icon--tool">\n '.concat(aiExpandIcon(c),'\n </div>\n <div class="ce-popover-item__title">').concat(this.t("expand"),"</div>\n "),p.addEventListener("click",async n=>{var o,i,r,s;n.stopPropagation();let a=e.blocks.getBlockByIndex(l),c=null==a?void 0:null===(i=a.holder)||void 0===i?void 0:null===(o=i.innerText)||void 0===o?void 0:o.trim(),d="";if(l>0){let n=await e.save(),o=n.blocks;d=(0,q.YH)((0,q.Ke)(null==o?void 0:o.slice(0,l)),!0).trim()}if(!c&&!d){null===(r=(s=this.props).showSnackbar)||void 0===r||r.call(s,this.t("inputExpandSnackbarText")),e.toolbar.close();return}this.openInlineAt(l,this.t("expand")),e.toolbar.close()}),a.before(p)})}async injectToolboxItems(){let e=this.editorRef.current,n="rgba(0,0,0,.4)";document.querySelectorAll(".ce-toolbox").forEach(o=>{let i=o.querySelector(".ce-popover__items");if(!i||i.querySelector(".ce-popover-item--ai-inline"))return;let l=document.createElement("div");l.className="ce-popover-item ce-popover-item--ai-inline",l.innerHTML='\n <div class="ce-popover-item__icon">'.concat(aiInlineIcon(n),'</div>\n <div class="ce-popover-item__title">Inline AI</div>\n '),l.addEventListener("click",n=>{n.stopPropagation();let o=e.blocks.getCurrentBlockIndex();this.openInlineAt(o),e.toolbar.close()});let r=document.createElement("div");r.className="ce-popover-item ce-popover-item--ai-modal",r.innerHTML='\n <div class="ce-popover-item__icon">'.concat(aiSparkIcon(n),'</div>\n <div class="ce-popover-item__title">Composer AI</div>\n '),r.addEventListener("click",n=>{n.stopPropagation();let o=e.blocks.getCurrentBlockIndex();this.openModalAt(o),e.toolbar.close()});let s=document.createElement("div");s.className="ce-popover-item ce-popover-item--ai-modal",s.innerHTML='\n <div class="ce-popover-item__icon">'.concat(aiImageIcon(n),'</div>\n <div class="ce-popover-item__title">AI Image</div>\n '),s.addEventListener("click",n=>{n.stopPropagation();let o=e.blocks.getCurrentBlockIndex();this.openImageModalAt(o),e.toolbar.close()}),i.insertBefore(s,i.querySelector('[data-item-name="image"]')),i.insertBefore(l,i.firstChild),i.insertBefore(r,i.firstChild)}),this.injectSettingsItems()}async openInlineAt(e,n){var o,i,l;let r=this.editorRef.current,s=r.blocks.getBlockByIndex(e);null===(o=r.caret)||void 0===o||o.setToBlock(e,"end"),null===(i=s.holder.querySelector("[contenteditable]"))||void 0===i||i.focus();let a=await r.save(),c=a.blocks,d=(0,q.YH)((0,q.Ke)(null==c?void 0:c.slice(Math.max(0,e-15),e-1||0)),!0),h=(0,q.YH)((0,q.Ke)(null==c?void 0:c.slice(Math.max(0,e+1),e+2)),!0);this.setState({inline:{container:s.holder,idx:e,currentBlock:{type:s.name,text:null==s?void 0:null===(l=s.holder)||void 0===l?void 0:l.innerText,previous:d,next:h},firstPrompt:n||void 0}})}async openModalAt(e){var n,o,i;let l=this.editorRef.current,r=l.blocks.getBlockByIndex(e);null===(n=l.caret)||void 0===n||n.setToBlock(e,"end"),null===(o=r.holder.querySelector("[contenteditable]"))||void 0===o||o.focus();let s=await l.save(),a=s.blocks,c=(0,q.YH)((0,q.Ke)(null==a?void 0:a.slice(Math.max(0,e-15),e-1||0)),!0),d=(0,q.YH)((0,q.Ke)(null==a?void 0:a.slice(Math.max(0,e+1),e+2)),!0);this.setState({modal:{idx:e,currentBlock:{type:r.name,text:null==r?void 0:null===(i=r.holder)||void 0===i?void 0:i.innerText,previous:c,next:d}}})}async openImageModalAt(e,n){var o,i,l,r;let s=this.editorRef.current,a=s.blocks.getBlockByIndex(e);null===(o=s.caret)||void 0===o||o.setToBlock(e,"end"),null===(i=a.holder.querySelector("[contenteditable]"))||void 0===i||i.focus();let c=await s.save(),d=c.blocks,h=(0,q.YH)((0,q.Ke)(null==d?void 0:d.slice(Math.max(0,e-15),e||0)),!0),p=(0,q.YH)((0,q.Ke)(null==d?void 0:d.slice(Math.max(0,e+1),e+15
1)),!0);this.setState({image:{idx:e,currentBlock:{type:a.name,text:null==a?void 0:null===(l=a.holder)||void 0===l?void 0:l.innerText,previous:h,next:p},firstPrompt:n?"The user wants to visualize the following text: ".concat(null==a?void 0:null===(r=a.holder)||void 0===r?void 0:r.innerText,". Previous context to that text: ").concat(h,". Next context to that text: ").concat(p):void 0}})}render(){var e,n,o,l,r,s,a,c,d,h,p,u,m,v,g,C,w;let{text:y={blocks:[],time:Date.now()},onChange:f,onNewChapter:b,conversationKey:x}=this.props,{inline:k,modal:L,image:E,recreateImage:T}=this.state;return(0,i.BX)("div",{id:"editor-container-".concat(this.props.holderId||"newt-native-editor"),children:[(0,i.tZ)("style",{children:"\n .ce-toolbar__plus,\n .ce-toolbar__settings-btn,\n .ce-conversion-toolbar,\n .ce-toolbar__actions {\n display: ".concat(this.props.compact?"none":"flex"," !important;\n }\n .ce-block__content {\n margin-left: ").concat(this.props.compact?"0 !important":"unset",";\n }\n .codex-editor--narrow .ce-block--focused {\n margin-right: ").concat(this.props.compact?"0 !important":"unset",";\n }\n ")}),(0,i.tZ)(EditorNewt,{data:y,instanceRef:e=>{this.editorRef.current=e,this.props.instanceRef&&this.props.instanceRef(e)},onChange:f,language:this.props.language||"es",isPremium:this.props.isPremium,isPro:this.props.isPro,key1:this.props.key1,key2:this.props.key2,triggerPremiumPaywall:this.props.triggerPremiumPaywall,triggerCreditsPurchasePaywall:this.props.triggerCreditsPurchasePaywall,composerSettings:this.props.composerSettings,typewriterEffect:this.props.typewriterEffect,compact:!0===this.props.compact,autocomplete:this.props.autocomplete,holderId:this.props.holderId}),E&&(0,i.tZ)(O.a8,{visible:!0,isPremium:this.props.isPremium,isPro:this.props.isPro,onClose:this.closeImage,showSnackbar:this.props.showSnackbar,firstPrompt:E.firstPrompt,rePromptOnFirstPromptToo:!!E.firstPrompt,onHardApply:(e,n,o,i)=>{let l=this.editorRef.current,r=l.blocks.getBlocksCount();l.blocks.insert("image",{file:{url:e},caption:i||"",withBorder:!1,withBackground:!1,stretched:!1,colors:n,hash:o},{},E.idx+1||r+1,!0),l.save().then(e=>null==f?void 0:f(e)),this.closeImage()},onInsert:(e,n,o,i)=>{let l=this.editorRef.current;l.blocks.insert("image",{file:{url:e},caption:i||"",withBorder:!1,withBackground:!1,stretched:!1},{},E.idx,!0),l.save().then(e=>null==f?void 0:f(e)),this.closeImage()}}),k&&(0,i.tZ)(InlineAssistantUI,{container:k.container,blockIndex:k.idx,currentBlock:null==k?void 0:k.currentBlock,allBlocks:y.blocks,editorInstance:this.editorRef.current,onChange:f,onClose:this.closeInline,onNewChapter:b,firstPrompt:null==k?void 0:k.firstPrompt,showSnackbar:this.props.showSnackbar,onInsertImageUrl:(e,n,o,i)=>{let l=this.editorRef.current,r=l.blocks.getBlocksCount();l.blocks.insert("image",{file:{url:e},caption:i||"",withBorder:!1,withBackground:!1,stretched:!1,colors:n,hash:o},{},k.idx+1||r+1,!0),l.save().then(e=>null==f?void 0:f(e)),this.closeInline()},systemPrompt:"\n You will assist the user in editing their writing".concat(this.props.aiIntent?" (".concat(this.props.aiIntent,")"):"",".\n ").concat(Array.isArray(this.props.memoryPrompt)&&(null===(e=this.props.memoryPrompt)||void 0===e?void 0:e.length)>0?'\n [CONTENT_CONTEXT:"\n'.concat(this.props.memoryPrompt.join("\n"),'\n]"\n '):"","\n ").concat((null==k?void 0:null===(n=k.currentBlock)||void 0===n?void 0:n.text)?'They have selected the following text to edit: "'.concat(null==k?void 0:null===(o=k.currentBlock)||void 0===o?void 0:o.text,'"'):"","\n ").concat((null==k?void 0:null===(l=k.currentBlock)||void 0===l?void 0:l.previous)?'The text before the selection is: "'.concat(null==k?void 0:null===(r=k.currentBlock)||void 0===r?void 0:r.previous,'"'):"","\n ").concat((null==k?void 0:null===(s=k.currentBlock)||void 0===s?void 0:s.next)?'The text after the selection is: "'.concat(null==k?void 0:null===(a=k.currentBlock)||void 0===a?void 0:a.next,'"'):"","\n ").concat((null==k?void 0:null===(c=k.currentBlock)||void 0===c?void 0:c.type)?"The selected text is part of a ".concat((null==k?void 0:null===(d=k.currentBlock)||void 0===d?void 0:d.type)||"paragraph","."):"","\n When rewriting, expanding the content to be longer, or anything else the user asks, focus mostly on the selected text. Make sure your changes maintain the overall meaning and flow with the previous and following text.\n Do not modify the text before or after the selection and do not add content from the before or after the selection.")}),L&&(0,i.tZ)(z.Z,{persistent:!0,visible:!0,conversationKey:x,showSnackbar:this.props.showSnackbar,firstPrompt:this.props.firstPrompt,systemPrompt:"\n You will assist the user in editing their writing".concat(this.props.aiIntent?" (".concat(this.props.aiIntent,")"):"",".\n ").concat(Array.isArray(this.props.memoryPrompt)&&(null===(h=this.props.memoryPrompt)||void 0===h?void 0:h.length)>0?'\n [CONTENT_CONTEXT:"\n'.concat(this.props.memoryPrompt.join("\n"),'\n]"\n '):"","\n ").concat((null==L?void 0:null===(p=L.currentBlock)||void 0===p?void 0:p.text)?'They have selected the following text: "'.concat(null==L?void 0:null===(u=L.currentBlock)||void 0===u?void 0:u.text,'"'):"","\n ").concat((null==L?void 0:null===(m=L.currentBlock)||void 0===m?void 0:m.previous)?"The ".concat((null==L?void 0:null===(v=L.currentBlock)||void 0===v?void 0:v.type)||"text",' before the selection is: "').concat(null==L?void 0:null===(g=L.currentBlock)||void 0===g?void 0:g.previous,'"'):"","\n ").concat((null==L?void 0:null===(C=L.currentBlock)||void 0===C?void 0:C.next)?'The text after the selection is: "'.concat(null==L?void 0:null===(w=L.currentBlock)||void 0===w?void 0:w.next,'"'):"","\n The user might ask to rewrite the entire content, not just the selection. In that case, rewrite the entire content, but do not add any new content or change the meaning of the original text unless told otherwise.\n The user might also ask to rewrite the current selection, and when doing so, only edit the selected text. Make sure your changes maintain the overall meaning and flow with the surrounding text; do not modify the text before or after the selection, just send the raw edit, without any explanation or additional text.\n Figure out the user's intent, whether is rewriting the whole content, rewriting the current selection, or expanding the current selection, and respond accordingly.\n "),onInsertImageUrl:(e,n,o,i)=>{let l=this.editorRef.current,r=l.blocks.getBlocksCount();l.blocks.insert("image",{file:{url:e}
1,caption:i||"",withBorder:!1,withBackground:!1,stretched:!1,colors:n,hash:o},{},L.idx+1||r+1,!0),l.save().then(e=>null==f?void 0:f(e)),this.closeModal()},currentBlock:null==L?void 0:L.currentBlock,onClose:this.closeModal,onRewrite:e=>{let n=this.editorRef.current;n.blocks.delete(L.idx),e.forEach((e,o)=>n.blocks.insert(e.type,e.data,{},L.idx+o,!0)),n.save().then(e=>null==f?void 0:f(e)),this.closeModal()},onInsert:e=>{let n=this.editorRef.current;e.forEach((e,o)=>n.blocks.insert(e.type,e.data,{},L.idx+o,!0)),n.save().then(e=>null==f?void 0:f(e)),this.closeModal()},onAppend:e=>{let n=this.editorRef.current,o=n.blocks.getBlocksCount();e.forEach((e,i)=>n.blocks.insert(e.type,e.data,{},o+i,!0)),n.save().then(e=>{null==f||f(e)}),this.closeModal()},onNewChapter:b,contents:null}),T&&(0,i.tZ)(O.a8,{visible:!0,firstImage:T.imageUrl,firstPrompt:"recreate this image",rePromptOnFirstPromptToo:!0,onClose:this.closeRecreateImage,onHardApply:(e,n,o,i)=>{T.onReplace(e,n,o,i),this.closeRecreateImage()},onInsert:(e,n,o,i)=>{T.onInsert(e,n,o,i),this.closeRecreateImage()},onAppend:(e,n,o,i)=>{T.onAppend(e,n,o,i),this.closeRecreateImage()},isPro:this.props.isPro,isPremium:this.props.isPremium})]})}constructor(...e){super(...e),this.editorRef=l.createRef(),this.openRecreateModal=e=>{let{imageUrl:n,onInsert:o,onAppend:i,onReplace:l}=e;this.setState({recreateImage:{imageUrl:n,onInsert:o,onAppend:i,onReplace:l}},()=>{})},this.state={inline:null,modal:null,image:null,recreateImage:null},this.initializeImageRecreateHandler=()=>{var e;let n=this.editorRef.current;if(!n){console.warn("EditorJS instance not available for image recreate handler");return}this.imageRecreateHandler=(e=this.openRecreateModal.bind(this),new OptimizedImageRecreateHandler(e,n)),this.imageRecreateHandler.initialize()},this.t=e=>translate(e,this.props.language),this.handleKeyDown=e=>{if(!this.props.typewriterEffect)return;let n=document.getElementById("editor-container-".concat(this.props.holderId||"newt-native-editor"));if(!n)return;let o=document.activeElement;o&&n.contains(o)&&("Enter"===e.key?playTypewriterSound("Enter"):1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey||playTypewriterSound(e.key))},this.openAIModal=e=>{var n;let o=this.editorRef.current;if(!o){console.error("Editor instance not available in openAIModal");return}let i=(null===(n=o.blocks)||void 0===n?void 0:n.getBlocksCount())||0,l="number"==typeof e?e:Math.max(0,i-1);this.openModalAt(l)},this.closeInline=()=>this.setState({inline:null}),this.closeImage=()=>this.setState({image:null}),this.closeModal=()=>this.setState({modal:null}),this.closeRecreateImage=()=>this.setState({recreateImage:null})}};var editor=e=>{let{forwardedRef:n,...o}=e;return(0,i.tZ)(Editor,{...o,ref:n})}}}]);
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.