@bimdata/viewer 2.15.1 → 2.15.2-beta.1

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.
@@ -5314,7 +5314,7 @@ void main() {
5314
5314
  --bimdata-local-context-width: ${r.width}px;
5315
5315
  --bimdata-local-context-center-width: ${r.centerWidth}px;
5316
5316
  --bimdata-local-context-resolution: ${r.resolution};
5317
- `),onMouseenter:e[0]||(e[0]=(...h)=>r.onMouseEnter&&r.onMouseEnter(...h)),onMouseleave:e[1]||(e[1]=(...h)=>r.onMouseLeave&&r.onMouseLeave(...h))},[R(s,{ref:"modalManagerTemplateRef"},null,512),x("div",GTi,[r.windowPlugins.leftSidePanel?(P(),Y(a,{key:0,plugin:r.windowPlugins.leftSidePanel},null,8,["plugin"])):ye("",!0),x("div",QTi,[(P(!0),F(lt,null,zt(r.windowPlugins.free,h=>(P(),Y(l,{key:h.name,class:Me({"window-container__content__center__viewer":h.isViewer}),plugin:h},null,8,["class","plugin"]))),128)),R(c,{position:"left",plugins:r.windowPlugins.leftButtonColumn},null,8,["plugins"]),R(c,{position:"right",plugins:r.windowPlugins.rightButtonColumn},null,8,["plugins"])]),r.windowPlugins.rightSidePanel?(P(),Y(a,{key:1,plugin:r.windowPlugins.rightSidePanel},null,8,["plugin"])):ye("",!0)]),r.loading?(P(),F("div",KTi,[r.spinner&&r.spinner.component?(P(),Y(Tn(r.spinner.component),uc(Ba({key:0},r.spinner.props)),null,16)):(P(),Y(d,{key:1,size:"20px",border:"3px"}))])):ye("",!0),r.layoutSettingsDisplayed?(P(),F("div",WTi,[R(u)])):ye("",!0)],36)}const ZTi=q(qTi,[["render",JTi],["__scopeId","data-v-485f288e"]]);let XTi=class{constructor(t=!0){const e=USi(zY,null,{resizable:t});e.registerContent("default",ZTi),this.settings=ts({edit:!1,swap:!1,full:!1}),this.areas=e}get resizable(){return this.areas.resizable}set resizable(t){this.areas.resizable=t}apply(t=null){this.areas.layout=t?NSi(t):null}copy(t,e=!0){return jSi(this.areas.layout,t,e)}open({ratio:t,direction:e,insertAfter:i,windowName:r=null,windowState:n=null,localContextId:o=null}={}){const s=r?{options:{windowName:r,windowState:n}}:null;return o===null?this.areas.splitLayout(t,e,i,s):this.areas.split(o,t,e,i,s)}swap(t,e){return this.areas.swap(t,e)}close(t){return this.areas.delete(t)}compare(t,e){if(!t&&!e)return!0;if(!t||!e)return!1;if(typeof t=="string"&&typeof e=="string")return t===e;if(typeof t=="string"||typeof e=="string")return!1;if(t.windowName&&e.windowName){if(t.windowName!==e.windowName)return!1;const i=new Set(t.windowState?.modelIds),r=new Set(e.windowState?.modelIds);return i.size===r.size&&[...i].every(n=>r.has(n))}return t.windowName||e.windowName||t.direction!==e.direction||t.children.length!==e.children.length?!1:t.children.every((i,r)=>this.compare(i,e.children[r]))}};const YTi="2.15.1",$Ti={version:YTi};let eDi=1;class tDi{constructor({plugins:e,api:i,ui:r,locale:n="fr"}){this.instanceId=eDi++,this.pluginManager=new EEi(e),this.windowManager=new PEi,this.windowManager.registerAndAddPluginsToWindows([...this.pluginManager.registeredPlugins.values()]),this.api=new qIi(i),this.globalContext=new BTe(this),this.state=rSi(this),this.shortcutManager=bke(this.state),this.uiSettings=r||{},this.i18n=new MTe(n),this._contextMenu=null,this.layout=new XTi(this.uiSettings.resizable!==!1),this._darkTheme=ke(r?.darkTheme??!1),this.localContext=null,window.$viewer=this}get darkTheme(){return this._darkTheme.value}set darkTheme(e){this._darkTheme.value=e}get version(){return $Ti.version}get locale(){return this.i18n.locale}get contextMenu(){return this._contextMenu||vke}set contextMenu(e){this._contextMenu=e}get registeredWindows(){return[...this.windowManager.registeredWindows.keys()]}get registeredPlugins(){return[...this.pluginManager.registeredPlugins.keys()]}get pluginsCfg(){return this.pluginManager.cfg}registerPlugin(e){this.pluginManager.registerPlugin(e),this.windowManager.registerAndAddPluginsToWindows([e])}}function iDi(t,e={}){e.backgroundColor&&(t.style.setProperty("--bimdata-viewer-background-color",e.backgroundColor),e.backgroundColor==="transparent"&&t.style.setProperty("--areas-separator-color","transparent")),e.colorPrimary&&t.style.setProperty("--color-primary",e.colorPrimary),e.colorPrimaryLighter&&t.style.setProperty("--color-primary-lighter",e.colorPrimaryLighter),e.colorPrimaryLight&&t.style.setProperty("--color-primary-light",e.colorPrimaryLight),e.colorPrimaryDark&&t.style.setProperty("--color-primary-dark",e.colorPrimaryDark),e.colorSecondary&&t.style.setProperty("--color-secondary",e.colorSecondary),e.colorSecondaryLighter&&t.style.setProperty("--color-secondary-lighter",e.colorSecondaryLighter),e.colorSecondaryLight&&t.style.setProperty("--color-secondary-light",e.colorSecondaryLight),e.colorSecondaryDark&&t.style.setProperty("--color-secondary-dark",e.colorSecondaryDark),e.colorSilverLight&&t.style.setProperty("--color-silver-light",e.colorSilverLight),e.colorSilver&&t.style.setProperty("--color-silver",e.colorSilver),e.colorSilverDark&&t.style.setProperty("--color-silver-dark",e.colorSilverDark),e.colorGraniteLight&&t.style.setProperty("--color-granite-light",e.colorGraniteLight),e.colorGranite&&t.style.setProperty("--color-granite",e.colorGranite),e.colorSuccess&&t.style.setProperty("--color-success",e.colorSuccess),e.colorSuccessLighter&&t.style.setProperty("--color-success-Lighter",e.colorSuccessLighter),e.colorSuccessLight&&t.style.setProperty("--color-success-Light",e.colorSuccessLight),e.colorSuccessDark&&t.style.setProperty("--color-success-Dark",e.colorSuccessDark),e.colorWarning&&t.style.setProperty("--color-warning",e.colorWarning),e.colorWarningLighter&&t.style.setProperty("--color-warning-Lighter",e.colorWarningLighter),e.colorWarningLight&&t.style.setProperty("--color-warning-Light",e.colorWarningLight),e.colorWarningDark&&t.style.setProperty("--color-warning-Dark",e.colorWarningDark),e.colorHigh&&t.style.setProperty("--color-high",e.colorHigh),e.colorHighLighter&&t.style.setProperty("--color-high-lighter",e.colorHighLighter),e.colorHighLight&&t.style.setProperty("--color-high-light",e.colorHighLight),e.colorHighDark&&t.style.setProperty("--color-high-dark",e.colorHighDark),e.colorText&&t.style.setProperty("--color-text",e.colorText),(!e.backgroundColor||e.backgroundColor!=="transparent")&&t.style.setProperty("--areas-separator-color","rgba(216, 216, 216, 1)"),e.headerHeight!=null&&t.style.setProperty("--bimdata-viewer-header-height",e.headerHeight),t.style.setProperty("--areas-background-color","transparent")}const rDi=Object.freeze({25:"GUEST",50:"USER",100:"ADMIN"}),W5=Object.freeze({READ:"read",WRITE:"write"});function y7e(t){const e={};return t.forEach(i=>{const[r,n]=i.split(":");e[r]?e[r].push(n):e[r]=[n]}),e}const nDi={token_scopes:[],usable_scopes:[],user_role:25};function b7e(t=nDi){const e=y7e(t.token_scopes),i=y7e(t.usable_scopes);return{...Vre(t),tokenScopes:e,usableScopes:i,userRole:rDi[t.user_role],user:t.user?Vre(t.user):null,hasBcfReadPermission:i.bcf?.includes(W5.READ)??!1,hasBcfWritePermission:i.bcf?.includes(W5.WRITE)??!1,hasModelReadPermission:i.model?.includes(W5.READ)??!1,hasModelWritePermission:i.model?.includes(W5.WRITE)??!1,hasDocReadPermission:i.document?.includes(W5.READ)??!1,hasDocWritePermission:i.document?.includes(W5.WRITE)??!1}}const oDi={back:"Zur\xFCck",BcfFilters:{filtersButton:"Filter",filtersTitle:"Filter",priorityLabel:"Priorit\xE4t",statusLabel:"Status",stageLabel:"Phase",assignedToLabel:"Zugewiesen an",creatorsLabel:"Erstellt von",tagsLabel:"Tags",resetButton:"Zur\xFCcksetzen",searchButton:"Suchen",undefined:"Nicht definiert",datePlaceholder:"Erstellungsdatum"},BcfSettings:{title:"BCF-Parameter",text:"Erstellen, f\xFCllen und listen Sie die BCF-Einstellungen auf, die Sie f\xFCr dieses Projekt haben m\xF6chten.",validateButton:"Die BCF-Parameter anerkennen"},BcfStatistics:{emptyText:"F\xFCgen Sie Fragen hinzu, um zugeh\xF6rige Statistiken hier anzuzeigen.",issues:"Probleme",extension:{Priority:"Priorit\xE4t",PriorityNotDefined:"Keine Priorit\xE4t",PriorityTitle:"Priorit\xE4ten",Status:"Status",StatusNotDefined:"Kein Status",StatusTitle:"Status"}},BcfTopicCard:{priority:"Priorit\xE4t",noPriority:"Keine",assignedTo:"Zugewiesen an",elements:"Elemente",notSpecified:"Nicht definiert",see:"Anzeigen"},BcfTopicCreationCard:{text:"Ein neues BCF-Thema erstellen",createBcfSideTitle:"Ein Problem melden"},BcfTopicForm:{dragDropImageText:"Bitte w\xE4hlen Sie eine Datei aus.",addObjectButton:"Objekt",addAnnotationButton:"Annotation",annotationButtonTooltip:"Zu diesem Thema gibt es derzeit keine Ansichten.",addPictureButton:"F\xFCgen Sie ein Bild hinzu.",titlePlaceholder:"Titel *",titleErrorMessage:"Titel fehlt",typeLabel:"Typ",priorityLabel:"Priorit\xE4t",statusLabel:"Status",stageLabel:"Phase",assignedToLabel:"Zugewiesen an",dueDateLabel:"F\xE4lligkeitsdatum (TT.MM.JJJJ)",descriptionLabel:"Beschreibung",labelsLabel:"Tags",createButton:"Best\xE4tigen",updateButton:"\xC4nderungen \xFCbernehmen",modalText:"Sie sind dabei, die Bearbeitung der Ausgabe {Name} zu beenden, aber es gibt noch ungespeicherte \xC4nderungen.",cancelButton:"\xC4nderungen verwerfen",continueButton:"\xC4nderungen fortsetzen",createTitle:"Ein Problem melden",dragDropImageTextTablet:"Foto machen",takeSnapshot:"Mach einen Schnappschuss",importFile:"Eine Datei importieren",searchPlaceholder:"Suchen",emptySearch:"kein Ergebnis",documentsLabel:"Dokumente",documentsCount:"Dokumente \u2013 {count} ausgew\xE4hlte Dokumente",groupsLabel:"Berechtigungen",groupsCount:"Berechtigungen \u2013 {count} ausgew\xE4hlte Gruppen",groupsText:"W\xE4hlen Sie die Benutzergruppen aus, die dieses Thema sehen und damit interagieren d\xFCrfen.",validate:"Best\xE4tigen"},BcfTopicOverview:{openViewer:"Im Viewer \xF6ffnen",openViewerNoModels:"Es sind keine Vorlagen zur Ansicht bereit",elements:"{count} Elemente",noElements:"kein Element",type:"Typ",noTypeSpecified:"Kein Typ angegeben",description:"Beschreibung",noDescriptionProvided:"Keine Beschreibung angegeben",assignedTo:"Zugeteilt an",notAssigned:"Nicht zugewiesen",dueDate:"F\xE4lligkeitsdatum",noDueDate:"Kein F\xE4lligkeitsdatum",informations:"Informationen",status:"Status",noStatusSpecified:"Kein Status angegeben",stage:"Phase",noStageProvided:"Keine Phase angegeben",priority:"Priorit\xE4t",priorityNotDefined:"Nicht definiert",tags:"Tags",noTags:"Keine Tags",commentButton:"Ein Kommentar ver\xF6ffentlichen",deleteText:"Sie l\xF6schen jetzt {Name}",deleteBcfButton:"Dieses BCF l\xF6schen",keepBcfButton:"Dieses BCF beibehalten",author:"Autor"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE4t",status:"Status",title:"Titel",creator:"Autor",date:"Datum"}},BcfTopicActionsCell:{seeButton:"Anzeigen"},BcfTopicComments:{commentButton:"Ein Kommentar verfassen",commentLabel:"Ein Kommentar verfassen",commentText:"Kommentar",cancelButton:"Abbrechen",publishButton:"Ver\xF6ffentlichen",commentsText:"Kommentare",deleteCommentText:"Diesen Kommentar l\xF6schen?",deleteButton:"L\xF6schen",takeSnapshot:"Mach einen Schnappschuss",edited:"bearbeitet"},BcfTopicPriorityCell:{noPriority:"Keine"},SettingCard:{addButton:"ein Element hinzuf\xFCgen",cancelButton:"Abbrechen",validateButton:"Best\xE4tigen",deleteExtensionText:"Diesen Parameter l\xF6schen",deleteButton:"L\xF6schen",title:{Priority:"Priorit\xE4ten",Label:"Tags",Status:"Status",Type:"Typen",Stage:"Phasen"},input:{Priority:"Eine neue Priorit\xE4t hinzuf\xFCgen",Label:"Ein neues Etikett hinzuf\xFCgen",Status:"Einen neuen Status hinzuf\xFCgen",Type:"Einen neuen Typ hinzuf\xFCgen",Stage:"Eine neue Phase hinzuf\xFCgen"},text:{Priority:"Liste der Priorit\xE4ten",Label:"Liste von Tags",Status:"Liste der Status",Type:"Liste der Typen",Stage:"Liste der Phasen"}}},sDi={BcfComponents:oDi},aDi={back:"Back",BcfFilters:{filtersButton:"Filters",filtersTitle:"Filters",priorityLabel:"Priority",statusLabel:"Status",stageLabel:"Stage",assignedToLabel:"Assigned to",creatorsLabel:"Created by",tagsLabel:"Tags",resetButton:"Reset",searchButton:"Search",undefined:"Not defined",datePlaceholder:"Creation date"},BcfSettings:{title:"BCF Settings",text:"Create, enter in, and list the BCF settings you would like to have for this project",validateButton:"Validate BCF settings"},BcfStatistics:{emptyText:"Add BCF Topics to start to have some stats here.",issues:"issues",extension:{Priority:"Priority",PriorityNotDefined:"No priority",PriorityTitle:"Priorities",Status:"Status",StatusNotDefined:"No status",StatusTitle:"Status"}},BcfTopicCard:{priority:"Priority",noPriority:"None",assignedTo:"Assigned to",elements:"Elements",notSpecified:"Not specified",see:"See"},BcfTopicCreationCard:{text:"Create a new BCF topic",createBcfSideTitle:"Report a problem"},BcfTopicForm:{dragDropImageText:"Please select a file",addObjectButton:"Object",addAnnotationButton:"Annotation",annotationButtonTooltip:"This topic has no viewpoint",addPictureButton:"Add a picture",titlePlaceholder:"Title *",titleErrorMessage:"Missing title",typeLabel:"Type",priorityLabel:"Priority",statusLabel:"Status",stageLabel:"Stage",assignedToLabel:"Assigned to",dueDateLabel:"Due date",descriptionLabel:"Description",labelsLabel:"Tags",createButton:"Validate",updateButton:"Modify this BCF",modalText:"You are about to quit editing issue {name} but there are unsaved changes.",cancelButton:"Discard changes",continueButton:"Continue editing",createTitle:"Report a problem",dragDropImageTextTablet:"Take a picture",takeSnapshot:"Take a snapshot",importFile:"Import a file",searchPlaceholder:"Search",emptySearch:"No result",documentsLabel:"Add a file",documentsCount:"Files - {count} selected files",groupsLabel:"Permissions",groupsCount:"Permissions - {count} selected groups",groupsText:"You are now setting the access rights: choose the user group(s) that will be exclusively authorized to see and interact with this topic.",validate:"Validate"},BcfTopicOverview:{openViewer:"Open in viewer",openViewerNoModels:"No model to open",elements:"{count} Elements",noElements:"No element",type:"Type",noTypeSpecified:"No type specified",description:"Description",noDescriptionProvided:"No description provided",assignedTo:"Assigned to",notAssigned:"Not assigned",dueDate:"Due date",noDueDate:"No due date",informations:"Informations",status:"Status",noStatusSpecified:"No status specified",stage:"Stage",noStageProvided:"No stage provided",priority:"Priority",priorityNotDefined:"Not defined",tags:"Tags",noTags:"No tags",commentButton:"Post a comment",deleteText:"You are about to delete {name}",deleteBcfButton:"Delete this BCF",keepBcfButton:"Keep this BCF",author:"Author"},BcfTopicsTable:{headers:{index:"#",priority:"Priority",status:"Status",title:"Title",creator:"Author",date:"Date"}},BcfTopicActionsCell:{seeButton:"See"},BcfTopicComments:{commentButton:"Post a comment",commentLabel:"Post a comment",commentText:"Comment",cancelButton:"Cancel",publishButton:"Publish",commentsText:"Comments",deleteCommentText:"Delete this comment ?",deleteButton:"Delete",takeSnapshot:"Take a snapshot",edited:"edited"},BcfTopicPriorityCell:{noPriority:"None"},SettingCard:{addButton:"add an element",cancelButton:"Cancel",validateButton:"Validate",deleteExtensionText:"Remove this setting",deleteButton:"Delete",title:{Priority:"Priorities",Label:"Labels",Status:"Status",Type:"Types",Stage:"Stages"},input:{Priority:"Add a new priority",Label:"Add a new label",Status:"Add new status",Type:"Add a new type",Stage:"Add a new stage"},text:{Priority:"Priority list",Label:"Labels list",Status:"Status list",Type:"Type list",Stage:"Stage list"}}},lDi={BcfComponents:aDi},cDi={back:"Volver",BcfFilters:{filtersButton:"Filtros",filtersTitle:"Filtros",priorityLabel:"Prioridad",statusLabel:"Estado",stageLabel:"Fase",assignedToLabel:"Asignado a",creatorsLabel:"Creado por",tagsLabel:"Etiquetas:",resetButton:"Restablecer",searchButton:"Buscar en",undefined:"No definido",datePlaceholder:"Fecha de creaci\xF3n"},BcfSettings:{title:"Par\xE1metros del BCF",text:"Cree, rellene y enumere los par\xE1metros del BCF que desea tener en este proyecto",validateButton:"Validar los par\xE1metros del BCF"},BcfStatistics:{emptyText:"A\xF1ada preguntas para ver las estad\xEDsticas asociadas aqu\xED.",issues:"problemas",extension:{Priority:"Prioridad",PriorityNotDefined:"Sin prioridad",PriorityTitle:"Prioridades",Status:"Estado",StatusNotDefined:"Sin estado",StatusTitle:"Estatutos"}},BcfTopicCard:{priority:"Prioridad",noPriority:"Sin",assignedTo:"Asignado a",elements:"Elementos",notSpecified:"No definido",see:"Ver"},BcfTopicCreationCard:{text:"Crear un nuevo tema BCF",createBcfSideTitle:"Informar de un problema"},BcfTopicForm:{dragDropImageText:"Seleccione un archivo",addObjectButton:"Objeto",addAnnotationButton:"Anotaci\xF3n",annotationButtonTooltip:"Actualmente este tema no posee ning\xFAn punto de vista",addPictureButton:"A\xF1adir una imagen",titlePlaceholder:"T\xEDtulo *",titleErrorMessage:"Falta el t\xEDtulo",typeLabel:"Tipo",priorityLabel:"Prioridad",statusLabel:"Estado",stageLabel:"Fase",assignedToLabel:"Asignado a",dueDateLabel:"Fecha de vencimiento (DD/MM/AAAA)",descriptionLabel:"Descripci\xF3n",labelsLabel:"Etiquetas",createButton:"Validar",updateButton:"Modificar este BCF",modalText:"Est\xE1 a punto de salir de la edici\xF3n del problema de {name} pero hay cambios sin guardar.",cancelButton:"Cancelar los cambios",continueButton:"Continuar con los cambios",createTitle:"Informar de un problema",dragDropImageTextTablet:"Tomar una fotograf\xEDa",takeSnapshot:"Tomar un snapshot",importFile:"Importar un archivo",searchPlaceholder:"Buscar",emptySearch:"No hay resultados"},BcfTopicOverview:{openViewer:"Abrir en el visor",openViewerNoModels:"No hay ning\xFAn modelo listo para la visualizaci\xF3n",elements:"{count} Elementos",noElements:"Ning\xFAn elemento",type:"Tipo",noTypeSpecified:"No se especifica el tipo",description:"Descripci\xF3n",noDescriptionProvided:"No hay descripci\xF3n",assignedTo:"Asignado a",notAssigned:"No asignado",dueDate:"Plazo",noDueDate:"Sin fecha de vencimiento",informations:"Informaci\xF3n",status:"Estado",noStatusSpecified:"No se especifica el estado",stage:"Fase",noStageProvided:"No se indica ninguna fase",priority:"Prioridad",priorityNotDefined:"No definido",tags:"Etiquetas",noTags:"Sin etiquetas",commentButton:"Publicar un comentario",deleteText:"Est\xE1s a punto de borrar {name}",deleteBcfButton:"Borrar este BCF",keepBcfButton:"Mantenga este BCF",author:"Autor"},BcfTopicsTable:{headers:{index:"#",priority:"Prioridad",status:"Estado",title:"T\xEDtulo",creator:"Autor",date:"Fecha"}},BcfTopicActionsCell:{seeButton:"Ver"},BcfTopicComments:{commentButton:"Publicar un comentario",commentLabel:"Publicar un comentario",commentText:"Comentario",cancelButton:"Cancelar",publishButton:"Publicar",commentsText:"comentarios",deleteCommentText:"\xBFBorrar este comentario?",deleteButton:"Borrar",takeSnapshot:"Tomar un snapshot"},BcfTopicPriorityCell:{noPriority:"Sin"},SettingCard:{addButton:"a\xF1adir un elemento",cancelButton:"Cancelar",validateButton:"Validar",deleteExtensionText:"Borrar esta configuraci\xF3n",deleteButton:"Borrar",title:{Priority:"Prioridades",Label:"Etiquetas:",Status:"Estatutos",Type:"Tipos",Stage:"Fases"},input:{Priority:"A\xF1adir una nueva prioridad",Label:"A\xF1adir una nueva etiqueta",Status:"A\xF1adir un nuevo estado",Type:"A\xF1adir un nuevo tipo",Stage:"A\xF1adir una nueva fase"},text:{Priority:"Lista de prioridades",Label:"Lista de etiquetas",Status:"Lista de estatutos",Type:"Lista de tipos",Stage:"Lista de fases"}}},dDi={BcfComponents:cDi},uDi={back:"Retour",BcfFilters:{filtersButton:"Filtres",filtersTitle:"Filtres",priorityLabel:"Priorit\xE9",statusLabel:"Statut",stageLabel:"Phase",assignedToLabel:"Assign\xE9 \xE0",creatorsLabel:"Cr\xE9\xE9 par",tagsLabel:"Tags",resetButton:"R\xE9initialiser",searchButton:"Rechercher",undefined:"Non d\xE9fini",datePlaceholder:"Date de cr\xE9ation"},BcfSettings:{title:"Param\xE8tres BCF",text:"Cr\xE9ez, renseignez et listez les param\xE8tres BCF que vous souhaitez avoir sur ce projet",validateButton:"Valider les param\xE8tres BCF"},BcfStatistics:{emptyText:"Ajoutez des questions pour voir les statistiques associ\xE9es ici.",issues:"probl\xE8mes",extension:{Priority:"Priorit\xE9",PriorityNotDefined:"Aucune priorit\xE9",PriorityTitle:"Priorit\xE9s",Status:"Statut",StatusNotDefined:"Aucun statut",StatusTitle:"Statuts"}},BcfTopicCard:{priority:"Priorit\xE9",noPriority:"Aucune",assignedTo:"Assign\xE9 \xE0",elements:"{n} \xC9lements",notSpecified:"Non d\xE9fini",see:"Voir"},BcfTopicCreationCard:{text:"Cr\xE9er un nouveau topic BCF",createBcfSideTitle:"Signaler un probl\xE8me"},BcfTopicForm:{dragDropImageText:"Veuillez s\xE9lectionner un fichier",addObjectButton:"Objet",addAnnotationButton:"Annotation",annotationButtonTooltip:"Ce topic ne poss\xE8de actuellement aucun point de vue",addPictureButton:"Ajouter une image",titlePlaceholder:"Titre *",titleErrorMessage:"Titre manquant",typeLabel:"Type",priorityLabel:"Priorit\xE9",statusLabel:"Statut",stageLabel:"Phase",assignedToLabel:"Assign\xE9 \xE0",dueDateLabel:"Date d'\xE9ch\xE9ance",descriptionLabel:"Description",labelsLabel:"Tags",createButton:"Valider",updateButton:"Modifier ce BCF",modalText:"Vous \xEAtes sur le point de quitter l'\xE9dition de l'issue {name} mais il y'a des modifications non enregistr\xE9es.",cancelButton:"Annuler les modifications",continueButton:"Continuer les modifications",createTitle:"Signaler un probl\xE8me",dragDropImageTextTablet:"Prendre une photo",takeSnapshot:"Prendre un snapshot",importFile:"Importer un fichier",searchPlaceholder:"Rechercher",emptySearch:"Pas de r\xE9sultat",documentsLabel:"Documents",documentsCount:"Documents - {count} documents s\xE9lectionn\xE9s",groupsLabel:"Permissions",groupsCount:"Permissions - {count} groupes s\xE9lectionn\xE9s",groupsText:"S\xE9lectionner les groupes utilisateur qui peuvent voir ce topic et int\xE9ragir avec.",validate:"Valider"},BcfTopicOverview:{openViewer:"Ouvrir dans le viewer",openViewerNoModels:"Il n'y a aucun mod\xE8le pr\xEAt pour une visualisation",elements:"{count} \xC9lements",noElements:"Aucun \xE9l\xE9ment concern\xE9",type:"Type",noTypeSpecified:"Pas de type sp\xE9cifi\xE9",description:"Description",noDescriptionProvided:"Pas de description renseign\xE9e",assignedTo:"Assign\xE9 \xE0",notAssigned:"Non assign\xE9",dueDate:"\xC9ch\xE9ance",noDueDate:"Pas de date d'\xE9ch\xE9ance",informations:"Informations",status:"Statut",noStatusSpecified:"Pas de statut sp\xE9cifi\xE9",stage:"Phase",noStageProvided:"Pas de phase renseign\xE9e",priority:"Priorit\xE9",priorityNotDefined:"Non d\xE9fini",tags:"Tags",noTags:"Pas de tags",commentButton:"Poster un commentaire",deleteText:"Vous \xEAtes sur le point de supprimer {name}",deleteBcfButton:"Supprimer ce BCF",keepBcfButton:"Conserver ce BCF",author:"Auteur"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE9",status:"Statut",title:"Titre",creator:"Auteur",date:"Date"}},BcfTopicActionsCell:{seeButton:"Voir"},BcfTopicComments:{commentButton:"Poster un commentaire",commentLabel:"Poster un commentaire",commentText:"Commentaire",cancelButton:"Annuler",publishButton:"Publier",commentsText:"commentaires",deleteCommentText:"Supprimer ce commentaire ?",deleteButton:"Supprimer",takeSnapshot:"Prendre un snapshot",edited:"edit\xE9"},BcfTopicPriorityCell:{noPriority:"Aucune"},SettingCard:{addButton:"ajouter un \xE9l\xE9ment",cancelButton:"Annuler",validateButton:"Valider",deleteExtensionText:"Supprimmer ce param\xE8tre",deleteButton:"Supprimer",title:{Priority:"Priorit\xE9s",Label:"Tags",Status:"Statuts",Type:"Types",Stage:"Phases"},input:{Priority:"Ajouter une nouvelle priorit\xE9",Label:"Ajouter un nouveau label",Status:"Ajouter un nouveau statut",Type:"Ajouter un nouveau type",Stage:"Ajouter une nouvelle phase"},text:{Priority:"Liste des priorit\xE9s",Label:"Liste des tags",Status:"Liste des statuts",Type:"Liste des types",Stage:"Liste des phases"}}},hDi={BcfComponents:uDi},pDi={back:"Indietro",BcfFilters:{filtersButton:"Filtri",filtersTitle:"Filtri",priorityLabel:"Priorit\xE0",statusLabel:"Stato",stageLabel:"Fase",datePlaceholder:"Data di creazione",assignedToLabel:"Assegnato a",creatorsLabel:"Creato da",tagsLabel:"Etichette",resetButton:"Ripristina",searchButton:"Cerca",undefined:"Non definito"},BcfSettings:{title:"Parametri BCF",text:"Creare, notificare e elencare i parametri BCF che si desidera avere su questo progetto",validateButton:"Conferma i parametri BCF"},BcfStatistics:{emptyText:"Aggiungi delle domande per vedere le statistiche associate qui.",issues:"problemi",extension:{Priority:"Priorit\xE0",PriorityNotDefined:"Nessuna priorit\xE0",PriorityTitle:"Priorit\xE0",Status:"Stato",StatusNotDefined:"Nessuno stato",StatusTitle:"Stati"}},BcfTopicCard:{priority:"Priorit\xE0",noPriority:"Nessuno",assignedTo:"Assegnato a",elements:"Elementi",noElements:"0 elementi",notSpecified:"Non definito",see:"Visualizza"},BcfTopicCreationCard:{text:"Crea un nuovo topic BCF",createBcfSideTitle:"Segnala un problema"},BcfTopicForm:{dragDropImageText:"Selezionare un file",addObjectButton:"Oggetto",addAnnotationButton:"Annotazione",annotationButtonTooltip:"Attualmente questo argomento non presenta alcun punto di vista",addPictureButton:"Aggiungere un'immagine",titlePlaceholder:"Titolo *",titleErrorMessage:"Titolo mancante",typeLabel:"Tipo",priorityLabel:"Priorit\xE0",statusLabel:"Stato",stageLabel:"Fase",assignedToLabel:"Assegnato a",dueDateLabel:"Data di scadenza",descriptionLabel:"Descrizione",labelsLabel:"Tag",createButton:"Conferma",updateButton:"Modificare questo BCF",modalText:"State per abbandonare la modifica di {name} ma ci sono modifiche non salvate.",cancelButton:"Annullare le modifiche",continueButton:"Continuare le modifiche",createTitle:"Segnala un problema"},BcfTopicOverview:{openViewer:"Apri nel visualizzatore",openViewerNoModels:"Non esistono modelli pronti per la visualizzazione",elements:"{count} Elementi",noElements:"Nessun elemento",type:"Tipo",noTypeSpecified:"Nessun tipo specificato",description:"Descrizione",noDescriptionProvided:"Nessuna descrizione inserita",assignedTo:"Assegnato a",notAssigned:"Non assegnato",dueDate:"Scadenza",noDueDate:"Nessuna data di scadenza",informations:"Informazioni",status:"Stato",noStatusSpecified:"Nessuno stato specificato",stage:"Fase",noStageProvided:"Nessuna fase inserita",priority:"Priorit\xE0",priorityNotDefined:"Non definita",tags:"Etichette",noTags:"Nessuna etichetta",commentButton:"Pubblica un commento",deleteText:"Stai per eliminare {name}",deleteBcfButton:"Elimina questo BCF",keepBcfButton:"Conserva questo BCF",author:"Autore"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE0",status:"Stato",title:"Titolo",creator:"Autore",date:"Data"}},BcfTopicActionsCell:{seeButton:"Visualizza"},BcfTopicComments:{commentButton:"Pubblica un commento",commentLabel:"Pubblica un commento",commentText:"Commento",cancelButton:"Annulla",publishButton:"Pubblica",commentsText:"commenti",deleteCommentText:"Eliminare questo commento?",deleteButton:"Elimina"},BcfTopicPriorityCell:{noPriority:"Nessuno"},SettingCard:{addButton:"aggiungi un elemento",cancelButton:"Annulla",validateButton:"Conferma",deleteExtensionText:"Elimina questo parametro",deleteButton:"Elimina",title:{Priority:"Priorit\xE0",Label:"Etichette",Status:"Stati",Type:"Tipi",Stage:"Fasi"},input:{Priority:"Aggiungi una nuova priorit\xE0",Label:"Aggiungi una nuova etichetta",Status:"Aggiungi un nuovo stato",Type:"Aggiungi un nuovo tipo",Stage:"Aggiungi una nuova fase"},text:{Priority:"Elenco delle priorit\xE0",Label:"Elenco delle etichette",Status:"Elenco degli stati",Type:"Elenco dei tipi",Stage:"Elenco delle fasi"}}},fDi={BcfComponents:pDi},gDi={de:sDi,en:lDi,es:dDi,fr:hDi,it:fDi},ADi=({apiClient:t,fetchUsers:e,i18nPlugin:i}={})=>({install(r){t?Sr.setup({apiClient:t,fetchUsers:e}):console.error("[BCF Components Plugin] No api client provided. You must provide an api client for the components to work properly."),i?Object.entries(gDi).forEach(([n,o])=>{i.global.mergeLocaleMessage(n,o)}):console.warn("[BCF Components Plugin] No i18n instance provided. You should either provide an i18n instance or define your own translations in order have text displayed properly."),Object.entries(vOe).forEach(([n,o])=>{r.component(n,o)})}}),mDi={title:"Building Maker",back:"Zur\xFCck",list:{text:"Erstellen und bearbeiten Sie die Etagen und laden Sie anschlie\xDFend Ihre PDFs herunter.",createButton:"Neues Projekt",updateButton:"Umbenennen",deleteButton:"L\xF6schen"},form:{text:"Erstellen und bearbeiten Sie die Etagen und laden Sie anschlie\xDFend Ihre PDFs herunter.",input:"Name des Geb\xE4udes",error:"Ung\xFCltiger Name",createButton:"Erstellen",updateButton:"Best\xE4tigen"},view:{addStoreyButton:"Etage",addPlanButton:"Grundriss",closeButton:"Fertigstellen",submitFilesButton:"Best\xE4tigen"},storeyForm:{title:"Neue Etage",input:"Name",error:"Ung\xFCltiger Name",cancelButton:"Abbrechen",submitButton:"Best\xE4tigen"}},vDi={creationFormTitle:"Ordner erstellen",renameFormPlaceholder:"Datei- / Ordnernam",nameInputPlaceholder:"Ordnername",emptyFolder:"Dieser Ordner ist leer",newFolderSuccess:"Neuer Ordner erstellt",renameFolderSuccess:"Umbenannter Ordner",deleteFolderSuccess:"Ordner gel\xF6scht",newFileSuccess:"Datei hinzugef\xFCgt",renameFileSuccess:"Umbenannte Datei",deleteFileSuccess:"Datei gel\xF6scht",nameInputErrorMessage:"Ung\xFCltiger name",cancel:"Abbrechen",submit:"Best\xE4tigen",buttonText:"Neuer Ordner",addFileButtonText:"Datei laden",rename:"Umbenennen",view:"Sehen",download:"Herunterladen",delete:"L\xF6schen",deleteTitle:"Dateien l\xF6schen",deleteDetail:"Sie sind im Begriff, die folgenden Dateien / Ordner endg\xFCltig zu l\xF6schen"},yDi={BuildingMaker:mDi,FileManager:vDi},bDi={t:{back:"Back",cancel:"Cancel",create:"Create",delete:"Delete",download:"Download",finish:"Finish",rename:"Rename",search:"Search",see:"View",storey:"Storey",validate:"Validate"}},wDi={title:"Building Maker",list:{text:"Create and edit storeys, then download your PDFs.",new:"New project"},form:{input:"Building name",error:"Invalid"},view:{addStorey:"Add Storey",addFile:"Add File",addPlan:"Add Plan"},storeyForm:{title:"New storey",input:"Name",error:"Invalid name"}},CDi={creationFormTitle:"Create folder",renameFormPlaceholder:"Folder/File name",nameInputPlaceholder:"Folder name",emptyFolder:"This folder is empty",newFolderSuccess:"New folder created",renameFolderSuccess:"Folder renamed",deleteFolderSuccess:"Folder deleted",newFileSuccess:"File added",renameFileSuccess:"File renamed",deleteFileSuccess:"File deleted",nameInputErrorMessage:"Invalid name",buttonText:"New folder",addFileButtonText:"Upload a file",deleteTitle:"Deleting Files",deleteDetail:"You are about to permanently delete the following files / folders",dmsRoot:"Root of the project's DMS",pdfPageSelectorTitle:"Select a page"},xDi={title:"Meta-Building Structure",tab:{structure:"Structure",zones:"Zones",equipments:"Equipments"},StoreySelector:{placeholder:"Select a storey"}},kDi={title:"Photosphere Building"},MDi={BIMDataComponents:bDi,BuildingMaker:wDi,FileManager:CDi,MetaBuildingStructure:xDi,PhotosphereBuilding:kDi},EDi={title:"Building Maker",back:"Vuelta",list:{text:"Cree y edite los pisos despu\xE9s cargue los PDF.",createButton:"Nuevo proyecto",updateButton:"Renombrar",deleteButton:"Suprimir"},form:{text:"Cree y edite los pisos despu\xE9s cargue los PDF.",input:"Nombre del edificio",error:"Nombre no v\xE1lido",createButton:"Crear",updateButton:"Validar"},view:{addStoreyButton:"Piso",addPlanButton:"Plano",closeButton:"Terminar",submitFilesButton:"Validar"},storeyForm:{title:"Nuevo piso",input:"Nombre",error:"Nombre no v\xE1lido",cancelButton:"Anular",submitButton:"Validar"}},BDi={creationFormTitle:"Crear un archivo",renameFormPlaceholder:"Nombre de archivo / carpeta",nameInputPlaceholder:"Nombre de la carpeta",emptyFolder:"Esta carpeta est\xE1 vac\xEDa",newFolderSuccess:"Nueva carpeta creada",renameFolderSuccess:"Carpeta renombrada",deleteFolderSuccess:"Carpeta eliminada",newFileSuccess:"Archivo agregado",renameFileSuccess:"Archivo renombrado",deleteFileSuccess:"Archivo eliminado",nameInputErrorMessage:"Nombre inv\xE1lida",cancel:"Cancelar",submit:"Validar",buttonText:"Carpeta nueva",addFileButtonText:"Cargar un archivo",rename:"Renombrar",view:"Ver",download:"Descargar",delete:"Borrar",deleteTitle:"Eliminar archivos",deleteDetail:"Est\xE1 a punto de eliminar permanentemente los siguientes archivos / carpetas"},PDi={BuildingMaker:EDi,FileManager:BDi},IDi={t:{back:"Retour",cancel:"Annuler",create:"Cr\xE9er",delete:"Supprimer",download:"T\xE9l\xE9charger",finish:"Terminer",rename:"Renommer",search:"Rechercher",see:"Voir",storey:"\xC9tage",validate:"Valider"}},SDi={title:"Building Maker",list:{text:"Cr\xE9ez et \xE9ditez les \xE9tages puis t\xE9l\xE9chagez vos PDF.",new:"Nouveau projet"},form:{input:"Nom du b\xE2timent",error:"Nom invalide"},view:{addStorey:"Ajouter un \xC9tage",addFile:"Ajouter un fichier",addPlan:"Ajouter un plan"},storeyForm:{title:"Nouvel \xE9tage",input:"Nom",error:"Nom invalide"}},TDi={creationFormTitle:"Cr\xE9er un dossier",renameFormPlaceholder:"Nom du fichier/dosier",nameInputPlaceholder:"Nom du dossier",emptyFolder:"Ce dossier est vide",newFolderSuccess:"Nouveau dossier cr\xE9\xE9",renameFolderSuccess:"Dossier renomm\xE9",deleteFolderSuccess:"Dossier supprim\xE9",newFileSuccess:"Fichier ajout\xE9",renameFileSuccess:"Fichier renomm\xE9",deleteFileSuccess:"Fichier supprim\xE9",nameInputErrorMessage:"Nom invalide",buttonText:"Nouveau dossier",addFileButtonText:"Charger un fichier",deleteTitle:"Supression de fichiers",deleteDetail:"Vous \xEAtes sur le point de supprimer d\xE9finitivement les fichiers/dossiers suivants",dmsRoot:"Racine de la GED du projet",pdfPageSelectorTitle:"S\xE9lectionner une page"},DDi={title:"Structure M\xE9ta-Building",tab:{structure:"Structure",zones:"Zones",equipments:"\xC9quipements"},StoreySelector:{placeholder:"S\xE9lectionner un \xE9tage"}},RDi={title:"Photosph\xE8re Building"},LDi={BIMDataComponents:IDi,BuildingMaker:SDi,FileManager:TDi,MetaBuildingStructure:DDi,PhotosphereBuilding:RDi},_Di={title:"Building Maker",back:"Reso",list:{text:"Crea e modifica i piani e poi scarica i tuoi PDF.",createButton:"Nuovo progetto",updateButton:"Rinominare",deleteButton:"Eliminare"},form:{text:"Crea e modifica i piani e poi scarica i tuoi PDF.",input:"Nome della costruzione",error:"Nome non corretto",createButton:"Creare",updateButton:"Convalidare"},view:{addStoreyButton:"Piano",addPlanButton:"Mappa",closeButton:"Finire",submitFilesButton:"Convalidare"},storeyForm:{title:"Nuovo piano",input:"Nome",error:"Nome non corretto",cancelButton:"Annullare",submitButton:"Convalidare"}},FDi={creationFormTitle:"Crea una cartella",renameFormPlaceholder:"Nome file/cartella",nameInputPlaceholder:"Nome della cartella",emptyFolder:"Questa cartella \xE8 vuota",newFolderSuccess:"Nuova cartella creata",renameFolderSuccess:"Cartella rinominata",deleteFolderSuccess:"Cartella eliminata",newFileSuccess:"File aggiunto",renameFileSuccess:"File rinominato",deleteFileSuccess:"File cancellato",nameInputErrorMessage:"Nome non valido",cancel:"Annulla",submit:"Invia",buttonText:"Nuova cartella",addFileButtonText:"Carica un file",rename:"Rinominare",view:"Vedere",download:"Scaricare",delete:"Cancellare",deleteTitle:"Eliminazione di file",deleteDetail:"Stai per eliminare definitivamente i seguenti file/cartelle"},ODi={BuildingMaker:_Di,FileManager:FDi},UDi={de:yDi,en:MDi,es:PDi,fr:LDi,it:ODi},NDi=({i18nPlugin:t}={})=>({install(e){t?Object.entries(UDi).forEach(([i,r])=>{t.global.mergeLocaleMessage(i,r)}):console.warn("[BIMData Components Plugin] No i18n instance provided. You should either provide an i18n instance or define your own translations in order have text displayed properly."),Object.entries(F0i).forEach(([i,r])=>{e.component(i,r)})}}),jDi={beforeMount(t,e){if(typeof e.value!="function")throw Error(`click away directive needs function, got ${typeof e.value}`);t.clickAwayHandler=i=>{(i.path||i.composedPath&&i.composedPath()).find(r=>r===t)||e.value()},window.addEventListener("mousedown",t.clickAwayHandler,!0)},unmounted(t){window.removeEventListener("mousedown",t.clickAwayHandler,!0),delete t.clickAwayHandler}},HDi=Object.freeze(Object.defineProperty({__proto__:null,BIMDataClickAway:iu,BIMDataClickInputAway:jDi},Symbol.toStringTag,{value:"Module"})),VDi=t=>({install(e){Object.entries(d0t).forEach(([i,r])=>{e.component(i,r)}),Object.entries(HDi).forEach(([i,r])=>e.directive(i.split("BIMData")[1],r))}}),zDi={name:"LiWrapper",render(){return so("li",this.$slots.default())}};function qDi(t,e){var i=new Set([]);return t.forEach(r=>{e.has(r)||i.add(r)}),i}const Du=Zs("id"),GDi=({contextMenu:t,objects:e=[],state:i=t.$viewer.state,pictos:r})=>[{name:"selectAll",get group(){return t.groupPositions.select},position:1,get label(){return t.$t("context_menu.select_all")},get picto(){return r.get(this.name)},execute:()=>i.selectObjects(e.filter(zd(br("visible"),S0("selected"))).map(Du)),predicate:()=>e.some(zd(br("visible"),S0("selected")))},{name:"deselectAll",get group(){return t.groupPositions.select},position:2,get label(){return t.$t("context_menu.deselect_all")},get picto(){return r.get(this.name)},execute:()=>i.deselectObjects(e.filter(br("selected")).map(Du)),predicate:()=>e.some(br("selected"))},{name:"selectSimilar",get group(){return t.groupPositions.select},position:3,get label(){return t.$t("context_menu.select_similar")},get picto(){return r.get(this.name)},execute(){const n=e.filter(o=>o.visible&&o.type===this.selectedObject.type&&o.id!==this.selectedObject.id).map(Du);i.selectObjects(n)},selectedObject:null,predicate(){const n=e.filter(zd(br("visible"),br("selected")));return n.length===1&&n[0].type!==void 0?(this.selectedObject=n[0],!0):(this.selectedObject=null,!1)}},{name:"reverseSelection",get label(){return t.$t("context_menu.reverse_selection")},get group(){return t.groupPositions.select},position:4,execute:()=>{const n=new Set(e.filter(br("selected")).map(Du)),o=new Set(e.filter(br("visible")).map(Du));i.selectObjects(Array.from(qDi(o,n)),{exclusive:!0})},predicate:()=>e.some(zd(S0("selected"),br("visible")))&&e.some(zd(br("selected"),br("visible")))},{name:"showAll",get group(){return t.groupPositions.visibility},position:1,get label(){return t.$t("context_menu.show_all")},get picto(){return r.get(this.name)},execute:()=>i.showObjects(e.filter(S0("visible")).map(Du)),predicate:()=>e.some(S0("visible"))},{name:"hide",get group(){return t.groupPositions.visibility},position:2,get label(){return t.$t("context_menu.hide")},get picto(){return r.get(this.name)},objectsToHide:null,execute(){const n=this.objectsToHide.filter(br("selected"));n.length>0&&i.deselectObjects(n.map(Du)),i.hideObjects(this.objectsToHide.map(Du))},predicate(){return this.objectsToHide=e.filter(zd(br("selected"),br("visible"))),this.objectsToHide.length>0}},{name:"hideAll",get group(){return t.groupPositions.visibility},position:3,get label(){return t.$t("context_menu.hide_all")},execute:()=>{const n=e.filter(br("visible"));n.some(br("selected"))&&i.deselectObjects(n.filter(br("selected")).map(Du)),i.hideObjects(n.map(Du))},predicate:()=>e.some(br("visible"))}].filter(n=>n.predicate()),QDi={components:{LiWrapper:zDi},inject:["$viewer"],data(){return{defaultPrevented:!1,displayed:!1,top:null,bottom:null,left:null,width:200,nextCommandId:1,currentCommands:[],contextCommands:[],registeredCommands:[],groupPositions:{select:10,visibility:20},asyncPredicateRunning:!1}},computed:{position(){return{top:this.top?this.top+"px":"unset",bottom:this.bottom?this.bottom+"px":"unset",left:this.left+"px",width:this.width+"px"}}},watch:{displayed(t){t?document.addEventListener("keydown",this.onKeyDown):document.removeEventListener("keydown",this.onKeyDown)}},created(){this.$viewer.contextMenu=this,this.asyncPredicates=new Set},methods:{onKeyDown(t){t.key==="Escape"&&this.away()},setPosition(t){const e=(document.fullscreenElement?document.fullscreenElement:this.$parent.$el).getBoundingClientRect();this.left=t.clientX-e.left,this.top=t.clientY-e.top,this.left+this.width>e.width&&(this.left=this.left-this.width),t.clientY>e.top+e.height/2?(this.bottom=e.height-this.top,this.top=null):this.bottom=null},typeCheckCommand(t={}){let e=null;if((!t.execute||typeof t.execute!="function")&!t.component&&(e="Cannot register context menu command. A command must have an execute function or a component property."),t.label||(e="Cannot register context menu command. A command must have a label."),e)throw console.error(e),new Error(e);return t.id=this.nextCommandId++,t},open(t){this.currentCommands=[],this.setPosition(t),this.originEvent=t,t.preventDefault(),this.setCurrentCommands(),this.groupCurrentCommands(),this.defaultPrevented=!1,this.displayed=!0,document.fullscreenElement?(this.$el.parentElement.removeChild(this.$el),this.adoptiveParent=document.fullscreenElement,this.adoptiveParent.appendChild(this.$el)):this.adoptiveParent&&this.adoptiveParent!==this.$viewer.globalContext.el&&(this.adoptiveParent.removeChild(this.$el),this.$viewer.globalContext.el.appendChild(this.$el),this.adoptiveParent=null)},setCurrentCommands(){this.asyncPredicates.clear(),this.asyncPredicateRunning=!1,this.defaultPrevented||this.registeredCommands.forEach(async t=>{if(typeof t.predicate=="function"){const e=t.predicate(this.$viewer.globalContext.activeLocalContext);if(e===!0)this.currentCommands.push(t);else if(typeof e?.then=="function"){this.asyncPredicates.add(e),this.asyncPredicateRunning=!0;const i=await e;this.asyncPredicates.has(e)&&(this.asyncPredicates.delete(e),this.asyncPredicateRunning=this.asyncPredicates.size>0,i===!0&&this.currentCommands.push(t))}}else this.currentCommands.push(t)}),this.currentCommands.push(...this.contextCommands),this.contextCommands=[]},getDefaultCommands({objects:t=[],state:e=this.$viewer.state,context:i=null}){const r=new Map;return i&&this.$viewer.shortcutManager.getShortcuts(i).forEach(n=>r.set(n.name,n.key)),GDi({contextMenu:this,objects:t,state:e,pictos:r})},executeCommand(t){if(t.execute&&(t.execute(this.originEvent),this.displayed=!1),t.component&&!t.menu)throw new Error("Command with component property must have a `menu` property")},away(){this.displayed=!1},groupCurrentCommands(){const t=new Map;this.currentCommands.forEach(i=>{(i.group===null||i.group===void 0)&&(i.group=0),t.has(i.group)?t.get(i.group).push(i):t.set(i.group,[i])}),t.forEach(i=>i.sort((r,n)=>(r.position=r.position||0,n.position=n.position||0,r.position-n.position)));const e=[...t.keys()].sort((i,r)=>i-r).map(i=>t.get(i)).flat();this.currentCommands=e},isGroupIntersection(t){if(t===0)return!1;const e=this.currentCommands[t-1],i=this.currentCommands[t];return e.group<i.group},registerContextCommand(t){const e=this.typeCheckCommand(t);return this.contextCommands.push(e),t.id},registerCommand(t){const e=this.typeCheckCommand(t);return this.registeredCommands.push(e),t.id},unregisterCommand(t){return this.registeredCommands.find(e=>e.id===t)?(this.registeredCommands=this.registeredCommands.filter(e=>e.id!==t),!0):!1},preventDefault(){this.defaultPrevented=!0}}},KDi={key:0,class:"separator"},WDi={class:"menu-text"},JDi={key:1,class:"menu-picto"},ZDi={key:0,class:"context-menu__spinner"};function XDi(t,e,i,r,n,o){const s=D("BIMDataIconChevron"),a=D("LiWrapper"),l=D("BIMDataSpinner"),c=Ki("click-away");return n.displayed&&(n.currentCommands.length||n.asyncPredicateRunning)?Ft((P(),F("ul",{key:0,class:"bimdata-list context-menu",style:Ee(o.position)},[(P(!0),F(lt,null,zt(n.currentCommands,(d,u)=>(P(),Y(a,{key:d.label,class:"context-menu__element",onClick:h=>o.executeCommand(d)},{default:H(()=>[o.isGroupIntersection(u)?(P(),F("div",KDi)):ye("",!0),x("div",WDi,Z(d.label),1),!d.component&&d.picto?(P(),F("span",JDi,Z(d.picto),1)):d.component?(P(),Y(s,{key:2,size:"xxs",class:"fill-primary"})):ye("",!0)]),_:2},1032,["onClick"]))),128)),n.asyncPredicateRunning?(P(),F("li",ZDi,[R(l)])):ye("",!0)],4)),[[c,o.away]]):ye("",!0)}const YDi=q(QDi,[["render",XDi],["__scopeId","data-v-5b87d4a3"]]),$Di={name:"ViewerHeader",inject:["$viewer"],props:{visible:{type:Boolean,default:!0}},setup(){const t=kt("$viewer"),e=ts(new Map),i=n=>{if(!n.name)throw new TypeError("[Viewer Header] Content must have a name");if(e.has(n.name))throw new Error(`[Viewer Header] Content with name ${n.name} already exists`);e.set(n.name,n)},r=n=>e.has(n)?(e.delete(n),!0):!1;return{logo:t.uiSettings.bimdataLogo!==!1,version:t.uiSettings.version!==!1?t.version:null,headerContent:e,headerRightContentComponents:qe(()=>Array.from(e.values()).filter(n=>n.position==="right").sort((n,o)=>n.order-o.order).map(n=>n.component)),headerLeftContentComponents:qe(()=>Array.from(e.values()).filter(n=>n.position==="left").sort((n,o)=>n.order-o.order).map(n=>n.component)),addContent:i,removeContent:r}}},eRi={class:"viewer-header"},tRi={class:"viewer-header__content"},iRi={class:"viewer-header__content__left"},rRi={class:"viewer-header__content__right"},nRi={key:0,class:"m-l-6 flex items-center"},oRi={key:1,class:"viewer-header__version"};function sRi(t,e,i,r,n,o){const s=D("BIMDataIllustration");return Ft((P(),F("div",eRi,[x("div",tRi,[x("div",iRi,[(P(!0),F(lt,null,zt(r.headerLeftContentComponents,a=>(P(),Y(Tn(a),{key:a.name}))),128))]),x("div",rRi,[(P(!0),F(lt,null,zt(r.headerRightContentComponents,a=>(P(),Y(Tn(a),{key:a.name}))),128))])]),r.logo||r.version?(P(),F("div",nRi,[r.logo?(P(),Y(s,{key:0,name:"logo",width:"30px",height:"30px"})):ye("",!0),r.version?(P(),F("div",oRi,Z(r.version),1)):ye("",!0)])):ye("",!0)],512)),[[hi,i.visible]])}const aRi=q($Di,[["render",sRi],["__scopeId","data-v-5c9ea6b6"]]),lRi={emits:["resize"],setup(t,{emit:e}){return{onResizerMousedown:i=>{i.preventDefault();let r=i.clientX;const n=s=>{s.preventDefault();const a=s.clientX-r;r=s.clientX,e("resize",a)},o=s=>{s.preventDefault(),window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",n),window.addEventListener("mouseup",o)}}}},cRi={class:"bimdata-separator"};function dRi(t,e,i,r,n,o){return P(),F("div",cRi,[e[1]||(e[1]=x("div",{class:"bimdata-separator__line"},null,-1)),x("div",{class:"bimdata-separator__resizer",onMousedown:e[0]||(e[0]=(...s)=>r.onResizerMousedown&&r.onResizerMousedown(...s))},null,32)])}const uRi=q(lRi,[["render",dRi],["__scopeId","data-v-79a3b3af"]]),hRi={components:{Separator:uRi},props:{position:{type:String,required:!0,validator(t){return["left","right"].includes(t)}},sidePanel:{type:Object,required:!0,validator(t){if(t.width&&(typeof t.width!="number"||t.width<0))return console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof t.width}`),!1;const e=typeof t?.component=="object";return e||console.error("[GlobalSidePanel] sidePanel must have a component property"),e}}},setup(t){const e=ke(null),i=ke(t.sidePanel.width??400),r=(n,o=1)=>{const s=i.value+n*o;i.value=Math.max(0,s)};return Et(()=>t.sidePanel,()=>{Object.defineProperty(t.sidePanel,"width",{get(){return i.value},set(n){if(typeof n!="number"||n<=0){console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof n}`);return}i.value=n}}),Object.defineProperty(t.sidePanel,"componentInstance",{get(){return e.value},enumerable:!0})},{immediate:!0}),{componentInstance:e,width:i,onResize:r}}},pRi={class:"bimdata-global-side-panel__component"};function fRi(t,e,i,r,n,o){const s=D("Separator");return P(),F("div",{class:"bimdata-global-side-panel",style:Ee(`width: ${r.width}px`)},[i.sidePanel.resizable&&i.position==="right"?(P(),Y(s,{key:0,onResize:e[0]||(e[0]=a=>r.onResize(a,-1))})):ye("",!0),x("div",pRi,[(P(),Y(Tn(i.sidePanel.component),{ref:"componentInstance"},null,512))]),i.sidePanel.resizable&&i.position==="left"?(P(),Y(s,{key:1,onResize:e[1]||(e[1]=a=>r.onResize(a))})):ye("",!0)],4)}const gRi=q(hRi,[["render",fRi],["__scopeId","data-v-82d0d4cb"]]),ARi={name:"BimdataViewer",components:{ContextMenu:YDi,ViewerHeader:aRi,ModalManager:A7e,GlobalSidePanel:gRi},setup(){const t=kt("$viewer"),{globalContext:e,shortcutManager:i}=t;hr(()=>{i&&i.destroy(),e.hub.clear()}),Qi(()=>{t.pluginManager.runPluginsScripts(t)});const r=qe(()=>t.uiSettings.bimdataLogo!==!1&&(e.localContexts.length!==1||e.localContexts[0].window?.logoAndVersion)),n=qe(()=>t.uiSettings.version!==!1&&(e.localContexts.length!==1||e.localContexts[0].window?.logoAndVersion)?t.version:null),o=qe(()=>e.leftSidePanel),s=qe(()=>e.rightSidePanel),a=qe(()=>{const p=t.uiSettings.header!==!1,g=e.localContexts.length===1&&e.localContexts[0].window?.header===!1,f=!!(o.value||s.value);return p&&(!g||f)}),l=t.uiSettings.contextMenu!==!1,c=ke(null);function d(p){l&&c.value.open(p)}function u(){t.shortcutManager.active=!0}function h(){t.shortcutManager.active=!1}return{Layout:t.layout.areas.component,onContextMenu:d,onMouseenter:u,onMouseleave:h,isHeaderVisible:a,viewerTemplateRef:e.templateRef,modalManagerTemplateRef:e.modalManagerTemplateRef,headerTemplateRef:e.headerTemplateRef,contextMenuTemplateRef:c,contextMenuEnabled:l,bimdataLogoOnSingleWindow:r,viewerVersionOnSingleWindow:n,version:t.version,loading:qe(()=>e.loading),spinner:qe(()=>e.spinner),leftSidePanel:o,rightSidePanel:s}}},mRi={key:1,class:"bimdata-context-loading-overlay",style:{"z-index":"3"}},vRi={key:2,class:"viewer__logo"},yRi={key:1,class:"version m-t-6"};function bRi(t,e,i,r,n,o){const s=D("ModalManager"),a=D("ContextMenu"),l=D("ViewerHeader"),c=D("GlobalSidePanel"),d=D("BIMDataSpinner"),u=D("BIMDataIllustration");return P(),F("div",{id:"bimdata-viewer",ref:"viewerTemplateRef",class:"bimdata-viewer bimdata-design-system bimdata-scrollbar",onContextmenu:e[0]||(e[0]=(...h)=>r.onContextMenu&&r.onContextMenu(...h)),onMouseenter:e[1]||(e[1]=(...h)=>r.onMouseenter&&r.onMouseenter(...h)),onMouseleave:e[2]||(e[2]=(...h)=>r.onMouseleave&&r.onMouseleave(...h))},[R(s,{ref:"modalManagerTemplateRef"},null,512),r.contextMenuEnabled?(P(),Y(a,{key:0,ref:"contextMenuTemplateRef"},null,512)):ye("",!0),R(l,{ref:"headerTemplateRef",visible:r.isHeaderVisible},null,8,["visible"]),x("div",{class:"bimdata-viewer__content",style:Ee(r.isHeaderVisible?"height: calc(100% - var(--bimdata-viewer-header-height, 40px))":"height: 100%")},[r.leftSidePanel?(P(),Y(c,{key:0,"side-panel":r.leftSidePanel,position:"left"},null,8,["side-panel"])):ye("",!0),(P(),Y(Tn(r.Layout),{style:"height: 100%; flex-grow: 1;"})),r.rightSidePanel?(P(),Y(c,{key:1,"side-panel":r.rightSidePanel,position:"right"},null,8,["side-panel"])):ye("",!0)],4),r.loading?(P(),F("div",mRi,[r.spinner&&r.spinner.component?(P(),Y(Tn(r.spinner.component),uc(Ba({key:0},r.spinner.props)),null,16)):(P(),Y(d,{key:1,size:"40px",border:"5px"}))])):ye("",!0),!r.isHeaderVisible&&(r.bimdataLogoOnSingleWindow||r.viewerVersionOnSingleWindow)?(P(),F("div",vRi,[r.bimdataLogoOnSingleWindow?(P(),Y(u,{key:0,name:"logo"})):ye("",!0),r.viewerVersionOnSingleWindow?(P(),F("div",yRi,Z(r.version),1)):ye("",!0)])):ye("",!0)],544)}const wRi=q(ARi,[["render",bRi],["__scopeId","data-v-0c1c941a"]]),CRi=["src"],xRi={class:"bimdata-models__header"},kRi={key:0,class:"bimdata-models__header__loader"},MRi={class:"bimdata-models__header__picto"},ERi={class:"bimdata-models__header__name"},BRi={key:0,class:"bimdata-models__header__name--empty"},PRi={key:1,class:"bimdata-models__header__name--empty"},IRi={key:3},SRi=["onMousemove","onClick"],TRi={__name:"Models",props:{preview:{type:Boolean,default:!1},windowPositioning:{type:Boolean,default:!0},customFilter:{type:Function,default:null},width:{type:String,default:"350px"}},setup(t){const e=t,i=kt("$viewer"),r=ke(),n=ke(0),o=ke(0),s=ke(),a=nr([]),l=ke(!1),c=qe(()=>i.localContext.loadedModels),d=qe(()=>i.localContext.loadedModelIds),u=qe(()=>i.localContext.loadingModelIds),h=qe(()=>i.localContext.multiModel),p=qe(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(C=>c.value.find(M=>M.document?.head_id!=null&&M.document.head_id===C.document.id)??C)),g=C=>d.value.includes(C),f=C=>u.value.includes(C),m=qe(()=>{const{x:C,y:M}=s.value?.getBoundingClientRect()??{x:0,y:0};return`top:${o.value-M}px; left:${n.value-C}px;`}),A=C=>{!h.value&&g(C.id)||u.value.length>0||(i.localContext.loadedModelIds.includes(C.id)?i.localContext.unloadModels([C.id]):i.localContext.loadModels([C.id]))},y=C=>{switch(C){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},v=(C,M)=>{C?.viewer_360_file&&(n.value=M.clientX,o.value=M.clientY),r.value=C?.viewer_360_file},b=async C=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,C)).filter(M=>i.state.models.some(E=>E.archived)||!M.archived).sort(su("updated_at",!1))}catch(M){console.error("[Models] Cannot get project models. Error: ",M)}finally{l.value=!1}return[]},w=C=>C.children?.some(M=>g(M.id))??!1;return b(i.localContext.modelTypes).then(C=>{a.value=C}),(C,M)=>{const E=D("BIMDataSpinner"),B=D("BIMDataIconModel3D"),S=D("BIMDataTextbox"),I=D("BIMDataCheckbox"),T=D("BIMDataRadio"),L=D("BIMDataIcon"),O=D("BIMDataDropdownList");return P(),F("div",{ref_key:"templateRef",ref:s,class:Me(["bimdata-models",{"bimdata-models--window-positioning":t.windowPositioning}])},[r.value?(P(),F("div",{key:0,class:"bimdata-models__preview",style:Ee(m.value)},[x("img",{src:r.value},null,8,CRi)],4)):ye("",!0),R(O,{style:Ee(`--bimdata-models-width: ${t.width};`),width:t.width,list:p.value,"element-key":"id","per-page":40,loading:l.value,class:"bimdata-models__list",disabled:p.value.length===0,onElementClick:A},{header:H(({isOpen:j})=>[x("div",xRi,[l.value||u.value.length>0?(P(),F("div",kRi,[R(E)])):(P(),F(lt,{key:1},[x("div",MRi,[R(B)]),x("div",{class:Me(["bimdata-models__header__number bimdata-info-length",{"bimdata-models__header__number--empty":d.value.length===0}])},[x("span",null,Z(d.value.length),1)],2),x("div",ERi,[p.value.length===0?(P(),F("span",BRi,Z(C.$t("model.no_model")),1)):d.value.length===0?(P(),F("span",PRi,Z(C.$t("model.no_loaded_model")),1)):d.value.length===1?(P(),Y(S,{key:2,text:c.value[0].name,tooltip:!j},null,8,["text","tooltip"])):d.value.length>1?(P(),F("span",IRi,Z(C.$t("model.selected_models")),1)):ye("",!0)])],64))])]),element:H(({element:j,close:N})=>[x("div",{class:"bimdata-models__model",onMousemove:z=>t.preview&&v(j,z),onMouseout:M[0]||(M[0]=z=>t.preview&&v()),onClick:()=>{!h.value&&!g(j.id)&&N()}},[h.value?(P(),Y(I,{key:0,"model-value":g(j.id)||w(j),disabled:j.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])):(P(),Y(T,{key:1,"model-value":g(j.id)||w(j),disabled:j.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])),R(L,{margin:"0 calc(var(--spacing-unit) / 2)",name:y(j.status),size:"xs",class:Me({"fill-success":j.status==="C","fill-high":j.status==="E"})},null,8,["name","class"]),R(S,{class:Me({"bimdata-models__model__name":!0,"bimdata-models__model__name--disabled":j.status!=="C"||u.value.length>0}),text:j.name,width:`calc(100% -
5317
+ `),onMouseenter:e[0]||(e[0]=(...h)=>r.onMouseEnter&&r.onMouseEnter(...h)),onMouseleave:e[1]||(e[1]=(...h)=>r.onMouseLeave&&r.onMouseLeave(...h))},[R(s,{ref:"modalManagerTemplateRef"},null,512),x("div",GTi,[r.windowPlugins.leftSidePanel?(P(),Y(a,{key:0,plugin:r.windowPlugins.leftSidePanel},null,8,["plugin"])):ye("",!0),x("div",QTi,[(P(!0),F(lt,null,zt(r.windowPlugins.free,h=>(P(),Y(l,{key:h.name,class:Me({"window-container__content__center__viewer":h.isViewer}),plugin:h},null,8,["class","plugin"]))),128)),R(c,{position:"left",plugins:r.windowPlugins.leftButtonColumn},null,8,["plugins"]),R(c,{position:"right",plugins:r.windowPlugins.rightButtonColumn},null,8,["plugins"])]),r.windowPlugins.rightSidePanel?(P(),Y(a,{key:1,plugin:r.windowPlugins.rightSidePanel},null,8,["plugin"])):ye("",!0)]),r.loading?(P(),F("div",KTi,[r.spinner&&r.spinner.component?(P(),Y(Tn(r.spinner.component),uc(Ba({key:0},r.spinner.props)),null,16)):(P(),Y(d,{key:1,size:"20px",border:"3px"}))])):ye("",!0),r.layoutSettingsDisplayed?(P(),F("div",WTi,[R(u)])):ye("",!0)],36)}const ZTi=q(qTi,[["render",JTi],["__scopeId","data-v-485f288e"]]);let XTi=class{constructor(t=!0){const e=USi(zY,null,{resizable:t});e.registerContent("default",ZTi),this.settings=ts({edit:!1,swap:!1,full:!1}),this.areas=e}get resizable(){return this.areas.resizable}set resizable(t){this.areas.resizable=t}apply(t=null){this.areas.layout=t?NSi(t):null}copy(t,e=!0){return jSi(this.areas.layout,t,e)}open({ratio:t,direction:e,insertAfter:i,windowName:r=null,windowState:n=null,localContextId:o=null}={}){const s=r?{options:{windowName:r,windowState:n}}:null;return o===null?this.areas.splitLayout(t,e,i,s):this.areas.split(o,t,e,i,s)}swap(t,e){return this.areas.swap(t,e)}close(t){return this.areas.delete(t)}compare(t,e){if(!t&&!e)return!0;if(!t||!e)return!1;if(typeof t=="string"&&typeof e=="string")return t===e;if(typeof t=="string"||typeof e=="string")return!1;if(t.windowName&&e.windowName){if(t.windowName!==e.windowName)return!1;const i=new Set(t.windowState?.modelIds),r=new Set(e.windowState?.modelIds);return i.size===r.size&&[...i].every(n=>r.has(n))}return t.windowName||e.windowName||t.direction!==e.direction||t.children.length!==e.children.length?!1:t.children.every((i,r)=>this.compare(i,e.children[r]))}};const YTi="2.15.2-beta.1",$Ti={version:YTi};let eDi=1;class tDi{constructor({plugins:e,api:i,ui:r,locale:n="fr"}){this.instanceId=eDi++,this.pluginManager=new EEi(e),this.windowManager=new PEi,this.windowManager.registerAndAddPluginsToWindows([...this.pluginManager.registeredPlugins.values()]),this.api=new qIi(i),this.globalContext=new BTe(this),this.state=rSi(this),this.shortcutManager=bke(this.state),this.uiSettings=r||{},this.i18n=new MTe(n),this._contextMenu=null,this.layout=new XTi(this.uiSettings.resizable!==!1),this._darkTheme=ke(r?.darkTheme??!1),this.localContext=null,window.$viewer=this}get darkTheme(){return this._darkTheme.value}set darkTheme(e){this._darkTheme.value=e}get version(){return $Ti.version}get locale(){return this.i18n.locale}get contextMenu(){return this._contextMenu||vke}set contextMenu(e){this._contextMenu=e}get registeredWindows(){return[...this.windowManager.registeredWindows.keys()]}get registeredPlugins(){return[...this.pluginManager.registeredPlugins.keys()]}get pluginsCfg(){return this.pluginManager.cfg}registerPlugin(e){this.pluginManager.registerPlugin(e),this.windowManager.registerAndAddPluginsToWindows([e])}}function iDi(t,e={}){e.backgroundColor&&(t.style.setProperty("--bimdata-viewer-background-color",e.backgroundColor),e.backgroundColor==="transparent"&&t.style.setProperty("--areas-separator-color","transparent")),e.colorPrimary&&t.style.setProperty("--color-primary",e.colorPrimary),e.colorPrimaryLighter&&t.style.setProperty("--color-primary-lighter",e.colorPrimaryLighter),e.colorPrimaryLight&&t.style.setProperty("--color-primary-light",e.colorPrimaryLight),e.colorPrimaryDark&&t.style.setProperty("--color-primary-dark",e.colorPrimaryDark),e.colorSecondary&&t.style.setProperty("--color-secondary",e.colorSecondary),e.colorSecondaryLighter&&t.style.setProperty("--color-secondary-lighter",e.colorSecondaryLighter),e.colorSecondaryLight&&t.style.setProperty("--color-secondary-light",e.colorSecondaryLight),e.colorSecondaryDark&&t.style.setProperty("--color-secondary-dark",e.colorSecondaryDark),e.colorSilverLight&&t.style.setProperty("--color-silver-light",e.colorSilverLight),e.colorSilver&&t.style.setProperty("--color-silver",e.colorSilver),e.colorSilverDark&&t.style.setProperty("--color-silver-dark",e.colorSilverDark),e.colorGraniteLight&&t.style.setProperty("--color-granite-light",e.colorGraniteLight),e.colorGranite&&t.style.setProperty("--color-granite",e.colorGranite),e.colorSuccess&&t.style.setProperty("--color-success",e.colorSuccess),e.colorSuccessLighter&&t.style.setProperty("--color-success-Lighter",e.colorSuccessLighter),e.colorSuccessLight&&t.style.setProperty("--color-success-Light",e.colorSuccessLight),e.colorSuccessDark&&t.style.setProperty("--color-success-Dark",e.colorSuccessDark),e.colorWarning&&t.style.setProperty("--color-warning",e.colorWarning),e.colorWarningLighter&&t.style.setProperty("--color-warning-Lighter",e.colorWarningLighter),e.colorWarningLight&&t.style.setProperty("--color-warning-Light",e.colorWarningLight),e.colorWarningDark&&t.style.setProperty("--color-warning-Dark",e.colorWarningDark),e.colorHigh&&t.style.setProperty("--color-high",e.colorHigh),e.colorHighLighter&&t.style.setProperty("--color-high-lighter",e.colorHighLighter),e.colorHighLight&&t.style.setProperty("--color-high-light",e.colorHighLight),e.colorHighDark&&t.style.setProperty("--color-high-dark",e.colorHighDark),e.colorText&&t.style.setProperty("--color-text",e.colorText),(!e.backgroundColor||e.backgroundColor!=="transparent")&&t.style.setProperty("--areas-separator-color","rgba(216, 216, 216, 1)"),e.headerHeight!=null&&t.style.setProperty("--bimdata-viewer-header-height",e.headerHeight),t.style.setProperty("--areas-background-color","transparent")}const rDi=Object.freeze({25:"GUEST",50:"USER",100:"ADMIN"}),W5=Object.freeze({READ:"read",WRITE:"write"});function y7e(t){const e={};return t.forEach(i=>{const[r,n]=i.split(":");e[r]?e[r].push(n):e[r]=[n]}),e}const nDi={token_scopes:[],usable_scopes:[],user_role:25};function b7e(t=nDi){const e=y7e(t.token_scopes),i=y7e(t.usable_scopes);return{...Vre(t),tokenScopes:e,usableScopes:i,userRole:rDi[t.user_role],user:t.user?Vre(t.user):null,hasBcfReadPermission:i.bcf?.includes(W5.READ)??!1,hasBcfWritePermission:i.bcf?.includes(W5.WRITE)??!1,hasModelReadPermission:i.model?.includes(W5.READ)??!1,hasModelWritePermission:i.model?.includes(W5.WRITE)??!1,hasDocReadPermission:i.document?.includes(W5.READ)??!1,hasDocWritePermission:i.document?.includes(W5.WRITE)??!1}}const oDi={back:"Zur\xFCck",BcfFilters:{filtersButton:"Filter",filtersTitle:"Filter",priorityLabel:"Priorit\xE4t",statusLabel:"Status",stageLabel:"Phase",assignedToLabel:"Zugewiesen an",creatorsLabel:"Erstellt von",tagsLabel:"Tags",resetButton:"Zur\xFCcksetzen",searchButton:"Suchen",undefined:"Nicht definiert",datePlaceholder:"Erstellungsdatum"},BcfSettings:{title:"BCF-Parameter",text:"Erstellen, f\xFCllen und listen Sie die BCF-Einstellungen auf, die Sie f\xFCr dieses Projekt haben m\xF6chten.",validateButton:"Die BCF-Parameter anerkennen"},BcfStatistics:{emptyText:"F\xFCgen Sie Fragen hinzu, um zugeh\xF6rige Statistiken hier anzuzeigen.",issues:"Probleme",extension:{Priority:"Priorit\xE4t",PriorityNotDefined:"Keine Priorit\xE4t",PriorityTitle:"Priorit\xE4ten",Status:"Status",StatusNotDefined:"Kein Status",StatusTitle:"Status"}},BcfTopicCard:{priority:"Priorit\xE4t",noPriority:"Keine",assignedTo:"Zugewiesen an",elements:"Elemente",notSpecified:"Nicht definiert",see:"Anzeigen"},BcfTopicCreationCard:{text:"Ein neues BCF-Thema erstellen",createBcfSideTitle:"Ein Problem melden"},BcfTopicForm:{dragDropImageText:"Bitte w\xE4hlen Sie eine Datei aus.",addObjectButton:"Objekt",addAnnotationButton:"Annotation",annotationButtonTooltip:"Zu diesem Thema gibt es derzeit keine Ansichten.",addPictureButton:"F\xFCgen Sie ein Bild hinzu.",titlePlaceholder:"Titel *",titleErrorMessage:"Titel fehlt",typeLabel:"Typ",priorityLabel:"Priorit\xE4t",statusLabel:"Status",stageLabel:"Phase",assignedToLabel:"Zugewiesen an",dueDateLabel:"F\xE4lligkeitsdatum (TT.MM.JJJJ)",descriptionLabel:"Beschreibung",labelsLabel:"Tags",createButton:"Best\xE4tigen",updateButton:"\xC4nderungen \xFCbernehmen",modalText:"Sie sind dabei, die Bearbeitung der Ausgabe {Name} zu beenden, aber es gibt noch ungespeicherte \xC4nderungen.",cancelButton:"\xC4nderungen verwerfen",continueButton:"\xC4nderungen fortsetzen",createTitle:"Ein Problem melden",dragDropImageTextTablet:"Foto machen",takeSnapshot:"Mach einen Schnappschuss",importFile:"Eine Datei importieren",searchPlaceholder:"Suchen",emptySearch:"kein Ergebnis",documentsLabel:"Dokumente",documentsCount:"Dokumente \u2013 {count} ausgew\xE4hlte Dokumente",groupsLabel:"Berechtigungen",groupsCount:"Berechtigungen \u2013 {count} ausgew\xE4hlte Gruppen",groupsText:"W\xE4hlen Sie die Benutzergruppen aus, die dieses Thema sehen und damit interagieren d\xFCrfen.",validate:"Best\xE4tigen"},BcfTopicOverview:{openViewer:"Im Viewer \xF6ffnen",openViewerNoModels:"Es sind keine Vorlagen zur Ansicht bereit",elements:"{count} Elemente",noElements:"kein Element",type:"Typ",noTypeSpecified:"Kein Typ angegeben",description:"Beschreibung",noDescriptionProvided:"Keine Beschreibung angegeben",assignedTo:"Zugeteilt an",notAssigned:"Nicht zugewiesen",dueDate:"F\xE4lligkeitsdatum",noDueDate:"Kein F\xE4lligkeitsdatum",informations:"Informationen",status:"Status",noStatusSpecified:"Kein Status angegeben",stage:"Phase",noStageProvided:"Keine Phase angegeben",priority:"Priorit\xE4t",priorityNotDefined:"Nicht definiert",tags:"Tags",noTags:"Keine Tags",commentButton:"Ein Kommentar ver\xF6ffentlichen",deleteText:"Sie l\xF6schen jetzt {Name}",deleteBcfButton:"Dieses BCF l\xF6schen",keepBcfButton:"Dieses BCF beibehalten",author:"Autor"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE4t",status:"Status",title:"Titel",creator:"Autor",date:"Datum"}},BcfTopicActionsCell:{seeButton:"Anzeigen"},BcfTopicComments:{commentButton:"Ein Kommentar verfassen",commentLabel:"Ein Kommentar verfassen",commentText:"Kommentar",cancelButton:"Abbrechen",publishButton:"Ver\xF6ffentlichen",commentsText:"Kommentare",deleteCommentText:"Diesen Kommentar l\xF6schen?",deleteButton:"L\xF6schen",takeSnapshot:"Mach einen Schnappschuss",edited:"bearbeitet"},BcfTopicPriorityCell:{noPriority:"Keine"},SettingCard:{addButton:"ein Element hinzuf\xFCgen",cancelButton:"Abbrechen",validateButton:"Best\xE4tigen",deleteExtensionText:"Diesen Parameter l\xF6schen",deleteButton:"L\xF6schen",title:{Priority:"Priorit\xE4ten",Label:"Tags",Status:"Status",Type:"Typen",Stage:"Phasen"},input:{Priority:"Eine neue Priorit\xE4t hinzuf\xFCgen",Label:"Ein neues Etikett hinzuf\xFCgen",Status:"Einen neuen Status hinzuf\xFCgen",Type:"Einen neuen Typ hinzuf\xFCgen",Stage:"Eine neue Phase hinzuf\xFCgen"},text:{Priority:"Liste der Priorit\xE4ten",Label:"Liste von Tags",Status:"Liste der Status",Type:"Liste der Typen",Stage:"Liste der Phasen"}}},sDi={BcfComponents:oDi},aDi={back:"Back",BcfFilters:{filtersButton:"Filters",filtersTitle:"Filters",priorityLabel:"Priority",statusLabel:"Status",stageLabel:"Stage",assignedToLabel:"Assigned to",creatorsLabel:"Created by",tagsLabel:"Tags",resetButton:"Reset",searchButton:"Search",undefined:"Not defined",datePlaceholder:"Creation date"},BcfSettings:{title:"BCF Settings",text:"Create, enter in, and list the BCF settings you would like to have for this project",validateButton:"Validate BCF settings"},BcfStatistics:{emptyText:"Add BCF Topics to start to have some stats here.",issues:"issues",extension:{Priority:"Priority",PriorityNotDefined:"No priority",PriorityTitle:"Priorities",Status:"Status",StatusNotDefined:"No status",StatusTitle:"Status"}},BcfTopicCard:{priority:"Priority",noPriority:"None",assignedTo:"Assigned to",elements:"Elements",notSpecified:"Not specified",see:"See"},BcfTopicCreationCard:{text:"Create a new BCF topic",createBcfSideTitle:"Report a problem"},BcfTopicForm:{dragDropImageText:"Please select a file",addObjectButton:"Object",addAnnotationButton:"Annotation",annotationButtonTooltip:"This topic has no viewpoint",addPictureButton:"Add a picture",titlePlaceholder:"Title *",titleErrorMessage:"Missing title",typeLabel:"Type",priorityLabel:"Priority",statusLabel:"Status",stageLabel:"Stage",assignedToLabel:"Assigned to",dueDateLabel:"Due date",descriptionLabel:"Description",labelsLabel:"Tags",createButton:"Validate",updateButton:"Modify this BCF",modalText:"You are about to quit editing issue {name} but there are unsaved changes.",cancelButton:"Discard changes",continueButton:"Continue editing",createTitle:"Report a problem",dragDropImageTextTablet:"Take a picture",takeSnapshot:"Take a snapshot",importFile:"Import a file",searchPlaceholder:"Search",emptySearch:"No result",documentsLabel:"Add a file",documentsCount:"Files - {count} selected files",groupsLabel:"Permissions",groupsCount:"Permissions - {count} selected groups",groupsText:"You are now setting the access rights: choose the user group(s) that will be exclusively authorized to see and interact with this topic.",validate:"Validate"},BcfTopicOverview:{openViewer:"Open in viewer",openViewerNoModels:"No model to open",elements:"{count} Elements",noElements:"No element",type:"Type",noTypeSpecified:"No type specified",description:"Description",noDescriptionProvided:"No description provided",assignedTo:"Assigned to",notAssigned:"Not assigned",dueDate:"Due date",noDueDate:"No due date",informations:"Informations",status:"Status",noStatusSpecified:"No status specified",stage:"Stage",noStageProvided:"No stage provided",priority:"Priority",priorityNotDefined:"Not defined",tags:"Tags",noTags:"No tags",commentButton:"Post a comment",deleteText:"You are about to delete {name}",deleteBcfButton:"Delete this BCF",keepBcfButton:"Keep this BCF",author:"Author"},BcfTopicsTable:{headers:{index:"#",priority:"Priority",status:"Status",title:"Title",creator:"Author",date:"Date"}},BcfTopicActionsCell:{seeButton:"See"},BcfTopicComments:{commentButton:"Post a comment",commentLabel:"Post a comment",commentText:"Comment",cancelButton:"Cancel",publishButton:"Publish",commentsText:"Comments",deleteCommentText:"Delete this comment ?",deleteButton:"Delete",takeSnapshot:"Take a snapshot",edited:"edited"},BcfTopicPriorityCell:{noPriority:"None"},SettingCard:{addButton:"add an element",cancelButton:"Cancel",validateButton:"Validate",deleteExtensionText:"Remove this setting",deleteButton:"Delete",title:{Priority:"Priorities",Label:"Labels",Status:"Status",Type:"Types",Stage:"Stages"},input:{Priority:"Add a new priority",Label:"Add a new label",Status:"Add new status",Type:"Add a new type",Stage:"Add a new stage"},text:{Priority:"Priority list",Label:"Labels list",Status:"Status list",Type:"Type list",Stage:"Stage list"}}},lDi={BcfComponents:aDi},cDi={back:"Volver",BcfFilters:{filtersButton:"Filtros",filtersTitle:"Filtros",priorityLabel:"Prioridad",statusLabel:"Estado",stageLabel:"Fase",assignedToLabel:"Asignado a",creatorsLabel:"Creado por",tagsLabel:"Etiquetas:",resetButton:"Restablecer",searchButton:"Buscar en",undefined:"No definido",datePlaceholder:"Fecha de creaci\xF3n"},BcfSettings:{title:"Par\xE1metros del BCF",text:"Cree, rellene y enumere los par\xE1metros del BCF que desea tener en este proyecto",validateButton:"Validar los par\xE1metros del BCF"},BcfStatistics:{emptyText:"A\xF1ada preguntas para ver las estad\xEDsticas asociadas aqu\xED.",issues:"problemas",extension:{Priority:"Prioridad",PriorityNotDefined:"Sin prioridad",PriorityTitle:"Prioridades",Status:"Estado",StatusNotDefined:"Sin estado",StatusTitle:"Estatutos"}},BcfTopicCard:{priority:"Prioridad",noPriority:"Sin",assignedTo:"Asignado a",elements:"Elementos",notSpecified:"No definido",see:"Ver"},BcfTopicCreationCard:{text:"Crear un nuevo tema BCF",createBcfSideTitle:"Informar de un problema"},BcfTopicForm:{dragDropImageText:"Seleccione un archivo",addObjectButton:"Objeto",addAnnotationButton:"Anotaci\xF3n",annotationButtonTooltip:"Actualmente este tema no posee ning\xFAn punto de vista",addPictureButton:"A\xF1adir una imagen",titlePlaceholder:"T\xEDtulo *",titleErrorMessage:"Falta el t\xEDtulo",typeLabel:"Tipo",priorityLabel:"Prioridad",statusLabel:"Estado",stageLabel:"Fase",assignedToLabel:"Asignado a",dueDateLabel:"Fecha de vencimiento (DD/MM/AAAA)",descriptionLabel:"Descripci\xF3n",labelsLabel:"Etiquetas",createButton:"Validar",updateButton:"Modificar este BCF",modalText:"Est\xE1 a punto de salir de la edici\xF3n del problema de {name} pero hay cambios sin guardar.",cancelButton:"Cancelar los cambios",continueButton:"Continuar con los cambios",createTitle:"Informar de un problema",dragDropImageTextTablet:"Tomar una fotograf\xEDa",takeSnapshot:"Tomar un snapshot",importFile:"Importar un archivo",searchPlaceholder:"Buscar",emptySearch:"No hay resultados"},BcfTopicOverview:{openViewer:"Abrir en el visor",openViewerNoModels:"No hay ning\xFAn modelo listo para la visualizaci\xF3n",elements:"{count} Elementos",noElements:"Ning\xFAn elemento",type:"Tipo",noTypeSpecified:"No se especifica el tipo",description:"Descripci\xF3n",noDescriptionProvided:"No hay descripci\xF3n",assignedTo:"Asignado a",notAssigned:"No asignado",dueDate:"Plazo",noDueDate:"Sin fecha de vencimiento",informations:"Informaci\xF3n",status:"Estado",noStatusSpecified:"No se especifica el estado",stage:"Fase",noStageProvided:"No se indica ninguna fase",priority:"Prioridad",priorityNotDefined:"No definido",tags:"Etiquetas",noTags:"Sin etiquetas",commentButton:"Publicar un comentario",deleteText:"Est\xE1s a punto de borrar {name}",deleteBcfButton:"Borrar este BCF",keepBcfButton:"Mantenga este BCF",author:"Autor"},BcfTopicsTable:{headers:{index:"#",priority:"Prioridad",status:"Estado",title:"T\xEDtulo",creator:"Autor",date:"Fecha"}},BcfTopicActionsCell:{seeButton:"Ver"},BcfTopicComments:{commentButton:"Publicar un comentario",commentLabel:"Publicar un comentario",commentText:"Comentario",cancelButton:"Cancelar",publishButton:"Publicar",commentsText:"comentarios",deleteCommentText:"\xBFBorrar este comentario?",deleteButton:"Borrar",takeSnapshot:"Tomar un snapshot"},BcfTopicPriorityCell:{noPriority:"Sin"},SettingCard:{addButton:"a\xF1adir un elemento",cancelButton:"Cancelar",validateButton:"Validar",deleteExtensionText:"Borrar esta configuraci\xF3n",deleteButton:"Borrar",title:{Priority:"Prioridades",Label:"Etiquetas:",Status:"Estatutos",Type:"Tipos",Stage:"Fases"},input:{Priority:"A\xF1adir una nueva prioridad",Label:"A\xF1adir una nueva etiqueta",Status:"A\xF1adir un nuevo estado",Type:"A\xF1adir un nuevo tipo",Stage:"A\xF1adir una nueva fase"},text:{Priority:"Lista de prioridades",Label:"Lista de etiquetas",Status:"Lista de estatutos",Type:"Lista de tipos",Stage:"Lista de fases"}}},dDi={BcfComponents:cDi},uDi={back:"Retour",BcfFilters:{filtersButton:"Filtres",filtersTitle:"Filtres",priorityLabel:"Priorit\xE9",statusLabel:"Statut",stageLabel:"Phase",assignedToLabel:"Assign\xE9 \xE0",creatorsLabel:"Cr\xE9\xE9 par",tagsLabel:"Tags",resetButton:"R\xE9initialiser",searchButton:"Rechercher",undefined:"Non d\xE9fini",datePlaceholder:"Date de cr\xE9ation"},BcfSettings:{title:"Param\xE8tres BCF",text:"Cr\xE9ez, renseignez et listez les param\xE8tres BCF que vous souhaitez avoir sur ce projet",validateButton:"Valider les param\xE8tres BCF"},BcfStatistics:{emptyText:"Ajoutez des questions pour voir les statistiques associ\xE9es ici.",issues:"probl\xE8mes",extension:{Priority:"Priorit\xE9",PriorityNotDefined:"Aucune priorit\xE9",PriorityTitle:"Priorit\xE9s",Status:"Statut",StatusNotDefined:"Aucun statut",StatusTitle:"Statuts"}},BcfTopicCard:{priority:"Priorit\xE9",noPriority:"Aucune",assignedTo:"Assign\xE9 \xE0",elements:"{n} \xC9lements",notSpecified:"Non d\xE9fini",see:"Voir"},BcfTopicCreationCard:{text:"Cr\xE9er un nouveau topic BCF",createBcfSideTitle:"Signaler un probl\xE8me"},BcfTopicForm:{dragDropImageText:"Veuillez s\xE9lectionner un fichier",addObjectButton:"Objet",addAnnotationButton:"Annotation",annotationButtonTooltip:"Ce topic ne poss\xE8de actuellement aucun point de vue",addPictureButton:"Ajouter une image",titlePlaceholder:"Titre *",titleErrorMessage:"Titre manquant",typeLabel:"Type",priorityLabel:"Priorit\xE9",statusLabel:"Statut",stageLabel:"Phase",assignedToLabel:"Assign\xE9 \xE0",dueDateLabel:"Date d'\xE9ch\xE9ance",descriptionLabel:"Description",labelsLabel:"Tags",createButton:"Valider",updateButton:"Modifier ce BCF",modalText:"Vous \xEAtes sur le point de quitter l'\xE9dition de l'issue {name} mais il y'a des modifications non enregistr\xE9es.",cancelButton:"Annuler les modifications",continueButton:"Continuer les modifications",createTitle:"Signaler un probl\xE8me",dragDropImageTextTablet:"Prendre une photo",takeSnapshot:"Prendre un snapshot",importFile:"Importer un fichier",searchPlaceholder:"Rechercher",emptySearch:"Pas de r\xE9sultat",documentsLabel:"Documents",documentsCount:"Documents - {count} documents s\xE9lectionn\xE9s",groupsLabel:"Permissions",groupsCount:"Permissions - {count} groupes s\xE9lectionn\xE9s",groupsText:"S\xE9lectionner les groupes utilisateur qui peuvent voir ce topic et int\xE9ragir avec.",validate:"Valider"},BcfTopicOverview:{openViewer:"Ouvrir dans le viewer",openViewerNoModels:"Il n'y a aucun mod\xE8le pr\xEAt pour une visualisation",elements:"{count} \xC9lements",noElements:"Aucun \xE9l\xE9ment concern\xE9",type:"Type",noTypeSpecified:"Pas de type sp\xE9cifi\xE9",description:"Description",noDescriptionProvided:"Pas de description renseign\xE9e",assignedTo:"Assign\xE9 \xE0",notAssigned:"Non assign\xE9",dueDate:"\xC9ch\xE9ance",noDueDate:"Pas de date d'\xE9ch\xE9ance",informations:"Informations",status:"Statut",noStatusSpecified:"Pas de statut sp\xE9cifi\xE9",stage:"Phase",noStageProvided:"Pas de phase renseign\xE9e",priority:"Priorit\xE9",priorityNotDefined:"Non d\xE9fini",tags:"Tags",noTags:"Pas de tags",commentButton:"Poster un commentaire",deleteText:"Vous \xEAtes sur le point de supprimer {name}",deleteBcfButton:"Supprimer ce BCF",keepBcfButton:"Conserver ce BCF",author:"Auteur"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE9",status:"Statut",title:"Titre",creator:"Auteur",date:"Date"}},BcfTopicActionsCell:{seeButton:"Voir"},BcfTopicComments:{commentButton:"Poster un commentaire",commentLabel:"Poster un commentaire",commentText:"Commentaire",cancelButton:"Annuler",publishButton:"Publier",commentsText:"commentaires",deleteCommentText:"Supprimer ce commentaire ?",deleteButton:"Supprimer",takeSnapshot:"Prendre un snapshot",edited:"edit\xE9"},BcfTopicPriorityCell:{noPriority:"Aucune"},SettingCard:{addButton:"ajouter un \xE9l\xE9ment",cancelButton:"Annuler",validateButton:"Valider",deleteExtensionText:"Supprimmer ce param\xE8tre",deleteButton:"Supprimer",title:{Priority:"Priorit\xE9s",Label:"Tags",Status:"Statuts",Type:"Types",Stage:"Phases"},input:{Priority:"Ajouter une nouvelle priorit\xE9",Label:"Ajouter un nouveau label",Status:"Ajouter un nouveau statut",Type:"Ajouter un nouveau type",Stage:"Ajouter une nouvelle phase"},text:{Priority:"Liste des priorit\xE9s",Label:"Liste des tags",Status:"Liste des statuts",Type:"Liste des types",Stage:"Liste des phases"}}},hDi={BcfComponents:uDi},pDi={back:"Indietro",BcfFilters:{filtersButton:"Filtri",filtersTitle:"Filtri",priorityLabel:"Priorit\xE0",statusLabel:"Stato",stageLabel:"Fase",datePlaceholder:"Data di creazione",assignedToLabel:"Assegnato a",creatorsLabel:"Creato da",tagsLabel:"Etichette",resetButton:"Ripristina",searchButton:"Cerca",undefined:"Non definito"},BcfSettings:{title:"Parametri BCF",text:"Creare, notificare e elencare i parametri BCF che si desidera avere su questo progetto",validateButton:"Conferma i parametri BCF"},BcfStatistics:{emptyText:"Aggiungi delle domande per vedere le statistiche associate qui.",issues:"problemi",extension:{Priority:"Priorit\xE0",PriorityNotDefined:"Nessuna priorit\xE0",PriorityTitle:"Priorit\xE0",Status:"Stato",StatusNotDefined:"Nessuno stato",StatusTitle:"Stati"}},BcfTopicCard:{priority:"Priorit\xE0",noPriority:"Nessuno",assignedTo:"Assegnato a",elements:"Elementi",noElements:"0 elementi",notSpecified:"Non definito",see:"Visualizza"},BcfTopicCreationCard:{text:"Crea un nuovo topic BCF",createBcfSideTitle:"Segnala un problema"},BcfTopicForm:{dragDropImageText:"Selezionare un file",addObjectButton:"Oggetto",addAnnotationButton:"Annotazione",annotationButtonTooltip:"Attualmente questo argomento non presenta alcun punto di vista",addPictureButton:"Aggiungere un'immagine",titlePlaceholder:"Titolo *",titleErrorMessage:"Titolo mancante",typeLabel:"Tipo",priorityLabel:"Priorit\xE0",statusLabel:"Stato",stageLabel:"Fase",assignedToLabel:"Assegnato a",dueDateLabel:"Data di scadenza",descriptionLabel:"Descrizione",labelsLabel:"Tag",createButton:"Conferma",updateButton:"Modificare questo BCF",modalText:"State per abbandonare la modifica di {name} ma ci sono modifiche non salvate.",cancelButton:"Annullare le modifiche",continueButton:"Continuare le modifiche",createTitle:"Segnala un problema"},BcfTopicOverview:{openViewer:"Apri nel visualizzatore",openViewerNoModels:"Non esistono modelli pronti per la visualizzazione",elements:"{count} Elementi",noElements:"Nessun elemento",type:"Tipo",noTypeSpecified:"Nessun tipo specificato",description:"Descrizione",noDescriptionProvided:"Nessuna descrizione inserita",assignedTo:"Assegnato a",notAssigned:"Non assegnato",dueDate:"Scadenza",noDueDate:"Nessuna data di scadenza",informations:"Informazioni",status:"Stato",noStatusSpecified:"Nessuno stato specificato",stage:"Fase",noStageProvided:"Nessuna fase inserita",priority:"Priorit\xE0",priorityNotDefined:"Non definita",tags:"Etichette",noTags:"Nessuna etichetta",commentButton:"Pubblica un commento",deleteText:"Stai per eliminare {name}",deleteBcfButton:"Elimina questo BCF",keepBcfButton:"Conserva questo BCF",author:"Autore"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE0",status:"Stato",title:"Titolo",creator:"Autore",date:"Data"}},BcfTopicActionsCell:{seeButton:"Visualizza"},BcfTopicComments:{commentButton:"Pubblica un commento",commentLabel:"Pubblica un commento",commentText:"Commento",cancelButton:"Annulla",publishButton:"Pubblica",commentsText:"commenti",deleteCommentText:"Eliminare questo commento?",deleteButton:"Elimina"},BcfTopicPriorityCell:{noPriority:"Nessuno"},SettingCard:{addButton:"aggiungi un elemento",cancelButton:"Annulla",validateButton:"Conferma",deleteExtensionText:"Elimina questo parametro",deleteButton:"Elimina",title:{Priority:"Priorit\xE0",Label:"Etichette",Status:"Stati",Type:"Tipi",Stage:"Fasi"},input:{Priority:"Aggiungi una nuova priorit\xE0",Label:"Aggiungi una nuova etichetta",Status:"Aggiungi un nuovo stato",Type:"Aggiungi un nuovo tipo",Stage:"Aggiungi una nuova fase"},text:{Priority:"Elenco delle priorit\xE0",Label:"Elenco delle etichette",Status:"Elenco degli stati",Type:"Elenco dei tipi",Stage:"Elenco delle fasi"}}},fDi={BcfComponents:pDi},gDi={de:sDi,en:lDi,es:dDi,fr:hDi,it:fDi},ADi=({apiClient:t,fetchUsers:e,i18nPlugin:i}={})=>({install(r){t?Sr.setup({apiClient:t,fetchUsers:e}):console.error("[BCF Components Plugin] No api client provided. You must provide an api client for the components to work properly."),i?Object.entries(gDi).forEach(([n,o])=>{i.global.mergeLocaleMessage(n,o)}):console.warn("[BCF Components Plugin] No i18n instance provided. You should either provide an i18n instance or define your own translations in order have text displayed properly."),Object.entries(vOe).forEach(([n,o])=>{r.component(n,o)})}}),mDi={title:"Building Maker",back:"Zur\xFCck",list:{text:"Erstellen und bearbeiten Sie die Etagen und laden Sie anschlie\xDFend Ihre PDFs herunter.",createButton:"Neues Projekt",updateButton:"Umbenennen",deleteButton:"L\xF6schen"},form:{text:"Erstellen und bearbeiten Sie die Etagen und laden Sie anschlie\xDFend Ihre PDFs herunter.",input:"Name des Geb\xE4udes",error:"Ung\xFCltiger Name",createButton:"Erstellen",updateButton:"Best\xE4tigen"},view:{addStoreyButton:"Etage",addPlanButton:"Grundriss",closeButton:"Fertigstellen",submitFilesButton:"Best\xE4tigen"},storeyForm:{title:"Neue Etage",input:"Name",error:"Ung\xFCltiger Name",cancelButton:"Abbrechen",submitButton:"Best\xE4tigen"}},vDi={creationFormTitle:"Ordner erstellen",renameFormPlaceholder:"Datei- / Ordnernam",nameInputPlaceholder:"Ordnername",emptyFolder:"Dieser Ordner ist leer",newFolderSuccess:"Neuer Ordner erstellt",renameFolderSuccess:"Umbenannter Ordner",deleteFolderSuccess:"Ordner gel\xF6scht",newFileSuccess:"Datei hinzugef\xFCgt",renameFileSuccess:"Umbenannte Datei",deleteFileSuccess:"Datei gel\xF6scht",nameInputErrorMessage:"Ung\xFCltiger name",cancel:"Abbrechen",submit:"Best\xE4tigen",buttonText:"Neuer Ordner",addFileButtonText:"Datei laden",rename:"Umbenennen",view:"Sehen",download:"Herunterladen",delete:"L\xF6schen",deleteTitle:"Dateien l\xF6schen",deleteDetail:"Sie sind im Begriff, die folgenden Dateien / Ordner endg\xFCltig zu l\xF6schen"},yDi={BuildingMaker:mDi,FileManager:vDi},bDi={t:{back:"Back",cancel:"Cancel",create:"Create",delete:"Delete",download:"Download",finish:"Finish",rename:"Rename",search:"Search",see:"View",storey:"Storey",validate:"Validate"}},wDi={title:"Building Maker",list:{text:"Create and edit storeys, then download your PDFs.",new:"New project"},form:{input:"Building name",error:"Invalid"},view:{addStorey:"Add Storey",addFile:"Add File",addPlan:"Add Plan"},storeyForm:{title:"New storey",input:"Name",error:"Invalid name"}},CDi={creationFormTitle:"Create folder",renameFormPlaceholder:"Folder/File name",nameInputPlaceholder:"Folder name",emptyFolder:"This folder is empty",newFolderSuccess:"New folder created",renameFolderSuccess:"Folder renamed",deleteFolderSuccess:"Folder deleted",newFileSuccess:"File added",renameFileSuccess:"File renamed",deleteFileSuccess:"File deleted",nameInputErrorMessage:"Invalid name",buttonText:"New folder",addFileButtonText:"Upload a file",deleteTitle:"Deleting Files",deleteDetail:"You are about to permanently delete the following files / folders",dmsRoot:"Root of the project's DMS",pdfPageSelectorTitle:"Select a page"},xDi={title:"Meta-Building Structure",tab:{structure:"Structure",zones:"Zones",equipments:"Equipments"},StoreySelector:{placeholder:"Select a storey"}},kDi={title:"Photosphere Building"},MDi={BIMDataComponents:bDi,BuildingMaker:wDi,FileManager:CDi,MetaBuildingStructure:xDi,PhotosphereBuilding:kDi},EDi={title:"Building Maker",back:"Vuelta",list:{text:"Cree y edite los pisos despu\xE9s cargue los PDF.",createButton:"Nuevo proyecto",updateButton:"Renombrar",deleteButton:"Suprimir"},form:{text:"Cree y edite los pisos despu\xE9s cargue los PDF.",input:"Nombre del edificio",error:"Nombre no v\xE1lido",createButton:"Crear",updateButton:"Validar"},view:{addStoreyButton:"Piso",addPlanButton:"Plano",closeButton:"Terminar",submitFilesButton:"Validar"},storeyForm:{title:"Nuevo piso",input:"Nombre",error:"Nombre no v\xE1lido",cancelButton:"Anular",submitButton:"Validar"}},BDi={creationFormTitle:"Crear un archivo",renameFormPlaceholder:"Nombre de archivo / carpeta",nameInputPlaceholder:"Nombre de la carpeta",emptyFolder:"Esta carpeta est\xE1 vac\xEDa",newFolderSuccess:"Nueva carpeta creada",renameFolderSuccess:"Carpeta renombrada",deleteFolderSuccess:"Carpeta eliminada",newFileSuccess:"Archivo agregado",renameFileSuccess:"Archivo renombrado",deleteFileSuccess:"Archivo eliminado",nameInputErrorMessage:"Nombre inv\xE1lida",cancel:"Cancelar",submit:"Validar",buttonText:"Carpeta nueva",addFileButtonText:"Cargar un archivo",rename:"Renombrar",view:"Ver",download:"Descargar",delete:"Borrar",deleteTitle:"Eliminar archivos",deleteDetail:"Est\xE1 a punto de eliminar permanentemente los siguientes archivos / carpetas"},PDi={BuildingMaker:EDi,FileManager:BDi},IDi={t:{back:"Retour",cancel:"Annuler",create:"Cr\xE9er",delete:"Supprimer",download:"T\xE9l\xE9charger",finish:"Terminer",rename:"Renommer",search:"Rechercher",see:"Voir",storey:"\xC9tage",validate:"Valider"}},SDi={title:"Building Maker",list:{text:"Cr\xE9ez et \xE9ditez les \xE9tages puis t\xE9l\xE9chagez vos PDF.",new:"Nouveau projet"},form:{input:"Nom du b\xE2timent",error:"Nom invalide"},view:{addStorey:"Ajouter un \xC9tage",addFile:"Ajouter un fichier",addPlan:"Ajouter un plan"},storeyForm:{title:"Nouvel \xE9tage",input:"Nom",error:"Nom invalide"}},TDi={creationFormTitle:"Cr\xE9er un dossier",renameFormPlaceholder:"Nom du fichier/dosier",nameInputPlaceholder:"Nom du dossier",emptyFolder:"Ce dossier est vide",newFolderSuccess:"Nouveau dossier cr\xE9\xE9",renameFolderSuccess:"Dossier renomm\xE9",deleteFolderSuccess:"Dossier supprim\xE9",newFileSuccess:"Fichier ajout\xE9",renameFileSuccess:"Fichier renomm\xE9",deleteFileSuccess:"Fichier supprim\xE9",nameInputErrorMessage:"Nom invalide",buttonText:"Nouveau dossier",addFileButtonText:"Charger un fichier",deleteTitle:"Supression de fichiers",deleteDetail:"Vous \xEAtes sur le point de supprimer d\xE9finitivement les fichiers/dossiers suivants",dmsRoot:"Racine de la GED du projet",pdfPageSelectorTitle:"S\xE9lectionner une page"},DDi={title:"Structure M\xE9ta-Building",tab:{structure:"Structure",zones:"Zones",equipments:"\xC9quipements"},StoreySelector:{placeholder:"S\xE9lectionner un \xE9tage"}},RDi={title:"Photosph\xE8re Building"},LDi={BIMDataComponents:IDi,BuildingMaker:SDi,FileManager:TDi,MetaBuildingStructure:DDi,PhotosphereBuilding:RDi},_Di={title:"Building Maker",back:"Reso",list:{text:"Crea e modifica i piani e poi scarica i tuoi PDF.",createButton:"Nuovo progetto",updateButton:"Rinominare",deleteButton:"Eliminare"},form:{text:"Crea e modifica i piani e poi scarica i tuoi PDF.",input:"Nome della costruzione",error:"Nome non corretto",createButton:"Creare",updateButton:"Convalidare"},view:{addStoreyButton:"Piano",addPlanButton:"Mappa",closeButton:"Finire",submitFilesButton:"Convalidare"},storeyForm:{title:"Nuovo piano",input:"Nome",error:"Nome non corretto",cancelButton:"Annullare",submitButton:"Convalidare"}},FDi={creationFormTitle:"Crea una cartella",renameFormPlaceholder:"Nome file/cartella",nameInputPlaceholder:"Nome della cartella",emptyFolder:"Questa cartella \xE8 vuota",newFolderSuccess:"Nuova cartella creata",renameFolderSuccess:"Cartella rinominata",deleteFolderSuccess:"Cartella eliminata",newFileSuccess:"File aggiunto",renameFileSuccess:"File rinominato",deleteFileSuccess:"File cancellato",nameInputErrorMessage:"Nome non valido",cancel:"Annulla",submit:"Invia",buttonText:"Nuova cartella",addFileButtonText:"Carica un file",rename:"Rinominare",view:"Vedere",download:"Scaricare",delete:"Cancellare",deleteTitle:"Eliminazione di file",deleteDetail:"Stai per eliminare definitivamente i seguenti file/cartelle"},ODi={BuildingMaker:_Di,FileManager:FDi},UDi={de:yDi,en:MDi,es:PDi,fr:LDi,it:ODi},NDi=({i18nPlugin:t}={})=>({install(e){t?Object.entries(UDi).forEach(([i,r])=>{t.global.mergeLocaleMessage(i,r)}):console.warn("[BIMData Components Plugin] No i18n instance provided. You should either provide an i18n instance or define your own translations in order have text displayed properly."),Object.entries(F0i).forEach(([i,r])=>{e.component(i,r)})}}),jDi={beforeMount(t,e){if(typeof e.value!="function")throw Error(`click away directive needs function, got ${typeof e.value}`);t.clickAwayHandler=i=>{(i.path||i.composedPath&&i.composedPath()).find(r=>r===t)||e.value()},window.addEventListener("mousedown",t.clickAwayHandler,!0)},unmounted(t){window.removeEventListener("mousedown",t.clickAwayHandler,!0),delete t.clickAwayHandler}},HDi=Object.freeze(Object.defineProperty({__proto__:null,BIMDataClickAway:iu,BIMDataClickInputAway:jDi},Symbol.toStringTag,{value:"Module"})),VDi=t=>({install(e){Object.entries(d0t).forEach(([i,r])=>{e.component(i,r)}),Object.entries(HDi).forEach(([i,r])=>e.directive(i.split("BIMData")[1],r))}}),zDi={name:"LiWrapper",render(){return so("li",this.$slots.default())}};function qDi(t,e){var i=new Set([]);return t.forEach(r=>{e.has(r)||i.add(r)}),i}const Du=Zs("id"),GDi=({contextMenu:t,objects:e=[],state:i=t.$viewer.state,pictos:r})=>[{name:"selectAll",get group(){return t.groupPositions.select},position:1,get label(){return t.$t("context_menu.select_all")},get picto(){return r.get(this.name)},execute:()=>i.selectObjects(e.filter(zd(br("visible"),S0("selected"))).map(Du)),predicate:()=>e.some(zd(br("visible"),S0("selected")))},{name:"deselectAll",get group(){return t.groupPositions.select},position:2,get label(){return t.$t("context_menu.deselect_all")},get picto(){return r.get(this.name)},execute:()=>i.deselectObjects(e.filter(br("selected")).map(Du)),predicate:()=>e.some(br("selected"))},{name:"selectSimilar",get group(){return t.groupPositions.select},position:3,get label(){return t.$t("context_menu.select_similar")},get picto(){return r.get(this.name)},execute(){const n=e.filter(o=>o.visible&&o.type===this.selectedObject.type&&o.id!==this.selectedObject.id).map(Du);i.selectObjects(n)},selectedObject:null,predicate(){const n=e.filter(zd(br("visible"),br("selected")));return n.length===1&&n[0].type!==void 0?(this.selectedObject=n[0],!0):(this.selectedObject=null,!1)}},{name:"reverseSelection",get label(){return t.$t("context_menu.reverse_selection")},get group(){return t.groupPositions.select},position:4,execute:()=>{const n=new Set(e.filter(br("selected")).map(Du)),o=new Set(e.filter(br("visible")).map(Du));i.selectObjects(Array.from(qDi(o,n)),{exclusive:!0})},predicate:()=>e.some(zd(S0("selected"),br("visible")))&&e.some(zd(br("selected"),br("visible")))},{name:"showAll",get group(){return t.groupPositions.visibility},position:1,get label(){return t.$t("context_menu.show_all")},get picto(){return r.get(this.name)},execute:()=>i.showObjects(e.filter(S0("visible")).map(Du)),predicate:()=>e.some(S0("visible"))},{name:"hide",get group(){return t.groupPositions.visibility},position:2,get label(){return t.$t("context_menu.hide")},get picto(){return r.get(this.name)},objectsToHide:null,execute(){const n=this.objectsToHide.filter(br("selected"));n.length>0&&i.deselectObjects(n.map(Du)),i.hideObjects(this.objectsToHide.map(Du))},predicate(){return this.objectsToHide=e.filter(zd(br("selected"),br("visible"))),this.objectsToHide.length>0}},{name:"hideAll",get group(){return t.groupPositions.visibility},position:3,get label(){return t.$t("context_menu.hide_all")},execute:()=>{const n=e.filter(br("visible"));n.some(br("selected"))&&i.deselectObjects(n.filter(br("selected")).map(Du)),i.hideObjects(n.map(Du))},predicate:()=>e.some(br("visible"))}].filter(n=>n.predicate()),QDi={components:{LiWrapper:zDi},inject:["$viewer"],data(){return{defaultPrevented:!1,displayed:!1,top:null,bottom:null,left:null,width:200,nextCommandId:1,currentCommands:[],contextCommands:[],registeredCommands:[],groupPositions:{select:10,visibility:20},asyncPredicateRunning:!1}},computed:{position(){return{top:this.top?this.top+"px":"unset",bottom:this.bottom?this.bottom+"px":"unset",left:this.left+"px",width:this.width+"px"}}},watch:{displayed(t){t?document.addEventListener("keydown",this.onKeyDown):document.removeEventListener("keydown",this.onKeyDown)}},created(){this.$viewer.contextMenu=this,this.asyncPredicates=new Set},methods:{onKeyDown(t){t.key==="Escape"&&this.away()},setPosition(t){const e=(document.fullscreenElement?document.fullscreenElement:this.$parent.$el).getBoundingClientRect();this.left=t.clientX-e.left,this.top=t.clientY-e.top,this.left+this.width>e.width&&(this.left=this.left-this.width),t.clientY>e.top+e.height/2?(this.bottom=e.height-this.top,this.top=null):this.bottom=null},typeCheckCommand(t={}){let e=null;if((!t.execute||typeof t.execute!="function")&!t.component&&(e="Cannot register context menu command. A command must have an execute function or a component property."),t.label||(e="Cannot register context menu command. A command must have a label."),e)throw console.error(e),new Error(e);return t.id=this.nextCommandId++,t},open(t){this.currentCommands=[],this.setPosition(t),this.originEvent=t,t.preventDefault(),this.setCurrentCommands(),this.groupCurrentCommands(),this.defaultPrevented=!1,this.displayed=!0,document.fullscreenElement?(this.$el.parentElement.removeChild(this.$el),this.adoptiveParent=document.fullscreenElement,this.adoptiveParent.appendChild(this.$el)):this.adoptiveParent&&this.adoptiveParent!==this.$viewer.globalContext.el&&(this.adoptiveParent.removeChild(this.$el),this.$viewer.globalContext.el.appendChild(this.$el),this.adoptiveParent=null)},setCurrentCommands(){this.asyncPredicates.clear(),this.asyncPredicateRunning=!1,this.defaultPrevented||this.registeredCommands.forEach(async t=>{if(typeof t.predicate=="function"){const e=t.predicate(this.$viewer.globalContext.activeLocalContext);if(e===!0)this.currentCommands.push(t);else if(typeof e?.then=="function"){this.asyncPredicates.add(e),this.asyncPredicateRunning=!0;const i=await e;this.asyncPredicates.has(e)&&(this.asyncPredicates.delete(e),this.asyncPredicateRunning=this.asyncPredicates.size>0,i===!0&&this.currentCommands.push(t))}}else this.currentCommands.push(t)}),this.currentCommands.push(...this.contextCommands),this.contextCommands=[]},getDefaultCommands({objects:t=[],state:e=this.$viewer.state,context:i=null}){const r=new Map;return i&&this.$viewer.shortcutManager.getShortcuts(i).forEach(n=>r.set(n.name,n.key)),GDi({contextMenu:this,objects:t,state:e,pictos:r})},executeCommand(t){if(t.execute&&(t.execute(this.originEvent),this.displayed=!1),t.component&&!t.menu)throw new Error("Command with component property must have a `menu` property")},away(){this.displayed=!1},groupCurrentCommands(){const t=new Map;this.currentCommands.forEach(i=>{(i.group===null||i.group===void 0)&&(i.group=0),t.has(i.group)?t.get(i.group).push(i):t.set(i.group,[i])}),t.forEach(i=>i.sort((r,n)=>(r.position=r.position||0,n.position=n.position||0,r.position-n.position)));const e=[...t.keys()].sort((i,r)=>i-r).map(i=>t.get(i)).flat();this.currentCommands=e},isGroupIntersection(t){if(t===0)return!1;const e=this.currentCommands[t-1],i=this.currentCommands[t];return e.group<i.group},registerContextCommand(t){const e=this.typeCheckCommand(t);return this.contextCommands.push(e),t.id},registerCommand(t){const e=this.typeCheckCommand(t);return this.registeredCommands.push(e),t.id},unregisterCommand(t){return this.registeredCommands.find(e=>e.id===t)?(this.registeredCommands=this.registeredCommands.filter(e=>e.id!==t),!0):!1},preventDefault(){this.defaultPrevented=!0}}},KDi={key:0,class:"separator"},WDi={class:"menu-text"},JDi={key:1,class:"menu-picto"},ZDi={key:0,class:"context-menu__spinner"};function XDi(t,e,i,r,n,o){const s=D("BIMDataIconChevron"),a=D("LiWrapper"),l=D("BIMDataSpinner"),c=Ki("click-away");return n.displayed&&(n.currentCommands.length||n.asyncPredicateRunning)?Ft((P(),F("ul",{key:0,class:"bimdata-list context-menu",style:Ee(o.position)},[(P(!0),F(lt,null,zt(n.currentCommands,(d,u)=>(P(),Y(a,{key:d.label,class:"context-menu__element",onClick:h=>o.executeCommand(d)},{default:H(()=>[o.isGroupIntersection(u)?(P(),F("div",KDi)):ye("",!0),x("div",WDi,Z(d.label),1),!d.component&&d.picto?(P(),F("span",JDi,Z(d.picto),1)):d.component?(P(),Y(s,{key:2,size:"xxs",class:"fill-primary"})):ye("",!0)]),_:2},1032,["onClick"]))),128)),n.asyncPredicateRunning?(P(),F("li",ZDi,[R(l)])):ye("",!0)],4)),[[c,o.away]]):ye("",!0)}const YDi=q(QDi,[["render",XDi],["__scopeId","data-v-5b87d4a3"]]),$Di={name:"ViewerHeader",inject:["$viewer"],props:{visible:{type:Boolean,default:!0}},setup(){const t=kt("$viewer"),e=ts(new Map),i=n=>{if(!n.name)throw new TypeError("[Viewer Header] Content must have a name");if(e.has(n.name))throw new Error(`[Viewer Header] Content with name ${n.name} already exists`);e.set(n.name,n)},r=n=>e.has(n)?(e.delete(n),!0):!1;return{logo:t.uiSettings.bimdataLogo!==!1,version:t.uiSettings.version!==!1?t.version:null,headerContent:e,headerRightContentComponents:qe(()=>Array.from(e.values()).filter(n=>n.position==="right").sort((n,o)=>n.order-o.order).map(n=>n.component)),headerLeftContentComponents:qe(()=>Array.from(e.values()).filter(n=>n.position==="left").sort((n,o)=>n.order-o.order).map(n=>n.component)),addContent:i,removeContent:r}}},eRi={class:"viewer-header"},tRi={class:"viewer-header__content"},iRi={class:"viewer-header__content__left"},rRi={class:"viewer-header__content__right"},nRi={key:0,class:"m-l-6 flex items-center"},oRi={key:1,class:"viewer-header__version"};function sRi(t,e,i,r,n,o){const s=D("BIMDataIllustration");return Ft((P(),F("div",eRi,[x("div",tRi,[x("div",iRi,[(P(!0),F(lt,null,zt(r.headerLeftContentComponents,a=>(P(),Y(Tn(a),{key:a.name}))),128))]),x("div",rRi,[(P(!0),F(lt,null,zt(r.headerRightContentComponents,a=>(P(),Y(Tn(a),{key:a.name}))),128))])]),r.logo||r.version?(P(),F("div",nRi,[r.logo?(P(),Y(s,{key:0,name:"logo",width:"30px",height:"30px"})):ye("",!0),r.version?(P(),F("div",oRi,Z(r.version),1)):ye("",!0)])):ye("",!0)],512)),[[hi,i.visible]])}const aRi=q($Di,[["render",sRi],["__scopeId","data-v-5c9ea6b6"]]),lRi={emits:["resize"],setup(t,{emit:e}){return{onResizerMousedown:i=>{i.preventDefault();let r=i.clientX;const n=s=>{s.preventDefault();const a=s.clientX-r;r=s.clientX,e("resize",a)},o=s=>{s.preventDefault(),window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",n),window.addEventListener("mouseup",o)}}}},cRi={class:"bimdata-separator"};function dRi(t,e,i,r,n,o){return P(),F("div",cRi,[e[1]||(e[1]=x("div",{class:"bimdata-separator__line"},null,-1)),x("div",{class:"bimdata-separator__resizer",onMousedown:e[0]||(e[0]=(...s)=>r.onResizerMousedown&&r.onResizerMousedown(...s))},null,32)])}const uRi=q(lRi,[["render",dRi],["__scopeId","data-v-79a3b3af"]]),hRi={components:{Separator:uRi},props:{position:{type:String,required:!0,validator(t){return["left","right"].includes(t)}},sidePanel:{type:Object,required:!0,validator(t){if(t.width&&(typeof t.width!="number"||t.width<0))return console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof t.width}`),!1;const e=typeof t?.component=="object";return e||console.error("[GlobalSidePanel] sidePanel must have a component property"),e}}},setup(t){const e=ke(null),i=ke(t.sidePanel.width??400),r=(n,o=1)=>{const s=i.value+n*o;i.value=Math.max(0,s)};return Et(()=>t.sidePanel,()=>{Object.defineProperty(t.sidePanel,"width",{get(){return i.value},set(n){if(typeof n!="number"||n<=0){console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof n}`);return}i.value=n}}),Object.defineProperty(t.sidePanel,"componentInstance",{get(){return e.value},enumerable:!0})},{immediate:!0}),{componentInstance:e,width:i,onResize:r}}},pRi={class:"bimdata-global-side-panel__component"};function fRi(t,e,i,r,n,o){const s=D("Separator");return P(),F("div",{class:"bimdata-global-side-panel",style:Ee(`width: ${r.width}px`)},[i.sidePanel.resizable&&i.position==="right"?(P(),Y(s,{key:0,onResize:e[0]||(e[0]=a=>r.onResize(a,-1))})):ye("",!0),x("div",pRi,[(P(),Y(Tn(i.sidePanel.component),{ref:"componentInstance"},null,512))]),i.sidePanel.resizable&&i.position==="left"?(P(),Y(s,{key:1,onResize:e[1]||(e[1]=a=>r.onResize(a))})):ye("",!0)],4)}const gRi=q(hRi,[["render",fRi],["__scopeId","data-v-82d0d4cb"]]),ARi={name:"BimdataViewer",components:{ContextMenu:YDi,ViewerHeader:aRi,ModalManager:A7e,GlobalSidePanel:gRi},setup(){const t=kt("$viewer"),{globalContext:e,shortcutManager:i}=t;hr(()=>{i&&i.destroy(),e.hub.clear()}),Qi(()=>{t.pluginManager.runPluginsScripts(t)});const r=qe(()=>t.uiSettings.bimdataLogo!==!1&&(e.localContexts.length!==1||e.localContexts[0].window?.logoAndVersion)),n=qe(()=>t.uiSettings.version!==!1&&(e.localContexts.length!==1||e.localContexts[0].window?.logoAndVersion)?t.version:null),o=qe(()=>e.leftSidePanel),s=qe(()=>e.rightSidePanel),a=qe(()=>{const p=t.uiSettings.header!==!1,g=e.localContexts.length===1&&e.localContexts[0].window?.header===!1,f=!!(o.value||s.value);return p&&(!g||f)}),l=t.uiSettings.contextMenu!==!1,c=ke(null);function d(p){l&&c.value.open(p)}function u(){t.shortcutManager.active=!0}function h(){t.shortcutManager.active=!1}return{Layout:t.layout.areas.component,onContextMenu:d,onMouseenter:u,onMouseleave:h,isHeaderVisible:a,viewerTemplateRef:e.templateRef,modalManagerTemplateRef:e.modalManagerTemplateRef,headerTemplateRef:e.headerTemplateRef,contextMenuTemplateRef:c,contextMenuEnabled:l,bimdataLogoOnSingleWindow:r,viewerVersionOnSingleWindow:n,version:t.version,loading:qe(()=>e.loading),spinner:qe(()=>e.spinner),leftSidePanel:o,rightSidePanel:s}}},mRi={key:1,class:"bimdata-context-loading-overlay",style:{"z-index":"3"}},vRi={key:2,class:"viewer__logo"},yRi={key:1,class:"version m-t-6"};function bRi(t,e,i,r,n,o){const s=D("ModalManager"),a=D("ContextMenu"),l=D("ViewerHeader"),c=D("GlobalSidePanel"),d=D("BIMDataSpinner"),u=D("BIMDataIllustration");return P(),F("div",{id:"bimdata-viewer",ref:"viewerTemplateRef",class:"bimdata-viewer bimdata-design-system bimdata-scrollbar",onContextmenu:e[0]||(e[0]=(...h)=>r.onContextMenu&&r.onContextMenu(...h)),onMouseenter:e[1]||(e[1]=(...h)=>r.onMouseenter&&r.onMouseenter(...h)),onMouseleave:e[2]||(e[2]=(...h)=>r.onMouseleave&&r.onMouseleave(...h))},[R(s,{ref:"modalManagerTemplateRef"},null,512),r.contextMenuEnabled?(P(),Y(a,{key:0,ref:"contextMenuTemplateRef"},null,512)):ye("",!0),R(l,{ref:"headerTemplateRef",visible:r.isHeaderVisible},null,8,["visible"]),x("div",{class:"bimdata-viewer__content",style:Ee(r.isHeaderVisible?"height: calc(100% - var(--bimdata-viewer-header-height, 40px))":"height: 100%")},[r.leftSidePanel?(P(),Y(c,{key:0,"side-panel":r.leftSidePanel,position:"left"},null,8,["side-panel"])):ye("",!0),(P(),Y(Tn(r.Layout),{style:"height: 100%; flex-grow: 1;"})),r.rightSidePanel?(P(),Y(c,{key:1,"side-panel":r.rightSidePanel,position:"right"},null,8,["side-panel"])):ye("",!0)],4),r.loading?(P(),F("div",mRi,[r.spinner&&r.spinner.component?(P(),Y(Tn(r.spinner.component),uc(Ba({key:0},r.spinner.props)),null,16)):(P(),Y(d,{key:1,size:"40px",border:"5px"}))])):ye("",!0),!r.isHeaderVisible&&(r.bimdataLogoOnSingleWindow||r.viewerVersionOnSingleWindow)?(P(),F("div",vRi,[r.bimdataLogoOnSingleWindow?(P(),Y(u,{key:0,name:"logo"})):ye("",!0),r.viewerVersionOnSingleWindow?(P(),F("div",yRi,Z(r.version),1)):ye("",!0)])):ye("",!0)],544)}const wRi=q(ARi,[["render",bRi],["__scopeId","data-v-0c1c941a"]]),CRi=["src"],xRi={class:"bimdata-models__header"},kRi={key:0,class:"bimdata-models__header__loader"},MRi={class:"bimdata-models__header__picto"},ERi={class:"bimdata-models__header__name"},BRi={key:0,class:"bimdata-models__header__name--empty"},PRi={key:1,class:"bimdata-models__header__name--empty"},IRi={key:3},SRi=["onMousemove","onClick"],TRi={__name:"Models",props:{preview:{type:Boolean,default:!1},windowPositioning:{type:Boolean,default:!0},customFilter:{type:Function,default:null},width:{type:String,default:"350px"}},setup(t){const e=t,i=kt("$viewer"),r=ke(),n=ke(0),o=ke(0),s=ke(),a=nr([]),l=ke(!1),c=qe(()=>i.localContext.loadedModels),d=qe(()=>i.localContext.loadedModelIds),u=qe(()=>i.localContext.loadingModelIds),h=qe(()=>i.localContext.multiModel),p=qe(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(C=>c.value.find(M=>M.document?.head_id!=null&&M.document.head_id===C.document.id)??C)),g=C=>d.value.includes(C),f=C=>u.value.includes(C),m=qe(()=>{const{x:C,y:M}=s.value?.getBoundingClientRect()??{x:0,y:0};return`top:${o.value-M}px; left:${n.value-C}px;`}),A=C=>{!h.value&&g(C.id)||u.value.length>0||(i.localContext.loadedModelIds.includes(C.id)?i.localContext.unloadModels([C.id]):i.localContext.loadModels([C.id]))},y=C=>{switch(C){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},v=(C,M)=>{C?.viewer_360_file&&(n.value=M.clientX,o.value=M.clientY),r.value=C?.viewer_360_file},b=async C=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,C)).filter(M=>i.state.models.some(E=>E.archived)||!M.archived).sort(su("updated_at",!1))}catch(M){console.error("[Models] Cannot get project models. Error: ",M)}finally{l.value=!1}return[]},w=C=>C.children?.some(M=>g(M.id))??!1;return b(i.localContext.modelTypes).then(C=>{a.value=C}),(C,M)=>{const E=D("BIMDataSpinner"),B=D("BIMDataIconModel3D"),S=D("BIMDataTextbox"),I=D("BIMDataCheckbox"),T=D("BIMDataRadio"),L=D("BIMDataIcon"),O=D("BIMDataDropdownList");return P(),F("div",{ref_key:"templateRef",ref:s,class:Me(["bimdata-models",{"bimdata-models--window-positioning":t.windowPositioning}])},[r.value?(P(),F("div",{key:0,class:"bimdata-models__preview",style:Ee(m.value)},[x("img",{src:r.value},null,8,CRi)],4)):ye("",!0),R(O,{style:Ee(`--bimdata-models-width: ${t.width};`),width:t.width,list:p.value,"element-key":"id","per-page":40,loading:l.value,class:"bimdata-models__list",disabled:p.value.length===0,onElementClick:A},{header:H(({isOpen:j})=>[x("div",xRi,[l.value||u.value.length>0?(P(),F("div",kRi,[R(E)])):(P(),F(lt,{key:1},[x("div",MRi,[R(B)]),x("div",{class:Me(["bimdata-models__header__number bimdata-info-length",{"bimdata-models__header__number--empty":d.value.length===0}])},[x("span",null,Z(d.value.length),1)],2),x("div",ERi,[p.value.length===0?(P(),F("span",BRi,Z(C.$t("model.no_model")),1)):d.value.length===0?(P(),F("span",PRi,Z(C.$t("model.no_loaded_model")),1)):d.value.length===1?(P(),Y(S,{key:2,text:c.value[0].name,tooltip:!j},null,8,["text","tooltip"])):d.value.length>1?(P(),F("span",IRi,Z(C.$t("model.selected_models")),1)):ye("",!0)])],64))])]),element:H(({element:j,close:N})=>[x("div",{class:"bimdata-models__model",onMousemove:z=>t.preview&&v(j,z),onMouseout:M[0]||(M[0]=z=>t.preview&&v()),onClick:()=>{!h.value&&!g(j.id)&&N()}},[h.value?(P(),Y(I,{key:0,"model-value":g(j.id)||w(j),disabled:j.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])):(P(),Y(T,{key:1,"model-value":g(j.id)||w(j),disabled:j.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])),R(L,{margin:"0 calc(var(--spacing-unit) / 2)",name:y(j.status),size:"xs",class:Me({"fill-success":j.status==="C","fill-high":j.status==="E"})},null,8,["name","class"]),R(S,{class:Me({"bimdata-models__model__name":!0,"bimdata-models__model__name--disabled":j.status!=="C"||u.value.length>0}),text:j.name,width:`calc(100% -
5318
5318
  ${h.value?13:23}px - 2 * 6px - 16px)`},null,8,["class","text","width"]),j.document&&!j.document.is_head_version?(P(),Y(L,{key:2,name:"versioning",fill:"",color:"default",size:"xs",margin:"0 0 0 6px"})):ye("",!0)],40,SRi),f(j.id)?(P(),Y(E,{key:0,class:"bimdata-models__model__spinner"})):ye("",!0)]),_:1},8,["style","width","list","loading","disabled"])],2)}}},w7e=q(TRi,[["__scopeId","data-v-34c2cf79"]]),DRi="data:image/svg+xml,%3csvg%20width='16'%20height='21'%20viewBox='0%200%2016%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.47193%202.76644C7.65699%202.84439%207.77716%203.02565%207.777%203.22661L7.77339%207.94624C7.77318%208.22238%207.54916%208.44655%207.27301%208.44693L2.4192%208.45366C2.21569%208.45394%202.03258%208.33085%201.95617%208.1424C1.87975%207.95394%201.92528%207.73773%202.07129%207.59566L6.92872%202.86931C7.0729%202.72902%207.28688%202.6885%207.47193%202.76644ZM3.65141%207.45195L6.77378%207.44762L6.7761%204.41157L3.65141%207.45195ZM5.81657%200.893911L6.02338%200.893274L13.3879%200.870595C14.679%200.866619%2015.7208%201.91642%2015.722%203.20083L15.2221%203.20237L15.722%203.20052L15.722%203.20083L15.745%2017.8999L15.745%2017.9002C15.7462%2019.1846%2014.7063%2020.2408%2013.4153%2020.2448L2.35929%2020.2788C1.07114%2020.2828%200.0171799%2019.2362%200.0159721%2017.9486L0.00563138%206.92409L0.00543684%206.71668L0.152103%206.56972L5.67032%201.04045L5.81657%200.893911ZM6.23113%201.89264L1.00582%207.12841L1.01597%2017.9455C1.01666%2018.6791%201.62068%2019.2811%202.35835%2019.2788L13.4143%2019.2448C14.1484%2019.2425%2014.7456%2018.6402%2014.745%2017.9035C14.745%2017.9034%2014.745%2017.9033%2014.745%2017.9033L14.722%203.20423L14.722%203.20391C14.7213%202.46716%2014.123%201.86833%2013.3888%201.87059L6.23113%201.89264Z'%20fill='%232F374A'/%3e%3c/svg%3e",RRi=["src"],LRi={key:0,class:"bimdata-multi-model-loader__header-container"},_Ri={key:0,class:"bimdata-multi-model-loader__header__loader"},FRi={class:"bimdata-multi-model-loader__header__picto"},ORi=["src"],URi={class:"bimdata-multi-model-loader__header__name"},NRi={key:0,class:"bimdata-multi-model-loader__header__name--empty"},jRi={key:1,class:"bimdata-multi-model-loader__header__name--empty"},HRi={key:3},VRi={key:1,class:"bimdata-multi-model-loader__main"},zRi=["onMousemove","onClick"],qRi={__name:"BIMDataMultiModelLoader",props:{preview:{type:Boolean,default:!1},windowPositioning:{type:Boolean,default:!0},customFilter:{type:Function,default:null},width:{type:String,default:"350px"}},setup(t){const e=t,i=kt("$viewer"),r=ke(),n=ke(0),o=ke(0),s=ke(),a=nr([]),l=ke(!1),c=ke(!0),d=T=>{T.key==="Escape"?c.value=!0:T.key==="Enter"&&E()};Et(c,T=>{T?(window.removeEventListener("keydown",d),v.clear(),y.clear(),r.value=null):window.addEventListener("keydown",d)});const u=qe(()=>i.localContext.loadedModels),h=qe(()=>i.localContext.loadedModelIds),p=qe(()=>i.localContext.loadingModelIds),g=qe(()=>i.localContext.multiModel),f=qe(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(T=>u.value.find(L=>L.document?.head_id!=null&&L.document.head_id===T.document.id)??T)),m=T=>h.value.includes(T),A=T=>p.value.includes(T),y=ts(new Set),v=ts(new Set),b=T=>T.children?.some(L=>m(L.id))??!1,w=T=>(m(T.id)||b(T)||y.has(T))&&!v.has(T),C=qe(()=>{const{x:T,y:L}=s.value.getBoundingClientRect();return`top:${o.value-L}px; left:${n.value-T}px;`}),M=T=>{T.status==="C"&&(!g.value&&m(T.id)||(m(T.id)?v.has(T)?v.delete(T):v.add(T):y.has(T)?y.delete(T):y.add(T)))},E=()=>{y.size>0&&i.localContext.loadModels(Array.from(y).map(T=>T.id)),v.size>0&&i.localContext.unloadModels(Array.from(v).map(T=>T.id)),c.value=!0},B=T=>{switch(T){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},S=T=>T.document&&!T.document.is_head_version,I=(T,L)=>{!e.preview||c.value||(T?.viewer_360_file&&(n.value=L.clientX,o.value=L.clientY),r.value=T?.viewer_360_file)};return(async T=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,T)).filter(L=>i.state.models.some(O=>O.archived)||!L.archived).sort(su("updated_at",!1))}catch(L){console.error("[Models] Cannot get project models. Error: ",L)}finally{l.value=!1}return[]})(i.localContext.modelTypes).then(T=>{a.value=T}),(T,L)=>{const O=D("BIMDataSpinner"),j=D("BIMDataTextbox"),N=D("BIMDataIconChevron"),z=D("BIMDataButton"),G=D("BIMDataIconFileIfcPolychrome"),X=D("BIMDataCheckbox"),me=D("BIMDataRadio"),le=D("BIMDataIcon"),Ce=D("BIMDataPaginatedList"),Te=Ki("click-away");return P(),F("div",{ref_key:"templateRef",ref:s,class:Me(["bimdata-multi-model-loader",{"bimdata-multi-model-loader--window-positioning":t.windowPositioning}])},[r.value?(P(),F("div",{key:0,class:"bimdata-multi-model-loader__preview",style:Ee(C.value)},[x("img",{src:r.value},null,8,RRi)],4)):ye("",!0),R(er,{name:"fade",mode:"out-in"},{default:H(()=>[c.value?(P(),F("div",LRi,[St(T.$slots,"left",{},void 0,!0),x("div",{class:"bimdata-multi-model-loader__header",onClick:L[0]||(L[0]=ue=>c.value=!1)},[l.value||p.value.length>0?(P(),F("div",_Ri,[R(O)])):(P(),F(lt,{key:1},[x("div",FRi,[x("img",{src:ft(DRi),alt:"file icon"},null,8,ORi)]),x("div",{class:Me(["bimdata-multi-model-loader__header__number bimdata-info-length",{"bimdata-multi-model-loader__header__number--empty":h.value.length===0}])},[x("span",null,Z(h.value.length),1)],2),x("div",URi,[f.value.length===0?(P(),F("span",NRi,Z(T.$t("model.no_model")),1)):h.value.length===0?(P(),F("span",jRi,Z(T.$t("model.no_loaded_model")),1)):h.value.length===1?(P(),Y(j,{key:2,text:u.value[0].name,tooltip:c.value,width:"233px"},null,8,["text","tooltip"])):h.value.length>1?(P(),F("span",HRi,Z(T.$t("model.selected_models")),1)):ye("",!0)]),R(z,{color:"default",icon:"",radius:"",fill:"",width:"21px",height:"21px"},{default:H(()=>[R(N,{size:"xxxs"})]),_:1})],64))]),St(T.$slots,"right",{},void 0,!0)])):Ft((P(),F("div",VRi,[R(Ce,{list:f.value,"per-page":10},{element:H(({element:ue})=>[x("div",{class:Me(["bimdata-multi-model-loader__main__model",{"bimdata-multi-model-loader__main__model--disabled":ue.status!=="C"}]),onMousemove:ee=>I(ue,ee),onMouseout:L[1]||(L[1]=ee=>I()),onClick:ee=>M(ue)},[R(G,{fill:"",color:"default",size:"xs"}),g.value?(P(),Y(X,{key:0,"model-value":w(ue),disabled:ue.status!=="C"},null,8,["model-value","disabled"])):(P(),Y(me,{key:1,"model-value":w(ue),disabled:ue.status!=="C"},null,8,["model-value","disabled"])),R(j,{class:Me({"bimdata-multi-model-loader__main__model__name":!0,"bimdata-multi-model-loader__main__model__name--disabled":ue.status!=="C"}),text:ue.name,width:S(ue)?"333px":"363px"},null,8,["class","text","width"]),S(ue)?(P(),Y(le,{key:2,name:"versioning",fill:"",color:"default",size:"xs",margin:"0 0 0 6px"})):ye("",!0),A(ue.id)?(P(),Y(O,{key:3,class:"bimdata-multi-model-loader__main__model__spinner"})):(P(),Y(le,{key:4,name:B(ue.status),size:"xs",class:Me({"fill-success":ue.status==="C","fill-high":ue.status==="E"})},null,8,["name","class"]))],42,zRi)]),_:1},8,["list"]),R(z,{class:"bimdata-multi-model-loader__main__validate",width:"93px",color:"primary",fill:"",radius:"",disabled:ft(y).size===0&&ft(v).size===0,onClick:E},{default:H(()=>[rt(Z(T.$t("global.validate")),1)]),_:1},8,["disabled"])])),[[Te,()=>c.value=!0]])]),_:3})],2)}}},GRi=q(qRi,[["__scopeId","data-v-44e6af66"]]),QRi={data(){return{shown:!1}},mounted(){setTimeout(()=>{this.shown=!0},500)}};function KRi(t,e,i,r,n,o){const s=D("BIMDataIllustration");return P(),F("div",{class:"bimdata__no-model",style:Ee({"--no-model--opacity":n.shown?1:0})},[R(s,{name:"emptyViewer",x:"90",y:"90"}),x("span",null,Z(t.$t("model.select_model")),1)],4)}const C7e=q(QRi,[["render",KRi],["__scopeId","data-v-5ffd9bc0"]]);window.BIMDataViewerVue=zY;class WRi{constructor(e={}){const{api:i={},ui:r}=e;this.uiCfg=r,i.apiUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `apiUrl` not set, use 'https://api.bimdata.io' by default."),i.apiUrl="https://api.bimdata.io"),i.archiveUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `archiveUrl` not set, use 'https://archive.bimdata.io' by default."),i.archiveUrl="https://archive.bimdata.io"),i.pdfBackendUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `pdfBackendUrl` not set, use 'https://pdf-backend.bimdata.io' by default."),i.pdfBackendUrl="https://pdf-backend.bimdata.io"),i.ifcIds&&(console.warn("[BIMData Viewer] DEPRECATED - Viewer config - please use the `modelIds` property instead of `ifcIds`."),i.modelIds===void 0&&(i.modelIds=i.ifcIds)),i.modelIds||(i.modelIds=[]),i.offline?.dataFile&&(i.offline.data=i.offline.dataFile),this.$viewer=new tDi(e),i.offline?.enabled?this.$viewer.api.enableOfflineMode(i.offline.data,i.offline.options).then(()=>this.state.loadModels(i.modelIds)):(this.$viewer.globalContext.loadingProcessStart(),this.state.loadModels(i.modelIds).finally(()=>this.$viewer.globalContext.loadingProcessEnd())),this.vueApp=null}get state(){return this.$viewer.state}get api(){return this.$viewer.api}async mount(e,i="3d"){const{$viewer:r}=this;await r.api.ready;try{const d=await r.api.apiClient.collaborationApi.checkProjectAccess(r.api.cloudId,r.api.projectId);r.api.permissions=b7e(d)}catch{r.api.permissions=b7e()}const n=this.api.accessToken,{i18n:o}=r;o.registerTranslations(r.pluginManager.pluginTranslations),r.layout.apply(i);const s={i18n:o.i18nVuePlugin,data(){return{accessToken:n}},render(){return so(wRi,{style:"height: 100%"})}},a=w8(s).use(o.i18nVuePlugin).use(VDi()).use(NDi({i18nPlugin:o.i18nVuePlugin})).use(ADi({apiClient:r.api.apiClient,i18nPlugin:o.i18nVuePlugin}));a.provide("$viewer",r),a.provide("BIMDATA_DESIGN_SYSTEM_DARK_THEME",qe(()=>r.darkTheme)),a.component("BIMDataModelLoader",w7e),a.component("BIMDataMultiModelLoader",GRi),a.component("BIMDataNoModelWindowPlaceHolder",C7e),a.component("BIMDataStoreySelector",SF),a.component("ModelsLoader",w7e),a.component("NoModelWindowPlaceHolder",C7e);const l=e instanceof HTMLElement?e:document.querySelector(e);l&&(l.style.height="100%");const c=a.mount(e);return c.$viewer=r,iDi(c.$el,this.uiCfg?.style),typeof window<"u"&&(window.bimdataViewer=c),this.vueApp=a,c}destroy(){this.vueApp?.unmount()}setLocale(e){if(!s$.includes(e))throw new Error(`Viewer available locales are ${s$.join(", ")}.`);this.$viewer.i18n.locale=e}registerPlugin(e){this.$viewer.registerPlugin(e)}registerWindow(e){return this.$viewer.windowManager.registerWindow(e)}unregisterWindow(e){return this.$viewer.windowManager.unregisterWindow(e)}setAccessToken(e){this.api.accessToken=e}async loadModels(e){this.$viewer.globalContext.loadingProcessStart();const i=await this.state.loadModels(e);return this.$viewer.globalContext.loadingProcessEnd(),i}loadIfcs(e){return console.warn("[BIMData Viewer] DEPRECATED - Viewer - please use the loadModels method instead of loadIfcs."),this.loadModels(e)}}const x7e=(t={})=>new WRi(t);window.makeBIMDataViewer=x7e;const za=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),xq=[.001,0,0,.001,0,0],kq=1.35,ec={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},e0={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},xy="pdfjs_internal_editor_",qi={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Cr={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},JRi={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Mq={TRIANGLES:1,LATTICE:2},Zo={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},bP={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Uo={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},J5={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},wP={ERRORS:0,WARNINGS:1,INFOS:5},ky={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},My={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},ZRi={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let CP=wP.WARNINGS;function XRi(t){Number.isInteger(t)&&(CP=t)}function YRi(){return CP}function xP(t){CP>=wP.INFOS&&console.info(`Info: ${t}`)}function Hi(t){CP>=wP.WARNINGS&&console.warn(`Warning: ${t}`)}function yn(t){throw new Error(t)}function xr(t,e){t||yn(e)}function $Ri(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function k7e(t,e=null,i=null){if(!t)return null;if(i&&typeof t=="string"&&(i.addDefaultProtocol&&t.startsWith("www.")&&t.match(/\./g)?.length>=2&&(t=`http://${t}`),i.tryConvertEncoding))try{t=nLi(t)}catch{}const r=e?URL.parse(t,e):URL.parse(t);return $Ri(r)?r:null}function M7e(t,e,i=!1){const r=URL.parse(t);return r?(r.hash=e,r.href):i&&k7e(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Vi(t,e,i,r=!1){return Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}const sg=(function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t})();let E7e=class extends sg{constructor(t,e){super(t,"PasswordException"),this.code=e}},Eq=class extends sg{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},Bq=class extends sg{constructor(t){super(t,"InvalidPDFException")}},kP=class extends sg{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}},eLi=class extends sg{constructor(t){super(t,"FormatError")}},t0=class extends sg{constructor(t){super(t,"AbortException")}};function B7e(t){(typeof t!="object"||t?.length===void 0)&&yn("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const r=[];for(let n=0;n<e;n+=i){const o=Math.min(n+i,e),s=t.subarray(n,o);r.push(String.fromCharCode.apply(null,s))}return r.join("")}function Ey(t){typeof t!="string"&&yn("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let r=0;r<e;++r)i[r]=t.charCodeAt(r)&255;return i}function tLi(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function iLi(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function rLi(){try{return new Function(""),!0}catch{return!1}}class Xo{static get isLittleEndian(){return Vi(this,"isLittleEndian",iLi())}static get isEvalSupported(){return Vi(this,"isEvalSupported",rLi())}static get isOffscreenCanvasSupported(){return Vi(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Vi(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Vi(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Vi(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){const{platform:e,userAgent:i}=navigator;return Vi(this,"platform",{isAndroid:i.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:i.includes("Firefox")})}static get isCSSRoundSupported(){return Vi(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const Pq=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));let Yt=class{static makeHexColor(t,e,i){return`#${Pq[t]}${Pq[e]}${Pq[i]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,i=0){const r=t[i],n=t[i+1];t[i]=r*e[0]+n*e[2]+e[4],t[i+1]=r*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){const r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5];for(let c=0;c<6;c+=2){const d=t[i+c],u=t[i+c+1];t[i+c]=d*r+u*o+a,t[i+c+1]=d*n+u*s+l}}static applyInverseTransform(t,e){const i=t[0],r=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-r*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-i*e[1]+r*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,i){const r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=t[0],d=t[1],u=t[2],h=t[3];let p=r*c+a,g=p,f=r*u+a,m=f,A=s*d+l,y=A,v=s*h+l,b=v;if(n!==0||o!==0){const w=n*c,C=n*u,M=o*d,E=o*h;p+=M,m+=M,f+=E,g+=E,A+=w,b+=w,v+=C,y+=C}i[0]=Math.min(i[0],p,f,g,m),i[1]=Math.min(i[1],A,v,y,b),i[2]=Math.max(i[2],p,f,g,m),i[3]=Math.max(i[3],A,v,y,b)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const i=t[0],r=t[1],n=t[2],o=t[3],s=i**2+r**2,a=i*n+r*o,l=n**2+o**2,c=(s+l)/2,d=Math.sqrt(c**2-(s*l-a**2));e[0]=Math.sqrt(c+d||1),e[1]=Math.sqrt(c-d||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),r=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>r)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),o=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>o?null:[i,n,r,o]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,r,n){n[0]=Math.min(n[0],t,i),n[1]=Math.min(n[1],e,r),n[2]=Math.max(n[2],t,i),n[3]=Math.max(n[3],e,r)}static#e(t,e,i,r,n,o,s,a,l,c){if(l<=0||l>=1)return;const d=1-l,u=l*l,h=u*l,p=d*(d*(d*t+3*l*e)+3*u*i)+h*r,g=d*(d*(d*n+3*l*o)+3*u*s)+h*a;c[0]=Math.min(c[0],p),c[1]=Math.min(c[1],g),c[2]=Math.max(c[2],p),c[3]=Math.max(c[3],g)}static#t(t,e,i,r,n,o,s,a,l,c,d,u){if(Math.abs(l)<1e-12){Math.abs(c)>=1e-12&&this.#e(t,e,i,r,n,o,s,a,-d/c,u);return}const h=c**2-4*d*l;if(h<0)return;const p=Math.sqrt(h),g=2*l;this.#e(t,e,i,r,n,o,s,a,(-c+p)/g,u),this.#e(t,e,i,r,n,o,s,a,(-c-p)/g,u)}static bezierBoundingBox(t,e,i,r,n,o,s,a,l){l[0]=Math.min(l[0],t,s),l[1]=Math.min(l[1],e,a),l[2]=Math.max(l[2],t,s),l[3]=Math.max(l[3],e,a),this.#t(t,i,n,s,e,r,o,a,3*(-t+3*(i-n)+s),6*(t-2*i+n),3*(i-t),l),this.#t(t,i,n,s,e,r,o,a,3*(-e+3*(r-o)+a),6*(e-2*r+o),3*(r-e),l)}};function nLi(t){return decodeURIComponent(escape(t))}let Iq=null,P7e=null;function oLi(t){return Iq||(Iq=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,P7e=new Map([["\uFB05","\u017Ft"]])),t.replaceAll(Iq,(e,i,r)=>i?i.normalize("NFKC"):P7e.get(r))}function I7e(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),B7e(t)}const Z5="pdfjs_internal_id_";function sLi(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;const[r,n,...o]=i;if(!t(r)&&!Number.isInteger(r)||!e(n))return!1;const s=o.length;let a=!0;switch(n.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return s===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(s!==4)return!1;a=!1;break;default:return!1}for(const l of o)if(!(typeof l=="number"||a&&l===null))return!1;return!0}function qa(t,e,i){return Math.min(Math.max(t,e),i)}function S7e(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(B7e(t))}function aLi(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):Ey(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(i=>{i(t(...e))})}),typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,i)=>e+i,0)});class Kb{static textContent(e){const i=[],r={items:i,styles:Object.create(null)};function n(o){if(!o)return;let s=null;const a=o.name;if(a==="#text")s=o.value;else if(Kb.shouldBuildText(a))o?.attributes?.textContent?s=o.attributes.textContent:o.value&&(s=o.value);else return;if(s!==null&&i.push({str:s}),!!o.children)for(const l of o.children)n(l)}return n(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}class T7e{static setupStorage(e,i,r,n,o){const s=n.getValue(i,{value:null});switch(r.name){case"textarea":if(s.value!==null&&(e.textContent=s.value),o==="print")break;e.addEventListener("input",a=>{n.setValue(i,{value:a.target.value})});break;case"input":if(r.attributes.type==="radio"||r.attributes.type==="checkbox"){if(s.value===r.attributes.xfaOn?e.setAttribute("checked",!0):s.value===r.attributes.xfaOff&&e.removeAttribute("checked"),o==="print")break;e.addEventListener("change",a=>{n.setValue(i,{value:a.target.checked?a.target.getAttribute("xfaOn"):a.target.getAttribute("xfaOff")})})}else{if(s.value!==null&&e.setAttribute("value",s.value),o==="print")break;e.addEventListener("input",a=>{n.setValue(i,{value:a.target.value})})}break;case"select":if(s.value!==null){e.setAttribute("value",s.value);for(const a of r.children)a.attributes.value===s.value?a.attributes.selected=!0:a.attributes.hasOwnProperty("selected")&&delete a.attributes.selected}e.addEventListener("input",a=>{const l=a.target.options,c=l.selectedIndex===-1?"":l[l.selectedIndex].value;n.setValue(i,{value:c})});break}}static setAttributes({html:e,element:i,storage:r=null,intent:n,linkService:o}){const{attributes:s}=i,a=e instanceof HTMLAnchorElement;s.type==="radio"&&(s.name=`${s.name}-${n}`);for(const[l,c]of Object.entries(s))if(c!=null)switch(l){case"class":c.length&&e.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!a||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,c)}a&&o.addLinkAttributes(e,s.href,s.newWindow),r&&s.dataId&&this.setupStorage(e,s.dataId,i,r)}static render(e){const i=e.annotationStorage,r=e.linkService,n=e.xfaHtml,o=e.intent||"display",s=document.createElement(n.name);n.attributes&&this.setAttributes({html:s,element:n,intent:o,linkService:r});const a=o!=="richText",l=e.div;if(l.append(s),e.viewport){const u=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=u}a&&l.setAttribute("class","xfaLayer xfaFont");const c=[];if(n.children.length===0){if(n.value){const u=document.createTextNode(n.value);s.append(u),a&&Kb.shouldBuildText(n.name)&&c.push(u)}return{textDivs:c}}const d=[[n,-1,s]];for(;d.length>0;){const[u,h,p]=d.at(-1);if(h+1===u.children.length){d.pop();continue}const g=u.children[++d.at(-1)[1]];if(g===null)continue;const{name:f}=g;if(f==="#text"){const A=document.createTextNode(g.value);c.push(A),p.append(A);continue}const m=g?.attributes?.xmlns?document.createElementNS(g.attributes.xmlns,f):document.createElement(f);if(p.append(m),g.attributes&&this.setAttributes({html:m,element:g,storage:i,intent:o,linkService:r}),g.children?.length>0)d.push([g,-1,m]);else if(g.value){const A=document.createTextNode(g.value);a&&Kb.shouldBuildText(f)&&c.push(A),m.append(A)}}for(const u of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const i=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=i,e.div.hidden=!1}}const d1="http://www.w3.org/2000/svg";class X5{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function By(t,e="text"){if(Py(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,r)=>{const n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(e){case"arraybuffer":case"blob":case"json":i(n.response);return}i(n.responseText);return}r(new Error(n.statusText))}},n.send(null)})}class Wb{constructor({viewBox:e,userUnit:i,scale:r,rotation:n,offsetX:o=0,offsetY:s=0,dontFlip:a=!1}){this.viewBox=e,this.userUnit=i,this.scale=r,this.rotation=n,this.offsetX=o,this.offsetY=s,r*=i;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let d,u,h,p;switch(n%=360,n<0&&(n+=360),n){case 180:d=-1,u=0,h=0,p=1;break;case 90:d=0,u=1,h=1,p=0;break;case 270:d=0,u=-1,h=-1,p=0;break;case 0:d=1,u=0,h=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(h=-h,p=-p);let g,f,m,A;d===0?(g=Math.abs(c-e[1])*r+o,f=Math.abs(l-e[0])*r+s,m=(e[3]-e[1])*r,A=(e[2]-e[0])*r):(g=Math.abs(l-e[0])*r+o,f=Math.abs(c-e[1])*r+s,m=(e[2]-e[0])*r,A=(e[3]-e[1])*r),this.transform=[d*r,u*r,h*r,p*r,g-d*r*l-h*r*c,f-u*r*l-p*r*c],this.width=m,this.height=A}get rawDims(){const e=this.viewBox;return Vi(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:i=this.rotation,offsetX:r=this.offsetX,offsetY:n=this.offsetY,dontFlip:o=!1}={}){return new Wb({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:i,offsetX:r,offsetY:n,dontFlip:o})}convertToViewportPoint(e,i){const r=[e,i];return Yt.applyTransform(r,this.transform),r}convertToViewportRectangle(e){const i=[e[0],e[1]];Yt.applyTransform(i,this.transform);const r=[e[2],e[3]];return Yt.applyTransform(r,this.transform),[i[0],i[1],r[0],r[1]]}convertToPdfPoint(e,i){const r=[e,i];return Yt.applyInverseTransform(r,this.transform),r}}class Sq extends sg{constructor(e,i=0){super(e,"RenderingCancelledException"),this.extraDelay=i}}function MP(t){const e=t.length;let i=0;for(;i<e&&t[i].trim()==="";)i++;return t.substring(i,i+5).toLowerCase()==="data:"}function Tq(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function lLi(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function cLi(t,e="document.pdf"){if(typeof t!="string")return e;if(MP(t))return Hi('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=(s=>{try{return new URL(s)}catch{try{return new URL(decodeURIComponent(s))}catch{try{return new URL(s,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(s),"https://foo.bar")}catch{return null}}}}})(t);if(!i)return e;const r=s=>{try{let a=decodeURIComponent(s);return a.includes("/")?(a=a.split("/").at(-1),a.test(/^\.pdf$/i)?a:s):a}catch{return s}},n=/\.pdf$/i,o=i.pathname.split("/").at(-1);if(n.test(o))return r(o);if(i.searchParams.size>0){const s=Array.from(i.searchParams.values()).reverse();for(const l of s)if(n.test(l))return r(l);const a=Array.from(i.searchParams.keys()).reverse();for(const l of a)if(n.test(l))return r(l)}if(i.hash){const s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(s)return r(s[0])}return e}class D7e{started=Object.create(null);times=[];time(e){e in this.started&&Hi(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Hi(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let i=0;for(const{name:r}of this.times)i=Math.max(r.length,i);for(const{name:r,start:n,end:o}of this.times)e.push(`${r.padEnd(i)} ${o-n}ms
5319
5319
  `);return e.join("")}}function Py(t,e){const i=e?URL.parse(t,e):URL.parse(t);return i?.protocol==="http:"||i?.protocol==="https:"}function Fc(t){t.preventDefault()}function fo(t){t.preventDefault(),t.stopPropagation()}function dLi(t){console.log("Deprecated API usage: "+t)}class Dq{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;this.#e||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const i=this.#e.exec(e);if(!i)return null;const r=parseInt(i[1],10);let n=parseInt(i[2],10);n=n>=1&&n<=12?n-1:0;let o=parseInt(i[3],10);o=o>=1&&o<=31?o:1;let s=parseInt(i[4],10);s=s>=0&&s<=23?s:0;let a=parseInt(i[5],10);a=a>=0&&a<=59?a:0;let l=parseInt(i[6],10);l=l>=0&&l<=59?l:0;const c=i[7]||"Z";let d=parseInt(i[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(i[9],10)||0;return u=u>=0&&u<=59?u:0,c==="-"?(s+=d,a+=u):c==="+"&&(s-=d,a-=u),new Date(Date.UTC(r,n,o,s,a,l))}}function uLi(t,{scale:e=1,rotation:i=0}){const{width:r,height:n}=t.attributes.style,o=[0,0,parseInt(r),parseInt(n)];return new Wb({viewBox:o,userUnit:1,scale:e,rotation:i})}function Iy(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(e=>parseInt(e)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Hi(`Not a valid color format: "${t}"`),[0,0,0])}function hLi(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const i of t.keys()){e.style.color=i;const r=window.getComputedStyle(e).color;t.set(i,Iy(r))}e.remove()}function to(t){const{a:e,b:i,c:r,d:n,e:o,f:s}=t.getTransform();return[e,i,r,n,o,s]}function Ru(t){const{a:e,b:i,c:r,d:n,e:o,f:s}=t.getTransform().invertSelf();return[e,i,r,n,o,s]}function ag(t,e,i=!1,r=!0){if(e instanceof Wb){const{pageWidth:n,pageHeight:o}=e.rawDims,{style:s}=t,a=Xo.isCSSRoundSupported,l=`var(--total-scale-factor) * ${n}px`,c=`var(--total-scale-factor) * ${o}px`,d=a?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,u=a?`round(down, ${c}, var(--scale-round-y))`:`calc(${c})`;!i||e.rotation%180===0?(s.width=d,s.height=u):(s.width=u,s.height=d)}r&&t.setAttribute("data-main-rotation",e.rotation)}class Ju{constructor(){const{pixelRatio:e}=Ju;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,i,r,n,o=-1){let s=1/0,a=1/0,l=1/0;r=Ju.capPixels(r,o),r>0&&(s=Math.sqrt(r/(e*i))),n!==-1&&(a=n/e,l=n/i);const c=Math.min(s,a,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,i){if(i>=0){const r=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+i/100));return e>0?Math.min(e,r):r}return e}}const Rq=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class pLi{static get isDarkMode(){return Vi(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}class fLi{static get commentForegroundColor(){const e=document.createElement("span");e.classList.add("comment","sidebar");const{style:i}=e;i.width=i.height="0",i.display="none",i.color="var(--comment-fg-color)",document.body.append(e);const{color:r}=window.getComputedStyle(e);return e.remove(),Vi(this,"commentForegroundColor",Iy(r))}}function gLi(t,e,i,r){r=Math.min(Math.max(r??1,0),1);const n=255*(1-r);return t=Math.round(t*r+n),e=Math.round(e*r+n),i=Math.round(i*r+n),[t,e,i]}function R7e(t,e){const i=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(i,r,n),s=Math.min(i,r,n),a=(o+s)/2;if(o===s)e[0]=e[1]=0;else{const l=o-s;switch(e[1]=a<.5?l/(o+s):l/(2-o-s),o){case i:e[0]=((r-n)/l+(r<n?6:0))*60;break;case r:e[0]=((n-i)/l+2)*60;break;case n:e[0]=((i-r)/l+4)*60;break}}e[2]=a}function Lq(t,e){const i=t[0],r=t[1],n=t[2],o=(1-Math.abs(2*n-1))*r,s=o*(1-Math.abs(i/60%2-1)),a=n-o/2;switch(Math.floor(i/60)){case 0:e[0]=o+a,e[1]=s+a,e[2]=a;break;case 1:e[0]=s+a,e[1]=o+a,e[2]=a;break;case 2:e[0]=a,e[1]=o+a,e[2]=s+a;break;case 3:e[0]=a,e[1]=s+a,e[2]=o+a;break;case 4:e[0]=s+a,e[1]=a,e[2]=o+a;break;case 5:case 6:e[0]=o+a,e[1]=a,e[2]=s+a;break}}function L7e(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function _7e(t,e,i){Lq(t,i),i.map(L7e);const r=.2126*i[0]+.7152*i[1]+.0722*i[2];Lq(e,i),i.map(L7e);const n=.2126*i[0]+.7152*i[1]+.0722*i[2];return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)}const F7e=new Map;function ALi(t,e){const i=t[0]+t[1]*256+t[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776;let r=F7e.get(i);if(r)return r;const n=new Float32Array(9),o=n.subarray(0,3),s=n.subarray(3,6);R7e(t,s);const a=n.subarray(6,9);R7e(e,a);const l=a[2]<.5,c=l?12:4.5;if(s[2]=l?Math.sqrt(s[2]):1-Math.sqrt(1-s[2]),_7e(s,a,o)<c){let d,u;l?(d=s[2],u=1):(d=0,u=s[2]);const h=.005;for(;u-d>h;){const p=s[2]=(d+u)/2;l===_7e(s,a,o)<c?d=p:u=p}s[2]=l?u:d}return Lq(s,o),r=Yt.makeHexColor(Math.round(o[0]*255),Math.round(o[1]*255),Math.round(o[2]*255)),F7e.set(i,r),r}function O7e({html:t,dir:e,className:i},r){const n=document.createDocumentFragment();if(typeof t=="string"){const o=document.createElement("p");o.dir=e||"auto";const s=t.split(/(?:\r\n?|\n)/);for(let a=0,l=s.length;a<l;++a){const c=s[a];o.append(document.createTextNode(c)),a<l-1&&o.append(document.createElement("br"))}n.append(o)}else T7e.render({xfaHtml:t,div:n,intent:"richText"});n.firstElementChild.classList.add("richText",i),r.append(n)}function U7e(t){const e=new Path2D;if(!t)return e;for(let i=0,r=t.length;i<r;)switch(t[i++]){case My.moveTo:e.moveTo(t[i++],t[i++]);break;case My.lineTo:e.lineTo(t[i++],t[i++]);break;case My.curveTo:e.bezierCurveTo(t[i++],t[i++],t[i++],t[i++],t[i++],t[i++]);break;case My.quadraticCurveTo:e.quadraticCurveTo(t[i++],t[i++],t[i++],t[i++]);break;case My.closePath:e.closePath();break;default:Hi(`Unrecognized drawing path operator: ${t[i-1]}`);break}return e}class Jb{#e=null;#t=null;#r;#i=null;#n=null;#o=null;#s=null;#a=null;static#l=null;constructor(e){this.#r=e,Jb.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"})}render(){const e=this.#e=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const i=this.#r._uiManager._signal;i instanceof AbortSignal&&!i.aborted&&(e.addEventListener("contextmenu",Fc,{signal:i}),e.addEventListener("pointerdown",Jb.#c,{signal:i}));const r=this.#i=document.createElement("div");r.className="buttons",e.append(r);const n=this.#r.toolbarPosition;if(n){const{style:o}=e,s=this.#r._uiManager.direction==="ltr"?1-n[0]:n[0];o.insetInlineEnd=`${100*s}%`,o.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return this.#e}static#c(e){e.stopPropagation()}#h(e){this.#r._focusEventsAllowed=!1,fo(e)}#u(e){this.#r._focusEventsAllowed=!0,fo(e)}#p(e){const i=this.#r._uiManager._signal;return!(i instanceof AbortSignal)||i.aborted?!1:(e.addEventListener("focusin",this.#h.bind(this),{capture:!0,signal:i}),e.addEventListener("focusout",this.#u.bind(this),{capture:!0,signal:i}),e.addEventListener("contextmenu",Fc,{signal:i}),!0)}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden"),this.#n?.shown(),this.#o?.shown()}addDeleteButton(){const{editorType:e,_uiManager:i}=this.#r,r=document.createElement("button");r.classList.add("basic","deleteButton"),r.tabIndex=0,r.setAttribute("data-l10n-id",Jb.#l[e]),this.#p(r)&&r.addEventListener("click",n=>{i.delete()},{signal:i._signal}),this.#i.append(r)}get#A(){const e=document.createElement("div");return e.className="divider",e}async addAltText(e){const i=await e.render();this.#p(i),this.#i.append(i,this.#A),this.#n=e}addComment(e,i=null){if(this.#o)return;const r=e.renderForToolbar();if(!r)return;this.#p(r);const n=this.#s=this.#A;i?(this.#i.insertBefore(r,i),this.#i.insertBefore(n,i)):this.#i.append(r,n),this.#o=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;const i=e.renderButton();this.#p(i),this.#i.append(i,this.#A)}async addEditSignatureButton(e){const i=this.#a=await e.renderEditButton(this.#r);this.#p(i),this.#i.append(i,this.#A)}removeButton(e){e==="comment"&&(this.#o?.removeToolbarCommentButton(),this.#o=null,this.#s?.remove(),this.#s=null)}async addButton(e,i){switch(e){case"colorPicker":i&&this.addColorPicker(i);break;case"altText":i&&await this.addAltText(i);break;case"editSignature":i&&await this.addEditSignatureButton(i);break;case"delete":this.addDeleteButton();break;case"comment":i&&this.addComment(i);break}}async addButtonBefore(e,i,r){if(!i&&e==="comment")return;const n=this.#i.querySelector(r);n&&e==="comment"&&this.addComment(i,n)}updateEditSignatureButton(e){this.#a&&(this.#a.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class mLi{#e=null;#t=null;#r;constructor(e){this.#r=e}#i(){const e=this.#t=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar");const i=this.#r._signal;i instanceof AbortSignal&&!i.aborted&&e.addEventListener("contextmenu",Fc,{signal:i});const r=this.#e=document.createElement("div");return r.className="buttons",e.append(r),this.#r.hasCommentManager()&&this.#o("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#r.commentSelection("floating_button")}),this.#o("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#r.highlightSelection("floating_button")}),e}#n(e,i){let r=0,n=0;for(const o of e){const s=o.y+o.height;if(s<r)continue;const a=o.x+(i?o.width:0);if(s>r){n=a,r=s;continue}i?a>n&&(n=a):a<n&&(n=a)}return[i?1-n:n,r]}show(e,i,r){const[n,o]=this.#n(i,r),{style:s}=this.#t||=this.#i();e.append(this.#t),s.insetInlineEnd=`${100*n}%`,s.top=`calc(${100*o}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#o(e,i,r,n){const o=document.createElement("button");o.classList.add("basic",e),o.tabIndex=0,o.setAttribute("data-l10n-id",i);const s=document.createElement("span");o.append(s),s.className="visuallyHidden",s.setAttribute("data-l10n-id",r);const a=this.#r._signal;a instanceof AbortSignal&&!a.aborted&&(o.addEventListener("contextmenu",Fc,{signal:a}),o.addEventListener("click",n,{signal:a})),this.#e.append(o)}}function N7e(t,e,i){for(const r of i)e.addEventListener(r,t[r].bind(t))}class Wr{static#e=NaN;static#t=null;static#r=NaN;static#i=null;static initializeAndAddPointerId(e){(Wr.#t||=new Set).add(e)}static setPointer(e,i){Wr.#e||=i,Wr.#i??=e}static setTimeStamp(e){Wr.#r=e}static isSamePointerId(e){return Wr.#e===e}static isSamePointerIdOrRemove(e){return Wr.#e===e?!0:(Wr.#t?.delete(e),!1)}static isSamePointerType(e){return Wr.#i===e}static isInitializedAndDifferentPointerType(e){return Wr.#i!==null&&!Wr.isSamePointerType(e)}static isSameTimeStamp(e){return Wr.#r===e}static isUsingMultiplePointers(){return Wr.#t?.size>=1}static clearPointerType(){Wr.#i=null}static clearPointerIds(){Wr.#e=NaN,Wr.#t=null}static clearTimeStamp(){Wr.#r=NaN}}class vLi{#e=0;get id(){return`${xy}${this.#e++}`}}class ZQ{#e=I7e();#t=0;#r=null;static get _isSVGFittingCanvas(){const e='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),r=new Image;r.src=e;const n=r.decode().then(()=>(i.drawImage(r,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return Vi(this,"_isSVGFittingCanvas",n)}async#i(e,i){this.#r||=new Map;let r=this.#r.get(e);if(r===null)return null;if(r?.bitmap)return r.refCounter+=1,r;try{r||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let n;if(typeof i=="string"?(r.url=i,n=await By(i,"blob")):i instanceof File?n=r.file=i:i instanceof Blob&&(n=i),n.type==="image/svg+xml"){const o=ZQ._isSVGFittingCanvas,s=new FileReader,a=new Image,l=new Promise((c,d)=>{a.onload=()=>{r.bitmap=a,r.isSvg=!0,c()},s.onload=async()=>{const u=r.svgUrl=s.result;a.src=await o?`${u}#svgView(preserveAspectRatio(none))`:u},a.onerror=s.onerror=d});s.readAsDataURL(n),await l}else r.bitmap=await createImageBitmap(n);r.refCounter=1}catch(n){Hi(n),r=null}return this.#r.set(e,r),r&&this.#r.set(r.id,r),r}async getFromFile(e){const{lastModified:i,name:r,size:n,type:o}=e;return this.#i(`${i}_${r}_${n}_${o}`,e)}async getFromUrl(e){return this.#i(e,e)}async getFromBlob(e,i){const r=await i;return this.#i(e,r)}async getFromId(e){this.#r||=new Map;const i=this.#r.get(e);if(!i)return null;if(i.bitmap)return i.refCounter+=1,i;if(i.file)return this.getFromFile(i.file);if(i.blobPromise){const{blobPromise:r}=i;return delete i.blobPromise,this.getFromBlob(i.id,r)}return this.getFromUrl(i.url)}getFromCanvas(e,i){this.#r||=new Map;let r=this.#r.get(e);if(r?.bitmap)return r.refCounter+=1,r;const n=new OffscreenCanvas(i.width,i.height);return n.getContext("2d").drawImage(i,0,0),r={bitmap:n.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#r.set(e,r),this.#r.set(r.id,r),r}getSvgUrl(e){const i=this.#r.get(e);return i?.isSvg?i.svgUrl:null}deleteId(e){this.#r||=new Map;const i=this.#r.get(e);if(!i||(i.refCounter-=1,i.refCounter!==0))return;const{bitmap:r}=i;if(!i.url&&!i.file){const n=new OffscreenCanvas(r.width,r.height);n.getContext("bitmaprenderer").transferFromImageBitmap(r),i.blobPromise=n.convertToBlob()}r.close?.(),i.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}}class yLi{#e=[];#t=!1;#r;#i=-1;constructor(e=128){this.#r=e}add({cmd:e,undo:i,post:r,mustExec:n,type:o=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}){if(n&&e(),this.#t)return;const l={cmd:e,undo:i,post:r,type:o};if(this.#i===-1){this.#e.length>0&&(this.#e.length=0),this.#i=0,this.#e.push(l);return}if(s&&this.#e[this.#i].type===o){a&&(l.undo=this.#e[this.#i].undo),this.#e[this.#i]=l;return}const c=this.#i+1;c===this.#r?this.#e.splice(0,1):(this.#i=c,c<this.#e.length&&this.#e.splice(c)),this.#e.push(l)}undo(){if(this.#i===-1)return;this.#t=!0;const{undo:e,post:i}=this.#e[this.#i];e(),i?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;const{cmd:e,post:i}=this.#e[this.#i];e(),i?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}cleanType(e){if(this.#i!==-1){for(let i=this.#i;i>=0;i--)if(this.#e[i].type!==e){this.#e.splice(i+1,this.#i-i),this.#i=i;return}this.#e.length=0,this.#i=-1}}destroy(){this.#e=null}}class Sy{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:i}=Xo.platform;for(const[r,n,o={}]of e)for(const s of r){const a=s.startsWith("mac+");i&&a?(this.callbacks.set(s.slice(4),{callback:n,options:o}),this.allKeys.add(s.split("+").at(-1))):!i&&!a&&(this.callbacks.set(s,{callback:n,options:o}),this.allKeys.add(s.split("+").at(-1)))}}#e(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const i=this.buffer.join("+");return this.buffer.length=0,i}exec(e,i){if(!this.allKeys.has(i.key))return;const r=this.callbacks.get(this.#e(i));if(!r)return;const{callback:n,options:{bubbles:o=!1,args:s=[],checker:a=null}}=r;a&&!a(e,i)||(n.bind(e,...s,i)(),o||fo(i))}}class XQ{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return hLi(e),Vi(this,"_colors",e)}convert(e){const i=Iy(e);if(!window.matchMedia("(forced-colors: active)").matches)return i;for(const[r,n]of this._colors)if(n.every((o,s)=>o===i[s]))return XQ._colorsMapping.get(r);return i}getHexCode(e){const i=this._colors.get(e);return i?Yt.makeHexColor(...i):e}}class x0{#e=new AbortController;#t=null;#r=null;#i=new Map;#n=new Map;#o=null;#s=null;#a=null;#l=new yLi;#c=null;#h=null;#u=null;#p=0;#A=new Set;#g=null;#d=null;#f=new Set;_editorUndoBar=null;#m=!1;#y=!1;#v=!1;#k=null;#x=null;#b=null;#E=null;#w=!1;#M=null;#S=new vLi;#P=!1;#I=!1;#O=!1;#D=null;#L=null;#U=null;#_=null;#q=null;#B=qi.NONE;#C=new Set;#R=null;#N=null;#H=null;#K=null;#Q=null;#W={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#V=[0,0];#F=null;#G=null;#Y=null;#$=null;#j=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=x0.prototype,i=s=>s.#G.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&s.hasSomethingToControl(),r=(s,{target:a})=>{if(a instanceof HTMLInputElement){const{type:l}=a;return l!=="text"&&l!=="number"}return!0},n=this.TRANSLATE_SMALL,o=this.TRANSLATE_BIG;return Vi(this,"_keyboardManager",new Sy([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:r}],[["ctrl+z","mac+meta+z"],e.undo,{checker:r}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:r}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:r}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(s,{target:a})=>!(a instanceof HTMLButtonElement)&&s.#G.contains(a)&&!s.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(s,{target:a})=>!(a instanceof HTMLButtonElement)&&s.#G.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-o,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[o,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-o],checker:i}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,o],checker:i}]]))}constructor(e,i,r,n,o,s,a,l,c,d,u,h,p,g,f,m){const A=this._signal=this.#e.signal;this.#G=e,this.#Y=i,this.#$=r,this.#o=n,this.#c=o,this.#N=s,this.#Q=l,this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:A}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:A}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:A}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:A}),a._on("setpreference",this.onSetPreference.bind(this),{signal:A}),a._on("switchannotationeditorparams",y=>this.updateParams(y.type,y.value),{signal:A}),window.addEventListener("pointerdown",()=>{this.#I=!0},{capture:!0,signal:A}),window.addEventListener("pointerup",()=>{this.#I=!1},{capture:!0,signal:A}),this.#se(),this.#he(),this.#te(),this.#s=l.annotationStorage,this.#k=l.filterFactory,this.#H=c,this.#E=d||null,this.#m=u,this.#y=h,this.#v=p,this.#q=g||null,this.viewParameters={realScale:X5.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=f||null,this._supportsPinchToZoom=m!==!1,o?.setSidebarUiManager(this)}destroy(){this.#j?.resolve(),this.#j=null,this.#e?.abort(),this.#e=null,this._signal=null;for(const e of this.#n.values())e.destroy();this.#n.clear(),this.#i.clear(),this.#f.clear(),this.#_?.clear(),this.#t=null,this.#C.clear(),this.#l.destroy(),this.#o?.destroy(),this.#c?.destroy(),this.#N?.destroy(),this.#M?.hide(),this.#M=null,this.#U?.destroy(),this.#U=null,this.#r=null,this.#x&&(clearTimeout(this.#x),this.#x=null),this.#F&&(clearTimeout(this.#F),this.#F=null),this._editorUndoBar?.destroy(),this.#Q=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#q}get useNewAltTextFlow(){return this.#y}get useNewAltTextWhenAddingImage(){return this.#v}get hcmFilter(){return Vi(this,"hcmFilter",this.#H?this.#k.addHCMFilter(this.#H.foreground,this.#H.background):"none")}get direction(){return Vi(this,"direction",getComputedStyle(this.#G).direction)}get _highlightColors(){return Vi(this,"_highlightColors",this.#E?new Map(this.#E.split(",").map(e=>(e=e.split("=").map(i=>i.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return Vi(this,"highlightColors",null);const i=new Map,r=!!this.#H;for(const[n,o]of e){const s=n.endsWith("_HCM");if(r&&s){i.set(n.replace("_HCM",""),o);continue}!r&&!s&&i.set(n,o)}return Vi(this,"highlightColors",i)}get highlightColorNames(){return Vi(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const i=this.highlightColorNames.get(e);return this._highlightColors.get(i)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#u=e}setMainHighlightColorPicker(e){this.#U=e}editAltText(e,i=!1){this.#o?.editAltText(this,e,i)}hasCommentManager(){return!!this.#c}editComment(e,i,r,n){this.#c?.showDialog(this,e,i,r,n)}selectComment(e,i){this.#n.get(e)?.getEditorByUID(i)?.toggleComment(!0,!0)}updateComment(e){this.#c?.updateComment(e.getData())}updatePopupColor(e){this.#c?.updatePopupColor(e)}removeComment(e){this.#c?.removeComments([e.uid])}toggleComment(e,i,r=void 0){this.#c?.toggleCommentPopup(e,i,r)}makeCommentColor(e,i){return e&&this.#c?.makeCommentColor(e,i)||null}getCommentDialogElement(){return this.#c?.dialogElement||null}async waitForEditorsRendered(e){if(this.#n.has(e-1))return;const{resolve:i,promise:r}=Promise.withResolvers(),n=o=>{o.pageNumber===e&&(this._eventBus._off("editorsrendered",n),i())};this._eventBus.on("editorsrendered",n),await r}getSignature(e){this.#N?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#N}switchToMode(e,i){this._eventBus.on("annotationeditormodechanged",i,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,i){this._eventBus.dispatch("setpreference",{source:this,name:e,value:i})}onSetPreference({name:e,value:i}){e==="enableNewAltTextWhenAddingImage"&&(this.#v=i)}onPageChanging({pageNumber:e}){this.#p=e-1}focusMainContainer(){this.#G.focus()}findParent(e,i){for(const r of this.#n.values()){const{x:n,y:o,width:s,height:a}=r.div.getBoundingClientRect();if(e>=n&&e<=n+s&&i>=o&&i<=o+a)return r}return null}disableUserSelect(e=!1){this.#Y.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#f.add(e)}removeShouldRescale(e){this.#f.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*X5.PDF_TO_CSS_UNITS;for(const i of this.#f)i.onScaleChanging();this.#u?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#X({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#ee(e){const{currentLayer:i}=this;if(i.hasTextLayer(e))return i;for(const r of this.#n.values())if(r.hasTextLayer(e))return r;return null}highlightSelection(e="",i=!1){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:n,anchorOffset:o,focusNode:s,focusOffset:a}=r,l=r.toString(),c=this.#X(r).closest(".textLayer"),d=this.getSelectionBoxes(c);if(!d)return;r.empty();const u=this.#ee(c),h=this.#B===qi.NONE,p=()=>{const g=u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:n,anchorOffset:o,focusNode:s,focusOffset:a,text:l});h&&this.showAllEditors("highlight",!0,!0),i&&g?.editComment()};if(h){this.switchToMode(qi.HIGHLIGHT,p);return}p()}commentSelection(e=""){this.highlightSelection(e,!0)}#ne(){const e=document.getSelection();if(!e||e.isCollapsed)return;const i=this.#X(e).closest(".textLayer"),r=this.getSelectionBoxes(i);r&&(this.#M||=new mLi(this),this.#M.show(i,r,this.direction==="ltr"))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#s)return null;const i=`${xy}${e}`,r=this.#s.getRawValue(i);return r&&this.#s.remove(i),r}addToAnnotationStorage(e){!e.isEmpty()&&this.#s&&!this.#s.has(e.id)&&this.#s.setValue(e.id,e)}a11yAlert(e,i=null){const r=this.#$;r&&(r.setAttribute("data-l10n-id",e),i?r.setAttribute("data-l10n-args",JSON.stringify(i)):r.removeAttribute("data-l10n-args"))}#oe(){const e=document.getSelection();if(!e||e.isCollapsed){this.#R&&(this.#M?.hide(),this.#R=null,this.#T({hasSelectedText:!1}));return}const{anchorNode:i}=e;if(i===this.#R)return;const r=this.#X(e).closest(".textLayer");if(!r){this.#R&&(this.#M?.hide(),this.#R=null,this.#T({hasSelectedText:!1}));return}if(this.#M?.hide(),this.#R=i,this.#T({hasSelectedText:!0}),!(this.#B!==qi.HIGHLIGHT&&this.#B!==qi.NONE)&&(this.#B===qi.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#w=this.isShiftKeyDown,!this.isShiftKeyDown)){const n=this.#B===qi.HIGHLIGHT?this.#ee(r):null;if(n?.toggleDrawing(),this.#I){const o=new AbortController,s=this.combinedSignal(o),a=l=>{l.type==="pointerup"&&l.button!==0||(o.abort(),n?.toggleDrawing(!0),l.type==="pointerup"&&this.#J("main_toolbar"))};window.addEventListener("pointerup",a,{signal:s}),window.addEventListener("blur",a,{signal:s})}else n?.toggleDrawing(!0),this.#J("main_toolbar")}}#J(e=""){this.#B===qi.HIGHLIGHT?this.highlightSelection(e):this.#m&&this.#ne()}#se(){document.addEventListener("selectionchange",this.#oe.bind(this),{signal:this._signal})}#ae(){if(this.#b)return;this.#b=new AbortController;const e=this.combinedSignal(this.#b);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#le(){this.#b?.abort(),this.#b=null}blur(){if(this.isShiftKeyDown=!1,this.#w&&(this.#w=!1,this.#J("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const i of this.#C)if(i.div.contains(e)){this.#L=[i,e],i._focusEventsAllowed=!1;break}}focus(){if(!this.#L)return;const[e,i]=this.#L;this.#L=null,i.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),i.focus()}#te(){if(this.#D)return;this.#D=new AbortController;const e=this.combinedSignal(this.#D);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#ce(){this.#D?.abort(),this.#D=null}#de(){if(this.#h)return;this.#h=new AbortController;const e=this.combinedSignal(this.#h);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#ue(){this.#h?.abort(),this.#h=null}#he(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#te(),this.setEditingState(!0)}removeEditListeners(){this.#ce(),this.setEditingState(!1)}dragOver(e){for(const{type:i}of e.dataTransfer.items)for(const r of this.#d)if(r.isHandlingMimeForPasting(i)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const i of e.dataTransfer.items)for(const r of this.#d)if(r.isHandlingMimeForPasting(i.type)){r.paste(i,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const i=[];for(const r of this.#C){const n=r.serialize(!0);n&&i.push(n)}i.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:i}=e;for(const o of i.items)for(const s of this.#d)if(s.isHandlingMimeForPasting(o.type)){s.paste(o,this.currentLayer);return}let r=i.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(o){Hi(`paste: "${o.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const n=this.currentLayer;try{const o=[];for(const l of r){const c=await n.deserialize(l);if(!c)return;o.push(c)}const s=()=>{for(const l of o)this.#ie(l);this.#re(o)},a=()=>{for(const l of o)l.remove()};this.addCommands({cmd:s,undo:a,mustExec:!0})}catch(o){Hi(`paste: "${o.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),this.#B!==qi.NONE&&!this.isEditorHandlingKeyboard&&x0._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,this.#w&&(this.#w=!1,this.#J("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}#T(e){Object.entries(e).some(([i,r])=>this.#W[i]!==r)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#W,e)}),this.#B===qi.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#z([[Cr.HIGHLIGHT_FREE,!0]]))}#z(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#ae(),this.#de(),this.#T({isEditing:this.#B!==qi.NONE,isEmpty:this.#Z(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#le(),this.#ue(),this.#T({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#d){this.#d=e;for(const i of this.#d)this.#z(i.defaultPropertiesToUpdate)}}getId(){return this.#S.id}get currentLayer(){return this.#n.get(this.#p)}getLayer(e){return this.#n.get(e)}get currentPageIndex(){return this.#p}addLayer(e){this.#n.set(e.pageIndex,e),this.#P?e.enable():e.disable()}removeLayer(e){this.#n.delete(e.pageIndex)}async updateMode(e,i=null,r=!1,n=!1,o=!1,s=!1){if(this.#B!==e&&!(this.#j&&(await this.#j.promise,!this.#j))){if(this.#j=Promise.withResolvers(),this.#u?.commitOrRemove(),this.#B===qi.POPUP&&this.#c?.hideSidebar(),this.#c?.destroyPopup(),this.#B=e,e===qi.NONE){this.setEditingState(!1),this.#fe();for(const a of this.#i.values())a.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#j.resolve();return}for(const a of this.#i.values())a.addStandaloneCommentButton();e===qi.SIGNATURE&&await this.#N?.loadSignatures(),r&&Wr.clearPointerType(),this.setEditingState(!0),await this.#pe(),this.unselectAll();for(const a of this.#n.values())a.updateMode(e);if(e===qi.POPUP){this.#r||=await this.#Q.getAnnotationsByType(new Set(this.#d.map(c=>c._editorType)));const a=new Set,l=[];for(const c of this.#i.values()){const{annotationElementId:d,hasComment:u,deleted:h}=c;d&&a.add(d),u&&!h&&l.push(c.getData())}for(const c of this.#r){const{id:d,popupRef:u,contentsObj:h}=c;u&&h?.str&&!a.has(d)&&!this.#A.has(d)&&l.push(c)}this.#c?.showSidebar(l)}if(!i){n&&this.addNewEditorFromKeyboard(),this.#j.resolve();return}for(const a of this.#i.values())a.uid===i?(this.setSelected(a),s?a.editComment():o?a.enterInEditMode():a.focus()):a.unselect();this.#j.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#B&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,i){if(this.#d){switch(e){case Cr.CREATE:this.currentLayer.addNewEditor(i);return;case Cr.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#K||=new Map).set(e,i),this.showAllEditors("highlight",i);break}if(this.hasSelection)for(const r of this.#C)r.updateParams(e,i);else for(const r of this.#d)r.updateDefaultParams(e,i)}}showAllEditors(e,i,r=!1){for(const n of this.#i.values())n.editorType===e&&n.show(i);(this.#K?.get(Cr.HIGHLIGHT_SHOW_ALL)??!0)!==i&&this.#z([[Cr.HIGHLIGHT_SHOW_ALL,i]])}enableWaiting(e=!1){if(this.#O!==e){this.#O=e;for(const i of this.#n.values())e?i.disableClick():i.enableClick(),i.div.classList.toggle("waiting",e)}}async#pe(){if(!this.#P){this.#P=!0;const e=[];for(const i of this.#n.values())e.push(i.enable());await Promise.all(e);for(const i of this.#i.values())i.enable()}}#fe(){if(this.unselectAll(),this.#P){this.#P=!1;for(const e of this.#n.values())e.disable();for(const e of this.#i.values())e.disable()}}*getEditors(e){for(const i of this.#i.values())i.pageIndex===e&&(yield i)}getEditor(e){return this.#i.get(e)}addEditor(e){this.#i.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#x&&clearTimeout(this.#x),this.#x=setTimeout(()=>{this.focusMainContainer(),this.#x=null},0)),this.#i.delete(e.id),e.annotationElementId&&this.#_?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#A.has(e.annotationElementId))&&this.#s?.remove(e.id)}addDeletedAnnotationElement(e){this.#A.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#A.has(e)}removeDeletedAnnotationElement(e){this.#A.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#ie(e){const i=this.#n.get(e.pageIndex);i?i.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#z(e.propertiesToUpdate))}get#ge(){let e=null;for(e of this.#C);return e}updateUI(e){this.#ge===e&&this.#z(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#z(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#C.has(e)){this.#C.delete(e),e.unselect(),this.#T({hasSelectedEditor:this.hasSelection});return}this.#C.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#T({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#u?.commitOrRemove();for(const i of this.#C)i!==e&&i.unselect();this.#C.clear(),this.#C.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#T({hasSelectedEditor:!0})}isSelected(e){return this.#C.has(e)}get firstSelectedEditor(){return this.#C.values().next().value}unselect(e){e.unselect(),this.#C.delete(e),this.#T({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#C.size!==0}get isEnterHandled(){return this.#C.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#T({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#Z()}),this._editorUndoBar?.hide()}redo(){this.#l.redo(),this.#T({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#Z()})}addCommands(e){this.#l.add(e),this.#T({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#Z()})}cleanUndoStack(e){this.#l.cleanType(e)}#Z(){if(this.#i.size===0)return!0;if(this.#i.size===1)for(const e of this.#i.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();const e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const i=e?[e]:[...this.#C],r=()=>{this._editorUndoBar?.show(n,i.length===1?i[0].editorType:i.length);for(const o of i)o.remove()},n=()=>{for(const o of i)this.#ie(o)};this.addCommands({cmd:r,undo:n,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#re(e){for(const i of this.#C)i.unselect();this.#C.clear();for(const i of e)i.isEmpty()||(this.#C.add(i),i.select());this.#T({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#C)e.commit();this.#re(this.#i.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#B!==qi.NONE))&&!this.#u?.commitOrRemove()&&this.hasSelection){for(const e of this.#C)e.unselect();this.#C.clear(),this.#T({hasSelectedEditor:!1})}}translateSelectedEditors(e,i,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;this.#V[0]+=e,this.#V[1]+=i;const[n,o]=this.#V,s=[...this.#C],a=1e3;this.#F&&clearTimeout(this.#F),this.#F=setTimeout(()=>{this.#F=null,this.#V[0]=this.#V[1]=0,this.addCommands({cmd:()=>{for(const l of s)this.#i.has(l.id)&&(l.translateInPage(n,o),l.translationDone())},undo:()=>{for(const l of s)this.#i.has(l.id)&&(l.translateInPage(-n,-o),l.translationDone())},mustExec:!1})},a);for(const l of s)l.translateInPage(e,i),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#g=new Map;for(const e of this.#C)this.#g.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#g)return!1;this.disableUserSelect(!1);const e=this.#g;this.#g=null;let i=!1;for(const[{x:n,y:o,pageIndex:s},a]of e)a.newX=n,a.newY=o,a.newPageIndex=s,i||=n!==a.savedX||o!==a.savedY||s!==a.savedPageIndex;if(!i)return!1;const r=(n,o,s,a)=>{if(this.#i.has(n.id)){const l=this.#n.get(a);l?n._setParentAndPosition(l,o,s):(n.pageIndex=a,n.x=o,n.y=s)}};return this.addCommands({cmd:()=>{for(const[n,{newX:o,newY:s,newPageIndex:a}]of e)r(n,o,s,a)},undo:()=>{for(const[n,{savedX:o,savedY:s,savedPageIndex:a}]of e)r(n,o,s,a)},mustExec:!0}),!0}dragSelectedEditors(e,i){if(this.#g)for(const r of this.#g.keys())r.drag(e,i)}rebuild(e){if(e.parent===null){const i=this.getLayer(e.pageIndex);i?(i.changeParent(e),i.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#C.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#B}isEditingMode(){return this.#B!==qi.NONE}get imageManager(){return Vi(this,"imageManager",new ZQ)}getSelectionBoxes(e){if(!e)return null;const i=document.getSelection();for(let c=0,d=i.rangeCount;c<d;c++)if(!e.contains(i.getRangeAt(c).commonAncestorContainer))return null;const{x:r,y:n,width:o,height:s}=e.getBoundingClientRect();let a;switch(e.getAttribute("data-main-rotation")){case"90":a=(c,d,u,h)=>({x:(d-n)/s,y:1-(c+u-r)/o,width:h/s,height:u/o});break;case"180":a=(c,d,u,h)=>({x:1-(c+u-r)/o,y:1-(d+h-n)/s,width:u/o,height:h/s});break;case"270":a=(c,d,u,h)=>({x:1-(d+h-n)/s,y:(c-r)/o,width:h/s,height:u/o});break;default:a=(c,d,u,h)=>({x:(c-r)/o,y:(d-n)/s,width:u/o,height:h/s});break}const l=[];for(let c=0,d=i.rangeCount;c<d;c++){const u=i.getRangeAt(c);if(!u.collapsed)for(const{x:h,y:p,width:g,height:f}of u.getClientRects())g===0||f===0||l.push(a(h,p,g,f))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:i}){(this.#a||=new Map).set(e,i)}removeChangedExistingAnnotation({annotationElementId:e}){this.#a?.delete(e)}renderAnnotationElement(e){const i=this.#a?.get(e.data.id);if(!i)return;const r=this.#s.getRawValue(i);r&&(this.#B===qi.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}setMissingCanvas(e,i,r){const n=this.#_?.get(e);n&&(n.setCanvas(i,r),this.#_.delete(e))}addMissingCanvas(e,i){(this.#_||=new Map).set(e,i)}}class Zu{#e=null;#t=!1;#r=null;#i=null;#n=null;#o=null;#s=!1;#a=null;#l=null;#c=null;#h=null;#u=!1;static#p=null;static _l10n=null;constructor(e){this.#l=e,this.#u=e._uiManager.useNewAltTextFlow,Zu.#p||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){Zu._l10n??=e}async render(){const e=this.#r=document.createElement("button");e.className="altText",e.tabIndex="0";const i=this.#i=document.createElement("span");e.append(i),this.#u?(e.classList.add("new"),e.setAttribute("data-l10n-id",Zu.#p.missing),i.setAttribute("data-l10n-id",Zu.#p["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const r=this.#l._uiManager._signal;e.addEventListener("contextmenu",Fc,{signal:r}),e.addEventListener("pointerdown",o=>o.stopPropagation(),{signal:r});const n=o=>{o.preventDefault(),this.#l._uiManager.editAltText(this.#l),this.#u&&this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#A}})};return e.addEventListener("click",n,{capture:!0,signal:r}),e.addEventListener("keydown",o=>{o.target===e&&o.key==="Enter"&&(this.#s=!0,n(o))},{signal:r}),await this.#g(),e}get#A(){return this.#e&&"added"||this.#e===null&&this.guessedText&&"review"||"missing"}finish(){this.#r&&(this.#r.focus({focusVisible:this.#s}),this.#s=!1)}isEmpty(){return this.#u?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#u?this.#e!==null||!!this.#c:this.isEmpty()}get guessedText(){return this.#c}async setGuessedText(e){this.#e===null&&(this.#c=e,this.#h=await Zu._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#g())}toggleAltTextBadge(e=!1){if(!this.#u||this.#e){this.#a?.remove(),this.#a=null;return}if(!this.#a){const i=this.#a=document.createElement("div");i.className="noAltTextBadge",this.#l.div.append(i)}this.#a.classList.toggle("hidden",!e)}serialize(e){let i=this.#e;return!e&&this.#c===i&&(i=this.#h),{altText:i,decorative:this.#t,guessedText:this.#c,textWithDisclaimer:this.#h}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:i,guessedText:r,textWithDisclaimer:n,cancel:o=!1}){r&&(this.#c=r,this.#h=n),!(this.#e===e&&this.#t===i)&&(o||(this.#e=e,this.#t=i),this.#g())}toggle(e=!1){this.#r&&(!e&&this.#o&&(clearTimeout(this.#o),this.#o=null),this.#r.disabled=!e)}shown(){this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#A}})}destroy(){this.#r?.remove(),this.#r=null,this.#i=null,this.#n=null,this.#a?.remove(),this.#a=null}async#g(){const e=this.#r;if(!e)return;if(this.#u){if(e.classList.toggle("done",!!this.#e),e.setAttribute("data-l10n-id",Zu.#p[this.#A]),this.#i?.setAttribute("data-l10n-id",Zu.#p[`${this.#A}-label`]),!this.#e){this.#n?.remove();return}}else{if(!this.#e&&!this.#t){e.classList.remove("done"),this.#n?.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let i=this.#n;if(!i){this.#n=i=document.createElement("span"),i.className="tooltip",i.setAttribute("role","tooltip"),i.id=`alt-text-tooltip-${this.#l.id}`;const r=100,n=this.#l._uiManager._signal;n.addEventListener("abort",()=>{clearTimeout(this.#o),this.#o=null},{once:!0}),e.addEventListener("mouseenter",()=>{this.#o=setTimeout(()=>{this.#o=null,this.#n.classList.add("show"),this.#l._reportTelemetry({action:"alt_text_tooltip"})},r)},{signal:n}),e.addEventListener("mouseleave",()=>{this.#o&&(clearTimeout(this.#o),this.#o=null),this.#n?.classList.remove("show")},{signal:n})}this.#t?i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(i.removeAttribute("data-l10n-id"),i.textContent=this.#e),i.parentNode||e.append(i),this.#l.getElementForAltText()?.setAttribute("aria-describedby",i.id)}}class EP{#e=null;#t=null;#r=!1;#i=null;#n=null;#o=null;#s=null;#a=null;#l=!1;#c=null;constructor(e){this.#i=e}renderForToolbar(){const e=this.#t=document.createElement("button");return e.className="comment",this.#h(e,!1)}renderForStandalone(){const e=this.#e=document.createElement("button");e.className="annotationCommentButton";const i=this.#i.commentButtonPosition;if(i){const{style:r}=e;r.insetInlineEnd=`calc(${100*(this.#i._uiManager.direction==="ltr"?1-i[0]:i[0])}% - var(--comment-button-dim))`,r.top=`calc(${100*i[1]}% - var(--comment-button-dim))`;const n=this.#i.commentButtonColor;n&&(r.backgroundColor=n)}return this.#h(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;const e=this.#i.commentButtonColor;e&&(this.#e.style.backgroundColor=e),this.#i._uiManager.updatePopupColor(this.#i)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#i.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#c)return this.#c;if(!this.#e)return null;const{x:e,y:i,height:r}=this.#e.getBoundingClientRect(),{x:n,y:o,width:s,height:a}=this.#i.parent.boundingClientRect;return[(e-n)/s,(i+r-o)/a]}set commentPopupPositionInLayer(e){this.#c=e}hasDefaultPopupPosition(){return this.#c===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:i}){this.#e&&(this.#e.classList.toggle("selected",e),this.#e.ariaExpanded=i)}#h(e,i){if(!this.#i._uiManager.hasCommentManager())return null;e.tabIndex="0",e.ariaHasPopup="dialog",i?(e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(e.ariaControlsElements=[this.#i._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));const r=this.#i._uiManager._signal;if(!(r instanceof AbortSignal)||r.aborted)return e;e.addEventListener("contextmenu",Fc,{signal:r}),i&&(e.addEventListener("focusin",o=>{this.#i._focusEventsAllowed=!1,fo(o)},{capture:!0,signal:r}),e.addEventListener("focusout",o=>{this.#i._focusEventsAllowed=!0,fo(o)},{capture:!0,signal:r})),e.addEventListener("pointerdown",o=>o.stopPropagation(),{signal:r});const n=o=>{o.preventDefault(),e===this.#t?this.edit():this.#i.toggleComment(!0)};return e.addEventListener("click",n,{capture:!0,signal:r}),e.addEventListener("keydown",o=>{o.target===e&&o.key==="Enter"&&(this.#r=!0,n(o))},{signal:r}),e.addEventListener("pointerenter",()=>{this.#i.toggleComment(!1,!0)},{signal:r}),e.addEventListener("pointerleave",()=>{this.#i.toggleComment(!1,!1)},{signal:r}),e}edit(e){const i=this.commentPopupPositionInLayer;let r,n;if(i)[r,n]=i;else{[r,n]=this.#i.commentButtonPosition;const{width:d,height:u,x:h,y:p}=this.#i;r=h+r*d,n=p+n*u}const o=this.#i.parent.boundingClientRect,{x:s,y:a,width:l,height:c}=o;this.#i._uiManager.editComment(this.#i,s+r*l,a+n*c,{...e,parentDimensions:o})}finish(){this.#t&&(this.#t.focus({focusVisible:this.#r}),this.#r=!1)}isDeleted(){return this.#l||this.#s===""}isEmpty(){return this.#s===null}hasBeenEdited(){return this.isDeleted()||this.#s!==this.#n}serialize(){return this.data}get data(){return{text:this.#s,richText:this.#o,date:this.#a,deleted:this.isDeleted()}}set data(e){if(e!==this.#s&&(this.#o=null),e===null){this.#s="",this.#l=!0;return}this.#s=e,this.#a=new Date,this.#l=!1}setInitialText(e,i=null){this.#n=e,this.data=e,this.#a=null,this.#o=i}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#s="",this.#o=null,this.#a=null,this.#i=null,this.#r=!1,this.#l=!1}}class ZI{#e;#t=!1;#r=null;#i;#n;#o;#s;#a=null;#l;#c=null;#h;#u=null;constructor({container:e,isPinchingDisabled:i=null,isPinchingStopped:r=null,onPinchStart:n=null,onPinching:o=null,onPinchEnd:s=null,signal:a}){this.#e=e,this.#r=r,this.#i=i,this.#n=n,this.#o=o,this.#s=s,this.#h=new AbortController,this.#l=AbortSignal.any([a,this.#h.signal]),e.addEventListener("touchstart",this.#p.bind(this),{passive:!1,signal:this.#l})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ju.pixelRatio}#p(e){if(this.#i?.())return;if(e.touches.length===1){if(this.#a)return;const n=this.#a=new AbortController,o=AbortSignal.any([this.#l,n.signal]),s=this.#e,a={capture:!0,signal:o,passive:!1},l=c=>{c.pointerType==="touch"&&(this.#a?.abort(),this.#a=null)};s.addEventListener("pointerdown",c=>{c.pointerType==="touch"&&(fo(c),l(c))},a),s.addEventListener("pointerup",l,a),s.addEventListener("pointercancel",l,a);return}if(!this.#u){this.#u=new AbortController;const n=AbortSignal.any([this.#l,this.#u.signal]),o=this.#e,s={signal:n,capture:!1,passive:!1};o.addEventListener("touchmove",this.#A.bind(this),s);const a=this.#g.bind(this);o.addEventListener("touchend",a,s),o.addEventListener("touchcancel",a,s),s.capture=!0,o.addEventListener("pointerdown",fo,s),o.addEventListener("pointermove",fo,s),o.addEventListener("pointercancel",fo,s),o.addEventListener("pointerup",fo,s),this.#n?.()}if(fo(e),e.touches.length!==2||this.#r?.()){this.#c=null;return}let[i,r]=e.touches;i.identifier>r.identifier&&([i,r]=[r,i]),this.#c={touch0X:i.screenX,touch0Y:i.screenY,touch1X:r.screenX,touch1Y:r.screenY}}#A(e){if(!this.#c||e.touches.length!==2)return;fo(e);let[i,r]=e.touches;i.identifier>r.identifier&&([i,r]=[r,i]);const{screenX:n,screenY:o}=i,{screenX:s,screenY:a}=r,l=this.#c,{touch0X:c,touch0Y:d,touch1X:u,touch1Y:h}=l,p=u-c,g=h-d,f=s-n,m=a-o,A=Math.hypot(f,m)||1,y=Math.hypot(p,g)||1;if(!this.#t&&Math.abs(y-A)<=ZI.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=n,l.touch0Y=o,l.touch1X=s,l.touch1Y=a,!this.#t){this.#t=!0;return}const v=[(n+s)/2,(o+a)/2];this.#o?.(v,y,A)}#g(e){e.touches.length>=2||(this.#u&&(this.#u.abort(),this.#u=null,this.#s?.()),this.#c&&(fo(e),this.#c=null,this.#t=!1))}destroy(){this.#h?.abort(),this.#h=null,this.#a?.abort(),this.#a=null}}class vi{#e=null;#t=null;#r=null;#i=null;#n=null;#o=!1;#s=null;#a="";#l=null;#c=null;#h=null;#u=null;#p=null;#A="";#g=!1;#d=null;#f=!1;#m=!1;#y=!1;#v=null;#k=0;#x=0;#b=null;#E=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#w=!1;#M=vi._zIndex++;static _borderLineWidth=-1;static _colorManager=new XQ;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const e=vi.prototype._resizeWithKeyboard,i=x0.TRANSLATE_SMALL,r=x0.TRANSLATE_BIG;return Vi(this,"_resizerKeyboardManager",new Sy([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-i,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-r,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[i,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[r,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-i]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-r]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,i]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,r]}],[["Escape","mac+Escape"],vi.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;const{rotation:i,rawDims:{pageWidth:r,pageHeight:n,pageX:o,pageY:s}}=this.parent.viewport;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,n],this.pageTranslation=[o,s];const[a,l]=this.parentDimensions;this.x=e.x/a,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Vi(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const i=new bLi({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});i.annotationElementId=e.annotationElementId,i.deleted=!0,i._uiManager.addToAnnotationStorage(i)}static initialize(e,i){if(vi._l10n??=e,vi._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),vi._borderLineWidth!==-1)return;const r=getComputedStyle(document.documentElement);vi._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,i){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,i){yn("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#w}set _isDraggable(e){this.#w=e,this.div?.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[e,i]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*i/(e*2),this.y+=this.width*e/(i*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*i/(e*2),this.y-=this.width*e/(i*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#M}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(this.#F(),this.#u?.remove(),this.#u=null),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#g?this.#g=!1:this.parent.setSelected(this))}focusout(e){!this._focusEventsAllowed||!this.isAttachedToDOM||e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,i,r,n){const[o,s]=this.parentDimensions;[r,n]=this.screenToPageTranslation(r,n),this.x=(e+r)/o,this.y=(i+n)/s,this.fixAndSetPosition()}_moveAfterPaste(e,i){const[r,n]=this.parentDimensions;this.setAt(e*r,i*n,this.width*r,this.height*n),this._onTranslated()}#S([e,i],r,n){[r,n]=this.screenToPageTranslation(r,n),this.x+=r/e,this.y+=n/i,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,i){this.#S(this.parentDimensions,e,i)}translateInPage(e,i){this.#d||=[this.x,this.y,this.width,this.height],this.#S(this.pageDimensions,e,i),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,i){this.#d||=[this.x,this.y,this.width,this.height];const{div:r,parentDimensions:[n,o]}=this;if(this.x+=e/n,this.y+=i/o,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:a}=this;const[l,c]=this.getBaseTranslation();s+=l,a+=c;const{style:d}=r;d.left=`${(100*s).toFixed(2)}%`,d.top=`${(100*a).toFixed(2)}%`,this._onTranslating(s,a),r.scrollIntoView({block:"nearest"})}_onTranslating(e,i){}_onTranslated(e,i){}get _hasBeenMoved(){return!!this.#d&&(this.#d[0]!==this.x||this.#d[1]!==this.y)}get _hasBeenResized(){return!!this.#d&&(this.#d[2]!==this.width||this.#d[3]!==this.height)}getBaseTranslation(){const[e,i]=this.parentDimensions,{_borderLineWidth:r}=vi,n=r/e,o=r/i;switch(this.rotation){case 90:return[-n,o];case 180:return[n,o];case 270:return[n,-o];default:return[-n,-o]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:i},pageDimensions:[r,n]}=this;let{x:o,y:s,width:a,height:l}=this;if(a*=r,l*=n,o*=r,s*=n,this._mustFixPosition)switch(e){case 0:o=qa(o,0,r-a),s=qa(s,0,n-l);break;case 90:o=qa(o,0,r-l),s=qa(s,a,n);break;case 180:o=qa(o,a,r),s=qa(s,l,n);break;case 270:o=qa(o,l,r),s=qa(s,0,n-a);break}this.x=o/=r,this.y=s/=n;const[c,d]=this.getBaseTranslation();o+=c,s+=d,i.left=`${(100*o).toFixed(2)}%`,i.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static#P(e,i,r){switch(r){case 90:return[i,-e];case 180:return[-e,-i];case 270:return[-i,e];default:return[e,i]}}screenToPageTranslation(e,i){return vi.#P(e,i,this.parentRotation)}pageTranslationToScreen(e,i){return vi.#P(e,i,360-this.parentRotation)}#I(e){switch(e){case 90:{const[i,r]=this.pageDimensions;return[0,-i/r,r/i,0]}case 180:return[-1,0,0,-1];case 270:{const[i,r]=this.pageDimensions;return[0,i/r,-r/i,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[i,r]}=this;return[i*e,r*e]}setDims(){const{div:{style:e},width:i,height:r}=this;e.width=`${(100*i).toFixed(2)}%`,e.height=`${(100*r).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#O(){if(this.#l)return;this.#l=document.createElement("div"),this.#l.classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],i=this._uiManager._signal;for(const r of e){const n=document.createElement("div");this.#l.append(n),n.classList.add("resizer",r),n.setAttribute("data-resizer-name",r),n.addEventListener("pointerdown",this.#D.bind(this,r),{signal:i}),n.addEventListener("contextmenu",Fc,{signal:i}),n.tabIndex=-1}this.div.prepend(this.#l)}#D(e,i){i.preventDefault();const{isMac:r}=Xo.platform;if(i.button!==0||i.ctrlKey&&r)return;this.#r?.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,this.#c=[i.screenX,i.screenY];const o=new AbortController,s=this._uiManager.combinedSignal(o);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#_.bind(this,e),{passive:!0,capture:!0,signal:s}),window.addEventListener("touchmove",fo,{passive:!1,signal:s}),window.addEventListener("contextmenu",Fc,{signal:s}),this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const a=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(i.target).cursor;const c=()=>{o.abort(),this.parent.togglePointerEvents(!0),this.#r?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=a,this.div.style.cursor=l,this.#U()};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})}#L(e,i,r,n){this.width=r,this.height=n,this.x=e,this.y=i,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#U(){if(!this.#h)return;const{savedX:e,savedY:i,savedWidth:r,savedHeight:n}=this.#h;this.#h=null;const o=this.x,s=this.y,a=this.width,l=this.height;o===e&&s===i&&a===r&&l===n||this.addCommands({cmd:this.#L.bind(this,o,s,a,l),undo:this.#L.bind(this,e,i,r,n),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#_(e,i){const[r,n]=this.parentDimensions,o=this.x,s=this.y,a=this.width,l=this.height,c=vi.MIN_SIZE/r,d=vi.MIN_SIZE/n,u=this.#I(this.rotation),h=(N,z)=>[u[0]*N+u[2]*z,u[1]*N+u[3]*z],p=this.#I(360-this.rotation),g=(N,z)=>[p[0]*N+p[2]*z,p[1]*N+p[3]*z];let f,m,A=!1,y=!1;switch(e){case"topLeft":A=!0,f=(N,z)=>[0,0],m=(N,z)=>[N,z];break;case"topMiddle":f=(N,z)=>[N/2,0],m=(N,z)=>[N/2,z];break;case"topRight":A=!0,f=(N,z)=>[N,0],m=(N,z)=>[0,z];break;case"middleRight":y=!0,f=(N,z)=>[N,z/2],m=(N,z)=>[0,z/2];break;case"bottomRight":A=!0,f=(N,z)=>[N,z],m=(N,z)=>[0,0];break;case"bottomMiddle":f=(N,z)=>[N/2,z],m=(N,z)=>[N/2,0];break;case"bottomLeft":A=!0,f=(N,z)=>[0,z],m=(N,z)=>[N,0];break;case"middleLeft":y=!0,f=(N,z)=>[0,z/2],m=(N,z)=>[N,z/2];break}const v=f(a,l),b=m(a,l);let w=h(...b);const C=vi._round(o+w[0]),M=vi._round(s+w[1]);let E=1,B=1,S,I;if(i.fromKeyboard)({deltaX:S,deltaY:I}=i);else{const{screenX:N,screenY:z}=i,[G,X]=this.#c;[S,I]=this.screenToPageTranslation(N-G,z-X),this.#c[0]=N,this.#c[1]=z}if([S,I]=g(S/r,I/n),A){const N=Math.hypot(a,l);E=B=Math.max(Math.min(Math.hypot(b[0]-v[0]-S,b[1]-v[1]-I)/N,1/a,1/l),c/a,d/l)}else y?E=qa(Math.abs(b[0]-v[0]-S),c,1)/a:B=qa(Math.abs(b[1]-v[1]-I),d,1)/l;const T=vi._round(a*E),L=vi._round(l*B);w=h(...m(T,L));const O=C-w[0],j=M-w[1];this.#d||=[this.x,this.y,this.width,this.height],this.width=T,this.height=L,this.x=O,this.y=j,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#r?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#m)return this._editToolbar;this._editToolbar=new Jb(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[i,r]of e)await this._editToolbar.addButton(i,r);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#r?.destroy()}addContainer(e){const i=this._editToolbar?.div;i?i.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#r||(Zu.initialize(vi._l10n),this.#r=new Zu(this),this.#e&&(this.#r.data=this.#e,this.#e=null)),this.#r}get altTextData(){return this.#r?.data}set altTextData(e){this.#r&&(this.#r.data=e)}get guessedAltText(){return this.#r?.guessedText}async setGuessedAltText(e){await this.#r?.setGuessedText(e)}serializeAltText(e){return this.#r?.serialize(e)}hasAltText(){return!!this.#r&&!this.#r.isEmpty()}hasAltTextData(){return this.#r?.hasData()??!1}focusCommentButton(){this.#i?.focusButton()}addCommentButton(){return this.canAddComment?this.#i||=new EP(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#n){this._uiManager.isEditingMode()&&this.#n.classList.remove("hidden");return}this.hasComment&&(this.#n=this.#i.renderForStandalone(),this.div.append(this.#n))}}removeStandaloneCommentButton(){this.#i.removeStandaloneCommentButton(),this.#n=null}hideStandaloneCommentButton(){this.#n?.classList.add("hidden")}get comment(){const{data:{richText:e,text:i,date:r,deleted:n}}=this.#i;return{text:i,richText:e,date:r,deleted:n,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){this.#i||=new EP(this),this.#i.data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:i,richText:r}){if(!i||(this.#i||=new EP(this),this.#i.setInitialText(e,r),!this.annotationElementId))return;const n=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);n&&this.updateFromAnnotationLayer(n)}get hasEditedComment(){return this.#i?.hasBeenEdited()}get hasDeletedComment(){return this.#i?.isDeleted()}get hasComment(){return!!this.#i&&!this.#i.isEmpty()&&!this.#i.isDeleted()}async editComment(e){this.#i||=new EP(this),this.#i.edit(e)}toggleComment(e,i=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,i)}setSelectedCommentButton(e){this.#i.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){const[,,,i]=e.rect,[r]=this.pageDimensions,[n]=this.pageTranslation,o=n+r+1,s=i-100,a=o+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,s,a,i]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:i}}){this.#i.data=i?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=this.#o?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),this.#H();const[i,r]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*r/i).toFixed(2)}%`,e.style.maxHeight=`${(100*i/r).toFixed(2)}%`);const[n,o]=this.getInitialTranslation();return this.translate(n,o),N7e(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#E||=new ZI({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#q.bind(this),onPinching:this.#B.bind(this),onPinchEnd:this.#C.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#q(){this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#r?.toggle(!1),this.parent.togglePointerEvents(!1)}#B(e,i,r){let n=.7*(r/i)+1-.7;if(n===1)return;const o=this.#I(this.rotation),s=(w,C)=>[o[0]*w+o[2]*C,o[1]*w+o[3]*C],[a,l]=this.parentDimensions,c=this.x,d=this.y,u=this.width,h=this.height,p=vi.MIN_SIZE/a,g=vi.MIN_SIZE/l;n=Math.max(Math.min(n,1/u,1/h),p/u,g/h);const f=vi._round(u*n),m=vi._round(h*n);if(f===u&&m===h)return;this.#d||=[c,d,u,h];const A=s(u/2,h/2),y=vi._round(c+A[0]),v=vi._round(d+A[1]),b=s(f/2,m/2);this.x=y-b[0],this.y=v-b[1],this.width=f,this.height=m,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#C(){this.#r?.toggle(!0),this.parent.togglePointerEvents(!0),this.#U()}pointerdown(e){const{isMac:i}=Xo.platform;if(e.button!==0||e.ctrlKey&&i){e.preventDefault();return}if(this.#g=!0,this._isDraggable){this.#N(e);return}this.#R(e)}#R(e){const{isMac:i}=Xo.platform;e.ctrlKey&&!i||e.shiftKey||e.metaKey&&i?this.parent.toggleSelected(this):this.parent.setSelected(this)}#N(e){const{isSelected:i}=this;this._uiManager.setUpDragSession();let r=!1;const n=new AbortController,o=this._uiManager.combinedSignal(n),s={capture:!0,passive:!1,signal:o},a=c=>{n.abort(),this.#s=null,this.#g=!1,this._uiManager.endDragSession()||this.#R(c),r&&this._onStopDragging()};i&&(this.#k=e.clientX,this.#x=e.clientY,this.#s=e.pointerId,this.#a=e.pointerType,window.addEventListener("pointermove",c=>{r||(r=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:d,clientY:u,pointerId:h}=c;if(h!==this.#s){fo(c);return}const[p,g]=this.screenToPageTranslation(d-this.#k,u-this.#x);this.#k=d,this.#x=u,this._uiManager.dragSelectedEditors(p,g)},s),window.addEventListener("touchmove",fo,s),window.addEventListener("pointerdown",c=>{c.pointerType===this.#a&&(this.#E||c.isPrimary)&&a(c),fo(c)},s));const l=c=>{if(!this.#s||this.#s===c.pointerId){a(c);return}fo(c)};window.addEventListener("pointerup",l,{signal:o}),window.addEventListener("blur",l,{signal:o})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#v&&clearTimeout(this.#v),this.#v=setTimeout(()=>{this.#v=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,i,r){e.changeParent(this),this.x=i,this.y=r,this.fixAndSetPosition(),this._onTranslated()}getRect(e,i,r=this.rotation){const n=this.parentScale,[o,s]=this.pageDimensions,[a,l]=this.pageTranslation,c=e/n,d=i/n,u=this.x*o,h=this.y*s,p=this.width*o,g=this.height*s;switch(r){case 0:return[u+c+a,s-h-d-g+l,u+c+p+a,s-h-d+l];case 90:return[u+d+a,s-h+c+l,u+d+g+a,s-h+c+p+l];case 180:return[u-c-p+a,s-h+d+l,u-c+a,s-h+d+g+l];case 270:return[u-d-g+a,s-h-c-p+l,u-d+a,s-h-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,i){const[r,n,o,s]=e,a=o-r,l=s-n;switch(this.rotation){case 0:return[r,i-s,a,l];case 90:return[r,i-n,l,a];case 180:return[o,i-n,a,l];case 270:return[o,i-s,l,a];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&vi._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#i?.onUpdatedColor()}getData(){const{comment:{text:e,color:i,date:r,opacity:n,deleted:o,richText:s},uid:a,pageIndex:l,creationDate:c,modificationDate:d}=this;return{id:a,pageIndex:l,rect:this.getPDFRect(),richText:s,contentsObj:{str:e},creationDate:c,modificationDate:r||d,popupRef:!o,color:i,opacity:n}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#m=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#m=!1,!0):!1}isInEditMode(){return this.#m}shouldGetKeyboardEvents(){return this.#y}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:i,bottom:r,right:n}=this.getClientDimensions(),{innerHeight:o,innerWidth:s}=window;return i<s&&n>0&&e<o&&r>0}#H(){if(this.#p||!this.div)return;this.#p=new AbortController;const e=this._uiManager.combinedSignal(this.#p);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#H()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,i=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(e,i,r){const n=new this.prototype.constructor({parent:i,id:i.getNextId(),uiManager:r,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});n.rotation=e.rotation,n.#e=e.accessibilityData,n._isCopy=e.isCopy||!1;const[o,s]=n.pageDimensions,[a,l,c,d]=n.getRectInCurrentCoords(e.rect,s);return n.x=a/o,n.y=l/s,n.width=c/o,n.height=d/s,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#p?.abort(),this.#p=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#v&&(clearTimeout(this.#v),this.#v=null),this.#F(),this.removeEditToolbar(),this.#b){for(const e of this.#b.values())clearTimeout(e);this.#b=null}this.parent=null,this.#E?.destroy(),this.#E=null,this.#u?.remove(),this.#u=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#O(),this.#l.classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,i]}=this,[r,n,o,s]=this.getPDFRect();return[vi._round(r+(o-r)*e),vi._round(n+(s-n)*(1-i))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#i.commentPopupPositionInLayer}set commentPopupPosition(e){this.#i.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#i.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#i.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#i?.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const i=this.#l.children;if(!this.#t){this.#t=Array.from(i);const s=this.#K.bind(this),a=this.#Q.bind(this),l=this._uiManager._signal;for(const c of this.#t){const d=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",s,{signal:l}),c.addEventListener("blur",a,{signal:l}),c.addEventListener("focus",this.#W.bind(this,d),{signal:l}),c.setAttribute("data-l10n-id",vi._l10nResizer[d])}}const r=this.#t[0];let n=0;for(const s of i){if(s===r)break;n++}const o=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(o!==n){if(o<n)for(let a=0;a<n-o;a++)this.#l.append(this.#l.firstElementChild);else if(o>n)for(let a=0;a<o-n;a++)this.#l.firstElementChild.before(this.#l.lastElementChild);let s=0;for(const a of i){const l=this.#t[s++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",vi._l10nResizer[l])}}this.#V(0),this.#y=!0,this.#l.firstElementChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#K(e){vi._resizerKeyboardManager.exec(this,e)}#Q(e){this.#y&&e.relatedTarget?.parentNode!==this.#l&&this.#F()}#W(e){this.#A=this.#y?e:""}#V(e){if(this.#t)for(const i of this.#t)i.tabIndex=e}_resizeWithKeyboard(e,i){this.#y&&this.#_(this.#A,{deltaX:e,deltaY:i,fromKeyboard:!0})}#F(){this.#y=!1,this.#V(-1),this.#U()}_stopResizingWithKeyboard(){this.#F(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#r?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#l?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#r?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,i){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#f}set isEditing(e){this.#f=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,i=!1){if(i){this.#b||=new Map;const{action:r}=e;let n=this.#b.get(r);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(e),this.#b.delete(r),this.#b.size===0&&(this.#b=null)},vi._telemetryTimeout),this.#b.set(r,n);return}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#o=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#o=!0}updateFakeAnnotationElement(e){if(!this.#u&&!this.deleted){this.#u=e.addFakeAnnotation(this);return}if(this.deleted){this.#u.remove(),this.#u=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#u.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let i=e.container.querySelector(".annotationContent");if(!i)i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),e.container.prepend(i);else if(i.nodeName==="CANVAS"){const r=i;i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),r.before(i)}return i}resetAnnotationElement(e){const{firstElementChild:i}=e.container;i?.nodeName==="DIV"&&i.classList.contains("annotationContent")&&i.remove()}}class bLi extends vi{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const j7e=3285377520,Oc=4294901760,Lu=65535;let H7e=class{constructor(t){this.h1=t?t&4294967295:j7e,this.h2=t?t&4294967295:j7e}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,f=t.length;g<f;g++){const m=t.charCodeAt(g);m<=255?e[i++]=m:(e[i++]=m>>>8,e[i++]=m&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),i=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const r=i>>2,n=i-r*4,o=new Uint32Array(e.buffer,0,r);let s=0,a=0,l=this.h1,c=this.h2;const d=3432918353,u=461845907,h=d&Lu,p=u&Lu;for(let g=0;g<r;g++)g&1?(s=o[g],s=s*d&Oc|s*h&Lu,s=s<<15|s>>>17,s=s*u&Oc|s*p&Lu,l^=s,l=l<<13|l>>>19,l=l*5+3864292196):(a=o[g],a=a*d&Oc|a*h&Lu,a=a<<15|a>>>17,a=a*u&Oc|a*p&Lu,c^=a,c=c<<13|c>>>19,c=c*5+3864292196);switch(s=0,n){case 3:s^=e[r*4+2]<<16;case 2:s^=e[r*4+1]<<8;case 1:s^=e[r*4],s=s*d&Oc|s*h&Lu,s=s<<15|s>>>17,s=s*u&Oc|s*p&Lu,r&1?l^=s:c^=s}this.h1=l,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Oc|t*36045&Lu,e=e*4283543511&Oc|((e<<16|t>>>16)*2950163797&Oc)>>>16,t^=e>>>1,t=t*444984403&Oc|t*60499&Lu,e=e*3301882366&Oc|((e<<16|t>>>16)*3120437893&Oc)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}};const _q=Object.freeze({map:null,hash:"",transfer:void 0});class Fq{#e=!1;#t=null;#r=null;#i=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,i){const r=this.#i.get(e);return r===void 0?i:Object.assign(i,r)}getRawValue(e){return this.#i.get(e)}remove(e){const i=this.#i.get(e);if(i!==void 0&&(i instanceof vi&&this.#r.delete(i.annotationElementId),this.#i.delete(e),this.#i.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function")){for(const r of this.#i.values())if(r instanceof vi)return;this.onAnnotationEditor(null)}}setValue(e,i){const r=this.#i.get(e);let n=!1;if(r!==void 0)for(const[o,s]of Object.entries(i))r[o]!==s&&(n=!0,r[o]=s);else n=!0,this.#i.set(e,i);n&&this.#n(),i instanceof vi&&((this.#r||=new Map).set(i.annotationElementId,i),typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(i.constructor._type))}has(e){return this.#i.has(e)}get size(){return this.#i.size}#n(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new V7e(this)}get serializable(){if(this.#i.size===0)return _q;const e=new Map,i=new H7e,r=[],n=Object.create(null);let o=!1;for(const[s,a]of this.#i){const l=a instanceof vi?a.serialize(!1,n):a;l&&(e.set(s,l),i.update(`${s}:${JSON.stringify(l)}`),o||=!!l.bitmap)}if(o)for(const s of e.values())s.bitmap&&r.push(s.bitmap);return e.size>0?{map:e,hash:i.hexdigest(),transfer:r}:_q}get editorStats(){let e=null;const i=new Map;let r=0,n=0;for(const o of this.#i.values()){if(!(o instanceof vi)){o.popup&&(o.popup.deleted?n+=1:r+=1);continue}o.isCommentDeleted?n+=1:o.hasEditedComment&&(r+=1);const s=o.telemetryFinalData;if(!s)continue;const{type:a}=s;i.has(a)||i.set(a,Object.getPrototypeOf(o).constructor),e||=Object.create(null);const l=e[a]||=new Map;for(const[c,d]of Object.entries(s)){if(c==="type")continue;let u=l.get(c);u||(u=new Map,l.set(c,u));const h=u.get(d)??0;u.set(d,h+1)}}if((n>0||r>0)&&(e||=Object.create(null),e.comments={deleted:n,edited:r}),!e)return null;for(const[o,s]of i)e[o]=s.computeTelemetryFinalData(e[o]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,i){const r=this.#r?.get(e);return r?(r.updateFromAnnotationLayer(i),!0):!1}getEditor(e){return this.#r?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;const e=[];if(this.#r)for(const i of this.#r.values())i.serialize()&&e.push(i.annotationElementId);return this.#t={ids:new Set(e),hash:e.join(",")}}[Symbol.iterator](){return this.#i.entries()}}class V7e extends Fq{#e;constructor(e){super();const{map:i,hash:r,transfer:n}=e.serializable,o=structuredClone(i,n?{transfer:n}:null);this.#e={map:o,hash:r,transfer:n}}get print(){yn("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}get modifiedIds(){return Vi(this,"modifiedIds",{ids:new Set,hash:""})}}class wLi{#e=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:i=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const i=this.styleElement.sheet;i.insertRule(e,i.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:i,_inspectFont:r}){if(!(!e||this.#e.has(e.loadedName))){if(xr(!i,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:o,style:s}=e,a=new FontFace(n,o,s);this.addNativeFontFace(a);try{await a.load(),this.#e.add(n),r?.(e)}catch{Hi(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}yn("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const r=e.createNativeFontFace();if(r){this.addNativeFontFace(r);try{await r.loaded}catch(n){throw Hi(`Failed to load font '${r.family}': '${n}'.`),e.disableFontFace=!0,n}}return}const i=e.createFontFaceRule();if(i){if(this.insertRule(i),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const n=this._queueLoadingCallback(r);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return Vi(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Vi(this,"isSyncFontLoadingSupported",za||Xo.platform.isFirefox)}_queueLoadingCallback(e){function i(){for(xr(!n.done,"completeRequest() cannot be called twice."),n.done=!0;r.length>0&&r[0].done;){const o=r.shift();setTimeout(o.callback,0)}}const{loadingRequests:r}=this,n={done:!1,complete:i,callback:e};return r.push(n),n}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Vi(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,i){function r(v,b){return v.charCodeAt(b)<<24|v.charCodeAt(b+1)<<16|v.charCodeAt(b+2)<<8|v.charCodeAt(b+3)&255}function n(v,b,w,C){const M=v.substring(0,b),E=v.substring(b+w);return M+C+E}let o,s;const a=this._document.createElement("canvas");a.width=1,a.height=1;const l=a.getContext("2d");let c=0;function d(v,b){if(++c>30){Hi("Load test font never loaded."),b();return}if(l.font="30px "+v,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){b();return}setTimeout(d.bind(null,v,b))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let h=this._loadTestFont;h=n(h,976,u.length,u);const p=16,g=1482184792;let f=r(h,p);for(o=0,s=u.length-3;o<s;o+=4)f=f-g+r(u,o)|0;o<u.length&&(f=f-g+r(u+"XXX",o)|0),h=n(h,p,4,tLi(f));const m=`url(data:font/opentype;base64,${btoa(h)});`,A=`@font-face {font-family:"${u}";src:${m}}`;this.insertRule(A);const y=this._document.createElement("div");y.style.visibility="hidden",y.style.width=y.style.height="10px",y.style.position="absolute",y.style.top=y.style.left="0px";for(const v of[e.loadedName,u]){const b=this._document.createElement("span");b.textContent="Hi",b.style.fontFamily=v,y.append(b)}this._document.body.append(y),d(u,()=>{y.remove(),i.complete()})}}class CLi{#e;constructor(e,i=null,r,n){this.compiledGlyphs=Object.create(null),this.#e=e,this._inspectFont=i,r&&Object.assign(this,r),n&&(this.charProcOperatorList=n)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const i={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(i.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,i)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${S7e(this.data)});`;let i;if(!this.cssFontInfo)i=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let r=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(r+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${r}src:${e}}`}return this._inspectFont?.(this,e),i}getPathGenerator(e,i){if(this.compiledGlyphs[i]!==void 0)return this.compiledGlyphs[i];const r=this.loadedName+"_path_"+i;let n;try{n=e.get(r)}catch(s){Hi(`getPathGenerator - ignoring character: "${s}".`)}const o=U7e(n?.path);return this.fontExtraProperties||e.delete(r),this.compiledGlyphs[i]=o}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace??!1}set disableFontFace(e){Vi(this,"disableFontFace",!!e)}get fontExtraProperties(){return this.#e.fontExtraProperties??!1}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}set bbox(e){Vi(this,"bbox",e)}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}}let z7e=class zI{#e;#t;#r;static strings=["fontFamily","fontWeight","italicAngle"];static write(e){const i=new TextEncoder,r={};let n=0;for(const c of zI.strings){const d=i.encode(e[c]);r[c]=d,n+=4+d.length}const o=new ArrayBuffer(n),s=new Uint8Array(o),a=new DataView(o);let l=0;for(const c of zI.strings){const d=r[c],u=d.length;a.setUint32(l,u),s.set(d,l+4),l+=4+u}return xr(l===o.byteLength,"CssFontInfo.write: Buffer overflow"),o}constructor(e){this.#e=e,this.#t=new DataView(this.#e),this.#r=new TextDecoder}#i(e){xr(e<zI.strings.length,"Invalid string index");let i=0;for(let n=0;n<e;n++)i+=this.#t.getUint32(i)+4;const r=this.#t.getUint32(i);return this.#r.decode(new Uint8Array(this.#e,i+4,r))}get fontFamily(){return this.#i(0)}get fontWeight(){return this.#i(1)}get italicAngle(){return this.#i(2)}},q7e=class qI{#e;#t;#r;static strings=["css","loadedName","baseFontName","src"];static write(e){const i=new TextEncoder,r={};let n=0;for(const h of qI.strings){const p=i.encode(e[h]);r[h]=p,n+=4+p.length}n+=4;let o,s,a=1+n;e.style&&(o=i.encode(e.style.style),s=i.encode(e.style.weight),a+=4+o.length+4+s.length);const l=new ArrayBuffer(a),c=new Uint8Array(l),d=new DataView(l);let u=0;d.setUint8(u++,e.guessFallback?1:0),d.setUint32(u,0),u+=4,n=0;for(const h of qI.strings){const p=r[h],g=p.length;n+=4+g,d.setUint32(u,g),c.set(p,u+4),u+=4+g}return d.setUint32(u-n-4,n),e.style&&(d.setUint32(u,o.length),c.set(o,u+4),u+=4+o.length,d.setUint32(u,s.length),c.set(s,u+4),u+=4+s.length),xr(u<=l.byteLength,"SubstitionInfo.write: Buffer overflow"),l.transferToFixedLength(u)}constructor(e){this.#e=e,this.#t=new DataView(this.#e),this.#r=new TextDecoder}get guessFallback(){return this.#t.getUint8(0)!==0}#i(e){xr(e<qI.strings.length,"Invalid string index");let i=5;for(let n=0;n<e;n++)i+=this.#t.getUint32(i)+4;const r=this.#t.getUint32(i);return this.#r.decode(new Uint8Array(this.#e,i+4,r))}get css(){return this.#i(0)}get loadedName(){return this.#i(1)}get baseFontName(){return this.#i(2)}get src(){return this.#i(3)}get style(){let e=1;e+=4+this.#t.getUint32(e);const i=this.#t.getUint32(e),r=this.#r.decode(new Uint8Array(this.#e,e+4,i));e+=4+i;const n=this.#t.getUint32(e),o=this.#r.decode(new Uint8Array(this.#e,e+4,n));return{style:r,weight:o}}},xLi=class wn{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static#e=Math.ceil(this.bools.length*2/8);static#t=this.#e+this.numbers.length*8;static#r=this.#t+1+8;static#i=this.#r+1+48;static#n=this.#i+1+6;#o;#s;#a;constructor({data:e,extra:i}){this.#o=e,this.#s=new TextDecoder,this.#a=new DataView(this.#o),i&&Object.assign(this,i)}#l(e){xr(e<wn.bools.length,"Invalid boolean index");const i=Math.floor(e/4),r=e*2%8,n=this.#a.getUint8(i)>>r&3;return n===0?void 0:n===2}get black(){return this.#l(0)}get bold(){return this.#l(1)}get disableFontFace(){return this.#l(2)}get fontExtraProperties(){return this.#l(3)}get isInvalidPDFjsFont(){return this.#l(4)}get isType3Font(){return this.#l(5)}get italic(){return this.#l(6)}get missingFile(){return this.#l(7)}get remeasure(){return this.#l(8)}get vertical(){return this.#l(9)}#c(e){return xr(e<wn.numbers.length,"Invalid number index"),this.#a.getFloat64(wn.#e+e*8)}get ascent(){return this.#c(0)}get defaultWidth(){return this.#c(1)}get descent(){return this.#c(2)}get bbox(){let e=wn.#t;if(this.#a.getUint8(e)===0)return;e+=1;const i=[];for(let r=0;r<4;r++)i.push(this.#a.getInt16(e,!0)),e+=2;return i}get fontMatrix(){let e=wn.#r;if(this.#a.getUint8(e)===0)return;e+=1;const i=[];for(let r=0;r<6;r++)i.push(this.#a.getFloat64(e,!0)),e+=8;return i}get defaultVMetrics(){let e=wn.#i;if(this.#a.getUint8(e)===0)return;e+=1;const i=[];for(let r=0;r<3;r++)i.push(this.#a.getInt16(e,!0)),e+=2;return i}#h(e){xr(e<wn.strings.length,"Invalid string index");let i=wn.#n+4;for(let o=0;o<e;o++)i+=this.#a.getUint32(i)+4;const r=this.#a.getUint32(i),n=new Uint8Array(r);return n.set(new Uint8Array(this.#o,i+4,r)),this.#s.decode(n)}get fallbackName(){return this.#h(0)}get loadedName(){return this.#h(1)}get mimetype(){return this.#h(2)}get name(){return this.#h(3)}get data(){let e=wn.#n;const i=this.#a.getUint32(e);e+=4+i;const r=this.#a.getUint32(e);e+=4+r;const n=this.#a.getUint32(e);e+=4+n;const o=this.#a.getUint32(e);if(o!==0)return new Uint8Array(this.#o,e+4,o)}clearData(){let e=wn.#n;const i=this.#a.getUint32(e);e+=4+i;const r=this.#a.getUint32(e);e+=4+r;const n=this.#a.getUint32(e);e+=4+n;const o=this.#a.getUint32(e);new Uint8Array(this.#o,e+4,o).fill(0),this.#a.setUint32(e,0)}get cssFontInfo(){let e=wn.#n;const i=this.#a.getUint32(e);e+=4+i;const r=this.#a.getUint32(e);e+=4+r;const n=this.#a.getUint32(e);if(n===0)return null;const o=new Uint8Array(n);return o.set(new Uint8Array(this.#o,e+4,n)),new z7e(o.buffer)}get systemFontInfo(){let e=wn.#n;const i=this.#a.getUint32(e);e+=4+i;const r=this.#a.getUint32(e);if(r===0)return null;const n=new Uint8Array(r);return n.set(new Uint8Array(this.#o,e+4,r)),new q7e(n.buffer)}static write(e){const i=e.systemFontInfo?q7e.write(e.systemFontInfo):null,r=e.cssFontInfo?z7e.write(e.cssFontInfo):null,n=new TextEncoder,o={};let s=0;for(const f of wn.strings)o[f]=n.encode(e[f]),s+=4+o[f].length;const a=wn.#n+4+s+4+(i?i.byteLength:0)+4+(r?r.byteLength:0)+4+(e.data?e.data.length:0),l=new ArrayBuffer(a),c=new Uint8Array(l),d=new DataView(l);let u=0;const h=wn.bools.length;let p=0,g=0;for(let f=0;f<h;f++){const m=e[wn.bools[f]];p|=(m===void 0?0:m?2:1)<<g,g+=2,(g===8||f===h-1)&&(d.setUint8(u++,p),p=0,g=0)}xr(u===wn.#e,"FontInfo.write: Boolean properties offset mismatch");for(const f of wn.numbers)d.setFloat64(u,e[f]),u+=8;if(xr(u===wn.#t,"FontInfo.write: Number properties offset mismatch"),e.bbox){d.setUint8(u++,4);for(const f of e.bbox)d.setInt16(u,f,!0),u+=2}else d.setUint8(u++,0),u+=8;if(xr(u===wn.#r,"FontInfo.write: BBox properties offset mismatch"),e.fontMatrix){d.setUint8(u++,6);for(const f of e.fontMatrix)d.setFloat64(u,f,!0),u+=8}else d.setUint8(u++,0),u+=48;if(xr(u===wn.#i,"FontInfo.write: FontMatrix properties offset mismatch"),e.defaultVMetrics){d.setUint8(u++,1);for(const f of e.defaultVMetrics)d.setInt16(u,f,!0),u+=2}else d.setUint8(u++,0),u+=6;xr(u===wn.#n,"FontInfo.write: DefaultVMetrics properties offset mismatch"),d.setUint32(wn.#n,0),u+=4;for(const f of wn.strings){const m=o[f],A=m.length;d.setUint32(u,A),c.set(m,u+4),u+=4+A}if(d.setUint32(wn.#n,u-wn.#n-4),!i)d.setUint32(u,0),u+=4;else{const f=i.byteLength;d.setUint32(u,f),xr(u+4+f<=l.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),c.set(new Uint8Array(i),u+4),u+=4+f}if(!r)d.setUint32(u,0),u+=4;else{const f=r.byteLength;d.setUint32(u,f),xr(u+4+f<=l.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),c.set(new Uint8Array(r),u+4),u+=4+f}return e.data===void 0?(d.setUint32(u,0),u+=4):(d.setUint32(u,e.data.length),c.set(e.data,u+4),u+=4+e.data.length),xr(u<=l.byteLength,"FontInfo.write: Buffer overflow"),l.transferToFixedLength(u)}},kLi=class Ws{static#e=0;static#t=1;static#r=2;static#i=3;static#n=4;static#o=8;static#s=12;static#a=16;constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}static write(e){let i,r=null,n=[],o=[],s=[],a=[],l=null,c=null;switch(e[0]){case"RadialAxial":i=e[1]==="axial"?1:2,r=e[2],s=e[3],i===1?n.push(...e[4],...e[5]):n.push(e[4][0],e[4][1],e[6],e[5][0],e[5][1],e[7]);break;case"Mesh":i=3,l=e[1],n=e[2],o=e[3],a=e[4]||[],r=e[6],c=e[7];break;default:throw new Error(`Unsupported pattern type: ${e[0]}`)}const d=Math.floor(n.length/2),u=Math.floor(o.length/3),h=s.length,p=a.length;let g=0;for(const b of a)g+=1,g=Math.ceil(g/4)*4,g+=4+b.coords.length*4,g+=4+b.colors.length*4,b.verticesPerRow!==void 0&&(g+=4);const f=20+d*8+u*3+h*8+(r?16:0)+(c?3:0)+g,m=new ArrayBuffer(f),A=new DataView(m),y=new Uint8Array(m);A.setUint8(Ws.#e,i),A.setUint8(Ws.#t,r?1:0),A.setUint8(Ws.#r,c?1:0),A.setUint8(Ws.#i,l),A.setUint32(Ws.#n,d,!0),A.setUint32(Ws.#o,u,!0),A.setUint32(Ws.#s,h,!0),A.setUint32(Ws.#a,p,!0);let v=20;new Float32Array(m,v,d*2).set(n),v+=d*8,y.set(o,v),v+=u*3;for(const[b,w]of s)A.setFloat32(v,b,!0),v+=4,A.setUint32(v,parseInt(w.slice(1),16),!0),v+=4;if(r)for(const b of r)A.setFloat32(v,b,!0),v+=4;c&&(y.set(c,v),v+=3);for(let b=0;b<a.length;b++){const w=a[b];A.setUint8(v,w.type),v+=1,v=Math.ceil(v/4)*4,A.setUint32(v,w.coords.length,!0),v+=4,new Int32Array(m,v,w.coords.length).set(w.coords),v+=w.coords.length*4,A.setUint32(v,w.colors.length,!0),v+=4,new Int32Array(m,v,w.colors.length).set(w.colors),v+=w.colors.length*4,w.verticesPerRow!==void 0&&(A.setUint32(v,w.verticesPerRow,!0),v+=4)}return m}getIR(){const e=this.view,i=this.data[Ws.#e],r=!!this.data[Ws.#t],n=!!this.data[Ws.#r],o=e.getUint32(Ws.#n,!0),s=e.getUint32(Ws.#o,!0),a=e.getUint32(Ws.#s,!0),l=e.getUint32(Ws.#a,!0);let c=20;const d=new Float32Array(this.buffer,c,o*2);c+=o*8;const u=new Uint8Array(this.buffer,c,s*3);c+=s*3;const h=[];for(let m=0;m<a;++m){const A=e.getFloat32(c,!0);c+=4;const y=e.getUint32(c,!0);c+=4,h.push([A,`#${y.toString(16).padStart(6,"0")}`])}let p=null;if(r){p=[];for(let m=0;m<4;++m)p.push(e.getFloat32(c,!0)),c+=4}let g=null;n&&(g=new Uint8Array(this.buffer,c,3),c+=3);const f=[];for(let m=0;m<l;++m){const A=e.getUint8(c);c+=1,c=Math.ceil(c/4)*4;const y=e.getUint32(c,!0);c+=4;const v=new Int32Array(this.buffer,c,y);c+=y*4;const b=e.getUint32(c,!0);c+=4;const w=new Int32Array(this.buffer,c,b);c+=b*4;const C={type:A,coords:v,colors:w};A===Mq.LATTICE&&(C.verticesPerRow=e.getUint32(c,!0),c+=4),f.push(C)}if(i===1)return["RadialAxial","axial",p,h,Array.from(d.slice(0,2)),Array.from(d.slice(2,4)),null,null];if(i===2)return["RadialAxial","radial",p,h,[d[0],d[1]],[d[3],d[4]],d[2],d[5]];if(i===3){const m=this.data[Ws.#i];let A=null;if(d.length>0){let y=d[0],v=d[0],b=d[1],w=d[1];for(let C=0;C<d.length;C+=2){const M=d[C],E=d[C+1];y=y>M?M:y,b=b>E?E:b,v=v<M?M:v,w=w<E?E:w}A=[y,b,v,w]}return["Mesh",m,d,u,f,A,p,g]}throw new Error(`Unsupported pattern kind: ${i}`)}},MLi=class{static write(t){let e,i;return Xo.isFloat16ArraySupported?(i=new ArrayBuffer(t.length*2),e=new Float16Array(i)):(i=new ArrayBuffer(t.length*4),e=new Float32Array(i)),e.set(t),i}#e;constructor(t){this.#e=t}get path(){return Xo.isFloat16ArraySupported?new Float16Array(this.#e):new Float32Array(this.#e)}};function ELi(t){if(t instanceof URL)return t.href;if(typeof t=="string"){if(za)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function BLi(t){if(za&&typeof Buffer<"u"&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if(typeof t=="string")return Ey(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="object"&&!isNaN(t?.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function BP(t){if(typeof t!="string")return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}const Oq=t=>typeof t=="object"&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0,PLi=t=>typeof t=="object"&&typeof t?.name=="string",ILi=sLi.bind(null,Oq,PLi);class SLi{#e=new Map;#t=Promise.resolve();postMessage(e,i){const r={data:structuredClone(e,i?{transfer:i}:null)};this.#t.then(()=>{for(const[n]of this.#e)n.call(this,r)})}addEventListener(e,i,r=null){let n=null;if(r?.signal instanceof AbortSignal){const{signal:o}=r;if(o.aborted){Hi("LoopbackPort - cannot use an `aborted` signal.");return}const s=()=>this.removeEventListener(e,i);n=()=>o.removeEventListener("abort",s),o.addEventListener("abort",s)}this.#e.set(i,n)}removeEventListener(e,i){this.#e.get(i)?.(),this.#e.delete(i)}terminate(){for(const[,e]of this.#e)e?.();this.#e.clear()}}const PP={DATA:1,ERROR:2},No={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function G7e(){}function bl(t){if(t instanceof t0||t instanceof Bq||t instanceof E7e||t instanceof kP||t instanceof Eq)return t;switch(t instanceof Error||typeof t=="object"&&t!==null||yn('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new t0(t.message);case"InvalidPDFException":return new Bq(t.message);case"PasswordException":return new E7e(t.message,t.code);case"ResponseException":return new kP(t.message,t.status,t.missing);case"UnknownErrorException":return new Eq(t.message,t.details)}return new Eq(t.message,t.toString())}let Ty=class{#e=new AbortController;constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#t.bind(this),{signal:this.#e.signal})}#t({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){this.#i(t);return}if(t.callback){const i=t.callbackId,r=this.callbackCapabilities[i];if(!r)throw new Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],t.callback===PP.DATA)r.resolve(t.data);else if(t.callback===PP.ERROR)r.reject(bl(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const i=this.sourceName,r=t.sourceName,n=this.comObj;Promise.try(e,t.data).then(function(o){n.postMessage({sourceName:i,targetName:r,callback:PP.DATA,callbackId:t.callbackId,data:o})},function(o){n.postMessage({sourceName:i,targetName:r,callback:PP.ERROR,callbackId:t.callbackId,reason:bl(o)})});return}if(t.streamId){this.#r(t);return}e(t.data)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const r=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[r]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:r,data:e},i)}catch(o){n.reject(o)}return n.promise}sendWithStream(t,e,i,r){const n=this.streamId++,o=this.sourceName,s=this.targetName,a=this.comObj;return new ReadableStream({start:l=>{const c=Promise.withResolvers();return this.streamControllers[n]={controller:l,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},a.postMessage({sourceName:o,targetName:s,action:t,streamId:n,data:e,desiredSize:l.desiredSize},r),c.promise},pull:l=>{const c=Promise.withResolvers();return this.streamControllers[n].pullCall=c,a.postMessage({sourceName:o,targetName:s,stream:No.PULL,streamId:n,desiredSize:l.desiredSize}),c.promise},cancel:l=>{xr(l instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[n].cancelCall=c,this.streamControllers[n].isClosed=!0,a.postMessage({sourceName:o,targetName:s,stream:No.CANCEL,streamId:n,reason:bl(l)}),c.promise}},i)}#r(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,n=this.comObj,o=this,s=this.actionHandler[t.action],a={enqueue(l,c=1,d){if(this.isCancelled)return;const u=this.desiredSize;this.desiredSize-=c,u>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:r,stream:No.ENQUEUE,streamId:e,chunk:l},d)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:r,stream:No.CLOSE,streamId:e}),delete o.streamSinks[e])},error(l){xr(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:r,stream:No.ERROR,streamId:e,reason:bl(l)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};a.sinkCapability.resolve(),a.ready=a.sinkCapability.promise,this.streamSinks[e]=a,Promise.try(s,t.data,a).then(function(){n.postMessage({sourceName:i,targetName:r,stream:No.START_COMPLETE,streamId:e,success:!0})},function(l){n.postMessage({sourceName:i,targetName:r,stream:No.START_COMPLETE,streamId:e,reason:bl(l)})})}#i(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,n=this.comObj,o=this.streamControllers[e],s=this.streamSinks[e];switch(t.stream){case No.START_COMPLETE:t.success?o.startCall.resolve():o.startCall.reject(bl(t.reason));break;case No.PULL_COMPLETE:t.success?o.pullCall.resolve():o.pullCall.reject(bl(t.reason));break;case No.PULL:if(!s){n.postMessage({sourceName:i,targetName:r,stream:No.PULL_COMPLETE,streamId:e,success:!0});break}s.desiredSize<=0&&t.desiredSize>0&&s.sinkCapability.resolve(),s.desiredSize=t.desiredSize,Promise.try(s.onPull||G7e).then(function(){n.postMessage({sourceName:i,targetName:r,stream:No.PULL_COMPLETE,streamId:e,success:!0})},function(l){n.postMessage({sourceName:i,targetName:r,stream:No.PULL_COMPLETE,streamId:e,reason:bl(l)})});break;case No.ENQUEUE:if(xr(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case No.CLOSE:if(xr(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),this.#n(o,e);break;case No.ERROR:xr(o,"error should have stream controller"),o.controller.error(bl(t.reason)),this.#n(o,e);break;case No.CANCEL_COMPLETE:t.success?o.cancelCall.resolve():o.cancelCall.reject(bl(t.reason)),this.#n(o,e);break;case No.CANCEL:if(!s)break;const a=bl(t.reason);Promise.try(s.onCancel||G7e,a).then(function(){n.postMessage({sourceName:i,targetName:r,stream:No.CANCEL_COMPLETE,streamId:e,success:!0})},function(l){n.postMessage({sourceName:i,targetName:r,stream:No.CANCEL_COMPLETE,streamId:e,reason:bl(l)})}),s.sinkCapability.reject(a),s.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#n(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#e?.abort(),this.#e=null}};class Q7e{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,i){if(e<=0||i<=0)throw new Error("Invalid canvas size");const r=this._createCanvas(e,i);return{canvas:r,context:r.getContext("2d",{willReadFrequently:!this.#e})}}reset(e,i,r){if(!e.canvas)throw new Error("Canvas is not specified");if(i<=0||r<=0)throw new Error("Invalid canvas size");e.canvas.width=i,e.canvas.height=r}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,i){yn("Abstract method `_createCanvas` called.")}}class TLi extends Q7e{constructor({ownerDocument:e=globalThis.document,enableHWA:i=!1}){super({enableHWA:i}),this._document=e}_createCanvas(e,i){const r=this._document.createElement("canvas");return r.width=e,r.height=i,r}}class K7e{constructor({baseUrl:e=null,isCompressed:i=!0}){this.baseUrl=e,this.isCompressed=i}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then(r=>({cMapData:r,isCompressed:this.isCompressed})).catch(r=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)})}async _fetch(e){yn("Abstract method `_fetch` called.")}}class W7e extends K7e{async _fetch(e){const i=await By(e,this.isCompressed?"arraybuffer":"text");return i instanceof ArrayBuffer?new Uint8Array(i):Ey(i)}}class J7e{addFilter(e){return"none"}addHCMFilter(e,i){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,i,r,n,o){return"none"}destroy(e=!1){}}class DLi extends J7e{#e;#t;#r;#i;#n;#o;#s=0;constructor({docId:e,ownerDocument:i=globalThis.document}){super(),this.#i=e,this.#n=i}get#a(){return this.#t||=new Map}get#l(){return this.#o||=new Map}get#c(){if(!this.#r){const e=this.#n.createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const r=this.#n.createElementNS(d1,"svg");r.setAttribute("width",0),r.setAttribute("height",0),this.#r=this.#n.createElementNS(d1,"defs"),e.append(r),r.append(this.#r),this.#n.body.append(e)}return this.#r}#h(e){if(e.length===1){const l=e[0],c=new Array(256);for(let u=0;u<256;u++)c[u]=l[u]/255;const d=c.join(",");return[d,d,d]}const[i,r,n]=e,o=new Array(256),s=new Array(256),a=new Array(256);for(let l=0;l<256;l++)o[l]=i[l]/255,s[l]=r[l]/255,a[l]=n[l]/255;return[o.join(","),s.join(","),a.join(",")]}#u(e){if(this.#e===void 0){this.#e="";const i=this.#n.URL;i!==this.#n.baseURI&&(MP(i)?Hi('#createUrl: ignore "data:"-URL for performance reasons.'):this.#e=M7e(i,""))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return"none";let i=this.#a.get(e);if(i)return i;const[r,n,o]=this.#h(e),s=e.length===1?r:`${r}${n}${o}`;if(i=this.#a.get(s),i)return this.#a.set(e,i),i;const a=`g_${this.#i}_transfer_map_${this.#s++}`,l=this.#u(a);this.#a.set(e,l),this.#a.set(s,l);const c=this.#g(a);return this.#f(r,n,o,c),l}addHCMFilter(e,i){const r=`${e}-${i}`,n="base";let o=this.#l.get(n);if(o?.key===r||(o?(o.filter?.remove(),o.key=r,o.url="none",o.filter=null):(o={key:r,url:"none",filter:null},this.#l.set(n,o)),!e||!i))return o.url;const s=this.#y(e);e=Yt.makeHexColor(...s);const a=this.#y(i);if(i=Yt.makeHexColor(...a),this.#c.style.color="",e==="#000000"&&i==="#ffffff"||e===i)return o.url;const l=new Array(256);for(let p=0;p<=255;p++){const g=p/255;l[p]=g<=.03928?g/12.92:((g+.055)/1.055)**2.4}const c=l.join(","),d=`g_${this.#i}_hcm_filter`,u=o.filter=this.#g(d);this.#f(c,c,c,u),this.#A(u);const h=(p,g)=>{const f=s[p]/255,m=a[p]/255,A=new Array(g+1);for(let y=0;y<=g;y++)A[y]=f+y/g*(m-f);return A.join(",")};return this.#f(h(0,5),h(1,5),h(2,5),u),o.url=this.#u(d),o.url}addAlphaFilter(e){let i=this.#a.get(e);if(i)return i;const[r]=this.#h([e]),n=`alpha_${r}`;if(i=this.#a.get(n),i)return this.#a.set(e,i),i;const o=`g_${this.#i}_alpha_map_${this.#s++}`,s=this.#u(o);this.#a.set(e,s),this.#a.set(n,s);const a=this.#g(o);return this.#m(r,a),s}addLuminosityFilter(e){let i=this.#a.get(e||"luminosity");if(i)return i;let r,n;if(e?([r]=this.#h([e]),n=`luminosity_${r}`):n="luminosity",i=this.#a.get(n),i)return this.#a.set(e,i),i;const o=`g_${this.#i}_luminosity_map_${this.#s++}`,s=this.#u(o);this.#a.set(e,s),this.#a.set(n,s);const a=this.#g(o);return this.#p(a),e&&this.#m(r,a),s}addHighlightHCMFilter(e,i,r,n,o){const s=`${i}-${r}-${n}-${o}`;let a=this.#l.get(e);if(a?.key===s||(a?(a.filter?.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},this.#l.set(e,a)),!i||!r))return a.url;const[l,c]=[i,r].map(this.#y.bind(this));let d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[h,p]=[n,o].map(this.#y.bind(this));u<d&&([d,u,h,p]=[u,d,p,h]),this.#c.style.color="";const g=(A,y,v)=>{const b=new Array(256),w=(u-d)/v,C=A/255,M=(y-A)/(255*v);let E=0;for(let B=0;B<=v;B++){const S=Math.round(d+B*w),I=C+B*M;for(let T=E;T<=S;T++)b[T]=I;E=S+1}for(let B=E;B<256;B++)b[B]=b[E-1];return b.join(",")},f=`g_${this.#i}_hcm_${e}_filter`,m=a.filter=this.#g(f);return this.#A(m),this.#f(g(h[0],p[0],5),g(h[1],p[1],5),g(h[2],p[2],5),m),a.url=this.#u(f),a.url}destroy(e=!1){e&&this.#o?.size||(this.#r?.parentNode.parentNode.remove(),this.#r=null,this.#t?.clear(),this.#t=null,this.#o?.clear(),this.#o=null,this.#s=0)}#p(e){const i=this.#n.createElementNS(d1,"feColorMatrix");i.setAttribute("type","matrix"),i.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(i)}#A(e){const i=this.#n.createElementNS(d1,"feColorMatrix");i.setAttribute("type","matrix"),i.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(i)}#g(e){const i=this.#n.createElementNS(d1,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),this.#c.append(i),i}#d(e,i,r){const n=this.#n.createElementNS(d1,i);n.setAttribute("type","discrete"),n.setAttribute("tableValues",r),e.append(n)}#f(e,i,r,n){const o=this.#n.createElementNS(d1,"feComponentTransfer");n.append(o),this.#d(o,"feFuncR",e),this.#d(o,"feFuncG",i),this.#d(o,"feFuncB",r)}#m(e,i){const r=this.#n.createElementNS(d1,"feComponentTransfer");i.append(r),this.#d(r,"feFuncA",e)}#y(e){return this.#c.style.color=e,Iy(getComputedStyle(this.#c).getPropertyValue("color"))}}class Z7e{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const i=`${this.baseUrl}${e}`;return this._fetch(i).catch(r=>{throw new Error(`Unable to load font data at: ${i}`)})}async _fetch(e){yn("Abstract method `_fetch` called.")}}class X7e extends Z7e{async _fetch(e){const i=await By(e,"arraybuffer");return new Uint8Array(i)}}class Y7e{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const i=`${this.baseUrl}${e}`;return this._fetch(i).catch(r=>{throw new Error(`Unable to load wasm data at: ${i}`)})}async _fetch(e){yn("Abstract method `_fetch` called.")}}class $7e extends Y7e{async _fetch(e){const i=await By(e,"arraybuffer");return new Uint8Array(i)}}za&&Hi("Please use the `legacy` build in Node.js environments.");async function Uq(t){const e=await process.getBuiltinModule("fs").promises.readFile(t);return new Uint8Array(e)}class RLi extends J7e{}class LLi extends Q7e{_createCanvas(e,i){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,i)}}class _Li extends K7e{async _fetch(e){return Uq(e)}}class FLi extends Z7e{async _fetch(e){return Uq(e)}}class OLi extends Y7e{async _fetch(e){return Uq(e)}}const Y5="__forcedDependency",{floor:eye,ceil:tye}=Math;function IP(t,e,i,r,n,o){t[e*4+0]=Math.min(t[e*4+0],i),t[e*4+1]=Math.min(t[e*4+1],r),t[e*4+2]=Math.max(t[e*4+2],n),t[e*4+3]=Math.max(t[e*4+3],o)}const Nq=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class ULi{#e;#t;constructor(e,i){this.#e=e,this.#t=i}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===Nq}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}}const SP=(t,e)=>{if(!t)return;let i=t.get(e);return i||(i={dependencies:new Set,isRenderingOperation:!1},t.set(e,i)),i};class NLi{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[Y5]:[]};#r=new Map;#i=[];#n=[];#o=[[1,0,0,1,0,0]];#s=[-1/0,-1/0,1/0,1/0];#a=new Float64Array([1/0,1/0,-1/0,-1/0]);#l=-1;#c=new Set;#h=new Map;#u=new Map;#p;#A;#g;#d;#f;constructor(e,i,r=!1){this.#p=e.width,this.#A=e.height,this.#m(i),r&&(this.#f=new Map)}growOperationsCount(e){e>=this.#d.length&&this.#m(e,this.#d)}#m(e,i){const r=new ArrayBuffer(e*4);this.#g=new Uint8ClampedArray(r),this.#d=new Uint32Array(r),i&&i.length>0?(this.#d.set(i),this.#d.fill(Nq,i.length)):this.#d.fill(Nq)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[Y5]:{__proto__:this.#t[Y5]}},this.#s={__proto__:this.#s},this.#i.push(e),this}restore(e){const i=Object.getPrototypeOf(this.#e);if(i===null)return this;this.#e=i,this.#t=Object.getPrototypeOf(this.#t),this.#s=Object.getPrototypeOf(this.#s);const r=this.#i.pop();return r!==void 0&&(SP(this.#f,e)?.dependencies.add(r),this.#d[e]=this.#d[r]),this}recordOpenMarker(e){return this.#i.push(e),this}getOpenMarker(){return this.#i.length===0?null:this.#i.at(-1)}recordCloseMarker(e){const i=this.#i.pop();return i!==void 0&&(SP(this.#f,e)?.dependencies.add(i),this.#d[e]=this.#d[i]),this}beginMarkedContent(e){return this.#n.push(e),this}endMarkedContent(e){const i=this.#n.pop();return i!==void 0&&(SP(this.#f,e)?.dependencies.add(i),this.#d[e]=this.#d[i]),this}pushBaseTransform(e){return this.#o.push(Yt.multiplyByDOMMatrix(this.#o.at(-1),e.getTransform())),this}popBaseTransform(){return this.#o.length>1&&this.#o.pop(),this}recordSimpleData(e,i){return this.#e[e]=i,this}recordIncrementalData(e,i){return this.#t[e].push(i),this}resetIncrementalData(e,i){return this.#t[e].length=0,this}recordNamedData(e,i){return this.#r.set(e,i),this}recordSimpleDataFromNamed(e,i,r){this.#e[e]=this.#r.get(i)??r}recordFutureForcedDependency(e,i){return this.recordIncrementalData(Y5,i),this}inheritSimpleDataAsFutureForcedDependencies(e){for(const i of e)i in this.#e&&this.recordFutureForcedDependency(i,this.#e[i]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of this.#c)this.recordFutureForcedDependency(Y5,e);return this}resetBBox(e){return this.#l!==e&&(this.#l=e,this.#a[0]=1/0,this.#a[1]=1/0,this.#a[2]=-1/0,this.#a[3]=-1/0),this}recordClipBox(e,i,r,n,o,s){const a=Yt.multiplyByDOMMatrix(this.#o.at(-1),i.getTransform()),l=[1/0,1/0,-1/0,-1/0];Yt.axialAlignedBoundingBox([r,o,n,s],a,l);const c=Yt.intersect(this.#s,l);return c?(this.#s[0]=c[0],this.#s[1]=c[1],this.#s[2]=c[2],this.#s[3]=c[3]):(this.#s[0]=this.#s[1]=1/0,this.#s[2]=this.#s[3]=-1/0),this}recordBBox(e,i,r,n,o,s){const a=this.#s;if(a[0]===1/0)return this;const l=Yt.multiplyByDOMMatrix(this.#o.at(-1),i.getTransform());if(a[0]===-1/0)return Yt.axialAlignedBoundingBox([r,o,n,s],l,this.#a),this;const c=[1/0,1/0,-1/0,-1/0];return Yt.axialAlignedBoundingBox([r,o,n,s],l,c),this.#a[0]=Math.min(this.#a[0],Math.max(c[0],a[0])),this.#a[1]=Math.min(this.#a[1],Math.max(c[1],a[1])),this.#a[2]=Math.max(this.#a[2],Math.min(c[2],a[2])),this.#a[3]=Math.max(this.#a[3],Math.min(c[3],a[3])),this}recordCharacterBBox(e,i,r,n=1,o=0,s=0,a){const l=r.bbox;let c,d;if(l&&(c=l[2]!==l[0]&&l[3]!==l[1]&&this.#u.get(r),c!==!1&&(d=[0,0,0,0],Yt.axialAlignedBoundingBox(l,r.fontMatrix,d),(n!==1||o!==0||s!==0)&&Yt.scaleMinMax([n,0,0,-n,o,s],d),c)))return this.recordBBox(e,i,d[0],d[2],d[1],d[3]);if(!a)return this.recordFullPageBBox(e);const u=a();return l&&d&&c===void 0&&(c=d[0]<=o-u.actualBoundingBoxLeft&&d[2]>=o+u.actualBoundingBoxRight&&d[1]<=s-u.actualBoundingBoxAscent&&d[3]>=s+u.actualBoundingBoxDescent,this.#u.set(r,c),c)?this.recordBBox(e,i,d[0],d[2],d[1],d[3]):this.recordBBox(e,i,o-u.actualBoundingBoxLeft,o+u.actualBoundingBoxRight,s-u.actualBoundingBoxAscent,s+u.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#a[0]=Math.max(0,this.#s[0]),this.#a[1]=Math.max(0,this.#s[1]),this.#a[2]=Math.min(this.#p,this.#s[2]),this.#a[3]=Math.min(this.#A,this.#s[3]),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,i){const r=this.#c,n=this.#e,o=this.#t;for(const s of i)s in this.#e?r.add(n[s]):s in o&&o[s].forEach(r.add,r);return this}recordNamedDependency(e,i){return this.#r.has(i)&&this.#c.add(this.#r.get(i)),this}recordOperation(e,i=!1){if(this.recordDependencies(e,[Y5]),this.#f){const r=SP(this.#f,e),{dependencies:n}=r;this.#c.forEach(n.add,n),this.#i.forEach(n.add,n),this.#n.forEach(n.add,n),n.delete(e),r.isRenderingOperation=!0}if(this.#l===e){const r=eye(this.#a[0]*256/this.#p),n=eye(this.#a[1]*256/this.#A),o=tye(this.#a[2]*256/this.#p),s=tye(this.#a[3]*256/this.#A);IP(this.#g,e,r,n,o,s);for(const a of this.#c)a!==e&&IP(this.#g,a,r,n,o,s);for(const a of this.#i)a!==e&&IP(this.#g,a,r,n,o,s);for(const a of this.#n)a!==e&&IP(this.#g,a,r,n,o,s);i||(this.#c.clear(),this.#l=-1)}return this}recordShowTextOperation(e,i=!1){const r=Array.from(this.#c);this.recordOperation(e,i),this.recordIncrementalData("sameLineText",e);for(const n of r)this.recordIncrementalData("sameLineText",n);return this}bboxToClipBoxDropOperation(e,i=!1){return this.#l===e&&(this.#l=-1,this.#s[0]=Math.max(this.#s[0],this.#a[0]),this.#s[1]=Math.max(this.#s[1],this.#a[1]),this.#s[2]=Math.min(this.#s[2],this.#a[2]),this.#s[3]=Math.min(this.#s[3],this.#a[3]),i||this.#c.clear()),this}_takePendingDependencies(){const e=this.#c;return this.#c=new Set,e}_extractOperation(e){const i=this.#h.get(e);return this.#h.delete(e),i}_pushPendingDependencies(e){for(const i of e)this.#c.add(i)}take(){return this.#u.clear(),new ULi(this.#d,this.#g)}takeDebugMetadata(){return this.#f}}class XI{#e;#t;#r;#i=0;#n=0;constructor(e,i,r){if(e instanceof XI&&e.#r===!!r)return e;this.#e=e,this.#t=i,this.#r=!!r}growOperationsCount(){throw new Error("Unreachable")}save(e){return this.#n++,this.#e.save(this.#t),this}restore(e){return this.#n>0&&(this.#e.restore(this.#t),this.#n--),this}recordOpenMarker(e){return this.#i++,this}getOpenMarker(){return this.#i>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#i--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,i){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,i){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,i){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,i){return this}recordSimpleDataFromNamed(e,i,r){return this.#e.recordSimpleDataFromNamed(e,i,this.#t),this}recordFutureForcedDependency(e,i){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return this.#r||this.#e.resetBBox(this.#t),this}recordClipBox(e,i,r,n,o,s){return this.#r||this.#e.recordClipBox(this.#t,i,r,n,o,s),this}recordBBox(e,i,r,n,o,s){return this.#r||this.#e.recordBBox(this.#t,i,r,n,o,s),this}recordCharacterBBox(e,i,r,n,o,s,a){return this.#r||this.#e.recordCharacterBBox(this.#t,i,r,n,o,s,a),this}recordFullPageBBox(e){return this.#r||this.#e.recordFullPageBBox(this.#t),this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,i){return this.#e.recordDependencies(this.#t,i),this}recordNamedDependency(e,i){return this.#e.recordNamedDependency(this.#t,i),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){return this.#r||this.#e.bboxToClipBoxDropOperation(this.#t,!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}}const Uc={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},Us={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function jq(t,e){if(!e)return;const i=e[2]-e[0],r=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],i,r),t.clip(n)}class Hq{isModifyingCurrentTransform(){return!1}getPattern(){yn("Abstract method `getPattern` called.")}}class jLi extends Hq{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}_createGradient(e,i=null){let r,n=this._p0,o=this._p1;if(i&&(n=n.slice(),o=o.slice(),Yt.applyTransform(n,i),Yt.applyTransform(o,i)),this._type==="axial")r=e.createLinearGradient(n[0],n[1],o[0],o[1]);else if(this._type==="radial"){let s=this._r0,a=this._r1;if(i){const l=new Float32Array(2);Yt.singularValueDecompose2dScale(i,l),s*=l[0],a*=l[0]}r=e.createRadialGradient(n[0],n[1],s,o[0],o[1],a)}for(const s of this._colorStops)r.addColorStop(s[0],s[1]);return r}getPattern(e,i,r,n){let o;if(n===Us.STROKE||n===Us.FILL){if(this.isOriginBased()){let h=Yt.transform(r,i.baseTransform);this.matrix&&(h=Yt.transform(h,this.matrix));const p=.001,g=Math.hypot(h[0],h[1]),f=Math.hypot(h[2],h[3]),m=(h[0]*h[2]+h[1]*h[3])/(g*f);if(Math.abs(m)<p)if(this.isRadial()){if(Math.abs(g-f)<p)return this._createGradient(e,h)}else return this._createGradient(e,h)}const s=i.current.getClippedPathBoundingBox(n,to(e))||[0,0,0,0],a=Math.ceil(s[2]-s[0])||1,l=Math.ceil(s[3]-s[1])||1,c=i.cachedCanvases.getCanvas("pattern",a,l),d=c.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-s[0],-s[1]),r=Yt.transform(r,[1,0,0,1,s[0],s[1]]),d.transform(...i.baseTransform),this.matrix&&d.transform(...this.matrix),jq(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),o=e.createPattern(c.canvas,"no-repeat");const u=new DOMMatrix(r);o.setTransform(u)}else jq(e,this._bbox),o=this._createGradient(e);return o}}function Vq(t,e,i,r,n,o,s,a){const l=e.coords,c=e.colors,d=t.data,u=t.width*4;let h;l[i+1]>l[r+1]&&(h=i,i=r,r=h,h=o,o=s,s=h),l[r+1]>l[n+1]&&(h=r,r=n,n=h,h=s,s=a,a=h),l[i+1]>l[r+1]&&(h=i,i=r,r=h,h=o,o=s,s=h);const p=(l[i]+e.offsetX)*e.scaleX,g=(l[i+1]+e.offsetY)*e.scaleY,f=(l[r]+e.offsetX)*e.scaleX,m=(l[r+1]+e.offsetY)*e.scaleY,A=(l[n]+e.offsetX)*e.scaleX,y=(l[n+1]+e.offsetY)*e.scaleY;if(g>=y)return;const v=c[o],b=c[o+1],w=c[o+2],C=c[s],M=c[s+1],E=c[s+2],B=c[a],S=c[a+1],I=c[a+2],T=Math.round(g),L=Math.round(y);let O,j,N,z,G,X,me,le;for(let Ce=T;Ce<=L;Ce++){if(Ce<m){const re=Ce<g?0:(g-Ce)/(g-m);O=p-(p-f)*re,j=v-(v-C)*re,N=b-(b-M)*re,z=w-(w-E)*re}else{let re;Ce>y?re=1:m===y?re=0:re=(m-Ce)/(m-y),O=f-(f-A)*re,j=C-(C-B)*re,N=M-(M-S)*re,z=E-(E-I)*re}let Te;Ce<g?Te=0:Ce>y?Te=1:Te=(g-Ce)/(g-y),G=p-(p-A)*Te,X=v-(v-B)*Te,me=b-(b-S)*Te,le=w-(w-I)*Te;const ue=Math.round(Math.min(O,G)),ee=Math.round(Math.max(O,G));let $=u*Ce+ue*4;for(let re=ue;re<=ee;re++)Te=(O-re)/(O-G),Te<0?Te=0:Te>1&&(Te=1),d[$++]=j-(j-X)*Te|0,d[$++]=N-(N-me)*Te|0,d[$++]=z-(z-le)*Te|0,d[$++]=255}}function HLi(t,e,i){const r=e.coords,n=e.colors;let o,s;switch(e.type){case Mq.LATTICE:const a=e.verticesPerRow,l=Math.floor(r.length/a)-1,c=a-1;for(o=0;o<l;o++){let d=o*a;for(let u=0;u<c;u++,d++)Vq(t,i,r[d],r[d+1],r[d+a],n[d],n[d+1],n[d+a]),Vq(t,i,r[d+a+1],r[d+1],r[d+a],n[d+a+1],n[d+1],n[d+a])}break;case Mq.TRIANGLES:for(o=0,s=r.length;o<s;o+=3)Vq(t,i,r[o],r[o+1],r[o+2],n[o],n[o+1],n[o+2]);break;default:throw new Error("illegal figure")}}class VLi extends Hq{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,i,r){const n=Math.floor(this._bounds[0]),o=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-o,l=Math.min(Math.ceil(Math.abs(s*e[0]*1.1)),3e3),c=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),d=s/l,u=a/c,h={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-o,scaleX:1/d,scaleY:1/u},p=l+4,g=c+4,f=r.getCanvas("mesh",p,g),m=f.context,A=m.createImageData(l,c);if(i){const y=A.data;for(let v=0,b=y.length;v<b;v+=4)y[v]=i[0],y[v+1]=i[1],y[v+2]=i[2],y[v+3]=255}for(const y of this._figures)HLi(A,y,h);return m.putImageData(A,2,2),{canvas:f.canvas,offsetX:n-2*d,offsetY:o-2*u,scaleX:d,scaleY:u}}isModifyingCurrentTransform(){return!0}getPattern(e,i,r,n){jq(e,this._bbox);const o=new Float32Array(2);if(n===Us.SHADING)Yt.singularValueDecompose2dScale(to(e),o);else if(this.matrix){Yt.singularValueDecompose2dScale(this.matrix,o);const[a,l]=o;Yt.singularValueDecompose2dScale(i.baseTransform,o),o[0]*=a,o[1]*=l}else Yt.singularValueDecompose2dScale(i.baseTransform,o);const s=this._createMeshCanvas(o,n===Us.SHADING?null:this._background,i.cachedCanvases);return n!==Us.SHADING&&(e.setTransform(...i.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(s.offsetX,s.offsetY),e.scale(s.scaleX,s.scaleY),e.createPattern(s.canvas,"no-repeat")}}class zLi extends Hq{getPattern(){return"hotpink"}}function qLi(t){switch(t[0]){case"RadialAxial":return new jLi(t);case"Mesh":return new VLi(t);case"Dummy":return new zLi}throw new Error(`Unknown IR type: ${t[0]}`)}const iye={COLORED:1,UNCOLORED:2};class YQ{static MAX_PATTERN_SIZE=3e3;constructor(e,i,r,n){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.ctx=i,this.canvasGraphicsFactory=r,this.baseTransform=n}createPatternCanvas(e,i){const{bbox:r,operatorList:n,paintType:o,tilingType:s,color:a,canvasGraphicsFactory:l}=this;let{xstep:c,ystep:d}=this;c=Math.abs(c),d=Math.abs(d),xP("TilingType: "+s);const u=r[0],h=r[1],p=r[2],g=r[3],f=p-u,m=g-h,A=new Float32Array(2);Yt.singularValueDecompose2dScale(this.matrix,A);const[y,v]=A;Yt.singularValueDecompose2dScale(this.baseTransform,A);const b=y*A[0],w=v*A[1];let C=f,M=m,E=!1,B=!1;const S=Math.ceil(c*b),I=Math.ceil(d*w),T=Math.ceil(f*b),L=Math.ceil(m*w);S>=T?C=c:E=!0,I>=L?M=d:B=!0;const O=this.getSizeAndScale(C,this.ctx.canvas.width,b),j=this.getSizeAndScale(M,this.ctx.canvas.height,w),N=e.cachedCanvases.getCanvas("pattern",O.size,j.size),z=N.context,G=l.createCanvasGraphics(z,i);if(G.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(G,o,a),z.translate(-O.scale*u,-j.scale*h),G.transform(0,O.scale,0,0,j.scale,0,0),z.save(),G.dependencyTracker?.save(),this.clipBbox(G,u,h,p,g),G.baseTransform=to(G.ctx),G.executeOperatorList(n),G.endDrawing(),G.dependencyTracker?.restore(),z.restore(),E||B){const X=N.canvas;E&&(C=c),B&&(M=d);const me=this.getSizeAndScale(C,this.ctx.canvas.width,b),le=this.getSizeAndScale(M,this.ctx.canvas.height,w),Ce=me.size,Te=le.size,ue=e.cachedCanvases.getCanvas("pattern-workaround",Ce,Te),ee=ue.context,$=E?Math.floor(f/c):0,re=B?Math.floor(m/d):0;for(let ie=0;ie<=$;ie++)for(let de=0;de<=re;de++)ee.drawImage(X,Ce*ie,Te*de,Ce,Te,0,0,Ce,Te);return{canvas:ue.canvas,scaleX:me.scale,scaleY:le.scale,offsetX:u,offsetY:h}}return{canvas:N.canvas,scaleX:O.scale,scaleY:j.scale,offsetX:u,offsetY:h}}getSizeAndScale(e,i,r){const n=Math.max(YQ.MAX_PATTERN_SIZE,i);let o=Math.ceil(e*r);return o>=n?o=n:r=o/e,{scale:r,size:o}}clipBbox(e,i,r,n,o){const s=n-i,a=o-r;e.ctx.rect(i,r,s,a),Yt.axialAlignedBoundingBox([i,r,n,o],to(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,i,r){const n=e.ctx,o=e.current;switch(i){case iye.COLORED:const{fillStyle:s,strokeStyle:a}=this.ctx;n.fillStyle=o.fillColor=s,n.strokeStyle=o.strokeColor=a;break;case iye.UNCOLORED:n.fillStyle=n.strokeStyle=r,o.fillColor=o.strokeColor=r;break;default:throw new eLi(`Unsupported paint type: ${i}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,i,r,n,o){let s=r;n!==Us.SHADING&&(s=Yt.transform(s,i.baseTransform),this.matrix&&(s=Yt.transform(s,this.matrix)));const a=this.createPatternCanvas(i,o);let l=new DOMMatrix(s);l=l.translate(a.offsetX,a.offsetY),l=l.scale(1/a.scaleX,1/a.scaleY);const c=e.createPattern(a.canvas,"repeat");return c.setTransform(l),c}}function GLi({src:t,srcPos:e=0,dest:i,width:r,height:n,nonBlackColor:o=4294967295,inverseDecode:s=!1}){const a=Xo.isLittleEndian?4278190080:255,[l,c]=s?[o,a]:[a,o],d=r>>3,u=r&7,h=t.length;i=new Uint32Array(i.buffer);let p=0;for(let g=0;g<n;g++){for(const m=e+d;e<m;e++){const A=e<h?t[e]:255;i[p++]=A&128?c:l,i[p++]=A&64?c:l,i[p++]=A&32?c:l,i[p++]=A&16?c:l,i[p++]=A&8?c:l,i[p++]=A&4?c:l,i[p++]=A&2?c:l,i[p++]=A&1?c:l}if(u===0)continue;const f=e<h?t[e++]:255;for(let m=0;m<u;m++)i[p++]=f&1<<7-m?c:l}return{srcPos:e,destPos:p}}const rye=16,nye=100,QLi=15,oye=10,wl=16,zq=new DOMMatrix,tc=new Float32Array(2),$5=new Float32Array([1/0,1/0,-1/0,-1/0]);function KLi(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(i,r){e.translate(i,r),this.__originalTranslate(i,r)},t.scale=function(i,r){e.scale(i,r),this.__originalScale(i,r)},t.transform=function(i,r,n,o,s,a){e.transform(i,r,n,o,s,a),this.__originalTransform(i,r,n,o,s,a)},t.setTransform=function(i,r,n,o,s,a){e.setTransform(i,r,n,o,s,a),this.__originalSetTransform(i,r,n,o,s,a)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(i){e.rotate(i),this.__originalRotate(i)},t.clip=function(i){e.clip(i),this.__originalClip(i)},t.moveTo=function(i,r){e.moveTo(i,r),this.__originalMoveTo(i,r)},t.lineTo=function(i,r){e.lineTo(i,r),this.__originalLineTo(i,r)},t.bezierCurveTo=function(i,r,n,o,s,a){e.bezierCurveTo(i,r,n,o,s,a),this.__originalBezierCurveTo(i,r,n,o,s,a)},t.rect=function(i,r,n,o){e.rect(i,r,n,o),this.__originalRect(i,r,n,o)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class WLi{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,i,r){let n;return this.cache[e]!==void 0?(n=this.cache[e],this.canvasFactory.reset(n,i,r)):(n=this.canvasFactory.create(i,r),this.cache[e]=n),n}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const i=this.cache[e];this.canvasFactory.destroy(i),delete this.cache[e]}}}function TP(t,e,i,r,n,o,s,a,l,c){const[d,u,h,p,g,f]=to(t);if(u===0&&h===0){const y=s*d+g,v=Math.round(y),b=a*p+f,w=Math.round(b),C=(s+l)*d+g,M=Math.abs(Math.round(C)-v)||1,E=(a+c)*p+f,B=Math.abs(Math.round(E)-w)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),v,w),t.drawImage(e,i,r,n,o,0,0,M,B),t.setTransform(d,u,h,p,g,f),[M,B]}if(d===0&&p===0){const y=a*h+g,v=Math.round(y),b=s*u+f,w=Math.round(b),C=(a+c)*h+g,M=Math.abs(Math.round(C)-v)||1,E=(s+l)*u+f,B=Math.abs(Math.round(E)-w)||1;return t.setTransform(0,Math.sign(u),Math.sign(h),0,v,w),t.drawImage(e,i,r,n,o,0,0,B,M),t.setTransform(d,u,h,p,g,f),[B,M]}t.drawImage(e,i,r,n,o,s,a,l,c);const m=Math.hypot(d,u),A=Math.hypot(h,p);return[m*l,A*c]}class sye{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=xq;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=Zo.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";constructor(e,i,r){r?.(this),this.clipBox=new Float32Array([0,0,e,i]),this.minMax=$5.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=Us.FILL,i=null){const r=this.minMax.slice();if(e===Us.STROKE){i||yn("Stroke bounding box must include transform."),Yt.singularValueDecompose2dScale(i,tc);const n=tc[0]*this.lineWidth/2,o=tc[1]*this.lineWidth/2;r[0]-=n,r[1]-=o,r[2]+=n,r[3]+=o}return r}updateClipFromPath(){const e=Yt.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set($5,0)}getClippedPathBoundingBox(e=Us.FILL,i=null){return Yt.intersect(this.clipBox,this.getPathBoundingBox(e,i))}}function aye(t,e){if(e instanceof ImageData){t.putImageData(e,0,0);return}const i=e.height,r=e.width,n=i%wl,o=(i-n)/wl,s=n===0?o:o+1,a=t.createImageData(r,wl);let l=0,c;const d=e.data,u=a.data;let h,p,g,f;if(e.kind===bP.GRAYSCALE_1BPP){const m=d.byteLength,A=new Uint32Array(u.buffer,0,u.byteLength>>2),y=A.length,v=r+7>>3,b=4294967295,w=Xo.isLittleEndian?4278190080:255;for(h=0;h<s;h++){for(g=h<o?wl:n,c=0,p=0;p<g;p++){const C=m-l;let M=0;const E=C>v?r:C*8-7,B=E&-8;let S=0,I=0;for(;M<B;M+=8)I=d[l++],A[c++]=I&128?b:w,A[c++]=I&64?b:w,A[c++]=I&32?b:w,A[c++]=I&16?b:w,A[c++]=I&8?b:w,A[c++]=I&4?b:w,A[c++]=I&2?b:w,A[c++]=I&1?b:w;for(;M<E;M++)S===0&&(I=d[l++],S=128),A[c++]=I&S?b:w,S>>=1}for(;c<y;)A[c++]=0;t.putImageData(a,0,h*wl)}}else if(e.kind===bP.RGBA_32BPP){for(p=0,f=r*wl*4,h=0;h<o;h++)u.set(d.subarray(l,l+f)),l+=f,t.putImageData(a,0,p),p+=wl;h<s&&(f=r*n*4,u.set(d.subarray(l,l+f)),t.putImageData(a,0,p))}else if(e.kind===bP.RGB_24BPP)for(g=wl,f=r*g,h=0;h<s;h++){for(h>=o&&(g=n,f=r*g),c=0,p=f;p--;)u[c++]=d[l++],u[c++]=d[l++],u[c++]=d[l++],u[c++]=255;t.putImageData(a,0,h*wl)}else throw new Error(`bad image kind: ${e.kind}`)}function lye(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const i=e.height,r=e.width,n=i%wl,o=(i-n)/wl,s=n===0?o:o+1,a=t.createImageData(r,wl);let l=0;const c=e.data,d=a.data;for(let u=0;u<s;u++){const h=u<o?wl:n;({srcPos:l}=GLi({src:c,srcPos:l,dest:d,width:r,height:h,nonBlackColor:0})),t.putImageData(a,0,u*wl)}}function Dy(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of i)t[r]!==void 0&&(e[r]=t[r]);t.setLineDash!==void 0&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function DP(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",t.setLineDash!==void 0&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}function cye(t,e){if(e)return!0;Yt.singularValueDecompose2dScale(t,tc);const i=Math.fround(Ju.pixelRatio*X5.PDF_TO_CSS_UNITS);return tc[0]<=i&&tc[1]<=i}const JLi=["butt","round","square"],ZLi=["miter","round","bevel"],XLi={},dye={};class D6{constructor(e,i,r,n,o,{optionalContentConfig:s,markedContentStack:a=null},l,c,d){this.ctx=e,this.current=new sye(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=i,this.objs=r,this.canvasFactory=n,this.filterFactory=o,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=a||[],this.optionalContentConfig=s,this.cachedCanvases=new WLi(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=d??null}getObject(e,i,r=null){return typeof i=="string"?(this.dependencyTracker?.recordNamedDependency(e,i),i.startsWith("g_")?this.commonObjs.get(i):this.objs.get(i)):r}beginDrawing({transform:e,viewport:i,transparency:r=!1,background:n=null}){const o=this.ctx.canvas.width,s=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,o,s),this.ctx.fillStyle=a,r){const l=this.cachedCanvases.getCanvas("transparent",o,s);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...to(this.compositeCtx))}this.ctx.save(),DP(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=to(this.ctx)}executeOperatorList(e,i,r,n,o){const s=e.argsArray,a=e.fnArray;let l=i||0;const c=s.length;if(c===l)return l;const d=c-l>oye&&typeof r=="function",u=d?Date.now()+QLi:0;let h=0;const p=this.commonObjs,g=this.objs;let f,m;for(;;){if(n!==void 0&&l===n.nextBreakPoint)return n.breakIt(l,r),l;if(!o||o(l))if(f=a[l],m=s[l]??null,f!==ky.dependency)m===null?this[f](l):this[f](l,...m);else for(const A of m){this.dependencyTracker?.recordNamedData(A,l);const y=A.startsWith("g_")?p:g;if(!y.has(A))return y.get(A,r),l}if(l++,l===c)return l;if(d&&++h>oye){if(Date.now()>u)return r(),l;h=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const i of e.values())typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&(i.width=i.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const i=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=i}}}_scaleImage(e,i){const r=e.width??e.displayWidth,n=e.height??e.displayHeight;let o=Math.max(Math.hypot(i[0],i[1]),1),s=Math.max(Math.hypot(i[2],i[3]),1),a=r,l=n,c="prescale1",d,u;for(;o>2&&a>1||s>2&&l>1;){let h=a,p=l;o>2&&a>1&&(h=a>=16384?Math.floor(a/2)-1||1:Math.ceil(a/2),o/=a/h),s>2&&l>1&&(p=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,s/=l/p),d=this.cachedCanvases.getCanvas(c,h,p),u=d.context,u.clearRect(0,0,h,p),u.drawImage(e,0,0,a,l,0,0,h,p),e=d.canvas,a=h,l=p,c=c==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:a,paintHeight:l}}_createMaskCanvas(e,i){const r=this.ctx,{width:n,height:o}=i,s=this.current.fillColor,a=this.current.patternFill,l=to(r);let c,d,u,h;if((i.bitmap||i.data)&&i.count>1){const S=i.bitmap||i.data.buffer;d=JSON.stringify(a?l:[l.slice(0,4),s]),c=this._cachedBitmapsMap.get(S),c||(c=new Map,this._cachedBitmapsMap.set(S,c));const I=c.get(d);if(I&&!a){const T=Math.round(Math.min(l[0],l[2])+l[4]),L=Math.round(Math.min(l[1],l[3])+l[5]);return this.dependencyTracker?.recordDependencies(e,Uc.transformAndFill),{canvas:I,offsetX:T,offsetY:L}}u=I}u||(h=this.cachedCanvases.getCanvas("maskCanvas",n,o),lye(h.context,i));let p=Yt.transform(l,[1/n,0,0,-1/o,0,0]);p=Yt.transform(p,[1,0,0,1,0,-o]);const g=$5.slice();Yt.axialAlignedBoundingBox([0,0,n,o],p,g);const[f,m,A,y]=g,v=Math.round(A-f)||1,b=Math.round(y-m)||1,w=this.cachedCanvases.getCanvas("fillCanvas",v,b),C=w.context,M=f,E=m;C.translate(-M,-E),C.transform(...p),u||(u=this._scaleImage(h.canvas,Ru(C)),u=u.img,c&&a&&c.set(d,u)),C.imageSmoothingEnabled=cye(to(C),i.interpolate),TP(C,u,0,0,u.width,u.height,0,0,n,o),C.globalCompositeOperation="source-in";const B=Yt.transform(Ru(C),[1,0,0,1,-M,-E]);return C.fillStyle=a?s.getPattern(r,this,B,Us.FILL,e):s,C.fillRect(0,0,n,o),c&&!a&&(this.cachedCanvases.delete("fillCanvas"),c.set(d,w.canvas)),this.dependencyTracker?.recordDependencies(e,Uc.transformAndFill),{canvas:w.canvas,offsetX:Math.round(M),offsetY:Math.round(E)}}setLineWidth(e,i){this.dependencyTracker?.recordSimpleData("lineWidth",e),i!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=i,this.ctx.lineWidth=i}setLineCap(e,i){this.dependencyTracker?.recordSimpleData("lineCap",e),this.ctx.lineCap=JLi[i]}setLineJoin(e,i){this.dependencyTracker?.recordSimpleData("lineJoin",e),this.ctx.lineJoin=ZLi[i]}setMiterLimit(e,i){this.dependencyTracker?.recordSimpleData("miterLimit",e),this.ctx.miterLimit=i}setDash(e,i,r){this.dependencyTracker?.recordSimpleData("dash",e);const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(i),n.lineDashOffset=r)}setRenderingIntent(e,i){}setFlatness(e,i){}setGState(e,i){for(const[r,n]of i)switch(r){case"LW":this.setLineWidth(e,n);break;case"LC":this.setLineCap(e,n);break;case"LJ":this.setLineJoin(e,n);break;case"ML":this.setMiterLimit(e,n);break;case"D":this.setDash(e,n[0],n[1]);break;case"RI":this.setRenderingIntent(e,n);break;case"FL":this.setFlatness(e,n);break;case"Font":this.setFont(e,n[0],n[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=n;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=n;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=n;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",e),this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const i=this.ctx.canvas.width,r=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,o=this.cachedCanvases.getCanvas(n,i,r);this.suspendedCtx=this.ctx;const s=this.ctx=o.context;s.setTransform(this.suspendedCtx.getTransform()),Dy(this.suspendedCtx,s),KLi(s,this.suspendedCtx),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Dy(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const i=this.current.activeSMask,r=this.suspendedCtx;this.composeSMask(r,i,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,i,r,n){const o=n[0],s=n[1],a=n[2]-o,l=n[3]-s;a===0||l===0||(this.genericComposeSMask(i.context,r,a,l,i.subtype,i.backdrop,i.transferMap,o,s,i.offsetX,i.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(r.canvas,0,0),e.restore())}genericComposeSMask(e,i,r,n,o,s,a,l,c,d,u){let h=e.canvas,p=l-d,g=c-u;if(s)if(p<0||g<0||p+r>h.width||g+n>h.height){const m=this.cachedCanvases.getCanvas("maskExtension",r,n),A=m.context;A.drawImage(h,-p,-g),A.globalCompositeOperation="destination-atop",A.fillStyle=s,A.fillRect(0,0,r,n),A.globalCompositeOperation="source-over",h=m.canvas,p=g=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const m=new Path2D;m.rect(p,g,r,n),e.clip(m),e.globalCompositeOperation="destination-atop",e.fillStyle=s,e.fillRect(p,g,r,n),e.restore()}i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0),o==="Alpha"&&a?i.filter=this.filterFactory.addAlphaFilter(a):o==="Luminosity"&&(i.filter=this.filterFactory.addLuminosityFilter(a));const f=new Path2D;f.rect(l,c,r,n),i.clip(f),i.globalCompositeOperation="destination-in",i.drawImage(h,p,g,r,n,l,c,r,n),i.restore()}save(e){this.inSMaskMode&&Dy(this.ctx,this.suspendedCtx),this.ctx.save();const i=this.current;this.stateStack.push(i),this.current=i.clone(),this.dependencyTracker?.save(e)}restore(e){if(this.dependencyTracker?.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Dy(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,i,r,n,o,s,a){this.dependencyTracker?.recordIncrementalData("transform",e),this.ctx.transform(i,r,n,o,s,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,i,r,n){let[o]=r;if(!n){o||=r[0]=new Path2D,this[i](e,o);return}if(this.dependencyTracker!==null){const s=i===ky.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,n[0]-s,n[2]+s,n[1]-s,n[3]+s).recordDependencies(e,["transform"])}o instanceof Path2D||(o=r[0]=U7e(o)),Yt.axialAlignedBoundingBox(n,to(this.ctx),this.current.minMax),this[i](e,o),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,i,r=!0){const n=this.ctx,o=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof o=="object"&&o?.getPattern){const s=o.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=o.getPattern(n,this,Ru(n),Us.STROKE,e),s){const a=new Path2D;a.addPath(i,n.getTransform().invertSelf().multiplySelf(s)),i=a}this.rescaleAndStroke(i,!1),n.restore()}else this.rescaleAndStroke(i,!0);this.dependencyTracker?.recordDependencies(e,Uc.stroke),r&&this.consumePath(e,i,this.current.getClippedPathBoundingBox(Us.STROKE,to(this.ctx))),n.globalAlpha=this.current.fillAlpha}closeStroke(e,i){this.stroke(e,i)}fill(e,i,r=!0){const n=this.ctx,o=this.current.fillColor,s=this.current.patternFill;let a=!1;if(s){const c=o.isModifyingCurrentTransform()?n.getTransform():null;if(this.dependencyTracker?.save(e),n.save(),n.fillStyle=o.getPattern(n,this,Ru(n),Us.FILL,e),c){const d=new Path2D;d.addPath(i,n.getTransform().invertSelf().multiplySelf(c)),i=d}a=!0}const l=this.current.getClippedPathBoundingBox();this.contentVisible&&l!==null&&(this.pendingEOFill?(n.fill(i,"evenodd"),this.pendingEOFill=!1):n.fill(i)),this.dependencyTracker?.recordDependencies(e,Uc.fill),a&&(n.restore(),this.dependencyTracker?.restore(e)),r&&this.consumePath(e,i,l)}eoFill(e,i){this.pendingEOFill=!0,this.fill(e,i)}fillStroke(e,i){this.fill(e,i,!1),this.stroke(e,i,!1),this.consumePath(e,i)}eoFillStroke(e,i){this.pendingEOFill=!0,this.fillStroke(e,i)}closeFillStroke(e,i){this.fillStroke(e,i)}closeEOFillStroke(e,i){this.pendingEOFill=!0,this.fillStroke(e,i)}endPath(e,i){this.consumePath(e,i)}rawFillPath(e,i){this.ctx.fill(i),this.dependencyTracker?.recordDependencies(e,Uc.rawFillPath).recordOperation(e)}clip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=XLi}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=dye}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const i=this.pendingTextPaths,r=this.ctx;if(this.dependencyTracker){const{dependencyTracker:n}=this;i!==void 0&&n.recordFutureForcedDependency("textClip",n.getOpenMarker()).recordFutureForcedDependency("textClip",e),n.recordCloseMarker(e)}if(i!==void 0){const n=new Path2D,o=r.getTransform().invertSelf();for(const{transform:s,x:a,y:l,fontSize:c,path:d}of i)d&&n.addPath(d,new DOMMatrix(s).preMultiplySelf(o).translate(a,l).scale(c,-c));r.clip(n)}delete this.pendingTextPaths}setCharSpacing(e,i){this.dependencyTracker?.recordSimpleData("charSpacing",e),this.current.charSpacing=i}setWordSpacing(e,i){this.dependencyTracker?.recordSimpleData("wordSpacing",e),this.current.wordSpacing=i}setHScale(e,i){this.dependencyTracker?.recordSimpleData("hScale",e),this.current.textHScale=i/100}setLeading(e,i){this.dependencyTracker?.recordSimpleData("leading",e),this.current.leading=-i}setFont(e,i,r){this.dependencyTracker?.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",i,e);const n=this.commonObjs.get(i),o=this.current;if(!n)throw new Error(`Can't find font for ${i}`);if(o.fontMatrix=n.fontMatrix||xq,(o.fontMatrix[0]===0||o.fontMatrix[3]===0)&&Hi("Invalid font matrix for font "+i),r<0?(r=-r,o.fontDirection=-1):o.fontDirection=1,this.current.font=n,this.current.fontSize=r,n.isType3Font)return;const s=n.loadedName||"sans-serif",a=n.systemFontInfo?.css||`"${s}", ${n.fallbackName}`;let l="normal";n.black?l="900":n.bold&&(l="bold");const c=n.italic?"italic":"normal";let d=r;r<rye?d=rye:r>nye&&(d=nye),this.current.fontSizeScale=r/d,this.ctx.font=`${c} ${l} ${d}px ${a}`}setTextRenderingMode(e,i){this.dependencyTracker?.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=i}setTextRise(e,i){this.dependencyTracker?.recordSimpleData("textRise",e),this.current.textRise=i}moveText(e,i,r){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=i,this.current.y=this.current.lineY+=r}setLeadingMoveText(e,i,r){this.setLeading(e,-r),this.moveText(e,i,r)}setTextMatrix(e,i){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);const{current:r}=this;r.textMatrix=i,r.textMatrixScale=Math.hypot(i[0],i[1]),r.x=r.lineX=0,r.y=r.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}#r(e,i,r){const n=new Path2D;return n.addPath(e,new DOMMatrix(r).invertSelf().multiplySelf(i)),n}paintChar(e,i,r,n,o,s){const a=this.ctx,l=this.current,c=l.font,d=l.textRenderingMode,u=l.fontSize/l.fontSizeScale,h=d&Zo.FILL_STROKE_MASK,p=!!(d&Zo.ADD_TO_PATH_FLAG),g=l.patternFill&&!c.missingFile,f=l.patternStroke&&!c.missingFile;let m;if((c.disableFontFace||p||g||f)&&!c.missingFile&&(m=c.getPathGenerator(this.commonObjs,i)),m&&(c.disableFontFace||g||f)){a.save(),a.translate(r,n),a.scale(u,-u),this.dependencyTracker?.recordCharacterBBox(e,a,c);let A;if(h===Zo.FILL||h===Zo.FILL_STROKE)if(o){A=a.getTransform(),a.setTransform(...o);const y=this.#r(m,A,o);a.fill(y)}else a.fill(m);if(h===Zo.STROKE||h===Zo.FILL_STROKE)if(s){A||=a.getTransform(),a.setTransform(...s);const{a:y,b:v,c:b,d:w}=A,C=Yt.inverseTransform(s),M=Yt.transform([y,v,b,w,0,0],C);Yt.singularValueDecompose2dScale(M,tc),a.lineWidth*=Math.max(tc[0],tc[1])/u,a.stroke(this.#r(m,A,s))}else a.lineWidth/=u,a.stroke(m);a.restore()}else(h===Zo.FILL||h===Zo.FILL_STROKE)&&(a.fillText(i,r,n),this.dependencyTracker?.recordCharacterBBox(e,a,c,u,r,n,()=>a.measureText(i))),(h===Zo.STROKE||h===Zo.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,a,c,u,r,n,()=>a.measureText(i)).recordDependencies(e,Uc.stroke),a.strokeText(i,r,n));p&&((this.pendingTextPaths||=[]).push({transform:to(a),x:r,y:n,fontSize:u,path:m}),this.dependencyTracker?.recordCharacterBBox(e,a,c,u,r,n))}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const i=e.getImageData(0,0,10,10).data;let r=!1;for(let n=3;n<i.length;n+=4)if(i[n]>0&&i[n]<255){r=!0;break}return Vi(this,"isFontSubpixelAAEnabled",r)}showText(e,i){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,Uc.showText).resetBBox(e),this.current.textRenderingMode&Zo.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());const r=this.current,n=r.font;if(n.isType3Font){this.showType3Text(e,i),this.dependencyTracker?.recordShowTextOperation(e);return}const o=r.fontSize;if(o===0){this.dependencyTracker?.recordOperation(e);return}const s=this.ctx,a=r.fontSizeScale,l=r.charSpacing,c=r.wordSpacing,d=r.fontDirection,u=r.textHScale*d,h=i.length,p=n.vertical,g=p?1:-1,f=n.defaultVMetrics,m=o*r.fontMatrix[0],A=r.textRenderingMode===Zo.FILL&&!n.disableFontFace&&!r.patternFill;s.save(),r.textMatrix&&s.transform(...r.textMatrix),s.translate(r.x,r.y+r.textRise),d>0?s.scale(u,-1):s.scale(u,1);let y,v;const b=r.textRenderingMode&Zo.FILL_STROKE_MASK,w=b===Zo.FILL||b===Zo.FILL_STROKE,C=b===Zo.STROKE||b===Zo.FILL_STROKE;if(w&&r.patternFill){s.save();const I=r.fillColor.getPattern(s,this,Ru(s),Us.FILL,e);y=to(s),s.restore(),s.fillStyle=I}if(C&&r.patternStroke){s.save();const I=r.strokeColor.getPattern(s,this,Ru(s),Us.STROKE,e);v=to(s),s.restore(),s.strokeStyle=I}let M=r.lineWidth;const E=r.textMatrixScale;if(E===0||M===0?C&&(M=this.getSinglePixelWidth()):M/=E,a!==1&&(s.scale(a,a),M/=a),s.lineWidth=M,n.isInvalidPDFjsFont){const I=[];let T=0;for(const O of i)I.push(O.unicode),T+=O.width;const L=I.join("");if(s.fillText(L,0,0),this.dependencyTracker!==null){const O=s.measureText(L);this.dependencyTracker.recordBBox(e,this.ctx,-O.actualBoundingBoxLeft,O.actualBoundingBoxRight,-O.actualBoundingBoxAscent,O.actualBoundingBoxDescent).recordShowTextOperation(e)}r.x+=T*m*u,s.restore(),this.compose();return}let B=0,S;for(S=0;S<h;++S){const I=i[S];if(typeof I=="number"){B+=g*I*o/1e3;continue}let T=!1;const L=(I.isSpace?c:0)+l,O=I.fontChar,j=I.accent;let N,z,G=I.width;if(p){const le=I.vmetric||f,Ce=-(I.vmetric?le[1]:G*.5)*m,Te=le[2]*m;G=le?-le[0]:G,N=Ce/a,z=(B+Te)/a}else N=B/a,z=0;let X;if(n.remeasure&&G>0){X=s.measureText(O);const le=X.width*1e3/o*a;if(G<le&&this.isFontSubpixelAAEnabled){const Ce=G/le;T=!0,s.save(),s.scale(Ce,1),N/=Ce}else G!==le&&(N+=(G-le)/2e3*o/a)}if(this.contentVisible&&(I.isInFont||n.missingFile)){if(A&&!j)s.fillText(O,N,z),this.dependencyTracker?.recordCharacterBBox(e,s,X?{bbox:null}:n,o/a,N,z,()=>X??s.measureText(O));else if(this.paintChar(e,O,N,z,y,v),j){const le=N+o*j.offset.x/a,Ce=z-o*j.offset.y/a;this.paintChar(e,j.fontChar,le,Ce,y,v)}}const me=p?G*m-L*d:G*m+L*d;B+=me,T&&s.restore()}p?r.y-=B:r.x+=B*u,s.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e)}showType3Text(e,i){const r=this.ctx,n=this.current,o=n.font,s=n.fontSize,a=n.fontDirection,l=o.vertical?1:-1,c=n.charSpacing,d=n.wordSpacing,u=n.textHScale*a,h=n.fontMatrix||xq,p=i.length,g=n.textRenderingMode===Zo.INVISIBLE;let f,m,A,y;if(g||s===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),n.textMatrix&&r.transform(...n.textMatrix),r.translate(n.x,n.y+n.textRise),r.scale(u,a);const v=this.dependencyTracker;for(this.dependencyTracker=v?new XI(v,e):null,f=0;f<p;++f){if(m=i[f],typeof m=="number"){y=l*m*s/1e3,this.ctx.translate(y,0),n.x+=y*u;continue}const b=(m.isSpace?d:0)+c,w=o.charProcOperatorList[m.operatorListId];w?this.contentVisible&&(this.save(),r.scale(s,s),r.transform(...h),this.executeOperatorList(w),this.restore()):Hi(`Type3 character "${m.operatorListId}" is not available.`);const C=[m.width,0];Yt.applyTransform(C,h),A=C[0]*s+b,r.translate(A,0),n.x+=A*u}r.restore(),v&&(this.dependencyTracker=v)}setCharWidth(e,i,r){}setCharWidthAndBounds(e,i,r,n,o,s,a){const l=new Path2D;l.rect(n,o,s-n,a-o),this.ctx.clip(l),this.dependencyTracker?.recordBBox(e,this.ctx,n,s,o,a).recordClipBox(e,this.ctx,n,s,o,a),this.endPath(e)}getColorN_Pattern(e,i){let r;if(i[0]==="TilingPattern"){const n=this.baseTransform||to(this.ctx),o={createCanvasGraphics:(s,a)=>new D6(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new XI(this.dependencyTracker,a,!0):null)};r=new YQ(i,this.ctx,o,n)}else r=this._getPattern(e,i[1],i[2]);return r}setStrokeColorN(e,...i){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,i),this.current.patternStroke=!0}setFillColorN(e,...i){this.dependencyTracker?.recordSimpleData("fillColor",e),this.current.fillColor=this.getColorN_Pattern(e,i),this.current.patternFill=!0}setStrokeRGBColor(e,i){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=i,this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,i){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=i,this.current.patternFill=!1}setFillTransparent(e){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,i,r=null){let n;return this.cachedPatterns.has(i)?n=this.cachedPatterns.get(i):(n=qLi(this.getObject(e,i)),this.cachedPatterns.set(i,n)),r&&(n.matrix=r),n}shadingFill(e,i){if(!this.contentVisible)return;const r=this.ctx;this.save(e);const n=this._getPattern(e,i);r.fillStyle=n.getPattern(r,this,Ru(r),Us.SHADING,e);const o=Ru(r);if(o){const{width:s,height:a}=r.canvas,l=$5.slice();Yt.axialAlignedBoundingBox([0,0,s,a],o,l);const[c,d,u,h]=l;this.ctx.fillRect(c,d,u-c,h-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,Uc.transform).recordDependencies(e,Uc.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e)}beginInlineImage(){yn("Should not call beginInlineImage")}beginImageData(){yn("Should not call beginImageData")}paintFormXObjectBegin(e,i,r){if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),i&&this.transform(e,...i),this.baseTransform=to(this.ctx),r)){Yt.axialAlignedBoundingBox(r,this.baseTransform,this.current.minMax);const[n,o,s,a]=r,l=new Path2D;l.rect(n,o,s-n,a-o),this.ctx.clip(l),this.dependencyTracker?.recordClipBox(e,this.ctx,n,s,o,a),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,i){if(!this.contentVisible)return;this.save(e),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;i.isolated||xP("TODO: Support non-isolated groups."),i.knockout&&Hi("Knockout groups not supported.");const n=to(r);if(i.matrix&&r.transform(...i.matrix),!i.bbox)throw new Error("Bounding box is required.");let o=$5.slice();Yt.axialAlignedBoundingBox(i.bbox,to(r),o);const s=[0,0,r.canvas.width,r.canvas.height];o=Yt.intersect(o,s)||[0,0,0,0];const a=Math.floor(o[0]),l=Math.floor(o[1]),c=Math.max(Math.ceil(o[2])-a,1),d=Math.max(Math.ceil(o[3])-l,1);this.current.startNewPathAndClipBox([0,0,c,d]);let u="groupAt"+this.groupLevel;i.smask&&(u+="_smask_"+this.smaskCounter++%2);const h=this.cachedCanvases.getCanvas(u,c,d),p=h.context;p.translate(-a,-l),p.transform(...n);let g=new Path2D;const[f,m,A,y]=i.bbox;if(g.rect(f,m,A-f,y-m),i.matrix){const v=new Path2D;v.addPath(g,new DOMMatrix(i.matrix)),g=v}p.clip(g),i.smask&&this.smaskStack.push({canvas:h.canvas,context:p,offsetX:a,offsetY:l,subtype:i.smask.subtype,backdrop:i.smask.backdrop,transferMap:i.smask.transferMap||null,startTransformInverse:null}),(!i.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(a,l),r.save()),Dy(r,p),this.ctx=p,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(r),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(e,i){if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),i.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const o=to(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...o);const s=$5.slice();Yt.axialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],o,s),this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(e,i,r,n,o,s){if(this.#e(),DP(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const a=r[2]-r[0],l=r[3]-r[1];if(s&&this.annotationCanvasMap){n=n.slice(),n[4]-=r[0],n[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=a,r[3]=l,Yt.singularValueDecompose2dScale(to(this.ctx),tc);const{viewportScale:c}=this,d=Math.ceil(a*this.outputScaleX*c),u=Math.ceil(l*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(d,u);const{canvas:h,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(i,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(tc[0],0,0,-tc[1],0,l*tc[1]),DP(this.ctx)}else{DP(this.ctx),this.endPath(e);const c=new Path2D;c.rect(r[0],r[1],a,l),this.ctx.clip(c)}}this.current=new sye(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(e,...n),this.transform(e,...o)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e,i){if(!this.contentVisible)return;const r=i.count;i=this.getObject(e,i.data,i),i.count=r;const n=this.ctx,o=this._createMaskCanvas(e,i),s=o.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(s,o.offsetX,o.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,o.offsetX,o.offsetX+s.width,o.offsetY,o.offsetY+s.height).recordOperation(e),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,i,r,n=0,o=0,s,a){if(!this.contentVisible)return;i=this.getObject(e,i.data,i);const l=this.ctx;l.save();const c=to(l);l.transform(r,n,o,s,0,0);const d=this._createMaskCanvas(e,i);l.setTransform(1,0,0,1,d.offsetX-c[4],d.offsetY-c[5]),this.dependencyTracker?.resetBBox(e);for(let u=0,h=a.length;u<h;u+=2){const p=Yt.transform(c,[r,n,o,s,a[u],a[u+1]]);l.drawImage(d.canvas,p[4],p[5]),this.dependencyTracker?.recordBBox(e,this.ctx,p[4],p[4]+d.canvas.width,p[5],p[5]+d.canvas.height)}l.restore(),this.compose(),this.dependencyTracker?.recordOperation(e)}paintImageMaskXObjectGroup(e,i){if(!this.contentVisible)return;const r=this.ctx,n=this.current.fillColor,o=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,Uc.transformAndFill);for(const s of i){const{data:a,width:l,height:c,transform:d}=s,u=this.cachedCanvases.getCanvas("maskCanvas",l,c),h=u.context;h.save();const p=this.getObject(e,a,s);lye(h,p),h.globalCompositeOperation="source-in",h.fillStyle=o?n.getPattern(h,this,Ru(r),Us.FILL,e):n,h.fillRect(0,0,l,c),h.restore(),r.save(),r.transform(...d),r.scale(1,-1),TP(r,u.canvas,0,0,l,c,0,-1,1,1),this.dependencyTracker?.recordBBox(e,r,0,l,0,c),r.restore()}this.compose(),this.dependencyTracker?.recordOperation(e)}paintImageXObject(e,i){if(!this.contentVisible)return;const r=this.getObject(e,i);if(!r){Hi("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,r)}paintImageXObjectRepeat(e,i,r,n,o){if(!this.contentVisible)return;const s=this.getObject(e,i);if(!s){Hi("Dependent image isn't ready yet");return}const a=s.width,l=s.height,c=[];for(let d=0,u=o.length;d<u;d+=2)c.push({transform:[r,0,0,n,o[d],o[d+1]],x:0,y:0,w:a,h:l});this.paintInlineImageXObjectGroup(e,s,c)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:i,width:r,height:n}=e,o=this.cachedCanvases.getCanvas("inlineImage",r,n),s=o.context;return s.filter=this.current.transferMaps,s.drawImage(i,0,0),s.filter="none",o.canvas}paintInlineImageXObject(e,i){if(!this.contentVisible)return;const r=i.width,n=i.height,o=this.ctx;this.save(e);const{filter:s}=o;s!=="none"&&s!==""&&(o.filter="none"),o.scale(1/r,-1/n);let a;if(i.bitmap)a=this.applyTransferMapsToBitmap(i);else if(typeof HTMLElement=="function"&&i instanceof HTMLElement||!i.data)a=i;else{const c=this.cachedCanvases.getCanvas("inlineImage",r,n).context;aye(c,i),a=this.applyTransferMapsToCanvas(c)}const l=this._scaleImage(a,Ru(o));o.imageSmoothingEnabled=cye(to(o),i.interpolate),this.dependencyTracker?.resetBBox(e).recordBBox(e,o,0,r,-n,0).recordDependencies(e,Uc.imageXObject).recordOperation(e),TP(o,l.img,0,0,l.paintWidth,l.paintHeight,0,-n,r,n),this.compose(),this.restore(e)}paintInlineImageXObjectGroup(e,i,r){if(!this.contentVisible)return;const n=this.ctx;let o;if(i.bitmap)o=i.bitmap;else{const s=i.width,a=i.height,l=this.cachedCanvases.getCanvas("inlineImage",s,a).context;aye(l,i),o=this.applyTransferMapsToCanvas(l)}this.dependencyTracker?.resetBBox(e);for(const s of r)n.save(),n.transform(...s.transform),n.scale(1,-1),TP(n,o,s.x,s.y,s.w,s.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,n,0,1,-1,0),n.restore();this.dependencyTracker?.recordOperation(e),this.compose()}paintSolidColorImageMask(e){this.contentVisible&&(this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,Uc.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e,i){}markPointProps(e,i,r){}beginMarkedContent(e,i){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,i,r){this.dependencyTracker?.beginMarkedContent(e),i==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,i,r){const n=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(r);const o=this.ctx;this.pendingClip?(n||(this.pendingClip===dye?o.clip(i,"evenodd"):o.clip(i)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)):this.dependencyTracker?.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=to(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const i=Math.abs(e[0]*e[3]-e[2]*e[1]),r=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(r,n)/i}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:i,b:r,c:n,d:o}=this.ctx.getTransform();let s,a;if(r===0&&n===0){const l=Math.abs(i),c=Math.abs(o);if(l===c)if(e===0)s=a=1/l;else{const d=l*e;s=a=d<1?1/d:1}else if(e===0)s=1/l,a=1/c;else{const d=l*e,u=c*e;s=d<1?1/d:1,a=u<1?1/u:1}}else{const l=Math.abs(i*o-r*n),c=Math.hypot(i,r),d=Math.hypot(n,o);if(e===0)s=d/l,a=c/l;else{const u=e*l;s=d>u?d/u:1,a=c>u?c/u:1}}this._cachedScaleForStroking[0]=s,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(e,i){const{ctx:r,current:{lineWidth:n}}=this,[o,s]=this.getScaleForStroking();if(o===s){r.lineWidth=(n||1)*o,r.stroke(e);return}const a=r.getLineDash();i&&r.save(),r.scale(o,s),zq.a=1/o,zq.d=1/s;const l=new Path2D;if(l.addPath(e,zq),a.length>0){const c=Math.max(o,s);r.setLineDash(a.map(d=>d/c)),r.lineDashOffset/=c}r.lineWidth=n||1,r.stroke(l),i&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const t in ky)D6.prototype[t]!==void 0&&(D6.prototype[ky[t]]=D6.prototype[t]);class e6{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");this.#t=e}}class YLi{#e;#t;constructor({parsedData:e,rawData:i}){this.#e=e,this.#t=i}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}}const t6=Symbol("INTERNAL");class $Li{#e=!1;#t=!1;#r=!1;#i=!0;constructor(e,{name:i,intent:r,usage:n,rbGroups:o}){this.#e=!!(e&ec.DISPLAY),this.#t=!!(e&ec.PRINT),this.name=i,this.intent=r,this.usage=n,this.rbGroups=o}get visible(){if(this.#r)return this.#i;if(!this.#i)return!1;const{print:e,view:i}=this.usage;return this.#e?i?.viewState!=="OFF":this.#t?e?.printState!=="OFF":!0}_setVisible(e,i,r=!1){e!==t6&&yn("Internal method `_setVisible` called."),this.#r=r,this.#i=i}}class e_i{#e=null;#t=new Map;#r=null;#i=null;constructor(e,i=ec.DISPLAY){if(this.renderingIntent=i,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,this.#i=e.order;for(const r of e.groups)this.#t.set(r.id,new $Li(i,r));if(e.baseState==="OFF")for(const r of this.#t.values())r._setVisible(t6,!1);for(const r of e.on)this.#t.get(r)._setVisible(t6,!0);for(const r of e.off)this.#t.get(r)._setVisible(t6,!1);this.#r=this.getHash()}}#n(e){const i=e.length;if(i<2)return!0;const r=e[0];for(let n=1;n<i;n++){const o=e[n];let s;if(Array.isArray(o))s=this.#n(o);else if(this.#t.has(o))s=this.#t.get(o).visible;else return Hi(`Optional content group not found: ${o}`),!0;switch(r){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return r==="And"}isVisible(e){if(this.#t.size===0)return!0;if(!e)return xP("Optional content group not defined."),!0;if(e.type==="OCG")return this.#t.has(e.id)?this.#t.get(e.id).visible:(Hi(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return this.#n(e.expression);if(!e.policy||e.policy==="AnyOn"){for(const i of e.ids){if(!this.#t.has(i))return Hi(`Optional content group not found: ${i}`),!0;if(this.#t.get(i).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const i of e.ids){if(!this.#t.has(i))return Hi(`Optional content group not found: ${i}`),!0;if(!this.#t.get(i).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const i of e.ids){if(!this.#t.has(i))return Hi(`Optional content group not found: ${i}`),!0;if(!this.#t.get(i).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const i of e.ids){if(!this.#t.has(i))return Hi(`Optional content group not found: ${i}`),!0;if(this.#t.get(i).visible)return!1}return!0}return Hi(`Unknown optional content policy ${e.policy}.`),!0}return Hi(`Unknown group type ${e.type}.`),!0}setVisibility(e,i=!0,r=!0){const n=this.#t.get(e);if(!n){Hi(`Optional content group not found: ${e}`);return}if(r&&i&&n.rbGroups.length)for(const o of n.rbGroups)for(const s of o)s!==e&&this.#t.get(s)?._setVisible(t6,!1,!0);n._setVisible(t6,!!i,!0),this.#e=null}setOCGState({state:e,preserveRB:i}){let r;for(const n of e){switch(n){case"ON":case"OFF":case"Toggle":r=n;continue}const o=this.#t.get(n);if(o)switch(r){case"ON":this.setVisibility(n,!0,i);break;case"OFF":this.setVisibility(n,!1,i);break;case"Toggle":this.setVisibility(n,!o.visible,i);break}}this.#e=null}get hasInitialVisibility(){return this.#r===null||this.getHash()===this.#r}getOrder(){return this.#t.size?this.#i?this.#i.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;const e=new H7e;for(const[i,r]of this.#t)e.update(`${i}:${r.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}}class t_i{constructor(e,{disableRange:i=!1,disableStream:r=!1}){xr(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:o,progressiveDone:s,contentDispositionFilename:a}=e;if(this._queuedChunks=[],this._progressiveDone=s,this._contentDispositionFilename=a,o?.length>0){const l=o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!r,this._isRangeSupported=!i,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((l,c)=>{this._onReceiveData({begin:l,chunk:c})}),e.addProgressListener((l,c)=>{this._onProgress({loaded:l,total:c})}),e.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:i}){const r=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{const n=this._rangeReaders.some(function(o){return o._begin!==e?!1:(o._enqueue(r),!0)});xr(n,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){e.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const i=this._rangeReaders.indexOf(e);i>=0&&this._rangeReaders.splice(i,1)}getFullReader(){xr(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new i_i(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new r_i(this,e,i);return this._pdfDataRangeTransport.requestDataRange(e,i),this._rangeReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const i of this._rangeReaders.slice(0))i.cancel(e);this._pdfDataRangeTransport.abort()}}class i_i{constructor(e,i,r=!1,n=null){this._stream=e,this._done=r||!1,this._filename=Tq(n)?n:null,this._queuedChunks=i||[],this._loaded=0;for(const o of this._queuedChunks)this._loaded+=o.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class r_i{constructor(e,i,r){this._stream=e,this._begin=i,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function n_i(t){let e=!0,i=r("filename\\*","i").exec(t);if(i){i=i[1];let d=a(i);return d=unescape(d),d=l(d),d=c(d),o(d)}if(i=s(t),i){const d=c(i);return o(d)}if(i=r("filename","i").exec(t),i){i=i[1];let d=a(i);return d=c(d),o(d)}function r(d,u){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function n(d,u){if(d){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const h=new TextDecoder(d,{fatal:!0}),p=Ey(u);u=h.decode(p),e=!1}catch{}}return u}function o(d){return e&&/[\x80-\xff]/.test(d)&&(d=n("utf-8",d),e&&(d=n("iso-8859-1",d))),d}function s(d){const u=[];let h;const p=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(h=p.exec(d))!==null;){let[,f,m,A]=h;if(f=parseInt(f,10),f in u){if(f===0)break;continue}u[f]=[m,A]}const g=[];for(let f=0;f<u.length&&f in u;++f){let[m,A]=u[f];A=a(A),m&&(A=unescape(A),f===0&&(A=l(A))),g.push(A)}return g.join("")}function a(d){if(d.startsWith('"')){const u=d.slice(1).split('\\"');for(let h=0;h<u.length;++h){const p=u[h].indexOf('"');p!==-1&&(u[h]=u[h].slice(0,p),u.length=h+1),u[h]=u[h].replaceAll(/\\(.)/g,"$1")}d=u.join('"')}return d}function l(d){const u=d.indexOf("'");if(u===-1)return d;const h=d.slice(0,u),p=d.slice(u+1).replace(/^[^']*'/,"");return n(h,p)}function c(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,h,p,g){if(p==="q"||p==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(f,m){return String.fromCharCode(parseInt(m,16))}),n(h,g);try{g=atob(g)}catch{}return n(h,g)})}return""}function uye(t,e){const i=new Headers;if(!t||!e||typeof e!="object")return i;for(const r in e){const n=e[r];n!==void 0&&i.append(r,n)}return i}function RP(t){return URL.parse(t)?.origin??null}function hye({responseHeaders:t,isHttp:e,rangeChunkSize:i,disableRange:r}){const n={allowRangeRequests:!1,suggestedLength:void 0},o=parseInt(t.get("Content-Length"),10);return!Number.isInteger(o)||(n.suggestedLength=o,o<=2*i)||r||!e||t.get("Accept-Ranges")!=="bytes"||(t.get("Content-Encoding")||"identity")!=="identity"||(n.allowRangeRequests=!0),n}function pye(t){const e=t.get("Content-Disposition");if(e){let i=n_i(e);if(i.includes("%"))try{i=decodeURIComponent(i)}catch{}if(Tq(i))return i}return null}function Ry(t,e){return new kP(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,t===404||t===0&&e.startsWith("file:"))}function fye(t){return t===200||t===206}function gye(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Aye(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Hi(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class o_i{_responseOrigin=null;constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=uye(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return xr(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new s_i(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new a_i(this,e,i);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const i of this._rangeRequestReaders.slice(0))i.cancel(e)}}class s_i{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const i=e.source;this._withCredentials=i.withCredentials||!1,this._contentLength=i.length,this._headersCapability=Promise.withResolvers(),this._disableRange=i.disableRange||!1,this._rangeChunkSize=i.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!i.disableStream,this._isRangeSupported=!i.disableRange;const r=new Headers(e.headers),n=i.url;fetch(n,gye(r,this._withCredentials,this._abortController)).then(o=>{if(e._responseOrigin=RP(o.url),!fye(o.status))throw Ry(o.status,n);this._reader=o.body.getReader(),this._headersCapability.resolve();const s=o.headers,{allowRangeRequests:a,suggestedLength:l}=hye({responseHeaders:s,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=l||this._contentLength,this._filename=pye(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new t0("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Aye(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class a_i{constructor(e,i,r){this._stream=e,this._reader=null,this._loaded=0;const n=e.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const o=new Headers(e.headers);o.append("Range",`bytes=${i}-${r-1}`);const s=n.url;fetch(s,gye(o,this._withCredentials,this._abortController)).then(a=>{const l=RP(a.url);if(l!==e._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${e._responseOrigin}".`);if(!fye(a.status))throw Ry(a.status,s);this._readCapability.resolve(),this._reader=a.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Aye(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}const qq=200,Gq=206;function l_i(t){const e=t.response;return typeof e!="string"?e:Ey(e).buffer}class c_i{_responseOrigin=null;constructor({url:e,httpHeaders:i,withCredentials:r}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=uye(this.isHttp,i),this.withCredentials=r||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const i=new XMLHttpRequest,r=this.currXhrId++,n=this.pendingRequests[r]={xhr:i};i.open("GET",this.url),i.withCredentials=this.withCredentials;for(const[o,s]of this.headers)i.setRequestHeader(o,s);return this.isHttp&&"begin"in e&&"end"in e?(i.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=Gq):n.expectedStatus=qq,i.responseType="arraybuffer",xr(e.onError,"Expected `onError` callback to be provided."),i.onerror=()=>{e.onError(i.status)},i.onreadystatechange=this.onStateChange.bind(this,r),i.onprogress=this.onProgress.bind(this,r),n.onHeadersReceived=e.onHeadersReceived,n.onDone=e.onDone,n.onError=e.onError,n.onProgress=e.onProgress,i.send(null),r}onProgress(e,i){const r=this.pendingRequests[e];r&&r.onProgress?.(i)}onStateChange(e,i){const r=this.pendingRequests[e];if(!r)return;const n=r.xhr;if(n.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),n.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],n.status===0&&this.isHttp){r.onError(n.status);return}const o=n.status||qq;if(!(o===qq&&r.expectedStatus===Gq)&&o!==r.expectedStatus){r.onError(n.status);return}const s=l_i(n);if(o===Gq){const a=n.getResponseHeader("Content-Range"),l=/bytes (\d+)-(\d+)\/(\d+)/.exec(a);l?r.onDone({begin:parseInt(l[1],10),chunk:s}):(Hi('Missing or invalid "Content-Range" header.'),r.onError(0))}else s?r.onDone({begin:0,chunk:s}):r.onError(n.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const i=this.pendingRequests[e].xhr;delete this.pendingRequests[e],i.abort()}}class d_i{constructor(e){this._source=e,this._manager=new c_i(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const i=this._rangeRequestReaders.indexOf(e);i>=0&&this._rangeRequestReaders.splice(i,1)}getFullReader(){return xr(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new u_i(this._manager,this._source),this._fullRequestReader}getRangeReader(e,i){const r=new h_i(this._manager,e,i);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const i of this._rangeRequestReaders.slice(0))i.cancel(e)}}class u_i{constructor(e,i){this._manager=e,this._url=i.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=i.disableRange||!1,this._contentLength=i.length,this._rangeChunkSize=i.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,i=this._manager.getRequestXhr(e);this._manager._responseOrigin=RP(i.responseURL);const r=i.getAllResponseHeaders(),n=new Headers(r?r.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(a=>{const[l,...c]=a.split(": ");return[l,c.join(": ")]}):[]),{allowRangeRequests:o,suggestedLength:s}=hye({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});o&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=pye(n),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Ry(e,this._url),this._headersCapability.reject(this._storedError);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class h_i{constructor(e,i,r){this._manager=e,this._url=e.url,this._requestId=e.request({begin:i,end:r,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){const e=RP(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(e){const i=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:i,done:!1}):this._queuedChunk=i,this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??=Ry(e,this._url);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const p_i=/^[a-z][a-z0-9\-+.]+:/i;function f_i(t){if(p_i.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}class g_i{constructor(e){this.source=e,this.url=f_i(e.url),xr(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return xr(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new A_i(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new m_i(this,e,i);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const i of this._rangeRequestReaders.slice(0))i.cancel(e)}}class A_i{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const i=e.source;this._contentLength=i.length,this._loaded=0,this._filename=null,this._disableRange=i.disableRange||!1,this._rangeChunkSize=i.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!i.disableStream,this._isRangeSupported=!i.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const r=process.getBuiltinModule("fs");r.promises.lstat(this._url).then(n=>{this._contentLength=n.size,this._setReadableStream(r.createReadStream(this._url)),this._headersCapability.resolve()},n=>{n.code==="ENOENT"&&(n=Ry(0,this._url.href)),this._storedError=n,this._headersCapability.reject(n)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",i=>{this._error(i)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new t0("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class m_i{constructor(e,i,r){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=e.source;this._isStreamingSupported=!n.disableStream;const o=process.getBuiltinModule("fs");this._setReadableStream(o.createReadStream(this._url,{start:i,end:r-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",i=>{this._error(i)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const Ly=Symbol("INITIAL_DATA");class mye{#e=Object.create(null);#t(e){return this.#e[e]||={...Promise.withResolvers(),data:Ly}}get(e,i=null){if(i){const n=this.#t(e);return n.promise.then(()=>i(n.data)),null}const r=this.#e[e];if(!r||r.data===Ly)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const i=this.#e[e];return!!i&&i.data!==Ly}delete(e){const i=this.#e[e];return!i||i.data===Ly?!1:(delete this.#e[e],!0)}resolve(e,i=null){const r=this.#t(e);r.data=i,r.resolve()}clear(){for(const e in this.#e){const{data:i}=this.#e[e];i?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const e in this.#e){const{data:i}=this.#e[e];i!==Ly&&(yield[e,i])}}}const v_i=1e5,vye=30;class cc{#e=Promise.withResolvers();#t=null;#r=!1;#i=!!globalThis.FontInspector?.enabled;#n=null;#o=null;#s=0;#a=0;#l=null;#c=null;#h=0;#u=0;#p=Object.create(null);#A=[];#g=null;#d=[];#f=new WeakMap;#m=null;static#y=new Map;static#v=new Map;static#k=new WeakMap;static#x=null;static#b=new Set;constructor({textContentSource:e,container:i,viewport:r}){if(e instanceof ReadableStream)this.#g=e;else if(typeof e=="object")this.#g=new ReadableStream({start(l){l.enqueue(e),l.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#c=i,this.#u=r.scale*Ju.pixelRatio,this.#h=r.rotation,this.#o={div:null,properties:null,ctx:null};const{pageWidth:n,pageHeight:o,pageX:s,pageY:a}=r.rawDims;this.#m=[1,0,0,-1,-s,a+o],this.#a=n,this.#s=o,cc.#I(),i.style.setProperty("--min-font-size",cc.#x),ag(i,r),this.#e.promise.finally(()=>{cc.#b.delete(this),this.#o=null,this.#p=null}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:i}=Xo.platform;return Vi(this,"fontFamilyMap",new Map([["sans-serif",`${e&&i?"Calibri, ":""}sans-serif`],["monospace",`${e&&i?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{this.#l.read().then(({value:i,done:r})=>{if(r){this.#e.resolve();return}this.#n??=i.lang,Object.assign(this.#p,i.styles),this.#E(i.items),e()},this.#e.reject)};return this.#l=this.#g.getReader(),cc.#b.add(this),e(),this.#e.promise}update({viewport:e,onBefore:i=null}){const r=e.scale*Ju.pixelRatio,n=e.rotation;if(n!==this.#h&&(i?.(),this.#h=n,ag(this.#c,{rotation:n})),r!==this.#u){i?.(),this.#u=r;const o={div:null,properties:null,ctx:cc.#S(this.#n)};for(const s of this.#d)o.properties=this.#f.get(s),o.div=s,this.#M(o)}}cancel(){const e=new t0("TextLayer task cancelled.");this.#l?.cancel(e).catch(()=>{}),this.#l=null,this.#e.reject(e)}get textDivs(){return this.#d}get textContentItemsStr(){return this.#A}#E(e){if(this.#r)return;this.#o.ctx??=cc.#S(this.#n);const i=this.#d,r=this.#A;for(const n of e){if(i.length>v_i){Hi("Ignoring additional textDivs for performance reasons."),this.#r=!0;return}if(n.str===void 0){if(n.type==="beginMarkedContentProps"||n.type==="beginMarkedContent"){const o=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),n.id&&this.#t.setAttribute("id",`${n.id}`),o.append(this.#t)}else n.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}r.push(n.str),this.#w(n)}}#w(e){const i=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};this.#d.push(i);const n=Yt.transform(this.#m,e.transform);let o=Math.atan2(n[1],n[0]);const s=this.#p[e.fontName];s.vertical&&(o+=Math.PI/2);let a=this.#i&&s.fontSubstitution||s.fontFamily;a=cc.fontFamilyMap.get(a)||a;const l=Math.hypot(n[2],n[3]),c=l*cc.#O(a,s,this.#n);let d,u;o===0?(d=n[4],u=n[5]-c):(d=n[4]+c*Math.sin(o),u=n[5]-c*Math.cos(o));const h=i.style;h.left=`${(100*d/this.#a).toFixed(2)}%`,h.top=`${(100*u/this.#s).toFixed(2)}%`,h.setProperty("--font-height",`${l.toFixed(2)}px`),h.fontFamily=a,r.fontSize=l,i.setAttribute("role","presentation"),i.textContent=e.str,i.dir=e.dir,this.#i&&(i.dataset.fontName=s.fontSubstitutionLoadedName||e.fontName),o!==0&&(r.angle=o*(180/Math.PI));let p=!1;if(e.str.length>1)p=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const g=Math.abs(e.transform[0]),f=Math.abs(e.transform[3]);g!==f&&Math.max(g,f)/Math.min(g,f)>1.5&&(p=!0)}if(p&&(r.canvasWidth=s.vertical?e.height:e.width),this.#f.set(i,r),this.#o.div=i,this.#o.properties=r,this.#M(this.#o),r.hasText&&this.#t.append(i),r.hasEOL){const g=document.createElement("br");g.setAttribute("role","presentation"),this.#t.append(g)}}#M(e){const{div:i,properties:r,ctx:n}=e,{style:o}=i;if(r.canvasWidth!==0&&r.hasText){const{fontFamily:s}=o,{canvasWidth:a,fontSize:l}=r;cc.#P(n,l*this.#u,s);const{width:c}=n.measureText(i.textContent);c>0&&o.setProperty("--scale-x",a*this.#u/c)}r.angle!==0&&o.setProperty("--rotate",`${r.angle}deg`)}static cleanup(){if(!(this.#b.size>0)){this.#y.clear();for(const{canvas:e}of this.#v.values())e.remove();this.#v.clear()}}static#S(e=null){let i=this.#v.get(e||="");if(!i){const r=document.createElement("canvas");r.className="hiddenCanvasElement",r.lang=e,document.body.append(r),i=r.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(e,i),this.#k.set(i,{size:0,family:""})}return i}static#P(e,i,r){const n=this.#k.get(e);i===n.size&&r===n.family||(e.font=`${i}px ${r}`,n.size=i,n.family=r)}static#I(){if(this.#x!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#x=e.getBoundingClientRect().height,e.remove()}static#O(e,i,r){const n=this.#y.get(e);if(n)return n;const o=this.#S(r);o.canvas.width=o.canvas.height=vye,this.#P(o,vye,e);const s=o.measureText(""),a=s.fontBoundingBoxAscent,l=Math.abs(s.fontBoundingBoxDescent);o.canvas.width=o.canvas.height=0;let c=.8;return a?c=a/(a+l):(Xo.platform.isFirefox&&Hi("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),i.ascent?c=i.ascent:i.descent&&(c=1+i.descent)),this.#y.set(e,c),c}}const y_i=100;function yye(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new $Q,{docId:i}=e,r=t.url?ELi(t.url):null,n=t.data?BLi(t.data):null,o=t.httpHeaders||null,s=t.withCredentials===!0,a=t.password??null,l=t.range instanceof bye?t.range:null,c=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:2**16;let d=t.worker instanceof Kq?t.worker:null;const u=t.verbosity,h=typeof t.docBaseUrl=="string"&&!MP(t.docBaseUrl)?t.docBaseUrl:null,p=BP(t.cMapUrl),g=t.cMapPacked!==!1,f=t.CMapReaderFactory||(za?_Li:W7e),m=BP(t.iccUrl),A=BP(t.standardFontDataUrl),y=t.StandardFontDataFactory||(za?FLi:X7e),v=BP(t.wasmUrl),b=t.WasmFactory||(za?OLi:$7e),w=t.stopAtErrors!==!0,C=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,M=t.isEvalSupported!==!1,E=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!za,B=typeof t.isImageDecoderSupported=="boolean"?t.isImageDecoderSupported:!za&&(Xo.platform.isFirefox||!globalThis.chrome),S=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,I=typeof t.disableFontFace=="boolean"?t.disableFontFace:za,T=t.fontExtraProperties===!0,L=t.enableXfa===!0,O=t.ownerDocument||globalThis.document,j=t.disableRange===!0,N=t.disableStream===!0,z=t.disableAutoFetch===!0,G=t.pdfBug===!0,X=t.CanvasFactory||(za?LLi:TLi),me=t.FilterFactory||(za?RLi:DLi),le=t.enableHWA===!0,Ce=t.useWasm!==!1,Te=l?l.length:t.length??NaN,ue=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!za&&!I,ee=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:!!(f===W7e&&y===X7e&&b===$7e&&p&&A&&v&&Py(p,document.baseURI)&&Py(A,document.baseURI)&&Py(v,document.baseURI)),$=null;XRi(u);const re={canvasFactory:new X({ownerDocument:O,enableHWA:le}),filterFactory:new me({docId:i,ownerDocument:O}),cMapReaderFactory:ee?null:new f({baseUrl:p,isCompressed:g}),standardFontDataFactory:ee?null:new y({baseUrl:A}),wasmFactory:ee?null:new b({baseUrl:v})};d||(d=Kq.create({verbosity:u,port:e6.workerPort}),e._worker=d);const ie={docId:i,apiVersion:"5.4.530",data:n,password:a,disableAutoFetch:z,rangeChunkSize:c,length:Te,docBaseUrl:h,enableXfa:L,evaluatorOptions:{maxImageSize:C,disableFontFace:I,ignoreErrors:w,isEvalSupported:M,isOffscreenCanvasSupported:E,isImageDecoderSupported:B,canvasMaxAreaInBytes:S,fontExtraProperties:T,useSystemFonts:ue,useWasm:Ce,useWorkerFetch:ee,cMapUrl:p,iccUrl:m,standardFontDataUrl:A,wasmUrl:v}},de={ownerDocument:O,pdfBug:G,styleElement:$,loadingParams:{disableAutoFetch:z,enableXfa:L}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const pe=d.messageHandler.sendWithPromise("GetDocRequest",ie,n?[n.buffer]:null);let Ae;if(l)Ae=new t_i(l,{disableRange:j,disableStream:N});else if(!n){if(!r)throw new Error("getDocument - no `url` parameter provided.");const je=Py(r)?o_i:za?g_i:d_i;Ae=new je({url:r,length:Te,httpHeaders:o,withCredentials:s,rangeChunkSize:c,disableRange:j,disableStream:N})}return pe.then(je=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const V=new Ty(i,je,d.port),se=new C_i(V,e,Ae,de,re,le);e._transport=se,V.send("Ready",null)})}).catch(e._capability.reject),e}class $Q{static#e=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${$Q.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}class bye{#e=Promise.withResolvers();#t=[];#r=[];#i=[];#n=[];constructor(e,i,r=!1,n=null){this.length=e,this.initialData=i,this.progressiveDone=r,this.contentDispositionFilename=n}addRangeListener(e){this.#n.push(e)}addProgressListener(e){this.#i.push(e)}addProgressiveReadListener(e){this.#r.push(e)}addProgressiveDoneListener(e){this.#t.push(e)}onDataRange(e,i){for(const r of this.#n)r(e,i)}onDataProgress(e,i){this.#e.promise.then(()=>{for(const r of this.#i)r(e,i)})}onDataProgressiveRead(e){this.#e.promise.then(()=>{for(const i of this.#r)i(e)})}onDataProgressiveDone(){this.#e.promise.then(()=>{for(const e of this.#t)e()})}transportReady(){this.#e.resolve()}requestDataRange(e,i){yn("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class b_i{constructor(e,i){this._pdfInfo=e,this._transport=i}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Vi(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(e,i){return this._transport.getAnnotationsByType(e,i)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:i}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(i)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(e){return this._transport.extractPages(e)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class w_i{#e=!1;constructor(e,i,r,n=!1){this._pageIndex=e,this._pageInfo=i,this._transport=r,this._stats=n?new D7e:null,this._pdfBug=n,this.commonObjs=r.commonObjs,this.objs=new mye,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:i=this.rotate,offsetX:r=0,offsetY:n=0,dontFlip:o=!1}={}){return new Wb({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:i,offsetX:r,offsetY:n,dontFlip:o})}getAnnotations({intent:e="display"}={}){const{renderingIntent:i}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,i)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Vi(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:i=e.canvas,viewport:r,intent:n="display",annotationMode:o=e0.ENABLE,transform:s=null,background:a=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:d=null,printAnnotationStorage:u=null,isEditing:h=!1,recordOperations:p=!1,operationsFilter:g=null}){this._stats?.time("Overall");const f=this._transport.getRenderingIntent(n,o,u,h),{renderingIntent:m,cacheKey:A}=f;this.#e=!1,l||=this._transport.getOptionalContentConfig(m);let y=this._intentStates.get(A);y||(y=Object.create(null),this._intentStates.set(A,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const v=!!(m&ec.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(f));const b=!!(this._pdfBug&&globalThis.StepperManager?.enabled),w=!this.recordedBBoxes&&(p||b),C=B=>{if(y.renderTasks.delete(M),w){const S=M.gfx?.dependencyTracker.take();S&&(M.stepper&&M.stepper.setOperatorBBoxes(S,M.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=S))}v&&(this.#e=!0),this.#t(),B?(M.capability.reject(B),this._abortOperatorList({intentState:y,reason:B instanceof Error?B:new Error(B)})):M.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},M=new R6({callback:C,params:{canvas:i,canvasContext:e,dependencyTracker:w?new NLi(i,y.operatorList.length,b):null,viewport:r,transform:s,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!v,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA,operationsFilter:g});(y.renderTasks||=new Set).add(M);const E=M.task;return Promise.all([y.displayReadyCapability.promise,l]).then(([B,S])=>{if(this.destroyed){C();return}if(this._stats?.time("Rendering"),!(S.renderingIntent&m))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");M.initializeGraphics({transparency:B,optionalContentConfig:S}),M.operatorListChanged()}).catch(C),E}getOperatorList({intent:e="display",annotationMode:i=e0.ENABLE,printAnnotationStorage:r=null,isEditing:n=!1}={}){function o(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(l))}const s=this._transport.getRenderingIntent(e,i,r,n,!0);let a=this._intentStates.get(s.cacheKey);a||(a=Object.create(null),this._intentStates.set(s.cacheKey,a));let l;return a.opListReadCapability||(l=Object.create(null),l.operatorListChanged=o,a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(l),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:i=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:i===!0},{highWaterMark:100,size(r){return r.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(r=>Kb.textContent(r));const i=this.streamTextContent(e);return new Promise(function(r,n){function o(){s.read().then(function({value:l,done:c}){if(c){r(a);return}a.lang??=l.lang,Object.assign(a.styles,l.styles),a.items.push(...l.items),o()},n)}const s=i.getReader(),a={items:[],styles:Object.create(null),lang:null};o()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const i of this._intentStates.values())if(this._abortOperatorList({intentState:i,reason:new Error("Page was destroyed."),force:!0}),!i.opListReadCapability)for(const r of i.renderTasks)e.push(r.completed),r.cancel();return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;const i=this.#t();return e&&i&&(this._stats&&=new D7e),i}#t(){if(!this.#e||this.destroyed)return!1;for(const{renderTasks:e,operatorList:i}of this._intentStates.values())if(e.size>0||!i.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,i){const r=this._intentStates.get(i);r&&(this._stats?.timeEnd("Page Request"),r.displayReadyCapability?.resolve(e))}_renderPageChunk(e,i){for(let r=0,n=e.length;r<n;r++)i.operatorList.fnArray.push(e.fnArray[r]),i.operatorList.argsArray.push(e.argsArray[r]);i.operatorList.lastChunk=e.lastChunk,i.operatorList.separateAnnots=e.separateAnnots;for(const r of i.renderTasks)r.operatorListChanged();e.lastChunk&&this.#t()}_pumpOperatorList({renderingIntent:e,cacheKey:i,annotationStorageSerializable:r,modifiedIds:n}){const{map:o,transfer:s}=r,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:o,modifiedIds:n},s).getReader(),l=this._intentStates.get(i);l.streamReader=a;const c=()=>{a.read().then(({value:d,done:u})=>{if(u){l.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,l),c())},d=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const u of l.renderTasks)u.operatorListChanged();this.#t()}if(l.displayReadyCapability)l.displayReadyCapability.reject(d);else if(l.opListReadCapability)l.opListReadCapability.reject(d);else throw d}})};c()}_abortOperatorList({intentState:e,reason:i,force:r=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!r){if(e.renderTasks.size>0)return;if(i instanceof Sq){let n=y_i;i.extraDelay>0&&i.extraDelay<1e3&&(n+=i.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},n);return}}if(e.streamReader.cancel(new t0(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[n,o]of this._intentStates)if(o===e){this._intentStates.delete(n);break}this.cleanup()}}}get stats(){return this._stats}}var lg,_u,i0,i6,Qq,r6,n6,Id,LP,wye,Cye,_y,Fy,_P;const Yo=class Ob{constructor({name:e=null,port:i=null,verbosity:r=YRi()}={}){if(ih(this,Id),ih(this,lg,Promise.withResolvers()),ih(this,_u,null),ih(this,i0,null),ih(this,i6,null),this.name=e,this.destroyed=!1,this.verbosity=r,i){if(Jn(Ob,n6).has(i))throw new Error("Cannot use more than one PDFWorker per port.");Jn(Ob,n6).set(i,this),rh(this,Id,wye).call(this,i)}else rh(this,Id,Cye).call(this)}get promise(){return Jn(this,lg).promise}get port(){return Jn(this,i0)}get messageHandler(){return Jn(this,_u)}destroy(){this.destroyed=!0,Jn(this,i6)?.terminate(),Sl(this,i6,null),Jn(Ob,n6).delete(Jn(this,i0)),Sl(this,i0,null),Jn(this,_u)?.destroy(),Sl(this,_u,null)}static create(e){const i=Jn(this,n6).get(e?.port);if(i){if(i._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new Ob(e)}static get workerSrc(){if(e6.workerSrc)return e6.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Vi(this,"_setupFakeWorkerGlobal",(async()=>Jn(this,Fy,_P)?Jn(this,Fy,_P):(await import(this.workerSrc)).WorkerMessageHandler)())}};lg=new WeakMap,_u=new WeakMap,i0=new WeakMap,i6=new WeakMap,Qq=new WeakMap,r6=new WeakMap,n6=new WeakMap,Id=new WeakSet,LP=function(){Jn(this,lg).resolve(),Jn(this,_u).send("configure",{verbosity:this.verbosity})},wye=function(t){Sl(this,i0,t),Sl(this,_u,new Ty("main","worker",t)),Jn(this,_u).on("ready",()=>{}),rh(this,Id,LP).call(this)},Cye=function(){if(Jn(Yo,r6)||Jn(Yo,Fy,_P)){rh(this,Id,_y).call(this);return}let{workerSrc:t}=Yo;try{Yo._isSameOrigin(window.location,t)||(t=Yo._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new Ty("main","worker",e),r=()=>{n.abort(),i.destroy(),e.terminate(),this.destroyed?Jn(this,lg).reject(new Error("Worker was destroyed")):rh(this,Id,_y).call(this)},n=new AbortController;e.addEventListener("error",()=>{Jn(this,i6)||r()},{signal:n.signal}),i.on("test",s=>{if(n.abort(),this.destroyed||!s){r();return}Sl(this,_u,i),Sl(this,i0,e),Sl(this,i6,e),rh(this,Id,LP).call(this)}),i.on("ready",s=>{if(n.abort(),this.destroyed){r();return}try{o()}catch{rh(this,Id,_y).call(this)}});const o=()=>{const s=new Uint8Array;i.send("test",s,[s.buffer])};o();return}catch{xP("The worker has been disabled.")}rh(this,Id,_y).call(this)},_y=function(){Jn(Yo,r6)||(Hi("Setting up fake worker."),Sl(Yo,r6,!0)),Yo._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){Jn(this,lg).reject(new Error("Worker was destroyed"));return}const e=new SLi;Sl(this,i0,e);const i=`fake${Ake(Yo,Qq)._++}`,r=new Ty(i+"_worker",i,e);t.setup(r,e),Sl(this,_u,new Ty(i,i+"_worker",e)),rh(this,Id,LP).call(this)}).catch(t=>{Jn(this,lg).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Fy=new WeakSet,_P=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},ih(Yo,Fy),ih(Yo,Qq,0),ih(Yo,r6,!1),ih(Yo,n6,new WeakMap),za&&(Sl(Yo,r6,!0),e6.workerSrc||="./pdf.worker.mjs"),Yo._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(!i?.origin||i.origin==="null")return!1;const r=new URL(e,i);return i.origin===r.origin},Yo._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Yo.fromPort=t=>{if(dLi("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return Yo.create(t)};let Kq=Yo;class C_i{#e=new Map;#t=new Map;#r=new Map;#i=new Map;#n=null;constructor(e,i,r,n,o,s){this.messageHandler=e,this.loadingTask=i,this.commonObjs=new mye,this.fontLoader=new wLi({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=o.canvasFactory,this.filterFactory=o.filterFactory,this.cMapReaderFactory=o.cMapReaderFactory,this.standardFontDataFactory=o.standardFontDataFactory,this.wasmFactory=o.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=s,this.setupMessageHandler()}#o(e,i=null){const r=this.#e.get(e);if(r)return r;const n=this.messageHandler.sendWithPromise(e,i);return this.#e.set(e,n),n}get annotationStorage(){return Vi(this,"annotationStorage",new Fq)}getRenderingIntent(e,i=e0.ENABLE,r=null,n=!1,o=!1){let s=ec.DISPLAY,a=_q;switch(e){case"any":s=ec.ANY;break;case"display":break;case"print":s=ec.PRINT;break;default:Hi(`getRenderingIntent - invalid intent: ${e}`)}const l=s&ec.PRINT&&r instanceof V7e?r:this.annotationStorage;switch(i){case e0.DISABLE:s+=ec.ANNOTATIONS_DISABLE;break;case e0.ENABLE:break;case e0.ENABLE_FORMS:s+=ec.ANNOTATIONS_FORMS;break;case e0.ENABLE_STORAGE:s+=ec.ANNOTATIONS_STORAGE,a=l.serializable;break;default:Hi(`getRenderingIntent - invalid annotationMode: ${i}`)}n&&(s+=ec.IS_EDITING),o&&(s+=ec.OPLIST);const{ids:c,hash:d}=l.modifiedIds,u=[s,a.hash,d];return{renderingIntent:s,cacheKey:u.join("_"),annotationStorageSerializable:a,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#n?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const r of this.#t.values())e.push(r._destroy());this.#t.clear(),this.#r.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),cc.cleanup(),this._networkStream?.cancelAllRequests(new t0("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:i}=this;e.on("GetReader",(r,n)=>{xr(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=o=>{this._lastProgress={loaded:o.loaded,total:o.total}},n.onPull=()=>{this._fullReader.read().then(function({value:o,done:s}){if(s){n.close();return}xr(o instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{n.error(o)})},n.onCancel=o=>{this._fullReader.cancel(o),n.ready.catch(s=>{if(!this.destroyed)throw s})}}),e.on("ReaderHeadersReady",async r=>{await this._fullReader.headersReady;const{isStreamingSupported:n,isRangeSupported:o,contentLength:s}=this._fullReader;return(!n||!o)&&(this._lastProgress&&i.onProgress?.(this._lastProgress),this._fullReader.onProgress=a=>{i.onProgress?.({loaded:a.loaded,total:a.total})}),{isStreamingSupported:n,isRangeSupported:o,contentLength:s}}),e.on("GetRangeReader",(r,n)=>{xr(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const o=this._networkStream.getRangeReader(r.begin,r.end);if(!o){n.close();return}n.onPull=()=>{o.read().then(function({value:s,done:a}){if(a){n.close();return}xr(s instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{n.error(s)})},n.onCancel=s=>{o.cancel(s),n.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("GetDoc",({pdfInfo:r})=>{this._numPages=r.numPages,this._htmlForXfa=r.htmlForXfa,delete r.htmlForXfa,i._capability.resolve(new b_i(r,this))}),e.on("DocException",r=>{i._capability.reject(bl(r))}),e.on("PasswordRequest",r=>{this.#n=Promise.withResolvers();try{if(!i.onPassword)throw bl(r);const n=o=>{o instanceof Error?this.#n.reject(o):this.#n.resolve({password:o})};i.onPassword(n,r.code)}catch(n){this.#n.reject(n)}return this.#n.promise}),e.on("DataLoaded",r=>{i.onProgress?.({loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{this.destroyed||this.#t.get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,n,o])=>{if(this.destroyed||this.commonObjs.has(r))return null;switch(n){case"Font":if("error"in o){const u=o.error;Hi(`Error during font loading: ${u}`),this.commonObjs.resolve(r,u);break}const s=new xLi(o),a=this._params.pdfBug&&globalThis.FontInspector?.enabled?(u,h)=>globalThis.FontInspector.fontAdded(u,h):null,l=new CLi(s,a,o.extra,o.charProcOperatorList);this.fontLoader.bind(l).catch(()=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!l.fontExtraProperties&&l.data&&l.clearData(),this.commonObjs.resolve(r,l)});break;case"CopyLocalImage":const{imageRef:c}=o;xr(c,"The imageRef must be defined.");for(const u of this.#t.values())for(const[,h]of u.objs)if(h?.ref===c)return h.dataLen?(this.commonObjs.resolve(r,structuredClone(h)),h.dataLen):null;break;case"FontPath":this.commonObjs.resolve(r,new MLi(o));break;case"Image":this.commonObjs.resolve(r,o);break;case"Pattern":const d=new kLi(o);this.commonObjs.resolve(r,d.getIR());break;default:throw new Error(`Got unknown common object type ${n}`)}return null}),e.on("obj",([r,n,o,s])=>{if(this.destroyed)return;const a=this.#t.get(n);if(!a.objs.has(r)){if(a._intentStates.size===0){s?.bitmap?.close();return}switch(o){case"Image":case"Pattern":a.objs.resolve(r,s);break;default:throw new Error(`Got unknown object type ${o}`)}}}),e.on("DocProgress",r=>{this.destroyed||i.onProgress?.({loaded:r.loaded,total:r.total})}),e.on("FetchBinaryData",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");const n=this[r.type];if(!n)throw new Error(`${r.type} not initialized, see the \`useWorkerFetch\` parameter.`);return n.fetch(r)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Hi("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:i}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},i).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e){return this.messageHandler.sendWithPromise("ExtractPages",{pageInfos:e})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const i=e-1,r=this.#r.get(i);if(r)return r;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(o=>{if(this.destroyed)throw new Error("Transport destroyed");o.refStr&&this.#i.set(o.refStr,e);const s=new w_i(i,o,this,this._params.pdfBug);return this.#t.set(i,s),s});return this.#r.set(i,n),n}getPageIndex(e){return Oq(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,i){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:i})}getFieldObjects(){return this.#o("GetFieldObjects")}hasJSActions(){return this.#o("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(e,i){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:i})}getDocJSActions(){return this.#o("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#o("GetOptionalContentConfig").then(i=>new e_i(i,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",i=this.#e.get(e);if(i)return i;const r=this.messageHandler.sendWithPromise(e,null).then(n=>({info:n[0],metadata:n[1]?new YLi(n[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null,hasStructTree:n[2]}));return this.#e.set(e,r),r}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const i of this.#t.values())if(!i.cleanup())throw new Error(`startCleanup: Page ${i.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),cc.cleanup()}}cachedPageNumber(e){if(!Oq(e))return null;const i=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return this.#i.get(i)??null}}class x_i{#e=null;onContinue=null;onError=null;constructor(e){this.#e=e}get promise(){return this.#e.capability.promise}cancel(e=0){this.#e.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#e.operatorList;if(!e)return!1;const{annotationCanvasMap:i}=this.#e;return e.form||e.canvas&&i?.size>0}}class R6{#e=null;static#t=new WeakSet;constructor({callback:e,params:i,objs:r,commonObjs:n,annotationCanvasMap:o,operatorList:s,pageIndex:a,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:h=null,enableHWA:p=!1,operationsFilter:g=null}){this.callback=e,this.params=i,this.objs=r,this.commonObjs=n,this.annotationCanvasMap=o,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=a,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=u,this.pageColors=h,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new x_i(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=i.canvas,this._canvasContext=i.canvas?null:i.canvasContext,this._enableHWA=p,this._dependencyTracker=i.dependencyTracker,this._operationsFilter=g}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:i}){if(this.cancelled)return;if(this._canvas){if(R6.#t.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");R6.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:r,transform:n,background:o,dependencyTracker:s}=this.params,a=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new D6(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors,s),this.gfx.beginDrawing({transform:n,viewport:r,transparency:e,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,i=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),R6.#t.delete(this._canvas),e||=new Sq(`Rendering cancelled, page ${this._pageIndex+1}`,i),this.callback(e),this.task.onError?.(e)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),R6.#t.delete(this._canvas),this.callback())))}}const k_i="5.4.530",M_i="50cc4adac";class Jc{#e=null;#t=null;#r;#i=null;#n=!1;#o=!1;#s=null;#a;#l=null;#c=null;static#h=null;static get _keyboardManager(){return Vi(this,"_keyboardManager",new Sy([[["Escape","mac+Escape"],Jc.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Jc.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Jc.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Jc.prototype._moveToPrevious],[["Home","mac+Home"],Jc.prototype._moveToBeginning],[["End","mac+End"],Jc.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:i=null}){e?(this.#o=!1,this.#s=e):this.#o=!0,this.#c=e?._uiManager||i,this.#a=this.#c._eventBus,this.#r=e?.color?.toUpperCase()||this.#c?.highlightColors.values().next().value||"#FFFF98",Jc.#h||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const e=this.#e=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",this.#s&&(e.ariaControls=`${this.#s.id}_colorpicker_dropdown`);const i=this.#c._signal;e.addEventListener("click",this.#g.bind(this),{signal:i}),e.addEventListener("keydown",this.#A.bind(this),{signal:i});const r=this.#t=document.createElement("span");return r.className="swatch",r.ariaHidden="true",r.style.backgroundColor=this.#r,e.append(r),e}renderMainDropdown(){const e=this.#i=this.#u();return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}#u(){const e=document.createElement("div"),i=this.#c._signal;e.addEventListener("contextmenu",Fc,{signal:i}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#s&&(e.id=`${this.#s.id}_colorpicker_dropdown`);for(const[r,n]of this.#c.highlightColors){const o=document.createElement("button");o.tabIndex="0",o.role="option",o.setAttribute("data-color",n),o.title=r,o.setAttribute("data-l10n-id",Jc.#h[r]);const s=document.createElement("span");o.append(s),s.className="swatch",s.style.backgroundColor=n,o.ariaSelected=n===this.#r,o.addEventListener("click",this.#p.bind(this,n),{signal:i}),e.append(o)}return e.addEventListener("keydown",this.#A.bind(this),{signal:i}),e}#p(e,i){i.stopPropagation(),this.#a.dispatch("switchannotationeditorparams",{source:this,type:Cr.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#g(e);return}const i=e.target.getAttribute("data-color");i&&this.#p(i,e)}_moveToNext(e){if(!this.#f){this.#g(e);return}if(e.target===this.#e){this.#i.firstElementChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#i?.firstElementChild||e.target===this.#e){this.#f&&this._hideDropdownFromKeyboard();return}this.#f||this.#g(e),e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#f){this.#g(e);return}this.#i.firstElementChild?.focus()}_moveToEnd(e){if(!this.#f){this.#g(e);return}this.#i.lastElementChild?.focus()}#A(e){Jc._keyboardManager.exec(this,e)}#g(e){if(this.#f){this.hideDropdown();return}if(this.#n=e.detail===0,this.#l||(this.#l=new AbortController,window.addEventListener("pointerdown",this.#d.bind(this),{signal:this.#c.combinedSignal(this.#l)})),this.#e.ariaExpanded="true",this.#i){this.#i.classList.remove("hidden");return}const i=this.#i=this.#u();this.#e.append(i)}#d(e){this.#i?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#i?.classList.add("hidden"),this.#e.ariaExpanded="false",this.#l?.abort(),this.#l=null}get#f(){return this.#i&&!this.#i.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#o){if(!this.#f){this.#s?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#n})}}updateColor(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#i)return;const i=this.#c.highlightColors.values();for(const r of this.#i.children)r.ariaSelected=i.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#i?.remove(),this.#i=null}}class nw{#e=null;#t=null;#r=null;static#i=null;constructor(e){this.#t=e,this.#r=e._uiManager,nw.#i||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#e)return this.#e;const{editorType:e,colorType:i,color:r}=this.#t,n=this.#e=document.createElement("input");return n.type="color",n.value=r||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",nw.#i[e]),n.addEventListener("input",()=>{this.#r.updateParams(i,n.value)},{signal:this.#r._signal}),n}update(e){this.#e&&(this.#e.value=e)}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}}function xye(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function Oy(t){return Math.max(0,Math.min(255,255*t))}class kye{static CMYK_G([e,i,r,n]){return["G",1-Math.min(1,.3*e+.59*r+.11*i+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=Oy(e),[e,e,e]}static G_HTML([e]){const i=xye(e);return`#${i}${i}${i}`}static RGB_G([e,i,r]){return["G",.3*e+.59*i+.11*r]}static RGB_rgb(e){return e.map(Oy)}static RGB_HTML(e){return`#${e.map(xye).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,i,r,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,r+n),1-Math.min(1,i+n)]}static CMYK_rgb([e,i,r,n]){return[Oy(1-Math.min(1,e+n)),Oy(1-Math.min(1,r+n)),Oy(1-Math.min(1,i+n))]}static CMYK_HTML(e){const i=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(i)}static RGB_CMYK([e,i,r]){const n=1-e,o=1-i,s=1-r,a=Math.min(n,o,s);return["CMYK",n,o,s,a]}}class E_i{create(e,i,r=!1){if(e<=0||i<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),r||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${i}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${i}`),n}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){yn("Abstract method `_createSVG` called.")}}class FP extends E_i{_createSVG(e){return document.createElementNS(d1,e)}}const B_i=9,cg=new WeakSet,P_i=new Date().getTimezoneOffset()*60*1e3;class Wq{static create(e){switch(e.data.annotationType){case Uo.LINK:return new Jq(e);case Uo.TEXT:return new S_i(e);case Uo.WIDGET:switch(e.data.fieldType){case"Tx":return new T_i(e);case"Btn":return e.data.radioButton?new Mye(e):e.data.checkBox?new R_i(e):new L_i(e);case"Ch":return new __i(e);case"Sig":return new D_i(e)}return new dg(e);case Uo.POPUP:return new Zq(e);case Uo.FREETEXT:return new Eye(e);case Uo.LINE:return new O_i(e);case Uo.SQUARE:return new U_i(e);case Uo.CIRCLE:return new N_i(e);case Uo.POLYLINE:return new Bye(e);case Uo.CARET:return new H_i(e);case Uo.INK:return new Xq(e);case Uo.POLYGON:return new j_i(e);case Uo.HIGHLIGHT:return new Pye(e);case Uo.UNDERLINE:return new V_i(e);case Uo.SQUIGGLY:return new z_i(e);case Uo.STRIKEOUT:return new q_i(e);case Uo.STAMP:return new Iye(e);case Uo.FILEATTACHMENT:return new G_i(e);default:return new io(e)}}}class io{#e=null;#t=!1;#r=null;constructor(e,{isRenderable:i=!1,ignoreBorder:r=!1,createQuadrilaterals:n=!1}={}){this.isRenderable=i,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,i&&(this.contentElement=this.container=this._createContainer(r)),n&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:i}){return!!(e?.str||i?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return io._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){const{data:e}=this,i=this.annotationStorage?.getEditor(e.id);return i?i.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){const e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:i,inkLists:r,rect:n}=this.data;let o=-1/0,s=-1/0;if(i?.length>=8){for(let a=0;a<i.length;a+=8)i[a+1]>s?(s=i[a+1],o=i[a+2]):i[a+1]===s&&(o=Math.max(o,i[a+2]));return[o,s]}if(r?.length>=1){for(const a of r)for(let l=0,c=a.length;l<c;l+=2)a[l+1]>s?(s=a[l+1],o=a[l]):a[l+1]===s&&(o=Math.max(o,a[l]));if(o!==1/0)return[o,s]}return n?[n[2],n[3]]:null}_normalizePoint(e){const{page:{view:i},viewport:{rawDims:{pageWidth:r,pageHeight:n,pageX:o,pageY:s}}}=this.parent;return e[1]=i[3]-e[1]+i[1],e[0]=100*(e[0]-o)/r,e[1]=100*(e[1]-s)/n,e}get commentText(){const{data:e}=this;return this.annotationStorage.getRawValue(`${xy}${e.id}`)?.popup?.contents||e.contentsObj?.str||""}set commentText(e){const{data:i}=this,r={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(i.id,{popup:r})||this.annotationStorage.setValue(`${xy}${i.id}`,{id:i.id,annotationType:i.annotationType,pageIndex:this.parent.page._pageIndex,popup:r,popupRef:i.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){(this.#r?.popup||this.popup)?.remove(),this.#r=this.popup=null}updateEdited(e){if(!this.container)return;e.rect&&(this.#e||={rect:this.data.rect.slice(0)});const{rect:i,popup:r}=e;i&&this.#i(i);let n=this.#r?.popup||this.popup;!n&&r?.text&&(this._createPopup(r),n=this.#r.popup),n&&(n.updateEdited(e),r?.deleted&&(n.remove(),this.#r=null,this.popup=null))}resetEdited(){this.#e&&(this.#i(this.#e.rect),this.#r?.popup.resetEdited(),this.#e=null)}#i(e){const{container:{style:i},data:{rect:r,rotation:n},parent:{viewport:{rawDims:{pageWidth:o,pageHeight:s,pageX:a,pageY:l}}}}=this;r?.splice(0,4,...e),i.left=`${100*(e[0]-a)/o}%`,i.top=`${100*(s-e[3]+l)/s}%`,n===0?(i.width=`${100*(e[2]-e[0])/o}%`,i.height=`${100*(e[3]-e[1])/s}%`):this.setRotation(n)}_createContainer(e){const{data:i,parent:{page:r,viewport:n}}=this,o=document.createElement("section");o.setAttribute("data-annotation-id",i.id),!(this instanceof dg)&&!(this instanceof Jq)&&(o.tabIndex=0);const{style:s}=o;if(s.zIndex=this.parent.zIndex,this.parent.zIndex+=2,i.alternativeText&&(o.title=i.alternativeText),i.noRotate&&o.classList.add("norotate"),!i.rect||this instanceof Zq){const{rotation:f}=i;return!i.hasOwnCanvas&&f!==0&&this.setRotation(f,o),o}const{width:a,height:l}=this;if(!e&&i.borderStyle.width>0){s.borderWidth=`${i.borderStyle.width}px`;const f=i.borderStyle.horizontalCornerRadius,m=i.borderStyle.verticalCornerRadius;if(f>0||m>0){const y=`calc(${f}px * var(--total-scale-factor)) / calc(${m}px * var(--total-scale-factor))`;s.borderRadius=y}else if(this instanceof Mye){const y=`calc(${a}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;s.borderRadius=y}switch(i.borderStyle.style){case J5.SOLID:s.borderStyle="solid";break;case J5.DASHED:s.borderStyle="dashed";break;case J5.BEVELED:Hi("Unimplemented border style: beveled");break;case J5.INSET:Hi("Unimplemented border style: inset");break;case J5.UNDERLINE:s.borderBottomStyle="solid";break}const A=i.borderColor||null;A?(this.#t=!0,s.borderColor=Yt.makeHexColor(A[0]|0,A[1]|0,A[2]|0)):s.borderWidth=0}const c=Yt.normalizeRect([i.rect[0],r.view[3]-i.rect[1]+r.view[1],i.rect[2],r.view[3]-i.rect[3]+r.view[1]]),{pageWidth:d,pageHeight:u,pageX:h,pageY:p}=n.rawDims;s.left=`${100*(c[0]-h)/d}%`,s.top=`${100*(c[1]-p)/u}%`;const{rotation:g}=i;return i.hasOwnCanvas||g===0?(s.width=`${100*a/d}%`,s.height=`${100*l/u}%`):this.setRotation(g,o),o}setRotation(e,i=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:n}=this.parent.viewport.rawDims;let{width:o,height:s}=this;e%180!==0&&([o,s]=[s,o]),i.style.width=`${100*o/r}%`,i.style.height=`${100*s/n}%`,i.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(i,r,n)=>{const o=n.detail[i],s=o[0],a=o.slice(1);n.target.style[r]=kye[`${s}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[r]:kye[`${s}_rgb`](a)})};return Vi(this,"_commonActions",{display:i=>{const{display:r}=i.detail,n=r%2===1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:r===1||r===2})},print:i=>{this.annotationStorage.setValue(this.data.id,{noPrint:!i.detail.print})},hidden:i=>{const{hidden:r}=i.detail;this.container.style.visibility=r?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:r,noView:r})},focus:i=>{setTimeout(()=>i.target.focus({preventScroll:!1}),0)},userName:i=>{i.target.title=i.detail.userName},readonly:i=>{i.target.disabled=i.detail.readonly},required:i=>{this._setRequired(i.target,i.detail.required)},bgColor:i=>{e("bgColor","backgroundColor",i)},fillColor:i=>{e("fillColor","backgroundColor",i)},fgColor:i=>{e("fgColor","color",i)},textColor:i=>{e("textColor","color",i)},borderColor:i=>{e("borderColor","borderColor",i)},strokeColor:i=>{e("strokeColor","borderColor",i)},rotation:i=>{const r=i.detail.rotation;this.setRotation(r),this.annotationStorage.setValue(this.data.id,{rotation:r})}})}_dispatchEventFromSandbox(e,i){const r=this._commonActions;for(const n of Object.keys(i.detail))(e[n]||r[n])?.(i)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const i=this.annotationStorage.getRawValue(this.data.id);if(!i)return;const r=this._commonActions;for(const[n,o]of Object.entries(i)){const s=r[n];if(s){const a={detail:{[n]:o},target:e};s(a),delete i[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[i,r,n,o]=this.data.rect.map(f=>Math.fround(f));if(e.length===8){const[f,m,A,y]=e.subarray(2,6);if(n===f&&o===m&&i===A&&r===y)return}const{style:s}=this.container;let a;if(this.#t){const{borderColor:f,borderWidth:m}=s;s.borderWidth=0,a=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${f}" stroke-width="${m}">`],this.container.classList.add("hasBorder")}const l=n-i,c=o-r,{svgFactory:d}=this,u=d.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const h=d.createElement("defs");u.append(h);const p=d.createElement("clipPath"),g=`clippath_${this.data.id}`;p.setAttribute("id",g),p.setAttribute("clipPathUnits","objectBoundingBox"),h.append(p);for(let f=2,m=e.length;f<m;f+=8){const A=e[f],y=e[f+1],v=e[f+2],b=e[f+3],w=d.createElement("rect"),C=(v-i)/l,M=(o-y)/c,E=(A-v)/l,B=(y-b)/c;w.setAttribute("x",C),w.setAttribute("y",M),w.setAttribute("width",E),w.setAttribute("height",B),p.append(w),a?.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${M}" width="${E}" height="${B}"/>`)}this.#t&&(a.push("</g></svg>')"),s.backgroundImage=a.join("")),this.container.append(u),this.container.style.clipPath=`url(#${g})`}_createPopup(e=null){const{data:i}=this;let r,n;e?(r={str:e.text},n=e.date):(r=i.contentsObj,n=i.modificationDate),this.#r=new Zq({data:{color:i.color,titleObj:i.titleObj,modificationDate:n,contentsObj:r,richText:i.richText,parentRect:i.rect,borderStyle:0,id:`popup_${i.id}`,rotation:i.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#r||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#r}render(){yn("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,i=null){const r=[];if(this._fieldObjects){const n=this._fieldObjects[e];if(n)for(const{page:o,id:s,exportValues:a}of n){if(o===-1||s===i)continue;const l=typeof a=="string"?a:null,c=document.querySelector(`[data-element-id="${s}"]`);if(c&&!cg.has(c)){Hi(`_getElementsByName - element not allowed: ${s}`);continue}r.push({id:s,exportValue:l,domElement:c})}return r}for(const n of document.getElementsByName(e)){const{exportValue:o}=n,s=n.getAttribute("data-element-id");s!==i&&cg.has(n)&&r.push({id:s,exportValue:o,domElement:n})}return r}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const i of e)i.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:i}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:i,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}class I_i extends io{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}class Jq extends io{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!i?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:i}=this,r=document.createElement("a");r.setAttribute("data-element-id",e.id);let n=!1;return e.url?(i.addLinkAttributes(r,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(r,e.action,e.overlaidText),n=!0):e.attachment?(this.#t(r,e.attachment,e.overlaidText,e.attachmentDest),n=!0):e.setOCGState?(this.#r(r,e.setOCGState,e.overlaidText),n=!0):e.dest?(this._bindLink(r,e.dest,e.overlaidText),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(r,e),n=!0),e.resetForm?(this._bindResetFormAction(r,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(r,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&(this.contentElement=r,this.container.append(r)),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(e,i,r=""){e.href=this.linkService.getDestinationHash(i),e.onclick=()=>(i&&this.linkService.goToDestination(i),!1),(i||i==="")&&this.#e(),r&&(e.title=r)}_bindNamedAction(e,i,r=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(i),!1),r&&(e.title=r),this.#e()}#t(e,i,r="",n=null){e.href=this.linkService.getAnchorUrl(""),i.description?e.title=i.description:r&&(e.title=r),e.onclick=()=>(this.downloadManager?.openOrDownloadData(i.content,i.filename,n),!1),this.#e()}#r(e,i,r=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),r&&(e.title=r),this.#e()}_bindJSAction(e,i){e.href=this.linkService.getAnchorUrl("");const r=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(i.actions)){const o=r.get(n);o&&(e[o]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i.id,name:n}}),!1))}i.overlaidText&&(e.title=i.overlaidText),e.onclick||(e.onclick=()=>!1),this.#e()}_bindResetFormAction(e,i){const r=e.onclick;if(r||(e.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){Hi('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),r||(e.onclick=()=>!1);return}e.onclick=()=>{r?.();const{fields:n,refs:o,include:s}=i,a=[];if(n.length!==0||o.length!==0){const d=new Set(o);for(const u of n){const h=this._fieldObjects[u]||[];for(const{id:p}of h)d.add(p)}for(const u of Object.values(this._fieldObjects))for(const h of u)d.has(h.id)===s&&a.push(h)}else for(const d of Object.values(this._fieldObjects))a.push(...d);const l=this.annotationStorage,c=[];for(const d of a){const{id:u}=d;switch(c.push(u),d.type){case"text":{const p=d.defaultValue||"";l.setValue(u,{value:p});break}case"checkbox":case"radiobutton":{const p=d.defaultValue===d.exportValues;l.setValue(u,{value:p});break}case"combobox":case"listbox":{const p=d.defaultValue||"";l.setValue(u,{value:p});break}default:continue}const h=document.querySelector(`[data-element-id="${u}"]`);if(h){if(!cg.has(h)){Hi(`_bindResetFormAction - element not allowed: ${u}`);continue}}else continue;h.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}}),!1}}}class S_i extends io{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}}class dg extends io{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Xo.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,i,r,n,o){r.includes("mouse")?e.addEventListener(r,s=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:o(s),shift:s.shiftKey,modifier:this._getKeyModifier(s)}})}):e.addEventListener(r,s=>{if(r==="blur"){if(!i.focused||!s.relatedTarget)return;i.focused=!1}else if(r==="focus"){if(i.focused)return;i.focused=!0}o&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:o(s)}})})}_setEventListeners(e,i,r,n){for(const[o,s]of r)(s==="Action"||this.data.actions?.[s])&&((s==="Focus"||s==="Blur")&&(i||={focused:!1}),this._setEventListener(e,i,o,s,n),s==="Focus"&&!this.data.actions?.Blur?this._setEventListener(e,i,"blur","Blur",null):s==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(e,i,"focus","Focus",null))}_setBackgroundColor(e){const i=this.data.backgroundColor||null;e.style.backgroundColor=i===null?"transparent":Yt.makeHexColor(i[0],i[1],i[2])}_setTextStyle(e){const i=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||B_i,o=e.style;let s;const a=2,l=c=>Math.round(10*c)/10;if(this.data.multiLine){const c=Math.abs(this.data.rect[3]-this.data.rect[1]-a),d=Math.round(c/(kq*n))||1,u=c/d;s=Math.min(n,l(u/kq))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-a);s=Math.min(n,l(c/kq))}o.fontSize=`calc(${s}px * var(--total-scale-factor))`,o.color=Yt.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(o.textAlign=i[this.data.textAlignment])}_setRequired(e,i){i?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",i)}}class T_i extends dg{constructor(e){const i=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:i})}setPropertyOnSiblings(e,i,r,n){const o=this.annotationStorage;for(const s of this._getElementsByName(e.name,e.id))s.domElement&&(s.domElement[i]=r),o.setValue(s.id,{[n]:r})}render(){const e=this.annotationStorage,i=this.data.id;this.container.classList.add("textWidgetAnnotation");let r=null;if(this.renderForms){const n=e.getValue(i,{value:this.data.fieldValue});let o=n.value||"";const s=e.getValue(i,{charLimit:this.data.maxLen}).charLimit;s&&o.length>s&&(o=o.slice(0,s));let a=n.formattedValue||this.data.textContent?.join(`
5320
5320
  `)||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));const l={userValue:o,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(r=document.createElement("textarea"),r.textContent=a??o,this.data.doNotScroll&&(r.style.overflowY="hidden")):(r=document.createElement("input"),r.type=this.data.password?"password":"text",r.setAttribute("value",a??o),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),cg.add(r),this.contentElement=r,r.setAttribute("data-element-id",i),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=0;const{datetimeFormat:c,datetimeType:d,timeStep:u}=this.data,h=!!d&&this.enableScripting;c&&(r.title=c),this._setRequired(r,this.data.required),s&&(r.maxLength=s),r.addEventListener("input",g=>{e.setValue(i,{value:g.target.value}),this.setPropertyOnSiblings(r,"value",g.target.value,"value"),l.formattedValue=null}),r.addEventListener("resetform",g=>{const f=this.data.defaultFieldValue??"";r.value=l.userValue=f,l.formattedValue=null});let p=g=>{const{formattedValue:f}=l;f!=null&&(g.target.value=f),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){r.addEventListener("focus",f=>{if(l.focused)return;const{target:m}=f;if(h&&(m.type=d,u&&(m.step=u)),l.userValue){const A=l.userValue;if(h)if(d==="time"){const y=new Date(A),v=[y.getHours(),y.getMinutes(),y.getSeconds()];m.value=v.map(b=>b.toString().padStart(2,"0")).join(":")}else m.value=new Date(A-P_i).toISOString().split(d==="date"?"T":".",1)[0];else m.value=A}l.lastCommittedValue=m.value,l.commitKey=1,this.data.actions?.Focus||(l.focused=!0)}),r.addEventListener("updatefromsandbox",f=>{this.showElementAndHideCanvas(f.target);const m={value(A){l.userValue=A.detail.value??"",h||e.setValue(i,{value:l.userValue.toString()}),A.target.value=l.userValue},formattedValue(A){const{formattedValue:y}=A.detail;l.formattedValue=y,y!=null&&A.target!==document.activeElement&&(A.target.value=y);const v={formattedValue:y};h&&(v.value=y),e.setValue(i,v)},selRange(A){A.target.setSelectionRange(...A.detail.selRange)},charLimit:A=>{const{charLimit:y}=A.detail,{target:v}=A;if(y===0){v.removeAttribute("maxLength");return}v.setAttribute("maxLength",y);let b=l.userValue;!b||b.length<=y||(b=b.slice(0,y),v.value=l.userValue=b,e.setValue(i,{value:b}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:b,willCommit:!0,commitKey:1,selStart:v.selectionStart,selEnd:v.selectionEnd}}))}};this._dispatchEventFromSandbox(m,f)}),r.addEventListener("keydown",f=>{l.commitKey=1;let m=-1;if(f.key==="Escape"?m=0:f.key==="Enter"&&!this.data.multiLine?m=2:f.key==="Tab"&&(l.commitKey=3),m===-1)return;const{value:A}=f.target;l.lastCommittedValue!==A&&(l.lastCommittedValue=A,l.userValue=A,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:A,willCommit:!0,commitKey:m,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}}))});const g=p;p=null,r.addEventListener("blur",f=>{if(!l.focused||!f.relatedTarget)return;this.data.actions?.Blur||(l.focused=!1);const{target:m}=f;let{value:A}=m;if(h){if(A&&d==="time"){const y=A.split(":").map(v=>parseInt(v,10));A=new Date(2e3,0,1,y[0],y[1],y[2]||0).valueOf(),m.step=""}else A.includes("T")||(A=`${A}T00:00`),A=new Date(A).valueOf();m.type="text"}l.userValue=A,l.lastCommittedValue!==A&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:A,willCommit:!0,commitKey:l.commitKey,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}}),g(f)}),this.data.actions?.Keystroke&&r.addEventListener("beforeinput",f=>{l.lastCommittedValue=null;const{data:m,target:A}=f,{value:y,selectionStart:v,selectionEnd:b}=A;let w=v,C=b;switch(f.inputType){case"deleteWordBackward":{const M=y.substring(0,v).match(/\w*[^\w]*$/);M&&(w-=M[0].length);break}case"deleteWordForward":{const M=y.substring(v).match(/^[^\w]*\w*/);M&&(C+=M[0].length);break}case"deleteContentBackward":v===b&&(w-=1);break;case"deleteContentForward":v===b&&(C+=1);break}f.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:y,change:m||"",willCommit:!1,selStart:w,selEnd:C}})}),this._setEventListeners(r,l,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],f=>f.target.value)}if(p&&r.addEventListener("blur",p),this.data.comb){const g=(this.data.rect[2]-this.data.rect[0])/s;r.classList.add("comb"),r.style.letterSpacing=`calc(${g}px * var(--total-scale-factor) - 1ch)`}}else r=document.createElement("div"),r.textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell",this.data.hasOwnCanvas&&(r.hidden=!0);return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class D_i extends dg{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class R_i extends dg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,i=this.data,r=i.id;let n=e.getValue(r,{value:i.exportValue===i.fieldValue}).value;typeof n=="string"&&(n=n!=="Off",e.setValue(r,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const o=document.createElement("input");return cg.add(o),o.setAttribute("data-element-id",r),o.disabled=i.readOnly,this._setRequired(o,this.data.required),o.type="checkbox",o.name=i.fieldName,n&&o.setAttribute("checked",!0),o.setAttribute("exportValue",i.exportValue),o.tabIndex=0,o.addEventListener("change",s=>{const{name:a,checked:l}=s.target;for(const c of this._getElementsByName(a,r)){const d=l&&c.exportValue===i.exportValue;c.domElement&&(c.domElement.checked=d),e.setValue(c.id,{value:d})}e.setValue(r,{value:l})}),o.addEventListener("resetform",s=>{const a=i.defaultFieldValue||"Off";s.target.checked=a===i.exportValue}),this.enableScripting&&this.hasJSActions&&(o.addEventListener("updatefromsandbox",s=>{const a={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(r,{value:l.target.checked})}};this._dispatchEventFromSandbox(a,s)}),this._setEventListeners(o,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],s=>s.target.checked)),this._setBackgroundColor(o),this._setDefaultPropertiesFromJS(o),this.container.append(o),this.container}}class Mye extends dg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,i=this.data,r=i.id;let n=e.getValue(r,{value:i.fieldValue===i.buttonValue}).value;if(typeof n=="string"&&(n=n!==i.buttonValue,e.setValue(r,{value:n})),n)for(const s of this._getElementsByName(i.fieldName,r))e.setValue(s.id,{value:!1});const o=document.createElement("input");if(cg.add(o),o.setAttribute("data-element-id",r),o.disabled=i.readOnly,this._setRequired(o,this.data.required),o.type="radio",o.name=i.fieldName,n&&o.setAttribute("checked",!0),o.tabIndex=0,o.addEventListener("change",s=>{const{name:a,checked:l}=s.target;for(const c of this._getElementsByName(a,r))e.setValue(c.id,{value:!1});e.setValue(r,{value:l})}),o.addEventListener("resetform",s=>{const a=i.defaultFieldValue;s.target.checked=a!=null&&a===i.buttonValue}),this.enableScripting&&this.hasJSActions){const s=i.buttonValue;o.addEventListener("updatefromsandbox",a=>{const l={value:c=>{const d=s===c.detail.value;for(const u of this._getElementsByName(c.target.name)){const h=d&&u.id===r;u.domElement&&(u.domElement.checked=h),e.setValue(u.id,{value:h})}}};this._dispatchEventFromSandbox(l,a)}),this._setEventListeners(o,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)}return this._setBackgroundColor(o),this._setDefaultPropertiesFromJS(o),this.container.append(o),this.container}}class L_i extends Jq{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const i=e.lastChild;return this.enableScripting&&this.hasJSActions&&i&&(this._setDefaultPropertiesFromJS(i),i.addEventListener("updatefromsandbox",r=>{this._dispatchEventFromSandbox({},r)})),e}}class __i extends dg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,i=this.data.id,r=e.getValue(i,{value:this.data.fieldValue}),n=document.createElement("select");cg.add(n),n.setAttribute("data-element-id",i),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=0;let o=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",d=>{const u=this.data.defaultFieldValue;for(const h of n.options)h.selected=h.value===u});for(const d of this.data.options){const u=document.createElement("option");u.textContent=d.displayValue,u.value=d.exportValue,r.value.includes(d.exportValue)&&(u.setAttribute("selected",!0),o=!1),n.append(u)}let s=null;if(o){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),n.prepend(d),s=()=>{d.remove(),n.removeEventListener("input",s),s=null},n.addEventListener("input",s)}const a=d=>{const u=d?"value":"textContent",{options:h,multiple:p}=n;return p?Array.prototype.filter.call(h,g=>g.selected).map(g=>g[u]):h.selectedIndex===-1?null:h[h.selectedIndex][u]};let l=a(!1);const c=d=>{const u=d.target.options;return Array.prototype.map.call(u,h=>({displayValue:h.textContent,exportValue:h.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",d=>{const u={value(h){s?.();const p=h.detail.value,g=new Set(Array.isArray(p)?p:[p]);for(const f of n.options)f.selected=g.has(f.value);e.setValue(i,{value:a(!0)}),l=a(!1)},multipleSelection(h){n.multiple=!0},remove(h){const p=n.options,g=h.detail.remove;p[g].selected=!1,n.remove(g),p.length>0&&Array.prototype.findIndex.call(p,f=>f.selected)===-1&&(p[0].selected=!0),e.setValue(i,{value:a(!0),items:c(h)}),l=a(!1)},clear(h){for(;n.length!==0;)n.remove(0);e.setValue(i,{value:null,items:[]}),l=a(!1)},insert(h){const{index:p,displayValue:g,exportValue:f}=h.detail.insert,m=n.children[p],A=document.createElement("option");A.textContent=g,A.value=f,m?m.before(A):n.append(A),e.setValue(i,{value:a(!0),items:c(h)}),l=a(!1)},items(h){const{items:p}=h.detail;for(;n.length!==0;)n.remove(0);for(const g of p){const{displayValue:f,exportValue:m}=g,A=document.createElement("option");A.textContent=f,A.value=m,n.append(A)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(i,{value:a(!0),items:c(h)}),l=a(!1)},indices(h){const p=new Set(h.detail.indices);for(const g of h.target.options)g.selected=p.has(g.index);e.setValue(i,{value:a(!0)}),l=a(!1)},editable(h){h.target.disabled=!h.detail.editable}};this._dispatchEventFromSandbox(u,d)}),n.addEventListener("input",d=>{const u=a(!0),h=a(!1);e.setValue(i,{value:u}),d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:l,change:h,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):n.addEventListener("input",function(d){e.setValue(i,{value:a(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Zq extends io{constructor(e){const{data:i,elements:r,parent:n}=e,o=!!n._commentManager;if(super(e,{isRenderable:!o&&io._hasPopupData(i)}),this.elements=r,o&&io._hasPopupData(i)){const s=this.popup=this.#e();for(const a of r)a.popup=s}else this.popup=null}#e(){return new F_i({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const i=this.popup=this.#e(),r=[];for(const n of this.elements)n.popup=i,n.container.ariaHasPopup="dialog",r.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",r.map(n=>`${Z5}${n}`).join(",")),this.container}}class F_i{#e=null;#t=this.#q.bind(this);#r=this.#N.bind(this);#i=this.#R.bind(this);#n=this.#C.bind(this);#o=null;#s=null;#a=null;#l=null;#c=null;#h=null;#u=null;#p=!1;#A=null;#g=null;#d=null;#f=null;#m=null;#y=null;#v=null;#k=null;#x=null;#b=null;#E=!1;#w=null;#M=null;constructor({container:e,color:i,elements:r,titleObj:n,modificationDate:o,contentsObj:s,richText:a,parent:l,rect:c,parentRect:d,open:u,commentManager:h=null}){this.#s=e,this.#x=n,this.#a=s,this.#k=a,this.#h=l,this.#o=i,this.#v=c,this.#u=d,this.#c=r,this.#e=h,this.#w=r[0],this.#l=Dq.toDateObject(o),this.trigger=r.flatMap(p=>p.getElementsToTriggerPopup()),h||(this.#S(),this.#s.hidden=!0,u&&this.#C())}#S(){if(this.#g)return;this.#g=new AbortController;const{signal:e}=this.#g;for(const i of this.trigger)i.addEventListener("click",this.#n,{signal:e}),i.addEventListener("pointerenter",this.#i,{signal:e}),i.addEventListener("pointerleave",this.#r,{signal:e}),i.classList.add("popupTriggerArea");for(const i of this.#c)i.container?.addEventListener("keydown",this.#t,{signal:e})}#P(){const e=this.#c.find(i=>i.hasCommentButton);e&&(this.#m=e._normalizePoint(e.commentButtonPosition))}renderCommentButton(){if(this.#f){this.#f.parentNode||this.#w.container.after(this.#f);return}if(this.#m||this.#P(),!this.#m)return;const{signal:e}=this.#g=new AbortController,i=this.#w.hasOwnCommentButton,r=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!i)},n=()=>{this.#e.toggleCommentPopup(this,!1,!0,!i)},o=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(i){this.#f=this.#w.container;for(const s of this.trigger)s.ariaHasPopup="dialog",s.ariaControls="commentPopup",s.addEventListener("keydown",this.#t,{signal:e}),s.addEventListener("click",r,{signal:e}),s.addEventListener("pointerenter",n,{signal:e}),s.addEventListener("pointerleave",o,{signal:e}),s.classList.add("popupTriggerArea")}else{const s=this.#f=document.createElement("button");s.className="annotationCommentButton";const a=this.#w.container;s.style.zIndex=a.style.zIndex+1,s.tabIndex=0,s.ariaHasPopup="dialog",s.ariaControls="commentPopup",s.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#O(),this.#I(),s.addEventListener("keydown",this.#t,{signal:e}),s.addEventListener("click",r,{signal:e}),s.addEventListener("pointerenter",n,{signal:e}),s.addEventListener("pointerleave",o,{signal:e}),a.after(s)}}#I(){if(this.#w.extraPopupElement&&!this.#w.editor)return;this.#f||this.renderCommentButton();const[e,i]=this.#m,{style:r}=this.#f;r.left=`calc(${e}%)`,r.top=`calc(${i}% - var(--comment-button-dim))`}#O(){this.#w.extraPopupElement||(this.#f||this.renderCommentButton(),this.#f.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){const{color:e,opacity:i}=this.#w.commentData;return e?this.#h._commentManager.makeCommentColor(e,i):null}focusCommentButton(){setTimeout(()=>{this.#f?.focus()},0)}getData(){const{richText:e,color:i,opacity:r,creationDate:n,modificationDate:o}=this.#w.commentData;return{contentsObj:{str:this.comment},richText:e,color:i,opacity:r,creationDate:n,modificationDate:o}}get elementBeforePopup(){return this.#f}get comment(){return this.#M||=this.#w.commentText,this.#M}set comment(e){e!==this.comment&&(this.#w.commentText=this.#M=e)}focus(){this.#w.container?.focus()}get parentBoundingClientRect(){return this.#w.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:i}){this.#f&&(this.#f.classList.toggle("selected",e),this.#f.ariaExpanded=i)}setSelectedCommentButton(e){this.#f.classList.toggle("selected",e)}get commentPopupPosition(){if(this.#y)return this.#y;const{x:e,y:i,height:r}=this.#f.getBoundingClientRect(),{x:n,y:o,width:s,height:a}=this.#w.layer.getBoundingClientRect();return[(e-n)/s,(i+r-o)/a]}set commentPopupPosition(e){this.#y=e}hasDefaultPopupPosition(){return this.#y===null}get commentButtonPosition(){return this.#m}get commentButtonWidth(){return this.#f.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[i,r]=this.#y||this.commentButtonPosition.map(c=>c/100),n=this.parentBoundingClientRect,{x:o,y:s,width:a,height:l}=n;this.#e.showDialog(null,this,o+i*a,s+r*l,{...e,parentDimensions:n})}render(){if(this.#A)return;const e=this.#A=document.createElement("div");if(e.className="popup",this.#o){const r=e.style.outlineColor=Yt.makeHexColor(...this.#o);e.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`}const i=document.createElement("span");if(i.className="header",this.#x?.str){const r=document.createElement("span");r.className="title",i.append(r),{dir:r.dir,str:r.textContent}=this.#x}if(e.append(i),this.#l){const r=document.createElement("time");r.className="popupDate",r.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),r.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#l.valueOf()})),r.dateTime=this.#l.toISOString(),i.append(r)}O7e({html:this.#D||this.#a.str,dir:this.#a?.dir,className:"popupContent"},e),this.#s.append(e)}get#D(){const e=this.#k,i=this.#a;return e?.str&&(!i?.str||i.str===e.str)&&this.#k.html||null}get#L(){return this.#D?.attributes?.style?.fontSize||0}get#U(){return this.#D?.attributes?.style?.color||null}#_(e){const i=[],r={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:i}]}},n={style:{color:this.#U,fontSize:this.#L?`calc(${this.#L}px * var(--total-scale-factor))`:""}};for(const o of e.split(`