ó
    UB/j
  ã                  ó’   • S r SSKJr  SSKJrJrJr  SSKJrJ	r	  SSK
Jr  SSKJr   " S S\5      r " S	 S
\5      r " S S\5      rg)uŠ  Result types for the two-flow extractor.

`VisualTable` is one table as identified by looking at the page (the
authoritative count and identity). `CamelotTable` is one cell grid pulled
by Camelot, carrying its classifier verdict as metadata only â€” the verdict
never drops a candidate here, because identity is the visual flow's job.
`DualResult` holds both lists for one document, unmatched.
é    )Úannotations)ÚListÚOptionalÚTuple)Ú	BaseModelÚField)ÚClassifierResult)ÚCamelotCandidatec                  óŽ   • \ rS rSr% Sr\" SSS9rS\S'   \" SSS9rS\S	'   \" S
SS9r	S\S'   \" SS9r
S\S'   \" SS9rS\S'   Srg)ÚVisualTableé   zCA table the visual flow found on a page, with its full-anatomy box.é   z 1-indexed page the table sits on)ÚgeÚdescriptionÚintÚpagez.1-based reading-order position within the pageÚordinalÚ z/Visible caption, else a one-line column summary©Údefaultr   ÚstrÚtitlezOBoundary box, normalized 0..1 with the page top-left as origin (x1, y1, x2, y2)©r   z!Tuple[float, float, float, float]ÚregionzUTrue if the box was snapped to the text layer; False if the coarse grid cell was keptÚboolÚ	tightened© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__annotations__r   r   r   r   Ú__static_attributes__r   ó    Ú?/home/mande/repo/quber/src/quber/core/extractors/dual/models.pyr   r      sf   ‡ ÙMá˜Ð(JÑK€Dˆ#ÓKÙ˜AÐ+[Ñ\€GˆSÓ\Ù˜rÐ/`Ña€Eˆ3ÓaÙ05Øeñ1€FÐ-ó ñ Økñ€Iˆtö r%   r   c                  óH   • \ rS rSr% Sr\" SS9rS\S'   \" SSS	9rS
\S'   Sr	g)ÚCamelotTableé"   zEA Camelot cell grid plus its is-table verdict (metadata, not a gate).z3Raw Camelot output: cells, markdown, bbox, accuracyr   r
   Ú	candidateNz]Classifier's is_table verdict, kept for later cross-reference; it does not drop the candidater   zOptional[ClassifierResult]Úclassificationr   )
r   r   r    r!   r"   r   r*   r#   r+   r$   r   r%   r&   r(   r(   "   s.   ‡ ÙOá"'Ð4iÑ"j€IÐÓjÙ16ØØsñ2€NÐ.ö r%   r(   c                  ót   • \ rS rSr% Sr\" SS9rS\S'   \" \SS9r	S	\S
'   \" \SS9r
S\S'   SS jrSS jrSrg)Ú
DualResulté,   z@Both flows' output for one document, side by side and unmatched.zPath of the source PDFr   r   Úsourcez$Tables identified by the visual flow)Údefault_factoryr   zList[VisualTable]ÚvisualzCell grids extracted by CamelotzList[CamelotTable]Úcamelotc                ó†   • 0 nU R                    H.  nUR                  UR                  S5      S-   XR                  '   M0     U$ ©Nr   r   )r1   Úgetr   ©ÚselfÚcountsÚts      r&   Úvisual_count_by_pageÚDualResult.visual_count_by_page5   s9   € Ø!#ˆØ—”ˆAØ#ŸZ™Z¨¯©°Ó2°QÑ6ˆF—6‘6‹Nñ àˆr%   c                ó®   • 0 nU R                    HB  nUR                  UR                  R                  S5      S-   XR                  R                  '   MD     U$ r4   )r2   r5   r*   r   r6   s      r&   Úcamelot_count_by_pageÚ DualResult.camelot_count_by_page;   sF   € Ø!#ˆØ—”ˆAØ'-§z¡z°!·+±+×2BÑ2BÀAÓ'FÈÑ'JˆF—;‘;×#Ñ#Ó$ñ àˆr%   r   N)Úreturnzdict[int, int])r   r   r    r!   r"   r   r/   r#   Úlistr1   r2   r:   r=   r$   r   r%   r&   r-   r-   ,   sL   ‡ ÙJáÐ$<Ñ=€FˆCÓ=Ù %ØÐ*Pñ!€FÐó ñ #(¸ÐJkÑ"l€GÐÓlô÷r%   r-   N)r"   Ú
__future__r   Útypingr   r   r   Úpydanticr   r   Úquber.agents.classifierr	   Ú%quber.core.extractors.camelot.acquirer
   r   r(   r-   r   r%   r&   Ú<module>rF      sB   ðñõ #ç (Ñ (ç %å 4Ý Bô�)ô ô�9ô ô�õ r%   