(this["webpackJsonpreact-typescript"]=this["webpackJsonpreact-typescript"]||[]).push([[0],{61:function(t,e,n){"use strict";n.r(e);var a=n(4),r=n(31),s=n(10),c=n(5),o=n(8),i=n(32),d=n(21);function l(t,e,n,a,r,s){var c,o,i,d;0!=a&&r!==t[n].text.length?(c=t[e].text.substring(0,a),o=t[n].text.substring(r,t[n].text.length),d={text:c,annotated:t[e].annotated},i={text:o,annotated:t[n].annotated},e==n?t[e].text=t[e].text.substring(a,r):(t[e].text=t[e].text.substring(a,t[e].text.length),t[n].text=t[n].text.substring(0,r)),t.splice(e,0,d),t.splice(n+2,0,i),e+=1,n+=2):0==a&&r!=t[n].text.length?(i={text:o=t[n].text.substring(r,t[n].text.length),annotated:t[n].annotated},t[n].text=t[n].text.substring(0,r),t.splice(n+1,0,i),n+=1):r==t[n].text.length&&0!=a?(console.log("is end"),d={text:c=t[e].text.substring(0,a),annotated:t[e].annotated},t[e].text=t[e].text.substring(a,t[e].text.length),t.splice(e,0,d),e+=1,n+=2):(n+=1,console.log("Not handled now...")),t[e].annotated=s,n>e&&(t[n-1].annotated=s);for(var l=t[e].text,u=e+1;u<n;u++)l=l.concat(t[u].text);return t.splice(e,n-e),t.splice(e,0,{text:l,annotated:s}),console.log("Data value :",t),t}var u=n(11),b={42:"#ebde34",0:"transparent",1:"#80B900",2:"#0080B9",3:"#FF0000"};var x=function(t){return Object(u.jsx)("span",{style:{backgroundColor:b[t.score],borderRadius:"0.3rem",padding:"0.2rem"},children:t.text})},j=n(75),p=n(73),f=n(74),g=(n(59),function(t){return t.match(/span\[(\d+)\]/)[1]-1});var O=Object(d.b)((function(t){var e=Object(a.useState)(t.args.data),n=Object(o.a)(e,2),r=n[0],b=n[1],O=Object(j.a)(),h=Object(o.a)(O,2),m=h[0],v=h[1],S=Object(a.useState)({x:0,y:0}),C=Object(o.a)(S,2),y=C[0],k=C[1],E=Object(a.useState)({startSpan:0,endSpan:0,start:0,end:0}),w=Object(o.a)(E,2),B=w[0],F=w[1],R=function(t){var e=function(){var e,n=document.getSelection();if(n&&""!==n.toString()){var a=n.getRangeAt(0),r=document.getElementById("root"),s=null;if(r&&(s=Object(i.fromRange)(a,r)),s)try{var c=function(t){var e=t.startOffset,n=t.endOffset,a=t.start;a=a.replace(/\(|\)/g,"");var r=t.end;return{startOffset:e,endOffset:n,startContainer:a,endContainer:r=r.replace(/\(|\)/g,"")}}(s),o=c.startOffset,d=c.endOffset,l=c.startContainer,u=c.endContainer;e={start:o,end:d,startSpan:g(l),endSpan:g(u)}}catch(t){console.error("User highlight failed.")}}return e}();e&&(k({x:t.pageX,y:t.pageY}),v(!0),F(e))};return Object(a.useEffect)((function(){d.a.setFrameHeight(1e3)})),Object(a.useEffect)((function(){return document.addEventListener("mouseup",R),function(){document.removeEventListener("mouseup",R)}}),[]),Object(u.jsxs)(u.Fragment,{children:[r&&Object(u.jsx)("p",{className:"Paragraph",children:r.map((function(t,e){return Object(u.jsx)(x,{text:t.text,score:t.annotated},e)}))}),Object(u.jsxs)(p.a,Object(s.a)(Object(s.a)({},m),{},{anchorPoint:y,onClose:function(){return v(!1)},children:[Object(u.jsx)(f.a,{onClick:function(t){b(Object(c.a)(l(r,B.startSpan,B.endSpan,B.start,B.end,0))),d.a.setComponentValue(r)},children:"lvl 0"}),Object(u.jsx)(f.a,{onClick:function(t){b(Object(c.a)(l(r,B.startSpan,B.endSpan,B.start,B.end,1))),d.a.setComponentValue(r)},children:"lvl 1"}),Object(u.jsx)(f.a,{onClick:function(t){b(Object(c.a)(l(r,B.startSpan,B.endSpan,B.start,B.end,2))),d.a.setComponentValue(r)},children:"lvl 2"}),Object(u.jsx)(f.a,{onClick:function(t){b(Object(c.a)(l(r,B.startSpan,B.endSpan,B.start,B.end,3))),d.a.setComponentValue(r)},children:"lvl 3"})]}))]})})),h=n(72),m=n(35),v=n(71),S=n(62),C=new h.a,y=document.getElementById("root");r.createRoot(y).render(Object(u.jsx)(a.StrictMode,{children:Object(u.jsx)(m.a,{value:C,children:Object(u.jsx)(v.a,{theme:S.a,children:Object(u.jsx)(O,{})})})}))}},[[61,1,2]]]);
//# sourceMappingURL=main.24fde773.chunk.js.map