anima-ds-nucleus 1.0.134 → 1.0.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -917,7 +917,7 @@ React keys must be passed directly to JSX without using spread:
917
917
  padding-right: 12px !important;
918
918
  }
919
919
  }
920
- `}),i.jsx("div",{className:`anima-tenantactive__content ${A}`,style:{width:"100%",minHeight:"24px",opacity:1,boxSizing:"border-box",...C||{}},children:i.jsx("div",{className:`anima-tenantactive__items ${L}`,style:{width:"100%",minHeight:"24px",display:"flex",flexDirection:"row",gap:"24px",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",boxSizing:"border-box",...M||{}},children:a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`anima-tenantactive__left-section ${$}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"24px",flex:"1 1 auto",minWidth:0,boxSizing:"border-box",...j||{}},children:[i.jsx(se,{variant:"rectangular",height:21,width:90}),i.jsx(se,{variant:"rectangular",height:24,width:168})]}),i.jsxs("div",{className:`anima-tenantactive__right-section ${D}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"24px",flex:"1 1 auto",minWidth:0,boxSizing:"border-box",...Z||{}},children:[i.jsx(se,{variant:"rectangular",height:21,width:130}),i.jsx(se,{variant:"rectangular",height:24,width:168})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`anima-tenantactive__left-section ${$}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"24px",flex:"1 1 auto",minWidth:0,boxSizing:"border-box",...j||{}},children:[e&&i.jsx(B,{variant:"body-md",className:n,style:{fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"1%",textTransform:"uppercase",color:"var(--color-main-800)",whiteSpace:"nowrap",flexShrink:0,...t||{}},children:e}),o&&i.jsx(sa,{variant:"primary",size:"medium",className:`anima-tenantactive__badge anima-tenantactive__badge-id ${u}`,style:{minWidth:"168px",flexShrink:0,justifyContent:"flex-end",...h||{}},children:o})]}),i.jsxs("div",{className:`anima-tenantactive__right-section ${D}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"24px",flex:"1 1 auto",minWidth:0,boxSizing:"border-box",...Z||{}},children:[f&&i.jsx(B,{variant:"body-md",className:p,style:{fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"1%",textTransform:"uppercase",color:"var(--color-main-800)",whiteSpace:"nowrap",flexShrink:0,...m||{}},children:f}),w&&i.jsx(sa,{variant:"successOutline",size:"medium",className:`anima-tenantactive__badge anima-tenantactive__badge-estado ${R}`,style:{minWidth:"168px",flexShrink:0,justifyContent:"flex-end",...y||{}},children:w})]})]})})})]}),zae=({title:a="",titleStyle:e,titleClassName:t="",text:n="",textStyle:o,textClassName:l="",iconName:s="Cog6ToothIcon",iconSize:c=24,iconColor:d="#334681",iconStyle:h,iconClassName:u="",containerStyle:f,containerClassName:m="",contentContainerStyle:p,contentContainerClassName:w="",iconContainerStyle:g,iconContainerClassName:b="",textContainerStyle:v,textContainerClassName:x="",breakpointNarrowPx:y=1023,variant:R="default",showChevron:S,className:_="",...C})=>{const A=R==="compact",[M,L]=E.useState(()=>typeof window<"u"?window.innerWidth<=y:!1),[j,$]=E.useState(!1),Z=()=>{const T=window.innerWidth<=y;L(T),T||$(!1)};E.useLayoutEffect(()=>{Z()},[y]),E.useEffect(()=>(window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)),[y]);const D=!A&&M&&j,k=!A&&M&&!j,O=S??(!A&&M);return i.jsxs("div",{className:`anima-tenantconfig__container ${A?"anima-tenantconfig__container--compact":""} ${m} ${_}`,style:{width:"100%",minWidth:0,maxWidth:"100%",...A?{height:"auto",minHeight:0}:k?{height:"80px",minHeight:"80px"}:D?{height:"auto",minHeight:0}:{height:"auto",minHeight:0},paddingTop:"16px",paddingRight:"20px",paddingBottom:"16px",paddingLeft:"20px",gap:"12px",borderRadius:"12px",border:"1px solid var(--misc-estado-info, #334681)",backgroundColor:"#F0F3FC",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"row",alignItems:A||M&&!j?"center":"flex-start",overflow:"hidden",...f||{}},...C,children:[i.jsx("div",{className:`anima-tenantconfig__icon-container ${b}`,style:{width:"24px",...M?{height:"48px",minHeight:"48px",display:"flex",alignItems:"center",paddingTop:0}:{minHeight:0,paddingTop:"4px"},opacity:1,boxSizing:"border-box",flexShrink:0,...g||{}},children:i.jsx("div",{style:{width:"24px",height:"24px",opacity:1,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:i.jsx(P,{name:s,size:24,className:u,style:{width:"24px",height:"24px",opacity:1,color:d,stroke:"#334681",strokeWidth:"1.5px",...h||{}}})})}),i.jsxs("div",{className:`anima-tenantconfig__text-container ${x}`,style:{flex:"1 1 auto",minWidth:0,...k?{height:"48px",minHeight:"48px"}:{minHeight:0},...D&&{maxWidth:"332px"},gap:D?"10px":"8px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:k?"center":"flex-start",...v||{}},children:[a&&i.jsx("div",{className:"anima-tenantconfig__title-container",style:{width:"100%",...M?{width:"100%",minWidth:0,height:"48px",minHeight:0,display:"flex",alignItems:"center"}:{minHeight:"30px"},gap:"8px",opacity:1,boxSizing:"border-box"},children:i.jsx(B,{variant:"mono-md",className:t,style:{fontFamily:qe,fontWeight:500,fontStyle:"normal",fontSize:M?"16px":"20px",lineHeight:M?"24px":"30px",letterSpacing:"0%",verticalAlign:"middle",color:"#334681",margin:0,...e||{}},children:a})}),n&&(A||!k)&&i.jsx(i.Fragment,{children:D?i.jsx("div",{className:"anima-tenantconfig__text-expanded-wrapper",style:{width:"100%",maxWidth:"332px",minHeight:0,paddingRight:"8px",gap:"10px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:i.jsx("div",{className:"anima-tenantconfig__text-content anima-tenantconfig__text-content--expanded",style:{width:"100%",maxWidth:"288px",minHeight:0,opacity:1,boxSizing:"border-box"},children:i.jsx(B,{variant:"mono-md",className:l,style:{fontFamily:qe,fontWeight:450,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",verticalAlign:"middle",color:"var(--misc-estado-info, #334681)",margin:0,...o||{}},children:n})})}):i.jsx("div",{className:"anima-tenantconfig__text-content",style:{width:"100%",minHeight:0,opacity:1,boxSizing:"border-box",display:"block"},children:i.jsx(B,{variant:"mono-md",className:l,style:{fontFamily:qe,fontWeight:450,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",verticalAlign:"middle",color:"var(--misc-estado-info, #334681)",margin:0,...o||{}},children:n})})})]}),O&&i.jsx("button",{type:"button",className:"anima-tenantconfig__chevron",onClick:()=>$(T=>!T),style:{width:"20px",height:"42px",marginLeft:"auto",opacity:1,borderRadius:"4px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",cursor:"pointer",padding:0},"aria-expanded":j,"aria-label":j?"Contraer":"Expandir",children:i.jsx(P,{name:j?"ChevronUpIcon":"ChevronDownIcon",size:20,style:{width:"20px",height:"20px",color:"var(--misc-estado-info, #334681)"}})})]})},Pn=({label:a="Última actualización:",text:e,variant:t="narrow",render:n="twoLines",labelClassName:o="",labelStyle:l,textClassName:s="",textStyle:c,iconName:d="ClockIcon",iconSize:h=16,iconStyle:u,className:f="",style:m,rowClassName:p="",rowStyle:w,...g})=>{const b=t==="wide",v=n==="singleLine",x={fontFamily:I,fontWeight:400,fontStyle:"italic",fontSize:"14px",lineHeight:"21px",letterSpacing:b?"1%":"0.01em",...b?{verticalAlign:"middle"}:{},color:"var(--grey-800, #303030)",margin:0,...l||{}},y={fontFamily:I,fontWeight:400,fontStyle:"italic",fontSize:"14px",lineHeight:"21px",letterSpacing:b?"1%":"0.01em",...b?{verticalAlign:"middle",textAlign:"left"}:{},color:"var(--grey-800, #303030)",margin:0,paddingLeft:"24px",...c||{}},R={...x,...c||{}},S={width:"16px",height:"16px",color:"#303030",flexShrink:0,...b?{opacity:1}:{},...u||{}};return i.jsxs("div",{className:`anima-ultimaactualizacion ${f}`.trim(),style:{display:"flex",flexDirection:"column",gap:"4px",minWidth:0,...m||{}},...g,children:[i.jsxs("div",{className:`anima-ultimaactualizacion__row ${p}`.trim(),style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",...b?{flexShrink:0}:{},...w||{}},children:[i.jsx(P,{name:d,size:h,style:S}),v?i.jsx(B,{variant:"body-sm",className:o,style:R,children:e?`${a} ${e}`:a}):i.jsx(B,{variant:"body-sm",className:o,style:x,children:a})]}),!v&&e?i.jsx(B,{variant:"body-sm",className:s,style:y,children:e}):null]})},fl=({isNarrow:a=!1,identidadVisualTitle:e="",identidadVisualTitleStyle:t,identidadVisualTitleClassName:n="",marcaActualTitle:o="",marcaActualTitleStyle:l,marcaActualTitleClassName:s="",marcaActualImage:c,marcaActualImageAlt:d="",marcaActualImageObjectFit:h="contain",marcaActualNucleusText:u="",marcaActualNucleusTextStyle:f,marcaActualNucleusTextClassName:m="",formatoText:p=`Formato cuadrado
920
+ `}),i.jsx("div",{className:`anima-tenantactive__content ${A}`,style:{width:"100%",minHeight:"24px",opacity:1,boxSizing:"border-box",...C||{}},children:i.jsx("div",{className:`anima-tenantactive__items ${L}`,style:{width:"100%",minHeight:"24px",display:"flex",flexDirection:"row",gap:"24px",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",boxSizing:"border-box",...M||{}},children:a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`anima-tenantactive__left-section ${$}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"24px",flex:"1 1 auto",minWidth:0,boxSizing:"border-box",...j||{}},children:[i.jsx(se,{variant:"rectangular",height:21,width:90}),i.jsx(se,{variant:"rectangular",height:24,width:48,style:{borderRadius:16}})]}),i.jsxs("div",{className:`anima-tenantactive__right-section ${D}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"24px",flex:"1 1 auto",minWidth:0,boxSizing:"border-box",...Z||{}},children:[i.jsx(se,{variant:"rectangular",height:21,width:130}),i.jsx(se,{variant:"rectangular",height:24,width:96,style:{borderRadius:16}})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`anima-tenantactive__left-section ${$}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"24px",flex:"1 1 auto",minWidth:0,boxSizing:"border-box",...j||{}},children:[e&&i.jsx(B,{variant:"body-md",className:n,style:{fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"1%",textTransform:"uppercase",color:"var(--color-main-800)",whiteSpace:"nowrap",flexShrink:0,...t||{}},children:e}),o&&i.jsx(sa,{variant:"primary",size:"medium",className:`anima-tenantactive__badge anima-tenantactive__badge-id ${u}`,style:{width:"fit-content",maxWidth:"100%",minWidth:0,flexShrink:0,justifyContent:"center",borderColor:c,backgroundColor:d,...h||{}},children:o})]}),i.jsxs("div",{className:`anima-tenantactive__right-section ${D}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"24px",flex:"1 1 auto",minWidth:0,boxSizing:"border-box",...Z||{}},children:[f&&i.jsx(B,{variant:"body-md",className:p,style:{fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"1%",textTransform:"uppercase",color:"var(--color-main-800)",whiteSpace:"nowrap",flexShrink:0,...m||{}},children:f}),w&&i.jsx(sa,{variant:"successOutline",size:"medium",className:`anima-tenantactive__badge anima-tenantactive__badge-estado ${R}`,style:{width:"fit-content",maxWidth:"100%",minWidth:0,flexShrink:0,justifyContent:"center",borderColor:v,backgroundColor:x,...y||{}},children:w})]})]})})})]}),zae=({title:a="",titleStyle:e,titleClassName:t="",text:n="",textStyle:o,textClassName:l="",iconName:s="Cog6ToothIcon",iconSize:c=24,iconColor:d="#334681",iconStyle:h,iconClassName:u="",containerStyle:f,containerClassName:m="",contentContainerStyle:p,contentContainerClassName:w="",iconContainerStyle:g,iconContainerClassName:b="",textContainerStyle:v,textContainerClassName:x="",breakpointNarrowPx:y=1023,variant:R="default",showChevron:S,className:_="",...C})=>{const A=R==="compact",[M,L]=E.useState(()=>typeof window<"u"?window.innerWidth<=y:!1),[j,$]=E.useState(!1),Z=()=>{const T=window.innerWidth<=y;L(T),T||$(!1)};E.useLayoutEffect(()=>{Z()},[y]),E.useEffect(()=>(window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)),[y]);const D=!A&&M&&j,k=!A&&M&&!j,O=S??(!A&&M);return i.jsxs("div",{className:`anima-tenantconfig__container ${A?"anima-tenantconfig__container--compact":""} ${m} ${_}`,style:{width:"100%",minWidth:0,maxWidth:"100%",...A?{height:"auto",minHeight:0}:k?{height:"80px",minHeight:"80px"}:D?{height:"auto",minHeight:0}:{height:"auto",minHeight:0},paddingTop:"16px",paddingRight:"20px",paddingBottom:"16px",paddingLeft:"20px",gap:"12px",borderRadius:"12px",border:"1px solid var(--misc-estado-info, #334681)",backgroundColor:"#F0F3FC",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"row",alignItems:A||M&&!j?"center":"flex-start",overflow:"hidden",...f||{}},...C,children:[i.jsx("div",{className:`anima-tenantconfig__icon-container ${b}`,style:{width:"24px",...M?{height:"48px",minHeight:"48px",display:"flex",alignItems:"center",paddingTop:0}:{minHeight:0,paddingTop:"4px"},opacity:1,boxSizing:"border-box",flexShrink:0,...g||{}},children:i.jsx("div",{style:{width:"24px",height:"24px",opacity:1,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:i.jsx(P,{name:s,size:24,className:u,style:{width:"24px",height:"24px",opacity:1,color:d,stroke:"#334681",strokeWidth:"1.5px",...h||{}}})})}),i.jsxs("div",{className:`anima-tenantconfig__text-container ${x}`,style:{flex:"1 1 auto",minWidth:0,...k?{height:"48px",minHeight:"48px"}:{minHeight:0},...D&&{maxWidth:"332px"},gap:D?"10px":"8px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:k?"center":"flex-start",...v||{}},children:[a&&i.jsx("div",{className:"anima-tenantconfig__title-container",style:{width:"100%",...M?{width:"100%",minWidth:0,height:"48px",minHeight:0,display:"flex",alignItems:"center"}:{minHeight:"30px"},gap:"8px",opacity:1,boxSizing:"border-box"},children:i.jsx(B,{variant:"mono-md",className:t,style:{fontFamily:qe,fontWeight:500,fontStyle:"normal",fontSize:M?"16px":"20px",lineHeight:M?"24px":"30px",letterSpacing:"0%",verticalAlign:"middle",color:"#334681",margin:0,...e||{}},children:a})}),n&&(A||!k)&&i.jsx(i.Fragment,{children:D?i.jsx("div",{className:"anima-tenantconfig__text-expanded-wrapper",style:{width:"100%",maxWidth:"332px",minHeight:0,paddingRight:"8px",gap:"10px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:i.jsx("div",{className:"anima-tenantconfig__text-content anima-tenantconfig__text-content--expanded",style:{width:"100%",maxWidth:"288px",minHeight:0,opacity:1,boxSizing:"border-box"},children:i.jsx(B,{variant:"mono-md",className:l,style:{fontFamily:qe,fontWeight:450,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",verticalAlign:"middle",color:"var(--misc-estado-info, #334681)",margin:0,...o||{}},children:n})})}):i.jsx("div",{className:"anima-tenantconfig__text-content",style:{width:"100%",minHeight:0,opacity:1,boxSizing:"border-box",display:"block"},children:i.jsx(B,{variant:"mono-md",className:l,style:{fontFamily:qe,fontWeight:450,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",verticalAlign:"middle",color:"var(--misc-estado-info, #334681)",margin:0,...o||{}},children:n})})})]}),O&&i.jsx("button",{type:"button",className:"anima-tenantconfig__chevron",onClick:()=>$(T=>!T),style:{width:"20px",height:"42px",marginLeft:"auto",opacity:1,borderRadius:"4px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",cursor:"pointer",padding:0},"aria-expanded":j,"aria-label":j?"Contraer":"Expandir",children:i.jsx(P,{name:j?"ChevronUpIcon":"ChevronDownIcon",size:20,style:{width:"20px",height:"20px",color:"var(--misc-estado-info, #334681)"}})})]})},Pn=({label:a="Última actualización:",text:e,variant:t="narrow",render:n="twoLines",labelClassName:o="",labelStyle:l,textClassName:s="",textStyle:c,iconName:d="ClockIcon",iconSize:h=16,iconStyle:u,className:f="",style:m,rowClassName:p="",rowStyle:w,...g})=>{const b=t==="wide",v=n==="singleLine",x={fontFamily:I,fontWeight:400,fontStyle:"italic",fontSize:"14px",lineHeight:"21px",letterSpacing:b?"1%":"0.01em",...b?{verticalAlign:"middle"}:{},color:"var(--grey-800, #303030)",margin:0,...l||{}},y={fontFamily:I,fontWeight:400,fontStyle:"italic",fontSize:"14px",lineHeight:"21px",letterSpacing:b?"1%":"0.01em",...b?{verticalAlign:"middle",textAlign:"left"}:{},color:"var(--grey-800, #303030)",margin:0,paddingLeft:"24px",...c||{}},R={...x,...c||{}},S={width:"16px",height:"16px",color:"#303030",flexShrink:0,...b?{opacity:1}:{},...u||{}};return i.jsxs("div",{className:`anima-ultimaactualizacion ${f}`.trim(),style:{display:"flex",flexDirection:"column",gap:"4px",minWidth:0,...m||{}},...g,children:[i.jsxs("div",{className:`anima-ultimaactualizacion__row ${p}`.trim(),style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",...b?{flexShrink:0}:{},...w||{}},children:[i.jsx(P,{name:d,size:h,style:S}),v?i.jsx(B,{variant:"body-sm",className:o,style:R,children:e?`${a} ${e}`:a}):i.jsx(B,{variant:"body-sm",className:o,style:x,children:a})]}),!v&&e?i.jsx(B,{variant:"body-sm",className:s,style:y,children:e}):null]})},fl=({isNarrow:a=!1,identidadVisualTitle:e="",identidadVisualTitleStyle:t,identidadVisualTitleClassName:n="",marcaActualTitle:o="",marcaActualTitleStyle:l,marcaActualTitleClassName:s="",marcaActualImage:c,marcaActualImageAlt:d="",marcaActualImageObjectFit:h="contain",marcaActualNucleusText:u="",marcaActualNucleusTextStyle:f,marcaActualNucleusTextClassName:m="",formatoText:p=`Formato cuadrado
921
921
  PNG de máximo 2Mb`,formatoTextStyle:w,formatoTextClassName:g="",uploadButtonText:b="Subir imagen",uploadButtonOnClick:v,uploadButtonStyle:x,uploadButtonClassName:y="",containerStyle:R,containerClassName:S="",..._})=>{const C=!!c&&h==="cover";return i.jsxs("div",{className:`anima-identidadvisual__container ${S}`,style:{width:"100%",...a?{minHeight:0,paddingBottom:0}:{minHeight:"256px",paddingBottom:"24px"},gap:"12px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",...R||{}},..._,children:[e&&i.jsx("div",{style:{width:"100%",minHeight:0,opacity:1,boxSizing:"border-box"},children:i.jsx(B,{variant:"body-sm",className:n,style:{fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"var(--color-main-800)",margin:0,...t||{}},children:e})}),a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:"12px",minWidth:0},children:[i.jsx("div",{style:{width:"56px",height:"56px",flexShrink:0,borderRadius:"12px",border:"1px solid #38656D",backgroundColor:"#FFFFFF",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:c?i.jsx("img",{src:c,alt:d,style:{width:"100%",height:"100%",objectFit:h,display:"block"}}):i.jsx(B,{variant:"mono-lg",className:m,style:{fontFamily:I,fontWeight:500,fontSize:"24px",lineHeight:"24px",color:"#38656D",margin:0,...f||{}},children:u})}),o&&i.jsx(B,{variant:"body-md",className:s,style:{fontFamily:I,fontWeight:500,fontSize:"16px",lineHeight:"24px",color:"var(--color-cyan-19)",margin:0,...l||{}},children:o})]}),i.jsxs("div",{style:{width:"100%",padding:"16px",borderRadius:"16px",backgroundColor:"#F0F3FC",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",minWidth:0},children:[i.jsx("div",{style:{width:"48px",height:"48px",flexShrink:0,borderRadius:"8px",border:"1.5px dashed #38656D",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(P,{name:"PhotoIcon",size:24,style:{width:"24px",height:"24px",color:"var(--color-main-800)",opacity:1}})}),p&&i.jsx(B,{variant:"body-sm",className:g,style:{flex:1,fontFamily:I,fontWeight:400,fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#5F5F5F",margin:0,whiteSpace:"pre-line",...w||{}},children:p})]}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:i.jsx(Xt,{onClick:v,className:y,style:{width:"110px",height:"37px",padding:"8px 12px",borderRadius:"8px",backgroundColor:"#38656D",border:"none",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",...x||{}},children:i.jsx(B,{variant:"body-sm",style:{fontFamily:I,fontWeight:500,fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#FFFFFF",margin:0,textAlign:"center"},children:b})})})]})]}):i.jsx(i.Fragment,{children:i.jsxs("div",{style:{width:"100%",minHeight:"199px",gap:"40px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"row",alignItems:"flex-start",flexWrap:"nowrap",minWidth:0},children:[i.jsxs("div",{style:{flex:"0 0 170px",minWidth:0,maxWidth:"170px",height:"196px",paddingTop:"16px",paddingRight:"36px",paddingBottom:"16px",paddingLeft:"36px",gap:"32px",borderRadius:"20px",backgroundColor:"#FFFFFF",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center",overflow:"hidden"},children:[o&&i.jsx("div",{style:{width:"98px",minHeight:"24px",paddingLeft:"4px",opacity:1,boxSizing:"border-box"},children:i.jsx(B,{variant:"body-md",className:s,style:{width:"94px",minHeight:"24px",fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"16px",lineHeight:"24px",letterSpacing:"0px",color:"var(--color-cyan-19)",margin:0,...l||{}},children:o})}),i.jsx("div",{style:{width:"72px",height:"128px",gap:"10px",opacity:1,boxSizing:"border-box",display:"inline-flex",flexDirection:"column",alignItems:"center"},children:i.jsx("div",{style:{width:"72px",height:"72px",borderRadius:"16px",borderWidth:"1px",borderStyle:"solid",borderColor:"#38656D",padding:C?0:"16px",backgroundColor:"#FFFFFF",opacity:1,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:c?i.jsx("img",{src:c,alt:d,style:{width:"100%",height:"100%",objectFit:h,display:"block"}}):i.jsx(B,{variant:"mono-lg",className:m,style:{width:"23px",minHeight:"24px",fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"32px",lineHeight:"24px",letterSpacing:"0px",color:"#38656D",margin:0,...f||{}},children:u})})})]}),i.jsxs("div",{style:{flex:"1 1 0",minWidth:0,minHeight:"199px",paddingTop:"20px",paddingRight:"12px",paddingBottom:"20px",paddingLeft:"12px",gap:"16px",borderRadius:"16px",backgroundColor:"#F0F3FC",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:[i.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"8px",borderWidth:"1.5px",borderStyle:"dashed",borderColor:"#38656D",padding:"16px",opacity:1,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:i.jsx("div",{style:{width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(P,{name:"PhotoIcon",size:24,style:{width:"24px",height:"24px",color:"var(--color-main-800)",opacity:1}})})}),p&&i.jsx("div",{style:{width:"194px",minHeight:"42px",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(B,{variant:"body-sm",className:g,style:{width:"135px",minHeight:"42px",fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"1%",textAlign:"center",color:"#5F5F5F",margin:0,whiteSpace:"pre-line",...w||{}},children:p})}),i.jsx(Xt,{onClick:v,className:y,style:{width:"110px",height:"37px",paddingTop:"8px",paddingRight:"12px",paddingBottom:"8px",paddingLeft:"12px",borderRadius:"8px",backgroundColor:"#38656D",border:"none",opacity:1,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",...x||{}},children:i.jsx(B,{variant:"body-sm",style:{width:"86px",minHeight:"21px",fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"1%",color:"#FFFFFF",margin:0,textAlign:"center"},children:b})})]})]})})]})},En=({className:a="",style:e,padding:t=24,children:n,...o})=>{const l=t===!1?{}:{padding:typeof t=="number"?`${t}px`:t};return i.jsx("div",{className:`anima-cardgrande__container ${a}`.trim(),style:{width:"100%",borderRadius:"16px",border:"1px solid #C4C4C4",backgroundColor:"#FFFFFF",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",overflow:"hidden",...l,...e||{}},...o,children:n})},Uae=({loading:a=!1,title:e="CONFIGURACIÓN DE MARCA",titleStyle:t,titleClassName:n="",labelText:o="Nombre comercial",labelTextStyle:l,labelTextClassName:s="",inputValue:c="",inputPlaceholder:d="",inputOnChange:h,inputStyle:u,inputClassName:f="",identidadVisualTitle:m="",identidadVisualTitleStyle:p,identidadVisualTitleClassName:w="",marcaActualTitle:g="",marcaActualTitleStyle:b,marcaActualTitleClassName:v="",marcaActualImage:x,marcaActualImageAlt:y="",marcaActualNucleusText:R="",marcaActualNucleusTextStyle:S,marcaActualNucleusTextClassName:_="",formatoText:C=`Formato cuadrado
922
922
  PNG de máximo 2Mb`,formatoTextStyle:A,formatoTextClassName:M="",uploadButtonText:L="Subir imagen",uploadButtonOnClick:j,uploadButtonStyle:$,uploadButtonClassName:Z="",actualizacionLabel:D="Última actualización:",actualizacionLabelStyle:k,actualizacionLabelClassName:O="",actualizacionText:T="hace 2 horas",actualizacionLoading:V=!1,actualizacionTextStyle:z,actualizacionTextClassName:G="",guardarButtonText:ae="Guardar",guardarButtonDisabled:Q=!0,guardarButtonOnClick:K,guardarButtonStyle:q,guardarButtonClassName:ne="",imageError:X="",imageErrorTitle:ee="La imagen seleccionada, no cumple las especificaciones.",imageErrorSubtitle:le="Inténtelo nuevamente.",containerStyle:U,containerClassName:fe="",titleContainerStyle:be,titleContainerClassName:J="",contentContainerStyle:he,contentContainerClassName:de="",breakpointNarrowPx:H=1439,className:Y="",...ue})=>{const[me,Ae]=E.useState(()=>typeof window<"u"?window.innerWidth<=H:!1),ye=()=>{Ae(window.innerWidth<=H)};E.useLayoutEffect(()=>{ye()},[H]),E.useEffect(()=>(window.addEventListener("resize",ye),()=>window.removeEventListener("resize",ye)),[H]);const Ie=i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:21,width:100,style:{marginLeft:24}})]});return i.jsxs(En,{className:`anima-configuracionmarcatenant__container ${fe} ${Y}`,style:{...me?{minHeight:0}:{minHeight:"518px"},...U||{}},...ue,children:[i.jsx("div",{className:`anima-configuracionmarcatenant__title-container ${J}`,style:{width:"100%",...me?{minHeight:0}:{minHeight:"58px"},paddingTop:"24px",paddingRight:me?"16px":"24px",paddingBottom:"4px",paddingLeft:me?"16px":"24px",gap:"8px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",...be||{}},children:i.jsx("div",{style:{width:"100%",minHeight:"30px",opacity:1,boxSizing:"border-box"},children:a?i.jsx(se,{variant:"rectangular",height:24,width:"60%"}):e?i.jsx(B,{variant:"body-md",className:n,style:{fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"16px",lineHeight:"30px",letterSpacing:"0%",verticalAlign:"middle",textTransform:"uppercase",color:"var(--color-cyan-19)",margin:0,...t||{}},children:e}):null})}),i.jsx("div",{className:`anima-configuracionmarcatenant__content ${de}`,style:{width:"100%",...me?{minHeight:0}:{minHeight:"460px"},paddingTop:"16px",paddingRight:me?"16px":"24px",paddingBottom:"20px",paddingLeft:me?"16px":"24px",opacity:1,boxSizing:"border-box",...me?{display:"flex",flexDirection:"column",gap:"24px"}:{},...he||{}},children:a?i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"24px",boxSizing:"border-box"},children:[i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsx(se,{variant:"rectangular",height:21,width:140}),i.jsx(se,{variant:"rectangular",height:42,width:"100%"})]}),i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsx(se,{variant:"rectangular",height:21,width:120}),me?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",justifyContent:"center"},children:[i.jsx(se,{variant:"rectangular",height:56,width:56,style:{borderRadius:12}}),i.jsx(se,{variant:"rectangular",height:24,width:80})]}),i.jsxs("div",{style:{padding:16,borderRadius:16,backgroundColor:"#F0F3FC",display:"flex",flexDirection:"column",gap:12},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:12},children:[i.jsx(se,{variant:"rectangular",height:48,width:48,style:{borderRadius:8}}),i.jsx(se,{variant:"rectangular",height:21,width:"70%"})]}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:i.jsx(se,{variant:"rectangular",height:37,width:110,style:{borderRadius:8}})})]})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:40,alignItems:"flex-start"},children:[i.jsxs("div",{style:{flex:"0 0 170px",display:"flex",flexDirection:"column",alignItems:"center",gap:16,padding:16,borderRadius:20,backgroundColor:"#FFFFFF"},children:[i.jsx(se,{variant:"rectangular",height:24,width:94}),i.jsx(se,{variant:"rectangular",height:72,width:72,style:{borderRadius:16}})]}),i.jsxs("div",{style:{flex:1,minWidth:0,padding:20,borderRadius:16,backgroundColor:"#F0F3FC",display:"flex",flexDirection:"column",alignItems:"center",gap:16},children:[i.jsx(se,{variant:"rectangular",height:48,width:48,style:{borderRadius:8}}),i.jsx(se,{variant:"rectangular",height:42,width:135}),i.jsx(se,{variant:"rectangular",height:37,width:110,style:{borderRadius:8}})]})]})]}),me?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:21,width:100,style:{marginLeft:24}})]}),i.jsx(se,{variant:"rectangular",height:48,width:"100%",style:{borderRadius:8}})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:20},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:21,width:100,style:{marginLeft:24}})]}),i.jsx(se,{variant:"rectangular",height:48,width:91,style:{borderRadius:8}})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"100%",...me?{minHeight:0,paddingBottom:0}:{minHeight:"95px",paddingBottom:"24px"},gap:"24px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:i.jsxs("div",{style:{width:"100%",...me?{minHeight:0}:{minHeight:"71px"},gap:"10px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:[o&&i.jsx("div",{style:{width:"100%",minHeight:"21px",gap:"8px",opacity:1,boxSizing:"border-box"},children:i.jsx(B,{variant:"body-sm",className:s,style:{fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"1%",color:"var(--color-main-800)",margin:0,...l||{}},children:o})}),i.jsx(Zt,{...h?{value:c,onChange:h}:{defaultValue:c},placeholder:d,className:f,style:u})]})}),i.jsx(fl,{isNarrow:me,identidadVisualTitle:m,identidadVisualTitleStyle:p,identidadVisualTitleClassName:w,marcaActualTitle:g,marcaActualTitleStyle:b,marcaActualTitleClassName:v,marcaActualImage:x,marcaActualImageAlt:y,marcaActualNucleusText:R,marcaActualNucleusTextStyle:S,marcaActualNucleusTextClassName:_,formatoText:C,formatoTextStyle:A,formatoTextClassName:M,uploadButtonText:L,uploadButtonOnClick:j,uploadButtonStyle:$,uploadButtonClassName:Z}),X&&i.jsxs("div",{className:"anima-configuracionmarcatenant__imageErrorBox",style:{paddingTop:"12px",paddingRight:"16px",paddingBottom:"12px",paddingLeft:"16px",gap:"4px",borderRadius:"8px",borderWidth:"1px",border:"1px solid #B30808",backgroundColor:"#F8DBDB",display:"flex",flexDirection:"column"},children:[i.jsx(B,{variant:"body2",style:{fontFamily:qe,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.02em",color:"#B30808",margin:0},children:typeof X=="string"?X:ee}),i.jsx(B,{variant:"body2",style:{fontFamily:qe,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.02em",color:"#B30808",margin:0},children:le})]}),me?i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"16px",boxSizing:"border-box"},children:[V?Ie:i.jsx(Pn,{variant:"narrow",label:D,text:T,labelClassName:O,labelStyle:k,textClassName:G,textStyle:z}),i.jsx(Ze,{text:ae,disabled:Q,onClick:K,fullWidth:!0,className:ne,style:q})]}):i.jsxs("div",{style:{width:"100%",minHeight:"69px",gap:"20px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",flexWrap:"nowrap"},children:[i.jsx("div",{style:{flex:"1 1 auto",minWidth:0,paddingTop:"8px",paddingRight:"12px",paddingBottom:"8px",paddingLeft:"12px",gap:"4px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"},children:V?Ie:i.jsx(Pn,{variant:"wide",label:D,text:T,labelClassName:O,labelStyle:k,textClassName:G,textStyle:z})}),i.jsx(Ze,{text:ae,disabled:Q,onClick:K,fullWidth:!1,className:ne,style:q})]})]})})]})},Gae=({loading:a=!1,title:e="CONFIGURACIÓN DE LOCALIZACIÓN",titleStyle:t,titleClassName:n="",labelText:o="Idioma (predeterminado)",labelTextStyle:l,labelTextClassName:s="",selectOptions:c=[],selectValue:d="",selectOnChange:h,selectPlaceholder:u="",selectDisabled:f=!1,selectClassName:m="",selectStyle:p,labelZonaHoraria:w="Zona horaria",labelZonaHorariaStyle:g,labelZonaHorariaClassName:b="",zonaHorariaOptions:v=[],zonaHorariaValue:x="",zonaHorariaOnChange:y,zonaHorariaPlaceholder:R="",zonaHorariaDisabled:S=!1,zonaHorariaClassName:_="",zonaHorariaStyle:C,actualizacionLabel:A="Última actualización:",actualizacionLabelStyle:M,actualizacionLabelClassName:L="",actualizacionText:j="hace 2 horas",actualizacionLoading:$=!1,actualizacionTextStyle:Z,actualizacionTextClassName:D="",guardarButtonText:k="Guardar",guardarButtonDisabled:O=!0,guardarButtonOnClick:T,guardarButtonStyle:V,guardarButtonClassName:z="",containerStyle:G,containerClassName:ae="",titleContainerStyle:Q,titleContainerClassName:K="",contentContainerStyle:q,contentContainerClassName:ne="",breakpointNarrowPx:X=1023,className:ee="",...le})=>{const[U,fe]=E.useState(()=>typeof window<"u"?window.innerWidth<=X:!1),be=()=>{fe(window.innerWidth<=X)};E.useLayoutEffect(()=>{be()},[X]),E.useEffect(()=>(window.addEventListener("resize",be),()=>window.removeEventListener("resize",be)),[X]);const J=i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:21,width:100,style:{marginLeft:24}})]});return i.jsxs(En,{className:`anima-configuracionlocalizacion__container ${ae} ${ee}`,style:{...U?{minHeight:0}:{minHeight:"518px"},marginBottom:"20px",...G||{}},...le,children:[i.jsx("div",{className:`anima-configuracionlocalizacion__title-container ${K}`,style:{width:"100%",...U?{minHeight:0}:{minHeight:"58px"},paddingTop:"24px",paddingRight:U?"16px":"24px",paddingBottom:"4px",paddingLeft:U?"16px":"24px",gap:"8px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",...Q||{}},children:i.jsx("div",{style:{width:"100%",minHeight:"30px",opacity:1,boxSizing:"border-box"},children:a?i.jsx(se,{variant:"rectangular",height:24,width:"70%"}):e?i.jsx(B,{variant:"body-md",className:n,style:{fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"16px",lineHeight:"30px",letterSpacing:"0%",verticalAlign:"middle",textTransform:"uppercase",color:"var(--color-cyan-19)",margin:0,...t||{}},children:e}):null})}),i.jsx("div",{className:`anima-configuracionlocalizacion__content ${ne}`,style:{width:"100%",flex:1,...U?{minHeight:0}:{minHeight:"460px"},paddingTop:"16px",paddingRight:U?"16px":"24px",paddingBottom:"20px",paddingLeft:U?"16px":"24px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"24px",...q||{}},children:a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:10},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:42,width:"100%"})]}),i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:10},children:[i.jsx(se,{variant:"rectangular",height:21,width:120}),i.jsx(se,{variant:"rectangular",height:42,width:"100%"})]}),U?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:21,width:100,style:{marginLeft:24}})]}),i.jsx(se,{variant:"rectangular",height:48,width:"100%",style:{borderRadius:8}})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:20,marginTop:"auto"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:21,width:100,style:{marginLeft:24}})]}),i.jsx(se,{variant:"rectangular",height:48,width:91,style:{borderRadius:8}})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{width:"100%",...U?{minHeight:0,paddingBottom:0}:{minHeight:"95px",paddingBottom:"24px"},gap:"24px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:[i.jsx("div",{style:{width:"100%",...U?{minHeight:0}:{minHeight:"71px"},gap:"10px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:i.jsx(ia,{label:o,labelStyle:l,labelClassName:s,options:c,value:d,onChange:h,placeholder:u,disabled:f,className:m,style:p})}),i.jsx("div",{style:{width:"100%",...U?{minHeight:0}:{minHeight:"71px"},gap:"10px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:i.jsx(ia,{label:w,labelStyle:g,labelClassName:b,options:v,value:x,onChange:y,placeholder:R,disabled:S,className:_,style:C})})]}),U?i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"16px",boxSizing:"border-box",marginTop:"auto"},children:[$?J:i.jsx(Pn,{variant:"narrow",label:A,text:j,labelClassName:L,labelStyle:M,textClassName:D,textStyle:Z}),i.jsx(Ze,{text:k,disabled:O,onClick:T,fullWidth:!0,className:z,style:V})]}):i.jsxs("div",{style:{width:"100%",minHeight:"69px",marginTop:"auto",gap:"20px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",flexWrap:"nowrap"},children:[i.jsx("div",{style:{flex:"1 1 auto",minWidth:0,paddingTop:"8px",paddingRight:"12px",paddingBottom:"8px",paddingLeft:"12px",gap:"4px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"},children:$?J:i.jsx(Pn,{variant:"wide",label:A,text:j,labelClassName:L,labelStyle:M,textClassName:D,textStyle:Z})}),i.jsx(Ze,{text:k,disabled:O,onClick:T,fullWidth:!1,className:z,style:V})]})]})})]})},ml="anima-ds.i18n.language",Yae=["es-AR","en-US"];function Uc(){if(typeof window>"u")return null;try{const a=localStorage.getItem(ml);if(a==="es-AR"||a==="en-US")return a}catch{}return null}function Gc(a){return a!=="es-AR"&&a!=="en-US"?Promise.resolve():ir.changeLanguage(a).then(()=>{try{localStorage.setItem(ml,a)}catch{}})}const Xae={"es-AR":{translation:{"common.save":"Guardar","common.cancel":"Cancelar","common.delete":"Eliminar","common.edit":"Editar","common.search":"Buscar","common.loading":"Cargando...","common.submit":"Enviar","common.back":"Volver","common.next":"Siguiente","common.previous":"Anterior","common.showPassword":"Mostrar contraseña","common.hidePassword":"Ocultar contraseña","nav.home":"Inicio","nav.dashboard":"Dashboard","nav.profile":"Perfil","nav.settings":"Configuración","nav.logout":"Cerrar Sesión","saludo.hola":"Hola","saludo.greetingPrefix":"¡","saludo.greetingSuffix":"!","sidebar.homeLabel":"Inicio","sidebar.settingsLabel":"Configuración","form.email":"Correo electrónico","form.password":"Contraseña","form.confirmPassword":"Confirmar contraseña","form.currentPassword":"Contraseña actual","form.newPassword":"Nueva contraseña","form.rememberMe":"Recordarme","form.login":"Iniciar Sesión","form.changePassword":"Cambiar contraseña","form.forgotPassword":"¿Olvidaste tu contraseña?","placeholder.email":"Ingresa tu correo electrónico","placeholder.password":"Ingresa tu contraseña","placeholder.currentPassword":"Ingresa tu contraseña actual","placeholder.search":"Buscar...","placeholder.select":"Selecciona una opción","validation.required":"{{field}} es obligatorio","validation.passwordMinLength":"La contraseña debe tener al menos {{min}} caracteres","validation.confirmPasswordRequired":"Por favor confirmá tu contraseña","validation.passwordsDoNotMatch":"Las contraseñas no coinciden","changePassword.success":"¡Contraseña actualizada con éxito!","changePassword.helper.minLength":"Debe tener al menos {{min}} caracteres","changePassword.repeatPassword":"Repetir contraseña","table.actions":"Acciones","table.noData":"No hay datos disponibles","table.loading":"Cargando datos...","table.id":"ID","table.name":"Nombre","table.email":"Correo","table.role":"Rol","table.status":"Estado","table.date":"Fecha","table.edit":"Editar","table.delete":"Eliminar","table.view":"Ver","table.rowsPerPage":"Filas por página","table.density":"Densidad","table.densityLabel":"Densidad","table.densityCompact":"Compacta","table.densityStandard":"Estándar","table.densityComfortable":"Cómoda","table.filters":"Filtros","table.filtersLabel":"Mostrar filtros","table.filtersTooltipHide":"Ocultar filtros","table.filtersTooltipShow":"Mostrar filtros","table.export":"Exportar","table.exportLabel":"Exportar","table.exportCSV":"Descargar como CSV","table.exportPrint":"Imprimir","table.columns":"Columnas","table.columnsLabel":"Seleccionar columnas","table.filterPanelAddFilter":"Agregar filtro","table.filterPanelDeleteIconLabel":"Eliminar","table.filterPanelOperators":"Operadores","table.filterPanelOperatorAnd":"Y","table.filterPanelOperatorOr":"O","table.filterPanelColumns":"Columnas","table.filterPanelInputLabel":"Valor","table.filterPanelInputPlaceholder":"Valor del filtro","table.noResults":"No se encontraron resultados","table.errorOverlayDefaultLabel":"Ocurrió un error","table.recordsPrefix":"Registros:","table.recordsRangeTo":"a","table.pagePrefix":"Página","table.of":"de","table.recordsPorPaginaInputAria":"Cuántos registros mostrar por página (número)","table.prevPageAria":"Página anterior","table.nextPageAria":"Página siguiente","table.actionsAria":"Acciones","table.searchPlaceholder":"Buscar dentro de 'Usuarios'","profile.menu.profile":"Mi Perfil","profile.menu.settings":"Configuración","profile.menu.help":"Centro de ayuda","profile.menu.logout":"Cerrar sesión","header.searchPlaceholder":"Buscar empleados, reportes, configuraciones...","header.mobileSearchPlaceholder":"Busca lo que necesites","header.menuAria":"Menú","header.notificationsAria":"Notificaciones","header.profileAria":"Perfil de usuario","header.coreLabel":"Core","header.greeting":"Hola, {{name}}","card.empty.title":"UPS...","card.empty.description":"Parece que esta tarjeta no contiene información.","overview.completedTasks":"Tareas completadas","overview.taskCompleted":"Completado","preferences.lastUpdateLabel":"Última actualización:","preferences.lastUpdateText":"hace 2 horas","preferences.languageLabel":"Idioma (predeterminado)","preferences.timezoneLabel":"Zona horaria","preferences.placeholder.selectLanguage":"Seleccionar idioma","preferences.placeholder.selectTimezone":"Seleccionar zona horaria","preferences.locale.esAR":"Español","preferences.locale.enUS":"English","empresa.table.header.tradeName":"Nombre comercial","empresa.table.header.country":"País","empresa.table.header.status":"Estado","empresa.table.header.activity":"Actividad","empresa.table.header.actions":"Acciones","empresa.table.searchPlaceholder":"Buscar empresas","empresa.form.title.create":"NUEVA EMPRESA","empresa.form.title.edit":"EMPRESA","empresa.form.status.aria":"Estado: {{status}}. Clic para cambiar","empresa.form.status.active":"Activo","empresa.form.status.draft":"Borrador","empresa.form.tradeName.label":"Nombre de fantasía","empresa.form.tradeName.placeholder":"Ej. Nucleus S.A.","empresa.form.identificationType.label":"Tipo de identificación","empresa.form.taxId.label":"ID tributario","empresa.form.taxId.placeholder":"Identificación tributaria de su país","empresa.form.legalName.label":"Razón social","empresa.form.legalName.placeholder":"Ej. Nucleus Corporate Group","empresa.form.country.label":"País","empresa.form.brandCurrent.title":"Marca actual","empresa.form.uploadImage":"Subir imagen","empresa.form.discard":"Descartar","empresa.form.save":"Guardar","empresa.form.logoError.title":"La imagen seleccionada, no cumple las especificaciones.","empresa.form.logoError.subtitle":"Inténtelo nuevamente.","chat.typeMessage":"Escribe un mensaje...","chat.send":"Enviar","chat.user":"Usuario","chat.ai":"Asistente IA","chat.loading":"Escribiendo...","chat.empty":"No hay mensajes aún. Comienza la conversación.","chat.placeholder":"Escribe tu mensaje aquí...","alert.success":"Éxito","alert.error":"Error","alert.warning":"Advertencia","alert.info":"Información","errors.invalidCredentials":"Correo o contraseña incorrectos.","errors.tryAgain":"Intentá nuevamente.","form.tryAgain":"Por favor, intentá nuevamente.","form.loggingIn":"Ingresando...","point.header.searchPlaceholder":"Buscar empleados, reportes, configuraciones...","point.header.titleShort":"Point","point.header.greetingPrefix":"¡Hola, ","point.header.greetingSuffix":"!","point.sidebar.home":"Inicio","point.sidebar.brandTitleMobile":"Point","point.sidebar.item.home":"Inicio","point.sidebar.section.people":"PERSONAS","point.sidebar.section.talent":"TALENTO","point.sidebar.item.employees":"Empleados","point.sidebar.item.organization":"Organización","point.sidebar.item.recruitment":"Reclutamiento","point.sidebar.item.development":"Desarrollo","point.sidebar.alt.headerLogo":"Logo del encabezado del menú","point.sidebar.alt.companyLogo":"Logo de la empresa","point.sidebar.aria.toggleMenu":"Abrir menú","point.sidebar.aria.closeMenu":"Cerrar menú","point.nav.home":"Inicio","point.nav.docs":"Docs","point.nav.team":"Equipo","point.nav.profile":"Mi perfil","point.modalInformativo.title":"Información","point.modalInformativo.description":"Acción realizada correctamente.","point.modalInformativo.buttonLabel":"Aceptar","point.modalInformativo.passwordSuccess.title":"Contraseña actualizada","point.modalInformativo.passwordSuccess.description":"Tu contraseña fue cambiada correctamente. Usá la nueva contraseña la próxima vez que inicies sesión.","point.modalInformativo.passwordSuccess.buttonLabel":"Volver a Configuración","point.modalInformativo.passwordError.title":"No se pudo actualizar","point.modalInformativo.passwordError.description":"Ocurrió un error al intentar cambiar la contraseña. Intentá de nuevo.","point.modalInformativo.passwordError.buttonLabel":"Entendido","point.cuenta.title":"Cuenta","point.cuenta.userLabel":"Usuario","point.cuenta.emailLabel":"Email","point.cuenta.changePassword":"Cambiar contraseña","point.organizacion.title":"Organización","point.organizacion.companyLabel":"Empresa","point.titulo.brand":"HEXA Point","home.quickActions":"Acciones rápidas","point.preferencias.title":"Preferencias"}},"pt-BR":{translation:{"common.save":"Salvar","common.cancel":"Cancelar","common.delete":"Excluir","common.edit":"Editar","common.search":"Buscar","common.loading":"Carregando...","common.submit":"Enviar","common.back":"Voltar","common.next":"Próximo","common.previous":"Anterior","common.showPassword":"Mostrar senha","common.hidePassword":"Ocultar senha","nav.home":"Início","nav.dashboard":"Painel","nav.profile":"Perfil","nav.settings":"Configurações","nav.logout":"Sair","saludo.hola":"Olá","saludo.greetingPrefix":"¡","saludo.greetingSuffix":"!","sidebar.homeLabel":"Início","sidebar.settingsLabel":"Configurações","form.email":"E-mail","form.password":"Senha","form.confirmPassword":"Confirmar senha","form.currentPassword":"Senha atual","form.newPassword":"Nova senha","form.rememberMe":"Lembrar-me","form.login":"Entrar","form.changePassword":"Alterar Senha","form.forgotPassword":"Esqueceu sua senha?","placeholder.email":"Digite seu e-mail","placeholder.password":"Digite sua senha","placeholder.currentPassword":"Digite sua senha atual","placeholder.search":"Buscar...","placeholder.select":"Selecione uma opção","validation.required":"{{field}} é obrigatório","validation.passwordMinLength":"A senha deve ter pelo menos {{min}} caracteres","validation.confirmPasswordRequired":"Por favor confirme sua senha","validation.passwordsDoNotMatch":"As senhas não coincidem","changePassword.success":"Senha alterada com sucesso!","changePassword.helper.minLength":"Deve ter pelo menos {{min}} caracteres","changePassword.repeatPassword":"Repetir senha","table.actions":"Ações","table.noData":"Nenhum dado disponível","table.loading":"Carregando dados...","table.id":"ID","table.name":"Nome","table.email":"E-mail","table.role":"Função","table.status":"Status","table.date":"Data","table.edit":"Editar","table.delete":"Excluir","table.view":"Ver","table.rowsPerPage":"Linhas por página","table.density":"Densidade","table.densityLabel":"Densidade","table.densityCompact":"Compacta","table.densityStandard":"Padrão","table.densityComfortable":"Confortável","table.filters":"Filtros","table.filtersLabel":"Mostrar filtros","table.filtersTooltipHide":"Ocultar filtros","table.filtersTooltipShow":"Mostrar filtros","table.export":"Exportar","table.exportLabel":"Exportar","table.exportCSV":"Baixar como CSV","table.exportPrint":"Imprimir","table.columns":"Colunas","table.columnsLabel":"Selecionar colunas","table.filterPanelAddFilter":"Adicionar filtro","table.filterPanelDeleteIconLabel":"Excluir","table.filterPanelOperators":"Operadores","table.filterPanelOperatorAnd":"E","table.filterPanelOperatorOr":"OU","table.filterPanelColumns":"Colunas","table.filterPanelInputLabel":"Valor","table.filterPanelInputPlaceholder":"Valor do filtro","table.noResults":"Nenhum resultado encontrado","table.errorOverlayDefaultLabel":"Ocorreu um erro","table.recordsPrefix":"Registros:","table.recordsRangeTo":"a","table.pagePrefix":"Página","table.of":"de","table.recordsPorPaginaInputAria":"Quantos registros exibir por página (número)","table.prevPageAria":"Página anterior","table.nextPageAria":"Página seguinte","table.actionsAria":"Ações","table.searchPlaceholder":"Buscar em 'Usuários'","profile.menu.profile":"Meu perfil","profile.menu.settings":"Configurações","profile.menu.help":"Central de ajuda","profile.menu.logout":"Sair","header.searchPlaceholder":"Buscar colaboradores, relatórios, configurações...","header.mobileSearchPlaceholder":"Busque o que precisar","header.menuAria":"Menu","header.notificationsAria":"Notificações","header.profileAria":"Perfil do usuário","header.coreLabel":"Core","header.greeting":"Olá, {{name}}","card.empty.title":"OPS...","card.empty.description":"Parece que este cartão não contém informações.","overview.completedTasks":"Tarefas concluídas","overview.taskCompleted":"Concluído","preferences.lastUpdateLabel":"Última atualização:","preferences.lastUpdateText":"há 2 horas","preferences.languageLabel":"Idioma (padrão)","preferences.timezoneLabel":"Fuso horário","preferences.placeholder.selectLanguage":"Selecionar idioma","preferences.placeholder.selectTimezone":"Selecionar fuso horário","preferences.locale.esAR":"Espanhol","preferences.locale.enUS":"English","empresa.table.header.tradeName":"Nome comercial","empresa.table.header.country":"País","empresa.table.header.status":"Estado","empresa.table.header.activity":"Atividade","empresa.table.header.actions":"Ações","empresa.table.searchPlaceholder":"Buscar empresas","empresa.form.title.create":"NOVA EMPRESA","empresa.form.title.edit":"EMPRESA","empresa.form.status.aria":"Status: {{status}}. Clique para alterar","empresa.form.status.active":"Ativa","empresa.form.status.draft":"Rascunho","empresa.form.tradeName.label":"Nome fantasia","empresa.form.tradeName.placeholder":"Ex. Nucleus S.A.","empresa.form.identificationType.label":"Tipo de identificação","empresa.form.taxId.label":"ID fiscal","empresa.form.taxId.placeholder":"Identificação tributária do seu país","empresa.form.legalName.label":"Razão social","empresa.form.legalName.placeholder":"Ex. Nucleus Corporate Group","empresa.form.country.label":"País","empresa.form.brandCurrent.title":"Marca atual","empresa.form.uploadImage":"Enviar imagem","empresa.form.discard":"Descartar","empresa.form.save":"Salvar","empresa.form.logoError.title":"A imagem selecionada não atende às especificações.","empresa.form.logoError.subtitle":"Tente novamente.","chat.typeMessage":"Digite uma mensagem...","chat.send":"Enviar","chat.user":"Usuário","chat.ai":"Assistente IA","chat.loading":"Digitando...","chat.empty":"Ainda não há mensagens. Comece a conversa.","chat.placeholder":"Digite sua mensagem aqui...","alert.success":"Sucesso","alert.error":"Erro","alert.warning":"Aviso","alert.info":"Informação","errors.invalidCredentials":"E-mail ou senha incorretos.","errors.tryAgain":"Tente novamente.","form.tryAgain":"Por favor, tente novamente.","form.loggingIn":"Entrando...","point.header.searchPlaceholder":"Buscar colaboradores, relatórios, configurações...","point.header.titleShort":"Point","point.header.greetingPrefix":"Olá, ","point.header.greetingSuffix":"!","point.sidebar.home":"Início","point.sidebar.brandTitleMobile":"Point","point.sidebar.item.home":"Início","point.sidebar.section.people":"PESSOAS","point.sidebar.section.talent":"TALENTO","point.sidebar.item.employees":"Colaboradores","point.sidebar.item.organization":"Organização","point.sidebar.item.recruitment":"Recrutamento","point.sidebar.item.development":"Desenvolvimento","point.sidebar.alt.headerLogo":"Logo do cabeçalho do menu","point.sidebar.alt.companyLogo":"Logo da empresa","point.sidebar.aria.toggleMenu":"Abrir menu","point.sidebar.aria.closeMenu":"Fechar menu","point.nav.home":"Início","point.nav.docs":"Docs","point.nav.team":"Equipe","point.nav.profile":"Meu perfil","point.modalInformativo.title":"Informação","point.modalInformativo.description":"Ação realizada com sucesso.","point.modalInformativo.buttonLabel":"Aceitar","point.modalInformativo.passwordSuccess.title":"Senha atualizada","point.modalInformativo.passwordSuccess.description":"Sua senha foi alterada com sucesso. Use a nova senha na próxima vez que fizer login.","point.modalInformativo.passwordSuccess.buttonLabel":"Voltar para Configurações","point.modalInformativo.passwordError.title":"Não foi possível atualizar","point.modalInformativo.passwordError.description":"Ocorreu um erro ao tentar alterar a senha. Tente novamente.","point.modalInformativo.passwordError.buttonLabel":"Entendi","point.cuenta.title":"Conta","point.cuenta.userLabel":"Usuário","point.cuenta.emailLabel":"E-mail","point.cuenta.changePassword":"Alterar senha","point.organizacion.title":"Organização","point.organizacion.companyLabel":"Empresa","point.titulo.brand":"HEXA Point","home.quickActions":"Acciones rápidas","point.preferencias.title":"Preferências"}},"en-US":{translation:{"common.save":"Save","common.cancel":"Cancel","common.delete":"Delete","common.edit":"Edit","common.search":"Search","common.loading":"Loading...","common.submit":"Submit","common.back":"Back","common.next":"Next","common.previous":"Previous","common.showPassword":"Show password","common.hidePassword":"Hide password","nav.home":"Home","nav.dashboard":"Dashboard","nav.profile":"Profile","nav.settings":"Settings","nav.logout":"Log out","sidebar.homeLabel":"Home","sidebar.settingsLabel":"Settings","saludo.hola":"Hello","saludo.greetingPrefix":"","saludo.greetingSuffix":"!","header.menuAria":"Menu","header.notificationsAria":"Notifications","header.profileAria":"User profile","form.email":"Email","form.password":"Password","form.confirmPassword":"Confirm password","form.currentPassword":"Current password","form.newPassword":"New password","form.rememberMe":"Remember me","form.login":"Sign in","form.changePassword":"Change password","form.forgotPassword":"Forgot your password?","placeholder.email":"Enter your email","placeholder.password":"Enter your password","placeholder.currentPassword":"Enter your current password","placeholder.search":"Search...","placeholder.select":"Select an option","validation.required":"{{field}} is required","validation.passwordMinLength":"Password must be at least {{min}} characters","validation.confirmPasswordRequired":"Please confirm your password","validation.passwordsDoNotMatch":"Passwords do not match","changePassword.success":"Password changed successfully!","changePassword.helper.minLength":"Must be at least {{min}} characters","changePassword.repeatPassword":"Repeat password","preferences.lastUpdateLabel":"Last update:","preferences.lastUpdateText":"2 hours ago","preferences.languageLabel":"Language (default)","preferences.timezoneLabel":"Time zone","preferences.placeholder.selectLanguage":"Select language","preferences.placeholder.selectTimezone":"Select time zone","preferences.locale.esAR":"Spanish","preferences.locale.enUS":"English","point.header.searchPlaceholder":"Search employees, reports, settings...","point.header.titleShort":"Point","point.header.greetingPrefix":"Hello, ","point.header.greetingSuffix":"!","point.sidebar.home":"Home","point.sidebar.brandTitleMobile":"Point","point.sidebar.item.home":"Home","point.sidebar.section.people":"PEOPLE","point.sidebar.section.talent":"TALENT","point.sidebar.item.employees":"Employees","point.sidebar.item.organization":"Organization","point.sidebar.item.recruitment":"Recruitment","point.sidebar.item.development":"Development","point.sidebar.alt.headerLogo":"Menu header logo","point.sidebar.alt.companyLogo":"Company logo","point.sidebar.aria.toggleMenu":"Open menu","point.sidebar.aria.closeMenu":"Close menu","point.nav.home":"Home","point.nav.docs":"Docs","point.nav.team":"Team","point.nav.profile":"My profile","point.modalInformativo.title":"Information","point.modalInformativo.description":"Action completed successfully.","point.modalInformativo.buttonLabel":"OK","point.modalInformativo.passwordSuccess.title":"Password updated","point.modalInformativo.passwordSuccess.description":"Your password was changed successfully. Use the new password the next time you sign in.","point.modalInformativo.passwordSuccess.buttonLabel":"Back to Settings","point.modalInformativo.passwordError.title":"Could not update","point.modalInformativo.passwordError.description":"An error occurred while trying to change the password. Please try again.","point.modalInformativo.passwordError.buttonLabel":"Got it","point.cuenta.title":"Account","point.cuenta.userLabel":"User","point.cuenta.emailLabel":"Email","point.cuenta.changePassword":"Change password","point.organizacion.title":"Organization","point.organizacion.companyLabel":"Company","point.titulo.brand":"HEXA Point","home.quickActions":"Quick actions","point.preferencias.title":"Preferences"}}};ir.use(Ke.initReactI18next).init({resources:Xae,lng:Uc()||"es-AR",fallbackLng:"es-AR",supportedLngs:["es-AR","pt-BR","en-US"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});const qae=({loading:a=!1,title:e,titleStyle:t,titleClassName:n="",labelText:o,labelTextStyle:l,labelTextClassName:s="",builtinLanguageSelect:c=!0,syncLanguageWithI18n:d=!0,onLanguageChange:h,selectOptions:u=[],selectValue:f="",selectOnChange:m,selectPlaceholder:p,selectDisabled:w=!1,selectClassName:g="",selectStyle:b,labelZonaHoraria:v,labelZonaHorariaStyle:x,labelZonaHorariaClassName:y="",zonaHorariaOptions:R=[],zonaHorariaValue:S="",zonaHorariaOnChange:_,zonaHorariaPlaceholder:C,zonaHorariaDisabled:A=!1,zonaHorariaClassName:M="",zonaHorariaStyle:L,showUltimaActualizacion:j=!0,actualizacionLabel:$,actualizacionLabelStyle:Z,actualizacionLabelClassName:D="",actualizacionText:k,actualizacionTextStyle:O,actualizacionTextClassName:T="",guardarButtonText:V,guardarButtonDisabled:z=!0,guardarButtonOnClick:G,guardarButtonStyle:ae,guardarButtonClassName:Q="",containerStyle:K,containerClassName:q="",titleContainerStyle:ne,titleContainerClassName:X="",contentContainerStyle:ee,contentContainerClassName:le="",breakpointNarrowPx:U=1023,className:fe="",...be})=>{const{t:J,i18n:he}=Ke.useTranslation(),[de,H]=E.useState(()=>typeof window<"u"?window.innerWidth<=U:!1),Y=e??J("point.preferencias.title"),ue=o??J("preferences.languageLabel"),me=v??J("preferences.timezoneLabel"),Ae=V??J("common.save"),ye=p??J("preferences.placeholder.selectLanguage"),Ie=C??J("preferences.placeholder.selectTimezone"),Ee=$??J("preferences.lastUpdateLabel"),Ye=k??J("preferences.lastUpdateText"),Ce=E.useMemo(()=>[{value:"es-AR",label:J("preferences.locale.esAR")},{value:"en-US",label:J("preferences.locale.enUS")}],[J]),Se=c&&(!u||u.length===0),it=Se?Ce:u,rt=E.useMemo(()=>{if(!Se)return f??"";if(f!==void 0&&f!=="")return f;const te=he.language;return te==="es-AR"||te==="en-US"?te:"es-AR"},[Se,f,he.language]),ht=E.useCallback(te=>{const N=te.target.value;d&&(N==="es-AR"||N==="en-US")&&(Gc(N),h?.(N)),m&&m(te)},[d,h,m]),ce=()=>{H(window.innerWidth<=U)};return E.useLayoutEffect(()=>{ce()},[U]),E.useEffect(()=>(window.addEventListener("resize",ce),()=>window.removeEventListener("resize",ce)),[U]),i.jsxs(En,{className:`anima-preferencias__container ${q} ${fe}`,style:{...K||{}},...be,children:[i.jsx("div",{className:`anima-preferencias__title-container ${X}`,style:{width:"100%",...de?{minHeight:0}:{minHeight:"58px"},paddingTop:"24px",paddingRight:de?"16px":"24px",paddingBottom:"4px",paddingLeft:de?"16px":"24px",gap:"8px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",...ne||{}},children:i.jsx("div",{style:{width:"100%",minHeight:"30px",opacity:1,boxSizing:"border-box"},children:a?i.jsx(se,{variant:"rectangular",height:24,width:"70%"}):Y?i.jsx(B,{variant:"body-md",className:n,style:{fontFamily:"IBM Plex Sans, sans-serif",fontWeight:400,fontStyle:"normal",fontSize:"20px",lineHeight:"30px",letterSpacing:"0%",verticalAlign:"middle",color:"var(--color-cyan-19)",margin:0,...t||{}},children:Y}):null})}),i.jsx("div",{className:`anima-preferencias__content ${le}`,style:{width:"100%",flex:1,opacity:1,boxSizing:"border-box",paddingTop:"16px",paddingRight:de?"16px":"24px",paddingBottom:"24px",paddingLeft:de?"16px":"24px",display:"flex",flexDirection:"column",gap:"24px",...ee||{}},children:a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:10},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:42,width:"100%"})]}),i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:10},children:[i.jsx(se,{variant:"rectangular",height:21,width:120}),i.jsx(se,{variant:"rectangular",height:42,width:"100%"})]}),j?de?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:"auto"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:21,width:100,style:{marginLeft:24}})]}),i.jsx(se,{variant:"rectangular",height:48,width:"100%",style:{borderRadius:8}})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:20,marginTop:"auto"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.jsx(se,{variant:"rectangular",height:21,width:180}),i.jsx(se,{variant:"rectangular",height:21,width:100,style:{marginLeft:24}})]}),i.jsx(se,{variant:"rectangular",height:48,width:91,style:{borderRadius:8}})]}):i.jsx("div",{style:{marginTop:"auto"},children:i.jsx(se,{variant:"rectangular",height:48,width:de?"100%":91,style:{borderRadius:8}})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{width:"100%",...de?{minHeight:0,paddingBottom:0}:{},gap:"24px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:[i.jsx("div",{style:{width:"100%",...de?{minHeight:0}:{minHeight:"71px"},gap:"10px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:i.jsx(ia,{label:ue,labelStyle:l,labelClassName:s,options:it,value:rt,onChange:ht,placeholder:ye,disabled:w,className:g,style:b})}),i.jsx("div",{style:{width:"100%",...de?{minHeight:0}:{minHeight:"71px"},gap:"10px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:i.jsx(ia,{label:me,labelStyle:x,labelClassName:y,options:R,value:S,onChange:_,placeholder:Ie,disabled:A,className:M,style:L})})]}),j?de?i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"16px",boxSizing:"border-box",marginTop:"auto"},children:[i.jsx(Pn,{variant:"narrow",render:"singleLine",label:Ee,text:Ye,labelClassName:D,labelStyle:Z,textClassName:T,textStyle:O}),i.jsx(Ze,{text:Ae,disabled:z,onClick:G,fullWidth:!0,className:Q,style:ae})]}):i.jsxs("div",{style:{width:"100%",minHeight:"69px",marginTop:"auto",gap:"20px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",flexWrap:"nowrap"},children:[i.jsx("div",{style:{flex:"1 1 auto",minWidth:0,paddingTop:"8px",paddingRight:"12px",paddingBottom:"8px",paddingLeft:"12px",gap:"4px",opacity:1,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"},children:i.jsx(Pn,{variant:"wide",render:"singleLine",label:Ee,text:Ye,labelClassName:D,labelStyle:Z,textClassName:T,textStyle:O})}),i.jsx(Ze,{text:Ae,disabled:z,onClick:G,fullWidth:!1,className:Q,style:ae})]}):i.jsx("div",{style:{width:"100%",marginTop:"auto",display:"flex",justifyContent:de?"stretch":"flex-end"},children:i.jsx(Ze,{text:Ae,disabled:z,onClick:G,fullWidth:de,className:Q,style:ae})})]})})]})},rn=({label:a,placeholder:e,value:t,onChange:n,error:o,required:l=!1,hideRequiredAsterisk:s=!1,disabled:c=!1,variant:d,themeColor:h,className:u="",inputClassName:f="",labelClassName:m="",labelStyle:p,style:w,clearPlaceholderOnFocus:g=!1,focusBorderOnFocus:b=!1,focusBorderColor:v="#38656D",onFocus:x,onBlur:y,type:R,...S})=>{const{t:_}=Ke.useTranslation(),[C,A]=E.useState(!1),[M,L]=E.useState(!1),j=d==="hexa-login",$=T=>{L(!0),typeof x=="function"&&x(T)},Z=T=>{L(!1),typeof y=="function"&&y(T)},D=b?"focus:outline-none focus:ring-0 focus:ring-transparent":"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",O=`
923
923
  ${j?`w-full px-3 py-2 pr-10 border rounded-lg ${D} text-sm text-gray-900`:`w-full px-3 py-2 pr-10 border rounded-lg ${D} disabled:bg-gray-100 disabled:cursor-not-allowed`}
@@ -1681,7 +1681,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
1681
1681
  `)}`,this.#s();const f=new Range;let m=Math.sumPrecise(h.map(p=>p.length));for(const{firstChild:p}of this.editorDiv.childNodes)if(p.nodeType===Node.TEXT_NODE){const w=p.nodeValue.length;if(m<=w){f.setStart(p,m),f.setEnd(p,m);break}m-=w}l.removeAllRanges(),l.addRange(f)}#s(){if(this.editorDiv.replaceChildren(),!!this.#e)for(const e of this.#e.split(`
1682
1682
  `)){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}#u(){return this.#e.replaceAll(" "," ")}static#h(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}getPDFRect(){const e=Qt._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,t,n){let o=null;if(e instanceof Kd){const{data:{defaultAppearanceData:{fontSize:s,fontColor:c},rect:d,rotation:h,id:u,popupRef:f,richText:m,contentsObj:p,creationDate:w,modificationDate:g},textContent:b,textPosition:v,parent:{page:{pageNumber:x}}}=e;if(!b||b.length===0)return null;o=e={annotationType:Je.FREETEXT,color:Array.from(c),fontSize:s,value:b.join(`
1683
1683
  `),position:v,pageIndex:x-1,rect:d.slice(0),rotation:h,annotationElementId:u,id:u,deleted:!1,popupRef:f,comment:p?.str||null,richText:m,creationDate:w,modificationDate:g}}const l=await super.deserialize(e,t,n);return l.#a=e.fontSize,l.color=je.makeHexColor(...e.color),l.#e=Qt.#h(e.value),l._initialData=o,e.comment&&l.setCommentData(e),l}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=Te._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:t,fontSize:this.#a,value:this.#u()});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!this.#f(n)?null:(n.id=this.annotationElementId,n)}#f(e){const{value:t,fontSize:n,color:o,pageIndex:l}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((s,c)=>s!==o[c])||e.pageIndex!==l}renderAnnotationElement(e){const t=super.renderAnnotationElement(e);if(!t)return null;const{style:n}=t;n.fontSize=`calc(${this.#a}px * var(--total-scale-factor))`,n.color=this.color,t.replaceChildren();for(const o of this.#e.split(`
1684
- `)){const l=document.createElement("div");l.append(o?document.createTextNode(o):document.createElement("br")),t.append(l)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class Me{static PRECISION=1e-4;toSVGPath(){Mt("Abstract method `toSVGPath` must be implemented.")}get box(){Mt("Abstract getter `box` must be implemented.")}serialize(e,t){Mt("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,o,l,s){s||=new Float32Array(e.length);for(let c=0,d=e.length;c<d;c+=2)s[c]=t+e[c]*o,s[c+1]=n+e[c+1]*l;return s}static _rescaleAndSwap(e,t,n,o,l,s){s||=new Float32Array(e.length);for(let c=0,d=e.length;c<d;c+=2)s[c]=t+e[c+1]*o,s[c+1]=n+e[c]*l;return s}static _translate(e,t,n,o){o||=new Float32Array(e.length);for(let l=0,s=e.length;l<s;l+=2)o[l]=t+e[l],o[l+1]=n+e[l+1];return o}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,o,l){switch(l){case 90:return[1-t/n,e/o];case 180:return[1-e/n,1-t/o];case 270:return[t/n,1-e/o];default:return[e/n,t/o]}}static _normalizePagePoint(e,t,n){switch(n){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,n,o,l,s){return[(e+5*n)/6,(t+5*o)/6,(5*n+l)/6,(5*o+s)/6,(n+l)/2,(o+s)/2]}}class On{#e;#t=[];#n;#a;#i=[];#r=new Float32Array(18);#o;#l;#c;#s;#u;#h;#f=[];static#g=8;static#m=2;static#d=On.#g+On.#m;constructor({x:e,y:t},n,o,l,s,c=0){this.#e=n,this.#h=l*o,this.#a=s,this.#r.set([NaN,NaN,NaN,NaN,e,t],6),this.#n=c,this.#s=On.#g*o,this.#c=On.#d*o,this.#u=o,this.#f.push(e,t)}isEmpty(){return isNaN(this.#r[8])}#p(){const e=this.#r.subarray(4,6),t=this.#r.subarray(16,18),[n,o,l,s]=this.#e;return[(this.#o+(e[0]-t[0])/2-n)/l,(this.#l+(e[1]-t[1])/2-o)/s,(this.#o+(t[0]-e[0])/2-n)/l,(this.#l+(t[1]-e[1])/2-o)/s]}add({x:e,y:t}){this.#o=e,this.#l=t;const[n,o,l,s]=this.#e;let[c,d,h,u]=this.#r.subarray(8,12);const f=e-h,m=t-u,p=Math.hypot(f,m);if(p<this.#c)return!1;const w=p-this.#s,g=w/p,b=g*f,v=g*m;let x=c,y=d;c=h,d=u,h+=b,u+=v,this.#f?.push(e,t);const R=-v/w,S=b/w,_=R*this.#h,C=S*this.#h;return this.#r.set(this.#r.subarray(2,8),0),this.#r.set([h+_,u+C],4),this.#r.set(this.#r.subarray(14,18),12),this.#r.set([h-_,u-C],16),isNaN(this.#r[6])?(this.#i.length===0&&(this.#r.set([c+_,d+C],2),this.#i.push(NaN,NaN,NaN,NaN,(c+_-n)/l,(d+C-o)/s),this.#r.set([c-_,d-C],14),this.#t.push(NaN,NaN,NaN,NaN,(c-_-n)/l,(d-C-o)/s)),this.#r.set([x,y,c,d,h,u],6),!this.isEmpty()):(this.#r.set([x,y,c,d,h,u],6),Math.abs(Math.atan2(y-d,x-c)-Math.atan2(v,b))<Math.PI/2?([c,d,h,u]=this.#r.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((c+h)/2-n)/l,((d+u)/2-o)/s),[c,d,x,y]=this.#r.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((x+c)/2-n)/l,((y+d)/2-o)/s),!0):([x,y,c,d,h,u]=this.#r.subarray(0,6),this.#i.push(((x+5*c)/6-n)/l,((y+5*d)/6-o)/s,((5*c+h)/6-n)/l,((5*d+u)/6-o)/s,((c+h)/2-n)/l,((d+u)/2-o)/s),[h,u,c,d,x,y]=this.#r.subarray(12,18),this.#t.push(((x+5*c)/6-n)/l,((y+5*d)/6-o)/s,((5*c+h)/6-n)/l,((5*d+u)/6-o)/s,((c+h)/2-n)/l,((d+u)/2-o)/s),!0))}toSVGPath(){if(this.isEmpty())return"";const e=this.#i,t=this.#t;if(isNaN(this.#r[6])&&!this.isEmpty())return this.#w();const n=[];n.push(`M${e[4]} ${e[5]}`);for(let o=6;o<e.length;o+=6)isNaN(e[o])?n.push(`L${e[o+4]} ${e[o+5]}`):n.push(`C${e[o]} ${e[o+1]} ${e[o+2]} ${e[o+3]} ${e[o+4]} ${e[o+5]}`);this.#v(n);for(let o=t.length-6;o>=6;o-=6)isNaN(t[o])?n.push(`L${t[o+4]} ${t[o+5]}`):n.push(`C${t[o]} ${t[o+1]} ${t[o+2]} ${t[o+3]} ${t[o+4]} ${t[o+5]}`);return this.#b(n),n.join(" ")}#w(){const[e,t,n,o]=this.#e,[l,s,c,d]=this.#p();return`M${(this.#r[2]-e)/n} ${(this.#r[3]-t)/o} L${(this.#r[4]-e)/n} ${(this.#r[5]-t)/o} L${l} ${s} L${c} ${d} L${(this.#r[16]-e)/n} ${(this.#r[17]-t)/o} L${(this.#r[14]-e)/n} ${(this.#r[15]-t)/o} Z`}#b(e){const t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#v(e){const[t,n,o,l]=this.#e,s=this.#r.subarray(4,6),c=this.#r.subarray(16,18),[d,h,u,f]=this.#p();e.push(`L${(s[0]-t)/o} ${(s[1]-n)/l} L${d} ${h} L${u} ${f} L${(c[0]-t)/o} ${(c[1]-n)/l}`)}newFreeDrawOutline(e,t,n,o,l,s){return new a2(e,t,n,o,l,s)}getOutlines(){const e=this.#i,t=this.#t,n=this.#r,[o,l,s,c]=this.#e,d=new Float32Array((this.#f?.length??0)+2);for(let f=0,m=d.length-2;f<m;f+=2)d[f]=(this.#f[f]-o)/s,d[f+1]=(this.#f[f+1]-l)/c;if(d[d.length-2]=(this.#o-o)/s,d[d.length-1]=(this.#l-l)/c,isNaN(n[6])&&!this.isEmpty())return this.#C(d);const h=new Float32Array(this.#i.length+24+this.#t.length);let u=e.length;for(let f=0;f<u;f+=2){if(isNaN(e[f])){h[f]=h[f+1]=NaN;continue}h[f]=e[f],h[f+1]=e[f+1]}u=this.#x(h,u);for(let f=t.length-6;f>=6;f-=6)for(let m=0;m<6;m+=2){if(isNaN(t[f+m])){h[u]=h[u+1]=NaN,u+=2;continue}h[u]=t[f+m],h[u+1]=t[f+m+1],u+=2}return this.#R(h,u),this.newFreeDrawOutline(h,d,this.#e,this.#u,this.#n,this.#a)}#C(e){const t=this.#r,[n,o,l,s]=this.#e,[c,d,h,u]=this.#p(),f=new Float32Array(36);return f.set([NaN,NaN,NaN,NaN,(t[2]-n)/l,(t[3]-o)/s,NaN,NaN,NaN,NaN,(t[4]-n)/l,(t[5]-o)/s,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,h,u,NaN,NaN,NaN,NaN,(t[16]-n)/l,(t[17]-o)/s,NaN,NaN,NaN,NaN,(t[14]-n)/l,(t[15]-o)/s],0),this.newFreeDrawOutline(f,e,this.#e,this.#u,this.#n,this.#a)}#R(e,t){const n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#x(e,t){const n=this.#r.subarray(4,6),o=this.#r.subarray(16,18),[l,s,c,d]=this.#e,[h,u,f,m]=this.#p();return e.set([NaN,NaN,NaN,NaN,(n[0]-l)/c,(n[1]-s)/d,NaN,NaN,NaN,NaN,h,u,NaN,NaN,NaN,NaN,f,m,NaN,NaN,NaN,NaN,(o[0]-l)/c,(o[1]-s)/d],t),t+=24}}class a2 extends Me{#e;#t=new Float32Array(4);#n;#a;#i;#r;#o;constructor(e,t,n,o,l,s){super(),this.#o=e,this.#i=t,this.#e=n,this.#r=o,this.#n=l,this.#a=s,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#l(s);const[c,d,h,u]=this.#t;for(let f=0,m=e.length;f<m;f+=2)e[f]=(e[f]-c)/h,e[f+1]=(e[f+1]-d)/u;for(let f=0,m=t.length;f<m;f+=2)t[f]=(t[f]-c)/h,t[f+1]=(t[f+1]-d)/u}toSVGPath(){const e=[`M${this.#o[4]} ${this.#o[5]}`];for(let t=6,n=this.#o.length;t<n;t+=6){if(isNaN(this.#o[t])){e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`);continue}e.push(`C${this.#o[t]} ${this.#o[t+1]} ${this.#o[t+2]} ${this.#o[t+3]} ${this.#o[t+4]} ${this.#o[t+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,t,n,o],l){const s=n-e,c=o-t;let d,h;switch(l){case 0:d=Me._rescale(this.#o,e,o,s,-c),h=Me._rescale(this.#i,e,o,s,-c);break;case 90:d=Me._rescaleAndSwap(this.#o,e,t,s,c),h=Me._rescaleAndSwap(this.#i,e,t,s,c);break;case 180:d=Me._rescale(this.#o,n,t,-s,c),h=Me._rescale(this.#i,n,t,-s,c);break;case 270:d=Me._rescaleAndSwap(this.#o,n,o,-s,-c),h=Me._rescaleAndSwap(this.#i,n,o,-s,-c);break}return{outline:Array.from(d),points:[Array.from(h)]}}#l(e){const t=this.#o;let n=t[4],o=t[5];const l=[n,o,n,o];let s=n,c=o,d=n,h=o;const u=e?Math.max:Math.min,f=new Float32Array(4);for(let p=6,w=t.length;p<w;p+=6){const g=t[p+4],b=t[p+5];isNaN(t[p])?(je.pointBoundingBox(g,b,l),c>b?(s=g,c=b):c===b&&(s=u(s,g)),h<b?(d=g,h=b):h===b&&(d=u(d,g))):(f[0]=f[1]=1/0,f[2]=f[3]=-1/0,je.bezierBoundingBox(n,o,...t.slice(p,p+6),f),je.rectBoundingBox(f[0],f[1],f[2],f[3],l),c>f[1]?(s=f[0],c=f[1]):c===f[1]&&(s=u(s,f[0])),h<f[3]?(d=f[2],h=f[3]):h===f[3]&&(d=u(d,f[2]))),n=g,o=b}const m=this.#t;m[0]=l[0]-this.#n,m[1]=l[1]-this.#n,m[2]=l[2]-l[0]+2*this.#n,m[3]=l[3]-l[1]+2*this.#n,this.firstPoint=[s,c],this.lastPoint=[d,h]}get box(){return this.#t}newOutliner(e,t,n,o,l,s=0){return new On(e,t,n,o,l,s)}getNewOutline(e,t){const[n,o,l,s]=this.#t,[c,d,h,u]=this.#e,f=l*h,m=s*u,p=n*h+c,w=o*u+d,g=this.newOutliner({x:this.#i[0]*f+p,y:this.#i[1]*m+w},this.#e,this.#r,e,this.#a,t??this.#n);for(let b=2;b<this.#i.length;b+=2)g.add({x:this.#i[b]*f+p,y:this.#i[b+1]*m+w});return g.getOutlines()}}class Z0{#e;#t;#n;#a=[];#i=[];constructor(e,t=0,n=0,o=!0){const l=[1/0,1/0,-1/0,-1/0],s=10**-4;for(const{x:g,y:b,width:v,height:x}of e){const y=Math.floor((g-t)/s)*s,R=Math.ceil((g+v+t)/s)*s,S=Math.floor((b-t)/s)*s,_=Math.ceil((b+x+t)/s)*s,C=[y,S,_,!0],A=[R,S,_,!1];this.#a.push(C,A),je.rectBoundingBox(y,S,R,_,l)}const c=l[2]-l[0]+2*n,d=l[3]-l[1]+2*n,h=l[0]-n,u=l[1]-n;let f=o?-1/0:1/0,m=1/0;const p=this.#a.at(o?-1:-2),w=[p[0],p[2]];for(const g of this.#a){const[b,v,x,y]=g;!y&&o?v<m?(m=v,f=b):v===m&&(f=Math.max(f,b)):y&&!o&&(v<m?(m=v,f=b):v===m&&(f=Math.min(f,b))),g[0]=(b-h)/c,g[1]=(v-u)/d,g[2]=(x-u)/d}this.#e=new Float32Array([h,u,c,d]),this.#t=[f,m],this.#n=w}getOutlines(){this.#a.sort((t,n)=>t[0]-n[0]||t[1]-n[1]||t[2]-n[2]);const e=[];for(const t of this.#a)t[3]?(e.push(...this.#s(t)),this.#l(t)):(this.#c(t),e.push(...this.#s(t)));return this.#r(e)}#r(e){const t=[],n=new Set;for(const s of e){const[c,d,h]=s;t.push([c,d,s],[c,h,s])}t.sort((s,c)=>s[1]-c[1]||s[0]-c[0]);for(let s=0,c=t.length;s<c;s+=2){const d=t[s][2],h=t[s+1][2];d.push(h),h.push(d),n.add(d),n.add(h)}const o=[];let l;for(;n.size>0;){const s=n.values().next().value;let[c,d,h,u,f]=s;n.delete(s);let m=c,p=d;for(l=[c,h],o.push(l);;){let w;if(n.has(u))w=u;else if(n.has(f))w=f;else break;n.delete(w),[c,d,h,u,f]=w,m!==c&&(l.push(m,p,c,p===d?d:h),m=c),p=p===d?h:d}l.push(m,p)}return new Joe(o,this.#e,this.#t,this.#n)}#o(e){const t=this.#i;let n=0,o=t.length-1;for(;n<=o;){const l=n+o>>1,s=t[l][0];if(s===e)return l;s<e?n=l+1:o=l-1}return o+1}#l([,e,t]){const n=this.#o(e);this.#i.splice(n,0,[e,t])}#c([,e,t]){const n=this.#o(e);for(let o=n;o<this.#i.length;o++){const[l,s]=this.#i[o];if(l!==e)break;if(l===e&&s===t){this.#i.splice(o,1);return}}for(let o=n-1;o>=0;o--){const[l,s]=this.#i[o];if(l!==e)break;if(l===e&&s===t){this.#i.splice(o,1);return}}}#s(e){const[t,n,o]=e,l=[[t,n,o]],s=this.#o(o);for(let c=0;c<s;c++){const[d,h]=this.#i[c];for(let u=0,f=l.length;u<f;u++){const[,m,p]=l[u];if(!(h<=m||p<=d)){if(m>=d){if(p>h)l[u][1]=h;else{if(f===1)return[];l.splice(u,1),u--,f--}continue}l[u][2]=d,p>h&&l.push([t,h,p])}}}return l}}class Joe extends Me{#e;#t;constructor(e,t,n,o){super(),this.#t=e,this.#e=t,this.firstPoint=n,this.lastPoint=o}toSVGPath(){const e=[];for(const t of this.#t){let[n,o]=t;e.push(`M${n} ${o}`);for(let l=2;l<t.length;l+=2){const s=t[l],c=t[l+1];s===n?(e.push(`V${c}`),o=c):c===o&&(e.push(`H${s}`),n=s)}e.push("Z")}return e.join(" ")}serialize([e,t,n,o],l){const s=[],c=n-e,d=o-t;for(const h of this.#t){const u=new Array(h.length);for(let f=0;f<h.length;f+=2)u[f]=e+h[f]*c,u[f+1]=o-h[f+1]*d;s.push(u)}return s}get box(){return this.#e}get classNamesForOutlining(){return["highlightOutline"]}}class P0 extends On{newFreeDrawOutline(e,t,n,o,l,s){return new Qoe(e,t,n,o,l,s)}}class Qoe extends a2{newOutliner(e,t,n,o,l,s=0){return new P0(e,t,n,o,l,s)}}class Yt extends Te{#e=null;#t=0;#n;#a=null;#i=null;#r=null;#o=null;#l=0;#c=null;#s=null;#u=null;#h=!1;#f=null;#g=null;#m=null;#d="";#p;#w="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=Je.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const e=Yt.prototype;return nt(this,"_keyboardManager",new vo([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"}),this.color=e.color||Yt._defaultColor,this.#p=e.thickness||Yt._defaultThickness,this.opacity=e.opacity||Yt._defaultOpacity,this.#n=e.boxes||null,this.#w=e.methodOfCreation||"",this.#d=e.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(this.#h=!0,this.#v(e),this.#E()):this.#n&&(this.#e=e.anchorNode,this.#t=e.anchorOffset,this.#o=e.focusNode,this.#l=e.focusOffset,this.#b(),this.#E(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:this.#h?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#p,methodOfCreation:this.#w}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#b(){const e=new Z0(this.#n,.001);this.#s=e.getOutlines(),[this.x,this.y,this.width,this.height]=this.#s.box;const t=new Z0(this.#n,.0025,.001,this._uiManager.direction==="ltr");this.#r=t.getOutlines();const{firstPoint:n}=this.#s;this.#f=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height];const{lastPoint:o}=this.#r;this.#g=[(o[0]-this.x)/this.width,(o[1]-this.y)/this.height]}#v({highlightOutlines:e,highlightId:t,clipPathId:n}){this.#s=e;const o=1.5;if(this.#r=e.getNewOutline(this.#p/2+o,.0025),t>=0)this.#u=t,this.#a=n,this.parent.drawLayer.finalizeDraw(t,{bbox:e.box,path:{d:e.toSVGPath()}}),this.#m=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#r.box,path:{d:this.#r.toSVGPath()}},!0);else if(this.parent){const f=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#u,{bbox:Yt.#A(this.#s.box,(f-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#m,{bbox:Yt.#A(this.#r.box,f),path:{d:this.#r.toSVGPath()}})}const[l,s,c,d]=e.box;switch(this.rotation){case 0:this.x=l,this.y=s,this.width=c,this.height=d;break;case 90:{const[f,m]=this.parentDimensions;this.x=s,this.y=1-l,this.width=c*m/f,this.height=d*f/m;break}case 180:this.x=1-l,this.y=1-s,this.width=c,this.height=d;break;case 270:{const[f,m]=this.parentDimensions;this.x=1-s,this.y=l,this.width=c*m/f,this.height=d*f/m;break}}const{firstPoint:h}=e;this.#f=[(h[0]-l)/c,(h[1]-s)/d];const{lastPoint:u}=this.#r;this.#g=[(u[0]-l)/c,(u[1]-s)/d]}static initialize(e,t){Te.initialize(e,t),Yt._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case dt.HIGHLIGHT_COLOR:Yt._defaultColor=t;break;case dt.HIGHLIGHT_THICKNESS:Yt._defaultThickness=t;break}}translateInPage(e,t){}get toolbarPosition(){return this.#g}get commentButtonPosition(){return this.#f}updateParams(e,t){switch(e){case dt.HIGHLIGHT_COLOR:this.#C(t);break;case dt.HIGHLIGHT_THICKNESS:this.#R(t);break}}static get defaultPropertiesToUpdate(){return[[dt.HIGHLIGHT_COLOR,Yt._defaultColor],[dt.HIGHLIGHT_THICKNESS,Yt._defaultThickness]]}get propertiesToUpdate(){return[[dt.HIGHLIGHT_COLOR,this.color||Yt._defaultColor],[dt.HIGHLIGHT_THICKNESS,this.#p||Yt._defaultThickness],[dt.HIGHLIGHT_FREE,this.#h]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#u,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#i?.updateColor(this.color),super.onUpdatedColor()}#C(e){const t=(l,s)=>{this.color=l,this.opacity=s,this.onUpdatedColor()},n=this.color,o=this.opacity;this.addCommands({cmd:t.bind(this,e,Yt._defaultOpacity),undo:t.bind(this,n,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:dt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)}#R(e){const t=this.#p,n=o=>{this.#p=o,this.#x(o)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:dt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#i=new Ea({editor:this})]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#j())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#j())}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this.#_(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#E(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#_():e&&(this.#E(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),t&&this.select()}#x(e){this.#h&&(this.#v({highlightOutlines:this.#s.getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))}#_(){this.#u===null||!this.parent||(this.parent.drawLayer.remove(this.#u),this.#u=null,this.parent.drawLayer.remove(this.#m),this.#m=null)}#E(e=this.parent){this.#u===null&&({id:this.#u,clipPathId:this.#a}=e.drawLayer.draw({bbox:this.#s.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#h},path:{d:this.#s.toSVGPath()}},!1,!0),this.#m=e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#h},bbox:this.#r.box,path:{d:this.#r.toSVGPath()}},this.#h),this.#c&&(this.#c.style.clipPath=this.#a))}static#A([e,t,n,o],l){switch(l){case 90:return[1-t-o,e,o,n];case 180:return[1-e-n,1-t-o,n,o];case 270:return[t,1-e-n,o,n]}return[e,t,n,o]}rotate(e){const{drawLayer:t}=this.parent;let n;this.#h?(e=(e-this.rotation+360)%360,n=Yt.#A(this.#s.box,e)):n=Yt.#A([this.x,this.y,this.width,this.height],e),t.updateProperties(this.#u,{bbox:n,root:{"data-main-rotation":e}}),t.updateProperties(this.#m,{bbox:Yt.#A(this.#r.box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();this.#d&&(e.setAttribute("aria-label",this.#d),e.setAttribute("role","mark")),this.#h?e.classList.add("free"):this.div.addEventListener("keydown",this.#L.bind(this),{signal:this._uiManager._signal});const t=this.#c=document.createElement("div");return e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#a,this.setDims(this.width,this.height),Fd(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1}})}#L(e){Yt._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#M(!0);break;case 1:case 3:this.#M(!1);break}}#M(e){if(!this.#e)return;const t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#o,this.#l)}select(){super.select(),this.#m&&this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#m&&(this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{selected:!1}}),this.#h||this.#M(!1))}get _mustFixPosition(){return!this.#h}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(this.#u,{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(this.#m,{rootClass:{hidden:!e}}))}#j(){return this.#h?this.rotation:0}#$(){if(this.#h)return null;const[e,t]=this.pageDimensions,[n,o]=this.pageTranslation,l=this.#n,s=new Float32Array(l.length*8);let c=0;for(const{x:d,y:h,width:u,height:f}of l){const m=d*e+n,p=(1-h)*t+o;s[c]=s[c+4]=m,s[c+1]=s[c+3]=p,s[c+2]=s[c+6]=m+u*e,s[c+5]=s[c+7]=p-f*t,c+=8}return s}#I(e){return this.#s.serialize(e,this.#j())}static startHighlighting(e,t,{target:n,x:o,y:l}){const{x:s,y:c,width:d,height:h}=n.getBoundingClientRect(),u=new AbortController,f=e.combinedSignal(u),m=p=>{u.abort(),this.#B(e,p)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",Wt,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Aa,{signal:f}),n.addEventListener("pointermove",this.#O.bind(this,e),{signal:f}),this._freeHighlight=new P0({x:o,y:l},[s,c,d,h],e.scale,this._defaultThickness/2,t,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static#O(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#B(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,n){let o=null;if(e instanceof Qd){const{data:{quadPoints:w,rect:g,rotation:b,id:v,color:x,opacity:y,popupRef:R,richText:S,contentsObj:_,creationDate:C,modificationDate:A},parent:{page:{pageNumber:M}}}=e;o=e={annotationType:Je.HIGHLIGHT,color:Array.from(x),opacity:y,quadPoints:w,boxes:null,pageIndex:M-1,rect:g.slice(0),rotation:b,annotationElementId:v,id:v,deleted:!1,popupRef:R,richText:S,comment:_?.str||null,creationDate:C,modificationDate:A}}else if(e instanceof Bl){const{data:{inkLists:w,rect:g,rotation:b,id:v,color:x,borderStyle:{rawWidth:y},popupRef:R,richText:S,contentsObj:_,creationDate:C,modificationDate:A},parent:{page:{pageNumber:M}}}=e;o=e={annotationType:Je.HIGHLIGHT,color:Array.from(x),thickness:y,inkLists:w,boxes:null,pageIndex:M-1,rect:g.slice(0),rotation:b,annotationElementId:v,id:v,deleted:!1,popupRef:R,richText:S,comment:_?.str||null,creationDate:C,modificationDate:A}}const{color:l,quadPoints:s,inkLists:c,opacity:d}=e,h=await super.deserialize(e,t,n);h.color=je.makeHexColor(...l),h.opacity=d||1,c&&(h.#p=e.thickness),h._initialData=o,e.comment&&h.setCommentData(e);const[u,f]=h.pageDimensions,[m,p]=h.pageTranslation;if(s){const w=h.#n=[];for(let g=0;g<s.length;g+=8)w.push({x:(s[g]-m)/u,y:1-(s[g+1]-p)/f,width:(s[g+2]-s[g])/u,height:(s[g+1]-s[g+5])/f});h.#b(),h.#E(),h.rotate(h.rotation)}else if(c){h.#h=!0;const w=c[0],g={x:w[0]-m,y:f-(w[1]-p)},b=new P0(g,[0,0,u,f],1,h.#p/2,!0,.001);for(let y=0,R=w.length;y<R;y+=2)g.x=w[y]-m,g.y=f-(w[y+1]-p),b.add(g);const{id:v,clipPathId:x}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:b.toSVGPath()}},!0,!0);h.#v({highlightOutlines:b.getOutlines(),highlightId:v,clipPathId:x}),h.#E(),h.rotate(h.parentRotation)}return h}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const t=Te._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),n=super.serialize(e);return Object.assign(n,{color:t,opacity:this.opacity,thickness:this.#p,quadPoints:this.#$(),outlines:this.#I(n.rect)}),this.addComment(n),this.annotationElementId&&!this.#T(n)?null:(n.id=this.annotationElementId,n)}#T(e){const{color:t}=this._initialData;return this.hasEditedComment||e.color.some((n,o)=>n!==t[o])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}}class n2{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,n]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){const e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){Mt("Not implemented")}}class Ne extends Te{#e=null;#t;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#a=null;static#i=null;static#r=NaN;static#o=null;static#l=null;static#c=NaN;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(this.#s(e),this.#f())}#s({drawOutlines:e,drawId:t,drawingOptions:n}){this.#e=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties)):this._drawId=this.#u(e,this.parent),this.#d(e.box)}#u(e,t){const{id:n}=t.drawLayer.draw(Ne._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(e,t){const n=new Set(Object.keys(e));for(const[o,l]of Object.entries(t))n.has(o)?Object.assign(e[o],l):e[o]=l;return e}static getDefaultDrawingOptions(e){Mt("Not implemented")}static get typesMap(){Mt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){const n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,t),this._currentParent&&(Ne.#n.updateProperty(n,t),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){const n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){const e=[],t=this._defaultDrawingOptions;for(const[n,o]of this.typesMap)e.push([n,t[o]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:t}=this;for(const[n,o]of this.constructor.typesMap)e.push([n,t[o]]);return e}_updateProperty(e,t,n){const o=this._drawingOptions,l=o[t],s=c=>{o.updateProperty(t,c);const d=this.#e.updateProperty(t,c);d&&this.#d(d),this.parent?.drawLayer.updateProperties(this._drawId,o.toSVGProperties()),e===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:s.bind(this,n),undo:s.bind(this,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Ne._mergeSVGProperties(this.#e.getPathResizingSVGProperties(this.#m()),{bbox:this.#p()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Ne._mergeSVGProperties(this.#e.getPathResizedSVGProperties(this.#m()),{bbox:this.#p()}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#p()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Ne._mergeSVGProperties(this.#e.getPathTranslatedSVGProperties(this.#m(),this.parentDimensions),{bbox:this.#p()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this.#h(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#f(),this.#d(this.#e.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#h()):e&&(this._uiManager.addShouldRescale(this),this.#f(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),t&&this.select()}#h(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#f(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#u(this.#e,e)}}#g([e,t,n,o]){const{parentDimensions:[l,s],rotation:c}=this;switch(c){case 90:return[t,1-e,n*(s/l),o*(l/s)];case 180:return[1-e,1-t,n,o];case 270:return[1-t,e,n*(s/l),o*(l/s)];default:return[e,t,n,o]}}#m(){const{x:e,y:t,width:n,height:o,parentDimensions:[l,s],rotation:c}=this;switch(c){case 90:return[1-t,e,n*(l/s),o*(s/l)];case 180:return[1-e,1-t,n,o];case 270:return[t,1-e,n*(l/s),o*(s/l)];default:return[e,t,n,o]}}#d(e){[this.x,this.y,this.width,this.height]=this.#g(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#p(){const{x:e,y:t,width:n,height:o,rotation:l,parentRotation:s,parentDimensions:[c,d]}=this;switch((l*4+s)/90){case 1:return[1-t-o,e,o,n];case 2:return[1-e-n,1-t-o,n,o];case 3:return[t,1-e-n,o,n];case 4:return[e,t-n*(c/d),o*(d/c),n*(c/d)];case 5:return[1-t,e,n*(c/d),o*(d/c)];case 6:return[1-e-o*(d/c),1-t,o*(d/c),n*(c/d)];case 7:return[t-n*(c/d),1-e-o*(d/c),n*(c/d),o*(d/c)];case 8:return[e-n,t-o,n,o];case 9:return[1-t,e-n,o,n];case 10:return[1-e,1-t,n,o];case 11:return[t-o,1-e,o,n];case 12:return[e-o*(d/c),t,o*(d/c),n*(c/d)];case 13:return[1-t-n*(c/d),e-o*(d/c),n*(c/d),o*(d/c)];case 14:return[1-e,1-t-n*(c/d),o*(d/c),n*(c/d)];case 15:return[t,1-e,n*(c/d),o*(d/c)];default:return[e,t,n,o]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,Ne._mergeSVGProperties({bbox:this.#p()},this.#e.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#d(this.#e.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);const n=super.render();n.classList.add("draw");const o=document.createElement("div");return n.append(o),o.setAttribute("aria-hidden","true"),o.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e,t,n,o,l){Mt("Not implemented")}static startDrawing(e,t,n,o){const{target:l,offsetX:s,offsetY:c,pointerId:d,pointerType:h}=o;if(Ne.#o&&Ne.#o!==h)return;const{viewport:{rotation:u}}=e,{width:f,height:m}=l.getBoundingClientRect(),p=Ne.#a=new AbortController,w=e.combinedSignal(p);if(Ne.#r||=d,Ne.#o??=h,window.addEventListener("pointerup",g=>{Ne.#r===g.pointerId?this._endDraw(g):Ne.#l?.delete(g.pointerId)},{signal:w}),window.addEventListener("pointercancel",g=>{Ne.#r===g.pointerId?this._currentParent.endDrawingSession():Ne.#l?.delete(g.pointerId)},{signal:w}),window.addEventListener("pointerdown",g=>{Ne.#o===g.pointerType&&((Ne.#l||=new Set).add(g.pointerId),Ne.#n.isCancellable()&&(Ne.#n.removeLastElement(),Ne.#n.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:w}),window.addEventListener("contextmenu",Aa,{signal:w}),l.addEventListener("pointermove",this._drawMove.bind(this),{signal:w}),l.addEventListener("touchmove",g=>{g.timeStamp===Ne.#c&&Wt(g)},{signal:w}),e.toggleDrawing(),t._editorUndoBar?.hide(),Ne.#n){e.drawLayer.updateProperties(this._currentDrawId,Ne.#n.startNew(s,c,f,m,u));return}t.updateUIForDefaultProperties(this),Ne.#n=this.createDrawerInstance(s,c,f,m,u),Ne.#i=this.getDefaultDrawingOptions(),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(Ne.#i.toSVGProperties(),Ne.#n.defaultSVGProperties),!0,!1)}static _drawMove(e){if(Ne.#c=-1,!Ne.#n)return;const{offsetX:t,offsetY:n,pointerId:o}=e;if(Ne.#r===o){if(Ne.#l?.size>=1){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,Ne.#n.add(t,n)),Ne.#c=e.timeStamp,Wt(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,Ne.#n=null,Ne.#i=null,Ne.#o=null,Ne.#c=NaN),Ne.#a&&(Ne.#a.abort(),Ne.#a=null,Ne.#r=NaN,Ne.#l=null)}static _endDraw(e){const t=this._currentParent;if(t){if(t.toggleDrawing(!0),this._cleanup(!1),e?.target===t.div&&t.drawLayer.updateProperties(this._currentDrawId,Ne.#n.end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const n=Ne.#n,o=this._currentDrawId,l=n.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(o,n.setLastElement(l))},undo:()=>{t.drawLayer.updateProperties(o,n.removeLastElement())},mustExec:!1,type:dt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const t=this._currentParent;if(!t)return null;if(t.toggleDrawing(!0),t.cleanUndoStack(dt.DRAW_STEP),!Ne.#n.isEmpty()){const{pageDimensions:[n,o],scale:l}=t,s=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Ne.#n.getOutlines(n*l,o*l,l,this._INNER_MARGIN),drawingOptions:Ne.#i,mustBeCommitted:!e});return this._cleanup(!0),s}return t.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,o,l,s){Mt("Not implemented")}static async deserialize(e,t,n){const{rawDims:{pageWidth:o,pageHeight:l,pageX:s,pageY:c}}=t.viewport,d=this.deserializeDraw(s,c,o,l,this._INNER_MARGIN,e),h=await super.deserialize(e,t,n);return h.createDrawingOptions(e),h.#s({drawOutlines:d}),h.#f(),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){const[t,n]=this.pageTranslation,[o,l]=this.pageDimensions;return this.#e.serialize([t,n,o,l],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class eie{#e=new Float64Array(6);#t;#n;#a;#i;#r;#o="";#l=0;#c=new yo;#s;#u;constructor(e,t,n,o,l,s){this.#s=n,this.#u=o,this.#a=l,this.#i=s,[e,t]=this.#h(e,t);const c=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#r=[e,t],this.#n=[{line:c,points:this.#r}],this.#e.set(c,0)}updateProperty(e,t){e==="stroke-width"&&(this.#i=t)}#h(e,t){return Me._normalizePoint(e,t,this.#s,this.#u,this.#a)}isEmpty(){return!this.#n||this.#n.length===0}isCancellable(){return this.#r.length<=10}add(e,t){[e,t]=this.#h(e,t);const[n,o,l,s]=this.#e.subarray(2,6),c=e-l,d=t-s;return Math.hypot(this.#s*c,this.#u*d)<=2?null:(this.#r.push(e,t),isNaN(n)?(this.#e.set([l,s,e,t],2),this.#t.push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(this.#e[0])&&this.#t.splice(6,6),this.#e.set([n,o,l,s,e,t],0),this.#t.push(...Me.createBezierPoints(n,o,l,s,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){const n=this.add(e,t);return n||(this.#r.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,o,l){this.#s=n,this.#u=o,this.#a=l,[e,t]=this.#h(e,t);const s=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#r=[e,t];const c=this.#n.at(-1);return c&&(c.line=new Float32Array(c.line),c.points=new Float32Array(c.points)),this.#n.push({line:s,points:this.#r}),this.#e.set(s,0),this.#l=0,this.toSVGPath(),null}getLastElement(){return this.#n.at(-1)}setLastElement(e){return this.#n?(this.#n.push(e),this.#t=e.line,this.#r=e.points,this.#l=0,{path:{d:this.toSVGPath()}}):this.#c.setLastElement(e)}removeLastElement(){if(!this.#n)return this.#c.removeLastElement();this.#n.pop(),this.#o="";for(let e=0,t=this.#n.length;e<t;e++){const{line:n,points:o}=this.#n[e];this.#t=n,this.#r=o,this.#l=0,this.toSVGPath()}return{path:{d:this.#o}}}toSVGPath(){const e=Me.svgRound(this.#t[4]),t=Me.svgRound(this.#t[5]);if(this.#r.length===2)return this.#o=`${this.#o} M ${e} ${t} Z`,this.#o;if(this.#r.length<=6){const o=this.#o.lastIndexOf("M");this.#o=`${this.#o.slice(0,o)} M ${e} ${t}`,this.#l=6}if(this.#r.length===4){const o=Me.svgRound(this.#t[10]),l=Me.svgRound(this.#t[11]);return this.#o=`${this.#o} L ${o} ${l}`,this.#l=12,this.#o}const n=[];this.#l===0&&(n.push(`M ${e} ${t}`),this.#l=6);for(let o=this.#l,l=this.#t.length;o<l;o+=6){const[s,c,d,h,u,f]=this.#t.slice(o,o+6).map(Me.svgRound);n.push(`C${s} ${c} ${d} ${h} ${u} ${f}`)}return this.#o+=n.join(" "),this.#l=this.#t.length,this.#o}getOutlines(e,t,n,o){const l=this.#n.at(-1);return l.line=new Float32Array(l.line),l.points=new Float32Array(l.points),this.#c.build(this.#n,e,t,n,this.#a,this.#i,o),this.#e=null,this.#t=null,this.#n=null,this.#o=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class yo extends Me{#e;#t=0;#n;#a;#i;#r;#o;#l;#c;build(e,t,n,o,l,s,c){this.#i=t,this.#r=n,this.#o=o,this.#l=l,this.#c=s,this.#n=c??0,this.#a=e,this.#h()}get thickness(){return this.#c}setLastElement(e){return this.#a.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#a.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:t}of this.#a){if(e.push(`M${Me.svgRound(t[4])} ${Me.svgRound(t[5])}`),t.length===6){e.push("Z");continue}if(t.length===12&&isNaN(t[6])){e.push(`L${Me.svgRound(t[10])} ${Me.svgRound(t[11])}`);continue}for(let n=6,o=t.length;n<o;n+=6){const[l,s,c,d,h,u]=t.subarray(n,n+6).map(Me.svgRound);e.push(`C${l} ${s} ${c} ${d} ${h} ${u}`)}}return e.join("")}serialize([e,t,n,o],l){const s=[],c=[],[d,h,u,f]=this.#u();let m,p,w,g,b,v,x,y,R;switch(this.#l){case 0:R=Me._rescale,m=e,p=t+o,w=n,g=-o,b=e+d*n,v=t+(1-h-f)*o,x=e+(d+u)*n,y=t+(1-h)*o;break;case 90:R=Me._rescaleAndSwap,m=e,p=t,w=n,g=o,b=e+h*n,v=t+d*o,x=e+(h+f)*n,y=t+(d+u)*o;break;case 180:R=Me._rescale,m=e+n,p=t,w=-n,g=o,b=e+(1-d-u)*n,v=t+h*o,x=e+(1-d)*n,y=t+(h+f)*o;break;case 270:R=Me._rescaleAndSwap,m=e+n,p=t+o,w=-n,g=-o,b=e+(1-h-f)*n,v=t+(1-d-u)*o,x=e+(1-h)*n,y=t+(1-d)*o;break}for(const{line:S,points:_}of this.#a)s.push(R(S,m,p,w,g,l?new Array(S.length):null)),c.push(R(_,m,p,w,g,l?new Array(_.length):null));return{lines:s,points:c,rect:[b,v,x,y]}}static deserialize(e,t,n,o,l,{paths:{lines:s,points:c},rotation:d,thickness:h}){const u=[];let f,m,p,w,g;switch(d){case 0:g=Me._rescale,f=-e/n,m=t/o+1,p=1/n,w=-1/o;break;case 90:g=Me._rescaleAndSwap,f=-t/o,m=-e/n,p=1/o,w=1/n;break;case 180:g=Me._rescale,f=e/n+1,m=-t/o,p=-1/n,w=1/o;break;case 270:g=Me._rescaleAndSwap,f=t/o+1,m=e/n+1,p=-1/o,w=-1/n;break}if(!s){s=[];for(const v of c){const x=v.length;if(x===2){s.push(new Float32Array([NaN,NaN,NaN,NaN,v[0],v[1]]));continue}if(x===4){s.push(new Float32Array([NaN,NaN,NaN,NaN,v[0],v[1],NaN,NaN,NaN,NaN,v[2],v[3]]));continue}const y=new Float32Array(3*(x-2));s.push(y);let[R,S,_,C]=v.subarray(0,4);y.set([NaN,NaN,NaN,NaN,R,S],0);for(let A=4;A<x;A+=2){const M=v[A],L=v[A+1];y.set(Me.createBezierPoints(R,S,_,C,M,L),(A-2)*3),[R,S,_,C]=[_,C,M,L]}}}for(let v=0,x=s.length;v<x;v++)u.push({line:g(s[v].map(y=>y??NaN),f,m,p,w),points:g(c[v].map(y=>y??NaN),f,m,p,w)});const b=new this.prototype.constructor;return b.build(u,n,o,1,d,h,l),b}#s(e=this.#c){const t=this.#n+e/2*this.#o;return this.#l%180===0?[t/this.#i,t/this.#r]:[t/this.#r,t/this.#i]}#u(){const[e,t,n,o]=this.#e,[l,s]=this.#s(0);return[e+l,t+s,n-2*l,o-2*s]}#h(){const e=this.#e=new Float32Array([1/0,1/0,-1/0,-1/0]);for(const{line:o}of this.#a){if(o.length<=12){for(let c=4,d=o.length;c<d;c+=6)je.pointBoundingBox(o[c],o[c+1],e);continue}let l=o[4],s=o[5];for(let c=6,d=o.length;c<d;c+=6){const[h,u,f,m,p,w]=o.subarray(c,c+6);je.bezierBoundingBox(l,s,h,u,f,m,p,w,e),l=p,s=w}}const[t,n]=this.#s();e[0]=oa(e[0]-t,0,1),e[1]=oa(e[1]-n,0,1),e[2]=oa(e[2]+t,0,1),e[3]=oa(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e==="stroke-width"?this.#f(t):null}#f(e){const[t,n]=this.#s();this.#c=e;const[o,l]=this.#s(),[s,c]=[o-t,l-n],d=this.#e;return d[0]-=s,d[1]-=c,d[2]+=2*s,d[3]+=2*c,d}updateParentDimensions([e,t],n){const[o,l]=this.#s();this.#i=e,this.#r=t,this.#o=n;const[s,c]=this.#s(),d=s-o,h=c-l,u=this.#e;return u[0]-=d,u[1]-=h,u[2]+=2*d,u[3]+=2*h,u}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(Me.svgRound).join(" ")}get defaultProperties(){const[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`}}}get rotationTransform(){const[,,e,t]=this.#e;let n=0,o=0,l=0,s=0,c=0,d=0;switch(this.#t){case 90:o=t/e,l=-e/t,c=e;break;case 180:n=-1,s=-1,c=e,d=t;break;case 270:o=-t/e,l=e/t,d=t;break;default:return""}return`matrix(${n} ${o} ${l} ${s} ${Me.svgRound(c)} ${Me.svgRound(d)})`}getPathResizingSVGProperties([e,t,n,o]){const[l,s]=this.#s(),[c,d,h,u]=this.#e;if(Math.abs(h-l)<=Me.PRECISION||Math.abs(u-s)<=Me.PRECISION){const g=e+n/2-(c+h/2),b=t+o/2-(d+u/2);return{path:{"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`,transform:`${this.rotationTransform} translate(${g} ${b})`}}}const f=(n-2*l)/(h-2*l),m=(o-2*s)/(u-2*s),p=h/n,w=u/o;return{path:{"transform-origin":`${Me.svgRound(c)} ${Me.svgRound(d)}`,transform:`${this.rotationTransform} scale(${p} ${w}) translate(${Me.svgRound(l)} ${Me.svgRound(s)}) scale(${f} ${m}) translate(${Me.svgRound(-l)} ${Me.svgRound(-s)})`}}}getPathResizedSVGProperties([e,t,n,o]){const[l,s]=this.#s(),c=this.#e,[d,h,u,f]=c;if(c[0]=e,c[1]=t,c[2]=n,c[3]=o,Math.abs(u-l)<=Me.PRECISION||Math.abs(f-s)<=Me.PRECISION){const b=e+n/2-(d+u/2),v=t+o/2-(h+f/2);for(const{line:x,points:y}of this.#a)Me._translate(x,b,v,x),Me._translate(y,b,v,y);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const m=(n-2*l)/(u-2*l),p=(o-2*s)/(f-2*s),w=-m*(d+l)+e+l,g=-p*(h+s)+t+s;if(m!==1||p!==1||w!==0||g!==0)for(const{line:b,points:v}of this.#a)Me._rescale(b,w,g,m,p,b),Me._rescale(v,w,g,m,p,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){const[o,l]=n,s=this.#e,c=e-s[0],d=t-s[1];if(this.#i===o&&this.#r===l)for(const{line:h,points:u}of this.#a)Me._translate(h,c,d,h),Me._translate(u,c,d,u);else{const h=this.#i/o,u=this.#r/l;this.#i=o,this.#r=l;for(const{line:f,points:m}of this.#a)Me._rescale(f,c,d,h,u,f),Me._rescale(m,c,d,h,u,m);s[2]*=h,s[3]*=u}return s[0]=e,s[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`}}}get defaultSVGProperties(){const e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Me.svgRound(e[0])} ${Me.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}class _i extends n2{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:Te._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??=this["stroke-width"],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new _i(this._viewParameters);return e.updateAll(this),e}}class Pl extends Ne{static _type="ink";static _editorType=Je.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,t){Te.initialize(e,t),this._defaultDrawingOptions=new _i(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return nt(this,"typesMap",new Map([[dt.INK_THICKNESS,"stroke-width"],[dt.INK_COLOR,"stroke"],[dt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,n,o,l){return new eie(e,t,n,o,l,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,n,o,l,s){return yo.deserialize(e,t,n,o,l,s)}static async deserialize(e,t,n){let o=null;if(e instanceof Bl){const{data:{inkLists:s,rect:c,rotation:d,id:h,color:u,opacity:f,borderStyle:{rawWidth:m},popupRef:p,richText:w,contentsObj:g,creationDate:b,modificationDate:v},parent:{page:{pageNumber:x}}}=e;o=e={annotationType:Je.INK,color:Array.from(u),thickness:m,opacity:f,paths:{points:s},boxes:null,pageIndex:x-1,rect:c.slice(0),rotation:d,annotationElementId:h,id:h,deleted:!1,popupRef:p,richText:w,comment:g?.str||null,creationDate:b,modificationDate:v}}const l=await super.deserialize(e,t,n);return l._initialData=o,e.comment&&l.setCommentData(e),l}get toolbarButtons(){return this._colorPicker||=new io(this),[["colorPicker",this._colorPicker]]}get colorType(){return dt.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:t,opacity:n}){this._drawingOptions=Pl.getDefaultDrawingOptions({stroke:je.makeHexColor(...e),"stroke-width":t,"stroke-opacity":n})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:o,"stroke-opacity":l,"stroke-width":s}}=this,c=Object.assign(super.serialize(e),{color:Te._colorManager.convert(o),opacity:l,thickness:s,paths:{lines:t,points:n}});return this.addComment(c),e?(c.isCopy=!0,c):this.annotationElementId&&!this.#e(c)?null:(c.id=this.annotationElementId,c)}#e(e){const{color:t,thickness:n,opacity:o,pageIndex:l}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((s,c)=>s!==t[c])||e.thickness!==n||e.opacity!==o||e.pageIndex!==l}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;const{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:t,popup:this.comment}),null}}class N0 extends yo{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const Wo=8,Vr=3;class kn{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,o){return n-=e,o-=t,n===0?o>0?0:4:n===1?o+6:2-o}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#a(e,t,n,o,l,s,c){const d=this.#t(n,o,l,s);for(let h=0;h<8;h++){const u=(-h+d-c+16)%8,f=this.#n[2*u],m=this.#n[2*u+1];if(e[(n+f)*t+(o+m)]!==0)return u}return-1}static#i(e,t,n,o,l,s,c){const d=this.#t(n,o,l,s);for(let h=0;h<8;h++){const u=(h+d+c+16)%8,f=this.#n[2*u],m=this.#n[2*u+1];if(e[(n+f)*t+(o+m)]!==0)return u}return-1}static#r(e,t,n,o){const l=e.length,s=new Int32Array(l);for(let u=0;u<l;u++)s[u]=e[u]<=o?1:0;for(let u=1;u<n-1;u++)s[u*t]=s[u*t+t-1]=0;for(let u=0;u<t;u++)s[u]=s[t*n-1-u]=0;let c=1,d;const h=[];for(let u=1;u<n-1;u++){d=1;for(let f=1;f<t-1;f++){const m=u*t+f,p=s[m];if(p===0)continue;let w=u,g=f;if(p===1&&s[m-1]===0)c+=1,g-=1;else if(p>=1&&s[m+1]===0)c+=1,g+=1,p>1&&(d=p);else{p!==1&&(d=Math.abs(p));continue}const b=[f,u],v=g===f+1,x={isHole:v,points:b,id:c,parent:0};h.push(x);let y;for(const j of h)if(j.id===d){y=j;break}y?y.isHole?x.parent=v?y.parent:d:x.parent=v?d:y.parent:x.parent=v?d:0;const R=this.#a(s,t,u,f,w,g,0);if(R===-1){s[m]=-c,s[m]!==1&&(d=Math.abs(s[m]));continue}let S=this.#n[2*R],_=this.#n[2*R+1];const C=u+S,A=f+_;w=C,g=A;let M=u,L=f;for(;;){const j=this.#i(s,t,M,L,w,g,1);S=this.#n[2*j],_=this.#n[2*j+1];const $=M+S,Z=L+_;b.push(Z,$);const D=M*t+L;if(s[D+1]===0?s[D]=-c:s[D]===1&&(s[D]=c),$===u&&Z===f&&M===C&&L===A){s[m]!==1&&(d=Math.abs(s[m]));break}else w=M,g=L,M=$,L=Z}}}return h}static#o(e,t,n,o){if(n-t<=4){for(let C=t;C<n-2;C+=2)o.push(e[C],e[C+1]);return}const l=e[t],s=e[t+1],c=e[n-4]-l,d=e[n-3]-s,h=Math.hypot(c,d),u=c/h,f=d/h,m=u*s-f*l,p=d/c,w=1/h,g=Math.atan(p),b=Math.cos(g),v=Math.sin(g),x=w*(Math.abs(b)+Math.abs(v)),y=w*(1-x+x**2),R=Math.max(Math.atan(Math.abs(v+b)*y),Math.atan(Math.abs(v-b)*y));let S=0,_=t;for(let C=t+2;C<n-2;C+=2){const A=Math.abs(m-u*e[C+1]+f*e[C]);A>S&&(_=C,S=A)}S>(h*R)**2?(this.#o(e,t,_+2,o),this.#o(e,_,n,o)):o.push(l,s)}static#l(e){const t=[],n=e.length;return this.#o(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#c(e,t,n,o,l,s){const c=new Float32Array(s**2),d=-2*o**2,h=s>>1;for(let g=0;g<s;g++){const b=(g-h)**2;for(let v=0;v<s;v++)c[g*s+v]=Math.exp((b+(v-h)**2)/d)}const u=new Float32Array(256),f=-2*l**2;for(let g=0;g<256;g++)u[g]=Math.exp(g**2/f);const m=e.length,p=new Uint8Array(m),w=new Uint32Array(256);for(let g=0;g<n;g++)for(let b=0;b<t;b++){const v=g*t+b,x=e[v];let y=0,R=0;for(let _=0;_<s;_++){const C=g+_-h;if(!(C<0||C>=n))for(let A=0;A<s;A++){const M=b+A-h;if(M<0||M>=t)continue;const L=e[C*t+M],j=c[_*s+A]*u[Math.abs(L-x)];y+=L*j,R+=j}}const S=p[v]=Math.round(y/R);w[S]++}return[p,w]}static#s(e){const t=new Uint32Array(256);for(const n of e)t[n]++;return t}static#u(e){const t=e.length,n=new Uint8ClampedArray(t>>2);let o=-1/0,l=1/0;for(let c=0,d=n.length;c<d;c++){const h=n[c]=e[c<<2];o=Math.max(o,h),l=Math.min(l,h)}const s=255/(o-l);for(let c=0,d=n.length;c<d;c++)n[c]=(n[c]-l)*s;return n}static#h(e){let t,n=-1/0,o=-1/0;const l=e.findIndex(d=>d!==0);let s=l,c=l;for(t=l;t<256;t++){const d=e[t];d>n&&(t-s>o&&(o=t-s,c=t-1),n=d,s=t)}for(t=c-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){const t=e,{width:n,height:o}=e,{maxDim:l}=this.#e;let s=n,c=o;if(n>l||o>l){let m=n,p=o,w=Math.log2(Math.max(n,o)/l);const g=Math.floor(w);w=w===g?g-1:g;for(let v=0;v<w;v++){s=Math.ceil(m/2),c=Math.ceil(p/2);const x=new OffscreenCanvas(s,c);x.getContext("2d").drawImage(e,0,0,m,p,0,0,s,c),m=s,p=c,e!==t&&e.close(),e=x.transferToImageBitmap()}const b=Math.min(l/s,l/c);s=Math.round(s*b),c=Math.round(c*b)}const h=new OffscreenCanvas(s,c).getContext("2d",{willReadFrequently:!0});h.fillStyle="white",h.fillRect(0,0,s,c),h.filter="grayscale(1)",h.drawImage(e,0,0,e.width,e.height,0,0,s,c);const u=h.getImageData(0,0,s,c).data;return[this.#u(u),s,c]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:o},l,s,c,d){let h=new OffscreenCanvas(1,1),u=h.getContext("2d",{alpha:!1});const f=200,m=u.font=`${n} ${o} ${f}px ${t}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:w,actualBoundingBoxAscent:g,actualBoundingBoxDescent:b,fontBoundingBoxAscent:v,fontBoundingBoxDescent:x,width:y}=u.measureText(e),R=1.5,S=Math.ceil(Math.max(Math.abs(p)+Math.abs(w)||0,y)*R),_=Math.ceil(Math.max(Math.abs(g)+Math.abs(b)||f,Math.abs(v)+Math.abs(x)||f)*R);h=new OffscreenCanvas(S,_),u=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),u.font=m,u.filter="grayscale(1)",u.fillStyle="white",u.fillRect(0,0,S,_),u.fillStyle="black",u.fillText(e,S*(R-1)/2,_*(3-R)/2);const C=this.#u(u.getImageData(0,0,S,_).data),A=this.#s(C),M=this.#h(A),L=this.#r(C,S,_,M);return this.processDrawnLines({lines:{curves:L,width:S,height:_},pageWidth:l,pageHeight:s,rotation:c,innerMargin:d,mustSmooth:!0,areContours:!0})}static process(e,t,n,o,l){const[s,c,d]=this.#f(e),[h,u]=this.#c(s,c,d,Math.hypot(c,d)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),f=this.#h(u),m=this.#r(h,c,d,f);return this.processDrawnLines({lines:{curves:m,width:c,height:d},pageWidth:t,pageHeight:n,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:o,innerMargin:l,mustSmooth:s,areContours:c}){o%180!==0&&([t,n]=[n,t]);const{curves:d,width:h,height:u}=e,f=e.thickness??0,m=[],p=Math.min(t/h,n/u),w=p/t,g=p/n,b=[];for(const{points:x}of d){const y=s?this.#l(x):x;if(!y)continue;b.push(y);const R=y.length,S=new Float32Array(R),_=new Float32Array(3*(R===2?2:R-2));if(m.push({line:_,points:S}),R===2){S[0]=y[0]*w,S[1]=y[1]*g,_.set([NaN,NaN,NaN,NaN,S[0],S[1]],0);continue}let[C,A,M,L]=y;C*=w,A*=g,M*=w,L*=g,S.set([C,A,M,L],0),_.set([NaN,NaN,NaN,NaN,C,A],0);for(let j=4;j<R;j+=2){const $=S[j]=y[j]*w,Z=S[j+1]=y[j+1]*g;_.set(Me.createBezierPoints(C,A,M,L,$,Z),(j-2)*3),[C,A,M,L]=[M,L,$,Z]}}if(m.length===0)return null;const v=c?new N0:new yo;return v.build(m,t,n,1,o,c?0:f,l),{outline:v,newCurves:b,areContours:c,thickness:f,width:h,height:u}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:o,height:l}){let s=1/0,c=-1/0,d=0;for(const y of e){d+=y.length;for(let R=2,S=y.length;R<S;R++){const _=y[R]-y[R-2];s=Math.min(s,_),c=Math.max(c,_)}}let h;s>=-128&&c<=127?h=Int8Array:s>=-32768&&c<=32767?h=Int16Array:h=Int32Array;const u=e.length,f=Wo+Vr*u,m=new Uint32Array(f);let p=0;m[p++]=f*Uint32Array.BYTES_PER_ELEMENT+(d-2*u)*h.BYTES_PER_ELEMENT,m[p++]=0,m[p++]=o,m[p++]=l,m[p++]=t?0:1,m[p++]=Math.max(0,Math.floor(n??0)),m[p++]=u,m[p++]=h.BYTES_PER_ELEMENT;for(const y of e)m[p++]=y.length-2,m[p++]=y[0],m[p++]=y[1];const w=new CompressionStream("deflate-raw"),g=w.writable.getWriter();await g.ready,g.write(m);const b=h.prototype.constructor;for(const y of e){const R=new b(y.length-2);for(let S=2,_=y.length;S<_;S++)R[S-2]=y[S]-y[S-2];g.write(R)}g.close();const v=await new Response(w.readable).arrayBuffer(),x=new Uint8Array(v);return Ad(x)}static async decompressSignature(e){try{const t=Cre(e),{readable:n,writable:o}=new DecompressionStream("deflate-raw"),l=o.getWriter();await l.ready,l.write(t).then(async()=>{await l.ready,await l.close()}).catch(()=>{});let s=null,c=0;for await(const y of n)s||=new Uint8Array(new Uint32Array(y.buffer,0,4)[0]),s.set(y,c),c+=y.length;const d=new Uint32Array(s.buffer,0,s.length>>2),h=d[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const u=d[2],f=d[3],m=d[4]===0,p=d[5],w=d[6],g=d[7],b=[],v=(Wo+Vr*w)*Uint32Array.BYTES_PER_ELEMENT;let x;switch(g){case Int8Array.BYTES_PER_ELEMENT:x=new Int8Array(s.buffer,v);break;case Int16Array.BYTES_PER_ELEMENT:x=new Int16Array(s.buffer,v);break;case Int32Array.BYTES_PER_ELEMENT:x=new Int32Array(s.buffer,v);break}c=0;for(let y=0;y<w;y++){const R=d[Vr*y+Wo],S=new Float32Array(R+2);b.push(S);for(let _=0;_<Vr-1;_++)S[_]=d[Vr*y+Wo+_+1];for(let _=0;_<R;_++)S[_+2]=S[_]+x[c++]}return{areContours:m,thickness:p,outlines:b,width:u,height:f}}catch(t){return Qe(`decompressSignature: ${t}`),null}}}class Nl extends n2{constructor(){super(),super.updateProperties({fill:Te._defaultLineColor,"stroke-width":0})}clone(){const e=new Nl;return e.updateAll(this),e}}class Hl extends _i{constructor(e){super(e),super.updateProperties({stroke:Te._defaultLineColor,"stroke-width":1})}clone(){const e=new Hl(this._viewParameters);return e.updateAll(this),e}}class Ha extends Ne{#e=!1;#t=null;#n=null;#a=null;static _type="signature";static _editorType=Je.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,t){Te.initialize(e,t),this._defaultDrawingOptions=new Nl,this._defaultDrawnSignatureOptions=new Hl(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return nt(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#t}}static computeTelemetryFinalData(e){const t=e.get("hasDescription");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,t;const{_isCopy:n}=this;if(n&&(this._isCopy=!1,e=this.x,t=this.y),super.render(),this._drawId===null)if(this.#n){const{lines:o,mustSmooth:l,areContours:s,description:c,uuid:d,heightInPage:h}=this.#n,{rawDims:{pageWidth:u,pageHeight:f},rotation:m}=this.parent.viewport,p=kn.processDrawnLines({lines:o,pageWidth:u,pageHeight:f,rotation:m,innerMargin:Ha._INNER_MARGIN,mustSmooth:l,areContours:s});this.addSignature(p,h,c,d)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#t||""}));return n&&(this._isCopy=!0,this._moveAfterPaste(e,t)),this.div}setUuid(e){this.#a=e,this.addEditToolbar()}getUuid(){return this.#a}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){const{newCurves:e,areContours:t,thickness:n,width:o,height:l}=this.#n,s=Math.max(o,l),c=kn.processDrawnLines({lines:{curves:e.map(d=>({points:d})),thickness:n,width:o,height:l},pageWidth:s,pageHeight:s,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t});return{areContours:t,outline:c.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,t,n,o){const{x:l,y:s}=this,{outline:c}=this.#n=e;this.#e=c instanceof N0,this.description=n;let d;this.#e?d=Ha.getDefaultDrawingOptions():(d=Ha._defaultDrawnSignatureOptions.clone(),d.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:d});const[,h]=this.pageDimensions;let u=t/h;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=l,this.y=s,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(o),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!o,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:t,pageHeight:n},rotation:o}=this.parent.viewport;return kn.process(e,t,n,o,Ha._INNER_MARGIN)}getFromText(e,t){const{rawDims:{pageWidth:n,pageHeight:o},rotation:l}=this.parent.viewport;return kn.extractContoursFromText(e,t,n,o,l,Ha._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:t,pageHeight:n},rotation:o}=this.parent.viewport;return kn.processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:o,innerMargin:Ha._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:t}){e?this._drawingOptions=Ha.getDefaultDrawingOptions():(this._drawingOptions=Ha._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":t}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":o}}=this,l=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:o});return this.addComment(l),e?(l.paths={lines:t,points:n},l.uuid=this.#a,l.isCopy=!0):l.lines=t,this.#t&&(l.accessibilityData={type:"Figure",alt:this.#t}),l}static deserializeDraw(e,t,n,o,l,s){return s.areContours?N0.deserialize(e,t,n,o,l,s):yo.deserialize(e,t,n,o,l,s)}static async deserialize(e,t,n){const o=await super.deserialize(e,t,n);return o.#e=e.areContours,o.description=e.accessibilityData?.alt||"",o.#a=e.uuid,o}}class tie extends Te{#e=null;#t=null;#n=null;#a=null;#i=null;#r="";#o=null;#l=!1;#c=null;#s=!1;#u=!1;static _type="stamp";static _editorType=Je.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#a=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,t){Te.initialize(e,t)}static isHandlingMimeForPasting(e){return hi.includes(e)}static paste(e,t){t.pasteEditor({mode:Je.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#h(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#s=e.isSvg),e.file&&(this.#r=e.file.name),this.#m()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),!!this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:o,width:l,height:s}=e||this.copyCanvas(null,null,!0).imageData,c=await n.guess({name:"altText",request:{data:o,width:l,height:s,channels:o.length/(l*s)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const d=c.output;return await this.setGuessedAltText(d),t&&!this.hasAltTextData()&&(this.altTextData={alt:d,decorative:!1}),d}#g(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(n=>this.#h(n,!0)).finally(()=>this.#f());return}if(this.#a){const n=this.#a;this.#a=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(n).then(o=>this.#h(o)).finally(()=>this.#f());return}if(this.#i){const n=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(n).then(o=>this.#h(o)).finally(()=>this.#f());return}const e=document.createElement("input");e.type="file",e.accept=hi.join(",");const t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const o=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#h(o)}n()},{signal:t}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#g();return}super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#g(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#a||this.#i||this.#t||this.#l)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#l||(this.#e?this.#m():this.#g()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){const{id:n,bitmap:o}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,o&&(this.#e=o),this.#l=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#c!==null&&clearTimeout(this.#c);const e=200;this.#c=setTimeout(()=>{this.#c=null,this.#p()},e)}#m(){const{div:e}=this;let{width:t,height:n}=this.#e;const[o,l]=this.pageDimensions,s=.75;if(this.width)t=this.width*o,n=this.height*l;else if(t>s*o||n>s*l){const d=Math.min(s*o/t,s*l/n);t*=d,n*=d}this._uiManager.enableWaiting(!1);const c=this.#o=document.createElement("canvas");c.setAttribute("role","img"),this.addContainer(c),this.width=t/o,this.height=n/l,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#p(),this.#u||(this.parent.addUndoableEditor(this),this.#u=!0),this._reportTelemetry({action:"inserted_image"}),this.#r&&this.div.setAttribute("aria-description",this.#r),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}copyCanvas(e,t,n=!1){e||(e=224);const{width:o,height:l}=this.#e,s=new ka;let c=this.#e,d=o,h=l,u=null;if(t){if(o>t||l>t){const _=Math.min(t/o,t/l);d=Math.floor(o*_),h=Math.floor(l*_)}u=document.createElement("canvas");const m=u.width=Math.ceil(d*s.sx),p=u.height=Math.ceil(h*s.sy);this.#s||(c=this.#d(m,p));const w=u.getContext("2d");w.filter=this._uiManager.hcmFilter;let g="white",b="#cfcfd8";this._uiManager.hcmFilter!=="none"?b="black":Mre.isDarkMode&&(g="#8f8f9d",b="#42414d");const v=15,x=v*s.sx,y=v*s.sy,R=new OffscreenCanvas(x*2,y*2),S=R.getContext("2d");S.fillStyle=g,S.fillRect(0,0,x*2,y*2),S.fillStyle=b,S.fillRect(0,0,x,y),S.fillRect(x,y,x,y),w.fillStyle=w.createPattern(R,"repeat"),w.fillRect(0,0,m,p),w.drawImage(c,0,0,c.width,c.height,0,0,m,p)}let f=null;if(n){let m,p;if(s.symmetric&&c.width<e&&c.height<e)m=c.width,p=c.height;else if(c=this.#e,o>e||l>e){const b=Math.min(e/o,e/l);m=Math.floor(o*b),p=Math.floor(l*b),this.#s||(c=this.#d(m,p))}const g=new OffscreenCanvas(m,p).getContext("2d",{willReadFrequently:!0});g.drawImage(c,0,0,c.width,c.height,0,0,m,p),f={width:m,height:p,data:g.getImageData(0,0,m,p).data}}return{canvas:u,width:d,height:h,imageData:f}}#d(e,t){const{width:n,height:o}=this.#e;let l=n,s=o,c=this.#e;for(;l>2*e||s>2*t;){const d=l,h=s;l>2*e&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2)),s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2));const u=new OffscreenCanvas(l,s);u.getContext("2d").drawImage(c,0,0,d,h,0,0,l,s),c=u.transferToImageBitmap()}return c}#p(){const[e,t]=this.parentDimensions,{width:n,height:o}=this,l=new ka,s=Math.ceil(n*e*l.sx),c=Math.ceil(o*t*l.sy),d=this.#o;if(!d||d.width===s&&d.height===c)return;d.width=s,d.height=c;const h=this.#s?this.#e:this.#d(s,c),u=d.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(h,0,0,h.width,h.height,0,0,s,c)}#w(e){if(e){if(this.#s){const o=this._uiManager.imageManager.getSvgUrl(this.#t);if(o)return o}const t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#e,t.getContext("2d").drawImage(this.#e,0,0),t.toDataURL()}if(this.#s){const[t,n]=this.pageDimensions,o=Math.round(this.width*t*Nn.PDF_TO_CSS_UNITS),l=Math.round(this.height*n*Nn.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(o,l);return s.getContext("2d").drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,o,l),s.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let o=null,l=!1;if(e instanceof e2){const{data:{rect:g,rotation:b,id:v,structParent:x,popupRef:y,richText:R,contentsObj:S,creationDate:_,modificationDate:C},container:A,parent:{page:{pageNumber:M}},canvas:L}=e;let j,$;L?(delete e.canvas,{id:j,bitmap:$}=n.imageManager.getFromCanvas(A.id,L),L.remove()):(l=!0,e._hasNoCanvas=!0);const Z=(await t._structTree.getAriaAttributes(`${Al}${v}`))?.get("aria-label")||"";o=e={annotationType:Je.STAMP,bitmapId:j,bitmap:$,pageIndex:M-1,rect:g.slice(0),rotation:b,annotationElementId:v,id:v,deleted:!1,accessibilityData:{decorative:!1,altText:Z},isSvg:!1,structParent:x,popupRef:y,richText:R,comment:S?.str||null,creationDate:_,modificationDate:C}}const s=await super.deserialize(e,t,n),{rect:c,bitmap:d,bitmapUrl:h,bitmapId:u,isSvg:f,accessibilityData:m}=e;l?(n.addMissingCanvas(e.id,s),s.#l=!0):u&&n.imageManager.isValidId(u)?(s.#t=u,d&&(s.#e=d)):s.#a=h,s.#s=f;const[p,w]=s.pageDimensions;return s.width=(c[2]-c[0])/p,s.height=(c[3]-c[1])/w,m&&(s.altTextData=m),s._initialData=o,e.comment&&s.setCommentData(e),s.#u=!!o,s}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#s});if(this.addComment(n),e)return n.bitmapUrl=this.#w(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;const{decorative:o,altText:l}=this.serializeAltText(!1);if(!o&&l&&(n.accessibilityData={type:"Figure",alt:l}),this.annotationElementId){const c=this.#b(n);return c.isSame?null:(c.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;const s=this.#s?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:s,serialized:n}),n.bitmap=this.#w(!1);else if(this.#s){const c=t.stamps.get(this.#t);s>c.area&&(c.area=s,c.serialized.bitmap.close(),c.serialized.bitmap=this.#w(!1))}return n}#b(e){const{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,o=e.pageIndex===t,l=(e.accessibilityData?.alt||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&o&&l,isSameAltText:l}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}class Wa{#e;#t=!1;#n=null;#a=null;#i=null;#r=new Map;#o=!1;#l=!1;#c=!1;#s=null;#u=null;#h=null;#f=null;#g=null;#m=-1;#d;static _initialized=!1;static#p=new Map([Qt,Pl,tie,Yt,Ha].map(e=>[e._editorType,e]));constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:o,accessibilityManager:l,annotationLayer:s,drawLayer:c,textLayer:d,viewport:h,l10n:u}){const f=[...Wa.#p.values()];if(!Wa._initialized){Wa._initialized=!0;for(const m of f)m.initialize(u,e)}e.registerEditorTypes(f),this.#d=e,this.pageIndex=t,this.div=n,this.#e=l,this.#n=s,this.viewport=h,this.#h=d,this.drawLayer=c,this._structTree=o,this.#d.addLayer(this)}get isEmpty(){return this.#r.size===0}get isInvisible(){return this.isEmpty&&this.#d.getMode()===Je.NONE}updateToolbar(e){this.#d.updateToolbar(e)}updateMode(e=this.#d.getMode()){switch(this.#x(),e){case Je.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Je.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Je.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;if(t.toggle("nonEditing",!1),e===Je.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(const n of Wa.#p.values())t.toggle(`${n._type}Editing`,e===n._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#h?.div}setEditingState(e){this.#d.setEditingState(e)}addCommands(e){this.#d.addCommands(e)}cleanUndoStack(e){this.#d.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.div.classList.toggle("disabled",!e)}get#w(){return this.#r.size!==0?this.#r.values():this.#d.getEditors(this.pageIndex)}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#g?.abort(),this.#g=null;const e=new Set;for(const n of this.#w)n.enableEditing(),n.show(!0),n.annotationElementId&&(this.#d.removeChangedExistingAnnotation(n),e.add(n.annotationElementId));const t=this.#n;if(t)for(const n of t.getEditableAnnotations()){if(n.hide(),this.#d.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;const o=await this.deserialize(n);o&&(this.addOrRebuild(o),o.enableEditing())}this.#c=!1,this.#d._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#l=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#h&&!this.#g){this.#g=new AbortController;const n=this.#d.combinedSignal(this.#g);this.#h.div.addEventListener("pointerdown",o=>{const{clientX:s,clientY:c,timeStamp:d}=o,h=this.#m;if(d-h>500){this.#m=d;return}this.#m=-1;const{classList:u}=this.div;u.toggle("getElements",!0);const f=document.elementsFromPoint(s,c);if(u.toggle("getElements",!1),!this.div.contains(f[0]))return;let m;const p=new RegExp(`^${ao}[0-9]+$`);for(const g of f)if(p.test(g.id)){m=g.id;break}if(!m)return;const w=this.#r.get(m);w?.annotationElementId===null&&(o.stopPropagation(),o.preventDefault(),w.dblclick(o))},{signal:n,capture:!0})}const e=this.#n;if(e){const n=new Map,o=new Map;for(const s of this.#w){if(s.disableEditing(),!s.annotationElementId){s.updateFakeAnnotationElement(e);continue}if(s.serialize()!==null){n.set(s.annotationElementId,s);continue}else o.set(s.annotationElementId,s);this.getEditableAnnotation(s.annotationElementId)?.show(),s.remove()}const l=e.getEditableAnnotations();for(const s of l){const{id:c}=s.data;if(this.#d.isDeletedAnnotationElement(c)){s.updateEdited({deleted:!0});continue}let d=o.get(c);if(d){d.resetAnnotationElement(s),d.show(!1),s.show();continue}d=n.get(c),d&&(this.#d.addChangedExistingAnnotation(d),d.renderAnnotationElement(s)&&d.show(!1)),s.show()}}this.#x(),this.isEmpty&&(this.div.hidden=!0);const{classList:t}=this.div;for(const n of Wa.#p.values())t.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#l=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#d.getActive()!==e&&this.#d.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#h?.div&&!this.#f){this.#f=new AbortController;const e=this.#d.combinedSignal(this.#f);this.#h.div.addEventListener("pointerdown",this.#b.bind(this),{signal:e}),this.#h.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#h?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#h.div.classList.remove("highlighting"))}#b(e){this.#d.unselectAll();const{target:t}=e;if(t===this.#h.div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&this.#h.div.contains(t)){const{isMac:n}=ta.platform;if(e.button!==0||e.ctrlKey&&n)return;this.#d.showAllEditors("highlight",!0,!0),this.#h.div.classList.add("free"),this.toggleDrawing(),Yt.startHighlighting(this,this.#d.direction==="ltr",{target:this.#h.div,x:e.x,y:e.y}),this.#h.div.addEventListener("pointerup",()=>{this.#h.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#d._signal}),e.preventDefault()}}enableClick(){if(this.#a)return;this.#a=new AbortController;const e=this.#d.combinedSignal(this.#a);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){this.#a?.abort(),this.#a=null}attach(e){this.#r.set(e.id,e);const{annotationElementId:t}=e;t&&this.#d.isDeletedAnnotationElement(t)&&this.#d.removeDeletedAnnotationElement(e)}detach(e){this.#r.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#l&&e.annotationElementId&&this.#d.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#d.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#d.addDeletedAnnotationElement(e.annotationElementId),Te.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#d.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#c),this.#d.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#d._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:t,undo:n,mustExec:!1})}getEditorByUID(e){for(const t of this.#r.values())if(t.uid===e)return t;return null}getNextId(){return this.#d.getId()}get#v(){return Wa.#p.get(this.#d.getMode())}combinedSignal(e){return this.#d.combinedSignal(e)}#C(e){const t=this.#v;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#v?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#d.updateMode(e.mode);const{offsetX:n,offsetY:o}=this.#R(),l=this.getNextId(),s=this.#C({parent:this,id:l,x:n,y:o,uiManager:this.#d,isCentered:!0,...t});s&&this.add(s)}async deserialize(e){return await Wa.#p.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#d)||null}createAndAddNewEditor(e,t,n={}){const o=this.getNextId(),l=this.#C({parent:this,id:o,x:e.offsetX,y:e.offsetY,uiManager:this.#d,isCentered:t,...n});return l&&this.add(l),l}get boundingClientRect(){return this.div.getBoundingClientRect()}#R(){const{x:e,y:t,width:n,height:o}=this.boundingClientRect,l=Math.max(0,e),s=Math.max(0,t),c=Math.min(window.innerWidth,e+n),d=Math.min(window.innerHeight,t+o),h=(l+c)/2-e,u=(s+d)/2-t,[f,m]=this.viewport.rotation%180===0?[h,u]:[u,h];return{offsetX:f,offsetY:m}}addNewEditor(e={}){this.createAndAddNewEditor(this.#R(),!0,e)}setSelected(e){this.#d.setSelected(e)}toggleSelected(e){this.#d.toggleSelected(e)}unselect(e){this.#d.unselect(e)}pointerup(e){const{isMac:t}=ta.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#o||(this.#o=!1,this.#v?.isDrawer&&this.#v.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}const n=this.#d.getMode();if(n===Je.STAMP||n===Je.SIGNATURE){this.#d.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#d.getMode()===Je.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}const{isMac:t}=ta.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#o=!0,this.#v?.isDrawer){this.startDrawingSession(e);return}const n=this.#d.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#s){this.#v.startDrawing(this,this.#d,!1,e);return}this.#d.setCurrentDrawingSession(this),this.#s=new AbortController;const t=this.#d.combinedSignal(this.#s);this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(this.#u=null,this.commitOrRemove())},{signal:t}),this.#v.startDrawing(this,this.#d,!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&(this.#u=t);return}this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){return this.#s?(this.#d.setCurrentDrawingSession(null),this.#s.abort(),this.#s=null,this.#u=null,this.#v.endDrawing(e)):null}findNewParent(e,t,n){const o=this.#d.findParent(t,n);return o===null||o===this?!1:(o.changeParent(e),!0)}commitOrRemove(){return this.#s?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#s&&this.#v.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#d.getActive()?.parent===this&&(this.#d.commitOrRemove(),this.#d.setActiveEditor(null)),this.#i&&(clearTimeout(this.#i),this.#i=null);for(const e of this.#r.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#r.clear(),this.#d.removeLayer(this)}#x(){for(const e of this.#r.values())e.isEmpty()&&e.remove()}render({viewport:e}){this.viewport=e,yn(this.div,e);for(const t of this.#d.getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){this.#d.commitOrRemove(),this.#x();const t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,yn(this.div,{rotation:n}),t!==n)for(const o of this.#r.values())o.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#d.viewParameters.realScale}}class ea{#e=null;#t=new Map;#n=new Map;static#a=0;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(!this.#e){this.#e=e;return}if(this.#e!==e){if(this.#t.size>0)for(const t of this.#t.values())t.remove(),e.append(t);this.#e=e}}static get _svgFactory(){return nt(this,"_svgFactory",new lo)}static#i(e,[t,n,o,l]){const{style:s}=e;s.top=`${100*n}%`,s.left=`${100*t}%`,s.width=`${100*o}%`,s.height=`${100*l}%`}#r(){const e=ea._svgFactory.create(1,1,!0);return this.#e.append(e),e.setAttribute("aria-hidden",!0),e}#o(e,t){const n=ea._svgFactory.createElement("clipPath");e.append(n);const o=`clip_${t}`;n.setAttribute("id",o),n.setAttribute("clipPathUnits","objectBoundingBox");const l=ea._svgFactory.createElement("use");return n.append(l),l.setAttribute("href",`#${t}`),l.classList.add("clip"),o}#l(e,t){for(const[n,o]of Object.entries(t))o===null?e.removeAttribute(n):e.setAttribute(n,o)}draw(e,t=!1,n=!1){const o=ea.#a++,l=this.#r(),s=ea._svgFactory.createElement("defs");l.append(s);const c=ea._svgFactory.createElement("path");s.append(c);const d=`path_p${this.pageIndex}_${o}`;c.setAttribute("id",d),c.setAttribute("vector-effect","non-scaling-stroke"),t&&this.#n.set(o,c);const h=n?this.#o(s,d):null,u=ea._svgFactory.createElement("use");return l.append(u),u.setAttribute("href",`#${d}`),this.updateProperties(l,e),this.#t.set(o,l),{id:o,clipPathId:`url(#${h})`}}drawOutline(e,t){const n=ea.#a++,o=this.#r(),l=ea._svgFactory.createElement("defs");o.append(l);const s=ea._svgFactory.createElement("path");l.append(s);const c=`path_p${this.pageIndex}_${n}`;s.setAttribute("id",c),s.setAttribute("vector-effect","non-scaling-stroke");let d;if(t){const f=ea._svgFactory.createElement("mask");l.append(f),d=`mask_p${this.pageIndex}_${n}`,f.setAttribute("id",d),f.setAttribute("maskUnits","objectBoundingBox");const m=ea._svgFactory.createElement("rect");f.append(m),m.setAttribute("width","1"),m.setAttribute("height","1"),m.setAttribute("fill","white");const p=ea._svgFactory.createElement("use");f.append(p),p.setAttribute("href",`#${c}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const h=ea._svgFactory.createElement("use");o.append(h),h.setAttribute("href",`#${c}`),d&&h.setAttribute("mask",`url(#${d})`);const u=h.cloneNode();return o.append(u),h.classList.add("mainOutline"),u.classList.add("secondaryOutline"),this.updateProperties(o,e),this.#t.set(n,o),n}finalizeDraw(e,t){this.#n.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;const{root:n,bbox:o,rootClass:l,path:s}=t,c=typeof e=="number"?this.#t.get(e):e;if(c){if(n&&this.#l(c,n),o&&ea.#i(c,o),l){const{classList:d}=c;for(const[h,u]of Object.entries(l))d.toggle(h,u)}if(s){const h=c.firstChild.firstChild;this.#l(h,s)}}}updateParent(e,t){if(t===this)return;const n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#n.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(const e of this.#t.values())e.remove();this.#t.clear(),this.#n.clear()}}globalThis._pdfjsTestingUtils={HighlightOutliner:Z0};globalThis.pdfjsLib={AbortException:on,AnnotationEditorLayer:Wa,AnnotationEditorParamsType:dt,AnnotationEditorType:Je,AnnotationEditorUIManager:ln,AnnotationLayer:Zl,AnnotationMode:za,AnnotationType:Gt,applyOpacity:jd,build:Xd,ColorPicker:Ea,createValidAbsoluteUrl:yl,CSSConstants:Md,DOMSVGFactory:lo,DrawLayer:ea,FeatureTest:ta,fetchData:Er,findContrastColor:Ld,getDocument:kl,getFilenameFromUrl:Cd,getPdfFilenameFromUrl:Sd,getRGB:Rr,getUuid:Rl,getXfaPageViewport:_d,GlobalWorkerOptions:xn,ImageKind:Kr,InvalidPDFException:ci,isDataScheme:wo,isPdfFile:Ci,isValidExplicitDest:Od,MathClamp:oa,noContextMenu:Aa,normalizeUnicode:Rd,OPS:pr,OutputScale:ka,PasswordResponses:yd,PDFDataRangeTransport:Tl,PDFDateString:di,PDFWorker:gr,PermissionFlag:xd,PixelsPerInch:Nn,RenderingCancelledException:Ai,renderRichText:Sl,ResponseException:no,setLayerDimensions:yn,shadow:nt,SignatureExtractor:kn,stopEvent:Wt,SupportedImageMimeTypes:hi,TextLayer:oo,TouchManager:bo,updateUrlHash:El,Util:je,VerbosityLevel:mo,version:Dl,XfaLayer:Cl};const aie=Object.freeze(Object.defineProperty({__proto__:null,AbortException:on,AnnotationEditorLayer:Wa,AnnotationEditorParamsType:dt,AnnotationEditorType:Je,AnnotationEditorUIManager:ln,AnnotationLayer:Zl,AnnotationMode:za,AnnotationType:Gt,CSSConstants:Md,ColorPicker:Ea,DOMSVGFactory:lo,DrawLayer:ea,FeatureTest:ta,GlobalWorkerOptions:xn,ImageKind:Kr,InvalidPDFException:ci,MathClamp:oa,OPS:pr,OutputScale:ka,PDFDataRangeTransport:Tl,PDFDateString:di,PDFWorker:gr,PasswordResponses:yd,PermissionFlag:xd,PixelsPerInch:Nn,RenderingCancelledException:Ai,ResponseException:no,SignatureExtractor:kn,SupportedImageMimeTypes:hi,TextLayer:oo,TouchManager:bo,Util:je,VerbosityLevel:mo,XfaLayer:Cl,applyOpacity:jd,build:Xd,createValidAbsoluteUrl:yl,fetchData:Er,findContrastColor:Ld,getDocument:kl,getFilenameFromUrl:Cd,getPdfFilenameFromUrl:Sd,getRGB:Rr,getUuid:Rl,getXfaPageViewport:_d,isDataScheme:wo,isPdfFile:Ci,isValidExplicitDest:Od,noContextMenu:Aa,normalizeUnicode:Rd,renderRichText:Sl,setLayerDimensions:yn,shadow:nt,stopEvent:Wt,updateUrlHash:El,version:Dl},Symbol.toStringTag,{value:"Module"}));function r2(a){var e,t,n="";if(typeof a=="string"||typeof a=="number")n+=a;else if(typeof a=="object")if(Array.isArray(a)){var o=a.length;for(e=0;e<o;e++)a[e]&&(t=r2(a[e]))&&(n&&(n+=" "),n+=t)}else for(t in a)a[t]&&(n&&(n+=" "),n+=t);return n}function Mi(){for(var a,e,t=0,n="",o=arguments.length;t<o;t++)(a=arguments[t])&&(e=r2(a))&&(n&&(n+=" "),n+=e);return n}var M1=Object.prototype.hasOwnProperty;function j1(a,e,t){for(t of a.keys())if(hr(t,e))return t}function hr(a,e){var t,n,o;if(a===e)return!0;if(a&&e&&(t=a.constructor)===e.constructor){if(t===Date)return a.getTime()===e.getTime();if(t===RegExp)return a.toString()===e.toString();if(t===Array){if((n=a.length)===e.length)for(;n--&&hr(a[n],e[n]););return n===-1}if(t===Set){if(a.size!==e.size)return!1;for(n of a)if(o=n,o&&typeof o=="object"&&(o=j1(e,o),!o)||!e.has(o))return!1;return!0}if(t===Map){if(a.size!==e.size)return!1;for(n of a)if(o=n[0],o&&typeof o=="object"&&(o=j1(e,o),!o)||!hr(n[1],e.get(o)))return!1;return!0}if(t===ArrayBuffer)a=new Uint8Array(a),e=new Uint8Array(e);else if(t===DataView){if((n=a.byteLength)===e.byteLength)for(;n--&&a.getInt8(n)===e.getInt8(n););return n===-1}if(ArrayBuffer.isView(a)){if((n=a.byteLength)===e.byteLength)for(;n--&&a[n]===e[n];);return n===-1}if(!t||typeof a=="object"){n=0;for(t in a)if(M1.call(a,t)&&++n&&!M1.call(e,t)||!(t in e)||!hr(a[t],e[t]))return!1;return Object.keys(e).length===n}}return a!==a&&e!==e}function Eo(a){let e=!1;return{promise:new Promise((n,o)=>{a.then(l=>!e&&n(l)).catch(l=>!e&&o(l))}),cancel(){e=!0}}}const nie=["onCopy","onCut","onPaste"],rie=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],oie=["onFocus","onBlur"],iie=["onInput","onInvalid","onReset","onSubmit"],lie=["onLoad","onError"],sie=["onKeyDown","onKeyPress","onKeyUp"],cie=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],die=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],hie=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],uie=["onSelect"],fie=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],mie=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],pie=["onScroll"],gie=["onWheel"],wie=["onAnimationStart","onAnimationEnd","onAnimationIteration"],vie=["onTransitionEnd"],bie=["onToggle"],xie=["onChange"],yie=[...nie,...rie,...oie,...iie,...lie,...sie,...cie,...die,...hie,...uie,...fie,...mie,...pie,...gie,...wie,...vie,...xie,...bie];function o2(a,e){const t={};for(const n of yie){const o=a[n];o&&(e?t[n]=(l=>o(l,e(n))):t[n]=o)}return t}var Eie=process.env.NODE_ENV==="production",c0="Invariant failed";function _t(a,e){if(!a){if(Eie)throw new Error(c0);var t=typeof e=="function"?e():e,n=t?"".concat(c0,": ").concat(t):c0;throw new Error(n)}}var d0,L1;function Rie(){if(L1)return d0;L1=1;var a=process.env.NODE_ENV!=="production",e=function(){};if(a){var t=function(o,l){var s=arguments.length;l=new Array(s>1?s-1:0);for(var c=1;c<s;c++)l[c-1]=arguments[c];var d=0,h="Warning: "+o.replace(/%s/g,function(){return l[d++]});typeof console<"u"&&console.error(h);try{throw new Error(h)}catch{}};e=function(n,o,l){var s=arguments.length;l=new Array(s>2?s-2:0);for(var c=2;c<s;c++)l[c-2]=arguments[c];if(o===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");n||t.apply(null,[o].concat(l))}}return d0=e,d0}var Aie=Rie();const la=_7(Aie),i2=E.createContext(null),Cie="noopener noreferrer nofollow";class Sie{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return _t(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(e){_t(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}addLinkAttributes(e,t,n){e.href=t,e.rel=this.externalLinkRel||Cie,e.target=n?"_blank":this.externalLinkTarget||""}goToDestination(e){return new Promise(t=>{_t(this.pdfDocument,"PDF document not loaded."),_t(e,"Destination is not specified."),typeof e=="string"?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)}).then(t=>{_t(Array.isArray(t),`"${t}" is not a valid destination array.`);const n=t[0];new Promise(o=>{_t(this.pdfDocument,"PDF document not loaded."),n instanceof Object?this.pdfDocument.getPageIndex(n).then(l=>{o(l)}).catch(()=>{_t(!1,`"${n}" is not a valid page reference.`)}):typeof n=="number"?o(n):_t(!1,`"${n}" is not a valid destination reference.`)}).then(o=>{const l=o+1;_t(this.pdfViewer,"PDF viewer is not initialized."),_t(l>=1&&l<=this.pagesCount,`"${l}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:o,pageNumber:l})})})}goToPage(e){const t=e-1;_t(this.pdfViewer,"PDF viewer is not initialized."),_t(e>=1&&e<=this.pagesCount,`"${e}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(e){this.goToDestination(e)}}function ur({children:a,type:e}){return i.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:a})}const F1={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function _ie(a,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return a}}function wr(){return E.useReducer(_ie,{value:void 0,error:void 0})}const ji=typeof window<"u",l2=ji&&window.location.protocol==="file:";function Mie(a){return typeof a<"u"}function Mn(a){return Mie(a)&&a!==null}function jie(a){return typeof a=="string"}function Lie(a){return a instanceof ArrayBuffer}function Fie(a){return _t(ji,"isBlob can only be used in a browser environment"),a instanceof Blob}function H0(a){return jie(a)&&/^data:/.test(a)}function I1(a){_t(H0(a),"Invalid data URI.");const[e="",t=""]=a.split(",");return e.split(";").indexOf("base64")!==-1?atob(t):unescape(t)}function Iie(){return ji&&window.devicePixelRatio||1}const s2="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function k1(){la(!l2,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${s2}`)}function kie(){la(!l2,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${s2}`)}function Vn(a){a?.cancel&&a.cancel()}function V0(a,e){return Object.defineProperty(a,"width",{get(){return this.getViewport({scale:e}).width},configurable:!0}),Object.defineProperty(a,"height",{get(){return this.getViewport({scale:e}).height},configurable:!0}),Object.defineProperty(a,"originalWidth",{get(){return this.getViewport({scale:1}).width},configurable:!0}),Object.defineProperty(a,"originalHeight",{get(){return this.getViewport({scale:1}).height},configurable:!0}),a}function c2(a){return a.name==="AbortException"||a.name==="RenderingCancelledException"}function Oie(a){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return t(new Error("Error while reading a file."));e(n.result)},n.onerror=o=>{if(!o.target)return t(new Error("Error while reading a file."));const{error:l}=o.target;if(!l)return t(new Error("Error while reading a file."));switch(l.code){case l.NOT_FOUND_ERR:return t(new Error("Error while reading a file: File not found."));case l.SECURITY_ERR:return t(new Error("Error while reading a file: Security error."));case l.ABORT_ERR:return t(new Error("Error while reading a file: Aborted."));default:return t(new Error("Error while reading a file."))}},n.readAsArrayBuffer(a)})}const{PDFDataRangeTransport:Tie}=aie,Die=(a,e)=>{switch(e){case F1.NEED_PASSWORD:{const t=prompt("Enter the password to open this PDF file.");a(t);break}case F1.INCORRECT_PASSWORD:{const t=prompt("Invalid password. Please try again.");a(t);break}}};function O1(a){return typeof a=="object"&&a!==null&&("data"in a||"range"in a||"url"in a)}const $ie=E.forwardRef(function({children:e,className:t,error:n="Failed to load PDF file.",externalLinkRel:o,externalLinkTarget:l,file:s,inputRef:c,imageResourcesPath:d,loading:h="Loading PDF…",noData:u="No PDF file specified.",onItemClick:f,onLoadError:m,onLoadProgress:p,onLoadSuccess:w,onPassword:g=Die,onSourceError:b,onSourceSuccess:v,options:x,renderMode:y,rotate:R,scale:S,..._},C){const[A,M]=wr(),{value:L,error:j}=A,[$,Z]=wr(),{value:D,error:k}=$,O=E.useRef(new Sie),T=E.useRef([]),V=E.useRef(void 0),z=E.useRef(void 0);s&&s!==V.current&&O1(s)&&(la(!hr(s,V.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),V.current=s),x&&x!==z.current&&(la(!hr(x,z.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),z.current=x);const G=E.useRef({scrollPageIntoView:he=>{const{dest:de,pageNumber:H,pageIndex:Y=H-1}=he;if(f){f({dest:de,pageIndex:Y,pageNumber:H});return}const ue=T.current[Y];if(ue){ue.scrollIntoView();return}la(!1,`An internal link leading to page ${H} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});E.useImperativeHandle(C,()=>({linkService:O,pages:T,viewer:G}),[]);function ae(){v&&v()}function Q(){j&&(la(!1,j.toString()),b&&b(j))}function K(){M({type:"RESET"})}E.useEffect(K,[s,M]);const q=E.useCallback(async()=>{if(!s)return null;if(typeof s=="string")return H0(s)?{data:I1(s)}:(k1(),{url:s});if(s instanceof Tie)return{range:s};if(Lie(s))return{data:s};if(ji&&Fie(s))return{data:await Oie(s)};if(_t(typeof s=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),_t(O1(s),"Invalid parameter object: need either .data, .range or .url"),"url"in s&&typeof s.url=="string"){if(H0(s.url)){const{url:he,...de}=s;return{data:I1(he),...de}}k1()}return s},[s]);E.useEffect(()=>{const he=Eo(q());return he.promise.then(de=>{M({type:"RESOLVE",value:de})}).catch(de=>{M({type:"REJECT",error:de})}),()=>{Vn(he)}},[q,M]),E.useEffect(()=>{if(!(typeof L>"u")){if(L===!1){Q();return}ae()}},[L]);function ne(){D&&(w&&w(D),T.current=new Array(D.numPages),O.current.setDocument(D))}function X(){k&&(la(!1,k.toString()),m&&m(k))}E.useEffect(function(){Z({type:"RESET"})},[Z,L]),E.useEffect(function(){if(!L)return;const de=x?{...L,...x}:L,H=kl(de);p&&(H.onProgress=p),g&&(H.onPassword=g);const Y=H;return Y.promise.then(ue=>{Y.destroyed||Z({type:"RESOLVE",value:ue})}).catch(ue=>{Y.destroyed||Z({type:"REJECT",error:ue})}),()=>{Y.destroy()}},[x,Z,L]),E.useEffect(()=>{if(!(typeof D>"u")){if(D===!1){X();return}ne()}},[D]),E.useEffect(function(){O.current.setViewer(G.current),O.current.setExternalLinkRel(o),O.current.setExternalLinkTarget(l)},[o,l]);const ee=E.useCallback((he,de)=>{T.current[he]=de},[]),le=E.useCallback(he=>{delete T.current[he]},[]),U=E.useMemo(()=>({imageResourcesPath:d,linkService:O.current,onItemClick:f,pdf:D,registerPage:ee,renderMode:y,rotate:R,scale:S,unregisterPage:le}),[d,f,D,ee,y,R,S,le]),fe=E.useMemo(()=>o2(_,()=>D),[_,D]);function be(){function he(H){return!!H?.pdf}if(!he(U))throw new Error("pdf is undefined");const de=typeof e=="function"?e(U):e;return i.jsx(i2.Provider,{value:U,children:de})}function J(){return s?D==null?i.jsx(ur,{type:"loading",children:typeof h=="function"?h():h}):D===!1?i.jsx(ur,{type:"error",children:typeof n=="function"?n():n}):be():i.jsx(ur,{type:"no-data",children:typeof u=="function"?u():u})}return i.jsx("div",{className:Mi("react-pdf__Document",t),ref:c,...fe,children:J()})});function d2(){return E.useContext(i2)}function h2(){for(var a=[],e=0;e<arguments.length;e++)a[e]=arguments[e];var t=a.filter(Boolean);if(t.length<=1){var n=t[0];return n||null}return function(l){for(var s=0,c=t;s<c.length;s++){var d=c[s];typeof d=="function"?d(l):d&&(d.current=l)}}}const u2=E.createContext(null);function Li(){return E.useContext(u2)}function Bie(){const a=d2(),e=Li();_t(e,"Unable to find Page context.");const t={...a,...e},{filterAnnotations:n,imageResourcesPath:o,linkService:l,onGetAnnotationsError:s,onGetAnnotationsSuccess:c,onRenderAnnotationLayerError:d,onRenderAnnotationLayerSuccess:h,page:u,pdf:f,renderForms:m,rotate:p,scale:w=1}=t;_t(f,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),_t(u,"Attempted to load page annotations, but no page was specified."),_t(l,"Attempted to load page annotations, but no linkService was specified.");const[g,b]=wr(),{value:v,error:x}=g,y=E.useRef(null);la(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function R(){v&&c&&c(v)}function S(){x&&(la(!1,x.toString()),s&&s(x))}E.useEffect(function(){b({type:"RESET"})},[b,u]),E.useEffect(function(){if(!u)return;const L=Eo(u.getAnnotations()),j=L;return L.promise.then($=>{b({type:"RESOLVE",value:$})}).catch($=>{b({type:"REJECT",error:$})}),()=>{Vn(j)}},[b,u]),E.useEffect(()=>{if(v!==void 0){if(v===!1){S();return}R()}},[v]);function _(){h&&h()}function C(M){la(!1,`${M}`),d&&d(M)}const A=E.useMemo(()=>u.getViewport({scale:w,rotation:p}),[u,p,w]);return E.useEffect(function(){if(!f||!u||!l||!v)return;const{current:L}=y;if(!L)return;const j=A.clone({dontFlip:!0}),$={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:f.annotationStorage,commentManager:null,div:L,l10n:null,linkService:l,page:u,structTreeLayer:null,viewport:j},Z={annotations:n?n({annotations:v}):v,annotationStorage:f.annotationStorage,div:L,imageResourcesPath:o,linkService:l,page:u,renderForms:m,viewport:j};L.innerHTML="";try{new Zl($).render(Z),_()}catch(D){C(D)}return()=>{}},[v,n,o,l,u,f,m,A]),i.jsx("div",{className:Mi("react-pdf__Page__annotations","annotationLayer"),ref:y})}const f2={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Zie=/^H(\d+)$/;function Pie(a){return a in f2}function Fi(a){return"children"in a}function m2(a){return Fi(a)?a.children.length===1&&0 in a.children&&"id"in a.children[0]:!1}function Nie(a){const e={};if(Fi(a)){const{role:t}=a,n=t.match(Zie);if(n)e.role="heading",e["aria-level"]=Number(n[1]);else if(Pie(t)){const o=f2[t];o&&(e.role=o)}}return e}function p2(a){const e={};if(Fi(a)){if(a.alt!==void 0&&(e["aria-label"]=a.alt),a.lang!==void 0&&(e.lang=a.lang),m2(a)){const[t]=a.children;if(t){const n=p2(t);return{...e,...n}}}}else"id"in a&&(e["aria-owns"]=a.id);return e}function Hie(a){return a?{...Nie(a),...p2(a)}:null}function g2({className:a,node:e}){const t=E.useMemo(()=>Hie(e),[e]),n=E.useMemo(()=>!Fi(e)||m2(e)?null:e.children.map((o,l)=>i.jsx(g2,{node:o},l)),[e]);return i.jsx("span",{className:a,...t,children:n})}function Vie(){const a=Li();_t(a,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:t}=a,[n,o]=wr(),{value:l,error:s}=n,{customTextRenderer:c,page:d}=a;function h(){l&&t&&t(l)}function u(){s&&(la(!1,s.toString()),e&&e(s))}return E.useEffect(function(){o({type:"RESET"})},[o,d]),E.useEffect(function(){if(c||!d)return;const m=Eo(d.getStructTree()),p=m;return m.promise.then(w=>{o({type:"RESOLVE",value:w})}).catch(w=>{o({type:"REJECT",error:w})}),()=>Vn(p)},[c,d,o]),E.useEffect(()=>{if(l!==void 0){if(l===!1){u();return}h()}},[l]),l?i.jsx(g2,{className:"react-pdf__Page__structTree structTree",node:l}):null}const T1=za;function Wie(a){const e=Li();_t(e,"Unable to find Page context.");const t={...e,...a},{_className:n,canvasBackground:o,devicePixelRatio:l=Iie(),onRenderError:s,onRenderSuccess:c,page:d,renderForms:h,renderTextLayer:u,pageColors:f,rotate:m,scale:p}=t,{canvasRef:w}=a;_t(d,"Attempted to render page canvas, but no page was specified.");const g=E.useRef(null);function b(){d&&c&&c(V0(d,p))}function v(S){c2(S)||(la(!1,S.toString()),s&&s(S))}const x=E.useMemo(()=>d.getViewport({scale:p*l,rotation:m}),[l,d,m,p]),y=E.useMemo(()=>d.getViewport({scale:p,rotation:m}),[d,m,p]);E.useEffect(function(){if(!d)return;d.cleanup();const{current:_}=g;if(!_)return;_.width=x.width,_.height=x.height,_.style.width=`${Math.floor(y.width)}px`,_.style.height=`${Math.floor(y.height)}px`,_.style.visibility="hidden";const C={annotationMode:h?T1.ENABLE_FORMS:T1.ENABLE,canvas:_,canvasContext:_.getContext("2d",{alpha:!1}),pageColors:f,viewport:x};o&&(C.background=o);const A=d.render(C),M=A;return A.promise.then(()=>{_.style.visibility="",b()}).catch(v),()=>Vn(M)},[o,d,f,h,x,y]);const R=E.useCallback(()=>{const{current:S}=g;S&&(S.width=0,S.height=0)},[]);return E.useEffect(()=>R,[R]),i.jsx("canvas",{className:`${n}__canvas`,dir:"ltr",ref:h2(w,g),style:{display:"block",userSelect:"none"},children:u?i.jsx(Vie,{}):null})}function zie(a){return"str"in a}const Uie=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),Gie=new Set(["action","formaction","href","poster","src","xlink:href"]);function Yie(a){let e="";for(const t of a){const n=t.charCodeAt(0);n<=32||n===127||(e+=t.toLowerCase())}return e.startsWith("javascript:")||e.startsWith("vbscript:")}function Xie(a){return a.nodeType===Node.ELEMENT_NODE}function w2(a){return Xie(a)&&a instanceof HTMLElement}function qie(a){return w2(a)&&Uie.has(a.tagName.toLowerCase())}function Kie(a){const e=document.createElement(a.tagName.toLowerCase());return Array.from(a.attributes).forEach(t=>{const n=t.name.toLowerCase();n.startsWith("on")||n==="srcdoc"||Gie.has(n)&&Yie(t.value)||e.setAttribute(t.name,t.value)}),Array.from(a.childNodes).forEach(t=>{e.append(v2(t))}),e}function v2(a){var e;return w2(a)&&!qie(a)?Kie(a):document.createTextNode((e=a.textContent)!==null&&e!==void 0?e:"")}function Jie(a,e){const t=document.createElement("template");t.innerHTML=e;const n=document.createDocumentFragment();Array.from(t.content.childNodes).forEach(o=>{n.append(v2(o))}),a.replaceChildren(n)}function Qie(){const a=Li();_t(a,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:t,onGetTextSuccess:n,onRenderTextLayerError:o,onRenderTextLayerSuccess:l,page:s,pageIndex:c,pageNumber:d,rotate:h,scale:u}=a;_t(s,"Attempted to load page text content, but no page was specified.");const[f,m]=wr(),{value:p,error:w}=f,g=E.useRef(null);la(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function b(){p&&n&&n(p)}function v(){w&&(la(!1,w.toString()),t&&t(w))}E.useEffect(function(){m({type:"RESET"})},[s,m]),E.useEffect(function(){if(!s)return;const A=Eo(s.getTextContent()),M=A;return A.promise.then(L=>{m({type:"RESOLVE",value:L})}).catch(L=>{m({type:"REJECT",error:L})}),()=>Vn(M)},[s,m]),E.useEffect(()=>{if(p!==void 0){if(p===!1){v();return}b()}},[p]);const x=E.useCallback(()=>{l&&l()},[l]),y=E.useCallback(C=>{c2(C)||(la(!1,C.toString()),o&&o(C))},[o]);function R(){const C=g.current;C&&C.classList.add("selecting")}function S(){const C=g.current;C&&C.classList.remove("selecting")}const _=E.useMemo(()=>s.getViewport({scale:u,rotation:h}),[s,h,u]);return E.useLayoutEffect(function(){if(!s||!p)return;const{current:A}=g;if(!A)return;A.innerHTML="";const M=s.streamTextContent({includeMarkedContent:!0}),L={container:A,textContentSource:M,viewport:_},j=new oo(L),$=j;return j.render().then(()=>{const Z=document.createElement("div");Z.className="endOfContent",A.append(Z);const D=A.querySelectorAll('[role="presentation"]');if(e){let k=0;p.items.forEach((O,T)=>{if(!zie(O))return;const V=D[k];if(!V)return;const z=e({pageIndex:c,pageNumber:d,itemIndex:T,...O});Jie(V,z),k+=O.str&&O.hasEOL?2:1})}x()}).catch(y),()=>Vn($)},[e,y,x,s,c,d,p,_]),i.jsx("div",{className:Mi("react-pdf__Page__textContent","textLayer"),onMouseUp:S,onMouseDown:R,ref:g})}const D1=1;function e0e(a){const t={...d2(),...a},{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:o=!0,canvasBackground:l,canvasRef:s,children:c,className:d,customRenderer:h,customTextRenderer:u,devicePixelRatio:f,error:m="Failed to load the page.",filterAnnotations:p,height:w,inputRef:g,loading:b="Loading page…",noData:v="No page specified.",onGetAnnotationsError:x,onGetAnnotationsSuccess:y,onGetStructTreeError:R,onGetStructTreeSuccess:S,onGetTextError:_,onGetTextSuccess:C,onLoadError:A,onLoadSuccess:M,onRenderAnnotationLayerError:L,onRenderAnnotationLayerSuccess:j,onRenderError:$,onRenderSuccess:Z,onRenderTextLayerError:D,onRenderTextLayerSuccess:k,pageColors:O,pageIndex:T,pageNumber:V,pdf:z,registerPage:G,renderAnnotationLayer:ae=!0,renderForms:Q=!1,renderMode:K="canvas",renderTextLayer:q=!0,rotate:ne,scale:X=D1,unregisterPage:ee,width:le,...U}=t,[fe,be]=wr(),{value:J,error:he}=fe,de=E.useRef(null);_t(z,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const H=Mn(V)?V-1:T??null,Y=V??(Mn(T)?T+1:null),ue=ne??(J?J.rotate:null),me=E.useMemo(()=>{if(!J)return null;let ce=1;const te=X??D1;if(le||w){const N=J.getViewport({scale:1,rotation:ue});le?ce=le/N.width:w&&(ce=w/N.height)}return te*ce},[w,J,ue,X,le]);E.useEffect(function(){return()=>{Mn(H)&&o&&ee&&ee(H)}},[o,z,H,ee]);function Ae(){if(M){if(!J||!me)return;M(V0(J,me))}if(o&&G){if(!Mn(H)||!de.current)return;G(H,de.current)}}function ye(){he&&(la(!1,he.toString()),A&&A(he))}E.useEffect(function(){be({type:"RESET"})},[be,z,H]),E.useEffect(function(){if(!z||!Y)return;const te=Eo(z.getPage(Y)),N=te;return te.promise.then(Re=>{be({type:"RESOLVE",value:Re})}).catch(Re=>{be({type:"REJECT",error:Re})}),()=>Vn(N)},[be,z,Y]),E.useEffect(()=>{if(J!==void 0){if(J===!1){ye();return}Ae()}},[J,me]);const Ie=E.useMemo(()=>Mn(H)&&Y&&Mn(ue)&&Mn(me)?{_className:n,canvasBackground:l,customTextRenderer:u,devicePixelRatio:f,filterAnnotations:p,onGetAnnotationsError:x,onGetAnnotationsSuccess:y,onGetStructTreeError:R,onGetStructTreeSuccess:S,onGetTextError:_,onGetTextSuccess:C,onRenderAnnotationLayerError:L,onRenderAnnotationLayerSuccess:j,onRenderError:$,onRenderSuccess:Z,onRenderTextLayerError:D,onRenderTextLayerSuccess:k,page:J,pageColors:O,pageIndex:H,pageNumber:Y,renderForms:Q,renderTextLayer:q,rotate:ue,scale:me}:null,[n,l,u,f,p,x,y,R,S,_,C,L,j,$,Z,D,k,J,O,H,Y,Q,q,ue,me]),Ee=E.useMemo(()=>o2(U,()=>J&&(me?V0(J,me):void 0)),[U,J,me]),Ye=`${H}@${me}/${ue}`;function Ce(){switch(K){case"custom":return _t(h,'renderMode was set to "custom", but no customRenderer was passed.'),i.jsx(h,{},`${Ye}_custom`);case"none":return null;default:return i.jsx(Wie,{canvasRef:s},`${Ye}_canvas`)}}function Se(){return q?i.jsx(Qie,{},`${Ye}_text`):null}function it(){return ae?i.jsx(Bie,{},`${Ye}_annotations`):null}function rt(){function ce(N){return!!N?.page}if(!ce(Ie))throw new Error("page is undefined");const te=typeof c=="function"?c(Ie):c;return i.jsxs(u2.Provider,{value:Ie,children:[Ce(),Se(),it(),te]})}function ht(){return Y?z===null||J===void 0||J===null?i.jsx(ur,{type:"loading",children:typeof b=="function"?b():b}):z===!1||J===!1?i.jsx(ur,{type:"error",children:typeof m=="function"?m():m}):rt():i.jsx(ur,{type:"no-data",children:typeof v=="function"?v():v})}return i.jsx("div",{className:Mi(n,d),"data-page-number":Y,ref:h2(g,de),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${me}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:l||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...Ee,children:ht()})}kie();xn.workerSrc="pdf.worker.mjs";xn.workerSrc=`https://unpkg.com/pdfjs-dist@${Dl}/build/pdf.worker.min.mjs`;const jn={fontFamily:I,fontWeight:400,fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#29474C",margin:0},t0e={fontFamily:I,fontWeight:500,fontSize:"14px",lineHeight:"24px",letterSpacing:"0.01em",color:"#29474C",margin:0},a0e="#6D3856",n0e="#455DA2",r0e={fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"20px",lineHeight:"30px",letterSpacing:0,color:"#29474C",margin:0},or={fontSize:"16px",lineHeight:"24px"},W0={fontFamily:qe,fontWeight:600,fontStyle:"normal",fontSize:"14px",lineHeight:"18px",letterSpacing:"0.01em"},h0=a=>({background:a?n0e:a0e,color:"#FFFFFF",borderRadius:6,padding:"2px 10px",display:"inline-flex",alignItems:"center",...W0}),$1=["persona","empresa","legajo","fechaImportacion","periodo"],B1={persona:{label:"PERSONA",getValue:({colaborador:a})=>a,valueStyle:or},empresa:{label:"EMPRESA",getValue:({empresa:a})=>a,valueStyle:or},legajo:{label:"N DE LEGAJO",getValue:({legajo:a})=>a,valueStyle:W0},recibo:{label:"RECIBO",getValue:({recibo:a})=>a,valueStyle:W0},fechaImportacion:{label:"FECHA DE IMPORTACION",getValue:({fechaImportacion:a})=>a},periodo:{label:"PERIODO",getValue:({periodo:a})=>a,wide:!0}},o0e=({isOpen:a=!1,onClose:e,onDownload:t,title:n="Contrato de trabajo",tagLabel:o="Confidencial",headerBadge:l,legajo:s="LEG-1004",point:c=!1,recibo:d="",colaborador:h="Pedro Sanchez Carmona",empresa:u="TechCorp Argentina",fechaImportacion:f="02-08-2026",periodo:m="2026-08",pdfUrl:p="",closeButtonLabel:w="Cerrar",downloadButtonLabel:g="Descargar PDF",onDownloadButtonClick:b,downloadButtonProps:v={},mobileBreakpoint:x=768,previewTitle:y="Vista previa del PDF",previewSubtitle:R="Contrato de trabajo",previewDescription:S="El documento se mostraria embebido aqui con scroll interno.",previewBackgroundColor:_="#FFFFFF",previewIconName:C="DocumentTextIcon",previewIconColor:A="#A7BEC3",previewIconSize:M=56,previewTitleStyle:L={},previewSubtitleStyle:j={},previewDescriptionStyle:$={},forcePreviewError:Z=!1,showErrorStateOnPreviewFailure:D=!1,previewErrorTitle:k="",previewErrorSubtitle:O="No se puede previsualizar el documento",previewErrorDescription:T="No hay conexión con el servidor o el servicio de documentos no está disponible en este momento.",previewErrorRetryLabel:V="Reintentar",onPreviewRetry:z,previewRetryButtonProps:G={},previewErrorIconName:ae="FaceFrownIcon",previewErrorIconColor:Q="#6D3856",onPreviewLoadError:K,previewErrorContainerStyle:q={},previewErrorIconSize:ne=80,previewErrorTitleStyle:X={},previewErrorSubtitleStyle:ee={},previewErrorDescriptionStyle:le={},pdfToolbarStyle:U={},pdfToolbarButtonStyle:fe={},pdfViewerContainerStyle:be={},pdfDocumentContainerStyle:J={},pdfPageWrapperStyle:he={},infoFields:de})=>{const[H,Y]=E.useState(0),[ue,me]=E.useState(!1),[Ae,ye]=E.useState(0),[Ie,Ee]=E.useState(1),[Ye,Ce]=E.useState(0),[Se,it]=E.useState(typeof window<"u"?window.innerWidth:1920),rt=E.useRef(null);if(E.useEffect(()=>{if(!a)return;const De=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=De}},[a]),E.useEffect(()=>{if(!a||!rt.current||typeof ResizeObserver>"u")return;const De=new ResizeObserver(et=>{const tt=et[0];tt&&ye(Math.max(0,Math.floor(tt.contentRect.width-24)))});return De.observe(rt.current),()=>De.disconnect()},[a]),E.useEffect(()=>{if(typeof window>"u")return;const De=()=>it(window.innerWidth);return De(),window.addEventListener("resize",De),()=>window.removeEventListener("resize",De)},[]),E.useEffect(()=>{a||(me(!1),Y(0),Ee(1),Ce(0))},[a]),!a)return null;const ht=!!c,ce=ht?d:s,te={colaborador:h,empresa:u,legajo:s,recibo:d,fechaImportacion:f,periodo:m},N=de==null,Re=(N?$1:Array.isArray(de)?de:$1).filter(De=>B1[De]),xt=N?"repeat(4, minmax(0, 1fr))":`repeat(${Math.min(Math.max(Re.length,1),4)}, minmax(0, 1fr))`,Fe=Se<=x,pe=!!p,we={minWidth:36,height:32,padding:"4px 10px",borderRadius:6,border:"1px solid #38656D",background:"#FFFFFF",color:"#38656D",cursor:"pointer",fontFamily:I,fontWeight:500,fontSize:14,lineHeight:"20px",...fe},He=()=>Ee(De=>Math.max(.5,Number((De-.1).toFixed(2)))),ut=()=>Ee(De=>Math.min(2,Number((De+.1).toFixed(2)))),Le=()=>Ee(1),st=()=>Ce(De=>(De+90)%360),gt=()=>(b??t)?.(),wt=i.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"12px 16px",boxSizing:"border-box"},children:[i.jsx(P,{name:C,variant:"24-outline",size:M,style:{color:A}}),i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:500,fontSize:"16px",lineHeight:"24px",color:"#29474C",margin:"12px 0 0",letterSpacing:"0px",...L},children:y}),i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:400,fontSize:"16px",lineHeight:"19.5px",letterSpacing:"0px",color:"#29474C",margin:"6px 0 0",textAlign:"center",...j},children:R}),i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:400,fontSize:"16px",lineHeight:"18px",letterSpacing:"0px",color:"#6B7280",margin:"8px 0 0",textAlign:"center",...$},children:S})]}),ft=i.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"16px 20px",boxSizing:"border-box",overflowY:"auto",...q},children:[i.jsx(P,{name:ae,variant:"24-outline",size:ne,style:{color:Q,width:ne,height:ne,opacity:1}}),O?i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:500,fontSize:"20px",lineHeight:"30px",letterSpacing:"0px",color:"#29474C",margin:"10px 0 0",textAlign:"center",whiteSpace:"normal",overflowWrap:"anywhere",wordBreak:"break-word",...ee,...X},children:O}):null,i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:400,fontSize:"16px",lineHeight:"24px",letterSpacing:"0px",color:"#474747",margin:"8px 0 0",textAlign:"center",maxWidth:520,whiteSpace:"normal",overflowWrap:"anywhere",wordBreak:"break-word",...le},children:T}),i.jsxs("button",{type:"button",onClick:()=>z?.(),...G,style:{marginTop:16,padding:"8px 12px",height:37,borderRadius:8,border:"1px solid #38656D",background:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontFamily:I,fontWeight:500,fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#38656D",...G?.style||{}},children:[i.jsx(P,{name:"ArrowPathIcon",variant:"24-outline",size:20,style:{color:"#38656D",marginRight:8}}),V]})]});return i.jsx("div",{style:{position:"fixed",inset:0,zIndex:1500,background:"#00000040",display:"flex",alignItems:Fe?"stretch":"center",justifyContent:"center",padding:Fe?0:20,boxSizing:"border-box"},onClick:()=>e?.(),children:i.jsxs("div",{role:"dialog","aria-modal":"true",onClick:De=>De.stopPropagation(),style:{width:Fe?"100%":861,maxWidth:"100%",height:Fe?"100%":"min(807px, calc(100vh - 40px))",maxHeight:Fe?"100%":"calc(100vh - 40px)",borderRadius:Fe?0:16,background:"#FFFFFF",border:"1px solid #C4C4C4",boxSizing:"border-box",display:"flex",flexDirection:"column",overflow:"hidden"},children:[i.jsxs("div",{style:{padding:Fe?"12px 10px 8px":"16px 16px 12px",borderBottom:"1px solid #E5E7EB",display:"flex",flexDirection:"column",gap:Fe?4:8},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[i.jsx(B,{component:"h2",variant:"h6",className:"anima-vista-documento__title",style:r0e,children:n}),i.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[!Fe&&!ht&&(l??i.jsx("span",{style:{height:28,padding:"4px 12px",borderRadius:999,border:"1px solid #4C6897",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#4C6897",fontFamily:I,fontWeight:500,fontSize:14,lineHeight:"20px"},children:o})),i.jsx("button",{type:"button","aria-label":"Cerrar modal",onClick:()=>e?.(),style:{border:"none",background:"transparent",padding:0,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:i.jsx(P,{name:"XMarkIcon",variant:"24-outline",size:22,style:{color:"#29474C"}})})]})]}),ht?ce?i.jsx("div",{style:{display:"flex",alignItems:"center"},children:i.jsx("span",{style:h0(ht),children:ce})}):null:Fe?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[i.jsx(B,{component:"span",style:{...jn,fontWeight:500,letterSpacing:"0.01em",...or},children:h}),i.jsx("span",{style:h0(!1),children:s})]}),i.jsx(B,{component:"span",style:{...jn,fontWeight:400,letterSpacing:"0.01em",...or},children:u}),i.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:2},children:l??i.jsx("span",{style:{height:20,padding:"2px 12px",borderRadius:999,border:"1px solid #4C6897",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#4C6897",fontFamily:I,fontWeight:500,fontSize:12,lineHeight:"16px"},children:o})})]}):i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx("span",{style:h0(!1),children:s}),i.jsx(B,{component:"span",style:{...jn,fontWeight:500,letterSpacing:"0.01em",...or},children:h}),i.jsx(B,{component:"span",style:{...jn,color:"#6B7280"},children:"·"}),i.jsx(B,{component:"span",style:{...jn,fontWeight:400,letterSpacing:"0.01em",...or},children:u})]})]}),i.jsxs("div",{style:{padding:Fe?10:16,display:"flex",flexDirection:"column",gap:Fe?12:16,flex:1,minHeight:0,overflowY:"auto",background:"#F3F3F3"},children:[pe&&!ue&&i.jsxs("div",{style:{border:"1px solid #C4C4C4",borderRadius:8,background:"#FFFFFF",padding:Fe?"8px 10px":"10px 12px",display:"flex",alignItems:"center",justifyContent:"center",gap:8,flexWrap:"wrap",...U},children:[i.jsx("button",{type:"button","aria-label":"Reducir zoom",onClick:He,style:we,children:"-"}),i.jsx("button",{type:"button","aria-label":"Aumentar zoom",onClick:ut,style:we,children:"+"}),i.jsx("button",{type:"button",onClick:Le,style:we,children:"Ajustar ancho"}),i.jsx("span",{style:{color:"#A7BEC3",fontFamily:I},children:"|"}),i.jsxs(B,{component:"span",style:jn,children:["Total paginas: ",H||"-"]}),i.jsx("span",{style:{color:"#A7BEC3",fontFamily:I},children:"|"}),i.jsx("button",{type:"button",onClick:st,style:we,children:"Rotar"}),i.jsx("span",{style:{color:"#A7BEC3",fontFamily:I},children:"|"}),i.jsx("button",{type:"button",onClick:gt,style:we,children:"Descargar"})]}),i.jsx("div",{ref:rt,style:{flex:1,minHeight:Fe?210:280,border:"1px solid #C4C4C4",borderRadius:8,background:_,overflow:"auto",display:"flex",alignItems:"stretch",justifyContent:"flex-start",padding:12,boxSizing:"border-box",...be},children:Z||D&&ue?ft:pe&&!ue?i.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",...J},children:i.jsx($ie,{file:p,loading:wt,onLoadSuccess:({numPages:De})=>{Y(De),Ee(1),Ce(0),me(!1)},onLoadError:De=>{me(!0),K?.(De)},children:Array.from({length:H},(De,et)=>i.jsx("div",{style:{marginBottom:et===H-1?0:16,background:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:6,boxShadow:"0 1px 2px rgba(0, 0, 0, 0.08)",padding:4,boxSizing:"border-box",...he},children:i.jsx(e0e,{pageNumber:et+1,width:Ae>0?Ae*Ie:void 0,rotate:Ye,renderTextLayer:!1,renderAnnotationLayer:!1})},`pdf-page-${et+1}`))})}):pe&&ue?i.jsx("object",{data:p,type:"application/pdf",style:{width:"100%",height:"100%",border:"none",borderRadius:8,background:"#FFFFFF"},children:i.jsx("iframe",{title:"Vista previa del PDF",src:p,style:{width:"100%",height:"100%",border:"none",borderRadius:8,background:"#FFFFFF"}})}):wt}),i.jsx("div",{style:{border:"1px solid #C4C4C4",borderRadius:8,background:"#FFFFFF",padding:Fe?"14px 12px":"16px 18px",display:"grid",gridTemplateColumns:Fe?"1fr":xt,rowGap:14,columnGap:16},children:Re.map(De=>{const et=B1[De],tt=!Fe&&et.wide&&(N||Re.length>=4)&&De==="periodo";return i.jsxs("div",{style:tt?{gridColumn:"1 / span 2"}:void 0,children:[i.jsx(B,{component:"p",style:jn,children:et.label}),i.jsx(B,{component:"p",style:{...t0e,...et.valueStyle||{}},children:et.getValue(te)})]},De)})})]}),i.jsxs("div",{style:{padding:Fe?"8px 8px 12px":"14px 16px",borderTop:Fe?"none":"1px solid #E5E7EB",background:Fe?"#FFFFFF":"#FAFAFA",display:"flex",flexDirection:Fe?"column-reverse":"row",justifyContent:"flex-end",alignItems:"center",gap:Fe?8:12,flexWrap:"nowrap"},children:[i.jsx(Ze,{variant:"outline",text:w,onClick:()=>e?.(),style:{width:Fe?"100%":94,minWidth:Fe?"100%":94,height:48,marginLeft:0}}),i.jsx(Ze,{variant:"primary",text:g,onClick:()=>(b??t)?.(),...v,style:{width:Fe?"100%":163,minWidth:Fe?"100%":163,height:48,marginLeft:0,...v?.style||{}}})]})]})})},Vl="var(--color-status-warning, #CC4908)",Wl={width:"100%",maxWidth:445,height:48,borderRadius:8,borderWidth:1,borderStyle:"solid",borderColor:Vl,gap:12,opacity:1,paddingTop:12,paddingRight:16,paddingBottom:12,paddingLeft:16,boxSizing:"border-box",display:"flex",alignItems:"center",flex:"0 0 auto",backgroundColor:"var(--color-neutrals-white, #FFFFFF)"},b2={fontFamily:qe,fontWeight:600,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#CC4908",margin:0},x2=({message:a="Algunos documentos no pudieron incorporarse",className:e="",style:t,textStyle:n,...o})=>!a||!String(a).trim()?null:i.jsxs("div",{role:"alert",className:["anima-vista-datos-detalle-alerta",e].filter(Boolean).join(" "),style:{...Wl,...t||{}},...o,children:[i.jsx(P,{name:"ExclamationCircleIcon",variant:"24-outline",size:24,style:{flexShrink:0,color:Vl},"aria-hidden":!0}),i.jsx("p",{style:{...b2,flex:1,minWidth:0,...n||{}},children:a})]}),y2={width:40,height:40,minWidth:40,borderRadius:8,background:"#BDE4E9",display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",flexShrink:0},z0={fontFamily:I,fontWeight:600,fontStyle:"normal",fontSize:"20px",lineHeight:"30px",letterSpacing:0,color:"#29474C",margin:0},zl={fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",margin:0},E2={...zl,color:"#6B7280",flex:"1 1 auto",minWidth:0,wordBreak:"break-word",overflowWrap:"break-word"},R2={...zl,color:"#29474C",textAlign:"right",flex:"1 1 auto",minWidth:0,wordBreak:"break-word",overflowWrap:"break-word"},A2={border:"none",borderTop:"1px solid #E5E7EB",margin:"12px 0",width:"100%"},C2={fontFamily:I,fontWeight:600,fontStyle:"normal",fontSize:"32px",lineHeight:"40px",letterSpacing:0,color:"#6D3856",margin:0,textAlign:"center"},S2={fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#29474C",margin:"4px 0 0 0",textAlign:"center"},_2={border:"none",borderTop:"1px solid #E5E7EB",margin:0,width:"100%",flexShrink:0},M2={marginTop:"auto",flexShrink:0,width:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:12,paddingTop:12,boxSizing:"border-box"},i0e={flex:"0 0 auto",width:"100%",boxSizing:"border-box"},Xr={display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"flex-end",gap:40,width:"auto",maxWidth:"100%"},Fn={empresaNombre:"Hexa Systems",empresaIconName:"BuildingOffice2Icon",avatarSrc:"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop&crop=face",avatarAlt:"Ejecutor de la carga",metadataSections:[{rows:[{label:"Ejecutado por",value:"María García Alonso"},{label:"Fecha y hora",value:"18-05-2026 - 15:20 hs."}]},{rows:[{label:"Tipo de documentos",value:"Recibos de sueldo"},{label:"Concepto de liquidación",value:"Mensual"},{label:"Período",value:"Mayo de 2026"}]}],stats:[{value:4,label:"Documentos"},{value:2,label:"Cargados"},{value:2,label:"No cargados"}]},zo=40;function j2(){return i.jsx("hr",{className:"anima-vista-datos-detalle__divider",style:A2})}function l0e({label:a,value:e,labelStyle:t,valueStyle:n,isNarrow:o=!1}){if(!a&&!e)return null;const l=o?{maxWidth:"58%",textAlign:"right"}:{};return i.jsxs("div",{className:"anima-vista-datos-detalle__row",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:o?8:16,width:"100%",maxWidth:"100%",boxSizing:"border-box"},children:[i.jsx("span",{style:{...E2,...t||{}},children:a}),i.jsx("span",{style:{...R2,...l,...n||{}},children:e})]})}function s0e({rows:a,showDividerAfter:e=!0,rowLabelStyle:t,rowValueStyle:n,isNarrow:o=!1}){const l=(a??[]).filter(s=>s&&(s.label||s.value));return l.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"anima-vista-datos-detalle__section",style:{display:"flex",flexDirection:"column",gap:10,width:"100%"},children:l.map((s,c)=>i.jsx(l0e,{label:s.label,value:s.value,labelStyle:s.labelStyle??t,valueStyle:s.valueStyle??n,isNarrow:o},s.id??`${s.label}-${c}`))}),e?i.jsx(j2,{}):null]})}const L2=({empresaNombre:a=Fn.empresaNombre,empresaIconName:e=Fn.empresaIconName,avatarSrc:t=Fn.avatarSrc,avatarAlt:n=Fn.avatarAlt,avatarName:o,avatarNode:l,metadataSections:s=Fn.metadataSections,stats:c=Fn.stats,empresaNombreStyle:d,empresaIconBoxStyle:h,rowLabelStyle:u,rowValueStyle:f,statValueStyle:m,statLabelStyle:p,className:w="",style:g,headerStyle:b,statsStyle:v,isNarrow:x=!1,...y})=>{const R=Array.isArray(s)?s:[],S=Array.isArray(c)?c.filter(A=>A!=null):[],_=R.filter(A=>(A?.rows??[]).some(M=>M&&(M.label||M.value))),C=()=>{if(l!=null)return l;if(t)return i.jsx("img",{src:t,alt:n||a||"Avatar",style:{width:zo,height:zo,borderRadius:"50%",objectFit:"cover",flexShrink:0}});if(o){const A=String(o).trim().split(/\s+/),M=A.length>1?`${A[0][0]??""}${A[A.length-1][0]??""}`.toUpperCase():(A[0]?.[0]??"?").toUpperCase();return i.jsx("div",{"aria-hidden":!0,style:{width:zo,height:zo,borderRadius:"50%",background:"#D3DFE1",color:"#29474C",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:z0.fontFamily,fontWeight:600,fontSize:"14px",flexShrink:0},children:M})}return null};return i.jsxs("div",{className:["anima-vista-datos-detalle",w].filter(Boolean).join(" "),style:{width:"100%",maxWidth:"100%",height:"100%",minHeight:0,flex:1,boxSizing:"border-box",display:"flex",flexDirection:"column",...g||{}},...y,children:[i.jsxs("div",{className:"anima-vista-datos-detalle__main",style:i0e,children:[i.jsxs("div",{className:"anima-vista-datos-detalle__header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",paddingBottom:8,boxSizing:"border-box",...b||{}},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0,flex:1},children:[i.jsx("div",{style:{...y2,...h||{}},children:i.jsx(P,{name:e,variant:"24-outline",size:24,style:{color:"#29474C",flexShrink:0},"aria-hidden":!0})}),a?i.jsx("h4",{className:"anima-vista-datos-detalle__empresa-nombre",style:{...z0,minWidth:0,wordBreak:"break-word",...d||{}},children:a}):null]}),C()]}),i.jsx(j2,{}),_.map((A,M)=>i.jsx(s0e,{rows:A.rows,showDividerAfter:M<_.length-1,rowLabelStyle:u,rowValueStyle:f,isNarrow:x},A.id??`section-${M}`))]}),S.length>0?i.jsxs("div",{className:"anima-vista-datos-detalle__stats-wrap",style:{...M2,...v||{}},children:[i.jsx("hr",{className:"anima-vista-datos-detalle__stats-divider",style:_2}),i.jsx("div",{className:"anima-vista-datos-detalle__stats",style:{...Xr,width:x?"100%":Xr.width,justifyContent:x?"space-between":Xr.justifyContent,gap:x?16:Xr.gap},children:S.map((A,M)=>i.jsxs("div",{className:"anima-vista-datos-detalle__stat",style:{display:"flex",flexDirection:"column",alignItems:"center",minWidth:0,textAlign:"center"},children:[i.jsx("p",{style:{...C2,...m||{},...A.valueStyle||{}},children:A.value}),i.jsx("p",{style:{...S2,...p||{},...A.labelStyle||{}},children:A.label})]},A.id??`stat-${A.label}-${M}`))})]}):null]})},F2={flexShrink:0,fill:"#D3FFDF",stroke:"var(--color-status-success, #0A742C)"},I2={flexShrink:0,fill:"var(--misc-error-fondo, #F8DBDB)",stroke:"var(--color-status-error, #B30808)"},Z1={borderBottom:"1px solid #E5E7EB"},c0e={fontFamily:I,fontWeight:600,fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#29474C",margin:0},d0e={fontFamily:I,fontWeight:400,fontStyle:"italic",fontSize:"12px",lineHeight:"18px",color:"#6B7280",margin:"4px 0 0 0"},h0e={fontFamily:I,fontWeight:600,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.01em",color:"#29474C",margin:"8px 0 0 0"},k2={fontFamily:qe,fontWeight:500,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.01em",textTransform:"uppercase",color:"#0A742C",margin:"8px 0 0 0"},u0e={...k2,color:"#B30808"},f0e={flexShrink:0,width:"100%",boxSizing:"border-box",paddingTop:12},P1={width:"100%",maxWidth:445,minHeight:48,borderRadius:8,border:"1px solid #C4C4C4",backgroundColor:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 12px",boxSizing:"border-box"},m0e={flex:"1 1 auto",display:"flex",alignItems:"center",justifyContent:"center",gap:4,flexWrap:"wrap",minWidth:0},U0={fontFamily:I,fontWeight:500,fontSize:"14px",lineHeight:"21px",color:"#29474C",minWidth:28,height:32,padding:"0 4px",border:"none",background:"transparent",cursor:"pointer",boxSizing:"border-box"},p0e={...U0,color:"#38656D",fontWeight:600,borderBottom:"2px solid #38656D"},O2=({status:a="success",title:e,archivoOrigen:t,archivoOrigenPrefix:n="Archivo origen:",personaLine:o,statusLabel:l,showBorder:s=!0,isFirst:c=!1,className:d="",style:h,onClick:u,...f})=>{const m=a==="error",p=m?"XCircleIcon":"CheckCircleIcon",w=m?I2:F2,g=i.jsxs(i.Fragment,{children:[i.jsx(P,{name:p,variant:"24-outline",size:24,style:{...w,marginTop:2},"aria-hidden":!0}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[e?i.jsx("p",{className:"anima-vista-datos-documento__title",style:c0e,children:e}):null,t?i.jsxs("p",{className:"anima-vista-datos-documento__origen",style:d0e,children:[n," ",t]}):null,o?i.jsx("p",{className:"anima-vista-datos-documento__persona",style:h0e,children:o}):null,l?i.jsx("p",{className:"anima-vista-datos-documento__status",style:m?u0e:k2,children:l}):null]})]}),b={display:"flex",alignItems:"flex-start",gap:12,width:"100%",padding:c?"8px 0 14px 0":"12px 0 12px 0",boxSizing:"border-box",...s?Z1:{},...h||{}};return typeof u=="function"?i.jsx("button",{type:"button",className:["anima-vista-datos-documento-item",d].filter(Boolean).join(" "),style:{...b,border:"none",borderBottom:s?Z1.borderBottom:void 0,background:"transparent",cursor:"pointer",textAlign:"left"},onClick:u,...f,children:g}):i.jsx("div",{className:["anima-vista-datos-documento-item",d].filter(Boolean).join(" "),style:b,...f,children:g})},Uo=32;function g0e(a,e){return e<=5?Array.from({length:e},(t,n)=>n+1):a<=3?[1,2,3,4,"ellipsis",e]:a>=e-2?[1,"ellipsis",e-3,e-2,e-1,e]:[1,"ellipsis",a-1,a,a+1,"ellipsis",e]}const T2=({currentPage:a=1,totalPages:e=1,onPageChange:t,className:n="",wrapStyle:o,boxStyle:l,isNarrow:s=!1,...c})=>{if(e<=1)return null;const d=Math.min(Math.max(1,a),e),h=d>1,u=d<e,f=g0e(d,e),m=p=>{p<1||p>e||p===d||t?.(p)};return i.jsx("nav",{className:["anima-vista-datos-documentos-paginacion",n].filter(Boolean).join(" "),"aria-label":"Paginación de documentos",style:{...f0e,...o||{}},...c,children:i.jsxs("div",{style:{...P1,maxWidth:s?"100%":P1.maxWidth,...l||{}},children:[i.jsx("button",{type:"button","aria-label":"Página anterior",disabled:!h,onClick:()=>m(d-1),style:{width:Uo,height:Uo,borderRadius:8,border:"1px solid #C4C4C4",background:"#FFFFFF",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:h?"pointer":"default",opacity:h?1:.5,flexShrink:0,padding:0},children:i.jsx(P,{name:"ChevronDoubleLeftIcon",size:16,style:{color:h?"#38656D":"#84A0A5"}})}),i.jsx("div",{className:"anima-vista-datos-documentos-paginacion__pages",style:m0e,children:f.map((p,w)=>{if(p==="ellipsis")return i.jsx("span",{"aria-hidden":!0,style:{...U0,cursor:"default",minWidth:20},children:"…"},`ellipsis-${w}`);const g=p===d;return i.jsx("button",{type:"button","aria-label":`Página ${p}`,"aria-current":g?"page":void 0,onClick:()=>m(p),style:g?p0e:U0,children:p},p)})}),i.jsx("button",{type:"button","aria-label":"Página siguiente",disabled:!u,onClick:()=>m(d+1),style:{width:Uo,height:Uo,borderRadius:8,border:"none",background:u?"#3F6F75":"#D3DDE0",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:u?"pointer":"default",flexShrink:0,padding:0},children:i.jsx(P,{name:"ChevronDoubleRightIcon",size:16,style:{color:"#FFFFFF"}})})]})})},D2=[{id:"doc-1",status:"success",title:"Política interna 05-2020.pdf",archivoOrigen:"polit.inter_l20457.pdf",personaLine:"María García Alonso - LEG-000123",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-2",status:"success",title:"Política interna 06-2021.pdf",archivoOrigen:"polit.inter_l20458.pdf",personaLine:"María García Alonso - LEG-000123",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-3",status:"error",title:"Recibo sueldo 03-2024.pdf",archivoOrigen:"recibo_marzo_2024.pdf",personaLine:"Juan Pérez - LEG-000456",statusLabel:"ERROR DE CARGA"},{id:"doc-4",status:"success",title:"Contrato laboral 2023.pdf",archivoOrigen:"contrato_2023_firmado.pdf",personaLine:"Ana López - LEG-000789",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-5",status:"success",title:"Anexo confidencialidad.pdf",archivoOrigen:"anexo_conf_v2.pdf",personaLine:"María García Alonso - LEG-000123",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-6",status:"error",title:"Formulario 931.pdf",archivoOrigen:"form_931_mayo.pdf",personaLine:"Carlos Ruiz - LEG-000321",statusLabel:"FORMATO NO VÁLIDO"},{id:"doc-7",status:"success",title:"Certificado médico.pdf",archivoOrigen:"cert_medico_abril.pdf",personaLine:"Ana López - LEG-000789",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-8",status:"success",title:"Liquidación final.pdf",archivoOrigen:"liq_final_2025.pdf",personaLine:"Juan Pérez - LEG-000456",statusLabel:"IDENTIFICADOR DETECTADO"}],w0e=16;function v0e(a,e){const t=String(e??"").trim().toLowerCase();return t?a.filter(n=>[n.title,n.archivoOrigen,n.personaLine,n.statusLabel].filter(Boolean).join(" ").toLowerCase().includes(t)):a}const $2=({documentos:a=D2,searchQuery:e="",pageSize:t=4,currentPage:n,defaultPage:o=1,onPageChange:l,onDocumentoClick:s,emptyMessage:c="No hay documentos para mostrar.",className:d="",style:h,listStyle:u,paginationProps:f,isNarrow:m=!1,...p})=>{const w=E.useRef(null),[g,b]=E.useState(o),v=n!=null,x=v?n:g,y=E.useMemo(()=>v0e(Array.isArray(a)?a:[],e),[a,e]),R=Math.max(1,Math.ceil(y.length/Math.max(1,t))),S=Math.min(Math.max(1,x),R),_=E.useCallback(A=>{const M=Math.min(Math.max(1,A),R);v||b(M),l?.(M),w.current&&(w.current.scrollTop=0)},[v,l,R]);E.useEffect(()=>{!v&&g!==S&&b(S)},[v,g,S]),E.useEffect(()=>{S>R&&_(R)},[S,R,_]),E.useEffect(()=>{_(1)},[e,_]);const C=E.useMemo(()=>{const A=(S-1)*t;return y.slice(A,A+t)},[y,S,t]);return i.jsxs("div",{className:["anima-vista-datos-documentos-list",d].filter(Boolean).join(" "),style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,flex:1,width:"100%",boxSizing:"border-box",...h||{}},...p,children:[i.jsxs("div",{style:{position:"relative",flex:"1 1 auto",minHeight:0,width:"100%"},children:[i.jsxs("div",{ref:w,className:"anima-vista-datos-documentos-list__scroll",style:{height:"100%",overflowY:"auto",overflowX:"hidden",paddingRight:w0e,boxSizing:"border-box",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",...u||{}},children:[i.jsx("style",{children:`
1684
+ `)){const l=document.createElement("div");l.append(o?document.createTextNode(o):document.createElement("br")),t.append(l)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class Me{static PRECISION=1e-4;toSVGPath(){Mt("Abstract method `toSVGPath` must be implemented.")}get box(){Mt("Abstract getter `box` must be implemented.")}serialize(e,t){Mt("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,o,l,s){s||=new Float32Array(e.length);for(let c=0,d=e.length;c<d;c+=2)s[c]=t+e[c]*o,s[c+1]=n+e[c+1]*l;return s}static _rescaleAndSwap(e,t,n,o,l,s){s||=new Float32Array(e.length);for(let c=0,d=e.length;c<d;c+=2)s[c]=t+e[c+1]*o,s[c+1]=n+e[c]*l;return s}static _translate(e,t,n,o){o||=new Float32Array(e.length);for(let l=0,s=e.length;l<s;l+=2)o[l]=t+e[l],o[l+1]=n+e[l+1];return o}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,o,l){switch(l){case 90:return[1-t/n,e/o];case 180:return[1-e/n,1-t/o];case 270:return[t/n,1-e/o];default:return[e/n,t/o]}}static _normalizePagePoint(e,t,n){switch(n){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,n,o,l,s){return[(e+5*n)/6,(t+5*o)/6,(5*n+l)/6,(5*o+s)/6,(n+l)/2,(o+s)/2]}}class On{#e;#t=[];#n;#a;#i=[];#r=new Float32Array(18);#o;#l;#c;#s;#u;#h;#f=[];static#g=8;static#m=2;static#d=On.#g+On.#m;constructor({x:e,y:t},n,o,l,s,c=0){this.#e=n,this.#h=l*o,this.#a=s,this.#r.set([NaN,NaN,NaN,NaN,e,t],6),this.#n=c,this.#s=On.#g*o,this.#c=On.#d*o,this.#u=o,this.#f.push(e,t)}isEmpty(){return isNaN(this.#r[8])}#p(){const e=this.#r.subarray(4,6),t=this.#r.subarray(16,18),[n,o,l,s]=this.#e;return[(this.#o+(e[0]-t[0])/2-n)/l,(this.#l+(e[1]-t[1])/2-o)/s,(this.#o+(t[0]-e[0])/2-n)/l,(this.#l+(t[1]-e[1])/2-o)/s]}add({x:e,y:t}){this.#o=e,this.#l=t;const[n,o,l,s]=this.#e;let[c,d,h,u]=this.#r.subarray(8,12);const f=e-h,m=t-u,p=Math.hypot(f,m);if(p<this.#c)return!1;const w=p-this.#s,g=w/p,b=g*f,v=g*m;let x=c,y=d;c=h,d=u,h+=b,u+=v,this.#f?.push(e,t);const R=-v/w,S=b/w,_=R*this.#h,C=S*this.#h;return this.#r.set(this.#r.subarray(2,8),0),this.#r.set([h+_,u+C],4),this.#r.set(this.#r.subarray(14,18),12),this.#r.set([h-_,u-C],16),isNaN(this.#r[6])?(this.#i.length===0&&(this.#r.set([c+_,d+C],2),this.#i.push(NaN,NaN,NaN,NaN,(c+_-n)/l,(d+C-o)/s),this.#r.set([c-_,d-C],14),this.#t.push(NaN,NaN,NaN,NaN,(c-_-n)/l,(d-C-o)/s)),this.#r.set([x,y,c,d,h,u],6),!this.isEmpty()):(this.#r.set([x,y,c,d,h,u],6),Math.abs(Math.atan2(y-d,x-c)-Math.atan2(v,b))<Math.PI/2?([c,d,h,u]=this.#r.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((c+h)/2-n)/l,((d+u)/2-o)/s),[c,d,x,y]=this.#r.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((x+c)/2-n)/l,((y+d)/2-o)/s),!0):([x,y,c,d,h,u]=this.#r.subarray(0,6),this.#i.push(((x+5*c)/6-n)/l,((y+5*d)/6-o)/s,((5*c+h)/6-n)/l,((5*d+u)/6-o)/s,((c+h)/2-n)/l,((d+u)/2-o)/s),[h,u,c,d,x,y]=this.#r.subarray(12,18),this.#t.push(((x+5*c)/6-n)/l,((y+5*d)/6-o)/s,((5*c+h)/6-n)/l,((5*d+u)/6-o)/s,((c+h)/2-n)/l,((d+u)/2-o)/s),!0))}toSVGPath(){if(this.isEmpty())return"";const e=this.#i,t=this.#t;if(isNaN(this.#r[6])&&!this.isEmpty())return this.#w();const n=[];n.push(`M${e[4]} ${e[5]}`);for(let o=6;o<e.length;o+=6)isNaN(e[o])?n.push(`L${e[o+4]} ${e[o+5]}`):n.push(`C${e[o]} ${e[o+1]} ${e[o+2]} ${e[o+3]} ${e[o+4]} ${e[o+5]}`);this.#v(n);for(let o=t.length-6;o>=6;o-=6)isNaN(t[o])?n.push(`L${t[o+4]} ${t[o+5]}`):n.push(`C${t[o]} ${t[o+1]} ${t[o+2]} ${t[o+3]} ${t[o+4]} ${t[o+5]}`);return this.#b(n),n.join(" ")}#w(){const[e,t,n,o]=this.#e,[l,s,c,d]=this.#p();return`M${(this.#r[2]-e)/n} ${(this.#r[3]-t)/o} L${(this.#r[4]-e)/n} ${(this.#r[5]-t)/o} L${l} ${s} L${c} ${d} L${(this.#r[16]-e)/n} ${(this.#r[17]-t)/o} L${(this.#r[14]-e)/n} ${(this.#r[15]-t)/o} Z`}#b(e){const t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#v(e){const[t,n,o,l]=this.#e,s=this.#r.subarray(4,6),c=this.#r.subarray(16,18),[d,h,u,f]=this.#p();e.push(`L${(s[0]-t)/o} ${(s[1]-n)/l} L${d} ${h} L${u} ${f} L${(c[0]-t)/o} ${(c[1]-n)/l}`)}newFreeDrawOutline(e,t,n,o,l,s){return new a2(e,t,n,o,l,s)}getOutlines(){const e=this.#i,t=this.#t,n=this.#r,[o,l,s,c]=this.#e,d=new Float32Array((this.#f?.length??0)+2);for(let f=0,m=d.length-2;f<m;f+=2)d[f]=(this.#f[f]-o)/s,d[f+1]=(this.#f[f+1]-l)/c;if(d[d.length-2]=(this.#o-o)/s,d[d.length-1]=(this.#l-l)/c,isNaN(n[6])&&!this.isEmpty())return this.#C(d);const h=new Float32Array(this.#i.length+24+this.#t.length);let u=e.length;for(let f=0;f<u;f+=2){if(isNaN(e[f])){h[f]=h[f+1]=NaN;continue}h[f]=e[f],h[f+1]=e[f+1]}u=this.#x(h,u);for(let f=t.length-6;f>=6;f-=6)for(let m=0;m<6;m+=2){if(isNaN(t[f+m])){h[u]=h[u+1]=NaN,u+=2;continue}h[u]=t[f+m],h[u+1]=t[f+m+1],u+=2}return this.#R(h,u),this.newFreeDrawOutline(h,d,this.#e,this.#u,this.#n,this.#a)}#C(e){const t=this.#r,[n,o,l,s]=this.#e,[c,d,h,u]=this.#p(),f=new Float32Array(36);return f.set([NaN,NaN,NaN,NaN,(t[2]-n)/l,(t[3]-o)/s,NaN,NaN,NaN,NaN,(t[4]-n)/l,(t[5]-o)/s,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,h,u,NaN,NaN,NaN,NaN,(t[16]-n)/l,(t[17]-o)/s,NaN,NaN,NaN,NaN,(t[14]-n)/l,(t[15]-o)/s],0),this.newFreeDrawOutline(f,e,this.#e,this.#u,this.#n,this.#a)}#R(e,t){const n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#x(e,t){const n=this.#r.subarray(4,6),o=this.#r.subarray(16,18),[l,s,c,d]=this.#e,[h,u,f,m]=this.#p();return e.set([NaN,NaN,NaN,NaN,(n[0]-l)/c,(n[1]-s)/d,NaN,NaN,NaN,NaN,h,u,NaN,NaN,NaN,NaN,f,m,NaN,NaN,NaN,NaN,(o[0]-l)/c,(o[1]-s)/d],t),t+=24}}class a2 extends Me{#e;#t=new Float32Array(4);#n;#a;#i;#r;#o;constructor(e,t,n,o,l,s){super(),this.#o=e,this.#i=t,this.#e=n,this.#r=o,this.#n=l,this.#a=s,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#l(s);const[c,d,h,u]=this.#t;for(let f=0,m=e.length;f<m;f+=2)e[f]=(e[f]-c)/h,e[f+1]=(e[f+1]-d)/u;for(let f=0,m=t.length;f<m;f+=2)t[f]=(t[f]-c)/h,t[f+1]=(t[f+1]-d)/u}toSVGPath(){const e=[`M${this.#o[4]} ${this.#o[5]}`];for(let t=6,n=this.#o.length;t<n;t+=6){if(isNaN(this.#o[t])){e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`);continue}e.push(`C${this.#o[t]} ${this.#o[t+1]} ${this.#o[t+2]} ${this.#o[t+3]} ${this.#o[t+4]} ${this.#o[t+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,t,n,o],l){const s=n-e,c=o-t;let d,h;switch(l){case 0:d=Me._rescale(this.#o,e,o,s,-c),h=Me._rescale(this.#i,e,o,s,-c);break;case 90:d=Me._rescaleAndSwap(this.#o,e,t,s,c),h=Me._rescaleAndSwap(this.#i,e,t,s,c);break;case 180:d=Me._rescale(this.#o,n,t,-s,c),h=Me._rescale(this.#i,n,t,-s,c);break;case 270:d=Me._rescaleAndSwap(this.#o,n,o,-s,-c),h=Me._rescaleAndSwap(this.#i,n,o,-s,-c);break}return{outline:Array.from(d),points:[Array.from(h)]}}#l(e){const t=this.#o;let n=t[4],o=t[5];const l=[n,o,n,o];let s=n,c=o,d=n,h=o;const u=e?Math.max:Math.min,f=new Float32Array(4);for(let p=6,w=t.length;p<w;p+=6){const g=t[p+4],b=t[p+5];isNaN(t[p])?(je.pointBoundingBox(g,b,l),c>b?(s=g,c=b):c===b&&(s=u(s,g)),h<b?(d=g,h=b):h===b&&(d=u(d,g))):(f[0]=f[1]=1/0,f[2]=f[3]=-1/0,je.bezierBoundingBox(n,o,...t.slice(p,p+6),f),je.rectBoundingBox(f[0],f[1],f[2],f[3],l),c>f[1]?(s=f[0],c=f[1]):c===f[1]&&(s=u(s,f[0])),h<f[3]?(d=f[2],h=f[3]):h===f[3]&&(d=u(d,f[2]))),n=g,o=b}const m=this.#t;m[0]=l[0]-this.#n,m[1]=l[1]-this.#n,m[2]=l[2]-l[0]+2*this.#n,m[3]=l[3]-l[1]+2*this.#n,this.firstPoint=[s,c],this.lastPoint=[d,h]}get box(){return this.#t}newOutliner(e,t,n,o,l,s=0){return new On(e,t,n,o,l,s)}getNewOutline(e,t){const[n,o,l,s]=this.#t,[c,d,h,u]=this.#e,f=l*h,m=s*u,p=n*h+c,w=o*u+d,g=this.newOutliner({x:this.#i[0]*f+p,y:this.#i[1]*m+w},this.#e,this.#r,e,this.#a,t??this.#n);for(let b=2;b<this.#i.length;b+=2)g.add({x:this.#i[b]*f+p,y:this.#i[b+1]*m+w});return g.getOutlines()}}class Z0{#e;#t;#n;#a=[];#i=[];constructor(e,t=0,n=0,o=!0){const l=[1/0,1/0,-1/0,-1/0],s=10**-4;for(const{x:g,y:b,width:v,height:x}of e){const y=Math.floor((g-t)/s)*s,R=Math.ceil((g+v+t)/s)*s,S=Math.floor((b-t)/s)*s,_=Math.ceil((b+x+t)/s)*s,C=[y,S,_,!0],A=[R,S,_,!1];this.#a.push(C,A),je.rectBoundingBox(y,S,R,_,l)}const c=l[2]-l[0]+2*n,d=l[3]-l[1]+2*n,h=l[0]-n,u=l[1]-n;let f=o?-1/0:1/0,m=1/0;const p=this.#a.at(o?-1:-2),w=[p[0],p[2]];for(const g of this.#a){const[b,v,x,y]=g;!y&&o?v<m?(m=v,f=b):v===m&&(f=Math.max(f,b)):y&&!o&&(v<m?(m=v,f=b):v===m&&(f=Math.min(f,b))),g[0]=(b-h)/c,g[1]=(v-u)/d,g[2]=(x-u)/d}this.#e=new Float32Array([h,u,c,d]),this.#t=[f,m],this.#n=w}getOutlines(){this.#a.sort((t,n)=>t[0]-n[0]||t[1]-n[1]||t[2]-n[2]);const e=[];for(const t of this.#a)t[3]?(e.push(...this.#s(t)),this.#l(t)):(this.#c(t),e.push(...this.#s(t)));return this.#r(e)}#r(e){const t=[],n=new Set;for(const s of e){const[c,d,h]=s;t.push([c,d,s],[c,h,s])}t.sort((s,c)=>s[1]-c[1]||s[0]-c[0]);for(let s=0,c=t.length;s<c;s+=2){const d=t[s][2],h=t[s+1][2];d.push(h),h.push(d),n.add(d),n.add(h)}const o=[];let l;for(;n.size>0;){const s=n.values().next().value;let[c,d,h,u,f]=s;n.delete(s);let m=c,p=d;for(l=[c,h],o.push(l);;){let w;if(n.has(u))w=u;else if(n.has(f))w=f;else break;n.delete(w),[c,d,h,u,f]=w,m!==c&&(l.push(m,p,c,p===d?d:h),m=c),p=p===d?h:d}l.push(m,p)}return new Joe(o,this.#e,this.#t,this.#n)}#o(e){const t=this.#i;let n=0,o=t.length-1;for(;n<=o;){const l=n+o>>1,s=t[l][0];if(s===e)return l;s<e?n=l+1:o=l-1}return o+1}#l([,e,t]){const n=this.#o(e);this.#i.splice(n,0,[e,t])}#c([,e,t]){const n=this.#o(e);for(let o=n;o<this.#i.length;o++){const[l,s]=this.#i[o];if(l!==e)break;if(l===e&&s===t){this.#i.splice(o,1);return}}for(let o=n-1;o>=0;o--){const[l,s]=this.#i[o];if(l!==e)break;if(l===e&&s===t){this.#i.splice(o,1);return}}}#s(e){const[t,n,o]=e,l=[[t,n,o]],s=this.#o(o);for(let c=0;c<s;c++){const[d,h]=this.#i[c];for(let u=0,f=l.length;u<f;u++){const[,m,p]=l[u];if(!(h<=m||p<=d)){if(m>=d){if(p>h)l[u][1]=h;else{if(f===1)return[];l.splice(u,1),u--,f--}continue}l[u][2]=d,p>h&&l.push([t,h,p])}}}return l}}class Joe extends Me{#e;#t;constructor(e,t,n,o){super(),this.#t=e,this.#e=t,this.firstPoint=n,this.lastPoint=o}toSVGPath(){const e=[];for(const t of this.#t){let[n,o]=t;e.push(`M${n} ${o}`);for(let l=2;l<t.length;l+=2){const s=t[l],c=t[l+1];s===n?(e.push(`V${c}`),o=c):c===o&&(e.push(`H${s}`),n=s)}e.push("Z")}return e.join(" ")}serialize([e,t,n,o],l){const s=[],c=n-e,d=o-t;for(const h of this.#t){const u=new Array(h.length);for(let f=0;f<h.length;f+=2)u[f]=e+h[f]*c,u[f+1]=o-h[f+1]*d;s.push(u)}return s}get box(){return this.#e}get classNamesForOutlining(){return["highlightOutline"]}}class P0 extends On{newFreeDrawOutline(e,t,n,o,l,s){return new Qoe(e,t,n,o,l,s)}}class Qoe extends a2{newOutliner(e,t,n,o,l,s=0){return new P0(e,t,n,o,l,s)}}class Yt extends Te{#e=null;#t=0;#n;#a=null;#i=null;#r=null;#o=null;#l=0;#c=null;#s=null;#u=null;#h=!1;#f=null;#g=null;#m=null;#d="";#p;#w="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=Je.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const e=Yt.prototype;return nt(this,"_keyboardManager",new vo([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"}),this.color=e.color||Yt._defaultColor,this.#p=e.thickness||Yt._defaultThickness,this.opacity=e.opacity||Yt._defaultOpacity,this.#n=e.boxes||null,this.#w=e.methodOfCreation||"",this.#d=e.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(this.#h=!0,this.#v(e),this.#E()):this.#n&&(this.#e=e.anchorNode,this.#t=e.anchorOffset,this.#o=e.focusNode,this.#l=e.focusOffset,this.#b(),this.#E(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:this.#h?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#p,methodOfCreation:this.#w}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#b(){const e=new Z0(this.#n,.001);this.#s=e.getOutlines(),[this.x,this.y,this.width,this.height]=this.#s.box;const t=new Z0(this.#n,.0025,.001,this._uiManager.direction==="ltr");this.#r=t.getOutlines();const{firstPoint:n}=this.#s;this.#f=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height];const{lastPoint:o}=this.#r;this.#g=[(o[0]-this.x)/this.width,(o[1]-this.y)/this.height]}#v({highlightOutlines:e,highlightId:t,clipPathId:n}){this.#s=e;const o=1.5;if(this.#r=e.getNewOutline(this.#p/2+o,.0025),t>=0)this.#u=t,this.#a=n,this.parent.drawLayer.finalizeDraw(t,{bbox:e.box,path:{d:e.toSVGPath()}}),this.#m=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#r.box,path:{d:this.#r.toSVGPath()}},!0);else if(this.parent){const f=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#u,{bbox:Yt.#A(this.#s.box,(f-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#m,{bbox:Yt.#A(this.#r.box,f),path:{d:this.#r.toSVGPath()}})}const[l,s,c,d]=e.box;switch(this.rotation){case 0:this.x=l,this.y=s,this.width=c,this.height=d;break;case 90:{const[f,m]=this.parentDimensions;this.x=s,this.y=1-l,this.width=c*m/f,this.height=d*f/m;break}case 180:this.x=1-l,this.y=1-s,this.width=c,this.height=d;break;case 270:{const[f,m]=this.parentDimensions;this.x=1-s,this.y=l,this.width=c*m/f,this.height=d*f/m;break}}const{firstPoint:h}=e;this.#f=[(h[0]-l)/c,(h[1]-s)/d];const{lastPoint:u}=this.#r;this.#g=[(u[0]-l)/c,(u[1]-s)/d]}static initialize(e,t){Te.initialize(e,t),Yt._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case dt.HIGHLIGHT_COLOR:Yt._defaultColor=t;break;case dt.HIGHLIGHT_THICKNESS:Yt._defaultThickness=t;break}}translateInPage(e,t){}get toolbarPosition(){return this.#g}get commentButtonPosition(){return this.#f}updateParams(e,t){switch(e){case dt.HIGHLIGHT_COLOR:this.#C(t);break;case dt.HIGHLIGHT_THICKNESS:this.#R(t);break}}static get defaultPropertiesToUpdate(){return[[dt.HIGHLIGHT_COLOR,Yt._defaultColor],[dt.HIGHLIGHT_THICKNESS,Yt._defaultThickness]]}get propertiesToUpdate(){return[[dt.HIGHLIGHT_COLOR,this.color||Yt._defaultColor],[dt.HIGHLIGHT_THICKNESS,this.#p||Yt._defaultThickness],[dt.HIGHLIGHT_FREE,this.#h]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#u,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#i?.updateColor(this.color),super.onUpdatedColor()}#C(e){const t=(l,s)=>{this.color=l,this.opacity=s,this.onUpdatedColor()},n=this.color,o=this.opacity;this.addCommands({cmd:t.bind(this,e,Yt._defaultOpacity),undo:t.bind(this,n,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:dt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)}#R(e){const t=this.#p,n=o=>{this.#p=o,this.#x(o)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:dt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#i=new Ea({editor:this})]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#j())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#j())}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this.#_(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#E(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#_():e&&(this.#E(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),t&&this.select()}#x(e){this.#h&&(this.#v({highlightOutlines:this.#s.getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))}#_(){this.#u===null||!this.parent||(this.parent.drawLayer.remove(this.#u),this.#u=null,this.parent.drawLayer.remove(this.#m),this.#m=null)}#E(e=this.parent){this.#u===null&&({id:this.#u,clipPathId:this.#a}=e.drawLayer.draw({bbox:this.#s.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#h},path:{d:this.#s.toSVGPath()}},!1,!0),this.#m=e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#h},bbox:this.#r.box,path:{d:this.#r.toSVGPath()}},this.#h),this.#c&&(this.#c.style.clipPath=this.#a))}static#A([e,t,n,o],l){switch(l){case 90:return[1-t-o,e,o,n];case 180:return[1-e-n,1-t-o,n,o];case 270:return[t,1-e-n,o,n]}return[e,t,n,o]}rotate(e){const{drawLayer:t}=this.parent;let n;this.#h?(e=(e-this.rotation+360)%360,n=Yt.#A(this.#s.box,e)):n=Yt.#A([this.x,this.y,this.width,this.height],e),t.updateProperties(this.#u,{bbox:n,root:{"data-main-rotation":e}}),t.updateProperties(this.#m,{bbox:Yt.#A(this.#r.box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();this.#d&&(e.setAttribute("aria-label",this.#d),e.setAttribute("role","mark")),this.#h?e.classList.add("free"):this.div.addEventListener("keydown",this.#L.bind(this),{signal:this._uiManager._signal});const t=this.#c=document.createElement("div");return e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#a,this.setDims(this.width,this.height),Fd(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1}})}#L(e){Yt._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#M(!0);break;case 1:case 3:this.#M(!1);break}}#M(e){if(!this.#e)return;const t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#o,this.#l)}select(){super.select(),this.#m&&this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#m&&(this.parent?.drawLayer.updateProperties(this.#m,{rootClass:{selected:!1}}),this.#h||this.#M(!1))}get _mustFixPosition(){return!this.#h}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(this.#u,{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(this.#m,{rootClass:{hidden:!e}}))}#j(){return this.#h?this.rotation:0}#$(){if(this.#h)return null;const[e,t]=this.pageDimensions,[n,o]=this.pageTranslation,l=this.#n,s=new Float32Array(l.length*8);let c=0;for(const{x:d,y:h,width:u,height:f}of l){const m=d*e+n,p=(1-h)*t+o;s[c]=s[c+4]=m,s[c+1]=s[c+3]=p,s[c+2]=s[c+6]=m+u*e,s[c+5]=s[c+7]=p-f*t,c+=8}return s}#I(e){return this.#s.serialize(e,this.#j())}static startHighlighting(e,t,{target:n,x:o,y:l}){const{x:s,y:c,width:d,height:h}=n.getBoundingClientRect(),u=new AbortController,f=e.combinedSignal(u),m=p=>{u.abort(),this.#B(e,p)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",Wt,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Aa,{signal:f}),n.addEventListener("pointermove",this.#O.bind(this,e),{signal:f}),this._freeHighlight=new P0({x:o,y:l},[s,c,d,h],e.scale,this._defaultThickness/2,t,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static#O(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#B(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,n){let o=null;if(e instanceof Qd){const{data:{quadPoints:w,rect:g,rotation:b,id:v,color:x,opacity:y,popupRef:R,richText:S,contentsObj:_,creationDate:C,modificationDate:A},parent:{page:{pageNumber:M}}}=e;o=e={annotationType:Je.HIGHLIGHT,color:Array.from(x),opacity:y,quadPoints:w,boxes:null,pageIndex:M-1,rect:g.slice(0),rotation:b,annotationElementId:v,id:v,deleted:!1,popupRef:R,richText:S,comment:_?.str||null,creationDate:C,modificationDate:A}}else if(e instanceof Bl){const{data:{inkLists:w,rect:g,rotation:b,id:v,color:x,borderStyle:{rawWidth:y},popupRef:R,richText:S,contentsObj:_,creationDate:C,modificationDate:A},parent:{page:{pageNumber:M}}}=e;o=e={annotationType:Je.HIGHLIGHT,color:Array.from(x),thickness:y,inkLists:w,boxes:null,pageIndex:M-1,rect:g.slice(0),rotation:b,annotationElementId:v,id:v,deleted:!1,popupRef:R,richText:S,comment:_?.str||null,creationDate:C,modificationDate:A}}const{color:l,quadPoints:s,inkLists:c,opacity:d}=e,h=await super.deserialize(e,t,n);h.color=je.makeHexColor(...l),h.opacity=d||1,c&&(h.#p=e.thickness),h._initialData=o,e.comment&&h.setCommentData(e);const[u,f]=h.pageDimensions,[m,p]=h.pageTranslation;if(s){const w=h.#n=[];for(let g=0;g<s.length;g+=8)w.push({x:(s[g]-m)/u,y:1-(s[g+1]-p)/f,width:(s[g+2]-s[g])/u,height:(s[g+1]-s[g+5])/f});h.#b(),h.#E(),h.rotate(h.rotation)}else if(c){h.#h=!0;const w=c[0],g={x:w[0]-m,y:f-(w[1]-p)},b=new P0(g,[0,0,u,f],1,h.#p/2,!0,.001);for(let y=0,R=w.length;y<R;y+=2)g.x=w[y]-m,g.y=f-(w[y+1]-p),b.add(g);const{id:v,clipPathId:x}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:b.toSVGPath()}},!0,!0);h.#v({highlightOutlines:b.getOutlines(),highlightId:v,clipPathId:x}),h.#E(),h.rotate(h.parentRotation)}return h}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const t=Te._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),n=super.serialize(e);return Object.assign(n,{color:t,opacity:this.opacity,thickness:this.#p,quadPoints:this.#$(),outlines:this.#I(n.rect)}),this.addComment(n),this.annotationElementId&&!this.#T(n)?null:(n.id=this.annotationElementId,n)}#T(e){const{color:t}=this._initialData;return this.hasEditedComment||e.color.some((n,o)=>n!==t[o])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}}class n2{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,n]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){const e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){Mt("Not implemented")}}class Ne extends Te{#e=null;#t;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#a=null;static#i=null;static#r=NaN;static#o=null;static#l=null;static#c=NaN;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(this.#s(e),this.#f())}#s({drawOutlines:e,drawId:t,drawingOptions:n}){this.#e=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties)):this._drawId=this.#u(e,this.parent),this.#d(e.box)}#u(e,t){const{id:n}=t.drawLayer.draw(Ne._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(e,t){const n=new Set(Object.keys(e));for(const[o,l]of Object.entries(t))n.has(o)?Object.assign(e[o],l):e[o]=l;return e}static getDefaultDrawingOptions(e){Mt("Not implemented")}static get typesMap(){Mt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){const n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,t),this._currentParent&&(Ne.#n.updateProperty(n,t),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){const n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){const e=[],t=this._defaultDrawingOptions;for(const[n,o]of this.typesMap)e.push([n,t[o]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:t}=this;for(const[n,o]of this.constructor.typesMap)e.push([n,t[o]]);return e}_updateProperty(e,t,n){const o=this._drawingOptions,l=o[t],s=c=>{o.updateProperty(t,c);const d=this.#e.updateProperty(t,c);d&&this.#d(d),this.parent?.drawLayer.updateProperties(this._drawId,o.toSVGProperties()),e===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:s.bind(this,n),undo:s.bind(this,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Ne._mergeSVGProperties(this.#e.getPathResizingSVGProperties(this.#m()),{bbox:this.#p()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Ne._mergeSVGProperties(this.#e.getPathResizedSVGProperties(this.#m()),{bbox:this.#p()}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#p()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Ne._mergeSVGProperties(this.#e.getPathTranslatedSVGProperties(this.#m(),this.parentDimensions),{bbox:this.#p()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this.#h(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#f(),this.#d(this.#e.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#h()):e&&(this._uiManager.addShouldRescale(this),this.#f(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),t&&this.select()}#h(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#f(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#u(this.#e,e)}}#g([e,t,n,o]){const{parentDimensions:[l,s],rotation:c}=this;switch(c){case 90:return[t,1-e,n*(s/l),o*(l/s)];case 180:return[1-e,1-t,n,o];case 270:return[1-t,e,n*(s/l),o*(l/s)];default:return[e,t,n,o]}}#m(){const{x:e,y:t,width:n,height:o,parentDimensions:[l,s],rotation:c}=this;switch(c){case 90:return[1-t,e,n*(l/s),o*(s/l)];case 180:return[1-e,1-t,n,o];case 270:return[t,1-e,n*(l/s),o*(s/l)];default:return[e,t,n,o]}}#d(e){[this.x,this.y,this.width,this.height]=this.#g(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#p(){const{x:e,y:t,width:n,height:o,rotation:l,parentRotation:s,parentDimensions:[c,d]}=this;switch((l*4+s)/90){case 1:return[1-t-o,e,o,n];case 2:return[1-e-n,1-t-o,n,o];case 3:return[t,1-e-n,o,n];case 4:return[e,t-n*(c/d),o*(d/c),n*(c/d)];case 5:return[1-t,e,n*(c/d),o*(d/c)];case 6:return[1-e-o*(d/c),1-t,o*(d/c),n*(c/d)];case 7:return[t-n*(c/d),1-e-o*(d/c),n*(c/d),o*(d/c)];case 8:return[e-n,t-o,n,o];case 9:return[1-t,e-n,o,n];case 10:return[1-e,1-t,n,o];case 11:return[t-o,1-e,o,n];case 12:return[e-o*(d/c),t,o*(d/c),n*(c/d)];case 13:return[1-t-n*(c/d),e-o*(d/c),n*(c/d),o*(d/c)];case 14:return[1-e,1-t-n*(c/d),o*(d/c),n*(c/d)];case 15:return[t,1-e,n*(c/d),o*(d/c)];default:return[e,t,n,o]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,Ne._mergeSVGProperties({bbox:this.#p()},this.#e.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#d(this.#e.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);const n=super.render();n.classList.add("draw");const o=document.createElement("div");return n.append(o),o.setAttribute("aria-hidden","true"),o.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e,t,n,o,l){Mt("Not implemented")}static startDrawing(e,t,n,o){const{target:l,offsetX:s,offsetY:c,pointerId:d,pointerType:h}=o;if(Ne.#o&&Ne.#o!==h)return;const{viewport:{rotation:u}}=e,{width:f,height:m}=l.getBoundingClientRect(),p=Ne.#a=new AbortController,w=e.combinedSignal(p);if(Ne.#r||=d,Ne.#o??=h,window.addEventListener("pointerup",g=>{Ne.#r===g.pointerId?this._endDraw(g):Ne.#l?.delete(g.pointerId)},{signal:w}),window.addEventListener("pointercancel",g=>{Ne.#r===g.pointerId?this._currentParent.endDrawingSession():Ne.#l?.delete(g.pointerId)},{signal:w}),window.addEventListener("pointerdown",g=>{Ne.#o===g.pointerType&&((Ne.#l||=new Set).add(g.pointerId),Ne.#n.isCancellable()&&(Ne.#n.removeLastElement(),Ne.#n.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:w}),window.addEventListener("contextmenu",Aa,{signal:w}),l.addEventListener("pointermove",this._drawMove.bind(this),{signal:w}),l.addEventListener("touchmove",g=>{g.timeStamp===Ne.#c&&Wt(g)},{signal:w}),e.toggleDrawing(),t._editorUndoBar?.hide(),Ne.#n){e.drawLayer.updateProperties(this._currentDrawId,Ne.#n.startNew(s,c,f,m,u));return}t.updateUIForDefaultProperties(this),Ne.#n=this.createDrawerInstance(s,c,f,m,u),Ne.#i=this.getDefaultDrawingOptions(),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(Ne.#i.toSVGProperties(),Ne.#n.defaultSVGProperties),!0,!1)}static _drawMove(e){if(Ne.#c=-1,!Ne.#n)return;const{offsetX:t,offsetY:n,pointerId:o}=e;if(Ne.#r===o){if(Ne.#l?.size>=1){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,Ne.#n.add(t,n)),Ne.#c=e.timeStamp,Wt(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,Ne.#n=null,Ne.#i=null,Ne.#o=null,Ne.#c=NaN),Ne.#a&&(Ne.#a.abort(),Ne.#a=null,Ne.#r=NaN,Ne.#l=null)}static _endDraw(e){const t=this._currentParent;if(t){if(t.toggleDrawing(!0),this._cleanup(!1),e?.target===t.div&&t.drawLayer.updateProperties(this._currentDrawId,Ne.#n.end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const n=Ne.#n,o=this._currentDrawId,l=n.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(o,n.setLastElement(l))},undo:()=>{t.drawLayer.updateProperties(o,n.removeLastElement())},mustExec:!1,type:dt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const t=this._currentParent;if(!t)return null;if(t.toggleDrawing(!0),t.cleanUndoStack(dt.DRAW_STEP),!Ne.#n.isEmpty()){const{pageDimensions:[n,o],scale:l}=t,s=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Ne.#n.getOutlines(n*l,o*l,l,this._INNER_MARGIN),drawingOptions:Ne.#i,mustBeCommitted:!e});return this._cleanup(!0),s}return t.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,o,l,s){Mt("Not implemented")}static async deserialize(e,t,n){const{rawDims:{pageWidth:o,pageHeight:l,pageX:s,pageY:c}}=t.viewport,d=this.deserializeDraw(s,c,o,l,this._INNER_MARGIN,e),h=await super.deserialize(e,t,n);return h.createDrawingOptions(e),h.#s({drawOutlines:d}),h.#f(),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){const[t,n]=this.pageTranslation,[o,l]=this.pageDimensions;return this.#e.serialize([t,n,o,l],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class eie{#e=new Float64Array(6);#t;#n;#a;#i;#r;#o="";#l=0;#c=new yo;#s;#u;constructor(e,t,n,o,l,s){this.#s=n,this.#u=o,this.#a=l,this.#i=s,[e,t]=this.#h(e,t);const c=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#r=[e,t],this.#n=[{line:c,points:this.#r}],this.#e.set(c,0)}updateProperty(e,t){e==="stroke-width"&&(this.#i=t)}#h(e,t){return Me._normalizePoint(e,t,this.#s,this.#u,this.#a)}isEmpty(){return!this.#n||this.#n.length===0}isCancellable(){return this.#r.length<=10}add(e,t){[e,t]=this.#h(e,t);const[n,o,l,s]=this.#e.subarray(2,6),c=e-l,d=t-s;return Math.hypot(this.#s*c,this.#u*d)<=2?null:(this.#r.push(e,t),isNaN(n)?(this.#e.set([l,s,e,t],2),this.#t.push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(this.#e[0])&&this.#t.splice(6,6),this.#e.set([n,o,l,s,e,t],0),this.#t.push(...Me.createBezierPoints(n,o,l,s,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){const n=this.add(e,t);return n||(this.#r.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,o,l){this.#s=n,this.#u=o,this.#a=l,[e,t]=this.#h(e,t);const s=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#r=[e,t];const c=this.#n.at(-1);return c&&(c.line=new Float32Array(c.line),c.points=new Float32Array(c.points)),this.#n.push({line:s,points:this.#r}),this.#e.set(s,0),this.#l=0,this.toSVGPath(),null}getLastElement(){return this.#n.at(-1)}setLastElement(e){return this.#n?(this.#n.push(e),this.#t=e.line,this.#r=e.points,this.#l=0,{path:{d:this.toSVGPath()}}):this.#c.setLastElement(e)}removeLastElement(){if(!this.#n)return this.#c.removeLastElement();this.#n.pop(),this.#o="";for(let e=0,t=this.#n.length;e<t;e++){const{line:n,points:o}=this.#n[e];this.#t=n,this.#r=o,this.#l=0,this.toSVGPath()}return{path:{d:this.#o}}}toSVGPath(){const e=Me.svgRound(this.#t[4]),t=Me.svgRound(this.#t[5]);if(this.#r.length===2)return this.#o=`${this.#o} M ${e} ${t} Z`,this.#o;if(this.#r.length<=6){const o=this.#o.lastIndexOf("M");this.#o=`${this.#o.slice(0,o)} M ${e} ${t}`,this.#l=6}if(this.#r.length===4){const o=Me.svgRound(this.#t[10]),l=Me.svgRound(this.#t[11]);return this.#o=`${this.#o} L ${o} ${l}`,this.#l=12,this.#o}const n=[];this.#l===0&&(n.push(`M ${e} ${t}`),this.#l=6);for(let o=this.#l,l=this.#t.length;o<l;o+=6){const[s,c,d,h,u,f]=this.#t.slice(o,o+6).map(Me.svgRound);n.push(`C${s} ${c} ${d} ${h} ${u} ${f}`)}return this.#o+=n.join(" "),this.#l=this.#t.length,this.#o}getOutlines(e,t,n,o){const l=this.#n.at(-1);return l.line=new Float32Array(l.line),l.points=new Float32Array(l.points),this.#c.build(this.#n,e,t,n,this.#a,this.#i,o),this.#e=null,this.#t=null,this.#n=null,this.#o=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class yo extends Me{#e;#t=0;#n;#a;#i;#r;#o;#l;#c;build(e,t,n,o,l,s,c){this.#i=t,this.#r=n,this.#o=o,this.#l=l,this.#c=s,this.#n=c??0,this.#a=e,this.#h()}get thickness(){return this.#c}setLastElement(e){return this.#a.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#a.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:t}of this.#a){if(e.push(`M${Me.svgRound(t[4])} ${Me.svgRound(t[5])}`),t.length===6){e.push("Z");continue}if(t.length===12&&isNaN(t[6])){e.push(`L${Me.svgRound(t[10])} ${Me.svgRound(t[11])}`);continue}for(let n=6,o=t.length;n<o;n+=6){const[l,s,c,d,h,u]=t.subarray(n,n+6).map(Me.svgRound);e.push(`C${l} ${s} ${c} ${d} ${h} ${u}`)}}return e.join("")}serialize([e,t,n,o],l){const s=[],c=[],[d,h,u,f]=this.#u();let m,p,w,g,b,v,x,y,R;switch(this.#l){case 0:R=Me._rescale,m=e,p=t+o,w=n,g=-o,b=e+d*n,v=t+(1-h-f)*o,x=e+(d+u)*n,y=t+(1-h)*o;break;case 90:R=Me._rescaleAndSwap,m=e,p=t,w=n,g=o,b=e+h*n,v=t+d*o,x=e+(h+f)*n,y=t+(d+u)*o;break;case 180:R=Me._rescale,m=e+n,p=t,w=-n,g=o,b=e+(1-d-u)*n,v=t+h*o,x=e+(1-d)*n,y=t+(h+f)*o;break;case 270:R=Me._rescaleAndSwap,m=e+n,p=t+o,w=-n,g=-o,b=e+(1-h-f)*n,v=t+(1-d-u)*o,x=e+(1-h)*n,y=t+(1-d)*o;break}for(const{line:S,points:_}of this.#a)s.push(R(S,m,p,w,g,l?new Array(S.length):null)),c.push(R(_,m,p,w,g,l?new Array(_.length):null));return{lines:s,points:c,rect:[b,v,x,y]}}static deserialize(e,t,n,o,l,{paths:{lines:s,points:c},rotation:d,thickness:h}){const u=[];let f,m,p,w,g;switch(d){case 0:g=Me._rescale,f=-e/n,m=t/o+1,p=1/n,w=-1/o;break;case 90:g=Me._rescaleAndSwap,f=-t/o,m=-e/n,p=1/o,w=1/n;break;case 180:g=Me._rescale,f=e/n+1,m=-t/o,p=-1/n,w=1/o;break;case 270:g=Me._rescaleAndSwap,f=t/o+1,m=e/n+1,p=-1/o,w=-1/n;break}if(!s){s=[];for(const v of c){const x=v.length;if(x===2){s.push(new Float32Array([NaN,NaN,NaN,NaN,v[0],v[1]]));continue}if(x===4){s.push(new Float32Array([NaN,NaN,NaN,NaN,v[0],v[1],NaN,NaN,NaN,NaN,v[2],v[3]]));continue}const y=new Float32Array(3*(x-2));s.push(y);let[R,S,_,C]=v.subarray(0,4);y.set([NaN,NaN,NaN,NaN,R,S],0);for(let A=4;A<x;A+=2){const M=v[A],L=v[A+1];y.set(Me.createBezierPoints(R,S,_,C,M,L),(A-2)*3),[R,S,_,C]=[_,C,M,L]}}}for(let v=0,x=s.length;v<x;v++)u.push({line:g(s[v].map(y=>y??NaN),f,m,p,w),points:g(c[v].map(y=>y??NaN),f,m,p,w)});const b=new this.prototype.constructor;return b.build(u,n,o,1,d,h,l),b}#s(e=this.#c){const t=this.#n+e/2*this.#o;return this.#l%180===0?[t/this.#i,t/this.#r]:[t/this.#r,t/this.#i]}#u(){const[e,t,n,o]=this.#e,[l,s]=this.#s(0);return[e+l,t+s,n-2*l,o-2*s]}#h(){const e=this.#e=new Float32Array([1/0,1/0,-1/0,-1/0]);for(const{line:o}of this.#a){if(o.length<=12){for(let c=4,d=o.length;c<d;c+=6)je.pointBoundingBox(o[c],o[c+1],e);continue}let l=o[4],s=o[5];for(let c=6,d=o.length;c<d;c+=6){const[h,u,f,m,p,w]=o.subarray(c,c+6);je.bezierBoundingBox(l,s,h,u,f,m,p,w,e),l=p,s=w}}const[t,n]=this.#s();e[0]=oa(e[0]-t,0,1),e[1]=oa(e[1]-n,0,1),e[2]=oa(e[2]+t,0,1),e[3]=oa(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e==="stroke-width"?this.#f(t):null}#f(e){const[t,n]=this.#s();this.#c=e;const[o,l]=this.#s(),[s,c]=[o-t,l-n],d=this.#e;return d[0]-=s,d[1]-=c,d[2]+=2*s,d[3]+=2*c,d}updateParentDimensions([e,t],n){const[o,l]=this.#s();this.#i=e,this.#r=t,this.#o=n;const[s,c]=this.#s(),d=s-o,h=c-l,u=this.#e;return u[0]-=d,u[1]-=h,u[2]+=2*d,u[3]+=2*h,u}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(Me.svgRound).join(" ")}get defaultProperties(){const[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`}}}get rotationTransform(){const[,,e,t]=this.#e;let n=0,o=0,l=0,s=0,c=0,d=0;switch(this.#t){case 90:o=t/e,l=-e/t,c=e;break;case 180:n=-1,s=-1,c=e,d=t;break;case 270:o=-t/e,l=e/t,d=t;break;default:return""}return`matrix(${n} ${o} ${l} ${s} ${Me.svgRound(c)} ${Me.svgRound(d)})`}getPathResizingSVGProperties([e,t,n,o]){const[l,s]=this.#s(),[c,d,h,u]=this.#e;if(Math.abs(h-l)<=Me.PRECISION||Math.abs(u-s)<=Me.PRECISION){const g=e+n/2-(c+h/2),b=t+o/2-(d+u/2);return{path:{"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`,transform:`${this.rotationTransform} translate(${g} ${b})`}}}const f=(n-2*l)/(h-2*l),m=(o-2*s)/(u-2*s),p=h/n,w=u/o;return{path:{"transform-origin":`${Me.svgRound(c)} ${Me.svgRound(d)}`,transform:`${this.rotationTransform} scale(${p} ${w}) translate(${Me.svgRound(l)} ${Me.svgRound(s)}) scale(${f} ${m}) translate(${Me.svgRound(-l)} ${Me.svgRound(-s)})`}}}getPathResizedSVGProperties([e,t,n,o]){const[l,s]=this.#s(),c=this.#e,[d,h,u,f]=c;if(c[0]=e,c[1]=t,c[2]=n,c[3]=o,Math.abs(u-l)<=Me.PRECISION||Math.abs(f-s)<=Me.PRECISION){const b=e+n/2-(d+u/2),v=t+o/2-(h+f/2);for(const{line:x,points:y}of this.#a)Me._translate(x,b,v,x),Me._translate(y,b,v,y);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const m=(n-2*l)/(u-2*l),p=(o-2*s)/(f-2*s),w=-m*(d+l)+e+l,g=-p*(h+s)+t+s;if(m!==1||p!==1||w!==0||g!==0)for(const{line:b,points:v}of this.#a)Me._rescale(b,w,g,m,p,b),Me._rescale(v,w,g,m,p,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){const[o,l]=n,s=this.#e,c=e-s[0],d=t-s[1];if(this.#i===o&&this.#r===l)for(const{line:h,points:u}of this.#a)Me._translate(h,c,d,h),Me._translate(u,c,d,u);else{const h=this.#i/o,u=this.#r/l;this.#i=o,this.#r=l;for(const{line:f,points:m}of this.#a)Me._rescale(f,c,d,h,u,f),Me._rescale(m,c,d,h,u,m);s[2]*=h,s[3]*=u}return s[0]=e,s[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Me.svgRound(e)} ${Me.svgRound(t)}`}}}get defaultSVGProperties(){const e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Me.svgRound(e[0])} ${Me.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}class _i extends n2{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:Te._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??=this["stroke-width"],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new _i(this._viewParameters);return e.updateAll(this),e}}class Pl extends Ne{static _type="ink";static _editorType=Je.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,t){Te.initialize(e,t),this._defaultDrawingOptions=new _i(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return nt(this,"typesMap",new Map([[dt.INK_THICKNESS,"stroke-width"],[dt.INK_COLOR,"stroke"],[dt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,n,o,l){return new eie(e,t,n,o,l,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,n,o,l,s){return yo.deserialize(e,t,n,o,l,s)}static async deserialize(e,t,n){let o=null;if(e instanceof Bl){const{data:{inkLists:s,rect:c,rotation:d,id:h,color:u,opacity:f,borderStyle:{rawWidth:m},popupRef:p,richText:w,contentsObj:g,creationDate:b,modificationDate:v},parent:{page:{pageNumber:x}}}=e;o=e={annotationType:Je.INK,color:Array.from(u),thickness:m,opacity:f,paths:{points:s},boxes:null,pageIndex:x-1,rect:c.slice(0),rotation:d,annotationElementId:h,id:h,deleted:!1,popupRef:p,richText:w,comment:g?.str||null,creationDate:b,modificationDate:v}}const l=await super.deserialize(e,t,n);return l._initialData=o,e.comment&&l.setCommentData(e),l}get toolbarButtons(){return this._colorPicker||=new io(this),[["colorPicker",this._colorPicker]]}get colorType(){return dt.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:t,opacity:n}){this._drawingOptions=Pl.getDefaultDrawingOptions({stroke:je.makeHexColor(...e),"stroke-width":t,"stroke-opacity":n})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:o,"stroke-opacity":l,"stroke-width":s}}=this,c=Object.assign(super.serialize(e),{color:Te._colorManager.convert(o),opacity:l,thickness:s,paths:{lines:t,points:n}});return this.addComment(c),e?(c.isCopy=!0,c):this.annotationElementId&&!this.#e(c)?null:(c.id=this.annotationElementId,c)}#e(e){const{color:t,thickness:n,opacity:o,pageIndex:l}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((s,c)=>s!==t[c])||e.thickness!==n||e.opacity!==o||e.pageIndex!==l}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;const{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:t,popup:this.comment}),null}}class N0 extends yo{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const Wo=8,Vr=3;class kn{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,o){return n-=e,o-=t,n===0?o>0?0:4:n===1?o+6:2-o}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#a(e,t,n,o,l,s,c){const d=this.#t(n,o,l,s);for(let h=0;h<8;h++){const u=(-h+d-c+16)%8,f=this.#n[2*u],m=this.#n[2*u+1];if(e[(n+f)*t+(o+m)]!==0)return u}return-1}static#i(e,t,n,o,l,s,c){const d=this.#t(n,o,l,s);for(let h=0;h<8;h++){const u=(h+d+c+16)%8,f=this.#n[2*u],m=this.#n[2*u+1];if(e[(n+f)*t+(o+m)]!==0)return u}return-1}static#r(e,t,n,o){const l=e.length,s=new Int32Array(l);for(let u=0;u<l;u++)s[u]=e[u]<=o?1:0;for(let u=1;u<n-1;u++)s[u*t]=s[u*t+t-1]=0;for(let u=0;u<t;u++)s[u]=s[t*n-1-u]=0;let c=1,d;const h=[];for(let u=1;u<n-1;u++){d=1;for(let f=1;f<t-1;f++){const m=u*t+f,p=s[m];if(p===0)continue;let w=u,g=f;if(p===1&&s[m-1]===0)c+=1,g-=1;else if(p>=1&&s[m+1]===0)c+=1,g+=1,p>1&&(d=p);else{p!==1&&(d=Math.abs(p));continue}const b=[f,u],v=g===f+1,x={isHole:v,points:b,id:c,parent:0};h.push(x);let y;for(const j of h)if(j.id===d){y=j;break}y?y.isHole?x.parent=v?y.parent:d:x.parent=v?d:y.parent:x.parent=v?d:0;const R=this.#a(s,t,u,f,w,g,0);if(R===-1){s[m]=-c,s[m]!==1&&(d=Math.abs(s[m]));continue}let S=this.#n[2*R],_=this.#n[2*R+1];const C=u+S,A=f+_;w=C,g=A;let M=u,L=f;for(;;){const j=this.#i(s,t,M,L,w,g,1);S=this.#n[2*j],_=this.#n[2*j+1];const $=M+S,Z=L+_;b.push(Z,$);const D=M*t+L;if(s[D+1]===0?s[D]=-c:s[D]===1&&(s[D]=c),$===u&&Z===f&&M===C&&L===A){s[m]!==1&&(d=Math.abs(s[m]));break}else w=M,g=L,M=$,L=Z}}}return h}static#o(e,t,n,o){if(n-t<=4){for(let C=t;C<n-2;C+=2)o.push(e[C],e[C+1]);return}const l=e[t],s=e[t+1],c=e[n-4]-l,d=e[n-3]-s,h=Math.hypot(c,d),u=c/h,f=d/h,m=u*s-f*l,p=d/c,w=1/h,g=Math.atan(p),b=Math.cos(g),v=Math.sin(g),x=w*(Math.abs(b)+Math.abs(v)),y=w*(1-x+x**2),R=Math.max(Math.atan(Math.abs(v+b)*y),Math.atan(Math.abs(v-b)*y));let S=0,_=t;for(let C=t+2;C<n-2;C+=2){const A=Math.abs(m-u*e[C+1]+f*e[C]);A>S&&(_=C,S=A)}S>(h*R)**2?(this.#o(e,t,_+2,o),this.#o(e,_,n,o)):o.push(l,s)}static#l(e){const t=[],n=e.length;return this.#o(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#c(e,t,n,o,l,s){const c=new Float32Array(s**2),d=-2*o**2,h=s>>1;for(let g=0;g<s;g++){const b=(g-h)**2;for(let v=0;v<s;v++)c[g*s+v]=Math.exp((b+(v-h)**2)/d)}const u=new Float32Array(256),f=-2*l**2;for(let g=0;g<256;g++)u[g]=Math.exp(g**2/f);const m=e.length,p=new Uint8Array(m),w=new Uint32Array(256);for(let g=0;g<n;g++)for(let b=0;b<t;b++){const v=g*t+b,x=e[v];let y=0,R=0;for(let _=0;_<s;_++){const C=g+_-h;if(!(C<0||C>=n))for(let A=0;A<s;A++){const M=b+A-h;if(M<0||M>=t)continue;const L=e[C*t+M],j=c[_*s+A]*u[Math.abs(L-x)];y+=L*j,R+=j}}const S=p[v]=Math.round(y/R);w[S]++}return[p,w]}static#s(e){const t=new Uint32Array(256);for(const n of e)t[n]++;return t}static#u(e){const t=e.length,n=new Uint8ClampedArray(t>>2);let o=-1/0,l=1/0;for(let c=0,d=n.length;c<d;c++){const h=n[c]=e[c<<2];o=Math.max(o,h),l=Math.min(l,h)}const s=255/(o-l);for(let c=0,d=n.length;c<d;c++)n[c]=(n[c]-l)*s;return n}static#h(e){let t,n=-1/0,o=-1/0;const l=e.findIndex(d=>d!==0);let s=l,c=l;for(t=l;t<256;t++){const d=e[t];d>n&&(t-s>o&&(o=t-s,c=t-1),n=d,s=t)}for(t=c-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){const t=e,{width:n,height:o}=e,{maxDim:l}=this.#e;let s=n,c=o;if(n>l||o>l){let m=n,p=o,w=Math.log2(Math.max(n,o)/l);const g=Math.floor(w);w=w===g?g-1:g;for(let v=0;v<w;v++){s=Math.ceil(m/2),c=Math.ceil(p/2);const x=new OffscreenCanvas(s,c);x.getContext("2d").drawImage(e,0,0,m,p,0,0,s,c),m=s,p=c,e!==t&&e.close(),e=x.transferToImageBitmap()}const b=Math.min(l/s,l/c);s=Math.round(s*b),c=Math.round(c*b)}const h=new OffscreenCanvas(s,c).getContext("2d",{willReadFrequently:!0});h.fillStyle="white",h.fillRect(0,0,s,c),h.filter="grayscale(1)",h.drawImage(e,0,0,e.width,e.height,0,0,s,c);const u=h.getImageData(0,0,s,c).data;return[this.#u(u),s,c]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:o},l,s,c,d){let h=new OffscreenCanvas(1,1),u=h.getContext("2d",{alpha:!1});const f=200,m=u.font=`${n} ${o} ${f}px ${t}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:w,actualBoundingBoxAscent:g,actualBoundingBoxDescent:b,fontBoundingBoxAscent:v,fontBoundingBoxDescent:x,width:y}=u.measureText(e),R=1.5,S=Math.ceil(Math.max(Math.abs(p)+Math.abs(w)||0,y)*R),_=Math.ceil(Math.max(Math.abs(g)+Math.abs(b)||f,Math.abs(v)+Math.abs(x)||f)*R);h=new OffscreenCanvas(S,_),u=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),u.font=m,u.filter="grayscale(1)",u.fillStyle="white",u.fillRect(0,0,S,_),u.fillStyle="black",u.fillText(e,S*(R-1)/2,_*(3-R)/2);const C=this.#u(u.getImageData(0,0,S,_).data),A=this.#s(C),M=this.#h(A),L=this.#r(C,S,_,M);return this.processDrawnLines({lines:{curves:L,width:S,height:_},pageWidth:l,pageHeight:s,rotation:c,innerMargin:d,mustSmooth:!0,areContours:!0})}static process(e,t,n,o,l){const[s,c,d]=this.#f(e),[h,u]=this.#c(s,c,d,Math.hypot(c,d)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),f=this.#h(u),m=this.#r(h,c,d,f);return this.processDrawnLines({lines:{curves:m,width:c,height:d},pageWidth:t,pageHeight:n,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:o,innerMargin:l,mustSmooth:s,areContours:c}){o%180!==0&&([t,n]=[n,t]);const{curves:d,width:h,height:u}=e,f=e.thickness??0,m=[],p=Math.min(t/h,n/u),w=p/t,g=p/n,b=[];for(const{points:x}of d){const y=s?this.#l(x):x;if(!y)continue;b.push(y);const R=y.length,S=new Float32Array(R),_=new Float32Array(3*(R===2?2:R-2));if(m.push({line:_,points:S}),R===2){S[0]=y[0]*w,S[1]=y[1]*g,_.set([NaN,NaN,NaN,NaN,S[0],S[1]],0);continue}let[C,A,M,L]=y;C*=w,A*=g,M*=w,L*=g,S.set([C,A,M,L],0),_.set([NaN,NaN,NaN,NaN,C,A],0);for(let j=4;j<R;j+=2){const $=S[j]=y[j]*w,Z=S[j+1]=y[j+1]*g;_.set(Me.createBezierPoints(C,A,M,L,$,Z),(j-2)*3),[C,A,M,L]=[M,L,$,Z]}}if(m.length===0)return null;const v=c?new N0:new yo;return v.build(m,t,n,1,o,c?0:f,l),{outline:v,newCurves:b,areContours:c,thickness:f,width:h,height:u}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:o,height:l}){let s=1/0,c=-1/0,d=0;for(const y of e){d+=y.length;for(let R=2,S=y.length;R<S;R++){const _=y[R]-y[R-2];s=Math.min(s,_),c=Math.max(c,_)}}let h;s>=-128&&c<=127?h=Int8Array:s>=-32768&&c<=32767?h=Int16Array:h=Int32Array;const u=e.length,f=Wo+Vr*u,m=new Uint32Array(f);let p=0;m[p++]=f*Uint32Array.BYTES_PER_ELEMENT+(d-2*u)*h.BYTES_PER_ELEMENT,m[p++]=0,m[p++]=o,m[p++]=l,m[p++]=t?0:1,m[p++]=Math.max(0,Math.floor(n??0)),m[p++]=u,m[p++]=h.BYTES_PER_ELEMENT;for(const y of e)m[p++]=y.length-2,m[p++]=y[0],m[p++]=y[1];const w=new CompressionStream("deflate-raw"),g=w.writable.getWriter();await g.ready,g.write(m);const b=h.prototype.constructor;for(const y of e){const R=new b(y.length-2);for(let S=2,_=y.length;S<_;S++)R[S-2]=y[S]-y[S-2];g.write(R)}g.close();const v=await new Response(w.readable).arrayBuffer(),x=new Uint8Array(v);return Ad(x)}static async decompressSignature(e){try{const t=Cre(e),{readable:n,writable:o}=new DecompressionStream("deflate-raw"),l=o.getWriter();await l.ready,l.write(t).then(async()=>{await l.ready,await l.close()}).catch(()=>{});let s=null,c=0;for await(const y of n)s||=new Uint8Array(new Uint32Array(y.buffer,0,4)[0]),s.set(y,c),c+=y.length;const d=new Uint32Array(s.buffer,0,s.length>>2),h=d[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const u=d[2],f=d[3],m=d[4]===0,p=d[5],w=d[6],g=d[7],b=[],v=(Wo+Vr*w)*Uint32Array.BYTES_PER_ELEMENT;let x;switch(g){case Int8Array.BYTES_PER_ELEMENT:x=new Int8Array(s.buffer,v);break;case Int16Array.BYTES_PER_ELEMENT:x=new Int16Array(s.buffer,v);break;case Int32Array.BYTES_PER_ELEMENT:x=new Int32Array(s.buffer,v);break}c=0;for(let y=0;y<w;y++){const R=d[Vr*y+Wo],S=new Float32Array(R+2);b.push(S);for(let _=0;_<Vr-1;_++)S[_]=d[Vr*y+Wo+_+1];for(let _=0;_<R;_++)S[_+2]=S[_]+x[c++]}return{areContours:m,thickness:p,outlines:b,width:u,height:f}}catch(t){return Qe(`decompressSignature: ${t}`),null}}}class Nl extends n2{constructor(){super(),super.updateProperties({fill:Te._defaultLineColor,"stroke-width":0})}clone(){const e=new Nl;return e.updateAll(this),e}}class Hl extends _i{constructor(e){super(e),super.updateProperties({stroke:Te._defaultLineColor,"stroke-width":1})}clone(){const e=new Hl(this._viewParameters);return e.updateAll(this),e}}class Ha extends Ne{#e=!1;#t=null;#n=null;#a=null;static _type="signature";static _editorType=Je.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,t){Te.initialize(e,t),this._defaultDrawingOptions=new Nl,this._defaultDrawnSignatureOptions=new Hl(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return nt(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#t}}static computeTelemetryFinalData(e){const t=e.get("hasDescription");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,t;const{_isCopy:n}=this;if(n&&(this._isCopy=!1,e=this.x,t=this.y),super.render(),this._drawId===null)if(this.#n){const{lines:o,mustSmooth:l,areContours:s,description:c,uuid:d,heightInPage:h}=this.#n,{rawDims:{pageWidth:u,pageHeight:f},rotation:m}=this.parent.viewport,p=kn.processDrawnLines({lines:o,pageWidth:u,pageHeight:f,rotation:m,innerMargin:Ha._INNER_MARGIN,mustSmooth:l,areContours:s});this.addSignature(p,h,c,d)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#t||""}));return n&&(this._isCopy=!0,this._moveAfterPaste(e,t)),this.div}setUuid(e){this.#a=e,this.addEditToolbar()}getUuid(){return this.#a}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){const{newCurves:e,areContours:t,thickness:n,width:o,height:l}=this.#n,s=Math.max(o,l),c=kn.processDrawnLines({lines:{curves:e.map(d=>({points:d})),thickness:n,width:o,height:l},pageWidth:s,pageHeight:s,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t});return{areContours:t,outline:c.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,t,n,o){const{x:l,y:s}=this,{outline:c}=this.#n=e;this.#e=c instanceof N0,this.description=n;let d;this.#e?d=Ha.getDefaultDrawingOptions():(d=Ha._defaultDrawnSignatureOptions.clone(),d.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:d});const[,h]=this.pageDimensions;let u=t/h;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=l,this.y=s,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(o),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!o,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:t,pageHeight:n},rotation:o}=this.parent.viewport;return kn.process(e,t,n,o,Ha._INNER_MARGIN)}getFromText(e,t){const{rawDims:{pageWidth:n,pageHeight:o},rotation:l}=this.parent.viewport;return kn.extractContoursFromText(e,t,n,o,l,Ha._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:t,pageHeight:n},rotation:o}=this.parent.viewport;return kn.processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:o,innerMargin:Ha._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:t}){e?this._drawingOptions=Ha.getDefaultDrawingOptions():(this._drawingOptions=Ha._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":t}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":o}}=this,l=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:o});return this.addComment(l),e?(l.paths={lines:t,points:n},l.uuid=this.#a,l.isCopy=!0):l.lines=t,this.#t&&(l.accessibilityData={type:"Figure",alt:this.#t}),l}static deserializeDraw(e,t,n,o,l,s){return s.areContours?N0.deserialize(e,t,n,o,l,s):yo.deserialize(e,t,n,o,l,s)}static async deserialize(e,t,n){const o=await super.deserialize(e,t,n);return o.#e=e.areContours,o.description=e.accessibilityData?.alt||"",o.#a=e.uuid,o}}class tie extends Te{#e=null;#t=null;#n=null;#a=null;#i=null;#r="";#o=null;#l=!1;#c=null;#s=!1;#u=!1;static _type="stamp";static _editorType=Je.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#a=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,t){Te.initialize(e,t)}static isHandlingMimeForPasting(e){return hi.includes(e)}static paste(e,t){t.pasteEditor({mode:Je.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#h(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#s=e.isSvg),e.file&&(this.#r=e.file.name),this.#m()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),!!this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:o,width:l,height:s}=e||this.copyCanvas(null,null,!0).imageData,c=await n.guess({name:"altText",request:{data:o,width:l,height:s,channels:o.length/(l*s)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const d=c.output;return await this.setGuessedAltText(d),t&&!this.hasAltTextData()&&(this.altTextData={alt:d,decorative:!1}),d}#g(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(n=>this.#h(n,!0)).finally(()=>this.#f());return}if(this.#a){const n=this.#a;this.#a=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(n).then(o=>this.#h(o)).finally(()=>this.#f());return}if(this.#i){const n=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(n).then(o=>this.#h(o)).finally(()=>this.#f());return}const e=document.createElement("input");e.type="file",e.accept=hi.join(",");const t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const o=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#h(o)}n()},{signal:t}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#g();return}super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#g(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#a||this.#i||this.#t||this.#l)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#l||(this.#e?this.#m():this.#g()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){const{id:n,bitmap:o}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,o&&(this.#e=o),this.#l=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#c!==null&&clearTimeout(this.#c);const e=200;this.#c=setTimeout(()=>{this.#c=null,this.#p()},e)}#m(){const{div:e}=this;let{width:t,height:n}=this.#e;const[o,l]=this.pageDimensions,s=.75;if(this.width)t=this.width*o,n=this.height*l;else if(t>s*o||n>s*l){const d=Math.min(s*o/t,s*l/n);t*=d,n*=d}this._uiManager.enableWaiting(!1);const c=this.#o=document.createElement("canvas");c.setAttribute("role","img"),this.addContainer(c),this.width=t/o,this.height=n/l,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#p(),this.#u||(this.parent.addUndoableEditor(this),this.#u=!0),this._reportTelemetry({action:"inserted_image"}),this.#r&&this.div.setAttribute("aria-description",this.#r),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}copyCanvas(e,t,n=!1){e||(e=224);const{width:o,height:l}=this.#e,s=new ka;let c=this.#e,d=o,h=l,u=null;if(t){if(o>t||l>t){const _=Math.min(t/o,t/l);d=Math.floor(o*_),h=Math.floor(l*_)}u=document.createElement("canvas");const m=u.width=Math.ceil(d*s.sx),p=u.height=Math.ceil(h*s.sy);this.#s||(c=this.#d(m,p));const w=u.getContext("2d");w.filter=this._uiManager.hcmFilter;let g="white",b="#cfcfd8";this._uiManager.hcmFilter!=="none"?b="black":Mre.isDarkMode&&(g="#8f8f9d",b="#42414d");const v=15,x=v*s.sx,y=v*s.sy,R=new OffscreenCanvas(x*2,y*2),S=R.getContext("2d");S.fillStyle=g,S.fillRect(0,0,x*2,y*2),S.fillStyle=b,S.fillRect(0,0,x,y),S.fillRect(x,y,x,y),w.fillStyle=w.createPattern(R,"repeat"),w.fillRect(0,0,m,p),w.drawImage(c,0,0,c.width,c.height,0,0,m,p)}let f=null;if(n){let m,p;if(s.symmetric&&c.width<e&&c.height<e)m=c.width,p=c.height;else if(c=this.#e,o>e||l>e){const b=Math.min(e/o,e/l);m=Math.floor(o*b),p=Math.floor(l*b),this.#s||(c=this.#d(m,p))}const g=new OffscreenCanvas(m,p).getContext("2d",{willReadFrequently:!0});g.drawImage(c,0,0,c.width,c.height,0,0,m,p),f={width:m,height:p,data:g.getImageData(0,0,m,p).data}}return{canvas:u,width:d,height:h,imageData:f}}#d(e,t){const{width:n,height:o}=this.#e;let l=n,s=o,c=this.#e;for(;l>2*e||s>2*t;){const d=l,h=s;l>2*e&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2)),s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2));const u=new OffscreenCanvas(l,s);u.getContext("2d").drawImage(c,0,0,d,h,0,0,l,s),c=u.transferToImageBitmap()}return c}#p(){const[e,t]=this.parentDimensions,{width:n,height:o}=this,l=new ka,s=Math.ceil(n*e*l.sx),c=Math.ceil(o*t*l.sy),d=this.#o;if(!d||d.width===s&&d.height===c)return;d.width=s,d.height=c;const h=this.#s?this.#e:this.#d(s,c),u=d.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(h,0,0,h.width,h.height,0,0,s,c)}#w(e){if(e){if(this.#s){const o=this._uiManager.imageManager.getSvgUrl(this.#t);if(o)return o}const t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#e,t.getContext("2d").drawImage(this.#e,0,0),t.toDataURL()}if(this.#s){const[t,n]=this.pageDimensions,o=Math.round(this.width*t*Nn.PDF_TO_CSS_UNITS),l=Math.round(this.height*n*Nn.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(o,l);return s.getContext("2d").drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,o,l),s.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let o=null,l=!1;if(e instanceof e2){const{data:{rect:g,rotation:b,id:v,structParent:x,popupRef:y,richText:R,contentsObj:S,creationDate:_,modificationDate:C},container:A,parent:{page:{pageNumber:M}},canvas:L}=e;let j,$;L?(delete e.canvas,{id:j,bitmap:$}=n.imageManager.getFromCanvas(A.id,L),L.remove()):(l=!0,e._hasNoCanvas=!0);const Z=(await t._structTree.getAriaAttributes(`${Al}${v}`))?.get("aria-label")||"";o=e={annotationType:Je.STAMP,bitmapId:j,bitmap:$,pageIndex:M-1,rect:g.slice(0),rotation:b,annotationElementId:v,id:v,deleted:!1,accessibilityData:{decorative:!1,altText:Z},isSvg:!1,structParent:x,popupRef:y,richText:R,comment:S?.str||null,creationDate:_,modificationDate:C}}const s=await super.deserialize(e,t,n),{rect:c,bitmap:d,bitmapUrl:h,bitmapId:u,isSvg:f,accessibilityData:m}=e;l?(n.addMissingCanvas(e.id,s),s.#l=!0):u&&n.imageManager.isValidId(u)?(s.#t=u,d&&(s.#e=d)):s.#a=h,s.#s=f;const[p,w]=s.pageDimensions;return s.width=(c[2]-c[0])/p,s.height=(c[3]-c[1])/w,m&&(s.altTextData=m),s._initialData=o,e.comment&&s.setCommentData(e),s.#u=!!o,s}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#s});if(this.addComment(n),e)return n.bitmapUrl=this.#w(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;const{decorative:o,altText:l}=this.serializeAltText(!1);if(!o&&l&&(n.accessibilityData={type:"Figure",alt:l}),this.annotationElementId){const c=this.#b(n);return c.isSame?null:(c.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;const s=this.#s?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:s,serialized:n}),n.bitmap=this.#w(!1);else if(this.#s){const c=t.stamps.get(this.#t);s>c.area&&(c.area=s,c.serialized.bitmap.close(),c.serialized.bitmap=this.#w(!1))}return n}#b(e){const{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,o=e.pageIndex===t,l=(e.accessibilityData?.alt||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&o&&l,isSameAltText:l}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}class Wa{#e;#t=!1;#n=null;#a=null;#i=null;#r=new Map;#o=!1;#l=!1;#c=!1;#s=null;#u=null;#h=null;#f=null;#g=null;#m=-1;#d;static _initialized=!1;static#p=new Map([Qt,Pl,tie,Yt,Ha].map(e=>[e._editorType,e]));constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:o,accessibilityManager:l,annotationLayer:s,drawLayer:c,textLayer:d,viewport:h,l10n:u}){const f=[...Wa.#p.values()];if(!Wa._initialized){Wa._initialized=!0;for(const m of f)m.initialize(u,e)}e.registerEditorTypes(f),this.#d=e,this.pageIndex=t,this.div=n,this.#e=l,this.#n=s,this.viewport=h,this.#h=d,this.drawLayer=c,this._structTree=o,this.#d.addLayer(this)}get isEmpty(){return this.#r.size===0}get isInvisible(){return this.isEmpty&&this.#d.getMode()===Je.NONE}updateToolbar(e){this.#d.updateToolbar(e)}updateMode(e=this.#d.getMode()){switch(this.#x(),e){case Je.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Je.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Je.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;if(t.toggle("nonEditing",!1),e===Je.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(const n of Wa.#p.values())t.toggle(`${n._type}Editing`,e===n._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#h?.div}setEditingState(e){this.#d.setEditingState(e)}addCommands(e){this.#d.addCommands(e)}cleanUndoStack(e){this.#d.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.div.classList.toggle("disabled",!e)}get#w(){return this.#r.size!==0?this.#r.values():this.#d.getEditors(this.pageIndex)}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#g?.abort(),this.#g=null;const e=new Set;for(const n of this.#w)n.enableEditing(),n.show(!0),n.annotationElementId&&(this.#d.removeChangedExistingAnnotation(n),e.add(n.annotationElementId));const t=this.#n;if(t)for(const n of t.getEditableAnnotations()){if(n.hide(),this.#d.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;const o=await this.deserialize(n);o&&(this.addOrRebuild(o),o.enableEditing())}this.#c=!1,this.#d._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#l=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#h&&!this.#g){this.#g=new AbortController;const n=this.#d.combinedSignal(this.#g);this.#h.div.addEventListener("pointerdown",o=>{const{clientX:s,clientY:c,timeStamp:d}=o,h=this.#m;if(d-h>500){this.#m=d;return}this.#m=-1;const{classList:u}=this.div;u.toggle("getElements",!0);const f=document.elementsFromPoint(s,c);if(u.toggle("getElements",!1),!this.div.contains(f[0]))return;let m;const p=new RegExp(`^${ao}[0-9]+$`);for(const g of f)if(p.test(g.id)){m=g.id;break}if(!m)return;const w=this.#r.get(m);w?.annotationElementId===null&&(o.stopPropagation(),o.preventDefault(),w.dblclick(o))},{signal:n,capture:!0})}const e=this.#n;if(e){const n=new Map,o=new Map;for(const s of this.#w){if(s.disableEditing(),!s.annotationElementId){s.updateFakeAnnotationElement(e);continue}if(s.serialize()!==null){n.set(s.annotationElementId,s);continue}else o.set(s.annotationElementId,s);this.getEditableAnnotation(s.annotationElementId)?.show(),s.remove()}const l=e.getEditableAnnotations();for(const s of l){const{id:c}=s.data;if(this.#d.isDeletedAnnotationElement(c)){s.updateEdited({deleted:!0});continue}let d=o.get(c);if(d){d.resetAnnotationElement(s),d.show(!1),s.show();continue}d=n.get(c),d&&(this.#d.addChangedExistingAnnotation(d),d.renderAnnotationElement(s)&&d.show(!1)),s.show()}}this.#x(),this.isEmpty&&(this.div.hidden=!0);const{classList:t}=this.div;for(const n of Wa.#p.values())t.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#l=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#d.getActive()!==e&&this.#d.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#h?.div&&!this.#f){this.#f=new AbortController;const e=this.#d.combinedSignal(this.#f);this.#h.div.addEventListener("pointerdown",this.#b.bind(this),{signal:e}),this.#h.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#h?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#h.div.classList.remove("highlighting"))}#b(e){this.#d.unselectAll();const{target:t}=e;if(t===this.#h.div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&this.#h.div.contains(t)){const{isMac:n}=ta.platform;if(e.button!==0||e.ctrlKey&&n)return;this.#d.showAllEditors("highlight",!0,!0),this.#h.div.classList.add("free"),this.toggleDrawing(),Yt.startHighlighting(this,this.#d.direction==="ltr",{target:this.#h.div,x:e.x,y:e.y}),this.#h.div.addEventListener("pointerup",()=>{this.#h.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#d._signal}),e.preventDefault()}}enableClick(){if(this.#a)return;this.#a=new AbortController;const e=this.#d.combinedSignal(this.#a);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){this.#a?.abort(),this.#a=null}attach(e){this.#r.set(e.id,e);const{annotationElementId:t}=e;t&&this.#d.isDeletedAnnotationElement(t)&&this.#d.removeDeletedAnnotationElement(e)}detach(e){this.#r.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#l&&e.annotationElementId&&this.#d.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#d.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#d.addDeletedAnnotationElement(e.annotationElementId),Te.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#d.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#c),this.#d.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#d._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:t,undo:n,mustExec:!1})}getEditorByUID(e){for(const t of this.#r.values())if(t.uid===e)return t;return null}getNextId(){return this.#d.getId()}get#v(){return Wa.#p.get(this.#d.getMode())}combinedSignal(e){return this.#d.combinedSignal(e)}#C(e){const t=this.#v;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#v?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#d.updateMode(e.mode);const{offsetX:n,offsetY:o}=this.#R(),l=this.getNextId(),s=this.#C({parent:this,id:l,x:n,y:o,uiManager:this.#d,isCentered:!0,...t});s&&this.add(s)}async deserialize(e){return await Wa.#p.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#d)||null}createAndAddNewEditor(e,t,n={}){const o=this.getNextId(),l=this.#C({parent:this,id:o,x:e.offsetX,y:e.offsetY,uiManager:this.#d,isCentered:t,...n});return l&&this.add(l),l}get boundingClientRect(){return this.div.getBoundingClientRect()}#R(){const{x:e,y:t,width:n,height:o}=this.boundingClientRect,l=Math.max(0,e),s=Math.max(0,t),c=Math.min(window.innerWidth,e+n),d=Math.min(window.innerHeight,t+o),h=(l+c)/2-e,u=(s+d)/2-t,[f,m]=this.viewport.rotation%180===0?[h,u]:[u,h];return{offsetX:f,offsetY:m}}addNewEditor(e={}){this.createAndAddNewEditor(this.#R(),!0,e)}setSelected(e){this.#d.setSelected(e)}toggleSelected(e){this.#d.toggleSelected(e)}unselect(e){this.#d.unselect(e)}pointerup(e){const{isMac:t}=ta.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#o||(this.#o=!1,this.#v?.isDrawer&&this.#v.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}const n=this.#d.getMode();if(n===Je.STAMP||n===Je.SIGNATURE){this.#d.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#d.getMode()===Je.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}const{isMac:t}=ta.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#o=!0,this.#v?.isDrawer){this.startDrawingSession(e);return}const n=this.#d.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#s){this.#v.startDrawing(this,this.#d,!1,e);return}this.#d.setCurrentDrawingSession(this),this.#s=new AbortController;const t=this.#d.combinedSignal(this.#s);this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(this.#u=null,this.commitOrRemove())},{signal:t}),this.#v.startDrawing(this,this.#d,!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&(this.#u=t);return}this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){return this.#s?(this.#d.setCurrentDrawingSession(null),this.#s.abort(),this.#s=null,this.#u=null,this.#v.endDrawing(e)):null}findNewParent(e,t,n){const o=this.#d.findParent(t,n);return o===null||o===this?!1:(o.changeParent(e),!0)}commitOrRemove(){return this.#s?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#s&&this.#v.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#d.getActive()?.parent===this&&(this.#d.commitOrRemove(),this.#d.setActiveEditor(null)),this.#i&&(clearTimeout(this.#i),this.#i=null);for(const e of this.#r.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#r.clear(),this.#d.removeLayer(this)}#x(){for(const e of this.#r.values())e.isEmpty()&&e.remove()}render({viewport:e}){this.viewport=e,yn(this.div,e);for(const t of this.#d.getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){this.#d.commitOrRemove(),this.#x();const t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,yn(this.div,{rotation:n}),t!==n)for(const o of this.#r.values())o.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#d.viewParameters.realScale}}class ea{#e=null;#t=new Map;#n=new Map;static#a=0;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(!this.#e){this.#e=e;return}if(this.#e!==e){if(this.#t.size>0)for(const t of this.#t.values())t.remove(),e.append(t);this.#e=e}}static get _svgFactory(){return nt(this,"_svgFactory",new lo)}static#i(e,[t,n,o,l]){const{style:s}=e;s.top=`${100*n}%`,s.left=`${100*t}%`,s.width=`${100*o}%`,s.height=`${100*l}%`}#r(){const e=ea._svgFactory.create(1,1,!0);return this.#e.append(e),e.setAttribute("aria-hidden",!0),e}#o(e,t){const n=ea._svgFactory.createElement("clipPath");e.append(n);const o=`clip_${t}`;n.setAttribute("id",o),n.setAttribute("clipPathUnits","objectBoundingBox");const l=ea._svgFactory.createElement("use");return n.append(l),l.setAttribute("href",`#${t}`),l.classList.add("clip"),o}#l(e,t){for(const[n,o]of Object.entries(t))o===null?e.removeAttribute(n):e.setAttribute(n,o)}draw(e,t=!1,n=!1){const o=ea.#a++,l=this.#r(),s=ea._svgFactory.createElement("defs");l.append(s);const c=ea._svgFactory.createElement("path");s.append(c);const d=`path_p${this.pageIndex}_${o}`;c.setAttribute("id",d),c.setAttribute("vector-effect","non-scaling-stroke"),t&&this.#n.set(o,c);const h=n?this.#o(s,d):null,u=ea._svgFactory.createElement("use");return l.append(u),u.setAttribute("href",`#${d}`),this.updateProperties(l,e),this.#t.set(o,l),{id:o,clipPathId:`url(#${h})`}}drawOutline(e,t){const n=ea.#a++,o=this.#r(),l=ea._svgFactory.createElement("defs");o.append(l);const s=ea._svgFactory.createElement("path");l.append(s);const c=`path_p${this.pageIndex}_${n}`;s.setAttribute("id",c),s.setAttribute("vector-effect","non-scaling-stroke");let d;if(t){const f=ea._svgFactory.createElement("mask");l.append(f),d=`mask_p${this.pageIndex}_${n}`,f.setAttribute("id",d),f.setAttribute("maskUnits","objectBoundingBox");const m=ea._svgFactory.createElement("rect");f.append(m),m.setAttribute("width","1"),m.setAttribute("height","1"),m.setAttribute("fill","white");const p=ea._svgFactory.createElement("use");f.append(p),p.setAttribute("href",`#${c}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const h=ea._svgFactory.createElement("use");o.append(h),h.setAttribute("href",`#${c}`),d&&h.setAttribute("mask",`url(#${d})`);const u=h.cloneNode();return o.append(u),h.classList.add("mainOutline"),u.classList.add("secondaryOutline"),this.updateProperties(o,e),this.#t.set(n,o),n}finalizeDraw(e,t){this.#n.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;const{root:n,bbox:o,rootClass:l,path:s}=t,c=typeof e=="number"?this.#t.get(e):e;if(c){if(n&&this.#l(c,n),o&&ea.#i(c,o),l){const{classList:d}=c;for(const[h,u]of Object.entries(l))d.toggle(h,u)}if(s){const h=c.firstChild.firstChild;this.#l(h,s)}}}updateParent(e,t){if(t===this)return;const n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#n.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(const e of this.#t.values())e.remove();this.#t.clear(),this.#n.clear()}}globalThis._pdfjsTestingUtils={HighlightOutliner:Z0};globalThis.pdfjsLib={AbortException:on,AnnotationEditorLayer:Wa,AnnotationEditorParamsType:dt,AnnotationEditorType:Je,AnnotationEditorUIManager:ln,AnnotationLayer:Zl,AnnotationMode:za,AnnotationType:Gt,applyOpacity:jd,build:Xd,ColorPicker:Ea,createValidAbsoluteUrl:yl,CSSConstants:Md,DOMSVGFactory:lo,DrawLayer:ea,FeatureTest:ta,fetchData:Er,findContrastColor:Ld,getDocument:kl,getFilenameFromUrl:Cd,getPdfFilenameFromUrl:Sd,getRGB:Rr,getUuid:Rl,getXfaPageViewport:_d,GlobalWorkerOptions:xn,ImageKind:Kr,InvalidPDFException:ci,isDataScheme:wo,isPdfFile:Ci,isValidExplicitDest:Od,MathClamp:oa,noContextMenu:Aa,normalizeUnicode:Rd,OPS:pr,OutputScale:ka,PasswordResponses:yd,PDFDataRangeTransport:Tl,PDFDateString:di,PDFWorker:gr,PermissionFlag:xd,PixelsPerInch:Nn,RenderingCancelledException:Ai,renderRichText:Sl,ResponseException:no,setLayerDimensions:yn,shadow:nt,SignatureExtractor:kn,stopEvent:Wt,SupportedImageMimeTypes:hi,TextLayer:oo,TouchManager:bo,updateUrlHash:El,Util:je,VerbosityLevel:mo,version:Dl,XfaLayer:Cl};const aie=Object.freeze(Object.defineProperty({__proto__:null,AbortException:on,AnnotationEditorLayer:Wa,AnnotationEditorParamsType:dt,AnnotationEditorType:Je,AnnotationEditorUIManager:ln,AnnotationLayer:Zl,AnnotationMode:za,AnnotationType:Gt,CSSConstants:Md,ColorPicker:Ea,DOMSVGFactory:lo,DrawLayer:ea,FeatureTest:ta,GlobalWorkerOptions:xn,ImageKind:Kr,InvalidPDFException:ci,MathClamp:oa,OPS:pr,OutputScale:ka,PDFDataRangeTransport:Tl,PDFDateString:di,PDFWorker:gr,PasswordResponses:yd,PermissionFlag:xd,PixelsPerInch:Nn,RenderingCancelledException:Ai,ResponseException:no,SignatureExtractor:kn,SupportedImageMimeTypes:hi,TextLayer:oo,TouchManager:bo,Util:je,VerbosityLevel:mo,XfaLayer:Cl,applyOpacity:jd,build:Xd,createValidAbsoluteUrl:yl,fetchData:Er,findContrastColor:Ld,getDocument:kl,getFilenameFromUrl:Cd,getPdfFilenameFromUrl:Sd,getRGB:Rr,getUuid:Rl,getXfaPageViewport:_d,isDataScheme:wo,isPdfFile:Ci,isValidExplicitDest:Od,noContextMenu:Aa,normalizeUnicode:Rd,renderRichText:Sl,setLayerDimensions:yn,shadow:nt,stopEvent:Wt,updateUrlHash:El,version:Dl},Symbol.toStringTag,{value:"Module"}));function r2(a){var e,t,n="";if(typeof a=="string"||typeof a=="number")n+=a;else if(typeof a=="object")if(Array.isArray(a)){var o=a.length;for(e=0;e<o;e++)a[e]&&(t=r2(a[e]))&&(n&&(n+=" "),n+=t)}else for(t in a)a[t]&&(n&&(n+=" "),n+=t);return n}function Mi(){for(var a,e,t=0,n="",o=arguments.length;t<o;t++)(a=arguments[t])&&(e=r2(a))&&(n&&(n+=" "),n+=e);return n}var M1=Object.prototype.hasOwnProperty;function j1(a,e,t){for(t of a.keys())if(hr(t,e))return t}function hr(a,e){var t,n,o;if(a===e)return!0;if(a&&e&&(t=a.constructor)===e.constructor){if(t===Date)return a.getTime()===e.getTime();if(t===RegExp)return a.toString()===e.toString();if(t===Array){if((n=a.length)===e.length)for(;n--&&hr(a[n],e[n]););return n===-1}if(t===Set){if(a.size!==e.size)return!1;for(n of a)if(o=n,o&&typeof o=="object"&&(o=j1(e,o),!o)||!e.has(o))return!1;return!0}if(t===Map){if(a.size!==e.size)return!1;for(n of a)if(o=n[0],o&&typeof o=="object"&&(o=j1(e,o),!o)||!hr(n[1],e.get(o)))return!1;return!0}if(t===ArrayBuffer)a=new Uint8Array(a),e=new Uint8Array(e);else if(t===DataView){if((n=a.byteLength)===e.byteLength)for(;n--&&a.getInt8(n)===e.getInt8(n););return n===-1}if(ArrayBuffer.isView(a)){if((n=a.byteLength)===e.byteLength)for(;n--&&a[n]===e[n];);return n===-1}if(!t||typeof a=="object"){n=0;for(t in a)if(M1.call(a,t)&&++n&&!M1.call(e,t)||!(t in e)||!hr(a[t],e[t]))return!1;return Object.keys(e).length===n}}return a!==a&&e!==e}function Eo(a){let e=!1;return{promise:new Promise((n,o)=>{a.then(l=>!e&&n(l)).catch(l=>!e&&o(l))}),cancel(){e=!0}}}const nie=["onCopy","onCut","onPaste"],rie=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],oie=["onFocus","onBlur"],iie=["onInput","onInvalid","onReset","onSubmit"],lie=["onLoad","onError"],sie=["onKeyDown","onKeyPress","onKeyUp"],cie=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],die=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],hie=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],uie=["onSelect"],fie=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],mie=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],pie=["onScroll"],gie=["onWheel"],wie=["onAnimationStart","onAnimationEnd","onAnimationIteration"],vie=["onTransitionEnd"],bie=["onToggle"],xie=["onChange"],yie=[...nie,...rie,...oie,...iie,...lie,...sie,...cie,...die,...hie,...uie,...fie,...mie,...pie,...gie,...wie,...vie,...xie,...bie];function o2(a,e){const t={};for(const n of yie){const o=a[n];o&&(e?t[n]=(l=>o(l,e(n))):t[n]=o)}return t}var Eie=process.env.NODE_ENV==="production",c0="Invariant failed";function _t(a,e){if(!a){if(Eie)throw new Error(c0);var t=typeof e=="function"?e():e,n=t?"".concat(c0,": ").concat(t):c0;throw new Error(n)}}var d0,L1;function Rie(){if(L1)return d0;L1=1;var a=process.env.NODE_ENV!=="production",e=function(){};if(a){var t=function(o,l){var s=arguments.length;l=new Array(s>1?s-1:0);for(var c=1;c<s;c++)l[c-1]=arguments[c];var d=0,h="Warning: "+o.replace(/%s/g,function(){return l[d++]});typeof console<"u"&&console.error(h);try{throw new Error(h)}catch{}};e=function(n,o,l){var s=arguments.length;l=new Array(s>2?s-2:0);for(var c=2;c<s;c++)l[c-2]=arguments[c];if(o===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");n||t.apply(null,[o].concat(l))}}return d0=e,d0}var Aie=Rie();const la=_7(Aie),i2=E.createContext(null),Cie="noopener noreferrer nofollow";class Sie{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return _t(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(e){_t(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}addLinkAttributes(e,t,n){e.href=t,e.rel=this.externalLinkRel||Cie,e.target=n?"_blank":this.externalLinkTarget||""}goToDestination(e){return new Promise(t=>{_t(this.pdfDocument,"PDF document not loaded."),_t(e,"Destination is not specified."),typeof e=="string"?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)}).then(t=>{_t(Array.isArray(t),`"${t}" is not a valid destination array.`);const n=t[0];new Promise(o=>{_t(this.pdfDocument,"PDF document not loaded."),n instanceof Object?this.pdfDocument.getPageIndex(n).then(l=>{o(l)}).catch(()=>{_t(!1,`"${n}" is not a valid page reference.`)}):typeof n=="number"?o(n):_t(!1,`"${n}" is not a valid destination reference.`)}).then(o=>{const l=o+1;_t(this.pdfViewer,"PDF viewer is not initialized."),_t(l>=1&&l<=this.pagesCount,`"${l}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:o,pageNumber:l})})})}goToPage(e){const t=e-1;_t(this.pdfViewer,"PDF viewer is not initialized."),_t(e>=1&&e<=this.pagesCount,`"${e}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(e){this.goToDestination(e)}}function ur({children:a,type:e}){return i.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:a})}const F1={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function _ie(a,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return a}}function wr(){return E.useReducer(_ie,{value:void 0,error:void 0})}const ji=typeof window<"u",l2=ji&&window.location.protocol==="file:";function Mie(a){return typeof a<"u"}function Mn(a){return Mie(a)&&a!==null}function jie(a){return typeof a=="string"}function Lie(a){return a instanceof ArrayBuffer}function Fie(a){return _t(ji,"isBlob can only be used in a browser environment"),a instanceof Blob}function H0(a){return jie(a)&&/^data:/.test(a)}function I1(a){_t(H0(a),"Invalid data URI.");const[e="",t=""]=a.split(",");return e.split(";").indexOf("base64")!==-1?atob(t):unescape(t)}function Iie(){return ji&&window.devicePixelRatio||1}const s2="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function k1(){la(!l2,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${s2}`)}function kie(){la(!l2,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${s2}`)}function Vn(a){a?.cancel&&a.cancel()}function V0(a,e){return Object.defineProperty(a,"width",{get(){return this.getViewport({scale:e}).width},configurable:!0}),Object.defineProperty(a,"height",{get(){return this.getViewport({scale:e}).height},configurable:!0}),Object.defineProperty(a,"originalWidth",{get(){return this.getViewport({scale:1}).width},configurable:!0}),Object.defineProperty(a,"originalHeight",{get(){return this.getViewport({scale:1}).height},configurable:!0}),a}function c2(a){return a.name==="AbortException"||a.name==="RenderingCancelledException"}function Oie(a){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return t(new Error("Error while reading a file."));e(n.result)},n.onerror=o=>{if(!o.target)return t(new Error("Error while reading a file."));const{error:l}=o.target;if(!l)return t(new Error("Error while reading a file."));switch(l.code){case l.NOT_FOUND_ERR:return t(new Error("Error while reading a file: File not found."));case l.SECURITY_ERR:return t(new Error("Error while reading a file: Security error."));case l.ABORT_ERR:return t(new Error("Error while reading a file: Aborted."));default:return t(new Error("Error while reading a file."))}},n.readAsArrayBuffer(a)})}const{PDFDataRangeTransport:Tie}=aie,Die=(a,e)=>{switch(e){case F1.NEED_PASSWORD:{const t=prompt("Enter the password to open this PDF file.");a(t);break}case F1.INCORRECT_PASSWORD:{const t=prompt("Invalid password. Please try again.");a(t);break}}};function O1(a){return typeof a=="object"&&a!==null&&("data"in a||"range"in a||"url"in a)}const $ie=E.forwardRef(function({children:e,className:t,error:n="Failed to load PDF file.",externalLinkRel:o,externalLinkTarget:l,file:s,inputRef:c,imageResourcesPath:d,loading:h="Loading PDF…",noData:u="No PDF file specified.",onItemClick:f,onLoadError:m,onLoadProgress:p,onLoadSuccess:w,onPassword:g=Die,onSourceError:b,onSourceSuccess:v,options:x,renderMode:y,rotate:R,scale:S,..._},C){const[A,M]=wr(),{value:L,error:j}=A,[$,Z]=wr(),{value:D,error:k}=$,O=E.useRef(new Sie),T=E.useRef([]),V=E.useRef(void 0),z=E.useRef(void 0);s&&s!==V.current&&O1(s)&&(la(!hr(s,V.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),V.current=s),x&&x!==z.current&&(la(!hr(x,z.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),z.current=x);const G=E.useRef({scrollPageIntoView:he=>{const{dest:de,pageNumber:H,pageIndex:Y=H-1}=he;if(f){f({dest:de,pageIndex:Y,pageNumber:H});return}const ue=T.current[Y];if(ue){ue.scrollIntoView();return}la(!1,`An internal link leading to page ${H} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});E.useImperativeHandle(C,()=>({linkService:O,pages:T,viewer:G}),[]);function ae(){v&&v()}function Q(){j&&(la(!1,j.toString()),b&&b(j))}function K(){M({type:"RESET"})}E.useEffect(K,[s,M]);const q=E.useCallback(async()=>{if(!s)return null;if(typeof s=="string")return H0(s)?{data:I1(s)}:(k1(),{url:s});if(s instanceof Tie)return{range:s};if(Lie(s))return{data:s};if(ji&&Fie(s))return{data:await Oie(s)};if(_t(typeof s=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),_t(O1(s),"Invalid parameter object: need either .data, .range or .url"),"url"in s&&typeof s.url=="string"){if(H0(s.url)){const{url:he,...de}=s;return{data:I1(he),...de}}k1()}return s},[s]);E.useEffect(()=>{const he=Eo(q());return he.promise.then(de=>{M({type:"RESOLVE",value:de})}).catch(de=>{M({type:"REJECT",error:de})}),()=>{Vn(he)}},[q,M]),E.useEffect(()=>{if(!(typeof L>"u")){if(L===!1){Q();return}ae()}},[L]);function ne(){D&&(w&&w(D),T.current=new Array(D.numPages),O.current.setDocument(D))}function X(){k&&(la(!1,k.toString()),m&&m(k))}E.useEffect(function(){Z({type:"RESET"})},[Z,L]),E.useEffect(function(){if(!L)return;const de=x?{...L,...x}:L,H=kl(de);p&&(H.onProgress=p),g&&(H.onPassword=g);const Y=H;return Y.promise.then(ue=>{Y.destroyed||Z({type:"RESOLVE",value:ue})}).catch(ue=>{Y.destroyed||Z({type:"REJECT",error:ue})}),()=>{Y.destroy()}},[x,Z,L]),E.useEffect(()=>{if(!(typeof D>"u")){if(D===!1){X();return}ne()}},[D]),E.useEffect(function(){O.current.setViewer(G.current),O.current.setExternalLinkRel(o),O.current.setExternalLinkTarget(l)},[o,l]);const ee=E.useCallback((he,de)=>{T.current[he]=de},[]),le=E.useCallback(he=>{delete T.current[he]},[]),U=E.useMemo(()=>({imageResourcesPath:d,linkService:O.current,onItemClick:f,pdf:D,registerPage:ee,renderMode:y,rotate:R,scale:S,unregisterPage:le}),[d,f,D,ee,y,R,S,le]),fe=E.useMemo(()=>o2(_,()=>D),[_,D]);function be(){function he(H){return!!H?.pdf}if(!he(U))throw new Error("pdf is undefined");const de=typeof e=="function"?e(U):e;return i.jsx(i2.Provider,{value:U,children:de})}function J(){return s?D==null?i.jsx(ur,{type:"loading",children:typeof h=="function"?h():h}):D===!1?i.jsx(ur,{type:"error",children:typeof n=="function"?n():n}):be():i.jsx(ur,{type:"no-data",children:typeof u=="function"?u():u})}return i.jsx("div",{className:Mi("react-pdf__Document",t),ref:c,...fe,children:J()})});function d2(){return E.useContext(i2)}function h2(){for(var a=[],e=0;e<arguments.length;e++)a[e]=arguments[e];var t=a.filter(Boolean);if(t.length<=1){var n=t[0];return n||null}return function(l){for(var s=0,c=t;s<c.length;s++){var d=c[s];typeof d=="function"?d(l):d&&(d.current=l)}}}const u2=E.createContext(null);function Li(){return E.useContext(u2)}function Bie(){const a=d2(),e=Li();_t(e,"Unable to find Page context.");const t={...a,...e},{filterAnnotations:n,imageResourcesPath:o,linkService:l,onGetAnnotationsError:s,onGetAnnotationsSuccess:c,onRenderAnnotationLayerError:d,onRenderAnnotationLayerSuccess:h,page:u,pdf:f,renderForms:m,rotate:p,scale:w=1}=t;_t(f,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),_t(u,"Attempted to load page annotations, but no page was specified."),_t(l,"Attempted to load page annotations, but no linkService was specified.");const[g,b]=wr(),{value:v,error:x}=g,y=E.useRef(null);la(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function R(){v&&c&&c(v)}function S(){x&&(la(!1,x.toString()),s&&s(x))}E.useEffect(function(){b({type:"RESET"})},[b,u]),E.useEffect(function(){if(!u)return;const L=Eo(u.getAnnotations()),j=L;return L.promise.then($=>{b({type:"RESOLVE",value:$})}).catch($=>{b({type:"REJECT",error:$})}),()=>{Vn(j)}},[b,u]),E.useEffect(()=>{if(v!==void 0){if(v===!1){S();return}R()}},[v]);function _(){h&&h()}function C(M){la(!1,`${M}`),d&&d(M)}const A=E.useMemo(()=>u.getViewport({scale:w,rotation:p}),[u,p,w]);return E.useEffect(function(){if(!f||!u||!l||!v)return;const{current:L}=y;if(!L)return;const j=A.clone({dontFlip:!0}),$={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:f.annotationStorage,commentManager:null,div:L,l10n:null,linkService:l,page:u,structTreeLayer:null,viewport:j},Z={annotations:n?n({annotations:v}):v,annotationStorage:f.annotationStorage,div:L,imageResourcesPath:o,linkService:l,page:u,renderForms:m,viewport:j};L.innerHTML="";try{new Zl($).render(Z),_()}catch(D){C(D)}return()=>{}},[v,n,o,l,u,f,m,A]),i.jsx("div",{className:Mi("react-pdf__Page__annotations","annotationLayer"),ref:y})}const f2={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Zie=/^H(\d+)$/;function Pie(a){return a in f2}function Fi(a){return"children"in a}function m2(a){return Fi(a)?a.children.length===1&&0 in a.children&&"id"in a.children[0]:!1}function Nie(a){const e={};if(Fi(a)){const{role:t}=a,n=t.match(Zie);if(n)e.role="heading",e["aria-level"]=Number(n[1]);else if(Pie(t)){const o=f2[t];o&&(e.role=o)}}return e}function p2(a){const e={};if(Fi(a)){if(a.alt!==void 0&&(e["aria-label"]=a.alt),a.lang!==void 0&&(e.lang=a.lang),m2(a)){const[t]=a.children;if(t){const n=p2(t);return{...e,...n}}}}else"id"in a&&(e["aria-owns"]=a.id);return e}function Hie(a){return a?{...Nie(a),...p2(a)}:null}function g2({className:a,node:e}){const t=E.useMemo(()=>Hie(e),[e]),n=E.useMemo(()=>!Fi(e)||m2(e)?null:e.children.map((o,l)=>i.jsx(g2,{node:o},l)),[e]);return i.jsx("span",{className:a,...t,children:n})}function Vie(){const a=Li();_t(a,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:t}=a,[n,o]=wr(),{value:l,error:s}=n,{customTextRenderer:c,page:d}=a;function h(){l&&t&&t(l)}function u(){s&&(la(!1,s.toString()),e&&e(s))}return E.useEffect(function(){o({type:"RESET"})},[o,d]),E.useEffect(function(){if(c||!d)return;const m=Eo(d.getStructTree()),p=m;return m.promise.then(w=>{o({type:"RESOLVE",value:w})}).catch(w=>{o({type:"REJECT",error:w})}),()=>Vn(p)},[c,d,o]),E.useEffect(()=>{if(l!==void 0){if(l===!1){u();return}h()}},[l]),l?i.jsx(g2,{className:"react-pdf__Page__structTree structTree",node:l}):null}const T1=za;function Wie(a){const e=Li();_t(e,"Unable to find Page context.");const t={...e,...a},{_className:n,canvasBackground:o,devicePixelRatio:l=Iie(),onRenderError:s,onRenderSuccess:c,page:d,renderForms:h,renderTextLayer:u,pageColors:f,rotate:m,scale:p}=t,{canvasRef:w}=a;_t(d,"Attempted to render page canvas, but no page was specified.");const g=E.useRef(null);function b(){d&&c&&c(V0(d,p))}function v(S){c2(S)||(la(!1,S.toString()),s&&s(S))}const x=E.useMemo(()=>d.getViewport({scale:p*l,rotation:m}),[l,d,m,p]),y=E.useMemo(()=>d.getViewport({scale:p,rotation:m}),[d,m,p]);E.useEffect(function(){if(!d)return;d.cleanup();const{current:_}=g;if(!_)return;_.width=x.width,_.height=x.height,_.style.width=`${Math.floor(y.width)}px`,_.style.height=`${Math.floor(y.height)}px`,_.style.visibility="hidden";const C={annotationMode:h?T1.ENABLE_FORMS:T1.ENABLE,canvas:_,canvasContext:_.getContext("2d",{alpha:!1}),pageColors:f,viewport:x};o&&(C.background=o);const A=d.render(C),M=A;return A.promise.then(()=>{_.style.visibility="",b()}).catch(v),()=>Vn(M)},[o,d,f,h,x,y]);const R=E.useCallback(()=>{const{current:S}=g;S&&(S.width=0,S.height=0)},[]);return E.useEffect(()=>R,[R]),i.jsx("canvas",{className:`${n}__canvas`,dir:"ltr",ref:h2(w,g),style:{display:"block",userSelect:"none"},children:u?i.jsx(Vie,{}):null})}function zie(a){return"str"in a}const Uie=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),Gie=new Set(["action","formaction","href","poster","src","xlink:href"]);function Yie(a){let e="";for(const t of a){const n=t.charCodeAt(0);n<=32||n===127||(e+=t.toLowerCase())}return e.startsWith("javascript:")||e.startsWith("vbscript:")}function Xie(a){return a.nodeType===Node.ELEMENT_NODE}function w2(a){return Xie(a)&&a instanceof HTMLElement}function qie(a){return w2(a)&&Uie.has(a.tagName.toLowerCase())}function Kie(a){const e=document.createElement(a.tagName.toLowerCase());return Array.from(a.attributes).forEach(t=>{const n=t.name.toLowerCase();n.startsWith("on")||n==="srcdoc"||Gie.has(n)&&Yie(t.value)||e.setAttribute(t.name,t.value)}),Array.from(a.childNodes).forEach(t=>{e.append(v2(t))}),e}function v2(a){var e;return w2(a)&&!qie(a)?Kie(a):document.createTextNode((e=a.textContent)!==null&&e!==void 0?e:"")}function Jie(a,e){const t=document.createElement("template");t.innerHTML=e;const n=document.createDocumentFragment();Array.from(t.content.childNodes).forEach(o=>{n.append(v2(o))}),a.replaceChildren(n)}function Qie(){const a=Li();_t(a,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:t,onGetTextSuccess:n,onRenderTextLayerError:o,onRenderTextLayerSuccess:l,page:s,pageIndex:c,pageNumber:d,rotate:h,scale:u}=a;_t(s,"Attempted to load page text content, but no page was specified.");const[f,m]=wr(),{value:p,error:w}=f,g=E.useRef(null);la(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function b(){p&&n&&n(p)}function v(){w&&(la(!1,w.toString()),t&&t(w))}E.useEffect(function(){m({type:"RESET"})},[s,m]),E.useEffect(function(){if(!s)return;const A=Eo(s.getTextContent()),M=A;return A.promise.then(L=>{m({type:"RESOLVE",value:L})}).catch(L=>{m({type:"REJECT",error:L})}),()=>Vn(M)},[s,m]),E.useEffect(()=>{if(p!==void 0){if(p===!1){v();return}b()}},[p]);const x=E.useCallback(()=>{l&&l()},[l]),y=E.useCallback(C=>{c2(C)||(la(!1,C.toString()),o&&o(C))},[o]);function R(){const C=g.current;C&&C.classList.add("selecting")}function S(){const C=g.current;C&&C.classList.remove("selecting")}const _=E.useMemo(()=>s.getViewport({scale:u,rotation:h}),[s,h,u]);return E.useLayoutEffect(function(){if(!s||!p)return;const{current:A}=g;if(!A)return;A.innerHTML="";const M=s.streamTextContent({includeMarkedContent:!0}),L={container:A,textContentSource:M,viewport:_},j=new oo(L),$=j;return j.render().then(()=>{const Z=document.createElement("div");Z.className="endOfContent",A.append(Z);const D=A.querySelectorAll('[role="presentation"]');if(e){let k=0;p.items.forEach((O,T)=>{if(!zie(O))return;const V=D[k];if(!V)return;const z=e({pageIndex:c,pageNumber:d,itemIndex:T,...O});Jie(V,z),k+=O.str&&O.hasEOL?2:1})}x()}).catch(y),()=>Vn($)},[e,y,x,s,c,d,p,_]),i.jsx("div",{className:Mi("react-pdf__Page__textContent","textLayer"),onMouseUp:S,onMouseDown:R,ref:g})}const D1=1;function e0e(a){const t={...d2(),...a},{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:o=!0,canvasBackground:l,canvasRef:s,children:c,className:d,customRenderer:h,customTextRenderer:u,devicePixelRatio:f,error:m="Failed to load the page.",filterAnnotations:p,height:w,inputRef:g,loading:b="Loading page…",noData:v="No page specified.",onGetAnnotationsError:x,onGetAnnotationsSuccess:y,onGetStructTreeError:R,onGetStructTreeSuccess:S,onGetTextError:_,onGetTextSuccess:C,onLoadError:A,onLoadSuccess:M,onRenderAnnotationLayerError:L,onRenderAnnotationLayerSuccess:j,onRenderError:$,onRenderSuccess:Z,onRenderTextLayerError:D,onRenderTextLayerSuccess:k,pageColors:O,pageIndex:T,pageNumber:V,pdf:z,registerPage:G,renderAnnotationLayer:ae=!0,renderForms:Q=!1,renderMode:K="canvas",renderTextLayer:q=!0,rotate:ne,scale:X=D1,unregisterPage:ee,width:le,...U}=t,[fe,be]=wr(),{value:J,error:he}=fe,de=E.useRef(null);_t(z,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const H=Mn(V)?V-1:T??null,Y=V??(Mn(T)?T+1:null),ue=ne??(J?J.rotate:null),me=E.useMemo(()=>{if(!J)return null;let ce=1;const te=X??D1;if(le||w){const N=J.getViewport({scale:1,rotation:ue});le?ce=le/N.width:w&&(ce=w/N.height)}return te*ce},[w,J,ue,X,le]);E.useEffect(function(){return()=>{Mn(H)&&o&&ee&&ee(H)}},[o,z,H,ee]);function Ae(){if(M){if(!J||!me)return;M(V0(J,me))}if(o&&G){if(!Mn(H)||!de.current)return;G(H,de.current)}}function ye(){he&&(la(!1,he.toString()),A&&A(he))}E.useEffect(function(){be({type:"RESET"})},[be,z,H]),E.useEffect(function(){if(!z||!Y)return;const te=Eo(z.getPage(Y)),N=te;return te.promise.then(Re=>{be({type:"RESOLVE",value:Re})}).catch(Re=>{be({type:"REJECT",error:Re})}),()=>Vn(N)},[be,z,Y]),E.useEffect(()=>{if(J!==void 0){if(J===!1){ye();return}Ae()}},[J,me]);const Ie=E.useMemo(()=>Mn(H)&&Y&&Mn(ue)&&Mn(me)?{_className:n,canvasBackground:l,customTextRenderer:u,devicePixelRatio:f,filterAnnotations:p,onGetAnnotationsError:x,onGetAnnotationsSuccess:y,onGetStructTreeError:R,onGetStructTreeSuccess:S,onGetTextError:_,onGetTextSuccess:C,onRenderAnnotationLayerError:L,onRenderAnnotationLayerSuccess:j,onRenderError:$,onRenderSuccess:Z,onRenderTextLayerError:D,onRenderTextLayerSuccess:k,page:J,pageColors:O,pageIndex:H,pageNumber:Y,renderForms:Q,renderTextLayer:q,rotate:ue,scale:me}:null,[n,l,u,f,p,x,y,R,S,_,C,L,j,$,Z,D,k,J,O,H,Y,Q,q,ue,me]),Ee=E.useMemo(()=>o2(U,()=>J&&(me?V0(J,me):void 0)),[U,J,me]),Ye=`${H}@${me}/${ue}`;function Ce(){switch(K){case"custom":return _t(h,'renderMode was set to "custom", but no customRenderer was passed.'),i.jsx(h,{},`${Ye}_custom`);case"none":return null;default:return i.jsx(Wie,{canvasRef:s},`${Ye}_canvas`)}}function Se(){return q?i.jsx(Qie,{},`${Ye}_text`):null}function it(){return ae?i.jsx(Bie,{},`${Ye}_annotations`):null}function rt(){function ce(N){return!!N?.page}if(!ce(Ie))throw new Error("page is undefined");const te=typeof c=="function"?c(Ie):c;return i.jsxs(u2.Provider,{value:Ie,children:[Ce(),Se(),it(),te]})}function ht(){return Y?z===null||J===void 0||J===null?i.jsx(ur,{type:"loading",children:typeof b=="function"?b():b}):z===!1||J===!1?i.jsx(ur,{type:"error",children:typeof m=="function"?m():m}):rt():i.jsx(ur,{type:"no-data",children:typeof v=="function"?v():v})}return i.jsx("div",{className:Mi(n,d),"data-page-number":Y,ref:h2(g,de),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${me}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:l||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...Ee,children:ht()})}kie();xn.workerSrc="pdf.worker.mjs";xn.workerSrc=`https://unpkg.com/pdfjs-dist@${Dl}/build/pdf.worker.min.mjs`;const jn={fontFamily:I,fontWeight:400,fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#29474C",margin:0},t0e={fontFamily:I,fontWeight:500,fontSize:"14px",lineHeight:"24px",letterSpacing:"0.01em",color:"#29474C",margin:0},a0e="#6D3856",n0e="#455DA2",r0e={fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"20px",lineHeight:"30px",letterSpacing:0,color:"#29474C",margin:0},or={fontSize:"16px",lineHeight:"24px"},W0={fontFamily:qe,fontWeight:600,fontStyle:"normal",fontSize:"14px",lineHeight:"18px",letterSpacing:"0.01em"},h0=a=>({background:a?n0e:a0e,color:"#FFFFFF",borderRadius:6,padding:"2px 10px",display:"inline-flex",alignItems:"center",...W0}),$1=["persona","empresa","legajo","fechaImportacion","periodo"],B1={persona:{label:"PERSONA",getValue:({colaborador:a})=>a,valueStyle:or},empresa:{label:"EMPRESA",getValue:({empresa:a})=>a,valueStyle:or},legajo:{label:"N DE LEGAJO",getValue:({legajo:a})=>a,valueStyle:W0},recibo:{label:"RECIBO",getValue:({recibo:a})=>a,valueStyle:W0},fechaImportacion:{label:"FECHA DE IMPORTACION",getValue:({fechaImportacion:a})=>a},periodo:{label:"PERIODO",getValue:({periodo:a})=>a,wide:!0}},o0e=({isOpen:a=!1,onClose:e,onDownload:t,title:n="Contrato de trabajo",tagLabel:o="Confidencial",headerBadge:l,legajo:s="LEG-1004",point:c=!1,recibo:d="",colaborador:h="Pedro Sanchez Carmona",empresa:u="TechCorp Argentina",fechaImportacion:f="02-08-2026",periodo:m="2026-08",pdfUrl:p="",closeButtonLabel:w="Cerrar",downloadButtonLabel:g="Descargar PDF",onDownloadButtonClick:b,downloadButtonProps:v={},mobileBreakpoint:x=768,previewTitle:y="Vista previa del PDF",previewSubtitle:R="Contrato de trabajo",previewDescription:S="El documento se mostraria embebido aqui con scroll interno.",previewBackgroundColor:_="#FFFFFF",previewIconName:C="DocumentTextIcon",previewIconColor:A="#A7BEC3",previewIconSize:M=56,previewTitleStyle:L={},previewSubtitleStyle:j={},previewDescriptionStyle:$={},forcePreviewError:Z=!1,showErrorStateOnPreviewFailure:D=!1,previewErrorTitle:k="",previewErrorSubtitle:O="No se puede previsualizar el documento",previewErrorDescription:T="No hay conexión con el servidor o el servicio de documentos no está disponible en este momento.",previewErrorRetryLabel:V="Reintentar",onPreviewRetry:z,previewRetryButtonProps:G={},previewErrorIconName:ae="FaceFrownIcon",previewErrorIconColor:Q="#6D3856",onPreviewLoadError:K,previewErrorContainerStyle:q={},previewErrorIconSize:ne=80,previewErrorTitleStyle:X={},previewErrorSubtitleStyle:ee={},previewErrorDescriptionStyle:le={},pdfToolbarStyle:U={},pdfToolbarButtonStyle:fe={},pdfViewerContainerStyle:be={},pdfDocumentContainerStyle:J={},pdfPageWrapperStyle:he={},infoFields:de})=>{const[H,Y]=E.useState(0),[ue,me]=E.useState(!1),[Ae,ye]=E.useState(0),[Ie,Ee]=E.useState(1),[Ye,Ce]=E.useState(0),[Se,it]=E.useState(typeof window<"u"?window.innerWidth:1920),rt=E.useRef(null);if(E.useEffect(()=>{if(!a)return;const De=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=De}},[a]),E.useEffect(()=>{if(!a||!rt.current||typeof ResizeObserver>"u")return;const De=new ResizeObserver(et=>{const tt=et[0];tt&&ye(Math.max(0,Math.floor(tt.contentRect.width-24)))});return De.observe(rt.current),()=>De.disconnect()},[a]),E.useEffect(()=>{if(typeof window>"u")return;const De=()=>it(window.innerWidth);return De(),window.addEventListener("resize",De),()=>window.removeEventListener("resize",De)},[]),E.useEffect(()=>{a||(me(!1),Y(0),Ee(1),Ce(0))},[a]),!a)return null;const ht=!!c,ce=ht?d:s,te={colaborador:h,empresa:u,legajo:s,recibo:d,fechaImportacion:f,periodo:m},N=de==null,Re=(N?$1:Array.isArray(de)?de:$1).filter(De=>B1[De]),xt=N?"repeat(4, minmax(0, 1fr))":`repeat(${Math.min(Math.max(Re.length,1),4)}, minmax(0, 1fr))`,Fe=Se<=x,pe=!!p,we={minWidth:36,height:32,padding:"4px 10px",borderRadius:6,border:"1px solid #38656D",background:"#FFFFFF",color:"#38656D",cursor:"pointer",fontFamily:I,fontWeight:500,fontSize:14,lineHeight:"20px",...fe},He=()=>Ee(De=>Math.max(.5,Number((De-.1).toFixed(2)))),ut=()=>Ee(De=>Math.min(2,Number((De+.1).toFixed(2)))),Le=()=>Ee(1),st=()=>Ce(De=>(De+90)%360),gt=()=>(b??t)?.(),wt=i.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"12px 16px",boxSizing:"border-box"},children:[i.jsx(P,{name:C,variant:"24-outline",size:M,style:{color:A}}),i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:500,fontSize:"16px",lineHeight:"24px",color:"#29474C",margin:"12px 0 0",letterSpacing:"0px",...L},children:y}),i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:400,fontSize:"16px",lineHeight:"19.5px",letterSpacing:"0px",color:"#29474C",margin:"6px 0 0",textAlign:"center",...j},children:R}),i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:400,fontSize:"16px",lineHeight:"18px",letterSpacing:"0px",color:"#6B7280",margin:"8px 0 0",textAlign:"center",...$},children:S})]}),ft=i.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"16px 20px",boxSizing:"border-box",overflowY:"auto",...q},children:[i.jsx(P,{name:ae,variant:"24-outline",size:ne,style:{color:Q,width:ne,height:ne,opacity:1}}),O?i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:500,fontSize:"20px",lineHeight:"30px",letterSpacing:"0px",color:"#29474C",margin:"10px 0 0",textAlign:"center",whiteSpace:"normal",overflowWrap:"anywhere",wordBreak:"break-word",...ee,...X},children:O}):null,i.jsx(B,{component:"p",style:{fontFamily:I,fontWeight:400,fontSize:"16px",lineHeight:"24px",letterSpacing:"0px",color:"#474747",margin:"8px 0 0",textAlign:"center",maxWidth:520,whiteSpace:"normal",overflowWrap:"anywhere",wordBreak:"break-word",...le},children:T}),i.jsxs("button",{type:"button",onClick:()=>z?.(),...G,style:{marginTop:16,padding:"8px 12px",height:37,borderRadius:8,border:"1px solid #38656D",background:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontFamily:I,fontWeight:500,fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#38656D",...G?.style||{}},children:[i.jsx(P,{name:"ArrowPathIcon",variant:"24-outline",size:20,style:{color:"#38656D",marginRight:8}}),V]})]});return i.jsx("div",{style:{position:"fixed",inset:0,zIndex:1500,background:"#00000040",display:"flex",alignItems:Fe?"stretch":"center",justifyContent:"center",padding:Fe?0:20,boxSizing:"border-box"},onClick:()=>e?.(),children:i.jsxs("div",{role:"dialog","aria-modal":"true",onClick:De=>De.stopPropagation(),style:{width:Fe?"100%":861,maxWidth:"100%",height:Fe?"100%":"min(807px, calc(100vh - 40px))",maxHeight:Fe?"100%":"calc(100vh - 40px)",borderRadius:Fe?0:16,background:"#FFFFFF",border:"1px solid #C4C4C4",boxSizing:"border-box",display:"flex",flexDirection:"column",overflow:"hidden"},children:[i.jsxs("div",{style:{padding:Fe?"12px 10px 8px":"16px 16px 12px",borderBottom:"1px solid #E5E7EB",display:"flex",flexDirection:"column",gap:Fe?4:8},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[i.jsx(B,{component:"h2",variant:"h6",className:"anima-vista-documento__title",style:r0e,children:n}),i.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[!Fe&&!ht&&(l??i.jsx("span",{style:{height:28,padding:"4px 12px",borderRadius:999,border:"1px solid #4C6897",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#4C6897",fontFamily:I,fontWeight:500,fontSize:14,lineHeight:"20px"},children:o})),i.jsx("button",{type:"button","aria-label":"Cerrar modal",onClick:()=>e?.(),style:{border:"none",background:"transparent",padding:0,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:i.jsx(P,{name:"XMarkIcon",variant:"24-outline",size:22,style:{color:"#29474C"}})})]})]}),ht?ce?i.jsx("div",{style:{display:"flex",alignItems:"center"},children:i.jsx("span",{style:h0(ht),children:ce})}):null:Fe?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[i.jsx(B,{component:"span",style:{...jn,fontWeight:500,letterSpacing:"0.01em",...or},children:h}),i.jsx("span",{style:h0(!1),children:s})]}),i.jsx(B,{component:"span",style:{...jn,fontWeight:400,letterSpacing:"0.01em",...or},children:u}),i.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:2},children:l??i.jsx("span",{style:{height:20,padding:"2px 12px",borderRadius:999,border:"1px solid #4C6897",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#4C6897",fontFamily:I,fontWeight:500,fontSize:12,lineHeight:"16px"},children:o})})]}):i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx("span",{style:h0(!1),children:s}),i.jsx(B,{component:"span",style:{...jn,fontWeight:500,letterSpacing:"0.01em",...or},children:h}),i.jsx(B,{component:"span",style:{...jn,color:"#6B7280"},children:"·"}),i.jsx(B,{component:"span",style:{...jn,fontWeight:400,letterSpacing:"0.01em",...or},children:u})]})]}),i.jsxs("div",{style:{padding:Fe?10:16,display:"flex",flexDirection:"column",gap:Fe?12:16,flex:1,minHeight:0,overflowY:"auto",background:"#F3F3F3"},children:[pe&&!ue&&i.jsxs("div",{style:{border:"1px solid #C4C4C4",borderRadius:8,background:"#FFFFFF",padding:Fe?"8px 10px":"10px 12px",display:"flex",alignItems:"center",justifyContent:"center",gap:8,flexWrap:"wrap",...U},children:[i.jsx("button",{type:"button","aria-label":"Reducir zoom",onClick:He,style:we,children:"-"}),i.jsx("button",{type:"button","aria-label":"Aumentar zoom",onClick:ut,style:we,children:"+"}),i.jsx("button",{type:"button",onClick:Le,style:we,children:"Ajustar ancho"}),i.jsx("span",{style:{color:"#A7BEC3",fontFamily:I},children:"|"}),i.jsxs(B,{component:"span",style:jn,children:["Total paginas: ",H||"-"]}),i.jsx("span",{style:{color:"#A7BEC3",fontFamily:I},children:"|"}),i.jsx("button",{type:"button",onClick:st,style:we,children:"Rotar"}),i.jsx("span",{style:{color:"#A7BEC3",fontFamily:I},children:"|"}),i.jsx("button",{type:"button",onClick:gt,style:we,children:"Descargar"})]}),i.jsx("div",{ref:rt,style:{flex:1,minHeight:Fe?210:280,border:"1px solid #C4C4C4",borderRadius:8,background:_,overflow:"auto",display:"flex",alignItems:"stretch",justifyContent:"flex-start",padding:12,boxSizing:"border-box",...be},children:Z||D&&ue?ft:pe&&!ue?i.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",...J},children:i.jsx($ie,{file:p,loading:wt,onLoadSuccess:({numPages:De})=>{Y(De),Ee(1),Ce(0),me(!1)},onLoadError:De=>{me(!0),K?.(De)},children:Array.from({length:H},(De,et)=>i.jsx("div",{style:{marginBottom:et===H-1?0:16,background:"#FFFFFF",border:"1px solid #E5E7EB",borderRadius:6,boxShadow:"0 1px 2px rgba(0, 0, 0, 0.08)",padding:4,boxSizing:"border-box",...he},children:i.jsx(e0e,{pageNumber:et+1,width:Ae>0?Ae*Ie:void 0,rotate:Ye,renderTextLayer:!1,renderAnnotationLayer:!1})},`pdf-page-${et+1}`))})}):pe&&ue?i.jsx("object",{data:p,type:"application/pdf",style:{width:"100%",height:"100%",border:"none",borderRadius:8,background:"#FFFFFF"},children:i.jsx("iframe",{title:"Vista previa del PDF",src:p,style:{width:"100%",height:"100%",border:"none",borderRadius:8,background:"#FFFFFF"}})}):wt}),i.jsx("div",{style:{border:"1px solid #C4C4C4",borderRadius:8,background:"#FFFFFF",padding:Fe?"14px 12px":"16px 18px",display:"grid",gridTemplateColumns:Fe?"1fr":xt,rowGap:14,columnGap:16},children:Re.map(De=>{const et=B1[De],tt=!Fe&&et.wide&&(N||Re.length>=4)&&De==="periodo";return i.jsxs("div",{style:tt?{gridColumn:"1 / span 2"}:void 0,children:[i.jsx(B,{component:"p",style:jn,children:et.label}),i.jsx(B,{component:"p",style:{...t0e,...et.valueStyle||{}},children:et.getValue(te)})]},De)})})]}),i.jsxs("div",{style:{padding:Fe?"8px 8px 12px":"14px 16px",borderTop:Fe?"none":"1px solid #E5E7EB",background:Fe?"#FFFFFF":"#FAFAFA",display:"flex",flexDirection:Fe?"column-reverse":"row",justifyContent:"flex-end",alignItems:"center",gap:Fe?8:12,flexWrap:"nowrap"},children:[i.jsx(Ze,{variant:"outline",text:w,onClick:()=>e?.(),style:{width:Fe?"100%":94,minWidth:Fe?"100%":94,marginLeft:0}}),i.jsx(Ze,{variant:"primary",text:g,onClick:()=>(b??t)?.(),...v,style:{width:Fe?"100%":163,minWidth:Fe?"100%":163,marginLeft:0,...v?.style||{}}})]})]})})},Vl="var(--color-status-warning, #CC4908)",Wl={width:"100%",maxWidth:445,height:48,borderRadius:8,borderWidth:1,borderStyle:"solid",borderColor:Vl,gap:12,opacity:1,paddingTop:12,paddingRight:16,paddingBottom:12,paddingLeft:16,boxSizing:"border-box",display:"flex",alignItems:"center",flex:"0 0 auto",backgroundColor:"var(--color-neutrals-white, #FFFFFF)"},b2={fontFamily:qe,fontWeight:600,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#CC4908",margin:0},x2=({message:a="Algunos documentos no pudieron incorporarse",className:e="",style:t,textStyle:n,...o})=>!a||!String(a).trim()?null:i.jsxs("div",{role:"alert",className:["anima-vista-datos-detalle-alerta",e].filter(Boolean).join(" "),style:{...Wl,...t||{}},...o,children:[i.jsx(P,{name:"ExclamationCircleIcon",variant:"24-outline",size:24,style:{flexShrink:0,color:Vl},"aria-hidden":!0}),i.jsx("p",{style:{...b2,flex:1,minWidth:0,...n||{}},children:a})]}),y2={width:40,height:40,minWidth:40,borderRadius:8,background:"#BDE4E9",display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",flexShrink:0},z0={fontFamily:I,fontWeight:600,fontStyle:"normal",fontSize:"20px",lineHeight:"30px",letterSpacing:0,color:"#29474C",margin:0},zl={fontFamily:I,fontWeight:500,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",margin:0},E2={...zl,color:"#6B7280",flex:"1 1 auto",minWidth:0,wordBreak:"break-word",overflowWrap:"break-word"},R2={...zl,color:"#29474C",textAlign:"right",flex:"1 1 auto",minWidth:0,wordBreak:"break-word",overflowWrap:"break-word"},A2={border:"none",borderTop:"1px solid #E5E7EB",margin:"12px 0",width:"100%"},C2={fontFamily:I,fontWeight:600,fontStyle:"normal",fontSize:"32px",lineHeight:"40px",letterSpacing:0,color:"#6D3856",margin:0,textAlign:"center"},S2={fontFamily:I,fontWeight:400,fontStyle:"normal",fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#29474C",margin:"4px 0 0 0",textAlign:"center"},_2={border:"none",borderTop:"1px solid #E5E7EB",margin:0,width:"100%",flexShrink:0},M2={marginTop:"auto",flexShrink:0,width:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:12,paddingTop:12,boxSizing:"border-box"},i0e={flex:"0 0 auto",width:"100%",boxSizing:"border-box"},Xr={display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"flex-end",gap:40,width:"auto",maxWidth:"100%"},Fn={empresaNombre:"Hexa Systems",empresaIconName:"BuildingOffice2Icon",avatarSrc:"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop&crop=face",avatarAlt:"Ejecutor de la carga",metadataSections:[{rows:[{label:"Ejecutado por",value:"María García Alonso"},{label:"Fecha y hora",value:"18-05-2026 - 15:20 hs."}]},{rows:[{label:"Tipo de documentos",value:"Recibos de sueldo"},{label:"Concepto de liquidación",value:"Mensual"},{label:"Período",value:"Mayo de 2026"}]}],stats:[{value:4,label:"Documentos"},{value:2,label:"Cargados"},{value:2,label:"No cargados"}]},zo=40;function j2(){return i.jsx("hr",{className:"anima-vista-datos-detalle__divider",style:A2})}function l0e({label:a,value:e,labelStyle:t,valueStyle:n,isNarrow:o=!1}){if(!a&&!e)return null;const l=o?{maxWidth:"58%",textAlign:"right"}:{};return i.jsxs("div",{className:"anima-vista-datos-detalle__row",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:o?8:16,width:"100%",maxWidth:"100%",boxSizing:"border-box"},children:[i.jsx("span",{style:{...E2,...t||{}},children:a}),i.jsx("span",{style:{...R2,...l,...n||{}},children:e})]})}function s0e({rows:a,showDividerAfter:e=!0,rowLabelStyle:t,rowValueStyle:n,isNarrow:o=!1}){const l=(a??[]).filter(s=>s&&(s.label||s.value));return l.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"anima-vista-datos-detalle__section",style:{display:"flex",flexDirection:"column",gap:10,width:"100%"},children:l.map((s,c)=>i.jsx(l0e,{label:s.label,value:s.value,labelStyle:s.labelStyle??t,valueStyle:s.valueStyle??n,isNarrow:o},s.id??`${s.label}-${c}`))}),e?i.jsx(j2,{}):null]})}const L2=({empresaNombre:a=Fn.empresaNombre,empresaIconName:e=Fn.empresaIconName,avatarSrc:t=Fn.avatarSrc,avatarAlt:n=Fn.avatarAlt,avatarName:o,avatarNode:l,metadataSections:s=Fn.metadataSections,stats:c=Fn.stats,empresaNombreStyle:d,empresaIconBoxStyle:h,rowLabelStyle:u,rowValueStyle:f,statValueStyle:m,statLabelStyle:p,className:w="",style:g,headerStyle:b,statsStyle:v,isNarrow:x=!1,...y})=>{const R=Array.isArray(s)?s:[],S=Array.isArray(c)?c.filter(A=>A!=null):[],_=R.filter(A=>(A?.rows??[]).some(M=>M&&(M.label||M.value))),C=()=>{if(l!=null)return l;if(t)return i.jsx("img",{src:t,alt:n||a||"Avatar",style:{width:zo,height:zo,borderRadius:"50%",objectFit:"cover",flexShrink:0}});if(o){const A=String(o).trim().split(/\s+/),M=A.length>1?`${A[0][0]??""}${A[A.length-1][0]??""}`.toUpperCase():(A[0]?.[0]??"?").toUpperCase();return i.jsx("div",{"aria-hidden":!0,style:{width:zo,height:zo,borderRadius:"50%",background:"#D3DFE1",color:"#29474C",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:z0.fontFamily,fontWeight:600,fontSize:"14px",flexShrink:0},children:M})}return null};return i.jsxs("div",{className:["anima-vista-datos-detalle",w].filter(Boolean).join(" "),style:{width:"100%",maxWidth:"100%",height:"100%",minHeight:0,flex:1,boxSizing:"border-box",display:"flex",flexDirection:"column",...g||{}},...y,children:[i.jsxs("div",{className:"anima-vista-datos-detalle__main",style:i0e,children:[i.jsxs("div",{className:"anima-vista-datos-detalle__header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",paddingBottom:8,boxSizing:"border-box",...b||{}},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0,flex:1},children:[i.jsx("div",{style:{...y2,...h||{}},children:i.jsx(P,{name:e,variant:"24-outline",size:24,style:{color:"#29474C",flexShrink:0},"aria-hidden":!0})}),a?i.jsx("h4",{className:"anima-vista-datos-detalle__empresa-nombre",style:{...z0,minWidth:0,wordBreak:"break-word",...d||{}},children:a}):null]}),C()]}),i.jsx(j2,{}),_.map((A,M)=>i.jsx(s0e,{rows:A.rows,showDividerAfter:M<_.length-1,rowLabelStyle:u,rowValueStyle:f,isNarrow:x},A.id??`section-${M}`))]}),S.length>0?i.jsxs("div",{className:"anima-vista-datos-detalle__stats-wrap",style:{...M2,...v||{}},children:[i.jsx("hr",{className:"anima-vista-datos-detalle__stats-divider",style:_2}),i.jsx("div",{className:"anima-vista-datos-detalle__stats",style:{...Xr,width:x?"100%":Xr.width,justifyContent:x?"space-between":Xr.justifyContent,gap:x?16:Xr.gap},children:S.map((A,M)=>i.jsxs("div",{className:"anima-vista-datos-detalle__stat",style:{display:"flex",flexDirection:"column",alignItems:"center",minWidth:0,textAlign:"center"},children:[i.jsx("p",{style:{...C2,...m||{},...A.valueStyle||{}},children:A.value}),i.jsx("p",{style:{...S2,...p||{},...A.labelStyle||{}},children:A.label})]},A.id??`stat-${A.label}-${M}`))})]}):null]})},F2={flexShrink:0,fill:"#D3FFDF",stroke:"var(--color-status-success, #0A742C)"},I2={flexShrink:0,fill:"var(--misc-error-fondo, #F8DBDB)",stroke:"var(--color-status-error, #B30808)"},Z1={borderBottom:"1px solid #E5E7EB"},c0e={fontFamily:I,fontWeight:600,fontSize:"14px",lineHeight:"21px",letterSpacing:"0.01em",color:"#29474C",margin:0},d0e={fontFamily:I,fontWeight:400,fontStyle:"italic",fontSize:"12px",lineHeight:"18px",color:"#6B7280",margin:"4px 0 0 0"},h0e={fontFamily:I,fontWeight:600,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.01em",color:"#29474C",margin:"8px 0 0 0"},k2={fontFamily:qe,fontWeight:500,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.01em",textTransform:"uppercase",color:"#0A742C",margin:"8px 0 0 0"},u0e={...k2,color:"#B30808"},f0e={flexShrink:0,width:"100%",boxSizing:"border-box",paddingTop:12},P1={width:"100%",maxWidth:445,minHeight:48,borderRadius:8,border:"1px solid #C4C4C4",backgroundColor:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 12px",boxSizing:"border-box"},m0e={flex:"1 1 auto",display:"flex",alignItems:"center",justifyContent:"center",gap:4,flexWrap:"wrap",minWidth:0},U0={fontFamily:I,fontWeight:500,fontSize:"14px",lineHeight:"21px",color:"#29474C",minWidth:28,height:32,padding:"0 4px",border:"none",background:"transparent",cursor:"pointer",boxSizing:"border-box"},p0e={...U0,color:"#38656D",fontWeight:600,borderBottom:"2px solid #38656D"},O2=({status:a="success",title:e,archivoOrigen:t,archivoOrigenPrefix:n="Archivo origen:",personaLine:o,statusLabel:l,showBorder:s=!0,isFirst:c=!1,className:d="",style:h,onClick:u,...f})=>{const m=a==="error",p=m?"XCircleIcon":"CheckCircleIcon",w=m?I2:F2,g=i.jsxs(i.Fragment,{children:[i.jsx(P,{name:p,variant:"24-outline",size:24,style:{...w,marginTop:2},"aria-hidden":!0}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[e?i.jsx("p",{className:"anima-vista-datos-documento__title",style:c0e,children:e}):null,t?i.jsxs("p",{className:"anima-vista-datos-documento__origen",style:d0e,children:[n," ",t]}):null,o?i.jsx("p",{className:"anima-vista-datos-documento__persona",style:h0e,children:o}):null,l?i.jsx("p",{className:"anima-vista-datos-documento__status",style:m?u0e:k2,children:l}):null]})]}),b={display:"flex",alignItems:"flex-start",gap:12,width:"100%",padding:c?"8px 0 14px 0":"12px 0 12px 0",boxSizing:"border-box",...s?Z1:{},...h||{}};return typeof u=="function"?i.jsx("button",{type:"button",className:["anima-vista-datos-documento-item",d].filter(Boolean).join(" "),style:{...b,border:"none",borderBottom:s?Z1.borderBottom:void 0,background:"transparent",cursor:"pointer",textAlign:"left"},onClick:u,...f,children:g}):i.jsx("div",{className:["anima-vista-datos-documento-item",d].filter(Boolean).join(" "),style:b,...f,children:g})},Uo=32;function g0e(a,e){return e<=5?Array.from({length:e},(t,n)=>n+1):a<=3?[1,2,3,4,"ellipsis",e]:a>=e-2?[1,"ellipsis",e-3,e-2,e-1,e]:[1,"ellipsis",a-1,a,a+1,"ellipsis",e]}const T2=({currentPage:a=1,totalPages:e=1,onPageChange:t,className:n="",wrapStyle:o,boxStyle:l,isNarrow:s=!1,...c})=>{if(e<=1)return null;const d=Math.min(Math.max(1,a),e),h=d>1,u=d<e,f=g0e(d,e),m=p=>{p<1||p>e||p===d||t?.(p)};return i.jsx("nav",{className:["anima-vista-datos-documentos-paginacion",n].filter(Boolean).join(" "),"aria-label":"Paginación de documentos",style:{...f0e,...o||{}},...c,children:i.jsxs("div",{style:{...P1,maxWidth:s?"100%":P1.maxWidth,...l||{}},children:[i.jsx("button",{type:"button","aria-label":"Página anterior",disabled:!h,onClick:()=>m(d-1),style:{width:Uo,height:Uo,borderRadius:8,border:"1px solid #C4C4C4",background:"#FFFFFF",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:h?"pointer":"default",opacity:h?1:.5,flexShrink:0,padding:0},children:i.jsx(P,{name:"ChevronDoubleLeftIcon",size:16,style:{color:h?"#38656D":"#84A0A5"}})}),i.jsx("div",{className:"anima-vista-datos-documentos-paginacion__pages",style:m0e,children:f.map((p,w)=>{if(p==="ellipsis")return i.jsx("span",{"aria-hidden":!0,style:{...U0,cursor:"default",minWidth:20},children:"…"},`ellipsis-${w}`);const g=p===d;return i.jsx("button",{type:"button","aria-label":`Página ${p}`,"aria-current":g?"page":void 0,onClick:()=>m(p),style:g?p0e:U0,children:p},p)})}),i.jsx("button",{type:"button","aria-label":"Página siguiente",disabled:!u,onClick:()=>m(d+1),style:{width:Uo,height:Uo,borderRadius:8,border:"none",background:u?"#3F6F75":"#D3DDE0",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:u?"pointer":"default",flexShrink:0,padding:0},children:i.jsx(P,{name:"ChevronDoubleRightIcon",size:16,style:{color:"#FFFFFF"}})})]})})},D2=[{id:"doc-1",status:"success",title:"Política interna 05-2020.pdf",archivoOrigen:"polit.inter_l20457.pdf",personaLine:"María García Alonso - LEG-000123",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-2",status:"success",title:"Política interna 06-2021.pdf",archivoOrigen:"polit.inter_l20458.pdf",personaLine:"María García Alonso - LEG-000123",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-3",status:"error",title:"Recibo sueldo 03-2024.pdf",archivoOrigen:"recibo_marzo_2024.pdf",personaLine:"Juan Pérez - LEG-000456",statusLabel:"ERROR DE CARGA"},{id:"doc-4",status:"success",title:"Contrato laboral 2023.pdf",archivoOrigen:"contrato_2023_firmado.pdf",personaLine:"Ana López - LEG-000789",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-5",status:"success",title:"Anexo confidencialidad.pdf",archivoOrigen:"anexo_conf_v2.pdf",personaLine:"María García Alonso - LEG-000123",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-6",status:"error",title:"Formulario 931.pdf",archivoOrigen:"form_931_mayo.pdf",personaLine:"Carlos Ruiz - LEG-000321",statusLabel:"FORMATO NO VÁLIDO"},{id:"doc-7",status:"success",title:"Certificado médico.pdf",archivoOrigen:"cert_medico_abril.pdf",personaLine:"Ana López - LEG-000789",statusLabel:"IDENTIFICADOR DETECTADO"},{id:"doc-8",status:"success",title:"Liquidación final.pdf",archivoOrigen:"liq_final_2025.pdf",personaLine:"Juan Pérez - LEG-000456",statusLabel:"IDENTIFICADOR DETECTADO"}],w0e=16;function v0e(a,e){const t=String(e??"").trim().toLowerCase();return t?a.filter(n=>[n.title,n.archivoOrigen,n.personaLine,n.statusLabel].filter(Boolean).join(" ").toLowerCase().includes(t)):a}const $2=({documentos:a=D2,searchQuery:e="",pageSize:t=4,currentPage:n,defaultPage:o=1,onPageChange:l,onDocumentoClick:s,emptyMessage:c="No hay documentos para mostrar.",className:d="",style:h,listStyle:u,paginationProps:f,isNarrow:m=!1,...p})=>{const w=E.useRef(null),[g,b]=E.useState(o),v=n!=null,x=v?n:g,y=E.useMemo(()=>v0e(Array.isArray(a)?a:[],e),[a,e]),R=Math.max(1,Math.ceil(y.length/Math.max(1,t))),S=Math.min(Math.max(1,x),R),_=E.useCallback(A=>{const M=Math.min(Math.max(1,A),R);v||b(M),l?.(M),w.current&&(w.current.scrollTop=0)},[v,l,R]);E.useEffect(()=>{!v&&g!==S&&b(S)},[v,g,S]),E.useEffect(()=>{S>R&&_(R)},[S,R,_]),E.useEffect(()=>{_(1)},[e,_]);const C=E.useMemo(()=>{const A=(S-1)*t;return y.slice(A,A+t)},[y,S,t]);return i.jsxs("div",{className:["anima-vista-datos-documentos-list",d].filter(Boolean).join(" "),style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,flex:1,width:"100%",boxSizing:"border-box",...h||{}},...p,children:[i.jsxs("div",{style:{position:"relative",flex:"1 1 auto",minHeight:0,width:"100%"},children:[i.jsxs("div",{ref:w,className:"anima-vista-datos-documentos-list__scroll",style:{height:"100%",overflowY:"auto",overflowX:"hidden",paddingRight:w0e,boxSizing:"border-box",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",...u||{}},children:[i.jsx("style",{children:`
1685
1685
  .anima-vista-datos-documentos-list__scroll::-webkit-scrollbar {
1686
1686
  display: none;
1687
1687
  width: 0;
@@ -45396,7 +45396,7 @@ const Cee = ({
45396
45396
  },
45397
45397
  children: [
45398
45398
  /* @__PURE__ */ i.jsx(de, { variant: "rectangular", height: 21, width: 90 }),
45399
- /* @__PURE__ */ i.jsx(de, { variant: "rectangular", height: 24, width: 168 })
45399
+ /* @__PURE__ */ i.jsx(de, { variant: "rectangular", height: 24, width: 48, style: { borderRadius: 16 } })
45400
45400
  ]
45401
45401
  }
45402
45402
  ),
@@ -45416,7 +45416,7 @@ const Cee = ({
45416
45416
  },
45417
45417
  children: [
45418
45418
  /* @__PURE__ */ i.jsx(de, { variant: "rectangular", height: 21, width: 130 }),
45419
- /* @__PURE__ */ i.jsx(de, { variant: "rectangular", height: 24, width: 168 })
45419
+ /* @__PURE__ */ i.jsx(de, { variant: "rectangular", height: 24, width: 96, style: { borderRadius: 16 } })
45420
45420
  ]
45421
45421
  }
45422
45422
  )
@@ -45464,9 +45464,13 @@ const Cee = ({
45464
45464
  size: "medium",
45465
45465
  className: `anima-tenantactive__badge anima-tenantactive__badge-id ${u}`,
45466
45466
  style: {
45467
- minWidth: "168px",
45467
+ width: "fit-content",
45468
+ maxWidth: "100%",
45469
+ minWidth: 0,
45468
45470
  flexShrink: 0,
45469
- justifyContent: "flex-end",
45471
+ justifyContent: "center",
45472
+ borderColor: c,
45473
+ backgroundColor: d,
45470
45474
  ...h || {}
45471
45475
  },
45472
45476
  children: o
@@ -45518,9 +45522,13 @@ const Cee = ({
45518
45522
  size: "medium",
45519
45523
  className: `anima-tenantactive__badge anima-tenantactive__badge-estado ${E}`,
45520
45524
  style: {
45521
- minWidth: "168px",
45525
+ width: "fit-content",
45526
+ maxWidth: "100%",
45527
+ minWidth: 0,
45522
45528
  flexShrink: 0,
45523
- justifyContent: "flex-end",
45529
+ justifyContent: "center",
45530
+ borderColor: v,
45531
+ backgroundColor: x,
45524
45532
  ...y || {}
45525
45533
  },
45526
45534
  children: w
@@ -75430,7 +75438,6 @@ const kn = {
75430
75438
  style: {
75431
75439
  width: Ie ? "100%" : 94,
75432
75440
  minWidth: Ie ? "100%" : 94,
75433
- height: 48,
75434
75441
  marginLeft: 0
75435
75442
  }
75436
75443
  }
@@ -75445,7 +75452,6 @@ const kn = {
75445
75452
  style: {
75446
75453
  width: Ie ? "100%" : 163,
75447
75454
  minWidth: Ie ? "100%" : 163,
75448
- height: 48,
75449
75455
  marginLeft: 0,
75450
75456
  ...v?.style || {}
75451
75457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anima-ds-nucleus",
3
- "version": "1.0.134",
3
+ "version": "1.0.135",
4
4
  "description": "Anima Design System - A comprehensive React component library",
5
5
  "author": "Nucleus Labs <ipvasallo@nucleus.com.ar>",
6
6
  "license": "UNLICENSED",
@@ -142,7 +142,7 @@ export const TenantActive = ({
142
142
  }}
143
143
  >
144
144
  <Skeleton variant="rectangular" height={21} width={90} />
145
- <Skeleton variant="rectangular" height={24} width={168} />
145
+ <Skeleton variant="rectangular" height={24} width={48} style={{ borderRadius: 16 }} />
146
146
  </div>
147
147
  {/* Skeleton: sección derecha — texto (label) + badge */}
148
148
  <div
@@ -159,7 +159,7 @@ export const TenantActive = ({
159
159
  }}
160
160
  >
161
161
  <Skeleton variant="rectangular" height={21} width={130} />
162
- <Skeleton variant="rectangular" height={24} width={168} />
162
+ <Skeleton variant="rectangular" height={24} width={96} style={{ borderRadius: 16 }} />
163
163
  </div>
164
164
  </>
165
165
  ) : (
@@ -208,9 +208,13 @@ export const TenantActive = ({
208
208
  size="medium"
209
209
  className={`anima-tenantactive__badge anima-tenantactive__badge-id ${idTenantBadgeClassName}`}
210
210
  style={{
211
- minWidth: '168px',
211
+ width: 'fit-content',
212
+ maxWidth: '100%',
213
+ minWidth: 0,
212
214
  flexShrink: 0,
213
- justifyContent: 'flex-end',
215
+ justifyContent: 'center',
216
+ borderColor: idTenantBadgeBorderColor,
217
+ backgroundColor: idTenantBadgeBackgroundColor,
214
218
  ...(idTenantBadgeStyle || {}),
215
219
  }}
216
220
  >
@@ -263,9 +267,13 @@ export const TenantActive = ({
263
267
  size="medium"
264
268
  className={`anima-tenantactive__badge anima-tenantactive__badge-estado ${estadoTenantBadgeClassName}`}
265
269
  style={{
266
- minWidth: '168px',
270
+ width: 'fit-content',
271
+ maxWidth: '100%',
272
+ minWidth: 0,
267
273
  flexShrink: 0,
268
- justifyContent: 'flex-end',
274
+ justifyContent: 'center',
275
+ borderColor: estadoTenantBadgeBorderColor,
276
+ backgroundColor: estadoTenantBadgeBackgroundColor,
269
277
  ...(estadoTenantBadgeStyle || {}),
270
278
  }}
271
279
  >
@@ -11,7 +11,7 @@ export default {
11
11
  },
12
12
  idTenantValue: {
13
13
  control: 'text',
14
- description: 'Valor del ID Tenant (texto dentro del badge)',
14
+ description: 'Valor del ID Tenant (texto dentro del badge). El badge se adapta al contenido.',
15
15
  },
16
16
  estadoTenantLabel: {
17
17
  control: 'text',
@@ -19,7 +19,7 @@ export default {
19
19
  },
20
20
  estadoTenantValue: {
21
21
  control: 'text',
22
- description: 'Valor del estado (texto dentro del badge)',
22
+ description: 'Valor del estado (texto dentro del badge). El badge se adapta al contenido.',
23
23
  },
24
24
  idTenantBadgeBorderColor: {
25
25
  control: 'color',
@@ -45,6 +45,58 @@ export const Default = {
45
45
  },
46
46
  };
47
47
 
48
+ /** Badge corto: valor "2" — el pill se ajusta al contenido (sin min-width fijo). */
49
+ export const BadgeCorto = {
50
+ args: {
51
+ idTenantLabel: 'ID TENANT',
52
+ idTenantValue: '2',
53
+ estadoTenantLabel: 'ESTADO TENANT',
54
+ estadoTenantValue: 'OK',
55
+ },
56
+ parameters: {
57
+ docs: {
58
+ description: {
59
+ story:
60
+ 'Valores cortos (`2`, `OK`). El badge usa `width: fit-content` y ya no fuerza 168px de ancho mínimo.',
61
+ },
62
+ },
63
+ },
64
+ };
65
+
66
+ /** Comparación visual: ID corto vs ID largo en el mismo layout. */
67
+ export const AdaptableAlContenido = {
68
+ render: () => (
69
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
70
+ <TenantActive
71
+ idTenantLabel="ID TENANT"
72
+ idTenantValue="2"
73
+ estadoTenantLabel="ESTADO TENANT"
74
+ estadoTenantValue="Activo"
75
+ />
76
+ <TenantActive
77
+ idTenantLabel="ID TENANT"
78
+ idTenantValue="ncl_corp_002394_prod"
79
+ estadoTenantLabel="ESTADO TENANT"
80
+ estadoTenantValue="Activo / Operacional"
81
+ />
82
+ <TenantActive
83
+ idTenantLabel="ID TENANT"
84
+ idTenantValue="99"
85
+ estadoTenantLabel="ESTADO TENANT"
86
+ estadoTenantValue="Inactivo / Suspendido por mantenimientos programados"
87
+ />
88
+ </div>
89
+ ),
90
+ parameters: {
91
+ docs: {
92
+ description: {
93
+ story:
94
+ 'Misma tipografía y padding del badge; el ancho crece o se reduce según el texto (2, ID largo, estado largo).',
95
+ },
96
+ },
97
+ },
98
+ };
99
+
48
100
  export const SoloIdTenant = {
49
101
  args: {
50
102
  idTenantLabel: 'ID TENANT',
@@ -54,6 +106,15 @@ export const SoloIdTenant = {
54
106
  },
55
107
  };
56
108
 
109
+ export const SoloIdCorto = {
110
+ args: {
111
+ idTenantLabel: 'ID TENANT',
112
+ idTenantValue: '2',
113
+ estadoTenantLabel: '',
114
+ estadoTenantValue: '',
115
+ },
116
+ };
117
+
57
118
  export const SoloEstadoTenant = {
58
119
  args: {
59
120
  idTenantLabel: '',
@@ -77,7 +138,6 @@ export const Personalizado = {
77
138
  export const Loading = {
78
139
  args: {
79
140
  loading: true,
80
- // Con loading=true solo se muestran skeletons (texto + badge en cada lado). Estos valores no se pintan.
81
141
  idTenantLabel: 'ID TENANT',
82
142
  idTenantValue: 'ncl_corp_002394_prod',
83
143
  estadoTenantLabel: 'ESTADO TENANT',
@@ -86,7 +146,7 @@ export const Loading = {
86
146
  parameters: {
87
147
  docs: {
88
148
  description: {
89
- story: 'Estado de carga: se muestran 4 skeletons (label + badge a la izquierda, label + badge a la derecha).',
149
+ story: 'Estado de carga: skeletons de label + badge a izquierda y derecha.',
90
150
  },
91
151
  },
92
152
  },
@@ -800,7 +800,6 @@ maxHeight: isMobile ? '100%' : 'calc(100vh - 40px)',
800
800
  style={{
801
801
  width: isMobile ? '100%' : 94,
802
802
  minWidth: isMobile ? '100%' : 94,
803
- height: 48,
804
803
  marginLeft: 0,
805
804
  }}
806
805
  />
@@ -812,7 +811,6 @@ maxHeight: isMobile ? '100%' : 'calc(100vh - 40px)',
812
811
  style={{
813
812
  width: isMobile ? '100%' : 163,
814
813
  minWidth: isMobile ? '100%' : 163,
815
- height: 48,
816
814
  marginLeft: 0,
817
815
  ...(downloadButtonProps?.style || {}),
818
816
  }}