1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1095],{21095:function(e,n,i){i.r(n),i.d(n,{default:function(){return z}});var t=i(2403),c=i(33583),a=i(5853),l=i(57437),s=i(46938),r=i(78302),o=i(54816),u=i(63676),d=i(78234),h=i(65318),g=i(5172),f=i(71190),x=i(2265),v=i(81328),m=i(19680),p=i(17494),j=i(18778),k=i(6387),b=i(84519),w=i(29747),C=i(79022),N=i(7586),Z=i(28645),A=i(74656),y=i(64935),L=i(31734),T=i(58310),H=i(17881),R=i(98335),U=i(53113),E=i(17689),M=i(75965),_=i(44353);function z(e){var n,i=e.content,z=e.onChange,B=(0,c._)((0,x.useState)(!1),2),I=B[0],P=B[1],q=(0,x.useRef)(null),S=(0,s.jE)({extensions:[r.Z.configure({heading:{levels:[1,2,3]}}),o.ZP.configure({openOnClick:!1,HTMLAttributes:{class:"text-purple-600 underline"}}),u.ZP.configure({HTMLAttributes:{class:"rounded-lg max-w-full mx-auto"}}),d.Z,h.Z.configure({types:["heading","paragraph"]}),g.Z.configure({placeholder:"Comece a escrever seu post..."}),f.ZP.configure({multicolor:!1})],content:i,onUpdate:function(e){z(e.editor.getHTML())},editorProps:{attributes:{class:"prose prose-sm sm:prose max-w-none focus:outline-none min-h-[300px] px-4 py-3"}}}),D=(0,x.useCallback)(function(){if(S){var e=S.getAttributes("link").href,n=window.prompt("URL do link:",e);if(null!==n){if(""===n){S.chain().focus().extendMarkRange("link").unsetLink().run();return}S.chain().focus().extendMarkRange("link").setLink({href:n}).run()}}},[S]),O=(0,x.useCallback)(function(){if(S){var e=window.prompt("URL da imagem:");e&&S.chain().focus().setImage({src:e}).run()}},[S]),F=(0,x.useCallback)((n=(0,t._)(function(e){var n,i,t;return(0,a.Jh)(this,function(c){switch(c.label){case 0:if(!S)return[2];P(!0),c.label=1;case 1:return c.trys.push([1,6,7,8]),(n=new FormData).append("file",e),[4,fetch("/api/mandaclass/admin/blog/upload",{method:"POST",body:n})];case 2:if(!(i=c.sent()).ok)return[3,4];return[4,i.json()];case 3:return t=c.sent(),S.chain().focus().setImage({src:t.url}).run(),[3,5];case 4:alert("Erro ao fazer upload da imagem"),c.label=5;case 5:return[3,8];case 6:return c.sent(),alert("Erro ao fazer upload"),[3,8];case 7:return P(!1),[7];case 8:return[2]}})}),function(e){return n.apply(this,arguments)}),[S]),J=(0,x.useCallback)(function(e){var n,i=null===(n=e.target.files)||void 0===n?void 0:n[0];i&&F(i),e.target.value=""},[F]);if(!S)return null;var G=function(e){var n=e.onClick,i=e.active,t=e.disabled,c=e.children,a=e.title;return(0,l.jsx)("button",{type:"button",onClick:n,disabled:t,title:a,className:"p-1.5 rounded transition-colors ".concat(i?"bg-purple-100 text-purple-700":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"," ").concat(t?"opacity-40 cursor-not-allowed":""),children:c})};return(0,l.jsxs)("div",{className:"border border-gray-300 rounded-lg overflow-hidden",children:[(0,l.jsxs)("div",{className:"bg-gray-50 border-b border-gray-200 px-2 py-1.5 flex flex-wrap items-center gap-0.5",children:[(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleBold().run()},active:S.isActive("bold"),title:"Negrito",children:(0,l.jsx)(v.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleItalic().run()},active:S.isActive("italic"),title:"It\xe1lico",children:(0,l.jsx)(m.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleUnderline().run()},active:S.isActive("underline"),title:"Sublinhado",children:(0,l.jsx)(p.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleStrike().run()},active:S.isActive("strike"),title:"Tachado",children:(0,l.jsx)(j.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleHighlight().run()},active:S.isActive("highlight"),title:"Destaque",children:(0,l.jsx)(k.Z,{className:"h-4 w-4"})}),(0,l.jsx)("div",{className:"w-px h-5 bg-gray-300 mx-1"}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleHeading({level:1}).run()},active:S.isActive("heading",{level:1}),title:"T\xedtulo 1",children:(0,l.jsx)(b.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleHeading({level:2}).run()},active:S.isActive("heading",{level:2}),title:"T\xedtulo 2",children:(0,l.jsx)(w.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleHeading({level:3}).run()},active:S.isActive("heading",{level:3}),title:"T\xedtulo 3",children:(0,l.jsx)(C.Z,{className:"h-4 w-4"})}),(0,l.jsx)("div",{className:"w-px h-5 bg-gray-300 mx-1"}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleBulletList().run()},active:S.isActive("bulletList"),title:"Lista",children:(0,l.jsx)(N.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleOrderedList().run()},active:S.isActive("orderedList"),title:"Lista numerada",children:(0,l.jsx)(Z.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleBlockquote().run()},active:S.isActive("blockquote"),title:"Cita\xe7\xe3o",children:(0,l.jsx)(A.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().toggleCodeBlock().run()},active:S.isActive("codeBlock"),title:"C\xf3digo",children:(0,l.jsx)(y.Z,{className:"h-4 w-4"})}),(0,l.jsx)("div",{className:"w-px h-5 bg-gray-300 mx-1"}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().setTextAlign("left").run()},active:S.isActive({textAlign:"left"}),title:"Alinhar esquerda",children:(0,l.jsx)(L.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().setTextAlign("center").run()},active:S.isActive({textAlign:"center"}),title:"Centralizar",children:(0,l.jsx)(T.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().setTextAlign("right").run()},active:S.isActive({textAlign:"right"}),title:"Alinhar direita",children:(0,l.jsx)(H.Z,{className:"h-4 w-4"})}),(0,l.jsx)("div",{className:"w-px h-5 bg-gray-300 mx-1"}),(0,l.jsx)(G,{onClick:D,active:S.isActive("link"),title:"Link",children:(0,l.jsx)(R.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:O,title:"Imagem por URL",children:(0,l.jsx)(U.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){var e;return null===(e=q.current)||void 0===e?void 0:e.click()},disabled:I,title:"Upload de imagem",children:(0,l.jsx)(E.Z,{className:"h-4 w-4"})}),(0,l.jsx)("div",{className:"w-px h-5 bg-gray-300 mx-1"}
1),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().undo().run()},disabled:!S.can().undo(),title:"Desfazer",children:(0,l.jsx)(M.Z,{className:"h-4 w-4"})}),(0,l.jsx)(G,{onClick:function(){return S.chain().focus().redo().run()},disabled:!S.can().redo(),title:"Refazer",children:(0,l.jsx)(_.Z,{className:"h-4 w-4"})}),I&&(0,l.jsx)("span",{className:"text-xs text-purple-600 ml-2",children:"Enviando imagem..."})]}),(0,l.jsx)(s.kg,{editor:S}),(0,l.jsx)("input",{ref:q,type:"file",accept:"image/*",className:"hidden",onChange:J})]})}},17689:function(e,n,i){i.d(n,{Z:function(){return t}});var t=(0,i(39763).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])}}]);
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.