import{s as xt,ae as Ke,af as gt,f as o,a as p,l as te,g as l,D as c,c as r,h as $,m as se,d as s,j as dt,k as _t,i as n,r as Re}from"./scheduler.2f9f1739.js";import{S as bt,i as $t,b as B,d as g,m as d,a as w,t as v,e as x}from"./index.f9f1dac6.js";import{g as Ct,a as wt}from"./styles.a749dd55.js";import{S as Dt}from"./seriesLayout.493d67f0.js";import{L as Ge}from"./link.4e908ad9.js";import{I as ee}from"./image.a4587660.js";function Et(F){let a;return{c(){a=te("Join the waitlist here")},l(i){a=se(i,"Join the waitlist here")},m(i,y){n(i,a,y)},d(i){i&&s(a)}}}function kt(F){let a;return{c(){a=te("commentrig")},l(i){a=se(i,"commentrig")},m(i,y){n(i,a,y)},d(i){i&&s(a)}}}function Tt(F){let a;return{c(){a=te("commentrig.com/waitlist")},l(i){a=se(i,"commentrig.com/waitlist")},m(i,y){n(i,a,y)},d(i){i&&s(a)}}}function At(F){let a,i="Triming plaintext is fairly an easy algorithm to write, and we rely on it soo much more than we think. Doing the same for rich text however is a bit of a different kettle of fish, spaces are not whitespace but instead a <code><b/></code> or linebreaks to say.",y,u,m="No gainsaying the fact that we can’t always trust users to do the right thing, things which might seem obvious to you (since you’re the ones building it), are not so obvious to them. Even worse is that they will be thinking it’s not their fault, hence why we go out of our way to build features to guardrail this.",h,f,ze,C,Je,he,ne,k,ue,ae,T,fe,A,Qe="In this weeks under the hood series, I want to talk about this algorithm I came up with that helped me solve the problem, hopefully helping you in your needs as well, or helping me find fault in my solution.",Be,L,Ve="The idea.",ge,H,We="The idea is very simple, and it goes like this:",de,M,Xe="<li><p><strong>1.</strong> Create a variable to mark the top (i.e the point where text does not have any space above it)</p></li> <li><p><strong>2.</strong> Also create a list to store nodes that we’re removing (removables 😅).</p></li> <li><p><strong>3.</strong> Iterate through all the nodes.</p></li> <li><p><strong>4.</strong> If the text content of the current node (x) is empty:</p></li> <li><p><strong>5.</strong> Check if the next sibling (x+1) is also empty, if true, remove the current node (x) (add it to the removables)</p></li> <li><p><strong>6.</strong> Else if it is the last index, (meaning no next sibling), remove it (add it to the removables).</p></li> <li><p><strong>7.</strong> Else if the next sibling is not empty, since the current index (x) is empty we will mark that as our top, but also mark it as a removable top. <strong><em>Top can only be set once.</em></strong></p></li> <li><p><strong>8.</strong> Else if the text content of the current node (x) is not empty: we mark it as our top, but a none removable top. <strong><em>Top can only be set once.</em></strong></p></li> <li><p><strong>9.</strong> After the iteration is complete, we loop over our list of removables, and remove corresponding elements from our original node. Also if our top is an element (removable top), we remove it as well, but if the set to True (non removable top) we leave it alone.</p></li>",we,P,Ze="You can already tell it interesting, or you can spend some time to think it over to fully understand it. But my breakdown goes like this:",ve,I,et="Breakdown",xe,S,tt="The first part of the algorithm, <code>Create a variable to mark the top</code>. The reason for this variable, is solely to remove the extra space that will be present at the top of the content, as the check will not remove anything that the next sibling is a text content. I will also explain why is that.",_e,N,st="<strong>Moving forward</strong> is to create a list to store the nodes we’re going to be removing. This solves a fundamental problem, because if we remove directly from our node while iterating, it reduces our iteration count. Hence the list. Otherwise we might as well get rid of the top variable we’re creating, because we can always check with <code>node.firstChildElement</code>.",be,q,nt="<strong>Next</strong> we’re checking if the text content is empty, this should be it if not that, we don’t want all spaces/linebreak in between paragraphs should be gone as well. At lease we will respect the intention to leave a space between paragraphs, but not excess. Hence why we’re checking the next sibling is a space as well, otherwise, it should be the only space that remains.",$e,oe,O,Ce,j,at="<strong>Inside of the same condition</strong> <code>text content of the current node (x) is empty</code> we’re checking if it is the last index or not, because the last child does not have a nextSibling. but we already know that current node is empty, so we just add it to our list of removables.",De,le,R,Ee,z,ot="<strong>Still here</strong> <code>text content of the current node (x) is empty</code>, we want to find our top which will trigger if the nextSibling is not empty and <strong><em>if our top is not already set yet</em></strong> (very important line). But we know that the current node is empty, hence we set it as our top, but a removable one.",ke,pe,J,Te,U,lt="<strong>Moving our of this condition</strong> <code>text content of the current node (x) is empty</code>, which means that we’ve encountered an element the is not empty, then we set it as our top (<strong><em>if our top is not already set yet</em></strong>), but a non removable one, meaning we will just mark to as <code>True</code>",Ae,re,Y,Le,G,pt=`Once the iteration is done, we loop over our list of removables, and remove corresponding elements from our original node. Also if our top is an element (removable top), we remove it as well, but if the set to True (non removable top) we leave it alone (we can’t remove that anyways). Here is a rough illustration of how everything comes together:`,He,ie,K,Me,Q,rt="<p>Forgive my editing skills 😅.</p>",Pe,V,it="Code",Ie,_,ct=`<code><span class="line"><span style="color: #F97583">function</span><span style="color: #B392F0"> trimCommentContent(htmlString) {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">const</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">tempDiv</span><span style="color: #B392F0"> </span><span style="color: #F97583">=</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">document</span><span style="color: #B392F0">.createElement(</span><span style="color: #FFAB70">'div'</span><span style="color: #B392F0">);</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #79B8FF">tempDiv</span><span style="color: #B392F0">.innerHTML </span><span style="color: #F97583">=</span><span style="color: #B392F0"> htmlString;</span></span> <span class="line"></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">let</span><span style="color: #B392F0"> removeList </span><span style="color: #F97583">=</span><span style="color: #B392F0"> [];</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">let</span><span style="color: #B392F0"> emptyTagNames </span><span style="color: #F97583">=</span><span style="color: #B392F0"> [</span><span style="color: #FFAB70">'BR'</span><span style="color: #BBBBBB">,</span><span style="color: #B392F0"> </span><span style="color: #FFAB70">'STRONG'</span><span style="color: #BBBBBB">,</span><span style="color: #B392F0"> </span><span style="color: #FFAB70">'EM'</span><span style="color: #B392F0">];</span></span> <span class="line"></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">function</span><span style="color: #B392F0"> removeEmptyNodes(element) {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">let</span><span style="color: #B392F0"> elements </span><span style="color: #F97583">=</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">element</span><span style="color: #B392F0">.childNodes;</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">let</span><span style="color: #B392F0"> top </span><span style="color: #F97583">=</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">null</span><span style="color: #B392F0">;</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">for</span><span style="color: #B392F0"> (</span><span style="color: #F97583">let</span><span style="color: #B392F0"> index </span><span style="color: #F97583">=</span><span style="color: #B392F0"> </span><span style="color: #F8F8F8">0</span><span style="color: #B392F0">; index </span><span style="color: #F97583"><</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">elements</span><span style="color: #B392F0">.</span><span style="color: #79B8FF">length</span><span style="color: #B392F0">; index</span><span style="color: #F97583">++</span><span style="color: #B392F0">) {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">const</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">e</span><span style="color: #B392F0"> </span><span style="color: #F97583">=</span><span style="color: #B392F0"> elements[index];</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">if</span><span style="color: #B392F0"> (</span><span style="color: #79B8FF">e</span><span style="color: #B392F0">.</span><span style="color: #79B8FF">textContent</span><span style="color: #B392F0">.trim() </span><span style="color: #F97583">==</span><span style="color: #B392F0"> </span><span style="color: #FFAB70">''</span><span style="color: #B392F0">) {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">if</span><span style="color: #B392F0"> (</span><span style="color: #79B8FF">e</span><span style="color: #B392F0">.</span><span style="color: #79B8FF">firstChild</span><span style="color: #B392F0">.tagName </span><span style="color: #F97583">==</span><span style="color: #B392F0"> </span><span style="color: #FFAB70">'BR'</span><span style="color: #B392F0">) {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">if</span><span style="color: #B392F0"> (</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #79B8FF">e</span><span style="color: #B392F0">.</span><span style="color: #79B8FF">nextElementSibling</span><span style="color: #B392F0">?.</span><span style="color: #79B8FF">textContent</span><span style="color: #B392F0">.trim() </span><span style="color: #F97583">==</span><span style="color: #B392F0"> </span><span style="color: #FFAB70">''</span><span style="color: #B392F0"> </span><span style="color: #F97583">&&</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #79B8FF">emptyTagNames</span><span style="color: #B392F0">.some((t) </span><span style="color: #F97583">=></span><span style="color: #B392F0"> </span><span style="color: #79B8FF">e</span><span style="color: #B392F0">.</span><span style="color: #79B8FF">nextElementSibling</span><span style="color: #B392F0">?.</span><span style="color: #79B8FF">firstChild</span><span style="color: #B392F0">.tagName </span><span style="color: #F97583">==</span><span style="color: #B392F0"> t)</span></span> <span class="line"><span style="color: #B392F0"> ) {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #79B8FF">removeList</span><span style="color: #B392F0">.push(e);</span></span> <span class="line"><span style="color: #B392F0"> } </span><span style="color: #F97583">else</span><span style="color: #B392F0"> </span><span style="color: #F97583">if</span><span style="color: #B392F0"> (index </span><span style="color: #F97583">==</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">elements</span><span style="color: #B392F0">.</span><span style="color: #79B8FF">length</span><span style="color: #B392F0"> </span><span style="color: #F97583">-</span><span style="color: #B392F0"> </span><span style="color: #F8F8F8">1</span><span style="color: #B392F0">) {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #79B8FF">removeList</span><span style="color: #B392F0">.push(e);</span></span> <span class="line"><span style="color: #B392F0"> } </span><span style="color: #F97583">else</span><span style="color: #B392F0"> </span><span style="color: #F97583">if</span><span style="color: #B392F0"> (</span><span style="color: #F97583">!</span><span style="color: #B392F0">top) {</span></span> <span class="line"><span style="color: #B392F0"> top </span><span style="color: #F97583">=</span><span style="color: #B392F0"> e;</span></span> <span class="line"><span style="color: #B392F0"> }</span></span> <span class="line"><span style="color: #B392F0"> }</span></span> <span class="line"><span style="color: #B392F0"> } </span><span style="color: #F97583">else</span><span style="color: #B392F0"> {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">if</span><span style="color: #B392F0"> (</span><span style="color: #F97583">!</span><span style="color: #B392F0">top) {</span></span> <span class="line"><span style="color: #B392F0"> top </span><span style="color: #F97583">=</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">true</span><span style="color: #B392F0">;</span></span> <span class="line"><span style="color: #B392F0"> }</span></span> <span class="line"><span style="color: #B392F0"> }</span></span> <span class="line"><span style="color: #B392F0"> }</span></span> <span class="line"></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #79B8FF">removeList</span><span style="color: #B392F0">.forEach((element) </span><span style="color: #F97583">=></span><span style="color: #B392F0"> {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #79B8FF">tempDiv</span><span style="color: #B392F0">.removeChild(element);</span></span> <span class="line"><span style="color: #B392F0"> });</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">if</span><span style="color: #B392F0"> (top </span><span style="color: #F97583">&&</span><span style="color: #B392F0"> top </span><span style="color: #F97583">!==</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">true</span><span style="color: #B392F0">) {</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #79B8FF">tempDiv</span><span style="color: #B392F0">.removeChild(top);</span></span> <span class="line"><span style="color: #B392F0"> }</span></span> <span class="line"><span style="color: #B392F0"> removeList </span><span style="color: #F97583">=</span><span style="color: #B392F0"> [];</span></span> <span class="line"><span style="color: #B392F0"> }</span></span> <span class="line"></span> <span class="line"><span style="color: #B392F0"> removeEmptyNodes(tempDiv);</span></span> <span class="line"><span style="color: #B392F0"> </span><span style="color: #F97583">return</span><span style="color: #B392F0"> </span><span style="color: #79B8FF">tempDiv</span><span style="color: #B392F0">.innerHTML;</span></span> <span class="line"><span style="color: #B392F0">}</span></span></code>`,Se,W,mt=`You can further study the code to understand it better. I’m hoping for a feedback on potential flaws in my implementation, or even a better one. Super hoped you learned something new as I did.`,Ne,X,yt="<strong>Before you go:</strong>",qe,b,Ue,D,Ye,E,Oe,Z,Ft="<strong>Stay Super Awesome 🫶🏾.</strong>",je;return C=new Ge({props:{href:"https://www.commentrig.com",rel:"nofollow",$$slots:{default:[Et]},$$scope:{ctx:F}}}),k=new ee({props:{src:"https://paper-attachments.dropboxusercontent.com/s_7C51D412F35D5EE32D7FA12E66F1AB07F248DD0FB86E6C0AF80EC2DBF81A39DD_1721925070940_Screenshot+2024-07-25+at+12-47-22+Vite+React.png",alt:"Text in a comment box with excess line breaks"}}),T=new ee({props:{src:"https://paper-attachments.dropboxusercontent.com/s_7C51D412F35D5EE32D7FA12E66F1AB07F248DD0FB86E6C0AF80EC2DBF81A39DD_1721925082228_beforeafter.png",alt:"Trimmed and untrimmed version of the latter text"}}),O=new ee({props:{src:"https://paper-attachments.dropboxusercontent.com/s_7C51D412F35D5EE32D7FA12E66F1AB07F248DD0FB86E6C0AF80EC2DBF81A39DD_1721925122634_Some+Text.gif",alt:"Illustration showing removing spaces removing extra spaces/line breaks between text"}}),R=new ee({props:{src:"https://paper-attachments.dropboxusercontent.com/s_7C51D412F35D5EE32D7FA12E66F1AB07F248DD0FB86E6C0AF80EC2DBF81A39DD_1721925137363_Some+Text1.gif",alt:"a gif showing a logic to remove the extra space/linebreak in the last index"}}),J=new ee({props:{src:"https://paper-attachments.dropboxusercontent.com/s_7C51D412F35D5EE32D7FA12E66F1AB07F248DD0FB86E6C0AF80EC2DBF81A39DD_1721925151010_Untitled+design3.gif",alt:"A gif showing how the “top” of the node is determined if there is an extra space/linebreak that precedes it"}}),Y=new ee({props:{src:"https://paper-attachments.dropboxusercontent.com/s_7C51D412F35D5EE32D7FA12E66F1AB07F248DD0FB86E6C0AF80EC2DBF81A39DD_1721925166030_yaqeen.me.gif",alt:"A git showing how the top is determined if there is no extra space/linebreak preceding it"}}),K=new ee({props:{src:"https://paper-attachments.dropboxusercontent.com/s_7C51D412F35D5EE32D7FA12E66F1AB07F248DD0FB86E6C0AF80EC2DBF81A39DD_1721925179672_yaqeen.me2.gif",alt:"A step by step walk through showing the rich text trimming algorithm in action"}}),D=new Ge({props:{href:"https://www.commentrig.com",rel:"nofollow",$$slots:{default:[kt]},$$scope:{ctx:F}}}),E=new Ge({props:{href:"https://www.commentrig.com/waitlist",rel:"nofollow",$$slots:{default:[Tt]},$$scope:{ctx:F}}}),{c(){a=o("p"),a.innerHTML=i,y=p(),u=o("p"),u.textContent=m,h=p(),f=o("p"),ze=te("This is a problem i ran into building commentrig ("),B(C.$$.fragment),Je=te(") a one minute robust comment system integration into your website. I needed a way to trim out extra and unnecessary spaces/linebreaks outside and between paragraphs."),he=p(),ne=o("p"),B(k.$$.fragment),ue=p(),ae=o("p"),B(T.$$.fragment),fe=p(),A=o("p"),A.textContent=Qe,Be=p(),L=o("h2"),L.textContent=Ve,ge=p(),H=o("p"),H.textContent=We,de=p(),M=o("ol"),M.innerHTML=Xe,we=p(),P=o("p"),P.textContent=Ze,ve=p(),I=o("h2"),I.textContent=et,xe=p(),S=o("p"),S.innerHTML=tt,_e=p(),N=o("p"),N.innerHTML=st,be=p(),q=o("p"),q.innerHTML=nt,$e=p(),oe=o("p"),B(O.$$.fragment),Ce=p(),j=o("p"),j.innerHTML=at,De=p(),le=o("p"),B(R.$$.fragment),Ee=p(),z=o("p"),z.innerHTML=ot,ke=p(),pe=o("p"),B(J.$$.fragment),Te=p(),U=o("p"),U.innerHTML=lt,Ae=p(),re=o("p"),B(Y.$$.fragment),Le=p(),G=o("p"),G.textContent=pt,He=p(),ie=o("p"),B(K.$$.fragment),Me=p(),Q=o("blockquote"),Q.innerHTML=rt,Pe=p(),V=o("h2"),V.textContent=it,Ie=p(),_=o("pre"),_.innerHTML=ct,Se=p(),W=o("p"),W.textContent=mt,Ne=p(),X=o("p"),X.innerHTML=yt,qe=p(),b=o("p"),Ue=te("I’m building "),B(D.$$.fragment),Ye=te(`, a platform that allow you to integrate a robust comment system to your website. Offering a native package for all your favorite frameworks. Join the waitlist here: `),B(E.$$.fragment),Oe=p(),Z=o("p"),Z.innerHTML=Ft,this.h()},l(e){a=l(e,"P",{"data-svelte-h":!0}),c(a)!=="svelte-yk97w7"&&(a.innerHTML=i),y=r(e),u=l(e,"P",{"data-svelte-h":!0}),c(u)!=="svelte-twy7vz"&&(u.textContent=m),h=r(e),f=l(e,"P",{});var t=$(f);ze=se(t,"This is a problem i ran into building commentrig ("),g(C.$$.fragment,t),Je=se(t,") a one minute robust comment system integration into your website. I needed a way to trim out extra and unnecessary spaces/linebreaks outside and between paragraphs."),t.forEach(s),he=r(e),ne=l(e,"P",{});var ce=$(ne);g(k.$$.fragment,ce),ce.forEach(s),ue=r(e),ae=l(e,"P",{});var me=$(ae);g(T.$$.fragment,me),me.forEach(s),fe=r(e),A=l(e,"P",{"data-svelte-h":!0}),c(A)!=="svelte-s3241u"&&(A.textContent=Qe),Be=r(e),L=l(e,"H2",{"data-svelte-h":!0}),c(L)!=="svelte-1xwtlem"&&(L.textContent=Ve),ge=r(e),H=l(e,"P",{"data-svelte-h":!0}),c(H)!=="svelte-1wbcooh"&&(H.textContent=We),de=r(e),M=l(e,"OL",{"data-svelte-h":!0}),c(M)!=="svelte-xqcwtu"&&(M.innerHTML=Xe),we=r(e),P=l(e,"P",{"data-svelte-h":!0}),c(P)!=="svelte-49mp41"&&(P.textContent=Ze),ve=r(e),I=l(e,"H2",{"data-svelte-h":!0}),c(I)!=="svelte-vzyokj"&&(I.textContent=et),xe=r(e),S=l(e,"P",{"data-svelte-h":!0}),c(S)!=="svelte-1vtj1zq"&&(S.innerHTML=tt),_e=r(e),N=l(e,"P",{"data-svelte-h":!0}),c(N)!=="svelte-1cbtir"&&(N.innerHTML=st),be=r(e),q=l(e,"P",{"data-svelte-h":!0}),c(q)!=="svelte-1f3csw3"&&(q.innerHTML=nt),$e=r(e),oe=l(e,"P",{});var ye=$(oe);g(O.$$.fragment,ye),ye.forEach(s),Ce=r(e),j=l(e,"P",{"data-svelte-h":!0}),c(j)!=="svelte-vqk1qf"&&(j.innerHTML=at),De=r(e),le=l(e,"P",{});var ht=$(le);g(R.$$.fragment,ht),ht.forEach(s),Ee=r(e),z=l(e,"P",{"data-svelte-h":!0}),c(z)!=="svelte-togu7p"&&(z.innerHTML=ot),ke=r(e),pe=l(e,"P",{});var ut=$(pe);g(J.$$.fragment,ut),ut.forEach(s),Te=r(e),U=l(e,"P",{"data-svelte-h":!0}),c(U)!=="svelte-24a6z6"&&(U.innerHTML=lt),Ae=r(e),re=l(e,"P",{});var ft=$(re);g(Y.$$.fragment,ft),ft.forEach(s),Le=r(e),G=l(e,"P",{"data-svelte-h":!0}),c(G)!=="svelte-16yclgh"&&(G.textContent=pt),He=r(e),ie=l(e,"P",{});var Bt=$(ie);g(K.$$.fragment,Bt),Bt.forEach(s),Me=r(e),Q=l(e,"BLOCKQUOTE",{"data-svelte-h":!0}),c(Q)!=="svelte-heveel"&&(Q.innerHTML=rt),Pe=r(e),V=l(e,"H2",{"data-svelte-h":!0}),c(V)!=="svelte-vkxdrz"&&(V.textContent=it),Ie=r(e),_=l(e,"PRE",{class:!0,style:!0,tabindex:!0,"data-svelte-h":!0}),c(_)!=="svelte-1nfh8m8"&&(_.innerHTML=ct),Se=r(e),W=l(e,"P",{"data-svelte-h":!0}),c(W)!=="svelte-gz6jcp"&&(W.textContent=mt),Ne=r(e),X=l(e,"P",{"data-svelte-h":!0}),c(X)!=="svelte-r5kli1"&&(X.innerHTML=yt),qe=r(e),b=l(e,"P",{});var Fe=$(b);Ue=se(Fe,"I’m building "),g(D.$$.fragment,Fe),Ye=se(Fe,`, a platform that allow you to integrate a robust comment system to your website. Offering a native package for all your favorite frameworks. Join the waitlist here: `),g(E.$$.fragment,Fe),Fe.forEach(s),Oe=r(e),Z=l(e,"P",{"data-svelte-h":!0}),c(Z)!=="svelte-u38bym"&&(Z.innerHTML=Ft),this.h()},h(){dt(_,"class","shiki min-dark"),_t(_,"background-color","#1f1f1f"),dt(_,"tabindex","0")},m(e,t){n(e,a,t),n(e,y,t),n(e,u,t),n(e,h,t),n(e,f,t),Re(f,ze),d(C,f,null),Re(f,Je),n(e,he,t),n(e,ne,t),d(k,ne,null),n(e,ue,t),n(e,ae,t),d(T,ae,null),n(e,fe,t),n(e,A,t),n(e,Be,t),n(e,L,t),n(e,ge,t),n(e,H,t),n(e,de,t),n(e,M,t),n(e,we,t),n(e,P,t),n(e,ve,t),n(e,I,t),n(e,xe,t),n(e,S,t),n(e,_e,t),n(e,N,t),n(e,be,t),n(e,q,t),n(e,$e,t),n(e,oe,t),d(O,oe,null),n(e,Ce,t),n(e,j,t),n(e,De,t),n(e,le,t),d(R,le,null),n(e,Ee,t),n(e,z,t),n(e,ke,t),n(e,pe,t),d(J,pe,null),n(e,Te,t),n(e,U,t),n(e,Ae,t),n(e,re,t),d(Y,re,null),n(e,Le,t),n(e,G,t),n(e,He,t),n(e,ie,t),d(K,ie,null),n(e,Me,t),n(e,Q,t),n(e,Pe,t),n(e,V,t),n(e,Ie,t),n(e,_,t),n(e,Se,t),n(e,W,t),n(e,Ne,t),n(e,X,t),n(e,qe,t),n(e,b,t),Re(b,Ue),d(D,b,null),Re(b,Ye),d(E,b,null),n(e,Oe,t),n(e,Z,t),je=!0},p(e,t){const ce={};t&2&&(ce.$$scope={dirty:t,ctx:e}),C.$set(ce);const me={};t&2&&(me.$$scope={dirty:t,ctx:e}),D.$set(me);const ye={};t&2&&(ye.$$scope={dirty:t,ctx:e}),E.$set(ye)},i(e){je||(w(C.$$.fragment,e),w(k.$$.fragment,e),w(T.$$.fragment,e),w(O.$$.fragment,e),w(R.$$.fragment,e),w(J.$$.fragment,e),w(Y.$$.fragment,e),w(K.$$.fragment,e),w(D.$$.fragment,e),w(E.$$.fragment,e),je=!0)},o(e){v(C.$$.fragment,e),v(k.$$.fragment,e),v(T.$$.fragment,e),v(O.$$.fragment,e),v(R.$$.fragment,e),v(J.$$.fragment,e),v(Y.$$.fragment,e),v(K.$$.fragment,e),v(D.$$.fragment,e),v(E.$$.fragment,e),je=!1},d(e){e&&(s(a),s(y),s(u),s(h),s(f),s(he),s(ne),s(ue),s(ae),s(fe),s(A),s(Be),s(L),s(ge),s(H),s(de),s(M),s(we),s(P),s(ve),s(I),s(xe),s(S),s(_e),s(N),s(be),s(q),s($e),s(oe),s(Ce),s(j),s(De),s(le),s(Ee),s(z),s(ke),s(pe),s(Te),s(U),s(Ae),s(re),s(Le),s(G),s(He),s(ie),s(Me),s(Q),s(Pe),s(V),s(Ie),s(_),s(Se),s(W),s(Ne),s(X),s(qe),s(b),s(Oe),s(Z)),x(C),x(k),x(T),x(O),x(R),x(J),x(Y),x(K),x(D),x(E)}}}function Lt(F){let a,i;const y=[F[0],vt];let u={$$slots:{default:[At]},$$scope:{ctx:F}};for(let m=0;m<y.length;m+=1)u=Ke(u,y[m]);return a=new Dt({props:u}),{c(){B(a.$$.fragment)},l(m){g(a.$$.fragment,m)},m(m,h){d(a,m,h),i=!0},p(m,[h]){const f=h&1?Ct(y,[h&1&&wt(m[0]),h&0&&wt(vt)]):{};h&2&&(f.$$scope={dirty:h,ctx:m}),a.$set(f)},i(m){i||(w(a.$$.fragment,m),i=!0)},o(m){v(a.$$.fragment,m),i=!1},d(m){x(a,m)}}}const vt={title:" Rich Text Trimming Algorithm",description:"In this weeks Under The Hood, I want to talk about this algorithm I came up with that helped me solve the problem, hopefully helping you in your needs as well, or helping me find fault in my solution.",date:"2024-07-25",lastmod:"2024-07-25",categories:["algorithm","dsa","under the hood series"],label:"under the hood series",series:"uth",episode:5,layout:"series",published:!0};function Ht(F,a,i){return F.$$set=y=>{i(0,a=Ke(Ke({},a),gt(y)))},a=gt(a),[a]}class Ot extends bt{constructor(a){super(),$t(this,a,Ht,Lt,xt,{})}}export{Ot as default,vt as metadata};