@bimdata/viewer 2.8.0-beta.8 → 2.8.0

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.
@@ -5491,7 +5491,7 @@ void main() {
5491
5491
  --bimdata-local-context-width: ${r.width}px;
5492
5492
  --bimdata-local-context-center-width: ${r.centerWidth}px;
5493
5493
  --bimdata-local-context-resolution: ${r.resolution};
5494
- `),onMouseenter:e[0]||(e[0]=(...A)=>r.onMouseEnter&&r.onMouseEnter(...A)),onMouseleave:e[1]||(e[1]=(...A)=>r.onMouseLeave&&r.onMouseLeave(...A))},[L(s,{ref:"modalManagerTemplateRef"},null,512),B("div",hLi,[r.windowPlugins.leftSidePanel?(Q(),te(a,{key:0,plugin:r.windowPlugins.leftSidePanel},null,8,["plugin"])):fe("",!0),B("div",pLi,[(Q(!0),O(Et,null,Wt(r.windowPlugins.free,A=>(Q(),te(l,{key:A.name,class:Be({"window-container__content__center__viewer":A.isViewer}),plugin:A},null,8,["class","plugin"]))),128)),L(c,{position:"left",plugins:r.windowPlugins.leftButtonColumn},null,8,["plugins"]),L(c,{position:"right",plugins:r.windowPlugins.rightButtonColumn},null,8,["plugins"])]),r.windowPlugins.rightSidePanel?(Q(),te(a,{key:1,plugin:r.windowPlugins.rightSidePanel},null,8,["plugin"])):fe("",!0)]),r.loading?(Q(),O("div",gLi,[r.spinner&&r.spinner.component?(Q(),te(No(r.spinner.component),hd(sl({key:0},r.spinner.props)),null,16)):(Q(),te(d,{key:1,size:"20px",border:"3px"}))])):fe("",!0),r.layoutSettingsDisplayed?(Q(),O("div",fLi,[L(u)])):fe("",!0)],36)}const vLi=K(ALi,[["render",mLi]]);let CLi=class{constructor(t=!0){const e=lRi(eae,null,{resizable:t});e.registerContent("default",vLi),this.settings=Gl({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?cRi(t):null}copy(t,e=!0){return dRi(this.areas.layout,t,e)}open({ratio:t,direction:e,insertAfter:i,windowName:r=null,windowState:o=null,localContextId:n=null}={}){const s=r?{options:{windowName:r,windowState:o}}:null;return n===null?this.areas.splitLayout(t,e,i,s):this.areas.split(n,t,e,i,s)}swap(t,e){return this.areas.swap(t,e)}close(t){return this.areas.delete(t)}compare(t,e){var i,r;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 o=new Set((i=t.windowState)==null?void 0:i.modelIds),n=new Set((r=e.windowState)==null?void 0:r.modelIds);return o.size===n.size&&[...o].every(s=>n.has(s))}return t.windowName||e.windowName||t.direction!==e.direction||t.children.length!==e.children.length?!1:t.children.every((o,n)=>this.compare(o,e.children[n]))}};const yLi="2.8.0-beta.8",wLi={version:yLi};class bLi{constructor({plugins:e,api:i,ui:r,locale:o="fr"}){this.pluginManager=new ySi(e),this.windowManager=new bSi,this.windowManager.registerAndAddPluginsToWindows([...this.pluginManager.registeredPlugins.values()]),this.api=new dPi(i),this.globalContext=new VOe(this),this.state=xPi(this),this.shortcutManager=kRe(this.state),this.uiSettings=r||{},this.i18n=new OOe(o),this._contextMenu=null,this.layout=new CLi(this.uiSettings.resizable!==!1),this.localContext=null,window.$viewer=this}get version(){return wLi.version}get locale(){return this.i18n.locale}get contextMenu(){return this._contextMenu||ERe}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 ILi(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 BLi=Object.freeze({25:"GUEST",50:"USER",100:"ADMIN"}),R9=Object.freeze({READ:"read",WRITE:"write"});function DEe(t){const e={};return t.forEach(i=>{const[r,o]=i.split(":");e[r]?e[r].push(o):e[r]=[o]}),e}const ELi={token_scopes:[],usable_scopes:[],user_role:25};function PEe(t=ELi){var e,i,r,o,n,s;const a=DEe(t.token_scopes),l=DEe(t.usable_scopes);return{..._ue(t),tokenScopes:a,usableScopes:l,userRole:BLi[t.user_role],user:t.user?_ue(t.user):null,hasBcfReadPermission:((e=l.bcf)==null?void 0:e.includes(R9.READ))??!1,hasBcfWritePermission:((i=l.bcf)==null?void 0:i.includes(R9.WRITE))??!1,hasModelReadPermission:((r=l.model)==null?void 0:r.includes(R9.READ))??!1,hasModelWritePermission:((o=l.model)==null?void 0:o.includes(R9.WRITE))??!1,hasDocReadPermission:((n=l.document)==null?void 0:n.includes(R9.READ))??!1,hasDocWritePermission:((s=l.document)==null?void 0:s.includes(R9.WRITE))??!1}}const xLi={BcfFilters:{filtersButton:"Filter",filtersTitle:"Filter",priorityLabel:"Priorit\xE4t",statusLabel:"Status",assignedToLabel:"Zugewiesen an",creatorsLabel:"Erstellt von",tagsLabel:"Tags",resetButton:"Zur\xFCcksetzen",searchButton:"Suchen",undefined:"Nicht definiert",datePlaceholder:"Erstellungsdatum"},BcfSettings:{goBackButton:"Zur\xFCck",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"},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"},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"}}},kLi={BcfComponents:xLi},MLi={BcfFilters:{filtersButton:"Filters",filtersTitle:"Filters",priorityLabel:"Priority",statusLabel:"Status",assignedToLabel:"Assigned to",creatorsLabel:"Created by",tagsLabel:"Tags",resetButton:"Reset",searchButton:"Search",undefined:"Not defined",datePlaceholder:"Creation date"},BcfSettings:{goBackButton:"Back",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"},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"},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"}}},SLi={BcfComponents:MLi},QLi={BcfFilters:{filtersButton:"Filtros",filtersTitle:"Filtros",priorityLabel:"Prioridad",statusLabel:"Estado",assignedToLabel:"Asignado a",creatorsLabel:"Creado por",tagsLabel:"Etiquetas:",resetButton:"Restablecer",searchButton:"Buscar en",undefined:"No definido",datePlaceholder:"Fecha de creaci\xF3n"},BcfSettings:{goBackButton:"Volver",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"}}},DLi={BcfComponents:QLi},PLi={BcfFilters:{filtersButton:"Filtres",filtersTitle:"Filtres",priorityLabel:"Priorit\xE9",statusLabel:"Statut",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:{goBackButton:"Retour",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"},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"},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"}}},RLi={BcfComponents:PLi},LLi={BcfFilters:{filtersButton:"Filtri",filtersTitle:"Filtri",priorityLabel:"Priorit\xE0",statusLabel:"Stato",datePlaceholder:"Data di creazione",assignedToLabel:"Assegnato a",creatorsLabel:"Creato da",tagsLabel:"Etichette",resetButton:"Ripristina",searchButton:"Cerca",undefined:"Non definito"},BcfSettings:{goBackButton:"Indietro",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"}}},TLi={BcfComponents:LLi},FLi={de:kLi,en:SLi,es:DLi,fr:RLi,it:TLi},ULi=({apiClient:t,fetchUsers:e,i18nPlugin:i}={})=>({install(r){t?mo.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(FLi).forEach(([o,n])=>{i.global.mergeLocaleMessage(o,n)}):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(lqe).forEach(([o,n])=>{r.component(o,n)})}}),NLi={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"}},_Li={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"},OLi={BuildingMaker:NLi,FileManager:_Li},HLi={t:{back:"Back",cancel:"Cancel",create:"Create",delete:"Delete",download:"Download",finish:"Finish",rename:"Rename",search:"Search",see:"View",storey:"Storey",validate:"Validate"}},VLi={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"}},GLi={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"},jLi={title:"Meta-Building Structure",tab:{structure:"Structure",zones:"Zones",equipments:"Equipments"},StoreySelector:{placeholder:"Select a storey"}},zLi={title:"Photosphere Building"},qLi={BIMDataComponents:HLi,BuildingMaker:VLi,FileManager:GLi,MetaBuildingStructure:jLi,PhotosphereBuilding:zLi},KLi={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"}},JLi={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"},YLi={BuildingMaker:KLi,FileManager:JLi},WLi={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"}},ZLi={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"}},XLi={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"},$Li={title:"Structure M\xE9ta-Building",tab:{structure:"Structure",zones:"Zones",equipments:"\xC9quipements"},StoreySelector:{placeholder:"S\xE9lectionner un \xE9tage"}},eTi={title:"Photosph\xE8re Building"},tTi={BIMDataComponents:WLi,BuildingMaker:ZLi,FileManager:XLi,MetaBuildingStructure:$Li,PhotosphereBuilding:eTi},iTi={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"}},rTi={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"},oTi={BuildingMaker:iTi,FileManager:rTi},nTi={de:OLi,en:qLi,es:YLi,fr:tTi,it:oTi},sTi=({i18nPlugin:t}={})=>({install(e){t?Object.entries(nTi).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(jvi).forEach(([i,r])=>{e.component(i,r)})}}),aTi={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}},lTi=Object.freeze(Object.defineProperty({__proto__:null,BIMDataClickAway:kA,BIMDataClickInputAway:aTi},Symbol.toStringTag,{value:"Module"})),cTi=t=>({install(e){Object.entries(e5t).forEach(([i,r])=>{e.component(i,r)}),Object.entries(lTi).forEach(([i,r])=>e.directive(i.split("BIMData")[1],r))}}),dTi={name:"LiWrapper",render(){return Ln("li",this.$slots.default())}};function uTi(t,e){var i=new Set([]);return t.forEach(r=>{e.has(r)||i.add(r)}),i}const th=Ia("id"),ATi=({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(gA(Mr("visible"),hf("selected"))).map(th)),predicate:()=>e.some(gA(Mr("visible"),hf("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(Mr("selected")).map(th)),predicate:()=>e.some(Mr("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 o=e.filter(n=>n.visible&&n.type===this.selectedObject.type&&n.id!==this.selectedObject.id).map(th);i.selectObjects(o)},selectedObject:null,predicate(){const o=e.filter(gA(Mr("visible"),Mr("selected")));return o.length===1&&o[0].type!==void 0?(this.selectedObject=o[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 o=new Set(e.filter(Mr("selected")).map(th)),n=new Set(e.filter(Mr("visible")).map(th));i.selectObjects(Array.from(uTi(n,o)),{exclusive:!0})},predicate:()=>e.some(gA(hf("selected"),Mr("visible")))&&e.some(gA(Mr("selected"),Mr("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(hf("visible")).map(th)),predicate:()=>e.some(hf("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 o=this.objectsToHide.filter(Mr("selected"));o.length>0&&i.deselectObjects(o.map(th)),i.hideObjects(this.objectsToHide.map(th))},predicate(){return this.objectsToHide=e.filter(gA(Mr("selected"),Mr("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 o=e.filter(Mr("visible"));o.some(Mr("selected"))&&i.deselectObjects(o.filter(Mr("selected")).map(th)),i.hideObjects(o.map(th))},predicate:()=>e.some(Mr("visible"))}].filter(o=>o.predicate()),hTi={components:{LiWrapper:dTi},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(o=>r.set(o.name,o.key)),ATi({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,o)=>(r.position=r.position||0,o.position=o.position||0,r.position-o.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}}},pTi={key:0,class:"separator"},gTi={class:"menu-text"},fTi={key:1,class:"menu-picto"},mTi={key:0,class:"context-menu__spinner"};function vTi(t,e,i,r,o,n){const s=R("BIMDataIconChevron"),a=R("LiWrapper"),l=R("BIMDataSpinner"),c=ar("click-away");return o.displayed&&(o.currentCommands.length||o.asyncPredicateRunning)?Ft((Q(),O("ul",{key:0,class:"bimdata-list context-menu",style:Ie(n.position)},[(Q(!0),O(Et,null,Wt(o.currentCommands,(d,u)=>(Q(),te(a,{key:d.label,class:"context-menu__element",onClick:A=>n.executeCommand(d)},{default:q(()=>[n.isGroupIntersection(u)?(Q(),O("div",pTi)):fe("",!0),B("div",gTi,ee(d.label),1),!d.component&&d.picto?(Q(),O("span",fTi,ee(d.picto),1)):d.component?(Q(),te(s,{key:2,size:"xxs",class:"fill-primary"})):fe("",!0)]),_:2},1032,["onClick"]))),128)),o.asyncPredicateRunning?(Q(),O("li",mTi,[L(l)])):fe("",!0)],4)),[[c,n.away]]):fe("",!0)}const CTi=K(hTi,[["render",vTi],["__scopeId","data-v-5b87d4a3"]]),yTi={name:"ViewerHeader",inject:["$viewer"],props:{visible:{type:Boolean,default:!0}},setup(){const t=Ut("$viewer"),e=Gl(new Map),i=o=>{if(!o.name)throw new TypeError("[Viewer Header] Content must have a name");if(e.has(o.name))throw new Error(`[Viewer Header] Content with name ${o.name} already exists`);e.set(o.name,o)},r=o=>e.has(o)?(e.delete(o),!0):!1;return{logo:t.uiSettings.bimdataLogo!==!1,version:t.uiSettings.version!==!1?t.version:null,headerContent:e,headerRightContentComponents:At(()=>Array.from(e.values()).filter(o=>o.position==="right").sort((o,n)=>o.order-n.order).map(o=>o.component)),headerLeftContentComponents:At(()=>Array.from(e.values()).filter(o=>o.position==="left").sort((o,n)=>o.order-n.order).map(o=>o.component)),addContent:i,removeContent:r}}},wTi={class:"viewer-header"},bTi={class:"viewer-header__content"},ITi={class:"viewer-header__content__left"},BTi={class:"viewer-header__content__right"},ETi={key:0,class:"m-l-6 flex items-center"},xTi={key:1,class:"viewer-header__version"};function kTi(t,e,i,r,o,n){const s=R("BIMDataIllustration");return Ft((Q(),O("div",wTi,[B("div",bTi,[B("div",ITi,[(Q(!0),O(Et,null,Wt(r.headerLeftContentComponents,a=>(Q(),te(No(a),{key:a.name}))),128))]),B("div",BTi,[(Q(!0),O(Et,null,Wt(r.headerRightContentComponents,a=>(Q(),te(No(a),{key:a.name}))),128))])]),r.logo||r.version?(Q(),O("div",ETi,[r.logo?(Q(),te(s,{key:0,name:"logo",width:"30px",height:"30px"})):fe("",!0),r.version?(Q(),O("div",xTi,ee(r.version),1)):fe("",!0)])):fe("",!0)],512)),[[vi,i.visible]])}const MTi=K(yTi,[["render",kTi],["__scopeId","data-v-5c9ea6b6"]]),STi={emits:["resize"],setup(t,{emit:e}){return{onResizerMousedown:i=>{i.preventDefault();let r=i.clientX;const o=s=>{s.preventDefault();const a=s.clientX-r;r=s.clientX,e("resize",a)},n=s=>{s.preventDefault(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",n)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",n)}}}},QTi={class:"bimdata-separator"};function DTi(t,e,i,r,o,n){return Q(),O("div",QTi,[e[1]||(e[1]=B("div",{class:"bimdata-separator__line"},null,-1)),B("div",{class:"bimdata-separator__resizer",onMousedown:e[0]||(e[0]=(...s)=>r.onResizerMousedown&&r.onResizerMousedown(...s))},null,32)])}const PTi=K(STi,[["render",DTi],["__scopeId","data-v-79a3b3af"]]),RTi={components:{Separator:PTi},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=Ne(null),i=Ne(t.sidePanel.width??400),r=(o,n=1)=>{const s=i.value+o*n;i.value=Math.max(0,s)};return Ht(()=>t.sidePanel,()=>{Object.defineProperty(t.sidePanel,"width",{get(){return i.value},set(o){if(typeof o!="number"||o<=0){console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof o}`);return}i.value=o}}),Object.defineProperty(t.sidePanel,"componentInstance",{get(){return e.value},enumerable:!0})},{immediate:!0}),{componentInstance:e,width:i,onResize:r}}},LTi={class:"bimdata-global-side-panel__component"};function TTi(t,e,i,r,o,n){const s=R("Separator");return Q(),O("div",{class:"bimdata-global-side-panel",style:Ie(`width: ${r.width}px`)},[i.sidePanel.resizable&&i.position==="right"?(Q(),te(s,{key:0,onResize:e[0]||(e[0]=a=>r.onResize(a,-1))})):fe("",!0),B("div",LTi,[(Q(),te(No(i.sidePanel.component),{ref:"componentInstance"},null,512))]),i.sidePanel.resizable&&i.position==="left"?(Q(),te(s,{key:1,onResize:e[1]||(e[1]=a=>r.onResize(a))})):fe("",!0)],4)}const FTi=K(RTi,[["render",TTi],["__scopeId","data-v-82d0d4cb"]]),UTi={name:"BimdataViewer",components:{ContextMenu:CTi,ViewerHeader:MTi,ModalManager:MEe,GlobalSidePanel:FTi},setup(){const t=Ut("$viewer"),{globalContext:e,shortcutManager:i}=t;fo(()=>{i&&i.destroy(),e.hub.clear()}),Sr(()=>{t.pluginManager.runPluginsScripts(t)});const r=At(()=>{var h;return t.uiSettings.bimdataLogo!==!1&&(e.localContexts.length!==1||((h=e.localContexts[0].window)==null?void 0:h.logoAndVersion))}),o=At(()=>{var h;return t.uiSettings.version!==!1&&(e.localContexts.length!==1||(h=e.localContexts[0].window)!=null&&h.logoAndVersion)?t.version:null}),n=At(()=>e.leftSidePanel),s=At(()=>e.rightSidePanel),a=At(()=>{var h;const g=t.uiSettings.header!==!1,p=e.localContexts.length===1&&((h=e.localContexts[0].window)==null?void 0:h.header)===!1,m=!!(n.value||s.value);return g&&(!p||m)}),l=t.uiSettings.contextMenu!==!1,c=Ne(null);function d(h){l&&c.value.open(h)}function u(){t.shortcutManager.active=!0}function A(){t.shortcutManager.active=!1}return{Layout:t.layout.areas.component,onContextMenu:d,onMouseenter:u,onMouseleave:A,isHeaderVisible:a,viewerTemplateRef:e.templateRef,modalManagerTemplateRef:e.modalManagerTemplateRef,headerTemplateRef:e.headerTemplateRef,contextMenuTemplateRef:c,contextMenuEnabled:l,bimdataLogoOnSingleWindow:r,viewerVersionOnSingleWindow:o,version:t.version,loading:At(()=>e.loading),spinner:At(()=>e.spinner),leftSidePanel:n,rightSidePanel:s}}},NTi={key:1,class:"global-spinner",style:{"z-index":"3"}},_Ti={key:2,class:"viewer__logo"},OTi={key:1,class:"version m-t-6"};function HTi(t,e,i,r,o,n){const s=R("ModalManager"),a=R("ContextMenu"),l=R("ViewerHeader"),c=R("GlobalSidePanel"),d=R("BIMDataSpinner"),u=R("BIMDataIllustration");return Q(),O("div",{id:"bimdata-viewer",ref:"viewerTemplateRef",class:"bimdata-viewer bimdata-scrollbar",onContextmenu:e[0]||(e[0]=(...A)=>r.onContextMenu&&r.onContextMenu(...A)),onMouseenter:e[1]||(e[1]=(...A)=>r.onMouseenter&&r.onMouseenter(...A)),onMouseleave:e[2]||(e[2]=(...A)=>r.onMouseleave&&r.onMouseleave(...A))},[L(s,{ref:"modalManagerTemplateRef"},null,512),r.contextMenuEnabled?(Q(),te(a,{key:0,ref:"contextMenuTemplateRef"},null,512)):fe("",!0),L(l,{ref:"headerTemplateRef",visible:r.isHeaderVisible},null,8,["visible"]),B("div",{class:"bimdata-viewer__content",style:Ie(r.isHeaderVisible?"height: calc(100% - var(--bimdata-viewer-header-height, 40px))":"height: 100%")},[r.leftSidePanel?(Q(),te(c,{key:0,"side-panel":r.leftSidePanel,position:"left"},null,8,["side-panel"])):fe("",!0),(Q(),te(No(r.Layout),{style:"height: 100%; flex-grow: 1;"})),r.rightSidePanel?(Q(),te(c,{key:1,"side-panel":r.rightSidePanel,position:"right"},null,8,["side-panel"])):fe("",!0)],4),r.loading?(Q(),O("div",NTi,[r.spinner&&r.spinner.component?(Q(),te(No(r.spinner.component),hd(sl({key:0},r.spinner.props)),null,16)):(Q(),te(d,{key:1,size:"40px",border:"5px"}))])):fe("",!0),!r.isHeaderVisible&&(r.bimdataLogoOnSingleWindow||r.viewerVersionOnSingleWindow)?(Q(),O("div",_Ti,[r.bimdataLogoOnSingleWindow?(Q(),te(u,{key:0,name:"logo"})):fe("",!0),r.viewerVersionOnSingleWindow?(Q(),O("div",OTi,ee(r.version),1)):fe("",!0)])):fe("",!0)],544)}const VTi=K(UTi,[["render",HTi]]),GTi=["src"],jTi={class:"bimdata-models__header"},zTi={key:0,class:"bimdata-models__header__loader"},qTi={class:"bimdata-models__header__picto"},KTi={class:"bimdata-models__header__name"},JTi={key:0,class:"bimdata-models__header__name--empty"},YTi={key:1,class:"bimdata-models__header__name--empty"},WTi={key:3},ZTi=["onMousemove","onClick"],REe={__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=Ut("$viewer"),r=Ne(),o=Ne(0),n=Ne(0),s=Ne(),a=Ro([]),l=Ne(!1),c=At(()=>i.localContext.loadedModels),d=At(()=>i.localContext.loadedModelIds),u=At(()=>i.localContext.loadingModelIds),A=At(()=>i.localContext.multiModel),h=At(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(b=>c.value.find(E=>{var k;return((k=E.document)==null?void 0:k.head_id)!=null&&E.document.head_id===b.document.id})??b)),g=b=>d.value.includes(b),p=b=>u.value.includes(b),m=At(()=>{var b;const{x:E,y:k}=((b=s.value)==null?void 0:b.getBoundingClientRect())??{x:0,y:0};return`top:${n.value-k}px; left:${o.value-E}px;`}),f=b=>{!A.value&&g(b.id)||u.value.length>0||(i.localContext.loadedModelIds.includes(b.id)?i.localContext.unloadModels([b.id]):i.localContext.loadModels([b.id]))},C=b=>{switch(b){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},y=(b,E)=>{b!=null&&b.viewer_360_file&&(o.value=E.clientX,n.value=E.clientY),r.value=b?.viewer_360_file},v=async b=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,b)).filter(E=>i.state.models.some(k=>k.archived)||!E.archived).sort(lp("updated_at",!1))}catch(E){console.error("[Models] Cannot get project models. Error: ",E)}finally{l.value=!1}return[]},w=b=>{var E;return((E=b.children)==null?void 0:E.some(k=>g(k.id)))??!1};return v(i.localContext.modelTypes).then(b=>{a.value=b}),(b,E)=>{const k=R("BIMDataSpinner"),x=R("BIMDataIconModel3D"),M=R("BIMDataTextbox"),D=R("BIMDataCheckbox"),P=R("BIMDataRadio"),T=R("BIMDataIcon"),N=R("BIMDataDropdownList");return Q(),O("div",{ref_key:"templateRef",ref:s,class:Be(["bimdata-models",{"bimdata-models--window-positioning":t.windowPositioning}])},[r.value?(Q(),O("div",{key:0,class:"bimdata-models__preview",style:Ie(m.value)},[B("img",{src:r.value},null,8,GTi)],4)):fe("",!0),L(N,{style:Ie(`--bimdata-models-width: ${t.width};`),width:t.width,list:h.value,"element-key":"id","per-page":40,loading:l.value,class:"bimdata-models__list",disabled:h.value.length===0,onElementClick:f},{header:q(({isOpen:H})=>[B("div",jTi,[l.value||u.value.length>0?(Q(),O("div",zTi,[L(k)])):(Q(),O(Et,{key:1},[B("div",qTi,[L(x)]),B("div",{class:Be(["bimdata-models__header__number bimdata-info-length",{"bimdata-models__header__number--empty":d.value.length===0}])},[B("span",null,ee(d.value.length),1)],2),B("div",KTi,[h.value.length===0?(Q(),O("span",JTi,ee(b.$t("model.no_model")),1)):d.value.length===0?(Q(),O("span",YTi,ee(b.$t("model.no_loaded_model")),1)):d.value.length===1?(Q(),te(M,{key:2,text:c.value[0].name,tooltip:!H},null,8,["text","tooltip"])):d.value.length>1?(Q(),O("span",WTi,ee(b.$t("model.selected_models")),1)):fe("",!0)])],64))])]),element:q(({element:H,close:U})=>[B("div",{class:"bimdata-models__model",onMousemove:V=>t.preview&&y(H,V),onMouseout:E[0]||(E[0]=V=>t.preview&&y()),onClick:()=>{!A.value&&!g(H.id)&&U()}},[A.value?(Q(),te(D,{key:0,"model-value":g(H.id)||w(H),disabled:H.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])):(Q(),te(P,{key:1,"model-value":g(H.id)||w(H),disabled:H.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])),L(T,{margin:"0 calc(var(--spacing-unit) / 2)",name:C(H.status),size:"xs",class:Be({"fill-success":H.status==="C","fill-high":H.status==="E"})},null,8,["name","class"]),L(M,{class:Be({"bimdata-models__model__name":!0,"bimdata-models__model__name--disabled":H.status!=="C"||u.value.length>0}),text:H.name,width:`calc(100% -
5494
+ `),onMouseenter:e[0]||(e[0]=(...A)=>r.onMouseEnter&&r.onMouseEnter(...A)),onMouseleave:e[1]||(e[1]=(...A)=>r.onMouseLeave&&r.onMouseLeave(...A))},[L(s,{ref:"modalManagerTemplateRef"},null,512),B("div",hLi,[r.windowPlugins.leftSidePanel?(Q(),te(a,{key:0,plugin:r.windowPlugins.leftSidePanel},null,8,["plugin"])):fe("",!0),B("div",pLi,[(Q(!0),O(Et,null,Wt(r.windowPlugins.free,A=>(Q(),te(l,{key:A.name,class:Be({"window-container__content__center__viewer":A.isViewer}),plugin:A},null,8,["class","plugin"]))),128)),L(c,{position:"left",plugins:r.windowPlugins.leftButtonColumn},null,8,["plugins"]),L(c,{position:"right",plugins:r.windowPlugins.rightButtonColumn},null,8,["plugins"])]),r.windowPlugins.rightSidePanel?(Q(),te(a,{key:1,plugin:r.windowPlugins.rightSidePanel},null,8,["plugin"])):fe("",!0)]),r.loading?(Q(),O("div",gLi,[r.spinner&&r.spinner.component?(Q(),te(No(r.spinner.component),hd(sl({key:0},r.spinner.props)),null,16)):(Q(),te(d,{key:1,size:"20px",border:"3px"}))])):fe("",!0),r.layoutSettingsDisplayed?(Q(),O("div",fLi,[L(u)])):fe("",!0)],36)}const vLi=K(ALi,[["render",mLi]]);let CLi=class{constructor(t=!0){const e=lRi(eae,null,{resizable:t});e.registerContent("default",vLi),this.settings=Gl({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?cRi(t):null}copy(t,e=!0){return dRi(this.areas.layout,t,e)}open({ratio:t,direction:e,insertAfter:i,windowName:r=null,windowState:o=null,localContextId:n=null}={}){const s=r?{options:{windowName:r,windowState:o}}:null;return n===null?this.areas.splitLayout(t,e,i,s):this.areas.split(n,t,e,i,s)}swap(t,e){return this.areas.swap(t,e)}close(t){return this.areas.delete(t)}compare(t,e){var i,r;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 o=new Set((i=t.windowState)==null?void 0:i.modelIds),n=new Set((r=e.windowState)==null?void 0:r.modelIds);return o.size===n.size&&[...o].every(s=>n.has(s))}return t.windowName||e.windowName||t.direction!==e.direction||t.children.length!==e.children.length?!1:t.children.every((o,n)=>this.compare(o,e.children[n]))}};const yLi="2.8.0",wLi={version:yLi};class bLi{constructor({plugins:e,api:i,ui:r,locale:o="fr"}){this.pluginManager=new ySi(e),this.windowManager=new bSi,this.windowManager.registerAndAddPluginsToWindows([...this.pluginManager.registeredPlugins.values()]),this.api=new dPi(i),this.globalContext=new VOe(this),this.state=xPi(this),this.shortcutManager=kRe(this.state),this.uiSettings=r||{},this.i18n=new OOe(o),this._contextMenu=null,this.layout=new CLi(this.uiSettings.resizable!==!1),this.localContext=null,window.$viewer=this}get version(){return wLi.version}get locale(){return this.i18n.locale}get contextMenu(){return this._contextMenu||ERe}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 ILi(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 BLi=Object.freeze({25:"GUEST",50:"USER",100:"ADMIN"}),R9=Object.freeze({READ:"read",WRITE:"write"});function DEe(t){const e={};return t.forEach(i=>{const[r,o]=i.split(":");e[r]?e[r].push(o):e[r]=[o]}),e}const ELi={token_scopes:[],usable_scopes:[],user_role:25};function PEe(t=ELi){var e,i,r,o,n,s;const a=DEe(t.token_scopes),l=DEe(t.usable_scopes);return{..._ue(t),tokenScopes:a,usableScopes:l,userRole:BLi[t.user_role],user:t.user?_ue(t.user):null,hasBcfReadPermission:((e=l.bcf)==null?void 0:e.includes(R9.READ))??!1,hasBcfWritePermission:((i=l.bcf)==null?void 0:i.includes(R9.WRITE))??!1,hasModelReadPermission:((r=l.model)==null?void 0:r.includes(R9.READ))??!1,hasModelWritePermission:((o=l.model)==null?void 0:o.includes(R9.WRITE))??!1,hasDocReadPermission:((n=l.document)==null?void 0:n.includes(R9.READ))??!1,hasDocWritePermission:((s=l.document)==null?void 0:s.includes(R9.WRITE))??!1}}const xLi={BcfFilters:{filtersButton:"Filter",filtersTitle:"Filter",priorityLabel:"Priorit\xE4t",statusLabel:"Status",assignedToLabel:"Zugewiesen an",creatorsLabel:"Erstellt von",tagsLabel:"Tags",resetButton:"Zur\xFCcksetzen",searchButton:"Suchen",undefined:"Nicht definiert",datePlaceholder:"Erstellungsdatum"},BcfSettings:{goBackButton:"Zur\xFCck",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"},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"},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"}}},kLi={BcfComponents:xLi},MLi={BcfFilters:{filtersButton:"Filters",filtersTitle:"Filters",priorityLabel:"Priority",statusLabel:"Status",assignedToLabel:"Assigned to",creatorsLabel:"Created by",tagsLabel:"Tags",resetButton:"Reset",searchButton:"Search",undefined:"Not defined",datePlaceholder:"Creation date"},BcfSettings:{goBackButton:"Back",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"},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"},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"}}},SLi={BcfComponents:MLi},QLi={BcfFilters:{filtersButton:"Filtros",filtersTitle:"Filtros",priorityLabel:"Prioridad",statusLabel:"Estado",assignedToLabel:"Asignado a",creatorsLabel:"Creado por",tagsLabel:"Etiquetas:",resetButton:"Restablecer",searchButton:"Buscar en",undefined:"No definido",datePlaceholder:"Fecha de creaci\xF3n"},BcfSettings:{goBackButton:"Volver",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"}}},DLi={BcfComponents:QLi},PLi={BcfFilters:{filtersButton:"Filtres",filtersTitle:"Filtres",priorityLabel:"Priorit\xE9",statusLabel:"Statut",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:{goBackButton:"Retour",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"},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"},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"}}},RLi={BcfComponents:PLi},LLi={BcfFilters:{filtersButton:"Filtri",filtersTitle:"Filtri",priorityLabel:"Priorit\xE0",statusLabel:"Stato",datePlaceholder:"Data di creazione",assignedToLabel:"Assegnato a",creatorsLabel:"Creato da",tagsLabel:"Etichette",resetButton:"Ripristina",searchButton:"Cerca",undefined:"Non definito"},BcfSettings:{goBackButton:"Indietro",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"}}},TLi={BcfComponents:LLi},FLi={de:kLi,en:SLi,es:DLi,fr:RLi,it:TLi},ULi=({apiClient:t,fetchUsers:e,i18nPlugin:i}={})=>({install(r){t?mo.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(FLi).forEach(([o,n])=>{i.global.mergeLocaleMessage(o,n)}):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(lqe).forEach(([o,n])=>{r.component(o,n)})}}),NLi={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"}},_Li={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"},OLi={BuildingMaker:NLi,FileManager:_Li},HLi={t:{back:"Back",cancel:"Cancel",create:"Create",delete:"Delete",download:"Download",finish:"Finish",rename:"Rename",search:"Search",see:"View",storey:"Storey",validate:"Validate"}},VLi={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"}},GLi={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"},jLi={title:"Meta-Building Structure",tab:{structure:"Structure",zones:"Zones",equipments:"Equipments"},StoreySelector:{placeholder:"Select a storey"}},zLi={title:"Photosphere Building"},qLi={BIMDataComponents:HLi,BuildingMaker:VLi,FileManager:GLi,MetaBuildingStructure:jLi,PhotosphereBuilding:zLi},KLi={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"}},JLi={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"},YLi={BuildingMaker:KLi,FileManager:JLi},WLi={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"}},ZLi={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"}},XLi={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"},$Li={title:"Structure M\xE9ta-Building",tab:{structure:"Structure",zones:"Zones",equipments:"\xC9quipements"},StoreySelector:{placeholder:"S\xE9lectionner un \xE9tage"}},eTi={title:"Photosph\xE8re Building"},tTi={BIMDataComponents:WLi,BuildingMaker:ZLi,FileManager:XLi,MetaBuildingStructure:$Li,PhotosphereBuilding:eTi},iTi={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"}},rTi={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"},oTi={BuildingMaker:iTi,FileManager:rTi},nTi={de:OLi,en:qLi,es:YLi,fr:tTi,it:oTi},sTi=({i18nPlugin:t}={})=>({install(e){t?Object.entries(nTi).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(jvi).forEach(([i,r])=>{e.component(i,r)})}}),aTi={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}},lTi=Object.freeze(Object.defineProperty({__proto__:null,BIMDataClickAway:kA,BIMDataClickInputAway:aTi},Symbol.toStringTag,{value:"Module"})),cTi=t=>({install(e){Object.entries(e5t).forEach(([i,r])=>{e.component(i,r)}),Object.entries(lTi).forEach(([i,r])=>e.directive(i.split("BIMData")[1],r))}}),dTi={name:"LiWrapper",render(){return Ln("li",this.$slots.default())}};function uTi(t,e){var i=new Set([]);return t.forEach(r=>{e.has(r)||i.add(r)}),i}const th=Ia("id"),ATi=({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(gA(Mr("visible"),hf("selected"))).map(th)),predicate:()=>e.some(gA(Mr("visible"),hf("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(Mr("selected")).map(th)),predicate:()=>e.some(Mr("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 o=e.filter(n=>n.visible&&n.type===this.selectedObject.type&&n.id!==this.selectedObject.id).map(th);i.selectObjects(o)},selectedObject:null,predicate(){const o=e.filter(gA(Mr("visible"),Mr("selected")));return o.length===1&&o[0].type!==void 0?(this.selectedObject=o[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 o=new Set(e.filter(Mr("selected")).map(th)),n=new Set(e.filter(Mr("visible")).map(th));i.selectObjects(Array.from(uTi(n,o)),{exclusive:!0})},predicate:()=>e.some(gA(hf("selected"),Mr("visible")))&&e.some(gA(Mr("selected"),Mr("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(hf("visible")).map(th)),predicate:()=>e.some(hf("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 o=this.objectsToHide.filter(Mr("selected"));o.length>0&&i.deselectObjects(o.map(th)),i.hideObjects(this.objectsToHide.map(th))},predicate(){return this.objectsToHide=e.filter(gA(Mr("selected"),Mr("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 o=e.filter(Mr("visible"));o.some(Mr("selected"))&&i.deselectObjects(o.filter(Mr("selected")).map(th)),i.hideObjects(o.map(th))},predicate:()=>e.some(Mr("visible"))}].filter(o=>o.predicate()),hTi={components:{LiWrapper:dTi},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(o=>r.set(o.name,o.key)),ATi({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,o)=>(r.position=r.position||0,o.position=o.position||0,r.position-o.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}}},pTi={key:0,class:"separator"},gTi={class:"menu-text"},fTi={key:1,class:"menu-picto"},mTi={key:0,class:"context-menu__spinner"};function vTi(t,e,i,r,o,n){const s=R("BIMDataIconChevron"),a=R("LiWrapper"),l=R("BIMDataSpinner"),c=ar("click-away");return o.displayed&&(o.currentCommands.length||o.asyncPredicateRunning)?Ft((Q(),O("ul",{key:0,class:"bimdata-list context-menu",style:Ie(n.position)},[(Q(!0),O(Et,null,Wt(o.currentCommands,(d,u)=>(Q(),te(a,{key:d.label,class:"context-menu__element",onClick:A=>n.executeCommand(d)},{default:q(()=>[n.isGroupIntersection(u)?(Q(),O("div",pTi)):fe("",!0),B("div",gTi,ee(d.label),1),!d.component&&d.picto?(Q(),O("span",fTi,ee(d.picto),1)):d.component?(Q(),te(s,{key:2,size:"xxs",class:"fill-primary"})):fe("",!0)]),_:2},1032,["onClick"]))),128)),o.asyncPredicateRunning?(Q(),O("li",mTi,[L(l)])):fe("",!0)],4)),[[c,n.away]]):fe("",!0)}const CTi=K(hTi,[["render",vTi],["__scopeId","data-v-5b87d4a3"]]),yTi={name:"ViewerHeader",inject:["$viewer"],props:{visible:{type:Boolean,default:!0}},setup(){const t=Ut("$viewer"),e=Gl(new Map),i=o=>{if(!o.name)throw new TypeError("[Viewer Header] Content must have a name");if(e.has(o.name))throw new Error(`[Viewer Header] Content with name ${o.name} already exists`);e.set(o.name,o)},r=o=>e.has(o)?(e.delete(o),!0):!1;return{logo:t.uiSettings.bimdataLogo!==!1,version:t.uiSettings.version!==!1?t.version:null,headerContent:e,headerRightContentComponents:At(()=>Array.from(e.values()).filter(o=>o.position==="right").sort((o,n)=>o.order-n.order).map(o=>o.component)),headerLeftContentComponents:At(()=>Array.from(e.values()).filter(o=>o.position==="left").sort((o,n)=>o.order-n.order).map(o=>o.component)),addContent:i,removeContent:r}}},wTi={class:"viewer-header"},bTi={class:"viewer-header__content"},ITi={class:"viewer-header__content__left"},BTi={class:"viewer-header__content__right"},ETi={key:0,class:"m-l-6 flex items-center"},xTi={key:1,class:"viewer-header__version"};function kTi(t,e,i,r,o,n){const s=R("BIMDataIllustration");return Ft((Q(),O("div",wTi,[B("div",bTi,[B("div",ITi,[(Q(!0),O(Et,null,Wt(r.headerLeftContentComponents,a=>(Q(),te(No(a),{key:a.name}))),128))]),B("div",BTi,[(Q(!0),O(Et,null,Wt(r.headerRightContentComponents,a=>(Q(),te(No(a),{key:a.name}))),128))])]),r.logo||r.version?(Q(),O("div",ETi,[r.logo?(Q(),te(s,{key:0,name:"logo",width:"30px",height:"30px"})):fe("",!0),r.version?(Q(),O("div",xTi,ee(r.version),1)):fe("",!0)])):fe("",!0)],512)),[[vi,i.visible]])}const MTi=K(yTi,[["render",kTi],["__scopeId","data-v-5c9ea6b6"]]),STi={emits:["resize"],setup(t,{emit:e}){return{onResizerMousedown:i=>{i.preventDefault();let r=i.clientX;const o=s=>{s.preventDefault();const a=s.clientX-r;r=s.clientX,e("resize",a)},n=s=>{s.preventDefault(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",n)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",n)}}}},QTi={class:"bimdata-separator"};function DTi(t,e,i,r,o,n){return Q(),O("div",QTi,[e[1]||(e[1]=B("div",{class:"bimdata-separator__line"},null,-1)),B("div",{class:"bimdata-separator__resizer",onMousedown:e[0]||(e[0]=(...s)=>r.onResizerMousedown&&r.onResizerMousedown(...s))},null,32)])}const PTi=K(STi,[["render",DTi],["__scopeId","data-v-79a3b3af"]]),RTi={components:{Separator:PTi},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=Ne(null),i=Ne(t.sidePanel.width??400),r=(o,n=1)=>{const s=i.value+o*n;i.value=Math.max(0,s)};return Ht(()=>t.sidePanel,()=>{Object.defineProperty(t.sidePanel,"width",{get(){return i.value},set(o){if(typeof o!="number"||o<=0){console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof o}`);return}i.value=o}}),Object.defineProperty(t.sidePanel,"componentInstance",{get(){return e.value},enumerable:!0})},{immediate:!0}),{componentInstance:e,width:i,onResize:r}}},LTi={class:"bimdata-global-side-panel__component"};function TTi(t,e,i,r,o,n){const s=R("Separator");return Q(),O("div",{class:"bimdata-global-side-panel",style:Ie(`width: ${r.width}px`)},[i.sidePanel.resizable&&i.position==="right"?(Q(),te(s,{key:0,onResize:e[0]||(e[0]=a=>r.onResize(a,-1))})):fe("",!0),B("div",LTi,[(Q(),te(No(i.sidePanel.component),{ref:"componentInstance"},null,512))]),i.sidePanel.resizable&&i.position==="left"?(Q(),te(s,{key:1,onResize:e[1]||(e[1]=a=>r.onResize(a))})):fe("",!0)],4)}const FTi=K(RTi,[["render",TTi],["__scopeId","data-v-82d0d4cb"]]),UTi={name:"BimdataViewer",components:{ContextMenu:CTi,ViewerHeader:MTi,ModalManager:MEe,GlobalSidePanel:FTi},setup(){const t=Ut("$viewer"),{globalContext:e,shortcutManager:i}=t;fo(()=>{i&&i.destroy(),e.hub.clear()}),Sr(()=>{t.pluginManager.runPluginsScripts(t)});const r=At(()=>{var h;return t.uiSettings.bimdataLogo!==!1&&(e.localContexts.length!==1||((h=e.localContexts[0].window)==null?void 0:h.logoAndVersion))}),o=At(()=>{var h;return t.uiSettings.version!==!1&&(e.localContexts.length!==1||(h=e.localContexts[0].window)!=null&&h.logoAndVersion)?t.version:null}),n=At(()=>e.leftSidePanel),s=At(()=>e.rightSidePanel),a=At(()=>{var h;const g=t.uiSettings.header!==!1,p=e.localContexts.length===1&&((h=e.localContexts[0].window)==null?void 0:h.header)===!1,m=!!(n.value||s.value);return g&&(!p||m)}),l=t.uiSettings.contextMenu!==!1,c=Ne(null);function d(h){l&&c.value.open(h)}function u(){t.shortcutManager.active=!0}function A(){t.shortcutManager.active=!1}return{Layout:t.layout.areas.component,onContextMenu:d,onMouseenter:u,onMouseleave:A,isHeaderVisible:a,viewerTemplateRef:e.templateRef,modalManagerTemplateRef:e.modalManagerTemplateRef,headerTemplateRef:e.headerTemplateRef,contextMenuTemplateRef:c,contextMenuEnabled:l,bimdataLogoOnSingleWindow:r,viewerVersionOnSingleWindow:o,version:t.version,loading:At(()=>e.loading),spinner:At(()=>e.spinner),leftSidePanel:n,rightSidePanel:s}}},NTi={key:1,class:"global-spinner",style:{"z-index":"3"}},_Ti={key:2,class:"viewer__logo"},OTi={key:1,class:"version m-t-6"};function HTi(t,e,i,r,o,n){const s=R("ModalManager"),a=R("ContextMenu"),l=R("ViewerHeader"),c=R("GlobalSidePanel"),d=R("BIMDataSpinner"),u=R("BIMDataIllustration");return Q(),O("div",{id:"bimdata-viewer",ref:"viewerTemplateRef",class:"bimdata-viewer bimdata-scrollbar",onContextmenu:e[0]||(e[0]=(...A)=>r.onContextMenu&&r.onContextMenu(...A)),onMouseenter:e[1]||(e[1]=(...A)=>r.onMouseenter&&r.onMouseenter(...A)),onMouseleave:e[2]||(e[2]=(...A)=>r.onMouseleave&&r.onMouseleave(...A))},[L(s,{ref:"modalManagerTemplateRef"},null,512),r.contextMenuEnabled?(Q(),te(a,{key:0,ref:"contextMenuTemplateRef"},null,512)):fe("",!0),L(l,{ref:"headerTemplateRef",visible:r.isHeaderVisible},null,8,["visible"]),B("div",{class:"bimdata-viewer__content",style:Ie(r.isHeaderVisible?"height: calc(100% - var(--bimdata-viewer-header-height, 40px))":"height: 100%")},[r.leftSidePanel?(Q(),te(c,{key:0,"side-panel":r.leftSidePanel,position:"left"},null,8,["side-panel"])):fe("",!0),(Q(),te(No(r.Layout),{style:"height: 100%; flex-grow: 1;"})),r.rightSidePanel?(Q(),te(c,{key:1,"side-panel":r.rightSidePanel,position:"right"},null,8,["side-panel"])):fe("",!0)],4),r.loading?(Q(),O("div",NTi,[r.spinner&&r.spinner.component?(Q(),te(No(r.spinner.component),hd(sl({key:0},r.spinner.props)),null,16)):(Q(),te(d,{key:1,size:"40px",border:"5px"}))])):fe("",!0),!r.isHeaderVisible&&(r.bimdataLogoOnSingleWindow||r.viewerVersionOnSingleWindow)?(Q(),O("div",_Ti,[r.bimdataLogoOnSingleWindow?(Q(),te(u,{key:0,name:"logo"})):fe("",!0),r.viewerVersionOnSingleWindow?(Q(),O("div",OTi,ee(r.version),1)):fe("",!0)])):fe("",!0)],544)}const VTi=K(UTi,[["render",HTi]]),GTi=["src"],jTi={class:"bimdata-models__header"},zTi={key:0,class:"bimdata-models__header__loader"},qTi={class:"bimdata-models__header__picto"},KTi={class:"bimdata-models__header__name"},JTi={key:0,class:"bimdata-models__header__name--empty"},YTi={key:1,class:"bimdata-models__header__name--empty"},WTi={key:3},ZTi=["onMousemove","onClick"],REe={__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=Ut("$viewer"),r=Ne(),o=Ne(0),n=Ne(0),s=Ne(),a=Ro([]),l=Ne(!1),c=At(()=>i.localContext.loadedModels),d=At(()=>i.localContext.loadedModelIds),u=At(()=>i.localContext.loadingModelIds),A=At(()=>i.localContext.multiModel),h=At(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(b=>c.value.find(E=>{var k;return((k=E.document)==null?void 0:k.head_id)!=null&&E.document.head_id===b.document.id})??b)),g=b=>d.value.includes(b),p=b=>u.value.includes(b),m=At(()=>{var b;const{x:E,y:k}=((b=s.value)==null?void 0:b.getBoundingClientRect())??{x:0,y:0};return`top:${n.value-k}px; left:${o.value-E}px;`}),f=b=>{!A.value&&g(b.id)||u.value.length>0||(i.localContext.loadedModelIds.includes(b.id)?i.localContext.unloadModels([b.id]):i.localContext.loadModels([b.id]))},C=b=>{switch(b){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},y=(b,E)=>{b!=null&&b.viewer_360_file&&(o.value=E.clientX,n.value=E.clientY),r.value=b?.viewer_360_file},v=async b=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,b)).filter(E=>i.state.models.some(k=>k.archived)||!E.archived).sort(lp("updated_at",!1))}catch(E){console.error("[Models] Cannot get project models. Error: ",E)}finally{l.value=!1}return[]},w=b=>{var E;return((E=b.children)==null?void 0:E.some(k=>g(k.id)))??!1};return v(i.localContext.modelTypes).then(b=>{a.value=b}),(b,E)=>{const k=R("BIMDataSpinner"),x=R("BIMDataIconModel3D"),M=R("BIMDataTextbox"),D=R("BIMDataCheckbox"),P=R("BIMDataRadio"),T=R("BIMDataIcon"),N=R("BIMDataDropdownList");return Q(),O("div",{ref_key:"templateRef",ref:s,class:Be(["bimdata-models",{"bimdata-models--window-positioning":t.windowPositioning}])},[r.value?(Q(),O("div",{key:0,class:"bimdata-models__preview",style:Ie(m.value)},[B("img",{src:r.value},null,8,GTi)],4)):fe("",!0),L(N,{style:Ie(`--bimdata-models-width: ${t.width};`),width:t.width,list:h.value,"element-key":"id","per-page":40,loading:l.value,class:"bimdata-models__list",disabled:h.value.length===0,onElementClick:f},{header:q(({isOpen:H})=>[B("div",jTi,[l.value||u.value.length>0?(Q(),O("div",zTi,[L(k)])):(Q(),O(Et,{key:1},[B("div",qTi,[L(x)]),B("div",{class:Be(["bimdata-models__header__number bimdata-info-length",{"bimdata-models__header__number--empty":d.value.length===0}])},[B("span",null,ee(d.value.length),1)],2),B("div",KTi,[h.value.length===0?(Q(),O("span",JTi,ee(b.$t("model.no_model")),1)):d.value.length===0?(Q(),O("span",YTi,ee(b.$t("model.no_loaded_model")),1)):d.value.length===1?(Q(),te(M,{key:2,text:c.value[0].name,tooltip:!H},null,8,["text","tooltip"])):d.value.length>1?(Q(),O("span",WTi,ee(b.$t("model.selected_models")),1)):fe("",!0)])],64))])]),element:q(({element:H,close:U})=>[B("div",{class:"bimdata-models__model",onMousemove:V=>t.preview&&y(H,V),onMouseout:E[0]||(E[0]=V=>t.preview&&y()),onClick:()=>{!A.value&&!g(H.id)&&U()}},[A.value?(Q(),te(D,{key:0,"model-value":g(H.id)||w(H),disabled:H.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])):(Q(),te(P,{key:1,"model-value":g(H.id)||w(H),disabled:H.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])),L(T,{margin:"0 calc(var(--spacing-unit) / 2)",name:C(H.status),size:"xs",class:Be({"fill-success":H.status==="C","fill-high":H.status==="E"})},null,8,["name","class"]),L(M,{class:Be({"bimdata-models__model__name":!0,"bimdata-models__model__name--disabled":H.status!=="C"||u.value.length>0}),text:H.name,width:`calc(100% -
5495
5495
  ${A.value?13:23}px - 2 * 6px - 16px)`},null,8,["class","text","width"]),H.document&&!H.document.is_head_version?(Q(),te(T,{key:2,name:"versioning",fill:"",color:"default",size:"xs",margin:"0 0 0 6px"})):fe("",!0)],40,ZTi),p(H.id)?(Q(),te(k,{key:0,class:"bimdata-models__model__spinner"})):fe("",!0)]),_:1},8,["style","width","list","loading","disabled"])],2)}}},XTi={data(){return{shown:!1}},mounted(){setTimeout(()=>{this.shown=!0},500)}};function $Ti(t,e,i,r,o,n){const s=R("BIMDataIllustration");return Q(),O("div",{class:"bimdata__no-model",style:Ie({"--no-model--opacity":o.shown?1:0})},[L(s,{name:"emptyViewer",x:"90",y:"90"}),B("span",null,ee(t.$t("model.select_model")),1)],4)}const LEe=K(XTi,[["render",$Ti],["__scopeId","data-v-5ffd9bc0"]]);window.BIMDataViewerVue=eae;class eFi{constructor(e={}){var i,r;const{api:o={},ui:n}=e;this.uiCfg=n,o.apiUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `apiUrl` not set, use 'https://api.bimdata.io' by default."),o.apiUrl="https://api.bimdata.io"),o.archiveUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `archiveUrl` not set, use 'https://archive.bimdata.io' by default."),o.archiveUrl="https://archive.bimdata.io"),o.pdfBackendUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `pdfBackendUrl` not set, use 'https://pdf-backend.bimdata.io' by default."),o.pdfBackendUrl="https://pdf-backend.bimdata.io"),o.ifcIds&&(console.warn("[BIMData Viewer] DEPRECATED - Viewer config - please use the `modelIds` property instead of `ifcIds`."),o.modelIds===void 0&&(o.modelIds=o.ifcIds)),o.modelIds||(o.modelIds=[]),(i=o.offline)!=null&&i.dataFile&&(o.offline.data=o.offline.dataFile),this.$viewer=new bLi(e),(r=o.offline)!=null&&r.enabled?this.$viewer.api.enableOfflineMode(o.offline.data,o.offline.options).then(()=>this.state.loadModels(o.modelIds)):(this.$viewer.globalContext.loadingProcessStart(),this.state.loadModels(o.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"){var r;const{$viewer:o}=this;await o.api.ready;try{const u=await o.api.apiClient.collaborationApi.checkProjectAccess(o.api.cloudId,o.api.projectId);o.api.permissions=PEe(u)}catch{o.api.permissions=PEe()}const n=this.api.accessToken,{i18n:s}=o;s.registerTranslations(o.pluginManager.pluginTranslations),o.layout.apply(i);const a={i18n:s.i18nVuePlugin,data(){return{accessToken:n}},render(){return Ln(VTi,{style:"height: 100%"})}},l=cy(a).use(s.i18nVuePlugin).use(cTi()).use(sTi({i18nPlugin:s.i18nVuePlugin})).use(ULi({apiClient:o.api.apiClient,i18nPlugin:s.i18nVuePlugin}));l.provide("$viewer",o),l.component("BIMDataModelLoader",REe),l.component("BIMDataNoModelWindowPlaceHolder",LEe),l.component("BIMDataStoreySelector",JG),l.component("ModelsLoader",REe),l.component("NoModelWindowPlaceHolder",LEe);const c=e instanceof HTMLElement?e:document.querySelector(e);c&&(c.style.height="100%");const d=l.mount(e);return d.$viewer=o,ILi(d.$el,(r=this.uiCfg)==null?void 0:r.style),typeof window<"u"&&(window.bimdataViewer=d),this.vueApp=l,d}destroy(){var e;(e=this.vueApp)==null||e.unmount()}setLocale(e){if(!fae.includes(e))throw new Error(`Viewer available locales are ${fae.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 TEe=(t={})=>new eFi(t);window.makeBIMDataViewer=TEe;var tI={};tI.d=(t,e)=>{for(var i in e)tI.o(e,i)&&!tI.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},tI.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var zi=globalThis.pdfjsLib={};tI.d(zi,{AbortException:()=>og,AnnotationEditorLayer:()=>gNi,AnnotationEditorParamsType:()=>Dr,AnnotationEditorType:()=>rr,AnnotationEditorUIManager:()=>vI,AnnotationLayer:()=>rNi,AnnotationMode:()=>ig,ColorPicker:()=>qke,DOMSVGFactory:()=>DX,DrawLayer:()=>fNi,FeatureTest:()=>El,GlobalWorkerOptions:()=>mg,ImageKind:()=>pR,InvalidPDFException:()=>DZ,MissingPDFException:()=>rI,OPS:()=>ju,OutputScale:()=>VZ,PDFDataRangeTransport:()=>cke,PDFDateString:()=>OZ,PDFWorker:()=>QL,PasswordResponses:()=>oFi,PermissionFlag:()=>rFi,PixelsPerInch:()=>T9,RenderingCancelledException:()=>NZ,TextLayer:()=>xX,TouchManager:()=>uxe,UnexpectedResponseException:()=>vR,Util:()=>bi,VerbosityLevel:()=>gR,XfaLayer:()=>pke,build:()=>FUi,createValidAbsoluteUrl:()=>lFi,fetchData:()=>wR,getDocument:()=>EUi,getFilenameFromUrl:()=>mFi,getPdfFilenameFromUrl:()=>vFi,getXfaPageViewport:()=>CFi,isDataScheme:()=>bR,isPdfFile:()=>_Z,noContextMenu:()=>zu,normalizeUnicode:()=>pFi,setLayerDimensions:()=>H2,shadow:()=>gr,stopEvent:()=>$c,version:()=>TUi});const Ua=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),FEe=[1,0,0,1,0,0],MZ=[.001,0,0,.001,0,0],tFi=1e7,SZ=1.35,Xc={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},ig={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},iFi="pdfjs_internal_editor_",rr={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Dr={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_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},rFi={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Na={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},pR={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Cs={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,WIDGET:20},iI={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},gR={ERRORS:0,WARNINGS:1,INFOS:5},ju={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},oFi={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let fR=gR.WARNINGS;function nFi(t){Number.isInteger(t)&&(fR=t)}function sFi(){return fR}function mR(t){fR>=gR.INFOS&&console.log(`Info: ${t}`)}function or(t){fR>=gR.WARNINGS&&console.log(`Warning: ${t}`)}function Mo(t){throw new Error(t)}function $n(t,e){t||Mo(e)}function aFi(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function lFi(t,e=null,i=null){if(!t)return null;try{if(i&&typeof t=="string"){if(i.addDefaultProtocol&&t.startsWith("www.")){const o=t.match(/\./g);o?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=hFi(t)}catch{}}const r=e?new URL(t,e):new URL(t);if(aFi(r))return r}catch{}return null}function gr(t,e,i,r=!1){return Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}const rg=function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();let UEe=class extends rg{constructor(t,e){super(t,"PasswordException"),this.code=e}},QZ=class extends rg{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},DZ=class extends rg{constructor(t){super(t,"InvalidPDFException")}},rI=class extends rg{constructor(t){super(t,"MissingPDFException")}},vR=class extends rg{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}},cFi=class extends rg{constructor(t){super(t,"FormatError")}},og=class extends rg{constructor(t){super(t,"AbortException")}};function NEe(t){(typeof t!="object"||t?.length===void 0)&&Mo("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const r=[];for(let o=0;o<e;o+=i){const n=Math.min(o+i,e),s=t.subarray(o,n);r.push(String.fromCharCode.apply(null,s))}return r.join("")}function CR(t){typeof t!="string"&&Mo("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 dFi(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function PZ(t){const e=Object.create(null);for(const[i,r]of t)e[i]=r;return e}function uFi(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function AFi(){try{return new Function(""),!0}catch{return!1}}class El{static get isLittleEndian(){return gr(this,"isLittleEndian",uFi())}static get isEvalSupported(){return gr(this,"isEvalSupported",AFi())}static get isOffscreenCanvasSupported(){return gr(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return gr(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){return typeof navigator<"u"&&typeof navigator?.platform=="string"?gr(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof navigator?.userAgent=="string"&&navigator.userAgent.includes("Firefox")}):gr(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var e,i;return gr(this,"isCSSRoundSupported",(i=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:i.call(e,"width: round(1.5px, 1px)"))}}const RZ=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));var O2,LZ,yR,TZ;let bi=(LZ=class{static makeHexColor(t,e,i){return`#${RZ[t]}${RZ[e]}${RZ[i]}`}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 applyTransform(t,e){const i=t[0]*e[0]+t[1]*e[2]+e[4],r=t[0]*e[1]+t[1]*e[3]+e[5];return[i,r]}static applyInverseTransform(t,e){const i=e[0]*e[3]-e[1]*e[2],r=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,o=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i;return[r,o]}static getAxialAlignedBoundingBox(t,e){const i=this.applyTransform(t,e),r=this.applyTransform(t.slice(2,4),e),o=this.applyTransform([t[0],t[3]],e),n=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],r[0],o[0],n[0]),Math.min(i[1],r[1],o[1],n[1]),Math.max(i[0],r[0],o[0],n[0]),Math.max(i[1],r[1],o[1],n[1])]}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){const e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],r=t[0]*e[1]+t[1]*e[3],o=t[2]*e[0]+t[3]*e[2],n=t[2]*e[1]+t[3]*e[3],s=(i+n)/2,a=Math.sqrt((i+n)**2-4*(i*n-o*r))/2,l=s+a||1,c=s-a||1;return[Math.sqrt(l),Math.sqrt(c)]}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 o=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),n=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return o>n?null:[i,o,r,n]}static bezierBoundingBox(t,e,i,r,o,n,s,a,l){return 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)):l=[Math.min(t,s),Math.min(e,a),Math.max(t,s),Math.max(e,a)],oe(this,O2,TZ).call(this,t,i,o,s,e,r,n,a,3*(-t+3*(i-o)+s),6*(t-2*i+o),3*(i-t),l),oe(this,O2,TZ).call(this,t,i,o,s,e,r,n,a,3*(-e+3*(r-n)+a),6*(e-2*r+n),3*(r-e),l),l}},O2=new WeakSet,yR=function(t,e,i,r,o,n,s,a,l,c){if(l<=0||l>=1)return;const d=1-l,u=l*l,A=u*l,h=d*(d*(d*t+3*l*e)+3*u*i)+A*r,g=d*(d*(d*o+3*l*n)+3*u*s)+A*a;c[0]=Math.min(c[0],h),c[1]=Math.min(c[1],g),c[2]=Math.max(c[2],h),c[3]=Math.max(c[3],g)},TZ=function(t,e,i,r,o,n,s,a,l,c,d,u){if(Math.abs(l)<1e-12){Math.abs(c)>=1e-12&&oe(this,O2,yR).call(this,t,e,i,r,o,n,s,a,-d/c,u);return}const A=c**2-4*d*l;if(A<0)return;const h=Math.sqrt(A),g=2*l;oe(this,O2,yR).call(this,t,e,i,r,o,n,s,a,(-c+h)/g,u),oe(this,O2,yR).call(this,t,e,i,r,o,n,s,a,(-c-h)/g,u)},ce(LZ,O2),LZ);function hFi(t){return decodeURIComponent(escape(t))}let FZ=null,_Ee=null;function pFi(t){return FZ||(FZ=/([\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,_Ee=new Map([["\uFB05","\u017Ft"]])),t.replaceAll(FZ,(e,i,r)=>i?i.normalize("NFKC"):_Ee.get(r))}function gFi(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),NEe(t)}const UZ="pdfjs_internal_id_";function fFi(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(NEe(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(i=>{i(t(...e))})});const H1="http://www.w3.org/2000/svg",L9=class{};ai(L9,"CSS",96),ai(L9,"PDF",72),ai(L9,"PDF_TO_CSS_UNITS",L9.CSS/L9.PDF);let T9=L9;async function wR(t,e="text"){if(oI(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 o=new XMLHttpRequest;o.open("GET",t,!0),o.responseType=e,o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE){if(o.status===200||o.status===0){switch(e){case"arraybuffer":case"blob":case"json":i(o.response);return}i(o.responseText);return}r(new Error(o.statusText))}},o.send(null)})}class KE{constructor({viewBox:e,userUnit:i,scale:r,rotation:o,offsetX:n=0,offsetY:s=0,dontFlip:a=!1}){this.viewBox=e,this.userUnit=i,this.scale=r,this.rotation=o,this.offsetX=n,this.offsetY=s,r*=i;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let d,u,A,h;switch(o%=360,o<0&&(o+=360),o){case 180:d=-1,u=0,A=0,h=1;break;case 90:d=0,u=1,A=1,h=0;break;case 270:d=0,u=-1,A=-1,h=0;break;case 0:d=1,u=0,A=0,h=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(A=-A,h=-h);let g,p,m,f;d===0?(g=Math.abs(c-e[1])*r+n,p=Math.abs(l-e[0])*r+s,m=(e[3]-e[1])*r,f=(e[2]-e[0])*r):(g=Math.abs(l-e[0])*r+n,p=Math.abs(c-e[1])*r+s,m=(e[2]-e[0])*r,f=(e[3]-e[1])*r),this.transform=[d*r,u*r,A*r,h*r,g-d*r*l-A*r*c,p-u*r*l-h*r*c],this.width=m,this.height=f}get rawDims(){const{userUnit:e,viewBox:i}=this,r=i.map(o=>o*e);return gr(this,"rawDims",{pageWidth:r[2]-r[0],pageHeight:r[3]-r[1],pageX:r[0],pageY:r[1]})}clone({scale:e=this.scale,rotation:i=this.rotation,offsetX:r=this.offsetX,offsetY:o=this.offsetY,dontFlip:n=!1}={}){return new KE({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:i,offsetX:r,offsetY:o,dontFlip:n})}convertToViewportPoint(e,i){return bi.applyTransform([e,i],this.transform)}convertToViewportRectangle(e){const i=bi.applyTransform([e[0],e[1]],this.transform),r=bi.applyTransform([e[2],e[3]],this.transform);return[i[0],i[1],r[0],r[1]]}convertToPdfPoint(e,i){return bi.applyInverseTransform([e,i],this.transform)}}class NZ extends rg{constructor(e,i=0){super(e,"RenderingCancelledException"),this.extraDelay=i}}function bR(t){const e=t.length;let i=0;for(;i<e&&t[i].trim()==="";)i++;return t.substring(i,i+5).toLowerCase()==="data:"}function _Z(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function mFi(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function vFi(t,e="document.pdf"){if(typeof t!="string")return e;if(bR(t))return or('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,r=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,o=i.exec(t);let n=r.exec(o[1])||r.exec(o[2])||r.exec(o[3]);if(n&&(n=n[0],n.includes("%")))try{n=r.exec(decodeURIComponent(n))[0]}catch{}return n||e}class OEe{constructor(){ai(this,"started",Object.create(null)),ai(this,"times",[])}time(e){e in this.started&&or(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||or(`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:o,end:n}of this.times)e.push(`${r.padEnd(i)} ${n-o}ms
5496
5496
  `);return e.join("")}}function oI(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return i==="http:"||i==="https:"}catch{return!1}}function zu(t){t.preventDefault()}function $c(t){t.preventDefault(),t.stopPropagation()}var nI;class OZ{static toDateObject(e){if(!e||typeof e!="string")return null;S(this,nI)||ie(this,nI,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const i=S(this,nI).exec(e);if(!i)return null;const r=parseInt(i[1],10);let o=parseInt(i[2],10);o=o>=1&&o<=12?o-1:0;let n=parseInt(i[3],10);n=n>=1&&n<=31?n: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,o,n,s,a,l))}}nI=new WeakMap,ce(OZ,nI);function CFi(t,{scale:e=1,rotation:i=0}){const{width:r,height:o}=t.attributes.style,n=[0,0,parseInt(r),parseInt(o)];return new KE({viewBox:n,userUnit:1,scale:e,rotation:i})}function HZ(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):(or(`Not a valid color format: "${t}"`),[0,0,0])}function yFi(t){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const i of t.keys()){e.style.color=i;const r=window.getComputedStyle(e).color;t.set(i,HZ(r))}e.remove()}function tn(t){const{a:e,b:i,c:r,d:o,e:n,f:s}=t.getTransform();return[e,i,r,o,n,s]}function ih(t){const{a:e,b:i,c:r,d:o,e:n,f:s}=t.getTransform().invertSelf();return[e,i,r,o,n,s]}function H2(t,e,i=!1,r=!0){if(e instanceof KE){const{pageWidth:o,pageHeight:n}=e.rawDims,{style:s}=t,a=El.isCSSRoundSupported,l=`var(--scale-factor) * ${o}px`,c=`var(--scale-factor) * ${n}px`,d=a?`round(down, ${l}, var(--scale-round-x, 1px))`:`calc(${l})`,u=a?`round(down, ${c}, var(--scale-round-y, 1px))`:`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 VZ{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var V2,F9,rh,U9,IR,sI,GZ,HEe,oh,VEe,GEe,BR,jEe,jZ;const ER=class hU{constructor(e){ce(this,oh),ce(this,V2,null),ce(this,F9,null),ce(this,rh),ce(this,U9,null),ce(this,IR,null),ie(this,rh,e),S(hU,sI)||ie(hU,sI,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"}))}render(){const e=ie(this,V2,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const i=S(this,rh)._uiManager._signal;e.addEventListener("contextmenu",zu,{signal:i}),e.addEventListener("pointerdown",oe(hU,GZ,HEe),{signal:i});const r=ie(this,U9,document.createElement("div"));r.className="buttons",e.append(r);const o=S(this,rh).toolbarPosition;if(o){const{style:n}=e,s=S(this,rh)._uiManager.direction==="ltr"?1-o[0]:o[0];n.insetInlineEnd=`${100*s}%`,n.top=`calc(${100*o[1]}% + var(--editor-toolbar-vert-offset))`}return oe(this,oh,jEe).call(this),e}get div(){return S(this,V2)}hide(){var e;S(this,V2).classList.add("hidden"),(e=S(this,F9))==null||e.hideDropdown()}show(){var e;S(this,V2).classList.remove("hidden"),(e=S(this,IR))==null||e.shown()}async addAltText(e){const i=await e.render();oe(this,oh,BR).call(this,i),S(this,U9).prepend(i,S(this,oh,jZ)),ie(this,IR,e)}addColorPicker(e){ie(this,F9,e);const i=e.renderButton();oe(this,oh,BR).call(this,i),S(this,U9).prepend(i,S(this,oh,jZ))}remove(){var e;S(this,V2).remove(),(e=S(this,F9))==null||e.destroy(),ie(this,F9,null)}};V2=new WeakMap,F9=new WeakMap,rh=new WeakMap,U9=new WeakMap,IR=new WeakMap,sI=new WeakMap,GZ=new WeakSet,HEe=function(t){t.stopPropagation()},oh=new WeakSet,VEe=function(t){S(this,rh)._focusEventsAllowed=!1,$c(t)},GEe=function(t){S(this,rh)._focusEventsAllowed=!0,$c(t)},BR=function(t){const e=S(this,rh)._uiManager._signal;t.addEventListener("focusin",oe(this,oh,VEe).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",oe(this,oh,GEe).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",zu,{signal:e})},jEe=function(){const{editorType:t,_uiManager:e}=S(this,rh),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",S(ER,sI)[t]),oe(this,oh,BR).call(this,i),i.addEventListener("click",r=>{e.delete()},{signal:e._signal}),S(this,U9).append(i)},jZ=function(){const t=document.createElement("div");return t.className="divider",t},ce(ER,GZ),ce(ER,sI,null);let wFi=ER;var xR,G2,N9,aI,zEe,qEe,KEe;class bFi{constructor(e){ce(this,aI),ce(this,xR,null),ce(this,G2,null),ce(this,N9),ie(this,N9,e)}show(e,i,r){const[o,n]=oe(this,aI,qEe).call(this,i,r),{style:s}=S(this,G2)||ie(this,G2,oe(this,aI,zEe).call(this));e.append(S(this,G2)),s.insetInlineEnd=`${100*o}%`,s.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){S(this,G2).remove()}}xR=new WeakMap,G2=new WeakMap,N9=new WeakMap,aI=new WeakSet,zEe=function(){const t=ie(this,G2,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",zu,{signal:S(this,N9)._signal});const e=ie(this,xR,document.createElement("div"));return e.className="buttons",t.append(e),oe(this,aI,KEe).call(this),t},qEe=function(t,e){let i=0,r=0;for(const o of t){const n=o.y+o.height;if(n<i)continue;const s=o.x+(e?o.width:0);if(n>i){r=s,i=n;continue}e?s>r&&(r=s):s<r&&(r=s)}return[e?1-r:r,i]},KEe=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=S(this,N9)._signal;t.addEventListener("contextmenu",zu,{signal:i}),t.addEventListener("click",()=>{S(this,N9).highlightSelection("floating_button")},{signal:i}),S(this,xR).append(t)};function kR(t,e,i){for(const r of i)e.addEventListener(r,t[r].bind(t))}var zZ;class IFi{constructor(){ce(this,zZ,0)}get id(){return`${iFi}${_l(this,zZ)._++}`}}zZ=new WeakMap;var lI,MR,ys,cI,SR;const JEe=class{constructor(){ce(this,cI),ce(this,lI,gFi()),ce(this,MR,0),ce(this,ys,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 o=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 gr(this,"_isSVGFittingCanvas",o)}async getFromFile(e){const{lastModified:i,name:r,size:o,type:n}=e;return oe(this,cI,SR).call(this,`${i}_${r}_${o}_${n}`,e)}async getFromUrl(e){return oe(this,cI,SR).call(this,e,e)}async getFromBlob(e,i){const r=await i;return oe(this,cI,SR).call(this,e,r)}async getFromId(e){S(this,ys)||ie(this,ys,new Map);const i=S(this,ys).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){S(this,ys)||ie(this,ys,new Map);let r=S(this,ys).get(e);if(r!=null&&r.bitmap)return r.refCounter+=1,r;const o=new OffscreenCanvas(i.width,i.height);return o.getContext("2d").drawImage(i,0,0),r={bitmap:o.transferToImageBitmap(),id:`image_${S(this,lI)}_${_l(this,MR)._++}`,refCounter:1,isSvg:!1},S(this,ys).set(e,r),S(this,ys).set(r.id,r),r}getSvgUrl(e){const i=S(this,ys).get(e);return i!=null&&i.isSvg?i.svgUrl:null}deleteId(e){var i;S(this,ys)||ie(this,ys,new Map);const r=S(this,ys).get(e);if(!r||(r.refCounter-=1,r.refCounter!==0))return;const{bitmap:o}=r;if(!r.url&&!r.file){const n=new OffscreenCanvas(o.width,o.height);n.getContext("bitmaprenderer").transferFromImageBitmap(o),r.blobPromise=n.convertToBlob()}(i=o.close)==null||i.call(o),r.bitmap=null}isValidId(e){return e.startsWith(`image_${S(this,lI)}_`)}};lI=new WeakMap,MR=new WeakMap,ys=new WeakMap,cI=new WeakSet,SR=async function(t,e){S(this,ys)||ie(this,ys,new Map);let i=S(this,ys).get(t);if(i===null)return null;if(i!=null&&i.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${S(this,lI)}_${_l(this,MR)._++}`,refCounter:0,isSvg:!1});let r;if(typeof e=="string"?(i.url=e,r=await wR(e,"blob")):e instanceof File?r=i.file=e:e instanceof Blob&&(r=e),r.type==="image/svg+xml"){const o=JEe._isSVGFittingCanvas,n=new FileReader,s=new Image,a=new Promise((l,c)=>{s.onload=()=>{i.bitmap=s,i.isSvg=!0,l()},n.onload=async()=>{const d=i.svgUrl=n.result;s.src=await o?`${d}#svgView(preserveAspectRatio(none))`:d},s.onerror=n.onerror=c});n.readAsDataURL(r),await a}else i.bitmap=await createImageBitmap(r);i.refCounter=1}catch(r){or(r),i=null}return S(this,ys).set(t,i),i&&S(this,ys).set(i.id,i),i};let BFi=JEe;var es,j2,QR,rn;class EFi{constructor(e=128){ce(this,es,[]),ce(this,j2,!1),ce(this,QR),ce(this,rn,-1),ie(this,QR,e)}add({cmd:e,undo:i,post:r,mustExec:o,type:n=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}){if(o&&e(),S(this,j2))return;const l={cmd:e,undo:i,post:r,type:n};if(S(this,rn)===-1){S(this,es).length>0&&(S(this,es).length=0),ie(this,rn,0),S(this,es).push(l);return}if(s&&S(this,es)[S(this,rn)].type===n){a&&(l.undo=S(this,es)[S(this,rn)].undo),S(this,es)[S(this,rn)]=l;return}const c=S(this,rn)+1;c===S(this,QR)?S(this,es).splice(0,1):(ie(this,rn,c),c<S(this,es).length&&S(this,es).splice(c)),S(this,es).push(l)}undo(){if(S(this,rn)===-1)return;ie(this,j2,!0);const{undo:e,post:i}=S(this,es)[S(this,rn)];e(),i?.(),ie(this,j2,!1),ie(this,rn,S(this,rn)-1)}redo(){if(S(this,rn)<S(this,es).length-1){ie(this,rn,S(this,rn)+1),ie(this,j2,!0);const{cmd:e,post:i}=S(this,es)[S(this,rn)];e(),i?.(),ie(this,j2,!1)}}hasSomethingToUndo(){return S(this,rn)!==-1}hasSomethingToRedo(){return S(this,rn)<S(this,es).length-1}cleanType(e){if(S(this,rn)!==-1){for(let i=S(this,rn);i>=0;i--)if(S(this,es)[i].type!==e){S(this,es).splice(i+1,S(this,rn)-i),ie(this,rn,i);return}S(this,es).length=0,ie(this,rn,-1)}}destroy(){ie(this,es,null)}}es=new WeakMap,j2=new WeakMap,QR=new WeakMap,rn=new WeakMap;var qZ,YEe;class dI{constructor(e){ce(this,qZ),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:i}=El.platform;for(const[r,o,n={}]of e)for(const s of r){const a=s.startsWith("mac+");i&&a?(this.callbacks.set(s.slice(4),{callback:o,options:n}),this.allKeys.add(s.split("+").at(-1))):!i&&!a&&(this.callbacks.set(s,{callback:o,options:n}),this.allKeys.add(s.split("+").at(-1)))}}exec(e,i){if(!this.allKeys.has(i.key))return;const r=this.callbacks.get(oe(this,qZ,YEe).call(this,i));if(!r)return;const{callback:o,options:{bubbles:n=!1,args:s=[],checker:a=null}}=r;a&&!a(e,i)||(o.bind(e,...s,i)(),n||$c(i))}}qZ=new WeakSet,YEe=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};const WEe=class YPe{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return yFi(e),gr(this,"_colors",e)}convert(e){const i=HZ(e);if(!window.matchMedia("(forced-colors: active)").matches)return i;for(const[r,o]of this._colors)if(o.every((n,s)=>n===i[s]))return YPe._colorsMapping.get(r);return i}getHexCode(e){const i=this._colors.get(e);return i?bi.makeHexColor(...i):e}};ai(WEe,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let xFi=WEe;var uI,Fd,Ns,_a,AI,ng,_9,qu,z2,O9,hI,H9,V1,nh,V9,DR,PR,pI,RR,G1,q2,gI,K2,sh,KZ,J2,LR,Y2,G9,TR,FR,oa,Bo,sg,j9,fI,UR,W2,j1,ag,NR,Ku,Ei,_R,JZ,ZEe,XEe,OR,$Ee,exe,txe,YZ,ixe,WZ,ZZ,rxe,xl,z1,oxe,nxe,XZ,sxe,mI,$Z;const eX=class vte{constructor(e,i,r,o,n,s,a,l,c,d,u,A,h){ce(this,Ei),ce(this,uI,new AbortController),ce(this,Fd,null),ce(this,Ns,new Map),ce(this,_a,new Map),ce(this,AI,null),ce(this,ng,null),ce(this,_9,null),ce(this,qu,new EFi),ce(this,z2,null),ce(this,O9,null),ce(this,hI,0),ce(this,H9,new Set),ce(this,V1,null),ce(this,nh,null),ce(this,V9,new Set),ai(this,"_editorUndoBar",null),ce(this,DR,!1),ce(this,PR,!1),ce(this,pI,!1),ce(this,RR,null),ce(this,G1,null),ce(this,q2,null),ce(this,gI,null),ce(this,K2,!1),ce(this,sh,null),ce(this,KZ,new IFi),ce(this,J2,!1),ce(this,LR,!1),ce(this,Y2,null),ce(this,G9,null),ce(this,TR,null),ce(this,FR,null),ce(this,oa,rr.NONE),ce(this,Bo,new Set),ce(this,sg,null),ce(this,j9,null),ce(this,fI,null),ce(this,UR,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),ce(this,W2,[0,0]),ce(this,j1,null),ce(this,ag,null),ce(this,NR,null),ce(this,Ku,null);const g=this._signal=S(this,uI).signal;ie(this,ag,e),ie(this,NR,i),ie(this,AI,r),this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:g}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:g}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:g}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:g}),o._on("setpreference",this.onSetPreference.bind(this),{signal:g}),o._on("switchannotationeditorparams",p=>this.updateParams(p.type,p.value),{signal:g}),oe(this,Ei,$Ee).call(this),oe(this,Ei,rxe).call(this),oe(this,Ei,YZ).call(this),ie(this,ng,n.annotationStorage),ie(this,RR,n.filterFactory),ie(this,j9,s),ie(this,gI,a||null),ie(this,DR,l),ie(this,PR,c),ie(this,pI,d),ie(this,FR,u||null),this.viewParameters={realScale:T9.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=A||null,this._supportsPinchToZoom=h!==!1}static get _keyboardManager(){const e=vte.prototype,i=s=>S(s,ag).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},o=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return gr(this,"_keyboardManager",new dI([[["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(s,ag).contains(a)&&!s.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(s,{target:a})=>!(a instanceof HTMLButtonElement)&&S(s,ag).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-o,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[o,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-o],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:i}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,o],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:i}]]))}destroy(){var e,i,r,o,n;(e=S(this,Ku))==null||e.resolve(),ie(this,Ku,null),(i=S(this,uI))==null||i.abort(),ie(this,uI,null),this._signal=null;for(const s of S(this,_a).values())s.destroy();S(this,_a).clear(),S(this,Ns).clear(),S(this,V9).clear(),ie(this,Fd,null),S(this,Bo).clear(),S(this,qu).destroy(),(r=S(this,AI))==null||r.destroy(),(o=S(this,sh))==null||o.hide(),ie(this,sh,null),S(this,G1)&&(clearTimeout(S(this,G1)),ie(this,G1,null)),S(this,j1)&&(clearTimeout(S(this,j1)),ie(this,j1,null)),(n=this._editorUndoBar)==null||n.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return S(this,FR)}get useNewAltTextFlow(){return S(this,PR)}get useNewAltTextWhenAddingImage(){return S(this,pI)}get hcmFilter(){return gr(this,"hcmFilter",S(this,j9)?S(this,RR).addHCMFilter(S(this,j9).foreground,S(this,j9).background):"none")}get direction(){return gr(this,"direction",getComputedStyle(S(this,ag)).direction)}get highlightColors(){return gr(this,"highlightColors",S(this,gI)?new Map(S(this,gI).split(",").map(e=>e.split("=").map(i=>i.trim()))):null)}get highlightColorNames(){return gr(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),ie(this,O9,e)}setMainHighlightColorPicker(e){ie(this,TR,e)}editAltText(e,i=!1){var r;(r=S(this,AI))==null||r.editAltText(this,e,i)}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}){switch(e){case"enableNewAltTextWhenAddingImage":ie(this,pI,i);break}}onPageChanging({pageNumber:e}){ie(this,hI,e-1)}focusMainContainer(){S(this,ag).focus()}findParent(e,i){for(const r of S(this,_a).values()){const{x:o,y:n,width:s,height:a}=r.div.getBoundingClientRect();if(e>=o&&e<=o+s&&i>=n&&i<=n+a)return r}return null}disableUserSelect(e=!1){S(this,NR).classList.toggle("noUserSelect",e)}addShouldRescale(e){S(this,V9).add(e)}removeShouldRescale(e){S(this,V9).delete(e)}onScaleChanging({scale:e}){var i;this.commitOrRemove(),this.viewParameters.realScale=e*T9.PDF_TO_CSS_UNITS;for(const r of S(this,V9))r.onScaleChanging();(i=S(this,O9))==null||i.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:r,anchorOffset:o,focusNode:n,focusOffset:s}=i,a=i.toString(),l=oe(this,Ei,_R).call(this,i).closest(".textLayer"),c=this.getSelectionBoxes(l);if(!c)return;i.empty();const d=oe(this,Ei,JZ).call(this,l),u=S(this,oa)===rr.NONE,A=()=>{d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:c,anchorNode:r,anchorOffset:o,focusNode:n,focusOffset:s,text:a}),u&&this.showAllEditors("highlight",!0,!0)};if(u){this.switchToMode(rr.HIGHLIGHT,A);return}A()}addToAnnotationStorage(e){!e.isEmpty()&&S(this,ng)&&!S(this,ng).has(e.id)&&S(this,ng).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,S(this,K2)&&(ie(this,K2,!1),oe(this,Ei,OR).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const i of S(this,Bo))if(i.div.contains(e)){ie(this,G9,[i,e]),i._focusEventsAllowed=!1;break}}focus(){if(!S(this,G9))return;const[e,i]=S(this,G9);ie(this,G9,null),i.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),i.focus()}addEditListeners(){oe(this,Ei,YZ).call(this),oe(this,Ei,WZ).call(this)}removeEditListeners(){oe(this,Ei,ixe).call(this),oe(this,Ei,ZZ).call(this)}dragOver(e){for(const{type:i}of e.dataTransfer.items)for(const r of S(this,nh))if(r.isHandlingMimeForPasting(i)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const i of e.dataTransfer.items)for(const r of S(this,nh))if(r.isHandlingMimeForPasting(i.type)){r.paste(i,this.currentLayer),e.preventDefault();return}}copy(e){var i;if(e.preventDefault(),(i=S(this,Fd))==null||i.commitOrRemove(),!this.hasSelection)return;const r=[];for(const o of S(this,Bo)){const n=o.serialize(!0);n&&r.push(n)}r.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:i}=e;for(const n of i.items)for(const s of S(this,nh))if(s.isHandlingMimeForPasting(n.type)){s.paste(n,this.currentLayer);return}let r=i.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(n){or(`paste: "${n.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const o=this.currentLayer;try{const n=[];for(const l of r){const c=await o.deserialize(l);if(!c)return;n.push(c)}const s=()=>{for(const l of n)oe(this,Ei,XZ).call(this,l);oe(this,Ei,$Z).call(this,n)},a=()=>{for(const l of n)l.remove()};this.addCommands({cmd:s,undo:a,mustExec:!0})}catch(n){or(`paste: "${n.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),S(this,oa)!==rr.NONE&&!this.isEditorHandlingKeyboard&&vte._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,S(this,K2)&&(ie(this,K2,!1),oe(this,Ei,OR).call(this,"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}}setEditingState(e){e?(oe(this,Ei,exe).call(this),oe(this,Ei,WZ).call(this),oe(this,Ei,xl).call(this,{isEditing:S(this,oa)!==rr.NONE,isEmpty:oe(this,Ei,mI).call(this),hasSomethingToUndo:S(this,qu).hasSomethingToUndo(),hasSomethingToRedo:S(this,qu).hasSomethingToRedo(),hasSelectedEditor:!1})):(oe(this,Ei,txe).call(this),oe(this,Ei,ZZ).call(this),oe(this,Ei,xl).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!S(this,nh)){ie(this,nh,e);for(const i of S(this,nh))oe(this,Ei,z1).call(this,i.defaultPropertiesToUpdate)}}getId(){return S(this,KZ).id}get currentLayer(){return S(this,_a).get(S(this,hI))}getLayer(e){return S(this,_a).get(e)}get currentPageIndex(){return S(this,hI)}addLayer(e){S(this,_a).set(e.pageIndex,e),S(this,J2)?e.enable():e.disable()}removeLayer(e){S(this,_a).delete(e.pageIndex)}async updateMode(e,i=null,r=!1){var o;if(S(this,oa)!==e&&!(S(this,Ku)&&(await S(this,Ku).promise,!S(this,Ku)))){if(ie(this,Ku,Promise.withResolvers()),ie(this,oa,e),e===rr.NONE){this.setEditingState(!1),oe(this,Ei,nxe).call(this),(o=this._editorUndoBar)==null||o.hide(),S(this,Ku).resolve();return}this.setEditingState(!0),await oe(this,Ei,oxe).call(this),this.unselectAll();for(const n of S(this,_a).values())n.updateMode(e);if(!i){r&&this.addNewEditorFromKeyboard(),S(this,Ku).resolve();return}for(const n of S(this,Ns).values())n.annotationElementId===i?(this.setSelected(n),n.enterInEditMode()):n.unselect();S(this,Ku).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==S(this,oa)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,i){var r;if(S(this,nh)){switch(e){case Dr.CREATE:this.currentLayer.addNewEditor();return;case Dr.HIGHLIGHT_DEFAULT_COLOR:(r=S(this,TR))==null||r.updateColor(i);break;case Dr.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(S(this,fI)||ie(this,fI,new Map)).set(e,i),this.showAllEditors("highlight",i);break}for(const o of S(this,Bo))o.updateParams(e,i);for(const o of S(this,nh))o.updateDefaultParams(e,i)}}showAllEditors(e,i,r=!1){var o;for(const n of S(this,Ns).values())n.editorType===e&&n.show(i);(((o=S(this,fI))==null?void 0:o.get(Dr.HIGHLIGHT_SHOW_ALL))??!0)!==i&&oe(this,Ei,z1).call(this,[[Dr.HIGHLIGHT_SHOW_ALL,i]])}enableWaiting(e=!1){if(S(this,LR)!==e){ie(this,LR,e);for(const i of S(this,_a).values())e?i.disableClick():i.enableClick(),i.div.classList.toggle("waiting",e)}}getEditors(e){const i=[];for(const r of S(this,Ns).values())r.pageIndex===e&&i.push(r);return i}getEditor(e){return S(this,Ns).get(e)}addEditor(e){S(this,Ns).set(e.id,e)}removeEditor(e){var i;e.div.contains(document.activeElement)&&(S(this,G1)&&clearTimeout(S(this,G1)),ie(this,G1,setTimeout(()=>{this.focusMainContainer(),ie(this,G1,null)},0))),S(this,Ns).delete(e.id),this.unselect(e),(!e.annotationElementId||!S(this,H9).has(e.annotationElementId))&&((i=S(this,ng))==null||i.remove(e.id))}addDeletedAnnotationElement(e){S(this,H9).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return S(this,H9).has(e)}removeDeletedAnnotationElement(e){S(this,H9).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){S(this,Fd)!==e&&(ie(this,Fd,e),e&&oe(this,Ei,z1).call(this,e.propertiesToUpdate))}updateUI(e){S(this,Ei,sxe)===e&&oe(this,Ei,z1).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){oe(this,Ei,z1).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(S(this,Bo).has(e)){S(this,Bo).delete(e),e.unselect(),oe(this,Ei,xl).call(this,{hasSelectedEditor:this.hasSelection});return}S(this,Bo).add(e),e.select(),oe(this,Ei,z1).call(this,e.propertiesToUpdate),oe(this,Ei,xl).call(this,{hasSelectedEditor:!0})}setSelected(e){var i;(i=S(this,O9))==null||i.commitOrRemove();for(const r of S(this,Bo))r!==e&&r.unselect();S(this,Bo).clear(),S(this,Bo).add(e),e.select(),oe(this,Ei,z1).call(this,e.propertiesToUpdate),oe(this,Ei,xl).call(this,{hasSelectedEditor:!0})}isSelected(e){return S(this,Bo).has(e)}get firstSelectedEditor(){return S(this,Bo).values().next().value}unselect(e){e.unselect(),S(this,Bo).delete(e),oe(this,Ei,xl).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return S(this,Bo).size!==0}get isEnterHandled(){return S(this,Bo).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;S(this,qu).undo(),oe(this,Ei,xl).call(this,{hasSomethingToUndo:S(this,qu).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:oe(this,Ei,mI).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){S(this,qu).redo(),oe(this,Ei,xl).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:S(this,qu).hasSomethingToRedo(),isEmpty:oe(this,Ei,mI).call(this)})}addCommands(e){S(this,qu).add(e),oe(this,Ei,xl).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:oe(this,Ei,mI).call(this)})}cleanUndoStack(e){S(this,qu).cleanType(e)}delete(){var e;this.commitOrRemove();const i=(e=this.currentLayer)==null?void 0:e.endDrawingSession(!0);if(!this.hasSelection&&!i)return;const r=i?[i]:[...S(this,Bo)],o=()=>{var s;(s=this._editorUndoBar)==null||s.show(n,r.length===1?r[0].editorType:r.length);for(const a of r)a.remove()},n=()=>{for(const s of r)oe(this,Ei,XZ).call(this,s)};this.addCommands({cmd:o,undo:n,mustExec:!0})}commitOrRemove(){var e;(e=S(this,Fd))==null||e.commitOrRemove()}hasSomethingToControl(){return S(this,Fd)||this.hasSelection}selectAll(){for(const e of S(this,Bo))e.commit();oe(this,Ei,$Z).call(this,S(this,Ns).values())}unselectAll(){var e;if(!(S(this,Fd)&&(S(this,Fd).commitOrRemove(),S(this,oa)!==rr.NONE))&&!((e=S(this,O9))!=null&&e.commitOrRemove())&&this.hasSelection){for(const i of S(this,Bo))i.unselect();S(this,Bo).clear(),oe(this,Ei,xl).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,i,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;S(this,W2)[0]+=e,S(this,W2)[1]+=i;const[o,n]=S(this,W2),s=[...S(this,Bo)];S(this,j1)&&clearTimeout(S(this,j1)),ie(this,j1,setTimeout(()=>{ie(this,j1,null),S(this,W2)[0]=S(this,W2)[1]=0,this.addCommands({cmd:()=>{for(const l of s)S(this,Ns).has(l.id)&&l.translateInPage(o,n)},undo:()=>{for(const l of s)S(this,Ns).has(l.id)&&l.translateInPage(-o,-n)},mustExec:!1})},1e3));for(const l of s)l.translateInPage(e,i)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),ie(this,V1,new Map);for(const e of S(this,Bo))S(this,V1).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!S(this,V1))return!1;this.disableUserSelect(!1);const e=S(this,V1);ie(this,V1,null);let i=!1;for(const[{x:o,y:n,pageIndex:s},a]of e)a.newX=o,a.newY=n,a.newPageIndex=s,i||(i=o!==a.savedX||n!==a.savedY||s!==a.savedPageIndex);if(!i)return!1;const r=(o,n,s,a)=>{if(S(this,Ns).has(o.id)){const l=S(this,_a).get(a);l?o._setParentAndPosition(l,n,s):(o.pageIndex=a,o.x=n,o.y=s)}};return this.addCommands({cmd:()=>{for(const[o,{newX:n,newY:s,newPageIndex:a}]of e)r(o,n,s,a)},undo:()=>{for(const[o,{savedX:n,savedY:s,savedPageIndex:a}]of e)r(o,n,s,a)},mustExec:!0}),!0}dragSelectedEditors(e,i){if(S(this,V1))for(const r of S(this,V1).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(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||S(this,Bo).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return S(this,Fd)===e}getActive(){return S(this,Fd)}getMode(){return S(this,oa)}get imageManager(){return gr(this,"imageManager",new BFi)}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:o,width:n,height:s}=e.getBoundingClientRect();let a;switch(e.getAttribute("data-main-rotation")){case"90":a=(c,d,u,A)=>({x:(d-o)/s,y:1-(c+u-r)/n,width:A/s,height:u/n});break;case"180":a=(c,d,u,A)=>({x:1-(c+u-r)/n,y:1-(d+A-o)/s,width:u/n,height:A/s});break;case"270":a=(c,d,u,A)=>({x:1-(d+A-o)/s,y:(c-r)/n,width:A/s,height:u/n});break;default:a=(c,d,u,A)=>({x:(c-r)/n,y:(d-o)/s,width:u/n,height:A/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:A,y:h,width:g,height:p}of u.getClientRects())g===0||p===0||l.push(a(A,h,g,p))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:i}){(S(this,_9)||ie(this,_9,new Map)).set(e,i)}removeChangedExistingAnnotation({annotationElementId:e}){var i;(i=S(this,_9))==null||i.delete(e)}renderAnnotationElement(e){var i;const r=(i=S(this,_9))==null?void 0:i.get(e.data.id);if(!r)return;const o=S(this,ng).getRawValue(r);o&&(S(this,oa)===rr.NONE&&!o.hasBeenModified||o.renderAnnotationElement(e))}};uI=new WeakMap,Fd=new WeakMap,Ns=new WeakMap,_a=new WeakMap,AI=new WeakMap,ng=new WeakMap,_9=new WeakMap,qu=new WeakMap,z2=new WeakMap,O9=new WeakMap,hI=new WeakMap,H9=new WeakMap,V1=new WeakMap,nh=new WeakMap,V9=new WeakMap,DR=new WeakMap,PR=new WeakMap,pI=new WeakMap,RR=new WeakMap,G1=new WeakMap,q2=new WeakMap,gI=new WeakMap,K2=new WeakMap,sh=new WeakMap,KZ=new WeakMap,J2=new WeakMap,LR=new WeakMap,Y2=new WeakMap,G9=new WeakMap,TR=new WeakMap,FR=new WeakMap,oa=new WeakMap,Bo=new WeakMap,sg=new WeakMap,j9=new WeakMap,fI=new WeakMap,UR=new WeakMap,W2=new WeakMap,j1=new WeakMap,ag=new WeakMap,NR=new WeakMap,Ku=new WeakMap,Ei=new WeakSet,_R=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},JZ=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const i of S(this,_a).values())if(i.hasTextLayer(t))return i;return null},ZEe=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=oe(this,Ei,_R).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(S(this,sh)||ie(this,sh,new bFi(this)),S(this,sh).show(e,i,this.direction==="ltr"))},XEe=function(){var t,e,i;const r=document.getSelection();if(!r||r.isCollapsed){S(this,sg)&&((t=S(this,sh))==null||t.hide(),ie(this,sg,null),oe(this,Ei,xl).call(this,{hasSelectedText:!1}));return}const{anchorNode:o}=r;if(o===S(this,sg))return;const n=oe(this,Ei,_R).call(this,r).closest(".textLayer");if(!n){S(this,sg)&&((e=S(this,sh))==null||e.hide(),ie(this,sg,null),oe(this,Ei,xl).call(this,{hasSelectedText:!1}));return}if((i=S(this,sh))==null||i.hide(),ie(this,sg,o),oe(this,Ei,xl).call(this,{hasSelectedText:!0}),!(S(this,oa)!==rr.HIGHLIGHT&&S(this,oa)!==rr.NONE)&&(S(this,oa)===rr.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),ie(this,K2,this.isShiftKeyDown),!this.isShiftKeyDown)){const s=S(this,oa)===rr.HIGHLIGHT?oe(this,Ei,JZ).call(this,n):null;s?.toggleDrawing();const a=new AbortController,l=this.combinedSignal(a),c=d=>{d.type==="pointerup"&&d.button!==0||(a.abort(),s?.toggleDrawing(!0),d.type==="pointerup"&&oe(this,Ei,OR).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}},OR=function(t=""){S(this,oa)===rr.HIGHLIGHT?this.highlightSelection(t):S(this,DR)&&oe(this,Ei,ZEe).call(this)},$Ee=function(){document.addEventListener("selectionchange",oe(this,Ei,XEe).bind(this),{signal:this._signal})},exe=function(){if(S(this,q2))return;ie(this,q2,new AbortController);const t=this.combinedSignal(S(this,q2));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},txe=function(){var t;(t=S(this,q2))==null||t.abort(),ie(this,q2,null)},YZ=function(){if(S(this,Y2))return;ie(this,Y2,new AbortController);const t=this.combinedSignal(S(this,Y2));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},ixe=function(){var t;(t=S(this,Y2))==null||t.abort(),ie(this,Y2,null)},WZ=function(){if(S(this,z2))return;ie(this,z2,new AbortController);const t=this.combinedSignal(S(this,z2));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},ZZ=function(){var t;(t=S(this,z2))==null||t.abort(),ie(this,z2,null)},rxe=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},xl=function(t){Object.entries(t).some(([e,i])=>S(this,UR)[e]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(S(this,UR),t)}),S(this,oa)===rr.HIGHLIGHT&&t.hasSelectedEditor===!1&&oe(this,Ei,z1).call(this,[[Dr.HIGHLIGHT_FREE,!0]]))},z1=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},oxe=async function(){if(!S(this,J2)){ie(this,J2,!0);const t=[];for(const e of S(this,_a).values())t.push(e.enable());await Promise.all(t);for(const e of S(this,Ns).values())e.enable()}},nxe=function(){if(this.unselectAll(),S(this,J2)){ie(this,J2,!1);for(const t of S(this,_a).values())t.disable();for(const t of S(this,Ns).values())t.disable()}},XZ=function(t){const e=S(this,_a).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},sxe=function(){let t=null;for(t of S(this,Bo));return t},mI=function(){if(S(this,Ns).size===0)return!0;if(S(this,Ns).size===1)for(const t of S(this,Ns).values())return t.isEmpty();return!1},$Z=function(t){for(const e of S(this,Bo))e.unselect();S(this,Bo).clear();for(const e of t)e.isEmpty()||(S(this,Bo).add(e),e.select());oe(this,Ei,xl).call(this,{hasSelectedEditor:this.hasSelection})},ai(eX,"TRANSLATE_SMALL",1),ai(eX,"TRANSLATE_BIG",10);let vI=eX;var na,q1,ah,CI,K1,Ud,yI,J1,ed,lg,z9,Y1,cg,W1,wI,HR;const bI=class cf{constructor(e){ce(this,W1),ce(this,na,null),ce(this,q1,!1),ce(this,ah,null),ce(this,CI,null),ce(this,K1,null),ce(this,Ud,null),ce(this,yI,!1),ce(this,J1,null),ce(this,ed,null),ce(this,lg,null),ce(this,z9,null),ce(this,Y1,!1),ie(this,ed,e),ie(this,Y1,e._uiManager.useNewAltTextFlow),S(cf,cg)||ie(cf,cg,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){cf._l10n??(cf._l10n=e)}async render(){const e=ie(this,ah,document.createElement("button"));e.className="altText",e.tabIndex="0";const i=ie(this,CI,document.createElement("span"));e.append(i),S(this,Y1)?(e.classList.add("new"),e.setAttribute("data-l10n-id",S(cf,cg).missing),i.setAttribute("data-l10n-id",S(cf,cg)["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=S(this,ed)._uiManager._signal;e.addEventListener("contextmenu",zu,{signal:r}),e.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:r});const o=n=>{n.preventDefault(),S(this,ed)._uiManager.editAltText(S(this,ed)),S(this,Y1)&&S(this,ed)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:S(this,W1,wI)}})};return e.addEventListener("click",o,{capture:!0,signal:r}),e.addEventListener("keydown",n=>{n.target===e&&n.key==="Enter"&&(ie(this,yI,!0),o(n))},{signal:r}),await oe(this,W1,HR).call(this),e}finish(){S(this,ah)&&(S(this,ah).focus({focusVisible:S(this,yI)}),ie(this,yI,!1))}isEmpty(){return S(this,Y1)?S(this,na)===null:!S(this,na)&&!S(this,q1)}hasData(){return S(this,Y1)?S(this,na)!==null||!!S(this,lg):this.isEmpty()}get guessedText(){return S(this,lg)}async setGuessedText(e){S(this,na)===null&&(ie(this,lg,e),ie(this,z9,await cf._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),oe(this,W1,HR).call(this))}toggleAltTextBadge(e=!1){var i;if(!S(this,Y1)||S(this,na)){(i=S(this,J1))==null||i.remove(),ie(this,J1,null);return}if(!S(this,J1)){const r=ie(this,J1,document.createElement("div"));r.className="noAltTextBadge",S(this,ed).div.append(r)}S(this,J1).classList.toggle("hidden",!e)}serialize(e){let i=S(this,na);return!e&&S(this,lg)===i&&(i=S(this,z9)),{altText:i,decorative:S(this,q1),guessedText:S(this,lg),textWithDisclaimer:S(this,z9)}}get data(){return{altText:S(this,na),decorative:S(this,q1)}}set data({altText:e,decorative:i,guessedText:r,textWithDisclaimer:o,cancel:n=!1}){r&&(ie(this,lg,r),ie(this,z9,o)),!(S(this,na)===e&&S(this,q1)===i)&&(n||(ie(this,na,e),ie(this,q1,i)),oe(this,W1,HR).call(this))}toggle(e=!1){S(this,ah)&&(!e&&S(this,Ud)&&(clearTimeout(S(this,Ud)),ie(this,Ud,null)),S(this,ah).disabled=!e)}shown(){S(this,ed)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:S(this,W1,wI)}})}destroy(){var e,i;(e=S(this,ah))==null||e.remove(),ie(this,ah,null),ie(this,CI,null),ie(this,K1,null),(i=S(this,J1))==null||i.remove(),ie(this,J1,null)}};na=new WeakMap,q1=new WeakMap,ah=new WeakMap,CI=new WeakMap,K1=new WeakMap,Ud=new WeakMap,yI=new WeakMap,J1=new WeakMap,ed=new WeakMap,lg=new WeakMap,z9=new WeakMap,Y1=new WeakMap,cg=new WeakMap,W1=new WeakSet,wI=function(){return S(this,na)&&"added"||S(this,na)===null&&this.guessedText&&"review"||"missing"},HR=async function(){var t,e,i;const r=S(this,ah);if(!r)return;if(S(this,Y1)){if(r.classList.toggle("done",!!S(this,na)),r.setAttribute("data-l10n-id",S(bI,cg)[S(this,W1,wI)]),(t=S(this,CI))==null||t.setAttribute("data-l10n-id",S(bI,cg)[`${S(this,W1,wI)}-label`]),!S(this,na)){(e=S(this,K1))==null||e.remove();return}}else{if(!S(this,na)&&!S(this,q1)){r.classList.remove("done"),(i=S(this,K1))==null||i.remove();return}r.classList.add("done"),r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let o=S(this,K1);if(!o){ie(this,K1,o=document.createElement("span")),o.className="tooltip",o.setAttribute("role","tooltip"),o.id=`alt-text-tooltip-${S(this,ed).id}`;const s=100,a=S(this,ed)._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(S(this,Ud)),ie(this,Ud,null)},{once:!0}),r.addEventListener("mouseenter",()=>{ie(this,Ud,setTimeout(()=>{ie(this,Ud,null),S(this,K1).classList.add("show"),S(this,ed)._reportTelemetry({action:"alt_text_tooltip"})},s))},{signal:a}),r.addEventListener("mouseleave",()=>{var l;S(this,Ud)&&(clearTimeout(S(this,Ud)),ie(this,Ud,null)),(l=S(this,K1))==null||l.classList.remove("show")},{signal:a})}S(this,q1)?o.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(o.removeAttribute("data-l10n-id"),o.textContent=S(this,na)),o.parentNode||r.append(o);const n=S(this,ed).getImageForAltText();n?.setAttribute("aria-describedby",o.id)},ce(bI,cg,null),ai(bI,"_l10n",null);let axe=bI;var VR,q9,GR,jR,zR,qR,KR,II,dg,K9,Z2,J9,lxe,cxe,tX;const dxe=class{constructor({container:e,isPinchingDisabled:i=null,isPinchingStopped:r=null,onPinchStart:o=null,onPinching:n=null,onPinchEnd:s=null,signal:a}){ce(this,J9),ce(this,VR),ce(this,q9,!1),ce(this,GR,null),ce(this,jR),ce(this,zR),ce(this,qR),ce(this,KR),ce(this,II),ce(this,dg,null),ce(this,K9),ce(this,Z2,null),ie(this,VR,e),ie(this,GR,r),ie(this,jR,i),ie(this,zR,o),ie(this,qR,n),ie(this,KR,s),ie(this,K9,new AbortController),ie(this,II,AbortSignal.any([a,S(this,K9).signal])),e.addEventListener("touchstart",oe(this,J9,lxe).bind(this),{passive:!1,signal:S(this,II)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return gr(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}destroy(){var e;(e=S(this,K9))==null||e.abort(),ie(this,K9,null)}};VR=new WeakMap,q9=new WeakMap,GR=new WeakMap,jR=new WeakMap,zR=new WeakMap,qR=new WeakMap,KR=new WeakMap,II=new WeakMap,dg=new WeakMap,K9=new WeakMap,Z2=new WeakMap,J9=new WeakSet,lxe=function(t){var e,i,r;if((e=S(this,jR))!=null&&e.call(this)||t.touches.length<2)return;if(!S(this,Z2)){ie(this,Z2,new AbortController);const s=AbortSignal.any([S(this,II),S(this,Z2).signal]),a=S(this,VR),l={signal:s,passive:!1};a.addEventListener("touchmove",oe(this,J9,cxe).bind(this),l),a.addEventListener("touchend",oe(this,J9,tX).bind(this),l),a.addEventListener("touchcancel",oe(this,J9,tX).bind(this),l),(i=S(this,zR))==null||i.call(this)}if($c(t),t.touches.length!==2||(r=S(this,GR))!=null&&r.call(this)){ie(this,dg,null);return}let[o,n]=t.touches;o.identifier>n.identifier&&([o,n]=[n,o]),ie(this,dg,{touch0X:o.screenX,touch0Y:o.screenY,touch1X:n.screenX,touch1Y:n.screenY})},cxe=function(t){var e;if(!S(this,dg)||t.touches.length!==2)return;let[i,r]=t.touches;i.identifier>r.identifier&&([i,r]=[r,i]);const{screenX:o,screenY:n}=i,{screenX:s,screenY:a}=r,l=S(this,dg),{touch0X:c,touch0Y:d,touch1X:u,touch1Y:A}=l,h=u-c,g=A-d,p=s-o,m=a-n,f=Math.hypot(p,m)||1,C=Math.hypot(h,g)||1;if(!S(this,q9)&&Math.abs(C-f)<=dxe.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=o,l.touch0Y=n,l.touch1X=s,l.touch1Y=a,t.preventDefault(),!S(this,q9)){ie(this,q9,!0);return}const y=[(o+s)/2,(n+a)/2];(e=S(this,qR))==null||e.call(this,y,C,f)},tX=function(t){var e;S(this,Z2).abort(),ie(this,Z2,null),(e=S(this,KR))==null||e.call(this),S(this,dg)&&(t.preventDefault(),ie(this,dg,null),ie(this,q9,!1))};let uxe=dxe;var Y9,lh,on,BI,X2,JR,W9,Oa,Z9,ug,$2,YR,X9,Ha,WR,$9,Ag,Z1,EI,xI,Nd,em,ZR,iX,jr,rX,XR,oX,$R,Axe,hxe,nX,eL,sX,pxe,gxe,fxe,aX,mxe,lX,vxe,Cxe,yxe,cX,kI;const Vn=class Ca{constructor(e){ce(this,jr),ce(this,Y9,null),ce(this,lh,null),ce(this,on,null),ce(this,BI,!1),ce(this,X2,null),ce(this,JR,""),ce(this,W9,!1),ce(this,Oa,null),ce(this,Z9,null),ce(this,ug,null),ce(this,$2,null),ce(this,YR,""),ce(this,X9,!1),ce(this,Ha,null),ce(this,WR,!1),ce(this,$9,!1),ce(this,Ag,!1),ce(this,Z1,null),ce(this,EI,0),ce(this,xI,0),ce(this,Nd,null),ce(this,em,null),ai(this,"_editToolbar",null),ai(this,"_initialOptions",Object.create(null)),ai(this,"_initialData",null),ai(this,"_isVisible",!0),ai(this,"_uiManager",null),ai(this,"_focusEventsAllowed",!0),ce(this,ZR,!1),ce(this,iX,Ca._zIndex++),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;const{rotation:i,rawDims:{pageWidth:r,pageHeight:o,pageX:n,pageY:s}}=this.parent.viewport;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,o],this.pageTranslation=[n,s];const[a,l]=this.parentDimensions;this.x=e.x/a,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=Ca.prototype._resizeWithKeyboard,i=vI.TRANSLATE_SMALL,r=vI.TRANSLATE_BIG;return gr(this,"_resizerKeyboardManager",new dI([[["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"],Ca.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return gr(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const i=new kFi({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(Ca._l10n??(Ca._l10n=e),Ca._l10nResizer||(Ca._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"})),Ca._borderLineWidth!==-1)return;const r=getComputedStyle(document.documentElement);Ca._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,i){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,i){Mo("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return S(this,ZR)}set _isDraggable(e){var i;ie(this,ZR,e),(i=this.div)==null||i.classList.toggle("draggable",e)}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=S(this,iX)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):oe(this,jr,kI).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(S(this,X9)?ie(this,X9,!1):this.parent.setSelected(this))}focusout(e){var i;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const r=e.relatedTarget;r!=null&&r.closest(`#${this.id}`)||(e.preventDefault(),(i=this.parent)!=null&&i.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,i,r,o){const[n,s]=this.parentDimensions;[r,o]=this.screenToPageTranslation(r,o),this.x=(e+r)/n,this.y=(i+o)/s,this.fixAndSetPosition()}translate(e,i){oe(this,jr,rX).call(this,this.parentDimensions,e,i)}translateInPage(e,i){S(this,Ha)||ie(this,Ha,[this.x,this.y,this.width,this.height]),oe(this,jr,rX).call(this,this.pageDimensions,e,i),this.div.scrollIntoView({block:"nearest"})}drag(e,i){S(this,Ha)||ie(this,Ha,[this.x,this.y,this.width,this.height]);const{div:r,parentDimensions:[o,n]}=this;if(this.x+=e/o,this.y+=i/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:A}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,A)&&(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!!S(this,Ha)&&(S(this,Ha)[0]!==this.x||S(this,Ha)[1]!==this.y)}get _hasBeenResized(){return!!S(this,Ha)&&(S(this,Ha)[2]!==this.width||S(this,Ha)[3]!==this.height)}getBaseTranslation(){const[e,i]=this.parentDimensions,{_borderLineWidth:r}=Ca,o=r/e,n=r/i;switch(this.rotation){case 90:return[-o,n];case 180:return[o,n];case 270:return[o,-n];default:return[-o,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:i},pageDimensions:[r,o]}=this;let{x:n,y:s,width:a,height:l}=this;if(a*=r,l*=o,n*=r,s*=o,this._mustFixPosition)switch(e){case 0:n=Math.max(0,Math.min(r-a,n)),s=Math.max(0,Math.min(o-l,s));break;case 90:n=Math.max(0,Math.min(r-l,n)),s=Math.min(o,Math.max(a,s));break;case 180:n=Math.min(r,Math.max(a,n)),s=Math.min(o,Math.max(l,s));break;case 270:n=Math.min(r,Math.max(l,n)),s=Math.max(0,Math.min(o-a,s));break}this.x=n/=r,this.y=s/=o;const[c,d]=this.getBaseTranslation();n+=c,s+=d,i.left=`${(100*n).toFixed(2)}%`,i.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,i){var r;return oe(r=Ca,XR,oX).call(r,e,i,this.parentRotation)}pageTranslationToScreen(e,i){var r;return oe(r=Ca,XR,oX).call(r,e,i,360-this.parentRotation)}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(e,i){const[r,o]=this.parentDimensions,{style:n}=this.div;n.width=`${(100*e/r).toFixed(2)}%`,S(this,W9)||(n.height=`${(100*i/o).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:i,width:r}=e,o=r.endsWith("%"),n=!S(this,W9)&&i.endsWith("%");if(o&&n)return;const[s,a]=this.parentDimensions;o||(e.width=`${(100*parseFloat(r)/s).toFixed(2)}%`),!S(this,W9)&&!n&&(e.height=`${(100*parseFloat(i)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=S(this,on))==null||e.finish()}async addEditToolbar(){return this._editToolbar||S(this,$9)?this._editToolbar:(this._editToolbar=new wFi(this),this.div.append(this._editToolbar.render()),S(this,on)&&await this._editToolbar.addAltText(S(this,on)),this._editToolbar)}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=S(this,on))==null||e.destroy())}addContainer(e){var i;const r=(i=this._editToolbar)==null?void 0:i.div;r?r.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){S(this,on)||(axe.initialize(Ca._l10n),ie(this,on,new axe(this)),S(this,Y9)&&(S(this,on).data=S(this,Y9),ie(this,Y9,null)),await this.addEditToolbar())}get altTextData(){var e;return(e=S(this,on))==null?void 0:e.data}set altTextData(e){S(this,on)&&(S(this,on).data=e)}get guessedAltText(){var e;return(e=S(this,on))==null?void 0:e.guessedText}async setGuessedAltText(e){var i;await((i=S(this,on))==null?void 0:i.setGuessedText(e))}serializeAltText(e){var i;return(i=S(this,on))==null?void 0:i.serialize(e)}hasAltText(){return!!S(this,on)&&!S(this,on).isEmpty()}hasAltTextData(){var e;return((e=S(this,on))==null?void 0:e.hasData())??!1}render(){var e;this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=S(this,BI)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),oe(this,jr,lX).call(this);const[i,r]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*r/i).toFixed(2)}%`,this.div.style.maxHeight=`${(100*i/r).toFixed(2)}%`);const[o,n]=this.getInitialTranslation();return this.translate(o,n),kR(this,this.div,["pointerdown"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(S(this,em)||ie(this,em,new uxe({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:oe(this,jr,pxe).bind(this),onPinching:oe(this,jr,gxe).bind(this),onPinchEnd:oe(this,jr,fxe).bind(this),signal:this._uiManager._signal}))),(e=this._uiManager._editorUndoBar)==null||e.hide(),this.div}pointerdown(e){const{isMac:i}=El.platform;if(e.button!==0||e.ctrlKey&&i){e.preventDefault();return}if(ie(this,X9,!0),this._isDraggable){oe(this,jr,mxe).call(this,e);return}oe(this,jr,aX).call(this,e)}get isSelected(){return this._uiManager.isSelected(this)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){S(this,Z1)&&clearTimeout(S(this,Z1)),ie(this,Z1,setTimeout(()=>{var e;ie(this,Z1,null),(e=this.parent)==null||e.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 o=this.parentScale,[n,s]=this.pageDimensions,[a,l]=this.pageTranslation,c=e/o,d=i/o,u=this.x*n,A=this.y*s,h=this.width*n,g=this.height*s;switch(r){case 0:return[u+c+a,s-A-d-g+l,u+c+h+a,s-A-d+l];case 90:return[u+d+a,s-A+c+l,u+d+g+a,s-A+c+h+l];case 180:return[u-c-h+a,s-A+d+l,u-c+a,s-A+d+g+l];case 270:return[u-d-g+a,s-A-c-h+l,u-d+a,s-A-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,i){const[r,o,n,s]=e,a=n-r,l=s-o;switch(this.rotation){case 0:return[r,i-s,a,l];case 90:return[r,i-o,l,a];case 180:return[n,i-o,a,l];case 270:return[n,i-s,l,a];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){ie(this,$9,!0)}disableEditMode(){ie(this,$9,!1)}isInEditMode(){return S(this,$9)}shouldGetKeyboardEvents(){return S(this,Ag)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:i,bottom:r,right:o}=this.getClientDimensions(),{innerHeight:n,innerWidth:s}=window;return i<s&&o>0&&e<n&&r>0}rebuild(){oe(this,jr,lX).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,i=null){Mo("An editor must be serializable")}static async deserialize(e,i,r){const o=new this.prototype.constructor({parent:i,id:i.getNextId(),uiManager:r});o.rotation=e.rotation,ie(o,Y9,e.accessibilityData);const[n,s]=o.pageDimensions,[a,l,c,d]=o.getRectInCurrentCoords(e.rect,s);return o.x=a/n,o.y=l/s,o.width=c/n,o.height=d/s,o}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,i;if((e=S(this,$2))==null||e.abort(),ie(this,$2,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),S(this,Z1)&&(clearTimeout(S(this,Z1)),ie(this,Z1,null)),oe(this,jr,kI).call(this),this.removeEditToolbar(),S(this,Nd)){for(const r of S(this,Nd).values())clearTimeout(r);ie(this,Nd,null)}this.parent=null,(i=S(this,em))==null||i.destroy(),ie(this,em,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(oe(this,jr,Axe).call(this),S(this,Oa).classList.remove("hidden"),kR(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),ie(this,ug,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const i=S(this,Oa).children;if(!S(this,lh)){ie(this,lh,Array.from(i));const s=oe(this,jr,vxe).bind(this),a=oe(this,jr,Cxe).bind(this),l=this._uiManager._signal;for(const c of S(this,lh)){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",oe(this,jr,yxe).bind(this,d),{signal:l}),c.setAttribute("data-l10n-id",Ca._l10nResizer[d])}}const r=S(this,lh)[0];let o=0;for(const s of i){if(s===r)break;o++}const n=(360-this.rotation+this.parentRotation)%360/90*(S(this,lh).length/4);if(n!==o){if(n<o)for(let a=0;a<o-n;a++)S(this,Oa).append(S(this,Oa).firstChild);else if(n>o)for(let a=0;a<n-o;a++)S(this,Oa).firstChild.before(S(this,Oa).lastChild);let s=0;for(const a of i){const l=S(this,lh)[s++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",Ca._l10nResizer[l])}}oe(this,jr,cX).call(this,0),ie(this,Ag,!0),S(this,Oa).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,i){S(this,Ag)&&oe(this,jr,sX).call(this,S(this,YR),{deltaX:e,deltaY:i,fromKeyboard:!0})}_stopResizingWithKeyboard(){oe(this,jr,kI).call(this),this.div.focus()}select(){var e,i,r;if(this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var o,n;(o=this.div)!=null&&o.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(i=this._editToolbar)==null||i.show(),(r=S(this,on))==null||r.toggleAltTextBadge(!1)}unselect(){var e,i,r,o,n;(e=S(this,Oa))==null||e.classList.add("hidden"),(i=this.div)==null||i.classList.remove("selectedEditor"),(r=this.div)!=null&&r.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(o=this._editToolbar)==null||o.hide(),(n=S(this,on))==null||n.toggleAltTextBadge(!0)}updateParams(e,i){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return S(this,WR)}set isEditing(e){ie(this,WR,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,i){ie(this,W9,!0);const r=e/i,{style:o}=this.div;o.aspectRatio=r,o.height="auto"}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){S(this,Nd)||ie(this,Nd,new Map);const{action:r}=e;let o=S(this,Nd).get(r);o&&clearTimeout(o),o=setTimeout(()=>{this._reportTelemetry(e),S(this,Nd).delete(r),S(this,Nd).size===0&&ie(this,Nd,null)},Ca._telemetryTimeout),S(this,Nd).set(r,o);return}e.type||(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),ie(this,BI,!1)}disable(){this.div&&(this.div.tabIndex=-1),ie(this,BI,!0)}renderAnnotationElement(e){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{firstChild:i}=e.container;i?.nodeName==="DIV"&&i.classList.contains("annotationContent")&&i.remove()}};Y9=new WeakMap,lh=new WeakMap,on=new WeakMap,BI=new WeakMap,X2=new WeakMap,JR=new WeakMap,W9=new WeakMap,Oa=new WeakMap,Z9=new WeakMap,ug=new WeakMap,$2=new WeakMap,YR=new WeakMap,X9=new WeakMap,Ha=new WeakMap,WR=new WeakMap,$9=new WeakMap,Ag=new WeakMap,Z1=new WeakMap,EI=new WeakMap,xI=new WeakMap,Nd=new WeakMap,em=new WeakMap,ZR=new WeakMap,iX=new WeakMap,jr=new WeakSet,rX=function([t,e],i,r){[i,r]=this.screenToPageTranslation(i,r),this.x+=i/t,this.y+=r/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},XR=new WeakSet,oX=function(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},$R=function(t){switch(t){case 90:{const[e,i]=this.pageDimensions;return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,i]=this.pageDimensions;return[0,e/i,-i/e,0]}default:return[1,0,0,1]}},Axe=function(){if(S(this,Oa))return;ie(this,Oa,document.createElement("div")),S(this,Oa).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const r=document.createElement("div");S(this,Oa).append(r),r.classList.add("resizer",i),r.setAttribute("data-resizer-name",i),r.addEventListener("pointerdown",oe(this,jr,hxe).bind(this,i),{signal:e}),r.addEventListener("contextmenu",zu,{signal:e}),r.tabIndex=-1}this.div.prepend(S(this,Oa))},hxe=function(t,e){var i;e.preventDefault();const{isMac:r}=El.platform;if(e.button!==0||e.ctrlKey&&r)return;(i=S(this,on))==null||i.toggle(!1);const o=this._isDraggable;this._isDraggable=!1,ie(this,Z9,[e.screenX,e.screenY]);const n=new AbortController,s=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",oe(this,jr,sX).bind(this,t),{passive:!0,capture:!0,signal:s}),window.addEventListener("touchmove",$c,{passive:!1,signal:s}),window.addEventListener("contextmenu",zu,{signal:s}),ie(this,ug,{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(e.target).cursor;const c=()=>{var d;n.abort(),this.parent.togglePointerEvents(!0),(d=S(this,on))==null||d.toggle(!0),this._isDraggable=o,this.parent.div.style.cursor=a,this.div.style.cursor=l,oe(this,jr,eL).call(this)};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})},nX=function(t,e,i,r){this.width=i,this.height=r,this.x=t,this.y=e;const[o,n]=this.parentDimensions;this.setDims(o*i,n*r),this.fixAndSetPosition(),this._onResized()},eL=function(){if(!S(this,ug))return;const{savedX:t,savedY:e,savedWidth:i,savedHeight:r}=S(this,ug);ie(this,ug,null);const o=this.x,n=this.y,s=this.width,a=this.height;o===t&&n===e&&s===i&&a===r||this.addCommands({cmd:oe(this,jr,nX).bind(this,o,n,s,a),undo:oe(this,jr,nX).bind(this,t,e,i,r),mustExec:!0})},sX=function(t,e){const[i,r]=this.parentDimensions,o=this.x,n=this.y,s=this.width,a=this.height,l=Vn.MIN_SIZE/i,c=Vn.MIN_SIZE/r,d=oe(this,jr,$R).call(this,this.rotation),u=(H,U)=>[d[0]*H+d[2]*U,d[1]*H+d[3]*U],A=oe(this,jr,$R).call(this,360-this.rotation),h=(H,U)=>[A[0]*H+A[2]*U,A[1]*H+A[3]*U];let g,p,m=!1,f=!1;switch(t){case"topLeft":m=!0,g=(H,U)=>[0,0],p=(H,U)=>[H,U];break;case"topMiddle":g=(H,U)=>[H/2,0],p=(H,U)=>[H/2,U];break;case"topRight":m=!0,g=(H,U)=>[H,0],p=(H,U)=>[0,U];break;case"middleRight":f=!0,g=(H,U)=>[H,U/2],p=(H,U)=>[0,U/2];break;case"bottomRight":m=!0,g=(H,U)=>[H,U],p=(H,U)=>[0,0];break;case"bottomMiddle":g=(H,U)=>[H/2,U],p=(H,U)=>[H/2,0];break;case"bottomLeft":m=!0,g=(H,U)=>[0,U],p=(H,U)=>[H,0];break;case"middleLeft":f=!0,g=(H,U)=>[0,U/2],p=(H,U)=>[H,U/2];break}const C=g(s,a),y=p(s,a);let v=u(...y);const w=Vn._round(o+v[0]),b=Vn._round(n+v[1]);let E=1,k=1,x,M;if(e.fromKeyboard)({deltaX:x,deltaY:M}=e);else{const{screenX:H,screenY:U}=e,[V,Y]=S(this,Z9);[x,M]=this.screenToPageTranslation(H-V,U-Y),S(this,Z9)[0]=H,S(this,Z9)[1]=U}if([x,M]=h(x/i,M/r),m){const H=Math.hypot(s,a);E=k=Math.max(Math.min(Math.hypot(y[0]-C[0]-x,y[1]-C[1]-M)/H,1/s,1/a),l/s,c/a)}else f?E=Math.max(l,Math.min(1,Math.abs(y[0]-C[0]-x)))/s:k=Math.max(c,Math.min(1,Math.abs(y[1]-C[1]-M)))/a;const D=Vn._round(s*E),P=Vn._round(a*k);v=u(...p(D,P));const T=w-v[0],N=b-v[1];S(this,Ha)||ie(this,Ha,[this.x,this.y,this.width,this.height]),this.width=D,this.height=P,this.x=T,this.y=N,this.setDims(i*D,r*P),this.fixAndSetPosition(),this._onResizing()},pxe=function(){var t;ie(this,ug,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(t=S(this,on))==null||t.toggle(!1),this.parent.togglePointerEvents(!1)},gxe=function(t,e,i){let r=.7*(i/e)+1-.7;if(r===1)return;const o=oe(this,jr,$R).call(this,this.rotation),n=(v,w)=>[o[0]*v+o[2]*w,o[1]*v+o[3]*w],[s,a]=this.parentDimensions,l=this.x,c=this.y,d=this.width,u=this.height,A=Vn.MIN_SIZE/s,h=Vn.MIN_SIZE/a;r=Math.max(Math.min(r,1/d,1/u),A/d,h/u);const g=Vn._round(d*r),p=Vn._round(u*r);if(g===d&&p===u)return;S(this,Ha)||ie(this,Ha,[l,c,d,u]);const m=n(d/2,u/2),f=Vn._round(l+m[0]),C=Vn._round(c+m[1]),y=n(g/2,p/2);this.x=f-y[0],this.y=C-y[1],this.width=g,this.height=p,this.setDims(s*g,a*p),this.fixAndSetPosition(),this._onResizing()},fxe=function(){var t;(t=S(this,on))==null||t.toggle(!0),this.parent.togglePointerEvents(!0),oe(this,jr,eL).call(this)},aX=function(t){const{isMac:e}=El.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},mxe=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const r=new AbortController,o=this._uiManager.combinedSignal(r),n={capture:!0,passive:!1,signal:o},s=l=>{r.abort(),ie(this,X2,null),ie(this,X9,!1),this._uiManager.endDragSession()||oe(this,jr,aX).call(this,l),i&&this._onStopDragging()};e&&(ie(this,EI,t.clientX),ie(this,xI,t.clientY),ie(this,X2,t.pointerId),ie(this,JR,t.pointerType),window.addEventListener("pointermove",l=>{i||(i=!0,this._onStartDragging());const{clientX:c,clientY:d,pointerId:u}=l;if(u!==S(this,X2)){$c(l);return}const[A,h]=this.screenToPageTranslation(c-S(this,EI),d-S(this,xI));ie(this,EI,c),ie(this,xI,d),this._uiManager.dragSelectedEditors(A,h)},n),window.addEventListener("touchmove",$c,n),window.addEventListener("pointerdown",l=>{l.pointerType===S(this,JR)&&(S(this,em)||l.isPrimary)&&s(l),$c(l)},n));const a=l=>{if(!S(this,X2)||S(this,X2)===l.pointerId){s(l);return}$c(l)};window.addEventListener("pointerup",a,{signal:o}),window.addEventListener("blur",a,{signal:o})},lX=function(){if(S(this,$2)||!this.div)return;ie(this,$2,new AbortController);const t=this._uiManager.combinedSignal(S(this,$2));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},vxe=function(t){Vn._resizerKeyboardManager.exec(this,t)},Cxe=function(t){var e;S(this,Ag)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==S(this,Oa)&&oe(this,jr,kI).call(this)},yxe=function(t){ie(this,YR,S(this,Ag)?t:"")},cX=function(t){if(S(this,lh))for(const e of S(this,lh))e.tabIndex=t},kI=function(){ie(this,Ag,!1),oe(this,jr,cX).call(this,-1),oe(this,jr,eL).call(this)},ce(Vn,XR),ai(Vn,"_l10n",null),ai(Vn,"_l10nResizer",null),ai(Vn,"_borderLineWidth",-1),ai(Vn,"_colorManager",new xFi),ai(Vn,"_zIndex",1),ai(Vn,"_telemetryTimeout",1e3);let Gn=Vn;class kFi extends Gn{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const wxe=3285377520,_d=4294901760,ch=65535;let bxe=class{constructor(t){this.h1=t?t&4294967295:wxe,this.h2=t?t&4294967295:wxe}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,p=t.length;g<p;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,o=i-r*4,n=new Uint32Array(e.buffer,0,r);let s=0,a=0,l=this.h1,c=this.h2;const d=3432918353,u=461845907,A=d&ch,h=u&ch;for(let g=0;g<r;g++)g&1?(s=n[g],s=s*d&_d|s*A&ch,s=s<<15|s>>>17,s=s*u&_d|s*h&ch,l^=s,l=l<<13|l>>>19,l=l*5+3864292196):(a=n[g],a=a*d&_d|a*A&ch,a=a<<15|a>>>17,a=a*u&_d|a*h&ch,c^=a,c=c<<13|c>>>19,c=c*5+3864292196);switch(s=0,o){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&_d|s*A&ch,s=s<<15|s>>>17,s=s*u&_d|s*h&ch,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&_d|t*36045&ch,e=e*4283543511&_d|((e<<16|t>>>16)*2950163797&_d)>>>16,t^=e>>>1,t=t*444984403&_d|t*60499&ch,e=e*3301882366&_d|((e<<16|t>>>16)*3120437893&_d)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}};const dX=Object.freeze({map:null,hash:"",transfer:void 0});var e6,t6,sa,uX,Ixe;class AX{constructor(){ce(this,uX),ce(this,e6,!1),ce(this,t6,null),ce(this,sa,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,i){const r=S(this,sa).get(e);return r===void 0?i:Object.assign(i,r)}getRawValue(e){return S(this,sa).get(e)}remove(e){if(S(this,sa).delete(e),S(this,sa).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const i of S(this,sa).values())if(i instanceof Gn)return;this.onAnnotationEditor(null)}}setValue(e,i){const r=S(this,sa).get(e);let o=!1;if(r!==void 0)for(const[n,s]of Object.entries(i))r[n]!==s&&(o=!0,r[n]=s);else o=!0,S(this,sa).set(e,i);o&&oe(this,uX,Ixe).call(this),i instanceof Gn&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(i.constructor._type)}has(e){return S(this,sa).has(e)}getAll(){return S(this,sa).size>0?PZ(S(this,sa)):null}setAll(e){for(const[i,r]of Object.entries(e))this.setValue(i,r)}get size(){return S(this,sa).size}resetModified(){S(this,e6)&&(ie(this,e6,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Bxe(this)}get serializable(){if(S(this,sa).size===0)return dX;const e=new Map,i=new bxe,r=[],o=Object.create(null);let n=!1;for(const[s,a]of S(this,sa)){const l=a instanceof Gn?a.serialize(!1,o):a;l&&(e.set(s,l),i.update(`${s}:${JSON.stringify(l)}`),n||(n=!!l.bitmap))}if(n)for(const s of e.values())s.bitmap&&r.push(s.bitmap);return e.size>0?{map:e,hash:i.hexdigest(),transfer:r}:dX}get editorStats(){let e=null;const i=new Map;for(const r of S(this,sa).values()){if(!(r instanceof Gn))continue;const o=r.telemetryFinalData;if(!o)continue;const{type:n}=o;i.has(n)||i.set(n,Object.getPrototypeOf(r).constructor),e||(e=Object.create(null));const s=e[n]||(e[n]=new Map);for(const[a,l]of Object.entries(o)){if(a==="type")continue;let c=s.get(a);c||(c=new Map,s.set(a,c));const d=c.get(l)??0;c.set(l,d+1)}}for(const[r,o]of i)e[r]=o.computeTelemetryFinalData(e[r]);return e}resetModifiedIds(){ie(this,t6,null)}get modifiedIds(){if(S(this,t6))return S(this,t6);const e=[];for(const i of S(this,sa).values())!(i instanceof Gn)||!i.annotationElementId||!i.serialize()||e.push(i.annotationElementId);return ie(this,t6,{ids:new Set(e),hash:e.join(",")})}}e6=new WeakMap,t6=new WeakMap,sa=new WeakMap,uX=new WeakSet,Ixe=function(){S(this,e6)||(ie(this,e6,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var tL;class Bxe extends AX{constructor(e){super(),ce(this,tL);const{map:i,hash:r,transfer:o}=e.serializable,n=structuredClone(i,o?{transfer:o}:null);ie(this,tL,{map:n,hash:r,transfer:o})}get print(){Mo("Should not call PrintAnnotationStorage.print")}get serializable(){return S(this,tL)}get modifiedIds(){return gr(this,"modifiedIds",{ids:new Set,hash:""})}}tL=new WeakMap;var MI;class MFi{constructor({ownerDocument:e=globalThis.document,styleElement:i=null}){ce(this,MI,new Set),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(),S(this,MI).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:i}){if(!(!e||S(this,MI).has(e.loadedName))){if($n(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:r,src:o,style:n}=e,s=new FontFace(r,o,n);this.addNativeFontFace(s);try{await s.load(),S(this,MI).add(r),i?.(e)}catch{or(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(s)}return}Mo("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(o){throw or(`Failed to load font '${r.family}': '${o}'.`),e.disableFontFace=!0,o}}return}const i=e.createFontFaceRule();if(i){if(this.insertRule(i),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const o=this._queueLoadingCallback(r);this._prepareFontLoadEvent(e,o)})}}get isFontLoadingAPISupported(){var e;const i=!!((e=this._document)!=null&&e.fonts);return gr(this,"isFontLoadingAPISupported",i)}get isSyncFontLoadingSupported(){let e=!1;return(Ua||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),gr(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){function i(){for($n(!o.done,"completeRequest() cannot be called twice."),o.done=!0;r.length>0&&r[0].done;){const n=r.shift();setTimeout(n.callback,0)}}const{loadingRequests:r}=this,o={done:!1,complete:i,callback:e};return r.push(o),o}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return gr(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,i){function r(y,v){return y.charCodeAt(v)<<24|y.charCodeAt(v+1)<<16|y.charCodeAt(v+2)<<8|y.charCodeAt(v+3)&255}function o(y,v,w,b){const E=y.substring(0,v),k=y.substring(v+w);return E+b+k}let n,s;const a=this._document.createElement("canvas");a.width=1,a.height=1;const l=a.getContext("2d");let c=0;function d(y,v){if(++c>30){or("Load test font never loaded."),v();return}if(l.font="30px "+y,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){v();return}setTimeout(d.bind(null,y,v))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let A=this._loadTestFont;A=o(A,976,u.length,u);const h=16,g=1482184792;let p=r(A,h);for(n=0,s=u.length-3;n<s;n+=4)p=p-g+r(u,n)|0;n<u.length&&(p=p-g+r(u+"XXX",n)|0),A=o(A,h,4,dFi(p));const m=`url(data:font/opentype;base64,${btoa(A)});`,f=`@font-face {font-family:"${u}";src:${m}}`;this.insertRule(f);const C=this._document.createElement("div");C.style.visibility="hidden",C.style.width=C.style.height="10px",C.style.position="absolute",C.style.top=C.style.left="0px";for(const y of[e.loadedName,u]){const v=this._document.createElement("span");v.textContent="Hi",v.style.fontFamily=y,C.append(v)}this._document.body.append(C),d(u,()=>{C.remove(),i.complete()})}}MI=new WeakMap;class SFi{constructor(e,{disableFontFace:i=!1,fontExtraProperties:r=!1,inspectFont:o=null}){this.compiledGlyphs=Object.create(null);for(const n in e)this[n]=e[n];this.disableFontFace=i===!0,this.fontExtraProperties=r===!0,this._inspectFont=o}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let i;if(!this.cssFontInfo)i=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),i=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return(e=this._inspectFont)==null||e.call(this,this),i}createFontFaceRule(){var e;if(!this.data||this.disableFontFace)return null;const i=`url(data:${this.mimetype};base64,${fFi(this.data)});`;let r;if(!this.cssFontInfo)r=`@font-face {font-family:"${this.loadedName}";src:${i}}`;else{let o=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(o+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),r=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${o}src:${i}}`}return(e=this._inspectFont)==null||e.call(this,this,i),r}getPathGenerator(e,i){if(this.compiledGlyphs[i]!==void 0)return this.compiledGlyphs[i];const r=this.loadedName+"_path_"+i;let o;try{o=e.get(r)}catch(s){or(`getPathGenerator - ignoring character: "${s}".`)}const n=new Path2D(o||"");return this.fontExtraProperties||e.delete(r),this.compiledGlyphs[i]=n}}const iL={DATA:1,ERROR:2},ts={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Exe(){}function cc(t){if(t instanceof og||t instanceof DZ||t instanceof rI||t instanceof UEe||t instanceof vR||t instanceof QZ)return t;switch(t instanceof Error||typeof t=="object"&&t!==null||Mo('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new og(t.message);case"InvalidPDFException":return new DZ(t.message);case"MissingPDFException":return new rI(t.message);case"PasswordException":return new UEe(t.message,t.code);case"UnexpectedResponseException":return new vR(t.message,t.status);case"UnknownErrorException":return new QZ(t.message,t.details)}return new QZ(t.message,t.toString())}var SI,hg,xxe,kxe,Mxe,rL,Sxe;let QI=(Sxe=class{constructor(t,e,i){ce(this,hg),ce(this,SI,new AbortController),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",oe(this,hg,xxe).bind(this),{signal:S(this,SI).signal})}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++,o=Promise.withResolvers();this.callbackCapabilities[r]=o;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:r,data:e},i)}catch(n){o.reject(n)}return o.promise}sendWithStream(t,e,i,r){const o=this.streamId++,n=this.sourceName,s=this.targetName,a=this.comObj;return new ReadableStream({start:l=>{const c=Promise.withResolvers();return this.streamControllers[o]={controller:l,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},a.postMessage({sourceName:n,targetName:s,action:t,streamId:o,data:e,desiredSize:l.desiredSize},r),c.promise},pull:l=>{const c=Promise.withResolvers();return this.streamControllers[o].pullCall=c,a.postMessage({sourceName:n,targetName:s,stream:ts.PULL,streamId:o,desiredSize:l.desiredSize}),c.promise},cancel:l=>{$n(l instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[o].cancelCall=c,this.streamControllers[o].isClosed=!0,a.postMessage({sourceName:n,targetName:s,stream:ts.CANCEL,streamId:o,reason:cc(l)}),c.promise}},i)}destroy(){var t;(t=S(this,SI))==null||t.abort(),ie(this,SI,null)}},SI=new WeakMap,hg=new WeakSet,xxe=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){oe(this,hg,Mxe).call(this,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===iL.DATA)r.resolve(t.data);else if(t.callback===iL.ERROR)r.reject(cc(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,o=this.comObj;Promise.try(e,t.data).then(function(n){o.postMessage({sourceName:i,targetName:r,callback:iL.DATA,callbackId:t.callbackId,data:n})},function(n){o.postMessage({sourceName:i,targetName:r,callback:iL.ERROR,callbackId:t.callbackId,reason:cc(n)})});return}if(t.streamId){oe(this,hg,kxe).call(this,t);return}e(t.data)},kxe=function(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,n=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),o.postMessage({sourceName:i,targetName:r,stream:ts.ENQUEUE,streamId:e,chunk:l},d)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:ts.CLOSE,streamId:e}),delete n.streamSinks[e])},error(l){$n(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:ts.ERROR,streamId:e,reason:cc(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(){o.postMessage({sourceName:i,targetName:r,stream:ts.START_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:ts.START_COMPLETE,streamId:e,reason:cc(l)})})},Mxe=function(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,n=this.streamControllers[e],s=this.streamSinks[e];switch(t.stream){case ts.START_COMPLETE:t.success?n.startCall.resolve():n.startCall.reject(cc(t.reason));break;case ts.PULL_COMPLETE:t.success?n.pullCall.resolve():n.pullCall.reject(cc(t.reason));break;case ts.PULL:if(!s){o.postMessage({sourceName:i,targetName:r,stream:ts.PULL_COMPLETE,streamId:e,success:!0});break}s.desiredSize<=0&&t.desiredSize>0&&s.sinkCapability.resolve(),s.desiredSize=t.desiredSize,Promise.try(s.onPull||Exe).then(function(){o.postMessage({sourceName:i,targetName:r,stream:ts.PULL_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:ts.PULL_COMPLETE,streamId:e,reason:cc(l)})});break;case ts.ENQUEUE:if($n(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(t.chunk);break;case ts.CLOSE:if($n(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),oe(this,hg,rL).call(this,n,e);break;case ts.ERROR:$n(n,"error should have stream controller"),n.controller.error(cc(t.reason)),oe(this,hg,rL).call(this,n,e);break;case ts.CANCEL_COMPLETE:t.success?n.cancelCall.resolve():n.cancelCall.reject(cc(t.reason)),oe(this,hg,rL).call(this,n,e);break;case ts.CANCEL:if(!s)break;const a=cc(t.reason);Promise.try(s.onCancel||Exe,a).then(function(){o.postMessage({sourceName:i,targetName:r,stream:ts.CANCEL_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:ts.CANCEL_COMPLETE,streamId:e,reason:cc(l)})}),s.sinkCapability.reject(a),s.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},rL=async function(t,e){var i,r,o;await Promise.allSettled([(i=t.startCall)==null?void 0:i.promise,(r=t.pullCall)==null?void 0:r.promise,(o=t.cancelCall)==null?void 0:o.promise]),delete this.streamControllers[e]},Sxe);var oL;class Qxe{constructor({enableHWA:e=!1}){ce(this,oL,!1),ie(this,oL,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:!S(this,oL)})}}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){Mo("Abstract method `_createCanvas` called.")}}oL=new WeakMap;class QFi extends Qxe{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 Dxe{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){Mo("Abstract method `_fetch` called.")}}class Pxe extends Dxe{async _fetch(e){const i=await wR(e,this.isCompressed?"arraybuffer":"text");return i instanceof ArrayBuffer?new Uint8Array(i):CR(i)}}class Rxe{addFilter(e){return"none"}addHCMFilter(e,i){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,i,r,o,n){return"none"}destroy(e=!1){}}var i6,r6,pg,gg,kl,tm,o6,xi,Va,DI,n6,nL,s6,Lxe,hX,a6,PI,RI,pX,LI;class DFi extends Rxe{constructor({docId:e,ownerDocument:i=globalThis.document}){super(),ce(this,xi),ce(this,i6),ce(this,r6),ce(this,pg),ce(this,gg),ce(this,kl),ce(this,tm),ce(this,o6,0),ie(this,gg,e),ie(this,kl,i)}addFilter(e){if(!e)return"none";let i=S(this,xi,Va).get(e);if(i)return i;const[r,o,n]=oe(this,xi,nL).call(this,e),s=e.length===1?r:`${r}${o}${n}`;if(i=S(this,xi,Va).get(s),i)return S(this,xi,Va).set(e,i),i;const a=`g_${S(this,gg)}_transfer_map_${_l(this,o6)._++}`,l=oe(this,xi,s6).call(this,a);S(this,xi,Va).set(e,l),S(this,xi,Va).set(s,l);const c=oe(this,xi,a6).call(this,a);return oe(this,xi,RI).call(this,r,o,n,c),l}addHCMFilter(e,i){var r;const o=`${e}-${i}`,n="base";let s=S(this,xi,DI).get(n);if(s?.key===o||(s?((r=s.filter)==null||r.remove(),s.key=o,s.url="none",s.filter=null):(s={key:o,url:"none",filter:null},S(this,xi,DI).set(n,s)),!e||!i))return s.url;const a=oe(this,xi,LI).call(this,e);e=bi.makeHexColor(...a);const l=oe(this,xi,LI).call(this,i);if(i=bi.makeHexColor(...l),S(this,xi,n6).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return s.url;const c=new Array(256);for(let g=0;g<=255;g++){const p=g/255;c[g]=p<=.03928?p/12.92:((p+.055)/1.055)**2.4}const d=c.join(","),u=`g_${S(this,gg)}_hcm_filter`,A=s.filter=oe(this,xi,a6).call(this,u);oe(this,xi,RI).call(this,d,d,d,A),oe(this,xi,hX).call(this,A);const h=(g,p)=>{const m=a[g]/255,f=l[g]/255,C=new Array(p+1);for(let y=0;y<=p;y++)C[y]=m+y/p*(f-m);return C.join(",")};return oe(this,xi,RI).call(this,h(0,5),h(1,5),h(2,5),A),s.url=oe(this,xi,s6).call(this,u),s.url}addAlphaFilter(e){let i=S(this,xi,Va).get(e);if(i)return i;const[r]=oe(this,xi,nL).call(this,[e]),o=`alpha_${r}`;if(i=S(this,xi,Va).get(o),i)return S(this,xi,Va).set(e,i),i;const n=`g_${S(this,gg)}_alpha_map_${_l(this,o6)._++}`,s=oe(this,xi,s6).call(this,n);S(this,xi,Va).set(e,s),S(this,xi,Va).set(o,s);const a=oe(this,xi,a6).call(this,n);return oe(this,xi,pX).call(this,r,a),s}addLuminosityFilter(e){let i=S(this,xi,Va).get(e||"luminosity");if(i)return i;let r,o;if(e?([r]=oe(this,xi,nL).call(this,[e]),o=`luminosity_${r}`):o="luminosity",i=S(this,xi,Va).get(o),i)return S(this,xi,Va).set(e,i),i;const n=`g_${S(this,gg)}_luminosity_map_${_l(this,o6)._++}`,s=oe(this,xi,s6).call(this,n);S(this,xi,Va).set(e,s),S(this,xi,Va).set(o,s);const a=oe(this,xi,a6).call(this,n);return oe(this,xi,Lxe).call(this,a),e&&oe(this,xi,pX).call(this,r,a),s}addHighlightHCMFilter(e,i,r,o,n){var s;const a=`${i}-${r}-${o}-${n}`;let l=S(this,xi,DI).get(e);if(l?.key===a||(l?((s=l.filter)==null||s.remove(),l.key=a,l.url="none",l.filter=null):(l={key:a,url:"none",filter:null},S(this,xi,DI).set(e,l)),!i||!r))return l.url;const[c,d]=[i,r].map(oe(this,xi,LI).bind(this));let u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),A=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[h,g]=[o,n].map(oe(this,xi,LI).bind(this));A<u&&([u,A,h,g]=[A,u,g,h]),S(this,xi,n6).style.color="";const p=(C,y,v)=>{const w=new Array(256),b=(A-u)/v,E=C/255,k=(y-C)/(255*v);let x=0;for(let M=0;M<=v;M++){const D=Math.round(u+M*b),P=E+M*k;for(let T=x;T<=D;T++)w[T]=P;x=D+1}for(let M=x;M<256;M++)w[M]=w[x-1];return w.join(",")},m=`g_${S(this,gg)}_hcm_${e}_filter`,f=l.filter=oe(this,xi,a6).call(this,m);return oe(this,xi,hX).call(this,f),oe(this,xi,RI).call(this,p(h[0],g[0],5),p(h[1],g[1],5),p(h[2],g[2],5),f),l.url=oe(this,xi,s6).call(this,m),l.url}destroy(e=!1){var i,r,o,n;e&&(i=S(this,tm))!=null&&i.size||((r=S(this,pg))==null||r.parentNode.parentNode.remove(),ie(this,pg,null),(o=S(this,r6))==null||o.clear(),ie(this,r6,null),(n=S(this,tm))==null||n.clear(),ie(this,tm,null),ie(this,o6,0))}}i6=new WeakMap,r6=new WeakMap,pg=new WeakMap,gg=new WeakMap,kl=new WeakMap,tm=new WeakMap,o6=new WeakMap,xi=new WeakSet,Va=function(){return S(this,r6)||ie(this,r6,new Map)},DI=function(){return S(this,tm)||ie(this,tm,new Map)},n6=function(){if(!S(this,pg)){const t=S(this,kl).createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;const i=S(this,kl).createElementNS(H1,"svg");i.setAttribute("width",0),i.setAttribute("height",0),ie(this,pg,S(this,kl).createElementNS(H1,"defs")),t.append(i),i.append(S(this,pg)),S(this,kl).body.append(t)}return S(this,pg)},nL=function(t){if(t.length===1){const a=t[0],l=new Array(256);for(let d=0;d<256;d++)l[d]=a[d]/255;const c=l.join(",");return[c,c,c]}const[e,i,r]=t,o=new Array(256),n=new Array(256),s=new Array(256);for(let a=0;a<256;a++)o[a]=e[a]/255,n[a]=i[a]/255,s[a]=r[a]/255;return[o.join(","),n.join(","),s.join(",")]},s6=function(t){if(S(this,i6)===void 0){ie(this,i6,"");const e=S(this,kl).URL;e!==S(this,kl).baseURI&&(bR(e)?or('#createUrl: ignore "data:"-URL for performance reasons.'):ie(this,i6,e.split("#",1)[0]))}return`url(${S(this,i6)}#${t})`},Lxe=function(t){const e=S(this,kl).createElementNS(H1,"feColorMatrix");e.setAttribute("type","matrix"),e.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"),t.append(e)},hX=function(t){const e=S(this,kl).createElementNS(H1,"feColorMatrix");e.setAttribute("type","matrix"),e.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"),t.append(e)},a6=function(t){const e=S(this,kl).createElementNS(H1,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),S(this,xi,n6).append(e),e},PI=function(t,e,i){const r=S(this,kl).createElementNS(H1,e);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),t.append(r)},RI=function(t,e,i,r){const o=S(this,kl).createElementNS(H1,"feComponentTransfer");r.append(o),oe(this,xi,PI).call(this,o,"feFuncR",t),oe(this,xi,PI).call(this,o,"feFuncG",e),oe(this,xi,PI).call(this,o,"feFuncB",i)},pX=function(t,e){const i=S(this,kl).createElementNS(H1,"feComponentTransfer");e.append(i),oe(this,xi,PI).call(this,i,"feFuncA",t)},LI=function(t){return S(this,xi,n6).style.color=t,HZ(getComputedStyle(S(this,xi,n6)).getPropertyValue("color"))};class Txe{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){Mo("Abstract method `_fetch` called.")}}class Fxe extends Txe{async _fetch(e){const i=await wR(e,"arraybuffer");return new Uint8Array(i)}}Ua&&or("Please use the `legacy` build in Node.js environments.");async function Uxe(t){const e=await process.getBuiltinModule("fs").promises.readFile(t);return new Uint8Array(e)}class PFi extends Rxe{}class RFi extends Qxe{_createCanvas(e,i){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,i)}}class LFi extends Dxe{async _fetch(e){return Uxe(e)}}class TFi extends Txe{async _fetch(e){return Uxe(e)}}const Ga={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function gX(t,e){if(!e)return;const i=e[2]-e[0],r=e[3]-e[1],o=new Path2D;o.rect(e[0],e[1],i,r),t.clip(o)}class fX{getPattern(){Mo("Abstract method `getPattern` called.")}}class FFi extends fX{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}_createGradient(e){let i;this._type==="axial"?i=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(i=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const r of this._colorStops)i.addColorStop(r[0],r[1]);return i}getPattern(e,i,r,o){let n;if(o===Ga.STROKE||o===Ga.FILL){const s=i.current.getClippedPathBoundingBox(o,tn(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=bi.transform(r,[1,0,0,1,s[0],s[1]]),d.transform(...i.baseTransform),this.matrix&&d.transform(...this.matrix),gX(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),n=e.createPattern(c.canvas,"no-repeat");const u=new DOMMatrix(r);n.setTransform(u)}else gX(e,this._bbox),n=this._createGradient(e);return n}}function mX(t,e,i,r,o,n,s,a){const l=e.coords,c=e.colors,d=t.data,u=t.width*4;let A;l[i+1]>l[r+1]&&(A=i,i=r,r=A,A=n,n=s,s=A),l[r+1]>l[o+1]&&(A=r,r=o,o=A,A=s,s=a,a=A),l[i+1]>l[r+1]&&(A=i,i=r,r=A,A=n,n=s,s=A);const h=(l[i]+e.offsetX)*e.scaleX,g=(l[i+1]+e.offsetY)*e.scaleY,p=(l[r]+e.offsetX)*e.scaleX,m=(l[r+1]+e.offsetY)*e.scaleY,f=(l[o]+e.offsetX)*e.scaleX,C=(l[o+1]+e.offsetY)*e.scaleY;if(g>=C)return;const y=c[n],v=c[n+1],w=c[n+2],b=c[s],E=c[s+1],k=c[s+2],x=c[a],M=c[a+1],D=c[a+2],P=Math.round(g),T=Math.round(C);let N,H,U,V,Y,re,de,xe;for(let pe=P;pe<=T;pe++){if(pe<m){const Z=pe<g?0:(g-pe)/(g-m);N=h-(h-p)*Z,H=y-(y-b)*Z,U=v-(v-E)*Z,V=w-(w-k)*Z}else{let Z;pe>C?Z=1:m===C?Z=0:Z=(m-pe)/(m-C),N=p-(p-f)*Z,H=b-(b-x)*Z,U=E-(E-M)*Z,V=k-(k-D)*Z}let Ee;pe<g?Ee=0:pe>C?Ee=1:Ee=(g-pe)/(g-C),Y=h-(h-f)*Ee,re=y-(y-x)*Ee,de=v-(v-M)*Ee,xe=w-(w-D)*Ee;const Ae=Math.round(Math.min(N,Y)),Fe=Math.round(Math.max(N,Y));let be=u*pe+Ae*4;for(let Z=Ae;Z<=Fe;Z++)Ee=(N-Z)/(N-Y),Ee<0?Ee=0:Ee>1&&(Ee=1),d[be++]=H-(H-re)*Ee|0,d[be++]=U-(U-de)*Ee|0,d[be++]=V-(V-xe)*Ee|0,d[be++]=255}}function UFi(t,e,i){const r=e.coords,o=e.colors;let n,s;switch(e.type){case"lattice":const a=e.verticesPerRow,l=Math.floor(r.length/a)-1,c=a-1;for(n=0;n<l;n++){let d=n*a;for(let u=0;u<c;u++,d++)mX(t,i,r[d],r[d+1],r[d+a],o[d],o[d+1],o[d+a]),mX(t,i,r[d+a+1],r[d+1],r[d+a],o[d+a+1],o[d+1],o[d+a])}break;case"triangles":for(n=0,s=r.length;n<s;n+=3)mX(t,i,r[n],r[n+1],r[n+2],o[n],o[n+1],o[n+2]);break;default:throw new Error("illegal figure")}}class NFi extends fX{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,i,r){const o=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-o,a=Math.ceil(this._bounds[3])-n,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,A={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-n,scaleX:1/d,scaleY:1/u},h=l+2*2,g=c+2*2,p=r.getCanvas("mesh",h,g),m=p.context,f=m.createImageData(l,c);if(i){const C=f.data;for(let y=0,v=C.length;y<v;y+=4)C[y]=i[0],C[y+1]=i[1],C[y+2]=i[2],C[y+3]=255}for(const C of this._figures)UFi(f,C,A);return m.putImageData(f,2,2),{canvas:p.canvas,offsetX:o-2*d,offsetY:n-2*u,scaleX:d,scaleY:u}}getPattern(e,i,r,o){gX(e,this._bbox);let n;if(o===Ga.SHADING)n=bi.singularValueDecompose2dScale(tn(e));else if(n=bi.singularValueDecompose2dScale(i.baseTransform),this.matrix){const a=bi.singularValueDecompose2dScale(this.matrix);n=[n[0]*a[0],n[1]*a[1]]}const s=this._createMeshCanvas(n,o===Ga.SHADING?null:this._background,i.cachedCanvases);return o!==Ga.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 _Fi extends fX{getPattern(){return"hotpink"}}function OFi(t){switch(t[0]){case"RadialAxial":return new FFi(t);case"Mesh":return new NFi(t);case"Dummy":return new _Fi}throw new Error(`Unknown IR type: ${t[0]}`)}const Nxe={COLORED:1,UNCOLORED:2},_xe=class WPe{constructor(e,i,r,o,n){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.color=i,this.ctx=r,this.canvasGraphicsFactory=o,this.baseTransform=n}createPatternCanvas(e){const{bbox:i,operatorList:r,paintType:o,tilingType:n,color:s,canvasGraphicsFactory:a}=this;let{xstep:l,ystep:c}=this;l=Math.abs(l),c=Math.abs(c),mR("TilingType: "+n);const d=i[0],u=i[1],A=i[2],h=i[3],g=A-d,p=h-u,m=bi.singularValueDecompose2dScale(this.matrix),f=bi.singularValueDecompose2dScale(this.baseTransform),C=m[0]*f[0],y=m[1]*f[1];let v=g,w=p,b=!1,E=!1;const k=Math.ceil(l*C),x=Math.ceil(c*y),M=Math.ceil(g*C),D=Math.ceil(p*y);k>=M?v=l:b=!0,x>=D?w=c:E=!0;const P=this.getSizeAndScale(v,this.ctx.canvas.width,C),T=this.getSizeAndScale(w,this.ctx.canvas.height,y),N=e.cachedCanvases.getCanvas("pattern",P.size,T.size),H=N.context,U=a.createCanvasGraphics(H);if(U.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(U,o,s),H.translate(-P.scale*d,-T.scale*u),U.transform(P.scale,0,0,T.scale,0,0),H.save(),this.clipBbox(U,d,u,A,h),U.baseTransform=tn(U.ctx),U.executeOperatorList(r),U.endDrawing(),H.restore(),b||E){const V=N.canvas;b&&(v=l),E&&(w=c);const Y=this.getSizeAndScale(v,this.ctx.canvas.width,C),re=this.getSizeAndScale(w,this.ctx.canvas.height,y),de=Y.size,xe=re.size,pe=e.cachedCanvases.getCanvas("pattern-workaround",de,xe),Ee=pe.context,Ae=b?Math.floor(g/l):0,Fe=E?Math.floor(p/c):0;for(let be=0;be<=Ae;be++)for(let Z=0;Z<=Fe;Z++)Ee.drawImage(V,de*be,xe*Z,de,xe,0,0,de,xe);return{canvas:pe.canvas,scaleX:Y.scale,scaleY:re.scale,offsetX:d,offsetY:u}}return{canvas:N.canvas,scaleX:P.scale,scaleY:T.scale,offsetX:d,offsetY:u}}getSizeAndScale(e,i,r){const o=Math.max(WPe.MAX_PATTERN_SIZE,i);let n=Math.ceil(e*r);return n>=o?n=o:r=n/e,{scale:r,size:n}}clipBbox(e,i,r,o,n){const s=o-i,a=n-r;e.ctx.rect(i,r,s,a),e.current.updateRectMinMax(tn(e.ctx),[i,r,o,n]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,i,r){const o=e.ctx,n=e.current;switch(i){case Nxe.COLORED:const s=this.ctx;o.fillStyle=s.fillStyle,o.strokeStyle=s.strokeStyle,n.fillColor=s.fillStyle,n.strokeColor=s.strokeStyle;break;case Nxe.UNCOLORED:const a=bi.makeHexColor(r[0],r[1],r[2]);o.fillStyle=a,o.strokeStyle=a,n.fillColor=a,n.strokeColor=a;break;default:throw new cFi(`Unsupported paint type: ${i}`)}}getPattern(e,i,r,o){let n=r;o!==Ga.SHADING&&(n=bi.transform(n,i.baseTransform),this.matrix&&(n=bi.transform(n,this.matrix)));const s=this.createPatternCanvas(i);let a=new DOMMatrix(n);a=a.translate(s.offsetX,s.offsetY),a=a.scale(1/s.scaleX,1/s.scaleY);const l=e.createPattern(s.canvas,"repeat");return l.setTransform(a),l}};ai(_xe,"MAX_PATTERN_SIZE",3e3);let HFi=_xe;function VFi({src:t,srcPos:e=0,dest:i,width:r,height:o,nonBlackColor:n=4294967295,inverseDecode:s=!1}){const a=El.isLittleEndian?4278190080:255,[l,c]=s?[n,a]:[a,n],d=r>>3,u=r&7,A=t.length;i=new Uint32Array(i.buffer);let h=0;for(let g=0;g<o;g++){for(const m=e+d;e<m;e++){const f=e<A?t[e]:255;i[h++]=f&128?c:l,i[h++]=f&64?c:l,i[h++]=f&32?c:l,i[h++]=f&16?c:l,i[h++]=f&8?c:l,i[h++]=f&4?c:l,i[h++]=f&2?c:l,i[h++]=f&1?c:l}if(u===0)continue;const p=e<A?t[e++]:255;for(let m=0;m<u;m++)i[h++]=p&1<<7-m?c:l}return{srcPos:e,destPos:h}}const Oxe=16,Hxe=100,GFi=15,Vxe=10,Gxe=1e3,dc=16;function jFi(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,o,n,s,a){e.transform(i,r,o,n,s,a),this.__originalTransform(i,r,o,n,s,a)},t.setTransform=function(i,r,o,n,s,a){e.setTransform(i,r,o,n,s,a),this.__originalSetTransform(i,r,o,n,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,o,n,s,a){e.bezierCurveTo(i,r,o,n,s,a),this.__originalBezierCurveTo(i,r,o,n,s,a)},t.rect=function(i,r,o,n){e.rect(i,r,o,n),this.__originalRect(i,r,o,n)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class zFi{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,i,r){let o;return this.cache[e]!==void 0?(o=this.cache[e],this.canvasFactory.reset(o,i,r)):(o=this.canvasFactory.create(i,r),this.cache[e]=o),o}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 sL(t,e,i,r,o,n,s,a,l,c){const[d,u,A,h,g,p]=tn(t);if(u===0&&A===0){const C=s*d+g,y=Math.round(C),v=a*h+p,w=Math.round(v),b=(s+l)*d+g,E=Math.abs(Math.round(b)-y)||1,k=(a+c)*h+p,x=Math.abs(Math.round(k)-w)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(h),y,w),t.drawImage(e,i,r,o,n,0,0,E,x),t.setTransform(d,u,A,h,g,p),[E,x]}if(d===0&&h===0){const C=a*A+g,y=Math.round(C),v=s*u+p,w=Math.round(v),b=(a+c)*A+g,E=Math.abs(Math.round(b)-y)||1,k=(s+l)*u+p,x=Math.abs(Math.round(k)-w)||1;return t.setTransform(0,Math.sign(u),Math.sign(A),0,y,w),t.drawImage(e,i,r,o,n,0,0,x,E),t.setTransform(d,u,A,h,g,p),[x,E]}t.drawImage(e,i,r,o,n,s,a,l,c);const m=Math.hypot(d,u),f=Math.hypot(A,h);return[m*l,f*c]}function qFi(t){const{width:e,height:i}=t;if(e>Gxe||i>Gxe)return null;const r=1e3,o=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=e+1;let s=new Uint8Array(n*(i+1)),a,l,c;const d=e+7&-8;let u=new Uint8Array(d*i),A=0;for(const m of t.data){let f=128;for(;f>0;)u[A++]=m&f?0:255,f>>=1}let h=0;for(A=0,u[A]!==0&&(s[0]=1,++h),l=1;l<e;l++)u[A]!==u[A+1]&&(s[l]=u[A]?2:1,++h),A++;for(u[A]!==0&&(s[l]=2,++h),a=1;a<i;a++){A=a*d,c=a*n,u[A-d]!==u[A]&&(s[c]=u[A]?1:8,++h);let m=(u[A]?4:0)+(u[A-d]?8:0);for(l=1;l<e;l++)m=(m>>2)+(u[A+1]?4:0)+(u[A-d+1]?8:0),o[m]&&(s[c+l]=o[m],++h),A++;if(u[A-d]!==u[A]&&(s[c+l]=u[A]?2:4,++h),h>r)return null}for(A=d*(i-1),c=a*n,u[A]!==0&&(s[c]=8,++h),l=1;l<e;l++)u[A]!==u[A+1]&&(s[c+l]=u[A]?4:8,++h),A++;if(u[A]!==0&&(s[c+l]=4,++h),h>r)return null;const g=new Int32Array([0,n,-1,0,-n,0,0,0,1]),p=new Path2D;for(a=0;h&&a<=i;a++){let m=a*n;const f=m+e;for(;m<f&&!s[m];)m++;if(m===f)continue;p.moveTo(m%n,a);const C=m;let y=s[m];do{const v=g[y];do m+=v;while(!s[m]);const w=s[m];w!==5&&w!==10?(y=w,s[m]=0):(y=w&51*y>>4,s[m]&=y>>2|y<<2),p.lineTo(m%n,m/n|0),s[m]||--h}while(C!==m);--a}return u=null,s=null,function(m){m.save(),m.scale(1/e,-1/i),m.translate(0,-i),m.fill(p),m.beginPath(),m.restore()}}class jxe{constructor(e,i){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=FEe,this.textMatrixScale=1,this.fontMatrix=MZ,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Na.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,i])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,i){this.x=e,this.y=i}updatePathMinMax(e,i,r){[i,r]=bi.applyTransform([i,r],e),this.minX=Math.min(this.minX,i),this.minY=Math.min(this.minY,r),this.maxX=Math.max(this.maxX,i),this.maxY=Math.max(this.maxY,r)}updateRectMinMax(e,i){const r=bi.applyTransform(i,e),o=bi.applyTransform(i.slice(2),e),n=bi.applyTransform([i[0],i[3]],e),s=bi.applyTransform([i[2],i[1]],e);this.minX=Math.min(this.minX,r[0],o[0],n[0],s[0]),this.minY=Math.min(this.minY,r[1],o[1],n[1],s[1]),this.maxX=Math.max(this.maxX,r[0],o[0],n[0],s[0]),this.maxY=Math.max(this.maxY,r[1],o[1],n[1],s[1])}updateScalingPathMinMax(e,i){bi.scaleMinMax(e,i),this.minX=Math.min(this.minX,i[0]),this.minY=Math.min(this.minY,i[1]),this.maxX=Math.max(this.maxX,i[2]),this.maxY=Math.max(this.maxY,i[3])}updateCurvePathMinMax(e,i,r,o,n,s,a,l,c,d){const u=bi.bezierBoundingBox(i,r,o,n,s,a,l,c,d);d||this.updateRectMinMax(e,u)}getPathBoundingBox(e=Ga.FILL,i=null){const r=[this.minX,this.minY,this.maxX,this.maxY];if(e===Ga.STROKE){i||Mo("Stroke bounding box must include transform.");const o=bi.singularValueDecompose2dScale(i),n=o[0]*this.lineWidth/2,s=o[1]*this.lineWidth/2;r[0]-=n,r[1]-=s,r[2]+=n,r[3]+=s}return r}updateClipFromPath(){const e=bi.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=Ga.FILL,i=null){return bi.intersect(this.clipBox,this.getPathBoundingBox(e,i))}}function zxe(t,e){if(e instanceof ImageData){t.putImageData(e,0,0);return}const i=e.height,r=e.width,o=i%dc,n=(i-o)/dc,s=o===0?n:n+1,a=t.createImageData(r,dc);let l=0,c;const d=e.data,u=a.data;let A,h,g,p;if(e.kind===pR.GRAYSCALE_1BPP){const m=d.byteLength,f=new Uint32Array(u.buffer,0,u.byteLength>>2),C=f.length,y=r+7>>3,v=4294967295,w=El.isLittleEndian?4278190080:255;for(A=0;A<s;A++){for(g=A<n?dc:o,c=0,h=0;h<g;h++){const b=m-l;let E=0;const k=b>y?r:b*8-7,x=k&-8;let M=0,D=0;for(;E<x;E+=8)D=d[l++],f[c++]=D&128?v:w,f[c++]=D&64?v:w,f[c++]=D&32?v:w,f[c++]=D&16?v:w,f[c++]=D&8?v:w,f[c++]=D&4?v:w,f[c++]=D&2?v:w,f[c++]=D&1?v:w;for(;E<k;E++)M===0&&(D=d[l++],M=128),f[c++]=D&M?v:w,M>>=1}for(;c<C;)f[c++]=0;t.putImageData(a,0,A*dc)}}else if(e.kind===pR.RGBA_32BPP){for(h=0,p=r*dc*4,A=0;A<n;A++)u.set(d.subarray(l,l+p)),l+=p,t.putImageData(a,0,h),h+=dc;A<s&&(p=r*o*4,u.set(d.subarray(l,l+p)),t.putImageData(a,0,h))}else if(e.kind===pR.RGB_24BPP)for(g=dc,p=r*g,A=0;A<s;A++){for(A>=n&&(g=o,p=r*g),c=0,h=p;h--;)u[c++]=d[l++],u[c++]=d[l++],u[c++]=d[l++],u[c++]=255;t.putImageData(a,0,A*dc)}else throw new Error(`bad image kind: ${e.kind}`)}function qxe(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const i=e.height,r=e.width,o=i%dc,n=(i-o)/dc,s=o===0?n:n+1,a=t.createImageData(r,dc);let l=0;const c=e.data,d=a.data;for(let u=0;u<s;u++){const A=u<n?dc:o;({srcPos:l}=VFi({src:c,srcPos:l,dest:d,width:r,height:A,nonBlackColor:0})),t.putImageData(a,0,u*dc)}}function TI(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 aL(t){if(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),!Ua){const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}}function Kxe(t,e){if(e)return!0;const i=bi.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*T9.PDF_TO_CSS_UNITS);return i[0]<=r&&i[1]<=r}const KFi=["butt","round","square"],JFi=["miter","round","bevel"],YFi={},Jxe={};var fg,vX,CX,yX;const WFi=class ZPe{constructor(e,i,r,o,n,{optionalContentConfig:s,markedContentStack:a=null},l,c){ce(this,fg),this.ctx=e,this.current=new jxe(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=o,this.filterFactory=n,this.groupStack=[],this.processingType3=null,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 zFi(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}getObject(e,i=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):i}beginDrawing({transform:e,viewport:i,transparency:r=!1,background:o=null}){const n=this.ctx.canvas.width,s=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=o||"#ffffff",this.ctx.fillRect(0,0,n,s),this.ctx.fillStyle=a,r){const l=this.cachedCanvases.getCanvas("transparent",n,s);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...tn(this.compositeCtx))}this.ctx.save(),aL(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=tn(this.ctx)}executeOperatorList(e,i,r,o){const n=e.argsArray,s=e.fnArray;let a=i||0;const l=n.length;if(l===a)return a;const c=l-a>Vxe&&typeof r=="function",d=c?Date.now()+GFi:0;let u=0;const A=this.commonObjs,h=this.objs;let g;for(;;){if(o!==void 0&&a===o.nextBreakPoint)return o.breakIt(a,r),a;if(g=s[a],g!==ju.dependency)this[g].apply(this,n[a]);else for(const p of n[a]){const m=p.startsWith("g_")?A:h;if(!m.has(p))return m.get(p,r),a}if(a++,a===l)return a;if(c&&++u>Vxe){if(Date.now()>d)return r(),a;u=0}}}endDrawing(){oe(this,fg,vX).call(this),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(),oe(this,fg,CX).call(this)}_scaleImage(e,i){const r=e.width??e.displayWidth,o=e.height??e.displayHeight;let n=Math.max(Math.hypot(i[0],i[1]),1),s=Math.max(Math.hypot(i[2],i[3]),1),a=r,l=o,c="prescale1",d,u;for(;n>2&&a>1||s>2&&l>1;){let A=a,h=l;n>2&&a>1&&(A=a>=16384?Math.floor(a/2)-1||1:Math.ceil(a/2),n/=a/A),s>2&&l>1&&(h=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,s/=l/h),d=this.cachedCanvases.getCanvas(c,A,h),u=d.context,u.clearRect(0,0,A,h),u.drawImage(e,0,0,a,l,0,0,A,h),e=d.canvas,a=A,l=h,c=c==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:a,paintHeight:l}}_createMaskCanvas(e){const i=this.ctx,{width:r,height:o}=e,n=this.current.fillColor,s=this.current.patternFill,a=tn(i);let l,c,d,u;if((e.bitmap||e.data)&&e.count>1){const k=e.bitmap||e.data.buffer;c=JSON.stringify(s?a:[a.slice(0,4),n]),l=this._cachedBitmapsMap.get(k),l||(l=new Map,this._cachedBitmapsMap.set(k,l));const x=l.get(c);if(x&&!s){const M=Math.round(Math.min(a[0],a[2])+a[4]),D=Math.round(Math.min(a[1],a[3])+a[5]);return{canvas:x,offsetX:M,offsetY:D}}d=x}d||(u=this.cachedCanvases.getCanvas("maskCanvas",r,o),qxe(u.context,e));let A=bi.transform(a,[1/r,0,0,-1/o,0,0]);A=bi.transform(A,[1,0,0,1,0,-o]);const[h,g,p,m]=bi.getAxialAlignedBoundingBox([0,0,r,o],A),f=Math.round(p-h)||1,C=Math.round(m-g)||1,y=this.cachedCanvases.getCanvas("fillCanvas",f,C),v=y.context,w=h,b=g;v.translate(-w,-b),v.transform(...A),d||(d=this._scaleImage(u.canvas,ih(v)),d=d.img,l&&s&&l.set(c,d)),v.imageSmoothingEnabled=Kxe(tn(v),e.interpolate),sL(v,d,0,0,d.width,d.height,0,0,r,o),v.globalCompositeOperation="source-in";const E=bi.transform(ih(v),[1,0,0,1,-w,-b]);return v.fillStyle=s?n.getPattern(i,this,E,Ga.FILL):n,v.fillRect(0,0,r,o),l&&!s&&(this.cachedCanvases.delete("fillCanvas"),l.set(c,y.canvas)),{canvas:y.canvas,offsetX:Math.round(w),offsetY:Math.round(b)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=KFi[e]}setLineJoin(e){this.ctx.lineJoin=JFi[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,i){const r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(e),r.lineDashOffset=i)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[i,r]of e)switch(i){case"LW":this.setLineWidth(r);break;case"LC":this.setLineCap(r);break;case"LJ":this.setLineJoin(r);break;case"ML":this.setMiterLimit(r);break;case"D":this.setDash(r[0],r[1]);break;case"RI":this.setRenderingIntent(r);break;case"FL":this.setFlatness(r);break;case"Font":this.setFont(r[0],r[1]);break;case"CA":this.current.strokeAlpha=r;break;case"ca":this.current.fillAlpha=r,this.ctx.globalAlpha=r;break;case"BM":this.ctx.globalCompositeOperation=r;break;case"SMask":this.current.activeSMask=r?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,i=this.ctx.canvas.height,r="smaskGroupAt"+this.groupLevel,o=this.cachedCanvases.getCanvas(r,e,i);this.suspendedCtx=this.ctx,this.ctx=o.context;const n=this.ctx;n.setTransform(...tn(this.suspendedCtx)),TI(this.suspendedCtx,n),jFi(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),TI(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,o){const n=o[0],s=o[1],a=o[2]-n,l=o[3]-s;a===0||l===0||(this.genericComposeSMask(i.context,r,a,l,i.subtype,i.backdrop,i.transferMap,n,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,o,n,s,a,l,c,d,u){let A=e.canvas,h=l-d,g=c-u;if(s){const m=bi.makeHexColor(...s);if(h<0||g<0||h+r>A.width||g+o>A.height){const f=this.cachedCanvases.getCanvas("maskExtension",r,o),C=f.context;C.drawImage(A,-h,-g),C.globalCompositeOperation="destination-atop",C.fillStyle=m,C.fillRect(0,0,r,o),C.globalCompositeOperation="source-over",A=f.canvas,h=g=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const f=new Path2D;f.rect(h,g,r,o),e.clip(f),e.globalCompositeOperation="destination-atop",e.fillStyle=m,e.fillRect(h,g,r,o),e.restore()}}i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0),n==="Alpha"&&a?i.filter=this.filterFactory.addAlphaFilter(a):n==="Luminosity"&&(i.filter=this.filterFactory.addLuminosityFilter(a));const p=new Path2D;p.rect(l,c,r,o),i.clip(p),i.globalCompositeOperation="destination-in",i.drawImage(A,h,g,r,o,l,c,r,o),i.restore()}save(){this.inSMaskMode?(TI(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),TI(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,i,r,o,n,s){this.ctx.transform(e,i,r,o,n,s),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,i,r){const o=this.ctx,n=this.current;let s=n.x,a=n.y,l,c;const d=tn(o),u=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,A=u?r.slice(0):null;for(let h=0,g=0,p=e.length;h<p;h++)switch(e[h]|0){case ju.rectangle:s=i[g++],a=i[g++];const m=i[g++],f=i[g++],C=s+m,y=a+f;o.moveTo(s,a),m===0||f===0?o.lineTo(C,y):(o.lineTo(C,a),o.lineTo(C,y),o.lineTo(s,y)),u||n.updateRectMinMax(d,[s,a,C,y]),o.closePath();break;case ju.moveTo:s=i[g++],a=i[g++],o.moveTo(s,a),u||n.updatePathMinMax(d,s,a);break;case ju.lineTo:s=i[g++],a=i[g++],o.lineTo(s,a),u||n.updatePathMinMax(d,s,a);break;case ju.curveTo:l=s,c=a,s=i[g+4],a=i[g+5],o.bezierCurveTo(i[g],i[g+1],i[g+2],i[g+3],s,a),n.updateCurvePathMinMax(d,l,c,i[g],i[g+1],i[g+2],i[g+3],s,a,A),g+=6;break;case ju.curveTo2:l=s,c=a,o.bezierCurveTo(s,a,i[g],i[g+1],i[g+2],i[g+3]),n.updateCurvePathMinMax(d,l,c,s,a,i[g],i[g+1],i[g+2],i[g+3],A),s=i[g+2],a=i[g+3],g+=4;break;case ju.curveTo3:l=s,c=a,s=i[g+2],a=i[g+3],o.bezierCurveTo(i[g],i[g+1],s,a,s,a),n.updateCurvePathMinMax(d,l,c,i[g],i[g+1],s,a,s,a,A),g+=4;break;case ju.closePath:o.closePath();break}u&&n.updateScalingPathMinMax(d,A),n.setCurrentPoint(s,a)}closePath(){this.ctx.closePath()}stroke(e=!0){const i=this.ctx,r=this.current.strokeColor;i.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof r=="object"&&r!=null&&r.getPattern?(i.save(),i.strokeStyle=r.getPattern(i,this,ih(i),Ga.STROKE),this.rescaleAndStroke(!1),i.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),i.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const i=this.ctx,r=this.current.fillColor,o=this.current.patternFill;let n=!1;o&&(i.save(),i.fillStyle=r.getPattern(i,this,ih(i),Ga.FILL),n=!0);const s=this.current.getClippedPathBoundingBox();this.contentVisible&&s!==null&&(this.pendingEOFill?(i.fill("evenodd"),this.pendingEOFill=!1):i.fill()),n&&i.restore(),e&&this.consumePath(s)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=YFi}eoClip(){this.pendingClip=Jxe}beginText(){this.current.textMatrix=FEe,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,i=this.ctx;if(e===void 0){i.beginPath();return}const r=new Path2D,o=i.getTransform().invertSelf();for(const{transform:n,x:s,y:a,fontSize:l,path:c}of e)r.addPath(c,new DOMMatrix(n).preMultiplySelf(o).translate(s,a).scale(l,-l));i.clip(r),i.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,i){var r;const o=this.commonObjs.get(e),n=this.current;if(!o)throw new Error(`Can't find font for ${e}`);if(n.fontMatrix=o.fontMatrix||MZ,(n.fontMatrix[0]===0||n.fontMatrix[3]===0)&&or("Invalid font matrix for font "+e),i<0?(i=-i,n.fontDirection=-1):n.fontDirection=1,this.current.font=o,this.current.fontSize=i,o.isType3Font)return;const s=o.loadedName||"sans-serif",a=((r=o.systemFontInfo)==null?void 0:r.css)||`"${s}", ${o.fallbackName}`;let l="normal";o.black?l="900":o.bold&&(l="bold");const c=o.italic?"italic":"normal";let d=i;i<Oxe?d=Oxe:i>Hxe&&(d=Hxe),this.current.fontSizeScale=i/d,this.ctx.font=`${c} ${l} ${d}px ${a}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,i){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(e,i){this.setLeading(-i),this.moveText(e,i)}setTextMatrix(e,i,r,o,n,s){this.current.textMatrix=[e,i,r,o,n,s],this.current.textMatrixScale=Math.hypot(e,i),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,i,r,o,n){const s=this.ctx,a=this.current,l=a.font,c=a.textRenderingMode,d=a.fontSize/a.fontSizeScale,u=c&Na.FILL_STROKE_MASK,A=!!(c&Na.ADD_TO_PATH_FLAG),h=a.patternFill&&!l.missingFile,g=a.patternStroke&&!l.missingFile;let p;if((l.disableFontFace||A||h||g)&&(p=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||h||g){if(s.save(),s.translate(i,r),s.scale(d,-d),u===Na.FILL||u===Na.FILL_STROKE)if(o){const m=s.getTransform();s.setTransform(...o),s.fill(oe(this,fg,yX).call(this,p,m,o))}else s.fill(p);if(u===Na.STROKE||u===Na.FILL_STROKE)if(n){const m=s.getTransform();s.setTransform(...n),s.stroke(oe(this,fg,yX).call(this,p,m,n))}else s.lineWidth/=d,s.stroke(p);s.restore()}else(u===Na.FILL||u===Na.FILL_STROKE)&&s.fillText(e,i,r),(u===Na.STROKE||u===Na.FILL_STROKE)&&s.strokeText(e,i,r);A&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:tn(s),x:i,y:r,fontSize:d,path:p})}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 o=3;o<i.length;o+=4)if(i[o]>0&&i[o]<255){r=!0;break}return gr(this,"isFontSubpixelAAEnabled",r)}showText(e){const i=this.current,r=i.font;if(r.isType3Font)return this.showType3Text(e);const o=i.fontSize;if(o===0)return;const n=this.ctx,s=i.fontSizeScale,a=i.charSpacing,l=i.wordSpacing,c=i.fontDirection,d=i.textHScale*c,u=e.length,A=r.vertical,h=A?1:-1,g=r.defaultVMetrics,p=o*i.fontMatrix[0],m=i.textRenderingMode===Na.FILL&&!r.disableFontFace&&!i.patternFill;n.save(),n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),c>0?n.scale(d,-1):n.scale(d,1);let f,C;if(i.patternFill){n.save();const E=i.fillColor.getPattern(n,this,ih(n),Ga.FILL);f=tn(n),n.restore(),n.fillStyle=E}if(i.patternStroke){n.save();const E=i.strokeColor.getPattern(n,this,ih(n),Ga.STROKE);C=tn(n),n.restore(),n.strokeStyle=E}let y=i.lineWidth;const v=i.textMatrixScale;if(v===0||y===0){const E=i.textRenderingMode&Na.FILL_STROKE_MASK;(E===Na.STROKE||E===Na.FILL_STROKE)&&(y=this.getSinglePixelWidth())}else y/=v;if(s!==1&&(n.scale(s,s),y/=s),n.lineWidth=y,r.isInvalidPDFjsFont){const E=[];let k=0;for(const x of e)E.push(x.unicode),k+=x.width;n.fillText(E.join(""),0,0),i.x+=k*p*d,n.restore(),this.compose();return}let w=0,b;for(b=0;b<u;++b){const E=e[b];if(typeof E=="number"){w+=h*E*o/1e3;continue}let k=!1;const x=(E.isSpace?l:0)+a,M=E.fontChar,D=E.accent;let P,T,N=E.width;if(A){const U=E.vmetric||g,V=-(E.vmetric?U[1]:N*.5)*p,Y=U[2]*p;N=U?-U[0]:N,P=V/s,T=(w+Y)/s}else P=w/s,T=0;if(r.remeasure&&N>0){const U=n.measureText(M).width*1e3/o*s;if(N<U&&this.isFontSubpixelAAEnabled){const V=N/U;k=!0,n.save(),n.scale(V,1),P/=V}else N!==U&&(P+=(N-U)/2e3*o/s)}if(this.contentVisible&&(E.isInFont||r.missingFile)){if(m&&!D)n.fillText(M,P,T);else if(this.paintChar(M,P,T,f,C),D){const U=P+o*D.offset.x/s,V=T-o*D.offset.y/s;this.paintChar(D.fontChar,U,V,f,C)}}const H=A?N*p-x*c:N*p+x*c;w+=H,k&&n.restore()}A?i.y-=w:i.x+=w*d,n.restore(),this.compose()}showType3Text(e){const i=this.ctx,r=this.current,o=r.font,n=r.fontSize,s=r.fontDirection,a=o.vertical?1:-1,l=r.charSpacing,c=r.wordSpacing,d=r.textHScale*s,u=r.fontMatrix||MZ,A=e.length,h=r.textRenderingMode===Na.INVISIBLE;let g,p,m,f;if(!(h||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),i.transform(...r.textMatrix),i.translate(r.x,r.y),i.scale(d,s),g=0;g<A;++g){if(p=e[g],typeof p=="number"){f=a*p*n/1e3,this.ctx.translate(f,0),r.x+=f*d;continue}const C=(p.isSpace?c:0)+l,y=o.charProcOperatorList[p.operatorListId];if(!y){or(`Type3 character "${p.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=p,this.save(),i.scale(n,n),i.transform(...u),this.executeOperatorList(y),this.restore()),m=bi.applyTransform([p.width,0],u)[0]*n+C,i.translate(m,0),r.x+=m*d}i.restore(),this.processingType3=null}}setCharWidth(e,i){}setCharWidthAndBounds(e,i,r,o,n,s){this.ctx.rect(r,o,n-r,s-o),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let i;if(e[0]==="TilingPattern"){const r=e[1],o=this.baseTransform||tn(this.ctx),n={createCanvasGraphics:s=>new ZPe(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};i=new HFi(e,r,this.ctx,n,o)}else i=this._getPattern(e[1],e[2]);return i}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,i,r){this.ctx.strokeStyle=this.current.strokeColor=bi.makeHexColor(e,i,r),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,i,r){this.ctx.fillStyle=this.current.fillColor=bi.makeHexColor(e,i,r),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,i=null){let r;return this.cachedPatterns.has(e)?r=this.cachedPatterns.get(e):(r=OFi(this.getObject(e)),this.cachedPatterns.set(e,r)),i&&(r.matrix=i),r}shadingFill(e){if(!this.contentVisible)return;const i=this.ctx;this.save();const r=this._getPattern(e);i.fillStyle=r.getPattern(i,this,ih(i),Ga.SHADING);const o=ih(i);if(o){const{width:n,height:s}=i.canvas,[a,l,c,d]=bi.getAxialAlignedBoundingBox([0,0,n,s],o);this.ctx.fillRect(a,l,c-a,d-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Mo("Should not call beginInlineImage")}beginImageData(){Mo("Should not call beginImageData")}paintFormXObjectBegin(e,i){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=tn(this.ctx),i)){const r=i[2]-i[0],o=i[3]-i[1];this.ctx.rect(i[0],i[1],r,o),this.current.updateRectMinMax(tn(this.ctx),i),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const i=this.ctx;e.isolated||mR("TODO: Support non-isolated groups."),e.knockout&&or("Knockout groups not supported.");const r=tn(i);if(e.matrix&&i.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let o=bi.getAxialAlignedBoundingBox(e.bbox,tn(i));const n=[0,0,i.canvas.width,i.canvas.height];o=bi.intersect(o,n)||[0,0,0,0];const s=Math.floor(o[0]),a=Math.floor(o[1]),l=Math.max(Math.ceil(o[2])-s,1),c=Math.max(Math.ceil(o[3])-a,1);this.current.startNewPathAndClipBox([0,0,l,c]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,l,c),A=u.context;A.translate(-s,-a),A.transform(...r),e.smask?this.smaskStack.push({canvas:u.canvas,context:A,offsetX:s,offsetY:a,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(i.setTransform(1,0,0,1,0,0),i.translate(s,a),i.save()),TI(i,A),this.ctx=A,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(i),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const i=this.ctx,r=this.groupStack.pop();if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const o=tn(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...o);const n=bi.getAxialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],o);this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,i,r,o,n){if(oe(this,fg,vX).call(this),aL(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const s=i[2]-i[0],a=i[3]-i[1];if(n&&this.annotationCanvasMap){r=r.slice(),r[4]-=i[0],r[5]-=i[1],i=i.slice(),i[0]=i[1]=0,i[2]=s,i[3]=a;const[l,c]=bi.singularValueDecompose2dScale(tn(this.ctx)),{viewportScale:d}=this,u=Math.ceil(s*this.outputScaleX*d),A=Math.ceil(a*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(u,A);const{canvas:h,context:g}=this.annotationCanvas;this.annotationCanvasMap.set(e,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=g,this.ctx.save(),this.ctx.setTransform(l,0,0,-c,0,a*c),aL(this.ctx)}else aL(this.ctx),this.endPath(),this.ctx.rect(i[0],i[1],s,a),this.ctx.clip(),this.ctx.beginPath()}this.current=new jxe(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...r),this.transform(...o)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),oe(this,fg,CX).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const i=e.count;e=this.getObject(e.data,e),e.count=i;const r=this.ctx,o=this.processingType3;if(o&&(o.compiled===void 0&&(o.compiled=qFi(e)),o.compiled)){o.compiled(r);return}const n=this._createMaskCanvas(e),s=n.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(s,n.offsetX,n.offsetY),r.restore(),this.compose()}paintImageMaskXObjectRepeat(e,i,r=0,o=0,n,s){if(!this.contentVisible)return;e=this.getObject(e.data,e);const a=this.ctx;a.save();const l=tn(a);a.transform(i,r,o,n,0,0);const c=this._createMaskCanvas(e);a.setTransform(1,0,0,1,c.offsetX-l[4],c.offsetY-l[5]);for(let d=0,u=s.length;d<u;d+=2){const A=bi.transform(l,[i,r,o,n,s[d],s[d+1]]),[h,g]=bi.applyTransform([0,0],A);a.drawImage(c.canvas,h,g)}a.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const i=this.ctx,r=this.current.fillColor,o=this.current.patternFill;for(const n of e){const{data:s,width:a,height:l,transform:c}=n,d=this.cachedCanvases.getCanvas("maskCanvas",a,l),u=d.context;u.save();const A=this.getObject(s,n);qxe(u,A),u.globalCompositeOperation="source-in",u.fillStyle=o?r.getPattern(u,this,ih(i),Ga.FILL):r,u.fillRect(0,0,a,l),u.restore(),i.save(),i.transform(...c),i.scale(1,-1),sL(i,d.canvas,0,0,a,l,0,-1,1,1),i.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const i=this.getObject(e);if(!i){or("Dependent image isn't ready yet");return}this.paintInlineImageXObject(i)}paintImageXObjectRepeat(e,i,r,o){if(!this.contentVisible)return;const n=this.getObject(e);if(!n){or("Dependent image isn't ready yet");return}const s=n.width,a=n.height,l=[];for(let c=0,d=o.length;c<d;c+=2)l.push({transform:[i,0,0,r,o[c],o[c+1]],x:0,y:0,w:s,h:a});this.paintInlineImageXObjectGroup(n,l)}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:o}=e,n=this.cachedCanvases.getCanvas("inlineImage",r,o),s=n.context;return s.filter=this.current.transferMaps,s.drawImage(i,0,0),s.filter="none",n.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const i=e.width,r=e.height,o=this.ctx;if(this.save(),!Ua){const{filter:a}=o;a!=="none"&&a!==""&&(o.filter="none")}o.scale(1/i,-1/r);let n;if(e.bitmap)n=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)n=e;else{const a=this.cachedCanvases.getCanvas("inlineImage",i,r).context;zxe(a,e),n=this.applyTransferMapsToCanvas(a)}const s=this._scaleImage(n,ih(o));o.imageSmoothingEnabled=Kxe(tn(o),e.interpolate),sL(o,s.img,0,0,s.paintWidth,s.paintHeight,0,-r,i,r),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,i){if(!this.contentVisible)return;const r=this.ctx;let o;if(e.bitmap)o=e.bitmap;else{const n=e.width,s=e.height,a=this.cachedCanvases.getCanvas("inlineImage",n,s).context;zxe(a,e),o=this.applyTransferMapsToCanvas(a)}for(const n of i)r.save(),r.transform(...n.transform),r.scale(1,-1),sL(r,o,n.x,n.y,n.w,n.h,0,-1,1,1),r.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,i){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,i){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const r=this.ctx;this.pendingClip&&(i||(this.pendingClip===Jxe?r.clip("evenodd"):r.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),r.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=tn(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]),o=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(r,o)/i}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:i,b:r,c:o,d:n}=this.ctx.getTransform();let s,a;if(r===0&&o===0){const l=Math.abs(i),c=Math.abs(n);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*n-r*o),c=Math.hypot(i,r),d=Math.hypot(o,n);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){const{ctx:i}=this,{lineWidth:r}=this.current,[o,n]=this.getScaleForStroking();if(i.lineWidth=r||1,o===1&&n===1){i.stroke();return}const s=i.getLineDash();if(e&&i.save(),i.scale(o,n),s.length>0){const a=Math.max(o,n);i.setLineDash(s.map(l=>l/a)),i.lineDashOffset/=a}i.stroke(),e&&i.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};fg=new WeakSet,vX=function(){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)},CX=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},yX=function(t,e,i){const r=new Path2D;return r.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),r};let lL=WFi;for(const t in ju)lL.prototype[t]!==void 0&&(lL.prototype[ju[t]]=lL.prototype[t]);var cL,dL;class mg{static get workerPort(){return S(this,cL)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");ie(this,cL,e)}static get workerSrc(){return S(this,dL)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");ie(this,dL,e)}}cL=new WeakMap,dL=new WeakMap,ce(mg,cL,null),ce(mg,dL,"");var l6,uL;class ZFi{constructor({parsedData:e,rawData:i}){ce(this,l6),ce(this,uL),ie(this,l6,e),ie(this,uL,i)}getRaw(){return S(this,uL)}get(e){return S(this,l6).get(e)??null}getAll(){return PZ(S(this,l6))}has(e){return S(this,l6).has(e)}}l6=new WeakMap,uL=new WeakMap;const c6=Symbol("INTERNAL");var AL,hL,pL,FI;class XFi{constructor(e,{name:i,intent:r,usage:o,rbGroups:n}){ce(this,AL,!1),ce(this,hL,!1),ce(this,pL,!1),ce(this,FI,!0),ie(this,AL,!!(e&Xc.DISPLAY)),ie(this,hL,!!(e&Xc.PRINT)),this.name=i,this.intent=r,this.usage=o,this.rbGroups=n}get visible(){if(S(this,pL))return S(this,FI);if(!S(this,FI))return!1;const{print:e,view:i}=this.usage;return S(this,AL)?i?.viewState!=="OFF":S(this,hL)?e?.printState!=="OFF":!0}_setVisible(e,i,r=!1){e!==c6&&Mo("Internal method `_setVisible` called."),ie(this,pL,r),ie(this,FI,i)}}AL=new WeakMap,hL=new WeakMap,pL=new WeakMap,FI=new WeakMap;var im,Eo,UI,NI,gL,wX;class $Fi{constructor(e,i=Xc.DISPLAY){if(ce(this,gL),ce(this,im,null),ce(this,Eo,new Map),ce(this,UI,null),ce(this,NI,null),this.renderingIntent=i,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,ie(this,NI,e.order);for(const r of e.groups)S(this,Eo).set(r.id,new XFi(i,r));if(e.baseState==="OFF")for(const r of S(this,Eo).values())r._setVisible(c6,!1);for(const r of e.on)S(this,Eo).get(r)._setVisible(c6,!0);for(const r of e.off)S(this,Eo).get(r)._setVisible(c6,!1);ie(this,UI,this.getHash())}}isVisible(e){if(S(this,Eo).size===0)return!0;if(!e)return mR("Optional content group not defined."),!0;if(e.type==="OCG")return S(this,Eo).has(e.id)?S(this,Eo).get(e.id).visible:(or(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return oe(this,gL,wX).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const i of e.ids){if(!S(this,Eo).has(i))return or(`Optional content group not found: ${i}`),!0;if(S(this,Eo).get(i).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const i of e.ids){if(!S(this,Eo).has(i))return or(`Optional content group not found: ${i}`),!0;if(!S(this,Eo).get(i).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const i of e.ids){if(!S(this,Eo).has(i))return or(`Optional content group not found: ${i}`),!0;if(!S(this,Eo).get(i).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const i of e.ids){if(!S(this,Eo).has(i))return or(`Optional content group not found: ${i}`),!0;if(S(this,Eo).get(i).visible)return!1}return!0}return or(`Unknown optional content policy ${e.policy}.`),!0}return or(`Unknown group type ${e.type}.`),!0}setVisibility(e,i=!0,r=!0){var o;const n=S(this,Eo).get(e);if(!n){or(`Optional content group not found: ${e}`);return}if(r&&i&&n.rbGroups.length)for(const s of n.rbGroups)for(const a of s)a!==e&&((o=S(this,Eo).get(a))==null||o._setVisible(c6,!1,!0));n._setVisible(c6,!!i,!0),ie(this,im,null)}setOCGState({state:e,preserveRB:i}){let r;for(const o of e){switch(o){case"ON":case"OFF":case"Toggle":r=o;continue}const n=S(this,Eo).get(o);if(n)switch(r){case"ON":this.setVisibility(o,!0,i);break;case"OFF":this.setVisibility(o,!1,i);break;case"Toggle":this.setVisibility(o,!n.visible,i);break}}ie(this,im,null)}get hasInitialVisibility(){return S(this,UI)===null||this.getHash()===S(this,UI)}getOrder(){return S(this,Eo).size?S(this,NI)?S(this,NI).slice():[...S(this,Eo).keys()]:null}getGroups(){return S(this,Eo).size>0?PZ(S(this,Eo)):null}getGroup(e){return S(this,Eo).get(e)||null}getHash(){if(S(this,im)!==null)return S(this,im);const e=new bxe;for(const[i,r]of S(this,Eo))e.update(`${i}:${r.visible}`);return ie(this,im,e.hexdigest())}}im=new WeakMap,Eo=new WeakMap,UI=new WeakMap,NI=new WeakMap,gL=new WeakSet,wX=function(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let r=1;r<e;r++){const o=t[r];let n;if(Array.isArray(o))n=oe(this,gL,wX).call(this,o);else if(S(this,Eo).has(o))n=S(this,Eo).get(o).visible;else return or(`Optional content group not found: ${o}`),!0;switch(i){case"And":if(!n)return!1;break;case"Or":if(n)return!0;break;case"Not":return!n;default:return!0}}return i==="And"};class eUi{constructor(e,{disableRange:i=!1,disableStream:r=!1}){$n(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:o,initialData:n,progressiveDone:s,contentDispositionFilename:a}=e;if(this._queuedChunks=[],this._progressiveDone=s,this._contentDispositionFilename=a,n?.length>0){const l=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!r,this._isRangeSupported=!i,this._contentLength=o,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 o=this._rangeReaders.some(function(n){return n._begin!==e?!1:(n._enqueue(r),!0)});$n(o,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var i,r,o,n;e.total===void 0?(r=(i=this._rangeReaders[0])==null?void 0:i.onProgress)==null||r.call(i,{loaded:e.loaded}):(n=(o=this._fullRequestReader)==null?void 0:o.onProgress)==null||n.call(o,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const i=this._rangeReaders.indexOf(e);i>=0&&this._rangeReaders.splice(i,1)}getFullReader(){$n(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new tUi(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new iUi(this,e,i);return this._pdfDataRangeTransport.requestDataRange(e,i),this._rangeReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeReaders.slice(0))r.cancel(e);this._pdfDataRangeTransport.abort()}}class tUi{constructor(e,i,r=!1,o=null){this._stream=e,this._done=r||!1,this._filename=_Z(o)?o:null,this._queuedChunks=i||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.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 iUi{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 rUi(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),n(d)}if(i=s(t),i){const d=c(i);return n(d)}if(i=r("filename","i").exec(t),i){i=i[1];let d=a(i);return d=c(d),n(d)}function r(d,u){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function o(d,u){if(d){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const A=new TextDecoder(d,{fatal:!0}),h=CR(u);u=A.decode(h),e=!1}catch{}}return u}function n(d){return e&&/[\x80-\xff]/.test(d)&&(d=o("utf-8",d),e&&(d=o("iso-8859-1",d))),d}function s(d){const u=[];let A;const h=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(A=h.exec(d))!==null;){let[,p,m,f]=A;if(p=parseInt(p,10),p in u){if(p===0)break;continue}u[p]=[m,f]}const g=[];for(let p=0;p<u.length&&p in u;++p){let[m,f]=u[p];f=a(f),m&&(f=unescape(f),p===0&&(f=l(f))),g.push(f)}return g.join("")}function a(d){if(d.startsWith('"')){const u=d.slice(1).split('\\"');for(let A=0;A<u.length;++A){const h=u[A].indexOf('"');h!==-1&&(u[A]=u[A].slice(0,h),u.length=A+1),u[A]=u[A].replaceAll(/\\(.)/g,"$1")}d=u.join('"')}return d}function l(d){const u=d.indexOf("'");if(u===-1)return d;const A=d.slice(0,u),h=d.slice(u+1).replace(/^[^']*'/,"");return o(A,h)}function c(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,A,h,g){if(h==="q"||h==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(p,m){return String.fromCharCode(parseInt(m,16))}),o(A,g);try{g=atob(g)}catch{}return o(A,g)})}return""}function Yxe(t,e){const i=new Headers;if(!t||!e||typeof e!="object")return i;for(const r in e){const o=e[r];o!==void 0&&i.append(r,o)}return i}function fL(t){try{return new URL(t).origin}catch{}return null}function Wxe({responseHeaders:t,isHttp:e,rangeChunkSize:i,disableRange:r}){const o={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(t.get("Content-Length"),10);return!Number.isInteger(n)||(o.suggestedLength=n,n<=2*i)||r||!e||t.get("Accept-Ranges")!=="bytes"||(t.get("Content-Encoding")||"identity")!=="identity"||(o.allowRangeRequests=!0),o}function Zxe(t){const e=t.get("Content-Disposition");if(e){let i=rUi(e);if(i.includes("%"))try{i=decodeURIComponent(i)}catch{}if(_Z(i))return i}return null}function mL(t,e){return t===404||t===0&&e.startsWith("file:")?new rI('Missing PDF "'+e+'".'):new vR(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)}function Xxe(t){return t===200||t===206}function $xe(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function eke(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(or(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class tke{constructor(e){ai(this,"_responseOrigin",null),this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Yxe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return $n(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new oUi(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new nUi(this,e,i);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class oUi{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),o=i.url;fetch(o,$xe(r,this._withCredentials,this._abortController)).then(n=>{if(e._responseOrigin=fL(n.url),!Xxe(n.status))throw mL(n.status,o);this._reader=n.body.getReader(),this._headersCapability.resolve();const s=n.headers,{allowRangeRequests:a,suggestedLength:l}=Wxe({responseHeaders:s,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=l||this._contentLength,this._filename=Zxe(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new og("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(){var e;await this._headersCapability.promise;const{value:i,done:r}=await this._reader.read();return r?{value:i,done:r}:(this._loaded+=i.byteLength,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded,total:this._contentLength}),{value:eke(i),done:!1})}cancel(e){var i;(i=this._reader)==null||i.cancel(e),this._abortController.abort()}}class nUi{constructor(e,i,r){this._stream=e,this._reader=null,this._loaded=0;const o=e.source;this._withCredentials=o.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!o.disableStream,this._abortController=new AbortController;const n=new Headers(e.headers);n.append("Range",`bytes=${i}-${r-1}`);const s=o.url;fetch(s,$xe(n,this._withCredentials,this._abortController)).then(a=>{const l=fL(a.url);if(l!==e._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${e._responseOrigin}".`);if(!Xxe(a.status))throw mL(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(){var e;await this._readCapability.promise;const{value:i,done:r}=await this._reader.read();return r?{value:i,done:r}:(this._loaded+=i.byteLength,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded}),{value:eke(i),done:!1})}cancel(e){var i;(i=this._reader)==null||i.cancel(e),this._abortController.abort()}}const bX=200,IX=206;function sUi(t){const e=t.response;return typeof e!="string"?e:CR(e).buffer}class aUi{constructor({url:e,httpHeaders:i,withCredentials:r}){ai(this,"_responseOrigin",null),this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Yxe(this.isHttp,i),this.withCredentials=r||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const i=new XMLHttpRequest,r=this.currXhrId++,o=this.pendingRequests[r]={xhr:i};i.open("GET",this.url),i.withCredentials=this.withCredentials;for(const[n,s]of this.headers)i.setRequestHeader(n,s);return this.isHttp&&"begin"in e&&"end"in e?(i.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),o.expectedStatus=IX):o.expectedStatus=bX,i.responseType="arraybuffer",$n(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),o.onHeadersReceived=e.onHeadersReceived,o.onDone=e.onDone,o.onError=e.onError,o.onProgress=e.onProgress,i.send(null),r}onProgress(e,i){var r;const o=this.pendingRequests[e];o&&((r=o.onProgress)==null||r.call(o,i))}onStateChange(e,i){const r=this.pendingRequests[e];if(!r)return;const o=r.xhr;if(o.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),o.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],o.status===0&&this.isHttp){r.onError(o.status);return}const n=o.status||bX;if(!(n===bX&&r.expectedStatus===IX)&&n!==r.expectedStatus){r.onError(o.status);return}const s=sUi(o);if(n===IX){const a=o.getResponseHeader("Content-Range"),l=/bytes (\d+)-(\d+)\/(\d+)/.exec(a);l?r.onDone({begin:parseInt(l[1],10),chunk:s}):(or('Missing or invalid "Content-Range" header.'),r.onError(0))}else s?r.onDone({begin:0,chunk:s}):r.onError(o.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 lUi{constructor(e){this._source=e,this._manager=new aUi(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 $n(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new cUi(this._manager,this._source),this._fullRequestReader}getRangeReader(e,i){const r=new dUi(this._manager,e,i);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class cUi{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=fL(i.responseURL);const r=i.getAllResponseHeaders(),o=new Headers(r?r.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(a=>{const[l,...c]=a.split(": ");return[l,c.join(": ")]}):[]),{allowRangeRequests:n,suggestedLength:s}=Wxe({responseHeaders:o,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=Zxe(o),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=mL(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){var i;(i=this.onProgress)==null||i.call(this,{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 dUi{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(){var e;const i=fL((e=this._manager.getRequestXhr(this._requestId))==null?void 0:e.responseURL);i!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${i}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var e;(e=this.onClosed)==null||e.call(this,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??(this._storedError=mL(e,this._url));for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var i;this.isStreamingSupported||(i=this.onProgress)==null||i.call(this,{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 uUi=/^[a-z][a-z0-9\-+.]+:/i;function AUi(t){if(uUi.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}class hUi{constructor(e){this.source=e,this.url=AUi(e.url),$n(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return $n(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new pUi(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new gUi(this,e,i);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class pUi{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(o=>{this._contentLength=o.size,this._setReadableStream(r.createReadStream(this._url)),this._headersCapability.resolve()},o=>{o.code==="ENOENT"&&(o=new rI(`Missing PDF "${this._url}".`)),this._storedError=o,this._headersCapability.reject(o)})}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(){var e;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const i=this._readableStream.read();return i===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=i.length,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(i).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 og("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class gUi{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 o=e.source;this._isStreamingSupported=!o.disableStream;const n=process.getBuiltinModule("fs");this._setReadableStream(n.createReadStream(this._url,{start:i,end:r-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var e;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const i=this._readableStream.read();return i===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=i.length,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded}),{value:new Uint8Array(i).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 fUi=1e5,uc=30,mUi=.8;var ike,rm,td,vL,CL,om,vg,yL,wL,d6,_I,OI,nm,HI,bL,VI,u6,IL,BL,A6,h6,EL,sm,GI,p6,rke,oke,BX,X1,xL,EX,nke,ske;const Ac=class FE{constructor({textContentSource:e,container:i,viewport:r}){ce(this,p6),ce(this,rm,Promise.withResolvers()),ce(this,td,null),ce(this,vL,!1),ce(this,CL,!!((ike=globalThis.FontInspector)!=null&&ike.enabled)),ce(this,om,null),ce(this,vg,null),ce(this,yL,0),ce(this,wL,0),ce(this,d6,null),ce(this,_I,null),ce(this,OI,0),ce(this,nm,0),ce(this,HI,Object.create(null)),ce(this,bL,[]),ce(this,VI,null),ce(this,u6,[]),ce(this,IL,new WeakMap),ce(this,BL,null);var o;if(e instanceof ReadableStream)ie(this,VI,e);else if(typeof e=="object")ie(this,VI,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');ie(this,td,ie(this,_I,i)),ie(this,nm,r.scale*(globalThis.devicePixelRatio||1)),ie(this,OI,r.rotation),ie(this,vg,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:s,pageX:a,pageY:l}=r.rawDims;ie(this,BL,[1,0,0,-1,-a,l+s]),ie(this,wL,n),ie(this,yL,s),oe(o=FE,X1,nke).call(o),H2(i,r),S(this,rm).promise.finally(()=>{S(FE,GI).delete(this),ie(this,vg,null),ie(this,HI,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:i}=El.platform;return gr(this,"fontFamilyMap",new Map([["sans-serif",`${e&&i?"Calibri, ":""}sans-serif`],["monospace",`${e&&i?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{S(this,d6).read().then(({value:i,done:r})=>{if(r){S(this,rm).resolve();return}S(this,om)??ie(this,om,i.lang),Object.assign(S(this,HI),i.styles),oe(this,p6,rke).call(this,i.items),e()},S(this,rm).reject)};return ie(this,d6,S(this,VI).getReader()),S(FE,GI).add(this),e(),S(this,rm).promise}update({viewport:e,onBefore:i=null}){var r;const o=e.scale*(globalThis.devicePixelRatio||1),n=e.rotation;if(n!==S(this,OI)&&(i?.(),ie(this,OI,n),H2(S(this,_I),{rotation:n})),o!==S(this,nm)){i?.(),ie(this,nm,o);const s={div:null,properties:null,ctx:oe(r=FE,X1,xL).call(r,S(this,om))};for(const a of S(this,u6))s.properties=S(this,IL).get(a),s.div=a,oe(this,p6,BX).call(this,s)}}cancel(){var e;const i=new og("TextLayer task cancelled.");(e=S(this,d6))==null||e.cancel(i).catch(()=>{}),ie(this,d6,null),S(this,rm).reject(i)}get textDivs(){return S(this,u6)}get textContentItemsStr(){return S(this,bL)}static cleanup(){if(!(S(this,GI).size>0)){S(this,A6).clear();for(const{canvas:e}of S(this,h6).values())e.remove();S(this,h6).clear()}}};rm=new WeakMap,td=new WeakMap,vL=new WeakMap,CL=new WeakMap,om=new WeakMap,vg=new WeakMap,yL=new WeakMap,wL=new WeakMap,d6=new WeakMap,_I=new WeakMap,OI=new WeakMap,nm=new WeakMap,HI=new WeakMap,bL=new WeakMap,VI=new WeakMap,u6=new WeakMap,IL=new WeakMap,BL=new WeakMap,A6=new WeakMap,h6=new WeakMap,EL=new WeakMap,sm=new WeakMap,GI=new WeakMap,p6=new WeakSet,rke=function(t){var e,i;if(S(this,vL))return;(i=S(this,vg)).ctx??(i.ctx=oe(e=Ac,X1,xL).call(e,S(this,om)));const r=S(this,u6),o=S(this,bL);for(const n of t){if(r.length>fUi){or("Ignoring additional textDivs for performance reasons."),ie(this,vL,!0);return}if(n.str===void 0){if(n.type==="beginMarkedContentProps"||n.type==="beginMarkedContent"){const s=S(this,td);ie(this,td,document.createElement("span")),S(this,td).classList.add("markedContent"),n.id!==null&&S(this,td).setAttribute("id",`${n.id}`),s.append(S(this,td))}else n.type==="endMarkedContent"&&ie(this,td,S(this,td).parentNode);continue}o.push(n.str),oe(this,p6,oke).call(this,n)}},oke=function(t){var e;const i=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};S(this,u6).push(i);const o=bi.transform(S(this,BL),t.transform);let n=Math.atan2(o[1],o[0]);const s=S(this,HI)[t.fontName];s.vertical&&(n+=Math.PI/2);let a=S(this,CL)&&s.fontSubstitution||s.fontFamily;a=Ac.fontFamilyMap.get(a)||a;const l=Math.hypot(o[2],o[3]),c=l*oe(e=Ac,X1,ske).call(e,a,S(this,om));let d,u;n===0?(d=o[4],u=o[5]-c):(d=o[4]+c*Math.sin(n),u=o[5]-c*Math.cos(n));const A="calc(var(--scale-factor)*",h=i.style;S(this,td)===S(this,_I)?(h.left=`${(100*d/S(this,wL)).toFixed(2)}%`,h.top=`${(100*u/S(this,yL)).toFixed(2)}%`):(h.left=`${A}${d.toFixed(2)}px)`,h.top=`${A}${u.toFixed(2)}px)`),h.fontSize=`${A}${(S(Ac,sm)*l).toFixed(2)}px)`,h.fontFamily=a,r.fontSize=l,i.setAttribute("role","presentation"),i.textContent=t.str,i.dir=t.dir,S(this,CL)&&(i.dataset.fontName=s.fontSubstitutionLoadedName||t.fontName),n!==0&&(r.angle=n*(180/Math.PI));let g=!1;if(t.str.length>1)g=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const p=Math.abs(t.transform[0]),m=Math.abs(t.transform[3]);p!==m&&Math.max(p,m)/Math.min(p,m)>1.5&&(g=!0)}if(g&&(r.canvasWidth=s.vertical?t.height:t.width),S(this,IL).set(i,r),S(this,vg).div=i,S(this,vg).properties=r,oe(this,p6,BX).call(this,S(this,vg)),r.hasText&&S(this,td).append(i),r.hasEOL){const p=document.createElement("br");p.setAttribute("role","presentation"),S(this,td).append(p)}},BX=function(t){var e;const{div:i,properties:r,ctx:o}=t,{style:n}=i;let s="";if(S(Ac,sm)>1&&(s=`scale(${1/S(Ac,sm)})`),r.canvasWidth!==0&&r.hasText){const{fontFamily:a}=n,{canvasWidth:l,fontSize:c}=r;oe(e=Ac,X1,EX).call(e,o,c*S(this,nm),a);const{width:d}=o.measureText(i.textContent);d>0&&(s=`scaleX(${l*S(this,nm)/d}) ${s}`)}r.angle!==0&&(s=`rotate(${r.angle}deg) ${s}`),s.length>0&&(n.transform=s)},X1=new WeakSet,xL=function(t=null){let e=S(this,h6).get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),S(this,h6).set(t,e),S(this,EL).set(e,{size:0,family:""})}return e},EX=function(t,e,i){const r=S(this,EL).get(t);e===r.size&&i===r.family||(t.font=`${e}px ${i}`,r.size=e,r.family=i)},nke=function(){if(S(this,sm)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),ie(this,sm,t.getBoundingClientRect().height),t.remove()},ske=function(t,e){const i=S(this,A6).get(t);if(i)return i;const r=oe(this,X1,xL).call(this,e);r.canvas.width=r.canvas.height=uc,oe(this,X1,EX).call(this,r,uc,t);const o=r.measureText("");let n=o.fontBoundingBoxAscent,s=Math.abs(o.fontBoundingBoxDescent);if(n){const c=n/(n+s);return S(this,A6).set(t,c),r.canvas.width=r.canvas.height=0,c}r.strokeStyle="red",r.clearRect(0,0,uc,uc),r.strokeText("g",0,0);let a=r.getImageData(0,0,uc,uc).data;s=0;for(let c=a.length-1-3;c>=0;c-=4)if(a[c]>0){s=Math.ceil(c/4/uc);break}r.clearRect(0,0,uc,uc),r.strokeText("A",0,uc),a=r.getImageData(0,0,uc,uc).data,n=0;for(let c=0,d=a.length;c<d;c+=4)if(a[c]>0){n=uc-Math.floor(c/4/uc);break}r.canvas.width=r.canvas.height=0;const l=n?n/(n+s):mUi;return S(this,A6).set(t,l),l},ce(Ac,X1),ce(Ac,A6,new Map),ce(Ac,h6,new Map),ce(Ac,EL,new WeakMap),ce(Ac,sm,null),ce(Ac,GI,new Set);let xX=Ac;class JE{static textContent(e){const i=[],r={items:i,styles:Object.create(null)};function o(n){var s;if(!n)return;let a=null;const l=n.name;if(l==="#text")a=n.value;else if(JE.shouldBuildText(l))(s=n?.attributes)!=null&&s.textContent?a=n.attributes.textContent:n.value&&(a=n.value);else return;if(a!==null&&i.push({str:a}),!!n.children)for(const c of n.children)o(c)}return o(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const vUi=65536,CUi=100,yUi=5e3,wUi=Ua?RFi:QFi,bUi=Ua?LFi:Pxe,IUi=Ua?PFi:DFi,BUi=Ua?TFi:Fxe;function EUi(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new MUi,{docId:i}=e,r=t.url?xUi(t.url):null,o=t.data?kUi(t.data):null,n=t.httpHeaders||null,s=t.withCredentials===!0,a=t.password??null,l=t.range instanceof cke?t.range:null,c=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:vUi;let d=t.worker instanceof QL?t.worker:null;const u=t.verbosity,A=typeof t.docBaseUrl=="string"&&!bR(t.docBaseUrl)?t.docBaseUrl:null,h=typeof t.cMapUrl=="string"?t.cMapUrl:null,g=t.cMapPacked!==!1,p=t.CMapReaderFactory||bUi,m=typeof t.standardFontDataUrl=="string"?t.standardFontDataUrl:null,f=t.StandardFontDataFactory||BUi,C=t.stopAtErrors!==!0,y=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,v=t.isEvalSupported!==!1,w=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!Ua,b=typeof t.isImageDecoderSupported=="boolean"?t.isImageDecoderSupported:!Ua&&(El.platform.isFirefox||!globalThis.chrome),E=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,k=typeof t.disableFontFace=="boolean"?t.disableFontFace:Ua,x=t.fontExtraProperties===!0,M=t.enableXfa===!0,D=t.ownerDocument||globalThis.document,P=t.disableRange===!0,T=t.disableStream===!0,N=t.disableAutoFetch===!0,H=t.pdfBug===!0,U=t.CanvasFactory||wUi,V=t.FilterFactory||IUi,Y=t.enableHWA===!0,re=l?l.length:t.length??NaN,de=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!Ua&&!k,xe=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:p===Pxe&&f===Fxe&&h&&m&&oI(h,document.baseURI)&&oI(m,document.baseURI),pe=null;nFi(u);const Ee={canvasFactory:new U({ownerDocument:D,enableHWA:Y}),filterFactory:new V({docId:i,ownerDocument:D}),cMapReaderFactory:xe?null:new p({baseUrl:h,isCompressed:g}),standardFontDataFactory:xe?null:new f({baseUrl:m})};if(!d){const be={verbosity:u,port:mg.workerPort};d=be.port?QL.fromPort(be):new QL(be),e._worker=d}const Ae={docId:i,apiVersion:"4.10.38",data:o,password:a,disableAutoFetch:N,rangeChunkSize:c,length:re,docBaseUrl:A,enableXfa:M,evaluatorOptions:{maxImageSize:y,disableFontFace:k,ignoreErrors:C,isEvalSupported:v,isOffscreenCanvasSupported:w,isImageDecoderSupported:b,canvasMaxAreaInBytes:E,fontExtraProperties:x,useSystemFonts:de,cMapUrl:xe?h:null,standardFontDataUrl:xe?m:null}},Fe={disableFontFace:k,fontExtraProperties:x,ownerDocument:D,pdfBug:H,styleElement:pe,loadingParams:{disableAutoFetch:N,enableXfa:M}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const be=d.messageHandler.sendWithPromise("GetDocRequest",Ae,o?[o.buffer]:null);let Z;if(l)Z=new eUi(l,{disableRange:P,disableStream:T});else if(!o){if(!r)throw new Error("getDocument - no `url` parameter provided.");let ae;if(Ua)if(oI(r)){if(typeof fetch>"u"||typeof Response>"u"||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");ae=tke}else ae=hUi;else ae=oI(r)?tke:lUi;Z=new ae({url:r,length:re,httpHeaders:n,withCredentials:s,rangeChunkSize:c,disableRange:P,disableStream:T})}return be.then(ae=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const le=new QI(i,ae,d.port),he=new PUi(le,e,Z,Fe,Ee);e._transport=he,le.send("Ready",null)})}).catch(e._capability.reject),e}function xUi(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(Ua&&typeof t=="string")return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function kUi(t){if(Ua&&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 CR(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 ake(t){return typeof t=="object"&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0}var kX;const lke=class XPe{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${_l(XPe,kX)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var e,i,r,o;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((i=this._transport)==null?void 0:i.destroy())}catch(n){throw(r=this._worker)!=null&&r.port&&delete this._worker._pendingDestroy,n}this._transport=null,(o=this._worker)==null||o.destroy(),this._worker=null}};kX=new WeakMap,ce(lke,kX,0);let MUi=lke;class cke{constructor(e,i,r=!1,o=null){this.length=e,this.initialData=i,this.progressiveDone=r,this.contentDispositionFilename=o,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,i){for(const r of this._rangeListeners)r(e,i)}onDataProgress(e,i){this._readyCapability.promise.then(()=>{for(const r of this._progressListeners)r(e,i)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const i of this._progressiveReadListeners)i(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,i){Mo("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class SUi{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 gr(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()}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()}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()}}var am,Cg,dh,g6,kL;class QUi{constructor(e,i,r,o=!1){ce(this,dh),ce(this,am,null),ce(this,Cg,!1),this._pageIndex=e,this._pageInfo=i,this._transport=r,this._stats=o?new OEe:null,this._pdfBug=o,this.commonObjs=r.commonObjs,this.objs=new dke,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}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:o=0,dontFlip:n=!1}={}){return new KE({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:i,offsetX:r,offsetY:o,dontFlip:n})}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 gr(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,viewport:i,intent:r="display",annotationMode:o=ig.ENABLE,transform:n=null,background:s=null,optionalContentConfigPromise:a=null,annotationCanvasMap:l=null,pageColors:c=null,printAnnotationStorage:d=null,isEditing:u=!1}){var A,h;(A=this._stats)==null||A.time("Overall");const g=this._transport.getRenderingIntent(r,o,d,u),{renderingIntent:p,cacheKey:m}=g;ie(this,Cg,!1),oe(this,dh,kL).call(this),a||(a=this._transport.getOptionalContentConfig(p));let f=this._intentStates.get(m);f||(f=Object.create(null),this._intentStates.set(m,f)),f.streamReaderCancelTimeout&&(clearTimeout(f.streamReaderCancelTimeout),f.streamReaderCancelTimeout=null);const C=!!(p&Xc.PRINT);f.displayReadyCapability||(f.displayReadyCapability=Promise.withResolvers(),f.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(g));const y=b=>{var E;f.renderTasks.delete(v),(this._maybeCleanupAfterRender||C)&&ie(this,Cg,!0),oe(this,dh,g6).call(this,!C),b?(v.capability.reject(b),this._abortOperatorList({intentState:f,reason:b instanceof Error?b:new Error(b)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(E=globalThis.Stats)!=null&&E.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},v=new LUi({callback:y,params:{canvasContext:e,viewport:i,transform:n,background:s},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:f.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!C,pdfBug:this._pdfBug,pageColors:c});(f.renderTasks||(f.renderTasks=new Set)).add(v);const w=v.task;return Promise.all([f.displayReadyCapability.promise,a]).then(([b,E])=>{var k;if(this.destroyed){y();return}if((k=this._stats)==null||k.time("Rendering"),!(E.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");v.initializeGraphics({transparency:b,optionalContentConfig:E}),v.operatorListChanged()}).catch(y),w}getOperatorList({intent:e="display",annotationMode:i=ig.ENABLE,printAnnotationStorage:r=null,isEditing:o=!1}={}){var n;function s(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}const a=this._transport.getRenderingIntent(e,i,r,o,!0);let l=this._intentStates.get(a.cacheKey);l||(l=Object.create(null),this._intentStates.set(a.cacheKey,l));let c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=s,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(n=this._stats)==null||n.time("Page Request"),this._pumpOperatorList(a)),l.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=>JE.textContent(r));const i=this.streamTextContent(e);return new Promise(function(r,o){function n(){s.read().then(function({value:l,done:c}){if(c){r(a);return}a.lang??(a.lang=l.lang),Object.assign(a.styles,l.styles),a.items.push(...l.items),n()},o)}const s=i.getReader(),a={items:[],styles:Object.create(null),lang:null};n()})}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(),ie(this,Cg,!1),oe(this,dh,kL).call(this),Promise.all(e)}cleanup(e=!1){ie(this,Cg,!0);const i=oe(this,dh,g6).call(this,!1);return e&&i&&this._stats&&(this._stats=new OEe),i}_startRenderPage(e,i){var r,o;const n=this._intentStates.get(i);n&&((r=this._stats)==null||r.timeEnd("Page Request"),(o=n.displayReadyCapability)==null||o.resolve(e))}_renderPageChunk(e,i){for(let r=0,o=e.length;r<o;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&&oe(this,dh,g6).call(this,!0)}_pumpOperatorList({renderingIntent:e,cacheKey:i,annotationStorageSerializable:r,modifiedIds:o}){const{map:n,transfer:s}=r,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n,modifiedIds:o},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();oe(this,dh,g6).call(this,!0)}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 NZ){let o=CUi;i.extraDelay>0&&i.extraDelay<1e3&&(o+=i.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},o);return}}if(e.streamReader.cancel(new og(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[o,n]of this._intentStates)if(n===e){this._intentStates.delete(o);break}this.cleanup()}}}get stats(){return this._stats}}am=new WeakMap,Cg=new WeakMap,dh=new WeakSet,g6=function(t=!1){if(oe(this,dh,kL).call(this),!S(this,Cg)||this.destroyed)return!1;if(t)return ie(this,am,setTimeout(()=>{ie(this,am,null),oe(this,dh,g6).call(this,!1)},yUi)),!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(),ie(this,Cg,!1),!0},kL=function(){S(this,am)&&(clearTimeout(S(this,am)),ie(this,am,null))};var yg,MX;class DUi{constructor(){ce(this,yg,new Map),ce(this,MX,Promise.resolve())}postMessage(e,i){const r={data:structuredClone(e,i?{transfer:i}:null)};S(this,MX).then(()=>{for(const[o]of S(this,yg))o.call(this,r)})}addEventListener(e,i,r=null){let o=null;if(r?.signal instanceof AbortSignal){const{signal:n}=r;if(n.aborted){or("LoopbackPort - cannot use an `aborted` signal.");return}const s=()=>this.removeEventListener(e,i);o=()=>n.removeEventListener("abort",s),n.addEventListener("abort",s)}S(this,yg).set(i,o)}removeEventListener(e,i){const r=S(this,yg).get(i);r?.(),S(this,yg).delete(i)}terminate(){for(const[,e]of S(this,yg))e?.();S(this,yg).clear()}}yg=new WeakMap,MX=new WeakMap;var SX,f6,lm,jI,ML,zI,SL;const wg=class Fl{constructor({name:e=null,port:i=null,verbosity:r=sFi()}={}){ce(this,jI);var o;if(this.name=e,this.destroyed=!1,this.verbosity=r,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,i){if((o=S(Fl,lm))!=null&&o.has(i))throw new Error("Cannot use more than one PDFWorker per port.");(S(Fl,lm)||ie(Fl,lm,new WeakMap)).set(i,this),this._initializeFromPort(i);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new QI("main","worker",e),this._messageHandler.on("ready",function(){}),oe(this,jI,ML).call(this)}_initialize(){if(S(Fl,f6)||S(Fl,zI,SL)){this._setupFakeWorker();return}let{workerSrc:e}=Fl;try{Fl._isSameOrigin(window.location.href,e)||(e=Fl._createCDNWrapper(new URL(e,window.location).href));const i=new Worker(e,{type:"module"}),r=new QI("main","worker",i),o=()=>{n.abort(),r.destroy(),i.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;i.addEventListener("error",()=>{this._webWorker||o()},{signal:n.signal}),r.on("test",a=>{if(n.abort(),this.destroyed||!a){o();return}this._messageHandler=r,this._port=i,this._webWorker=i,oe(this,jI,ML).call(this)}),r.on("ready",a=>{if(n.abort(),this.destroyed){o();return}try{s()}catch{this._setupFakeWorker()}});const s=()=>{const a=new Uint8Array;r.send("test",a,[a.buffer])};s();return}catch{mR("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){S(Fl,f6)||(or("Setting up fake worker."),ie(Fl,f6,!0)),Fl._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const i=new DUi;this._port=i;const r=`fake${_l(Fl,SX)._++}`,o=new QI(r+"_worker",r,i);e.setup(o,i),this._messageHandler=new QI(r,r+"_worker",i),oe(this,jI,ML).call(this)}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){var e,i,r;this.destroyed=!0,(e=this._webWorker)==null||e.terminate(),this._webWorker=null,(i=S(Fl,lm))==null||i.delete(this._port),this._port=null,(r=this._messageHandler)==null||r.destroy(),this._messageHandler=null}static fromPort(e){var i;if(!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const r=(i=S(this,lm))==null?void 0:i.get(e.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new Fl(e)}static get workerSrc(){if(mg.workerSrc)return mg.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return gr(this,"_setupFakeWorkerGlobal",(async()=>S(this,zI,SL)?S(this,zI,SL):(await import(this.workerSrc)).WorkerMessageHandler)())}};SX=new WeakMap,f6=new WeakMap,lm=new WeakMap,jI=new WeakSet,ML=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},zI=new WeakSet,SL=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},ce(wg,zI),ce(wg,SX,0),ce(wg,f6,!1),ce(wg,lm),Ua&&(ie(wg,f6,!0),mg.workerSrc||(mg.workerSrc="./pdf.worker.mjs")),wg._isSameOrigin=(t,e)=>{let i;try{if(i=new URL(t),!i.origin||i.origin==="null")return!1}catch{return!1}const r=new URL(e,i);return i.origin===r.origin},wg._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let QL=wg;var bg,$1,qI,KI,Ig,m6,JI;class PUi{constructor(e,i,r,o,n){ce(this,m6),ce(this,bg,new Map),ce(this,$1,new Map),ce(this,qI,new Map),ce(this,KI,new Map),ce(this,Ig,null),this.messageHandler=e,this.loadingTask=i,this.commonObjs=new dke,this.fontLoader=new MFi({ownerDocument:o.ownerDocument,styleElement:o.styleElement}),this.loadingParams=o.loadingParams,this._params=o,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return gr(this,"annotationStorage",new AX)}getRenderingIntent(e,i=ig.ENABLE,r=null,o=!1,n=!1){let s=Xc.DISPLAY,a=dX;switch(e){case"any":s=Xc.ANY;break;case"display":break;case"print":s=Xc.PRINT;break;default:or(`getRenderingIntent - invalid intent: ${e}`)}const l=s&Xc.PRINT&&r instanceof Bxe?r:this.annotationStorage;switch(i){case ig.DISABLE:s+=Xc.ANNOTATIONS_DISABLE;break;case ig.ENABLE:break;case ig.ENABLE_FORMS:s+=Xc.ANNOTATIONS_FORMS;break;case ig.ENABLE_STORAGE:s+=Xc.ANNOTATIONS_STORAGE,a=l.serializable;break;default:or(`getRenderingIntent - invalid annotationMode: ${i}`)}o&&(s+=Xc.IS_EDITING),n&&(s+=Xc.OPLIST);const{ids:c,hash:d}=l.modifiedIds,u=[s,a.hash,d];return{renderingIntent:s,cacheKey:u.join("_"),annotationStorageSerializable:a,modifiedIds:c}}destroy(){var e;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(e=S(this,Ig))==null||e.reject(new Error("Worker was destroyed during onPassword callback"));const i=[];for(const o of S(this,$1).values())i.push(o._destroy());S(this,$1).clear(),S(this,qI).clear(),S(this,KI).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return i.push(r),Promise.all(i).then(()=>{var o,n;this.commonObjs.clear(),this.fontLoader.clear(),S(this,bg).clear(),this.filterFactory.destroy(),xX.cleanup(),(o=this._networkStream)==null||o.cancelAllRequests(new og("Worker was terminated.")),(n=this.messageHandler)==null||n.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:i}=this;e.on("GetReader",(r,o)=>{$n(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},o.onPull=()=>{this._fullReader.read().then(function({value:n,done:s}){if(s){o.close();return}$n(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),o.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{o.error(n)})},o.onCancel=n=>{this._fullReader.cancel(n),o.ready.catch(s=>{if(!this.destroyed)throw s})}}),e.on("ReaderHeadersReady",async r=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:n,isRangeSupported:s,contentLength:a}=this._fullReader;return(!n||!s)&&(this._lastProgress&&((o=i.onProgress)==null||o.call(i,this._lastProgress)),this._fullReader.onProgress=l=>{var c;(c=i.onProgress)==null||c.call(i,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:n,isRangeSupported:s,contentLength:a}}),e.on("GetRangeReader",(r,o)=>{$n(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(r.begin,r.end);if(!n){o.close();return}o.onPull=()=>{n.read().then(function({value:s,done:a}){if(a){o.close();return}$n(s instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),o.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{o.error(s)})},o.onCancel=s=>{n.cancel(s),o.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 SUi(r,this))}),e.on("DocException",r=>{i._capability.reject(cc(r))}),e.on("PasswordRequest",r=>{ie(this,Ig,Promise.withResolvers());try{if(!i.onPassword)throw cc(r);const o=n=>{n instanceof Error?S(this,Ig).reject(n):S(this,Ig).resolve({password:n})};i.onPassword(o,r.code)}catch(o){S(this,Ig).reject(o)}return S(this,Ig).promise}),e.on("DataLoaded",r=>{var o;(o=i.onProgress)==null||o.call(i,{loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{this.destroyed||S(this,$1).get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,o,n])=>{var s;if(this.destroyed||this.commonObjs.has(r))return null;switch(o){case"Font":const{disableFontFace:a,fontExtraProperties:l,pdfBug:c}=this._params;if("error"in n){const h=n.error;or(`Error during font loading: ${h}`),this.commonObjs.resolve(r,h);break}const d=c&&(s=globalThis.FontInspector)!=null&&s.enabled?(h,g)=>globalThis.FontInspector.fontAdded(h,g):null,u=new SFi(n,{disableFontFace:a,fontExtraProperties:l,inspectFont:d});this.fontLoader.bind(u).catch(()=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!l&&u.data&&(u.data=null),this.commonObjs.resolve(r,u)});break;case"CopyLocalImage":const{imageRef:A}=n;$n(A,"The imageRef must be defined.");for(const h of S(this,$1).values())for(const[,g]of h.objs)if(g?.ref===A)return g.dataLen?(this.commonObjs.resolve(r,structuredClone(g)),g.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,n);break;default:throw new Error(`Got unknown common object type ${o}`)}return null}),e.on("obj",([r,o,n,s])=>{var a;if(this.destroyed)return;const l=S(this,$1).get(o);if(!l.objs.has(r)){if(l._intentStates.size===0){(a=s?.bitmap)==null||a.close();return}switch(n){case"Image":l.objs.resolve(r,s),s?.dataLen>tFi&&(l._maybeCleanupAfterRender=!0);break;case"Pattern":l.objs.resolve(r,s);break;default:throw new Error(`Got unknown object type ${n}`)}}}),e.on("DocProgress",r=>{var o;this.destroyed||(o=i.onProgress)==null||o.call(i,{loaded:r.loaded,total:r.total})}),e.on("FetchBuiltInCMap",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(r)}),e.on("FetchStandardFontData",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(r)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var e;this.annotationStorage.size<=0&&or("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:i,transfer:r}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:((e=this._fullReader)==null?void 0:e.filename)??null},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const i=e-1,r=S(this,qI).get(i);if(r)return r;const o=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&S(this,KI).set(n.refStr,e);const s=new QUi(i,n,this,this._params.pdfBug);return S(this,$1).set(i,s),s});return S(this,qI).set(i,o),o}getPageIndex(e){return ake(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 oe(this,m6,JI).call(this,"GetFieldObjects")}hasJSActions(){return oe(this,m6,JI).call(this,"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)}getDocJSActions(){return oe(this,m6,JI).call(this,"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 oe(this,m6,JI).call(this,"GetOptionalContentConfig").then(i=>new $Fi(i,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",i=S(this,bg).get(e);if(i)return i;const r=this.messageHandler.sendWithPromise(e,null).then(o=>{var n,s;return{info:o[0],metadata:o[1]?new ZFi(o[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((s=this._fullReader)==null?void 0:s.contentLength)??null}});return S(this,bg).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 S(this,$1).values())if(!i.cleanup())throw new Error(`startCleanup: Page ${i.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),S(this,bg).clear(),this.filterFactory.destroy(!0),xX.cleanup()}}cachedPageNumber(e){if(!ake(e))return null;const i=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return S(this,KI).get(i)??null}}bg=new WeakMap,$1=new WeakMap,qI=new WeakMap,KI=new WeakMap,Ig=new WeakMap,m6=new WeakSet,JI=function(t,e=null){const i=S(this,bg).get(t);if(i)return i;const r=this.messageHandler.sendWithPromise(t,e);return S(this,bg).set(t,r),r};const YI=Symbol("INITIAL_DATA");var Od,DL,QX;class dke{constructor(){ce(this,DL),ce(this,Od,Object.create(null))}get(e,i=null){if(i){const o=oe(this,DL,QX).call(this,e);return o.promise.then(()=>i(o.data)),null}const r=S(this,Od)[e];if(!r||r.data===YI)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const i=S(this,Od)[e];return!!i&&i.data!==YI}delete(e){const i=S(this,Od)[e];return!i||i.data===YI?!1:(delete S(this,Od)[e],!0)}resolve(e,i=null){const r=oe(this,DL,QX).call(this,e);r.data=i,r.resolve()}clear(){var e;for(const i in S(this,Od)){const{data:r}=S(this,Od)[i];(e=r?.bitmap)==null||e.close()}ie(this,Od,Object.create(null))}*[Symbol.iterator](){for(const e in S(this,Od)){const{data:i}=S(this,Od)[e];i!==YI&&(yield[e,i])}}}Od=new WeakMap,DL=new WeakSet,QX=function(t){var e;return(e=S(this,Od))[t]||(e[t]={...Promise.withResolvers(),data:YI})};var cm;class RUi{constructor(e){ce(this,cm,null),ie(this,cm,e),this.onContinue=null}get promise(){return S(this,cm).capability.promise}cancel(e=0){S(this,cm).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=S(this,cm).operatorList;if(!e)return!1;const{annotationCanvasMap:i}=S(this,cm);return e.form||e.canvas&&i?.size>0}}cm=new WeakMap;var dm,v6;const uke=class UE{constructor({callback:e,params:i,objs:r,commonObjs:o,annotationCanvasMap:n,operatorList:s,pageIndex:a,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:A=null}){ce(this,dm,null),this.callback=e,this.params=i,this.objs=r,this.commonObjs=o,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=a,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=u,this.pageColors=A,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 RUi(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.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:i}){var r,o;if(this.cancelled)return;if(this._canvas){if(S(UE,v6).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.");S(UE,v6).add(this._canvas)}this._pdfBug&&(r=globalThis.StepperManager)!=null&&r.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:s,transform:a,background:l}=this.params;this.gfx=new lL(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:a,viewport:s,transparency:e,background:l}),this.operatorListIdx=0,this.graphicsReady=!0,(o=this.graphicsReadyCallback)==null||o.call(this)}cancel(e=null,i=0){var r;this.running=!1,this.cancelled=!0,(r=this.gfx)==null||r.endDrawing(),S(this,dm)&&(window.cancelAnimationFrame(S(this,dm)),ie(this,dm,null)),S(UE,v6).delete(this._canvas),this.callback(e||new NZ(`Rendering cancelled, page ${this._pageIndex+1}`,i))}operatorListChanged(){var e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.stepper)==null||e.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?ie(this,dm,window.requestAnimationFrame(()=>{ie(this,dm,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.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),S(UE,v6).delete(this._canvas),this.callback())))}};dm=new WeakMap,v6=new WeakMap,ce(uke,v6,new WeakSet);let LUi=uke;const TUi="4.10.38",FUi="f9bea397f";function Ake(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function WI(t){return Math.max(0,Math.min(255,255*t))}class hke{static CMYK_G([e,i,r,o]){return["G",1-Math.min(1,.3*e+.59*r+.11*i+o)]}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=WI(e),[e,e,e]}static G_HTML([e]){const i=Ake(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(WI)}static RGB_HTML(e){return`#${e.map(Ake).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,i,r,o]){return["RGB",1-Math.min(1,e+o),1-Math.min(1,r+o),1-Math.min(1,i+o)]}static CMYK_rgb([e,i,r,o]){return[WI(1-Math.min(1,e+o)),WI(1-Math.min(1,r+o)),WI(1-Math.min(1,i+o))]}static CMYK_HTML(e){const i=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(i)}static RGB_CMYK([e,i,r]){const o=1-e,n=1-i,s=1-r,a=Math.min(o,n,s);return["CMYK",o,n,s,a]}}class UUi{create(e,i,r=!1){if(e<=0||i<=0)throw new Error("Invalid SVG dimensions");const o=this._createSVG("svg:svg");return o.setAttribute("version","1.1"),r||(o.setAttribute("width",`${e}px`),o.setAttribute("height",`${i}px`)),o.setAttribute("preserveAspectRatio","none"),o.setAttribute("viewBox",`0 0 ${e} ${i}`),o}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Mo("Abstract method `_createSVG` called.")}}class DX extends UUi{_createSVG(e){return document.createElementNS(H1,e)}}class pke{static setupStorage(e,i,r,o,n){const s=o.getValue(i,{value:null});switch(r.name){case"textarea":if(s.value!==null&&(e.textContent=s.value),n==="print")break;e.addEventListener("input",a=>{o.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"),n==="print")break;e.addEventListener("change",a=>{o.setValue(i,{value:a.target.checked?a.target.getAttribute("xfaOn"):a.target.getAttribute("xfaOff")})})}else{if(s.value!==null&&e.setAttribute("value",s.value),n==="print")break;e.addEventListener("input",a=>{o.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;o.setValue(i,{value:c})});break}}static setAttributes({html:e,element:i,storage:r=null,intent:o,linkService:n}){const{attributes:s}=i,a=e instanceof HTMLAnchorElement;s.type==="radio"&&(s.name=`${s.name}-${o}`);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&&n.addLinkAttributes(e,s.href,s.newWindow),r&&s.dataId&&this.setupStorage(e,s.dataId,i,r)}static render(e){var i,r;const o=e.annotationStorage,n=e.linkService,s=e.xfaHtml,a=e.intent||"display",l=document.createElement(s.name);s.attributes&&this.setAttributes({html:l,element:s,intent:a,linkService:n});const c=a!=="richText",d=e.div;if(d.append(l),e.viewport){const h=`matrix(${e.viewport.transform.join(",")})`;d.style.transform=h}c&&d.setAttribute("class","xfaLayer xfaFont");const u=[];if(s.children.length===0){if(s.value){const h=document.createTextNode(s.value);l.append(h),c&&JE.shouldBuildText(s.name)&&u.push(h)}return{textDivs:u}}const A=[[s,-1,l]];for(;A.length>0;){const[h,g,p]=A.at(-1);if(g+1===h.children.length){A.pop();continue}const m=h.children[++A.at(-1)[1]];if(m===null)continue;const{name:f}=m;if(f==="#text"){const y=document.createTextNode(m.value);u.push(y),p.append(y);continue}const C=(i=m?.attributes)!=null&&i.xmlns?document.createElementNS(m.attributes.xmlns,f):document.createElement(f);if(p.append(C),m.attributes&&this.setAttributes({html:C,element:m,storage:o,intent:a,linkService:n}),((r=m.children)==null?void 0:r.length)>0)A.push([m,-1,C]);else if(m.value){const y=document.createTextNode(m.value);c&&JE.shouldBuildText(f)&&u.push(y),C.append(y)}}for(const h of d.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const i=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=i,e.div.hidden=!1}}const ZI=1e3,NUi=9,um=new WeakSet;function Bg(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class _Ui{static create(e){switch(e.data.annotationType){case Cs.LINK:return new mke(e);case Cs.TEXT:return new HUi(e);case Cs.WIDGET:switch(e.data.fieldType){case"Tx":return new VUi(e);case"Btn":return e.data.radioButton?new vke(e):e.data.checkBox?new jUi(e):new zUi(e);case"Ch":return new qUi(e);case"Sig":return new GUi(e)}return new pm(e);case Cs.POPUP:return new RX(e);case Cs.FREETEXT:return new Ike(e);case Cs.LINE:return new JUi(e);case Cs.SQUARE:return new YUi(e);case Cs.CIRCLE:return new WUi(e);case Cs.POLYLINE:return new Bke(e);case Cs.CARET:return new XUi(e);case Cs.INK:return new _X(e);case Cs.POLYGON:return new ZUi(e);case Cs.HIGHLIGHT:return new Eke(e);case Cs.UNDERLINE:return new $Ui(e);case Cs.SQUIGGLY:return new eNi(e);case Cs.STRIKEOUT:return new tNi(e);case Cs.STAMP:return new xke(e);case Cs.FILEATTACHMENT:return new iNi(e);default:return new ws(e)}}}var Am,XI,$I,PL,PX;const OUi=class $Pe{constructor(e,{isRenderable:i=!1,ignoreBorder:r=!1,createQuadrilaterals:o=!1}={}){ce(this,PL),ce(this,Am,null),ce(this,XI,!1),ce(this,$I,null),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.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,i&&(this.container=this._createContainer(r)),o&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:i,richText:r}){return!!(e!=null&&e.str||i!=null&&i.str||r!=null&&r.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return $Pe._hasPopupData(this.data)}updateEdited(e){var i;if(!this.container)return;S(this,Am)||ie(this,Am,{rect:this.data.rect.slice(0)});const{rect:r}=e;r&&oe(this,PL,PX).call(this,r),(i=S(this,$I))==null||i.popup.updateEdited(e)}resetEdited(){var e;S(this,Am)&&(oe(this,PL,PX).call(this,S(this,Am).rect),(e=S(this,$I))==null||e.popup.resetEdited(),ie(this,Am,null))}_createContainer(e){const{data:i,parent:{page:r,viewport:o}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",i.id),this instanceof pm||(n.tabIndex=ZI);const{style:s}=n;if(s.zIndex=this.parent.zIndex++,i.alternativeText&&(n.title=i.alternativeText),i.noRotate&&n.classList.add("norotate"),!i.rect||this instanceof RX){const{rotation:p}=i;return!i.hasOwnCanvas&&p!==0&&this.setRotation(p,n),n}const{width:a,height:l}=Bg(i.rect);if(!e&&i.borderStyle.width>0){s.borderWidth=`${i.borderStyle.width}px`;const p=i.borderStyle.horizontalCornerRadius,m=i.borderStyle.verticalCornerRadius;if(p>0||m>0){const C=`calc(${p}px * var(--scale-factor)) / calc(${m}px * var(--scale-factor))`;s.borderRadius=C}else if(this instanceof vke){const C=`calc(${a}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`;s.borderRadius=C}switch(i.borderStyle.style){case iI.SOLID:s.borderStyle="solid";break;case iI.DASHED:s.borderStyle="dashed";break;case iI.BEVELED:or("Unimplemented border style: beveled");break;case iI.INSET:or("Unimplemented border style: inset");break;case iI.UNDERLINE:s.borderBottomStyle="solid";break}const f=i.borderColor||null;f?(ie(this,XI,!0),s.borderColor=bi.makeHexColor(f[0]|0,f[1]|0,f[2]|0)):s.borderWidth=0}const c=bi.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:A,pageY:h}=o.rawDims;s.left=`${100*(c[0]-A)/d}%`,s.top=`${100*(c[1]-h)/u}%`;const{rotation:g}=i;return i.hasOwnCanvas||g===0?(s.width=`${100*a/d}%`,s.height=`${100*l/u}%`):this.setRotation(g,n),n}setRotation(e,i=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:o}=this.parent.viewport.rawDims,{width:n,height:s}=Bg(this.data.rect);let a,l;e%180===0?(a=100*n/r,l=100*s/o):(a=100*s/r,l=100*n/o),i.style.width=`${a}%`,i.style.height=`${l}%`,i.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(i,r,o)=>{const n=o.detail[i],s=n[0],a=n.slice(1);o.target.style[r]=hke[`${s}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[r]:hke[`${s}_rgb`](a)})};return gr(this,"_commonActions",{display:i=>{const{display:r}=i.detail,o=r%2===1;this.container.style.visibility=o?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:o,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 o of Object.keys(i.detail)){const n=e[o]||r[o];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[o,n]of Object.entries(i)){const s=r[o];if(s){const a={detail:{[o]:n},target:e};s(a),delete i[o]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[i,r,o,n]=this.data.rect.map(p=>Math.fround(p));if(e.length===8){const[p,m,f,C]=e.subarray(2,6);if(o===p&&n===m&&i===f&&r===C)return}const{style:s}=this.container;let a;if(S(this,XI)){const{borderColor:p,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="${p}" stroke-width="${m}">`],this.container.classList.add("hasBorder")}const l=o-i,c=n-r,{svgFactory:d}=this,u=d.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const A=d.createElement("defs");u.append(A);const h=d.createElement("clipPath"),g=`clippath_${this.data.id}`;h.setAttribute("id",g),h.setAttribute("clipPathUnits","objectBoundingBox"),A.append(h);for(let p=2,m=e.length;p<m;p+=8){const f=e[p],C=e[p+1],y=e[p+2],v=e[p+3],w=d.createElement("rect"),b=(y-i)/l,E=(n-C)/c,k=(f-y)/l,x=(C-v)/c;w.setAttribute("x",b),w.setAttribute("y",E),w.setAttribute("width",k),w.setAttribute("height",x),h.append(w),a?.push(`<rect vector-effect="non-scaling-stroke" x="${b}" y="${E}" width="${k}" height="${x}"/>`)}S(this,XI)&&(a.push("</g></svg>')"),s.backgroundImage=a.join("")),this.container.append(u),this.container.style.clipPath=`url(#${g})`}_createPopup(){const{data:e}=this,i=ie(this,$I,new RX({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(i.render())}render(){Mo("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,i=null){const r=[];if(this._fieldObjects){const o=this._fieldObjects[e];if(o)for(const{page:n,id:s,exportValues:a}of o){if(n===-1||s===i)continue;const l=typeof a=="string"?a:null,c=document.querySelector(`[data-element-id="${s}"]`);if(c&&!um.has(c)){or(`_getElementsByName - element not allowed: ${s}`);continue}r.push({id:s,exportValue:l,domElement:c})}return r}for(const o of document.getElementsByName(e)){const{exportValue:n}=o,s=o.getAttribute("data-element-id");s!==i&&um.has(o)&&r.push({id:s,exportValue:n,domElement:o})}return r}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.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",()=>{var r;(r=this.linkService.eventBus)==null||r.dispatch("switchannotationeditormode",{source:this,mode:e,editId:i})})}};Am=new WeakMap,XI=new WeakMap,$I=new WeakMap,PL=new WeakSet,PX=function(t){const{container:{style:e},data:{rect:i,rotation:r},parent:{viewport:{rawDims:{pageWidth:o,pageHeight:n,pageX:s,pageY:a}}}}=this;i?.splice(0,4,...t);const{width:l,height:c}=Bg(t);e.left=`${100*(t[0]-s)/o}%`,e.top=`${100*(n-t[3]+a)/n}%`,r===0?(e.width=`${100*l/o}%`,e.height=`${100*c/n}%`):this.setRotation(r)};let ws=OUi;var uh,hm,gke,fke;class mke extends ws{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!(i!=null&&i.ignoreBorder),createQuadrilaterals:!0}),ce(this,uh),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:i}=this,r=document.createElement("a");r.setAttribute("data-element-id",e.id);let o=!1;return e.url?(i.addLinkAttributes(r,e.url,e.newWindow),o=!0):e.action?(this._bindNamedAction(r,e.action),o=!0):e.attachment?(oe(this,uh,gke).call(this,r,e.attachment,e.attachmentDest),o=!0):e.setOCGState?(oe(this,uh,fke).call(this,r,e.setOCGState),o=!0):e.dest?(this._bindLink(r,e.dest),o=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(r,e),o=!0),e.resetForm?(this._bindResetFormAction(r,e.resetForm),o=!0):this.isTooltipOnly&&!o&&(this._bindLink(r,""),o=!0)),this.container.classList.add("linkAnnotation"),o&&this.container.append(r),this.container}_bindLink(e,i){e.href=this.linkService.getDestinationHash(i),e.onclick=()=>(i&&this.linkService.goToDestination(i),!1),(i||i==="")&&oe(this,uh,hm).call(this)}_bindNamedAction(e,i){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(i),!1),oe(this,uh,hm).call(this)}_bindJSAction(e,i){e.href=this.linkService.getAnchorUrl("");const r=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const o of Object.keys(i.actions)){const n=r.get(o);n&&(e[n]=()=>{var s;return(s=this.linkService.eventBus)==null||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i.id,name:o}}),!1})}e.onclick||(e.onclick=()=>!1),oe(this,uh,hm).call(this)}_bindResetFormAction(e,i){const r=e.onclick;if(r||(e.href=this.linkService.getAnchorUrl("")),oe(this,uh,hm).call(this),!this._fieldObjects){or('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),r||(e.onclick=()=>!1);return}e.onclick=()=>{var o;r?.();const{fields:n,refs:s,include:a}=i,l=[];if(n.length!==0||s.length!==0){const u=new Set(s);for(const A of n){const h=this._fieldObjects[A]||[];for(const{id:g}of h)u.add(g)}for(const A of Object.values(this._fieldObjects))for(const h of A)u.has(h.id)===a&&l.push(h)}else for(const u of Object.values(this._fieldObjects))l.push(...u);const c=this.annotationStorage,d=[];for(const u of l){const{id:A}=u;switch(d.push(A),u.type){case"text":{const g=u.defaultValue||"";c.setValue(A,{value:g});break}case"checkbox":case"radiobutton":{const g=u.defaultValue===u.exportValues;c.setValue(A,{value:g});break}case"combobox":case"listbox":{const g=u.defaultValue||"";c.setValue(A,{value:g});break}default:continue}const h=document.querySelector(`[data-element-id="${A}"]`);if(h){if(!um.has(h)){or(`_bindResetFormAction - element not allowed: ${A}`);continue}}else continue;h.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}uh=new WeakSet,hm=function(){this.container.setAttribute("data-internal-link","")},gke=function(t,e,i=null){t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>{var r;return(r=this.downloadManager)==null||r.openOrDownloadData(e.content,e.filename,i),!1},oe(this,uh,hm).call(this)},fke=function(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),oe(this,uh,hm).call(this)};class HUi extends ws{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._createPopup(),this.container.append(e),this.container}}class pm extends ws{render(){return this.container}showElementAndHideCanvas(e){var i;this.data.hasOwnCanvas&&(((i=e.previousSibling)==null?void 0:i.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return El.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,i,r,o,n){r.includes("mouse")?e.addEventListener(r,s=>{var a;(a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:o,value:n(s),shift:s.shiftKey,modifier:this._getKeyModifier(s)}})}):e.addEventListener(r,s=>{var a;if(r==="blur"){if(!i.focused||!s.relatedTarget)return;i.focused=!1}else if(r==="focus"){if(i.focused)return;i.focused=!0}n&&((a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:o,value:n(s)}}))})}_setEventListeners(e,i,r,o){var n,s,a;for(const[l,c]of r)(c==="Action"||(n=this.data.actions)!=null&&n[c])&&((c==="Focus"||c==="Blur")&&(i||(i={focused:!1})),this._setEventListener(e,i,l,c,o),c==="Focus"&&!((s=this.data.actions)!=null&&s.Blur)?this._setEventListener(e,i,"blur","Blur",null):c==="Blur"&&!((a=this.data.actions)!=null&&a.Focus)&&this._setEventListener(e,i,"focus","Focus",null))}_setBackgroundColor(e){const i=this.data.backgroundColor||null;e.style.backgroundColor=i===null?"transparent":bi.makeHexColor(i[0],i[1],i[2])}_setTextStyle(e){const i=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,o=this.data.defaultAppearanceData.fontSize||NUi,n=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/(SZ*o))||1,u=c/d;s=Math.min(o,l(u/SZ))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-a);s=Math.min(o,l(c/SZ))}n.fontSize=`calc(${s}px * var(--scale-factor))`,n.color=bi.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(n.textAlign=i[this.data.textAlignment])}_setRequired(e,i){i?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",i)}}class VUi extends pm{constructor(e){const i=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:i})}setPropertyOnSiblings(e,i,r,o){const n=this.annotationStorage;for(const s of this._getElementsByName(e.name,e.id))s.domElement&&(s.domElement[i]=r),n.setValue(s.id,{[o]:r})}render(){var e,i;const r=this.annotationStorage,o=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const s=r.getValue(o,{value:this.data.fieldValue});let a=s.value||"";const l=r.getValue(o,{charLimit:this.data.maxLen}).charLimit;l&&a.length>l&&(a=a.slice(0,l));let c=s.formattedValue||((e=this.data.textContent)==null?void 0:e.join(`
5497
5497
  `))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const d={userValue:a,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=c??a,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",c??a),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),um.add(n),n.setAttribute("data-element-id",o),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=ZI,this._setRequired(n,this.data.required),l&&(n.maxLength=l),n.addEventListener("input",A=>{r.setValue(o,{value:A.target.value}),this.setPropertyOnSiblings(n,"value",A.target.value,"value"),d.formattedValue=null}),n.addEventListener("resetform",A=>{const h=this.data.defaultFieldValue??"";n.value=d.userValue=h,d.formattedValue=null});let u=A=>{const{formattedValue:h}=d;h!=null&&(A.target.value=h),A.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",h=>{var g;if(d.focused)return;const{target:p}=h;d.userValue&&(p.value=d.userValue),d.lastCommittedValue=p.value,d.commitKey=1,(g=this.data.actions)!=null&&g.Focus||(d.focused=!0)}),n.addEventListener("updatefromsandbox",h=>{this.showElementAndHideCanvas(h.target);const g={value(p){d.userValue=p.detail.value??"",r.setValue(o,{value:d.userValue.toString()}),p.target.value=d.userValue},formattedValue(p){const{formattedValue:m}=p.detail;d.formattedValue=m,m!=null&&p.target!==document.activeElement&&(p.target.value=m),r.setValue(o,{formattedValue:m})},selRange(p){p.target.setSelectionRange(...p.detail.selRange)},charLimit:p=>{var m;const{charLimit:f}=p.detail,{target:C}=p;if(f===0){C.removeAttribute("maxLength");return}C.setAttribute("maxLength",f);let y=d.userValue;!y||y.length<=f||(y=y.slice(0,f),C.value=d.userValue=y,r.setValue(o,{value:y}),(m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:y,willCommit:!0,commitKey:1,selStart:C.selectionStart,selEnd:C.selectionEnd}}))}};this._dispatchEventFromSandbox(g,h)}),n.addEventListener("keydown",h=>{var g;d.commitKey=1;let p=-1;if(h.key==="Escape"?p=0:h.key==="Enter"&&!this.data.multiLine?p=2:h.key==="Tab"&&(d.commitKey=3),p===-1)return;const{value:m}=h.target;d.lastCommittedValue!==m&&(d.lastCommittedValue=m,d.userValue=m,(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:m,willCommit:!0,commitKey:p,selStart:h.target.selectionStart,selEnd:h.target.selectionEnd}}))});const A=u;u=null,n.addEventListener("blur",h=>{var g,p;if(!d.focused||!h.relatedTarget)return;(g=this.data.actions)!=null&&g.Blur||(d.focused=!1);const{value:m}=h.target;d.userValue=m,d.lastCommittedValue!==m&&((p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:m,willCommit:!0,commitKey:d.commitKey,selStart:h.target.selectionStart,selEnd:h.target.selectionEnd}})),A(h)}),(i=this.data.actions)!=null&&i.Keystroke&&n.addEventListener("beforeinput",h=>{var g;d.lastCommittedValue=null;const{data:p,target:m}=h,{value:f,selectionStart:C,selectionEnd:y}=m;let v=C,w=y;switch(h.inputType){case"deleteWordBackward":{const b=f.substring(0,C).match(/\w*[^\w]*$/);b&&(v-=b[0].length);break}case"deleteWordForward":{const b=f.substring(C).match(/^[^\w]*\w*/);b&&(w+=b[0].length);break}case"deleteContentBackward":C===y&&(v-=1);break;case"deleteContentForward":C===y&&(w+=1);break}h.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:f,change:p||"",willCommit:!1,selStart:v,selEnd:w}})}),this._setEventListeners(n,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],h=>h.target.value)}if(u&&n.addEventListener("blur",u),this.data.comb){const A=(this.data.rect[2]-this.data.rect[0])/l;n.classList.add("comb"),n.style.letterSpacing=`calc(${A}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class GUi extends pm{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class jUi extends pm{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,i=this.data,r=i.id;let o=e.getValue(r,{value:i.exportValue===i.fieldValue}).value;typeof o=="string"&&(o=o!=="Off",e.setValue(r,{value:o})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return um.add(n),n.setAttribute("data-element-id",r),n.disabled=i.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=i.fieldName,o&&n.setAttribute("checked",!0),n.setAttribute("exportValue",i.exportValue),n.tabIndex=ZI,n.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})}),n.addEventListener("resetform",s=>{const a=i.defaultFieldValue||"Off";s.target.checked=a===i.exportValue}),this.enableScripting&&this.hasJSActions&&(n.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(n,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(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class vke extends pm{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 o=e.getValue(r,{value:i.fieldValue===i.buttonValue}).value;if(typeof o=="string"&&(o=o!==i.buttonValue,e.setValue(r,{value:o})),o)for(const s of this._getElementsByName(i.fieldName,r))e.setValue(s.id,{value:!1});const n=document.createElement("input");if(um.add(n),n.setAttribute("data-element-id",r),n.disabled=i.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=i.fieldName,o&&n.setAttribute("checked",!0),n.tabIndex=ZI,n.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})}),n.addEventListener("resetform",s=>{const a=i.defaultFieldValue;s.target.checked=a!=null&&a===i.buttonValue}),this.enableScripting&&this.hasJSActions){const s=i.buttonValue;n.addEventListener("updatefromsandbox",a=>{const l={value:c=>{const d=s===c.detail.value;for(const u of this._getElementsByName(c.target.name)){const A=d&&u.id===r;u.domElement&&(u.domElement.checked=A),e.setValue(u.id,{value:A})}}};this._dispatchEventFromSandbox(l,a)}),this._setEventListeners(n,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(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class zUi extends mke{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 qUi extends pm{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}),o=document.createElement("select");um.add(o),o.setAttribute("data-element-id",i),o.disabled=this.data.readOnly,this._setRequired(o,this.data.required),o.name=this.data.fieldName,o.tabIndex=ZI;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(o.size=this.data.options.length,this.data.multiSelect&&(o.multiple=!0)),o.addEventListener("resetform",d=>{const u=this.data.defaultFieldValue;for(const A of o.options)A.selected=A.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),n=!1),o.append(u)}let s=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),o.prepend(d),s=()=>{d.remove(),o.removeEventListener("input",s),s=null},o.addEventListener("input",s)}const a=d=>{const u=d?"value":"textContent",{options:A,multiple:h}=o;return h?Array.prototype.filter.call(A,g=>g.selected).map(g=>g[u]):A.selectedIndex===-1?null:A[A.selectedIndex][u]};let l=a(!1);const c=d=>{const u=d.target.options;return Array.prototype.map.call(u,A=>({displayValue:A.textContent,exportValue:A.value}))};return this.enableScripting&&this.hasJSActions?(o.addEventListener("updatefromsandbox",d=>{const u={value(A){s?.();const h=A.detail.value,g=new Set(Array.isArray(h)?h:[h]);for(const p of o.options)p.selected=g.has(p.value);e.setValue(i,{value:a(!0)}),l=a(!1)},multipleSelection(A){o.multiple=!0},remove(A){const h=o.options,g=A.detail.remove;h[g].selected=!1,o.remove(g),h.length>0&&Array.prototype.findIndex.call(h,p=>p.selected)===-1&&(h[0].selected=!0),e.setValue(i,{value:a(!0),items:c(A)}),l=a(!1)},clear(A){for(;o.length!==0;)o.remove(0);e.setValue(i,{value:null,items:[]}),l=a(!1)},insert(A){const{index:h,displayValue:g,exportValue:p}=A.detail.insert,m=o.children[h],f=document.createElement("option");f.textContent=g,f.value=p,m?m.before(f):o.append(f),e.setValue(i,{value:a(!0),items:c(A)}),l=a(!1)},items(A){const{items:h}=A.detail;for(;o.length!==0;)o.remove(0);for(const g of h){const{displayValue:p,exportValue:m}=g,f=document.createElement("option");f.textContent=p,f.value=m,o.append(f)}o.options.length>0&&(o.options[0].selected=!0),e.setValue(i,{value:a(!0),items:c(A)}),l=a(!1)},indices(A){const h=new Set(A.detail.indices);for(const g of A.target.options)g.selected=h.has(g.index);e.setValue(i,{value:a(!0)}),l=a(!1)},editable(A){A.target.disabled=!A.detail.editable}};this._dispatchEventFromSandbox(u,d)}),o.addEventListener("input",d=>{var u;const A=a(!0),h=a(!1);e.setValue(i,{value:A}),d.preventDefault(),(u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:l,change:h,changeEx:A,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(o,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)):o.addEventListener("input",function(d){e.setValue(i,{value:a(!0)})}),this.data.combo&&this._setTextStyle(o),this._setBackgroundColor(o),this._setDefaultPropertiesFromJS(o),this.container.append(o),this.container}}class RX extends ws{constructor(e){const{data:i,elements:r}=e;super(e,{isRenderable:ws._hasPopupData(i)}),this.elements=r,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new KUi({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,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}),i=[];for(const r of this.elements)r.popup=e,r.container.ariaHasPopup="dialog",i.push(r.data.id),r.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(r=>`${UZ}${r}`).join(",")),this.container}}var eB,LX,TX,tB,C6,jn,Eg,iB,RL,LL,rB,xg,Ah,kg,TL,Mg,FL,gm,y6,bs,UL,FX,Cke,yke,wke,bke,NL,_L,UX;class KUi{constructor({container:e,color:i,elements:r,titleObj:o,modificationDate:n,contentsObj:s,richText:a,parent:l,rect:c,parentRect:d,open:u}){ce(this,bs),ce(this,eB,oe(this,bs,wke).bind(this)),ce(this,LX,oe(this,bs,UX).bind(this)),ce(this,TX,oe(this,bs,_L).bind(this)),ce(this,tB,oe(this,bs,NL).bind(this)),ce(this,C6,null),ce(this,jn,null),ce(this,Eg,null),ce(this,iB,null),ce(this,RL,null),ce(this,LL,null),ce(this,rB,null),ce(this,xg,!1),ce(this,Ah,null),ce(this,kg,null),ce(this,TL,null),ce(this,Mg,null),ce(this,FL,null),ce(this,gm,null),ce(this,y6,!1);var A;ie(this,jn,e),ie(this,FL,o),ie(this,Eg,s),ie(this,Mg,a),ie(this,LL,l),ie(this,C6,i),ie(this,TL,c),ie(this,rB,d),ie(this,RL,r),ie(this,iB,OZ.toDateObject(n)),this.trigger=r.flatMap(h=>h.getElementsToTriggerPopup());for(const h of this.trigger)h.addEventListener("click",S(this,tB)),h.addEventListener("mouseenter",S(this,TX)),h.addEventListener("mouseleave",S(this,LX)),h.classList.add("popupTriggerArea");for(const h of r)(A=h.container)==null||A.addEventListener("keydown",S(this,eB));S(this,jn).hidden=!0,u&&oe(this,bs,NL).call(this)}render(){if(S(this,Ah))return;const e=ie(this,Ah,document.createElement("div"));if(e.className="popup",S(this,C6)){const n=e.style.outlineColor=bi.makeHexColor(...S(this,C6));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?e.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`:e.style.backgroundColor=bi.makeHexColor(...S(this,C6).map(s=>Math.floor(.7*(255-s)+s)))}const i=document.createElement("span");i.className="header";const r=document.createElement("h1");if(i.append(r),{dir:r.dir,str:r.textContent}=S(this,FL),e.append(i),S(this,iB)){const n=document.createElement("span");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:S(this,iB).valueOf()})),i.append(n)}const o=S(this,bs,UL);if(o)pke.render({xfaHtml:o,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(S(this,Eg));e.append(n)}S(this,jn).append(e)}_formatContents({str:e,dir:i}){const r=document.createElement("p");r.classList.add("popupContent"),r.dir=i;const o=e.split(/(?:\r\n?|\n)/);for(let n=0,s=o.length;n<s;++n){const a=o[n];r.append(document.createTextNode(a)),n<s-1&&r.append(document.createElement("br"))}return r}updateEdited({rect:e,popupContent:i}){var r;S(this,gm)||ie(this,gm,{contentsObj:S(this,Eg),richText:S(this,Mg)}),e&&ie(this,kg,null),i&&(ie(this,Mg,oe(this,bs,yke).call(this,i)),ie(this,Eg,null)),(r=S(this,Ah))==null||r.remove(),ie(this,Ah,null)}resetEdited(){var e;S(this,gm)&&({contentsObj:_l(this,Eg)._,richText:_l(this,Mg)._}=S(this,gm),ie(this,gm,null),(e=S(this,Ah))==null||e.remove(),ie(this,Ah,null),ie(this,kg,null))}forceHide(){ie(this,y6,this.isVisible),S(this,y6)&&(S(this,jn).hidden=!0)}maybeShow(){S(this,y6)&&(S(this,Ah)||oe(this,bs,_L).call(this),ie(this,y6,!1),S(this,jn).hidden=!1)}get isVisible(){return S(this,jn).hidden===!1}}eB=new WeakMap,LX=new WeakMap,TX=new WeakMap,tB=new WeakMap,C6=new WeakMap,jn=new WeakMap,Eg=new WeakMap,iB=new WeakMap,RL=new WeakMap,LL=new WeakMap,rB=new WeakMap,xg=new WeakMap,Ah=new WeakMap,kg=new WeakMap,TL=new WeakMap,Mg=new WeakMap,FL=new WeakMap,gm=new WeakMap,y6=new WeakMap,bs=new WeakSet,UL=function(){const t=S(this,Mg),e=S(this,Eg);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&S(this,Mg).html||null},FX=function(){var t,e,i;return((i=(e=(t=S(this,bs,UL))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:i.fontSize)||0},Cke=function(){var t,e,i;return((i=(e=(t=S(this,bs,UL))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:i.color)||null},yke=function(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},r={style:{color:S(this,bs,Cke),fontSize:S(this,bs,FX)?`calc(${S(this,bs,FX)}px * var(--scale-factor))`:""}};for(const o of t.split(`