1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[35715],{26699:(e,r,t)=>{Promise.resolve().then(t.bind(t,90519))},40980:(e,r,t)=>{"use strict";t.d(r,{Y:()=>n,cn:()=>i,o:()=>l});var s=t(29722),a=t(622);function i(...e){return(0,a.QP)((0,s.$)(e))}function n(e){return e?e.toString().toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\s_]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,""):`artigo-sem-titulo-${Date.now()}`}function l(e){return e&&"string"==typeof e?e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]/g,""):""}},45160:(e,r,t)=>{"use strict";t.d(r,{E:()=>l});var s=t(95155);t(12115);var a=t(18460),i=t(40980);let n=(0,a.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function l({className:e,variant:r,...t}){return(0,s.jsx)("span",{className:(0,i.cn)(n({variant:r}),e),...t})}},81477:(e,r,t)=>{"use strict";t.d(r,{BT:()=>d,Wu:()=>c,ZB:()=>o,Zp:()=>n,aR:()=>l});var s=t(95155),a=t(12115),i=t(40980);let n=a.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...r}));n.displayName="Card";let l=a.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",e),...r}));l.displayName="CardHeader";let o=a.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",e),...r}));o.displayName="CardTitle";let d=a.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",e),...r}));d.displayName="CardDescription";let c=a.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,i.cn)("p-6 pt-0",e),...r}));c.displayName="CardContent",a.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,i.cn)("flex items-center p-6 pt-0",e),...r})).displayName="CardFooter"},89239:(e,r,t)=>{"use strict";t.d(r,{$:()=>d,r:()=>o});var s=t(95155),a=t(12115),i=t(42442),n=t(18460),l=t(40980);let o=(0,n.F)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=a.forwardRef(({className:e,variant:r,size:t,asChild:a=!1,...n},d)=>{let c=a?i.DX:"button";return(0,s.jsx)(c,{className:(0,l.cn)(o({variant:r,size:t,className:e})),ref:d,...n})});d.displayName="Button"},90519:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>C});var s=t(95155),a=t(12115),i=t(73321),n=t(81477),l=t(89239),o=t(45160),d=t(80723),c=t(52484),u=t(13545),m=t(20232),x=t(19835),h=t(36201),g=t(68459),f=t(69220),p=t(9199),b=t(22651),w=t(21628),y=t(17243),v=t(30125),j=t(55243),N=t(66609);let k={text:{fill:"rgba(59, 130, 246, 0.25)",border:"rgb(59, 130, 246)"},image:{fill:"rgba(16, 185, 129, 0.25)",border:"rgb(16, 185, 129)"},ad:{fill:"rgba(245, 158, 11, 0.25)",border:"rgb(245, 158, 11)"},title:{fill:"rgba(168, 85, 247, 0.25)",border:"rgb(168, 85, 247)"},caption:{fill:"rgba(236, 72, 153, 0.25)",border:"rgb(236, 72, 153)"},header:{fill:"rgba(107, 114, 128, 0.25)",border:"rgb(107, 114, 128)"},footer:{fill:"rgba(107, 114, 128, 0.25)",border:"rgb(107, 114, 128)"},page_number:{fill:"rgba(156, 163, 175, 0.25)",border:"rgb(156, 163, 175)"},ignore:{fill:"rgba(239, 68, 68, 0.25)",border:"rgb(239, 68, 68)"}};function C(){let e,r=(0,i.useParams)(),t=(0,i.useRouter)(),C=r.workflowId,[B,R]=(0,a.useState)([]),[M,S]=(0,a.useState)(0),[z,$]=(0,a.useState)(!0),[E,P]=(0,a.useState)(!1),[A,Z]=(0,a.useState)(1),[T,_]=(0,a.useState)("select"),[F,I]=(0,a.useState)("image"),[O,W]=(0,a.useState)(null),[D,L]=(0,a.useState)(!1),[U,X]=(0,a.useState)(null),[Y,V]=(0,a.useState)(!1),[H,J]=(0,a.useState)(null),[Q,q]=(0,a.useState)(null),[G,K]=(0,a.useState)("default"),ee=(0,a.useRef)(null),er=(0,a.useRef)(null),[et,es]=(0,a.useState)(null);(0,a.useEffect)(()=>{!async function(){try{let e=await fetch(`/api/magazines/workflow/${C}/pages`);if(e.ok){let r=await e.json();R(r.pages||[]);let t=r.pages.findIndex(e=>"pending"===e.reviewStatus);t>=0&&S(t)}}catch(e){console.error("Erro ao carregar p\xe1ginas:",e),N.oR.error("Erro ao carregar p\xe1ginas")}finally{$(!1)}}()},[C]);let ea=B[M],ei=ea?.confirmedZones||ea?.detectedZones||[];(0,a.useEffect)(()=>
1{if(!O||!ea?.imageUrl)return void es(null);let e=ei.find(e=>e.id===O);if(!e||"image"!==e.type)return void es(null);let r=new Image;r.crossOrigin="anonymous",r.onload=()=>{let t=document.createElement("canvas"),s=t.getContext("2d");if(!s)return;let a=e.boundingBox.x/100*r.width,i=e.boundingBox.y/100*r.height,n=e.boundingBox.width/100*r.width,l=e.boundingBox.height/100*r.height;t.width=n,t.height=l,s.drawImage(r,a,i,n,l,0,0,n,l),es(t.toDataURL("image/jpeg",.9))},r.onerror=()=>{es(null)},r.src=ea.imageUrl},[O,ea?.imageUrl,ei]);let en=(0,a.useCallback)(()=>{let e=ee.current,r=er.current;if(!e||!r||!ea)return;let t=e.getContext("2d");if(!t)return;t.clearRect(0,0,e.width,e.height),t.drawImage(r,0,0,e.width,e.height);let s=e.originalWidth||e.width,a=e.originalHeight||e.height,i=e.scale||1;for(let e of ei){let r=k[e.type]||k.text,n=e.boundingBox.x/100*s*i,l=e.boundingBox.y/100*a*i,o=e.boundingBox.width/100*s*i,d=e.boundingBox.height/100*a*i;t.fillStyle=r.fill,t.fillRect(n,l,o,d),t.strokeStyle=e.id===O?"#000":r.border,t.lineWidth=e.id===O?3:2,t.strokeRect(n,l,o,d),t.fillStyle=r.border,t.font="bold 12px sans-serif",t.fillText(e.type.toUpperCase(),n+4,l+14),e.label&&(t.font="10px sans-serif",t.fillText(e.label.substring(0,30),n+4,l+26)),e.id===O&&[{x:n,y:l,type:"nw"},{x:n+o/2,y:l,type:"n"},{x:n+o,y:l,type:"ne"},{x:n+o,y:l+d/2,type:"e"},{x:n+o,y:l+d,type:"se"},{x:n+o/2,y:l+d,type:"s"},{x:n,y:l+d,type:"sw"},{x:n,y:l+d/2,type:"w"}].forEach(e=>{t.fillStyle="#fff",t.strokeStyle=r.border,t.lineWidth=2,t.fillRect(e.x-4,e.y-4,8,8),t.strokeRect(e.x-4,e.y-4,8,8)})}},[ea,ei,O]);(0,a.useEffect)(()=>{if(!ea?.imageUrl)return;let e=new Image;e.crossOrigin="anonymous",e.onload=()=>{er.current=e;let r=ee.current;if(r){let t=Math.min(1200/e.width,1);r.width=e.width*t,r.height=e.height*t,r.scale=t,r.originalWidth=e.width,r.originalHeight=e.height}en()},e.src=ea.imageUrl},[ea?.imageUrl]),(0,a.useEffect)(()=>{en()},[en,A]);let el=(e,r,t,s)=>{let a=s.originalWidth||s.width,i=s.originalHeight||s.height,n=s.scale||1,l=t.boundingBox.x/100*a*n,o=t.boundingBox.y/100*i*n,d=t.boundingBox.width/100*a*n,c=t.boundingBox.height/100*i*n;for(let t of[{x:l,y:o,type:"nw"},{x:l+d/2,y:o,type:"n"},{x:l+d,y:o,type:"ne"},{x:l+d,y:o+c/2,type:"e"},{x:l+d,y:o+c,type:"se"},{x:l+d/2,y:o+c,type:"s"},{x:l,y:o+c,type:"sw"},{x:l,y:o+c/2,type:"w"}]){let s=e-t.x,a=r-t.y;if(4>=Math.abs(s)&&4>=Math.abs(a))return t.type}return null};(0,a.useEffect)(()=>{if(!D&&!H)return;let e=(e,r)=>{let t=ee.current;if(!t)return null;let s=t.getBoundingClientRect();return{x:(e-s.left)/s.width*100,y:(r-s.top)/s.height*100}},r=r=>{if(!H||!Q)return;let t=e(r.clientX,r.clientY);if(!t)return;let{zone:s,x:a,y:i}=Q,n=t.x-a,l=t.y-i,o={...s.boundingBox};H.includes("n")&&(o.y=Math.max(0,s.boundingBox.y+l),o.height=Math.max(5,s.boundingBox.height-l)),H.includes("s")&&(o.height=Math.max(5,s.boundingBox.height+l)),H.includes("w")&&(o.x=Math.max(0,s.boundingBox.x+n),o.width=Math.max(5,s.boundingBox.width-n)),H.includes("e")&&(o.width=Math.max(5,s.boundingBox.width+n)),o.x+o.width>100&&(o.width=100-o.x),o.y+o.height>100&&(o.height=100-o.y),o.x=Math.min(Math.max(o.x,0),100),o.y=Math.min(Math.max(o.y,0),100),eo(ei.map(e=>e.id===s.id?{...e,boundingBox:o,userCorrected:!0,originalBoundingBox:e.originalBoundingBox||e.boundingBox}:e)),q({x:t.x,y:t.y,zone:{...s,boundingBox:o}})},t=r=>{if(H){J(null),q(null);return}if(!D||!U)return;let t=e(r.clientX,r.clientY),s=t?Math.min(Math.max(t.x,0),100):U.x,a=t?Math.min(Math.max(t.y,0),100):U.y,i={id:`zone_${Date.now()}`,type:F,boundingBox:{x:Math.min(U.x,s),y:Math.min(U.y,a),width:Math.abs(s-U.x),height:Math.abs(a-U.y)},confidence:1,userCorrected:!0};i.boundingBox.width>2&&i.boundingBox.height>2&&(eo([...ei,i]),W(i.id)),L(!1),X(null)};return window.addEventListener("mousemove",r),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",t)}},[D,H,Q,U,ei,F]);let eo=e=>{R(r=>r.map((r,t)=>t===M?{...r,confirmedZones:e}:r)),V(!0)},ed=async()=>{if(ea){P(!0);try{let e=await fetch(`/api/magazines/workflow/${C}/pages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pageNumber:ea.pageNumber,confirmedZones:ei.map(e=>({...e,userCorrected:e.userCorrected||!1}))})});if(!e.ok){let r=await e.json();throw Error(r.error||"Erro ao salvar")}let r=await e.json();N.oR.success(`P\xe1gina ${ea.pageNumber} salva! ${r.correctionsRecorded} corre\xe7\xf5es registradas.`),R(e=>e.map((e,r)=>r===M?{...e,reviewStatus:"reviewed"}:e)),V(!1);let t=B.findIndex((e,r)=>r>M&&"pending"===e.reviewStatus);t>=0&&S(t)}catch(e){N.oR.error(e.message)}finally{P(!1)}}};if(z)return(0,s.jsx)("div",{className:"container mx-auto p-6 flex items-center justify-center h-96",children:(0,s.jsx)("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent roun
1ded-full"})});let ec=B.filter(e=>"reviewed"===e.reviewStatus).length,eu=ec/B.length*100;return(0,s.jsxs)("div",{className:"container mx-auto p-6 max-w-7xl",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)(l.$,{variant:"ghost",onClick:()=>t.back(),children:[(0,s.jsx)(d.A,{className:"w-4 h-4 mr-2"}),"Voltar"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold",children:"Revis\xe3o de Zonas"}),(0,s.jsxs)("p",{className:"text-muted-foreground",children:[ec," de ",B.length," p\xe1ginas revisadas (",Math.round(eu),"%)"]})]})]}),(0,s.jsx)(o.E,{variant:Y?"destructive":"secondary",children:Y?"Altera\xe7\xf5es n\xe3o salvas":"Salvo"})]}),ec>0&&B.length>0&&(0,s.jsxs)("div",{className:`mb-6 p-4 border rounded-lg flex items-center justify-between ${ec===B.length?"bg-green-50 border-green-200":"bg-yellow-50 border-yellow-200"}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[ec===B.length?(0,s.jsx)(c.A,{className:"w-6 h-6 text-green-600"}):(0,s.jsx)(u.A,{className:"w-6 h-6 text-yellow-600"}),(0,s.jsx)("div",{children:ec===B.length?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"font-medium text-green-900",children:"Todas as p\xe1ginas foram revisadas!"}),(0,s.jsx)("p",{className:"text-sm text-green-700",children:"Voc\xea pode iniciar o processamento agora."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"font-medium text-yellow-900",children:"Processamento parcial dispon\xedvel"}),(0,s.jsxs)("p",{className:"text-sm text-yellow-700",children:[ec," de ",B.length," p\xe1ginas revisadas. Voc\xea pode processar apenas as p\xe1ginas revisadas."]})]})})]}),(0,s.jsxs)(l.$,{onClick:async()=>{try{let e=await fetch(`/api/magazines/workflow/${C}/process`,{method:"POST"});if(!e.ok){let r=await e.json();throw Error(r.error||"Erro ao iniciar processamento")}let r=await e.json();N.oR.success(r.message||"Processamento iniciado! Redirecionando..."),setTimeout(()=>{t.push("/admin/magazine-workflow")},1500)}catch(e){N.oR.error(e.message)}},children:[(0,s.jsx)(m.A,{className:"w-4 h-4 mr-2"}),ec===B.length?"Iniciar Processamento":`Processar ${ec} P\xe1ginas`]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-[300px_1fr] gap-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)(n.Zp,{children:[(0,s.jsx)(n.aR,{className:"pb-3",children:(0,s.jsx)(n.ZB,{className:"text-lg",children:"Ferramentas"})}),(0,s.jsxs)(n.Wu,{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Modo"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(l.$,{size:"sm",variant:"select"===T?"default":"outline",onClick:()=>_("select"),children:[(0,s.jsx)(x.A,{className:"w-4 h-4 mr-1"}),"Selecionar"]}),(0,s.jsxs)(l.$,{size:"sm",variant:"draw"===T?"default":"outline",onClick:()=>_("draw"),children:[(0,s.jsx)(h.A,{className:"w-4 h-4 mr-1"}),"Desenhar"]})]})]}),"draw"===T&&(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Tipo de Zona"}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-1",children:["text","image","ad","title","caption","header","footer","ignore"].map(e=>(0,s.jsx)(l.$,{size:"sm",variant:F===e?"default":"outline",onClick:()=>I(e),className:"justify-start text-xs",style:{borderColor:k[e].border,backgroundColor:F===e?k[e].border:void 0},children:e.replace("_"," ")},e))})]}),et&&O&&((e=ei.find(e=>e.id===O))&&"image"===e.type?(0,s.jsxs)(n.Zp,{className:"border-t pt-4",children:[(0,s.jsx)(n.aR,{className:"pb-2",children:(0,s.jsx)(n.ZB,{className:"text-sm",children:"Preview do Recorte"})}),(0,s.jsxs)(n.Wu,{children:[(0,s.jsx)("div",{className:"border rounded-lg overflow-hidden bg-gray-50",children:(0,s.jsx)("img",{src:et,alt:"Preview do recorte",className:"w-full h-auto"})}),(0,s.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground text-center",children:[Math.round(e.boundingBox.width),"% \xd7 ",Math.round(e.boundingBox.height),"%"]})]})]}):null),O&&(0,s.jsxs)("div",{className:"border-t pt-4",children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Zona Selecionada"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(()=>{let e=ei.find(e=>e.id===O);if(!e)return null;let r=k[e.type];return(0,s.jsxs)("div",{className:"mb-3 p-2 rounded border",style:{borderColor:r.border,backgroundColor:r.fill},children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Tipo atual:"}),(0,s.jsx)(o.E,{style:{backgroundColor:r.border,color:"white"},className:"capitalize",children:e.type.replace("_"," ")})]})})(),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{className:"text-xs text-muted-foreground",children:"Alterar para:"}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-1",children:["text","image","ad","title","caption","header","footer","ignore"].map(e=>{let r=ei.find(e=>e.id===O),t=r?.type===e;return(0,s.jsx)(l.$,{size:"sm",variant:t?"default":"outline",onClick:()=>{O&&eo(ei.map(r=>r.id===O?{...r,type:e,userCorrected:!0,originalType:r.originalType||r.type}:r))},className:"text-xs justify-start",style:t?{backgroundColor:k[e].border,borderColor:k[e].border}:{borderColor:k[e].border},children:e.replace("_"," ")},e)})})]}),(0,s.jsxs)(l.$,{size:"sm",variant:"destructive",className:"w-full mt-2",onClick:()=>{O&&(eo(ei.filter(e=>e.id!==O)),W(null))},children:[(0,s.jsx)(g.A,{className:"w-4 h-4 mr-1"}),"Excluir Zona"]})]})]}),(0,s.jsxs)("div",{className:"border-t pt-4",children:[(0,s.jsxs)("label",{className:"text-sm font-medium mb-2 block",children:["Zoom: ",Math.round(100*A),"%"]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>Z(e=>Math.max(.5,e-.1)),children:(0,s.jsx)(f.A,{className:"w-4 h-4"})}),(0,s.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>Z(1),children:(0,s.jsx)(p.A,{className:"w-4 h-4"})}),(0,s.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>Z(e=>Math.min(2,e+.1)),children:(0,s.jsx)(b.A,{className:"w-4 h-4"})})]})]})]})]}),(0,s.jsxs)(n.Zp,{children:[(0,s.jsx)(n.aR,{className:"pb-3",children:(0,s.jsx)(n.ZB,{className:"text-lg",children:"Legenda"})}),(0,s.jsx)(n.Wu,{className:"space-y-1",children:Object.entries(k).map(([e,r])=>(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)("div",{className:"w-4 h-4 rounded",style:{backgroundColor:r.fill,border:`2px solid ${r.border}`}}),(0,s.jsx)("span",{className:"capitalize",children:e.replace("_"," ")})]},e))})]})]}),(0,s.jsxs)(n.Zp,{children:[(0,s.jsx)(n.aR,{className:"pb-3",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(l.$,{variant:"outline",size:"sm",onClick:()=>S(e=>Math.max(0,e-1)),disabled:0===M,children:(0,s.jsx)(d.A,{className:"w-4 h-4"})}),(0,s.jsxs)(n.ZB,{children:["P\xe1gina ",ea?.pageNumber," de ",B.length,ea?.reviewStatus==="reviewed"&&(0,s.jsxs)(o.E,{variant:"secondary",className:"ml-2",children:[(0,s.jsx)(c.A,{className:"w-3 h-3 mr-1"}),"Revisada"]}
1)]}),(0,s.jsx)(l.$,{variant:"outline",size:"sm",onClick:()=>S(e=>Math.min(B.length-1,e+1)),disabled:M===B.length-1,children:(0,s.jsx)(w.A,{className:"w-4 h-4"})})]}),(0,s.jsxs)("div",{className:"text-sm text-muted-foreground",children:[ei.length," zonas detectadas"]})]})}),(0,s.jsx)(n.Wu,{children:(0,s.jsx)("div",{className:"overflow-auto border rounded-lg bg-gray-100",style:{maxHeight:"70vh"},children:ea?.imageUrl?(0,s.jsx)("canvas",{ref:ee,onClick:e=>{let r=ee.current;if(!r||"select"!==T||H)return;let t=r.getBoundingClientRect(),s=(e.clientX-t.left)/t.width*100,a=(e.clientY-t.top)/t.height*100;if(O){let s=ei.find(e=>e.id===O);if(s&&el(e.clientX-t.left,e.clientY-t.top,s,r))return}let i=ei.find(e=>s>=e.boundingBox.x&&s<=e.boundingBox.x+e.boundingBox.width&&a>=e.boundingBox.y&&a<=e.boundingBox.y+e.boundingBox.height);W(i?.id||null)},onMouseDown:e=>{let r=ee.current;if(!r)return;let t=r.getBoundingClientRect(),s=e.clientX-t.left,a=e.clientY-t.top,i=s/t.width*100,n=a/t.height*100;if("select"===T&&O){let e=ei.find(e=>e.id===O);if(e){let t=el(s,a,e,r);if(t){J(t),q({x:i,y:n,zone:e});return}}}"draw"===T&&(L(!0),X({x:i,y:n}))},onMouseMove:e=>{if(D||H)return;let r=ee.current;if(!r)return;let t=r.getBoundingClientRect(),s=e.clientX-t.left,a=e.clientY-t.top;if("select"===T&&O){let e=ei.find(e=>e.id===O);if(e){let t=el(s,a,e,r);if(t)return void K({n:"n-resize",s:"s-resize",e:"e-resize",w:"w-resize",nw:"nw-resize",ne:"ne-resize",sw:"sw-resize",se:"se-resize"}[t]||"default")}K("default")}else"draw"===T?K("crosshair"):K("default")},onMouseLeave:()=>{D||H||K("default")},style:{cursor:G,transform:`scale(${A})`,transformOrigin:"top left"}}):(0,s.jsxs)("div",{className:"flex items-center justify-center h-96 text-muted-foreground",children:[(0,s.jsx)(y.A,{className:"w-16 h-16 opacity-50"}),(0,s.jsx)("p",{className:"ml-4",children:"Imagem n\xe3o dispon\xedvel"})]})})})]})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center mt-6 pt-4 border-t",children:[(0,s.jsxs)(l.$,{variant:"outline",onClick:()=>{S(Math.min(M+1,B.length-1)),V(!1),W(null)},children:[(0,s.jsx)(v.A,{className:"w-4 h-4 mr-2"}),"Pular P\xe1gina"]}),(0,s.jsx)("div",{className:"flex gap-2",children:ec>0&&B.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.$,{variant:"outline",onClick:()=>t.back(),children:"Voltar"}),(0,s.jsxs)(l.$,{variant:"default",onClick:async()=>{try{let e=await fetch(`/api/magazines/workflow/${C}/process`,{method:"POST"});if(!e.ok){let r=await e.json();throw Error(r.error||"Erro ao iniciar processamento")}let r=await e.json();N.oR.success(r.message||"Processamento iniciado! Redirecionando..."),setTimeout(()=>{t.push("/admin/magazine-workflow")},1500)}catch(e){N.oR.error(e.message)}},children:[(0,s.jsx)(m.A,{className:"w-4 h-4 mr-2"}),ec===B.length?"Iniciar Processamento":`Processar ${ec} P\xe1ginas`]})]}):(0,s.jsx)(l.$,{variant:"default",onClick:ed,disabled:E,children:E?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"w-4 h-4 mr-2 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Salvando..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(j.A,{className:"w-4 h-4 mr-2"}),"Salvar e Continuar"]})})})]})]})}}},e=>{e.O(0,[18409,66609,20003,28441,93794,77358],()=>e(e.s=26699)),_N_E=e.O()}]);
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.