{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACrHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;;;;;;;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;AC9KA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;AC3EA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;;;;;;;;;;;;;;;ACTA;AACA;AACA;AACA;AAAA;AAAA;AAEA;;;;;;;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AAAA;AAAA;AAEA;;;;;;;;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAEA;AAAA;AAEA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAEA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;AAAA;AAEA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;;ACzCA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;ACnBA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;ACnBA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;AC1BA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;;;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AAAA;AAAA;AAEA;;;;;;;;;;;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;;;;;;;;;;;;;;ACrDA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC3ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1DA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAQA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACtUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACjGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AC5IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;ACvJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AC7OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC5CA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;AC5BA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;ACpLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AAGA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;AClNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAGA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACrHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;ACxNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;AChSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACrDA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;ACxZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;ACxIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAIA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AAIA;AAAA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;ACvWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AC5fA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAIA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;AC9GA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACjRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;ACjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;ACnJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;AChQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAKA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACnIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACztBA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAGA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAIA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;;;;;;;;;;;;;;;AC5+DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChHA;AACA;;;;;;;;;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxVA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAGA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACzsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC5JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC9BA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACnDA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC9KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACncA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;AC7IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACnTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AChSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACpJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;ACxXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AAEA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;;;;;;;;;;;;;;ACnCA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAIA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAIA;AAIA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAIA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AAIA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAIA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAoCA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AC13SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACz2CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAGA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;AChkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;AChGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAIA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;;;;;;;;;;;;;;;;AClBA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;;;;;;;;;;;;;;;;ACjBA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAGA;;;;;;;;;;;;;;;;;;;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAEA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AASA;;;;;;;;;;;;;;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AAEA;AAAA;AAAA;AACA;AAAA;AAIA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAGA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAGA;;;;;;;;;;;;;;;;;;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AAAA;AAGA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAEA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;;;;;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAEA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AAGA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAAA;;;;;;;;;;;;;;;;;;;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAEA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;;;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;;;;;;;;;;;;;;;;ACxBA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;;;;;;;;;;;;;;;;;ACJA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;AC7BA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AAAA;;;;;;;;;;;;;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;AClDA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;;;;;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;;;;;;;;;;;;;;;;;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAKA;AAAA;AAEA;AACA;;;;;;;;;;;;;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAAA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AACA;AAAA;AAEA;AAAA;AAGA;AACA;AAEA;AAAA;AACA;AAAA;AAEA;AACA;AAEA;AAAA;AACA;AAAA;AAEA;AACA;AAEA;AAAA;AACA;AAAA;AAEA;AACA;AAAA;AAEA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAIA;AAAA;AAAA;AACA;AAGA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAAA;AAIA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;AC7JA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;;;;;;;;;;;;;;;;;ACjDA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;;;;;;;;;;;;;;;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;;;;;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACNA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AAYA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA","sources":["webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/Color.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/ColorPicker.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/Contextbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/DragMoveHandler.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/Dropdown.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/DropdownMenu.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/DropdownSeparator.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/Icon.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/Loader.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/RangeSlider.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/StrokeStylePicker.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/StrokeWidthPicker.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/Toolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/ToolbarButton.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/ToolbarFileButton.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/ToolbarItemGroup.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/ToolbarSeparator.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/Tools.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/TooltipManager.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/TranslationManager.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/classNames.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/icons.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/common/utils.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/custom/history.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/index.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/lib/hyperapp/index.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/CanvasLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/CanvasModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/eraser/EraserLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/eraser/EraserModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/eraser/EraserToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/CheckBoxWidget.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/ComboBoxWidget.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/EditFormFieldLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/FormFieldModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/ListBoxWidget.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/RadioButtonWidget.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/SelectListWidget.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/TextBoxWidget.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/form-fields/WidgetBase.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/freetext-annotation/FreetextAnnotationModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/freetext-annotation/RichTextEditor.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/highlight-annotation/HighlightAnnotationModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/image-annotations/ImageAnnotationModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/index.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/ink-annotation/AddInkAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/ink-annotation/AddInkAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/ink-annotation/EditInkAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/ink-annotation/EditInkAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/ink-annotation/InkAnnotationModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/popup/Popup.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/popup/PopupLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/popup/PopupModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/print-service/PrintServiceDialog.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/print-service/PrintServiceLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/print-service/PrintServiceModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/shape-annotations/AddShapeAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/shape-annotations/AddShapeAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/shape-annotations/EditShapeAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/shape-annotations/EditShapeAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/shape-annotations/ShapeAnnotationModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/stamp-annotation/AddStampAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/stamp-annotation/AddStampAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/stamp-annotation/StampAnnotationModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/text-annotation/AddTextAnnotationLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/text-annotation/AddTextAnnotationToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/modules/text-annotation/TextAnnotationModule.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-api/ImageContainer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-api/PdfViewerApi.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-api/PdfViewingWrapper.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-api/annotationDefaultBehaviors.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-api/enums.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-api/index.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-api/types.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/CanvasEvents.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/PdfViewerCanvas.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/annotations.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/appState.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/canvas.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/document.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/pointer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/scroll.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/search.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/store.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/state/viewer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/ScrollLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/canvasShapes.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-viewing/PdfViewing.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/PdfWebViewer.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/UserSettings.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/WebViewerOptions.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/state/index.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/state/layout.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/state/navigationPanel.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/state/passwordForm.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/state/pdfDocument.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/state/search.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/App.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/CustomButtons.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/DropZone.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/Layout.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/annotationbar/Annotationbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/AddonsToolbar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/AppBar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/DocumentBar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/Menu.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/NavigationBar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/SearchBar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/SearchOptions.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/ViewBar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/appbar/ZoomBar.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/ApplicationError.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/LoadApplication.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/LoadFile.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/Modal.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/OpenFile.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/OpenFileError.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/PasswordForm.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/SaveFile.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/modal/UnsavedChanges.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/navigation/AnnotationList.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/navigation/AnnotationListItem.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/navigation/NavigationPanel.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/navigation/OutlineList.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/navigation/OutlineNavigation.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/../../packages/four-heights-pdf-web-viewer/build/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.js","webpack://@pdf-tools/pdf-web-viewer-demowebapp/webpack/bootstrap","webpack://@pdf-tools/pdf-web-viewer-demowebapp/webpack/runtime/define property getters","webpack://@pdf-tools/pdf-web-viewer-demowebapp/webpack/runtime/hasOwnProperty shorthand","webpack://@pdf-tools/pdf-web-viewer-demowebapp/webpack/runtime/make namespace object","webpack://@pdf-tools/pdf-web-viewer-demowebapp/./src/index.js"],"sourcesContent":["/** internal */\nexport class Color {\n constructor(color) {\n this.pR = 0;\n this.pG = 0;\n this.pB = 0;\n this.pA = 0;\n color = color.replace(/\\s+/gi, '');\n if (color === 'transparent') {\n this.pR = 255;\n this.pG = 255;\n this.pB = 255;\n this.pA = 0;\n }\n else if (color.indexOf('#') === 0) {\n if (color.length === 4) {\n this.pR = parseInt(color.substring(1, 2), 16);\n this.pG = parseInt(color.substring(2, 3), 16);\n this.pB = parseInt(color.substring(3, 4), 16);\n this.pA = 255;\n }\n else if (color.length === 5) {\n this.pR = parseInt(color.substring(1, 2), 16);\n this.pG = parseInt(color.substring(2, 3), 16);\n this.pB = parseInt(color.substring(3, 4), 16);\n this.pA = parseInt(color.substring(4, 5), 16);\n }\n else if (color.length === 7) {\n this.pR = parseInt(color.substring(1, 3), 16);\n this.pG = parseInt(color.substring(3, 5), 16);\n this.pB = parseInt(color.substring(5, 7), 16);\n this.pA = 255;\n }\n else if (color.length === 9) {\n this.pR = parseInt(color.substring(1, 3), 16);\n this.pG = parseInt(color.substring(3, 5), 16);\n this.pB = parseInt(color.substring(5, 7), 16);\n this.pA = parseInt(color.substring(7, 9), 16);\n }\n else {\n throw new Error('invalid color string: ' + color);\n }\n }\n else if (color.indexOf('rgb') === 0) {\n const values = color.substring(color.indexOf('(') + 1, color.indexOf(')')).split(',');\n if (values.length < 3 || values.length > 4) {\n throw new Error('invalid color string: ' + color);\n }\n this.pR = parseInt(values[0], 10);\n this.pG = parseInt(values[1], 10);\n this.pB = parseInt(values[2], 10);\n if (values.length === 4) {\n this.pA = Math.floor(parseFloat(values[3]) * 255);\n }\n else {\n this.pA = 255;\n }\n }\n else {\n throw new Error('invalid color string: ' + color);\n }\n }\n isDark() {\n return this.pR * 0.3 + this.pG * 0.59 + this.pB * 0.11 < 127;\n }\n get r() {\n return this.pR;\n }\n set r(r) {\n this.pR = r;\n }\n get g() {\n return this.pG;\n }\n set g(g) {\n this.pG = g;\n }\n get b() {\n return this.pB;\n }\n set b(b) {\n this.pB = b;\n }\n get a() {\n return Math.floor((this.pA / 255) * 1000) / 1000;\n }\n darken(percent) {\n const f = 1 - Math.abs(percent / 100);\n const r = Math.floor(this.pR * f);\n const g = Math.floor(this.pG * f);\n const b = Math.floor(this.pB * f);\n this.pR = r > 255 ? 255 : r;\n this.pG = g > 255 ? 255 : g;\n this.pB = b > 255 ? 255 : b;\n }\n setOpacity(opacity) {\n this.pA = Math.floor(opacity * 255);\n }\n toRgb() {\n return `rgb(${this.pR},${this.pG},${this.pB})`;\n }\n toRgba() {\n return `rgba(${this.pR},${this.pG},${this.pB},${this.a})`;\n }\n toHexRgb() {\n return `#${this.toHex(this.pR)}${this.toHex(this.pG)}${this.toHex(this.pB)}`;\n }\n toHexRgba() {\n return `#${this.toHex(this.pR)}${this.toHex(this.pG)}${this.toHex(this.pB)}${this.toHex(this.pA)}`;\n }\n toHex(value) {\n let h = value.toString(16);\n if (h.length === 1) {\n h = '0' + h;\n }\n return h;\n }\n}\n","import { h } from '../lib/hyperapp';\nimport { classNames } from './classNames';\nimport { Color } from '../common/Color';\nimport { DropdownComponent } from './Dropdown';\nimport { Icon } from './Icon';\nimport { tooltipManager } from './TooltipManager';\n/** internal */\nexport const ColorPicker = ({ icon, tooltip, disabled, colors, color, allowRgba = true, mode, onChange, }) => {\n const items = allowRgba ? colors : colors.filter((c) => new Color(c).a >= 1);\n if (mode === 'buttons' && window.innerWidth > 580) {\n return h(ColorPickerButtons, { icon: icon, colors: items, color: color, onChange: onChange });\n }\n else {\n return (h(ColorPickerDropdown, { icon: icon, tooltip: tooltip, disabled: disabled, colors: items, color: color, onChange: onChange }));\n }\n};\nconst ColorPickerDropdown = ({ icon, tooltip, disabled, colors, color, onChange, }) => {\n if (disabled) {\n return (h(\"div\", { class: \"pwv-ColorPicker pwv-Dropdown pwv-ToolbarItem pwv-disabled\" },\n h(\"button\", Object.assign({}, tooltipManager.createTooltip(tooltip), { oncreate: DropdownComponent.create, onremove: DropdownComponent.remove }),\n h(Icon, { icon: icon }),\n h(\"div\", { class: classNames('pwv-ColorPicker__selectedColor'), style: { backgroundColor: color } }))));\n }\n else {\n return (h(\"div\", { class: \"pwv-ColorPicker pwv-Dropdown pwv-ToolbarItem\" },\n h(\"button\", Object.assign({}, tooltipManager.createTooltip(tooltip), { oncreate: DropdownComponent.create, onremove: DropdownComponent.remove }),\n h(Icon, { icon: icon }),\n h(\"div\", { class: classNames('pwv-ColorPicker__selectedColor'), style: { backgroundColor: color } })),\n h(\"div\", { class: classNames('pwv-DropdownPanel', {\n 'pwv-DropdownPanel-wide': colors.length > 6,\n }) }, colors.map((c) => (h(\"button\", { disabled: c.toLowerCase() === color.toLowerCase(), class: classNames('pwv-ColorPicker__Button', {\n 'pwv-selected': c.toLowerCase() === color.toLowerCase(),\n }), onclick: (e) => {\n onChange && onChange(c);\n } },\n h(\"div\", { style: { backgroundColor: c } })))))));\n }\n};\nconst ColorPickerButtons = ({ icon, colors, color, onChange }) => {\n return (h(\"div\", { class: \"pwv-ColorPicker--buttons pwv-ToolbarItem\" }, colors.map((c) => (h(\"button\", { disabled: c.toLowerCase() === color.toLowerCase(), class: classNames('pwv-ColorPicker__Button', {\n 'pwv-selected': c.toLowerCase() === color.toLowerCase(),\n }), onclick: (e) => {\n onChange && onChange(c);\n } },\n h(\"div\", { style: { backgroundColor: c } }))))));\n};\n","import { h } from '../lib/hyperapp';\nconst stopPropagation = (e) => {\n e.stopPropagation();\n};\n/** internal */\nexport const Contextbar = ({}, children) => {\n return (h(\"div\", { class: \"pwv-contextbar\", oncreate: (element) => {\n element.addEventListener('click', (e) => {\n e.preventDefault();\n }, { passive: false });\n element.addEventListener('mousedown', stopPropagation, false);\n element.addEventListener('mousemove', stopPropagation, false);\n element.addEventListener('mouseup', stopPropagation, false);\n element.addEventListener('touchstart', stopPropagation, { passive: false });\n element.addEventListener('touchmove', stopPropagation, { passive: true });\n element.addEventListener('touchend', stopPropagation, { passive: true });\n } },\n h(\"div\", { class: \"pwv-contextbar-content\" }, children)));\n};\n","export class DragMoveHandler {\n /* tslint:disable-next-line:max-line-length */\n constructor(element, onDragStart, onDragMove, onDragEnd, onClick, onDblClick) {\n this.lastPosX = 0;\n this.lastPosY = 0;\n this.startPosX = 0;\n this.startPosY = 0;\n this.isSuspended = false;\n this.dragging = false;\n this.clickTimer = null;\n this.dragStartTimer = null;\n this.clickDuration = 250;\n this.dragStartDuration = 300;\n this.dblClickTimer = null;\n this.dblClickDuration = 250;\n this.suspend = this.suspend.bind(this);\n this.resume = this.resume.bind(this);\n this.onMouseDown = this.onMouseDown.bind(this);\n this.onTouchStart = this.onTouchStart.bind(this);\n this.start = this.start.bind(this);\n this.onMouseMove = this.onMouseMove.bind(this);\n this.onTouchMove = this.onTouchMove.bind(this);\n this.move = this.move.bind(this);\n this.onMouseUp = this.onMouseUp.bind(this);\n this.onTouchEnd = this.onTouchEnd.bind(this);\n this.end = this.end.bind(this);\n this.element = element;\n this.onDragStart = onDragStart;\n this.onDragMove = onDragMove;\n this.onDragEnd = onDragEnd;\n this.onClick = onClick;\n this.onDblClick = onDblClick;\n this.disableCanvasEvents = true;\n this.element.addEventListener('mousedown', this.onMouseDown, { passive: true });\n this.element.addEventListener('touchstart', this.onTouchStart, { passive: false });\n }\n suspend() {\n window.removeEventListener('mousemove', this.onMouseMove);\n window.removeEventListener('mouseup', this.onMouseUp);\n window.removeEventListener('touchmove', this.onTouchMove);\n window.removeEventListener('touchend', this.onTouchEnd);\n this.element.removeEventListener('mousedown', this.onMouseDown);\n this.element.removeEventListener('touchstart', this.onTouchStart);\n this.isSuspended = true;\n }\n resume() {\n if (this.isSuspended) {\n this.element.addEventListener('mousedown', this.onMouseDown, { passive: true });\n this.element.addEventListener('touchstart', this.onTouchStart, { passive: false });\n }\n }\n clearClickTimer() {\n if (this.clickTimer !== null) {\n window.clearTimeout(this.clickTimer);\n this.clickTimer = null;\n }\n }\n clearDblClickTimer() {\n if (this.dblClickTimer !== null) {\n window.clearTimeout(this.dblClickTimer);\n this.dblClickTimer = null;\n }\n }\n clearDragStartTimer() {\n if (this.dragStartTimer !== null) {\n window.clearTimeout(this.dragStartTimer);\n this.dragStartTimer = null;\n }\n }\n onMouseDown(e) {\n if (e.buttons === 1) {\n this.start(e.clientX, e.clientY);\n window.addEventListener('mousemove', this.onMouseMove, { passive: true });\n window.addEventListener('mouseup', this.onMouseUp, { passive: true });\n }\n }\n onTouchStart(e) {\n if (e.touches.length === 1) {\n this.start(e.touches[0].clientX, e.touches[0].clientY);\n window.addEventListener('touchmove', this.onTouchMove, { passive: false });\n window.addEventListener('touchend', this.onTouchEnd, { passive: false });\n }\n }\n start(clientX, clientY) {\n if (this.disableCanvasEvents) {\n window.dispatchEvent(new Event('pdfwebviewer.DragMoveHandlerStart'));\n }\n this.startPosX = this.lastPosX = clientX;\n this.startPosY = this.lastPosY = clientY;\n this.dragging = false;\n if (!this.dblClickTimer) {\n this.clickTimer = window.setTimeout(() => {\n this.clickTimer = null;\n }, this.clickDuration);\n this.dragStartTimer = window.setTimeout(() => {\n this.dragging = true;\n this.onDragStart({\n clientX: this.startPosX,\n clientY: this.startPosY,\n movementX: 0,\n movementY: 0,\n element: this.element,\n });\n }, this.dragStartDuration);\n }\n }\n onMouseMove(e) {\n this.move(e.clientX, e.clientY);\n }\n onTouchMove(e) {\n this.move(e.touches[0].clientX, e.touches[0].clientY);\n }\n move(clientX, clientY) {\n let movementX = clientX - this.lastPosX;\n let movementY = clientY - this.lastPosY;\n this.lastPosX = clientX;\n this.lastPosY = clientY;\n if (this.clickTimer || this.dragStartTimer) {\n if (Math.abs(movementX) > 5 || Math.abs(movementY) > 5) {\n this.clearClickTimer();\n this.clearDragStartTimer();\n this.dragging = true;\n this.onDragStart({\n clientX: this.startPosX,\n clientY: this.startPosY,\n movementX: 0,\n movementY: 0,\n element: this.element,\n });\n movementX = clientX - this.startPosX;\n movementY = clientY - this.startPosY;\n }\n }\n if (this.dragging) {\n this.onDragMove({ clientX, clientY, movementX, movementY, element: this.element });\n }\n }\n onMouseUp(e) {\n window.removeEventListener('mousemove', this.onMouseMove);\n window.removeEventListener('mouseup', this.onMouseUp);\n this.end();\n }\n onTouchEnd(e) {\n window.removeEventListener('touchmove', this.onTouchMove);\n window.removeEventListener('touchend', this.onTouchEnd);\n this.end();\n }\n end() {\n const moved = this.startPosX !== this.lastPosX || this.startPosY !== this.lastPosY;\n const clientX = this.lastPosX;\n const clientY = this.lastPosY;\n if (this.disableCanvasEvents) {\n window.dispatchEvent(new Event('pdfwebviewer.DragMoveHandlerEnd'));\n }\n if (this.dblClickTimer !== null) {\n this.clearDblClickTimer();\n if (this.onDblClick) {\n this.onDblClick({ clientX, clientY, movementX: 0, movementY: 0, element: this.element });\n }\n }\n else if (this.clickTimer !== null) {\n if (this.onClick) {\n this.onClick({ clientX, clientY, movementX: 0, movementY: 0, element: this.element });\n }\n this.dblClickTimer = window.setTimeout(() => {\n this.dblClickTimer = null;\n }, this.dblClickDuration);\n }\n if (this.dragging) {\n this.onDragEnd({ clientX, clientY, movementX: 0, movementY: 0, moved, element: this.element });\n }\n this.clearClickTimer();\n this.clearDragStartTimer();\n }\n}\n","import { h } from '../lib/hyperapp';\nimport { tooltipManager } from './TooltipManager';\nimport { Icon, icons } from './Icon';\nimport { classNames } from './classNames';\nexport const Dropdown = ({ disabled, text, icon, name, value, tooltip, width, className, items, align, hideCaret, renderButton, onChange, }) => {\n const selectedItem = items.find((item) => item.value === value);\n if (!text && selectedItem) {\n text = selectedItem.text;\n }\n const style = width\n ? {\n width: width + 'px',\n }\n : {};\n return (h(\"div\", { class: classNames('pwv-Dropdown', { 'pwv-disabled': disabled }, { 'pwv-Dropdown--alignLeft': !align || align === 'left' }, { 'pwv-Dropdown--alignRight': align === 'right' }, { 'pwv-Dropdown--alignCenter': align === 'center' }, className), style: style },\n h(\"button\", Object.assign({ name: name }, tooltipManager.createTooltip(tooltip), { oncreate: DropdownComponent.create, onremove: DropdownComponent.remove, disabled: disabled }),\n renderButton ? (renderButton(value, text)) : (h(\"span\", { class: \"pwv-Dropdown-text\" },\n icon && h(Icon, { icon: icon }),\n text)),\n !hideCaret && (h(\"span\", { class: \"pwv-Dropdown-caret\" },\n h(Icon, { icon: icons.dropdownCaret })))),\n !disabled && (h(\"div\", { class: \"pwv-DropdownPanel\" },\n h(\"ul\", null, items.map((item) => (h(\"li\", { class: \"pwv-DropdownItem\", onclick: () => onChange && onChange(item.value) }, item.renderItem ? (item.renderItem(item)) : (h(\"span\", { class: \"pwv-Dropdown-item-text\" }, item.text))))))))));\n};\nexport class DropdownComponent {\n static create(btnElement) {\n ;\n btnElement.parentElement.dropdown = new DropdownComponent(btnElement);\n }\n static remove(btnElement) {\n ;\n btnElement.parentElement.dropdown.unmount();\n }\n constructor(btnElement) {\n this.button = btnElement;\n this.element = btnElement.parentElement;\n this.handleOnClick = this.handleOnClick.bind(this);\n this.setMaxPanelHeight = this.setMaxPanelHeight.bind(this);\n this.button.addEventListener('click', this.handleOnClick, false);\n tooltipManager.bindCssTooltip(this.button);\n window.addEventListener('resize', this.setMaxPanelHeight);\n }\n unmount() {\n this.button.removeEventListener('click', this.handleOnClick);\n this.button.removeEventListener('resize', this.setMaxPanelHeight);\n }\n setMaxPanelHeight() {\n const dropdownPanel = this.element.querySelector('.pwv-DropdownPanel');\n if (dropdownPanel) {\n const maxHeight = window.innerHeight - dropdownPanel.getBoundingClientRect().top;\n if (dropdownPanel.scrollHeight > maxHeight) {\n dropdownPanel.style.maxHeight = `${maxHeight - 10}px`;\n dropdownPanel.classList.add('pwv-DropdownPanel--scroll');\n }\n else {\n dropdownPanel.style.maxHeight = '';\n dropdownPanel.classList.remove('pwv-DropdownPanel--scroll');\n }\n }\n }\n handleOnClick(e) {\n if (!this.element.classList.contains('pwv-Dropdown--open')) {\n this.element.classList.add('pwv-Dropdown--open');\n this.setMaxPanelHeight();\n const t = new Date().getTime();\n e.openDropdown = t;\n const closeDropdownPanel = (ev) => {\n if (ev.openDropdown !== t) {\n window.removeEventListener('click', closeDropdownPanel);\n this.element.classList.remove('pwv-Dropdown--open');\n }\n };\n window.addEventListener('click', closeDropdownPanel, false);\n }\n }\n}\n","import { h } from '../lib/hyperapp';\nimport { tooltipManager } from './TooltipManager';\nimport { Icon } from './Icon';\nimport { classNames } from './classNames';\nimport { DropdownComponent } from './Dropdown';\nexport const DropdownMenu = ({ icon, className, tooltip }, children) => {\n return (h(\"div\", { class: classNames('pwv-Dropdown', className) },\n h(\"button\", Object.assign({ class: \"pwv-ToolbarButton\" }, tooltipManager.createTooltip(tooltip), { oncreate: DropdownComponent.create, onremove: DropdownComponent.remove }), icon && h(Icon, { icon: icon })),\n h(\"div\", { class: \"pwv-DropdownPanel\" }, children)));\n};\n","import { h } from '../lib/hyperapp';\n/** internal */\nexport const DropdownSeparator = ({}) => {\n return (h(\"div\", { class: \"pwv-DropdownSeparator\" },\n h(\"span\", null)));\n};\n","import { h } from '../lib/hyperapp';\nimport { classNames } from './classNames';\nexport * from './icons';\n/** internal */\nexport const Icon = ({ icon, className, fill, bg, title }) => (h(\"span\", { class: classNames('pwv-icon', className), title: title },\n h(\"svg\", { viewBox: `0 0 ${icon.width} ${icon.height}` },\n icon.bg && bg && h(\"path\", { d: icon.bg, fill: bg }),\n h(\"path\", { d: icon.path, fill: fill, \"shape-rendering\": \"geometricPrecision\", \"stroke-width\": \"1px\" }))));\n","import { h } from '../lib/hyperapp';\n/** internal */\nexport const Loader = ({}) => {\n return (h(\"div\", { class: \"pwv-Loader\" },\n h(\"div\", null)));\n};\n","import { h } from '../lib/hyperapp';\nimport { DropdownComponent } from './Dropdown';\nimport { Icon, icons } from './Icon';\nimport { classNames } from './classNames';\nimport { tooltipManager } from './TooltipManager';\n/** internal */\nexport const RangeSlider = ({ min, max, value, icon, className, text, tooltip, label, disabled, onChange, }) => {\n const elmProps = {\n title: tooltip,\n };\n if (disabled) {\n return (h(\"div\", Object.assign({}, tooltipManager.createTooltip(tooltip), { class: classNames('pwv-RangeSlider', 'pwv-ToolbarItem', 'pwv-Dropdown', 'pwv-disabled', className) }),\n label ||\n (icon && (h(\"span\", { class: \"pwv-Dropdown-label\" },\n label,\n icon && h(Icon, { icon: icon })))),\n h(\"span\", { class: \"pwv-Dropdown-text\" }, text),\n h(\"span\", { class: \"pwv-Dropdown-caret\" },\n h(Icon, { icon: icons.dropdownCaret }))));\n }\n else {\n return (h(\"div\", { class: classNames('pwv-RangeSlider', 'pwv-commandbar-item', 'pwv-Dropdown', className) },\n h(\"button\", Object.assign({}, tooltipManager.createTooltip(tooltip), { oncreate: DropdownComponent.create, onremove: DropdownComponent.remove }),\n label ||\n (icon && (h(\"span\", { class: \"pwv-Dropdown-label\" },\n label,\n icon && h(Icon, { icon: icon })))),\n h(\"span\", { class: \"pwv-Dropdown-text\" }, text),\n h(\"span\", { class: \"pwv-Dropdown-caret\" },\n h(Icon, { icon: icons.dropdownCaret }))),\n h(\"div\", { class: \"pwv-DropdownPanel\" },\n h(\"input\", { type: \"range\", min: min, max: max, value: value, oninput: (e) => {\n const input = e.currentTarget;\n const intVal = parseInt(input.value, undefined);\n onChange(intVal);\n }, onchange: (e) => {\n e.preventDefault();\n const input = e.currentTarget;\n window.dispatchEvent(new Event('click'));\n } }))));\n }\n};\n","import { h } from '../lib/hyperapp';\nimport { AnnotationBorderStyle } from '../pdf-viewer-api';\nimport { Dropdown } from './Dropdown';\nconst StrokeItem = ({ value }) => {\n const strokeStyle = value === AnnotationBorderStyle.DASHED ? 'dashed' : 'solid';\n return (h(\"div\", { class: `pwv-stroke-style-picker-item pwv-stroke-style-${strokeStyle}` },\n h(\"span\", null)));\n};\nconst StrokeButton = ({ value }) => {\n const strokeStyle = value === AnnotationBorderStyle.DASHED ? 'dashed' : 'solid';\n return (h(\"div\", { class: `pwv-stroke-style-picker-button pwv-stroke-style-${strokeStyle}` },\n h(\"span\", null)));\n};\nexport const StrokeStylePicker = ({ disabled, value, tooltip, shapeType, onChange, }) => {\n const items = [AnnotationBorderStyle.SOLID, AnnotationBorderStyle.DASHED].map((item) => ({\n value: item,\n renderItem: (i) => h(StrokeItem, { value: item }),\n }));\n return (h(Dropdown, { className: `pwv-stroke-style-picker pwv-stroke-style-picker-${shapeType}`, align: \"right\", disabled: disabled, tooltip: tooltip, items: items, value: value, renderButton: (value) => h(StrokeButton, { value: value }), onChange: onChange }));\n};\n","import { h } from '../lib/hyperapp';\nimport { Dropdown } from './Dropdown';\nconst StrokeItem = ({ value, noneStrokeText }) => {\n if (value === 0) {\n return (h(\"div\", { class: \"pwv-stroke-width-picker-item\" },\n h(\"span\", null, noneStrokeText)));\n }\n return (h(\"div\", { class: \"pwv-stroke-width-picker-item\" },\n h(\"span\", null,\n value,\n \"pt\"),\n h(\"span\", { class: \"pwv-stroke-width\", style: { height: `${value}px` } })));\n};\nexport const StrokeWidthPicker = ({ disabled, noneStrokeText, strokeWidths, value, tooltip, onChange, }) => {\n const items = strokeWidths.map((item) => ({\n value: item,\n renderItem: (i) => h(StrokeItem, { value: i.value, noneStrokeText: noneStrokeText }),\n }));\n return (h(Dropdown, { className: \"pwv-stroke-width-picker\", align: \"right\", tooltip: tooltip, disabled: disabled, items: items, value: value, renderButton: (value) => h(StrokeItem, { value: value, noneStrokeText: noneStrokeText }), onChange: onChange }));\n};\n","import { h } from '../lib/hyperapp';\nimport { classNames } from './classNames';\n/** internal */\nexport const Toolbar = ({ className, dense, allowWrap, alignCenter }, children) => {\n return (h(\"div\", { class: classNames('pwv-Toolbar', { 'pwv-Toolbar--center': alignCenter }, { 'pwv-Toolbar--dense': dense }, { 'pwv-Toolbar--wrap': allowWrap }, className) }, children));\n};\n","import { h } from '../lib/hyperapp';\nimport { Icon } from './Icon';\nimport { classNames } from './classNames';\nimport { tooltipManager } from './TooltipManager';\n/** internal */\nexport const ToolbarButton = ({ icon, disabled, active, name, onClick, tooltip, className }, children) => {\n if (disabled) {\n return (h(\"button\", Object.assign({ name: name, disabled: disabled, oncreate: tooltipManager.bindCssTooltip }, tooltipManager.createTooltip(tooltip), { class: classNames('pwv-ToolbarButton', 'pwv-ToolbarButton--disabled', className) }),\n icon && h(Icon, { icon: icon }),\n children.length > 0 && h(\"span\", { class: \"pwv-ToolbarButton__Text\" }, children)));\n }\n else {\n return (h(\"button\", Object.assign({ name: name, oncreate: tooltipManager.bindCssTooltip }, tooltipManager.createTooltip(tooltip), { class: classNames('pwv-ToolbarButton', className, {\n 'pwv-ToolbarButton--selected': active,\n }), onclick: (e) => {\n onClick && onClick(e);\n } }),\n icon && h(Icon, { icon: icon }),\n children.length > 0 && h(\"span\", { class: \"pwv-ToolbarButton__Text\" }, children)));\n }\n};\n","import { h } from '../lib/hyperapp';\nimport { Icon } from './Icon';\nimport { classNames } from './classNames';\nimport { tooltipManager } from './TooltipManager';\n/** internal */\nexport const ToolbarFileButton = ({ icon, accept, className, tooltip, disabled, name, onFileSelected, }) => {\n if (disabled) {\n return (h(\"div\", Object.assign({ oncreate: tooltipManager.bindCssTooltip }, tooltipManager.createTooltip(tooltip), { class: classNames('pwv-ToolbarButton', 'pwv-ToolbarButton--disabled', className) }),\n h(Icon, { icon: icon })));\n }\n else {\n return (h(\"label\", Object.assign({ name: name, tabindex: \"auto\", oncreate: tooltipManager.bindCssTooltip }, tooltipManager.createTooltip(tooltip), { class: classNames('pwv-ToolbarButton', className) }),\n h(Icon, { icon: icon }),\n h(\"input\", { style: { display: 'none' }, type: \"file\", accept: accept, onchange: (e) => {\n if (onFileSelected && e.currentTarget.files && e.currentTarget.files.length) {\n const file = e.currentTarget.files[0];\n onFileSelected(file);\n e.currentTarget.value = '';\n }\n }, oncreate: (input) => {\n const id = 'fi_' + performance.now();\n input.id = id;\n const label = input.parentElement;\n label.setAttribute('for', id);\n } })));\n }\n};\n","import { h } from '../lib/hyperapp';\nimport { classNames } from './classNames';\n/** internal */\nexport const ToolbarItemGroup = ({ className, pushRight }, children) => {\n return (h(\"div\", { class: classNames('pwv-ToolbarItemGroup', className, {\n 'pwv-ToolbarItemGroup--pushRight': pushRight,\n }), oncreate: (element) => {\n if (pushRight) {\n element.parentNode.classList.add('pwv-Toolbar--paddingRight');\n }\n } }, children));\n};\n","import { h } from '../lib/hyperapp';\n/** internal */\nexport const ToolbarSeparator = ({}) => {\n return (h(\"div\", { class: \"pwv-ToolbarSeparator\" },\n h(\"span\", null)));\n};\n","import { PdfItemType } from '../pdf-viewer-api/enums';\nexport function convertPdfToCssPixel(pdfPixel) {\n const regex = /(\\d*\\.?\\d+)/.exec(pdfPixel);\n const size = regex && regex.length > 1 ? parseFloat(regex[1]) : 12;\n return roundToTwo((size / 72) * 96) + 'px';\n}\nexport function convertCssToPdfPixel(cssPixel) {\n const regex = /(\\d*\\.?\\d+)/.exec(cssPixel);\n const size = regex && regex.length > 1 ? parseFloat(regex[1]) : 12;\n return roundToTwo((size / 96) * 72) + 'pt';\n}\nexport function roundToTwo(num) {\n return Math.round(num * 100) / 100;\n}\nexport function getColorPalette(type, options) {\n if (type === PdfItemType.INK) {\n return options.annotation.colors.foregroundColors;\n }\n else {\n return options.annotation.colors.highlightColors;\n }\n}\nexport function createPdfTime() {\n const time = new Date();\n const year = time.getFullYear();\n let month = `${time.getMonth() + 1}`;\n month = padString(month, 2, '0');\n let day = `${time.getDate()}`;\n day = padString(day, 2, '0');\n let hour = `${time.getHours()}`;\n hour = padString(hour, 2, '0');\n let minutes = `${time.getMinutes()}`;\n minutes = padString(minutes, 2, '0');\n let seconds = `${time.getSeconds()}`;\n seconds = padString(seconds, 2, '0');\n let offsetString = time.getTimezoneOffset() < 0 ? '+' : '';\n const hourOffset = -1 * Math.floor(time.getTimezoneOffset() / 60);\n offsetString += padString(hourOffset.toString(), 2, '0') + `'`;\n const minuteOffset = -1 * Math.floor(time.getTimezoneOffset() % 60);\n offsetString += padString(minuteOffset.toString(), 2, '0') + `'`;\n const dateString = `(D:${year}${month}${day}${hour}${minutes}${seconds}${offsetString})`;\n return dateString;\n}\nexport const formatDate = (dateStr) => {\n if (dateStr.indexOf('(D:') === 0) {\n // todo: convert to local time\n return `${dateStr.substring(9, 11)}.${dateStr.substring(7, 11)}.${dateStr.substring(3, 7)} ${dateStr.substring(11, 13)}:${dateStr.substring(13, 15)}`;\n }\n return `${dateStr.substring(8, 10)}.${dateStr.substring(6, 8)}.${dateStr.substring(2, 6)} ${dateStr.substring(10, 12)}:${dateStr.substring(12, 14)}`;\n};\nexport function padString(s, paddingSize, fill) {\n if (s.length < paddingSize) {\n s = `${fill.repeat(paddingSize - s.length)}${s}`;\n }\n return s;\n}\nexport function imageDataUrlToUint8Array(dataUrl) {\n const base64 = dataUrl.replace(/^data:[a-z]+\\/[a-z]+;base64,/i, '');\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n const lookup = new Uint8Array(256);\n for (let i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n let bufferLength = base64.length * 0.75;\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n const arraybuffer = new ArrayBuffer(bufferLength);\n const bytes = new Uint8Array(arraybuffer);\n let p = 0;\n let encoded1 = 0;\n let encoded2 = 0;\n let encoded3 = 0;\n let encoded4 = 0;\n for (let i = 0; i < base64.length; i += 4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i + 1)];\n encoded3 = lookup[base64.charCodeAt(i + 2)];\n encoded4 = lookup[base64.charCodeAt(i + 3)];\n // tslint:disable: no-bitwise\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n return bytes;\n}\n","let tooltipType;\n/** internal */\nexport const tooltipManager = {\n setType: (type) => {\n tooltipType = type;\n },\n bindCssTooltip: (element, text) => {\n if (tooltipType !== 'css') {\n return;\n }\n element.onmouseover = (e) => {\n const elm = e.currentTarget;\n let viewerElm = elm.closest('.pwv-ViewerCanvas');\n if (!viewerElm) {\n viewerElm = elm.closest('.pwv-WebViewer');\n }\n if (viewerElm) {\n elm.classList.remove('pwv-tooltip-top', 'pwv-tooltip-left', 'pwv-tooltip-right', 'pwv-tooltip-bottom');\n const elmRect = elm.getBoundingClientRect();\n const viewerRect = viewerElm.getBoundingClientRect();\n const top = elmRect.top - viewerRect.top;\n const left = elmRect.left - viewerRect.left;\n const right = viewerRect.right - elmRect.right;\n const bottom = viewerRect.bottom - elmRect.bottom;\n top < 45\n ? element.classList.add('pwv-tooltip-bottom')\n : element.classList.add('pwv-tooltip-top');\n if (left < 45) {\n element.classList.add('pwv-tooltip-right');\n }\n else if (right < 45) {\n element.classList.add('pwv-tooltip-left');\n }\n }\n };\n },\n createTooltip: (text) => {\n if (!text) {\n return undefined;\n }\n switch (tooltipType) {\n case 'title':\n return {\n title: text,\n };\n case 'css':\n return {\n 'data-pwv-tooltip': text,\n };\n default:\n return undefined;\n }\n },\n};\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nlet translations = {};\nlet translationRequested = false;\n/** internal */\nexport const translationManager = {\n language: '',\n addTranslations: (res) => {\n translations = Object.assign(Object.assign({}, translations), res);\n },\n getText: (key) => {\n const res = translations[key];\n if (!res) {\n switch (key) {\n case 'applicationError.title':\n return 'Error';\n case 'applicationError.defaultMessage':\n return 'Configuration Error';\n case 'applicationError.reload':\n return '';\n }\n console.warn(`key not found ${key}`);\n return key;\n }\n return res;\n },\n loadTranslations: (language) => __awaiter(void 0, void 0, void 0, function* () {\n if (language !== translationManager.language ||\n (!translationRequested && Object.keys(translations).length === 0)) {\n translationManager.language = language;\n translationRequested = true;\n const translationFileUrl = window.Module.locateFile(`translations.${language}.json`);\n try {\n const res = yield fetch(translationFileUrl);\n if (res.ok) {\n translations = yield res.json();\n }\n else {\n throw new Error(`failed to load translation file '${translationFileUrl}`);\n }\n }\n catch (err) {\n // console.error(err)\n console.error(`**************************************\nFailed to load translations.${language}.js\n\n%cThe PDF Web Viewer failed to load a required script resource. Either the \"Base URL\" (PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL) is not configured correctly or the static assets have not been copied to the configured location. For more information please consult the documentation.\n\n%cwindow.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL=${window.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL}\n%c**************************************`, 'color: orange', 'color: gray', 'color: red');\n }\n }\n }),\n};\n","/** internal */\nexport const classNames = (...args) => {\n const classes = [];\n args.forEach((arg) => {\n if (typeof arg === 'string') {\n classes.push(arg);\n }\n else if (typeof arg === 'object') {\n const keys = Object.keys(arg);\n keys.forEach((k) => {\n if (arg[k]) {\n classes.push(k);\n }\n });\n }\n });\n return classes.join(' ');\n};\n","/** internal */\n/* tslint:disable:max-line-length */\nexport const icons = {\n openFile: {\n width: 576,\n height: 512,\n path: 'M527.95 224H480v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h385.057c28.068 0 54.135-14.733 68.599-38.84l67.453-112.464C588.24 264.812 565.285 224 527.95 224zM48 96h146.745l64 64H432c8.837 0 16 7.163 16 16v48H171.177c-28.068 0-54.135 14.733-68.599 38.84L32 380.47V112c0-8.837 7.163-16 16-16zm493.695 184.232l-67.479 112.464A47.997 47.997 0 0 1 433.057 416H44.823l82.017-136.696A48 48 0 0 1 168 256h359.975c12.437 0 20.119 13.568 13.72 24.232z',\n },\n saveFile: {\n width: 448,\n height: 512,\n path: 'M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM288 64v96H96V64h192zm128 368c0 8.822-7.178 16-16 16H48c-8.822 0-16-7.178-16-16V80c0-8.822 7.178-16 16-16h16v104c0 13.255 10.745 24 24 24h208c13.255 0 24-10.745 24-24V64.491a15.888 15.888 0 0 1 7.432 4.195l83.882 83.882A15.895 15.895 0 0 1 416 163.882V432zM224 232c-48.523 0-88 39.477-88 88s39.477 88 88 88 88-39.477 88-88-39.477-88-88-88zm0 144c-30.879 0-56-25.121-56-56s25.121-56 56-56 56 25.121 56 56-25.121 56-56 56z',\n },\n print: {\n width: 512,\n height: 512,\n path: 'M432 192h-16v-82.75c0-8.49-3.37-16.62-9.37-22.63L329.37 9.37c-6-6-14.14-9.37-22.63-9.37H126.48C109.64 0 96 14.33 96 32v160H80c-44.18 0-80 35.82-80 80v96c0 8.84 7.16 16 16 16h80v112c0 8.84 7.16 16 16 16h288c8.84 0 16-7.16 16-16V384h80c8.84 0 16-7.16 16-16v-96c0-44.18-35.82-80-80-80zM320 45.25L370.75 96H320V45.25zM128.12 32H288v64c0 17.67 14.33 32 32 32h64v64H128.02l.1-160zM384 480H128v-96h256v96zm96-128H32v-80c0-26.47 21.53-48 48-48h352c26.47 0 48 21.53 48 48v80zm-80-88c-13.25 0-24 10.74-24 24 0 13.25 10.75 24 24 24s24-10.75 24-24c0-13.26-10.75-24-24-24z',\n },\n docNavigation: {\n width: 512,\n height: 512,\n path: 'M464 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm16 400c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V192h448v240zM32 160V80c0-8.8 7.2-16 16-16h416c8.8 0 16 7.2 16 16v80H32z',\n },\n nextPage: {\n width: 448,\n height: 512,\n path: 'M216.464 36.465l-7.071 7.07c-4.686 4.686-4.686 12.284 0 16.971L387.887 239H12c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h375.887L209.393 451.494c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l211.051-211.05c4.686-4.686 4.686-12.284 0-16.971L233.434 36.465c-4.686-4.687-12.284-4.687-16.97 0z',\n },\n previousPage: {\n width: 448,\n height: 512,\n path: 'M231.536 475.535l7.071-7.07c4.686-4.686 4.686-12.284 0-16.971L60.113 273H436c6.627 0 12-5.373 12-12v-10c0-6.627-5.373-12-12-12H60.113L238.607 60.506c4.686-4.686 4.686-12.284 0-16.971l-7.071-7.07c-4.686-4.686-12.284-4.686-16.97 0L3.515 247.515c-4.686 4.686-4.686 12.284 0 16.971l211.051 211.05c4.686 4.686 12.284 4.686 16.97-.001z',\n },\n zoomIn: {\n width: 512,\n height: 512,\n path: 'M384 250v12c0 6.6-5.4 12-12 12h-98v98c0 6.6-5.4 12-12 12h-12c-6.6 0-12-5.4-12-12v-98h-98c-6.6 0-12-5.4-12-12v-12c0-6.6 5.4-12 12-12h98v-98c0-6.6 5.4-12 12-12h12c6.6 0 12 5.4 12 12v98h98c6.6 0 12 5.4 12 12zm120 6c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-32 0c0-119.9-97.3-216-216-216-119.9 0-216 97.3-216 216 0 119.9 97.3 216 216 216 119.9 0 216-97.3 216-216z',\n },\n zoomOut: {\n width: 512,\n height: 512,\n path: 'M140 274c-6.6 0-12-5.4-12-12v-12c0-6.6 5.4-12 12-12h232c6.6 0 12 5.4 12 12v12c0 6.6-5.4 12-12 12H140zm364-18c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-32 0c0-119.9-97.3-216-216-216-119.9 0-216 97.3-216 216 0 119.9 97.3 216 216 216 119.9 0 216-97.3 216-216z',\n },\n search: {\n width: 512,\n height: 512,\n path: 'M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395 312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5 0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17 0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208 32s176 78.7 176 176-78.7 176-176 176z',\n },\n fitActualSize: {\n width: 448,\n height: 512,\n path: 'M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v8c0 6.6-5.4 12-12 12H32v116c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zM300 32h124c13.3 0 24 10.7 24 24v124c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12V64H300c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12zm148 300v124c0 13.3-10.7 24-24 24H300c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h116V332c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12zM148 480H24c-13.3 0-24-10.7-24-24V332c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v116h116c6.6 0 12 5.4 12 12v8c0 6.6-5.4 12-12 12z',\n },\n fitWidth: {\n width: 512,\n height: 512,\n path: 'M399.959 170.585c-4.686 4.686-4.686 12.284 0 16.971L451.887 239H60.113l51.928-51.444c4.686-4.686 4.686-12.284 0-16.971l-7.071-7.07c-4.686-4.686-12.284-4.686-16.97 0l-84.485 84c-4.686 4.686-4.686 12.284 0 16.971l84.485 84c4.686 4.686 12.284 4.686 16.97 0l7.071-7.07c4.686-4.686 4.686-12.284 0-16.971L60.113 273h391.773l-51.928 51.444c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l84.485-84c4.687-4.686 4.687-12.284 0-16.971l-84.485-84c-4.686-4.686-12.284-4.686-16.97 0l-7.07 7.071z',\n },\n fitPage: {\n width: 512,\n height: 512,\n path: 'M337.782 434.704l-73.297 73.782c-4.686 4.686-12.284 4.686-16.971 0l-73.296-73.782c-4.686-4.686-4.686-12.284 0-16.97l7.07-7.07c4.686-4.686 12.284-4.686 16.971 0L239 451.887h1V272H60.113v1l41.224 40.741c4.686 4.686 4.686 12.284 0 16.971l-7.071 7.07c-4.686 4.686-12.284 4.686-16.97 0L3.515 264.485c-4.686-4.686-4.686-12.284 0-16.971l73.782-73.297c4.686-4.686 12.284-4.686 16.971 0l7.071 7.071c4.686 4.686 4.686 12.284 0 16.971L60.113 239v1H240V60.113h-1l-40.741 41.224c-4.686 4.686-12.284 4.686-16.971 0l-7.07-7.071c-4.686-4.686-4.687-12.284 0-16.97l73.297-73.782c4.686-4.686 12.284-4.686 16.971 0l73.297 73.782c4.686 4.686 4.686 12.284 0 16.971l-7.071 7.071c-4.686 4.686-12.284 4.686-16.971 0L273 60.113h-1V240h179.887v-1l-41.224-40.741c-4.686-4.686-4.686-12.284 0-16.971l7.071-7.07c4.686-4.686 12.284-4.686 16.97 0l73.782 73.297c4.687 4.686 4.686 12.284 0 16.971l-73.782 73.297c-4.686 4.686-12.284 4.686-16.97 0l-7.071-7.07c-4.686-4.686-4.686-12.284 0-16.971L451.887 273v-1H272v179.887h1l40.741-41.224c4.686-4.686 12.284-4.686 16.971 0l7.07 7.071c4.686 4.685 4.686 12.283 0 16.97z',\n },\n edit: {\n width: 576,\n height: 512,\n path: 'M417.8 315.5l20-20c3.8-3.8 10.2-1.1 10.2 4.2V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h292.3c5.3 0 8 6.5 4.2 10.2l-20 20c-1.1 1.1-2.7 1.8-4.2 1.8H48c-8.8 0-16 7.2-16 16v352c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V319.7c0-1.6.6-3.1 1.8-4.2zm145.9-191.2L251.2 436.8l-99.9 11.1c-13.4 1.5-24.7-9.8-23.2-23.2l11.1-99.9L451.7 12.3c16.4-16.4 43-16.4 59.4 0l52.6 52.6c16.4 16.4 16.4 43 0 59.4zm-93.6 48.4L403.4 106 169.8 339.5l-8.3 75.1 75.1-8.3 233.5-233.6zm71-85.2l-52.6-52.6c-3.8-3.8-10.2-4-14.1 0L426 83.3l66.7 66.7 48.4-48.4c3.9-3.8 3.9-10.2 0-14.1z',\n },\n stickyNote: {\n width: 512,\n height: 512,\n path: 'M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm32 352c0 17.6-14.4 32-32 32H293.3l-8.5 6.4L192 460v-76H64c-17.6 0-32-14.4-32-32V64c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v288zM280 240H136c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h144c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8zm96-96H136c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h240c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8z',\n bg: 'M 448,0 H 64 C 28.7,0 0,28.7 0,64 v 288 c 0,35.3 28.7,64 64,64 h 96 v 84 c 0,7.1 5.8,12 12,12 2.4,0 4.9,-0.7 7.1,-2.4 L 304,416 h 144 c 35.3,0 64,-28.7 64,-64 V 64 C 512,28.7 483.3,0 448,0 Z',\n },\n stickyNoteAdd: {\n width: 512,\n height: 512,\n path: 'M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm32 352c0 17.6-14.4 32-32 32H293.3l-8.5 6.4L192 460v-76H64c-17.6 0-32-14.4-32-32V64c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v288zM344 192h-72v-72c0-4.4-3.6-8-8-8h-16c-4.4 0-8 3.6-8 8v72h-72c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h72v72c0 4.4 3.6 8 8 8h16c4.4 0 8-3.6 8-8v-72h72c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8z',\n },\n stickyNoteEdit: {\n width: 512,\n height: 512,\n path: 'M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm32 352c0 17.6-14.4 32-32 32H293.3l-8.5 6.4L192 460v-76H64c-17.6 0-32-14.4-32-32V64c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v288zM336 105.4c-12.5-12.5-32.8-12.5-45.2 0l-126.1 126c-2 2-3.4 4.5-4.2 7.3l-16 61.2c-1.4 5.5.1 11.3 4.2 15.4 3 3 7.1 4.7 11.3 4.7 1.3 0 2.7-.2 4-.5l61.2-16c2.8-.7 5.3-2.2 7.3-4.2l126.1-126.1c12.5-12.5 12.5-32.8 0-45.2L336 105.4zM213 273.6l-30.6 8 8-30.6 75-75 22.6 22.6-75 75zm97.6-97.6L288 153.4l25.4-25.4 22.6 22.6-25.4 25.4z',\n },\n stickyNoteRemove: {\n width: 640,\n height: 512,\n path: 'M637 485.2l-96.7-76.1-22.5-17.7-443.2-349-5.2-4.1L23 1.8C19.6-1 14.5-.4 11.8 3l-10 12.5C-1 19-.4 24 3 26.8l61 48L96 100l360.7 284 15.9 12.5L617 510.2c3.4 2.8 8.5 2.2 11.2-1.2l10-12.5c2.8-3.5 2.2-8.5-1.2-11.3zM368 384h-10.7l-8.5 6.4L256 460v-76H128c-17.6 0-32-14.4-32-32V161.1l-32-25.2V352c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L368 416h51.7l-40.6-32H368zM512 32c17.6 0 32 14.4 32 32v286.9l28.2 22.2c2.3-6.6 3.8-13.7 3.8-21.1V64c0-35.3-28.7-64-64-64H128c-8.4 0-16.4 1.7-23.7 4.7L139 32h373z',\n },\n nextMatch: {\n width: 448,\n height: 512,\n path: 'M311.03 131.515l-7.071 7.07c-4.686 4.686-4.686 12.284 0 16.971L387.887 239H12c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h375.887l-83.928 83.444c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l116.485-116c4.686-4.686 4.686-12.284 0-16.971L328 131.515c-4.686-4.687-12.284-4.687-16.97 0z',\n },\n previousMatch: {\n width: 448,\n height: 512,\n path: 'M136.97 380.485l7.071-7.07c4.686-4.686 4.686-12.284 0-16.971L60.113 273H436c6.627 0 12-5.373 12-12v-10c0-6.627-5.373-12-12-12H60.113l83.928-83.444c4.686-4.686 4.686-12.284 0-16.971l-7.071-7.07c-4.686-4.686-12.284-4.686-16.97 0l-116.485 116c-4.686 4.686-4.686 12.284 0 16.971l116.485 116c4.686 4.686 12.284 4.686 16.97-.001z',\n },\n outlineOpen: {\n width: 320,\n height: 512,\n path: 'M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z',\n },\n outlineClosed: {\n width: 192,\n height: 512,\n path: 'M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z',\n },\n dropdownCaret: {\n width: 448,\n height: 512,\n path: 'M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z',\n },\n addLayer: {\n width: 512,\n height: 512,\n path: 'M504 96h-88V8c0-4.42-3.58-8-8-8h-16c-4.42 0-8 3.58-8 8v88h-88c-4.42 0-8 3.58-8 8v16c0 4.42 3.58 8 8 8h88v88c0 4.42 3.58 8 8 8h16c4.42 0 8-3.58 8-8v-88h88c4.42 0 8-3.58 8-8v-16c0-4.42-3.58-8-8-8zm-6.77 270.71l-99.72-42.87 99.72-42.87c8.35-3.6 12.19-13.23 8.58-21.52-3.65-8.29-13.32-12.13-21.74-8.48l-225.32 96.86c-1.81.77-3.74.77-5.48 0L45.23 258.4l193.45-83.16c8.35-3.59 12.19-13.23 8.58-21.52-3.65-8.28-13.26-12.13-21.74-8.48L14.81 235.81C5.81 239.66 0 248.52 0 258.4c0 9.87 5.81 18.74 14.77 22.58l99.73 42.87-99.7 42.85C5.81 370.55 0 379.42 0 389.31c0 9.87 5.81 18.74 14.77 22.58l225.32 96.84c5.06 2.17 10.48 3.28 15.9 3.28s10.84-1.09 15.9-3.28l225.29-96.83c9-3.85 14.81-12.72 14.81-22.59.01-9.89-5.8-18.76-14.76-22.6zM258.74 478.72c-1.81.77-3.74.77-5.48 0L45.23 389.29 156 341.68l84.1 36.15c5.06 2.17 10.48 3.28 15.9 3.28s10.84-1.09 15.9-3.28l84.12-36.16 110.78 47.62-208.06 89.43z',\n },\n eraser: {\n width: 512,\n height: 512,\n path: 'M497.942 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.744-18.744-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48 48 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12H323.883l174.059-174.059zM292.686 68.687c6.243-6.243 16.374-6.254 22.628-.001l160 160c6.243 6.243 6.253 16.374 0 22.627L358.627 368.001 176 185.373 292.686 68.687zM144 448a15.895 15.895 0 0 1-11.314-4.686l-96-96c-6.243-6.243-6.253-16.374 0-22.627L153.373 208 336 390.628l-52.686 52.686A15.895 15.895 0 0 1 272 448H144z',\n },\n ok: {\n width: 448,\n height: 512,\n path: 'M413.505 91.951L133.49 371.966l-98.995-98.995c-4.686-4.686-12.284-4.686-16.971 0L6.211 284.284c-4.686 4.686-4.686 12.284 0 16.971l118.794 118.794c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-11.314-11.314c-4.686-4.686-12.284-4.686-16.97 0z',\n },\n alignCenter: {\n width: 448,\n height: 512,\n path: 'M352 52v24a6 6 0 0 1-6 6H102a6 6 0 0 1-6-6V52a6 6 0 0 1 6-6h244a6 6 0 0 1 6 6zM6 210h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0 256h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm340-164H102a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6h244a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6z',\n },\n alignJustify: {\n width: 448,\n height: 512,\n path: 'M0 76V52a6 6 0 0 1 6-6h436a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6H6a6 6 0 0 1-6-6zm6 134h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0 256h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0-128h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6z',\n },\n alignLeft: {\n width: 448,\n height: 512,\n path: 'M288 52v24a6 6 0 0 1-6 6H6a6 6 0 0 1-6-6V52a6 6 0 0 1 6-6h276a6 6 0 0 1 6 6zM6 210h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0 256h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm276-164H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6h276a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6z',\n },\n alignRight: {\n width: 448,\n height: 512,\n path: 'M160 76V52a6 6 0 0 1 6-6h276a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6H166a6 6 0 0 1-6-6zM6 210h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0 256h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm160-128h276a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H166a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6z',\n },\n bold: {\n width: 320,\n height: 512,\n path: 'M249.139 242.128c33.922-18.988 53.22-53.503 53.22-95.748 0-42.421-19.499-80.713-49.665-97.55C232.561 37.505 207.478 32 176.01 32H12C5.373 32 0 37.373 0 44v8c0 6.627 5.373 12 12 12h19.95v384H12c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h169.68c19.934 0 45.622-1.177 67.493-10.348C292.198 451.781 320 406.247 320 353.65c0-52.496-28.196-96.372-70.861-111.522zM66.041 64.201H176.01c24.929 0 43.694 4.153 57.357 12.692 21.38 13.439 33.642 38.537 33.642 68.858 0 49.531-32.265 82.81-80.289 82.81H66.041V64.201zm167.194 375.685c-12.585 5.325-29.449 7.914-51.555 7.914H66.041V260.76h124.458c56.314 0 94.151 37.837 94.151 94.151 0 40.208-19.2 71.966-51.415 84.975z',\n },\n italic: {\n width: 256,\n height: 512,\n path: 'M102.791 64h45.215L73.143 448H23.762a12 12 0 0 0-11.764 9.632l-1.61 8C8.892 473.062 14.573 480 22.151 480h128.817a12 12 0 0 0 11.764-9.632l1.61-8c1.495-7.43-4.186-14.368-11.764-14.368h-45.215l74.864-384h50.011a12 12 0 0 0 11.764-9.632l1.61-8C247.108 38.938 241.427 32 233.849 32H104.401a12 12 0 0 0-11.764 9.632l-1.61 8C89.532 57.062 95.213 64 102.791 64z',\n },\n underline: {\n width: 448,\n height: 512,\n path: 'M0 500v-8c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12H12c-6.627 0-12-5.373-12-12zM291.142 12v8c0 6.627 5.373 12 12 12h42.72v226.509c0 85.451-46.451 128.726-122.145 128.726-74.322 0-121.569-40.289-121.569-127.572V32h42.721c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12H26.659c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12H69.38v228.818c0 106.811 63.591 158.094 154.913 158.094 89.287 0 154.337-52.813 154.337-158.094V32h42.721c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12H303.142c-6.628 0-12 5.373-12 12z',\n },\n squiggly: {\n width: 448,\n height: 512,\n path: 'M 111.80004,416.25781 -0.09375,473.46875 v 38.51563 l 111.89379,-57.21094 112.14242,57.33789 112.14243,-57.33985 112.14244,57.33985 V 473.59375 L 336.08881,416.25781 223.94246,473.5957 Z M 291.142,12 v 8 c 0,6.627 5.373,12 12,12 h 42.72 v 226.509 c 0,85.451 -46.451,128.726 -122.145,128.726 -74.322,0 -121.569,-40.289 -121.569,-127.572 V 32 h 42.721 c 6.627,0 12,-5.373 12,-12 v -8 c 0,-6.627 -5.373,-12 -12,-12 H 26.659 c -6.627,0 -12,5.373 -12,12 v 8 c 0,6.627 5.373,12 12,12 H 69.38 v 228.818 c 0,106.811 63.591,158.094 154.913,158.094 89.287,0 154.337,-52.813 154.337,-158.094 V 32 h 42.721 c 6.627,0 12,-5.373 12,-12 v -8 c 0,-6.627 -5.373,-12 -12,-12 H 303.142 c -6.628,0 -12,5.373 -12,12 z',\n },\n strikethrough: {\n width: 512,\n height: 512,\n path: 'M500 272H12c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12h488c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12zm-199.246 16c34.104 17.688 58.216 40.984 58.216 83.01 0 57.657-45.969 87.221-104.86 87.221-43.044 0-101.711-17.734-101.711-60.762V388c0-6.627-5.373-12-12-12h-10.72c-6.627 0-12 5.373-12 12v15.77c0 60.082 76.565 87.291 136.431 87.291 78.593 0 140.211-46.632 140.211-123.832 0-35.712-11.87-60.522-30.603-79.229h-62.964zm-137.387-64h74.348c-43.357-17.896-75.865-37.601-75.865-84.203 0-52.844 43.64-79.03 96.041-79.03 32.008 0 90.37 12.598 90.37 44.38V116c0 6.627 5.373 12 12 12h10.721c6.627 0 12-5.373 12-12V96.327c0-44.421-64.45-68.391-125.091-68.391-72.526 0-131.392 41.225-131.392 115.011 0 38.214 14.813 63.053 36.868 81.053z',\n },\n fontColor: {\n width: 448,\n height: 512,\n path: 'M232.594 32h-17.187a11.998 11.998 0 0 0-11.239 7.796L51.473 448H28c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h88c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12H87.913l44.651-120.46h182.253L360.063 448H332c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h88c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12h-23.473L243.833 39.796A12 12 0 0 0 232.594 32zm-87.958 263.34l75.696-201.241c1.5-3.857 2.714-7.827 3.668-11.427.95 3.589 2.159 7.544 3.651 11.382l75.098 201.286H144.636z',\n },\n fillColor: {\n width: 576,\n height: 512,\n path: 'M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm0 160c-17.64 0-32-14.36-32-31.96.26-9.78 13.57-37.67 32.01-68.73 18.43 31.04 31.73 58.91 31.99 68.69 0 17.64-14.36 32-32 32zm-9.37-262.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-92.85 92.85L56.97 2.35c-3.12-3.12-8.19-3.12-11.31 0L34.34 13.66c-3.12 3.12-3.12 8.19 0 11.31l99.88 99.88-106.1 106.1c-37.49 37.49-37.49 98.26 0 135.75l117.19 117.19c18.75 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.76.01-45.26zm-244.2 244.2C246.34 473.34 230.27 480 213.18 480s-33.16-6.66-45.24-18.74l-117.2-117.2c-6.88-6.88-11.77-15.14-14.91-24.06h363.85L258.43 461.26zM431.68 288H33.06c2.2-12.96 8.2-24.94 17.69-34.43l106.09-106.11 87.85 87.85c6.25 6.25 16.38 6.25 22.62 0 6.25-6.25 6.25-16.38 0-22.62l-87.85-87.85L272.29 32h.02L480 239.68 431.68 288z',\n },\n drop: {\n width: 352,\n height: 512,\n path: 'M205.22 22.09C201.21 7.53 188.61 0 175.97 0c-12.35 0-24.74 7.2-29.19 22.09C100.01 179.85 0 222.72 0 333.91 0 432.35 78.72 512 176 512s176-79.65 176-178.09c0-111.75-99.79-153.34-146.78-311.82zM176 480c-79.4 0-144-65.54-144-146.09 0-48.36 23-81.32 54.84-126.94 29.18-41.81 65.34-93.63 89.18-170.91 23.83 77.52 60.06 129.31 89.3 171.08C297.06 252.52 320 285.3 320 333.91 320 414.46 255.4 480 176 480zm0-64c-44.12 0-80-35.89-80-80 0-8.84-7.16-16-16-16s-16 7.16-16 16c0 61.75 50.25 112 112 112 8.84 0 16-7.16 16-16s-7.16-16-16-16z',\n },\n checkbox: {\n width: 448,\n height: 512,\n path: 'M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm16 400c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V80c0-8.8 7.2-16 16-16h352c8.8 0 16 7.2 16 16v352z',\n },\n checkboxChecked: {\n width: 448,\n height: 512,\n path: 'M400 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zm0 32c8.823 0 16 7.178 16 16v352c0 8.822-7.177 16-16 16H48c-8.822 0-16-7.178-16-16V80c0-8.822 7.178-16 16-16h352m-34.301 98.293l-8.451-8.52c-4.667-4.705-12.265-4.736-16.97-.068l-163.441 162.13-68.976-69.533c-4.667-4.705-12.265-4.736-16.97-.068l-8.52 8.451c-4.705 4.667-4.736 12.265-.068 16.97l85.878 86.572c4.667 4.705 12.265 4.736 16.97.068l180.48-179.032c4.704-4.667 4.735-12.265.068-16.97z',\n },\n pageLayoutModeNone: {\n width: 512,\n height: 512,\n path: 'M 404.00446,340.39588 H 307.417 c -8.8907,0 -16.09791,-7.20735 -16.09791,-16.0979 V 226.90563 H 129.53513 c -9.33519,0 -16.90281,7.56764 -16.90281,16.90282 V 508.86602 H 82.046291 V 243.80845 c 0,-26.22737 21.261469,-47.48883 47.488839,-47.48883 h 185.16393 c 13.26225,0 25.94064,5.4538 35.06108,15.08212 l 76.00853,80.24116 c 5.66469,5.9802 8.82181,13.90391 8.82181,22.14106 v 195.63997 h -30.58602 z m -1.01739,-27.15345 -79.47231,-86.3368 h -1.60979 v 86.3368 z M 82.851029,3.1447104 H 113.43705 V 99.732162 c 0,9.335168 7.56762,16.902808 16.90282,16.902808 h 257.56652 c 9.33518,0 16.9028,-7.56764 16.9028,-16.902808 V 3.1447104 h 30.58603 V 99.732162 c 0,26.227348 -21.26147,47.488828 -47.48883,47.488828 H 130.33987 c -26.22737,0 -47.488841,-21.26148 -47.488841,-47.488828 z',\n },\n pageLayoutModeSinglePage: {\n width: 384,\n height: 512,\n path: 'M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zm-22.6 22.7c2.1 2.1 3.5 4.6 4.2 7.4H256V32.5c2.8.7 5.3 2.1 7.4 4.2l83.9 83.9zM336 480H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h176v104c0 13.3 10.7 24 24 24h104v304c0 8.8-7.2 16-16 16z',\n },\n warning: {\n width: 576,\n height: 512,\n path: 'M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.054-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.952 83.154 0l239.94 416.028zm-27.658 15.991l-240-416c-6.16-10.678-21.583-10.634-27.718 0l-240 416C27.983 466.678 35.731 480 48 480h480c12.323 0 19.99-13.369 13.859-23.996zM288 372c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28zm-11.49-212h22.979c6.823 0 12.274 5.682 11.99 12.5l-7 168c-.268 6.428-5.556 11.5-11.99 11.5h-8.979c-6.433 0-11.722-5.073-11.99-11.5l-7-168c-.283-6.818 5.167-12.5 11.99-12.5zM288 372c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28z',\n },\n lock: {\n width: 448,\n height: 512,\n path: 'M224 420c-11 0-20-9-20-20v-64c0-11 9-20 20-20s20 9 20 20v64c0 11-9 20-20 20zm224-148v192c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V272c0-26.5 21.5-48 48-48h16v-64C64 71.6 136-.3 224.5 0 312.9.3 384 73.1 384 161.5V224h16c26.5 0 48 21.5 48 48zM96 224h256v-64c0-70.6-57.4-128-128-128S96 89.4 96 160v64zm320 240V272c0-8.8-7.2-16-16-16H48c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16z',\n },\n unlock: {\n width: 640,\n height: 512,\n path: 'M227 417c-11 0-20-9-20-20v-64c0-11 9-20 20-20s20 9 20 20v64c0 11-9 20-20 20zM480.5 0C392-.3 320 71.6 320 160v64H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48h-48v-62.6c0-70.7 56.7-129 127.3-129.4C550.2 31.6 608 89.2 608 160v84c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12v-82.5C640 73.1 568.9.3 480.5 0zM400 256c8.8 0 16 7.2 16 16v192c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V272c0-8.8 7.2-16 16-16h352z',\n },\n history: {\n width: 512,\n height: 512,\n path: 'M20 24h10c6.627 0 12 5.373 12 12v94.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H164c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V36c0-6.627 5.373-12 12-12zm321.647 315.235l4.706-6.47c3.898-5.36 2.713-12.865-2.647-16.763L272 263.853V116c0-6.627-5.373-12-12-12h-8c-6.627 0-12 5.373-12 12v164.147l84.884 61.734c5.36 3.899 12.865 2.714 16.763-2.646z',\n },\n error: {\n width: 512,\n height: 512,\n path: 'M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z',\n },\n pdfFile: {\n width: 384,\n height: 512,\n path: 'M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zm-22.6 22.7c2.1 2.1 3.5 4.6 4.2 7.4H256V32.5c2.8.7 5.3 2.1 7.4 4.2l83.9 83.9zM336 480H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h176v104c0 13.3 10.7 24 24 24h104v304c0 8.8-7.2 16-16 16zm-48-244v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm0 64v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm0 64v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12z',\n },\n fileError: {\n width: 384,\n height: 512,\n path: 'M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zm-22.6 22.7c2.1 2.1 3.5 4.6 4.2 7.4H256V32.5c2.8.7 5.3 2.1 7.4 4.2l83.9 83.9zM336 480H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h176v104c0 13.3 10.7 24 24 24h104v304c0 8.8-7.2 16-16 16zm-73.3-127.9c4.7 4.7 4.7 12.3 0 17l-5.7 5.7c-4.7 4.7-12.3 4.7-17 0l-48-48.2-48.1 48.1c-4.7 4.7-12.3 4.7-17 0l-5.7-5.7c-4.7-4.7-4.7-12.3 0-17l48.1-48.1-48.1-48.1c-4.7-4.7-4.7-12.3 0-17l5.7-5.7c4.7-4.7 12.3-4.7 17 0l48.1 48.1 48.1-48.1c4.7-4.7 12.3-4.7 17 0l5.7 5.7c4.7 4.7 4.7 12.3 0 17L214.6 304l48.1 48.1z',\n },\n sidePaneThumbnails: {\n width: 512,\n height: 512,\n path: 'M 111.73 0.28125 C 85.231 0.28125 63.73 21.781 63.73 48.281 L 63.73 63.73 L 48.359 63.73 C 21.859 63.73 0.35938 85.231 0.35938 111.73 L 0.35938 463.73 C 0.35938 490.23 21.859 511.73 48.359 511.73 L 400.36 511.73 C 426.86 511.73 448.36 490.23 448.36 463.73 L 448.36 448.28 L 463.73 448.28 C 490.23 448.28 511.73 426.78 511.73 400.28 L 511.73 48.281 C 511.73 21.781 490.23 0.28125 463.73 0.28125 L 111.73 0.28125 z M 111.73 32.281 L 463.73 32.281 C 472.55 32.281 479.73 39.461 479.73 48.281 L 479.73 400.28 C 479.73 409.1 472.55 416.28 463.73 416.28 L 448.36 416.28 L 448.36 111.73 C 448.36 85.231 426.86 63.73 400.36 63.73 L 95.73 63.73 L 95.73 48.281 C 95.73 39.461 102.91 32.281 111.73 32.281 z M 48.359 95.73 L 400.36 95.73 C 409.18 95.73 416.36 102.91 416.36 111.73 L 416.36 463.73 C 416.36 472.55 409.18 479.73 400.36 479.73 L 48.359 479.73 C 39.539 479.73 32.359 472.55 32.359 463.73 L 32.359 111.73 C 32.359 102.91 39.539 95.73 48.359 95.73 z M 104.36 175.73 C 99.938 175.73 96.359 179.31 96.359 183.73 L 96.359 199.73 C 96.359 204.15 99.938 207.73 104.36 207.73 L 248.36 207.73 C 252.78 207.73 256.36 204.15 256.36 199.73 L 256.36 183.73 C 256.36 179.31 252.78 175.73 248.36 175.73 L 104.36 175.73 z M 104.36 271.73 C 99.938 271.73 96.359 275.31 96.359 279.73 L 96.359 295.73 C 96.359 300.15 99.938 303.73 104.36 303.73 L 344.36 303.73 C 348.78 303.73 352.36 300.15 352.36 295.73 L 352.36 279.73 C 352.36 275.31 348.78 271.73 344.36 271.73 L 104.36 271.73 z M 104.36 367.73 C 99.938 367.73 96.359 371.31 96.359 375.73 L 96.359 391.73 C 96.359 396.15 99.938 399.73 104.36 399.73 L 184.36 399.73 C 188.78 399.73 192.36 396.15 192.36 391.73 L 192.36 375.73 C 192.36 371.31 188.78 367.73 184.36 367.73 L 104.36 367.73 z',\n },\n sidePaneAnnotation: {\n width: 512,\n height: 512,\n path: 'M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm32 352c0 17.6-14.4 32-32 32H293.3l-8.5 6.4L192 460v-76H64c-17.6 0-32-14.4-32-32V64c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v288zM280 240H136c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h144c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8zm96-96H136c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h240c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8z',\n },\n sidePaneOutline: {\n width: 512,\n height: 512,\n path: 'M88 56H40a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h48a16 16 0 0 0 16-16V72a16 16 0 0 0-16-16zm0 160H40a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h48a16 16 0 0 0 16-16v-48a16 16 0 0 0-16-16zm0 160H40a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h48a16 16 0 0 0 16-16v-48a16 16 0 0 0-16-16zm416 24H168a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h336a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8zm0-320H168a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h336a8 8 0 0 0 8-8V88a8 8 0 0 0-8-8zm0 160H168a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h336a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8z',\n },\n annotation: {\n width: 512,\n height: 512,\n path: 'M256 64c123.5 0 224 79 224 176S379.5 416 256 416c-28.3 0-56.3-4.3-83.2-12.8l-15.2-4.8-13 9.2c-23 16.3-58.5 35.3-102.6 39.6 12-15.1 29.8-40.4 40.8-69.6l7.1-18.7-13.7-14.6C47.3 313.7 32 277.6 32 240c0-97 100.5-176 224-176m0-32C114.6 32 0 125.1 0 240c0 47.6 19.9 91.2 52.9 126.3C38 405.7 7 439.1 6.5 439.5c-6.6 7-8.4 17.2-4.6 26 3.8 8.8 12.4 14.5 22 14.5 61.5 0 110-25.7 139.1-46.3 29 9.1 60.2 14.3 93 14.3 141.4 0 256-93.1 256-208S397.4 32 256 32z',\n bg: 'M 256,32 C 114.6,32 0,125.1 0,240 0,287.6 19.9,331.2 52.9,366.3 38,405.7 7,439.1 6.5,439.5 c -6.6,7 -8.4,17.2 -4.6,26 3.8,8.8 12.4,14.5 22,14.5 61.5,0 110,-25.7 139.1,-46.3 29,9.1 60.2,14.3 93,14.3 141.4,0 256,-93.1 256,-208 C 512,125.1 397.4,32 256,32 Z',\n },\n highlighter: {\n width: 544,\n height: 512,\n path: 'M528.61 75.91l-60.49-60.52C457.91 5.16 444.45 0 430.98 0a52.38 52.38 0 0 0-34.75 13.15L110.59 261.8c-10.29 9.08-14.33 23.35-10.33 36.49l12.49 41.02-36.54 36.56c-6.74 6.75-6.74 17.68 0 24.43l.25.26L0 479.98 99.88 512l43.99-44.01.02.02c6.75 6.75 17.69 6.75 24.44 0l36.46-36.47 40.91 12.53c18.01 5.51 31.41-4.54 36.51-10.32l248.65-285.9c18.35-20.82 17.37-52.32-2.25-71.94zM91.05 475.55l-32.21-10.33 40.26-42.03 22.14 22.15-30.19 30.21zm167.16-62.99c-.63.72-1.4.94-2.32.94-.26 0-.54-.02-.83-.05l-40.91-12.53-18.39-5.63-39.65 39.67-46.85-46.88 39.71-39.72-5.6-18.38-12.49-41.02c-.34-1.13.01-2.36.73-3l44.97-39.15 120.74 120.8-39.11 44.95zm248.51-285.73L318.36 343.4l-117.6-117.66L417.4 37.15c4.5-3.97 17.55-9.68 28.1.88l60.48 60.52c7.65 7.65 8.04 20 .74 28.28z',\n bg: 'M 528.61,75.91 468.12,15.39 C 457.91,5.16 444.45,0 430.98,0 418.17896,-0.01016736 405.81733,4.6676871 396.23,13.15 L 110.59,261.8 c -10.29,9.08 -14.33,23.35 -10.33,36.49 l 12.49,41.02 -36.54,36.56 c -6.74,6.75 -6.74,17.68 0,24.43 l 0.25,0.26 L 0,479.98 99.88,512 l 43.99,-44.01 0.02,0.02 c 6.75,6.75 17.69,6.75 24.44,0 l 36.46,-36.47 40.91,12.53 c 18.01,5.51 31.41,-4.54 36.51,-10.32 l 248.65,-285.9 c 18.35,-20.82 17.37,-52.32 -2.25,-71.94 z',\n },\n rectangularHighlighter: {\n width: 512,\n height: 512,\n path: 'M486.4 128c14.14 0 25.6-11.46 25.6-25.6V25.6C512 11.46 500.54 0 486.4 0h-76.8C395.46 0 384 11.46 384 25.6V48H128V25.6C128 11.46 116.54 0 102.4 0H25.6C11.46 0 0 11.46 0 25.6v76.8C0 116.54 11.46 128 25.6 128H48v256H25.6C11.46 384 0 395.46 0 409.6v76.8C0 500.54 11.46 512 25.6 512h76.8c14.14 0 25.6-11.46 25.6-25.6V464h256v22.4c0 14.14 11.46 25.6 25.6 25.6h76.8c14.14 0 25.6-11.46 25.6-25.6v-76.8c0-14.14-11.46-25.6-25.6-25.6H464V128h22.4zM416 32h64v64h-64V32zM32 96V32h64v64H32zm64 384H32v-64h64v64zm384-64v64h-64v-64h64zm-48-32h-22.4c-14.14 0-25.6 11.46-25.6 25.6V432H128v-22.4c0-14.14-11.46-25.6-25.6-25.6H80V128h22.4c14.14 0 25.6-11.46 25.6-25.6V80h256v22.4c0 14.14 11.46 25.6 25.6 25.6H432v256z',\n },\n pencil: {\n width: 512,\n height: 512,\n path: 'M493.255 56.236l-37.49-37.49c-24.993-24.993-65.515-24.994-90.51 0L12.838 371.162.151 485.346c-1.698 15.286 11.22 28.203 26.504 26.504l114.184-12.687 352.417-352.417c24.992-24.994 24.992-65.517-.001-90.51zm-95.196 140.45L174 420.745V386h-48v-48H91.255l224.059-224.059 82.745 82.745zM126.147 468.598l-58.995 6.555-30.305-30.305 6.555-58.995L63.255 366H98v48h48v34.745l-19.853 19.853zm344.48-344.48l-49.941 49.941-82.745-82.745 49.941-49.941c12.505-12.505 32.748-12.507 45.255 0l37.49 37.49c12.506 12.506 12.507 32.747 0 45.255z',\n bg: 'm 493.255,56.236 -37.49,-37.49 c -24.993,-24.993 -65.515,-24.994 -90.51,0 L 12.838,371.162 0.151,485.346 c -1.698,15.286 11.22,28.203 26.504,26.504 L 140.839,499.163 493.256,146.746 c 24.992,-24.994 24.992,-65.517 -10e-4,-90.51 z',\n },\n freeText: {\n width: 512,\n height: 512,\n path: 'm 460,81 v 72 c 0,4.42 -3.58,8 -8,8 h -16 c -4.42,0 -8,-3.58 -8,-8 V 97 H 272 v 338 h 72 c 4.42,0 8,3.58 8,8 v 16 c 0,4.42 -3.58,8 -8,8 H 168 c -4.42,0 -8,-3.58 -8,-8 v -16 c 0,-4.42 3.58,-8 8,-8 h 72 V 97 H 84 v 56 c 0,4.42 -3.582,8 -8,8 H 60 c -4.418,0 -8,-3.58 -8,-8 V 81 c 0,-8.837 7.163,-16 16,-16 h 376 c 8.84,0 16,7.163 16,16 z',\n bg: 'M512 512H0V0h512v512z',\n },\n stamp: {\n width: 508,\n height: 512,\n path: 'm 333.71644,332.74589 h 121.26625 l 52.08896,87.08726 H 508.009 V 512.0005 H 0 V 419.83315 H 0.80598227 L 54.686486,332.74589 H 178.89175 V 241.68498 C 139.83419,229.2037 120.83357,188.0785 120.83357,122.28502 120.83357,50.03435 163.8049,8.54414 246.15327,0.3862 V 0 h 4.2226 14.81043 v 0.26345 c 83.1756,7.85642 126.58831,49.40078 126.58831,122.02157 0,65.79348 -19.00062,106.91868 -58.05817,119.39996 z m 0,26.85191 v 11.42093 l -0.57524,1.90136 c -7.77664,25.70458 -26.80014,40.76443 -54.91507,44.75071 -3.13022,0.44382 -6.37313,0.75038 -9.72577,0.91907 2e-5,0.0515 5e-5,0.10303 8e-5,0.15469 h -18.12457 -4.2226 c 0,-0.0231 0,-0.0462 0,-0.0693 -34.59286,-1.15044 -57.8689,-16.6105 -66.68629,-45.75514 l -0.57523,-1.90136 V 359.5978 H 70.109423 L 33.186454,419.83315 H 474.69705 l -35.1373,-60.23535 z m -72.20597,-332.75872 -5.41897,-0.0189 -4.95803,0.0158 C 180.53972,32.90225 147.68548,63.8059 147.68548,122.285 c 0,60.26373 16.08094,90.41551 46.87034,95.62098 l 11.18782,1.8915 v 147.12358 c 5.83066,16.85951 19.64352,24.97158 44.63223,24.97158 h 5.92822 5.92822 c 24.9887,0 38.80158,-8.11207 44.63222,-24.97158 V 219.79748 l 11.18782,-1.8915 c 30.7894,-5.20547 46.87035,-35.35725 46.87035,-95.62098 0,-58.46923 -32.84314,-89.37232 -103.41223,-95.44594 z M 26.96748,485.1486 H 481.04152 V 446.68506 H 26.96748 Z',\n bg: 'm 333.71644,332.74589 h 121.26625 l 52.08896,87.08726 H 508.009 V 512.0005 H 0 V 419.83315 H 0.80598227 L 54.686486,332.74589 H 178.89175 V 241.68498 C 139.83419,229.2037 120.83357,188.0785 120.83357,122.28502 120.83357,50.03435 163.8049,8.54414 246.15327,0.3862 V 0 h 4.2226 14.81043 v 0.26345 c 83.1756,7.85642 126.58831,49.40078 126.58831,122.02157 0,65.79348 -19.00062,106.91868 -58.05817,119.39996 z',\n },\n redaction: {\n width: 512,\n height: 512,\n path: 'M 256 341.332031 L 256 426.667969 L 64 426.667969 L 64 341.332031 Z M 448 384 L 448 405.332031 L 298.667969 405.332031 L 298.667969 384 Z M 448 213.332031 L 448 298.667969 L 64 298.667969 L 64 213.332031 Z M 448 85.332031 L 448 170.667969 L 256 170.667969 L 256 85.332031 Z M 213.332031 128 L 213.332031 149.332031 L 64 149.332031 L 64 128 Z M 213.332031 128',\n },\n rotate: {\n width: 512,\n height: 512,\n path: 'M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z',\n },\n rotateLeft: {\n width: 512,\n height: 512,\n path: 'M20 8h10c6.627 0 12 5.373 12 12v110.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H180c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V20c0-6.627 5.373-12 12-12z',\n },\n rotateRight: {\n width: 512,\n height: 512,\n path: 'M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z',\n },\n close: {\n width: 320,\n height: 512,\n path: 'M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z',\n },\n options: {\n width: 512,\n height: 512,\n path: 'M482.696 299.276l-32.61-18.827a195.168 195.168 0 0 0 0-48.899l32.61-18.827c9.576-5.528 14.195-16.902 11.046-27.501-11.214-37.749-31.175-71.728-57.535-99.595-7.634-8.07-19.817-9.836-29.437-4.282l-32.562 18.798a194.125 194.125 0 0 0-42.339-24.48V38.049c0-11.13-7.652-20.804-18.484-23.367-37.644-8.909-77.118-8.91-114.77 0-10.831 2.563-18.484 12.236-18.484 23.367v37.614a194.101 194.101 0 0 0-42.339 24.48L105.23 81.345c-9.621-5.554-21.804-3.788-29.437 4.282-26.36 27.867-46.321 61.847-57.535 99.595-3.149 10.599 1.47 21.972 11.046 27.501l32.61 18.827a195.168 195.168 0 0 0 0 48.899l-32.61 18.827c-9.576 5.528-14.195 16.902-11.046 27.501 11.214 37.748 31.175 71.728 57.535 99.595 7.634 8.07 19.817 9.836 29.437 4.283l32.562-18.798a194.08 194.08 0 0 0 42.339 24.479v37.614c0 11.13 7.652 20.804 18.484 23.367 37.645 8.909 77.118 8.91 114.77 0 10.831-2.563 18.484-12.236 18.484-23.367v-37.614a194.138 194.138 0 0 0 42.339-24.479l32.562 18.798c9.62 5.554 21.803 3.788 29.437-4.283 26.36-27.867 46.321-61.847 57.535-99.595 3.149-10.599-1.47-21.972-11.046-27.501zm-65.479 100.461l-46.309-26.74c-26.988 23.071-36.559 28.876-71.039 41.059v53.479a217.145 217.145 0 0 1-87.738 0v-53.479c-33.621-11.879-43.355-17.395-71.039-41.059l-46.309 26.74c-19.71-22.09-34.689-47.989-43.929-75.958l46.329-26.74c-6.535-35.417-6.538-46.644 0-82.079l-46.329-26.74c9.24-27.969 24.22-53.869 43.929-75.969l46.309 26.76c27.377-23.434 37.063-29.065 71.039-41.069V44.464a216.79 216.79 0 0 1 87.738 0v53.479c33.978 12.005 43.665 17.637 71.039 41.069l46.309-26.76c19.709 22.099 34.689 47.999 43.929 75.969l-46.329 26.74c6.536 35.426 6.538 46.644 0 82.079l46.329 26.74c-9.24 27.968-24.219 53.868-43.929 75.957zM256 160c-52.935 0-96 43.065-96 96s43.065 96 96 96 96-43.065 96-96-43.065-96-96-96zm0 160c-35.29 0-64-28.71-64-64s28.71-64 64-64 64 28.71 64 64-28.71 64-64 64z',\n },\n delete: {\n width: 512,\n height: 512,\n path: 'M368 64l-33.6-44.8C325.3 7.1 311.1 0 296 0h-80c-15.1 0-29.3 7.1-38.4 19.2L144 64H40c-13.3 0-24 10.7-24 24v2c0 3.3 2.7 6 6 6h20.9l33.2 372.3C78.3 493 99 512 123.9 512h264.2c24.9 0 45.6-19 47.8-43.7L469.1 96H490c3.3 0 6-2.7 6-6v-2c0-13.3-10.7-24-24-24H368zM216 32h80c5 0 9.8 2.4 12.8 6.4L328 64H184l19.2-25.6c3-4 7.8-6.4 12.8-6.4zm188 433.4c-.7 8.3-7.6 14.6-15.9 14.6H123.9c-8.3 0-15.2-6.3-15.9-14.6L75 96h362l-33 369.4z',\n },\n copy: {\n width: 448,\n height: 512,\n path: 'M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM352 32.491a15.88 15.88 0 0 1 7.431 4.195l51.882 51.883A15.885 15.885 0 0 1 415.508 96H352V32.491zM288 464c0 8.822-7.178 16-16 16H48c-8.822 0-16-7.178-16-16V144c0-8.822 7.178-16 16-16h80v240c0 26.51 21.49 48 48 48h112v48zm128-96c0 8.822-7.178 16-16 16H176c-8.822 0-16-7.178-16-16V48c0-8.822 7.178-16 16-16h144v72c0 13.2 10.8 24 24 24h72v240z',\n },\n created: {\n width: 448,\n height: 512,\n path: 'M400 64c8.8 0 16 7.2 16 16v352c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V80c0-8.8 7.2-16 16-16h352m0-32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-60 206h-98v-98c0-6.6-5.4-12-12-12h-12c-6.6 0-12 5.4-12 12v98h-98c-6.6 0-12 5.4-12 12v12c0 6.6 5.4 12 12 12h98v98c0 6.6 5.4 12 12 12h12c6.6 0 12-5.4 12-12v-98h98c6.6 0 12-5.4 12-12v-12c0-6.6-5.4-12-12-12z',\n },\n pen: {\n width: 512,\n height: 512,\n path: 'M493.25 56.26l-37.51-37.51C443.25 6.25 426.87 0 410.49 0s-32.76 6.25-45.26 18.74L12.85 371.12.15 485.34C-1.45 499.72 9.88 512 23.95 512c.89 0 1.78-.05 2.69-.15l114.14-12.61 352.48-352.48c24.99-24.99 24.99-65.51-.01-90.5zM126.09 468.68l-93.03 10.31 10.36-93.17 263.89-263.89 82.77 82.77-263.99 263.98zm344.54-344.54l-57.93 57.93-82.77-82.77 57.93-57.93c6.04-6.04 14.08-9.37 22.63-9.37 8.55 0 16.58 3.33 22.63 9.37l37.51 37.51c12.47 12.48 12.47 32.78 0 45.26z',\n },\n rectangle: {\n width: 512,\n height: 512,\n path: 'M480 32v448H32V32h448m32-32H0v512h512V0z',\n bg: 'M 512,0 H 0 v 512 h 512 z',\n },\n circle: {\n width: 512,\n height: 512,\n path: 'M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216z',\n bg: 'M 256,8 C 119,8 8,119 8,256 8,393 119,504 256,504 393,504 504,393 504,256 504,119 393,8 256,8 Z',\n },\n circleDashed: {\n width: 512,\n height: 512,\n path: 'M 217.9 10.91 C 177.84 17.083 140.95 32.842 109.64 55.766 L 132.58 78.705 C 157.62 61.229 186.56 48.91 217.9 43.344 L 217.9 10.91 z M 294.09 10.91 L 294.09 43.355 C 325.33 48.924 354.3 61.224 379.41 78.725 L 402.36 55.773 C 371.05 32.849 334.16 17.082 294.09 10.91 z M 55.77 109.64 C 32.851 140.96 17.095 177.84 10.922 217.9 L 43.365 217.9 C 48.935 186.67 61.234 157.71 78.729 132.6 L 55.77 109.64 z M 456.24 109.65 L 433.3 132.58 C 450.77 157.62 463.09 186.56 468.66 217.9 L 501.08 217.9 C 494.91 177.84 479.16 140.95 456.24 109.65 z M 10.92 294.09 C 17.096 334.15 32.846 371.05 55.771 402.36 L 78.707 379.43 C 61.228 354.38 48.91 325.43 43.342 294.09 L 10.92 294.09 z M 468.64 294.09 C 463.07 325.33 450.77 354.29 433.27 379.4 L 456.23 402.36 C 479.15 371.04 494.91 334.15 501.08 294.09 L 468.64 294.09 z M 132.6 433.28 L 109.65 456.23 C 140.96 479.15 177.84 494.92 217.9 501.09 L 217.9 468.64 C 186.67 463.07 157.71 450.77 132.6 433.28 z M 379.42 433.29 C 354.38 450.77 325.44 463.09 294.09 468.66 L 294.09 501.09 C 334.15 494.92 371.05 479.16 402.36 456.23 L 379.42 433.29 z',\n },\n shapes: {\n width: 512,\n height: 512,\n path: 'M480 288H320c-17.67 0-32 14.33-32 32v160c0 17.67 14.33 32 32 32h160c17.67 0 32-14.33 32-32V320c0-17.67-14.33-32-32-32zm0 192H320V320h160v160zM128 256C57.31 256 0 313.31 0 384s57.31 128 128 128 128-57.31 128-128-57.31-128-128-128zm0 224c-52.93 0-96-43.07-96-96 0-52.94 43.07-96 96-96 52.94 0 96 43.06 96 96 0 52.93-43.06 96-96 96zm378.98-278.86L400.07 18.29C392.95 6.1 380.47 0 368 0s-24.95 6.1-32.07 18.29L229.02 201.14c-14.26 24.38 3.56 54.86 32.07 54.86h213.82c28.51 0 46.33-30.48 32.07-54.86zm-27.6 20.39c-.94 1.64-2.45 2.47-4.47 2.47H261.09c-2.02 0-3.53-.83-4.47-2.47-1.21-2.12-.35-3.6.02-4.23L363.55 34.44c.95-1.62 2.44-2.44 4.45-2.44s3.5.82 4.45 2.44L479.36 217.3c.37.63 1.24 2.11.02 4.23z',\n },\n image: {\n width: 512,\n height: 512,\n path: 'M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.822-7.178 16-16 16H48c-8.822 0-16-7.178-16-16V112c0-8.822 7.178-16 16-16h416c8.822 0 16 7.178 16 16v288zM112 232c30.928 0 56-25.072 56-56s-25.072-56-56-56-56 25.072-56 56 25.072 56 56 56zm0-80c13.234 0 24 10.766 24 24s-10.766 24-24 24-24-10.766-24-24 10.766-24 24-24zm207.029 23.029L224 270.059l-31.029-31.029c-9.373-9.373-24.569-9.373-33.941 0l-88 88A23.998 23.998 0 0 0 64 344v28c0 6.627 5.373 12 12 12h360c6.627 0 12-5.373 12-12v-92c0-6.365-2.529-12.47-7.029-16.971l-88-88c-9.373-9.372-24.569-9.372-33.942 0zM416 352H96v-4.686l80-80 48 48 112-112 80 80V352z',\n },\n pageLayoutMode0: {\n width: 800,\n height: 512,\n path: 'M 287.48 56 C 266.77 56.079 249.97 72.872 249.97 93.57 L 249.97 418.51 C 249.97 439.21 266.77 456 287.48 456 L 512.52 456 C 533.23 456 550.03 439.21 550.03 418.51 L 550.03 159.1 C 550.03 149.18 546.04 139.58 539.01 132.55 L 473.45 67.016 C 466.42 59.984 456.88 56 446.96 56 L 287.48 56 z M 287.48 81.072 L 425 81.072 L 425 162.31 C 425 172.7 433.36 181.05 443.76 181.05 L 525.03 181.05 L 525.03 418.51 L 525.02 418.51 C 525.02 425.38 519.39 431.01 512.52 431.01 L 287.48 431.01 C 280.6 431.01 274.97 425.38 274.97 418.51 L 274.97 93.57 C 274.97 86.697 280.6 81.072 287.48 81.072 z M 450.01 81.465 C 452.2 82.012 454.15 83.104 455.79 84.744 L 521.35 150.28 C 522.99 151.92 524.09 153.87 524.63 156.06 L 450.01 156.06 L 450.01 81.465 z',\n },\n pageLayoutMode1: {\n width: 800,\n height: 512,\n path: 'M 249.97 -7.6191 L 249.97 162.51 C 249.97 183.21 266.77 200 287.48 200 L 512.52 200 C 533.23 200 550.03 183.21 550.03 162.51 L 550.03 -7.6191 L 525.03 -7.6191 L 525.03 162.51 L 525.02 162.51 C 525.02 169.38 519.4 175.01 512.52 175.01 L 287.48 175.01 C 280.6 175.01 274.98 169.38 274.98 162.51 L 274.98 -7.6191 L 249.97 -7.6191 z M 287.48 312 C 266.77 312.08 249.97 328.87 249.97 349.57 L 249.97 523.16 L 274.98 523.16 L 274.98 349.57 C 274.98 342.7 280.6 337.07 287.48 337.07 L 425.01 337.07 L 425.01 418.31 C 425.01 428.7 433.36 437.05 443.76 437.05 L 525.03 437.05 L 525.03 523.16 L 550.03 523.16 L 550.03 415.1 C 550.03 405.18 546.04 395.58 539.01 388.55 L 473.45 323.01 C 466.42 315.98 456.88 312 446.96 312 L 287.48 312 z M 450.01 337.46 C 452.2 338.01 454.15 339.1 455.79 340.74 L 521.35 406.28 C 522.99 407.92 524.09 409.87 524.63 412.06 L 450.01 412.06 L 450.01 337.46 z',\n },\n pageLayoutMode2: {\n width: 800,\n height: 512,\n path: 'M 49.971 0.5293 L 49.971 162.51 C 49.971 183.21 66.771 200 87.479 200 L 312.52 200 C 333.23 200 350.03 183.21 350.03 162.51 L 350.03 0.5293 L 325.02 0.5293 L 325.02 162.51 C 325.02 169.38 319.39 175.01 312.52 175.01 L 87.479 175.01 C 80.602 175.01 74.975 169.38 74.975 162.51 L 74.975 0.5293 L 49.971 0.5293 z M 449.97 0.53906 L 449.97 162.51 C 449.97 183.21 466.77 200 487.48 200 L 712.52 200 C 733.23 200 750.03 183.21 750.03 162.51 L 750.03 0.53906 L 725.03 0.53906 L 725.03 162.51 L 725.02 162.51 C 725.02 169.38 719.39 175.01 712.52 175.01 L 487.48 175.01 C 480.6 175.01 474.97 169.38 474.97 162.51 L 474.97 0.53906 L 449.97 0.53906 z M 87.479 312 C 66.772 312.08 49.971 328.87 49.971 349.57 L 49.971 511.69 L 74.975 511.69 L 74.975 349.57 C 74.975 342.7 80.602 337.07 87.479 337.07 L 225 337.07 L 225 418.31 C 225 428.7 233.36 437.05 243.76 437.05 L 325.02 437.05 L 325.02 511.69 L 350.03 511.69 L 350.03 415.1 C 350.03 405.18 346.04 395.58 339.01 388.55 L 273.45 323.01 C 266.42 315.98 256.88 312 246.96 312 L 87.479 312 z M 487.48 312 C 466.77 312.08 449.97 328.87 449.97 349.57 L 449.97 511.67 L 474.97 511.67 L 474.97 349.57 C 474.97 342.7 480.6 337.07 487.48 337.07 L 625 337.07 L 625 418.31 C 625 428.7 633.36 437.05 643.76 437.05 L 725.03 437.05 L 725.03 511.67 L 750.03 511.67 L 750.03 415.1 C 750.03 405.18 746.04 395.58 739.01 388.55 L 673.45 323.01 C 666.42 315.98 656.88 312 646.96 312 L 487.48 312 z M 250.01 337.46 C 252.2 338.01 254.15 339.1 255.79 340.74 L 321.35 406.28 C 322.99 407.92 324.09 409.87 324.63 412.06 L 250.01 412.06 L 250.01 337.46 z M 650.01 337.46 C 652.2 338.01 654.15 339.1 655.79 340.74 L 721.35 406.28 C 722.99 407.92 724.09 409.87 724.63 412.06 L 650.01 412.06 L 650.01 337.46 z',\n },\n pageLayoutMode3: {\n width: 800,\n height: 512,\n path: 'M 449.97 0.48047 L 449.97 162.51 C 449.97 183.21 466.77 200 487.48 200 L 712.52 200 C 733.23 200 750.03 183.21 750.03 162.51 L 750.03 0.48047 L 725.03 0.48047 L 725.03 162.51 L 725.02 162.51 C 725.02 169.38 719.39 175.01 712.52 175.01 L 487.48 175.01 C 480.6 175.01 474.97 169.38 474.97 162.51 L 474.97 0.48047 L 449.97 0.48047 z M 87.479 312 C 66.772 312.08 49.971 328.87 49.971 349.57 L 49.971 511.89 L 74.975 511.89 L 74.975 349.57 C 74.975 342.7 80.602 337.07 87.479 337.07 L 225 337.07 L 225 418.31 C 225 428.7 233.36 437.05 243.76 437.05 L 325.02 437.05 L 325.02 511.89 L 350.03 511.89 L 350.03 415.1 C 350.03 405.18 346.04 395.58 339.01 388.55 L 273.45 323.01 C 266.42 315.98 256.88 312 246.96 312 L 87.479 312 z M 487.48 312 C 466.77 312.08 449.97 328.87 449.97 349.57 L 449.97 511.93 L 474.97 511.93 L 474.97 349.57 C 474.97 342.7 480.6 337.07 487.48 337.07 L 625 337.07 L 625 418.31 C 625 428.7 633.36 437.05 643.76 437.05 L 725.03 437.05 L 725.03 511.93 L 750.03 511.93 L 750.03 415.1 C 750.03 405.18 746.04 395.58 739.01 388.55 L 673.45 323.01 C 666.42 315.98 656.88 312 646.96 312 L 487.48 312 z M 250.01 337.46 C 252.2 338.01 254.15 339.1 255.79 340.74 L 321.35 406.28 C 322.99 407.92 324.09 409.87 324.63 412.06 L 250.01 412.06 L 250.01 337.46 z M 650.01 337.46 C 652.2 338.01 654.15 339.1 655.79 340.74 L 721.35 406.28 C 722.99 407.92 724.09 409.87 724.63 412.06 L 650.01 412.06 L 650.01 337.46 z',\n },\n pageLayoutMode4: {\n width: 800,\n height: 512,\n path: 'M 87.479 55.998 C 66.772 56.077 49.971 72.871 49.971 93.57 L 49.971 418.51 C 49.971 439.2 66.771 456 87.479 456 L 312.52 456 C 333.23 456 350.03 439.2 350.03 418.51 L 350.03 159.1 C 350.03 149.18 346.04 139.58 339.01 132.55 L 273.45 67.014 C 266.42 59.983 256.88 55.998 246.96 55.998 L 87.479 55.998 z M 487.48 55.998 C 466.77 56.077 449.97 72.87 449.97 93.568 L 449.97 418.51 C 449.97 439.2 466.77 456 487.48 456 L 712.52 456 C 733.23 456 750.03 439.2 750.03 418.51 L 750.03 159.1 C 750.03 149.18 746.04 139.58 739.01 132.55 L 673.45 67.014 C 666.42 59.983 656.88 55.998 646.96 55.998 L 487.48 55.998 z M 87.479 81.072 L 225 81.072 L 225 162.31 C 225 172.7 233.36 181.05 243.76 181.05 L 325.02 181.05 L 325.02 418.5 C 325.02 425.38 319.39 431.01 312.52 431.01 L 87.479 431.01 C 80.602 431.01 74.975 425.38 74.975 418.51 L 74.975 93.57 C 74.975 86.697 80.602 81.072 87.479 81.072 z M 487.48 81.072 L 625 81.072 L 625 162.31 C 625 172.7 633.36 181.05 643.76 181.05 L 725.03 181.05 L 725.03 418.5 L 725.02 418.5 C 725.02 425.38 719.39 431.01 712.52 431.01 L 487.48 431.01 C 480.6 431.01 474.97 425.38 474.97 418.51 L 474.97 93.57 C 474.97 86.697 480.6 81.072 487.48 81.072 z M 250.01 81.463 C 252.2 82.01 254.15 83.104 255.79 84.744 L 321.35 150.28 C 322.99 151.92 324.09 153.87 324.63 156.06 L 250.01 156.06 L 250.01 81.463 z M 650.01 81.463 C 652.2 82.01 654.15 83.104 655.79 84.744 L 721.35 150.28 C 722.99 151.92 724.09 153.87 724.63 156.06 L 650.01 156.06 L 650.01 81.463 z',\n },\n pageLayoutMode5: {\n width: 800,\n height: 512,\n path: 'M739.01,132.548l-65.561-65.533C666.416,59.983,656.885,56,646.961,56H487.479c-20.707,0.079-37.508,16.872-37.508,37.57 v324.937c0,20.698,16.799,37.494,37.508,37.494h225.043c20.707,0,37.508-16.796,37.508-37.494V159.104 C750.029,149.184,746.041,139.578,739.01,132.548z M650.008,81.464c2.188,0.547,4.143,1.641,5.781,3.281l65.563,65.533 c1.643,1.641,2.734,3.593,3.279,5.779h-74.623V81.464z M725.025,418.505c-0.002,6.878-5.631,12.501-12.506,12.501H487.479 c-6.877,0-12.504-5.623-12.504-12.499V93.57c0-6.873,5.627-12.497,12.504-12.497h137.525v81.233 c0,10.389,8.361,18.745,18.756,18.745h81.266V418.505z',\n },\n closeFile: {\n width: 384,\n height: 512,\n path: 'M369.9,97.9,286,14A48,48,0,0,0,252.1-.1H48A48.16,48.16,0,0,0,0,48V464a48,48,0,0,0,48,48H336a48,48,0,0,0,48-48V131.9A48.23,48.23,0,0,0,369.9,97.9Zm-22.6,22.7a15.73,15.73,0,0,1,4.2,7.4H256V32.5a15.73,15.73,0,0,1,7.4,4.2ZM336,480H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H224V136a23.94,23.94,0,0,0,24,24H352V464A16,16,0,0,1,336,480ZM262.71,369.05l-5.66,5.66a12,12,0,0,1-17,0L192,326.63l-48.08,48.08a12,12,0,0,1-17,0l-5.66-5.66a12,12,0,0,1,0-17L169.37,304l-48.08-48.08a12,12,0,0,1,0-17l5.66-5.66a12,12,0,0,1,17,0L192,281.37l48.08-48.08a12,12,0,0,1,17,0l5.66,5.66a12,12,0,0,1,0,17L214.63,304l48.08,48.08A12,12,0,0,1,262.71,369.05Z',\n },\n bars: {\n width: 448,\n height: 512,\n path: 'M442 114H6a6 6 0 0 1-6-6V84a6 6 0 0 1 6-6h436a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6zm0 160H6a6 6 0 0 1-6-6v-24a6 6 0 0 1 6-6h436a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6zm0 160H6a6 6 0 0 1-6-6v-24a6 6 0 0 1 6-6h436a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6z',\n },\n};\n","export const getKeyboardCommands = (e, shortcuts, excludeNodeTypes = ['INPUT', 'SELECT', 'TEXTAREA']) => {\n if (!shortcuts || excludeNodeTypes.includes(e.target.nodeName)) {\n return [];\n }\n let cmd = [];\n Object.keys(shortcuts).forEach((sc) => {\n const keybinding = shortcuts[sc];\n if (keybinding) {\n const key = e.key.length > 1 ? e.key : e.key.toLowerCase();\n if (key === keybinding.key &&\n e.altKey === Boolean(keybinding.altKey) &&\n e.ctrlKey === Boolean(keybinding.ctrlKey) &&\n e.shiftKey === Boolean(keybinding.shiftKey)) {\n cmd.push([sc, shortcuts[sc].superKey]);\n }\n }\n });\n return cmd;\n};\n","import { createPdfTime } from '../common/Tools';\n// tslint:disable-next-line: max-line-length\nexport function addHistoryEntry(annotation, type, author, content, subject) {\n let data = {};\n if (annotation.privateData) {\n data = JSON.parse(annotation.privateData);\n }\n else {\n data = {\n 'PDF Tools AG': {},\n };\n }\n if (!data.hasOwnProperty('PDF Tools AG')) {\n data['PDF Tools AG'] = {};\n }\n if (!data['PDF Tools AG'].hasOwnProperty('Private')) {\n data['PDF Tools AG'].Private = {};\n }\n if (!data['PDF Tools AG'].Private.hasOwnProperty('History')) {\n data['PDF Tools AG'].Private.History = [];\n }\n data['PDF Tools AG'].Private.LastModified = createPdfTime();\n const historyItem = {\n D: createPdfTime(),\n T: `(${author})`,\n };\n if (type === 'create') {\n historyItem.Type = '/Create';\n }\n else if (type === 'edit') {\n historyItem.Type = '/Edit';\n historyItem.params = [];\n if (content !== null && annotation.content !== content) {\n historyItem.params.push('/Contents');\n historyItem.params.push(`(${content})`);\n }\n if (subject !== null && annotation.subject !== subject) {\n historyItem.params.push('/Subj');\n historyItem.params.push(`(${subject})`);\n }\n if (historyItem.params.length === 0) {\n return;\n }\n }\n else if (type === 'lock') {\n historyItem.Type = '/Lock';\n }\n else if (type === 'unlock') {\n historyItem.Type = '/Unlock';\n }\n else if (type === 'delete') {\n historyItem.Type = '/Delete';\n annotation.popup.isOpen = false;\n }\n if (historyItem) {\n data['PDF Tools AG'].Private.History.push(historyItem);\n }\n annotation.privateData = JSON.stringify(data);\n}\n","export * from './pdf-web-viewer/PdfWebViewer';\nexport * from './pdf-web-viewer/WebViewerOptions';\nexport * from './pdf-viewer-canvas/PdfViewerCanvas';\nexport * from './pdf-viewer-api';\nexport * from './modules';\n","export function h(name, attributes) {\n var rest = [];\n var children = [];\n var length = arguments.length;\n while (length-- > 2)\n rest.push(arguments[length]);\n while (rest.length) {\n var node = rest.pop();\n if (node && node.pop) {\n for (length = node.length; length--;) {\n rest.push(node[length]);\n }\n }\n else if (node != null && node !== true && node !== false) {\n children.push(node);\n }\n }\n return typeof name === \"function\"\n ? name(attributes || {}, children)\n : {\n nodeName: name,\n attributes: attributes || {},\n children: children,\n key: attributes && attributes.key\n };\n}\nexport function app(state, actions, view, container) {\n var map = [].map;\n var rootElement = (container && container.children[0]) || null;\n var oldNode = rootElement && recycleElement(rootElement);\n var lifecycle = [];\n var skipRender;\n var isRecycling = true;\n var globalState = clone(state);\n var wiredActions = wireStateToActions([], globalState, clone(actions));\n scheduleRender();\n return wiredActions;\n function recycleElement(element) {\n return {\n nodeName: element.nodeName.toLowerCase(),\n attributes: {},\n children: map.call(element.childNodes, function (element) {\n return element.nodeType === 3 // Node.TEXT_NODE\n ? element.nodeValue\n : recycleElement(element);\n })\n };\n }\n function resolveNode(node) {\n return typeof node === \"function\"\n ? resolveNode(node(globalState, wiredActions))\n : node != null\n ? node\n : \"\";\n }\n function render() {\n skipRender = !skipRender;\n var node = resolveNode(view);\n if (container && !skipRender) {\n rootElement = patch(container, rootElement, oldNode, (oldNode = node));\n }\n isRecycling = false;\n while (lifecycle.length)\n lifecycle.pop()();\n }\n function scheduleRender() {\n if (!skipRender) {\n skipRender = true;\n setTimeout(render);\n }\n }\n function clone(target, source) {\n var out = {};\n for (var i in target)\n out[i] = target[i];\n for (var i in source)\n out[i] = source[i];\n return out;\n }\n function setPartialState(path, value, source) {\n var target = {};\n if (path.length) {\n target[path[0]] =\n path.length > 1\n ? setPartialState(path.slice(1), value, source[path[0]])\n : value;\n return clone(source, target);\n }\n return value;\n }\n function getPartialState(path, source) {\n var i = 0;\n while (i < path.length) {\n source = source[path[i++]];\n }\n return source;\n }\n function wireStateToActions(path, state, actions) {\n for (var key in actions) {\n typeof actions[key] === \"function\"\n ? (function (key, action) {\n actions[key] = function (data) {\n var result = action(data);\n if (typeof result === \"function\") {\n result = result(getPartialState(path, globalState), actions);\n }\n if (result &&\n result !== (state = getPartialState(path, globalState)) &&\n !result.then // !isPromise\n ) {\n scheduleRender((globalState = setPartialState(path, clone(state, result), globalState)));\n }\n return result;\n };\n })(key, actions[key])\n : wireStateToActions(path.concat(key), (state[key] = clone(state[key])), (actions[key] = clone(actions[key])));\n }\n return actions;\n }\n function getKey(node) {\n return node ? node.key : null;\n }\n function eventListener(event) {\n return event.currentTarget.events[event.type](event);\n }\n function updateAttribute(element, name, value, oldValue, isSvg) {\n if (name === \"key\") {\n }\n else if (name === \"style\") {\n if (typeof value === \"string\") {\n element.style.cssText = value;\n }\n else {\n if (typeof oldValue === \"string\")\n oldValue = element.style.cssText = \"\";\n for (var i in clone(oldValue, value)) {\n var style = value == null || value[i] == null ? \"\" : value[i];\n if (i[0] === \"-\") {\n element.style.setProperty(i, style);\n }\n else {\n element.style[i] = style;\n }\n }\n }\n }\n else {\n if (name[0] === \"o\" && name[1] === \"n\") {\n name = name.slice(2);\n if (element.events) {\n if (!oldValue)\n oldValue = element.events[name];\n }\n else {\n element.events = {};\n }\n element.events[name] = value;\n if (value) {\n if (!oldValue) {\n element.addEventListener(name, eventListener);\n }\n }\n else {\n element.removeEventListener(name, eventListener);\n }\n }\n else if (name in element &&\n name !== \"list\" &&\n name !== \"type\" &&\n name !== \"draggable\" &&\n name !== \"spellcheck\" &&\n name !== \"translate\" &&\n !isSvg) {\n element[name] = value == null ? \"\" : value;\n }\n else if (value != null && value !== false) {\n element.setAttribute(name, value);\n }\n if (value == null || value === false) {\n element.removeAttribute(name);\n }\n }\n }\n function createElement(node, isSvg) {\n var element = typeof node === \"string\" || typeof node === \"number\"\n ? document.createTextNode(node)\n : (isSvg = isSvg || node.nodeName === \"svg\")\n ? document.createElementNS(\"http://www.w3.org/2000/svg\", node.nodeName)\n : document.createElement(node.nodeName);\n var attributes = node.attributes;\n if (attributes) {\n if (attributes.oncreate) {\n lifecycle.push(function () {\n attributes.oncreate(element);\n });\n }\n for (var i = 0; i < node.children.length; i++) {\n element.appendChild(createElement((node.children[i] = resolveNode(node.children[i])), isSvg));\n }\n for (var name in attributes) {\n updateAttribute(element, name, attributes[name], null, isSvg);\n }\n }\n return element;\n }\n function updateElement(element, oldAttributes, attributes, isSvg) {\n for (var name in clone(oldAttributes, attributes)) {\n if (attributes[name] !==\n (name === \"value\" || name === \"checked\"\n ? element[name]\n : oldAttributes[name])) {\n updateAttribute(element, name, attributes[name], oldAttributes[name], isSvg);\n }\n }\n var cb = isRecycling ? attributes.oncreate : attributes.onupdate;\n if (cb) {\n lifecycle.push(function () {\n cb(element, oldAttributes);\n });\n }\n }\n function removeChildren(element, node) {\n var attributes = node.attributes;\n if (attributes) {\n for (var i = 0; i < node.children.length; i++) {\n removeChildren(element.childNodes[i], node.children[i]);\n }\n if (attributes.ondestroy) {\n attributes.ondestroy(element);\n }\n }\n return element;\n }\n function removeElement(parent, element, node) {\n function done() {\n parent.removeChild(removeChildren(element, node));\n }\n var cb = node.attributes && node.attributes.onremove;\n if (cb) {\n cb(element, done);\n }\n else {\n done();\n }\n }\n function patch(parent, element, oldNode, node, isSvg) {\n if (node === oldNode) {\n }\n else if (oldNode == null || oldNode.nodeName !== node.nodeName) {\n var newElement = createElement(node, isSvg);\n parent.insertBefore(newElement, element);\n if (oldNode != null) {\n removeElement(parent, element, oldNode);\n }\n element = newElement;\n }\n else if (oldNode.nodeName == null) {\n element.nodeValue = node;\n }\n else {\n updateElement(element, oldNode.attributes, node.attributes, (isSvg = isSvg || node.nodeName === \"svg\"));\n var oldKeyed = {};\n var newKeyed = {};\n var oldElements = [];\n var oldChildren = oldNode.children;\n var children = node.children;\n for (var i = 0; i < oldChildren.length; i++) {\n oldElements[i] = element.childNodes[i];\n var oldKey = getKey(oldChildren[i]);\n if (oldKey != null) {\n oldKeyed[oldKey] = [oldElements[i], oldChildren[i]];\n }\n }\n var i = 0;\n var k = 0;\n while (k < children.length) {\n var oldKey = getKey(oldChildren[i]);\n var newKey = getKey((children[k] = resolveNode(children[k])));\n if (newKeyed[oldKey]) {\n i++;\n continue;\n }\n if (newKey != null && newKey === getKey(oldChildren[i + 1])) {\n if (oldKey == null) {\n removeElement(element, oldElements[i], oldChildren[i]);\n }\n i++;\n continue;\n }\n if (newKey == null || isRecycling) {\n if (oldKey == null) {\n patch(element, oldElements[i], oldChildren[i], children[k], isSvg);\n k++;\n }\n i++;\n }\n else {\n var keyedNode = oldKeyed[newKey] || [];\n if (oldKey === newKey) {\n patch(element, keyedNode[0], keyedNode[1], children[k], isSvg);\n i++;\n }\n else if (keyedNode[0]) {\n patch(element, element.insertBefore(keyedNode[0], oldElements[i]), keyedNode[1], children[k], isSvg);\n }\n else {\n patch(element, oldElements[i], null, children[k], isSvg);\n }\n newKeyed[newKey] = children[k];\n k++;\n }\n }\n while (i < oldChildren.length) {\n if (getKey(oldChildren[i]) == null) {\n removeElement(element, oldElements[i], oldChildren[i]);\n }\n i++;\n }\n for (var i in oldKeyed) {\n if (!newKeyed[i]) {\n removeElement(element, oldKeyed[i][0], oldKeyed[i][1]);\n }\n }\n }\n return element;\n }\n}\n","import { addHistoryEntry } from '../custom/history';\nexport class CanvasLayer {\n constructor(module, name, containerElement, store, pdfApi, pdfViewerCanvas, options) {\n this.canvasContexts = [];\n this.htmlLayers = [];\n this.containerElement = containerElement;\n this.store = store;\n this.pdfApi = pdfApi;\n this.pdfViewerCanvas = pdfViewerCanvas;\n this.options = options;\n this.module = module;\n this.name = name;\n this.remove = this.remove.bind(this);\n this.onAnnotationCreated = this.onAnnotationCreated.bind(this);\n }\n resize(width, height) {\n const tempCanvas = document.createElement('canvas');\n tempCanvas.width = width * devicePixelRatio;\n tempCanvas.height = height * devicePixelRatio;\n const tempContext = tempCanvas.getContext('2d');\n this.canvasContexts.forEach((ctx) => {\n tempContext.drawImage(ctx.canvas, 0, 0);\n ctx.canvas.style.width = width + 'px';\n ctx.canvas.style.height = height + 'px';\n ctx.canvas.width = width * devicePixelRatio;\n ctx.canvas.height = height * devicePixelRatio;\n ctx.drawImage(tempContext.canvas, 0, 0);\n });\n }\n remove() {\n this.module.removeCanvasLayer(this.name);\n }\n createHtmlLayer() {\n const element = document.createElement('div');\n this.htmlLayers.push(element);\n if (this.containerElement) {\n this.containerElement.appendChild(element);\n }\n return element;\n }\n createCanvas() {\n const element = document.createElement('canvas');\n element.style.position = 'absolute';\n element.style.top = '0';\n element.style.left = '0';\n element.style.right = '0';\n element.style.bottom = '0';\n const context = element.getContext('2d');\n this.canvasContexts.push(context);\n if (this.containerElement) {\n this.containerElement.appendChild(element);\n const rect = this.containerElement.getBoundingClientRect();\n context.canvas.width = rect.width * devicePixelRatio;\n context.canvas.height = rect.height * devicePixelRatio;\n context.canvas.style.width = rect.width + 'px';\n context.canvas.style.height = rect.height + 'px';\n }\n return context;\n }\n removeHtmlElements() {\n if (this.containerElement) {\n for (let i = 0; i < this.htmlLayers.length; i++) {\n this.containerElement.removeChild(this.htmlLayers[i]);\n }\n this.htmlLayers = [];\n }\n }\n removeCanvasElements() {\n if (this.containerElement) {\n for (let i = 0; i < this.canvasContexts.length; i++) {\n this.containerElement.removeChild(this.canvasContexts[i].canvas);\n }\n this.canvasContexts = [];\n }\n }\n onAnnotationCreated(annotation) {\n if (this.options.annotation.trackHistory) {\n addHistoryEntry(annotation, 'create', this.options.viewer.general.user);\n return this.pdfApi.updateItem(annotation);\n }\n return new Promise((resolve) => resolve(annotation));\n }\n}\n","export var CanvasModuleType;\n(function (CanvasModuleType) {\n CanvasModuleType[CanvasModuleType[\"Tool\"] = 0] = \"Tool\";\n CanvasModuleType[CanvasModuleType[\"Layer\"] = 1] = \"Layer\";\n})(CanvasModuleType || (CanvasModuleType = {}));\nexport class CanvasModule {\n constructor() {\n this.canvasLayers = {};\n this.store = null;\n this.pdfApi = null;\n this.pdfViewerCanvas = null;\n this.options = null;\n this.name = null;\n this.containerElement = null;\n this.createCanvasLayer = this.createCanvasLayer.bind(this);\n this.removeCanvasLayer = this.removeCanvasLayer.bind(this);\n }\n register(containerElement, store, pdfApi, pdfViewerCanvas, options) {\n this.containerElement = containerElement;\n this.store = store;\n this.pdfApi = pdfApi;\n this.pdfViewerCanvas = pdfViewerCanvas;\n this.options = options;\n return this.onRegister();\n }\n render(timestamp, state) {\n const keys = Object.keys(this.canvasLayers);\n for (let i = 0; i < keys.length; i++) {\n this.canvasLayers[keys[i]].render(timestamp, state);\n }\n }\n deactivate() {\n const keys = Object.keys(this.canvasLayers);\n for (let i = 0; i < keys.length; i++) {\n const name = keys[i];\n this.canvasLayers[name].onRemove();\n delete this.canvasLayers[name];\n }\n }\n resize(width, height) {\n const keys = Object.keys(this.canvasLayers);\n for (let i = 0; i < keys.length; i++) {\n this.canvasLayers[keys[i]].resize(width, height);\n }\n }\n getCanvasSize() {\n const rect = {\n width: 0,\n height: 0,\n };\n if (this.containerElement !== null) {\n const clientRect = this.containerElement.getBoundingClientRect();\n rect.width = clientRect.width;\n rect.height = clientRect.height;\n }\n return rect;\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n const keys = Object.keys(this.canvasLayers);\n const promises = [];\n for (let i = 0; i < keys.length; i++) {\n promises.push(this.canvasLayers[keys[i]].onSave());\n }\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch((error) => {\n reject('OnSave failed on a canvas layer: ' + error);\n });\n });\n return promise;\n }\n createCanvasLayer(name, canvasLayer, args) {\n if (this.containerElement &&\n this.store &&\n this.pdfApi &&\n this.pdfViewerCanvas &&\n this.options) {\n if (this.canvasLayers[name]) {\n throw new Error('duplicate canvas layer name');\n }\n const layer = new canvasLayer(this, name, this.containerElement, this.store, this.pdfApi, this.pdfViewerCanvas, this.options);\n this.canvasLayers[name] = layer;\n layer.onCreate(args);\n }\n else {\n throw new Error('canvas layer is not registered');\n }\n }\n removeCanvasLayer(name) {\n if (this.canvasLayers[name]) {\n this.canvasLayers[name].onRemove();\n delete this.canvasLayers[name];\n }\n }\n}\n","import { CanvasLayer } from '../CanvasLayer';\nimport { PdfItemType } from '../../pdf-viewer-api/';\nimport { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { createEraserToolbar } from './EraserToolbar';\nconst moduleLayerName = 'EraserTool';\nexport class EraserLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.context = null;\n this.eraserRadius = this.options.annotation.eraserRadius;\n }\n onCreate(args) {\n this.setEraserRadius = this.setEraserRadius.bind(this);\n this.remove = this.remove.bind(this);\n this.context = this.createCanvas();\n const toolbarElement = this.module.toolbarElement;\n createEraserToolbar({\n radius: this.eraserRadius,\n onRadiusChanged: this.setEraserRadius,\n onCancel: this.remove,\n }, toolbarElement);\n this.store.viewer.beginModule(moduleLayerName);\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.endModule(moduleLayerName);\n }\n onSave() {\n return new Promise((resolve) => {\n return resolve();\n });\n }\n render(timestamp, state) {\n var _a;\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n const pointerPos = {\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n };\n const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);\n const cursorStyle = pointerPdfPos.isOnPage ? CursorStyle.NONE : CursorStyle.NOT_ALLOWED;\n this.store.viewer.setCursorStyle(cursorStyle);\n const ctx = this.context;\n if (ctx) {\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n if (pointerPdfPos.isOnPage) {\n ctx.save();\n ctx.lineWidth = 1;\n if (this.eraserRadius >= 8) {\n ctx.setLineDash([4 * devicePixelRatio, 4 * devicePixelRatio]);\n }\n ctx.beginPath();\n ctx.arc(pointerPos.x, pointerPos.y, (this.eraserRadius * devicePixelRatio) / 2, 0, 2 * Math.PI);\n ctx.stroke();\n ctx.restore();\n }\n }\n if (!pointerPdfPos.isOnPage || state.pointer.action !== 'click') {\n return;\n }\n const inkAnnotations = (_a = this.pdfApi\n .getAnnotationsOnPoint(pointerPos)) === null || _a === void 0 ? void 0 : _a.filter((a) => a.itemType === PdfItemType.INK);\n if (!inkAnnotations) {\n return;\n }\n const annot = this.deleteFirstInkLineCloseToPoint(inkAnnotations, pointerPdfPos.pdfPoint);\n if (annot) {\n this.updateInkAnnotation(annot);\n }\n }\n setEraserRadius(radius) {\n this.options.annotation.eraserRadius = radius;\n this.eraserRadius = radius;\n }\n deleteFirstInkLineCloseToPoint(inkAnnotations, pdfPoint) {\n if (!this.context) {\n return null;\n }\n const ctx = this.context;\n ctx.save();\n for (let inkAnnotation of inkAnnotations) {\n ctx.lineWidth = Math.max(inkAnnotation.border.width, this.eraserRadius * devicePixelRatio);\n ctx.lineCap = 'round';\n for (let inkLine of inkAnnotation.inkList) {\n const path = new Path2D();\n let isFirstPoint = true;\n for (let point of inkLine) {\n if (isFirstPoint) {\n path.moveTo(point.x, point.y);\n isFirstPoint = false;\n }\n else {\n path.lineTo(point.x, point.y);\n }\n }\n const isPointInStroke = ctx.isPointInStroke(path, pdfPoint.pdfX, pdfPoint.pdfY);\n if (isPointInStroke) {\n inkAnnotation.inkList.splice(inkAnnotation.inkList.indexOf(inkLine), 1);\n return inkAnnotation;\n }\n }\n }\n ctx.restore();\n return null;\n }\n updateInkAnnotation(inkAnnotation) {\n return new Promise((resolve, reject) => {\n if (inkAnnotation.inkList.length) {\n this.pdfApi\n .updateItem(inkAnnotation)\n .then((item) => {\n this.store.annotations.updateAnnotation(item);\n resolve();\n })\n .catch((err) => {\n console.error(err);\n reject();\n });\n }\n else {\n const id = inkAnnotation.id;\n this.pdfApi\n .deleteItem(inkAnnotation)\n .then(() => {\n resolve();\n })\n .catch((err) => {\n console.error(err);\n reject();\n });\n }\n });\n }\n}\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { EraserLayer } from './EraserLayer';\nexport class EraserModule extends CanvasModule {\n constructor() {\n super();\n this.toolbarElement = null;\n this.name = EraserModule.moduleInfo.name;\n this.activate = this.activate.bind(this);\n }\n onRegister() {\n this.toolbarElement = document.createElement('div');\n return {\n toolbar: this.toolbarElement,\n };\n }\n activate() {\n if (!this.canvasLayers['add']) {\n this.createCanvasLayer('add', EraserLayer);\n }\n else {\n this.removeCanvasLayer('add');\n }\n }\n}\nEraserModule.moduleInfo = {\n name: 'EraserModule',\n moduleType: CanvasModuleType.Tool,\n requiredFeatures: {\n annotate: true,\n fillFormFields: false,\n },\n translationKey: 'eraser.begin',\n icon: 'eraser',\n};\n","import { app, h } from '../../lib/hyperapp';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { RangeSlider } from '../../common/RangeSlider';\nexport const createEraserToolbar = (props, element) => {\n const state = {\n radius: props.radius,\n };\n const actions = {\n setRadius: (radius) => ($state) => {\n props.onRadiusChanged(radius);\n return Object.assign(Object.assign({}, $state), { radius });\n },\n setCancel: () => ($state) => {\n return Object.assign({}, $state);\n },\n };\n const App = () => h(EraserToolbar, null);\n const EraserToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(RangeSlider, { tooltip: translationManager.getText('eraser.eraserWidth'), min: 2, max: 50, step: 1, value: $state.radius, text: `${$state.radius}px`, icon: icons.circleDashed, onChange: $actions.setRadius, className: \"pwv-opacityslider\" })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onCancel }))));\n return app(state, actions, App, element);\n};\n","import { WidgetBase } from './WidgetBase';\nexport class CheckBoxWidget extends WidgetBase {\n createFormField() {\n const formField = document.createElement('label');\n formField.classList.add('pwv-formField__CheckBox');\n formField.style.overflow = 'hidden';\n const checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.checked = this.widget.selected;\n checkbox.style.position = 'absolute';\n checkbox.style.top = '-20px';\n checkbox.style.left = '-20px';\n formField.appendChild(checkbox);\n this.handleOnChange = this.handleOnChange.bind(this);\n this.handleOnKeyDown = this.handleOnKeyDown.bind(this);\n this.handleOnBlur = this.handleOnBlur.bind(this);\n formField.addEventListener('change', this.handleOnChange);\n formField.addEventListener('keydown', this.handleOnKeyDown);\n formField.addEventListener('blur', this.handleOnBlur);\n return formField;\n }\n onRemove() {\n this.editorElement.removeEventListener('change', this.handleOnChange);\n this.editorElement.removeEventListener('keydown', this.handleOnKeyDown);\n this.editorElement.removeEventListener('blur', this.handleOnBlur);\n }\n setFocus() {\n this.editorElement.focus();\n }\n handleOnKeyDown(e) {\n if (e.code === 'Tab') {\n this.onTab(e.shiftKey);\n }\n else if (e.code === 'Escape') {\n this.onBlur();\n }\n }\n handleOnBlur(e) {\n this.onBlur();\n }\n handleOnChange(e) {\n this.widget.push();\n this.saveWidget();\n }\n}\n","import { WidgetBase } from './WidgetBase';\nexport class ComboBoxWidget extends WidgetBase {\n constructor() {\n super(...arguments);\n this.btnClearPressed = false;\n this.hasPendingChanges = false;\n this.saveThrottlingTimer = undefined;\n }\n createFormField() {\n // bind events\n this.inputOnFocus = this.inputOnFocus.bind(this);\n this.inputOnBlur = this.inputOnBlur.bind(this);\n this.inputOnInput = this.inputOnInput.bind(this);\n this.inputOnChange = this.inputOnChange.bind(this);\n this.inputOnKeyDown = this.inputOnKeyDown.bind(this);\n this.btnOnClick = this.btnOnClick.bind(this);\n this.btnOnMouseDown = this.btnOnMouseDown.bind(this);\n this.btnOnMouseUp = this.btnOnMouseUp.bind(this);\n // form field\n const formField = document.createElement('div');\n formField.classList.add('pwv-formField__ComboBox');\n // datalist\n this.dataList = document.createElement('datalist');\n this.dataList.id = Math.random().toString(36).substring(2, 8);\n for (let i = 0; i < this.widget.options.size; i++) {\n const value = this.widget.options.get(i);\n const item = document.createElement('option');\n item.value = value;\n item.textContent = value;\n this.dataList.appendChild(item);\n }\n // input\n this.input = document.createElement('input');\n this.input.setAttribute('list', this.dataList.id);\n this.input.style.border = 'none';\n this.input.style.boxSizing = 'border-box';\n this.input.style.width = '100%';\n this.input.style.maxWidth = '100%';\n this.input.value =\n this.widget.chosen !== null\n ? this.widget.options.get(this.widget.chosen)\n : this.widget.customEntry;\n this.input.addEventListener('focus', this.inputOnFocus);\n this.input.addEventListener('blur', this.inputOnBlur);\n this.input.addEventListener('input', this.inputOnInput);\n this.input.addEventListener('change', this.inputOnChange);\n this.input.addEventListener('keydown', this.inputOnKeyDown);\n // clear button\n this.btnClear = document.createElement('button');\n this.btnClear.tabIndex = -1;\n const icon = document.createElement('span');\n icon.classList.add('pwv-icon');\n const iconSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n iconSvg.setAttribute('viewBox', '0 0 320 512');\n const iconPath = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n iconPath.setAttribute('d', 'M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z');\n iconPath.setAttribute('stroke-width', '1px');\n iconPath.setAttribute('shape-rendering', 'optimizeQuality');\n iconSvg.appendChild(iconPath);\n icon.appendChild(iconSvg);\n this.btnClear.appendChild(icon);\n this.btnClear.addEventListener('mousedown', this.btnOnMouseDown);\n this.btnClear.addEventListener('mouseup', this.btnOnMouseUp);\n this.btnClear.addEventListener('mouseleave', this.btnOnMouseUp);\n this.btnClear.addEventListener('click', this.btnOnClick);\n formField.appendChild(this.input);\n formField.appendChild(this.dataList);\n formField.appendChild(this.btnClear);\n return formField;\n }\n onRemove() {\n if (this.saveThrottlingTimer) {\n window.clearTimeout(this.saveThrottlingTimer);\n }\n if (this.hasPendingChanges) {\n this.saveWidget();\n }\n this.input.removeEventListener('focus', this.inputOnFocus);\n this.input.removeEventListener('blur', this.inputOnBlur);\n this.input.removeEventListener('input', this.inputOnInput);\n this.input.removeEventListener('change', this.inputOnChange);\n this.input.removeEventListener('keydown', this.inputOnKeyDown);\n this.btnClear.removeEventListener('mousedown', this.btnOnMouseDown);\n this.btnClear.removeEventListener('mouseup', this.btnOnMouseUp);\n this.btnClear.removeEventListener('mouseleave', this.btnOnMouseUp);\n this.btnClear.removeEventListener('click', this.btnOnClick);\n }\n setFocus() {\n this.input.focus();\n }\n updateBtnVisibility() {\n if (this.btnClear) {\n this.btnClear.style.display = this.input.value === '' ? 'none' : 'flex';\n }\n }\n updateWidget() {\n const { value, list } = this.input;\n const options = list.options;\n const chosen = [...options].findIndex((i) => i.value === value);\n if (chosen >= 0) {\n this.widget.chosen = chosen;\n }\n else {\n this.widget.customEntry = value;\n }\n if (this.saveThrottlingTimer) {\n window.clearTimeout(this.saveThrottlingTimer);\n }\n this.saveThrottlingTimer = window.setTimeout(() => {\n this.saveWidget();\n this.hasPendingChanges = false;\n }, 500);\n }\n inputOnFocus(e) {\n this.updateBtnVisibility();\n }\n inputOnBlur(e) {\n if (!this.btnClearPressed) {\n this.saveWidget();\n this.hasPendingChanges = false;\n this.onBlur();\n }\n }\n inputOnInput(e) {\n this.updateBtnVisibility();\n this.updateWidget();\n }\n inputOnChange(e) {\n this.updateBtnVisibility();\n }\n inputOnKeyDown(e) {\n if (e.code === 'Tab') {\n this.onTab(e.shiftKey);\n }\n else if (e.code === 'Escape') {\n this.input.blur();\n }\n }\n btnOnClick(e) {\n this.input.value = '';\n this.updateWidget();\n this.updateBtnVisibility();\n this.input.focus();\n }\n btnOnMouseDown(e) {\n this.btnClearPressed = true;\n }\n btnOnMouseUp(e) {\n this.input.focus();\n this.btnClearPressed = false;\n }\n}\n","import { CanvasLayer } from '../CanvasLayer';\nimport { PdfItemType, WidgetType } from '../../pdf-viewer-api';\nimport { CheckBoxWidget } from './CheckBoxWidget';\nimport { ComboBoxWidget } from './ComboBoxWidget';\nimport { SelectListWidget } from './SelectListWidget';\nimport { ListBoxWidget } from './ListBoxWidget';\nimport { RadioButtonWidget } from './RadioButtonWidget';\nimport { TextBoxWidget } from './TextBoxWidget';\nconst moduleLayerName = 'EditFormField';\nconst stopPropagation = (e) => {\n e.stopPropagation();\n};\nexport class EditFormFieldLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.widgetAnnotation = null;\n this.formFieldElement = null;\n this.hasFocus = false;\n this.widgetEditor = null;\n }\n onCreate(args) {\n const { annotationId, action } = args;\n this.store.viewer.beginModule(moduleLayerName);\n this.widgetAnnotation = this.pdfApi.getItem(annotationId);\n this.selectNextFormField = this.selectNextFormField.bind(this);\n this.blur = this.blur.bind(this);\n this.formFieldElement = this.createHtmlLayer();\n this.formFieldElement.classList.add('pwv-formField');\n this.formFieldElement.addEventListener('mousedown', stopPropagation, false);\n this.formFieldElement.addEventListener('mousemove', stopPropagation, false);\n this.formFieldElement.addEventListener('mouseup', stopPropagation, false);\n this.formFieldElement.addEventListener('touchstart', stopPropagation, { passive: false });\n this.formFieldElement.addEventListener('touchmove', stopPropagation, { passive: true });\n this.formFieldElement.addEventListener('touchend', stopPropagation, { passive: true });\n this.updateFormFieldElementPosition();\n const widget = this.widgetAnnotation.widget;\n const widgetType = this.widgetAnnotation.widgetType;\n if (action === 'click' &&\n (widgetType === WidgetType.CHECK_BOX || widgetType === WidgetType.RADIO_BUTTON)) {\n widget.push();\n this.widgetAnnotation.pdfDocument.editAnnotation(widget);\n }\n const bb = widget.boundingBox;\n const paddingX = 4;\n const paddingY = 6;\n this.pdfApi.goToRectangle({\n page: bb.pageNumber,\n pdfX: bb.x - paddingX,\n pdfY: bb.y - paddingY,\n pdfW: bb.width + 2 * paddingX,\n pdfH: bb.height + 2 * paddingY,\n });\n const options = {\n widget: widget,\n widgetType: widgetType,\n pdfDocument: this.widgetAnnotation.pdfDocument,\n onTab: (shiftKey) => {\n this.selectNextFormField(shiftKey);\n },\n onBlur: () => {\n if (this.hasFocus) {\n this.blur();\n }\n },\n };\n switch (options.widgetType) {\n case WidgetType.CHECK_BOX:\n this.widgetEditor = new CheckBoxWidget(this.formFieldElement, options);\n break;\n case WidgetType.RADIO_BUTTON:\n this.widgetEditor = new RadioButtonWidget(this.formFieldElement, options);\n break;\n case WidgetType.TEXT_BOX:\n this.widgetEditor = new TextBoxWidget(this.formFieldElement, options);\n break;\n case WidgetType.COMBO_BOX:\n {\n if (widget.customEntryAllowed) {\n this.widgetEditor = new ComboBoxWidget(this.formFieldElement, options);\n }\n else {\n this.widgetEditor = new SelectListWidget(this.formFieldElement, options);\n }\n }\n break;\n case WidgetType.LIST_BOX:\n this.widgetEditor = new ListBoxWidget(this.formFieldElement, options);\n break;\n }\n this.hasFocus = true;\n }\n cancel() {\n this.remove();\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n resolve();\n });\n return promise;\n }\n close() {\n this.remove();\n }\n onRemove() {\n var _a;\n this.hasFocus = false;\n (_a = this.widgetEditor) === null || _a === void 0 ? void 0 : _a.onRemove();\n this.removeHtmlElements();\n this.formFieldElement = null;\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n var _a;\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (this.formFieldElement) {\n // update position\n if (state.canvas.canvasInvalidated || state.viewer.modeChanged) {\n this.updateFormFieldElementPosition();\n }\n // handle click events\n if (state.pointer.action === 'click') {\n const pointerCssPos = {\n x: state.pointer.x.cssPixels,\n y: state.pointer.y.cssPixels,\n };\n const insideHorizontal = pointerCssPos.x > this.formFieldElement.offsetLeft &&\n pointerCssPos.x < this.formFieldElement.offsetLeft + this.formFieldElement.offsetWidth;\n const insideVertical = pointerCssPos.y > this.formFieldElement.offsetTop &&\n pointerCssPos.y < this.formFieldElement.offsetTop + this.formFieldElement.offsetHeight;\n if (!insideHorizontal || !insideVertical) {\n this.blur();\n const annotationsOnPoint = this.pdfApi.getAnnotationsOnPoint({\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n });\n if (annotationsOnPoint && annotationsOnPoint.length) {\n for (let i = 0; i < annotationsOnPoint.length; i++) {\n const annotationOnPoint = annotationsOnPoint[i];\n if (annotationOnPoint.itemType === PdfItemType.WIDGET &&\n !annotationOnPoint.widget.readOnly) {\n this.pdfViewerCanvas.activateModule('FormFieldModule', {\n annotationId: annotationOnPoint.id,\n action: 'click',\n });\n }\n }\n }\n return;\n }\n }\n }\n if (state.document.zoomChanged || state.viewer.modeChanged) {\n (_a = this.widgetEditor) === null || _a === void 0 ? void 0 : _a.setZoom(state.document.zoom);\n }\n }\n updateFormFieldElementPosition() {\n if (this.widgetAnnotation && this.formFieldElement) {\n const screenRect = this.pdfApi.transformPdfPageRectToScreenRect(this.widgetAnnotation.pdfRect);\n this.formFieldElement.style.left = `${screenRect.x / devicePixelRatio - 2}px`;\n this.formFieldElement.style.top = `${screenRect.y / devicePixelRatio - 2}px`;\n this.formFieldElement.style.width = `${screenRect.w / devicePixelRatio + 1}px`;\n this.formFieldElement.style.height = `${screenRect.h / devicePixelRatio + 1}px`;\n }\n }\n selectNextFormField(reverse) {\n if (this.widgetAnnotation) {\n const { annotations, document } = this.store.getState();\n const pageCount = this.pdfApi.getPageCount();\n const getNextFormFieldOnPage = (pageNumber, index) => {\n const list = annotations.byPage[pageNumber];\n for (let i = index; i < list.length; i++) {\n const annotId = list[i];\n const annotation = annotations.all[annotId];\n if (annotation.itemType === PdfItemType.WIDGET &&\n !annotation.widget.readOnly) {\n return annotation;\n }\n }\n if (pageCount === 1 && index === 0) {\n return null;\n }\n const nextPage = pageCount > pageNumber ? pageNumber + 1 : 1;\n return getNextFormFieldOnPage(nextPage, 0);\n };\n const getPreviewsFormFieldOnPage = (pageNumber, index) => {\n const list = annotations.byPage[pageNumber];\n const start = index < 0 ? list.length - 1 : index;\n for (let i = start; i >= 0; i--) {\n const annotId = list[i];\n const annotation = annotations.all[annotId];\n if (annotation.itemType === PdfItemType.WIDGET &&\n !annotation.widget.readOnly) {\n return annotation;\n }\n }\n if (pageNumber === 1) {\n return null;\n }\n return getPreviewsFormFieldOnPage(pageNumber - 1, -1);\n };\n const currentWidgetIndex = annotations.byPage[this.widgetAnnotation.page].findIndex((a) => { var _a; return a === ((_a = this.widgetAnnotation) === null || _a === void 0 ? void 0 : _a.id); });\n let currentPage = this.widgetAnnotation.page;\n let nextFormField = null;\n if (reverse) {\n if (currentWidgetIndex === 0) {\n if (currentPage === 1) {\n nextFormField = this.widgetAnnotation;\n }\n else {\n nextFormField = getPreviewsFormFieldOnPage(this.widgetAnnotation.page - 1, -1);\n }\n }\n else {\n nextFormField = getPreviewsFormFieldOnPage(this.widgetAnnotation.page, currentWidgetIndex - 1);\n }\n }\n else {\n nextFormField = getNextFormFieldOnPage(this.widgetAnnotation.page, currentWidgetIndex + 1);\n }\n if (nextFormField) {\n this.blur();\n this.pdfViewerCanvas.activateModule('FormFieldModule', {\n annotationId: nextFormField.id,\n action: 'select',\n });\n }\n }\n }\n blur() {\n if (this.hasFocus) {\n this.hasFocus = false;\n this.remove();\n }\n }\n}\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { EditFormFieldLayer } from './EditFormFieldLayer';\nexport class FormFieldModule extends CanvasModule {\n constructor() {\n super();\n this.name = FormFieldModule.moduleInfo.name;\n }\n onRegister() {\n return {};\n }\n activate(args) {\n if (!this.canvasLayers['edit']) {\n this.onEdit(args);\n }\n }\n onEdit(args) {\n this.createCanvasLayer('edit', EditFormFieldLayer, args);\n }\n}\nFormFieldModule.moduleInfo = {\n name: 'FormFieldModule',\n moduleType: CanvasModuleType.Layer,\n requiredFeatures: {\n annotate: false,\n fillFormFields: true,\n },\n};\n","import { WidgetBase } from './WidgetBase';\nexport class ListBoxWidget extends WidgetBase {\n createFormField() {\n const formField = document.createElement('select');\n formField.setAttribute('required', 'true');\n if (this.widget.multiSelectAllowed) {\n formField.setAttribute('multiple', 'true');\n }\n else {\n formField.setAttribute('size', `${this.widget.options.size}`);\n }\n formField.classList.add('pwv-formField__ListBox');\n const values = Array.from(this.widget.chosen.values());\n for (let i = 0; i < this.widget.options.size; i++) {\n const value = this.widget.options.get(i);\n const item = document.createElement('option');\n item.value = i.toString();\n item.textContent = value;\n formField.appendChild(item);\n item.selected = values.includes(i);\n }\n this.handleOnChange = this.handleOnChange.bind(this);\n this.handleOnKeyDown = this.handleOnKeyDown.bind(this);\n this.handleOnBlur = this.handleOnBlur.bind(this);\n formField.addEventListener('change', this.handleOnChange);\n formField.addEventListener('keydown', this.handleOnKeyDown);\n formField.addEventListener('blur', this.handleOnBlur);\n formField.addEventListener('wheel', (e) => {\n e.stopPropagation();\n });\n return formField;\n }\n onRemove() {\n this.editorElement.removeEventListener('change', this.handleOnChange);\n this.editorElement.removeEventListener('keydown', this.handleOnKeyDown);\n this.editorElement.removeEventListener('blur', this.handleOnBlur);\n }\n setFocus() {\n this.editorElement.focus();\n }\n handleOnKeyDown(e) {\n if (e.code === 'Tab') {\n this.onTab(e.shiftKey);\n }\n else if (e.code === 'Escape') {\n this.onBlur();\n }\n }\n handleOnBlur(e) {\n this.onBlur();\n }\n handleOnChange(e) {\n let selectedOptions = [];\n if (!e.target.value) {\n const value = Array.from(this.widget.chosen.values()).shift();\n selectedOptions = [value];\n e.target.value = value;\n }\n else {\n selectedOptions = [...e.target.options]\n .filter((o) => o.selected)\n .map((o) => parseInt(o.value));\n if (!this.widget.multiSelectAllowed) {\n const value = selectedOptions[0];\n selectedOptions = [value];\n e.target.value = value;\n }\n }\n this.widget.chosen.clear();\n selectedOptions.forEach((o) => this.widget.chosen.add(o));\n this.saveWidget();\n }\n}\n","import { WidgetBase } from './WidgetBase';\nexport class RadioButtonWidget extends WidgetBase {\n createFormField() {\n const formField = document.createElement('label');\n formField.classList.add('pwv-formField__RadioButton');\n formField.style.overflow = 'hidden';\n const radio = document.createElement('input');\n radio.type = 'radio';\n radio.checked = this.widget.selected;\n radio.style.position = 'absolute';\n radio.style.top = '-20px';\n radio.style.left = '-20px';\n formField.appendChild(radio);\n this.handleOnChange = this.handleOnChange.bind(this);\n this.handleOnKeyDown = this.handleOnKeyDown.bind(this);\n this.handleOnBlur = this.handleOnBlur.bind(this);\n formField.addEventListener('change', this.handleOnChange);\n formField.addEventListener('keydown', this.handleOnKeyDown);\n formField.addEventListener('blur', this.handleOnBlur);\n return formField;\n }\n onRemove() {\n this.editorElement.removeEventListener('change', this.handleOnChange);\n this.editorElement.removeEventListener('keydown', this.handleOnKeyDown);\n this.editorElement.removeEventListener('blur', this.handleOnBlur);\n }\n setFocus() {\n this.editorElement.focus();\n }\n handleOnKeyDown(e) {\n if (e.code === 'Tab') {\n this.onTab(e.shiftKey);\n }\n else if (e.code === 'Escape') {\n this.onBlur();\n }\n }\n handleOnBlur(e) {\n this.onBlur();\n }\n handleOnChange(e) {\n this.widget.push();\n this.saveWidget();\n }\n}\n","import { WidgetBase } from './WidgetBase';\nexport class SelectListWidget extends WidgetBase {\n createFormField() {\n const formField = document.createElement('select');\n formField.classList.add('pwv-formField__SelectList');\n for (let i = 0; i < this.widget.options.size; i++) {\n const value = this.widget.options.get(i);\n const item = document.createElement('option');\n item.value = i.toString();\n item.textContent = value;\n formField.appendChild(item);\n }\n formField.value = this.widget.chosen;\n this.handleOnChange = this.handleOnChange.bind(this);\n this.handleOnKeyDown = this.handleOnKeyDown.bind(this);\n this.handleOnBlur = this.handleOnBlur.bind(this);\n formField.addEventListener('change', this.handleOnChange);\n formField.addEventListener('keydown', this.handleOnKeyDown);\n formField.addEventListener('blur', this.handleOnBlur);\n return formField;\n }\n onRemove() {\n // this.editorElement.removeEventListener('change', this.handleOnChange)\n // this.editorElement.removeEventListener('keydown', this.handleOnKeyDown)\n // this.editorElement.removeEventListener('blur', this.handleOnBlur)\n }\n setFocus() {\n this.editorElement.focus();\n }\n handleOnKeyDown(e) {\n if (e.code === 'Tab') {\n this.onTab(e.shiftKey);\n }\n else if (e.code === 'Escape') {\n this.onBlur();\n }\n }\n handleOnBlur(e) {\n this.onBlur();\n }\n handleOnChange(e) {\n this.widget.chosen = parseInt(e.target.value);\n this.saveWidget();\n }\n}\n","import { WidgetBase } from './WidgetBase';\nexport class TextBoxWidget extends WidgetBase {\n createFormField() {\n const formField = this.widget.multilineAllowed\n ? document.createElement('textarea')\n : document.createElement('input');\n formField.classList.add('pwv-formField__TextBox');\n if (this.widget.text) {\n formField.value = this.widget.text;\n }\n if (this.widget.maxLength && this.widget.maxLength >= 0) {\n formField.maxLength = this.widget.maxLength;\n }\n if (this.widget.comb) {\n formField.style.letterSpacing = '1em';\n }\n this.handleOnChange = this.handleOnChange.bind(this);\n this.handleOnKeyDown = this.handleOnKeyDown.bind(this);\n this.handleOnBlur = this.handleOnBlur.bind(this);\n formField.addEventListener('input', this.handleOnChange);\n formField.addEventListener('keydown', this.handleOnKeyDown);\n formField.addEventListener('blur', this.handleOnBlur);\n return formField;\n }\n onRemove() {\n // this.editorElement.removeEventListener('change', this.handleOnChange)\n // this.editorElement.removeEventListener('keydown', this.handleOnKeyDown)\n // this.editorElement.removeEventListener('blur', this.handleOnBlur)\n }\n setFocus() {\n this.editorElement.focus();\n }\n handleOnKeyDown(e) {\n if (e.code === 'Tab') {\n this.onTab(e.shiftKey);\n }\n else if (e.code === 'Escape') {\n this.onBlur();\n }\n }\n handleOnBlur(e) {\n this.onBlur();\n }\n handleOnChange(e) {\n try {\n this.widget.text = e.target.value;\n }\n catch (err) {\n console.warn(err);\n }\n this.saveWidget();\n }\n}\n","export class WidgetBase {\n constructor(element, options) {\n this.element = element;\n this.widgetType = options.widgetType;\n this.widget = options.widget;\n this.pdfDocument = options.pdfDocument;\n this.onTab = options.onTab;\n this.onBlur = options.onBlur;\n this.editorElement = this.createFormField();\n this.editorElement.classList.add('pwv-formField__Element');\n this.element.appendChild(this.editorElement);\n window.setTimeout(() => {\n this.setFocus();\n }, 1);\n }\n saveWidget() {\n this.pdfDocument\n .editAnnotation(this.widget)\n .then(() => { })\n .catch((err) => {\n console.warn(err);\n });\n }\n setZoom(zoom) {\n this.editorElement.style.transform = `scale(${zoom})`;\n this.editorElement.style.width = this.element.clientWidth / zoom + 'px';\n this.editorElement.style.height = this.element.clientHeight / zoom + 'px';\n }\n}\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { CanvasLayer } from '../CanvasLayer';\nimport { PdfItemType, AnnotationBorderStyle, } from '../../pdf-viewer-api';\nimport { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { getRectFromSelection } from '../../pdf-viewer-canvas/state/document';\nimport { createAddFreetextAnnotationToolbar } from './AddFreetextAnnotationToolbar';\nconst moduleLayerName = 'AddFreetextAnnotation';\nexport class AddFreetextAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.context = null;\n this.colors = [];\n this.selectedColor = '';\n this.borderWidths = [];\n this.pointerDown = false;\n this.startPoint = null;\n this.page = 0;\n }\n onCreate() {\n this.setColor = this.setColor.bind(this);\n this.setBorderWidth = this.setBorderWidth.bind(this);\n this.close = this.close.bind(this);\n this.context = this.createCanvas();\n this.colors = this.options.annotation.colors.backgroundColors;\n this.selectedColor =\n this.options.annotation.colors.freetextBackgroundColor ||\n this.options.annotation.colors.defaultBackgroundColor;\n // todo: get values from options\n this.borderWidths = [0, 1, 2, 3, 4];\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n createAddFreetextAnnotationToolbar({\n colors: this.colors,\n selectedColor: this.selectedColor,\n borderWidths: this.borderWidths,\n selectedBorderWidth: this.options.annotation.freetextBorderWidth || this.options.annotation.defaultBorderWidth,\n onColorChanged: this.setColor,\n onBorderWidthChanged: this.setBorderWidth,\n onClose: this.close,\n }, toolbarElement);\n this.store.viewer.beginModule(moduleLayerName);\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n resolve();\n });\n return promise;\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (this.context) {\n const update = state.viewer.modeChanged ||\n state.pointer.positionChanged ||\n state.pointer.action ||\n state.document.zoomChanged;\n if (update) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const pointerPos = { x: state.pointer.x.devicePixels, y: state.pointer.y.devicePixels };\n const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);\n if (pointerPdfPos.isOnPage) {\n this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);\n }\n else {\n this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);\n }\n if (state.pointer.isDown) {\n if (!this.pointerDown) {\n this.startPoint = pointerPos;\n this.pointerDown = true;\n if (this.page === 0 && pointerPdfPos.isOnPage) {\n this.page = pointerPdfPos.pdfPoint.page;\n }\n }\n if (this.startPoint) {\n const rect = getRectFromSelection(state.document, {\n x: this.startPoint.x,\n y: this.startPoint.y,\n }, {\n x: pointerPos.x,\n y: pointerPos.y,\n }, this.page);\n if (rect) {\n const lineWidth = 2 * devicePixelRatio;\n ctx.save();\n ctx.strokeStyle = this.options.viewer.general.textSelectionColor;\n ctx.fillStyle = this.options.viewer.general.textSelectionColor;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash([lineWidth, lineWidth]);\n ctx.strokeRect(rect.x, rect.y, rect.w, rect.h);\n ctx.globalAlpha = 0.33;\n ctx.fillRect(rect.x, rect.y, rect.w, rect.h);\n ctx.restore();\n }\n }\n }\n else if (this.pointerDown && this.startPoint) {\n const rect = getRectFromSelection(state.document, {\n x: this.startPoint.x,\n y: this.startPoint.y,\n }, {\n x: pointerPos.x,\n y: pointerPos.y,\n }, this.page);\n if (rect) {\n this.createFreeTextAnnotation(rect);\n this.pointerDown = false;\n this.startPoint = null;\n this.remove();\n }\n }\n }\n }\n }\n setColor(color) {\n this.selectedColor = color;\n this.options.annotation.colors.freetextBackgroundColor = color;\n }\n setBorderWidth(borderWidth) {\n this.options.annotation.freetextBorderWidth = borderWidth;\n }\n close() {\n this.remove();\n }\n createFreeTextAnnotation(rect) {\n return __awaiter(this, void 0, void 0, function* () {\n const pdfRect = this.pdfApi.transformScreenRectToPdfRect(rect, this.page);\n const { pdfY, pdfH, pdfW, pdfX, page } = pdfRect;\n const pageSize = yield this.pdfApi.getPagePdfSize(page);\n const minWidth = 20;\n const minHeight = 18;\n const isRotated = this.pdfApi.getRotation() % 180 !== 0;\n pdfRect.pdfW = isRotated ? Math.max(minHeight, pdfW) : Math.max(minWidth, pdfW);\n pdfRect.pdfH = isRotated ? Math.max(minWidth, pdfH) : Math.max(minHeight, pdfH);\n pdfRect.pdfX = Math.min(pdfX, pageSize.width - pdfRect.pdfW);\n pdfRect.pdfY = Math.min(pdfY, pageSize.height - pdfRect.pdfH);\n const annotation = {\n itemType: PdfItemType.FREE_TEXT,\n color: this.selectedColor === 'transparent' ? '#00000000' : this.selectedColor,\n author: this.options.viewer.general.user,\n page: pdfRect.page,\n pdfRect,\n border: {\n width: this.options.annotation.freetextBorderWidth || this.options.annotation.defaultBorderWidth,\n style: AnnotationBorderStyle.SOLID,\n },\n /* tslint:disable-next-line: max-line-length */\n richtext: ``,\n fontName: 'Arial',\n fontColor: this.options.annotation.fonts.freetextFontColor,\n fontSize: this.options.annotation.fonts.freetextFontSize,\n };\n this.pdfApi.createItem(annotation).then((item) => {\n this.onAnnotationCreated(item).then((item) => {\n const module = this.module;\n module.onEdit(item.id);\n });\n });\n });\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { ColorPicker } from '../../common/ColorPicker';\nimport { StrokeWidthPicker } from '../../common/StrokeWidthPicker';\nexport const createAddFreetextAnnotationToolbar = (props, element) => {\n const state = {\n colors: props.colors,\n selectedColor: props.selectedColor,\n borderWidths: props.borderWidths,\n selectedBorderWidth: props.selectedBorderWidth,\n };\n const actions = {\n setColor: (color) => ($state) => {\n props.onColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedColor: color });\n },\n setBorderWith: (borderWidth) => ($state) => {\n props.onBorderWidthChanged(borderWidth);\n return Object.assign(Object.assign({}, $state), { selectedBorderWidth: borderWidth });\n },\n };\n const App = () => h(AddFreetextAnnotationToolbar, null);\n /* tslint:disable-next-line:max-line-length */\n const AddFreetextAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(ColorPicker, { colors: $state.colors, color: $state.selectedColor, icon: icons.fillColor, mode: \"buttons\", onChange: $actions.setColor }),\n h(StrokeWidthPicker, { tooltip: translationManager.getText('annotFreeText.borderWidth'), noneStrokeText: translationManager.getText('border.none'), strokeWidths: $state.borderWidths, value: $state.selectedBorderWidth, onChange: $actions.setBorderWith })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onClose }))));\n return app(state, actions, App, element);\n};\n","import { CanvasLayer } from '../CanvasLayer';\nimport { Color } from '../../common/Color';\nimport { createEditFreetextAnnotationToolbar, } from './EditFreetextAnnotationToolbar';\nimport { RichTextEditor } from './RichTextEditor';\nimport { convertPdfToCssPixel, convertCssToPdfPixel } from '../../common/Tools';\nimport { addHistoryEntry } from '../../custom/history';\nconst moduleLayerName = 'EditFreetextAnnotation';\nexport class EditFreetextAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.freetextAnnotation = null;\n this.editorElement = null;\n this.richTextEditor = null;\n this.toolbarView = null;\n this.color = this.options.annotation.fonts.freetextFontColor;\n this.fontSize = `${this.options.annotation.fonts.defaultFontSize}pt`;\n this.borderWidth = 1;\n this.fontSizeCSS = convertPdfToCssPixel(`${this.options.annotation.fonts.defaultFontSize}`);\n this.fontName = this.options.annotation.fonts.freetextFontFamily;\n }\n onCreate(annotationId) {\n this.store.viewer.beginModule(moduleLayerName);\n this.freetextAnnotation = this.pdfApi.getItem(annotationId);\n this.updateFreeTextAnnotation = this.updateFreeTextAnnotation.bind(this);\n this.close = this.close.bind(this);\n this.executeCommand = this.executeCommand.bind(this);\n this.editorElement = this.createHtmlLayer();\n this.editorElement.style.position = 'absolute';\n this.editorElement.style.zIndex = '4';\n const annotationOptions = this.options.annotation;\n this.color = annotationOptions.colors.freetextFontColor;\n this.borderWidth = this.freetextAnnotation.border.width;\n this.fontName = annotationOptions.fonts.freetextFontFamily;\n this.fontSize = `${annotationOptions.fonts.freetextFontSize}`;\n this.fontSizeCSS = convertPdfToCssPixel(`${annotationOptions.fonts.freetextFontSize}`);\n if (this.freetextAnnotation.richText) {\n const colorRes = /.*color:(.*?);/.exec(this.freetextAnnotation.richText);\n const fontNameRes = /.*font-family:(.*?);/.exec(this.freetextAnnotation.richText);\n const fontSizeRes = /.*font-size:(.*?)[;|\\\"]/.exec(this.freetextAnnotation.richText);\n if (colorRes && colorRes.length > 1) {\n this.color = colorRes[1];\n }\n if (fontNameRes && fontNameRes.length > 1) {\n this.fontName = fontNameRes[1];\n }\n if (fontSizeRes && fontSizeRes.length > 1) {\n this.fontSize = fontSizeRes[1];\n this.fontSizeCSS = convertPdfToCssPixel(this.fontSize);\n }\n }\n else {\n this.color = this.freetextAnnotation.color;\n this.fontName = this.freetextAnnotation.fontName;\n this.fontSizeCSS = convertPdfToCssPixel(this.freetextAnnotation.fontSize);\n }\n this.richTextEditor = new RichTextEditor(this.editorElement, {\n content: this.freetextAnnotation.content,\n richText: this.freetextAnnotation.richText,\n backgroundColor: this.freetextAnnotation.color,\n borderWidth: this.freetextAnnotation.border.width,\n fontName: this.fontName,\n fontColor: this.color,\n fontSizeCSS: this.fontSizeCSS,\n });\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n this.toolbarView = createEditFreetextAnnotationToolbar({\n annotation: this.freetextAnnotation,\n backgroundColors: [...annotationOptions.colors.backgroundColors],\n borderWidths: [0, 1, 2, 3, 4],\n fontColors: [...annotationOptions.colors.foregroundColors],\n fontFamilies: annotationOptions.fonts.fontFamilies,\n fontSizes: annotationOptions.fonts.fontSizes,\n selectedFont: this.fontName,\n selectedBackgroundColor: this.freetextAnnotation.color,\n selectedFontColor: this.color,\n selectedFontSize: this.fontSize,\n selectedBorderWidth: this.borderWidth,\n allowLockAnnotations: this.options.viewer.permissions.allowLockAnnotations,\n hideAnnotationSubject: this.options.annotation.hideAnnotationSubject || false,\n onCmd: this.executeCommand,\n onClose: this.close,\n }, toolbarElement);\n }\n onSave() {\n return new Promise((resolve, reject) => {\n this.updateFreeTextAnnotation().then(() => {\n this.remove();\n resolve();\n });\n });\n }\n close() {\n this.updateFreeTextAnnotation().then(() => {\n this.remove();\n });\n }\n onRemove() {\n this.removeHtmlElements();\n this.editorElement = null;\n this.freetextAnnotation = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (this.editorElement && state.pointer.action === 'click') {\n const insideHorizontal = state.pointer.x.cssPixels > this.editorElement.offsetLeft &&\n state.pointer.x.cssPixels < this.editorElement.offsetLeft + this.editorElement.offsetWidth;\n const insideVertical = state.pointer.y.cssPixels > this.editorElement.offsetTop &&\n state.pointer.y.cssPixels < this.editorElement.offsetTop + this.editorElement.offsetHeight;\n if (!insideHorizontal || !insideVertical) {\n this.updateFreeTextAnnotation();\n this.remove();\n return;\n }\n }\n if (this.editorElement && this.freetextAnnotation && this.richTextEditor) {\n const updatePosition = state.canvas.canvasInvalidated || state.viewer.modeChanged;\n if (updatePosition) {\n const screenRect = this.pdfApi.transformPdfPageRectToScreenRect(this.freetextAnnotation.pdfRect);\n this.editorElement.style.left = `${screenRect.x / devicePixelRatio}px`;\n this.editorElement.style.top = `${screenRect.y / devicePixelRatio}px`;\n const width = screenRect.w / devicePixelRatio;\n const height = screenRect.h / devicePixelRatio;\n const rotation = (this.freetextAnnotation.rotation + state.document.rotation) % 360;\n this.editorElement.style.transform = `rotate(${rotation}deg)`;\n if (rotation == 90) {\n this.editorElement.style.width = `${height}px`;\n this.editorElement.style.height = `${width}px`;\n this.editorElement.style.transformOrigin = `${width / 2}px ${width / 2}px`;\n }\n else if (rotation == 180) {\n this.editorElement.style.width = `${width}px`;\n this.editorElement.style.height = `${height}px`;\n this.editorElement.style.transformOrigin = `${width / 2}px ${height / 2}px`;\n }\n else if (rotation == 270) {\n this.editorElement.style.width = `${height}px`;\n this.editorElement.style.height = `${width}px`;\n this.editorElement.style.transformOrigin = `${height / 2}px ${height / 2}px`;\n }\n else {\n this.editorElement.style.width = `${width}px`;\n this.editorElement.style.height = `${height}px`;\n }\n }\n if (state.document.zoomChanged || state.viewer.modeChanged) {\n this.richTextEditor.setZoom(state.document.zoom);\n }\n }\n }\n executeCommand(cmd) {\n var _a;\n switch (cmd.cmd) {\n case 'setFont': {\n this.options.annotation.fonts.freetextFontFamily = cmd.args;\n break;\n }\n case 'setFontSize': {\n this.options.annotation.fonts.freetextFontSize = cmd.args;\n break;\n }\n }\n (_a = this.richTextEditor) === null || _a === void 0 ? void 0 : _a.executeCommand(cmd);\n }\n updateFreeTextAnnotation() {\n const promise = new Promise((resolve, reject) => {\n if (this.richTextEditor && this.freetextAnnotation) {\n const richTextObj = this.richTextEditor.getEditorValues();\n const subject = this.toolbarView\n ? this.toolbarView.getState().updatedSubject\n : this.freetextAnnotation.subject;\n if (this.options.annotation.trackHistory) {\n addHistoryEntry(this.freetextAnnotation, 'edit', this.options.viewer.general.user, richTextObj.content, subject);\n }\n const fontColor = new Color(richTextObj.fontColor);\n const backgroundColor = richTextObj.backgroundColor === ''\n ? null\n : new Color(richTextObj.backgroundColor);\n this.freetextAnnotation.content = richTextObj.content;\n this.freetextAnnotation.subject = subject;\n this.freetextAnnotation.richText = richTextObj.richText;\n this.freetextAnnotation.fontColor = fontColor.toHexRgb();\n this.freetextAnnotation.fontName =\n richTextObj.fontName !== null ? richTextObj.fontName : 'Helvetica';\n this.freetextAnnotation.fontSize = richTextObj.fontSizeCSS\n ? convertCssToPdfPixel(richTextObj.fontSizeCSS)\n : this.freetextAnnotation.fontSize;\n this.freetextAnnotation.color = backgroundColor !== null ? backgroundColor.toRgba() : null;\n this.freetextAnnotation.border.width = richTextObj.borderWidth;\n this.pdfApi\n .updateItem(this.freetextAnnotation)\n .then((item) => {\n this.store.annotations.updateAnnotation(item);\n resolve();\n })\n .catch((err) => {\n console.error(err);\n reject();\n });\n }\n });\n return promise;\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { Dropdown } from '../../common/Dropdown';\nimport { ColorPicker } from '../../common/ColorPicker';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { StrokeWidthPicker } from '../../common/StrokeWidthPicker';\n/** internal */\nexport const createEditFreetextAnnotationToolbar = (props, element) => {\n const state = {\n annotation: props.annotation,\n updatedSubject: props.annotation.subject,\n backgroundColors: props.backgroundColors,\n borderWidths: props.borderWidths,\n selectedBorderWidth: props.selectedBorderWidth,\n fontColors: props.fontColors,\n fontFamilies: props.fontFamilies,\n fontSizes: props.fontSizes,\n selectedFont: props.selectedFont,\n selectedBackgroundColor: props.selectedBackgroundColor,\n selectedFontColor: props.selectedFontColor,\n selectedFontSize: props.selectedFontSize,\n hasRangeSelection: false,\n };\n const actions = {\n getState: () => ($state) => $state,\n setBorderWith: (borderWidth) => ($state) => {\n // props.onBorderWidthChanged(borderWidth)\n props.onCmd({ cmd: 'setBorderWidth', args: borderWidth });\n return Object.assign(Object.assign({}, $state), { selectedBorderWidth: borderWidth });\n },\n executeCommand: (cmd) => ($state) => {\n props.onCmd(cmd);\n return $state;\n },\n setFontFamily: (fontName) => ($state) => {\n props.onCmd({ cmd: 'setFont', args: fontName });\n return Object.assign(Object.assign({}, $state), { selectedFont: fontName });\n },\n setFontSize: (fontSize) => ($state) => {\n props.onCmd({ cmd: 'setFontSize', args: fontSize });\n return Object.assign(Object.assign({}, $state), { selectedFontSize: `${fontSize}pt` });\n },\n setFontColor: (color) => ($state) => {\n props.onCmd({ cmd: 'setFontColor', args: color });\n return Object.assign(Object.assign({}, $state), { selectedFontColor: color });\n },\n setBackgroundColor: (color) => ($state) => {\n props.onCmd({ cmd: 'setFillColor', args: color });\n return Object.assign(Object.assign({}, $state), { selectedBackgroundColor: color });\n },\n setSubject: (subject) => ($state) => {\n return Object.assign(Object.assign({}, $state), { annotation: $state.annotation, updatedSubject: subject });\n },\n hasRangeSelectionChanged: (hasRangeSelection) => ($state) => (Object.assign(Object.assign({}, $state), { hasRangeSelection })),\n close: () => ($state) => {\n props.onClose();\n return $state;\n },\n };\n const App = () => (h(EditFreetextAnnotationToolbar, { hideAnnotationSubject: props.hideAnnotationSubject }));\n /* tslint:disable-next-line:max-line-length */\n const EditFreetextAnnotationToolbar = ({ hideAnnotationSubject }) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(Dropdown, { tooltip: translationManager.getText('annotFreeText.fontFamily'), text: $state.selectedFont, value: $state.selectedFont, width: 150, items: $state.fontFamilies.map((font) => ({\n text: font,\n value: font,\n })), onChange: $actions.setFontFamily }),\n h(Dropdown, { tooltip: translationManager.getText('annotFreeText.fontSize'), text: $state.selectedFontSize, value: $state.selectedFontSize, width: 85, align: \"right\", items: $state.fontSizes.map((size, index) => ({\n text: `${size}pt`,\n value: size,\n })), onChange: $actions.setFontSize }),\n h(ToolbarSeparator, null)),\n h(ToolbarItemGroup, null,\n h(ColorPicker, { tooltip: translationManager.getText('annotFreeText.fontColor'), colors: $state.fontColors, icon: icons.fontColor, color: $state.selectedFontColor, onChange: $actions.setFontColor }),\n h(ColorPicker, { tooltip: translationManager.getText('annotFreeText.bgColor'), colors: $state.backgroundColors, icon: icons.fillColor, color: $state.selectedBackgroundColor, onChange: $actions.setBackgroundColor }),\n h(StrokeWidthPicker, { tooltip: translationManager.getText('annotFreeText.borderWidth'), noneStrokeText: translationManager.getText('border.none'), strokeWidths: $state.borderWidths, value: $state.selectedBorderWidth, onChange: $actions.setBorderWith }),\n h(ToolbarSeparator, null)),\n h(ToolbarItemGroup, null,\n h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.alignLeft'), icon: icons.alignLeft, onClick: () => {\n $actions.executeCommand({ cmd: 'justifyLeft' });\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.alignCenter'), icon: icons.alignCenter, onClick: () => {\n $actions.executeCommand({ cmd: 'justifyCenter' });\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.alignRight'), icon: icons.alignRight, onClick: () => {\n $actions.executeCommand({ cmd: 'justifyRight' });\n } }),\n h(ToolbarSeparator, null)),\n h(ToolbarItemGroup, null,\n h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.bold'), icon: icons.bold, onClick: () => {\n $actions.executeCommand({ cmd: 'bold' });\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.italic'), icon: icons.italic, onClick: () => {\n $actions.executeCommand({ cmd: 'italic' });\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.underline'), icon: icons.underline, onClick: () => {\n $actions.executeCommand({ cmd: 'underline' });\n } }),\n h(ToolbarSeparator, null)),\n props.allowLockAnnotations && (h(ToolbarItemGroup, null,\n h(ToolbarButton, { tooltip: translationManager.getText($state.annotation.isLocked() ? 'annotFreeText.unlock' : 'annotFreeText.lock'), icon: $state.annotation.isLocked() ? icons.lock : icons.unlock, onClick: () => {\n $state.annotation.setLock(!$state.annotation.isLocked());\n $actions.close();\n } }),\n h(ToolbarSeparator, null))),\n !hideAnnotationSubject && (h(ToolbarItemGroup, null,\n h(\"div\", { class: 'pwv-freetext-subject' },\n h(\"input\", { id: 'pwv-freetext-subject-' + $state.annotation.id, placeholder: translationManager.getText('annotFreeText.subjectPlaceholder'), onchange: (e) => {\n $actions.setSubject(e.currentTarget.value);\n }, value: $state.updatedSubject })))),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarButton, { icon: icons.ok, onClick: $actions.close }))));\n return app(state, actions, App, element);\n};\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { AddFreetextAnnotationLayer } from './AddFreetextAnnotationLayer';\nimport { PdfItemType } from '../../pdf-viewer-api';\nimport { icons } from '../../common/Icon';\nimport { translationManager } from '../../common/TranslationManager';\nimport { EditFreetextAnnotationLayer } from './EditFreetextAnnotationLayer';\nexport class FreetextAnnotationModule extends CanvasModule {\n constructor() {\n super();\n this.annotationbarElement = null;\n this.toolbarElement = null;\n this.name = FreetextAnnotationModule.moduleInfo.name;\n this.onEdit = this.onEdit.bind(this);\n }\n onRegister() {\n this.toolbarElement = document.createElement('div');\n return {\n toolbar: this.toolbarElement,\n contextbar: {\n itemTypes: [PdfItemType.FREE_TEXT],\n icon: icons.edit,\n tooltip: translationManager.getText('annotFreeText.edit'),\n onCmd: (annotationId) => {\n this.onEdit(annotationId);\n },\n },\n };\n }\n activate(annotationId) {\n if (annotationId) {\n this.onEdit(annotationId);\n }\n else {\n if (!this.canvasLayers['add']) {\n if (this.store) {\n this.store.viewer.deselectAnnotation();\n }\n this.createCanvasLayer('add', AddFreetextAnnotationLayer);\n }\n else {\n this.removeCanvasLayer('add');\n }\n }\n }\n onEdit(annotationId) {\n this.createCanvasLayer('edit', EditFreetextAnnotationLayer, annotationId);\n }\n}\nFreetextAnnotationModule.moduleInfo = {\n name: 'FreetextAnnotationModule',\n moduleType: CanvasModuleType.Tool,\n requiredFeatures: {\n annotate: true,\n fillFormFields: false,\n },\n translationKey: 'annotFreeText.add',\n icon: 'freeText',\n};\n","import { Color } from '../../common/Color';\nimport { convertPdfToCssPixel, roundToTwo } from '../../common/Tools';\n/** internal */\nexport class RichTextEditor {\n constructor(element, content) {\n this.hasRangeSelection = false;\n // bind events\n this.executeCommand = this.executeCommand.bind(this);\n this.handleOnPaste = this.handleOnPaste.bind(this);\n this.handleSelectionChange = this.handleSelectionChange.bind(this);\n this.content = content;\n // create elements\n this.element = element;\n this.element.style.background = 'white';\n this.element.classList.add('pwv-freetexteditor');\n this.editorElement = document.createElement('iframe');\n this.editorElement.width = '100%';\n this.editorElement.height = '100%';\n this.editorElement.frameBorder = '0';\n this.editorElement.style.transformOrigin = '0 0';\n this.element.appendChild(this.editorElement);\n this.editorDocument = this.editorElement.contentDocument;\n this.editorDocument.open();\n this.editorDocument.close();\n // set content\n let text = content.richText;\n text = text.replace(/\\&#(10|13|x0A|x0D);/gi, '
');\n text = text.replace(/]*)>/gi, '
');\n text = text.replace(/<\\/p>\\s*/gi, '
');\n text = text.replace(/\\s*<\\/p>\\s*/gi, '');\n text = text.replace(/<\\/p>/gi, '');\n text = text.replace(/\\r?\\n|\\r/g, '');\n const m = /.*().*/gi.exec(text);\n /* tslint:disable:max-line-length */\n this.editorDocument.body.outerHTML =\n m && m.length > 1\n ? m[1]\n : '

';\n if (this.editorDocument.body.children.length === 0) {\n this.editorDocument.body.innerHTML = '

';\n }\n else {\n this.editorDocument.body.childNodes.forEach((node) => {\n if (node.nodeName === 'DIV' && node.childNodes.length === 0) {\n const br = document.createElement('br');\n node.appendChild(br);\n }\n });\n }\n this.editorDocument.body.addEventListener('input', (e) => {\n if (this.editorDocument.body.innerHTML === '' ||\n this.editorDocument.body.innerHTML === '
') {\n this.editorDocument.body.innerHTML = '

';\n }\n });\n this.editorDocument.body.addEventListener('keydown', (e) => {\n if (e.key === 'Tab') {\n e.preventDefault();\n }\n else if (e.key === 'Enter') {\n this.editorDocument.execCommand('formatBlock', false, 'div');\n }\n });\n this.editorDocument.head.insertAdjacentHTML('beforeend', ``);\n this.editorDocument.body.style.fontFamily = content.fontName;\n this.editorDocument.body.style.color = content.fontColor;\n this.editorDocument.body.style.fontSize = content.fontSizeCSS;\n this.editorDocument.body.style.backgroundColor = content.backgroundColor;\n this.editorDocument.body.style.borderColor = '#000000';\n this.editorDocument.body.style.borderStyle = 'solid';\n this.editorDocument.body.style.borderWidth = `${content.borderWidth}px`;\n this.editorDocument.designMode = 'on';\n // this.editorDocument.execCommand('defaultParagraphSeparator', false, 'div')\n // add event listeners\n this.editorDocument.addEventListener('paste', this.handleOnPaste, false);\n this.editorDocument.addEventListener('selectionchange', this.handleSelectionChange, false);\n this.editorDocument.addEventListener('mousewheel', (e) => {\n e.preventDefault();\n e.cancelBubble = true;\n }, { passive: false });\n this.editorDocument.body.setAttribute('tabindex', '1');\n window.setTimeout(() => {\n var _a;\n let range = this.editorDocument.createRange();\n range.setStart(this.editorDocument.body, 0);\n range.setEnd(this.editorDocument.body, this.editorDocument.body.children.length);\n range.collapse();\n (_a = this.editorDocument.getSelection()) === null || _a === void 0 ? void 0 : _a.addRange(range);\n this.editorDocument.body.focus();\n }, 1);\n }\n setZoom(zoom) {\n this.editorElement.style.transform = `scale(${zoom})`;\n this.editorElement.width = this.element.clientWidth / zoom + 'px';\n this.editorElement.height = this.element.clientHeight / zoom + 'px';\n }\n getEditorValues() {\n const richText = '' + this.cleanupRichText(this.editorDocument.body.outerHTML);\n const pureContent = this.getContent(richText);\n return Object.assign(Object.assign({}, this.content), { content: pureContent ? pureContent : '', backgroundColor: this.editorDocument.body.style.backgroundColor, fontColor: this.editorDocument.body.style.color, fontName: this.editorDocument.body.style.fontFamily, fontSizeCSS: this.editorDocument.body.style.fontSize, richText });\n }\n executeCommand(cmd) {\n switch (cmd.cmd) {\n case 'setFont': {\n this.content.fontName = cmd.args;\n this.editorDocument.body.style.fontFamily = cmd.args;\n break;\n }\n case 'setFontColor': {\n this.content.fontColor = cmd.args;\n this.editorDocument.body.style.color = cmd.args;\n break;\n }\n case 'setBorderWidth': {\n this.content.borderWidth = cmd.args;\n this.editorDocument.body.style.borderWidth = `${cmd.args}px`;\n break;\n }\n case 'setFontSize': {\n const size = convertPdfToCssPixel(cmd.args);\n this.content.fontSizeCSS = size;\n this.editorDocument.body.style.fontSize = size;\n break;\n }\n case 'setFillColor': {\n this.content.backgroundColor = cmd.args;\n this.editorDocument.body.style.backgroundColor = cmd.args;\n break;\n }\n default: {\n this.editorDocument.execCommand(cmd.cmd, false, cmd.args);\n }\n }\n }\n cleanupRichText(richText) {\n let text = richText;\n text = text.replace(/

<\\/div>/gi, ' ');\n text = text.replace(/]*)\\>/gi, '

');\n text = text.replace(/<\\/div\\>/gi, '

');\n text = text.replace(//gi, '

');\n text = text.replace(/\\/gi, ' ');\n text = text.replace(/(\\n|\\r)/gi, '');\n // const underline = //gi\n // const found = text.match(underline) // find underline tags\n // if (found && found.length > 0) {\n // // if they exist remove them\n // text = text.replace(/<\\/?u>/gi, '')\n // text = text.replace(/style=\\\"/gi, 'style=\"text-decoration:underline') // set text-decoration instead\n // }\n text = text.replace(//gi, '');\n text = text.replace(/<\\/u>/gi, '');\n text = text.replace(/\\ \\;/gi, ' '); // remove non breaking space\n text = text.replace(/overflow\\:.*?\\;/gi, ''); // remove: overflow:...;\n text = text.replace(/background-color\\:.*?\\;/gi, ''); // remove background-color:...;\n text = text.replace(/border\\:.*?\\;/gi, ''); // remove border:...;\n text = text.replace(/border-color\\:.*?\\;/gi, ''); // remove border-color:...;\n text = text.replace(/border-style\\:.*?\\;/gi, ''); // remove border-style:...;\n text = text.replace(/border-width\\:.*?\\;/gi, ''); // remove border-width:...;\n text = text.replace(/font-size\\:\\s*(\\d*\\.?\\d+)px\\s*\\;/gi, (_, size) => {\n size = parseFloat(size);\n // calculate font size in pdf units\n size = roundToTwo((size / 96) * 72);\n return 'font-size:' + size + 'pt;';\n });\n text = text.replace(/rgb\\((.+?)\\)/gi, (rgb) => {\n return new Color(rgb).toHexRgb();\n });\n // remove spaces within the styles tag\n text = text.replace(/style=\"(.*?)\"/gi, (styles) => {\n return styles.replace(/\\s*/gi, '');\n });\n return text;\n }\n getContent(richText) {\n const parser = new DOMParser();\n const node = parser.parseFromString(richText, 'text/html').documentElement;\n let nodes = node ? node.querySelector('*') : null;\n if (nodes) {\n while (true) {\n nodes = nodes.nextSibling;\n if (nodes) {\n if (nodes.nodeName.toLocaleLowerCase() === 'body') {\n return nodes.innerText;\n }\n }\n else {\n break;\n }\n }\n }\n return null;\n }\n handleOnPaste(e) {\n e.preventDefault();\n const text = e.clipboardData.getData('text/plain');\n if (text) {\n this.executeCommand({\n cmd: 'insertText',\n args: text,\n });\n }\n }\n handleSelectionChange(e) { }\n}\n","import { CanvasLayer } from '../CanvasLayer';\nimport { PdfItemType, } from '../../pdf-viewer-api';\nimport { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { renderTextSelection } from '../../pdf-viewer-canvas/view-layers/canvasShapes';\nimport { Color } from '../../common/Color';\nimport { createAddHighlightAnnotationToolbar } from './AddHighlightAnnotationToolbar';\nimport { getRectFromSelection } from '../../pdf-viewer-canvas/state/document';\nexport var HighlightTool;\n(function (HighlightTool) {\n HighlightTool[HighlightTool[\"HIGHLIGHT\"] = 0] = \"HIGHLIGHT\";\n HighlightTool[HighlightTool[\"RECTANGULAR_HIGHLIGHT\"] = 1] = \"RECTANGULAR_HIGHLIGHT\";\n HighlightTool[HighlightTool[\"UNDERLINE\"] = 2] = \"UNDERLINE\";\n HighlightTool[HighlightTool[\"SQUIGGLY\"] = 3] = \"SQUIGGLY\";\n HighlightTool[HighlightTool[\"STRIKE_OUT\"] = 4] = \"STRIKE_OUT\";\n})(HighlightTool || (HighlightTool = {}));\nconst moduleLayerName = 'AddHighlightAnnotation';\nexport class AddHighlightAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.colors = [];\n this.selectedColor = '';\n this.selectedTool = HighlightTool.HIGHLIGHT;\n this.pdfStartPoint = null;\n this.screenStartPoint = null;\n this.pointerDown = false;\n this.page = 0;\n this.selecting = false;\n this.selection = null;\n }\n onCreate() {\n this.setColor = this.setColor.bind(this);\n this.close = this.close.bind(this);\n this.setTool = this.setTool.bind(this);\n this.context = this.createCanvas();\n const annotationOptions = this.options.annotation;\n this.colors = annotationOptions.colors.highlightColors;\n this.selectedColor = annotationOptions.colors.highlightAnnotationColor;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n createAddHighlightAnnotationToolbar({\n colors: this.colors,\n selectedColor: this.selectedColor,\n selectedTool: this.selectedTool,\n onColorChanged: this.setColor,\n onToolChanged: this.setTool,\n onClose: this.close,\n }, toolbarElement);\n this.store.viewer.beginModule(moduleLayerName);\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n resolve();\n });\n return promise;\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (this.context) {\n if (this.selectedTool === HighlightTool.RECTANGULAR_HIGHLIGHT) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const pointerPos = {\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n };\n const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);\n if (pointerPdfPos.isOnPage) {\n this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);\n }\n else {\n this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);\n }\n if (state.pointer.isDown) {\n if (!this.pointerDown) {\n this.screenStartPoint = pointerPos;\n this.pointerDown = true;\n if (this.page === 0 && pointerPdfPos.isOnPage) {\n this.page = pointerPdfPos.pdfPoint.page;\n }\n }\n if (this.screenStartPoint) {\n const rect = getRectFromSelection(state.document, {\n x: this.screenStartPoint.x,\n y: this.screenStartPoint.y,\n }, {\n x: pointerPos.x,\n y: pointerPos.y,\n }, this.page);\n if (rect) {\n const lineWidth = 2 * devicePixelRatio;\n ctx.save();\n ctx.strokeStyle = this.options.viewer.general.textSelectionColor;\n ctx.fillStyle = this.options.viewer.general.textSelectionColor;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash([lineWidth, lineWidth]);\n ctx.strokeRect(rect.x, rect.y, rect.w, rect.h);\n ctx.globalAlpha = 0.33;\n ctx.fillRect(rect.x, rect.y, rect.w, rect.h);\n ctx.restore();\n }\n }\n }\n else if (this.pointerDown && this.screenStartPoint) {\n const rect = getRectFromSelection(state.document, {\n x: this.screenStartPoint.x,\n y: this.screenStartPoint.y,\n }, {\n x: pointerPos.x,\n y: pointerPos.y,\n }, this.page);\n if (rect) {\n this.createRectangularHighlightAnnotation(rect);\n this.pointerDown = false;\n this.screenStartPoint = null;\n this.page = 0;\n }\n }\n }\n else {\n let drawSelection = state.canvas.canvasInvalidated;\n if (state.pointer.positionChanged) {\n const pointerPos = {\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n };\n const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);\n let currentTextFragment = null;\n if (pointerPdfPos.isOnPage) {\n currentTextFragment = this.pdfApi.getTextFragmentOnPoint(pointerPos);\n if (currentTextFragment) {\n this.store.viewer.setCursorStyle(CursorStyle.TEXT);\n }\n else {\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n }\n }\n else {\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n }\n if (state.pointer.stateChanged) {\n if (state.pointer.isDown) {\n if (pointerPdfPos.isOnPage) {\n if (currentTextFragment) {\n const startPdfPos = pointerPdfPos;\n this.selecting = true;\n this.selection = null;\n this.pdfStartPoint = startPdfPos.pdfPoint;\n drawSelection = true;\n }\n }\n }\n else {\n if (this.selecting) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n this.createHighlightAnnotation();\n this.selecting = false;\n }\n }\n }\n if (this.selecting &&\n this.pdfStartPoint &&\n this.pdfStartPoint !== pointerPdfPos.pdfPoint) {\n const endPoint = this.pdfApi.getClosestPointOnPdfByScreenPoint(pointerPos);\n this.selection = this.pdfApi.getTextSelection(this.pdfStartPoint, endPoint);\n }\n drawSelection = true;\n }\n if (drawSelection && this.selection) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const screenSelection = [];\n for (let i = 0; i < this.selection.quadrilaterals.length; i++) {\n const path = this.pdfApi.transformQuadrilateralToViewport(this.selection.quadrilaterals[i]);\n screenSelection.push(path);\n }\n renderTextSelection(ctx, devicePixelRatio * state.document.zoom, this.options.viewer.general.textSelectionColor, screenSelection);\n }\n }\n }\n }\n setColor(color) {\n this.selectedColor = color;\n this.options.annotation.colors.highlightAnnotationColor = color;\n }\n setTool(tool) {\n this.selectedTool = tool;\n }\n close() {\n this.remove();\n }\n getPdfItemTypeForTool() {\n switch (this.selectedTool) {\n case HighlightTool.HIGHLIGHT:\n return PdfItemType.HIGHLIGHT;\n case HighlightTool.RECTANGULAR_HIGHLIGHT:\n return PdfItemType.HIGHLIGHT;\n case HighlightTool.UNDERLINE:\n return PdfItemType.UNDERLINE;\n case HighlightTool.SQUIGGLY:\n return PdfItemType.SQUIGGLY;\n case HighlightTool.STRIKE_OUT:\n return PdfItemType.STRIKE_OUT;\n default:\n throw new Error('unknown Highlight tool');\n }\n }\n createRectangularHighlightAnnotation(rect) {\n const pdfRect = this.pdfApi.transformScreenRectToPdfRect(rect, this.page);\n const colorObj = new Color(this.selectedColor);\n colorObj.setOpacity(this.options.annotation.highlightOpacity);\n const color = colorObj.toRgba();\n const quadrilaterals = [];\n quadrilaterals.push({\n pageNumber: this.page,\n bottomLeft: { x: pdfRect.pdfX, y: pdfRect.pdfY },\n bottomRight: { x: pdfRect.pdfX + pdfRect.pdfW, y: pdfRect.pdfY },\n topLeft: { x: pdfRect.pdfX, y: pdfRect.pdfY + pdfRect.pdfH },\n topRight: { x: pdfRect.pdfX + pdfRect.pdfW, y: pdfRect.pdfY + pdfRect.pdfH },\n });\n const args = {\n itemType: PdfItemType.HIGHLIGHT,\n page: this.page,\n pdfRect,\n color,\n author: this.options.viewer.general.user,\n quadrilaterals,\n };\n this.pdfApi.createItem(args).then((item) => {\n this.onAnnotationCreated(item);\n });\n }\n createHighlightAnnotation() {\n if (this.pdfApi && this.store) {\n const pdfItemType = this.getPdfItemTypeForTool();\n const selection = this.selection;\n this.selection = null;\n if (selection) {\n const selByPage = [];\n for (let i = 0; i < selection.quadrilaterals.length; i++) {\n const quadrilateral = selection.quadrilaterals[i];\n if (!selByPage[quadrilateral.pageNumber]) {\n selByPage[quadrilateral.pageNumber] = [];\n }\n selByPage[quadrilateral.pageNumber].push(quadrilateral);\n }\n let color = this.selectedColor;\n if (pdfItemType === PdfItemType.HIGHLIGHT) {\n const colorObj = new Color(color);\n colorObj.setOpacity(this.options.annotation.highlightOpacity);\n color = colorObj.toRgba();\n }\n for (let i = 0; i < selByPage.length; i++) {\n if (selByPage[i]) {\n const quadrilaterals = selByPage[i];\n const args = {\n itemType: pdfItemType,\n page: i,\n pdfRect: {\n pdfX: 0,\n pdfY: 0,\n pdfW: 0,\n pdfH: 0,\n page: i,\n },\n color,\n author: this.options.viewer.general.user,\n quadrilaterals,\n };\n this.pdfApi.createItem(args).then((item) => {\n this.onAnnotationCreated(item);\n });\n }\n }\n }\n }\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { ColorPicker } from '../../common/ColorPicker';\nimport { HighlightTool } from './AddHighlightAnnotationLayer';\nexport const createAddHighlightAnnotationToolbar = (props, element) => {\n const state = {\n colors: props.colors,\n selectedTool: props.selectedTool,\n selectedColor: props.selectedColor,\n };\n const actions = {\n setColor: (color) => ($state) => {\n props.onColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedColor: color });\n },\n setTool: (tool) => ($state) => {\n props.onToolChanged(tool);\n return Object.assign(Object.assign({}, $state), { selectedTool: tool });\n },\n };\n const App = () => h(AddHighlightAnnotationToolbar, null);\n /* tslint:disable-next-line:max-line-length */\n const AddHighlightAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(ColorPicker, { colors: $state.colors, color: $state.selectedColor, icon: icons.fillColor, mode: \"buttons\", onChange: $actions.setColor }),\n h(ToolbarSeparator, null)),\n h(ToolbarItemGroup, null,\n h(ToolbarButton, { tooltip: translationManager.getText('annotHighlight.highlight'), icon: icons.highlighter, active: $state.selectedTool === HighlightTool.HIGHLIGHT, onClick: () => {\n $actions.setTool(HighlightTool.HIGHLIGHT);\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotHighlight.underline'), icon: icons.underline, active: $state.selectedTool === HighlightTool.UNDERLINE, onClick: () => {\n $actions.setTool(HighlightTool.UNDERLINE);\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotHighlight.squiggly'), icon: icons.squiggly, active: $state.selectedTool === HighlightTool.SQUIGGLY, onClick: () => {\n $actions.setTool(HighlightTool.SQUIGGLY);\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotHighlight.strikeOut'), icon: icons.strikethrough, active: $state.selectedTool === HighlightTool.STRIKE_OUT, onClick: () => {\n $actions.setTool(HighlightTool.STRIKE_OUT);\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotHighlight.rectangularHighlight'), icon: icons.rectangularHighlighter, active: $state.selectedTool === HighlightTool.RECTANGULAR_HIGHLIGHT, onClick: () => {\n $actions.setTool(HighlightTool.RECTANGULAR_HIGHLIGHT);\n } })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onClose }))));\n return app(state, actions, App, element);\n};\n","import { CanvasLayer } from '../CanvasLayer';\nimport { Color } from '../../common/Color';\nimport { createEditHighlightAnnotationToolbar } from './EditHighlightAnnotationToolbar';\nconst moduleLayerName = 'EditHighlightAnnotation';\nexport class EditHighlightAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.highlightAnnotation = null;\n this.colors = [];\n this.selectedColor = '';\n }\n onCreate(annotationId) {\n this.highlightAnnotation = this.pdfApi.getItem(annotationId);\n this.setColor = this.setColor.bind(this);\n this.close = this.close.bind(this);\n this.context = this.createCanvas();\n const annotationOptions = this.options.annotation;\n this.colors = annotationOptions.colors.highlightColors;\n this.selectedColor = annotationOptions.colors.highlightAnnotationColor;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n createEditHighlightAnnotationToolbar({\n colors: this.colors,\n selectedColor: this.selectedColor,\n onColorChanged: this.setColor,\n onClose: this.close,\n }, toolbarElement);\n this.store.viewer.beginModule(moduleLayerName);\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n resolve();\n });\n return promise;\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n var _a;\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.close();\n return;\n }\n if (state.pointer.action === 'click' || state.pointer.action === 'dblclick') {\n const highlightAnnotation = (_a = this.pdfApi\n .getAnnotationsOnPoint({\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n })) === null || _a === void 0 ? void 0 : _a.find((a) => this.highlightAnnotation && a.id === this.highlightAnnotation.id);\n if (!highlightAnnotation) {\n this.close();\n return;\n }\n }\n if (this.context && this.highlightAnnotation) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const rect = this.pdfApi.transformPdfPageRectToScreenRect(this.highlightAnnotation.pdfRect);\n const lineWidth = 2 * devicePixelRatio;\n ctx.save();\n ctx.strokeStyle = this.options.viewer.general.textSelectionColor;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash([lineWidth, lineWidth]);\n ctx.strokeRect(rect.x - lineWidth, rect.y - lineWidth, rect.w + 2 * lineWidth, rect.h + 2 * lineWidth);\n ctx.restore();\n }\n }\n setColor(color) {\n if (this.highlightAnnotation && this.highlightAnnotation.color) {\n const newColor = new Color(color);\n const currentColor = new Color(this.highlightAnnotation.color);\n newColor.setOpacity(currentColor.a);\n this.highlightAnnotation.color = newColor.toRgba();\n this.updateHighlightAnnotation();\n }\n }\n close() {\n this.remove();\n }\n updateHighlightAnnotation() {\n const promise = new Promise((resolve, reject) => {\n if (this.pdfApi && this.highlightAnnotation) {\n this.pdfApi\n .updateItem(this.highlightAnnotation)\n .then((item) => {\n resolve();\n })\n .catch((error) => {\n console.warn(error);\n });\n }\n else {\n reject();\n }\n });\n return promise;\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { ColorPicker } from '../../common/ColorPicker';\nexport const createEditHighlightAnnotationToolbar = (props, element) => {\n const state = {\n colors: props.colors,\n selectedColor: props.selectedColor,\n };\n const actions = {\n setColor: (color) => ($state) => {\n props.onColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedColor: color });\n },\n };\n const App = () => h(EditHighlightAnnotationToolbar, null);\n /* tslint:disable-next-line:max-line-length */\n const EditHighlightAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(ColorPicker, { colors: $state.colors, color: $state.selectedColor, icon: icons.fillColor, mode: \"buttons\", onChange: $actions.setColor })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onClose }))));\n return app(state, actions, App, element);\n};\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { AddHighlightAnnotationLayer } from './AddHighlightAnnotationLayer';\nimport { PdfItemType } from '../../pdf-viewer-api';\nimport { icons } from '../../common/Icon';\nimport { translationManager } from '../../common/TranslationManager';\nimport { EditHighlightAnnotationLayer } from './EditHighlightAnnotationLayer';\nexport class HighlightAnnotationModule extends CanvasModule {\n constructor() {\n super();\n this.toolbarElement = null;\n this.name = HighlightAnnotationModule.moduleInfo.name;\n this.activate = this.activate.bind(this);\n }\n onRegister() {\n this.toolbarElement = document.createElement('div');\n return {\n toolbar: this.toolbarElement,\n contextbar: {\n itemTypes: [\n PdfItemType.HIGHLIGHT,\n PdfItemType.UNDERLINE,\n PdfItemType.SQUIGGLY,\n PdfItemType.STRIKE_OUT,\n ],\n icon: icons.edit,\n tooltip: translationManager.getText('annotHighlight.edit'),\n onCmd: (annotationId) => {\n this.onEdit(annotationId);\n },\n },\n };\n }\n activate() {\n if (!this.canvasLayers['add']) {\n this.createCanvasLayer('add', AddHighlightAnnotationLayer);\n }\n else {\n this.removeCanvasLayer('add');\n }\n }\n onEdit(annotationId) {\n this.createCanvasLayer('edit', EditHighlightAnnotationLayer, annotationId);\n }\n}\nHighlightAnnotationModule.moduleInfo = {\n name: 'HighlightAnnotationModule',\n moduleType: CanvasModuleType.Tool,\n requiredFeatures: {\n annotate: true,\n fillFormFields: false,\n },\n translationKey: 'annotHighlight.add',\n icon: 'highlighter',\n};\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { PdfItemType } from '../../pdf-viewer-api';\nimport { imageDataUrlToUint8Array } from '../../common/Tools';\nimport { MIN_SIZE } from '../../pdf-viewer-canvas/view-layers/views/AnnotationBorder';\nexport class ImageAnnotationModule extends CanvasModule {\n constructor() {\n super();\n this.toolbarElement = null;\n this.fileInput = null;\n this.name = ImageAnnotationModule.moduleInfo.name;\n this.createImage = this.createImage.bind(this);\n this.onFileSelected = this.onFileSelected.bind(this);\n this.createImageStampAnnotation = this.createImageStampAnnotation.bind(this);\n }\n onRegister() {\n this.toolbarElement = document.createElement('div');\n this.fileInput = document.createElement('input');\n this.fileInput.setAttribute('type', 'file');\n this.fileInput.setAttribute('accept', '.jpg, .jpeg, .jpe, .jif, .jfif, .jfi, .jp2, .j2k, .jpf, .jpm, .jpg2, .j2c, .jpc, .jpx, .mj2 .tif, tiff, .png, .gif, .bmp');\n this.fileInput.style.position = 'absolute';\n this.fileInput.style.left = '-5000px';\n this.fileInput.onchange = (e) => {\n if (e.currentTarget.files && e.currentTarget.files.length) {\n const file = e.currentTarget.files[0];\n this.onFileSelected(file);\n e.currentTarget.value = '';\n }\n };\n this.toolbarElement.append(this.fileInput);\n return {\n toolbar: this.toolbarElement,\n };\n }\n activate(file) {\n if (file) {\n this.onFileSelected(file);\n }\n else if (this.fileInput) {\n this.fileInput.click();\n }\n }\n createImage(dataUrl) {\n const image = new Image();\n image.onload = () => {\n // image needs to be over min since the moment it is added\n const anyUnderMinSize = image.width < MIN_SIZE || image.width < MIN_SIZE;\n let width = image.width;\n let height = image.height;\n // set the smallest to MIN_SIZE\n // and scale keeping aspect ratio\n if (anyUnderMinSize && width <= height) {\n height = (MIN_SIZE * height) / width;\n width = MIN_SIZE;\n }\n else if (anyUnderMinSize && height < width) {\n width = (MIN_SIZE * width) / height;\n height = MIN_SIZE;\n }\n const imageInfo = {\n width: width,\n height: height,\n stampImage: imageDataUrlToUint8Array(image.src),\n };\n this.createImageStampAnnotation(imageInfo);\n };\n image.src = dataUrl;\n }\n onFileSelected(file) {\n return __awaiter(this, void 0, void 0, function* () {\n const reader = new FileReader();\n const _this = this;\n reader.onload = function (e) {\n _this.createImage(e.target.result);\n };\n reader.readAsDataURL(file);\n });\n }\n createImageStampAnnotation(imageInfo) {\n if (this.pdfApi !== null && this.store !== null && this.options !== null) {\n const state = this.store.getState();\n const document = state.document;\n const canvasRect = this.getCanvasSize();\n const screenCenter = {\n x: canvasRect.width / 2,\n y: canvasRect.height / 2,\n };\n // get page to insert image\n let page = this.pdfApi.getPageNumber();\n const screenRect = {\n x: 0,\n y: 0,\n w: canvasRect.width,\n h: canvasRect.height,\n };\n const pageScreenRect = this.pdfApi.getPageScreenRect(page);\n const x1 = Math.max(screenRect.x, pageScreenRect.x);\n const y1 = Math.max(screenRect.y, pageScreenRect.y);\n const x2 = Math.min(screenRect.w, pageScreenRect.x + pageScreenRect.w);\n const y2 = Math.min(screenRect.h, pageScreenRect.y + pageScreenRect.h);\n const boundingRect = {\n x: x1,\n y: y1,\n w: x2 - x1,\n h: y2 - y1,\n };\n const pageBoundingBox = this.pdfApi.transformScreenRectToPdfRect(boundingRect, page);\n const imagepPdfRect = {\n pdfX: 0,\n pdfY: 0,\n pdfW: imageInfo.width * 0.24,\n pdfH: imageInfo.height * 0.24,\n page,\n };\n if (imagepPdfRect.pdfW > pageBoundingBox.pdfW) {\n const f = (pageBoundingBox.pdfW / imagepPdfRect.pdfW) * 0.97;\n imagepPdfRect.pdfW = imagepPdfRect.pdfW * f;\n imagepPdfRect.pdfH = imagepPdfRect.pdfH * f;\n }\n if (imagepPdfRect.pdfH > pageBoundingBox.pdfH) {\n const f = (pageBoundingBox.pdfH / imagepPdfRect.pdfH) * 0.97;\n imagepPdfRect.pdfW = imagepPdfRect.pdfW * f;\n imagepPdfRect.pdfH = imagepPdfRect.pdfH * f;\n }\n imagepPdfRect.pdfX = (pageBoundingBox.pdfW - imagepPdfRect.pdfW) / 2 + pageBoundingBox.pdfX;\n imagepPdfRect.pdfY = (pageBoundingBox.pdfH - imagepPdfRect.pdfH) / 2 + pageBoundingBox.pdfY;\n this.pdfApi.registerStampImage(imageInfo.stampImage).then((imageId) => {\n if (this.pdfApi !== null && this.options !== null) {\n const annotation = {\n itemType: PdfItemType.STAMP,\n imageId,\n page,\n color: this.options.annotation.colors.defaultHighlightColor,\n pdfRect: imagepPdfRect,\n author: this.options.viewer.general.user,\n };\n this.pdfApi\n .createItem(annotation)\n .then((annot) => {\n // select new annotation\n const pdfViewerCanvasApi = this.pdfViewerCanvas;\n pdfViewerCanvasApi.dispatchEvent('itemSelected', annot);\n })\n .catch((err) => {\n console.error(err);\n });\n }\n });\n }\n }\n}\nImageAnnotationModule.moduleInfo = {\n name: 'ImageAnnotationModule',\n moduleType: CanvasModuleType.Tool,\n requiredFeatures: {\n annotate: true,\n fillFormFields: false,\n },\n translationKey: 'annotImage.add',\n icon: 'image',\n};\n","export * from './freetext-annotation/FreetextAnnotationModule';\nexport * from './highlight-annotation/HighlightAnnotationModule';\nexport * from './ink-annotation/InkAnnotationModule';\nexport * from './popup/PopupModule';\nexport * from './stamp-annotation/StampAnnotationModule';\nexport * from './text-annotation/TextAnnotationModule';\nexport * from './image-annotations/ImageAnnotationModule';\nexport * from './shape-annotations/ShapeAnnotationModule';\nexport * from './eraser/EraserModule';\nexport * from './print-service/PrintServiceModule';\nexport * from './form-fields/FormFieldModule';\nexport * from './CanvasLayer';\nexport * from './CanvasModule';\n","import { CanvasLayer } from '../CanvasLayer';\nimport { PdfItemType, AnnotationBorderStyle, } from '../../pdf-viewer-api';\nimport { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { createAddInkAnnotationToolbar, } from './AddInkAnnotationToolbar';\nimport { Color } from '../../common/Color';\nconst moduleLayerName = 'AddInkAnnotation';\nexport class AddInkAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.context = null;\n this.drawing = false;\n this.lines = [];\n this.page = null;\n this.zoom = null;\n this.inkWidth = 1;\n this.penColors = [];\n this.penWidths = [];\n this.penColor = '';\n this.penOpacity = 1;\n this.boundingBox = null;\n this.toolbar = null;\n this.handlePointerMove = (e) => {\n if (!e.isPrimary) {\n this.handlePointerUp(e);\n return;\n }\n const x = e.offsetX * devicePixelRatio;\n const y = e.offsetY * devicePixelRatio;\n const pdfPoint = this.pdfApi.getClosestPointOnPdfByScreenPoint({ x, y }, this.page);\n this.lines[this.lines.length - 1].push(pdfPoint);\n if (this.context) {\n const screenPoint = this.pdfApi.transformPdfPointToScreenPoint(pdfPoint);\n this.context.lineTo(screenPoint.x, screenPoint.y);\n this.context.stroke();\n }\n };\n this.handlePointerUp = (e) => {\n if (this.context) {\n const { canvas } = this.context;\n canvas.removeEventListener('pointermove', this.handlePointerMove);\n canvas.removeEventListener('pointerup', this.handlePointerUp);\n canvas.removeEventListener('pointercancel', this.handlePointerUp);\n }\n this.endLine();\n };\n }\n onCreate() {\n this.setPenColor = this.setPenColor.bind(this);\n this.setPenSize = this.setPenSize.bind(this);\n this.setPenOpacity = this.setPenOpacity.bind(this);\n this.add = this.add.bind(this);\n this.undo = this.undo.bind(this);\n this.save = this.save.bind(this);\n const annotationOptions = this.options.annotation;\n this.context = this.createCanvas();\n this.penColors = annotationOptions.colors.foregroundColors;\n this.penWidths = annotationOptions.strokeWidths;\n this.inkWidth = annotationOptions.inkWidth;\n this.setPenColor(annotationOptions.colors.inkColor);\n this.setPenOpacity(annotationOptions.colors.inkOpacity);\n this.store.viewer.beginModule(moduleLayerName);\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n this.toolbar = createAddInkAnnotationToolbar({\n penColors: this.penColors,\n penWidths: this.penWidths,\n selectedPenColor: annotationOptions.colors.inkColor,\n selectedPenSize: annotationOptions.inkWidth,\n penOpacity: annotationOptions.colors.inkOpacity,\n onPenColorChanged: this.setPenColor,\n onPenSizeChanged: this.setPenSize,\n onPenOpacityChanged: this.setPenOpacity,\n onSave: this.save,\n onUndo: this.undo,\n onAdd: this.add,\n onCancel: this.remove,\n }, toolbarElement);\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n this.createInkAnnotation()\n .then(() => {\n this.remove();\n resolve();\n })\n .catch(() => {\n reject();\n });\n });\n return promise;\n }\n onRemove() {\n if (this.lines && this.lines.length > 0) {\n this.createInkAnnotation().then(() => {\n this.onRemove();\n });\n }\n else {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.endModule(moduleLayerName);\n }\n }\n render(timestamp, state) {\n if (this.drawing) {\n return;\n }\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (this.zoom === null || state.document.zoomChanged) {\n this.zoom = state.document.zoom;\n this.drawLines();\n }\n if (state.scroll.leftPositionChanged || state.scroll.topPositionChanged) {\n this.drawLines();\n }\n const pointerPos = {\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n };\n const pdfPoint = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);\n if (state.pointer.stateChanged) {\n if (state.pointer.isDown) {\n const page = pdfPoint.isOnPage ? pdfPoint.pdfPoint.page : null;\n if (this.page === null && page) {\n this.page = page;\n }\n if (typeof this.page === 'number' && this.page === page) {\n const pdfPointRes = this.pdfApi.getClosestPointOnPdfByScreenPoint(pointerPos, this.page);\n if (pdfPointRes) {\n this.startLine(pointerPos, pdfPointRes);\n }\n }\n }\n }\n if (state.pointer.positionChanged) {\n if (pdfPoint.isOnPage && (this.page === null || pdfPoint.pdfPoint.page === this.page)) {\n this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);\n }\n else {\n this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);\n }\n }\n }\n startLine(point, pdfPoint) {\n var _a;\n this.lines.push([pdfPoint]);\n this.pdfViewerCanvas.suspendCanvasEvents();\n this.drawing = true;\n if (this.context) {\n const { canvas } = this.context;\n canvas.addEventListener('pointermove', this.handlePointerMove);\n canvas.addEventListener('pointerup', this.handlePointerUp);\n canvas.addEventListener('pointercancel', this.handlePointerUp);\n this.drawLines();\n const ctx = this.context;\n ctx.save();\n ctx.strokeStyle = this.penColor;\n ctx.lineWidth = this.inkWidth * devicePixelRatio * ((_a = this.zoom) !== null && _a !== void 0 ? _a : 1);\n ctx.lineCap = 'round';\n ctx.lineJoin = 'round';\n ctx.moveTo(point.x, point.y);\n }\n }\n endLine() {\n var _a, _b;\n this.drawing = false;\n this.pdfViewerCanvas.resumeCanvasEvents();\n (_a = this.context) === null || _a === void 0 ? void 0 : _a.restore();\n this.drawBoundingBox();\n (_b = this.toolbar) === null || _b === void 0 ? void 0 : _b.setLineCount(this.lines.length);\n }\n drawLines() {\n if (this.context) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const annotationOptions = this.options.annotation;\n ctx.save();\n ctx.strokeStyle = this.penColor;\n ctx.lineWidth = this.inkWidth * devicePixelRatio * this.zoom;\n ctx.lineCap = 'round';\n ctx.lineJoin = 'round';\n this.lines.forEach((pointList) => {\n ctx.beginPath();\n const p1 = this.pdfApi.transformPdfPointToScreenPoint(pointList[0]);\n ctx.moveTo(p1.x, p1.y);\n for (let i = 0; i < pointList.length; i++) {\n const p = this.pdfApi.transformPdfPointToScreenPoint(pointList[i]);\n ctx.lineTo(p.x, p.y);\n }\n ctx.stroke();\n });\n ctx.restore();\n }\n }\n drawBoundingBox() {\n if (this.context && this.lines && this.lines.length > 0) {\n const pdfRect = {\n pdfX: 0,\n pdfY: 0,\n pdfW: 0,\n pdfH: 0,\n page: this.page ? this.page : 0,\n };\n let x1 = 1000000000;\n let x2 = 0;\n let y1 = 1000000000;\n let y2 = 0;\n this.lines.forEach((pointList) => {\n const line = [];\n for (let i = 0; i < pointList.length; i++) {\n const p = pointList[i];\n if (p.pdfX < x1) {\n x1 = p.pdfX;\n }\n if (p.pdfX > x2) {\n x2 = p.pdfX;\n }\n if (p.pdfY < y1) {\n y1 = p.pdfY;\n }\n if (p.pdfY > y2) {\n y2 = p.pdfY;\n }\n }\n });\n pdfRect.pdfX = x1;\n pdfRect.pdfY = y1;\n pdfRect.pdfW = x2 - x1;\n pdfRect.pdfH = y2 - y1;\n const rect = this.pdfApi.transformPdfPageRectToScreenRect(pdfRect);\n const ctx = this.context;\n ctx.save();\n ctx.strokeStyle = this.options.viewer.general.textSelectionColor;\n ctx.lineWidth = 1 * devicePixelRatio;\n ctx.setLineDash([2 * devicePixelRatio, 3 * devicePixelRatio]);\n const p = this.inkWidth * devicePixelRatio;\n const p2 = p * 2;\n ctx.strokeRect(rect.x - p, rect.y - p, rect.w + p2, rect.h + p2);\n ctx.restore();\n }\n }\n setPenColor(color) {\n this.options.annotation.colors.inkColor = color;\n this.penColor = color;\n this.drawLines();\n this.drawBoundingBox();\n }\n setPenOpacity(opacity) {\n this.options.annotation.colors.inkOpacity = opacity;\n this.penOpacity = opacity;\n if (this.context) {\n this.context.canvas.style.opacity = `${opacity / 100}`;\n }\n this.drawLines();\n this.drawBoundingBox();\n }\n setPenSize(size) {\n this.inkWidth = size;\n this.options.annotation.inkWidth = size;\n this.drawLines();\n this.drawBoundingBox();\n }\n save() {\n this.createInkAnnotation();\n this.remove();\n }\n add() {\n this.createInkAnnotation();\n this.drawLines();\n }\n undo() {\n if (this.lines && this.lines.length > 0) {\n this.lines.pop();\n if (this.lines.length === 0) {\n this.page = null;\n this.boundingBox = null;\n }\n else {\n this.boundingBox = this.getBoundingBox();\n }\n if (this.toolbar) {\n this.toolbar.setLineCount(this.lines.length);\n }\n this.store.canvas.setCanvasInvalidated(true);\n this.drawLines();\n this.drawBoundingBox();\n }\n }\n createInkAnnotation() {\n const promise = new Promise((resolve, reject) => {\n if (this.pdfApi) {\n if (this.page && this.lines && this.lines.length > 0) {\n const inkList = [];\n let x1 = 1000000000;\n let x2 = 0;\n let y1 = 1000000000;\n let y2 = 0;\n this.lines.forEach((pointList) => {\n const line = [];\n for (let i = 0; i < pointList.length; i++) {\n const p = pointList[i];\n if (p.pdfX < x1) {\n x1 = p.pdfX;\n }\n if (p.pdfX > x2) {\n x2 = p.pdfX;\n }\n if (p.pdfY < y1) {\n y1 = p.pdfY;\n }\n if (p.pdfY > y2) {\n y2 = p.pdfY;\n }\n line.push(p.pdfX);\n line.push(p.pdfY);\n }\n inkList.push(line);\n });\n const rgbaColor = new Color(this.options.annotation.colors.inkColor);\n rgbaColor.setOpacity(this.options.annotation.colors.inkOpacity / 100);\n const inkAnnotation = {\n itemType: PdfItemType.INK,\n page: this.page,\n pdfRect: {\n pdfX: x1,\n pdfY: y1,\n pdfW: x2 - x1,\n pdfH: y2 - y1,\n page: this.page,\n },\n color: rgbaColor.toRgba(),\n author: this.options.viewer.general.user,\n border: {\n style: AnnotationBorderStyle.SOLID,\n width: this.options.annotation.inkWidth,\n },\n inkList,\n };\n this.lines = [];\n this.page = null;\n this.boundingBox = null;\n if (this.toolbar) {\n this.toolbar.setLineCount(0);\n }\n this.pdfApi\n .createItem(inkAnnotation)\n .then((item) => {\n this.onAnnotationCreated(item);\n resolve();\n })\n .catch((error) => {\n console.warn(error);\n });\n }\n else {\n resolve();\n }\n }\n else {\n reject();\n }\n });\n return promise;\n }\n getBoundingBox() {\n const pdfRect = {\n pdfX: 0,\n pdfY: 0,\n pdfW: 0,\n pdfH: 0,\n page: this.page ? this.page : 0,\n };\n if (this.lines && this.lines.length > 0) {\n let x1 = 1000000000;\n let x2 = 0;\n let y1 = 1000000000;\n let y2 = 0;\n this.lines.forEach((pointList) => {\n const line = [];\n for (let i = 0; i < pointList.length; i++) {\n const p = pointList[i];\n if (p.pdfX < x1) {\n x1 = p.pdfX;\n }\n if (p.pdfX > x2) {\n x2 = p.pdfX;\n }\n if (p.pdfY < y1) {\n y1 = p.pdfY;\n }\n if (p.pdfY > y2) {\n y2 = p.pdfY;\n }\n }\n });\n pdfRect.pdfX = x1;\n pdfRect.pdfY = y1;\n pdfRect.pdfW = x2 - x1;\n pdfRect.pdfH = y2 - y1;\n }\n return pdfRect;\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { StrokeWidthPicker } from '../../common/StrokeWidthPicker';\nimport { RangeSlider } from '../../common/RangeSlider';\nimport { ColorPicker } from '../../common/ColorPicker';\nexport const createAddInkAnnotationToolbar = (props, element) => {\n const state = {\n penColors: props.penColors,\n penWidths: props.penWidths,\n selectedPenColor: props.selectedPenColor,\n selectedPenSize: props.selectedPenSize,\n penOpacity: props.penOpacity,\n lineCount: 0,\n };\n const actions = {\n setPenColor: (color) => ($state) => {\n props.onPenColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedPenColor: color });\n },\n setPenSize: (width) => ($state) => {\n props.onPenSizeChanged(width);\n return Object.assign(Object.assign({}, $state), { selectedPenSize: width });\n },\n setPenOpacity: (opacity) => ($state) => {\n props.onPenOpacityChanged(opacity);\n return Object.assign(Object.assign({}, $state), { penOpacity: opacity });\n },\n setLineCount: (lineCount) => ($state) => (Object.assign(Object.assign({}, $state), { lineCount })),\n };\n const App = () => h(AddInkAnnotationToolbar, null);\n const AddInkAnnotationToolbar = ({}) => ($state, $actions) => {\n const strokeWidths = $state.penWidths.filter((w) => w > 0);\n return (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(ColorPicker, { colors: $state.penColors, color: $state.selectedPenColor, icon: icons.fillColor, allowRgba: false, mode: \"buttons\", onChange: $actions.setPenColor })),\n h(ToolbarItemGroup, null,\n h(RangeSlider, { tooltip: translationManager.getText('annotFreeDrawing.opacity'), min: 10, max: 100, step: 1, value: $state.penOpacity, text: `${$state.penOpacity}%`, icon: icons.drop, onChange: $actions.setPenOpacity, className: \"pwv-opacityslider\" }),\n h(StrokeWidthPicker, { tooltip: translationManager.getText('annotFreeDrawing.strokeWidth'), noneStrokeText: '', strokeWidths: strokeWidths, value: $state.selectedPenSize, onChange: $actions.setPenSize })),\n h(ToolbarItemGroup, null,\n h(ToolbarSeparator, null),\n h(ToolbarButton, { tooltip: translationManager.getText('annotFreeDrawing.undo'), icon: icons.eraser, onClick: props.onUndo, disabled: $state.lineCount < 1 }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotFreeDrawing.addNew'), icon: icons.addLayer, onClick: props.onAdd, disabled: $state.lineCount < 1 })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n $state.lineCount < 1 ? (h(ToolbarButton, { icon: icons.close, onClick: props.onCancel })) : (h(ToolbarButton, { icon: icons.ok, onClick: props.onSave })))));\n };\n return app(state, actions, App, element);\n};\n","import { CanvasLayer } from '../CanvasLayer';\nimport { AnnotationBorderStyle } from '../../pdf-viewer-api';\nimport { createEditInkAnnotationToolbar, } from './EditInkAnnotationToolbar';\nimport { Color } from '../../common/Color';\nconst moduleLayerName = 'EditInkAnnotation';\nexport class EditInkAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.inkAnnotation = null;\n this.context = null;\n this.penColors = [];\n this.penWidths = [];\n this.toolbar = null;\n this.updatePending = false;\n this.unsavedChanges = false;\n }\n onCreate(annotationId) {\n var _a;\n this.inkAnnotation = this.pdfApi.getItem(annotationId);\n this.setPenColor = this.setPenColor.bind(this);\n this.setPenSize = this.setPenSize.bind(this);\n this.setPenOpacity = this.setPenOpacity.bind(this);\n this.close = this.close.bind(this);\n const annotationOptions = this.options.annotation;\n this.penColors = annotationOptions.colors.foregroundColors;\n this.penWidths = annotationOptions.strokeWidths;\n this.context = this.createCanvas();\n const color = new Color(this.inkAnnotation.color || annotationOptions.colors.inkColor);\n const penSize = ((_a = this.inkAnnotation) === null || _a === void 0 ? void 0 : _a.border.width) || annotationOptions.inkWidth;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n this.toolbar = createEditInkAnnotationToolbar({\n penColors: this.penColors,\n penWidths: this.penWidths,\n selectedPenColor: color.toHexRgb(),\n selectedPenSize: penSize,\n penOpacity: color.a * 100,\n onPenColorChanged: this.setPenColor,\n onPenSizeChanged: this.setPenSize,\n onPenOpacityChanged: this.setPenOpacity,\n onCancel: this.remove,\n }, toolbarElement);\n this.store.viewer.beginModule(moduleLayerName);\n }\n onSave() {\n return new Promise((resolve) => resolve);\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n var _a;\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (state.pointer.action === 'click' || state.pointer.action === 'dblclick') {\n const inkAnnotation = (_a = this.pdfApi\n .getAnnotationsOnPoint({\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n })) === null || _a === void 0 ? void 0 : _a.find((a) => this.inkAnnotation && a.id === this.inkAnnotation.id);\n if (!inkAnnotation) {\n this.close();\n return;\n }\n }\n if (this.context && this.inkAnnotation) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const rect = this.pdfApi.transformPdfPageRectToScreenRect(this.inkAnnotation.pdfRect);\n const lineWidth = 2 * devicePixelRatio;\n ctx.save();\n ctx.strokeStyle = this.options.viewer.general.textSelectionColor;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash([lineWidth, lineWidth]);\n ctx.strokeRect(rect.x - lineWidth, rect.y - lineWidth, rect.w + 2 * lineWidth, rect.h + 2 * lineWidth);\n ctx.restore();\n }\n }\n close() {\n this.remove();\n }\n setPenColor(color) {\n if (this.inkAnnotation && this.inkAnnotation.color) {\n const newColor = new Color(color);\n const currentColor = new Color(this.inkAnnotation.color);\n newColor.setOpacity(currentColor.a);\n this.inkAnnotation.color = newColor.toHexRgba();\n this.updateInkAnnotation();\n }\n }\n setPenSize(size) {\n if (this.inkAnnotation) {\n this.inkAnnotation.border = {\n style: AnnotationBorderStyle.SOLID,\n width: size,\n };\n this.updateInkAnnotation();\n }\n }\n setPenOpacity(opacity) {\n if (this.inkAnnotation && this.inkAnnotation.color) {\n const rgbaColor = new Color(this.inkAnnotation.color);\n rgbaColor.setOpacity(opacity / 100);\n this.inkAnnotation.color = rgbaColor.toHexRgba();\n this.updateInkAnnotation();\n }\n }\n updateInkAnnotation() {\n if (this.pdfApi && this.inkAnnotation) {\n if (this.updatePending) {\n this.unsavedChanges = true;\n }\n else {\n this.updatePending = true;\n this.pdfApi\n .updateItem(this.inkAnnotation)\n .then((item) => {\n this.updatePending = false;\n if (this.unsavedChanges) {\n this.unsavedChanges = false;\n this.updateInkAnnotation();\n }\n })\n .catch((error) => {\n console.warn(error);\n });\n }\n }\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { StrokeWidthPicker } from '../../common/StrokeWidthPicker';\nimport { RangeSlider } from '../../common/RangeSlider';\nimport { ColorPicker } from '../../common/ColorPicker';\nexport const createEditInkAnnotationToolbar = (props, element) => {\n const state = {\n penColors: props.penColors,\n penWidths: props.penWidths,\n selectedPenColor: props.selectedPenColor,\n selectedPenSize: props.selectedPenSize,\n penOpacity: props.penOpacity,\n };\n const actions = {\n setPenColor: (color) => ($state) => {\n props.onPenColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedPenColor: color });\n },\n setPenSize: (width) => ($state) => {\n props.onPenSizeChanged(width);\n return Object.assign(Object.assign({}, $state), { selectedPenSize: width });\n },\n setPenOpacity: (opacity) => ($state) => {\n props.onPenOpacityChanged(opacity);\n return Object.assign(Object.assign({}, $state), { penOpacity: opacity });\n },\n };\n const App = () => h(EditInkAnnotationToolbar, null);\n const EditInkAnnotationToolbar = ({}) => ($state, $actions) => {\n const strokeWidths = $state.penWidths.filter((w) => w > 0);\n return (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(ColorPicker, { colors: $state.penColors, color: $state.selectedPenColor, icon: icons.fillColor, allowRgba: false, mode: \"buttons\", onChange: $actions.setPenColor })),\n h(ToolbarItemGroup, null,\n h(RangeSlider, { tooltip: translationManager.getText('annotFreeDrawing.opacity'), min: 10, max: 100, step: 1, value: $state.penOpacity, text: `${Math.round($state.penOpacity)}%`, icon: icons.drop, onChange: $actions.setPenOpacity, className: \"pwv-opacityslider\" }),\n h(StrokeWidthPicker, { tooltip: translationManager.getText('annotFreeDrawing.strokeWidth'), noneStrokeText: '', strokeWidths: strokeWidths, value: $state.selectedPenSize, onChange: $actions.setPenSize })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onCancel }))));\n };\n return app(state, actions, App, element);\n};\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { AddInkAnnotationLayer } from './AddInkAnnotationLayer';\nimport { EditInkAnnotationLayer } from './EditInkAnnotationLayer';\nimport { PdfItemType } from '../../pdf-viewer-api';\nimport { icons } from '../../common/Icon';\nimport { translationManager } from '../../common/TranslationManager';\nexport class InkAnnotationModule extends CanvasModule {\n constructor() {\n super();\n this.toolbarElement = null;\n this.name = InkAnnotationModule.moduleInfo.name;\n this.activate = this.activate.bind(this);\n this.onEdit = this.onEdit.bind(this);\n }\n onRegister() {\n this.toolbarElement = document.createElement('div');\n return {\n toolbar: this.toolbarElement,\n contextbar: {\n itemTypes: [PdfItemType.INK],\n icon: icons.edit,\n tooltip: translationManager.getText('annotInk.edit'),\n onCmd: (annotationId) => {\n this.onEdit(annotationId);\n },\n },\n };\n }\n activate() {\n if (!this.canvasLayers['add']) {\n this.createCanvasLayer('add', AddInkAnnotationLayer);\n }\n else {\n this.removeCanvasLayer('add');\n }\n }\n onEdit(annotationId) {\n this.createCanvasLayer('edit', EditInkAnnotationLayer, annotationId);\n }\n}\nInkAnnotationModule.moduleInfo = {\n name: 'InkAnnotationModule',\n moduleType: CanvasModuleType.Tool,\n requiredFeatures: {\n annotate: true,\n fillFormFields: false,\n },\n translationKey: 'annotFreeDrawing.add',\n icon: 'pencil',\n};\n","import { h, app } from '../../lib/hyperapp';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/Icon';\nimport { ColorPicker } from '../../common/ColorPicker';\nimport { classNames } from '../../common/classNames';\nimport { DragMoveHandler } from '../../common/DragMoveHandler';\nimport { PdfItemType } from '../../pdf-viewer-api';\nimport { Color } from '../../common/Color';\nexport const createPopupView = (props, element) => {\n const state = {\n selectedPopup: null,\n openPopups: [],\n maxPopupWidth: props.maxPopupWidth,\n maxPopupHeight: props.maxPopupHeight,\n minPopupWidth: 260,\n minPopupHeight: 200,\n currentUser: props.currentUser,\n hideSubject: props.hideSubject,\n activeContent: null,\n activeSubject: null,\n stateChanged: false,\n clearFocus: false,\n };\n const actions = {\n getState: () => ($state) => $state,\n updateOpenPopups: (openPopups) => ($state) => {\n openPopups.forEach((popup) => {\n const oldPopup = $state.openPopups.find((op) => op.id === popup.id);\n if (oldPopup) {\n popup.selected = oldPopup.selected;\n popup.positionCalculated = oldPopup.positionCalculated;\n }\n });\n return Object.assign(Object.assign({}, $state), { openPopups });\n },\n stateChanged: (hasChanged) => ($state) => {\n return Object.assign(Object.assign({}, $state), { stateChanged: hasChanged });\n },\n setPositionCalculated: (id) => ($state) => {\n const popup = $state.openPopups.find((p) => p.id === id);\n if (popup) {\n popup.positionCalculated = true;\n }\n return Object.assign({}, $state);\n },\n selectPopup: (id) => ($state) => {\n const openPopups = $state.openPopups.map((p) => (Object.assign(Object.assign({}, p), { selected: p.id === id })));\n return Object.assign(Object.assign({}, $state), { openPopups, activeContent: id === $state.selectedPopup ? $state.activeContent : null, activeSubject: id === $state.selectedPopup ? $state.activeSubject : null, selectedPopup: id });\n },\n updateSubjectAndContent: (id) => ($state) => {\n const subject = document.getElementById('pwv-popup-subject-' + id)\n .value;\n const content = document.getElementById('pwv-popup-content-' + id)\n .value;\n return Object.assign(Object.assign({}, $state), { activeContent: content, activeSubject: subject });\n },\n setFocus: (id) => ($state) => {\n const textArea = document.getElementById('pwv-popup-content-' + id);\n if (textArea) {\n textArea.focus();\n }\n return Object.assign(Object.assign({}, $state), { clearFocus: document.activeElement === textArea });\n },\n deselectPopup: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { selectedPopup: null });\n },\n };\n const App = () => h(OpenPopups, null);\n const OpenPopups = ({}) => ($state, $actions) => {\n return (h(\"div\", null, $state.openPopups.map((popup) => (h(Popup, { popup: Object.assign(Object.assign({}, popup), { selected: popup.id === $state.selectedPopup }), colorPalette: popup.colorPalette, hideSubject: props.hideSubject, allowLockAnnotations: props.allowLockAnnotations, allowEditLockedAnnotations: props.allowEditLockedAnnotations, close: props.onClose, remove: props.onDelete, select: props.onSelect, toggleLock: props.onLock, updatePosition: (payload) => {\n props.onUpdatePosition(payload.id, payload.x, payload.y);\n }, updateSize: (payload) => {\n props.onUpdateSize(payload.id, payload.w, payload.h);\n }, updateColor: (payload) => {\n props.onUpdateColor(payload.id, payload.color);\n } })))));\n };\n return app(state, actions, App, element);\n};\n/* tslint:disable-next-line:max-line-length */\nconst Popup = ({ popup, colorPalette, hideSubject, allowLockAnnotations, allowEditLockedAnnotations, updateColor, close, select, remove, toggleLock, updatePosition, updateSize, }) => ($state, $actions) => {\n const styles = {\n backgroundColor: popup.color,\n width: popup.cssWidth < $state.minPopupWidth ? $state.minPopupWidth + 'px' : popup.cssWidth + 'px',\n height: popup.cssHeight < $state.minPopupHeight\n ? $state.minPopupHeight + 'px'\n : popup.cssHeight + 'px',\n };\n let colorString;\n if (popup.color != null) {\n const color = new Color(popup.color);\n styles.backgroundColor = color.toRgb();\n // color.a\n if (color.isDark()) {\n colorString = 'rgba(255, 255, 255, 0.9)';\n }\n else {\n colorString = 'rgba(0, 0, 0, 0.9)';\n }\n }\n const headerStyles = {\n color: colorString,\n };\n if (!popup.positionCalculated) {\n styles.display = 'none';\n }\n const isReadOnly = popup.isReadOnly();\n return (h(\"div\", { class: classNames('pwv-popup', {\n 'pwv-popup-view-only': isReadOnly,\n 'pwv-popup-selected': popup.selected,\n }), key: popup.id, style: styles, \"data-id\": popup.id },\n h(\"div\", { onclick: (e) => {\n if (!e.openDropdown) {\n window.dispatchEvent(new Event('click', e));\n }\n if (!popup.selected) {\n select(popup.id);\n }\n }, onchange: (e) => {\n $actions.stateChanged(true);\n } },\n h(\"div\", { class: \"pwv-popup-header\" },\n h(\"div\", { class: \"pwv-popup-header-info\", style: headerStyles },\n h(\"div\", { class: \"pwv-popup-header-author\" }, popup.author),\n h(\"div\", { class: \"pwv-popup-header-modified\" }, popup.modificationDate)),\n isReadOnly ? (h(Toolbar, null,\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarButton, { onClick: (e) => {\n e.stopPropagation();\n if (!popup.selected) {\n select(popup.id);\n }\n close();\n }, icon: icons.close })))) : (h(Toolbar, null,\n h(ToolbarItemGroup, null,\n h(ToolbarButton, { tooltip: translationManager.getText('annotPopup.delete'), icon: icons.delete, onClick: () => {\n remove(popup.id);\n }, disabled: popup.isLocked && !allowEditLockedAnnotations }),\n allowLockAnnotations && (h(ToolbarButton, { tooltip: translationManager.getText(popup.isLocked ? 'annotPopup.unlock' : 'annotPopup.lock'), onClick: (e) => {\n e.stopPropagation();\n if (!popup.selected) {\n select(popup.id);\n }\n toggleLock(popup.id);\n }, icon: popup.isLocked ? icons.lock : icons.unlock })),\n popup.itemType !== PdfItemType.STAMP && (h(ColorPicker, { tooltip: translationManager.getText('annotPopup.color'), colors: colorPalette, icon: icons.fillColor, color: popup.color || 'transparent', onChange: (color) => {\n updateColor({\n id: popup.id,\n color,\n });\n }, disabled: popup.isLocked && !allowEditLockedAnnotations }))),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarButton, { onClick: (e) => {\n e.stopPropagation();\n if (!popup.selected) {\n select(popup.id);\n }\n if (!popup.isLocked || allowEditLockedAnnotations) {\n $actions.updateSubjectAndContent(popup.id);\n }\n close();\n }, icon: icons.close }))))),\n isReadOnly ? (h(\"div\", { class: \"pwv-popup-view-only-content\" },\n !hideSubject && popup.subject && h(\"h4\", null, popup.subject),\n h(\"div\", null, popup.content))) : (h(\"div\", null,\n hideSubject ? (h(\"input\", { id: 'pwv-popup-subject-' + popup.id, type: \"hidden\", value: $state.selectedPopup === popup.id\n ? $state.activeSubject\n ? $state.activeSubject\n : popup.subject\n : popup.subject })) : (h(\"div\", { class: \"pwv-popup-subject\" }, !popup.isLocked || allowEditLockedAnnotations ? (h(\"input\", { id: 'pwv-popup-subject-' + popup.id, placeholder: translationManager.getText('annotPopup.subjectPlaceholder'), onchange: () => {\n $actions.updateSubjectAndContent(popup.id);\n }, value: $state.selectedPopup === popup.id\n ? $state.activeSubject\n ? $state.activeSubject\n : popup.subject\n : popup.subject })) : (h(\"div\", { id: 'pwv-popup-subject-' + popup.id }, popup.subject)))),\n h(\"div\", { class: classNames('pwv-popup-content', {\n 'pwv-popup-content-no-subject': hideSubject,\n }) }, !popup.isLocked || allowEditLockedAnnotations ? (h(\"textarea\", { placeholder: translationManager.getText('annotPopup.contentPlaceholder'), id: 'pwv-popup-content-' + popup.id, onchange: () => {\n $actions.updateSubjectAndContent(popup.id);\n }, oninput: () => {\n $actions.updateSubjectAndContent(popup.id);\n } }, $state.selectedPopup === popup.id\n ? $state.activeContent\n ? $state.activeContent\n : popup.content\n : popup.content)) : (h(\"div\", { id: 'pwv-popup-content-' + popup.id }, popup.content)))))),\n h(\"div\", null,\n h(\"div\", { class: \"pwv-popup-draghandle\" }),\n h(\"div\", { class: \"pwv-popup-resizer\", \n /* tslint:disable-next-line:max-line-length */\n oncreate: (element) => {\n PopupComponent.create(popup.id, element, $state.minPopupWidth, $state.minPopupHeight, $state.maxPopupWidth, $state.maxPopupHeight, updatePosition, updateSize, select);\n }, onremove: (element, done) => {\n PopupComponent.remove(element);\n done();\n } }))));\n};\nclass PopupComponent {\n static create(id, resizeHandle, minPopupWidth, minPopupHeight, maxPopupWidth, maxPopupHeight, updatePosition, updateSize, select) {\n /* tslint:disable-next-line:max-line-length */\n ;\n resizeHandle.parentElement.popup = new PopupComponent(id, resizeHandle, minPopupWidth, minPopupHeight, maxPopupWidth, maxPopupHeight, updatePosition, updateSize, select);\n }\n static remove(resizeHandle) {\n ;\n resizeHandle.parentElement.popup.unmount()(resizeHandle.parentElement).popup =\n null;\n }\n constructor(id, resizeHandle, minPopupWidth, minPopupHeight, maxPopupWidth, maxPopupHeight, updatePosition, updateSize, select) {\n this.cancelContentEvents = true;\n this.dragOffsetX = 0;\n this.dragOffsetY = 0;\n this.containerOffsetX = 0;\n this.containerOffsetY = 0;\n this.id = id;\n this.resizeHandle = resizeHandle;\n const parent = resizeHandle.parentElement;\n this.dragHandle = parent.children.item(0);\n this.element = parent.parentElement;\n this.minPopupWidth = 260;\n this.minPopupHeight = 200;\n this.maxPopupWidth = maxPopupWidth > this.minPopupWidth ? maxPopupWidth : this.minPopupWidth;\n this.maxPopupHeight =\n maxPopupHeight > this.minPopupHeight ? maxPopupHeight : this.minPopupHeight;\n this.updatePosition = updatePosition;\n this.updateSize = updateSize;\n this.select = select;\n this.cancelEvent = this.cancelEvent.bind(this);\n this.startMove = this.startMove.bind(this);\n this.moving = this.moving.bind(this);\n this.endMove = this.endMove.bind(this);\n this.onSelect = this.onSelect.bind(this);\n this.startResize = this.startResize.bind(this);\n this.resizing = this.resizing.bind(this);\n this.endResize = this.endResize.bind(this);\n this.handleMouseWheel = this.handleMouseWheel.bind(this);\n new DragMoveHandler(this.dragHandle, this.startMove, this.moving, this.endMove, this.onSelect);\n new DragMoveHandler(this.resizeHandle, this.startResize, this.resizing, this.endResize);\n this.element.addEventListener('mousewheel', this.handleMouseWheel, { passive: true });\n const contentElement = this.element.firstChild;\n contentElement.addEventListener('onclick', this.cancelEvent, false);\n contentElement.addEventListener('keydown', this.cancelEvent, false);\n contentElement.addEventListener('mousedown', this.cancelEvent, false);\n contentElement.addEventListener('mousemove', this.cancelEvent, false);\n contentElement.addEventListener('mouseup', this.cancelEvent, false);\n contentElement.addEventListener('touchstart', this.cancelEvent, { passive: true });\n contentElement.addEventListener('touchmove', this.cancelEvent, { passive: true });\n contentElement.addEventListener('touchend', this.cancelEvent, { passive: true });\n }\n unmount() {\n this.element.removeEventListener('mousewheel', this.handleMouseWheel);\n }\n cancelEvent(e) {\n if (this.cancelContentEvents) {\n if (!(e.type === 'mousemove' && e.buttons === 0)) {\n e.cancelBubble = true;\n e.stopPropagation();\n }\n }\n }\n onSelect() {\n this.select(this.id);\n }\n startResize(e) {\n this.cancelContentEvents = false;\n this.element.classList.add('pwv-popup-resizing');\n this.onSelect();\n }\n resizing(e) {\n const rect = this.element.getBoundingClientRect();\n let width = e.clientX - rect.left;\n let height = e.clientY - rect.top;\n width =\n width < this.minPopupWidth\n ? this.minPopupWidth\n : width > this.maxPopupWidth\n ? this.maxPopupWidth\n : width;\n height =\n height < this.minPopupHeight\n ? this.minPopupHeight\n : height > this.maxPopupHeight\n ? this.maxPopupHeight\n : height;\n this.element.style.width = width + 'px';\n this.element.style.height = height + 'px';\n const popupRect = {\n x: parseInt(this.element.style.left, undefined),\n y: parseInt(this.element.style.top, undefined),\n w: width,\n h: height,\n };\n const evtDetail = {\n annotationId: this.id,\n popupRect,\n color: this.element.style.backgroundColor,\n };\n window.dispatchEvent(new CustomEvent('pdfwebviewer.PopupMoved', { detail: evtDetail }));\n }\n endResize(e) {\n if (e.moved) {\n this.updateSize({\n id: this.id,\n w: this.element.clientWidth,\n h: this.element.clientHeight,\n });\n }\n this.cancelContentEvents = true;\n this.element.classList.remove('pwv-popup-resizing');\n }\n startMove(e) {\n const elementRect = this.element.getBoundingClientRect();\n const offsetParent = this.element.offsetParent;\n const offsetParentRect = offsetParent.getBoundingClientRect();\n this.dragOffsetX = e.clientX - elementRect.left;\n this.dragOffsetY = e.clientY - elementRect.top;\n this.containerOffsetX = offsetParentRect.left;\n this.containerOffsetY = offsetParentRect.top;\n this.cancelContentEvents = false;\n this.element.classList.add('pwv-popup-moving');\n this.onSelect();\n }\n moving(e) {\n const popupRect = {\n x: e.clientX - this.containerOffsetX - this.dragOffsetX,\n y: e.clientY - this.containerOffsetY - this.dragOffsetY,\n w: parseInt(this.element.style.width, undefined),\n h: parseInt(this.element.style.height, undefined),\n };\n this.element.style.top = popupRect.y + 'px';\n this.element.style.left = popupRect.x + 'px';\n const evtDetail = {\n annotationId: this.id,\n popupRect,\n color: this.element.style.backgroundColor,\n };\n window.dispatchEvent(new CustomEvent('pdfwebviewer.PopupMoved', { detail: evtDetail }));\n }\n endMove(e) {\n if (e.moved) {\n this.updatePosition({\n id: this.id,\n x: this.element.offsetLeft,\n y: this.element.offsetTop,\n });\n }\n this.cancelContentEvents = true;\n this.element.classList.remove('pwv-popup-moving');\n }\n handleMouseWheel(e) {\n if (this.element.classList.contains('pwv-popup-selected')) {\n // e.preventDefault()\n e.stopPropagation();\n }\n }\n}\n","import { CanvasLayer } from '../CanvasLayer';\nimport { createPopupView } from './Popup';\nimport { getPopups, getOpenPopups } from '../../pdf-viewer-canvas/state/annotations';\nimport { PdfItemType, } from '../../pdf-viewer-api';\nimport { renderPopupMarker } from '../../pdf-viewer-canvas/view-layers/canvasShapes';\nimport { ViewerMode, CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { Color } from '../../common/Color';\nimport { getColorPalette } from '../../common/Tools';\nimport { addHistoryEntry } from '../../custom/history';\nexport class PopupLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.popupView = null;\n this.context = null;\n this.maxPopupWidth = window.screen.availWidth < 570 ? 280 : 480;\n this.maxPopupHeight = 320;\n this.minPopupWidth = 260;\n this.minPopupHeight = 200;\n this.zoom = 0;\n this.screenToPdfScale = 0;\n }\n onCreate() {\n this.drawPopupRelation = this.drawPopupRelation.bind(this);\n this.popupMoved = this.popupMoved.bind(this);\n this.selectPopup = this.selectPopup.bind(this);\n this.deselectPopup = this.deselectPopup.bind(this);\n this.openPopup = this.openPopup.bind(this);\n this.closePopup = this.closePopup.bind(this);\n this.deletePopup = this.deletePopup.bind(this);\n this.toggleAnnotationLock = this.toggleAnnotationLock.bind(this);\n this.updateSelectedPopupContent = this.updateSelectedPopupContent.bind(this);\n this.updatePopupPosition = this.updatePopupPosition.bind(this);\n this.updatePopupSize = this.updatePopupSize.bind(this);\n this.updatePopupColor = this.updatePopupColor.bind(this);\n this.context = this.createCanvas();\n this.createPopupView();\n window.addEventListener('pdfwebviewer.PopupMoved', this.popupMoved, false);\n }\n onRemove() { }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n if (this.popupView) {\n const state = this.popupView.getState();\n if (state.stateChanged) {\n this.updateSelectedPopupContent(true).then(() => {\n resolve();\n });\n }\n else {\n resolve();\n }\n }\n });\n return promise;\n }\n render(timestamp, state) {\n if (this.pdfApi && this.popupView && this.popupViewElement) {\n if (state.document.zoomChanged && state.document.zoom !== this.zoom) {\n this.zoom = state.document.zoom;\n this.screenToPdfScale = this.pdfApi.transformPdfLengthToScreenLength(100) / 100 / this.zoom;\n }\n /* tslint:disable-next-line:max-line-length */\n if (state.annotations.openPopupChanged ||\n state.document.firstVisiblePageChanged ||\n state.document.lastVisiblePageChanged ||\n state.viewer.modeChanged) {\n this.updateOpenPopupList(state);\n }\n if (state.viewer.popupFocus) {\n this.popupView.setFocus(state.viewer.popupFocus);\n }\n if (this.popupView.getState().clearFocus) {\n this.store.viewer.clearPopupFocus();\n }\n if (state.viewer.selectedPopupChanged) {\n const selectedPopup = this.popupView.getState().selectedPopup;\n if (state.viewer.selectedPopupId) {\n if (selectedPopup !== state.viewer.selectedPopupId) {\n this.popupView.selectPopup(state.viewer.selectedPopupId);\n }\n }\n }\n const viewerMode = state.viewer.mode;\n if (viewerMode === ViewerMode.POPUP_SELECTED) {\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n }\n const { openPopups, selectedPopup } = this.popupView.getState();\n const popupsVisible = viewerMode === ViewerMode.DEFAULT || viewerMode === ViewerMode.POPUP_SELECTED;\n if (state.viewer.modeChanged) {\n if (popupsVisible) {\n this.popupViewElement.style.display = 'block';\n }\n else {\n this.popupViewElement.style.display = 'none';\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n if (selectedPopup && state.pointer.action !== 'click') {\n this.updateSelectedPopupContent(true);\n }\n }\n }\n if (viewerMode === ViewerMode.POPUP_SELECTED && state.pointer.action === 'click') {\n this.deselectPopup();\n }\n const updatePopupPosition = state.canvas.canvasInvalidated || openPopups.find((p) => !p.positionCalculated);\n if (openPopups.length > 0 && updatePopupPosition) {\n const popupElements = this.popupViewElement.querySelectorAll('.pwv-popup');\n const canvasWidth = state.canvas.width.cssPixels;\n const canvasHeight = state.canvas.height.cssPixels;\n const zoom = state.document.zoom;\n for (let i = 0; i < popupElements.length; i++) {\n const popupElement = popupElements[i];\n if (!popupElement.classList.contains('pwv-popup-moving')) {\n const id = popupElement.dataset.id;\n const popup = openPopups.find((p) => p.id.toString() === id);\n if (popup) {\n const screenRect = this.pdfApi.transformPdfPageRectToScreenRect(popup.pdfRect);\n let x = screenRect.x / devicePixelRatio;\n let y = screenRect.y / devicePixelRatio;\n const w = parseInt(popupElement.style.width, undefined);\n const h = parseInt(popupElement.style.height, undefined);\n const padding = 8;\n if (x < padding) {\n x = padding;\n }\n else if (x + w + padding * 2 > canvasWidth) {\n x = canvasWidth - (w + padding * 2);\n }\n if (y < padding) {\n y = padding;\n }\n else if (y + h + padding * 2 > canvasHeight) {\n y = canvasHeight - (h + padding * 2);\n }\n popupElement.style.top = `${y}px`;\n popupElement.style.left = `${x}px`;\n if (!popup.positionCalculated) {\n this.popupView.setPositionCalculated(popup.id);\n }\n }\n }\n }\n }\n if ((state.viewer.mode === ViewerMode.POPUP_SELECTED ||\n state.viewer.mode === ViewerMode.DEFAULT) &&\n (state.viewer.selectedPopupChanged ||\n state.canvas.canvasInvalidated ||\n state.pointer.positionChanged ||\n state.annotations.openPopupChanged)) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const scale = state.canvas.pixelRatio * state.document.zoom;\n if (viewerMode !== ViewerMode.POPUP_SELECTED) {\n const popups = getPopups(state.annotations, state.document.firstVisiblePage, state.document.lastVisiblePage);\n if (popups === null) {\n return;\n }\n for (let i = 0; i < popups.length; i++) {\n const popup = popups[i];\n if (popup.itemType !== PdfItemType.TEXT) {\n let pos;\n pos = this.pdfApi.transformPdfPageRectToScreenRect(popup.pdfRect);\n ctx.lineWidth = 1;\n ctx.beginPath();\n const r = 12 * scale;\n const posX = pos.x + r / 2;\n const posY = pos.y - r;\n ctx.arc(posX, posY, r, 0, 2 * Math.PI);\n if (ctx.isPointInPath(state.pointer.x.devicePixels, state.pointer.y.devicePixels)) {\n this.store.viewer.setCursorStyle(CursorStyle.POINTER);\n ctx.globalAlpha = 0.15;\n ctx.fillStyle = this.options.viewer.general.textSelectionColor;\n ctx.fill();\n ctx.globalAlpha = 1;\n if (state.pointer.action === 'click') {\n this.openPopup(popup.id);\n }\n }\n renderPopupMarker(ctx, scale, popup.color || this.options.annotation.colors.defaultHighlightColor, { x: posX, y: posY });\n }\n }\n }\n if (openPopups.length > 0) {\n const popupElements = this.popupViewElement.querySelectorAll('.pwv-popup:hover, .pwv-popup.pwv-popup-selected');\n for (let i = 0; i < popupElements.length; i++) {\n const popupElement = popupElements[i];\n const id = popupElement.dataset.id ? parseInt(popupElement.dataset.id, undefined) : -1;\n this.drawPopupRelation(ctx, id, {\n x: popupElement.offsetLeft,\n y: popupElement.offsetTop,\n w: popupElement.offsetWidth,\n h: popupElement.offsetHeight,\n }, popupElement.style.backgroundColor, id === state.viewer.selectedPopupId);\n }\n }\n }\n }\n }\n updateOpenPopupList(state) {\n if (this.popupView) {\n const openPopups = getOpenPopups(state.annotations, state.document.firstVisiblePage, state.document.lastVisiblePage);\n const zoom = state.document.zoom;\n const popups = openPopups.map((an) => {\n const width = this.pdfApi.transformPdfLengthToScreenLength(an.popup.pdfRect.pdfW) / zoom;\n const height = this.pdfApi.transformPdfLengthToScreenLength(an.popup.pdfRect.pdfH) / zoom;\n // Take last modified date, author and color\n // from parent annotation\n return {\n id: an.id,\n colorPalette: getColorPalette(an.itemType, this.options),\n content: an.content,\n subject: an.subject ? an.subject : null,\n modificationDate: an.modificationDate,\n author: an.author,\n color: an.color,\n itemType: an.itemType,\n isLocked: an.isLocked(),\n selected: false,\n positionCalculated: false,\n pdfRect: an.popup.pdfRect,\n cssWidth: width < this.maxPopupWidth ? width : this.maxPopupWidth,\n cssHeight: height < this.maxPopupHeight ? height : this.maxPopupHeight,\n behaviors: an.behaviors,\n isReadOnly: an.isReadOnly,\n };\n });\n this.popupView.updateOpenPopups(popups);\n }\n }\n drawPopupRelation(ctx, annotationId, popupRect, color, selected) {\n const annotation = this.pdfApi.getItem(annotationId);\n if (annotation) {\n const annotationRect = this.pdfApi.transformPdfPageRectToScreenRect(annotation.pdfRect);\n const popupX1 = popupRect.x * devicePixelRatio;\n const popupX2 = popupX1 + popupRect.w * devicePixelRatio;\n const popupXc = popupX1 + (popupRect.w / 2) * devicePixelRatio;\n const popupY1 = popupRect.y * devicePixelRatio;\n const popupY2 = popupY1 + popupRect.h * devicePixelRatio;\n const popupYc = popupY1 + (popupRect.h / 2) * devicePixelRatio;\n const annotationX1 = annotationRect.x;\n const annotationX2 = annotationX1 + annotationRect.w;\n const annotationY1 = annotationRect.y;\n const annotationY2 = annotationY1 + annotationRect.h;\n let popupRelX = popupX1;\n let popupRelY = popupY1;\n let annotationRelX = annotationX1;\n let annotationRelY = annotationY1;\n if (popupX2 <= annotationX1) {\n popupRelX = popupX2;\n annotationRelX = annotationX1;\n }\n if (popupX1 >= annotationX2) {\n popupRelX = popupX1;\n annotationRelX = annotationX2;\n }\n if (popupY2 <= annotationY1) {\n popupRelY = popupY2;\n annotationRelY = annotationY1;\n }\n if (popupY1 >= annotationY2) {\n popupRelY = popupY1;\n annotationRelY = annotationY2;\n }\n if (popupX2 >= annotationX1 && popupX1 <= annotationX2) {\n const x = popupXc < annotationX1 ? annotationX1 : popupXc > annotationX2 ? annotationX2 : popupXc;\n popupRelX = x;\n annotationRelX = x;\n }\n if (popupY2 >= annotationY1 && popupY1 <= annotationY2) {\n const y = popupYc < annotationY1 ? annotationY1 : popupYc > annotationY2 ? annotationY2 : popupYc;\n popupRelY = y;\n annotationRelY = y;\n }\n ctx.save();\n if (!(popupRelX === 0 && popupRelY === 0)) {\n if (color) {\n const rgbColor = new Color(color);\n rgbColor.darken(20);\n if (!selected) {\n rgbColor.setOpacity(0.8);\n }\n ctx.strokeStyle = rgbColor.toRgba();\n ctx.fillStyle = rgbColor.toRgba();\n }\n ctx.lineWidth = 2 * window.devicePixelRatio;\n if (!selected) {\n ctx.setLineDash([ctx.lineWidth]);\n }\n ctx.beginPath();\n ctx.moveTo(annotationRelX, annotationRelY);\n ctx.lineTo(popupRelX, popupRelY);\n ctx.stroke();\n ctx.strokeRect(annotationX1, annotationY1, annotationRect.w, annotationRect.h);\n ctx.restore();\n }\n }\n ctx.restore();\n }\n popupMoved(event) {\n if (this.context !== null && event.detail) {\n this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height);\n this.drawPopupRelation(this.context, event.detail.annotationId, event.detail.popupRect, event.detail.color, true);\n }\n }\n createPopupView() {\n if (this.containerElement) {\n this.popupViewElement = this.createHtmlLayer();\n this.popupView = createPopupView({\n maxPopupWidth: this.maxPopupWidth,\n maxPopupHeight: this.maxPopupHeight,\n minPopupWidth: this.minPopupWidth,\n minPopupHeight: this.minPopupHeight,\n currentUser: this.options.viewer.general.user ? this.options.viewer.general.user : '',\n hideSubject: this.options.annotation.hideAnnotationSubject || false,\n allowLockAnnotations: this.options.viewer.permissions.allowLockAnnotations,\n allowEditLockedAnnotations: this.options.viewer.permissions.allowEditLockedAnnotations,\n onSelect: this.selectPopup,\n onClose: this.closePopup,\n onDelete: this.deletePopup,\n onUpdatePosition: this.updatePopupPosition,\n onUpdateSize: this.updatePopupSize,\n onUpdateColor: this.updatePopupColor,\n onLock: this.toggleAnnotationLock,\n }, this.popupViewElement);\n }\n }\n selectPopup(id) {\n if (this.popupView) {\n if (this.popupView.getState().selectedPopup !== null) {\n this.updateSelectedPopupContent(true);\n }\n this.popupView.selectPopup(id);\n this.store.viewer.selectPopup({ id, focus: false });\n }\n }\n deselectPopup() {\n if (this.popupView) {\n this.updateSelectedPopupContent(true);\n this.popupView.deselectPopup();\n this.store.viewer.selectPopup({ id: null, focus: false });\n }\n }\n openPopup(id) {\n if (this.pdfApi) {\n const annotation = this.pdfApi.getItem(id);\n if (annotation) {\n annotation.popup.isOpen = true;\n this.store.annotations.updateAnnotation(annotation);\n if (this.pdfViewerCanvas.licenseFeatures.annotate) {\n this.pdfApi.updateItem(annotation).then(() => {\n this.selectPopup(annotation.id);\n });\n }\n else {\n this.selectPopup(annotation.id);\n }\n }\n }\n }\n closePopup() {\n this.updateSelectedPopupContent(false).then((annot) => {\n this.store.viewer.deselectPopup();\n if (this.pdfApi) {\n if (annot) {\n annot.popup.isOpen = false;\n this.store.annotations.updateAnnotation(annot);\n if (this.pdfViewerCanvas.licenseFeatures.annotate) {\n this.pdfApi.updateItem(annot);\n }\n }\n }\n });\n }\n deletePopup(id) {\n if (this.pdfApi) {\n if (this.popupView) {\n this.popupView.deselectPopup();\n }\n this.store.viewer.selectPopup({ id: null, focus: false });\n const annotation = this.pdfApi.getItem(id);\n if (annotation) {\n annotation.content = '';\n annotation.subject = '';\n annotation.popup.isOpen = false;\n this.store.annotations.updateAnnotation(annotation);\n if (this.pdfViewerCanvas.licenseFeatures.annotate) {\n this.pdfApi.updateItem(annotation);\n }\n }\n }\n }\n toggleAnnotationLock(id) {\n if (this.pdfApi) {\n this.updateSelectedPopupContent(false).then((annotation) => {\n if (annotation) {\n if (this.options.annotation.trackHistory) {\n addHistoryEntry(annotation, 'lock', this.options.viewer.general.user);\n }\n annotation.setLock(!annotation.isLocked());\n this.store.annotations.updateAnnotation(annotation);\n if (this.pdfViewerCanvas.licenseFeatures.annotate) {\n this.pdfApi.updateItem(annotation);\n }\n }\n });\n }\n }\n updateSelectedPopupContent(syncronize, annotation) {\n const promise = new Promise((resolve, reject) => {\n var _a;\n if (this.pdfApi) {\n if (this.popupView) {\n const state = this.popupView.getState();\n const id = state.selectedPopup;\n if (id) {\n if (!annotation) {\n annotation = this.pdfApi.getItem(id);\n }\n const content = state.activeContent;\n const subject = state.activeSubject;\n if (this.options.annotation.trackHistory) {\n addHistoryEntry(annotation, 'edit', this.options.viewer.general.user, content, subject);\n }\n annotation.content = content !== null ? content : annotation.content;\n annotation.subject = subject !== null ? subject : annotation.subject;\n if (((_a = this.pdfViewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && syncronize) {\n this.pdfApi\n .updateItem(annotation)\n .then(() => {\n if (this.popupView) {\n this.popupView.stateChanged(false);\n }\n resolve();\n })\n .catch(() => {\n reject();\n });\n }\n else {\n resolve(annotation);\n }\n }\n }\n }\n resolve(null);\n });\n return promise;\n }\n updatePopupPosition(id, x, y) {\n if (this.pdfApi) {\n const annotation = this.pdfApi.getItem(id);\n if (annotation) {\n const newPdfPos = this.pdfApi.transformScreenPointToPdfPoint({\n x: x * window.devicePixelRatio,\n y: y * window.devicePixelRatio,\n }, annotation.pdfRect.page).pdfPoint;\n if (annotation.popup.pdfRect.pdfX !== newPdfPos.pdfX ||\n annotation.popup.pdfRect.pdfY !== newPdfPos.pdfY) {\n annotation.popup.pdfRect.pdfX = newPdfPos.pdfX;\n annotation.popup.pdfRect.pdfY = newPdfPos.pdfY - annotation.popup.pdfRect.pdfH;\n this.store.annotations.updateAnnotation(annotation);\n this.updateSelectedPopupContent(true, annotation);\n }\n }\n }\n }\n updatePopupSize(id, w, h) {\n if (this.pdfApi) {\n const annotation = this.pdfApi.getItem(id);\n if (annotation) {\n const newWidth = w / this.screenToPdfScale;\n const newHeight = h / this.screenToPdfScale;\n if (annotation.popup.pdfRect.pdfW !== newWidth ||\n annotation.popup.pdfRect.pdfH !== newHeight) {\n annotation.popup.pdfRect.pdfW = newWidth;\n annotation.popup.pdfRect.pdfH = newHeight;\n this.store.annotations.updateAnnotation(annotation);\n this.updateSelectedPopupContent(true, annotation);\n }\n }\n }\n }\n updatePopupColor(id, color) {\n if (this.pdfApi) {\n const annotation = this.pdfApi.getItem(id);\n if (annotation) {\n if (annotation.itemType === PdfItemType.TEXT ||\n annotation.itemType === PdfItemType.HIGHLIGHT ||\n annotation.itemType === PdfItemType.SQUIGGLY ||\n annotation.itemType === PdfItemType.UNDERLINE ||\n annotation.itemType === PdfItemType.STRIKE_OUT) {\n ;\n annotation.color = color;\n }\n else if (annotation.itemType === PdfItemType.INK ||\n annotation.itemType === PdfItemType.SQUARE ||\n annotation.itemType === PdfItemType.CIRCLE) {\n const newColor = new Color(color);\n const currentColor = new Color(annotation.color);\n newColor.setOpacity(currentColor.a);\n annotation.color = newColor.toRgba();\n }\n annotation.popup.color = color;\n this.store.annotations.updateAnnotation(annotation);\n this.updateSelectedPopupContent(true, annotation);\n }\n }\n }\n}\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { PopupLayer } from './PopupLayer';\nexport class PopupModule extends CanvasModule {\n constructor() {\n super();\n this.name = PopupModule.moduleInfo.name;\n }\n onRegister() {\n this.createCanvasLayer('popup', PopupLayer);\n return {};\n }\n activate() {\n return;\n }\n}\nPopupModule.moduleInfo = {\n name: 'PopupModule',\n moduleType: CanvasModuleType.Layer,\n requiredFeatures: {\n annotate: false,\n fillFormFields: false,\n },\n translationKey: 'a',\n icon: 'a',\n};\n","import { app, h } from '../../lib/hyperapp';\nimport { icons } from '../../common/icons';\nimport { Icon } from '../../common/Icon';\nimport { Loader } from '../../common/Loader';\nimport { translationManager } from '../../common/TranslationManager';\nexport var PaperFormat;\n(function (PaperFormat) {\n PaperFormat[PaperFormat[\"A4\"] = 0] = \"A4\";\n PaperFormat[PaperFormat[\"LETTER\"] = 1] = \"LETTER\";\n})(PaperFormat || (PaperFormat = {}));\nexport const createPrintServiceDialog = (props, element) => {\n const state = {\n pages: [],\n selectedFormat: PaperFormat.A4,\n radio_selection: 'all',\n printPending: false,\n };\n const actions = {\n setFormat: (format) => ($state) => {\n let selectedFormat = $state.selectedFormat;\n if (format === 0) {\n selectedFormat = PaperFormat.A4;\n }\n else if (format === 1) {\n selectedFormat = PaperFormat.LETTER;\n }\n return Object.assign(Object.assign({}, $state), { selectedFormat });\n },\n setRadioSelection: (sel) => ($state) => {\n return Object.assign(Object.assign({}, $state), { radio_selection: sel });\n },\n setPrintPending: (printPending) => ($state) => {\n return Object.assign(Object.assign({}, $state), { printPending });\n },\n };\n const App = () => (h(PrintServiceDialog, { print: props.print, cancel: props.cancel, pageCount: props.pageCount, currentPage: props.currentPage, parseRange: props.parseRange, validateRange: props.validateRange }));\n const PrintServiceDialog = ({ print, cancel, parseRange, validateRange }) => ($state, $actions) => (h(\"div\", { class: \"pwv-print-body\", id: \"pwv-print-body\" },\n h(\"div\", { class: \"pwv-print-title\" },\n h(Icon, { className: \"pwv-print-icon\", icon: icons.print, fill: '#008BD2' }),\n translationManager.getText('print.title')),\n $state.printPending ? (h(\"div\", null,\n h(Loader, null),\n h(\"div\", { class: \"pwv-print-bottom pwv-print-bottom-center\" },\n h(\"button\", { class: \"pwv-print-button-cancel\", onclick: () => {\n cancel();\n } }, translationManager.getText('print.cancel'))))) : (h(\"div\", null,\n h(\"div\", { class: \"pwv-print-pages\" },\n h(\"div\", { class: \"pwv-print-option\" },\n h(\"label\", null,\n h(\"input\", { type: \"radio\", id: \"all\", checked: $state.radio_selection === 'all' ? true : false, onclick: () => {\n $actions.setRadioSelection('all');\n } }),\n h(\"span\", { class: \"pwv-print-radio\" }),\n translationManager.getText('print.all'))),\n h(\"div\", { class: \"pwv-print-option\" },\n h(\"label\", null,\n h(\"input\", { type: \"radio\", id: \"current_page\", checked: $state.radio_selection === 'current_page' ? true : false, onclick: () => {\n $actions.setRadioSelection('current_page');\n } }),\n h(\"span\", { class: \"pwv-print-radio\" }),\n translationManager.getText('print.current'))),\n h(\"div\", { class: \"pwv-print-option\" },\n h(\"label\", null,\n h(\"input\", { type: \"radio\", id: \"range\", checked: $state.radio_selection === 'range' ? true : false, onclick: () => {\n $actions.setRadioSelection('range');\n } }),\n h(\"span\", { class: \"pwv-print-radio\" }),\n translationManager.getText('print.range')),\n h(\"input\", { class: \"pwv-print-page-range\", id: \"pwv-print-input-range\", type: \"text\", placeholder: \"e.g. 1,3-5\", onkeydown: (e) => {\n e.stopPropagation();\n }, onkeyup: (e) => {\n if (state.radio_selection !== 'range') {\n $actions.setRadioSelection('range');\n }\n const inputElement = document.getElementById('pwv-print-input-range');\n const errorMessage = document.getElementById('pwv-print-invalid-range-text');\n let bValidInput = false;\n if (validateRange(inputElement.value)) {\n const pages = parseRange(inputElement.value);\n bValidInput = !pages.some((page) => page > props.pageCount || page < 1);\n }\n if (bValidInput) {\n inputElement.classList.remove('pwv-print-invalid-input');\n errorMessage.style.display = 'none';\n }\n else {\n inputElement.classList.add('pwv-print-invalid-input');\n errorMessage.style.display = 'block';\n }\n } })),\n h(\"div\", { class: \"pwv-print-invalid-range-text\", id: \"pwv-print-invalid-range-text\" }, translationManager.getText('print.invalid'))),\n h(\"div\", { class: \"pwv-print-bottom\" },\n h(\"button\", { class: \"pwv-print-button-cancel\", onclick: () => {\n cancel();\n } }, translationManager.getText('print.cancel')),\n h(\"button\", { class: \"pwv-print-button-print\", onclick: () => {\n if ($state.radio_selection === 'all') {\n const pages = Array.from({ length: props.pageCount }, (x, i) => i + 1);\n print(pages, $state.selectedFormat);\n }\n if ($state.radio_selection === 'current_page') {\n print([props.currentPage], $state.selectedFormat);\n }\n if ($state.radio_selection === 'range') {\n const input = document.getElementById('pwv-print-input-range').value;\n const pages = parseRange(input);\n print(pages, $state.selectedFormat);\n }\n } }, translationManager.getText('print.print')))))));\n return app(state, actions, App, element);\n};\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { CanvasLayer } from '../CanvasLayer';\nimport { createPrintServiceDialog } from './PrintServiceDialog';\nconst moduleLayerName = 'PrintServiceLayer';\nexport class PrintServiceLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.printDialog = null;\n this.printElement = null;\n this.printIFrame = null;\n this.pageStyle = null;\n this.printPending = false;\n }\n onCreate() {\n this.startPrint = this.startPrint.bind(this);\n this.cancelPrint = this.cancelPrint.bind(this);\n this.validateRange = this.validateRange.bind(this);\n this.parseRange = this.parseRange.bind(this);\n this.stopTouchEventPropagation = this.stopTouchEventPropagation.bind(this);\n this.printElement = this.createHtmlLayer();\n this.printElement.className = 'pwv-print-dialog';\n this.printDialog = createPrintServiceDialog({\n pageCount: this.pdfApi.getPageCount(),\n currentPage: this.store.getState().document.firstVisiblePage,\n print: this.startPrint,\n cancel: this.cancelPrint,\n validateRange: this.validateRange,\n parseRange: this.parseRange,\n }, this.printElement);\n this.store.viewer.beginModule(moduleLayerName);\n this.printElement.addEventListener('touchstart', this.stopTouchEventPropagation);\n this.printElement.addEventListener('touchend', this.stopTouchEventPropagation);\n }\n startPrint(pages, format) {\n this.printPending = true;\n if (this.printDialog) {\n this.printDialog.setPrintPending(true);\n }\n if (!this.printIFrame) {\n this.printIFrame = document.createElement('iframe');\n this.printIFrame.style.display = 'none';\n document.body.appendChild(this.printIFrame);\n const doc = this.printIFrame.contentDocument;\n doc.open();\n doc.close();\n if (doc.head) {\n const styleElm = doc.createElement('style');\n styleElm.textContent = `\n @media print {\n @page {size:A4;margin:0;padding:0}\n body {margin:0;padding:0;background-color:white;height:100%;}\n .page {margin:0;width:100% !important; height:100% !important;overflow:hidden}\n .page img {display:block;margin:0;padding:0;width:100%;height:auto;max-height:100%;}\n .page:last-child { page-break-after: avoid; }\n }\n `;\n doc.head.append(styleElm);\n }\n }\n const printDocument = this.printIFrame.contentDocument;\n printDocument.body.innerHTML = '';\n const pageList = printDocument.createElement('div');\n printDocument.body.append(pageList);\n const pdfApi = this.pdfApi;\n const dpi = 150;\n // paper sizes\n const paperSizes = {\n a4: {\n width: 595,\n height: 842,\n },\n };\n const printerPaperSize = paperSizes.a4;\n // papersize in pixels for a4\n const paperSize = {\n width: (printerPaperSize.width / 72) * dpi,\n height: (printerPaperSize.height / 72) * dpi,\n };\n // canvas for image creation\n const canvas = printDocument.createElement('canvas');\n canvas.width = paperSize.width;\n canvas.height = paperSize.height;\n const ctx = canvas.getContext('2d');\n const renderNextPage = () => __awaiter(this, void 0, void 0, function* () {\n if (!this.printPending) {\n return;\n }\n const page = pages.shift();\n if (page) {\n const pageSize = yield pdfApi.getPagePdfSize(page);\n let pageWidth = (pageSize.width / 72) * dpi;\n let pageHeight = (pageSize.height / 72) * dpi;\n const isLandscape = pageWidth > pageHeight;\n //shrink page if the page is larger then lager then paper size\n let scale = 1;\n if (isLandscape) {\n scale = Math.min(paperSize.height / pageWidth, paperSize.width / pageHeight);\n }\n else {\n scale = Math.min(paperSize.width / pageWidth, paperSize.height / pageHeight);\n }\n if (scale < 1) {\n pageWidth = pageWidth * scale;\n pageHeight = pageHeight * scale;\n }\n const img = yield pdfApi.renderPage(page, pageWidth, pageHeight);\n if (ctx) {\n ctx.clearRect(0, 0, paperSize.width, paperSize.height);\n ctx.save();\n if (isLandscape) {\n // putImageData is not affected by the transformation matrix\n // need to draw draw to a tmp camvas\n const tmpCanvas = printDocument.createElement('canvas');\n tmpCanvas.width = img.imageData.width;\n tmpCanvas.height = img.imageData.height;\n const tmpCtx = tmpCanvas.getContext('2d');\n if (tmpCtx) {\n tmpCtx.putImageData(img.imageData, 0, 0);\n }\n const imgPosX = (paperSize.height - img.imageData.width) / 2;\n const imgPosY = (paperSize.width - img.imageData.height) / 2;\n ctx.translate(canvas.width, 0);\n ctx.rotate((90 * Math.PI) / 180);\n ctx.drawImage(tmpCanvas, imgPosX, imgPosY);\n // draw page rectangle for debugging\n // ctx.strokeStyle = 'blue'\n // ctx.lineWidth = 4\n // ctx.strokeRect(\n // imgPosX + 2,\n // imgPosY + 2,\n // img.imageData.width - 4,\n // img.imageData.height - 4\n // )\n }\n else {\n const imgPosX = (paperSize.width - pageWidth) / 2;\n const imgPosY = (paperSize.height - pageHeight) / 2;\n ctx.putImageData(img.imageData, imgPosX, imgPosY);\n // draw page rectangle for debugging\n // ctx.strokeStyle = 'red'\n // ctx.lineWidth = 4\n // ctx.strokeRect(\n // imgPosX + 2,\n // imgPosY + 2,\n // pageWidth - 4,\n // pageHeight - 4\n // )\n }\n ctx.restore();\n // create and append html elements to page list\n const pageElm = printDocument.createElement('div');\n pageElm.classList.add('page');\n pageList.append(pageElm);\n const imgSrc = canvas.toDataURL('image/png');\n const imgElm = printDocument.createElement('img');\n imgElm.src = imgSrc;\n pageElm.append(imgElm);\n }\n renderNextPage();\n }\n else {\n window.setTimeout(() => {\n this.printPending = false;\n if (this.printDialog) {\n this.printDialog.setPrintPending(false);\n }\n if (this.printIFrame && this.printIFrame.contentWindow) {\n this.printIFrame.contentWindow.print();\n }\n }, 100);\n }\n });\n renderNextPage();\n }\n cancelPrint() {\n this.printPending = false;\n this.remove();\n }\n stopTouchEventPropagation(e) {\n e.stopImmediatePropagation();\n }\n // Validate the provided page range\n validateRange(range) {\n // Only numbers, commas and dashes are allowed\n let regex = range.match(/^[\\d\\,\\-]*$/g);\n if (!regex || (regex && regex.length === 0)) {\n return false;\n }\n // Only single dashes and commas are allowed\n regex = range.match(/-{2,}|,{2,}/g);\n if (regex && regex.length > 0) {\n return false;\n }\n return true;\n }\n // Transform a range string into a list of pages\n // The range string should be validated first\n parseRange(range) {\n let pages = [];\n if (!this.validateRange(range)) {\n return [];\n }\n const splitInput = range.split(',');\n splitInput.forEach((input) => {\n const nDashes = (input.match(/-/g) || []).length;\n if (nDashes === 0) {\n // No dash, parse string as int and push\n // number to the list\n pages.push(parseInt(input, 10));\n }\n if (nDashes === 1) {\n const numbers = input.split('-');\n let firstPage = parseInt(numbers[0], 10);\n let lastPage = parseInt(numbers[1], 10);\n // this.printDialog.\n if (lastPage < firstPage) {\n const temp = firstPage;\n firstPage = lastPage;\n lastPage = temp;\n }\n const pageRange = Array.from({ length: lastPage - firstPage + 1 }, (v, k) => k + firstPage);\n pages = pages.concat(pageRange);\n }\n });\n return pages;\n }\n close() {\n this.remove();\n }\n onRemove() {\n var _a, _b;\n (_a = this.printElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.stopTouchEventPropagation);\n (_b = this.printElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.stopTouchEventPropagation);\n this.removeHtmlElements();\n this.printPending = false;\n this.printElement = null;\n if (this.pageStyle) {\n this.pageStyle.remove();\n }\n if (this.printIFrame) {\n document.body.removeChild(this.printIFrame);\n }\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (this.printElement && state.pointer.action === 'click') {\n const insideHorizontal = state.pointer.x.cssPixels > this.printElement.offsetLeft &&\n state.pointer.x.cssPixels < this.printElement.offsetLeft + this.printElement.offsetWidth;\n const insideVertical = state.pointer.y.cssPixels > this.printElement.offsetTop &&\n state.pointer.y.cssPixels < this.printElement.offsetTop + this.printElement.offsetHeight;\n if (!insideHorizontal || !insideVertical) {\n this.remove();\n return;\n }\n }\n }\n onSave() {\n return new Promise((resolve, rejct) => {\n return;\n });\n }\n}\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { PrintServiceLayer } from './PrintServiceLayer';\nexport class PrintServiceModule extends CanvasModule {\n constructor() {\n super();\n this.annotationbarElement = null;\n this.toolbarElement = null;\n this.name = PrintServiceModule.moduleInfo.name;\n this.activate = this.activate.bind(this);\n }\n onRegister() {\n return {};\n }\n activate() {\n /* tslint:disable-next-line:no-string-literal */\n if (!this.canvasLayers['add']) {\n this.createCanvasLayer('add', PrintServiceLayer);\n }\n }\n}\nPrintServiceModule.moduleInfo = {\n name: 'PrintServiceModule',\n moduleType: CanvasModuleType.Layer,\n requiredFeatures: {\n annotate: false,\n fillFormFields: false,\n },\n translationKey: 'a',\n icon: 'a',\n};\n","import { CanvasLayer } from '../CanvasLayer';\nimport { PdfItemType, AnnotationBorderStyle, } from '../../pdf-viewer-api';\nimport { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { getRectFromSelection } from '../../pdf-viewer-canvas/state/document';\nimport { createAddShapeAnnotationToolbar, } from './AddShapeAnnotationToolbar';\nimport { Color } from '../../common/Color';\nconst moduleLayerName = 'AddShapeAnnotation';\nexport class AddShapeAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.context = null;\n this.toolbar = null;\n this.page = 0;\n this.pointerDown = false;\n this.startPoint = null;\n this.itemType = null;\n this.strokeColors = [];\n this.fillColors = [];\n }\n onCreate(itemType) {\n this.setStrokeColor = this.setStrokeColor.bind(this);\n this.setStrokeWidth = this.setStrokeWidth.bind(this);\n this.setStrokeStyle = this.setStrokeStyle.bind(this);\n this.setFillColor = this.setFillColor.bind(this);\n this.setShape = this.setShape.bind(this);\n this.cancel = this.cancel.bind(this);\n this.context = this.createCanvas();\n this.itemType = itemType;\n const annotationOptions = this.options.annotation;\n this.strokeColors = annotationOptions.colors.foregroundColors;\n this.fillColors = annotationOptions.colors.backgroundColors;\n this.store.viewer.beginModule(moduleLayerName);\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n this.toolbar = createAddShapeAnnotationToolbar({\n strokeColors: this.strokeColors,\n strokeWidths: annotationOptions.strokeWidths,\n fillColors: this.fillColors,\n selectedStrokeColor: annotationOptions.colors.shapeColor,\n selectedStrokeWidth: annotationOptions.shapeStrokeWidth,\n selectedStrokeStyle: annotationOptions.shapeStrokeStyle,\n selectedFillColor: annotationOptions.colors.shapeFillColor,\n selectedShape: this.itemType,\n onStrokeColorChanged: this.setStrokeColor,\n onStrokeWidthChanged: this.setStrokeWidth,\n onStrokeStyleChanged: this.setStrokeStyle,\n onFillColorChanged: this.setFillColor,\n onShapeChanged: this.setShape,\n onCancel: this.cancel,\n }, toolbarElement);\n }\n cancel() {\n this.remove();\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n resolve();\n });\n return promise;\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (this.context) {\n const update = state.viewer.modeChanged ||\n state.pointer.positionChanged ||\n state.pointer.action ||\n state.document.zoomChanged;\n if (update) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const pointerPos = {\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n };\n const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);\n if (pointerPdfPos.isOnPage) {\n this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);\n }\n else {\n this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);\n }\n if (state.pointer.isDown) {\n if (!this.pointerDown) {\n this.startPoint = pointerPos;\n this.pointerDown = true;\n if (this.page === 0 && pointerPdfPos.isOnPage) {\n this.page = pointerPdfPos.pdfPoint.page;\n }\n }\n if (this.startPoint) {\n const rect = getRectFromSelection(state.document, {\n x: this.startPoint.x,\n y: this.startPoint.y,\n }, {\n x: pointerPos.x,\n y: pointerPos.y,\n }, this.page);\n const annotationOptions = this.options.annotation;\n if (rect) {\n ctx.save();\n const strokeColor = new Color(annotationOptions.colors.shapeColor);\n ctx.strokeStyle = strokeColor.toRgb();\n const fillColor = new Color(annotationOptions.colors.shapeFillColor);\n ctx.fillStyle = fillColor.toRgb();\n const lineWidth = annotationOptions.shapeStrokeWidth * devicePixelRatio * state.document.zoom;\n ctx.lineWidth = lineWidth;\n if (lineWidth) {\n ctx.globalAlpha = strokeColor.a;\n }\n else {\n ctx.globalAlpha = fillColor.a;\n }\n if (this.options.annotation.shapeStrokeStyle === AnnotationBorderStyle.DASHED) {\n ctx.setLineDash([ctx.lineWidth]);\n }\n if (this.itemType === PdfItemType.CIRCLE) {\n const cX = rect.x + rect.w / 2;\n const cY = rect.y + rect.h / 2;\n ctx.beginPath();\n ctx.ellipse(cX, cY, Math.max(rect.w / 2 - ctx.lineWidth / 2, 0), Math.max(rect.h / 2 - ctx.lineWidth / 2, 0), 0, 0, Math.PI * 2);\n if (fillColor.a) {\n ctx.fill();\n }\n if (annotationOptions.shapeStrokeWidth) {\n ctx.stroke();\n }\n }\n else {\n if (fillColor.a) {\n ctx.fillRect(rect.x, rect.y, rect.w, rect.h);\n }\n if (annotationOptions.shapeStrokeWidth) {\n ctx.strokeRect(rect.x + ctx.lineWidth / 2, rect.y + ctx.lineWidth / 2, rect.w - ctx.lineWidth, rect.h - ctx.lineWidth);\n }\n }\n ctx.restore();\n }\n }\n }\n else if (this.pointerDown && this.startPoint) {\n const rect = getRectFromSelection(state.document, {\n x: this.startPoint.x,\n y: this.startPoint.y,\n }, {\n x: pointerPos.x,\n y: pointerPos.y,\n }, this.page);\n if (rect) {\n this.pointerDown = false;\n this.startPoint = null;\n this.createRectangleAnnotation(rect);\n }\n }\n }\n }\n }\n setStrokeColor(color) {\n this.options.annotation.colors.shapeColor = color;\n }\n setShape(shape) {\n this.itemType = shape;\n }\n setStrokeWidth(width) {\n this.options.annotation.shapeStrokeWidth = width;\n }\n setStrokeStyle(style) {\n this.options.annotation.shapeStrokeStyle = style;\n }\n setFillColor(color) {\n this.options.annotation.colors.shapeFillColor = color;\n }\n createRectangleAnnotation(rect) {\n const pdfRect = this.pdfApi.transformScreenRectToPdfRect(rect, this.page);\n const annotationOptions = this.options.annotation;\n const annotation = {\n itemType: this.itemType,\n color: annotationOptions.colors.shapeColor,\n pdfRect,\n page: this.page,\n author: this.options.viewer.general.user,\n fillColor: annotationOptions.colors.shapeFillColor === 'transparent'\n ? null\n : annotationOptions.colors.shapeFillColor,\n border: {\n width: annotationOptions.shapeStrokeWidth,\n style: this.options.annotation.shapeStrokeStyle,\n },\n };\n this.pdfApi\n .createItem(annotation)\n .then(() => {\n this.remove();\n })\n .catch((err) => {\n console.error(err);\n });\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { PdfItemType } from '../../pdf-viewer-api';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { StrokeWidthPicker } from '../../common/StrokeWidthPicker';\nimport { StrokeStylePicker } from '../../common/StrokeStylePicker';\nimport { ColorPicker } from '../../common/ColorPicker';\nexport const createAddShapeAnnotationToolbar = (props, element) => {\n const state = {\n strokeColors: props.strokeColors,\n strokeWidths: props.strokeWidths,\n fillColors: props.fillColors,\n selectedShape: props.selectedShape,\n selectedStrokeColor: props.selectedStrokeColor,\n selectedStrokeWidth: props.selectedStrokeWidth,\n selectedStrokeStyle: props.selectedStrokeStyle,\n selectedFillColor: props.selectedFillColor,\n };\n const actions = {\n setShape: (shape) => ($state) => {\n props.onShapeChanged(shape);\n return Object.assign(Object.assign({}, $state), { selectedShape: shape });\n },\n setStrokeColor: (color) => ($state) => {\n props.onStrokeColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedStrokeColor: color });\n },\n setStrokeWidth: (width) => ($state) => {\n props.onStrokeWidthChanged(width);\n return Object.assign(Object.assign({}, $state), { selectedStrokeWidth: width });\n },\n setStrokeStyle: (style) => ($state) => {\n props.onStrokeStyleChanged(style);\n return Object.assign(Object.assign({}, $state), { selectedStrokeStyle: style });\n },\n setFillColor: (color) => ($state) => {\n props.onFillColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedFillColor: color });\n },\n setCancel: () => ($state) => {\n return Object.assign({}, $state);\n },\n };\n const App = () => h(AddShapeAnnotationToolbar, null);\n const AddShapeAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(ToolbarButton, { tooltip: translationManager.getText('annotShape.addRectangle'), icon: icons.rectangle, active: $state.selectedShape === PdfItemType.SQUARE, onClick: () => {\n $actions.setShape(PdfItemType.SQUARE);\n } }),\n h(ToolbarButton, { tooltip: translationManager.getText('annotShape.addEllipse'), icon: icons.circle, active: $state.selectedShape === PdfItemType.CIRCLE, onClick: () => {\n $actions.setShape(PdfItemType.CIRCLE);\n } }),\n h(ToolbarSeparator, null)),\n h(ToolbarItemGroup, null,\n h(StrokeWidthPicker, { tooltip: translationManager.getText('annotShape.strokeWidth'), noneStrokeText: translationManager.getText('border.none'), strokeWidths: $state.strokeWidths, value: $state.selectedStrokeWidth, onChange: $actions.setStrokeWidth }),\n h(StrokeStylePicker, { tooltip: translationManager.getText('annotShape.strokeStyle'), value: $state.selectedStrokeStyle, disabled: $state.selectedStrokeWidth === 0, onChange: $actions.setStrokeStyle, shapeType: $state.selectedShape === PdfItemType.CIRCLE ? 'circle' : 'rectangle' }),\n h(ColorPicker, { tooltip: translationManager.getText('annotShape.strokeColor'), colors: $state.strokeColors, color: $state.selectedStrokeColor, disabled: $state.selectedStrokeWidth === 0, icon: icons.pencil, onChange: $actions.setStrokeColor })),\n h(ToolbarItemGroup, null,\n h(ToolbarSeparator, null),\n h(ColorPicker, { tooltip: translationManager.getText('annotShape.bgColor'), colors: $state.fillColors, color: $state.selectedFillColor, icon: icons.fillColor, onChange: $actions.setFillColor })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onCancel }))));\n return app(state, actions, App, element);\n};\n","import { CanvasLayer } from '../CanvasLayer';\nimport { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { createEditShapeAnnotationToolbar, } from './EditShapeAnnotationToolbar';\nimport { Color } from '../../common/Color';\nconst moduleLayerName = 'EditShapeAnnotation';\nexport class EditShapeAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.shapeAnnotation = null;\n this.context = null;\n this.toolbar = null;\n this.strokeColors = [];\n this.fillColors = [];\n }\n onCreate(annotationId) {\n this.shapeAnnotation = this.pdfApi.getItem(annotationId);\n this.setStrokeColor = this.setStrokeColor.bind(this);\n this.setStrokeWidth = this.setStrokeWidth.bind(this);\n this.setStrokeStyle = this.setStrokeStyle.bind(this);\n this.setFillColor = this.setFillColor.bind(this);\n this.close = this.close.bind(this);\n const annotOptions = this.options.annotation;\n this.strokeColors = annotOptions.colors.foregroundColors;\n this.fillColors = annotOptions.colors.backgroundColors;\n this.context = this.createCanvas();\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n this.toolbar = createEditShapeAnnotationToolbar({\n strokeColors: this.strokeColors,\n strokeWidths: annotOptions.strokeWidths,\n fillColors: this.fillColors,\n selectedStrokeColor: this.shapeAnnotation.color\n ? this.shapeAnnotation.color\n : annotOptions.colors.shapeColor,\n selectedStrokeWidth: this.shapeAnnotation.border.width,\n selectedStrokeStyle: this.shapeAnnotation.border.style,\n selectedFillColor: this.shapeAnnotation.fillColor\n ? this.shapeAnnotation.fillColor\n : annotOptions.colors.shapeFillColor,\n itemType: this.shapeAnnotation.itemType,\n onStrokeColorChanged: this.setStrokeColor,\n onStrokeWidthChanged: this.setStrokeWidth,\n onStrokeStyleChanged: this.setStrokeStyle,\n onFillColorChanged: this.setFillColor,\n onCancel: this.close,\n }, toolbarElement);\n this.store.viewer.beginModule(moduleLayerName);\n }\n close() {\n this.remove();\n }\n onSave() {\n return new Promise((resolve, reject) => {\n resolve();\n });\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n var _a;\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (state.pointer.action === 'click' || state.pointer.action === 'dblclick') {\n const shapeAnnotation = (_a = this.pdfApi\n .getAnnotationsOnPoint({\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n })) === null || _a === void 0 ? void 0 : _a.find((a) => this.shapeAnnotation && a.id === this.shapeAnnotation.id);\n if (!shapeAnnotation) {\n this.close();\n return;\n }\n }\n if (this.context && this.shapeAnnotation) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const rect = this.pdfApi.transformPdfPageRectToScreenRect(this.shapeAnnotation.pdfRect);\n const lineWidth = 2 * devicePixelRatio;\n ctx.save();\n ctx.strokeStyle = this.options.viewer.general.textSelectionColor;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash([lineWidth, lineWidth]);\n ctx.strokeRect(rect.x - lineWidth, rect.y - lineWidth, rect.w + 2 * lineWidth, rect.h + 2 * lineWidth);\n ctx.restore();\n }\n }\n setStrokeColor(color) {\n if (this.shapeAnnotation && this.shapeAnnotation.color) {\n const newColor = new Color(color);\n const currentColor = new Color(this.shapeAnnotation.color);\n newColor.setOpacity(currentColor.a);\n this.shapeAnnotation.color = newColor.toRgba();\n this.updateShapeAnnotation();\n }\n }\n setStrokeWidth(width) {\n if (this.shapeAnnotation) {\n this.shapeAnnotation.border = {\n style: this.shapeAnnotation.border.style,\n width: width,\n };\n this.updateShapeAnnotation();\n }\n }\n setStrokeStyle(style) {\n if (this.shapeAnnotation) {\n this.shapeAnnotation.border = {\n style: style,\n width: this.shapeAnnotation.border.width,\n };\n this.updateShapeAnnotation();\n }\n }\n setFillColor(color) {\n if (this.shapeAnnotation) {\n const newColor = new Color(color);\n this.shapeAnnotation.fillColor = newColor.toRgba();\n this.updateShapeAnnotation();\n }\n }\n updateShapeAnnotation() {\n const promise = new Promise((resolve, reject) => {\n if (this.pdfApi && this.shapeAnnotation) {\n this.pdfApi\n .updateItem(this.shapeAnnotation)\n .then((item) => {\n resolve();\n })\n .catch((error) => {\n console.warn(error);\n });\n }\n else {\n reject();\n }\n });\n return promise;\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { PdfItemType } from '../../pdf-viewer-api';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { StrokeWidthPicker } from '../../common/StrokeWidthPicker';\nimport { StrokeStylePicker } from '../../common/StrokeStylePicker';\nimport { ColorPicker } from '../../common/ColorPicker';\nexport const createEditShapeAnnotationToolbar = (props, element) => {\n const state = {\n strokeColors: props.strokeColors,\n strokeWidths: props.strokeWidths,\n fillColors: props.fillColors,\n selectedStrokeColor: props.selectedStrokeColor,\n selectedStrokeWidth: props.selectedStrokeWidth,\n selectedStrokeStyle: props.selectedStrokeStyle,\n selectedFillColor: props.selectedFillColor,\n itemType: props.itemType,\n };\n const actions = {\n setStrokeColor: (color) => ($state) => {\n props.onStrokeColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedStrokeColor: color });\n },\n setStrokeWidth: (width) => ($state) => {\n props.onStrokeWidthChanged(width);\n return Object.assign(Object.assign({}, $state), { selectedStrokeWidth: width });\n },\n setStrokeStyle: (style) => ($state) => {\n props.onStrokeStyleChanged(style);\n return Object.assign(Object.assign({}, $state), { selectedStrokeStyle: style });\n },\n setFillColor: (color) => ($state) => {\n props.onFillColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedFillColor: color });\n },\n setCancel: () => ($state) => {\n return Object.assign({}, $state);\n },\n };\n const App = () => h(EditShapeAnnotationToolbar, null);\n const EditShapeAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(StrokeWidthPicker, { tooltip: translationManager.getText('annotShape.strokeWidth'), noneStrokeText: translationManager.getText('border.none'), strokeWidths: $state.strokeWidths, value: $state.selectedStrokeWidth, onChange: $actions.setStrokeWidth }),\n h(StrokeStylePicker, { tooltip: translationManager.getText('annotShape.strokeStyle'), value: $state.selectedStrokeStyle, disabled: $state.selectedStrokeWidth === 0, onChange: $actions.setStrokeStyle, shapeType: $state.itemType === PdfItemType.CIRCLE ? 'circle' : 'rectangle' }),\n h(ColorPicker, { tooltip: translationManager.getText('annotShape.strokeColor'), colors: $state.strokeColors, color: $state.selectedStrokeColor, disabled: $state.selectedStrokeWidth === 0, icon: icons.pencil, onChange: $actions.setStrokeColor })),\n h(ToolbarItemGroup, null,\n h(ToolbarSeparator, null),\n h(ColorPicker, { tooltip: translationManager.getText('annotShape.bgColor'), colors: $state.fillColors, color: $state.selectedFillColor, icon: icons.fillColor, onChange: $actions.setFillColor })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onCancel }))));\n return app(state, actions, App, element);\n};\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { AddShapeAnnotationLayer } from './AddShapeAnnotationLayer';\nimport { EditShapeAnnotationLayer } from './EditShapeAnnotationLayer';\nimport { PdfItemType } from '../../pdf-viewer-api';\nimport { icons } from '../../common/Icon';\nimport { translationManager } from '../../common/TranslationManager';\nexport class ShapeAnnotationModule extends CanvasModule {\n constructor() {\n super();\n this.annotationbarElement = null;\n this.toolbarElement = null;\n this.name = ShapeAnnotationModule.moduleInfo.name;\n this.onEdit = this.onEdit.bind(this);\n }\n onRegister() {\n this.toolbarElement = document.createElement('div');\n return {\n toolbar: this.toolbarElement,\n contextbar: {\n itemTypes: [PdfItemType.SQUARE, PdfItemType.CIRCLE],\n icon: icons.edit,\n tooltip: translationManager.getText('annotShape.edit'),\n onCmd: (annotationId) => {\n this.onEdit(annotationId);\n },\n },\n };\n }\n activate() {\n if (!this.canvasLayers['add']) {\n this.createCanvasLayer('add', AddShapeAnnotationLayer, PdfItemType.SQUARE);\n }\n else {\n this.removeCanvasLayer('add');\n }\n }\n onEdit(annotationId) {\n this.createCanvasLayer('edit', EditShapeAnnotationLayer, annotationId);\n }\n}\nShapeAnnotationModule.moduleInfo = {\n name: 'ShapeAnnotationModule',\n moduleType: CanvasModuleType.Tool,\n requiredFeatures: {\n annotate: true,\n fillFormFields: false,\n },\n translationKey: 'annotShape.add',\n icon: 'shapes',\n};\n","import { CanvasLayer } from '../CanvasLayer';\nimport { PdfItemType, StampAnnotationColor, } from '../../pdf-viewer-api';\nimport { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { getRectFromSelection } from '../../pdf-viewer-canvas/state/document';\nimport { createAddStampAnnotationToolbar } from './AddStampAnnotationToolbar';\nimport { translationManager } from '../../common/TranslationManager';\nimport { imageDataUrlToUint8Array } from '../../common/Tools';\nconst moduleLayerName = 'AddStampAnnotation';\nexport class AddStampAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.context = null;\n this.pointerDown = false;\n this.startPoint = null;\n this.stampRect = null;\n this.page = 0;\n this.screenPageRect = null;\n this.aspectRatio = null;\n this.stamps = [];\n }\n onCreate() {\n this.setStamp = this.setStamp.bind(this);\n this.close = this.close.bind(this);\n this.context = this.createCanvas();\n this.stamps = this.options.annotation.stamps;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n this.setStamp(this.options.annotation.selectedStamp);\n createAddStampAnnotationToolbar({\n selectedStamp: this.options.annotation.selectedStamp,\n stamps: this.stamps,\n onStampChanged: this.setStamp,\n onClose: this.close,\n }, toolbarElement);\n this.store.viewer.beginModule(moduleLayerName);\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n resolve();\n });\n return promise;\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (!this.aspectRatio) {\n return;\n }\n if (this.context) {\n const update = state.viewer.modeChanged ||\n state.pointer.positionChanged ||\n state.pointer.action ||\n state.document.zoomChanged;\n if (update) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const pointerPos = { x: state.pointer.x.devicePixels, y: state.pointer.y.devicePixels };\n const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);\n if (pointerPdfPos.isOnPage) {\n this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);\n }\n else {\n this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);\n }\n if (state.pointer.isDown) {\n if (!this.pointerDown) {\n if (!pointerPdfPos.isOnPage) {\n return;\n }\n this.startPoint = pointerPos;\n this.page = pointerPdfPos.pdfPoint.page;\n this.pointerDown = true;\n this.screenPageRect = this.pdfApi.getPageScreenRect(this.page);\n }\n if (this.startPoint && this.screenPageRect) {\n this.stampRect = getRectFromSelection(state.document, {\n x: this.startPoint.x,\n y: this.startPoint.y,\n }, {\n x: pointerPos.x,\n y: pointerPos.y,\n });\n if (this.stampRect) {\n this.stampRect.h = this.stampRect.w / this.aspectRatio;\n const lineWidth = 2 * devicePixelRatio;\n ctx.save();\n ctx.strokeStyle = this.options.viewer.general.textSelectionColor;\n ctx.fillStyle = this.options.viewer.general.textSelectionColor;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash([lineWidth, lineWidth]);\n if (this.startPoint.y > pointerPos.y) {\n this.stampRect.y = this.startPoint.y - this.stampRect.h;\n if (this.stampRect.y < this.screenPageRect.y) {\n this.stampRect.y = this.screenPageRect.y;\n this.stampRect.w = this.stampRect.h * this.aspectRatio;\n }\n }\n else {\n if (this.startPoint.y + this.stampRect.h >\n this.screenPageRect.y + this.screenPageRect.h) {\n this.stampRect.h =\n this.screenPageRect.y + this.screenPageRect.h - this.startPoint.y;\n this.stampRect.w = this.stampRect.h * this.aspectRatio;\n }\n }\n ctx.strokeRect(this.stampRect.x, this.stampRect.y, this.stampRect.w, this.stampRect.h);\n ctx.globalAlpha = 0.33;\n ctx.fillRect(this.stampRect.x, this.stampRect.y, this.stampRect.w, this.stampRect.h);\n ctx.restore();\n }\n }\n }\n else if (this.pointerDown && this.startPoint) {\n if (this.stampRect) {\n this.createStampAnnotation(this.stampRect);\n this.pointerDown = false;\n this.startPoint = null;\n this.stampRect = null;\n this.page = 0;\n this.aspectRatio = null;\n this.screenPageRect = null;\n this.remove();\n return;\n }\n }\n }\n }\n }\n close() {\n this.remove();\n }\n setStamp(stampIndex) {\n if (this.stamps.length == 0) {\n return;\n }\n if (stampIndex >= this.stamps.length) {\n stampIndex = 0;\n }\n this.options.annotation.selectedStamp = stampIndex;\n const stamp = this.stamps[stampIndex];\n // todo: handle pdf stamps\n if (stamp.aspectRatio) {\n this.aspectRatio = stamp.aspectRatio;\n return;\n }\n if (stamp.image) {\n const img = new Image();\n img.onload = () => {\n this.aspectRatio = img.width / img.height;\n };\n img.src = stamp.image;\n return;\n }\n this.pdfApi\n .getTextStampAspectRatio(stamp.text ? stamp.text : translationManager.getText(stamp.translation_key))\n .then((aspectRatio) => {\n this.aspectRatio = aspectRatio;\n });\n }\n createStampAnnotation(rect) {\n const pdfRect = this.pdfApi.transformScreenRectToPdfRect(rect, this.page);\n if (this.aspectRatio && (pdfRect.pdfW < 2 || pdfRect.pdfH < 2)) {\n switch (this.pdfApi.getRotation()) {\n case 0:\n pdfRect.pdfW = this.options.annotation.defaultStampWidth;\n pdfRect.pdfH = pdfRect.pdfW / this.aspectRatio;\n pdfRect.pdfY -= pdfRect.pdfH;\n break;\n case 90:\n pdfRect.pdfH = this.options.annotation.defaultStampWidth;\n pdfRect.pdfW = pdfRect.pdfH / this.aspectRatio;\n break;\n case 180:\n pdfRect.pdfW = this.options.annotation.defaultStampWidth;\n pdfRect.pdfH = pdfRect.pdfW / this.aspectRatio;\n pdfRect.pdfX -= pdfRect.pdfW;\n break;\n case 270:\n pdfRect.pdfH = this.options.annotation.defaultStampWidth;\n pdfRect.pdfW = pdfRect.pdfH / this.aspectRatio;\n pdfRect.pdfX -= pdfRect.pdfW;\n pdfRect.pdfY -= pdfRect.pdfH;\n break;\n default:\n break;\n }\n }\n const stampSetting = this.stamps[this.options.annotation.selectedStamp];\n if (stampSetting.pdfStampFileName) {\n this.pdfApi\n .registerPdfPage(stampSetting.pdfStampFileName, stampSetting.pageNumber)\n .then((imageId) => {\n const annotation = {\n itemType: PdfItemType.STAMP,\n imageId,\n page: pdfRect.page,\n color: this.options.annotation.colors.defaultHighlightColor,\n pdfRect,\n author: this.options.viewer.general.user,\n };\n this.pdfApi.createItem(annotation).then((annot) => {\n this.onAnnotationCreated(annot);\n });\n });\n }\n else if (stampSetting.image) {\n const imgData = imageDataUrlToUint8Array(stampSetting.image);\n this.pdfApi.registerStampImage(imgData).then((imageId) => {\n const annotation = {\n itemType: PdfItemType.STAMP,\n imageId,\n page: pdfRect.page,\n color: this.options.annotation.colors.defaultHighlightColor,\n pdfRect,\n author: this.options.viewer.general.user,\n };\n this.pdfApi.createItem(annotation).then((annot) => {\n this.onAnnotationCreated(annot);\n });\n });\n }\n else {\n let stampColor = null;\n let stampName = null;\n if (stampSetting) {\n stampColor = stampSetting.color;\n stampName = stampSetting.pdfStampName !== undefined ? stampSetting.pdfStampName : null;\n }\n const annotation = {\n itemType: PdfItemType.STAMP,\n color: this.options.annotation.colors.defaultHighlightColor,\n author: this.options.viewer.general.user,\n page: pdfRect.page,\n pdfRect,\n stampName,\n stampText: stampSetting.text\n ? stampSetting.text\n : translationManager.getText(stampSetting.translation_key),\n stampColor: stampColor != null ? stampColor : StampAnnotationColor.GREEN,\n };\n this.pdfApi.createItem(annotation).then((annot) => {\n this.onAnnotationCreated(annot);\n });\n }\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { translationManager } from '../../common/TranslationManager';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { Dropdown } from '../../common/Dropdown';\nexport const createAddStampAnnotationToolbar = (props, element) => {\n const state = {\n stamps: props.stamps,\n stampDropdownItems: [],\n selectedStamp: props.selectedStamp,\n };\n const actions = {\n setStamp: (stamp) => ($state) => {\n props.onStampChanged(stamp);\n return Object.assign(Object.assign({}, $state), { selectedStamp: stamp });\n },\n };\n const DropdownStampItem = (item) => {\n const stamp = state.stamps[item.value];\n if (stamp.thumbnail) {\n return (h(\"div\", null,\n h(\"img\", { src: stamp.thumbnail })));\n }\n // todo: handle pdf stamps\n if (stamp.name) {\n return h(\"div\", null, stamp.name);\n }\n return (h(\"div\", null, stamp.image\n ? stamp.name\n : stamp.text\n ? stamp.text\n : translationManager.getText(stamp.translation_key)));\n };\n const DropdownButton = (value) => {\n if (value === -1) {\n return (h(\"div\", { class: \"pwv-Dropdown-text\" }, translationManager.getText('annotStamp.chooseStamp')));\n }\n const stamp = state.stamps[value];\n if (stamp.thumbnail) {\n return (h(\"div\", { class: \"pwv-Dropdown-text\" },\n h(\"img\", { src: stamp.thumbnail })));\n }\n // todo: handle pdf stamps\n if (stamp.pdfStampFileName) {\n return h(\"div\", { class: \"pwv-Dropdown-text\" }, stamp.name);\n }\n return (h(\"div\", { class: \"pwv-Dropdown-text\" }, stamp.image\n ? stamp.name\n : stamp.text\n ? stamp.text\n : translationManager.getText(stamp.translation_key)));\n };\n const App = () => h(AddStampAnnotationToolbar, null);\n /* tslint:disable-next-line:max-line-length */\n const AddStampAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(Dropdown, { className: \"pwv-stampannotation-dropdown\", value: $state.selectedStamp, items: $state.stamps.map((stamp, index) => ({\n value: index,\n renderItem: DropdownStampItem,\n })), onChange: $actions.setStamp, renderButton: DropdownButton })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onClose }))));\n return app(state, actions, App, element);\n};\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { AddStampAnnotationLayer } from './AddStampAnnotationLayer';\nexport class StampAnnotationModule extends CanvasModule {\n constructor() {\n super();\n this.annotationbarElement = null;\n this.toolbarElement = null;\n this.name = StampAnnotationModule.moduleInfo.name;\n this.activate = this.activate.bind(this);\n }\n onRegister() {\n this.toolbarElement = document.createElement('div');\n return {\n toolbar: this.toolbarElement,\n };\n }\n activate() {\n if (!this.canvasLayers['add']) {\n this.createCanvasLayer('add', AddStampAnnotationLayer);\n }\n else {\n this.removeCanvasLayer('add');\n }\n }\n}\nStampAnnotationModule.moduleInfo = {\n name: 'StampAnnotationModule',\n moduleType: CanvasModuleType.Tool,\n requiredFeatures: {\n annotate: true,\n fillFormFields: false,\n },\n translationKey: 'annotStamp.add',\n icon: 'stamp',\n};\n","import { CanvasLayer } from '../CanvasLayer';\nimport { PdfItemType, } from '../../pdf-viewer-api';\nimport { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';\nimport { renderStickyNote } from '../../pdf-viewer-canvas/view-layers/canvasShapes';\nimport { createAddTextAnnotationToolbar } from './AddTextAnnotationToolbar';\nconst moduleLayerName = 'AddTextAnnotation';\nexport class AddTextAnnotationLayer extends CanvasLayer {\n constructor() {\n super(...arguments);\n this.colors = [];\n this.selectedColor = '';\n }\n onCreate() {\n this.setColor = this.setColor.bind(this);\n this.close = this.close.bind(this);\n this.context = this.createCanvas();\n this.colors = this.options.annotation.colors.highlightColors;\n this.selectedColor = this.options.annotation.colors.stickyNoteColor;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n createAddTextAnnotationToolbar({\n colors: this.colors,\n selectedColor: this.selectedColor,\n onColorChanged: this.setColor,\n onClose: this.close,\n }, toolbarElement);\n this.store.viewer.beginModule(moduleLayerName);\n }\n onSave() {\n const promise = new Promise((resolve, reject) => {\n resolve();\n });\n return promise;\n }\n onRemove() {\n this.removeCanvasElements();\n this.context = null;\n /* tslint:disable-next-line:align */\n const toolbarElement = this.module.toolbarElement;\n toolbarElement.innerHTML = '';\n this.store.viewer.endModule(moduleLayerName);\n }\n render(timestamp, state) {\n if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {\n this.remove();\n return;\n }\n if (this.context &&\n (state.viewer.modeChanged ||\n state.pointer.positionChanged ||\n state.pointer.action ||\n state.canvas.canvasInvalidated)) {\n const ctx = this.context;\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const scale = state.canvas.pixelRatio * state.document.zoom;\n const s = 6 * scale;\n const h = 22 * scale;\n const rect = {\n w: 26 * scale,\n h,\n x: state.pointer.x.devicePixels - s,\n y: state.pointer.y.devicePixels - h,\n };\n let rectOnPage = false;\n for (const k in state.document.pageRects) {\n if (state.document.pageRects[k]) {\n const p = state.document.pageRects[k];\n const px2 = p.x + p.w;\n const rx2 = rect.x + rect.w;\n const py2 = p.y + p.h;\n const ry2 = rect.y + rect.h;\n if (rect.x >= p.x && rx2 <= px2 && rect.y >= p.y && ry2 <= py2) {\n rectOnPage = true;\n break;\n }\n }\n }\n if (rectOnPage) {\n if (state.pointer.type === 'mouse') {\n renderStickyNote(ctx, scale, rect, this.selectedColor, '#000000');\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n }\n if (state.pointer.action === 'click') {\n rect.y = rect.y;\n this.createTextAnnotation(rect, this.selectedColor);\n this.remove();\n return;\n }\n }\n else {\n this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);\n }\n }\n }\n setColor(color) {\n this.selectedColor = color;\n this.options.annotation.colors.stickyNoteColor = color;\n }\n close() {\n this.remove();\n }\n createTextAnnotation(point, color) {\n const pdfPoint = this.pdfApi.transformScreenPointToPdfPoint({\n x: point.x,\n y: point.y,\n }).pdfPoint;\n const annotation = {\n itemType: PdfItemType.TEXT,\n color,\n author: this.options.viewer.general.user,\n page: pdfPoint.page,\n isOpen: true,\n pdfRect: {\n pdfX: pdfPoint.pdfX,\n pdfY: pdfPoint.pdfY,\n pdfW: 0,\n pdfH: 0,\n page: pdfPoint.page,\n },\n };\n this.pdfApi.createItem(annotation).then((item) => {\n const annot = item;\n const annotation = this.pdfApi.getItem(annot.id);\n if (annotation) {\n annotation.popup.isOpen = true;\n this.store.annotations.updateAnnotation(annotation);\n this.store.viewer.selectPopup({ id: annot.id, focus: true });\n }\n this.onAnnotationCreated(annot);\n });\n }\n}\n","import { app, h } from '../../lib/hyperapp';\nimport { Toolbar } from '../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../common/ToolbarButton';\nimport { icons } from '../../common/icons';\nimport { ToolbarSeparator } from '../../common/ToolbarSeparator';\nimport { ColorPicker } from '../../common/ColorPicker';\nexport const createAddTextAnnotationToolbar = (props, element) => {\n const state = {\n colors: props.colors,\n selectedColor: props.selectedColor,\n };\n const actions = {\n setColor: (color) => ($state) => {\n props.onColorChanged(color);\n return Object.assign(Object.assign({}, $state), { selectedColor: color });\n },\n };\n const App = () => h(AddTextAnnotationToolbar, null);\n const AddTextAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },\n h(ToolbarItemGroup, null,\n h(ColorPicker, { colors: $state.colors, color: $state.selectedColor, icon: icons.fillColor, mode: \"buttons\", onChange: $actions.setColor })),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarSeparator, null),\n h(ToolbarButton, { icon: icons.close, onClick: props.onClose }))));\n return app(state, actions, App, element);\n};\n","import { CanvasModule, CanvasModuleType } from '../CanvasModule';\nimport { AddTextAnnotationLayer } from './AddTextAnnotationLayer';\nexport class TextAnnotationModule extends CanvasModule {\n constructor() {\n super();\n this.toolbarElement = null;\n this.name = TextAnnotationModule.moduleInfo.name;\n this.activate = this.activate.bind(this);\n }\n onRegister() {\n this.toolbarElement = document.createElement('div');\n return {\n toolbar: this.toolbarElement,\n };\n }\n activate() {\n if (!this.canvasLayers['add']) {\n this.createCanvasLayer('add', AddTextAnnotationLayer);\n }\n else {\n this.removeCanvasLayer('add');\n }\n }\n}\nTextAnnotationModule.moduleInfo = {\n name: 'TextAnnotationModule',\n moduleType: CanvasModuleType.Tool,\n requiredFeatures: {\n annotate: true,\n fillFormFields: false,\n },\n translationKey: 'annotText.add',\n icon: 'stickyNote',\n};\n","const isFirefox = /Firefox/i.test(navigator.userAgent);\nexport class ImageContainer {\n constructor(image) {\n this._imageBitmap = null;\n this._imageData = null;\n this._htmlCanvas = null;\n if (image.bufferView) {\n if (image.hasImageData) {\n this._imageData = new ImageData(new Uint8ClampedArray(image.bufferView), image.width, image.height);\n }\n else {\n throw new Error('Cannot create an image container of image without imageData');\n }\n image.removeImageData();\n if (!isFirefox && typeof window.createImageBitmap === 'function') {\n createImageBitmap(this._imageData).then((imageBitmap) => {\n this._imageBitmap = imageBitmap;\n });\n }\n else {\n this._htmlCanvas = document.createElement('canvas');\n this._htmlCanvas.width = image.width;\n this._htmlCanvas.height = image.height;\n const ctx = this._htmlCanvas.getContext('2d');\n ctx && ctx.putImageData(this._imageData, 0, 0);\n }\n }\n }\n get scaledImage() {\n if (this._imageBitmap) {\n return this._imageBitmap;\n }\n return this._htmlCanvas;\n }\n get imageData() {\n return this._imageData;\n }\n destroy() {\n this._imageBitmap = null;\n this._imageData = null;\n this._htmlCanvas = null;\n }\n}\n","import { PdfViewing } from '../pdf-viewing/PdfViewing';\nimport { PdfItemCategory } from './enums';\nimport { PdfViewingWrapper } from './PdfViewingWrapper';\nconst checkType = (object, typeName, methodName, optional = false) => {\n if (!optional && (object === null || typeof object !== typeName)) {\n throw new TypeError(`Method ${methodName} requires argument of type '${typeName}' but is '${typeof object}'`);\n }\n};\nconst checkLicense = (instance) => {\n if (!instance)\n throw new Error('License is not set.');\n};\nexport class PdfViewerApi {\n constructor(pdfViewerApiOptions) {\n this.eventListeners = new Map();\n this.open = this.open.bind(this);\n this.save = this.save.bind(this);\n this.pdfViewerApiOptions = pdfViewerApiOptions;\n /* iOS warns whenever an app uses resources too aggressively.\n * For Cordova this plugin redirects this warning as an event to the document.\n * When triggered flush the render cache.\n * https://www.npmjs.com/package/cordova-plugin-memory-warning\n */\n // document.addEventListener('memorywarning', this.instance.forceFlushCache, {passive: false})\n }\n /**\n *\n * Open a PDF and optionally one or more associated FDF's.\n * @param pdfFile The PDF File that should be opened.\n * @param fdfFiles A list of FDF or XFDF files associated with this PDF that should be opened.\n * @param password The password used for opening this file.\n * @param viewOptions ViewOptions.\n */\n open(pdfFile, fdfFiles, password, viewOptions, renderOptions, viewportSize) {\n checkLicense(this.instance);\n return this.instance.open(pdfFile, fdfFiles, password, viewOptions, renderOptions, viewportSize);\n }\n /**\n * Save the currently opened PDF file.\n * @param fileType Whether the file should be saved as\n * a PDF containing the document and annotations,\n * or an FDF containing ONLY the annotations.\n *\n * @returns A promise returning a memory buffer containing the saved file if resolved or an error message if rejected.\n */\n save(saveOptions) {\n checkLicense(this.instance);\n return this.instance.save(saveOptions);\n }\n /**\n * Close the currently opened PDF file.\n * @returns A promise returning nothing if resolved and an error message if rejected.\n */\n close() {\n checkLicense(this.instance);\n return this.instance.close();\n }\n /**\n * dispose the api.\n */\n destroy() {\n checkLicense(this.instance);\n this.instance.destroy();\n }\n /**\n * Registers pdf documents to use as stamp\n *\n */\n registerPdfStampFile(pdfStampFileName, data, onStampCreated) {\n checkLicense(this.instance);\n this.instance.registerPdfStampFile(pdfStampFileName, data, onStampCreated);\n }\n /**\n * Clear the rendered pages cache to free memory.\n */\n forceFlushCache() {\n checkLicense(this.instance);\n this.instance.forceFlushCache();\n }\n /**\n * Get the current maximum size of the rendered pages cache.\n * @returns The current maximum cache size in MB.\n */\n getMaxCacheSize() {\n checkLicense(this.instance);\n return this.instance.getMaxCacheSize();\n }\n /**\n * Set the maximum size of the rendered pages cache.\n * @param cacheSize The maximum cache size in MB. Default is 120 MB.\n */\n setMaxCacheSize(cacheSize) {\n checkLicense(this.instance);\n this.instance.setMaxCacheSize(cacheSize);\n }\n /**\n * Get the total page count of the opened document.\n * @returns The total number of pages of the currently opened file.\n * 0 if no document is open.\n */\n getPageCount() {\n checkLicense(this.instance);\n return this.instance.getPageCount();\n }\n /**\n * Get the page number of the first visible page.\n * @returns The number of the topmost page shown in the viewport at this moment.\n */\n getPageNumber() {\n checkLicense(this.instance);\n return this.instance.getPageNumber();\n }\n getLastVisiblePage() {\n checkLicense(this.instance);\n return this.instance.getLastVisiblePage();\n }\n getFirstVisiblePage() {\n checkLicense(this.instance);\n return this.instance.getFirstVisiblePage();\n }\n /**\n * Go to a given page.\n * @param pageNumber The number of the page to be shown in the viewport.\n */\n setPageNumber(pageNumber) {\n checkType(pageNumber, 'number', 'setPageNumber');\n checkLicense(this.instance);\n this.instance.setPageNumber(pageNumber);\n }\n /**\n * Get the viewer rotation.\n * @returns The currently used viewer rotation on all pages.\n */\n getRotation() {\n checkLicense(this.instance);\n return this.instance.getRotation();\n }\n /**\n * Set the viewer rotation.\n * NOTE: This only changes the view of the document and is not an operation on the document.\n * @param rotation The rotation to be applied on all pages (cumulative with the embedded rotation per page).\n */\n setRotation(rotation) {\n checkType(rotation, 'number', 'setRotation');\n checkLicense(this.instance);\n this.instance.setRotation(rotation);\n }\n /**\n * Get the viewer zoom.\n * @returns The currently used zoom factor.\n */\n getZoom() {\n checkLicense(this.instance);\n return this.instance.getZoom();\n }\n /**\n * Set the viewer zoom.\n * @param zoom The zoom factor as a percentage of the original size.\n */\n setZoom(zoom, location) {\n checkType(zoom, 'number', 'setZoom');\n checkLicense(this.instance);\n this.instance.setZoom(zoom, location);\n }\n /**\n * Get the maximum scroll position.\n * @returns The maximum scroll position in device pixels.\n */\n getScrollMaxPosition() {\n checkLicense(this.instance);\n return this.instance.getScrollMaxPosition();\n }\n /**\n * Get the current scroll position.\n * @returns The current scroll position in device pixels.\n */\n getScrollPosition() {\n checkLicense(this.instance);\n return this.instance.getScrollPosition();\n }\n /**\n * Set the scroll position.\n * @param pos The scroll position to be shown in the viewer.\n */\n setScrollPosition(pos) {\n checkLicense(this.instance);\n this.instance.setScrollPosition(pos);\n }\n /**\n * Jump to a given destination in the document.\n * @param destination The target destination in PDF coordinates (page origin bottom left)\n */\n goTo(destination) {\n checkLicense(this.instance);\n this.instance.goTo(destination);\n }\n /**\n * Jump ot a given viewer destination in the document\n * @param destination The target destination in viewer coordinates (page origin top left)\n */\n goToViewerDestination(destination) {\n checkLicense(this.instance);\n this.instance.goTo(destination);\n }\n /**\n * Navigate the viewport to show the given Rectangle by scrolling and zooming as little as possible.\n * @param pdfRect The target destination in PDF coordinates (page origin bottom left)\n */\n goToRectangle(rectangle) {\n checkLicense(this.instance);\n this.instance.goToRectangle(rectangle);\n }\n /**\n * Check if a document is opened\n * @returns Whether a file is opened by the viewer.\n * A file counts as open if opening it has completed successfully\n * and closing it has not started yet.\n */\n isOpen() {\n checkLicense(this.instance);\n return this.instance.getIsOpen();\n }\n /**\n * Set the page layout mode.\n * @param mode The mode to be used for arranging pages on the canvas.\n */\n setPageLayoutMode(mode) {\n checkLicense(this.instance);\n this.instance.setPageLayoutMode(mode);\n }\n /**\n * Get the current page layout mode.\n * @returns The mode that is currently used for arranging pages on the canvas.\n */\n getPageLayoutMode() {\n checkLicense(this.instance);\n return this.instance.getPageLayoutMode();\n }\n /**\n * Set the fit mode.\n * @param fitMode The mode to be used for fitting the viewport to the visible pages.\n */\n setFitMode(fitMode) {\n checkLicense(this.instance);\n this.instance.setFitMode(fitMode);\n }\n /**\n * Get the current fit mode.\n * @returns The mode that is currently used for fitting the viewport to the visible pages.\n */\n getFitMode() {\n checkLicense(this.instance);\n return this.instance.getFitMode();\n }\n /**\n * Get the size of the border shown in between pages.\n * @returns The border size in pixels at 100% zoom.\n */\n getBorderSize() {\n checkLicense(this.instance);\n return this.instance.getBorderSize();\n }\n /**\n * Set the size of the border shown in between pages.\n * @param borderSize The border size in pixels at 100% zoom.\n */\n setBorderSize(borderSize) {\n checkLicense(this.instance);\n const ret = this.instance.setBorderSize(borderSize);\n if (!ret.ok) {\n throw new Error(ret.message);\n }\n }\n /**\n * Get the sliding window size.\n * @returns The number of pages the viewer renders before and after the visible pages.\n */\n getSlidingWindowSize() {\n checkLicense(this.instance);\n return this.instance.getSlidingWindowSize();\n }\n /**\n * Set the sliding window size.\n * NOTE: Changing this value will impact caching behavior, because the sliding\n * window has priority over cache size. This means that the cache can grow beyond\n * the set cache limit if the sliding window is very large.\n * @param slidingWindowSize The number of pages the viewer renders before and after the visible pages.\n */\n setSlidingWindowSize(slidingWindowSize) {\n checkType(slidingWindowSize, 'number', 'setSlidingWindowSize');\n checkLicense(this.instance);\n const ret = this.instance.setSlidingWindowSize(slidingWindowSize);\n if (!ret.ok) {\n throw new Error(ret.message);\n }\n }\n /**\n * Suspend drawing for all actions until {@link PdfWebViewer#resumeDrawing|resumeDrawing} is called.\n */\n suspendDrawing() {\n checkLicense(this.instance);\n this.instance.suspendDrawing();\n }\n /**\n * Resume drawing if currently suspended by {@link PdfWebViewer#suspendDrawing|suspendDrawing}.\n * NOTE: previously given commands that have not yet been executed will not trigger separate render updates.\n * However, a single render update will be made once all commands before the resumeDrawing call have been executed.\n */\n resumeDrawing() {\n checkLicense(this.instance);\n this.instance.resumeDrawing();\n }\n /**\n * Draw into the canvas to update the viewport.\n * This method has to be called whenever the canvas has been invalidated or after zoom/scroll.\n * @param context The canvas context in which the viewer will render.\n */\n renderCanvas(context, options) {\n checkLicense(this.instance);\n this.instance.renderCanvas(context, options);\n }\n /**\n * Explicitly render a page with the given dimensions.\n * The width and height will be adjusted to the aspect ratio of the page, clamping it to the smaller of the two values.\n * @param pageNumber The number of the page to be rendered.\n * @param width The width of the output file.\n * @param height The height of the output file.\n * @returns A promise returning PageImage if resolved or returning an error message if rejected.\n */\n renderPage(pageNumber, width, height) {\n checkLicense(this.instance);\n return this.instance.renderPage(pageNumber, width, height);\n }\n rotatePage(pageNumber, direction) {\n checkLicense(this.instance);\n return this.instance.rotatePage(pageNumber, direction);\n }\n /**\n * Returns the size of a PDF page\n * @param pageNumber The number of the page.\n */\n getPagePdfSize(pageNumber) {\n checkLicense(this.instance);\n return this.instance.getPagePdfSize(pageNumber);\n }\n /**\n * Set whether embedded preferences for the startup viewport should be ignored\n * when opening a PDF file (first shown page, fitmode etc.).\n * @param ignore Whether the embedded preferences should be ignored.\n */\n setIgnoringPreferences(ignore) {\n checkLicense(this.instance);\n this.instance.setIgnoringPreferences(ignore);\n }\n /**\n * Get whether embedded preferences are ignored when opening a PDF file.\n * @returns Whether embedded preferences are ignored.\n */\n getIgnoringPreferences() {\n checkLicense(this.instance);\n return this.instance.getIgnoringPreferences();\n }\n /**\n * Get the product version of the viewer.\n * @returns The product version of the PDF Web Viewer.\n */\n getProductVersion() {\n return PdfViewing.Sdk.version;\n }\n /**\n * Load outlines for a given parent.\n * Can be used to call recursively on children which have descendants.\n * @param parent The parent outline item. If null then the root outline will be loaded.\n * @returns A promise with the children of the parent outline.\n */\n getOutlines(parent) {\n checkLicense(this.instance);\n return this.instance.getOutlines(parent);\n }\n /**\n * Get the text fragment located at a given position.\n * @param point The point in PDF coordinates.\n * @returns The text fragment or null if no text fragment can be found at the given point.\n */\n getTextFragmentOnPoint(point) {\n checkType(point, 'object', 'getTextFragmentOnPoint');\n checkLicense(this.instance);\n return this.instance.getTextFragmentOnPoint(point);\n }\n /**\n * Get the text selection for a word located at a given position.\n * @param point The point in PDF coordinates.\n * @returns The text selection or null if no word can be found at the given point.\n */\n getWordOnPoint(point) {\n checkType(point, 'object', 'getWordOnPoint');\n checkLicense(this.instance);\n return this.instance.getWordOnPoint(point);\n }\n /**\n * Get the text selection rectangles between the two points.\n * @param startPoint The starting point of the selection in PDF coordinates.\n * @param endPoint The end point of the selection in PDF coordinates.\n * @returns The rectangles of the text fragments contained between the two points.\n */\n getTextSelection(startPoint, endPoint) {\n checkLicense(this.instance);\n return this.instance.getTextSelection(startPoint, endPoint);\n }\n /**\n * Returns a text selection of all text within a rectangle.\n * @param startPoint The starting point of the selection in PDF coordinates.\n * @param endPoint The end point of the selection in PDF coordinates.\n * @returns The rectangles of the text fragments contained between the two points.\n */\n getRectangularTextSelection(startPoint, endPoint) {\n checkLicense(this.instance);\n return this.instance.getRectangularTextSelection(startPoint, endPoint);\n }\n /**\n * Get the text between the two points.\n * @param startPoint The starting point of the selection in PDF coordinates.\n * @param endPoint The end point of the selection in PDF coordinates.\n * @returns The string of the selected text.\n */\n getText(startPoint, endPoint) {\n checkLicense(this.instance);\n return this.instance.getText(startPoint, endPoint);\n }\n /**\n * Get the text within a rectangle.\n * @param startPoint The starting point of the selection in PDF coordinates.\n * @param endPoint The end point of the selection in PDF coordinates.\n * @returns The string of the selected text.\n */\n getTextForRectangularSelection(startPoint, endPoint) {\n checkLicense(this.instance);\n return this.instance.getTextForRectangularSelection(startPoint, endPoint);\n }\n /**\n * Get the text contained in given rectangles.\n * @param selection The rectangles in PDF coordinates.\n * @returns The string of the selected text.\n */\n // public getTextFromSelection(selection: PdfRect[]): string {\n // checkLicense(this.instance)\n // return this.instance.getTextFromSelection(selection)\n // }\n /**\n * Get the annotation located at a given point.\n * @param point The point in PDF coordinates.\n * @returns The annotation or null.\n */\n getAnnotationsOnPoint(point, onlySelectable = false) {\n checkLicense(this.instance);\n return this.instance.getAnnotationsOnPoint(point, onlySelectable);\n }\n /**\n * Get all open popups from to .\n * @param firstPage The first page.\n * @param lastPage The last page.\n * @returns The list of annotations with an open popup in the given range.\n */\n getOpenPopups(firstPage, lastPage) {\n checkLicense(this.instance);\n return this.instance.getOpenPopups(firstPage, lastPage);\n }\n /**\n * Load items of type {@link PdfItemCategory} for a given page.\n * @param page The page for which the items should be loaded.\n * @param type The type of item to be loaded. See {@link PdfItemCategory}.\n * @returns The list of items.\n */\n getItemsFromPage(page, category) {\n checkType(page, 'number', 'getItemsFromPage');\n checkType(category, 'number', 'getItemsFromPage');\n checkLicense(this.instance);\n if (category === PdfItemCategory.ANNOTATION) {\n return this.instance.getItemsFromPage(page, category);\n }\n else {\n return new Promise((resolve, reject) => {\n resolve({});\n });\n }\n }\n /**\n * Create an annotation.\n * Depending on the type of annotation the annotation args have to contain different arguments.\n * See:\n * {@link TextStampAnnotationArgs}\n * {@link InkAnnotationArgs}\n * {@link FreeTextAnnotationArgs}\n * @param itemArgs The arguments specific to the type of item to be created.\n * @returns The created item.\n */\n createItem(itemArgs) {\n checkType(itemArgs, 'object', 'createItem');\n checkLicense(this.instance);\n return this.instance.createItem(itemArgs);\n }\n /**\n * Get the item for a given id.\n * @param id The id of the item.\n * @returns A promise returning the item if resolved or returning an error message if rejected.\n */\n getItem(id) {\n checkLicense(this.instance);\n return this.instance.getItem(id);\n }\n /**\n * Get the objects for given ids.\n * @param ids The ids of the items.\n * @returns A promise returning a list of items if resolved or returning an error message if rejected.\n */\n getItems(ids) {\n checkLicense(this.instance);\n return this.instance.getItems(ids);\n }\n /**\n * Update the editable fields of an item (e.g. an annotation).\n * Please check the manual for more information about items and their fields.\n * @param item The item to be updated.\n * @returns A promise returning the updated item if resolved or returning an error message if rejected.\n */\n updateItem(item) {\n checkType(item, 'object', 'updateItem');\n checkLicense(this.instance);\n return this.instance.updateItem(item);\n }\n /**\n * Delete an item (e.g. an annotation).\n * Please check the manual for more information about items.\n * @param item The item to be deleted.\n * @returns A promise returning nothing if resolved or returning an error message if rejected.\n */\n deleteItem(item) {\n checkType(item, 'object', 'deleteItem');\n checkLicense(this.instance);\n return this.instance.deleteItem(item);\n }\n /**\n * Get information about a particular stamp.\n * Used for text stamps to retrieve the aspect ratio of the resulting stamp.\n * @param args stampType should be TEXT - stampText is the text of the stamp that should be displayed on the stamp annotation.\n * @returns A promise returning stamp information such as aspect ratio if resolved.\n */\n getStampInfo(args) {\n checkLicense(this.instance);\n return this.instance.getStampInfo(args);\n }\n getTextStampAspectRatio(stampText) {\n checkLicense(this.instance);\n return this.instance.getTextStampAspectRatio(stampText);\n }\n /**\n * Register an image stamp in the document. If the registration is successful the promise\n * returns an ID > 0. This ID can then be used for the createItem method to create an image stamp\n * with the given image ID\n * @param image\n * @returns A promise returning the ID\n */\n registerStampImage(image) {\n checkType(image, 'object', 'registerStampImage');\n checkLicense(this.instance);\n return this.instance.registerImage(image);\n }\n /**\n * Register an pdf page as stamp in the document. If the registration is successful the promise\n * returns an ID > 0. This ID can then be used for the createItem method to create an image stamp\n * with the given ID\n * @param image\n * @returns A promise returning the ID\n */\n registerPdfPage(fileName, pageNumber) {\n checkType(fileName, 'string', 'registerPdfStamp');\n checkType(pageNumber, 'number', 'registerPdfStamp');\n checkLicense(this.instance);\n return this.instance.registerPdfPage(fileName, pageNumber);\n }\n /**\n * Check whether there are unsaved changes in the document.\n * NOTE: When saving a document with unsaved changes\n * - is successful: the promise resolves and the document is considered to be saved even if the array buffer with the saved document is discarded.\n * - fails: the document is considered to contain unsaved changes.\n * @returns True if there are unsaved changes, false otherwise.\n */\n hasChanges() {\n checkLicense(this.instance);\n return this.instance.hasChanges();\n }\n /**\n * @param searchString The string to be searched for.\n * @param startPage The page on which the search is started.\n * @param caseSensitive Whether the search should match case.\n * @param wrapSearch Whether the search should wrap around to the beginning when the end of the document is reached.\n * @param useRegex Whether the search should interpret the provided string as a regular expression.\n * @returns A promise returning a {@link SearchResult} if resolved or returning an error message if rejected.\n */\n getSearchIterator(searchString, startPage, caseSensitive, wrapSearch, useRegex) {\n return this.instance.getSearchIterator(searchString, startPage, caseSensitive, wrapSearch, useRegex);\n }\n /**\n * Set the license key for the viewer.\n * @param license The license key.\n * @returns True if license is correct else false\n */\n setLicenseKey(license) {\n try {\n this.instance = new PdfViewingWrapper(license, this.pdfViewerApiOptions);\n return true;\n }\n catch (error) {\n return false;\n }\n }\n /** internal */\n getSupportedFeatures() {\n return this.instance.getSupportedFeatures();\n }\n /**\n * Convert a point from device coordinates to PDF coordinates.\n * @param point The point in device coordinates.\n * @param page The page relative to which the PDF coordinates should be calculated.\n * @param guaranteePointIsOnPage This parameter will fix the isOnPage boolean of the return value to true.\n * Due to conversions back and forth from CSS to PDF and vice versa,\n * a CSS coordinate could return isOnPage=False even if the mouse movement\n * has been restricted to the page. Only set this to true if the\n * device point is certainly on the page.\n * @returns The point in PDF coordinates, including the number of the page where it is located.\n */\n transformScreenPointToPdfPoint(point, page, guaranteePointIsOnPage) {\n checkType(point.x, 'number', 'x');\n checkType(point.y, 'number', 'y');\n checkLicense(this.instance);\n if (page !== undefined) {\n checkType(page, 'number', 'page');\n }\n if (guaranteePointIsOnPage !== undefined) {\n checkType(guaranteePointIsOnPage, 'boolean', 'transformScreenPointToPdf');\n }\n return this.instance.transformScreenPointToPdfPoint(point, page, guaranteePointIsOnPage);\n }\n getClosestPointOnPdfByScreenPoint(point, padding = 0, page) {\n checkLicense(this.instance);\n return this.instance.getClosestPointOnPdfByScreenPoint(point, page, padding);\n }\n transformPdfPointToScreenPoint(pdfPoint) {\n checkType(pdfPoint.pdfX, 'number', 'pdfX');\n checkType(pdfPoint.pdfY, 'number', 'pdfY');\n checkType(pdfPoint.page, 'number', 'page');\n checkLicense(this.instance);\n return this.instance.transformPdfPointToScreenPoint(pdfPoint);\n }\n /**\n * Convert a rectangle from device coordinates to PDF coordinates.\n * @param rect The rectangle in device coordinates.\n * @returns The rectangle in PDF coordinates, including the number of the page where it is located.\n */\n transformScreenRectToPdfRect(rect, page) {\n checkType(rect.x, 'number', 'x');\n checkType(rect.y, 'number', 'y');\n checkType(rect.w, 'number', 'w');\n checkType(rect.h, 'number', 'h');\n checkLicense(this.instance);\n return this.instance.transformScreenRectToPdfRect(rect, page);\n }\n /**\n * Convert a rectangle from PDF coordinates to device coordinates.\n * @param pdfRect The rectangle in PDF coordinates.\n * @returns Rect The rectangle in device coordinates.\n */\n transformPdfPageRectToScreenRect(pdfRect) {\n checkType(pdfRect.pdfX, 'number', 'pdfX');\n checkType(pdfRect.pdfY, 'number', 'pdfY');\n checkType(pdfRect.pdfW, 'number', 'pdfW');\n checkType(pdfRect.pdfH, 'number', 'pdfH');\n checkType(pdfRect.page, 'number', 'page');\n checkLicense(this.instance);\n let ret = this.instance.transformPdfPageRectToScreenRect(pdfRect);\n return ret;\n }\n /**\n * Convert a length from PDF units to device pixels.\n * @param pdfLength The length in PDF units.\n * @returns number The length in device pixels.\n */\n transformPdfLengthToScreenLength(pdfLength) {\n checkType(pdfLength, 'number', 'transformPdfLengthToScreenLength');\n checkLicense(this.instance);\n return this.instance.transformPdfLengthToScreenLength(pdfLength);\n }\n /**\n * Convert a length from device pixels to PDF units.\n * @param screenLength The length in device pixels.\n * @returns number The length in PDF units.\n */\n transformScreenLengthToPdfLength(screenLength) {\n checkType(screenLength, 'number', 'transformScreenLengthToPdfLength');\n checkLicense(this.instance);\n return this.instance.transformScreenLengthToPdfLength(screenLength);\n }\n /**\n * Convert a length from PDF units to device pixels.\n * @param pdfLength The length in PDF units.\n * @returns number The length in device pixels.\n */\n transformQuadrilateralToViewport(quadrilateral) {\n checkLicense(this.instance);\n return this.instance.transformQuadrilateralToViewport(quadrilateral);\n }\n /**\n * Get the screen rectangle of a page to know its position inside the viewport.\n * @param pageNumber The number of the page.\n * @returns The rectangle with the page coordinates in device pixels.\n * Null if no document is opened or the page is invalid.\n */\n getPageScreenRect(pageNumber) {\n checkLicense(this.instance);\n return this.instance.getPageScreenRect(pageNumber);\n }\n addEventListener(type, listener) {\n checkLicense(this.instance);\n this.instance.addEventListener(type, listener);\n }\n removeEventListener(type, listener) {\n checkLicense(this.instance);\n this.instance.removeEventListener(type, listener);\n }\n}\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n};\nimport { PdfActionType, PdfFitMode, PdfItemCategory, PdfItemType, WidgetType, PdfPageLayoutMode, AnnotationBorderStyle, DocumentChange, RotationDirection, } from './enums';\nimport { FileType, } from './types';\nimport { annotationDefaultBehaviors } from './annotationDefaultBehaviors';\nimport { PdfViewing } from '../pdf-viewing/PdfViewing';\nimport { ImageContainer } from './ImageContainer';\nexport class PdfViewingWrapper {\n constructor(key, pdfViewerApiOptions) {\n this.pdfDocument = null;\n this.objectUrls = [];\n this.view = null;\n this.textFragmentCache = new Map();\n this.nativeAnnotationCache = new Map();\n this.handleAnnotationCache = new Map();\n this.pageAnnotationCache = new Map();\n this.imageBitmapCache = new Map();\n this.ignoreDocumentPreferences = false;\n this.nativeOutlines = new Map();\n this.devicePixelRatio = window.devicePixelRatio;\n this.xDPI = 0;\n this.yDPI = 0;\n PdfViewing.Sdk.initialize(key, PdfViewing.Sdk.version);\n this.validateViewingSdkVersion();\n this.pdfViewerApiOptions = pdfViewerApiOptions;\n this.licenseFeatures = PdfViewing.Sdk.supportedFeatures;\n this.pdfController = new PdfViewing.ViewerController();\n this.eventListeners = new Map();\n this.viewportSize = new PdfViewing.Pdf.Geometry.Real.Size(0, 0);\n this.pdfStampDocuments = new Map();\n this.registeredPdfStamps = new Map();\n this.attachEventListeners = this.attachEventListeners.bind(this);\n this.onDocumentOpened = this.onDocumentOpened.bind(this);\n this.onViewUpdated = this.onViewUpdated.bind(this);\n this.onImageCreated = this.onImageCreated.bind(this);\n this.onImageRemovedFromCache = this.onImageRemovedFromCache.bind(this);\n this.getAnnotationsFromPage = this.getAnnotationsFromPage.bind(this);\n }\n getIgnoringPreferences() {\n return this.ignoreDocumentPreferences;\n }\n setIgnoringPreferences(ignorePreferences) {\n this.ignoreDocumentPreferences = ignorePreferences;\n }\n open(pdfFile, fdfFiles, password, viewOptions, renderOptions, viewportSize) {\n return new Promise((resolve, reject) => {\n const mapInputDocument = (file, fileType) => {\n try {\n let mimeType = 'application/pdf';\n switch (fileType) {\n case FileType.Fdf:\n mimeType = 'application/vnd.fdf';\n break;\n // case FileType.Xfdf:\n // mimeType = 'application/vnd.adobe.xfdf'\n // break\n }\n const { data } = file;\n let uri = '';\n let httpOptions = new PdfViewing.IO.HttpOptions();\n if (data) {\n uri = URL.createObjectURL(new File([data], pdfFile.sourceTag || '', {\n type: mimeType,\n }));\n }\n else {\n const inputUri = file;\n uri = inputUri.uri;\n if (inputUri.httpOptions) {\n const { headers, mode, cache, credentials, redirect, referrerPolicy } = inputUri.httpOptions;\n if (mode !== undefined ||\n cache !== undefined ||\n credentials !== undefined ||\n redirect !== undefined ||\n referrerPolicy !== undefined) {\n console.warn(`\n You are using a property that has been deprecated for stability reasons on iOS. \n Affected properties are: mode, cache, credentials, redirect, referrerPolicy.\n If you want to continue using one of these properties, please switch to the separate build that is now available at: https://pdftools-public-downloads-production.s3.eu-west-1.amazonaws.com/productkits/VIEWWEB/4.3.4/extended/pdf-tools-four-heights-pdf-web-viewer-4.3.4.tar.gz\n You can read more about this in our docs: https://www.pdf-tools.com/public/downloads/manuals/PdfWebViewer.pdf\n `);\n }\n if (headers) {\n // httpOptions.headers = new PdfViewing.StringMap()\n Object.keys(headers).forEach((key) => {\n var _a;\n (_a = httpOptions.headers) === null || _a === void 0 ? void 0 : _a.set(key, headers[key]);\n });\n }\n httpOptions.credentials = null;\n httpOptions.cache = null;\n httpOptions.mode = null;\n httpOptions.redirect = null;\n httpOptions.referrerPolicy = null;\n }\n }\n return new PdfViewing.IO.InputUri(uri, httpOptions, pdfFile.sourceTag);\n }\n catch (err) {\n throw new Error('failed to create InputDocument');\n }\n };\n const pdfInputFile = mapInputDocument(pdfFile, FileType.Pdf);\n const fdfInputFiles = new PdfViewing.IO.InputDocumentList();\n if (fdfFiles && fdfFiles.length) {\n fdfFiles.forEach((file) => {\n const fdfFile = mapInputDocument(file, FileType.Fdf);\n if (fdfFile) {\n fdfInputFiles.add(fdfFile);\n }\n });\n }\n const mapViewOptions = (viewOptions) => {\n try {\n if (!viewOptions) {\n return null;\n }\n const options = new PdfViewing.Pdf.ViewOptions();\n options.initialDestination = null;\n if (typeof viewOptions.initialFitMode === 'number') {\n options.initialFitMode = this.WwFitModeToViewingFitMode(viewOptions.initialFitMode);\n }\n if (typeof viewOptions.initialPageLayoutMode === 'number') {\n options.initialPageLayoutMode = this.WwPageLayoutToViewingPageLayout(viewOptions.initialPageLayoutMode);\n }\n if (typeof viewOptions.initialPageNumber === 'number' ||\n typeof viewOptions.initialZoom === 'number') {\n const pageNumber = typeof viewOptions.initialPageNumber === 'number' ? viewOptions.initialPageNumber : 1;\n const zoom = typeof viewOptions.initialZoom === 'number' ? viewOptions.initialZoom : null;\n options.initialDestination = new PdfViewing.Pdf.Navigation.LocationZoomDestination(pageNumber, null, null, zoom);\n }\n if (typeof viewportSize === 'object') {\n this.viewportSize = new PdfViewing.Pdf.Geometry.Integer.Size(viewportSize.width, viewportSize.height);\n options.viewportSize = this.viewportSize;\n }\n return options;\n }\n catch (err) {\n console.error(err);\n throw new Error('failed to create View Options');\n }\n };\n const sdkViewOptions = mapViewOptions(viewOptions);\n const mapRenderOptions = (renderOptions) => {\n try {\n if (!renderOptions) {\n return null;\n }\n const options = new PdfViewing.Pdf.RenderOptions();\n if (renderOptions.formFieldHighlightColor) {\n options.formFieldHighlightColor = this.createNativeColor(renderOptions.formFieldHighlightColor);\n }\n if (renderOptions.formFieldRequiredHighlightColor) {\n options.formFieldRequiredHighlightColor = this.createNativeColor(renderOptions.formFieldRequiredHighlightColor);\n }\n // if (renderOptions.annotationFilter) {\n // options.annotationFilter = this.createAnnotationFilter(renderOptions.annotationFilter)\n // }\n return options;\n }\n catch (err) {\n throw new Error('failed to create Render Options');\n }\n };\n const sdkRenderOptions = mapRenderOptions(renderOptions);\n this.pdfController\n .open(pdfInputFile, fdfInputFiles, password)\n .then((document) => {\n this.pdfDocument = document;\n this.onDocumentOpened(document, sdkRenderOptions, sdkViewOptions);\n resolve();\n })\n .catch((error) => {\n console.warn(error);\n reject(error);\n });\n });\n }\n save(saveOptions) {\n const { fileType, annotationFilter } = saveOptions || {};\n const _saveOptions = new PdfViewing.Pdf.SaveOptions();\n switch (fileType) {\n case FileType.Fdf:\n _saveOptions.fileType = PdfViewing.IO.FileType.Fdf;\n break;\n // case FileType.Xfdf:\n // type = PdfViewing.IO.FileType.Xfdf\n // break\n default:\n _saveOptions.fileType = PdfViewing.IO.FileType.Pdf;\n }\n _saveOptions.annotationFilter = annotationFilter\n ? this.createAnnotationFilter(annotationFilter)\n : null;\n return new Promise((resolve, reject) => {\n if (this.pdfDocument) {\n this.pdfDocument\n .save(_saveOptions)\n .then((file) => {\n const buffer = file.bufferData;\n if (buffer) {\n const blob = new Blob([file.bufferData]);\n file.close();\n resolve(blob);\n }\n else {\n reject('Returned save buffer is null');\n }\n })\n .catch((error) => {\n console.warn(error);\n reject(error);\n });\n }\n else {\n reject('No document opened');\n }\n });\n }\n close() {\n var _a, _b;\n this.nativeAnnotationCache.forEach((annot) => {\n var _a;\n if (annot instanceof PdfViewing.Pdf.Annotations.MarkupAnnotation) {\n (_a = annot.info) === null || _a === void 0 ? void 0 : _a.close();\n }\n annot.close();\n });\n this.nativeAnnotationCache.clear();\n this.handleAnnotationCache.clear();\n this.pageAnnotationCache.clear();\n this.textFragmentCache.clear();\n this.objectUrls.forEach((url) => {\n URL.revokeObjectURL(url);\n });\n this.objectUrls = [];\n this.nativeOutlines.forEach((outline) => {\n outline.close();\n });\n this.nativeOutlines.clear();\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.close();\n (_b = this.pdfDocument) === null || _b === void 0 ? void 0 : _b.close();\n this.pdfDocument = null;\n }\n destroy() {\n if (this.view) {\n this.view.removeEventListener('viewUpdated', this.onViewUpdated);\n this.view.removeEventListener('imageCreated', this.onImageCreated);\n this.view.removeEventListener('imageRemovedFromCache', this.onImageRemovedFromCache);\n }\n this.close();\n this.pdfStampDocuments.forEach((stampDocument) => {\n stampDocument.close();\n });\n this.pdfController.close();\n this.imageBitmapCache.forEach((imageContainer) => {\n imageContainer.destroy();\n });\n this.nativeOutlines.clear();\n this.imageBitmapCache.clear();\n this.textFragmentCache.clear();\n this.nativeAnnotationCache.clear();\n this.handleAnnotationCache.clear();\n this.pageAnnotationCache.clear();\n this.pdfStampDocuments.clear();\n this.registeredPdfStamps.clear();\n }\n registerPdfStampFile(pdfStampFileName, data, onStampCreated) {\n const url = URL.createObjectURL(new File([data], pdfStampFileName, { type: 'application/pdf' }));\n this.objectUrls.push(url);\n this.pdfController\n .openUri(url, null, null, null, null)\n .then((pdfDocument) => {\n const createStamps = () => __awaiter(this, void 0, void 0, function* () {\n var _a, e_1, _b, _c, _d, e_2, _e, _f;\n const pageNumbers = Array.from({ length: pdfDocument.pageCount }, (_, i) => i + 1);\n let maxHeight = 0;\n let maxWidth = 0;\n const stampSizes = {};\n try {\n for (var _g = true, pageNumbers_1 = __asyncValues(pageNumbers), pageNumbers_1_1; pageNumbers_1_1 = yield pageNumbers_1.next(), _a = pageNumbers_1_1.done, !_a;) {\n _c = pageNumbers_1_1.value;\n _g = false;\n try {\n let pageNumber = _c;\n const size = yield pdfDocument.getPagePdfSize(pageNumber);\n stampSizes[pageNumber] = size;\n maxHeight = Math.max(size.height, maxHeight);\n maxWidth = Math.max(size.width, maxWidth);\n }\n finally {\n _g = true;\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (!_g && !_a && (_b = pageNumbers_1.return)) yield _b.call(pageNumbers_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n const MAX_PX_WIDTH = 200;\n const MAX_PX_HEIGHT = 100;\n const scale = Math.max(maxHeight / MAX_PX_HEIGHT, maxWidth / MAX_PX_WIDTH);\n try {\n for (var _h = true, pageNumbers_2 = __asyncValues(pageNumbers), pageNumbers_2_1; pageNumbers_2_1 = yield pageNumbers_2.next(), _d = pageNumbers_2_1.done, !_d;) {\n _f = pageNumbers_2_1.value;\n _h = false;\n try {\n let pageNumber = _f;\n const size = stampSizes[pageNumber];\n const aspectRatio = size.width / size.height;\n const img = yield pdfDocument.renderPage(pageNumber, size.width / scale, size.height / scale, 0);\n const tempCanvas = document.createElement('canvas');\n tempCanvas.width = img.width;\n tempCanvas.height = img.height;\n const tempContext = tempCanvas.getContext('2d');\n const imgData = new ImageData(new Uint8ClampedArray(img.bufferView), img.width, img.height);\n tempContext.putImageData(imgData, 0, 0);\n const thumbnail = tempCanvas.toDataURL('png');\n onStampCreated({\n pdfStampFileName,\n name: `${pdfStampFileName} - ${pageNumber}`,\n pageNumber,\n thumbnail,\n aspectRatio,\n });\n }\n finally {\n _h = true;\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (!_h && !_d && (_e = pageNumbers_2.return)) yield _e.call(pageNumbers_2);\n }\n finally { if (e_2) throw e_2.error; }\n }\n });\n this.pdfStampDocuments.set(pdfStampFileName, pdfDocument);\n createStamps();\n })\n .catch((error) => {\n console.warn(error);\n });\n }\n getPageCount() {\n if (this.pdfDocument) {\n return this.pdfDocument.pageCount;\n }\n else {\n return null;\n }\n }\n registerImage(imageBuffer) {\n return new Promise((resolve, reject) => {\n if (this.pdfDocument) {\n const imgBlob = URL.createObjectURL(new Blob([imageBuffer]));\n this.pdfDocument.registerImageUri(imgBlob, null).then((id) => {\n resolve(id);\n });\n }\n });\n }\n registerPdfPage(fileName, pageNumber) {\n return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {\n if (this.pdfDocument) {\n const pdfDoc = this.pdfStampDocuments.get(fileName);\n if (!pdfDoc) {\n resolve(0);\n }\n else {\n const registeredPdfStampsKey = `${fileName}__${pageNumber}`;\n const stampRefId = this.registeredPdfStamps.get(registeredPdfStampsKey);\n if (stampRefId) {\n resolve(stampRefId);\n }\n else {\n const id = yield this.pdfDocument.registerPdfPage(pdfDoc, pageNumber);\n this.registeredPdfStamps.set(registeredPdfStampsKey, id);\n resolve(id);\n }\n }\n }\n }));\n }\n getPageNumber() {\n if (this.view) {\n return this.view.pageNumber;\n }\n return 0;\n }\n getFitMode() {\n var _a;\n var fitMode = (_a = this.view) === null || _a === void 0 ? void 0 : _a.fitMode;\n if (fitMode === undefined) {\n throw new Error('Invalid fit mode');\n }\n else {\n return fitMode;\n }\n }\n setFitMode(mode) {\n if (this.view) {\n this.view.fitMode = mode;\n }\n }\n setPageNumber(page) {\n if (this.view) {\n this.view.pageNumber = page;\n }\n }\n getZoom() {\n if (this.view) {\n return this.view.zoom;\n }\n return 0;\n }\n setZoom(zoom, location) {\n if (this.view) {\n if (location) {\n const p = new PdfViewing.Pdf.Geometry.Integer.Point(location.x, location.y);\n this.view.zoomOnLocation(zoom, p);\n }\n else {\n this.view.zoom = zoom;\n }\n }\n }\n getRotation() {\n if (this.view) {\n return this.view.viewRotation;\n }\n return 0;\n }\n setRotation(rotation) {\n if (this.view) {\n this.view.viewRotation = rotation;\n }\n }\n setBorderSize(size) {\n if (this.view) {\n this.view.borderSize = size;\n }\n }\n getBorderSize() {\n if (this.view) {\n return this.view.borderSize;\n }\n return 0;\n }\n suspendDrawing() {\n var _a;\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.suspendDrawing();\n }\n resumeDrawing() {\n var _a;\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.resumeDrawing();\n }\n renderCanvas(ctx, options) {\n var _a;\n if (this.view) {\n // viewport size changed?\n if (this.viewportSize.width != ctx.canvas.width ||\n this.viewportSize.height != ctx.canvas.height) {\n this.viewportSize.width = ctx.canvas.width;\n this.viewportSize.height = ctx.canvas.height;\n this.view.viewportSize = new PdfViewing.Pdf.Geometry.Integer.Size(ctx.canvas.width, ctx.canvas.height);\n }\n const data = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getRenderedResults();\n if (data) {\n this.drawImages(ctx, data, options);\n data.close();\n }\n }\n }\n renderPage(page, width, height) {\n // TODO: expose rotation\n return new Promise((resolve, reject) => {\n var _a;\n (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.renderPage(page, width, height, /* rotation = */ 0).then((image) => {\n const imgBuffer = image.bufferView;\n if (!imgBuffer) {\n reject();\n }\n let pageImage = {};\n pageImage.page = page;\n pageImage.imageData = new ImageData(new Uint8ClampedArray(imgBuffer), image.width, image.height);\n image.close();\n resolve(pageImage);\n }).catch((err) => {\n if (err.message !== 'Document was closed before operation could finish') {\n reject(`failed to render page ${page}`);\n }\n });\n });\n }\n rotatePage(pageNumber, direction) {\n var _a;\n const page = (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.pages.get(pageNumber - 1);\n if (page) {\n page.rotatePage(direction === RotationDirection.CLOCKWISE ? 90 : -90);\n this.dispatchEvent('pageChanged', pageNumber);\n }\n }\n getPagePdfSize(page) {\n return new Promise((resolve, reject) => {\n var _a;\n (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.getPagePdfSize(page).then((pageSize) => {\n resolve(pageSize);\n });\n });\n }\n setLicenseKey(key) {\n try {\n PdfViewing.Sdk.initialize(key, PdfViewing.Sdk.version);\n return true;\n }\n catch (error) {\n return false;\n }\n }\n getSupportedFeatures() {\n return PdfViewing.Sdk.supportedFeatures;\n }\n hasChanges() {\n if (this.pdfDocument) {\n const changes = this.pdfDocument.hasChanges;\n let ret = DocumentChange.NONE;\n if (changes & PdfViewing.Pdf.DocumentChange.Annotation) {\n ret = ret | DocumentChange.ANNOTATION;\n }\n if (changes & PdfViewing.Pdf.DocumentChange.Content) {\n ret = ret | DocumentChange.CONTENT;\n }\n return ret;\n }\n return null;\n }\n getSearchIterator(keyword, page, caseSensitive, wrap, regex) {\n var _a;\n try {\n return (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.searchText(keyword, page, caseSensitive, wrap, regex);\n }\n catch (err) {\n if (err.message !== 'Invalid search text') {\n throw err;\n }\n console.warn(err.message);\n }\n }\n getTextFragmentOnPoint(point) {\n var _a;\n const pointOnVp = new PdfViewing.Pdf.Geometry.Integer.Point(point.x, point.y);\n if (this.pdfDocument === null)\n return null;\n try {\n const fragmentList = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getTextFragmentsOnPoint(pointOnVp);\n let frag = null;\n if (fragmentList && fragmentList.size > 0) {\n const nativeFrag = fragmentList.get(0);\n frag = this.createWebViewerFragment(nativeFrag);\n nativeFrag.close();\n fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.close();\n }\n return frag;\n }\n catch (error) {\n return null;\n }\n }\n getWordOnPoint(point) {\n var _a;\n const pointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(point.page, point.pdfX, point.pdfY);\n try {\n const selection = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getWordOnPoint(pointOnPage);\n if (selection) {\n const { textArea } = selection;\n if (textArea) {\n const quadrilaterals = [];\n for (let index = 0; index < textArea.size; index++) {\n quadrilaterals.push(textArea.get(index));\n }\n textArea.close();\n selection.close();\n const q = quadrilaterals[0];\n if (q) {\n const { bottomLeft, bottomRight, topRight, topLeft, pageNumber } = q;\n return {\n quadrilaterals,\n startPoint: {\n pdfX: Math.min(bottomLeft.x, bottomRight.x, topRight.x, topLeft.x),\n pdfY: Math.max(bottomLeft.y, bottomRight.y, topRight.y, topLeft.y),\n page: pageNumber,\n },\n endPoint: {\n pdfX: Math.max(bottomLeft.x, bottomRight.x, topRight.x, topLeft.x),\n pdfY: Math.min(bottomLeft.y, bottomRight.y, topRight.y, topLeft.y),\n page: pageNumber,\n },\n };\n }\n }\n }\n }\n catch (e) { }\n return null;\n }\n getTextSelection(startPoint, endPoint) {\n var _a;\n const startPointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(startPoint.page, startPoint.pdfX, startPoint.pdfY);\n const endPointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(endPoint.page, endPoint.pdfX, endPoint.pdfY);\n try {\n const selection = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getTextSelection(startPointOnPage, endPointOnPage);\n if (selection) {\n const { textArea } = selection;\n if (textArea) {\n const quadrilaterals = [];\n for (let index = 0; index < textArea.size; index++) {\n quadrilaterals.push(textArea.get(index));\n }\n textArea.close();\n selection.close();\n return {\n quadrilaterals,\n startPoint,\n endPoint,\n };\n }\n }\n }\n catch (e) { }\n return null;\n }\n getRectangularTextSelection(startPoint, endPoint) {\n var _a;\n const startPointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(startPoint.page, startPoint.pdfX, startPoint.pdfY);\n const endPointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(endPoint.page, endPoint.pdfX, endPoint.pdfY);\n try {\n const selection = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getRectangularTextSelection(startPointOnPage, endPointOnPage);\n if (selection) {\n const { textArea } = selection;\n if (textArea) {\n const quadrilaterals = [];\n for (let index = 0; index < textArea.size; index++) {\n quadrilaterals.push(textArea.get(index));\n }\n textArea.close();\n selection.close();\n return {\n quadrilaterals,\n startPoint,\n endPoint,\n };\n }\n }\n }\n catch (err) { }\n return null;\n }\n getText(startPoint, endPoint) {\n var _a;\n const startPointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(startPoint.page, startPoint.pdfX, startPoint.pdfY);\n const endPointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(endPoint.page, endPoint.pdfX, endPoint.pdfY);\n try {\n const selection = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getTextSelection(startPointOnPage, endPointOnPage);\n if (selection) {\n const { text } = selection;\n selection.close();\n return text;\n }\n }\n catch (e) { }\n return null;\n }\n getTextForRectangularSelection(startPoint, endPoint) {\n var _a;\n const startPointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(startPoint.page, startPoint.pdfX, startPoint.pdfY);\n const endPointOnPage = new PdfViewing.Pdf.Geometry.Real.PointOnPage(endPoint.page, endPoint.pdfX, endPoint.pdfY);\n try {\n const selection = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getRectangularTextSelection(startPointOnPage, endPointOnPage);\n if (selection) {\n const { text } = selection;\n selection.close();\n return text;\n }\n }\n catch (e) { }\n return null;\n }\n createWebViewerFragment(nativeFragment) {\n const fragment = {};\n fragment.glyphOffsets = nativeFragment.glyphOffsets ? nativeFragment.glyphOffsets : [];\n fragment.text = nativeFragment.text || '';\n // Convert Tetragon to Rect\n const fragRect = nativeFragment.rectangleOnPage;\n if (fragRect) {\n fragment.pdfRect = this.ViewingPdfRect2WwPdfRect(fragRect);\n }\n return fragment;\n }\n getIsOpen() {\n return this.pdfDocument !== null;\n }\n getOutlines(parent) {\n return new Promise((resolve, reject) => {\n if (this.pdfDocument) {\n if (parent !== null) {\n parent = this.nativeOutlines.get(parent.id);\n }\n this.pdfDocument\n .getOutlines(parent)\n .then((outlineList) => {\n const outlines = [];\n for (let i = 0; i < outlineList.size; i++) {\n const nativeOutline = outlineList.get(i);\n const outline = {};\n outline.id = nativeOutline.getHashCode();\n outline.title = nativeOutline.title || '';\n outline.hasDescendants = nativeOutline.hasChildren;\n outline.destination = nativeOutline.destination;\n this.nativeOutlines.set(nativeOutline.getHashCode(), nativeOutline);\n outlines.push(outline);\n }\n outlineList.close();\n resolve(outlines);\n })\n .catch((err) => {\n if (err.message !== 'Document was closed before operation could finish') {\n reject('failed to get outlines');\n }\n });\n }\n else {\n reject();\n }\n });\n }\n goTo(destination) {\n if (destination != null)\n this.goToPage(destination.pageNumber, destination.left, destination.top, destination.zoom);\n }\n goToPage(pageNumber, left = null, top = null, zoom = null) {\n if (this.view) {\n const nativeDest = new PdfViewing.Pdf.Navigation.LocationZoomDestination(pageNumber, left, top, zoom);\n this.view.goToDestination(nativeDest);\n }\n }\n goToRectangle(rectangle) {\n if (this.view) {\n const rectangleOnPage = new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(rectangle.page, rectangle.pdfX, rectangle.pdfY, rectangle.pdfW, rectangle.pdfH);\n this.view.goToRectangle(rectangleOnPage);\n }\n }\n getAnnotationsFromPage(page) {\n return new Promise((resolve, reject) => {\n var _a;\n (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.getAnnotations(page).then((annotList) => {\n var _a;\n const annotRet = {};\n annotRet.page = page;\n annotRet.itemCategory = 1;\n annotRet.items = [];\n for (let i = 0; i < annotList.size; i++) {\n const nativeAnnot = annotList.get(i);\n const ww_annot = this.createWebViewerAnnotation(nativeAnnot, page);\n if (ww_annot) {\n annotRet.items.push(ww_annot);\n this.nativeAnnotationCache.set(ww_annot.id, nativeAnnot);\n this.handleAnnotationCache.set(ww_annot.id, ww_annot);\n if (!this.pageAnnotationCache.has(page)) {\n this.pageAnnotationCache.set(page, []);\n }\n (_a = this.pageAnnotationCache.get(page)) === null || _a === void 0 ? void 0 : _a.push(ww_annot);\n }\n }\n resolve(annotRet);\n }).catch((err) => {\n if (err.message !== 'Document was closed before operation could finish') {\n reject(`Failed to get annotations for page ${page}, ${err}`);\n }\n });\n });\n }\n deleteItem(item) {\n return this.deleteAnnotation(item);\n }\n validateViewingSdkVersion() {\n const parseVersionString = (versionString) => {\n const match = versionString.match(/(\\d+)\\.(\\d+)\\.(\\d+)[\\-]{0,1}(\\w*)[\\.]{0,1}(\\d*)/);\n if (match) {\n return {\n major: parseInt(match[1]),\n minor: parseInt(match[2]),\n patch: parseInt(match[3]),\n type: match[4],\n buildId: parseInt(match[5]),\n };\n }\n };\n // 4.3.4-rc.17499 will be replaced with the current PdfViewing SDK Version by webpack\n const requiredSdk = parseVersionString('4.3.4-rc.17499');\n const currentSdk = parseVersionString(PdfViewing.Sdk.version);\n if (requiredSdk && currentSdk) {\n const valid = requiredSdk.major === currentSdk.major &&\n requiredSdk.minor === currentSdk.minor &&\n requiredSdk.patch === currentSdk.patch &&\n (requiredSdk.type ? requiredSdk.buildId === currentSdk.buildId : true);\n if (!valid) {\n console.warn(`**************************************\nVersion mismatch between PDF Viewing SDK and PDF Web Viewer\n\nMost likely, the static assets of the PDF Viewing SDK have not been copied to the configured location. For more information please consult the documentation (\"static assets\").\n\nCurrent version: ${currentSdk.major}.${currentSdk.minor}.${currentSdk.patch}\nRequired version: ${requiredSdk.major}.${requiredSdk.minor}.${requiredSdk.patch}${requiredSdk.type ? ` (${requiredSdk.type.toUpperCase()} version)` : ''}\n\n**************************************`);\n }\n }\n else {\n console.warn('The PDF Viewing SDK version number has an incorrect format');\n }\n }\n deleteAnnotation(item) {\n return new Promise((resolve, reject) => {\n var _a;\n const id = item.id;\n const nativeAnnot = this.nativeAnnotationCache.get(id);\n const page = item.page;\n if (nativeAnnot) {\n (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.deleteAnnotation(nativeAnnot).then(() => {\n nativeAnnot.close();\n this.nativeAnnotationCache.delete(id);\n this.handleAnnotationCache.delete(id);\n this.dispatchEvent('itemDeleted', { page, id, categoryType: 1 });\n this.dispatchEvent('pageChanged', page);\n resolve();\n });\n }\n });\n }\n getItem(id) {\n if (this.handleAnnotationCache.has(id)) {\n return this.handleAnnotationCache.get(id);\n }\n return null;\n }\n createItem(item) {\n return this.createAnnotation(item);\n }\n createAnnotationFilter(annotationFilter) {\n return (annot) => {\n const { pageNumber } = annot.boundingBox;\n const ww_annot = this.createWebViewerAnnotation(annot, pageNumber);\n annot.close();\n const res = annotationFilter(ww_annot);\n return res;\n };\n }\n createMarkupAnnotation(item) {\n const color = this.createNativeColor(item.color);\n const fillColor = this.createNativeColor(item.fillColor);\n let borderStyle = PdfViewing.Pdf.Annotations.BorderStyleType.Lined;\n const stroke = new PdfViewing.Pdf.Annotations.AnnotationStroke();\n if (item.border) {\n stroke.lineWidth = item.border.width;\n borderStyle = this.convertToNativeBorderStyle(item.border.style);\n if (item.border.style === 1) {\n stroke.dashArray = [item.border.width];\n }\n }\n const bbox = new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(item.pdfRect.page, item.pdfRect.pdfX, item.pdfRect.pdfY, item.pdfRect.pdfW, item.pdfRect.pdfH);\n switch (item.itemType) {\n case 1: // Sticky Note\n const stickyOrigin = new PdfViewing.Pdf.Geometry.Real.PointOnPage(item.pdfRect.page, item.pdfRect.pdfX, item.pdfRect.pdfY);\n return PdfViewing.Pdf.Annotations.StickyNote.create(stickyOrigin, '', color);\n case 3: // Freetext\n return PdfViewing.Pdf.Annotations.FreeText.create(bbox, item.richtext, color, stroke, this.view ? this.view.viewRotation : PdfViewing.Pdf.Geometry.Rotation.NoRotation);\n case 5: // Rectangle\n return PdfViewing.Pdf.Annotations.RectangleAnnotation.create(bbox, stroke.lineWidth ? color : null, stroke, borderStyle, fillColor);\n case 6: // Ellipse\n return PdfViewing.Pdf.Annotations.EllipseAnnotation.create(bbox, stroke.lineWidth ? color : null, stroke, borderStyle, fillColor);\n case 9: // Highlight\n return PdfViewing.Pdf.Annotations.Highlight.create(this.createQuadrilateralList(item.quadrilaterals), color);\n case 10: // Underline\n return PdfViewing.Pdf.Annotations.Underline.create(this.createQuadrilateralList(item.quadrilaterals), color);\n case 11: // Squiggly\n return PdfViewing.Pdf.Annotations.Squiggly.create(this.createQuadrilateralList(item.quadrilaterals), color);\n case 12: // StrikeThrough\n return PdfViewing.Pdf.Annotations.StrikeThrough.create(this.createQuadrilateralList(item.quadrilaterals), color);\n case 13: // Text Stamp\n if (item.stampText) {\n return PdfViewing.Pdf.Annotations.CustomTextStamp.create(bbox, item.stampText, item.stampColor, this.view ? this.view.viewRotation : PdfViewing.Pdf.Geometry.Rotation.NoRotation);\n }\n else if (item.imageId) {\n return PdfViewing.Pdf.Annotations.CustomImageStamp.create(bbox, item.imageId, this.view ? this.view.viewRotation : PdfViewing.Pdf.Geometry.Rotation.NoRotation);\n }\n else {\n throw new Error(`createAnnotation: Unknown custom stamp annotation`);\n }\n case 15: // Ink\n const inkList = item.inkList;\n const path = new PdfViewing.Pdf.Geometry.Real.Path();\n if (inkList) {\n const pathGen = new PdfViewing.Pdf.Geometry.Real.PathGenerator(path);\n for (let i = 0; i < inkList.length; i++) {\n pathGen.moveTo(new PdfViewing.Pdf.Geometry.Real.Point(inkList[i][0], inkList[i][1]));\n for (let j = 2; j < inkList[i].length; j += 2) {\n pathGen.lineTo(new PdfViewing.Pdf.Geometry.Real.Point(inkList[i][j], inkList[i][j + 1]));\n }\n }\n pathGen.close();\n }\n return PdfViewing.Pdf.Annotations.InkAnnotation.create(item.page, path, color, stroke);\n default:\n throw new Error(`createAnnotation: Type not implemented: ${item.itemType}`);\n }\n }\n createAnnotation(item) {\n let annot = this.createMarkupAnnotation(item);\n const page = item.page;\n // Set general properties\n annot.info.author = item.author || '';\n return new Promise((resolve, reject) => {\n var _a;\n (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.createAnnotation(annot).then(() => {\n const ww_annot = this.createWebViewerAnnotation(annot, item.page);\n if (ww_annot) {\n this.nativeAnnotationCache.set(ww_annot.id, annot);\n this.handleAnnotationCache.set(ww_annot.id, ww_annot);\n this.dispatchEvent('itemCreated', ww_annot);\n this.dispatchEvent('pageChanged', page);\n resolve(ww_annot);\n }\n reject('Failed to create Web Viewer annotation');\n }).catch((error) => {\n reject(error);\n });\n });\n }\n createQuadrilateralList(quadrilaterals) {\n const quadrilateralList = new PdfViewing.Pdf.Geometry.Real.QuadrilateralList();\n for (let i = 0; i < quadrilaterals.length; i++) {\n const q = quadrilaterals[i];\n quadrilateralList.add(new PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage(q.pageNumber, new PdfViewing.Pdf.Geometry.Real.Point(q.bottomLeft.x, q.bottomLeft.y), new PdfViewing.Pdf.Geometry.Real.Point(q.bottomRight.x, q.bottomRight.y), new PdfViewing.Pdf.Geometry.Real.Point(q.topRight.x, q.topRight.y), new PdfViewing.Pdf.Geometry.Real.Point(q.topLeft.x, q.topLeft.y)));\n }\n return quadrilateralList;\n }\n convertToNativeBorderStyle(style) {\n switch (style) {\n case 0:\n return PdfViewing.Pdf.Annotations.BorderStyleType.Lined;\n case 2:\n return PdfViewing.Pdf.Annotations.BorderStyleType.Beveled;\n case 3:\n return PdfViewing.Pdf.Annotations.BorderStyleType.Inset;\n case 4:\n return PdfViewing.Pdf.Annotations.BorderStyleType.Underline;\n default:\n return PdfViewing.Pdf.Annotations.BorderStyleType.Lined;\n }\n }\n convertToWebViewerBorderStyle(style) {\n switch (style) {\n case PdfViewing.Pdf.Annotations.BorderStyleType.Lined:\n return 0;\n case PdfViewing.Pdf.Annotations.BorderStyleType.Beveled:\n return 2;\n case PdfViewing.Pdf.Annotations.BorderStyleType.Inset:\n return 3;\n case PdfViewing.Pdf.Annotations.BorderStyleType.Underline:\n return 4;\n default:\n return 0;\n }\n }\n updateItem(item) {\n return new Promise((resolve, reject) => {\n var _a, _b;\n if (item.itemType === PdfItemType.WIDGET) {\n (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.editAnnotation(item.widget).then(() => {\n // this.dispatchEvent('itemUpdated', item)\n this.dispatchEvent('pageChanged', item.widget.boundingBox.pageNumber);\n resolve(item);\n }).catch((error) => {\n reject(error);\n });\n }\n else {\n const nativeAnnot = this.nativeAnnotationCache.get(item.id);\n if (nativeAnnot) {\n const rotationChanged = item.hasOwnProperty('rotation') &&\n item.rotation % 360 !== nativeAnnot.rotation % 360;\n if (!rotationChanged) {\n const bbox = new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(item.pdfRect.page, item.pdfRect.pdfX, item.pdfRect.pdfY, item.pdfRect.pdfW, item.pdfRect.pdfH);\n nativeAnnot.boundingBox = bbox;\n }\n let nativeColor = null;\n nativeColor = this.createNativeColor(item.color);\n const markupAnnot = nativeAnnot;\n if (markupAnnot && item.privateData) {\n markupAnnot.privateData = item.privateData;\n }\n if (nativeAnnot.popup) {\n const rect = item.popup.pdfRect;\n nativeAnnot.popup.boundingBox =\n new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(rect.page, rect.pdfX, rect.pdfY, rect.pdfW, rect.pdfH);\n nativeAnnot.popup.isOpen = item.popup.isOpen;\n }\n if (markupAnnot && markupAnnot.info) {\n markupAnnot.info.content = item.content || '';\n markupAnnot.info.subject = item.subject || '';\n }\n if (item.itemType === PdfItemType.TEXT) {\n const stickyAnnot = nativeAnnot;\n stickyAnnot.color = nativeColor;\n }\n if (item.itemType === PdfItemType.FREE_TEXT) {\n const freetextAnnot = nativeAnnot;\n freetextAnnot.richText = item.richText;\n freetextAnnot.backgroundColor = this.createNativeColor(item.color);\n const stroke = freetextAnnot.annotationStroke;\n if (stroke) {\n stroke.lineWidth = item.border.width;\n freetextAnnot.annotationStroke = stroke;\n stroke.close();\n }\n if (rotationChanged) {\n freetextAnnot.rotation = item.rotation;\n item.pdfRect = {\n page: freetextAnnot.boundingBox.pageNumber,\n pdfX: freetextAnnot.boundingBox.x,\n pdfY: freetextAnnot.boundingBox.y,\n pdfW: freetextAnnot.boundingBox.width,\n pdfH: freetextAnnot.boundingBox.height,\n };\n }\n }\n if (item.itemType === PdfItemType.INK) {\n const inkAnnotation = nativeAnnot;\n const inkAnnot = item;\n inkAnnotation.strokeColor = nativeColor;\n const { annotationStroke } = inkAnnotation;\n if (annotationStroke) {\n annotationStroke.lineWidth = item.border.width;\n inkAnnotation.annotationStroke = annotationStroke;\n }\n const { path } = inkAnnotation;\n const { vertices } = path;\n vertices.clear();\n for (let line of inkAnnot.inkList) {\n let isFirstPoint = true;\n for (let point of line) {\n if (isFirstPoint) {\n vertices.add(new PdfViewing.Pdf.Geometry.Real.Vertex(inkAnnot.page, point.x, point.y, PdfViewing.Pdf.Geometry.Real.PathOperation.MoveTo));\n isFirstPoint = false;\n }\n else {\n vertices.add(new PdfViewing.Pdf.Geometry.Real.Vertex(inkAnnot.page, point.x, point.y, PdfViewing.Pdf.Geometry.Real.PathOperation.LineTo));\n }\n }\n }\n path.vertices = vertices;\n inkAnnotation.setPath(path);\n }\n if (item.itemType === PdfItemType.SQUARE || item.itemType === PdfItemType.CIRCLE) {\n // ! using square annotation type because there is no common base class\n const shapeAnnotation = nativeAnnot;\n // update stroke\n const { annotationStroke } = shapeAnnotation;\n if (annotationStroke) {\n annotationStroke.lineWidth = item.border.width;\n if (item.border.style === 1) {\n annotationStroke.dashArray = [item.border.width];\n }\n else {\n annotationStroke.dashArray = [0];\n }\n shapeAnnotation.annotationStroke = annotationStroke;\n }\n shapeAnnotation.borderStyleType = this.convertToNativeBorderStyle(item.border.style);\n shapeAnnotation.strokeColor = nativeColor;\n shapeAnnotation.fillColor = this.createNativeColor(item.fillColor);\n }\n if (item.itemType === PdfItemType.HIGHLIGHT ||\n item.itemType === PdfItemType.SQUIGGLY ||\n item.itemType === PdfItemType.STRIKE_OUT ||\n item.itemType === PdfItemType.UNDERLINE) {\n const textMarkupAnnot = nativeAnnot;\n textMarkupAnnot.color = nativeColor;\n }\n if (item.itemType === PdfItemType.STAMP) {\n const stampAnnot = nativeAnnot;\n if (rotationChanged) {\n stampAnnot.rotation = item.rotation;\n item.pdfRect = {\n page: stampAnnot.boundingBox.pageNumber,\n pdfX: stampAnnot.boundingBox.x,\n pdfY: stampAnnot.boundingBox.y,\n pdfW: stampAnnot.boundingBox.width,\n pdfH: stampAnnot.boundingBox.height,\n };\n }\n }\n (_b = this.pdfDocument) === null || _b === void 0 ? void 0 : _b.editAnnotation(nativeAnnot).then(() => {\n const { pageNumber } = nativeAnnot.boundingBox;\n const updatedItem = this.createWebViewerAnnotation(nativeAnnot, pageNumber);\n if (updatedItem) {\n this.handleAnnotationCache.set(item.id, updatedItem);\n this.dispatchEvent('itemUpdated', updatedItem);\n this.dispatchEvent('pageChanged', pageNumber);\n resolve(updatedItem);\n }\n else {\n throw new Error('failed to update item');\n }\n }).catch((error) => {\n reject(error);\n });\n }\n }\n });\n }\n getTextStampAspectRatio(stampText) {\n return new Promise((resolve, reject) => {\n var _a;\n if (this.pdfDocument && this.view) {\n (_a = this.pdfDocument) === null || _a === void 0 ? void 0 : _a.getTextStampAspectRatio(stampText).then((ratio) => {\n resolve(ratio);\n });\n }\n else {\n reject('No document opened');\n }\n });\n }\n createNativeColor(color) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n if (!color) {\n return new PdfViewing.Pdf.Annotations.Color(red, green, blue, alpha);\n }\n color = color.replace(/\\s+/gi, '');\n if (color.indexOf('#') === 0) {\n if (color.length === 4) {\n red = parseInt(color.substring(1, 2), 16);\n green = parseInt(color.substring(2, 3), 16);\n blue = parseInt(color.substring(3, 4), 16);\n alpha = 255;\n }\n else if (color.length === 5) {\n red = parseInt(color.substring(1, 2), 16);\n green = parseInt(color.substring(2, 3), 16);\n blue = parseInt(color.substring(3, 4), 16);\n alpha = parseInt(color.substring(4, 5), 16);\n }\n else if (color.length === 7) {\n red = parseInt(color.substring(1, 3), 16);\n green = parseInt(color.substring(3, 5), 16);\n blue = parseInt(color.substring(5, 7), 16);\n alpha = 255;\n }\n else if (color.length === 9) {\n red = parseInt(color.substring(1, 3), 16);\n green = parseInt(color.substring(3, 5), 16);\n blue = parseInt(color.substring(5, 7), 16);\n alpha = parseInt(color.substring(7, 9), 16);\n }\n else {\n throw new Error('invalid color string: ' + color);\n }\n }\n else if (color.indexOf('rgb') === 0) {\n const values = color.substring(color.indexOf('(') + 1, color.indexOf(')')).split(',');\n if (values.length < 3 || values.length > 4) {\n throw new Error('invalid color string: ' + color);\n }\n red = parseInt(values[0], 10);\n green = parseInt(values[1], 10);\n blue = parseInt(values[2], 10);\n if (values.length === 4) {\n alpha = Math.floor(parseFloat(values[3]) * 255);\n }\n else {\n alpha = 255;\n }\n }\n else {\n throw new Error('invalid color string: ' + color);\n }\n return new PdfViewing.Pdf.Annotations.Color(red, green, blue, alpha);\n }\n createWebViewerAnnotation(annot, page) {\n var _a, _b;\n let ww_annot = {};\n ww_annot.itemCategory = PdfItemCategory.ANNOTATION;\n ww_annot.sourceTag = annot.sourceTag;\n if (annot instanceof PdfViewing.Pdf.Annotations.MarkupAnnotation) {\n const bbox = annot.boundingBox;\n if (bbox) {\n ww_annot.pdfRect = this.ViewingPdfRect2WwPdfRect(bbox);\n }\n ww_annot.page = page;\n ww_annot.privateData = annot.privateData ? annot.privateData : null;\n const info = annot.info;\n if (info) {\n ww_annot.content = info === null || info === void 0 ? void 0 : info.content;\n ww_annot.author = (info === null || info === void 0 ? void 0 : info.author) || '';\n ww_annot.id = info === null || info === void 0 ? void 0 : info.getHashCode();\n ww_annot.modificationDate = (info === null || info === void 0 ? void 0 : info.modificationDate) || null;\n ww_annot.creationDate = (info === null || info === void 0 ? void 0 : info.creationDate) || null;\n ww_annot.subject = info === null || info === void 0 ? void 0 : info.subject;\n }\n ww_annot.isLocked = () => {\n const cachedAnnotation = this.nativeAnnotationCache.get(ww_annot.id);\n if (cachedAnnotation instanceof PdfViewing.Pdf.Annotations.MarkupAnnotation) {\n const markupAnnot = cachedAnnotation;\n if (markupAnnot.info) {\n return markupAnnot.info.locked;\n }\n }\n console.warn('annotation not found');\n return false;\n };\n ww_annot.setLock = (isLocked) => {\n const cachedAnnotation = this.nativeAnnotationCache.get(ww_annot.id);\n if (cachedAnnotation instanceof PdfViewing.Pdf.Annotations.MarkupAnnotation) {\n const markupAnnot = cachedAnnotation;\n if (markupAnnot.info) {\n markupAnnot.info.locked = isLocked;\n }\n }\n };\n if (annot instanceof PdfViewing.Pdf.Annotations.TextMarkup) {\n ww_annot.color = this.convertColorToRgbaString(annot.color);\n }\n ww_annot.isHidden = () => {\n const cachedAnnotation = this.nativeAnnotationCache.get(ww_annot.id);\n if (!cachedAnnotation) {\n console.warn('annotation not found');\n return false;\n }\n return cachedAnnotation.hidden;\n };\n ww_annot.setHidden = (isHidden) => {\n const cachedAnnotation = this.nativeAnnotationCache.get(ww_annot.id);\n if (!cachedAnnotation) {\n console.warn('annotation not found');\n return false;\n }\n return (cachedAnnotation.hidden = isHidden);\n };\n ww_annot.border = {};\n this.addPopup(ww_annot, annot);\n if (annot instanceof PdfViewing.Pdf.Annotations.StickyNote) {\n ww_annot.color = this.convertColorToRgbaString(annot.color);\n ww_annot.itemType = PdfItemType.TEXT;\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.FreeText) {\n ww_annot.itemType = PdfItemType.FREE_TEXT;\n const freetextAnnot = annot;\n const ww_freetextAnnot = ww_annot;\n ww_freetextAnnot.richText =\n freetextAnnot.richText ||\n `

${annot.info.content}

`;\n ww_freetextAnnot.rotation = freetextAnnot.rotation;\n ww_freetextAnnot.color = this.convertColorToRgbaString(freetextAnnot.backgroundColor);\n const stroke = freetextAnnot.annotationStroke;\n if (stroke) {\n ww_freetextAnnot.border.width = stroke === null || stroke === void 0 ? void 0 : stroke.lineWidth;\n ww_freetextAnnot.border.style = 0;\n stroke.close();\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.RectangleAnnotation) {\n const ww_shapeAnnot = ww_annot;\n ww_shapeAnnot.itemType = PdfItemType.SQUARE;\n ww_shapeAnnot.color = this.convertColorToRgbaString(annot.strokeColor);\n const stroke = annot.annotationStroke;\n if (stroke) {\n ww_shapeAnnot.border.width = stroke === null || stroke === void 0 ? void 0 : stroke.lineWidth;\n const hasDashArray = stroke.dashArray.length && stroke.dashArray[0] > 0;\n ww_shapeAnnot.border.style = hasDashArray\n ? 1\n : this.convertToWebViewerBorderStyle(annot.borderStyleType);\n stroke.close();\n }\n if (annot.fillColor) {\n ww_shapeAnnot.fillColor = this.convertColorToRgbaString(annot.fillColor);\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.EllipseAnnotation) {\n const ww_shapeAnnot = ww_annot;\n ww_shapeAnnot.itemType = PdfItemType.CIRCLE;\n ww_shapeAnnot.color = this.convertColorToRgbaString(annot.strokeColor);\n const stroke = annot.annotationStroke;\n if (stroke) {\n ww_shapeAnnot.border.width = stroke === null || stroke === void 0 ? void 0 : stroke.lineWidth;\n const hasDashArray = stroke.dashArray.length && stroke.dashArray[0] > 0;\n ww_shapeAnnot.border.style = hasDashArray\n ? 1\n : this.convertToWebViewerBorderStyle(annot.borderStyleType);\n stroke.close();\n }\n if (annot.fillColor) {\n ww_shapeAnnot.fillColor = this.convertColorToRgbaString(annot.fillColor);\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.PolygonAnnotation) {\n ww_annot.itemType = PdfItemType.POLYGON;\n const stroke = annot.annotationStroke;\n if (stroke) {\n ww_annot.border.width = stroke === null || stroke === void 0 ? void 0 : stroke.lineWidth;\n const hasDashArray = stroke.dashArray.length && stroke.dashArray[0] > 0;\n ww_annot.border.style = hasDashArray\n ? 1\n : this.convertToWebViewerBorderStyle(annot.borderStyleType);\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.PolyLineAnnotation) {\n ww_annot.itemType = PdfItemType.POLY_LINE;\n const stroke = annot.annotationStroke;\n if (stroke) {\n ww_annot.border.width = stroke === null || stroke === void 0 ? void 0 : stroke.lineWidth;\n ww_annot.border.style = 0;\n stroke.close();\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.TextMarkup) {\n const highlightAnnot = ww_annot;\n highlightAnnot.markedText = annot.markedText;\n if (annot.markupArea !== null) {\n highlightAnnot.quadrilaterals = [];\n for (let index = 0; index < annot.markupArea.size; index++) {\n highlightAnnot.quadrilaterals.push(annot.markupArea.get(index));\n }\n }\n if (annot instanceof PdfViewing.Pdf.Annotations.Highlight) {\n highlightAnnot.itemType = PdfItemType.HIGHLIGHT;\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.Underline) {\n highlightAnnot.itemType = PdfItemType.UNDERLINE;\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.Squiggly) {\n highlightAnnot.itemType = PdfItemType.SQUIGGLY;\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.StrikeThrough) {\n highlightAnnot.itemType = PdfItemType.STRIKE_OUT;\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.Stamp) {\n const stampAnnot = ww_annot;\n stampAnnot.itemType = PdfItemType.STAMP;\n stampAnnot.rotation = annot.rotation;\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.TextInsert) {\n return null;\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.InkAnnotation) {\n const sdkInkAnnot = annot;\n const inkAnnot = ww_annot;\n inkAnnot.itemType = PdfItemType.INK;\n inkAnnot.color = this.convertColorToRgbaString(sdkInkAnnot.strokeColor);\n inkAnnot.border = {\n width: ((_a = sdkInkAnnot.annotationStroke) === null || _a === void 0 ? void 0 : _a.lineWidth) || 1,\n style: AnnotationBorderStyle.SOLID,\n };\n // extract inklist\n inkAnnot.inkList = [];\n const { vertices } = sdkInkAnnot.path;\n let path = null;\n for (let i = 0; i < vertices.size; i++) {\n const vertex = vertices.get(i);\n if (vertex.operator === PdfViewing.Pdf.Geometry.Real.PathOperation.MoveTo) {\n if (path) {\n inkAnnot.inkList.push(path);\n }\n path = [{ x: vertex.x, y: vertex.y }];\n }\n else if (vertex.operator === PdfViewing.Pdf.Geometry.Real.PathOperation.LineTo) {\n path === null || path === void 0 ? void 0 : path.push({ x: vertex.x, y: vertex.y });\n }\n }\n if (path) {\n inkAnnot.inkList.push(path);\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.Popup) {\n return null;\n }\n else {\n return null;\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.Link) {\n ww_annot.itemType = PdfItemType.LINK;\n const linkAnnot = ww_annot;\n ww_annot.id = annot.getHashCode();\n ww_annot.pdfRect = this.ViewingPdfRect2WwPdfRect(annot.boundingBox);\n if (annot instanceof PdfViewing.Pdf.Annotations.WebLink) {\n linkAnnot.uri = annot.uri;\n linkAnnot.actionType = PdfActionType.URI;\n }\n else if (annot instanceof PdfViewing.Pdf.Annotations.InternalLink) {\n const target = (_b = annot.destination) === null || _b === void 0 ? void 0 : _b.target;\n linkAnnot.actionType = PdfActionType.GO_TO;\n if (target) {\n linkAnnot.destination = {\n destinationType: 8,\n pageNumber: target.pageNumber,\n left: null,\n top: null,\n zoom: null,\n };\n }\n }\n }\n else if (annot instanceof PdfViewing.Pdf.Forms.Widget) {\n const widgetAnnot = ww_annot;\n widgetAnnot.id = annot.getHashCode();\n widgetAnnot.itemType = PdfItemType.WIDGET;\n widgetAnnot.page = page;\n const bbox = annot.boundingBox;\n widgetAnnot.pdfRect = this.ViewingPdfRect2WwPdfRect(bbox);\n widgetAnnot.widget = annot;\n widgetAnnot.isLocked = () => {\n return false;\n };\n widgetAnnot.isHidden = () => {\n return annot.hidden;\n };\n widgetAnnot.setHidden = (isHidden) => {\n annot.hidden = isHidden;\n };\n widgetAnnot.pdfDocument = this.pdfDocument;\n if (annot instanceof PdfViewing.Pdf.Forms.CheckBox) {\n widgetAnnot.widgetType = WidgetType.CHECK_BOX;\n }\n else if (annot instanceof PdfViewing.Pdf.Forms.RadioButton) {\n widgetAnnot.widgetType = WidgetType.RADIO_BUTTON;\n }\n else if (annot instanceof PdfViewing.Pdf.Forms.TextBox) {\n widgetAnnot.widgetType = WidgetType.TEXT_BOX;\n }\n else if (annot instanceof PdfViewing.Pdf.Forms.ListBox) {\n widgetAnnot.widgetType = WidgetType.LIST_BOX;\n }\n else if (annot instanceof PdfViewing.Pdf.Forms.ComboBox) {\n widgetAnnot.widgetType = WidgetType.COMBO_BOX;\n // } else if (annot instanceof PdfViewing.Pdf.Forms.ListBox) {\n // widgetAnnot.widgetType = WidgetType.STRING_LIST\n }\n }\n else {\n return null;\n }\n const isReadOnly = () => {\n const { annotationPermissionCallback, onlyAuthorCanEdit, user } = this.pdfViewerApiOptions;\n let eventThrottlingTimer = null;\n let lastResult = false;\n const viewOnly = this.pdfViewerApiOptions.viewOnly ||\n !(PdfViewing.Sdk.supportedFeatures & PdfViewing.LicenseFeature.Annotate);\n return () => {\n if (eventThrottlingTimer) {\n return lastResult;\n }\n lastResult = false;\n if (viewOnly || !(PdfViewing.Sdk.supportedFeatures & PdfViewing.LicenseFeature.Annotate)) {\n lastResult = true;\n }\n else if (annotationPermissionCallback) {\n lastResult = !annotationPermissionCallback(ww_annot, user);\n }\n else if (onlyAuthorCanEdit) {\n lastResult = !ww_annot.author || user !== ww_annot.author;\n }\n eventThrottlingTimer = window.setTimeout(() => {\n eventThrottlingTimer = null;\n }, 50);\n return lastResult;\n };\n };\n ww_annot.isReadOnly = isReadOnly();\n ww_annot.behaviors = this.getAnnotationBehaviors(ww_annot);\n return ww_annot;\n }\n getAnnotationBehaviors(ww_annot) {\n const defaultBehaviors = annotationDefaultBehaviors[ww_annot.itemType];\n if (!defaultBehaviors) {\n return {\n isReadOnly: true,\n selectable: false,\n editable: false,\n deletable: false,\n movable: false,\n rotatable: false,\n resizable: false,\n aspectRatioChangeable: false,\n canHavePopup: false,\n link: false,\n text: false,\n };\n }\n let isReadOnly = false;\n if (this.pdfViewerApiOptions.viewOnly ||\n !(this.licenseFeatures & PdfViewing.LicenseFeature.Annotate)) {\n isReadOnly = true;\n }\n const behaviors = {\n isReadOnly,\n selectable: defaultBehaviors[0],\n editable: defaultBehaviors[1],\n deletable: defaultBehaviors[2],\n movable: defaultBehaviors[3],\n rotatable: defaultBehaviors[4],\n resizable: defaultBehaviors[5],\n aspectRatioChangeable: defaultBehaviors[6],\n canHavePopup: this.pdfViewerApiOptions.allowPopups && defaultBehaviors[7],\n link: defaultBehaviors[8],\n text: defaultBehaviors[9],\n };\n return behaviors;\n }\n addPopup(ww_annot, annot) {\n const popup = annot.popup;\n if (popup) {\n ww_annot.popup = {};\n ww_annot.popup.pdfRect = this.ViewingPdfRect2WwPdfRect(popup.boundingBox);\n ww_annot.popup.isOpen = popup.isOpen;\n ww_annot.popup.pdfRect.page = ww_annot.page;\n popup.close();\n }\n }\n getOpenPopups(firstPage, lastPage) {\n var _a;\n const annotationsWithOpenPopups = [];\n for (let i = firstPage; i <= lastPage; i++) {\n (_a = this.pageAnnotationCache.get(i)) === null || _a === void 0 ? void 0 : _a.forEach((annot) => {\n if (annot.popup && annot.popup.isOpen) {\n annotationsWithOpenPopups.push(annot);\n }\n });\n }\n return annotationsWithOpenPopups;\n }\n convertColorToRgbaString(color) {\n let rgba_string = '#';\n if (!color) {\n rgba_string += '00000000';\n return rgba_string;\n }\n // add red\n rgba_string += color.red.toString(16).padStart(2, '0');\n // add green\n rgba_string += color.green.toString(16).padStart(2, '0');\n // add blue\n rgba_string += color.blue.toString(16).padStart(2, '0');\n // add alpha\n rgba_string += color.alpha.toString(16).padStart(2, '0');\n return rgba_string;\n }\n getPageLayoutMode() {\n if (this.view) {\n return this.view.pageLayoutMode;\n }\n return PdfViewing.Pdf.Navigation.PageLayoutMode.SinglePage;\n }\n setPageLayoutMode(layout) {\n if (this.view) {\n this.view.pageLayoutMode = layout;\n }\n }\n getScrollMaxPosition() {\n var _a;\n const sp = (_a = this.view) === null || _a === void 0 ? void 0 : _a.scrollMaxPosition;\n if (sp) {\n sp.x = Math.max(sp.x - this.viewportSize.width, 0);\n sp.y = Math.max(sp.y - this.viewportSize.height, 0);\n }\n return sp;\n }\n getScrollPosition() {\n var _a;\n return (_a = this.view) === null || _a === void 0 ? void 0 : _a.scrollPosition;\n }\n setScrollPosition(pos) {\n const sp = new PdfViewing.Pdf.Geometry.Integer.ScrollPosition(pos.x, pos.y);\n if (this.view) {\n this.view.scrollPosition = pos; //sp // TODO: Is this good? Or should I create a PdfViewing.ScrollPosition first?\n }\n }\n getPageScreenRect(page) {\n var _a;\n const viewingRect = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getPageRectangleOnViewport(page);\n if (viewingRect) {\n return this.ViewingVPRect2WwVpRect(viewingRect);\n }\n return null;\n }\n getClosestPointOnPdfByScreenPoint(point, padding = 0, page) {\n if (this.view && this.pdfDocument) {\n const p = new PdfViewing.Pdf.Geometry.Integer.Point(point.x, point.y);\n const pointOnPage = page\n ? this.view.transformPointFromViewportToSpecificPage(p, page, true)\n : this.view.transformPointFromViewportToPage(p, true);\n const pageSize = this.pdfDocument.getPageSize(pointOnPage.pageNumber, true);\n const pdfPoint = {\n pdfX: pointOnPage.x,\n pdfY: pointOnPage.y,\n page: pointOnPage.pageNumber,\n };\n if (pdfPoint.pdfX < padding) {\n pdfPoint.pdfX = padding;\n }\n else if (pdfPoint.pdfX > pageSize.width - padding) {\n pdfPoint.pdfX = pageSize.width - padding;\n }\n if (pdfPoint.pdfY < padding) {\n pdfPoint.pdfY = padding;\n }\n else if (pdfPoint.pdfY > pageSize.height - padding) {\n pdfPoint.pdfY = pageSize.height - padding;\n }\n return pdfPoint;\n }\n throw new Error('PDF Document must not be null');\n }\n transformPdfLengthToScreenLength(pdfLength) {\n var _a;\n if (this.view) {\n return (_a = this.view) === null || _a === void 0 ? void 0 : _a.transformPdfLengthToViewportLength(pdfLength);\n }\n throw new Error('View must not be null');\n }\n transformScreenLengthToPdfLength(pdfLength) {\n var _a;\n if (this.view) {\n return (_a = this.view) === null || _a === void 0 ? void 0 : _a.transformViewportLengthToPdfLength(pdfLength);\n }\n throw new Error('View must not be null');\n }\n transformScreenPointToPdfPoint(point, page) {\n if (this.view && this.pdfDocument) {\n const p = new PdfViewing.Pdf.Geometry.Integer.Point(point.x, point.y);\n try {\n const pointOnPage = page\n ? this.view.transformPointFromViewportToSpecificPage(p, page, false)\n : this.view.transformPointFromViewportToPage(p, false);\n const pageSize = this.pdfDocument.getPageSize(pointOnPage.pageNumber, true);\n return {\n pdfPoint: { pdfX: pointOnPage.x, pdfY: pointOnPage.y, page: pointOnPage.pageNumber },\n isOnPage: pointOnPage.x >= 0 &&\n pointOnPage.x <= pageSize.width &&\n pointOnPage.y >= 0 &&\n pointOnPage.y <= pageSize.height,\n };\n }\n catch (error) {\n if (error instanceof PdfViewing.ArgumentError) {\n return { pdfPoint: null, isOnPage: false };\n }\n }\n }\n return null;\n }\n transformPdfPointToScreenPoint(pdfPoint) {\n var _a;\n const screenPoint = (_a = this.view) === null || _a === void 0 ? void 0 : _a.transformPointFromPageToViewport(new PdfViewing.Pdf.Geometry.Real.PointOnPage(pdfPoint.page, pdfPoint.pdfX, pdfPoint.pdfY));\n return {\n x: screenPoint === null || screenPoint === void 0 ? void 0 : screenPoint.x,\n y: screenPoint === null || screenPoint === void 0 ? void 0 : screenPoint.y,\n };\n }\n transformPdfPageRectToScreenRect(pdfRect) {\n var _a;\n const screenRect = (_a = this.view) === null || _a === void 0 ? void 0 : _a.transformRectangleFromPageToViewport(new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(pdfRect.page, pdfRect.pdfX, pdfRect.pdfY, pdfRect.pdfW, pdfRect.pdfH));\n return {\n x: screenRect === null || screenRect === void 0 ? void 0 : screenRect.x,\n y: screenRect === null || screenRect === void 0 ? void 0 : screenRect.y,\n w: screenRect === null || screenRect === void 0 ? void 0 : screenRect.width,\n h: screenRect === null || screenRect === void 0 ? void 0 : screenRect.height,\n };\n }\n transformScreenRectToPdfRect(screenRect, page) {\n var _a;\n const vpRect = new PdfViewing.Pdf.Geometry.Integer.Rectangle(screenRect.x, screenRect.y, screenRect.w, screenRect.h);\n try {\n const pdfRect = (_a = this.view) === null || _a === void 0 ? void 0 : _a.transformRectangleFromViewportToSpecificPage(vpRect, page);\n return {\n pdfX: pdfRect === null || pdfRect === void 0 ? void 0 : pdfRect.x,\n pdfY: pdfRect === null || pdfRect === void 0 ? void 0 : pdfRect.y,\n pdfW: pdfRect === null || pdfRect === void 0 ? void 0 : pdfRect.width,\n pdfH: pdfRect === null || pdfRect === void 0 ? void 0 : pdfRect.height,\n page,\n };\n }\n catch (error) {\n return null;\n }\n }\n transformQuadrilateralToViewport(quadrilateral) {\n const points = [];\n if (this.view) {\n points.push(this.view.transformPointFromPageToViewport(new PdfViewing.Pdf.Geometry.Real.PointOnPage(quadrilateral.pageNumber, quadrilateral.topLeft.x, quadrilateral.topLeft.y)));\n points.push(this.view.transformPointFromPageToViewport(new PdfViewing.Pdf.Geometry.Real.PointOnPage(quadrilateral.pageNumber, quadrilateral.topRight.x, quadrilateral.topRight.y)));\n points.push(this.view.transformPointFromPageToViewport(new PdfViewing.Pdf.Geometry.Real.PointOnPage(quadrilateral.pageNumber, quadrilateral.bottomRight.x, quadrilateral.bottomRight.y)));\n points.push(this.view.transformPointFromPageToViewport(new PdfViewing.Pdf.Geometry.Real.PointOnPage(quadrilateral.pageNumber, quadrilateral.bottomLeft.x, quadrilateral.bottomLeft.y)));\n }\n return points;\n }\n getAnnotationsOnPoint(point, onlySelectable) {\n var _a;\n const annotList = (_a = this.view) === null || _a === void 0 ? void 0 : _a.getAnnotationsOnPoint(point, onlySelectable);\n if (annotList && annotList.size > 0) {\n const annotationList = [];\n for (let i = 0; i < annotList.size; i++) {\n const annot = annotList.get(i);\n const annotId = annot.getHashCode();\n if (this.handleAnnotationCache.has(annotId)) {\n annotationList.push(this.handleAnnotationCache.get(annotId));\n }\n else {\n console.warn('annotation handle is not cached');\n }\n annot.close();\n }\n annotList.close();\n return annotationList;\n }\n return null;\n }\n getItemsFromPage(page, type) {\n if (type === 1) {\n return this.getAnnotationsFromPage(page);\n }\n }\n onDocumentOpened(document, renderOptions, viewOptions) {\n const _viewOptions = viewOptions ? viewOptions : new PdfViewing.Pdf.ViewOptions();\n _viewOptions.viewDPI = this.getXDPI();\n const { initialDestination, initialPageLayoutMode } = document;\n if (initialPageLayoutMode !== null && _viewOptions.initialPageLayoutMode === null) {\n _viewOptions.initialPageLayoutMode = initialPageLayoutMode;\n }\n if (initialDestination !== null && _viewOptions.initialDestination === null) {\n _viewOptions.initialDestination = initialDestination;\n }\n this.view = PdfViewing.Pdf.View.create(document, renderOptions, viewOptions);\n this.attachEventListeners();\n if (this.view) {\n this.dispatchEvent('firstVisiblePage', this.view.firstVisiblePage);\n this.dispatchEvent('lastVisiblePage', this.view.lastVisiblePage);\n this.dispatchEvent('pageNumber', this.view.pageNumber);\n this.dispatchEvent('fitMode', this.view.fitMode);\n this.dispatchEvent('pageLayoutMode', this.ViewingPageLayoutToWwPageLayout(this.view.pageLayoutMode));\n }\n }\n ViewingPageLayoutToWwPageLayout(layout) {\n switch (layout) {\n case PdfViewing.Pdf.Navigation.PageLayoutMode.OneColumn:\n return PdfPageLayoutMode.ONE_COLUMN;\n case PdfViewing.Pdf.Navigation.PageLayoutMode.SinglePage:\n return PdfPageLayoutMode.SINGLE_PAGE;\n case PdfViewing.Pdf.Navigation.PageLayoutMode.TwoColumnLeft:\n return PdfPageLayoutMode.TWO_COLUMN_LEFT;\n case PdfViewing.Pdf.Navigation.PageLayoutMode.TwoColumnRight:\n return PdfPageLayoutMode.TWO_COLUMN_RIGHT;\n case PdfViewing.Pdf.Navigation.PageLayoutMode.TwoPageLeft:\n return PdfPageLayoutMode.TWO_PAGE_LEFT;\n case PdfViewing.Pdf.Navigation.PageLayoutMode.TwoPageRight:\n return PdfPageLayoutMode.TWO_PAGE_RIGHT;\n default:\n return PdfPageLayoutMode.ONE_COLUMN;\n }\n }\n WwPageLayoutToViewingPageLayout(layout) {\n switch (layout) {\n case PdfPageLayoutMode.ONE_COLUMN:\n return PdfViewing.Pdf.Navigation.PageLayoutMode.OneColumn;\n case PdfPageLayoutMode.SINGLE_PAGE:\n return PdfViewing.Pdf.Navigation.PageLayoutMode.SinglePage;\n case PdfPageLayoutMode.TWO_COLUMN_LEFT:\n return PdfViewing.Pdf.Navigation.PageLayoutMode.TwoColumnLeft;\n case PdfPageLayoutMode.TWO_COLUMN_RIGHT:\n return PdfViewing.Pdf.Navigation.PageLayoutMode.TwoColumnRight;\n case PdfPageLayoutMode.TWO_PAGE_LEFT:\n return PdfViewing.Pdf.Navigation.PageLayoutMode.TwoPageLeft;\n case PdfPageLayoutMode.TWO_PAGE_RIGHT:\n return PdfViewing.Pdf.Navigation.PageLayoutMode.TwoPageRight;\n case PdfPageLayoutMode.ONE_COLUMN:\n default:\n return PdfViewing.Pdf.Navigation.PageLayoutMode.OneColumn;\n }\n }\n WwFitModeToViewingFitMode(fitMode) {\n switch (fitMode) {\n case PdfFitMode.NONE:\n return PdfViewing.Pdf.Navigation.FitMode.None;\n case PdfFitMode.FIT_PAGE:\n return PdfViewing.Pdf.Navigation.FitMode.FitPage;\n case PdfFitMode.FIT_WIDTH:\n return PdfViewing.Pdf.Navigation.FitMode.FitWidth;\n default:\n return PdfViewing.Pdf.Navigation.FitMode.None;\n }\n }\n getLastVisiblePage() {\n if (this.view) {\n return this.view.lastVisiblePage;\n }\n return 0;\n }\n getFirstVisiblePage() {\n if (this.view) {\n return this.view.firstVisiblePage;\n }\n return 0;\n }\n drawImages(ctx, data, options) {\n if (data.visiblePages) {\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n const currentPage = this.getPageNumber();\n for (let i = 0; i < data.visiblePages.size; i++) {\n const { image, pageRect, pageNumber } = data.visiblePages.get(i);\n ctx.save();\n if (currentPage === pageNumber && options.currentPageShadow) {\n ctx.shadowColor = options.currentPageShadow.shadowColor;\n ctx.shadowBlur = options.currentPageShadow.shadowBlur;\n ctx.shadowOffsetX = options.currentPageShadow.shadowOffsetX;\n ctx.shadowOffsetY = options.currentPageShadow.shadowOffsetY;\n }\n else if (options.pageShadow) {\n ctx.shadowColor = options.pageShadow.shadowColor;\n ctx.shadowBlur = options.pageShadow.shadowBlur;\n ctx.shadowOffsetX = options.pageShadow.shadowOffsetX;\n ctx.shadowOffsetY = options.pageShadow.shadowOffsetY;\n }\n ctx.fillStyle = '#ffffffff';\n ctx.fillRect(pageRect.x, pageRect.y, pageRect.width, pageRect.height);\n ctx.restore();\n if (image) {\n const imageContainer = this.imageBitmapCache.get(image.id);\n if (imageContainer) {\n const { scaledImage, imageData } = imageContainer;\n const { imageRectangle } = image;\n if (imageData && scaledImage) {\n if (imageRectangle.width !== image.width || imageRectangle.height !== image.height) {\n ctx.drawImage(scaledImage, pageRect.x + imageRectangle.x, pageRect.y + imageRectangle.y, imageRectangle.width, imageRectangle.height);\n }\n else {\n ctx.putImageData(imageData, pageRect.x + imageRectangle.x, pageRect.y + imageRectangle.y);\n }\n }\n }\n image.close();\n }\n }\n }\n }\n addEventListener(type, listener) {\n if (type === 'busyState') {\n this.pdfController.addEventListener('busyChanged', listener);\n return;\n }\n if (this.eventListeners.has(type)) {\n ;\n this.eventListeners.get(type).push(listener);\n }\n else {\n this.eventListeners.set(type, [listener]);\n }\n }\n removeEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n let listeners = this.eventListeners.get(type);\n listeners = listeners.filter((listenerInArray) => listenerInArray !== listener);\n if (listeners.length !== 0) {\n this.eventListeners.set(type, listeners);\n }\n else {\n this.eventListeners.delete(type);\n }\n }\n }\n dispatchEvent(type, args) {\n if (this.eventListeners.has(type)) {\n const listeners = this.eventListeners.get(type);\n listeners.forEach((listener) => listener(args));\n }\n }\n attachEventListeners() {\n if (this.view) {\n this.view.addEventListener('viewUpdated', this.onViewUpdated);\n this.view.addEventListener('imageCreated', this.onImageCreated);\n this.view.addEventListener('imageRemovedFromCache', this.onImageRemovedFromCache);\n }\n }\n onViewUpdated(args) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n if (args.bitmapsUpdated) {\n }\n if (args.fitmodeChanged) {\n (_a = this.eventListeners.get('fitMode')) === null || _a === void 0 ? void 0 : _a.forEach((listener) => {\n listener(this.view ? this.view.fitMode : PdfViewing.Pdf.Navigation.FitMode.None);\n });\n }\n if (args.pageLayoutModeChanged) {\n (_b = this.eventListeners.get('pageLayoutMode')) === null || _b === void 0 ? void 0 : _b.forEach((listener) => {\n listener(this.view ? this.view.pageLayoutMode : 0);\n });\n }\n if (args.pageSizeUpdated) {\n }\n if (args.scrollMaxPositionChanged) {\n }\n if (args.viewRotationChanged) {\n (_c = this.eventListeners.get('rotation')) === null || _c === void 0 ? void 0 : _c.forEach((listener) => {\n listener(this.view ? this.view.viewRotation : 0);\n });\n }\n if (args.visisblePageRangeChanged) {\n (_d = this.eventListeners.get('firstVisiblePage')) === null || _d === void 0 ? void 0 : _d.forEach((listener) => {\n listener(this.view ? this.view.firstVisiblePage : 0);\n });\n (_e = this.eventListeners.get('lastVisiblePage')) === null || _e === void 0 ? void 0 : _e.forEach((listener) => {\n listener(this.view ? this.view.lastVisiblePage : 0);\n });\n }\n if (args.pageNumberChanged) {\n (_f = this.eventListeners.get('pageNumber')) === null || _f === void 0 ? void 0 : _f.forEach((listener) => {\n listener(this.view ? this.view.pageNumber : 0);\n });\n }\n if (args.zoomChanged) {\n (_g = this.eventListeners.get('zoom')) === null || _g === void 0 ? void 0 : _g.forEach((listener) => {\n listener(this.view ? this.view.zoom : 0);\n });\n }\n // A ViewUpdatedEvent should always dispatch a\n // CanvasInvalidated Event\n (_h = this.eventListeners.get('canvasInvalidated')) === null || _h === void 0 ? void 0 : _h.forEach((listener) => {\n listener(true);\n });\n }\n onImageRemovedFromCache(id) {\n const imgContainer = this.imageBitmapCache.get(id);\n imgContainer === null || imgContainer === void 0 ? void 0 : imgContainer.destroy();\n this.imageBitmapCache.delete(id);\n }\n onImageCreated(image) {\n this.imageBitmapCache.set(image.id, new ImageContainer(image));\n image.removeImageData();\n image.close();\n }\n getProductVersion() {\n return PdfViewing.Sdk.version;\n }\n getXDPI() {\n var _a;\n if (this.devicePixelRatio !== window.devicePixelRatio || this.xDPI === 0) {\n const dpi = document.createElement('div');\n dpi.style.height = '1in';\n dpi.style.width = '1in';\n dpi.style.visibility = 'hidden';\n document.body.appendChild(dpi);\n this.xDPI = window.devicePixelRatio * dpi.offsetWidth;\n (_a = dpi.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(dpi);\n }\n return this.xDPI;\n }\n getYDPI() {\n var _a;\n if (this.devicePixelRatio !== window.devicePixelRatio || this.yDPI === 0) {\n const dpi = document.createElement('div');\n dpi.style.height = '1in';\n dpi.style.width = '1in';\n dpi.style.visibility = 'hidden';\n document.body.appendChild(dpi);\n this.yDPI = window.devicePixelRatio * dpi.offsetHeight;\n (_a = dpi.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(dpi);\n }\n return this.yDPI;\n }\n ViewingPdfRect2WwPdfRect(rect) {\n return {\n pdfX: rect.x,\n pdfY: rect.y,\n pdfW: rect.width,\n pdfH: rect.height,\n page: rect.pageNumber,\n };\n }\n ViewingQuadrilateral2WwPdfRect(quadrilateral) {\n if (quadrilateral.bottomLeft && quadrilateral.bottomRight && quadrilateral.topLeft) {\n const width = quadrilateral.bottomRight.x - quadrilateral.bottomLeft.x;\n const height = quadrilateral.topLeft.y - quadrilateral.bottomLeft.y;\n return {\n pdfX: quadrilateral.bottomLeft.x,\n pdfY: quadrilateral.bottomLeft.y,\n pdfW: width,\n pdfH: height,\n page: quadrilateral.pageNumber,\n };\n }\n return { page: -1, pdfX: -1, pdfY: -1, pdfW: -1, pdfH: -1 };\n }\n ViewingVPRect2WwVpRect(rect) {\n return { x: rect.x, y: rect.y, w: rect.width, h: rect.height };\n }\n}\n","import { PdfItemType } from './enums';\n// prettier-ignore\nexport const annotationDefaultBehaviors = {\n // select,edit, delete,move, rotate,resize,ratio, popup, link, text\n [PdfItemType.TEXT]: [true, false, true, true, false, false, false, true, false, false],\n [PdfItemType.LINK]: [false, false, false, true, false, false, false, false, true, false],\n [PdfItemType.FREE_TEXT]: [true, false, true, true, true, true, true, false, false, false],\n [PdfItemType.LINE]: [true, false, true, true, false, true, true, true, false, false],\n [PdfItemType.SQUARE]: [true, false, true, true, false, true, true, true, false, false],\n [PdfItemType.CIRCLE]: [true, false, true, true, false, true, true, true, false, false],\n [PdfItemType.POLYGON]: [true, false, true, true, false, true, true, true, false, false],\n [PdfItemType.POLY_LINE]: [true, false, true, true, false, true, true, true, false, false],\n [PdfItemType.HIGHLIGHT]: [true, false, true, false, false, false, false, true, false, true],\n [PdfItemType.UNDERLINE]: [true, false, true, false, false, false, false, true, false, true],\n [PdfItemType.SQUIGGLY]: [true, false, true, false, false, false, false, true, false, true],\n [PdfItemType.STRIKE_OUT]: [true, false, true, false, false, false, false, true, false, true],\n [PdfItemType.STAMP]: [true, false, true, true, true, true, false, true, false, false],\n [PdfItemType.CARET]: [true, false, true, false, false, false, false, true, false, false],\n [PdfItemType.INK]: [true, false, true, true, false, true, true, true, false, false],\n [PdfItemType.POPUP]: [false, false, false, false, false, false, false, false, false, false],\n [PdfItemType.FILE_ATTACHMENT]: [false, false, false, false, false, false, false, false, false, false],\n [PdfItemType.SOUND]: [false, false, false, false, false, false, false, false, false, false],\n [PdfItemType.MOVIE]: [false, false, false, false, false, false, false, false, false, false],\n [PdfItemType.WIDGET]: [true, false, false, false, false, false, false, false, false, false],\n [PdfItemType.SCREEN]: [false, false, false, false, false, false, false, false, false, false],\n [PdfItemType.PRINTER_MARK]: [false, false, false, false, false, false, false, false, false, false],\n [PdfItemType.TRAP_NET]: [false, false, false, false, false, false, false, false, false, false],\n [PdfItemType.WATERMARK]: [false, false, false, false, false, false, false, false, false, false],\n [PdfItemType.THREED]: [false, false, false, false, false, false, false, false, false, false],\n};\n","export var PdfItemCategory;\n(function (PdfItemCategory) {\n PdfItemCategory[PdfItemCategory[\"ANNOTATION\"] = 1] = \"ANNOTATION\";\n PdfItemCategory[PdfItemCategory[\"TEXT_FRAGMENT\"] = 2] = \"TEXT_FRAGMENT\";\n PdfItemCategory[PdfItemCategory[\"OUTLINE\"] = 3] = \"OUTLINE\";\n PdfItemCategory[PdfItemCategory[\"DESTINATION\"] = 4] = \"DESTINATION\";\n PdfItemCategory[PdfItemCategory[\"CONTENT_ELEMENT\"] = 5] = \"CONTENT_ELEMENT\";\n})(PdfItemCategory || (PdfItemCategory = {}));\nexport var AnnotationBorderStyle;\n(function (AnnotationBorderStyle) {\n AnnotationBorderStyle[AnnotationBorderStyle[\"SOLID\"] = 0] = \"SOLID\";\n AnnotationBorderStyle[AnnotationBorderStyle[\"DASHED\"] = 1] = \"DASHED\";\n AnnotationBorderStyle[AnnotationBorderStyle[\"BEVELED\"] = 2] = \"BEVELED\";\n AnnotationBorderStyle[AnnotationBorderStyle[\"INSET\"] = 3] = \"INSET\";\n AnnotationBorderStyle[AnnotationBorderStyle[\"UNDERLINE\"] = 4] = \"UNDERLINE\";\n})(AnnotationBorderStyle || (AnnotationBorderStyle = {}));\nexport var StampAnnotationColor;\n(function (StampAnnotationColor) {\n StampAnnotationColor[StampAnnotationColor[\"GREEN\"] = 0] = \"GREEN\";\n StampAnnotationColor[StampAnnotationColor[\"RED\"] = 1] = \"RED\";\n StampAnnotationColor[StampAnnotationColor[\"BLUE\"] = 2] = \"BLUE\";\n})(StampAnnotationColor || (StampAnnotationColor = {}));\nexport var WidgetType;\n(function (WidgetType) {\n WidgetType[WidgetType[\"CHECK_BOX\"] = 1] = \"CHECK_BOX\";\n WidgetType[WidgetType[\"RADIO_BUTTON\"] = 2] = \"RADIO_BUTTON\";\n WidgetType[WidgetType[\"TEXT_BOX\"] = 3] = \"TEXT_BOX\";\n WidgetType[WidgetType[\"LIST_BOX\"] = 4] = \"LIST_BOX\";\n WidgetType[WidgetType[\"COMBO_BOX\"] = 5] = \"COMBO_BOX\";\n})(WidgetType || (WidgetType = {}));\nexport var PdfItemType;\n(function (PdfItemType) {\n PdfItemType[PdfItemType[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n PdfItemType[PdfItemType[\"TEXT\"] = 1] = \"TEXT\";\n PdfItemType[PdfItemType[\"LINK\"] = 2] = \"LINK\";\n PdfItemType[PdfItemType[\"FREE_TEXT\"] = 3] = \"FREE_TEXT\";\n PdfItemType[PdfItemType[\"LINE\"] = 4] = \"LINE\";\n PdfItemType[PdfItemType[\"SQUARE\"] = 5] = \"SQUARE\";\n PdfItemType[PdfItemType[\"CIRCLE\"] = 6] = \"CIRCLE\";\n PdfItemType[PdfItemType[\"POLYGON\"] = 7] = \"POLYGON\";\n PdfItemType[PdfItemType[\"POLY_LINE\"] = 8] = \"POLY_LINE\";\n PdfItemType[PdfItemType[\"HIGHLIGHT\"] = 9] = \"HIGHLIGHT\";\n PdfItemType[PdfItemType[\"UNDERLINE\"] = 10] = \"UNDERLINE\";\n PdfItemType[PdfItemType[\"SQUIGGLY\"] = 11] = \"SQUIGGLY\";\n PdfItemType[PdfItemType[\"STRIKE_OUT\"] = 12] = \"STRIKE_OUT\";\n PdfItemType[PdfItemType[\"STAMP\"] = 13] = \"STAMP\";\n PdfItemType[PdfItemType[\"CARET\"] = 14] = \"CARET\";\n PdfItemType[PdfItemType[\"INK\"] = 15] = \"INK\";\n PdfItemType[PdfItemType[\"POPUP\"] = 16] = \"POPUP\";\n PdfItemType[PdfItemType[\"FILE_ATTACHMENT\"] = 17] = \"FILE_ATTACHMENT\";\n PdfItemType[PdfItemType[\"SOUND\"] = 18] = \"SOUND\";\n PdfItemType[PdfItemType[\"MOVIE\"] = 19] = \"MOVIE\";\n PdfItemType[PdfItemType[\"WIDGET\"] = 20] = \"WIDGET\";\n PdfItemType[PdfItemType[\"SCREEN\"] = 21] = \"SCREEN\";\n PdfItemType[PdfItemType[\"PRINTER_MARK\"] = 22] = \"PRINTER_MARK\";\n PdfItemType[PdfItemType[\"TRAP_NET\"] = 23] = \"TRAP_NET\";\n PdfItemType[PdfItemType[\"WATERMARK\"] = 24] = \"WATERMARK\";\n PdfItemType[PdfItemType[\"THREED\"] = 25] = \"THREED\";\n})(PdfItemType || (PdfItemType = {}));\nexport var PdfDestinationType;\n(function (PdfDestinationType) {\n PdfDestinationType[PdfDestinationType[\"FIT\"] = 1] = \"FIT\";\n PdfDestinationType[PdfDestinationType[\"FITH\"] = 2] = \"FITH\";\n PdfDestinationType[PdfDestinationType[\"FITV\"] = 3] = \"FITV\";\n PdfDestinationType[PdfDestinationType[\"FITR\"] = 4] = \"FITR\";\n PdfDestinationType[PdfDestinationType[\"FITB\"] = 5] = \"FITB\";\n PdfDestinationType[PdfDestinationType[\"FITBH\"] = 6] = \"FITBH\";\n PdfDestinationType[PdfDestinationType[\"FITBV\"] = 7] = \"FITBV\";\n PdfDestinationType[PdfDestinationType[\"XYZ\"] = 8] = \"XYZ\";\n})(PdfDestinationType || (PdfDestinationType = {}));\nexport var PdfFitMode;\n(function (PdfFitMode) {\n PdfFitMode[PdfFitMode[\"NONE\"] = 0] = \"NONE\";\n PdfFitMode[PdfFitMode[\"FIT_WIDTH\"] = 1] = \"FIT_WIDTH\";\n PdfFitMode[PdfFitMode[\"FIT_PAGE\"] = 2] = \"FIT_PAGE\";\n})(PdfFitMode || (PdfFitMode = {}));\nexport var PdfPageLayoutMode;\n(function (PdfPageLayoutMode) {\n PdfPageLayoutMode[PdfPageLayoutMode[\"SINGLE_PAGE\"] = 0] = \"SINGLE_PAGE\";\n PdfPageLayoutMode[PdfPageLayoutMode[\"ONE_COLUMN\"] = 1] = \"ONE_COLUMN\";\n PdfPageLayoutMode[PdfPageLayoutMode[\"TWO_COLUMN_LEFT\"] = 2] = \"TWO_COLUMN_LEFT\";\n PdfPageLayoutMode[PdfPageLayoutMode[\"TWO_COLUMN_RIGHT\"] = 3] = \"TWO_COLUMN_RIGHT\";\n PdfPageLayoutMode[PdfPageLayoutMode[\"TWO_PAGE_LEFT\"] = 4] = \"TWO_PAGE_LEFT\";\n PdfPageLayoutMode[PdfPageLayoutMode[\"TWO_PAGE_RIGHT\"] = 5] = \"TWO_PAGE_RIGHT\";\n})(PdfPageLayoutMode || (PdfPageLayoutMode = {}));\nexport var PdfActionType;\n(function (PdfActionType) {\n PdfActionType[PdfActionType[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n PdfActionType[PdfActionType[\"GO_TO\"] = 1] = \"GO_TO\";\n PdfActionType[PdfActionType[\"URI\"] = 2] = \"URI\";\n})(PdfActionType || (PdfActionType = {}));\nexport var StampType;\n(function (StampType) {\n StampType[StampType[\"TEXT\"] = 0] = \"TEXT\";\n StampType[StampType[\"IMAGE\"] = 1] = \"IMAGE\";\n})(StampType || (StampType = {}));\nexport var SearchResultType;\n(function (SearchResultType) {\n SearchResultType[SearchResultType[\"OK\"] = 0] = \"OK\";\n SearchResultType[SearchResultType[\"NO_RESULT\"] = 1] = \"NO_RESULT\";\n SearchResultType[SearchResultType[\"END\"] = 2] = \"END\";\n})(SearchResultType || (SearchResultType = {}));\nexport var DocumentChange;\n(function (DocumentChange) {\n DocumentChange[DocumentChange[\"NONE\"] = 0] = \"NONE\";\n DocumentChange[DocumentChange[\"ANNOTATION\"] = 1] = \"ANNOTATION\";\n DocumentChange[DocumentChange[\"CONTENT\"] = 2] = \"CONTENT\";\n})(DocumentChange || (DocumentChange = {}));\nexport var RotationDirection;\n(function (RotationDirection) {\n RotationDirection[RotationDirection[\"CLOCKWISE\"] = 90] = \"CLOCKWISE\";\n RotationDirection[RotationDirection[\"COUNTERCLOCKWISE\"] = 270] = \"COUNTERCLOCKWISE\";\n})(RotationDirection || (RotationDirection = {}));\n","export * from './types';\nexport * from './enums';\nexport * from './PdfViewerApi';\n","export var FileType;\n(function (FileType) {\n FileType[FileType[\"Pdf\"] = 0] = \"Pdf\";\n FileType[FileType[\"Fdf\"] = 1] = \"Fdf\";\n // Xfdf, uncomment, once we support saving xfdf files\n})(FileType || (FileType = {}));\n","/** internal */\nexport class CanvasEvents {\n constructor(element) {\n this.eventListeners = new Map();\n this.trackEvents = true;\n this.startPosX = 0;\n this.startPosY = 0;\n this.multiTouch = false;\n this.pinch = false;\n this.dragging = false;\n this.lastTouchPosX = 0;\n this.lastTouchPosY = 0;\n this.lastPinchDiv = 0;\n this.lastPinchPosX = 0;\n this.lastPinchPosY = 0;\n this.lastTouchX1 = 0;\n this.lastTouchY1 = 0;\n this.lastTouchX2 = 0;\n this.lastTouchY2 = 0;\n this.clickTimer = null;\n this.clickDuration = 250;\n this.dblClickTimer = null;\n this.dblClickDuration = 250;\n this.longPressTimer = null;\n this.longPressDuration = 750;\n this.onMouseDown = this.onMouseDown.bind(this);\n this.onTouchStart = this.onTouchStart.bind(this);\n this.onStart = this.onStart.bind(this);\n this.onMouseMove = this.onMouseMove.bind(this);\n this.onTouchMove = this.onTouchMove.bind(this);\n this.onMove = this.onMove.bind(this);\n this.onMouseUp = this.onMouseUp.bind(this);\n this.onTouchEnd = this.onTouchEnd.bind(this);\n this.onEnd = this.onEnd.bind(this);\n this.suspend = this.suspend.bind(this);\n this.resume = this.resume.bind(this);\n this.element = element;\n this.element.addEventListener('mousedown', this.onMouseDown, {\n passive: true,\n });\n this.element.addEventListener('mousemove', this.onMouseMove, {\n passive: true,\n });\n this.element.addEventListener('touchstart', this.onTouchStart, {\n passive: false,\n });\n window.addEventListener('pdfwebviewer.DragMoveHandlerStart', () => {\n this.suspend();\n }, { passive: true });\n window.addEventListener('pdfwebviewer.DragMoveHandlerEnd', () => {\n this.resume();\n }, { passive: true });\n }\n addEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n ;\n this.eventListeners.get(type).push(listener);\n }\n else {\n this.eventListeners.set(type, [listener]);\n }\n }\n removeEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n let listeners = this.eventListeners.get(type);\n listeners = listeners.filter((listenerInArray) => listenerInArray !== listener);\n if (listeners.length !== 0) {\n this.eventListeners.set(type, listeners);\n }\n else {\n this.eventListeners.delete(type);\n }\n }\n }\n suspend() {\n this.trackEvents = false;\n this.element.removeEventListener('mousemove', this.onMouseMove);\n window.removeEventListener('touchmove', this.onTouchMove);\n }\n resume() {\n if (!this.trackEvents) {\n this.trackEvents = true;\n this.element.addEventListener('mousemove', this.onMouseMove, {\n passive: true,\n });\n }\n }\n dispatchEvent(type, args) {\n if (this.eventListeners.has(type)) {\n const listeners = this.eventListeners.get(type);\n listeners.forEach((listener) => listener(args));\n }\n }\n clearClickTimer() {\n if (this.clickTimer !== null) {\n window.clearTimeout(this.clickTimer);\n this.clickTimer = null;\n }\n }\n clearLongPressTimer() {\n if (this.longPressTimer !== null) {\n window.clearTimeout(this.longPressTimer);\n this.longPressTimer = null;\n }\n }\n clearDblClickTimer() {\n if (this.dblClickTimer !== null) {\n window.clearTimeout(this.dblClickTimer);\n this.dblClickTimer = null;\n }\n }\n mouseToCanvasPointerEvent(e) {\n return {\n clientX: e.clientX,\n clientY: e.clientY,\n movementX: e.movementX,\n movementY: e.movementY,\n buttons: e.buttons,\n type: 'mouse',\n };\n }\n touchToCanvasPointerEvent(e) {\n const event = {\n clientX: e.touches[0].clientX,\n clientY: e.touches[0].clientY,\n movementX: e.touches[0].clientX - this.lastTouchPosX,\n movementY: e.touches[0].clientY - this.lastTouchPosY,\n buttons: e.touches.length === 1 ? 1 : 4,\n type: 'touch',\n };\n this.lastTouchPosX = e.touches[0].clientX;\n this.lastTouchPosY = e.touches[0].clientY;\n return event;\n }\n getPinchPos(e) {\n const x1 = e.touches[0].clientX;\n const y1 = e.touches[0].clientY;\n const x2 = e.touches[1].clientX;\n const y2 = e.touches[1].clientY;\n const vx = Math.abs(x1 - x2);\n const vy = Math.abs(y1 - y2);\n const distance = Math.sqrt(vx * vx + vy * vy);\n const clientX = Math.min(x1, x2) + vx;\n const clientY = Math.min(y1, y2) + vy;\n return {\n clientX,\n clientY,\n distance,\n };\n }\n touchToCanvasPointerPinchEvent(e) {\n const { clientX, clientY, distance } = this.getPinchPos(e);\n const event = {\n clientX,\n clientY,\n movementX: clientX - this.lastPinchPosX,\n movementY: clientY - this.lastPinchPosY,\n distance,\n movementDistance: distance - this.lastPinchDiv,\n buttons: 1,\n type: 'touch',\n };\n this.lastPinchPosX = event.clientX;\n this.lastPinchPosY = event.clientY;\n this.lastPinchDiv = distance;\n return event;\n }\n onMouseDown(e) {\n if (this.trackEvents) {\n const event = this.mouseToCanvasPointerEvent(e);\n this.onStart(event);\n window.addEventListener('mouseup', this.onMouseUp, { passive: true });\n }\n }\n onTouchStart(e) {\n e.preventDefault();\n // e.stopPropagation()\n this.pinch = false;\n if (this.trackEvents) {\n if (e.touches.length === 0) {\n return;\n }\n else if (e.touches.length === 1) {\n this.lastTouchPosX = e.touches[0].clientX;\n this.lastTouchPosY = e.touches[0].clientY;\n const event = this.touchToCanvasPointerEvent(e);\n this.onStart(event);\n window.addEventListener('touchmove', this.onTouchMove, {\n passive: false,\n });\n window.addEventListener('touchend', this.onTouchEnd, { passive: false });\n }\n else if (e.touches.length === 2) {\n this.clearClickTimer();\n this.clearDblClickTimer();\n this.clearLongPressTimer();\n this.multiTouch = true;\n const { clientX, clientY, distance } = this.getPinchPos(e);\n this.lastPinchDiv = distance;\n this.lastPinchPosX = clientX;\n this.lastPinchPosY = clientY;\n this.lastTouchX1 = e.touches[0].clientX;\n this.lastTouchY1 = e.touches[0].clientY;\n this.lastTouchX2 = e.touches[1].clientX;\n this.lastTouchY2 = e.touches[1].clientY;\n window.addEventListener('touchmove', this.onTouchMove, {\n passive: false,\n });\n window.addEventListener('touchend', this.onTouchEnd, { passive: false });\n }\n }\n }\n onStart(e) {\n this.startPosX = e.clientX;\n this.startPosY = e.clientY;\n this.dragging = false;\n if (!this.dblClickTimer) {\n this.clickTimer = window.setTimeout(() => {\n this.clickTimer = null;\n }, this.clickDuration);\n }\n this.longPressTimer = window.setTimeout(() => {\n this.longPressTimer = null;\n this.dispatchEvent('pointerlongpress', e);\n }, this.longPressDuration);\n this.dispatchEvent('pointerdown', e);\n }\n onMouseMove(e) {\n const event = this.mouseToCanvasPointerEvent(e);\n this.onMove(event);\n }\n onTouchMove(e) {\n e.preventDefault();\n e.stopPropagation();\n if (!e.touches) {\n return;\n }\n if (e.touches.length === 1 && !this.multiTouch) {\n const event = this.touchToCanvasPointerEvent(e);\n this.onMove(event);\n }\n else if (e.touches.length === 2) {\n const event = this.touchToCanvasPointerPinchEvent(e);\n const x1 = e.touches[0].clientX;\n const y1 = e.touches[0].clientY;\n const x2 = e.touches[1].clientX;\n const y2 = e.touches[1].clientY;\n const dX1 = x1 - this.lastTouchX1;\n const dY1 = y1 - this.lastTouchY1;\n const dX2 = x2 - this.lastTouchX2;\n const dY2 = y2 - this.lastTouchY2;\n const sX1 = Math.sign(dX1);\n const sY1 = Math.sign(dY1);\n const sX2 = Math.sign(dX2);\n const sY2 = Math.sign(dY2);\n if ((sX1 === sX2 && sY1 === sY2) ||\n ((sX1 === sX2 || dX1 === 0 || dX2 === 0) && (sY1 === sY2 || dY1 === 0 || dY2 === 0)) ||\n Math.max(Math.abs(event.movementX), Math.abs(event.movementY)) >\n Math.abs(event.movementDistance)) {\n event.buttons = 4;\n this.onMove(event);\n this.pinch = false;\n }\n else {\n this.dispatchEvent('pinch', event);\n this.pinch = true;\n }\n this.lastTouchX1 = e.touches[0].clientX;\n this.lastTouchY1 = e.touches[0].clientY;\n this.lastTouchX2 = e.touches[1].clientX;\n this.lastTouchY2 = e.touches[1].clientY;\n }\n }\n onMove(e) {\n this.dispatchEvent('pointermove', e);\n if (this.clickTimer || this.longPressTimer) {\n if (Math.abs(this.startPosX - e.clientX) > 5 || Math.abs(this.startPosY - e.clientY) > 5) {\n this.clearLongPressTimer();\n this.clearClickTimer();\n this.dispatchEvent('pointerstartdrag', e);\n this.dragging = true;\n }\n }\n else if (e.buttons > 0 && !this.dragging) {\n this.dispatchEvent('pointerstartdrag', e);\n this.dragging = true;\n }\n }\n onMouseUp(e) {\n const event = this.mouseToCanvasPointerEvent(e);\n this.onEnd(event);\n window.removeEventListener('mouseup', this.onMouseUp);\n }\n onTouchEnd(e) {\n // e.preventDefault()\n // e.stopPropagation()\n if (e.touches.length === 0) {\n this.multiTouch = false;\n const event = {\n clientX: this.lastTouchPosX,\n clientY: this.lastTouchPosY,\n movementX: 0,\n movementY: 0,\n buttons: 0,\n type: 'touch',\n };\n this.onEnd(event);\n window.removeEventListener('touchmove', this.onTouchMove);\n window.removeEventListener('touchend', this.onTouchEnd);\n }\n }\n onEnd(e) {\n this.dispatchEvent('pointerup', e);\n if (this.dblClickTimer !== null) {\n this.clearDblClickTimer();\n this.dispatchEvent('pointerdblclick', e);\n }\n else if (this.clickTimer !== null) {\n this.dispatchEvent('pointerclick', {\n clientX: this.startPosX,\n clientY: this.startPosY,\n movementX: e.movementX,\n movementY: e.movementY,\n buttons: e.buttons,\n type: e.type,\n });\n this.dblClickTimer = window.setTimeout(() => {\n this.dblClickTimer = null;\n }, this.dblClickDuration);\n }\n if (this.dragging) {\n this.dispatchEvent('pointerenddrag', e);\n }\n this.lastTouchX1 = 0;\n this.lastTouchY1 = 0;\n this.lastTouchX2 = 0;\n this.lastTouchY2 = 0;\n this.lastTouchPosX = 0;\n this.lastTouchPosY = 0;\n this.lastPinchPosX = 0;\n this.lastPinchPosY = 0;\n this.clearClickTimer();\n this.clearLongPressTimer();\n }\n}\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { createStore } from './state/store';\nimport { PdfViewerApi, PdfFitMode, PdfItemCategory, FileType, DocumentChange, } from '../pdf-viewer-api';\nimport { translationManager } from '../common/TranslationManager';\nimport { tooltipManager } from '../common/TooltipManager';\nimport { CanvasEvents } from './CanvasEvents';\nimport { StampAnnotationModule } from '../modules/stamp-annotation/StampAnnotationModule';\nimport { PdfDocumentLayer } from './view-layers/PdfDocumentLayer';\nimport { ScrollLayer } from './view-layers/ScrollLayer';\nimport { BusyStateLayer } from './view-layers/BusyStateLayer';\nimport { AnnotationSelectionLayer } from './view-layers/AnnotationSelectionLayer';\nimport { TextSelectionLayer } from './view-layers/TextSelectionLayer';\nimport { ViewerMode, CursorStyle, copyTextToClipboard } from './state/viewer';\nimport { imageDataUrlToUint8Array } from '../common/Tools';\nimport { PdfViewing } from '../pdf-viewing/PdfViewing';\nimport { getKeyboardCommands } from '../common/utils';\nimport { PopupModule } from '../modules';\nexport class PdfViewerCanvas {\n get licenseFeatures() {\n const licenseFeatures = this.pdfViewerApi.getSupportedFeatures();\n return {\n annotate: !this.options.viewer.general.viewOnly &&\n PdfViewing.LicenseFeature.Annotate ===\n (licenseFeatures & PdfViewing.LicenseFeature.Annotate),\n fillFormFields: !this.options.viewer.general.viewOnly &&\n PdfViewing.LicenseFeature.FillFormFields ===\n (licenseFeatures & PdfViewing.LicenseFeature.FillFormFields),\n pageRotation: !this.options.viewer.general.viewOnly &&\n PdfViewing.LicenseFeature.PageRotation ===\n (licenseFeatures & PdfViewing.LicenseFeature.PageRotation),\n };\n }\n constructor(containerElement, license, options) {\n var _a;\n this.eventListeners = new Map();\n this.documentLoaded = false;\n this.renderLoopRunning = false;\n if (!containerElement) {\n throw { error: 'PdfViewerCanvas container element is null' };\n }\n this.options = options;\n this.annotTimer = 0;\n // bind events\n this.onResize = this.onResize.bind(this);\n this.startRenderLoop = this.startRenderLoop.bind(this);\n this.updateViewLayerContext = this.updateViewLayerContext.bind(this);\n this.onKeyboardShortcuts = this.onKeyboardShortcuts.bind(this);\n this.dispatchEvent = this.dispatchEvent.bind(this);\n this.onCanvasPointerDown = this.onCanvasPointerDown.bind(this);\n this.onCanvasPointerMove = this.onCanvasPointerMove.bind(this);\n this.onCanvasPointerUp = this.onCanvasPointerUp.bind(this);\n this.onCanvasPointerClick = this.onCanvasPointerClick.bind(this);\n this.onCanvasPointerDblClick = this.onCanvasPointerDblClick.bind(this);\n this.onCanvasPointerLongPress = this.onCanvasPointerLongPress.bind(this);\n this.onCanvasPointerStartDrag = this.onCanvasPointerStartDrag.bind(this);\n this.onCanvasPointerEndDrag = this.onCanvasPointerEndDrag.bind(this);\n this.onCanvasPointerPinch = this.onCanvasPointerPinch.bind(this);\n this.onMouseWheel = this.onMouseWheel.bind(this);\n this.onDocumentOpened = this.onDocumentOpened.bind(this);\n this.onDocumentClosed = this.onDocumentClosed.bind(this);\n this.onCanvasInvalidated = this.onCanvasInvalidated.bind(this);\n this.onFirstVisiblePageChanged = this.onFirstVisiblePageChanged.bind(this);\n this.onLastVisiblePageChanged = this.onLastVisiblePageChanged.bind(this);\n this.onPageNumberChanged = this.onPageNumberChanged.bind(this);\n this.onZoomChanged = this.onZoomChanged.bind(this);\n this.onFitModeChanged = this.onFitModeChanged.bind(this);\n this.onPageLayoutModeChanged = this.onPageLayoutModeChanged.bind(this);\n this.onBusyStateChanged = this.onBusyStateChanged.bind(this);\n this.onRotationChanged = this.onRotationChanged.bind(this);\n this.onItemCreated = this.onItemCreated.bind(this);\n this.onItemUpdated = this.onItemUpdated.bind(this);\n this.onItemDeleted = this.onItemDeleted.bind(this);\n this.onPageChanged = this.onPageChanged.bind(this);\n this.onTextSelected = this.onTextSelected.bind(this);\n this.onHtmlDocumentSelectionChanged = this.onHtmlDocumentSelectionChanged.bind(this);\n this.onApiError = this.onApiError.bind(this);\n this.beforeUnloadCallback = this.beforeUnloadCallback.bind(this);\n this.getAnnotations = this.getAnnotations.bind(this);\n this.openRoutine = this.openRoutine.bind(this);\n this.print = this.print.bind(this);\n this.close = this.close.bind(this);\n this.searchIterator = null;\n // create store\n this.store = createStore();\n // create api\n const pdfViewerApiOptions = {\n onlyAuthorCanEdit: (_a = options.annotation.onlyAuthorCanEdit) !== null && _a !== void 0 ? _a : false,\n viewOnly: options.viewer.general.viewOnly,\n user: options.viewer.general.user,\n allowPopups: options.modules.includes(PopupModule),\n annotationPermissionCallback: options.annotation.annotationPermissionCallback,\n };\n this.pdfViewerApi = new PdfViewerApi(pdfViewerApiOptions);\n const licenseIsValid = this.pdfViewerApi.setLicenseKey(license);\n if (!licenseIsValid) {\n throw new Error('Invalid License');\n }\n // create elements\n this.element = containerElement;\n this.element.classList.add('pwv-ViewerCanvas');\n const viewerContainer = document.createElement('div');\n viewerContainer.classList.add('pwv-canvas-container');\n this.element.appendChild(viewerContainer);\n this.toolbarElement = document.createElement('div');\n if (this.licenseFeatures.annotate) {\n this.toolbarElement.classList.add('pwv-canvas-toolbar');\n viewerContainer.appendChild(this.toolbarElement);\n }\n const canvasLayers = document.createElement('div');\n canvasLayers.classList.add('pwv-canvas-layers');\n viewerContainer.appendChild(canvasLayers);\n this.viewLayersElement = document.createElement('div');\n canvasLayers.appendChild(this.viewLayersElement);\n viewerContainer.appendChild(canvasLayers);\n this.viewLayers = [];\n this.modules = [];\n // events\n this.resizeObserver = new ResizeObserver(this.onResize);\n this.resizeObserver.observe(canvasLayers);\n this.pdfViewerApi.addEventListener('firstVisiblePage', this.onFirstVisiblePageChanged);\n this.pdfViewerApi.addEventListener('lastVisiblePage', this.onLastVisiblePageChanged);\n this.pdfViewerApi.addEventListener('pageNumber', this.onPageNumberChanged);\n this.pdfViewerApi.addEventListener('zoom', this.onZoomChanged);\n this.pdfViewerApi.addEventListener('fitMode', this.onFitModeChanged);\n this.pdfViewerApi.addEventListener('pageLayoutMode', this.onPageLayoutModeChanged);\n this.pdfViewerApi.addEventListener('busyState', this.onBusyStateChanged);\n this.pdfViewerApi.addEventListener('canvasInvalidated', this.onCanvasInvalidated);\n this.pdfViewerApi.addEventListener('itemCreated', this.onItemCreated);\n this.pdfViewerApi.addEventListener('itemUpdated', this.onItemUpdated);\n this.pdfViewerApi.addEventListener('itemDeleted', this.onItemDeleted);\n this.pdfViewerApi.addEventListener('pageChanged', this.onPageChanged);\n this.pdfViewerApi.addEventListener('rotation', this.onRotationChanged);\n this.pdfViewerApi.addEventListener('error', this.onApiError);\n if (this.options.viewer.general.promptOnUnsavedChange) {\n window.addEventListener('beforeunload', this.beforeUnloadCallback);\n }\n document.addEventListener('selectionchange', this.onHtmlDocumentSelectionChanged);\n this.canvasEvents = new CanvasEvents(canvasLayers);\n this.canvasEvents.suspend();\n this.canvasEvents.addEventListener('pointerdown', this.onCanvasPointerDown);\n this.canvasEvents.addEventListener('pointermove', this.onCanvasPointerMove);\n this.canvasEvents.addEventListener('pointerup', this.onCanvasPointerUp);\n this.canvasEvents.addEventListener('pointerclick', this.onCanvasPointerClick);\n this.canvasEvents.addEventListener('pointerdblclick', this.onCanvasPointerDblClick);\n this.canvasEvents.addEventListener('pointerlongpress', this.onCanvasPointerLongPress);\n this.canvasEvents.addEventListener('pointerstartdrag', this.onCanvasPointerStartDrag);\n this.canvasEvents.addEventListener('pointerenddrag', this.onCanvasPointerEndDrag);\n this.canvasEvents.addEventListener('pinch', this.onCanvasPointerPinch);\n this.viewLayersElement.addEventListener('wheel', this.onMouseWheel, {\n passive: false,\n });\n document.addEventListener('keydown', this.onKeyboardShortcuts, {\n passive: false,\n });\n translationManager.loadTranslations(this.options.viewer.general.language || 'en');\n tooltipManager.setType(this.options.viewer.general.tooltips || 'title');\n if (this.options.modules) {\n // load pdf for stamps\n if (this.licenseFeatures.annotate &&\n this.options.modules.find((m) => m === StampAnnotationModule) &&\n this.options.annotation.options.pdfStampFiles) {\n this.registerPdfStamps(this.options.annotation.options.pdfStampFiles);\n }\n }\n // Push the dispatching of the appLoaded event to the macro task queue\n // otherwise any function added to the appLoaded event won't be notified\n // since the event has already been dispatched\n requestAnimationFrame(() => {\n this.dispatchEvent('appLoaded', true);\n });\n }\n open(pdfFile, fdfFiles, password, viewOptions, renderOptions) {\n const _viewOptions = viewOptions ? viewOptions : {};\n const containerRect = this.viewLayersElement.getBoundingClientRect();\n const viewportSize = {\n width: containerRect.width,\n height: containerRect.height,\n };\n return this.openRoutine(this.pdfViewerApi.open, pdfFile, fdfFiles, password, _viewOptions, renderOptions, viewportSize);\n }\n save(saveOptions) {\n const promises = new Array();\n for (let i = 0; i < this.modules.length; i++) {\n promises.push(this.modules[i].onSave());\n }\n const savePromise = new Promise((resolve, reject) => {\n Promise.all(promises).then(() => {\n return this.pdfViewerApi\n .save(saveOptions)\n .then((buffer) => {\n resolve(buffer);\n })\n .catch((err) => {\n reject(err);\n });\n });\n });\n return savePromise;\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use Open method instead.\n */\n openFDF(pdfBuffer, fdfBuffer, password) {\n return this.open({ data: pdfBuffer }, [{ data: fdfBuffer }], password);\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use Open method instead.\n */\n openUri(pdfUri, password, pdfAuthorization) {\n return this.open({ uri: pdfUri }, [], password);\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use Open method instead.\n */\n openFDFUri(pdfUri, fdfUri, password, pdfAuthorization, fdfAuthorization) {\n return this.open({ uri: pdfUri }, [{ uri: pdfUri }], password);\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use Open method instead.\n */\n openBlob(blob, password) {\n return this.open({ data: blob }, [], password);\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use Open method instead.\n */\n openFDFBlob(pdfBlob, fdfBlob, password) {\n return this.open({ data: pdfBlob }, [{ data: fdfBlob }], password);\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use save method instead.\n */\n saveFile(asFdf) {\n return new Promise((resolve, reject) => {\n const saveOptions = {};\n if (asFdf) {\n saveOptions.fileType = FileType.Fdf;\n }\n this.save(saveOptions).then((blob) => {\n blob.arrayBuffer().then((arrayBuffer) => {\n resolve(new Uint8Array(arrayBuffer));\n });\n });\n });\n }\n close() {\n this.unRegisterModules();\n this.onDocumentClosed();\n if (this.searchIterator) {\n this.searchIterator.close();\n this.searchIterator = null;\n }\n return this.pdfViewerApi.close();\n }\n destroy() {\n this.stopRenderLoop();\n if (this.searchIterator) {\n this.searchIterator.close();\n }\n this.resizeObserver.disconnect();\n if (this.annotTimer) {\n window.clearTimeout(this.annotTimer);\n }\n // remove listeners\n this.eventListeners.clear();\n document.removeEventListener('keydown', this.onKeyboardShortcuts);\n window.removeEventListener('beforeunload', this.beforeUnloadCallback);\n this.pdfViewerApi.removeEventListener('firstVisiblePage', this.onFirstVisiblePageChanged);\n this.pdfViewerApi.removeEventListener('lastVisiblePage', this.onLastVisiblePageChanged);\n this.pdfViewerApi.removeEventListener('pageNumber', this.onPageNumberChanged);\n this.pdfViewerApi.removeEventListener('zoom', this.onZoomChanged);\n this.pdfViewerApi.removeEventListener('fitMode', this.onFitModeChanged);\n this.pdfViewerApi.removeEventListener('pageLayoutMode', this.onPageLayoutModeChanged);\n this.pdfViewerApi.removeEventListener('busyState', this.onBusyStateChanged);\n this.pdfViewerApi.removeEventListener('canvasInvalidated', this.onCanvasInvalidated);\n this.pdfViewerApi.removeEventListener('itemCreated', this.onItemCreated);\n this.pdfViewerApi.removeEventListener('itemUpdated', this.onItemUpdated);\n this.pdfViewerApi.removeEventListener('itemDeleted', this.onItemDeleted);\n this.pdfViewerApi.removeEventListener('pageChanged', this.onPageChanged);\n this.pdfViewerApi.removeEventListener('rotation', this.onRotationChanged);\n this.pdfViewerApi.removeEventListener('error', this.onApiError);\n this.canvasEvents.suspend();\n this.canvasEvents.removeEventListener('pointerdown', this.onCanvasPointerDown);\n this.canvasEvents.removeEventListener('pointermove', this.onCanvasPointerMove);\n this.canvasEvents.removeEventListener('pointerup', this.onCanvasPointerUp);\n this.canvasEvents.removeEventListener('pointerclick', this.onCanvasPointerClick);\n this.canvasEvents.removeEventListener('pointerdblclick', this.onCanvasPointerDblClick);\n this.canvasEvents.removeEventListener('pointerlongpress', this.onCanvasPointerLongPress);\n this.canvasEvents.removeEventListener('pointerstartdrag', this.onCanvasPointerStartDrag);\n this.canvasEvents.removeEventListener('pointerenddrag', this.onCanvasPointerEndDrag);\n this.canvasEvents.removeEventListener('pinch', this.onCanvasPointerPinch);\n this.viewLayersElement.removeEventListener('wheel', this.onMouseWheel);\n this.pdfViewerApi.destroy();\n this.viewLayers = [];\n this.modules = [];\n // remove all child elements\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild);\n }\n }\n hasChanges() {\n return this.pdfViewerApi.hasChanges();\n }\n getProductVersion() {\n return PdfViewing.Sdk.version;\n }\n getZoom() {\n return this.pdfViewerApi.getZoom();\n }\n setZoom(zoom, location) {\n this.pdfViewerApi.setZoom(zoom, location);\n }\n zoomIn(location) {\n const zoom = this.pdfViewerApi.getZoom();\n this.pdfViewerApi.setZoom(this.getNextZoomInLevel(zoom), location);\n }\n zoomOut(location) {\n const zoom = this.pdfViewerApi.getZoom();\n this.pdfViewerApi.setZoom(this.getNextZoomOutLevel(zoom), location);\n }\n getPageCount() {\n return this.pdfViewerApi.getPageCount();\n }\n getPageNumber() {\n return this.pdfViewerApi.getPageNumber();\n }\n rotatePage(pageNumber, direction) {\n const { textSelection, selectedAnnotationId, selectedModuleName } = this.store.getState().viewer;\n if (textSelection) {\n const textSelectionLayer = this.viewLayers.find((v) => v instanceof TextSelectionLayer);\n if (textSelectionLayer) {\n textSelectionLayer.clearSelection();\n }\n }\n if (selectedAnnotationId) {\n this.store.viewer.deselectAnnotation();\n }\n if (selectedModuleName) {\n this.store.viewer.endModule(selectedModuleName);\n }\n return this.pdfViewerApi.rotatePage(pageNumber, direction);\n }\n setPageNumber(page) {\n if (page < 1) {\n page = 1;\n }\n else {\n const pageCount = this.pdfViewerApi.getPageCount();\n if (page > pageCount) {\n page = pageCount;\n }\n }\n this.pdfViewerApi.setPageNumber(page);\n }\n scrollDown(distance = 100) {\n if (distance === 0) {\n return;\n }\n const pos = this.pdfViewerApi.getScrollPosition();\n pos.y += distance * window.devicePixelRatio;\n this.pdfViewerApi.setScrollPosition(pos);\n }\n scrollUp(distance = 100) {\n if (distance === 0) {\n return;\n }\n const pos = this.pdfViewerApi.getScrollPosition();\n pos.y -= distance * window.devicePixelRatio;\n this.pdfViewerApi.setScrollPosition(pos);\n }\n scrollLeft(distance = 100) {\n if (distance === 0) {\n return;\n }\n const pos = this.pdfViewerApi.getScrollPosition();\n pos.x -= distance * window.devicePixelRatio;\n this.pdfViewerApi.setScrollPosition(pos);\n }\n scrollRight(distance = 100) {\n if (distance === 0) {\n return;\n }\n const pos = this.pdfViewerApi.getScrollPosition();\n pos.x += distance * window.devicePixelRatio;\n this.pdfViewerApi.setScrollPosition(pos);\n }\n scrollMove(distanceVertical = 0, distanceHorizontal = 0) {\n if (distanceVertical === 0 && distanceHorizontal === 0) {\n return;\n }\n const pos = this.pdfViewerApi.getScrollPosition();\n pos.y += distanceVertical * window.devicePixelRatio;\n pos.x += distanceHorizontal * window.devicePixelRatio;\n this.pdfViewerApi.setScrollPosition(pos);\n }\n nextPage() {\n const page = this.pdfViewerApi.getPageNumber();\n const pageCount = this.pdfViewerApi.getPageCount();\n if (page < pageCount) {\n this.pdfViewerApi.setPageNumber(page + 1);\n }\n }\n previousPage() {\n const page = this.pdfViewerApi.getPageNumber();\n if (page > 1) {\n this.pdfViewerApi.setPageNumber(page - 1);\n }\n }\n getFitMode() {\n return this.pdfViewerApi.getFitMode();\n }\n setFitMode(fitMode) {\n this.pdfViewerApi.setFitMode(fitMode);\n }\n getPageLayoutMode() {\n return this.pdfViewerApi.getPageLayoutMode();\n }\n setPageLayoutMode(pageLayoutMode) {\n this.pdfViewerApi.setPageLayoutMode(pageLayoutMode);\n }\n getRotation() {\n return this.pdfViewerApi.getRotation();\n }\n setRotation(rotation) {\n this.pdfViewerApi.setRotation(rotation);\n }\n renderPage(pageNumber, width, height) {\n return this.pdfViewerApi.renderPage(pageNumber, width, height);\n }\n getDocumentOutline() {\n return this.getOutlines(null);\n }\n goTo(pdfDestination) {\n this.pdfViewerApi.goTo(pdfDestination);\n }\n updateCanvasSearchState(state) {\n this.store.search.start({\n caseSensitive: state.caseSensitive,\n searchString: state.searchString,\n reverse: false,\n useRegex: state.useRegex,\n wrapSearch: state.wrapSearch,\n });\n }\n doSearch() {\n const s = this.store.getState().search;\n if (this.searchIterator &&\n this.searchIterator.match instanceof PdfViewing.Pdf.Content.TextSelection) {\n const list = this.searchIterator.match.textArea;\n let page = 1;\n const quadrilateralList = [];\n for (let i = 0; i < list.size; i++) {\n const quad = list.get(i);\n if (quad.pageNumber > page) {\n page = quad.pageNumber;\n }\n quadrilateralList.push(quad);\n }\n this.store.search.updateMatch({\n match: quadrilateralList,\n page,\n });\n const q = list.get(0);\n const { bottomLeft, bottomRight, topRight, topLeft, pageNumber } = q;\n const x = Math.min(bottomLeft.x, bottomRight.x, topRight.x, topLeft.x);\n const y = Math.min(bottomLeft.y, bottomRight.y, topRight.y, topLeft.y);\n const padding = 10;\n const rect = {\n pdfX: x - padding,\n pdfY: y - padding,\n pdfW: Math.max(bottomLeft.x, bottomRight.x, topRight.x, topLeft.x) - x + 2 * padding,\n pdfH: Math.max(bottomLeft.y, bottomRight.y, topRight.y, topLeft.y) - y + 2 * padding,\n page: pageNumber,\n };\n this.pdfViewerApi.goToRectangle(rect);\n }\n }\n startSearch(searchString, startPage, caseSensitive, wrapSearch, useRegex) {\n if (this.searchIterator) {\n this.endSearch();\n }\n this.searchIterator = this.pdfViewerApi.getSearchIterator(searchString, startPage, caseSensitive, wrapSearch, useRegex);\n if (!this.searchIterator) {\n return;\n }\n this.searchIterator.getNext().then((hasResult) => {\n if (hasResult) {\n this.doSearch();\n }\n else {\n this.endSearch();\n }\n });\n }\n nextSearchMatch() {\n if (this.searchIterator) {\n this.searchIterator.getNext().then((hasResult) => {\n if (hasResult) {\n this.doSearch();\n }\n });\n }\n }\n previousSearchMatch() {\n if (this.searchIterator) {\n return this.searchIterator.getPrevious().then((hasResult) => {\n if (hasResult) {\n this.doSearch();\n }\n });\n }\n }\n endSearch() {\n if (this.searchIterator) {\n this.searchIterator.close();\n this.searchIterator = null;\n this.store.search.clear();\n }\n }\n resetViewerMode() {\n this.store.viewer.setDefaultMode();\n }\n getAnnotationsFromPage(page) {\n return new Promise((resolve, reject) => {\n this.pdfViewerApi\n .getItemsFromPage(page, PdfItemCategory.ANNOTATION)\n .then((items) => {\n this.store.annotations.setPageAnnotations(items);\n resolve(items);\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n goToAnnotation(annotation, action) {\n this.pdfViewerApi.goToRectangle(annotation.pdfRect);\n if (action === 'select') {\n this.dispatchEvent('itemSelected', annotation);\n }\n }\n print() {\n this.activateModule('PrintServiceModule', null);\n }\n getModules() {\n return this.modules;\n }\n activateModule(moduleName, args) {\n const module = this.modules.find((m) => {\n return m.name == moduleName;\n });\n if (module) {\n module.activate(args);\n this.dispatchEvent('moduleActivated', moduleName);\n }\n }\n deactivateModule(moduleName) {\n this.dispatchEvent('moduleActivated', moduleName);\n const module = this.modules.find((m) => {\n return m.name == moduleName;\n });\n if (module) {\n module.deactivate();\n }\n }\n getSelectedText() {\n const { textSelection, textSelectionType } = this.store.getState().viewer;\n let text = undefined;\n if (textSelection) {\n const { startPoint, endPoint } = textSelection;\n text =\n textSelectionType === 'rectangular'\n ? this.pdfViewerApi.getTextForRectangularSelection(startPoint, endPoint)\n : this.pdfViewerApi.getText(startPoint, endPoint);\n }\n return text;\n }\n addEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n ;\n this.eventListeners.get(type).push(listener);\n }\n else {\n this.eventListeners.set(type, [listener]);\n }\n }\n removeEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n let listeners = this.eventListeners.get(type);\n listeners = listeners.filter((listenerInArray) => listenerInArray !== listener);\n if (listeners.length !== 0) {\n this.eventListeners.set(type, listeners);\n }\n else {\n this.eventListeners.delete(type);\n }\n }\n }\n suspendCanvasEvents() {\n this.canvasEvents.suspend();\n }\n resumeCanvasEvents() {\n this.canvasEvents.resume();\n }\n dispatchEvent(type, args) {\n if (this.eventListeners.has(type)) {\n const listeners = this.eventListeners.get(type);\n listeners.forEach((listener) => listener(args));\n }\n }\n getOutlines(parent) {\n return __awaiter(this, void 0, void 0, function* () {\n const outlineItems = yield this.pdfViewerApi.getOutlines(parent);\n for (const item of outlineItems) {\n if (item.hasDescendants) {\n const children = yield this.getOutlines(item);\n item.descendants = children;\n }\n }\n return outlineItems;\n });\n }\n openRoutine(openFunction, ...args) {\n return new Promise((resolve, reject) => {\n if (this.pdfViewerApi.isOpen()) {\n this.close();\n }\n requestAnimationFrame(() => {\n openFunction(...args)\n .then(() => {\n this.onDocumentOpened();\n resolve({});\n })\n .catch((error) => {\n if (error.message === 'The authentication failed due to a wrong password.') {\n reject(new Error('password required'));\n }\n else {\n reject(new Error('unsupported file'));\n }\n });\n });\n });\n }\n onDocumentOpened() {\n this.registerModules();\n this.documentLoaded = true;\n this.element.classList.add('pwv-ViewerCanvas--documentLoaded');\n this.dispatchEvent('pageLayoutMode', this.pdfViewerApi.getPageLayoutMode());\n this.dispatchEvent('firstVisiblePage', this.pdfViewerApi.getFirstVisiblePage());\n this.dispatchEvent('lastVisiblePage', this.pdfViewerApi.getLastVisiblePage());\n this.dispatchEvent('pageNumber', this.pdfViewerApi.getPageNumber());\n this.dispatchEvent('zoom', this.pdfViewerApi.getZoom());\n // set canvas size\n const containerRect = this.viewLayersElement.getBoundingClientRect();\n this.store.canvas.resize({\n cssWidth: containerRect.width,\n cssHeight: containerRect.height,\n });\n this.startRenderLoop();\n const document = this.store.getState().document;\n window.setTimeout(() => {\n this.canvasEvents.resume();\n this.element.classList.add('pwv-ViewerCanvas--documentLoaded');\n }, 100);\n }\n onDocumentClosed() {\n this.canvasEvents.suspend();\n this.documentLoaded = false;\n this.element.classList.remove('pwv-ViewerCanvas--documentLoaded');\n this.stopRenderLoop();\n this.store.loadDefaultState();\n }\n startRenderLoop() {\n const viewLayers = this.viewLayers;\n const modules = this.modules;\n const loop = (timestamp) => {\n const state = this.store.getState();\n if (this.renderLoopRunning) {\n this.store.resetChangedState();\n if (state.viewer.cursorStyleChanged) {\n this.viewLayersElement.style.cursor = state.viewer.cursorStyle;\n }\n for (let i = 0; i < viewLayers.length; i++) {\n const res = viewLayers[i].render(timestamp, state);\n if (res === false) {\n break;\n }\n }\n for (let i = 0; i < modules.length; i++) {\n modules[i].render(timestamp, state);\n }\n requestAnimationFrame(loop);\n }\n };\n this.renderLoopRunning = true;\n requestAnimationFrame(loop);\n }\n stopRenderLoop() {\n this.renderLoopRunning = false;\n }\n registerPdfStamps(pdfStampFiles) {\n const pdfStampConfigs = this.options.annotation.options.stamps.filter((s) => s.pdfStampFileName);\n const pdfStampConfigMap = pdfStampConfigs.reduce(function (acc, obj) {\n let key = obj.pdfStampFileName;\n if (!acc[key]) {\n acc[key] = 0;\n }\n ++acc[key];\n return acc;\n }, {});\n const onStampCreated = (pdfStamp) => {\n if (pdfStampConfigMap.hasOwnProperty(pdfStamp.pdfStampFileName)) {\n const stamp = this.options.annotation.options.stamps.find((s) => s.pdfStampFileName === pdfStamp.pdfStampFileName && s.pageNumber === pdfStamp.pageNumber);\n if (stamp) {\n stamp.thumbnail = pdfStamp.thumbnail;\n stamp.aspectRatio = pdfStamp.aspectRatio;\n }\n }\n else {\n this.options.annotation.options.stamps.push(pdfStamp);\n }\n };\n pdfStampFiles.forEach((stampFile) => {\n const data = imageDataUrlToUint8Array(stampFile.data);\n const pdfStampFileName = stampFile.pdfStampFileName ? stampFile.pdfStampFileName : '';\n this.pdfViewerApi.registerPdfStampFile(pdfStampFileName, data, onStampCreated);\n });\n }\n registerModules() {\n // view layers\n const viewLayers = [\n PdfDocumentLayer,\n BusyStateLayer,\n AnnotationSelectionLayer,\n TextSelectionLayer,\n ScrollLayer,\n ];\n viewLayers.forEach((viewLayerBaseClass) => {\n const viewLayer = new viewLayerBaseClass();\n viewLayer.register(this, this.dispatchEvent);\n this.viewLayers.push(viewLayer);\n });\n const modules = this.options.modules.filter(({ moduleInfo }) => (!moduleInfo.requiredFeatures.annotate ||\n (moduleInfo.requiredFeatures.annotate && this.licenseFeatures.annotate)) &&\n (!moduleInfo.requiredFeatures.fillFormFields ||\n (moduleInfo.requiredFeatures.fillFormFields && this.licenseFeatures.fillFormFields)));\n if (modules) {\n modules.forEach((module) => {\n const m = new module();\n this.modules.push(m);\n // tmp const for this, used for rollup\n const viewerCanvas = this;\n const reg = m.register(this.viewLayersElement, this.store, this.pdfViewerApi, viewerCanvas, this.options);\n if (reg.toolbar && this.toolbarElement) {\n this.toolbarElement.appendChild(reg.toolbar);\n }\n if (reg.contextbar) {\n this.store.viewer.addContextBarItem(reg.contextbar);\n }\n });\n }\n this.updateCanvasSize();\n }\n unRegisterModules() {\n this.viewLayers = [];\n this.store.viewer.clearContextBarItems();\n this.toolbarElement.innerHTML = '';\n this.viewLayersElement.innerHTML = '';\n this.modules.splice(0, this.modules.length);\n }\n updateViewLayerContext() {\n const pixelRatio = window.devicePixelRatio;\n this.store.canvas.setPixelRatio(pixelRatio);\n const rect = this.viewLayersElement.getBoundingClientRect();\n const maxScroll = this.pdfViewerApi.getScrollMaxPosition();\n const scrollPosition = this.pdfViewerApi.getScrollPosition();\n const devicePixelsWidth = rect.width * pixelRatio + (maxScroll.x > 0 ? maxScroll.x : scrollPosition.x * 2);\n const devicePixelsHeight = rect.height * pixelRatio + (maxScroll.y > 0 ? maxScroll.y : scrollPosition.y * 2);\n const zoom = this.pdfViewerApi.getZoom();\n this.store.document.resize({ zoom, devicePixelsHeight, devicePixelsWidth });\n this.store.scroll.scrollChanged({\n cssLeft: scrollPosition.x,\n cssTop: scrollPosition.y,\n });\n const state = this.store.getState();\n const pageRects = {};\n for (let page = this.pdfViewerApi.getFirstVisiblePage(); page <= this.pdfViewerApi.getLastVisiblePage(); page++) {\n pageRects[page] = this.pdfViewerApi.getPageScreenRect(page);\n }\n this.store.document.updatePageRects(pageRects);\n }\n onMouseWheel(e) {\n if (e.deltaY !== 0) {\n if (e.ctrlKey) {\n e.preventDefault();\n e.cancelBubble = true;\n const containerRect = this.viewLayersElement.getBoundingClientRect();\n const x = e.clientX - containerRect.left;\n const y = e.clientY - containerRect.top;\n if (e.deltaY < 0) {\n this.zoomIn({ x, y });\n }\n else {\n this.zoomOut({ x, y });\n }\n }\n else if (e.shiftKey) {\n e.preventDefault();\n e.cancelBubble = true;\n const distance = e.deltaY > 0 ? 100 : -100;\n this.scrollRight(distance);\n }\n else {\n e.preventDefault();\n e.cancelBubble = true;\n const distance = e.deltaY > 0 ? 100 : -100;\n this.scrollDown(distance);\n }\n }\n else if (e.deltaX > 0) {\n this.scrollRight();\n }\n else if (e.deltaX < 0) {\n this.scrollLeft();\n }\n else if (e.deltaZ < 0) {\n this.zoomIn();\n }\n else if (e.deltaZ > 0) {\n this.zoomOut();\n }\n }\n transformPointer(e) {\n const containerRect = this.viewLayersElement.getBoundingClientRect();\n const x = e.clientX - containerRect.left;\n const y = e.clientY - containerRect.top;\n return {\n cssX: x,\n cssY: y,\n isDown: e.buttons === 1,\n type: e.type,\n };\n }\n onCanvasPointerClick(e) {\n const p = this.transformPointer(e);\n this.store.pointer.update(p);\n this.store.pointer.setAction('click');\n }\n onCanvasPointerDblClick(e) {\n const p = this.transformPointer(e);\n this.store.pointer.update(p);\n this.store.pointer.setAction('dblclick');\n }\n onCanvasPointerLongPress(e) {\n const p = this.transformPointer(e);\n this.store.pointer.update(p);\n this.store.pointer.setAction('longpress');\n }\n onCanvasPointerStartDrag(e) {\n this.store.pointer.setAction('startdrag');\n }\n onCanvasPointerEndDrag(e) {\n this.store.pointer.setAction('enddrag');\n }\n onCanvasPointerPinch(e) {\n const containerRect = this.viewLayersElement.getBoundingClientRect();\n const x = (e.clientX - containerRect.left) * devicePixelRatio;\n const y = (e.clientY - containerRect.top) * devicePixelRatio;\n const zoom = this.pdfViewerApi.getZoom();\n const zoomDistance = (e.movementDistance / 200) * zoom;\n let newZoom = zoom + zoomDistance;\n const minZoomLevel = this.options.viewer.general.defaultZoomLevels[0];\n const maxZoomLevel = this.options.viewer.general.defaultZoomLevels[this.options.viewer.general.defaultZoomLevels.length - 1];\n if (newZoom < minZoomLevel) {\n newZoom = minZoomLevel;\n }\n else if (newZoom > maxZoomLevel) {\n newZoom = maxZoomLevel;\n }\n this.setZoom(newZoom, { x, y });\n }\n onCanvasPointerDown(e) {\n const p = this.transformPointer(e);\n this.store.pointer.update(p);\n this.store.startPointer.update(p);\n }\n onCanvasPointerUp(e) {\n const p = this.transformPointer(e);\n this.store.pointer.update(p);\n }\n onCanvasPointerMove(e) {\n if (e.buttons < 2) {\n const p = this.transformPointer(e);\n this.store.pointer.update(p);\n }\n else if (e.buttons === 4) {\n this.scrollMove(e.movementY * -1, e.movementX * -1);\n this.store.viewer.setCursorStyle(CursorStyle.GRABBING);\n }\n }\n onKeyboardShortcuts(e) {\n // check if element is visible\n const rect = this.element.getBoundingClientRect();\n if (rect.width + rect.height === 0) {\n return;\n }\n let metaflag = false;\n // metaKey is true if it is super/command key in this context\n // although meta key is normally alt\n if (e.metaKey) {\n metaflag = true;\n }\n const { shortcuts } = this.options;\n if (Object.keys(shortcuts).length > 0) {\n const keyboardCommands = getKeyboardCommands(e, shortcuts);\n if (!keyboardCommands.length) {\n return;\n }\n for (const cmd of keyboardCommands) {\n // deal with super / command key in a central place\n // it is not a modifier, but it behaves like one\n const isSuperKeyRequired = cmd[1];\n if (isSuperKeyRequired && !metaflag) {\n continue;\n }\n switch (cmd[0]) {\n case 'zoomIn':\n e.preventDefault();\n this.zoomIn();\n break;\n case 'zoomOut':\n e.preventDefault();\n this.zoomOut();\n break;\n case 'nextPage':\n e.preventDefault();\n this.nextPage();\n break;\n case 'previousPage':\n e.preventDefault();\n this.previousPage();\n break;\n case 'scrollDown':\n e.preventDefault();\n this.scrollDown();\n break;\n case 'scrollUp':\n e.preventDefault();\n this.scrollUp();\n break;\n case 'scrollLeft':\n e.preventDefault();\n this.scrollLeft();\n break;\n case 'scrollRight':\n e.preventDefault();\n this.scrollRight();\n break;\n case 'firstPage':\n e.preventDefault();\n this.setPageNumber(1);\n break;\n case 'lastPage':\n e.preventDefault();\n this.setPageNumber(this.getPageCount());\n break;\n case 'releaseSelection':\n const viewerMode = this.store.getState().viewer.mode;\n if (viewerMode === ViewerMode.TEXT_SELECTED) {\n e.preventDefault();\n e.cancelBubble = true;\n this.store.viewer.setTextSelection({ selection: null, type: null });\n this.store.viewer.setTextSelectionState(null);\n break;\n }\n if (viewerMode === ViewerMode.ANNOTATION_SELECTED) {\n e.preventDefault();\n e.cancelBubble = true;\n this.store.viewer.deselectAnnotation();\n break;\n }\n break;\n case 'copy':\n if (this.options.viewer.permissions.allowCopyText) {\n const documentSelection = document.getSelection();\n // Copy needs to work outside the viewer too\n // None if inside the viewer: Caret|Range outside\n if ((documentSelection === null || documentSelection === void 0 ? void 0 : documentSelection.type) && ['Caret', 'Range'].includes(documentSelection === null || documentSelection === void 0 ? void 0 : documentSelection.type)) {\n return;\n }\n e.preventDefault();\n e.cancelBubble = true;\n copyTextToClipboard(this.getSelectedText() || '');\n }\n break;\n case 'copyMac':\n if (this.options.viewer.permissions.allowCopyText) {\n const documentSelection = document.getSelection();\n // Copy needs to work outside the viewer too\n // None if inside the viewer: Caret|Range outside\n if ((documentSelection === null || documentSelection === void 0 ? void 0 : documentSelection.type) && ['Caret', 'Range'].includes(documentSelection === null || documentSelection === void 0 ? void 0 : documentSelection.type)) {\n return;\n }\n e.preventDefault();\n e.cancelBubble = true;\n copyTextToClipboard(this.getSelectedText() || '');\n }\n break;\n case 'resetZoom':\n e.preventDefault();\n this.setZoom(1);\n break;\n case 'fitToPage':\n e.preventDefault();\n this.setFitMode(PdfFitMode.FIT_PAGE);\n break;\n case 'fitToWidth':\n e.preventDefault();\n this.setFitMode(PdfFitMode.FIT_WIDTH);\n break;\n case 'rotateView':\n if (this.options.viewer.permissions.allowRotateView) {\n e.preventDefault();\n const r = this.getRotation();\n const rotation = r >= 270 ? 0 : r + 90;\n this.setRotation(rotation);\n }\n break;\n case 'cancelEditAnnotation':\n const { selectedModuleName } = this.store.getState().viewer;\n if (selectedModuleName) {\n this.store.viewer.endModule(selectedModuleName);\n e.preventDefault();\n break;\n }\n }\n }\n }\n else if (e.key === 'Escape') {\n const { selectedModuleName, mode } = this.store.getState().viewer;\n if (selectedModuleName) {\n this.store.viewer.endModule(selectedModuleName);\n }\n const viewerMode = mode;\n if (viewerMode === ViewerMode.TEXT_SELECTED) {\n this.store.viewer.setTextSelection({ selection: null, type: null });\n this.store.viewer.setTextSelectionState(null);\n }\n if (viewerMode === ViewerMode.ANNOTATION_SELECTED) {\n this.store.viewer.deselectAnnotation();\n }\n }\n }\n onResize(entries, observer) {\n const containerRect = this.viewLayersElement.getBoundingClientRect();\n if (containerRect.width === 0 || containerRect.height === 0) {\n return;\n }\n this.updateCanvasSize();\n }\n onHtmlDocumentSelectionChanged() {\n const documentSelection = document.getSelection();\n if (documentSelection) {\n const viewerMode = this.store.getState().viewer.mode;\n if (viewerMode === ViewerMode.TEXT_SELECTED) {\n this.store.viewer.setTextSelection({ selection: null, type: null });\n this.store.viewer.setTextSelectionState(null);\n }\n }\n }\n updateCanvasSize() {\n const containerRect = this.viewLayersElement.getBoundingClientRect();\n const pixelRatio = window.devicePixelRatio;\n this.viewLayers.forEach((viewLayer) => {\n viewLayer.resize(containerRect.width, containerRect.height, pixelRatio);\n });\n this.modules.forEach((module) => {\n module.resize(containerRect.width, containerRect.height);\n });\n this.store.canvas.resize({\n cssWidth: containerRect.width,\n cssHeight: containerRect.height,\n });\n this.store.canvas.setCanvasInvalidated(true);\n }\n onCanvasInvalidated() {\n this.store.canvas.setCanvasInvalidated(true);\n this.updateViewLayerContext();\n }\n onFirstVisiblePageChanged(page) {\n this.store.document.fistVisiblePageChanged(page);\n this.maybeGetAnnotations(this.store.getState().document.firstVisiblePage, this.store.getState().document.lastVisiblePage);\n this.dispatchEvent('firstVisiblePage', page);\n }\n onPageNumberChanged(page) {\n this.dispatchEvent('pageNumber', page);\n }\n onTextSelected() {\n var _a;\n this.dispatchEvent('textSelected', (_a = this.getSelectedText()) !== null && _a !== void 0 ? _a : '');\n }\n /**\n * This function works with a timer. This avoids mass loading of annotation when scrolling\n * through a large document. It only loads the annotations once the viewport is stable (visible\n * pages didn't change for 100ms). If there is an active timer that will be cancelled.\n * @param begin first page to get annotations from\n * @param end last page to get annotations from\n */\n maybeGetAnnotations(begin, end) {\n if (this.annotTimer) {\n window.clearTimeout(this.annotTimer);\n }\n this.annotTimer = window.setTimeout(() => {\n this.getAnnotations(begin, end);\n }, 100);\n }\n getAnnotations(begin, end) {\n for (let page = begin; page <= end; page++) {\n if (this.store.getState().annotations.byPage[page] === undefined) {\n this.pdfViewerApi\n .getItemsFromPage(page, PdfItemCategory.ANNOTATION)\n .then((itemsOnPage) => {\n this.store.annotations.setPageAnnotations(itemsOnPage);\n })\n .catch((err) => {\n console.warn(err);\n });\n }\n }\n }\n onLastVisiblePageChanged(page) {\n this.store.document.lastVisiblePageChanged(page);\n this.maybeGetAnnotations(this.store.getState().document.firstVisiblePage, this.store.getState().document.lastVisiblePage);\n this.dispatchEvent('lastVisiblePage', page);\n }\n onZoomChanged(zoom) {\n this.dispatchEvent('zoom', zoom);\n }\n onFitModeChanged(fitMode) {\n this.store.document.fitModeChanged(fitMode);\n this.dispatchEvent('fitMode', fitMode);\n }\n onPageLayoutModeChanged(layoutMode) {\n this.store.document.pageLayoutModeChanged(layoutMode);\n this.dispatchEvent('pageLayoutMode', layoutMode);\n }\n onBusyStateChanged(state) {\n this.store.document.busyStateChanged(state);\n if (state) {\n this.element.classList.remove('pwv-ViewerCanvas--documentIdle');\n }\n else {\n this.element.classList.add('pwv-ViewerCanvas--documentIdle');\n }\n this.dispatchEvent('busyState', state);\n }\n onRotationChanged(rotation) {\n this.store.document.rotationChanged(rotation);\n this.dispatchEvent('rotation', rotation);\n }\n onItemCreated(item) {\n if (item.itemCategory === PdfItemCategory.ANNOTATION) {\n this.store.annotations.addAnnotation(item);\n }\n this.dispatchEvent('itemCreated', item);\n }\n onItemUpdated(item) {\n if (item.itemCategory === PdfItemCategory.ANNOTATION) {\n this.store.annotations.updateAnnotation(item);\n }\n this.dispatchEvent('itemUpdated', item);\n }\n onItemDeleted(deletedItem) {\n if (deletedItem.categoryType === PdfItemCategory.ANNOTATION) {\n this.store.annotations.deleteAnnotation(deletedItem.id);\n }\n this.dispatchEvent('itemDeleted', deletedItem);\n }\n onPageChanged(pageNumber) {\n this.pdfViewerApi\n .getItemsFromPage(pageNumber, PdfItemCategory.ANNOTATION)\n .then((itemsOnPage) => {\n itemsOnPage.items.forEach((annotation) => {\n this.store.annotations.updateAnnotation(annotation);\n });\n this.dispatchEvent('pageChanged', pageNumber);\n });\n }\n onApiError(error) {\n console.error('//// PdfViewerApi Error: ', error);\n this.dispatchEvent('error', error);\n }\n beforeUnloadCallback(e) {\n const changes = this.pdfViewerApi.hasChanges();\n if (changes !== null && changes !== DocumentChange.NONE) {\n e.preventDefault();\n e.returnValue = '';\n }\n else {\n return;\n }\n }\n getNextZoomOutLevel(zoomCurrent) {\n for (var i = this.options.viewer.general.defaultZoomLevels.length - 1; i >= 0; i--) {\n if (zoomCurrent > this.options.viewer.general.defaultZoomLevels[i])\n return this.options.viewer.general.defaultZoomLevels[i];\n }\n return this.options.viewer.general.defaultZoomLevels[0];\n }\n getNextZoomInLevel(zoomCurrent) {\n for (var i = 0; i < this.options.viewer.general.defaultZoomLevels.length; i++) {\n if (zoomCurrent < this.options.viewer.general.defaultZoomLevels[i])\n return this.options.viewer.general.defaultZoomLevels[i];\n }\n return this.options.viewer.general.defaultZoomLevels[this.options.viewer.general.defaultZoomLevels.length - 1];\n }\n}\n","import { PdfItemType, } from '../../pdf-viewer-api';\n/** internal */\nexport const state = {\n annotationsChanged: false,\n openPopupChanged: false,\n all: [],\n byPage: [],\n popupsByPage: [],\n openPopupsByPage: [],\n};\n/** internal */\nexport const annotationHasPopup = (annotation) => {\n if (annotation.itemType === PdfItemType.TEXT) {\n return true;\n }\n if (annotation.itemType === PdfItemType.FREE_TEXT) {\n return false;\n }\n if (!annotation.behaviors) {\n return false;\n }\n return (annotation.behaviors.canHavePopup &&\n (annotation.popup.isOpen === true ||\n (typeof annotation.content === 'string' && annotation.content !== '') ||\n (typeof annotation.subject === 'string' && annotation.subject !== '')));\n};\n/** internal */\nexport const actions = {\n setPageAnnotations: (annotationsOnPage) => ($state) => {\n const newState = Object.assign({}, $state);\n const pageNumber = annotationsOnPage.page;\n newState.byPage[pageNumber] = [];\n annotationsOnPage.items.forEach((item) => {\n const annotation = item;\n newState.all[annotation.id] = annotation;\n newState.byPage[pageNumber].push(annotation.id);\n if (annotationHasPopup(annotation)) {\n if (!newState.popupsByPage[pageNumber]) {\n newState.popupsByPage[pageNumber] = [];\n }\n newState.popupsByPage[pageNumber].push(annotation.id);\n if (annotation.popup.isOpen) {\n if (!newState.openPopupsByPage[pageNumber]) {\n newState.openPopupsByPage[pageNumber] = [];\n }\n if (!newState.openPopupsByPage[pageNumber].find((id) => id === annotation.id)) {\n newState.openPopupsByPage[pageNumber].push(annotation.id);\n newState.openPopupChanged = true;\n }\n }\n }\n });\n newState.annotationsChanged = true;\n return newState;\n },\n deleteAnnotation: (id) => ($state) => {\n const newState = Object.assign({}, $state);\n const annotation = $state.all[id];\n const pageNumber = annotation.pdfRect.page;\n delete newState.all[id];\n newState.byPage[pageNumber] = newState.byPage[pageNumber].filter((i) => i !== id);\n if (newState.popupsByPage[pageNumber]) {\n newState.popupsByPage[pageNumber] = newState.popupsByPage[pageNumber].filter((i) => i !== id);\n }\n if (newState.openPopupsByPage[pageNumber]) {\n newState.openPopupChanged = newState.openPopupsByPage[pageNumber].indexOf(id) > -1;\n newState.openPopupsByPage[pageNumber] = newState.openPopupsByPage[pageNumber].filter((i) => i !== id);\n }\n newState.annotationsChanged = true;\n return newState;\n },\n updateAnnotation: (annotation) => ($state) => {\n const newState = Object.assign({}, $state);\n const { behaviors } = annotation;\n const id = annotation.id;\n const pageNumber = annotation.pdfRect.page;\n if (behaviors.canHavePopup) {\n if (annotationHasPopup(annotation)) {\n if (!newState.popupsByPage[pageNumber]) {\n newState.popupsByPage[pageNumber] = [];\n }\n const popupIndex = newState.popupsByPage[pageNumber].indexOf(id);\n if (popupIndex < 0) {\n newState.popupsByPage[pageNumber].push(annotation.id);\n }\n }\n else {\n if (newState.popupsByPage[pageNumber]) {\n newState.popupsByPage[pageNumber] = newState.popupsByPage[pageNumber].filter((i) => i !== id);\n }\n }\n if (annotation.popup.isOpen) {\n if (!newState.openPopupsByPage[pageNumber]) {\n newState.openPopupsByPage[pageNumber] = [];\n }\n if (newState.openPopupsByPage[pageNumber].indexOf(id) < 0) {\n newState.openPopupsByPage[pageNumber].push(id);\n }\n newState.openPopupChanged = true;\n }\n else if (newState.openPopupsByPage[pageNumber]) {\n newState.openPopupsByPage[pageNumber] = newState.openPopupsByPage[pageNumber].filter((i) => i !== id);\n newState.openPopupChanged = true;\n }\n }\n newState.all[annotation.id] = annotation;\n newState.annotationsChanged = true;\n return newState;\n },\n addAnnotation: (annotation) => ($state) => {\n const newState = Object.assign({}, $state);\n const pageNumber = annotation.pdfRect.page;\n const id = annotation.id;\n newState.all[id] = annotation;\n if (!newState.byPage[pageNumber]) {\n newState.byPage[pageNumber] = [];\n }\n newState.byPage[pageNumber].push(id);\n if (annotationHasPopup(annotation)) {\n if (!newState.popupsByPage[pageNumber]) {\n newState.popupsByPage[pageNumber] = [];\n }\n newState.popupsByPage[pageNumber].push(id);\n if (annotation.popup.isOpen) {\n if (!newState.openPopupsByPage[pageNumber]) {\n newState.openPopupsByPage[pageNumber] = [];\n }\n newState.openPopupsByPage[pageNumber].push(id);\n newState.openPopupChanged = true;\n }\n }\n newState.annotationsChanged = true;\n return newState;\n },\n};\n/** internal */\nexport const getPopups = ($state, startPage, endPage) => {\n let popups = [];\n for (let page = startPage; page <= endPage; page++) {\n if ($state.popupsByPage[page]) {\n popups = popups\n .concat($state.popupsByPage[page].map((id) => $state.all[id]))\n .filter((annot) => !annot.isHidden());\n }\n }\n return popups;\n};\n/** internal */\nexport const getOpenPopups = ($state, startPage, endPage) => {\n let openPopups = [];\n for (let page = startPage; page <= endPage; page++) {\n if ($state.openPopupsByPage[page]) {\n openPopups = openPopups.concat($state.openPopupsByPage[page].map((id) => $state.all[id]));\n }\n }\n return openPopups;\n};\n","/** internal */\nexport const appState = (state, actions) => {\n const clone = (target, source) => {\n const out = {};\n for (const field of Object.keys(target)) {\n out[field] = target[field];\n }\n if (source) {\n for (const field of Object.keys(source)) {\n out[field] = source[field];\n }\n }\n return out;\n };\n const getPartialState = (path, source) => {\n let i = 0;\n while (i < path.length) {\n source = source[path[i++]];\n }\n return source;\n };\n function setPartialState(path, value, source) {\n const target = {};\n if (path.length) {\n target[path[0]] =\n path.length > 1 ? setPartialState(path.slice(1), value, source[path[0]]) : value;\n return clone(source, target);\n }\n return value;\n }\n const wireStateToActions = (path, wState, wActions) => {\n for (const field of Object.keys(wActions)) {\n if (typeof wActions[field] === 'function') {\n ;\n ((key, action) => {\n wActions[key] = (data) => {\n let result = action(data);\n if (typeof result === 'function') {\n result = result(getPartialState(path, globalState), wActions);\n }\n /* tslint:disable-next-line */\n if (result &&\n result !== (wState = getPartialState(path, globalState)) &&\n !result.then) {\n globalState = setPartialState(path, clone(wState, result), globalState);\n }\n return result;\n };\n })(field, wActions[field]);\n }\n else {\n wireStateToActions(path.concat(field), (wState[field] = clone(wState[field])), (wActions[field] = clone(wActions[field])));\n }\n }\n return wActions;\n };\n let globalState = clone(state);\n const wiredActions = wireStateToActions([], globalState, clone(actions));\n return wiredActions;\n};\n","/** internal */\nexport const state = {\n widthChanged: true,\n heightChanged: true,\n pixelRatioChanged: true,\n canvasInvalidated: true,\n width: { devicePixels: 0, cssPixels: 0 },\n height: { devicePixels: 0, cssPixels: 0 },\n pixelRatio: 1,\n};\n/** internal */\nexport const actions = {\n resize: (payload) => ($state) => {\n const pixelRatio = window.devicePixelRatio;\n const newState = Object.assign({}, $state);\n if ($state.pixelRatio !== pixelRatio) {\n newState.pixelRatio = pixelRatio;\n newState.pixelRatioChanged = true;\n }\n if ($state.width.cssPixels !== payload.cssWidth) {\n newState.width.cssPixels = payload.cssWidth;\n newState.width.devicePixels = payload.cssWidth * pixelRatio;\n newState.widthChanged = true;\n }\n if ($state.height.cssPixels !== payload.cssHeight) {\n newState.height.cssPixels = payload.cssHeight;\n newState.height.devicePixels = payload.cssHeight * pixelRatio;\n newState.heightChanged = true;\n }\n return newState;\n },\n setPixelRatio: (pixelRatio) => ($state) => {\n const newState = Object.assign({}, $state);\n if ($state.pixelRatio !== pixelRatio) {\n newState.pixelRatio = pixelRatio;\n newState.pixelRatioChanged = true;\n }\n return newState;\n },\n setCanvasInvalidated: (canvasInvalidated) => ($state) => (Object.assign(Object.assign({}, $state), { canvasInvalidated })),\n};\n","import { PdfFitMode, PdfPageLayoutMode } from '../../pdf-viewer-api';\n/** internal */\nexport const state = {\n busyStateChanged: true,\n heightChanged: true,\n widthChanged: true,\n zoomChanged: true,\n rotationChanged: true,\n firstVisiblePageChanged: true,\n lastVisiblePageChanged: true,\n busyState: false,\n firstVisiblePage: 0,\n lastVisiblePage: 0,\n pageRects: [],\n zoom: 1,\n fitMode: PdfFitMode.NONE,\n pageLayoutMode: PdfPageLayoutMode.SINGLE_PAGE,\n rotation: 0,\n width: { devicePixels: 0, cssPixels: 0 },\n height: { devicePixels: 0, cssPixels: 0 },\n};\n/** internal */\nexport const actions = {\n fistVisiblePageChanged: (pageNumber) => ($state) => (Object.assign(Object.assign({}, $state), { firstVisiblePage: pageNumber, firstVisiblePageChanged: true })),\n lastVisiblePageChanged: (pageNumber) => ($state) => (Object.assign(Object.assign({}, $state), { lastVisiblePage: pageNumber, lastVisiblePageChanged: true })),\n resize: (payload) => ($state) => {\n const newState = Object.assign({}, $state);\n const pixelRatio = window.devicePixelRatio;\n if (newState.width.devicePixels !== payload.devicePixelsWidth) {\n newState.width.cssPixels = payload.devicePixelsWidth / pixelRatio;\n newState.width.devicePixels = payload.devicePixelsWidth;\n newState.widthChanged = true;\n }\n if (newState.height.devicePixels !== payload.devicePixelsHeight) {\n newState.height.cssPixels = payload.devicePixelsHeight / pixelRatio;\n newState.height.devicePixels = payload.devicePixelsHeight;\n newState.heightChanged = true;\n }\n if (newState.zoom !== payload.zoom) {\n newState.zoom = payload.zoom;\n newState.zoomChanged = true;\n }\n return newState;\n },\n rotationChanged: (rotation) => ($state) => (Object.assign(Object.assign({}, $state), { rotation, rotationChanged: true })),\n updatePageRects: (pageRects) => ($state) => (Object.assign(Object.assign({}, $state), { pageRects })),\n busyStateChanged: (busyState) => ($state) => (Object.assign(Object.assign({}, $state), { busyState, busyStateChanged: true })),\n fitModeChanged: (fitMode) => ($state) => (Object.assign(Object.assign({}, $state), { fitMode })),\n pageLayoutModeChanged: (pageLayoutMode) => ($state) => (Object.assign(Object.assign({}, $state), { pageLayoutMode })),\n};\n/** internal */\nconst getSelectionRectFromPage = ($state, startPoint, endPoint, page, padding = 1) => {\n let rect = null;\n const pageRect = $state.pageRects[page];\n const pX1 = pageRect.x + padding;\n const pX2 = pageRect.x + (pageRect.w - 2 * padding);\n const pY1 = pageRect.y + padding;\n const pY2 = pageRect.y + (pageRect.h - 2 * padding);\n if (startPoint.x >= pX1 && startPoint.x <= pX2 && startPoint.y >= pY1 && startPoint.y <= pY2) {\n endPoint.x = endPoint.x < pX1 ? pX1 : endPoint.x > pX2 ? pX2 : endPoint.x;\n endPoint.y = endPoint.y < pY1 ? pY1 : endPoint.y > pY2 ? pY2 : endPoint.y;\n rect = { x: 0, y: 0, w: 0, h: 0 };\n if (startPoint.x < endPoint.x) {\n rect.x = startPoint.x;\n rect.w = endPoint.x - startPoint.x;\n }\n else {\n rect.x = endPoint.x;\n rect.w = startPoint.x - endPoint.x;\n }\n if (startPoint.y < endPoint.y) {\n rect.y = startPoint.y;\n rect.h = endPoint.y - startPoint.y;\n }\n else {\n rect.y = endPoint.y;\n rect.h = startPoint.y - endPoint.y;\n }\n return rect;\n }\n return rect;\n};\n/** internal */\nexport const getRectFromSelection = ($state, startPoint, endPoint, page, padding = 1) => {\n if (page) {\n return getSelectionRectFromPage($state, startPoint, endPoint, page);\n }\n else {\n for (const pNr in $state.pageRects) {\n if ($state.pageRects) {\n const rect = getSelectionRectFromPage($state, startPoint, endPoint, parseInt(pNr, 10), padding);\n if (rect) {\n return rect;\n }\n }\n }\n }\n return null;\n};\n","/** internal */\nexport const state = {\n positionChanged: true,\n stateChanged: true,\n isDown: false,\n type: 'ontouchstart' in window ? 'touch' : 'mouse',\n action: null,\n x: { devicePixels: 0, cssPixels: 0 },\n y: { devicePixels: 0, cssPixels: 0 },\n};\n/** internal */\nexport const actions = {\n setAction: (action) => ($state) => (Object.assign(Object.assign({}, $state), { action })),\n update: (payload) => ($state) => {\n const pixelRatio = window.devicePixelRatio;\n const newState = Object.assign({}, $state);\n newState.type = payload.type;\n if ($state.x.cssPixels !== payload.cssY || $state.x.cssPixels !== payload.cssX) {\n newState.x.cssPixels = payload.cssX;\n newState.x.devicePixels = payload.cssX * pixelRatio;\n newState.y.cssPixels = payload.cssY;\n newState.y.devicePixels = payload.cssY * pixelRatio;\n newState.positionChanged = true;\n }\n if ($state.isDown !== payload.isDown) {\n newState.isDown = payload.isDown;\n newState.stateChanged = true;\n }\n return newState;\n },\n};\n","/** internal */\nexport const state = {\n topPositionChanged: false,\n leftPositionChanged: false,\n top: { devicePixels: 0, cssPixels: 0 },\n left: { devicePixels: 0, cssPixels: 0 },\n};\n/** internal */\nexport const actions = {\n scrollChanged: (payload) => ($state) => {\n const newState = Object.assign({}, $state);\n const pixelRatio = window.devicePixelRatio;\n if ($state.top.devicePixels !== payload.cssTop) {\n newState.top.cssPixels = payload.cssTop / pixelRatio;\n newState.top.devicePixels = payload.cssTop;\n newState.topPositionChanged = true;\n }\n if ($state.left.devicePixels !== payload.cssLeft) {\n newState.left.cssPixels = payload.cssLeft / pixelRatio;\n newState.left.devicePixels = payload.cssLeft;\n newState.leftPositionChanged = true;\n }\n return newState;\n },\n};\n","/** internal */\nexport const state = {\n searchString: '',\n caseSensitive: false,\n wrapSearch: false,\n useRegex: false,\n page: 1,\n match: null,\n painted: false,\n};\n/** internal */\nexport const actions = {\n start: (payload) => ($state) => (Object.assign(Object.assign(Object.assign({}, $state), payload), { match: null, page: 1 })),\n updateMatch: (payload) => ($state) => (Object.assign(Object.assign(Object.assign({}, $state), payload), { painted: false })),\n matchPainted: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { painted: true });\n },\n clear: () => ($state) => ({\n searchString: '',\n caseSensitive: false,\n wrapSearch: false,\n useRegex: false,\n page: 1,\n match: null,\n painted: false,\n }),\n};\n","import { appState } from './appState';\nimport * as Document from './document';\nimport * as Annotations from './annotations';\nimport * as Canvas from './canvas';\nimport * as Scroll from './scroll';\nimport * as Pointer from './pointer';\nimport * as Search from './search';\nimport * as Viewer from './viewer';\n/** internal */\nexport const defaultState = {\n document: Document.state,\n annotations: Annotations.state,\n canvas: Canvas.state,\n scroll: Scroll.state,\n pointer: Pointer.state,\n startPointer: Pointer.state,\n search: Search.state,\n viewer: Viewer.state,\n};\n/** internal */\nconst deepClone = (state) => {\n return JSON.parse(JSON.stringify(state));\n};\n/** internal */\nconst resetSearchResults = (searchState) => {\n searchState.page = 1;\n searchState.match = null;\n return searchState;\n};\n/** internal */\nexport const actions = {\n document: Document.actions,\n annotations: Annotations.actions,\n canvas: Canvas.actions,\n scroll: Scroll.actions,\n search: Search.actions,\n pointer: Pointer.actions,\n startPointer: Pointer.actions,\n viewer: Viewer.actions,\n getState: () => ($state) => $state,\n loadDefaultState: () => ($state) => {\n const newState = deepClone(defaultState);\n newState.viewer.contextBarItems = $state.viewer.contextBarItems;\n newState.search = resetSearchResults($state.search);\n return newState;\n },\n resetChangedState: () => ($state) => (Object.assign(Object.assign({}, $state), { changed: false, viewer: Object.assign(Object.assign({}, $state.viewer), { modeChanged: false, cursorStyleChanged: false, selectedAnnotationChanged: false, textSelectionChanged: false, selectedPopupChanged: false, command: null }), annotations: Object.assign(Object.assign({}, $state.annotations), { annotationsChanged: false, openPopupChanged: false }), document: Object.assign(Object.assign({}, $state.document), { busyStateChanged: false, heightChanged: false, widthChanged: false, firstVisiblePageChanged: false, lastVisiblePageChanged: false, rotationChanged: false, zoomChanged: false }), canvas: Object.assign(Object.assign({}, $state.canvas), { canvasInvalidated: false, heightChanged: false, widthChanged: false }), scroll: Object.assign(Object.assign({}, $state.scroll), { leftPositionChanged: false, topPositionChanged: false }), pointer: Object.assign(Object.assign({}, $state.pointer), { positionChanged: false, stateChanged: false, action: null }) })),\n};\n/** internal */\nexport const createStore = () => {\n return appState(deepClone(defaultState), actions);\n};\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n/** internal */\nexport var ViewerMode;\n(function (ViewerMode) {\n ViewerMode[ViewerMode[\"DEFAULT\"] = 0] = \"DEFAULT\";\n ViewerMode[ViewerMode[\"ANNOTATION_SELECTED\"] = 1] = \"ANNOTATION_SELECTED\";\n ViewerMode[ViewerMode[\"TEXT_SELECTED\"] = 2] = \"TEXT_SELECTED\";\n ViewerMode[ViewerMode[\"POPUP_SELECTED\"] = 3] = \"POPUP_SELECTED\";\n ViewerMode[ViewerMode[\"MODULE_SELECTED\"] = 4] = \"MODULE_SELECTED\";\n})(ViewerMode || (ViewerMode = {}));\n/** internal */\nexport var CursorStyle;\n(function (CursorStyle) {\n CursorStyle[\"DEFAULT\"] = \"default\";\n CursorStyle[\"TEXT\"] = \"text\";\n CursorStyle[\"NONE\"] = \"none\";\n CursorStyle[\"POINTER\"] = \"pointer\";\n CursorStyle[\"CROSSHAIR\"] = \"crosshair\";\n CursorStyle[\"NOT_ALLOWED\"] = \"not-allowed\";\n CursorStyle[\"WAIT\"] = \"wait\";\n CursorStyle[\"MOVE\"] = \"move\";\n CursorStyle[\"GRAB\"] = \"grab\";\n CursorStyle[\"GRABBING\"] = \"grabbing\";\n CursorStyle[\"COL_RESIZE\"] = \"col-resize\";\n CursorStyle[\"ROW_RESIZE\"] = \"row-resize\";\n CursorStyle[\"NS_RESIZE\"] = \"ns-resize\";\n CursorStyle[\"EW_RESIZE\"] = \"ew-resize\";\n CursorStyle[\"NESW_RESIZE\"] = \"nesw-resize\";\n CursorStyle[\"NWSE_RESIZE\"] = \"nwse-resize\";\n CursorStyle[\"ERASE\"] = \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADwQAAA8EB0Z6ZfgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAM+SURBVEiJtZRbSBRRGMe/WTd3dmfmzOyZdcaVQlCsl3yK8lIqRAgFIbrubGa6D1IURQ8RhWgPQZC0RRQ99agPQXSDNCPEy67FCqZb6boma7Vq1w0zytvO7PTS0qZ7M+wPw8D3/+b/O+fMzEcEg0HV5/NBtPx+/2273W6D9ZDL5VIBIAwAi1HXkXUJBwDt7/sbAMhdr9BoaVJtbK6sPLwrP9/4XwBX7XbH6YqKG+erqjxHy8uFtQC0c3NzPQBwK17DzWPHzlsKCk5u0Gq1hXl5GwmCGJyX5aLW7u6ZVABEItNRV9dkLys7R5Hkhuj64OTkh3tOZ/G1rq5AMkBaPON6Q8OJ2pKSCzRJpq/0soxGRsC4xsRx9/vHxmbXDGiprT1uKy6+zOr1q8IjElmWZvX6GoamHw6Mj39NGXClvv7QwdLS60aK0iVaGQBAJsdRPEXZkF7f4Z6YCCYFNErSPntJSSumaTJZeBTEICJky+D5jn6v98tK/6/PVKeqwW/z80qq4RHlmM28YtrcZ7UeyV/p/bWDXq93RkSoLwOhap5hkh4RAMCyLMPVVx8VcaeN4hB7QKBRz+jY0PuYgN+QKTPLuniEqk1JIEuhEDhezISFAksaEAToWIE0Yl7KNtIuz8jQVExABCJynDMDIYuJYWK+j5CiQMvzd4pQZE0jNH9OOp0x6QwsL2VnsG7Py8G3cf8Dp9c7bca4Q0RIwgxjiPZkRYFLQ+8UoUhK02hWTxsdY0o3MNiSbebdcQEAAL2jo59Zmn6CaVoSWVYfCXcMTyl8YXXM8GgICcT+hAAAgKc+3ycBoUeYpiWeYQyXhwNhXJA4HABAXvyhwrSnPSkAAMDl832mSbL92XeN1bSzhtZoEj8mLy2oCyOPO5odjdUpAQAA3BMTQQpvahcwL5HGTCpenyovq6Hx7r6mljN7ARIMu1jy+0eCyIAeYA7ZSFZcBVEVWZ0dfDBw7tLZskgt4biOp117LDm7d1ucOHebOVILhxX4+aJzuPniqe0EQaiR+pp2EFFgcmxWWVq+I/LYasBZSFVV+OnpfLll0r1jqySFo3v/CQAAEAi8ngsvh+6KHFMZmvJMi7Pj2+1tbfLKvl/ycBilf3EZ0gAAAABJRU5ErkJggg=='), auto\";\n})(CursorStyle || (CursorStyle = {}));\n/** internal */\nexport const state = {\n modeChanged: true,\n mode: ViewerMode.DEFAULT,\n selectedAnnotationId: null,\n selectedAnnotationBehaviors: null,\n selectedAnnotationChanged: true,\n textSelectionChanged: true,\n textSelection: null,\n textSelectionType: null,\n textSelectionState: null,\n textSelectionRects: null,\n selectedPopupId: null,\n selectedPopupChanged: true,\n popupFocus: null,\n selectedModuleName: null,\n cursorStyle: CursorStyle.DEFAULT,\n cursorStyleChanged: true,\n contextBarItems: [],\n};\n/** internal */\nexport const actions = {\n setDefaultMode: () => ($state) => ({\n modeChanged: true,\n mode: ViewerMode.DEFAULT,\n selectedAnnotationId: null,\n selectedAnnotationBehaviors: null,\n selectedAnnotationChanged: true,\n textSelectionChanged: true,\n textSelection: null,\n selectedPopupId: null,\n selectedPopupChanged: true,\n selectedModuleName: null,\n cursorStyle: CursorStyle.DEFAULT,\n cursorStyleChanged: true,\n }),\n addContextBarItem: (contextBarItem) => ($state) => {\n const contextBarItems = $state.contextBarItems;\n contextBarItem.itemTypes.forEach((itemType) => {\n if (!contextBarItems[itemType]) {\n contextBarItems[itemType] = [];\n }\n contextBarItems[itemType].push(contextBarItem);\n });\n return Object.assign(Object.assign({}, $state), { contextBarItems });\n },\n clearContextBarItems: () => ($state) => (Object.assign(Object.assign({}, $state), { contextBarItems: [] })),\n setCursorStyle: (cursorStyle) => ($state) => (Object.assign(Object.assign({}, $state), { cursorStyle, cursorStyleChanged: $state.cursorStyle !== cursorStyle })),\n selectAnnotation: (annotation) => ($state) => (Object.assign(Object.assign({}, $state), { selectedAnnotationId: annotation.id, selectedAnnotationBehaviors: annotation.behaviors, selectedAnnotationChanged: true, selectedModuleName: null, selectedPopupId: null, modeChanged: true, mode: ViewerMode.ANNOTATION_SELECTED })),\n deselectAnnotation: () => ($state) => {\n const modeChanged = $state.mode === ViewerMode.ANNOTATION_SELECTED;\n return Object.assign(Object.assign({}, $state), { selectedAnnotationId: null, selectedAnnotationBehaviors: null, selectedModuleName: null, selectedAnnotationChanged: true, modeChanged, mode: modeChanged ? ViewerMode.DEFAULT : $state.mode });\n },\n beginModule: (moduleName) => ($state) => {\n return Object.assign(Object.assign({}, $state), { modeChanged: true, mode: ViewerMode.MODULE_SELECTED, selectedAnnotationId: null, selectedAnnotationBehaviors: null, selectedAnnotationChanged: true, textSelectionChanged: true, textSelection: null, selectedModuleName: moduleName, selectedPopupId: null, selectedPopupChanged: true });\n },\n endModule: (moduleName) => ($state) => {\n const selectedModuleName = $state.selectedModuleName === moduleName ? null : $state.selectedModuleName;\n const mode = selectedModuleName !== null ? ViewerMode.MODULE_SELECTED : ViewerMode.DEFAULT;\n return Object.assign(Object.assign({}, $state), { modeChanged: true, selectedModuleName,\n mode });\n },\n setTextSelectionState: (textSelectionState) => ($state) => {\n return Object.assign(Object.assign({}, $state), { textSelectionState });\n },\n setTextSelection: (args) => ($state) => {\n const { selection, type } = args;\n const mode = selection ? ViewerMode.TEXT_SELECTED : ViewerMode.DEFAULT;\n const modeChanged = $state.mode !== mode;\n const textSelectionRects = selection ? {} : null;\n if (selection && textSelectionRects) {\n const pageRects = {};\n selection.quadrilaterals.forEach((q) => {\n const { bottomLeft, bottomRight, topRight, topLeft, pageNumber } = q;\n if (!pageRects[pageNumber]) {\n pageRects[pageNumber] = {\n x1: Number.MAX_SAFE_INTEGER,\n y1: Number.MAX_SAFE_INTEGER,\n x2: Number.MIN_SAFE_INTEGER,\n y2: Number.MIN_SAFE_INTEGER,\n };\n }\n pageRects[pageNumber] = {\n x1: Math.min(pageRects[pageNumber].x1, bottomLeft.x, bottomRight.x, topRight.x, topLeft.x),\n y1: Math.min(pageRects[pageNumber].y1, bottomLeft.y, bottomRight.y, topRight.y, topLeft.y),\n x2: Math.max(pageRects[pageNumber].x2, bottomLeft.x, bottomRight.x, topRight.x, topLeft.x),\n y2: Math.max(pageRects[pageNumber].y2, bottomLeft.y, bottomRight.y, topRight.y, topLeft.y),\n };\n });\n Object.keys(pageRects).forEach((pageNumber) => {\n textSelectionRects[pageNumber] = {\n pdfX: pageRects[pageNumber].x1,\n pdfY: pageRects[pageNumber].y1,\n pdfW: pageRects[pageNumber].x2 - pageRects[pageNumber].x1,\n pdfH: pageRects[pageNumber].y2 - pageRects[pageNumber].y1,\n page: parseInt(pageNumber),\n };\n });\n }\n return Object.assign(Object.assign({}, $state), { mode,\n modeChanged, textSelectionChanged: true, textSelection: selection, textSelectionType: type, textSelectionRects });\n },\n selectPopup: (args) => ($state) => {\n const mode = args.id !== null ? ViewerMode.POPUP_SELECTED : ViewerMode.DEFAULT;\n const modeChanged = $state.mode !== mode;\n return Object.assign(Object.assign({}, $state), { mode,\n modeChanged, selectedPopupChanged: args.id !== $state.selectedPopupId, selectedPopupId: args.id, popupFocus: args.focus ? args.id : null });\n },\n clearPopupFocus: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { popupFocus: null });\n },\n deselectPopup: () => ($state) => {\n const mode = ViewerMode.DEFAULT;\n const modeChanged = mode !== $state.mode;\n return Object.assign(Object.assign({}, $state), { mode,\n modeChanged });\n },\n};\n/** internal */\nexport const copyTextToClipboard = (text) => __awaiter(void 0, void 0, void 0, function* () {\n try {\n yield navigator.clipboard.writeText(text);\n }\n catch (err) {\n var textArea = document.createElement('textarea');\n textArea.value = text;\n textArea.style.top = '0';\n textArea.style.left = '0';\n textArea.style.position = 'fixed';\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n document.execCommand('copy');\n document.body.removeChild(textArea);\n }\n});\n","import { PdfItemType, PdfItemCategory, PdfPageLayoutMode, } from '../../pdf-viewer-api';\nimport { ViewLayerBase } from './ViewLayerBase';\nimport { ViewerMode, copyTextToClipboard, CursorStyle } from '../state/viewer';\nimport { createAnnotationContextBar } from './views/AnnotationContextBar';\nimport { AnnotationBorder } from './views/AnnotationBorder';\nimport { addHistoryEntry } from '../../custom/history';\n/** internal */\nexport class AnnotationSelectionLayer extends ViewLayerBase {\n constructor() {\n super();\n this.context = null;\n this.selectedAnnotation = null;\n this.selectionElement = null;\n this.barAtTop = true;\n this.contextBar = null;\n this.annotationBorder = null;\n this.deleteAnnotation = this.deleteAnnotation.bind(this);\n this.rotateAnnotation = this.rotateAnnotation.bind(this);\n this.copyAnnotationText = this.copyAnnotationText.bind(this);\n this.createPopup = this.createPopup.bind(this);\n this.openPopup = this.openPopup.bind(this);\n this.deletePopup = this.deletePopup.bind(this);\n this.moveAnnotation = this.moveAnnotation.bind(this);\n this.toggleLock = this.toggleLock.bind(this);\n this.resizeAnnotation = this.resizeAnnotation.bind(this);\n this.onItemSelected = this.onItemSelected.bind(this);\n this.onItemDblClick = this.onItemDblClick.bind(this);\n }\n create() {\n var _a, _b;\n if (this.viewerCanvas) {\n this.viewerCanvas.addEventListener('itemSelected', this.onItemSelected);\n }\n this.selectAnnotation = this.selectAnnotation.bind(this);\n this.deselectAnnotation = this.deselectAnnotation.bind(this);\n this.deleteAnnotation = this.deleteAnnotation.bind(this);\n this.createPopup = this.createPopup.bind(this);\n this.deletePopup = this.deletePopup.bind(this);\n this.openPopup = this.openPopup.bind(this);\n this.context = this.createCanvas('pwv-annotation-selection-layers');\n this.context.canvas.style.display = 'none';\n this.selectionElement = this.createHtmlLayer();\n this.selectionElement.style.display = 'none';\n this.selectionElement.style.position = 'absolute';\n this.selectionElement.classList.add('pwv-annotation-selection');\n this.selectionElement.classList.add('pwv-contextbar-top');\n this.selectionElement.addEventListener('click', (e) => {\n e.preventDefault();\n e.cancelBubble = true;\n }, false);\n if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {\n this.contextBar = createAnnotationContextBar({\n allowCopyText: this.options.viewer.permissions.allowCopyText,\n allowLockAnnotations: this.options.viewer.permissions.allowLockAnnotations,\n allowEditLockedAnnotations: this.options.viewer.permissions.allowEditLockedAnnotations,\n onDeleteAnnotation: this.deleteAnnotation,\n onRotateAnnotation: this.rotateAnnotation,\n onCopy: this.copyAnnotationText,\n onCreatePopup: this.createPopup,\n onOpenPopup: this.openPopup,\n onDeletePopup: this.deletePopup,\n onToggleLock: this.toggleLock,\n }, this.selectionElement);\n }\n this.annotationBorder = new AnnotationBorder(this.selectionElement, this.moveAnnotation, this.resizeAnnotation, this.onItemDblClick, this.options, this.store, !((_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.licenseFeatures.annotate) || false);\n }\n render(timestamp, state) {\n const mode = state.viewer.mode;\n if (this.selectedAnnotation && mode !== ViewerMode.ANNOTATION_SELECTED) {\n this.deselectAnnotation();\n }\n const { pageLayoutMode } = state.document;\n if ((pageLayoutMode === PdfPageLayoutMode.SINGLE_PAGE ||\n pageLayoutMode === PdfPageLayoutMode.TWO_PAGE_LEFT ||\n pageLayoutMode === PdfPageLayoutMode.TWO_PAGE_RIGHT) &&\n this.selectedAnnotation &&\n state.document.firstVisiblePageChanged) {\n this.deselectAnnotation();\n this.store.canvas.setCanvasInvalidated(true);\n return false;\n }\n if ((state.pointer.action === 'click' || state.pointer.action === 'dblclick') &&\n (mode === ViewerMode.DEFAULT ||\n mode === ViewerMode.ANNOTATION_SELECTED ||\n mode === ViewerMode.POPUP_SELECTED)) {\n const annotationsOnPoint = this.pdfViewerApi.getAnnotationsOnPoint({\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n });\n let breakRenderLoop = false;\n if (annotationsOnPoint && annotationsOnPoint.length) {\n // the most visible annotation is the last element of the returned list\n for (let i = annotationsOnPoint.length - 1; i >= 0; i--) {\n const annotationOnPoint = annotationsOnPoint[i];\n if (annotationOnPoint.behaviors.selectable) {\n if (state.pointer.action === 'click') {\n if (annotationOnPoint.itemType === PdfItemType.WIDGET) {\n if (this.viewerCanvas && !annotationOnPoint.widget.readOnly) {\n this.viewerCanvas.activateModule('FormFieldModule', {\n annotationId: annotationOnPoint.id,\n action: 'click',\n });\n breakRenderLoop = true;\n break;\n }\n }\n else if (annotationOnPoint.id !== state.viewer.selectedAnnotationId) {\n if (state.viewer.selectedAnnotationId) {\n this.deselectAnnotation();\n }\n if (!annotationOnPoint.isHidden()) {\n this.selectAnnotation(annotationOnPoint);\n breakRenderLoop = true;\n break;\n }\n }\n }\n else if (state.pointer.action === 'dblclick') {\n this.onItemDblClick(annotationOnPoint.id);\n break;\n }\n }\n }\n }\n else if (state.viewer.selectedAnnotationId) {\n this.deselectAnnotation();\n breakRenderLoop = true;\n }\n if (breakRenderLoop) {\n this.store.canvas.setCanvasInvalidated(true);\n return false;\n }\n }\n if (mode === ViewerMode.ANNOTATION_SELECTED && state.viewer.selectedAnnotationId) {\n const annotation = state.annotations.all[state.viewer.selectedAnnotationId];\n if (this.selectedAnnotation === null) {\n this.selectAnnotation(annotation);\n }\n if (this.annotationBorder && state.canvas.canvasInvalidated) {\n const pageRect = state.document.pageRects[annotation.pdfRect.page];\n if (pageRect) {\n this.annotationBorder.updatePageRect(pageRect);\n }\n }\n if (state.viewer.selectedAnnotationChanged || state.canvas.canvasInvalidated) {\n this.updateSelectionElementPosition(annotation);\n }\n }\n }\n updateSelectionElementPosition(annotation) {\n if (this.selectionElement) {\n const rect = this.pdfViewerApi.transformPdfPageRectToScreenRect(annotation.pdfRect);\n const annotationY = rect.y / devicePixelRatio;\n const annotationX = rect.x / devicePixelRatio;\n const annotationW = rect.w / devicePixelRatio;\n const annotationH = rect.h / devicePixelRatio;\n const newBarAtTop = annotationY > 80;\n this.selectionElement.style.top = annotationY + 'px';\n this.selectionElement.style.left = annotationX + 'px';\n this.selectionElement.style.width = annotationW + 'px';\n this.selectionElement.style.height = annotationH + 'px';\n if (this.barAtTop !== newBarAtTop) {\n this.barAtTop = newBarAtTop;\n if (this.barAtTop) {\n this.selectionElement.classList.remove('pwv-contextbar-bottom');\n this.selectionElement.classList.add('pwv-contextbar-top');\n }\n else {\n this.selectionElement.classList.remove('pwv-contextbar-top');\n this.selectionElement.classList.add('pwv-contextbar-bottom');\n }\n }\n // update contextbar left position\n const contextbarElement = this.selectionElement.lastChild;\n if (contextbarElement && contextbarElement.nodeType === 1) {\n const state = this.store.getState();\n const canvasWidth = state.canvas.width.cssPixels;\n const barWidth = contextbarElement.offsetWidth;\n const barCenter = barWidth / 2;\n const padding = 4;\n let left = 0;\n if (barWidth > annotationW) {\n left = (barWidth - annotationW) / -2;\n }\n else {\n left = (annotationW - barWidth) / 2;\n }\n if (annotationX + left + padding < 0) {\n left = annotationX * -1 + padding;\n if (annotationX + annotationW < barCenter) {\n left = annotationW - barCenter;\n }\n }\n if (annotationX + left + barWidth + padding > canvasWidth) {\n left = canvasWidth - annotationX - barWidth - padding;\n if (left * -1 > barCenter) {\n left = barCenter * -1;\n }\n }\n contextbarElement.style.left = left + 'px';\n }\n }\n }\n selectAnnotation(annotation, preventEvent) {\n var _a, _b;\n if (this.selectionElement && this.context && this.annotationBorder) {\n this.selectedAnnotation = annotation;\n const pageRect = this.store.getState().document.pageRects[annotation.pdfRect.page];\n this.annotationBorder.deselectAnnotation();\n this.annotationBorder.setAnnotation(annotation, pageRect);\n const state = this.store.getState();\n if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.contextBar) {\n const commands = (_b = state.viewer.contextBarItems[annotation.itemType]) !== null && _b !== void 0 ? _b : [];\n this.contextBar.setAnnotation({ annotation, commands });\n }\n this.context.canvas.style.display = 'none';\n this.selectionElement.style.display = 'block';\n this.barAtTop = true;\n this.selectionElement.classList.remove('pwv-contextbar-bottom');\n this.selectionElement.classList.add('pwv-contextbar-top');\n this.updateSelectionElementPosition(annotation);\n this.store.viewer.selectAnnotation(annotation);\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n if (this.viewerCanvas && !preventEvent) {\n this.dispatchEvent('itemSelected', annotation);\n }\n }\n }\n deselectAnnotation() {\n if (this.context && this.selectionElement && this.annotationBorder) {\n const annot = this.selectedAnnotation;\n this.selectedAnnotation = null;\n this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height);\n this.annotationBorder.deselectAnnotation();\n this.context.canvas.style.display = 'none';\n this.selectionElement.style.display = 'none';\n this.store.viewer.deselectAnnotation();\n if (this.viewerCanvas && annot !== null) {\n this.dispatchEvent('itemDeselected', annot);\n }\n }\n }\n rotateAnnotation(id) {\n if (this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n item.rotation = (item.rotation + 90) % 360;\n this.pdfViewerApi.updateItem(item).then((item) => {\n if (this.annotationBorder) {\n const annotation = item;\n const pageRect = this.store.getState().document.pageRects[annotation.pdfRect.page];\n this.annotationBorder.setAnnotation(annotation, pageRect);\n }\n });\n }\n }\n moveAnnotation(id, point) {\n var _a;\n if (this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n const newItemPos = this.pdfViewerApi.transformScreenPointToPdfPoint({\n x: point.x * window.devicePixelRatio,\n y: point.y * window.devicePixelRatio,\n }, item.page, true);\n if (newItemPos.pdfPoint.page === item.pdfRect.page) {\n switch (this.pdfViewerApi.getRotation()) {\n case 0:\n item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX;\n item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY;\n break;\n case 90:\n item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX - item.pdfRect.pdfW;\n item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY;\n break;\n case 180:\n item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX - item.pdfRect.pdfW;\n item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY - item.pdfRect.pdfH;\n break;\n case 270:\n item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX;\n item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY - item.pdfRect.pdfH;\n break;\n }\n }\n this.store.annotations.updateAnnotation(item);\n this.store.canvas.setCanvasInvalidated(true);\n if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {\n this.pdfViewerApi.updateItem(item);\n }\n }\n }\n resizeAnnotation(id, rect) {\n var _a;\n if (this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n const newItemRect = this.pdfViewerApi.transformScreenRectToPdfRect({\n x: rect.x * window.devicePixelRatio,\n y: rect.y * window.devicePixelRatio,\n w: rect.w * window.devicePixelRatio,\n h: rect.h * window.devicePixelRatio,\n }, item.pdfRect.page);\n if (newItemRect.page === item.pdfRect.page) {\n item.pdfRect = newItemRect;\n }\n this.store.annotations.updateAnnotation(item);\n this.store.canvas.setCanvasInvalidated(true);\n if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {\n this.pdfViewerApi.updateItem(item);\n }\n }\n }\n copyAnnotationText(id) {\n if (this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n if (item.itemType === PdfItemType.HIGHLIGHT ||\n item.itemType === PdfItemType.UNDERLINE ||\n item.itemType === PdfItemType.SQUIGGLY ||\n item.itemType === PdfItemType.STRIKE_OUT) {\n const quadPointAnnotation = item;\n const firstRect = quadPointAnnotation.quadrilaterals[0];\n const lastRect = quadPointAnnotation.quadrilaterals[quadPointAnnotation.quadrilaterals.length - 1];\n const startPoint = {\n pdfX: firstRect.topLeft.x,\n pdfY: firstRect.topLeft.y,\n page: firstRect.pageNumber,\n };\n const endPoint = {\n pdfX: lastRect.bottomRight.x,\n pdfY: lastRect.bottomRight.y,\n page: lastRect.pageNumber,\n };\n const text = this.pdfViewerApi.getText(startPoint, endPoint);\n copyTextToClipboard(text || '');\n }\n }\n }\n toggleLock(id) {\n var _a;\n if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {\n const annot = this.pdfViewerApi.getItem(id);\n if (this.options.annotation.trackHistory) {\n addHistoryEntry(annot, annot.isLocked() ? 'unlock' : 'lock', this.options.viewer.general.user);\n }\n annot.setLock(!annot.isLocked());\n if (this.annotationBorder) {\n this.annotationBorder.deselectAnnotation();\n const pageRect = this.store.getState().document.pageRects[annot.pdfRect.page];\n this.annotationBorder.setAnnotation(annot, pageRect);\n }\n this.store.annotations.updateAnnotation(annot);\n this.pdfViewerApi.updateItem(annot);\n }\n }\n deleteAnnotation(id) {\n var _a;\n if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n if (this.options.annotation.hideOnDelete) {\n item.setHidden(true);\n item.popup.isOpen = false;\n if (this.options.annotation.trackHistory) {\n addHistoryEntry(item, 'delete', this.options.viewer.general.user);\n }\n this.store.annotations.updateAnnotation(item);\n this.pdfViewerApi.updateItem(item);\n this.deselectAnnotation();\n }\n else {\n this.pdfViewerApi\n .deleteItem(item)\n .then(() => {\n this.deselectAnnotation();\n })\n .catch((error) => {\n console.error(error);\n });\n }\n }\n }\n deletePopup(id) {\n var _a;\n if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n item.content = null;\n item.popup.isOpen = false;\n this.store.annotations.updateAnnotation(item);\n this.store.canvas.setCanvasInvalidated(true);\n this.pdfViewerApi.updateItem(item);\n }\n }\n createPopup(id) {\n var _a;\n if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n item.content = '';\n item.popup.isOpen = true;\n item.popup.pdfRect.pdfX = item.pdfRect.pdfX;\n item.popup.pdfRect.pdfY = item.pdfRect.pdfY - (item.popup.pdfRect.pdfH + 10);\n this.store.annotations.updateAnnotation(item);\n this.store.canvas.setCanvasInvalidated(true);\n this.pdfViewerApi.updateItem(item).then(() => {\n this.store.viewer.selectPopup({ id: item.id, focus: true });\n });\n this.deselectAnnotation();\n }\n }\n openPopup(id) {\n var _a, _b;\n if (this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n if (!((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && (!item.content || !item.content)) {\n return;\n }\n if (!item.popup) {\n return;\n }\n item.popup.isOpen = true;\n this.store.annotations.updateAnnotation(item);\n this.store.canvas.setCanvasInvalidated(true);\n if ((_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.licenseFeatures.annotate) {\n this.pdfViewerApi.updateItem(item).then(() => {\n this.store.viewer.selectPopup({ id: item.id, focus: true });\n });\n }\n else {\n this.deselectAnnotation();\n this.store.viewer.selectPopup({ id: item.id, focus: true });\n }\n }\n }\n onItemDblClick(id) {\n if (this.pdfViewerApi) {\n const item = this.pdfViewerApi.getItem(id);\n const { behaviors } = item;\n if (item.isHidden()) {\n return;\n }\n if (item.itemType === PdfItemType.FREE_TEXT && !item.isReadOnly() && !item.isLocked()) {\n if (this.viewerCanvas) {\n this.viewerCanvas.activateModule('FreetextAnnotationModule', item.id);\n }\n }\n else if (behaviors.canHavePopup && !item.isHidden()) {\n this.openPopup(id);\n }\n }\n }\n onItemSelected(item) {\n if (item.itemCategory === PdfItemCategory.ANNOTATION) {\n this.selectAnnotation(item, true);\n }\n }\n}\n","import { ViewLayerBase } from './ViewLayerBase';\n/** internal */\nexport class BusyStateLayer extends ViewLayerBase {\n constructor() {\n super();\n }\n create() {\n this.busyStateView = this.createHtmlLayer();\n this.busyStateView.classList.add('pwv-BusyLoader');\n this.busyStateView.style.display = 'none';\n const ct = document.createElement('div');\n this.busyStateView.appendChild(ct);\n const rects = ['rect-1', 'rect-2', 'rect-3', 'rect-4', 'rect-5'];\n rects.forEach((rect) => {\n const rectElement = document.createElement('div');\n rectElement.classList.add(rect);\n ct.appendChild(rectElement);\n });\n }\n render(timestamp, state) {\n if (this.busyStateView && state.document.busyStateChanged) {\n this.busyStateView.style.display = state.document.busyState ? 'block' : 'none';\n }\n }\n}\n","import { PdfItemType, PdfActionType, } from '../../pdf-viewer-api';\nimport { ViewLayerBase } from './ViewLayerBase';\nimport { ViewerMode, CursorStyle } from '../state/viewer';\nimport { renderTextSelection } from './canvasShapes';\n/** internal */\nexport class PdfDocumentLayer extends ViewLayerBase {\n constructor() {\n super();\n }\n create() {\n this.context = this.createCanvas();\n this.canvas = this.context.canvas;\n }\n render(timestamp, state) {\n if (this.pdfViewerApi) {\n const draw = state.canvas.canvasInvalidated ||\n state.canvas.widthChanged ||\n state.canvas.heightChanged ||\n state.viewer.modeChanged ||\n state.viewer.textSelectionChanged ||\n state.pointer.stateChanged ||\n !state.search.painted;\n const defaultState = state.viewer.mode === ViewerMode.DEFAULT;\n // set cursor style and handle link click\n if (defaultState && (state.pointer.positionChanged || state.pointer.stateChanged)) {\n const pointerPos = {\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n };\n const pointerPdfPos = this.pdfViewerApi.transformScreenPointToPdfPoint(pointerPos);\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n if (pointerPdfPos.isOnPage) {\n const annotationsOnPoint = this.pdfViewerApi.getAnnotationsOnPoint(pointerPos);\n const annotationOnPoint = annotationsOnPoint\n ? annotationsOnPoint[annotationsOnPoint.length - 1]\n : null;\n if (annotationOnPoint) {\n const itemType = annotationOnPoint.itemType;\n if ((itemType === PdfItemType.HIGHLIGHT ||\n itemType === PdfItemType.SQUIGGLY ||\n itemType === PdfItemType.STRIKE_OUT) &&\n this.pdfViewerApi.getTextFragmentOnPoint(pointerPos) !== null) {\n this.store.viewer.setCursorStyle(CursorStyle.TEXT);\n }\n else if (itemType === PdfItemType.LINK) {\n const link = annotationOnPoint;\n this.store.viewer.setCursorStyle(CursorStyle.POINTER);\n if (state.pointer.action === 'click') {\n if (link.destination && link.actionType === PdfActionType.GO_TO) {\n this.pdfViewerApi.goTo(link.destination);\n }\n else if (link.uri && link.actionType === PdfActionType.URI) {\n window.open(link.uri, undefined, 'noreferrer');\n }\n }\n }\n }\n else {\n const textFragmentOnPoint = this.pdfViewerApi.getTextFragmentOnPoint(pointerPos);\n if (textFragmentOnPoint) {\n this.store.viewer.setCursorStyle(CursorStyle.TEXT);\n }\n }\n }\n }\n if (draw) {\n const ctx = this.context;\n ctx.save();\n const { pageShadow, currentPageShadow } = this.options.viewer.general;\n // draw pdf\n if (state.viewer.mode === ViewerMode.MODULE_SELECTED) {\n ctx.globalAlpha = 0.75;\n this.pdfViewerApi.renderCanvas(ctx, { pageShadow, currentPageShadow });\n ctx.globalAlpha = 1;\n ctx.fillStyle = 'rgb(255,255,255)';\n ctx.globalCompositeOperation = 'destination-over';\n for (const k in state.document.pageRects) {\n if (state.document.pageRects[k]) {\n const pageRect = state.document.pageRects[k];\n ctx.fillRect(pageRect.x, pageRect.y, pageRect.w, pageRect.h);\n }\n }\n }\n else {\n this.pdfViewerApi.renderCanvas(ctx, { pageShadow, currentPageShadow });\n }\n ctx.restore();\n if (state.search.match) {\n ctx.save();\n ctx.globalCompositeOperation = 'multiply';\n ctx.fillStyle = this.options.viewer.general.searchMatchColor;\n ctx.globalAlpha = 0.9;\n ctx.beginPath();\n state.search.match.forEach((match) => {\n if (match.pageNumber >= state.document.firstVisiblePage &&\n match.pageNumber <= state.document.lastVisiblePage) {\n const path = this.pdfViewerApi.transformQuadrilateralToViewport(match);\n for (let k = 0; k < path.length; k++) {\n const point = path[k];\n if (k === 0) {\n ctx.moveTo(point.x, point.y);\n }\n else {\n ctx.lineTo(point.x, point.y);\n }\n }\n }\n });\n ctx.closePath();\n ctx.fill();\n ctx.restore();\n }\n this.store.search.matchPainted();\n if (state.viewer.textSelection) {\n ctx.save();\n const selection = state.viewer.textSelection;\n const screenSelection = [];\n for (let i = 0; i < selection.quadrilaterals.length; i++) {\n const path = this.pdfViewerApi.transformQuadrilateralToViewport(selection.quadrilaterals[i]);\n screenSelection.push(path);\n }\n renderTextSelection(ctx, devicePixelRatio * state.document.zoom, this.options.viewer.general.textSelectionColor, screenSelection);\n ctx.restore();\n if (state.pointer.isDown &&\n state.viewer.textSelectionState === 'selecting' &&\n state.viewer.textSelectionType === 'rectangular') {\n const { textSelection } = state.viewer;\n const startPoint = this.pdfViewerApi.transformPdfPointToScreenPoint(textSelection.startPoint);\n const endPoint = this.pdfViewerApi.transformPdfPointToScreenPoint(textSelection.endPoint);\n ctx.save();\n const lineWidth = 2 * devicePixelRatio;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash([lineWidth, lineWidth]);\n ctx.strokeStyle = this.options.viewer.general.textSelectionColor;\n ctx.strokeRect(startPoint.x, startPoint.y, endPoint.x - startPoint.x, endPoint.y - startPoint.y);\n ctx.restore();\n }\n }\n }\n }\n }\n}\n","import { ViewLayerBase } from './ViewLayerBase';\nimport { DragMoveHandler } from '../../common/DragMoveHandler';\nimport { ViewerMode } from '../state/viewer';\n/** internal */\nexport class ScrollLayer extends ViewLayerBase {\n constructor() {\n super();\n this.horizontalScrollEnabled = false;\n this.horizontalScrollBarVisible = false;\n this.horizontalScrollRatio = 0;\n this.horizontalScrollBarSize = 0;\n this.horizontalScrollHandleSize = 0;\n this.horizontalScrollHandlePos = 0;\n this.horizontalScrollTimer = 0;\n this.horizontalScrollExpanded = false;\n this.verticalScrollEnabled = false;\n this.verticalScrollBarVisible = false;\n this.verticalScrollRatio = 0;\n this.verticalScrollBarSize = 0;\n this.verticalScrollHandleSize = 0;\n this.verticalScrollHandlePos = 0;\n this.verticalScrollTimer = 0;\n this.verticalScrollExpanded = false;\n this.canScrollDown = false;\n this.canScrollUp = false;\n this.canScrollRight = false;\n this.canScrollLeft = false;\n this.isTouchScrolling = false;\n this.recentTouchPos = [];\n this.touchScrollAxis = null;\n this.autoscrollLastTimestamp = 0;\n this.autoscrollDist = 0;\n this.autoscrollDistTime = 0;\n this.autoscrollDx = 0;\n this.startVerticalScroll = this.startVerticalScroll.bind(this);\n this.verticalScroll = this.verticalScroll.bind(this);\n this.endVerticalScroll = this.endVerticalScroll.bind(this);\n this.startHorizontalScroll = this.startHorizontalScroll.bind(this);\n this.horizontalScroll = this.horizontalScroll.bind(this);\n this.endHorizontalScroll = this.endHorizontalScroll.bind(this);\n this.horizontalScrollBar = document.createElement('div');\n this.horizontalScrollBar.style.display = 'none';\n this.horizontalScrollBar.classList.add('pwv-horizontal-scrollbar');\n this.horizontalScrollHandle = document.createElement('div');\n this.horizontalScrollHandle.classList.add('pwv-scrollbar-handle');\n this.horizontalScrollBar.appendChild(this.horizontalScrollHandle);\n this.verticalScrollBar = document.createElement('div');\n this.verticalScrollBar.style.display = 'none';\n this.verticalScrollBar.classList.add('pwv-vertical-scrollbar');\n this.verticalScrollHandle = document.createElement('div');\n this.verticalScrollHandle.classList.add('pwv-scrollbar-handle');\n this.verticalScrollBar.appendChild(this.verticalScrollHandle);\n new DragMoveHandler(this.verticalScrollHandle, this.startVerticalScroll, this.verticalScroll, this.endVerticalScroll);\n new DragMoveHandler(this.horizontalScrollHandle, this.startHorizontalScroll, this.horizontalScroll, this.endHorizontalScroll);\n }\n create() {\n this.htmlLayerElement = this.createHtmlLayer();\n this.htmlLayerElement.appendChild(this.horizontalScrollBar);\n this.htmlLayerElement.appendChild(this.verticalScrollBar);\n }\n render(timestamp, state) {\n const canvasHeight = state.canvas.height.cssPixels;\n const documentHeight = state.document.height.cssPixels;\n // update vertical scroll bar size & visibility\n if (state.document.heightChanged || state.canvas.heightChanged) {\n this.verticalScrollEnabled = documentHeight > canvasHeight;\n if (this.verticalScrollEnabled !== this.verticalScrollBarVisible) {\n this.verticalScrollBar.style.display = this.verticalScrollEnabled ? 'block' : 'none';\n this.verticalScrollBarVisible = this.verticalScrollEnabled;\n }\n if (this.verticalScrollEnabled) {\n this.verticalScrollBarSize = this.verticalScrollBar.clientHeight;\n this.verticalScrollHandleSize = (this.verticalScrollBarSize * canvasHeight) / documentHeight;\n if (this.verticalScrollHandleSize < 50) {\n this.verticalScrollHandleSize = 50;\n }\n this.verticalScrollHandle.style.height = this.verticalScrollHandleSize + 'px';\n this.verticalScrollRatio =\n (this.verticalScrollBarSize - this.verticalScrollHandleSize) /\n (documentHeight - canvasHeight);\n }\n this.updateCanScrollVertical(state);\n }\n // update vertical scroll handle position\n if (state.scroll.topPositionChanged) {\n this.verticalScrollHandlePos = state.scroll.top.cssPixels * this.verticalScrollRatio;\n this.verticalScrollHandle.style.top = this.verticalScrollHandlePos + 'px';\n if (this.verticalScrollTimer) {\n clearTimeout(this.verticalScrollTimer);\n }\n else {\n this.verticalScrollBar.classList.add('pwv-scrollbar-scrolling');\n }\n this.verticalScrollTimer = window.setTimeout(() => {\n this.verticalScrollTimer = 0;\n this.verticalScrollBar.classList.remove('pwv-scrollbar-scrolling');\n }, 500);\n this.updateCanScrollVertical(state);\n }\n const canvasWidth = state.canvas.width.cssPixels;\n const documentWidth = state.document.width.cssPixels;\n // update horizontal scroll bar size & visibility\n if (state.document.widthChanged || state.canvas.widthChanged) {\n this.horizontalScrollEnabled = documentWidth > canvasWidth;\n if (this.horizontalScrollEnabled !== this.horizontalScrollBarVisible) {\n this.horizontalScrollBar.style.display = this.horizontalScrollEnabled ? 'block' : 'none';\n this.horizontalScrollBarVisible = this.horizontalScrollEnabled;\n }\n if (this.horizontalScrollEnabled) {\n this.horizontalScrollBarSize = this.horizontalScrollBar.clientWidth;\n this.horizontalScrollHandleSize =\n (this.horizontalScrollBarSize * canvasWidth) / documentWidth;\n if (this.horizontalScrollHandleSize < 50) {\n this.horizontalScrollHandleSize = 50;\n }\n this.horizontalScrollHandle.style.width = this.horizontalScrollHandleSize + 'px';\n this.horizontalScrollRatio =\n (this.horizontalScrollBarSize - this.horizontalScrollHandleSize) /\n (documentWidth - canvasWidth);\n }\n this.updateCanScrollHorizontal(state);\n }\n // update horizontal scroll handle position\n if (state.scroll.leftPositionChanged) {\n this.horizontalScrollHandlePos = state.scroll.left.cssPixels * this.horizontalScrollRatio;\n this.horizontalScrollHandle.style.left = this.horizontalScrollHandlePos + 'px';\n if (this.horizontalScrollTimer) {\n clearTimeout(this.horizontalScrollTimer);\n }\n else {\n this.horizontalScrollBar.classList.add('pwv-scrollbar-scrolling');\n }\n this.horizontalScrollTimer = window.setTimeout(() => {\n this.horizontalScrollTimer = 0;\n this.horizontalScrollBar.classList.remove('pwv-scrollbar-scrolling');\n }, 500);\n this.updateCanScrollHorizontal(state);\n }\n if (state.pointer.positionChanged) {\n const pointerX = state.pointer.x.cssPixels;\n const pointerY = state.pointer.y.cssPixels;\n const xPos = canvasWidth - 40;\n const yPos = canvasHeight - 40;\n if (!this.verticalScrollExpanded && pointerX > xPos && pointerY < yPos) {\n this.verticalScrollBar.classList.add('pwv-scrollbar-hover');\n this.verticalScrollExpanded = true;\n }\n else if (this.verticalScrollExpanded && (pointerX < xPos || pointerY > yPos)) {\n this.verticalScrollBar.classList.remove('pwv-scrollbar-hover');\n this.verticalScrollExpanded = false;\n }\n if (!this.horizontalScrollExpanded && pointerY > yPos && pointerX < xPos) {\n this.horizontalScrollBar.classList.add('pwv-scrollbar-hover');\n this.horizontalScrollExpanded = true;\n }\n else if (this.horizontalScrollExpanded && (pointerY < yPos || pointerX > xPos)) {\n this.horizontalScrollBar.classList.remove('pwv-scrollbar-hover');\n this.horizontalScrollExpanded = false;\n }\n }\n // touchscroll\n const pointer = state.pointer;\n const touchScrollEnabled = pointer.type === 'touch' &&\n (state.viewer.mode === ViewerMode.DEFAULT ||\n state.viewer.mode === ViewerMode.ANNOTATION_SELECTED);\n if (touchScrollEnabled && this.viewerCanvas) {\n if (state.pointer.isDown) {\n if (!this.isTouchScrolling) {\n this.isTouchScrolling = true;\n this.autoscrollDx = 0;\n this.touchScrollAxis = null;\n this.recentTouchPos = [];\n this.recentTouchPos.unshift({\n x: pointer.x.cssPixels,\n y: pointer.y.cssPixels,\n time: timestamp,\n });\n }\n else if (pointer.positionChanged) {\n this.recentTouchPos.unshift({\n x: pointer.x.cssPixels,\n y: pointer.y.cssPixels,\n time: timestamp,\n });\n if (this.recentTouchPos.length > 3) {\n this.recentTouchPos.pop();\n }\n const diffX = this.recentTouchPos[1].x - this.recentTouchPos[0].x;\n const diffY = this.recentTouchPos[1].y - this.recentTouchPos[0].y;\n const diffXabs = Math.abs(diffX);\n const diffYabs = Math.abs(diffY);\n const scrollAxis = this.touchScrollAxis !== null\n ? this.touchScrollAxis\n : diffYabs > diffXabs\n ? 'y'\n : diffXabs > diffYabs\n ? 'x'\n : null;\n if (this.verticalScrollEnabled && scrollAxis === 'y') {\n if ((diffY > 0 && this.canScrollDown) || (diffY < 0 && this.canScrollUp)) {\n this.viewerCanvas.scrollDown(diffY);\n }\n }\n else if (this.horizontalScrollEnabled && this.touchScrollAxis === 'x') {\n if ((diffX > 0 && this.canScrollRight) || (diffX < 0 && this.canScrollLeft)) {\n this.viewerCanvas.scrollRight(diffX);\n }\n }\n // lock scroll axis\n if (this.touchScrollAxis === null && this.recentTouchPos.length >= 3) {\n this.touchScrollAxis = diffYabs > diffXabs ? 'y' : diffXabs > diffYabs ? 'x' : null;\n }\n }\n }\n else if (this.isTouchScrolling) {\n this.isTouchScrolling = false;\n if (this.touchScrollAxis === 'x') {\n this.autoscrollDist = this.recentTouchPos[2].x - this.recentTouchPos[0].x;\n this.autoscrollDistTime = this.recentTouchPos[0].time - this.recentTouchPos[2].time;\n this.autoscrollDx = Math.abs(this.autoscrollDist / this.autoscrollDistTime);\n this.autoscrollLastTimestamp = timestamp;\n }\n else if (this.touchScrollAxis === 'y') {\n this.autoscrollDist = this.recentTouchPos[2].y - this.recentTouchPos[0].y;\n this.autoscrollDistTime = this.recentTouchPos[0].time - this.recentTouchPos[2].time;\n this.autoscrollDx = Math.abs(this.autoscrollDist / this.autoscrollDistTime);\n this.autoscrollLastTimestamp = timestamp;\n }\n }\n }\n // auto scroll\n if (this.viewerCanvas && this.autoscrollDx !== 0) {\n const time = timestamp - this.autoscrollLastTimestamp;\n if (time > 1000 / 70) {\n if (this.autoscrollDx > 3) {\n this.autoscrollDx = 3;\n }\n if (this.touchScrollAxis === 'y' &&\n ((this.autoscrollDist > 0 && !this.canScrollDown) ||\n (this.autoscrollDist < 0 && !this.canScrollUp))) {\n this.autoscrollDx = 0;\n }\n else if (this.touchScrollAxis === 'x' &&\n ((this.autoscrollDist > 0 && !this.canScrollRight) ||\n (this.autoscrollDist < 0 && !this.canScrollLeft))) {\n this.autoscrollDx = 0;\n }\n else {\n const direction = Math.sign(this.autoscrollDist);\n const distance = Math.abs(this.autoscrollDist);\n const timeFactor = time / this.autoscrollDistTime;\n const diff = Math.min(100, distance * this.autoscrollDx) * timeFactor;\n const scrollDiff = diff * direction;\n if (Math.abs(scrollDiff) < 1) {\n this.autoscrollDx = 0;\n }\n else {\n if (this.touchScrollAxis === 'y') {\n this.viewerCanvas.scrollDown(scrollDiff);\n }\n else {\n this.viewerCanvas.scrollRight(scrollDiff);\n }\n }\n const throttleDiff = this.autoscrollDx * 0.08 * timeFactor;\n this.autoscrollDx = this.autoscrollDx - throttleDiff;\n this.autoscrollLastTimestamp = timestamp;\n }\n }\n }\n }\n updateCanScrollVertical(state) {\n this.canScrollUp = state.scroll.top.cssPixels > 0;\n this.canScrollDown =\n state.scroll.top.cssPixels + state.canvas.height.cssPixels <\n state.document.height.cssPixels - 1;\n }\n updateCanScrollHorizontal(state) {\n this.canScrollLeft = state.scroll.left.cssPixels > 0;\n this.canScrollRight =\n state.scroll.left.cssPixels + state.canvas.width.cssPixels <\n state.document.width.cssPixels - 1;\n }\n startVerticalScroll(e) {\n this.verticalScrollBar.classList.add('pwv-scrollbar-dragging');\n }\n verticalScroll(e) {\n if (this.viewerCanvas) {\n const scrollDiv = e.movementY / this.verticalScrollRatio;\n this.viewerCanvas.scrollDown(scrollDiv);\n }\n }\n endVerticalScroll(e) {\n this.verticalScrollBar.classList.remove('pwv-scrollbar-dragging');\n }\n startHorizontalScroll(e) {\n this.horizontalScrollBar.classList.add('pwv-scrollbar-dragging');\n }\n horizontalScroll(e) {\n if (this.viewerCanvas) {\n const scrollDiv = e.movementX / this.horizontalScrollRatio;\n this.viewerCanvas.scrollRight(scrollDiv);\n }\n }\n endHorizontalScroll(e) {\n this.horizontalScrollBar.classList.remove('pwv-scrollbar-dragging');\n }\n}\n","import { ViewLayerBase } from './ViewLayerBase';\nimport { PdfItemType, } from '../../pdf-viewer-api';\nimport { createTextSelectionContextBar } from './views/TextSelectionContextBar';\nimport { Color } from '../../common/Color';\nimport { ViewerMode, CursorStyle, copyTextToClipboard } from '../state/viewer';\nimport { addHistoryEntry } from '../../custom/history';\n/** internal */\nexport class TextSelectionLayer extends ViewLayerBase {\n constructor() {\n super();\n this.startPoint = null;\n this.selecting = false;\n this.contextBarElement = null;\n this.selectionType = null;\n this.createAnnotation = this.createAnnotation.bind(this);\n this.copyTextSelection = this.copyTextSelection.bind(this);\n }\n create() { }\n render(timestamp, state) {\n var _a;\n if (state.viewer.mode !== ViewerMode.TEXT_SELECTED) {\n if (this.contextBarElement) {\n this.removeHtmlElements();\n this.contextBarElement = null;\n }\n }\n if (state.viewer.mode === ViewerMode.MODULE_SELECTED) {\n return;\n }\n let updateContextBarPos = true;\n if (state.pointer.action === 'click') {\n this.endSelection();\n // dbl click word selection\n }\n else if (state.pointer.action === 'dblclick') {\n const clickPos = this.pdfViewerApi.transformScreenPointToPdfPoint({\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n });\n const wordSelection = this.pdfViewerApi.getWordOnPoint(clickPos.pdfPoint);\n this.store.viewer.setTextSelection({ selection: wordSelection, type: 'normal' });\n this.selectionCreated();\n }\n // start new selection\n else if (state.viewer.mode === ViewerMode.DEFAULT &&\n !this.selecting &&\n ((state.pointer.type === 'mouse' && state.pointer.action === 'startdrag') ||\n state.pointer.action === 'longpress')) {\n const screenPos = {\n x: state.startPointer.x.devicePixels,\n y: state.startPointer.y.devicePixels,\n };\n const startPos = this.pdfViewerApi.transformScreenPointToPdfPoint(screenPos);\n const textOnPoint = this.pdfViewerApi.getTextFragmentOnPoint(screenPos);\n if (this.options.viewer.general.rectangularTextSelection === 'automatic') {\n this.selectionType = textOnPoint ? 'normal' : 'rectangular';\n this.startSelection(startPos.pdfPoint);\n }\n else {\n if (textOnPoint) {\n this.startSelection(startPos.pdfPoint);\n }\n }\n }\n else if (this.selecting) {\n if (state.pointer.isDown) {\n if (state.pointer.positionChanged) {\n const mousePos = this.pdfViewerApi.getClosestPointOnPdfByScreenPoint({\n x: state.pointer.x.devicePixels,\n y: state.pointer.y.devicePixels,\n });\n if (this.startPoint) {\n const textSelection = this.selectionType === 'rectangular'\n ? this.pdfViewerApi.getRectangularTextSelection(this.startPoint, mousePos)\n : this.pdfViewerApi.getTextSelection(this.startPoint, mousePos);\n this.store.viewer.setTextSelection({\n selection: textSelection,\n type: this.selectionType,\n });\n this.store.viewer.setTextSelectionState('selecting');\n }\n }\n }\n else {\n if ((_a = state.viewer.textSelection) === null || _a === void 0 ? void 0 : _a.quadrilaterals.length) {\n this.selectionCreated();\n }\n else {\n this.endSelection();\n }\n }\n }\n // auto scroll\n if (this.selecting && state.pointer.y.devicePixels > -1) {\n const padding = 30;\n const dxScroll = 20;\n if (state.pointer.y.devicePixels > state.canvas.height.devicePixels - padding) {\n this.pdfViewerApi.setScrollPosition({\n x: state.scroll.left.devicePixels,\n y: state.scroll.top.devicePixels + dxScroll,\n });\n }\n else if (state.pointer.y.devicePixels < padding) {\n this.pdfViewerApi.setScrollPosition({\n x: state.scroll.left.devicePixels,\n y: state.scroll.top.devicePixels - dxScroll,\n });\n }\n else if (state.pointer.x.devicePixels > state.canvas.width.devicePixels - padding) {\n this.pdfViewerApi.setScrollPosition({\n x: state.scroll.left.devicePixels + dxScroll,\n y: state.scroll.top.devicePixels,\n });\n }\n else if (state.pointer.x.devicePixels < padding) {\n this.pdfViewerApi.setScrollPosition({\n x: state.scroll.left.devicePixels - dxScroll,\n y: state.scroll.top.devicePixels,\n });\n }\n }\n // update contextbar position\n if (updateContextBarPos && this.contextBarElement && state.viewer.textSelectionRects) {\n const padding = 25;\n let barTopPos = padding;\n let barLeftPos = 0;\n let isTopPos = false;\n let isBottomPos = false;\n let screenRect = null;\n const { firstVisiblePage, lastVisiblePage } = state.document;\n Object.keys(state.viewer.textSelectionRects).forEach((page) => {\n const pageNumber = parseInt(page);\n if (pageNumber >= firstVisiblePage && pageNumber <= lastVisiblePage) {\n if (state.viewer.textSelectionRects) {\n const pageScreenRect = this.pdfViewerApi.transformPdfPageRectToScreenRect(state.viewer.textSelectionRects[page]);\n if (pageScreenRect) {\n screenRect = {\n x1: pageScreenRect.x / devicePixelRatio,\n y1: pageScreenRect.y / devicePixelRatio,\n x2: pageScreenRect.x / devicePixelRatio + pageScreenRect.w / devicePixelRatio,\n y2: pageScreenRect.y / devicePixelRatio + pageScreenRect.h / devicePixelRatio,\n };\n }\n }\n }\n });\n if (screenRect) {\n const { x1, y1, x2, y2 } = screenRect;\n if (y1 > 90) {\n barTopPos = y1 - 65;\n isTopPos = true;\n }\n else if (state.canvas.height.cssPixels / 2 > y2) {\n barTopPos = y2 + 15;\n isBottomPos = true;\n }\n const barWidth = this.contextBarElement.clientWidth;\n barLeftPos = x1 + (x2 - x1 - barWidth) / 2;\n if (barLeftPos < 0) {\n barLeftPos = 0;\n }\n }\n else {\n barTopPos = -90;\n }\n this.contextBarElement.style.top = barTopPos + 'px';\n this.contextBarElement.style.left = barLeftPos + 'px';\n if (isTopPos) {\n this.contextBarElement.classList.add('pwv-contextbar-top');\n }\n else {\n this.contextBarElement.classList.remove('pwv-contextbar-top');\n }\n if (isBottomPos) {\n this.contextBarElement.classList.add('pwv-contextbar-bottom');\n }\n else {\n this.contextBarElement.classList.remove('pwv-contextbar-bottom');\n }\n }\n }\n clearSelection() {\n this.endSelection();\n }\n clearHtmlDocumentSelection() {\n const documentSelection = document.getSelection();\n if (documentSelection) {\n documentSelection.empty();\n }\n }\n startSelection(startPoint) {\n this.clearHtmlDocumentSelection();\n this.removeHtmlElements();\n this.contextBarElement = null;\n this.selecting = true;\n if (this.startPoint === null) {\n this.startPoint = startPoint;\n }\n this.store.viewer.setCursorStyle(CursorStyle.TEXT);\n }\n endSelection() {\n this.removeHtmlElements();\n this.contextBarElement = null;\n this.selecting = false;\n this.startPoint = null;\n this.clearHtmlDocumentSelection();\n window.setTimeout(() => {\n this.selectionType = null;\n this.store.viewer.setTextSelection({ selection: null, type: null });\n this.store.viewer.setTextSelectionState(null);\n }, 50);\n }\n selectionCreated() {\n var _a;\n this.selecting = false;\n if (this.contextBarElement) {\n this.removeHtmlElements();\n }\n this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);\n this.store.viewer.setTextSelectionState('textSelected');\n const isViewOnly = !((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate);\n const allowCopyText = this.options.viewer.permissions.allowCopyText;\n if (isViewOnly && !allowCopyText) {\n return;\n }\n this.contextBarElement = this.createHtmlLayer();\n this.contextBarElement.classList.add('pwv-textselection-contextbar');\n this.contextBarElement.classList.add('pwv-contextbar-top');\n createTextSelectionContextBar({\n highlightColors: this.options.annotation.colors.highlightColors,\n onCreateAnnotation: this.createAnnotation,\n onCopyText: this.copyTextSelection,\n isViewOnly,\n allowCopyText,\n }, this.contextBarElement);\n this.viewerCanvas.onTextSelected();\n }\n createAnnotation(itemType, color) {\n if (this.pdfViewerApi && this.store) {\n const selection = this.store.getState().viewer.textSelection;\n if (selection) {\n const selectionByPage = [];\n for (let i = 0; i < selection.quadrilaterals.length; i++) {\n const quadrilateral = selection.quadrilaterals[i];\n if (!selectionByPage[quadrilateral.pageNumber]) {\n selectionByPage[quadrilateral.pageNumber] = [];\n }\n selectionByPage[quadrilateral.pageNumber].push(quadrilateral);\n }\n if (itemType === PdfItemType.HIGHLIGHT) {\n const colorObj = new Color(color);\n colorObj.setOpacity(this.options.annotation.highlightOpacity);\n color = colorObj.toRgba();\n }\n for (let i = 0; i < selectionByPage.length; i++) {\n if (selectionByPage[i]) {\n const quadrilaterals = selectionByPage[i];\n const args = {\n itemType,\n page: i,\n pdfRect: {\n pdfX: 0,\n pdfY: 0,\n pdfW: 0,\n pdfH: 0,\n page: i,\n },\n color,\n author: this.options.viewer.general.user,\n quadrilaterals,\n };\n this.pdfViewerApi.createItem(args).then((annotation) => {\n if (this.options.annotation.trackHistory) {\n addHistoryEntry(annotation, 'create', this.options.viewer.general.user);\n this.pdfViewerApi.updateItem(annotation);\n }\n });\n this.endSelection();\n }\n }\n }\n }\n }\n copyTextSelection() {\n var _a;\n const selectedText = (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.getSelectedText();\n copyTextToClipboard(selectedText || '');\n }\n}\n","import { addHistoryEntry } from '../../custom/history';\nexport class ViewLayerBase {\n constructor() {\n this.canvasContexts = [];\n this.htmlLayers = [];\n }\n get pdfViewerApi() {\n if (!this.pPdfViewerApi) {\n this.pPdfViewerApi = this.viewerCanvas.pdfViewerApi;\n if (!this.pPdfViewerApi) {\n throw new Error('pdfViewerApi in undefined');\n }\n }\n return this.pPdfViewerApi;\n }\n get store() {\n if (!this.pStore) {\n this.pStore = this.viewerCanvas.store;\n if (!this.pStore) {\n throw new Error('pStore in undefined');\n }\n }\n return this.pStore;\n }\n get options() {\n if (!this.pOptions) {\n this.pOptions = this.viewerCanvas.options;\n if (!this.pOptions) {\n throw new Error('options in undefined');\n }\n }\n return this.pOptions;\n }\n resize(width, height, pixelRatio) {\n try {\n const tempCanvas = document.createElement('canvas');\n tempCanvas.width = width * pixelRatio;\n tempCanvas.height = height * pixelRatio;\n const tempContext = tempCanvas.getContext('2d');\n this.canvasContexts.forEach((ctx) => {\n tempContext.drawImage(ctx.canvas, 0, 0);\n ctx.canvas.style.width = width + 'px';\n ctx.canvas.style.height = height + 'px';\n ctx.canvas.width = width * pixelRatio;\n ctx.canvas.height = height * pixelRatio;\n ctx.drawImage(tempContext.canvas, 0, 0);\n });\n }\n catch (err) {\n console.warn(err);\n }\n }\n register(viewerCanvas, dispatchEvent) {\n this.viewerCanvas = viewerCanvas;\n this.dispatchEvent = dispatchEvent;\n this.containerElement = this.viewerCanvas.viewLayersElement;\n this.create();\n }\n createHtmlLayer() {\n const element = document.createElement('div');\n this.htmlLayers.push(element);\n if (this.containerElement) {\n this.containerElement.appendChild(element);\n }\n return element;\n }\n createCanvas(className) {\n const element = document.createElement('canvas');\n element.style.position = 'absolute';\n element.style.top = '0';\n element.style.left = '0';\n element.style.right = '0';\n element.style.bottom = '0';\n if (className) {\n element.classList.add(className);\n }\n const context = element.getContext('2d');\n this.canvasContexts.push(context);\n if (this.containerElement) {\n this.containerElement.appendChild(element);\n const rect = this.containerElement.getBoundingClientRect();\n context.canvas.width = rect.width * devicePixelRatio;\n context.canvas.height = rect.height * devicePixelRatio;\n }\n return context;\n }\n removeHtmlElements() {\n if (this.containerElement) {\n for (let i = 0; i < this.htmlLayers.length; i++) {\n this.containerElement.removeChild(this.htmlLayers[i]);\n }\n this.htmlLayers = [];\n }\n }\n removeCanvasElements() {\n if (this.containerElement) {\n for (let i = 0; i < this.canvasContexts.length; i++) {\n this.containerElement.removeChild(this.canvasContexts[i].canvas);\n }\n this.canvasContexts = [];\n }\n }\n addDeleteHistory(annotation) {\n addHistoryEntry(annotation, 'delete', this.options.viewer.general.user);\n }\n}\n","/** internal */\n/* tslint:disable-next-line */\nexport const renderAnnotationSelection = (ctx, scale, color, rect, resizable) => {\n const handle = 10 * scale;\n const handleOffset = handle / 2;\n const padding = 4 * scale;\n const x = rect.x - padding;\n const y = rect.y - padding;\n const w = rect.w + 2 * padding;\n const h = rect.h + 2 * padding;\n ctx.lineWidth = 2 * scale;\n ctx.strokeStyle = color;\n ctx.fillStyle = color;\n if (resizable) {\n const x1 = x - handleOffset;\n const x2 = x1 + w;\n const y1 = y - handleOffset;\n const y2 = y1 + h;\n ctx.fillRect(x1, y1, handle, handle);\n ctx.fillRect(x1, y2, handle, handle);\n ctx.fillRect(x2, y1, handle, handle);\n ctx.fillRect(x2, y2, handle, handle);\n }\n ctx.strokeRect(x, y, w, h);\n};\n/** internal */\nexport const renderTextMarker = (ctx, scale, type, color, rect) => {\n ctx.save();\n const startType = type === 'start';\n const lineWidth = 2 * scale;\n const p = 3 * scale;\n const x = startType ? rect.x - lineWidth / 2 : rect.x + rect.w + lineWidth / 2;\n const y1 = startType ? rect.y - p : rect.y + rect.h + p;\n const y2 = startType ? rect.y + rect.h : rect.y;\n ctx.strokeStyle = color;\n ctx.fillStyle = color;\n ctx.lineWidth = lineWidth;\n ctx.globalAlpha = 0.8;\n ctx.beginPath();\n ctx.moveTo(x, y1);\n ctx.lineTo(x, y2);\n ctx.closePath();\n ctx.stroke();\n ctx.restore();\n};\n/** internal */\nexport const renderTextSelection = (ctx, scale, color, selection) => {\n ctx.save();\n ctx.globalCompositeOperation = 'multiply';\n ctx.globalAlpha = 0.3;\n ctx.fillStyle = color;\n if (selection.length) {\n ctx.beginPath();\n for (let i = 0; i < selection.length; i++) {\n const path = selection[i];\n for (let k = 0; k < path.length; k++) {\n const point = path[k];\n if (k === 0) {\n ctx.moveTo(point.x, point.y);\n }\n else {\n ctx.lineTo(point.x, point.y);\n }\n }\n }\n ctx.closePath();\n ctx.fill();\n }\n ctx.restore();\n};\n/** internal */\nexport const renderPopupMarker = (ctx, scale, color, pos) => {\n const posX = pos.x;\n const posY = pos.y;\n ctx.beginPath();\n ctx.moveTo(posX - 5 * scale, posY - 5 * scale);\n ctx.lineTo(posX + 6 * scale, posY - 5 * scale);\n ctx.lineTo(posX + 6 * scale, posY + 3 * scale);\n ctx.lineTo(posX + 3 * scale, posY + 3 * scale);\n ctx.lineTo(posX, posY + 6 * scale);\n ctx.lineTo(posX - 3 * scale, posY + 3 * scale);\n ctx.lineTo(posX - 5 * scale, posY + 3 * scale);\n ctx.closePath();\n ctx.stroke();\n ctx.globalAlpha = 0.5;\n ctx.fillStyle = color;\n ctx.fill();\n ctx.globalAlpha = 1;\n};\n/** internal */\nexport const renderStickyNote = (ctx, scale, rect, fillColor, strokeColor) => {\n const w = rect.w;\n const h1 = rect.h * 0.8;\n const h2 = rect.h;\n const r = rect.w / 6;\n const s = rect.w / 10;\n const x1 = rect.x;\n const y1 = rect.y;\n const x1r = x1 + r;\n const y1r = y1 + r;\n const x2 = x1 + w;\n const y2 = y1 + h1;\n const x2r = x2 - r;\n const y2r = y2 - r;\n const xs1 = x1r + r;\n const xs2 = xs1 + r;\n const xs3 = x1r + s;\n const ys3 = y1 + h2;\n ctx.beginPath();\n ctx.moveTo(x1r, y1);\n ctx.lineTo(x2r, y1);\n ctx.arcTo(x2, y1, x2, y1r, r);\n ctx.lineTo(x2, y2r);\n ctx.arcTo(x2, y2, x2r, y2, r);\n ctx.lineTo(xs2, y2);\n ctx.lineTo(xs3, ys3);\n ctx.lineTo(xs1, y2);\n ctx.lineTo(x1r, y2);\n ctx.arcTo(x1, y2, x1, y2r, r);\n ctx.lineTo(x1, y1r);\n ctx.arcTo(x1, y1, x1r, y1, r);\n ctx.closePath();\n ctx.lineWidth = 0.75 * scale;\n ctx.fillStyle = fillColor;\n ctx.strokeStyle = strokeColor;\n ctx.fill();\n ctx.stroke();\n const x1l = x1r + 1 * scale;\n const x2l = x2r - 1 * scale;\n const x3l = x2r - r;\n const y1l = y1r + 1 * scale;\n const y3l = y2r - 1 * scale;\n const y2l = y1l + (y3l - y1l) / 2;\n ctx.beginPath();\n ctx.moveTo(x1l, y1l);\n ctx.lineTo(x2l, y1l);\n ctx.closePath();\n ctx.stroke();\n ctx.beginPath();\n ctx.moveTo(x1l, y2l);\n ctx.lineTo(x2l, y2l);\n ctx.closePath();\n ctx.stroke();\n ctx.beginPath();\n ctx.moveTo(x1l, y3l);\n ctx.lineTo(x3l, y3l);\n ctx.closePath();\n ctx.stroke();\n};\n","import { DragMoveHandler } from '../../../common/DragMoveHandler';\nvar ResizeDir;\n(function (ResizeDir) {\n ResizeDir[ResizeDir[\"NW\"] = 1] = \"NW\";\n ResizeDir[ResizeDir[\"NE\"] = 2] = \"NE\";\n ResizeDir[ResizeDir[\"SW\"] = 3] = \"SW\";\n ResizeDir[ResizeDir[\"SE\"] = 4] = \"SE\";\n})(ResizeDir || (ResizeDir = {}));\n/** internal */\nexport const MIN_SIZE = 10;\n/** internal */\nexport class AnnotationBorder {\n constructor(element, onMoved, onResized, onDblClick, options, store, isViewOnly) {\n this.annotationId = null;\n this.movable = false;\n this.resizable = false;\n this.aspectRatio = null;\n this.pageRect = null;\n this.dragOffsetX = 0;\n this.dragOffsetY = 0;\n this.containerOffsetX = 0;\n this.containerOffsetY = 0;\n this.resizeDir = null;\n this.minSize = MIN_SIZE;\n this.startMove = this.startMove.bind(this);\n this.moving = this.moving.bind(this);\n this.endMove = this.endMove.bind(this);\n this.click = this.click.bind(this);\n this.dblClick = this.dblClick.bind(this);\n this.setAnnotation = this.setAnnotation.bind(this);\n this.deselectAnnotation = this.deselectAnnotation.bind(this);\n this.startResize = this.startResize.bind(this);\n this.resizing = this.resizing.bind(this);\n this.resizeNoAspectRatio = this.resizeNoAspectRatio.bind(this);\n this.resizeWithAspectRatio = this.resizeWithAspectRatio.bind(this);\n this.endResize = this.endResize.bind(this);\n this.dragElement = document.createElement('div');\n this.border = document.createElement('div');\n this.resizeElementNw = document.createElement('div');\n this.resizeElementNe = document.createElement('div');\n this.resizeElementSw = document.createElement('div');\n this.resizeElementSe = document.createElement('div');\n this.isViewOnly = isViewOnly;\n this.onMoved = onMoved;\n this.onResized = onResized;\n this.onDblClick = onDblClick;\n this.element = element;\n this.options = options;\n this.store = store;\n this.element.appendChild(this.dragElement);\n this.dragElement.classList.add('pwv-annotation-border-draghandle');\n this.dragElement.style.display = 'none';\n this.dragHandler = new DragMoveHandler(this.dragElement, this.startMove, this.moving, this.endMove, this.click, this.dblClick);\n this.dragHandler.suspend();\n this.element.appendChild(this.border);\n this.border.classList.add('pwv-annotation-border');\n this.element.appendChild(this.resizeElementNw);\n this.resizeElementNw.classList.add('pwv-annotation-border-resizehandle-nw');\n this.resizeElementNw.style.display = 'none';\n this.resizeHandlerNw = new DragMoveHandler(this.resizeElementNw, this.startResize, this.resizing, this.endResize);\n this.resizeHandlerNw.suspend();\n this.element.appendChild(this.resizeElementNe);\n this.resizeElementNe.classList.add('pwv-annotation-border-resizehandle-ne');\n this.resizeElementNe.style.display = 'none';\n this.resizeHandlerNe = new DragMoveHandler(this.resizeElementNe, this.startResize, this.resizing, this.endResize);\n this.resizeHandlerNe.suspend();\n this.element.appendChild(this.resizeElementSw);\n this.resizeElementSw.classList.add('pwv-annotation-border-resizehandle-sw');\n this.resizeElementSw.style.display = 'none';\n this.resizeHandlerSw = new DragMoveHandler(this.resizeElementSw, this.startResize, this.resizing, this.endResize);\n this.resizeHandlerSw.suspend();\n this.element.appendChild(this.resizeElementSe);\n this.resizeElementSe.classList.add('pwv-annotation-border-resizehandle-se');\n this.resizeElementSe.style.display = 'none';\n this.resizeHandlerSe = new DragMoveHandler(this.resizeElementSe, this.startResize, this.resizing, this.endResize);\n this.resizeHandlerSe.suspend();\n }\n setAnnotation(annotation, pageRect) {\n const { behaviors } = annotation;\n const isReadOnly = annotation.isReadOnly();\n const isLocked = annotation.isLocked() && !this.options.viewer.permissions.allowEditLockedAnnotations;\n this.annotationId = annotation.id;\n this.movable = behaviors.movable && !isLocked && !isReadOnly;\n this.resizable = behaviors.resizable && !isLocked && !isReadOnly;\n this.aspectRatio = behaviors.aspectRatioChangeable\n ? null\n : annotation.pdfRect.pdfW / annotation.pdfRect.pdfH;\n this.pageRect = pageRect;\n if (this.movable) {\n this.dragElement.style.display = 'block';\n }\n if (this.resizable) {\n this.resizeElementNw.style.display = 'block';\n this.resizeElementNe.style.display = 'block';\n this.resizeElementSw.style.display = 'block';\n this.resizeElementSe.style.display = 'block';\n }\n window.setTimeout(() => {\n if (this.movable) {\n this.dragHandler.resume();\n }\n if (this.resizable) {\n this.resizeHandlerNw.resume();\n this.resizeHandlerNe.resume();\n this.resizeHandlerSw.resume();\n this.resizeHandlerSe.resume();\n }\n }, 100);\n }\n deselectAnnotation() {\n this.annotationId = null;\n this.movable = false;\n this.resizable = false;\n this.aspectRatio = 0;\n this.pageRect = null;\n this.dragHandler.suspend();\n this.resizeHandlerNw.suspend();\n this.resizeHandlerNe.suspend();\n this.resizeHandlerSw.suspend();\n this.resizeHandlerSe.suspend();\n this.dragElement.style.display = 'none';\n this.resizeElementNw.style.display = 'none';\n this.resizeElementNe.style.display = 'none';\n this.resizeElementSw.style.display = 'none';\n this.resizeElementSe.style.display = 'none';\n }\n updatePageRect(pageRect) {\n this.pageRect = pageRect;\n }\n click() { }\n dblClick() {\n if (this.annotationId) {\n this.onDblClick(this.annotationId);\n }\n }\n startResize(e) {\n if (e.element.classList.contains('pwv-annotation-border-resizehandle-nw')) {\n this.resizeDir = ResizeDir.NW;\n }\n else if (e.element.classList.contains('pwv-annotation-border-resizehandle-ne')) {\n this.resizeDir = ResizeDir.NE;\n }\n else if (e.element.classList.contains('pwv-annotation-border-resizehandle-sw')) {\n this.resizeDir = ResizeDir.SW;\n }\n else if (e.element.classList.contains('pwv-annotation-border-resizehandle-se')) {\n this.resizeDir = ResizeDir.SE;\n }\n this.element.classList.add('pwv-annotation-resizing');\n }\n resizing(e) {\n if (this.aspectRatio !== null) {\n this.resizeWithAspectRatio(e.clientX, e.clientY);\n }\n else {\n this.resizeNoAspectRatio(e.clientX, e.clientY);\n }\n }\n updateMinSize() {\n const { document } = this.store.getState();\n this.minSize = MIN_SIZE;\n }\n resizeNoAspectRatio(clientX, clientY) {\n if (this.element && this.element.offsetParent && this.pageRect) {\n this.updateMinSize();\n const offsetRect = this.element.offsetParent.getBoundingClientRect();\n const elementRect = this.element.getBoundingClientRect();\n const minLeft = this.pageRect.x / window.devicePixelRatio;\n const maxLeft = minLeft + this.pageRect.w / window.devicePixelRatio;\n const minTop = this.pageRect.y / window.devicePixelRatio;\n const maxTop = minTop + this.pageRect.h / window.devicePixelRatio;\n let pointerX = clientX - offsetRect.left;\n if (pointerX < minLeft) {\n pointerX = minLeft;\n }\n else if (pointerX > maxLeft) {\n pointerX = maxLeft;\n }\n let pointerY = clientY - offsetRect.top;\n if (pointerY < minTop) {\n pointerY = minTop;\n }\n else if (pointerY > maxTop) {\n pointerY = maxTop;\n }\n let topPos = elementRect.top - offsetRect.top;\n let leftPos = elementRect.left - offsetRect.left;\n let width = elementRect.width;\n let height = elementRect.height;\n // width ne se\n if (this.resizeDir === ResizeDir.NE || this.resizeDir === ResizeDir.SE) {\n width = pointerX - leftPos;\n if (width < this.minSize) {\n width = this.minSize;\n }\n }\n // width nw sw\n if (this.resizeDir === ResizeDir.NW || this.resizeDir === ResizeDir.SW) {\n width = leftPos + width - pointerX;\n if (width < this.minSize) {\n width = this.minSize;\n leftPos = elementRect.left - offsetRect.left + elementRect.width - width;\n }\n else {\n leftPos = pointerX;\n }\n }\n // height se sw\n if (this.resizeDir === ResizeDir.SE || this.resizeDir === ResizeDir.SW) {\n height = pointerY - topPos;\n if (height < this.minSize) {\n height = this.minSize;\n }\n }\n // height ne nw\n if (this.resizeDir === ResizeDir.NE || this.resizeDir === ResizeDir.NW) {\n height = topPos + height - pointerY;\n if (height < this.minSize) {\n height = this.minSize;\n topPos = elementRect.top - offsetRect.top + elementRect.height - height;\n }\n else {\n topPos = pointerY;\n }\n }\n this.element.style.top = topPos + 'px';\n this.element.style.left = leftPos + 'px';\n this.element.style.width = width + 'px';\n this.element.style.height = height + 'px';\n }\n }\n resizeWithAspectRatio(clientX, clientY) {\n if (this.pageRect && this.aspectRatio !== null && this.element && this.element.offsetParent) {\n this.updateMinSize();\n const offsetRect = this.element.offsetParent.getBoundingClientRect();\n const elementRect = this.element.getBoundingClientRect();\n const minLeft = this.pageRect.x / window.devicePixelRatio;\n const maxLeft = minLeft + this.pageRect.w / window.devicePixelRatio;\n const minTop = this.pageRect.y / window.devicePixelRatio;\n const maxTop = minTop + this.pageRect.h / window.devicePixelRatio;\n let pointerX = clientX - offsetRect.left;\n if (pointerX < minLeft) {\n pointerX = minLeft;\n }\n else if (pointerX > maxLeft) {\n pointerX = maxLeft;\n }\n let pointerY = clientY - offsetRect.top;\n if (pointerY < minTop) {\n pointerY = minTop;\n }\n else if (pointerY > maxTop) {\n pointerY = maxTop;\n }\n let topPos = elementRect.top - offsetRect.top;\n let leftPos = elementRect.left - offsetRect.left;\n let width = elementRect.width;\n let height = elementRect.height;\n const calcSize = (w, h, r) => {\n if (this.store.getState().document.rotation % 180 !== 0)\n r = 1 / r;\n const size = { w, h };\n if (w / h < r) {\n size.w = Math.max(w, this.minSize);\n size.h = size.w / r;\n if (size.h < this.minSize) {\n size.h = this.minSize;\n size.w = size.h * r;\n }\n }\n else {\n size.h = Math.max(h, this.minSize);\n size.w = size.h * r;\n if (size.w < this.minSize) {\n size.w = this.minSize;\n size.h = size.w * r;\n }\n }\n return size;\n };\n // resize nw (top left)\n if (this.resizeDir === ResizeDir.NW) {\n const w = leftPos + width - pointerX;\n const h = topPos + height - pointerY;\n const size = calcSize(w, h, this.aspectRatio);\n leftPos = leftPos + width - size.w;\n topPos = topPos + height - size.h;\n width = size.w;\n height = size.h;\n }\n // resize ne (top right)\n if (this.resizeDir === ResizeDir.NE) {\n const w = pointerX - leftPos;\n const h = topPos + height - pointerY;\n const size = calcSize(w, h, this.aspectRatio);\n topPos = topPos + height - size.h;\n width = size.w;\n height = size.h;\n }\n // resize sw (bottom left)\n if (this.resizeDir === ResizeDir.SW) {\n const w = leftPos + width - pointerX;\n const h = pointerY - topPos;\n const size = calcSize(w, h, this.aspectRatio);\n leftPos = leftPos + width - size.w;\n width = size.w;\n height = size.h;\n }\n // resize se (bottom right)\n if (this.resizeDir === ResizeDir.SE) {\n const w = pointerX - leftPos;\n const h = pointerY - topPos;\n const size = calcSize(w, h, this.aspectRatio);\n width = size.w;\n height = size.h;\n }\n this.element.style.top = topPos + 'px';\n this.element.style.left = leftPos + 'px';\n this.element.style.width = width + 'px';\n this.element.style.height = height + 'px';\n }\n }\n endResize(e) {\n if (e.moved && this.annotationId) {\n this.onResized(this.annotationId, {\n x: this.element.offsetLeft,\n y: this.element.offsetTop,\n w: this.element.offsetWidth,\n h: this.element.offsetHeight,\n });\n }\n this.element.classList.remove('pwv-annotation-resizing');\n }\n startMove(e) {\n const elementRect = this.element.getBoundingClientRect();\n const offsetParent = this.element.offsetParent;\n const offsetParentRect = offsetParent.getBoundingClientRect();\n this.dragOffsetX = e.clientX - elementRect.left;\n this.dragOffsetY = e.clientY - elementRect.top;\n this.containerOffsetX = offsetParentRect.left;\n this.containerOffsetY = offsetParentRect.top;\n this.element.classList.add('pwv-annotation-moving');\n }\n moving(e) {\n if (this.pageRect) {\n const minLeft = this.pageRect.x / devicePixelRatio;\n const maxLeft = minLeft + this.pageRect.w / devicePixelRatio - this.element.offsetWidth;\n const minTop = this.pageRect.y / devicePixelRatio;\n const maxTop = minTop + this.pageRect.h / devicePixelRatio - this.element.offsetHeight;\n let topPos = e.clientY - this.containerOffsetY - this.dragOffsetY;\n let leftPos = e.clientX - this.containerOffsetX - this.dragOffsetX;\n if (topPos < minTop) {\n topPos = minTop;\n }\n else if (topPos > maxTop) {\n topPos = maxTop;\n }\n if (leftPos < minLeft) {\n leftPos = minLeft;\n }\n else if (leftPos > maxLeft) {\n leftPos = maxLeft;\n }\n this.element.style.top = topPos + 'px';\n this.element.style.left = leftPos + 'px';\n }\n }\n endMove(e) {\n if (e.moved && this.annotationId) {\n this.onMoved(this.annotationId, {\n x: this.element.offsetLeft,\n y: this.element.offsetTop + this.element.offsetHeight,\n });\n }\n this.element.classList.remove('pwv-annotation-moving');\n }\n}\n","import { h, app } from '../../../lib/hyperapp';\nimport { PdfItemType } from '../../../pdf-viewer-api';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { Toolbar } from '../../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { Contextbar } from '../../../common/Contextbar';\nimport { icons } from '../../../common/icons';\nimport { annotationHasPopup } from '../../state/annotations';\n/** internal */\nexport const createAnnotationContextBar = (props, element) => {\n const state = {\n annotation: null,\n isReadOnly: false,\n hasPopup: false,\n canRotate: false,\n deletable: false,\n canCopy: false,\n isLocked: false,\n canHavePopup: false,\n canDeletePopup: true,\n showConfirmDelete: false,\n commands: [],\n };\n const actions = {\n setAnnotation: (payload) => ($state) => {\n const { annotation, commands } = payload;\n const { behaviors } = annotation;\n const isReadOnly = annotation.isReadOnly();\n return Object.assign(Object.assign({}, $state), { showConfirmDelete: false, commands, annotation: annotation, isReadOnly, hasPopup: annotationHasPopup(annotation), canRotate: behaviors.rotatable, deletable: behaviors.deletable, canCopy: behaviors.text && props.allowCopyText, isLocked: annotation.isLocked(), canHavePopup: behaviors.canHavePopup, canDeletePopup: annotationHasPopup(annotation) && annotation.itemType !== PdfItemType.TEXT });\n },\n startDelete: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { showConfirmDelete: true });\n },\n cancelDelete: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { showConfirmDelete: false });\n },\n delete: () => ($state) => {\n props.onDeleteAnnotation($state.annotation ? $state.annotation.id : 0);\n return Object.assign({}, $state);\n },\n rotate: () => ($state) => {\n props.onRotateAnnotation($state.annotation ? $state.annotation.id : 0);\n return Object.assign({}, $state);\n },\n copyText: () => ($state) => {\n props.onCopy($state.annotation ? $state.annotation.id : 0);\n return Object.assign({}, $state);\n },\n addPopup: () => ($state) => {\n props.onCreatePopup($state.annotation ? $state.annotation.id : 0);\n return Object.assign(Object.assign({}, $state), { hasPopup: true });\n },\n editPopup: () => ($state) => {\n props.onOpenPopup($state.annotation ? $state.annotation.id : 0);\n return Object.assign({}, $state);\n },\n deletePopup: () => ($state) => {\n props.onDeletePopup($state.annotation ? $state.annotation.id : 0);\n return Object.assign(Object.assign({}, $state), { hasPopup: false });\n },\n toggleLock: () => ($state) => {\n props.onToggleLock($state.annotation ? $state.annotation.id : 0);\n return Object.assign(Object.assign({}, $state), { isLocked: !$state.isLocked });\n },\n };\n const App = () => h(ContextBar, null);\n const ContextBar = ({}) => ($state, $actions) => {\n if ($state.isReadOnly) {\n if ($state.canCopy || ($state.canHavePopup && $state.hasPopup)) {\n return (h(Contextbar, null,\n h(Toolbar, null,\n $state.canCopy && (h(ToolbarButton, { tooltip: translationManager.getText('contextbar.copyText'), icon: icons.copy, onClick: $actions.copyText })),\n $state.canHavePopup && $state.hasPopup && (h(ToolbarButton, { tooltip: translationManager.getText('contextbar.openPopup'), icon: icons.stickyNote, onClick: $actions.editPopup })))));\n }\n return null;\n }\n return (h(Contextbar, null,\n h(Toolbar, null, $state.showConfirmDelete ? (h(ToolbarItemGroup, null,\n h(ToolbarButton, { onClick: $actions.delete }, translationManager.getText('contextbar.confirmDelete')),\n h(ToolbarButton, { onClick: $actions.cancelDelete }, translationManager.getText('contextbar.cancelDelete')))) : (h(ToolbarItemGroup, null,\n !$state.isReadOnly &&\n $state.commands.map((cmd) => (h(ToolbarButton, { icon: cmd.icon, tooltip: cmd.tooltip, onClick: () => {\n cmd.onCmd($state.annotation ? $state.annotation.id : 0);\n }, disabled: ($state.isLocked && !props.allowEditLockedAnnotations) || $state.isReadOnly }))),\n $state.canCopy && (h(ToolbarButton, { tooltip: translationManager.getText('contextbar.copyText'), icon: icons.copy, onClick: $actions.copyText })),\n $state.canRotate && (h(ToolbarButton, { tooltip: translationManager.getText('contextbar.rotate'), icon: icons.rotate, onClick: $actions.rotate, disabled: ($state.isLocked && !props.allowEditLockedAnnotations) || $state.isReadOnly })),\n $state.canHavePopup &&\n !$state.isReadOnly &&\n !($state.isLocked && !props.allowEditLockedAnnotations) &&\n !$state.hasPopup && (h(ToolbarButton, { tooltip: translationManager.getText('contextbar.addPopup'), icon: icons.stickyNoteAdd, onClick: $actions.addPopup, disabled: ($state.isLocked && !props.allowEditLockedAnnotations) || $state.isReadOnly })),\n $state.canHavePopup && $state.hasPopup && (h(ToolbarButton, { tooltip: translationManager.getText(($state.isLocked && !props.allowEditLockedAnnotations) || $state.isReadOnly\n ? 'contextbar.openPopup'\n : 'contextbar.editPopup'), icon: ($state.isLocked && !props.allowEditLockedAnnotations) || $state.isReadOnly\n ? icons.stickyNote\n : icons.stickyNoteEdit, onClick: $actions.editPopup })),\n $state.canDeletePopup && $state.hasPopup && (h(ToolbarButton, { tooltip: translationManager.getText('contextbar.deletePopup'), icon: icons.stickyNoteRemove, onClick: $actions.deletePopup, disabled: ($state.isLocked && !props.allowEditLockedAnnotations) || $state.isReadOnly })),\n !$state.isReadOnly && props.allowLockAnnotations && (h(ToolbarButton, { tooltip: translationManager.getText($state.isLocked ? 'contextbar.unlock' : 'contextbar.lock'), icon: $state.isLocked ? icons.lock : icons.unlock, onClick: $actions.toggleLock, disabled: $state.isReadOnly })),\n $state.deletable && (h(ToolbarButton, { tooltip: translationManager.getText('contextbar.delete'), icon: icons.delete, onClick: $actions.startDelete, disabled: ($state.isLocked && !props.allowEditLockedAnnotations) || $state.isReadOnly })))))));\n };\n return app(state, actions, App, element);\n};\n","import { app, h } from '../../../lib/hyperapp';\nimport { PdfItemType } from '../../../pdf-viewer-api';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { Toolbar } from '../../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { ColorPicker } from '../../../common/ColorPicker';\nimport { Contextbar } from '../../../common/Contextbar';\nimport { icons } from '../../../common/icons';\n/** internal */\nexport const createTextSelectionContextBar = (props, element) => {\n const state = {\n highlightColors: props.highlightColors,\n };\n const actions = {};\n const App = () => h(ContextBar, null);\n const ContextBar = ({}) => ($state) => {\n return (h(Contextbar, null,\n h(Toolbar, null, props.isViewOnly ? (h(ToolbarItemGroup, null,\n h(ToolbarButton, { tooltip: translationManager.getText('contextbar.copyText'), icon: icons.copy, onClick: props.onCopyText }))) : (h(ToolbarItemGroup, null,\n props.allowCopyText && (h(ToolbarButton, { tooltip: translationManager.getText('contextbar.copyText'), icon: icons.copy, onClick: props.onCopyText })),\n h(ColorPicker, { tooltip: translationManager.getText('contextbar.highlightText'), colors: $state.highlightColors, icon: icons.highlighter, color: \"#000000ff\", onChange: (color) => {\n props.onCreateAnnotation(PdfItemType.HIGHLIGHT, color);\n } }),\n h(ColorPicker, { tooltip: translationManager.getText('contextbar.underlineText'), colors: $state.highlightColors, icon: icons.underline, color: \"#000000ff\", onChange: (color) => {\n props.onCreateAnnotation(PdfItemType.UNDERLINE, color);\n } }),\n h(ColorPicker, { tooltip: translationManager.getText('contextbar.squigglyText'), colors: $state.highlightColors, icon: icons.squiggly, color: \"#000000ff\", onChange: (color) => {\n props.onCreateAnnotation(PdfItemType.SQUIGGLY, color);\n } }),\n h(ColorPicker, { tooltip: translationManager.getText('contextbar.strikeOutText'), colors: $state.highlightColors, icon: icons.strikethrough, color: \"#000000ff\", onChange: (color) => {\n props.onCreateAnnotation(PdfItemType.STRIKE_OUT, color);\n } }))))));\n };\n return app(state, actions, App, element);\n};\n","/* Begin of block that initializes the WASM code */\nif (window.PdfToolsPromise === undefined) {\n window.Module = {};\n Module['locateFile'] = (path, prefix) => {\n const pdfviewingBaseUrl = window.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL;\n return pdfviewingBaseUrl\n ? pdfviewingBaseUrl + (pdfviewingBaseUrl.endsWith('/') ? '' : '/') + path\n : path;\n };\n window.PdfToolsPromise = new Promise((resolve, reject) => {\n window.Module['onRuntimeInitialized'] = () => {\n if (typeof Module.ViewingInitialize !== 'function') {\n const errorMsg = `**************************************\nCould not find method Module.ViewingInitialize\n\n%cYou may be using a mismatched version of the 4-Heights® PDF Viewing SDK. Please make sure you have updated all files to the same version.\n%c**************************************`;\n console.error(errorMsg, 'color: orange', 'color: gray', 'color: red');\n reject(errorMsg);\n }\n Module.ViewingInitialize();\n resolve();\n };\n const scriptElm = document.createElement('script');\n const scriptSrc = window.Module.locateFile('PdfViewing_Main.js');\n scriptElm.onerror = function (err) {\n console.error(`**************************************\nFailed to load PdfViewing_Main.js \n\n%cThe 4-Heights® PDF Viewing SDK failed to load a required script resource. Either the \"Base URL\" (PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL) is not configured correctly or the static assets have not been copied to the configured location. For more information please consult the documentation.\n\n%cwindow.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL=>${window.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL}\n%c**************************************`, 'color: orange', 'color: gray', 'color: red');\n reject('failed to load PdfViewing_Main.js');\n };\n scriptElm.src = scriptSrc;\n document.head.appendChild(scriptElm);\n });\n}\nexport var PdfViewing;\n(function (PdfViewing) {\n var _a;\n let Internal;\n (function (Internal) {\n class NativeBase {\n /** @internal */\n static throwLastError(allowSuccess = true) {\n let exception = this.createLastError(this.lastErrorCode, this.lastErrorMessage, allowSuccess);\n if (exception === null)\n return;\n else\n throw exception;\n }\n /** @internal */\n static createLastError(errorCode, errorMessage, allowSuccess = true) {\n switch (errorCode) {\n case 0:\n if (allowSuccess)\n return null;\n else\n return new PdfViewing.PdfViewingError('An unexpected error occurred');\n case 10:\n return new PdfViewing.GenericError(errorMessage);\n case 11:\n return new PdfViewing.FatalError(errorMessage);\n case 12:\n return new PdfViewing.LicenseError(errorMessage);\n case 15:\n return new PdfViewing.UnknownFormatError(errorMessage);\n case 16:\n return new PdfViewing.CorruptError(errorMessage);\n case 17:\n return new PdfViewing.PasswordError(errorMessage);\n case 18:\n return new PdfViewing.ConformanceError(errorMessage);\n case 19:\n return new PdfViewing.UnsupportedFeatureError(errorMessage);\n case 20:\n return new PdfViewing.InfrastructureError(errorMessage);\n case 21:\n return new PdfViewing.ProcessingError(errorMessage);\n case 22:\n return new PdfViewing.ExistsError(errorMessage);\n case 23:\n return new PdfViewing.UpdateFailedError(errorMessage);\n case 1:\n return new PdfViewing.NotSupportedError(errorMessage);\n case 2:\n return new PdfViewing.InvalidOperationError(errorMessage);\n case 3:\n return new PdfViewing.ArgumentError(errorMessage);\n case 5:\n return new PdfViewing.NotFoundError(errorMessage);\n case 4:\n return new PdfViewing.IOError(errorMessage);\n default:\n return null;\n }\n }\n /** @internal */\n static get lastErrorMessage() {\n return Module.ViewingGetLastErrorMessage();\n }\n /** @internal */\n static get lastErrorCode() {\n return Module.ViewingGetLastError();\n }\n }\n Internal.NativeBase = NativeBase;\n class NativeObject extends NativeBase {\n /** @internal */\n get handle() {\n if (this._handle === 0) {\n throw new Error('NULL Pointer');\n }\n return this._handle;\n }\n /** @internal */\n set handle(handle) {\n this._handle = handle;\n }\n /** @internal */\n constructor(handle) {\n super();\n this._handle = handle;\n }\n equals(obj) {\n if (obj instanceof NativeObject) {\n if (this._handle === 0 || obj._handle === 0)\n return false;\n return Module.ViewingEquals(this._handle, obj._handle);\n }\n return false;\n }\n getHashCode() {\n return this._handle === 0 ? 0 : Module.ViewingGetHashCode(this._handle);\n }\n /** @internal */\n static checkReturnHandleErrorCode(handle) {\n if (handle === 0) {\n NativeBase.throwLastError(false);\n }\n return handle;\n }\n }\n Internal.NativeObject = NativeObject;\n })(Internal = PdfViewing.Internal || (PdfViewing.Internal = {}));\n class PdfViewingError extends Error {\n constructor(message) {\n super(message);\n const actualProto = new.target.prototype;\n Object.setPrototypeOf(this, actualProto);\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n ;\n this.__proto__ = actualProto;\n }\n }\n }\n PdfViewing.PdfViewingError = PdfViewingError;\n /**\n *\n * Specifies functional features which can be supported by the ViewingSDK.\n * A given license key can permit or prohibit any of these features.\n */\n let LicenseFeature;\n (function (LicenseFeature) {\n /**\n *\n * Viewer may create and edit annotations.\n */\n LicenseFeature[LicenseFeature[\"Annotate\"] = 1] = \"Annotate\";\n /**\n *\n * Viewer may fill out form fields.\n */\n LicenseFeature[LicenseFeature[\"FillFormFields\"] = 2] = \"FillFormFields\";\n /**\n *\n * Viewer may rotate individual pages.\n */\n LicenseFeature[LicenseFeature[\"PageRotation\"] = 4] = \"PageRotation\";\n })(LicenseFeature = PdfViewing.LicenseFeature || (PdfViewing.LicenseFeature = {}));\n /**\n *\n */\n class ViewerController extends Internal.NativeObject {\n /**\n * @event\n */\n addEventListener(type, listener) {\n if (typeof listener !== 'function')\n throw new PdfViewing.ArgumentError(\"Argument 'listener' must be a function.\");\n var eventObj;\n if (this.eventListeners.has(type)) {\n if (!this.eventListeners.get(type).has(listener)) {\n if (type === 'busyChanged') {\n eventObj = new BusyChangedNativeClass(listener);\n let context = Module.ViewingViewerControllerAddBusyChangedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n this.eventListeners.get(type).set(listener, eventObj);\n }\n }\n if (!this.eventListeners.get(type).has(listener)) {\n if (type === 'errorOccured') {\n eventObj = new ErrorOccuredNativeClass(listener);\n let context = Module.ViewingViewerControllerAddErrorOccuredHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n this.eventListeners.get(type).set(listener, eventObj);\n }\n }\n }\n else {\n if (type === 'busyChanged') {\n eventObj = new BusyChangedNativeClass(listener);\n let context = Module.ViewingViewerControllerAddBusyChangedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n let mapItem = new Map();\n mapItem.set(listener, eventObj);\n this.eventListeners.set(type, mapItem);\n }\n if (type === 'errorOccured') {\n eventObj = new ErrorOccuredNativeClass(listener);\n let context = Module.ViewingViewerControllerAddErrorOccuredHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n let mapItem = new Map();\n mapItem.set(listener, eventObj);\n this.eventListeners.set(type, mapItem);\n }\n }\n }\n removeEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n if (type === 'busyChanged') {\n let listeners = this.eventListeners.get(type);\n if (listeners.has(listener)) {\n let eventObj = listeners.get(listener);\n try {\n if (!Module.ViewingViewerControllerRemoveBusyChangedHandler(this.handle, eventObj === null || eventObj === void 0 ? void 0 : eventObj.context))\n Internal.NativeBase.throwLastError();\n }\n catch (err) {\n if (err instanceof NotFoundError)\n throw err;\n }\n listeners.delete(listener);\n if (listeners.size === 0)\n this.eventListeners.delete('busyChanged');\n }\n }\n if (type === 'errorOccured') {\n let listeners = this.eventListeners.get(type);\n if (listeners.has(listener)) {\n let eventObj = listeners.get(listener);\n try {\n if (!Module.ViewingViewerControllerRemoveErrorOccuredHandler(this.handle, eventObj === null || eventObj === void 0 ? void 0 : eventObj.context))\n Internal.NativeBase.throwLastError();\n }\n catch (err) {\n if (err instanceof NotFoundError)\n throw err;\n }\n listeners.delete(listener);\n if (listeners.size === 0)\n this.eventListeners.delete('errorOccured');\n }\n }\n }\n }\n /**\n *\n *\n * @throws {@link PdfViewing.LicenseError} The license is not valid.\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingNewViewerController()));\n }\n this.eventListeners = new Map();\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new ViewerController({ __handle: handle });\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingViewerControllerClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n *\n * Open a PDF and optionally one or more associated FDFs.\n * @param pdfFile\n * The PDF file to be opened.\n * @param fdfFiles\n * A list of FDF or XFDF files that are opened jointly with the {@link PdfViewing.ViewerController.open pdfFile}.\n * @param password\n * The password used for opening the {@link PdfViewing.ViewerController.open pdfFile}.\n * Set `null` if unencrypted.\n * @returns\n * The document that has been opened.\n *\n * @throws {@link PdfViewing.PasswordError} The file from {@link PdfViewing.ViewerController.open pdfFile} is encrypted and the password is not valid.\n * @throws {@link PdfViewing.IOError} Error reading from a stream.\n * @throws {@link PdfViewing.CorruptError} The file from {@link PdfViewing.ViewerController.open pdfFile} is corrupt or not a PDF.\n * @throws {@link PdfViewing.NotFoundError} The file from {@link PdfViewing.ViewerController.open pdfFile} is missing.\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed.\n */\n open(pdfFile, fdfFiles = null, password = null) {\n if (!(pdfFile instanceof PdfViewing.IO.InputDocument))\n throw new PdfViewing.ArgumentError(\"Argument 'pdfFile' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.\");\n if (fdfFiles !== null &&\n fdfFiles !== undefined &&\n !(fdfFiles instanceof PdfViewing.IO.InputDocumentList))\n throw new PdfViewing.ArgumentError(\"Argument 'fdfFiles' must be of type PdfViewing.IO.InputDocumentList or can be null or undefined.\");\n if (password !== null && password !== undefined && typeof password !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'password' must be of type string or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingViewerControllerOpen(thisHandle.handle, { thisHandle, resolved, rejected }, pdfFile.handle, fdfFiles !== null && fdfFiles !== undefined ? fdfFiles.handle : 0, password))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n openCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Document.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * @param pdf\n * @param fdf\n * @param password\n * the password to open the PDF document\n * @returns\n * The document that has been opened.\n *\n * @throws {@link PdfViewing.PasswordError} The file is encrypted and the password is not valid.\n * @throws {@link PdfViewing.CorruptError} The file is corrupt or not a PDF.\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n *\n * @deprecated Deprecated in Version 3.11. Use Open method instead.\n */\n openMem(pdf, fdf, password) {\n if (!(pdf instanceof Uint8Array))\n throw new PdfViewing.ArgumentError(\"Argument 'pdf' must be of type Uint8Array and must not be null or undefined.\");\n if (fdf !== null && fdf !== undefined && !(fdf instanceof Uint8Array))\n throw new PdfViewing.ArgumentError(\"Argument 'fdf' must be of type Uint8Array or can be null or undefined.\");\n if (password !== null && password !== undefined && typeof password !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'password' must be of type string or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingViewerControllerOpenMem(thisHandle.handle, { thisHandle, resolved, rejected }, pdf, fdf, password))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n openMemCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Document.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * @param pdfUri\n * @param fdfUri\n * @param password\n * the password to open the PDF document\n * @param pdfAuthorization\n * @param fdfAuthorization\n * @returns\n * The document that has been opened.\n *\n * @throws {@link PdfViewing.PasswordError} The file is encrypted and the password is not valid.\n * @throws {@link PdfViewing.CorruptError} The file is corrupt or not a PDF.\n * @throws {@link PdfViewing.NotFoundError} The file from {@link PdfViewing.ViewerController.openUri pdfUri} or {@link PdfViewing.ViewerController.openUri fdfUri} is missing.\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n *\n * @deprecated Deprecated in Version 3.11. Use Open method instead.\n */\n openUri(pdfUri, fdfUri, password, pdfAuthorization, fdfAuthorization) {\n if (typeof pdfUri !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'pdfUri' must be of type string and must not be null or undefined.\");\n if (fdfUri !== null && fdfUri !== undefined && typeof fdfUri !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'fdfUri' must be of type string or can be null or undefined.\");\n if (password !== null && password !== undefined && typeof password !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'password' must be of type string or can be null or undefined.\");\n if (pdfAuthorization !== null &&\n pdfAuthorization !== undefined &&\n typeof pdfAuthorization !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'pdfAuthorization' must be of type string or can be null or undefined.\");\n if (fdfAuthorization !== null &&\n fdfAuthorization !== undefined &&\n typeof fdfAuthorization !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'fdfAuthorization' must be of type string or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingViewerControllerOpenUri(thisHandle.handle, { thisHandle, resolved, rejected }, pdfUri, fdfUri, password, pdfAuthorization, fdfAuthorization))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n openUriCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Document.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Merge two input documents into one document.\n * @param first\n * The first PDF document. This document is the parent document. It's metadata and viewing properties will be used.\n * @param second\n * The second PDF document. It's pages will be appended to {@link PdfViewing.ViewerController.merge first}\n * @param firstDocumentPassword\n * The password for the first PDF document.\n * @param secondDocumentPassword\n * The password for the second PDF document.\n * @param mergeOptions\n * Document merge options.\n * @returns\n * Binary buffer containing the new document.\n *\n * @throws {@link PdfViewing.PasswordError} Either {@link PdfViewing.ViewerController.merge first} or {@link PdfViewing.ViewerController.merge second} is encrypted and the password is not valid.\n * @throws {@link PdfViewing.IOError} Error reading from a stream.\n * @throws {@link PdfViewing.CorruptError} Either {@link PdfViewing.ViewerController.merge first} or {@link PdfViewing.ViewerController.merge second} is corrupt or not a PDF.\n * @throws {@link PdfViewing.NotFoundError} Either {@link PdfViewing.ViewerController.merge first} or {@link PdfViewing.ViewerController.merge second} is missing.\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed.\n */\n merge(first, second, firstDocumentPassword = null, secondDocumentPassword = null, mergeOptions = null) {\n if (!(first instanceof PdfViewing.IO.InputDocument))\n throw new PdfViewing.ArgumentError(\"Argument 'first' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.\");\n if (!(second instanceof PdfViewing.IO.InputDocument))\n throw new PdfViewing.ArgumentError(\"Argument 'second' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.\");\n if (firstDocumentPassword !== null &&\n firstDocumentPassword !== undefined &&\n typeof firstDocumentPassword !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'firstDocumentPassword' must be of type string or can be null or undefined.\");\n if (secondDocumentPassword !== null &&\n secondDocumentPassword !== undefined &&\n typeof secondDocumentPassword !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'secondDocumentPassword' must be of type string or can be null or undefined.\");\n if (mergeOptions !== null &&\n mergeOptions !== undefined &&\n !(mergeOptions instanceof PdfViewing.IO.MergeOptions))\n throw new PdfViewing.ArgumentError(\"Argument 'mergeOptions' must be of type PdfViewing.IO.MergeOptions or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingViewerControllerMerge(thisHandle.handle, { thisHandle, resolved, rejected }, first.handle, second.handle, firstDocumentPassword, secondDocumentPassword, mergeOptions !== null && mergeOptions !== undefined ? mergeOptions.handle : 0))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n mergeCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Content.BinaryBuffer.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n * True if viewer is currently still processing any the latest inputs and some updates to the viewport are incoming.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get isBusy() {\n let retVal = Module.ViewingViewerControllerGetIsBusy(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Set how formfields highlights are colored.\n * Use a fully transparent color to disable highlighting.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set formsHighlightColor(formsHighlightColor) {\n if (typeof formsHighlightColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'formsHighlightColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingViewerControllerSetFormsHighlightColor(this.handle, formsHighlightColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Set how required formfields highlights are colored.\n * Use a fully transparent color to disable highlighting.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set formsHighlightRequiredColor(formsHighlightRequiredColor) {\n if (typeof formsHighlightRequiredColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'formsHighlightRequiredColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingViewerControllerSetFormsHighlightRequiredColor(this.handle, formsHighlightRequiredColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n PdfViewing.ViewerController = ViewerController;\n class EventViewerControllerNativeBase {\n constructor(listener) {\n this.listener = listener;\n }\n }\n class BusyChangedNativeClass extends EventViewerControllerNativeBase {\n constructor(listener) {\n super(listener);\n }\n dispatchEventBusyChanged(busy) {\n this.listener(busy);\n }\n }\n class ErrorOccuredNativeClass extends EventViewerControllerNativeBase {\n constructor(listener) {\n super(listener);\n }\n dispatchEventErrorOccured() {\n this.listener(undefined);\n }\n }\n /**\n *\n */\n class Sdk extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new Sdk(handle);\n }\n /**\n *\n * @param license\n * Pass the license key to activate the product.\n * An empty string may be passed to use a default license which will watermark all pages.\n * @param producerSuffix\n *\n * @throws {@link PdfViewing.UnknownFormatError} if the format (version) of the {@link PdfViewing.Sdk.initialize license} argument is unknown\n * @throws {@link PdfViewing.CorruptError} if the {@link PdfViewing.Sdk.initialize license} argument is not a correct license key\n * @throws {@link PdfViewing.LicenseError} if the {@link PdfViewing.Sdk.initialize license} argument can be read but the license check failed\n */\n static initialize(license, producerSuffix) {\n if (typeof license !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'license' must be of type string and must not be null or undefined.\");\n if (producerSuffix !== null &&\n producerSuffix !== undefined &&\n typeof producerSuffix !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'producerSuffix' must be of type string or can be null or undefined.\");\n let retVal = Module.ViewingSdkInitialize(license, producerSuffix);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n *\n */\n static get version() {\n let retVal = Module.ViewingSdkGetVersion();\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n *\n */\n static get producerFullName() {\n let retVal = Module.ViewingSdkGetProducerFullName();\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * Returns a bitfield describing which features are supported with the currently set license\n */\n static get supportedFeatures() {\n let retVal = Module.ViewingSdkGetSupportedFeatures();\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n PdfViewing.Sdk = Sdk;\n /**\n *\n */\n class IntegerSet extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new IntegerSet(handle);\n }\n nativeGet(value) {\n let it = Module.ViewingIntegerSetGet(this.handle, value);\n if (it === -1 && Module.ViewingGetLastError() !== 5)\n Internal.NativeBase.throwLastError(false);\n return it;\n }\n [Symbol.iterator]() {\n return new IntegerSetIterator(this);\n }\n clear() {\n if (!Module.ViewingIntegerSetClear(this.handle))\n Internal.NativeBase.throwLastError(false);\n }\n delete(value) {\n if (typeof value !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'value' must be of type number and must not be null or undefined.\");\n let it = this.nativeGet(value);\n if (it == -1)\n return false;\n var retVal = Module.ViewingIntegerSetRemove(this.handle, this.nativeGet(value));\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n forEach(callbackfn, thisArg) {\n for (const value of this.entries()) {\n callbackfn(value[1], value[0], this);\n }\n }\n has(value) {\n if (typeof value !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'value' must be of type number and must not be null or undefined.\");\n return this.nativeGet(value) !== -1;\n }\n add(value) {\n if (typeof value !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'value' must be of type number and must not be null or undefined.\");\n if (!Module.ViewingIntegerSetAdd(this.handle, value))\n Internal.NativeBase.throwLastError(false);\n return this;\n }\n get size() {\n let size = Module.ViewingIntegerSetGetSize(this.handle);\n if (size < 0)\n Internal.NativeBase.throwLastError(false);\n return size;\n }\n entries() {\n return new IntegerSetEntryIterator(this);\n }\n keys() {\n return new IntegerSetIterator(this);\n }\n values() {\n return new IntegerSetIterator(this);\n }\n }\n Symbol.toStringTag;\n PdfViewing.IntegerSet = IntegerSet;\n class IntegerSetIteratorBase {\n /** @internal */\n constructor(set) {\n this.set = set;\n this.index = Module.ViewingIntegerSetGetBegin(set.handle);\n if (this.index === -1)\n Internal.NativeBase.throwLastError(false);\n this.end = Module.ViewingIntegerSetGetEnd(set.handle);\n if (this.end === -1)\n Internal.NativeBase.throwLastError(false);\n }\n /** @internal */\n getNextIndex() {\n let nextIndex = Module.ViewingIntegerSetGetNext(this.set.handle, this.index);\n if (nextIndex === -1)\n Internal.NativeBase.throwLastError(false);\n return nextIndex;\n }\n /** @internal */\n getValueFromIndex(index) {\n let retVal = Module.ViewingIntegerSetGetValue(this.set.handle, index);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n class IntegerSetEntryIterator extends IntegerSetIteratorBase {\n constructor(set) {\n super(set);\n }\n next() {\n if (this.index === this.end)\n return { done: true, value: null };\n let element = this.getValueFromIndex(this.index);\n this.index = this.getNextIndex();\n return { done: false, value: [element, element] };\n }\n [Symbol.iterator]() {\n return new IntegerSetEntryIterator(this.set);\n }\n }\n class IntegerSetIterator extends IntegerSetIteratorBase {\n constructor(set) {\n super(set);\n }\n next() {\n if (this.index === this.end)\n return { done: true, value: null };\n let element = this.getValueFromIndex(this.index);\n this.index = this.getNextIndex();\n return { done: false, value: element };\n }\n [Symbol.iterator]() {\n return new IntegerSetIterator(this.set);\n }\n }\n /**\n *\n * A list of strings\n */\n class StringList extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new StringList(handle);\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n throw new Error('Method not implemented.');\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingStringListGet(this.handle, index);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingStringListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n PdfViewing.StringList = StringList;\n /**\n *\n * A map that maps strings to strings.\n */\n class StringMap extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n this[_a] = 'StringMap';\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new StringMap(handle);\n }\n nativeGet(key) {\n let it = Module.ViewingStringMapGet(this.handle, key);\n if (it === -1 && Module.ViewingGetLastError() !== 5)\n Internal.NativeBase.throwLastError();\n return it;\n }\n [Symbol.iterator]() {\n return new StringMapKeyValueIterator(this);\n }\n clear() {\n if (!Module.ViewingStringMapClear(this.handle))\n Internal.NativeBase.throwLastError(false);\n }\n delete(key) {\n if (typeof key !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'key' must be of type string and must not be null or undefined.\");\n let it = this.nativeGet(key);\n if (it == -1)\n return false;\n var retVal = Module.ViewingStringMapRemove(this.handle, it);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n return true;\n }\n forEach(callbackfn, thisArg) {\n for (const keyValue of this.entries()) {\n callbackfn(keyValue[1], keyValue[0], this);\n }\n }\n get(key) {\n if (typeof key !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'key' must be of type string and must not be null or undefined.\");\n let it = Module.ViewingStringMapGet(this.handle, key);\n if (it === -1)\n Internal.NativeBase.throwLastError(false);\n let retVal = Module.ViewingStringMapGetValue(this.handle, it);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n has(key) {\n if (typeof key !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'key' must be of type string and must not be null or undefined.\");\n return this.nativeGet(key) !== -1;\n }\n set(key, value) {\n if (typeof key !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'key' must be of type string and must not be null or undefined.\");\n if (typeof value !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'value' must be of type string and must not be null or undefined.\");\n if (!Module.ViewingStringMapSet(this.handle, key, value))\n Internal.NativeBase.throwLastError(false);\n return this;\n }\n get size() {\n let size = Module.ViewingStringMapGetSize(this.handle);\n if (size < 0)\n Internal.NativeBase.throwLastError(false);\n return size;\n }\n entries() {\n return new StringMapKeyValueIterator(this);\n }\n keys() {\n return new StringMapKeyIterator(this);\n }\n values() {\n return new StringMapValueIterator(this);\n }\n }\n _a = Symbol.toStringTag;\n PdfViewing.StringMap = StringMap;\n class StringMapIteratorBase extends Internal.NativeBase {\n /** @internal */\n constructor(map) {\n super();\n this.map = map;\n this.index = Module.ViewingStringMapGetBegin(map.handle);\n if (this.index === -1)\n Internal.NativeBase.throwLastError(false);\n this.end = Module.ViewingStringMapGetEnd(map.handle);\n if (this.end === -1)\n Internal.NativeBase.throwLastError(false);\n }\n /** @internal */\n getNextIndex() {\n let nextIndex = Module.ViewingStringMapGetNext(this.map.handle, this.index);\n if (nextIndex === -1)\n Internal.NativeBase.throwLastError(false);\n return nextIndex;\n }\n /** @internal */\n getKeyFromIndex(index) {\n let key = Module.ViewingStringMapGetKey(this.map.handle, index);\n if (key === null)\n Internal.NativeBase.throwLastError(false);\n return key;\n }\n /** @internal */\n getValueFromIndex(index) {\n let retVal = Module.ViewingStringMapGetValue(this.map.handle, index);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n }\n class StringMapKeyValueIterator extends StringMapIteratorBase {\n constructor(map) {\n super(map);\n }\n next() {\n if (this.index === this.end)\n return { done: true, value: null };\n let key = this.getKeyFromIndex(this.index);\n let element = this.getValueFromIndex(this.index);\n this.index = this.getNextIndex();\n return { done: false, value: [key, element] };\n }\n [Symbol.iterator]() {\n return new StringMapKeyValueIterator(this.map);\n }\n }\n class StringMapKeyIterator extends StringMapIteratorBase {\n constructor(map) {\n super(map);\n }\n next() {\n if (this.index === this.end)\n return { done: true, value: null };\n let key = this.getKeyFromIndex(this.index);\n this.index = this.getNextIndex();\n return { done: false, value: key };\n }\n [Symbol.iterator]() {\n return new StringMapKeyIterator(this.map);\n }\n }\n class StringMapValueIterator extends StringMapIteratorBase {\n constructor(map) {\n super(map);\n }\n next() {\n if (this.index === this.end)\n return { done: true, value: null };\n let element = this.getValueFromIndex(this.index);\n this.index = this.getNextIndex();\n return { done: false, value: element };\n }\n [Symbol.iterator]() {\n return new StringMapValueIterator(this.map);\n }\n }\n let IO;\n (function (IO) {\n /**\n *\n * Describes the type of the file.\n */\n let FileType;\n (function (FileType) {\n /**\n *\n * A PDF file contains all content.\n */\n FileType[FileType[\"Pdf\"] = 0] = \"Pdf\";\n /**\n *\n * A FDF file may only contain annotations and form fields.\n */\n FileType[FileType[\"Fdf\"] = 1] = \"Fdf\";\n })(FileType = IO.FileType || (IO.FileType = {}));\n /**\n *\n * A PDF, FDF or XFDF File\n */\n class InputDocument extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingIOInputDocumentGetType(handle);\n switch (type) {\n case 0:\n return new InputDocument(handle);\n case 1:\n return PdfViewing.IO.InputUri.createDynamicObject(handle);\n case 2:\n return PdfViewing.IO.InputFile.createDynamicObject(handle);\n default:\n return new InputDocument(handle);\n }\n }\n /**\n * Tag that identifies annotations coming from present document (PDF, FDF or XFDF).\n * The tag for an annotation can be retrieved by {@link PdfViewing.Pdf.Annotations.Annotation.sourceTag }.\n */\n get sourceTag() {\n let retVal = Module.ViewingIOInputDocumentGetSourceTag(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n IO.InputDocument = InputDocument;\n /**\n *\n * A file that can be opened on a text-uri.\n */\n class InputUri extends PdfViewing.IO.InputDocument {\n /**\n *\n * @param uri\n * The uri where the file can be loaded from.\n * @param httpOptions\n * Contains custom settings that one wants to apply to the HTTP request.\n * @param sourceTag\n * Tag that identifies annotations coming from present document (PDF, FDF or XFDF).\n * The tag for an annotation can be retrieved by {@link PdfViewing.Pdf.Annotations.Annotation.sourceTag }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the file is an encrypted FDF or XFDF.\n */\n constructor(uri, httpOptions = null, sourceTag = null) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (typeof uri !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'uri' must be of type string and must not be null or undefined.\");\n if (httpOptions !== null &&\n httpOptions !== undefined &&\n !(httpOptions instanceof PdfViewing.IO.HttpOptions))\n throw new PdfViewing.ArgumentError(\"Argument 'httpOptions' must be of type PdfViewing.IO.HttpOptions or can be null or undefined.\");\n if (sourceTag !== null && sourceTag !== undefined && typeof sourceTag !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'sourceTag' must be of type string or can be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewInputUri(uri, httpOptions !== null && httpOptions !== undefined ? httpOptions.handle : 0, sourceTag)));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new InputUri({ __handle: handle });\n }\n /**\n * Get uri where this file is loaded from.\n */\n get uri() {\n let retVal = Module.ViewingIOInputUriGetUri(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n }\n IO.InputUri = InputUri;\n /**\n *\n */\n class InputFile extends PdfViewing.IO.InputDocument {\n /**\n *\n * @param data\n * The byte array containing the file in memory.\n * @param sourceTag\n * Tag that identifies annotations coming from present document (PDF, FDF or XFDF).\n * The tag for an annotation can be retrieved by {@link PdfViewing.Pdf.Annotations.Annotation.sourceTag }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the file is an encrypted FDF or XFDF.\n */\n constructor(data, sourceTag = null) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (!(data instanceof Uint8Array))\n throw new PdfViewing.ArgumentError(\"Argument 'data' must be of type Uint8Array and must not be null or undefined.\");\n if (sourceTag !== null && sourceTag !== undefined && typeof sourceTag !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'sourceTag' must be of type string or can be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewInputFile(data, sourceTag)));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new InputFile({ __handle: handle });\n }\n /**\n * Get byte array containing the file in memory.\n */\n get data() {\n let retVal = Module.ViewingIOInputFileGetData(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new Uint8Array(retVal);\n }\n }\n IO.InputFile = InputFile;\n /**\n *\n * A list of files\n */\n class InputDocumentList extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewInputDocumentList()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new InputDocumentList({ __handle: handle });\n }\n /** @internal */\n indexOf(element) {\n for (var i = 0; i < this.size; i++) {\n if (element.equals(this.get(i)))\n return i;\n }\n return -1;\n }\n remove(element) {\n if (!(element instanceof PdfViewing.IO.InputDocument))\n throw new PdfViewing.ArgumentError(\"Argument 'element' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.\");\n let index = this.indexOf(element);\n if (index == -1)\n return false;\n let retVal = Module.ViewingIOInputDocumentListRemove(this.handle, index);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n return true;\n }\n add(element) {\n if (!(element instanceof PdfViewing.IO.InputDocument))\n throw new PdfViewing.ArgumentError(\"Argument 'element' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.\");\n let retVal = Module.ViewingIOInputDocumentListAdd(this.handle, element.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n return true;\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n if (!(element instanceof PdfViewing.IO.InputDocument))\n throw new PdfViewing.ArgumentError(\"Argument 'element' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.\");\n let retVal = Module.ViewingIOInputDocumentListSet(this.handle, index, element.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n clear() {\n let retVal = Module.ViewingIOInputDocumentListClear(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n get(index) {\n let retVal = Module.ViewingIOInputDocumentListGet(this.handle, index);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.IO.InputDocument.createDynamicObject(retVal);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingIOInputDocumentListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n IO.InputDocumentList = InputDocumentList;\n /**\n *\n * Contains options that are applied to a HTTP request.\n */\n class HttpOptions extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewHttpOptions()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new HttpOptions({ __handle: handle });\n }\n /**\n * The mode for the request, possible values among others:\n * - \"cors\"\n * - \"no-cors\"\n * - \"same-origin\"\n */\n get mode() {\n let retVal = Module.ViewingIOHttpOptionsGetMode(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The mode for the request, possible values among others:\n * - \"cors\"\n * - \"no-cors\"\n * - \"same-origin\"\n */\n set mode(mode) {\n if (mode !== null && mode !== undefined && typeof mode !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'mode' must be of type string or can be null or undefined.\");\n let retVal = Module.ViewingIOHttpOptionsSetMode(this.handle, mode);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * A string indicating how the request will interact with the browser's HTTP cache.\n * The possible values are:\n * - \"default\"\n * - \"no-store\"\n * - \"reload\"\n * - \"no-cache\"\n * - \"force-cache\"\n * - \"only-if-cached\"\n */\n get cache() {\n let retVal = Module.ViewingIOHttpOptionsGetCache(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * A string indicating how the request will interact with the browser's HTTP cache.\n * The possible values are:\n * - \"default\"\n * - \"no-store\"\n * - \"reload\"\n * - \"no-cache\"\n * - \"force-cache\"\n * - \"only-if-cached\"\n */\n set cache(cache) {\n if (cache !== null && cache !== undefined && typeof cache !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'cache' must be of type string or can be null or undefined.\");\n let retVal = Module.ViewingIOHttpOptionsSetCache(this.handle, cache);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Controls what browsers do with credentials (i.e. cookies, HTTP authentication entries, and TLS client certificates).\n * Default value is \"same-origin\".\n * Must be one of the following strings:\n * - \"omit\": Tells browsers to exclude credentials from the request, and ignore any credentials sent back in the response (e.g., any Set-Cookie header).\n * - \"same-origin\": Tells browsers to include credentials with requests to same-origin URLs, and use any credentials sent back in responses from same-origin URLs.\n * - \"include\": Tells browsers to include credentials in both same- and cross-origin requests, and always use any credentials sent back in responses.\n */\n get credentials() {\n let retVal = Module.ViewingIOHttpOptionsGetCredentials(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Controls what browsers do with credentials (i.e. cookies, HTTP authentication entries, and TLS client certificates).\n * Default value is \"same-origin\".\n * Must be one of the following strings:\n * - \"omit\": Tells browsers to exclude credentials from the request, and ignore any credentials sent back in the response (e.g., any Set-Cookie header).\n * - \"same-origin\": Tells browsers to include credentials with requests to same-origin URLs, and use any credentials sent back in responses from same-origin URLs.\n * - \"include\": Tells browsers to include credentials in both same- and cross-origin requests, and always use any credentials sent back in responses.\n */\n set credentials(credentials) {\n if (credentials !== null && credentials !== undefined && typeof credentials !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'credentials' must be of type string or can be null or undefined.\");\n let retVal = Module.ViewingIOHttpOptionsSetCredentials(this.handle, credentials);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Specify how to handle the response.\n * Default value is \"follow\".\n * Possible values are:\n * - \"follow\": Automatically follow redirects.\n * - \"error\": Abort with an error if a redirect occurs.\n * - \"manual\": Caller intends to process the response in another context.\n */\n get redirect() {\n let retVal = Module.ViewingIOHttpOptionsGetRedirect(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Specify how to handle the response.\n * Default value is \"follow\".\n * Possible values are:\n * - \"follow\": Automatically follow redirects.\n * - \"error\": Abort with an error if a redirect occurs.\n * - \"manual\": Caller intends to process the response in another context.\n */\n set redirect(redirect) {\n if (redirect !== null && redirect !== undefined && typeof redirect !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'redirect' must be of type string or can be null or undefined.\");\n let retVal = Module.ViewingIOHttpOptionsSetRedirect(this.handle, redirect);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Specifies the referrer policy to use for the request.\n * Possible values are:\n * - \"no-referrer\"\n * - \"no-referrer-when-downgrade\"\n * - \"same-origin\"\n * - \"origin\"\n * - \"strict-origin\"\n * - \"origin-when-cross-origin\"\n * - \"strict-origin-when-cross-origin\"\n * - \"unsafe-url\"\n */\n get referrerPolicy() {\n let retVal = Module.ViewingIOHttpOptionsGetReferrerPolicy(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Specifies the referrer policy to use for the request.\n * Possible values are:\n * - \"no-referrer\"\n * - \"no-referrer-when-downgrade\"\n * - \"same-origin\"\n * - \"origin\"\n * - \"strict-origin\"\n * - \"origin-when-cross-origin\"\n * - \"strict-origin-when-cross-origin\"\n * - \"unsafe-url\"\n */\n set referrerPolicy(referrerPolicy) {\n if (referrerPolicy !== null &&\n referrerPolicy !== undefined &&\n typeof referrerPolicy !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'referrerPolicy' must be of type string or can be null or undefined.\");\n let retVal = Module.ViewingIOHttpOptionsSetReferrerPolicy(this.handle, referrerPolicy);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Headers to be added to the request.\n */\n get headers() {\n let retVal = Module.ViewingIOHttpOptionsGetHeaders(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.StringMap.createDynamicObject(retVal);\n }\n }\n IO.HttpOptions = HttpOptions;\n /**\n *\n * Contains options for merging two PDF documents into one.\n */\n class MergeOptions extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewMergeOptions()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new MergeOptions({ __handle: handle });\n }\n /**\n * Copy links (document internal and external links).\n */\n get copyLinks() {\n let retVal = Module.ViewingIOMergeOptionsGetCopyLinks(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Copy links (document internal and external links).\n */\n set copyLinks(copyLinks) {\n if (typeof copyLinks !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'copyLinks' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingIOMergeOptionsSetCopyLinks(this.handle, copyLinks);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Copy interactive annotations such as sticky notes or highlight annotations.\n */\n get copyAnnotations() {\n let retVal = Module.ViewingIOMergeOptionsGetCopyAnnotations(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Copy interactive annotations such as sticky notes or highlight annotations.\n */\n set copyAnnotations(copyAnnotations) {\n if (typeof copyAnnotations !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'copyAnnotations' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingIOMergeOptionsSetCopyAnnotations(this.handle, copyAnnotations);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Copy interactive form fields.\n */\n get copyFormFields() {\n let retVal = Module.ViewingIOMergeOptionsGetCopyFormFields(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Copy interactive form fields.\n */\n set copyFormFields(copyFormFields) {\n if (typeof copyFormFields !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'copyFormFields' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingIOMergeOptionsSetCopyFormFields(this.handle, copyFormFields);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Copy outlines (also called bookmarks).\n */\n get copyOutlines() {\n let retVal = Module.ViewingIOMergeOptionsGetCopyOutlines(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Copy outlines (also called bookmarks).\n */\n set copyOutlines(copyOutlines) {\n if (typeof copyOutlines !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'copyOutlines' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingIOMergeOptionsSetCopyOutlines(this.handle, copyOutlines);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Copy logical structure and tagging information.\n */\n get copyLogicalStructure() {\n let retVal = Module.ViewingIOMergeOptionsGetCopyLogicalStructure(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Copy logical structure and tagging information.\n */\n set copyLogicalStructure(copyLogicalStructure) {\n if (typeof copyLogicalStructure !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'copyLogicalStructure' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingIOMergeOptionsSetCopyLogicalStructure(this.handle, copyLogicalStructure);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Copy named destinations.\n */\n get copyNamedDestinations() {\n let retVal = Module.ViewingIOMergeOptionsGetCopyNamedDestinations(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Copy named destinations.\n */\n set copyNamedDestinations(copyNamedDestinations) {\n if (typeof copyNamedDestinations !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'copyNamedDestinations' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingIOMergeOptionsSetCopyNamedDestinations(this.handle, copyNamedDestinations);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Copy unsigned signature fields.\n */\n get copyUnsignedSignatures() {\n let retVal = Module.ViewingIOMergeOptionsGetCopyUnsignedSignatures(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Copy unsigned signature fields.\n */\n set copyUnsignedSignatures(copyUnsignedSignatures) {\n if (typeof copyUnsignedSignatures !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'copyUnsignedSignatures' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingIOMergeOptionsSetCopyUnsignedSignatures(this.handle, copyUnsignedSignatures);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n IO.MergeOptions = MergeOptions;\n })(IO = PdfViewing.IO || (PdfViewing.IO = {}));\n let Pdf;\n (function (Pdf) {\n /**\n *\n * Declares which kind of changes were done in the document since opening or last save action.\n */\n let DocumentChange;\n (function (DocumentChange) {\n /**\n *\n * Nothing has been changed.\n */\n DocumentChange[DocumentChange[\"NoChange\"] = 0] = \"NoChange\";\n /**\n *\n * Some annotations have been created, edited or deleted and the containing files need to be saved.\n */\n DocumentChange[DocumentChange[\"Annotation\"] = 1] = \"Annotation\";\n /**\n *\n * Some content has been edited and the PDF needs to be saved.\n */\n DocumentChange[DocumentChange[\"Content\"] = 2] = \"Content\";\n })(DocumentChange = Pdf.DocumentChange || (Pdf.DocumentChange = {}));\n /**\n *\n * The claimed standard compliance of the PDF document.\n */\n let Compliance;\n (function (Compliance) {\n /**\n *\n * Unkown claimed compliance\n */\n Compliance[Compliance[\"Unknown\"] = 0] = \"Unknown\";\n /**\n *\n * PDF 1.0\n */\n Compliance[Compliance[\"Pdf10\"] = 1] = \"Pdf10\";\n /**\n *\n * PDF 1.1\n */\n Compliance[Compliance[\"Pdf11\"] = 2] = \"Pdf11\";\n /**\n *\n * PDF 1.2\n */\n Compliance[Compliance[\"Pdf12\"] = 3] = \"Pdf12\";\n /**\n *\n * PDF 1.3\n */\n Compliance[Compliance[\"Pdf13\"] = 4] = \"Pdf13\";\n /**\n *\n * PDF 1.4\n */\n Compliance[Compliance[\"Pdf14\"] = 5] = \"Pdf14\";\n /**\n *\n * PDF 1.5\n */\n Compliance[Compliance[\"Pdf15\"] = 6] = \"Pdf15\";\n /**\n *\n * PDF 1.6\n */\n Compliance[Compliance[\"Pdf16\"] = 7] = \"Pdf16\";\n /**\n *\n * PDF 1.7\n */\n Compliance[Compliance[\"Pdf17\"] = 8] = \"Pdf17\";\n /**\n *\n * PDF 2.0\n */\n Compliance[Compliance[\"Pdf20\"] = 9] = \"Pdf20\";\n /**\n *\n * PDF/A-1\n */\n Compliance[Compliance[\"PdfA1b\"] = 10] = \"PdfA1b\";\n /**\n *\n * PDF/A-1a\n */\n Compliance[Compliance[\"PdfA1a\"] = 11] = \"PdfA1a\";\n /**\n *\n * PDF/A-2b\n */\n Compliance[Compliance[\"PdfA2b\"] = 12] = \"PdfA2b\";\n /**\n *\n * PDF/A-2u\n */\n Compliance[Compliance[\"PdfA2u\"] = 13] = \"PdfA2u\";\n /**\n *\n * PDF/A-2a\n */\n Compliance[Compliance[\"PdfA2a\"] = 14] = \"PdfA2a\";\n /**\n *\n * PDF/A-3b\n */\n Compliance[Compliance[\"PdfA3b\"] = 15] = \"PdfA3b\";\n /**\n *\n * PDF/A-3u\n */\n Compliance[Compliance[\"PdfA3u\"] = 16] = \"PdfA3u\";\n /**\n *\n * PDF/A-3a\n */\n Compliance[Compliance[\"PdfA3a\"] = 17] = \"PdfA3a\";\n })(Compliance = Pdf.Compliance || (Pdf.Compliance = {}));\n /**\n *\n * The intended target for rendering.\n */\n let OutputMedium;\n (function (OutputMedium) {\n /**\n *\n * Show rendered output on a display.\n */\n OutputMedium[OutputMedium[\"Display\"] = 0] = \"Display\";\n /**\n *\n * Print rendered output onto paper.\n */\n OutputMedium[OutputMedium[\"Print\"] = 1] = \"Print\";\n })(OutputMedium = Pdf.OutputMedium || (Pdf.OutputMedium = {}));\n /**\n *\n * Options used for rendering pages.\n */\n class RenderOptions extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNewRenderOptions()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new RenderOptions({ __handle: handle });\n }\n /**\n * Color of form field highlights.\n * By default a light blue color is used.\n * Use a fully transparent color to disable highlighting.\n */\n get formFieldHighlightColor() {\n let retVal = Module.ViewingPdfRenderOptionsGetFormFieldHighlightColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n /**\n * Color of form field highlights.\n * By default a light blue color is used.\n * Use a fully transparent color to disable highlighting.\n */\n set formFieldHighlightColor(formFieldHighlightColor) {\n if (typeof formFieldHighlightColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'formFieldHighlightColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfRenderOptionsSetFormFieldHighlightColor(this.handle, formFieldHighlightColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Color of form field highlights for required fields.\n * By default a red color is used.\n * Use a fully transparent color to disable highlighting of required fields.\n */\n get formFieldRequiredHighlightColor() {\n let retVal = Module.ViewingPdfRenderOptionsGetFormFieldRequiredHighlightColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n /**\n * Color of form field highlights for required fields.\n * By default a red color is used.\n * Use a fully transparent color to disable highlighting of required fields.\n */\n set formFieldRequiredHighlightColor(formFieldRequiredHighlightColor) {\n if (typeof formFieldRequiredHighlightColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'formFieldRequiredHighlightColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfRenderOptionsSetFormFieldRequiredHighlightColor(this.handle, formFieldRequiredHighlightColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Filter that decides which annotations get rendered.\n * Set `null` to render all Annotations.\n * Default value is `null`.\n */\n set annotationFilter(annotationFilter) {\n if (annotationFilter !== null &&\n annotationFilter !== undefined &&\n typeof annotationFilter !== 'function')\n throw new PdfViewing.ArgumentError(\"Argument 'annotationFilter' must be of type PdfViewing.Pdf.Annotations.AnnotationFilter or can be null or undefined.\");\n let retVal = Module.ViewingPdfRenderOptionsSetAnnotationFilter(this.handle, annotationFilter !== null && annotationFilter !== undefined\n ? new AnnotationFilterWrapper(annotationFilter)\n : null);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Set what ouput medium you want to use the rendered images for.\n * Default is \"display\".\n */\n get outputMedium() {\n let retVal = Module.ViewingPdfRenderOptionsGetOutputMedium(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Set what ouput medium you want to use the rendered images for.\n * Default is \"display\".\n */\n set outputMedium(outputMedium) {\n if (typeof outputMedium !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'outputMedium' must be of type PdfViewing.Pdf.OutputMedium and must not be null or undefined.\");\n let retVal = Module.ViewingPdfRenderOptionsSetOutputMedium(this.handle, outputMedium);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Pdf.RenderOptions = RenderOptions;\n /**\n *\n * Additional settings to configure the initial view\n */\n class ViewOptions extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNewViewOptions()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new ViewOptions({ __handle: handle });\n }\n /**\n * Destination that the view should initially navigate to.\n */\n get initialDestination() {\n let retVal = Module.ViewingPdfViewOptionsGetInitialDestination(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0\n ? PdfViewing.Pdf.Navigation.Destination.createDynamicObject(retVal)\n : null;\n }\n /**\n * Destination that the view should initially navigate to.\n */\n set initialDestination(initialDestination) {\n if (initialDestination !== null &&\n initialDestination !== undefined &&\n !(initialDestination instanceof PdfViewing.Pdf.Navigation.Destination))\n throw new PdfViewing.ArgumentError(\"Argument 'initialDestination' must be of type PdfViewing.Pdf.Navigation.Destination or can be null or undefined.\");\n let retVal = Module.ViewingPdfViewOptionsSetInitialDestination(this.handle, initialDestination !== null && initialDestination !== undefined\n ? initialDestination.handle\n : 0);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * This will override any fitting operation in the given {@link PdfViewing.Pdf.ViewOptions.initialDestination },\n * but preserve the navigation to the target of said destination.\n */\n get initialFitMode() {\n let retVal = Module.ViewingPdfViewOptionsGetInitialFitMode(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * This will override any fitting operation in the given {@link PdfViewing.Pdf.ViewOptions.initialDestination },\n * but preserve the navigation to the target of said destination.\n */\n set initialFitMode(initialFitMode) {\n if (initialFitMode !== null &&\n initialFitMode !== undefined &&\n typeof initialFitMode !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'initialFitMode' must be of type PdfViewing.Pdf.Navigation.FitMode or can be null or undefined.\");\n let retVal = Module.ViewingPdfViewOptionsSetInitialFitMode(this.handle, initialFitMode);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Set a initial page-layout mode.\n */\n get initialPageLayoutMode() {\n let retVal = Module.ViewingPdfViewOptionsGetInitialPageLayoutMode(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Set a initial page-layout mode.\n */\n set initialPageLayoutMode(initialPageLayoutMode) {\n if (initialPageLayoutMode !== null &&\n initialPageLayoutMode !== undefined &&\n typeof initialPageLayoutMode !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'initialPageLayoutMode' must be of type PdfViewing.Pdf.Navigation.PageLayoutMode or can be null or undefined.\");\n let retVal = Module.ViewingPdfViewOptionsSetInitialPageLayoutMode(this.handle, initialPageLayoutMode);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Set an initial viewport size in pixel.\n * Default: 720 (height) and 480 (width).\n */\n get viewportSize() {\n let retVal = Module.ViewingPdfViewOptionsGetViewportSize(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.Size(retVal.width, retVal.height);\n }\n /**\n * Set an initial viewport size in pixel.\n * Default: 720 (height) and 480 (width).\n */\n set viewportSize(viewportSize) {\n if (typeof viewportSize !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'viewportSize' must be of type PdfViewing.Pdf.Geometry.Integer.Size and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewOptionsSetViewportSize(this.handle, viewportSize);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Set an initial resolution in DPI (dots per inch) for this view.\n * Default: 96.0.\n */\n get viewDPI() {\n let retVal = Module.ViewingPdfViewOptionsGetViewDPI(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Set an initial resolution in DPI (dots per inch) for this view.\n * Default: 96.0.\n */\n set viewDPI(viewDPI) {\n if (typeof viewDPI !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'viewDPI' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewOptionsSetViewDPI(this.handle, viewDPI);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Pdf.ViewOptions = ViewOptions;\n /**\n *\n * Options used for saving {@link PdfViewing.Pdf.Document }s.\n */\n class SaveOptions extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNewSaveOptions()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new SaveOptions({ __handle: handle });\n }\n /**\n * Choose whether the outputfile should be a PDF or an FDF document.\n * Default is {@link PdfViewing.IO.FileType.Pdf }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get fileType() {\n let retVal = Module.ViewingPdfSaveOptionsGetFileType(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Choose whether the outputfile should be a PDF or an FDF document.\n * Default is {@link PdfViewing.IO.FileType.Pdf }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set fileType(fileType) {\n if (typeof fileType !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'fileType' must be of type PdfViewing.IO.FileType and must not be null or undefined.\");\n let retVal = Module.ViewingPdfSaveOptionsSetFileType(this.handle, fileType);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * A callback to be called for each annotation in the document when saving.\n * The result of the callback determines whether the annotation is included in the output.\n * Pass `null` to save all annotations.\n * Default is `null`.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set annotationFilter(annotationFilter) {\n if (annotationFilter !== null &&\n annotationFilter !== undefined &&\n typeof annotationFilter !== 'function')\n throw new PdfViewing.ArgumentError(\"Argument 'annotationFilter' must be of type PdfViewing.Pdf.Annotations.AnnotationFilter or can be null or undefined.\");\n let retVal = Module.ViewingPdfSaveOptionsSetAnnotationFilter(this.handle, annotationFilter !== null && annotationFilter !== undefined\n ? new AnnotationFilterWrapper(annotationFilter)\n : null);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Pdf.SaveOptions = SaveOptions;\n /**\n *\n */\n class Page extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new Page(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfPageClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n *\n * Rotate this page by the specified number of degrees.\n * @param rotateBy\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.LicenseError} The license is not valid for the editing feature.\n */\n rotatePage(rotateBy) {\n if (typeof rotateBy !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'rotateBy' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n let retVal = Module.ViewingPdfPageRotatePage(this.handle, rotateBy);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Pdf.Page = Page;\n /**\n *\n */\n class PageList extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new PageList(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfPageListClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n throw new Error('Method not implemented.');\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingPdfPageListGet(this.handle, index);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Page.createDynamicObject(retVal);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingPdfPageListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Pdf.PageList = PageList;\n /**\n *\n * Allows Interacting with an opened document\n */\n class Document extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new Document(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfDocumentClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n *\n * Return the opened PDF as binary data,\n * to be used, e.g., to save the file to disk.\n * @param asFdf\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.LicenseError} The license is not valid for this feature.\n *\n * @deprecated Deprecated in Version 3.10. Use method Save instead.\n */\n saveFile(asFdf) {\n if (typeof asFdf !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'asFdf' must be of type boolean and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentSaveFile(thisHandle.handle, { thisHandle, resolved, rejected }, asFdf))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n saveFileCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Content.BinaryBuffer.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Return the opened PDF or FDF as binary data,\n * to be used, e.g., to save the file to disk.\n * @param saveOptions\n * Options used for saving the document.\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.NotSupportedError} if trying to save an annotation type to FDF which is currently not supported.\n * Unsupported are: {@link PdfViewing.Pdf.Annotations.FileAttachment }\n * and all derivatives of {@link PdfViewing.Pdf.Annotations.Link } and {@link PdfViewing.Pdf.Forms.Widget }.\n * @throws {@link PdfViewing.LicenseError} The license is not valid for the editing feature.\n */\n save(saveOptions = null) {\n if (saveOptions !== null &&\n saveOptions !== undefined &&\n !(saveOptions instanceof PdfViewing.Pdf.SaveOptions))\n throw new PdfViewing.ArgumentError(\"Argument 'saveOptions' must be of type PdfViewing.Pdf.SaveOptions or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentSave(thisHandle.handle, { thisHandle, resolved, rejected }, saveOptions !== null && saveOptions !== undefined ? saveOptions.handle : 0))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n saveCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Content.BinaryBuffer.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Start a new textsearch.\n * All results for the same textsearch can be iterated over using the returned {@link PdfViewing.Pdf.Content.TextSearchIterator }.\n * @param text\n * The text to look for.\n * @param startPage\n * The page on which to start the search.\n * @param isCaseSensitive\n * Set to `true` to ignore whether a letter is uppercase or lowercase.\n * @param isWrappingEnabled\n * Enable continuing search at the other end of the document if one end is reached.\n * @param isRegex\n * Interpret {@link PdfViewing.Pdf.Document.searchText text} as a regular expression according to ECMAScript Regular Expression grammar.\n * @returns\n * The returned {@link PdfViewing.Pdf.Content.TextSearchIterator } is starting the search at the top of the given page.\n *\n * @throws {@link PdfViewing.ArgumentError} if an empty string is given as a search term\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n searchText(text, startPage, isCaseSensitive, isWrappingEnabled, isRegex) {\n if (typeof text !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'text' must be of type string and must not be null or undefined.\");\n if (typeof startPage !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'startPage' must be of type number and must not be null or undefined.\");\n if (typeof isCaseSensitive !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'isCaseSensitive' must be of type boolean and must not be null or undefined.\");\n if (typeof isWrappingEnabled !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'isWrappingEnabled' must be of type boolean and must not be null or undefined.\");\n if (typeof isRegex !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'isRegex' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfDocumentSearchText(this.handle, text, startPage, isCaseSensitive, isWrappingEnabled, isRegex);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.TextSearchIterator.createDynamicObject(retVal);\n }\n /**\n *\n * Create a new {@link PdfViewing.Pdf.Annotations.Annotation } and add it to the page\n * specified in the given {@link PdfViewing.Pdf.Document.createAnnotation annotation}.\n * @param annotation\n * @returns newly created promise for further asynchronous processing.\n *\n * @throws {@link PdfViewing.UpdateFailedError} The PDF file could not be updated.\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.LicenseError} The license is not valid for the editing feature.\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Document.createAnnotation annotation} argument is `null`\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Document.createAnnotation annotation} is not placed on a page\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Document.createAnnotation annotation} is added twice to the document\n */\n createAnnotation(annotation) {\n if (!(annotation instanceof PdfViewing.Pdf.Annotations.Annotation))\n throw new PdfViewing.ArgumentError(\"Argument 'annotation' must be of type PdfViewing.Pdf.Annotations.Annotation and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentCreateAnnotation(thisHandle.handle, { thisHandle, resolved, rejected }, annotation.handle))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n createAnnotationCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (!retVal)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved();\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Delete an existing {@link PdfViewing.Pdf.Annotations.Annotation } from the document.\n * @param annotation\n * @returns newly created promise for further asynchronous processing.\n *\n * @throws {@link PdfViewing.UpdateFailedError} The PDF file could not be updated\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.LicenseError} The license is not valid for the editing feature.\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Document.deleteAnnotation annotation} argument is `null`\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Document.deleteAnnotation annotation} had already been deleted\n */\n deleteAnnotation(annotation) {\n if (!(annotation instanceof PdfViewing.Pdf.Annotations.Annotation))\n throw new PdfViewing.ArgumentError(\"Argument 'annotation' must be of type PdfViewing.Pdf.Annotations.Annotation and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentDeleteAnnotation(thisHandle.handle, { thisHandle, resolved, rejected }, annotation.handle))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n deleteAnnotationCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (!retVal)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved();\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Edit an existing {@link PdfViewing.Pdf.Annotations.Annotation } that is attached to the document.\n * @param annotation\n * @returns newly created promise for further asynchronous processing.\n *\n * @throws {@link PdfViewing.UpdateFailedError} The PDF file could not be updated\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.LicenseError} The license is not valid for the editing feature.\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Document.editAnnotation annotation} argument is `null`\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Document.editAnnotation annotation} was moved to illegal page\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Document.editAnnotation annotation} has been deleted from page\n */\n editAnnotation(annotation) {\n if (!(annotation instanceof PdfViewing.Pdf.Annotations.Annotation))\n throw new PdfViewing.ArgumentError(\"Argument 'annotation' must be of type PdfViewing.Pdf.Annotations.Annotation and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentEditAnnotation(thisHandle.handle, { thisHandle, resolved, rejected }, annotation.handle))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n editAnnotationCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (!retVal)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved();\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Get a list of {@link PdfViewing.Pdf.Annotations.Annotation }s associated with the document\n * and placed on page {@link PdfViewing.Pdf.Document.getAnnotations pageNumber}.\n * This list is only updated after the asynchronous operations that modify annotations\n * ({@link PdfViewing.Pdf.Document.createAnnotation }, {@link PdfViewing.Pdf.Document.deleteAnnotation } and {@link PdfViewing.Pdf.Document.editAnnotation })\n * have finished.\n * @param pageNumber\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getAnnotations(pageNumber) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentGetAnnotations(thisHandle.handle, { thisHandle, resolved, rejected }, pageNumber))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n getAnnotationsCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Annotations.AnnotationList.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Get a list of {@link PdfViewing.Pdf.Content.TextFragment }s that are placed on page {@link PdfViewing.Pdf.Document.getTextFragments pageNumber}.\n * @param pageNumber\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getTextFragments(pageNumber) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentGetTextFragments(thisHandle.handle, { thisHandle, resolved, rejected }, pageNumber))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n getTextFragmentsCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Content.TextFragmentList.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Copy the page of another {@link PdfViewing.Pdf.Document } to this document.\n * This copy is not yet visible anywhere but can be used to create a {@link PdfViewing.Pdf.Annotations.CustomImageStamp } using {@link PdfViewing.Pdf.Annotations.CustomImageStamp.create } , which will add said page as an annotation.\n * @param otherDocument\n * The document where the page is copied from\n * @param pageNumber\n * The number of the page to be copied\n * @returns\n * An identifier which can be used to create annotations on this document using {@link PdfViewing.Pdf.Annotations.CustomImageStamp.create }\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n registerPdfPage(otherDocument, pageNumber) {\n if (!(otherDocument instanceof PdfViewing.Pdf.Document))\n throw new PdfViewing.ArgumentError(\"Argument 'otherDocument' must be of type PdfViewing.Pdf.Document and must not be null or undefined.\");\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentRegisterPdfPage(thisHandle.handle, { thisHandle, resolved, rejected }, otherDocument.handle, pageNumber))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n registerPdfPageCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage);\n if (error === null) {\n context.resolved(retVal);\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Get a List of {@link PdfViewing.Pdf.Navigation.OutlineItem }s attached to the document.\n * @param parentOutline\n * Insert `null` to get top level outline item of document.\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getOutlines(parentOutline) {\n if (parentOutline !== null &&\n parentOutline !== undefined &&\n !(parentOutline instanceof PdfViewing.Pdf.Navigation.OutlineItem))\n throw new PdfViewing.ArgumentError(\"Argument 'parentOutline' must be of type PdfViewing.Pdf.Navigation.OutlineItem or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentGetOutlines(thisHandle.handle, { thisHandle, resolved, rejected }, parentOutline !== null && parentOutline !== undefined ? parentOutline.handle : 0))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n getOutlinesCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Navigation.OutlineItemList.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Render page {@link PdfViewing.Pdf.Document.renderPage pageNumber} with a specific rotation into a rectangle of a specific size.\n * The returned image will always use the exact dimensions passed by parameters {@link PdfViewing.Pdf.Document.renderPage width} and {@link PdfViewing.Pdf.Document.renderPage height} even if the aspect ratio differs from the rendred page.\n * @param pageNumber\n * @param width\n * @param height\n * @param rotate\n * Rotate page in degrees.\n * @param renderOptions\n * Options used for rendering the page, set `null` to use default options\n * @returns\n *\n * @throws {@link PdfViewing.ArgumentError} if the provided page does not exist\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n renderPage(pageNumber, width, height, rotate, renderOptions = null) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (typeof width !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'width' must be of type number and must not be null or undefined.\");\n if (typeof height !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'height' must be of type number and must not be null or undefined.\");\n if (typeof rotate !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'rotate' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n if (renderOptions !== null &&\n renderOptions !== undefined &&\n !(renderOptions instanceof PdfViewing.Pdf.RenderOptions))\n throw new PdfViewing.ArgumentError(\"Argument 'renderOptions' must be of type PdfViewing.Pdf.RenderOptions or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentRenderPage(thisHandle.handle, { thisHandle, resolved, rejected }, pageNumber, width, height, rotate, renderOptions !== null && renderOptions !== undefined ? renderOptions.handle : 0))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n renderPageCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Content.Image.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Get Size of a pdf page.\n * If the page is not loaded yet the returned value is just a guess based on the already loaded pages\n * or `null` depending on the value of {@link PdfViewing.Pdf.Document.getPageSize guess}.\n * @param page\n * @param guess\n * Configure to get a best guess if the size has not been loaded yet\n * @returns\n */\n getPageSize(page, guess) {\n if (typeof page !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'page' must be of type number and must not be null or undefined.\");\n if (typeof guess !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'guess' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfDocumentGetPageSize(this.handle, page, guess);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal !== null\n ? new PdfViewing.Pdf.Geometry.Real.Size(retVal.width, retVal.height)\n : null;\n }\n /**\n *\n * Get the size in Pdf Coordinates of page {@link PdfViewing.Pdf.Document.getPagePdfSize pageNumber}\n * @param pageNumber\n * @returns\n *\n * @throws {@link PdfViewing.ArgumentError} if the provided page does not exist\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getPagePdfSize(pageNumber) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentGetPagePdfSize(thisHandle.handle, { thisHandle, resolved, rejected }, pageNumber))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n getPagePdfSizeCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === null)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(new PdfViewing.Pdf.Geometry.Real.Size(retVal.width, retVal.height));\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Get the aspect ratio (width divided by height) of a given {@link PdfViewing.Pdf.Document.getTextStampAspectRatio stampText}.\n * This value can be used as preparation step to compute the exact bounding box\n * for creating a {@link PdfViewing.Pdf.Annotations.CustomTextStamp }.\n * @param stampText\n * The text that will be used for creating a {@link PdfViewing.Pdf.Annotations.CustomTextStamp }\n * @returns\n * The ratio of height divided by width of the given text.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getTextStampAspectRatio(stampText) {\n if (typeof stampText !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'stampText' must be of type string and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentGetTextStampAspectRatio(thisHandle.handle, { thisHandle, resolved, rejected }, stampText))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n getTextStampAspectRatioCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage);\n if (error === null) {\n context.resolved(retVal);\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Register an image in the document as a resource. This resource can then later be used to add e.g. an {@link PdfViewing.Pdf.Annotations.CustomImageStamp }.\n * @param image\n * @returns\n * ID of the registered image.\n * This ID is needed by {@link PdfViewing.Pdf.Annotations.CustomImageStamp.create } to link the image resource to the stamp annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the provided {@link PdfViewing.Pdf.Document.registerImage image} is invalid or the format is not supported\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n registerImage(image) {\n if (!(image instanceof Uint8Array))\n throw new PdfViewing.ArgumentError(\"Argument 'image' must be of type Uint8Array and must not be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentRegisterImage(thisHandle.handle, { thisHandle, resolved, rejected }, image))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n registerImageCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage);\n if (error === null) {\n context.resolved(retVal);\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Register an image in the document as a resource.\n * This resource can then later be used,\n * e.g. to add an {@link PdfViewing.Pdf.Annotations.CustomImageStamp }.\n * @param imageUri\n * @param authorization\n * @returns\n * ID of the registered image.\n * This ID is needed by {@link PdfViewing.Pdf.Annotations.CustomImageStamp.create } to link the image resource to the stamp annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the provided {@link PdfViewing.Pdf.Document.registerImageUri imageUri} is invalid or the format is not supported\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n registerImageUri(imageUri, authorization) {\n if (typeof imageUri !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'imageUri' must be of type string and must not be null or undefined.\");\n if (authorization !== null &&\n authorization !== undefined &&\n typeof authorization !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'authorization' must be of type string or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentRegisterImageUri(thisHandle.handle, { thisHandle, resolved, rejected }, imageUri, authorization))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n registerImageUriCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage);\n if (error === null) {\n context.resolved(retVal);\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Create a new document by merging this document to the input document.\n * Pages, optional content, embedded files, and outlines are appended.\n * Viewing options and metadata from the current document are used.\n * @param other\n * Other document.\n * @param mergeOptions\n * Document merge options.\n * @returns\n * A binary buffer containing the new document.\n *\n * @throws {@link PdfViewing.ArgumentError} if the provided document {@link PdfViewing.Pdf.Document.mergeWith other} is invalid\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n mergeWith(other, mergeOptions = null) {\n if (!(other instanceof PdfViewing.Pdf.Document))\n throw new PdfViewing.ArgumentError(\"Argument 'other' must be of type PdfViewing.Pdf.Document and must not be null or undefined.\");\n if (mergeOptions !== null &&\n mergeOptions !== undefined &&\n !(mergeOptions instanceof PdfViewing.IO.MergeOptions))\n throw new PdfViewing.ArgumentError(\"Argument 'mergeOptions' must be of type PdfViewing.IO.MergeOptions or can be null or undefined.\");\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfDocumentMergeWith(thisHandle.handle, { thisHandle, resolved, rejected }, other.handle, mergeOptions !== null && mergeOptions !== undefined ? mergeOptions.handle : 0))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n mergeWithCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (retVal === 0)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved(PdfViewing.Pdf.Content.BinaryBuffer.createDynamicObject(retVal));\n }\n else\n context.rejected(error);\n }\n /**\n * The destination that the creator of the PDF recommends to use when opening a view of the PDF.\n * This destination can be passed in a {@link PdfViewing.Pdf.ViewOptions } object to {@link PdfViewing.Pdf.View.create } for initializing the view,\n * thus respecting the creator's recommendation.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get initialDestination() {\n let retVal = Module.ViewingPdfDocumentGetInitialDestination(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0\n ? PdfViewing.Pdf.Navigation.Destination.createDynamicObject(retVal)\n : null;\n }\n /**\n * Tells whether any modifications have been made that would be lost without saving, such as editing annotations or rotating pages.\n * Value is 0 after opening and will reset to 0 when saving the document.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get hasChanges() {\n let retVal = Module.ViewingPdfDocumentGetHasChanges(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Return the number of pages in the document.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get pageCount() {\n let retVal = Module.ViewingPdfDocumentGetPageCount(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The pagelayoutmode that the creator of the PDF has suggested to use when opening a view of the PDF.\n * Can be passed in a {@link PdfViewing.Pdf.ViewOptions } object to method {@link PdfViewing.Pdf.View.create } for initializing the view.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get initialPageLayoutMode() {\n let retVal = Module.ViewingPdfDocumentGetInitialPageLayoutMode(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n * Return the claimed document compliance.\n *\n * Note: Claimed compliance does not guarantee conformance to the standard.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get compliance() {\n let retVal = Module.ViewingPdfDocumentGetCompliance(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n */\n get pages() {\n let retVal = Module.ViewingPdfDocumentGetPages(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.PageList.createDynamicObject(retVal);\n }\n }\n Pdf.Document = Document;\n /**\n *\n * Describes the current view of the viewport on part of the document.\n * All properties and methods are consistent with what is actually visible, i.e. text fragments on a point can only be detected if said text is currently visible.\n */\n class View extends Internal.NativeObject {\n /**\n * @event\n */\n addEventListener(type, listener) {\n if (typeof listener !== 'function')\n throw new PdfViewing.ArgumentError(\"Argument 'listener' must be a function.\");\n var eventObj;\n if (this.eventListeners.has(type)) {\n if (!this.eventListeners.get(type).has(listener)) {\n if (type === 'viewUpdated') {\n eventObj = new ViewUpdatedNativeClass(listener);\n let context = Module.ViewingPdfViewAddViewUpdatedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n this.eventListeners.get(type).set(listener, eventObj);\n }\n }\n if (!this.eventListeners.get(type).has(listener)) {\n if (type === 'imageCreated') {\n eventObj = new ImageCreatedNativeClass(listener);\n let context = Module.ViewingPdfViewAddImageCreatedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n this.eventListeners.get(type).set(listener, eventObj);\n }\n }\n if (!this.eventListeners.get(type).has(listener)) {\n if (type === 'imageRemovedFromCache') {\n eventObj = new ImageRemovedFromCacheNativeClass(listener);\n let context = Module.ViewingPdfViewAddImageRemovedFromCacheHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n this.eventListeners.get(type).set(listener, eventObj);\n }\n }\n }\n else {\n if (type === 'viewUpdated') {\n eventObj = new ViewUpdatedNativeClass(listener);\n let context = Module.ViewingPdfViewAddViewUpdatedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n let mapItem = new Map();\n mapItem.set(listener, eventObj);\n this.eventListeners.set(type, mapItem);\n }\n if (type === 'imageCreated') {\n eventObj = new ImageCreatedNativeClass(listener);\n let context = Module.ViewingPdfViewAddImageCreatedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n let mapItem = new Map();\n mapItem.set(listener, eventObj);\n this.eventListeners.set(type, mapItem);\n }\n if (type === 'imageRemovedFromCache') {\n eventObj = new ImageRemovedFromCacheNativeClass(listener);\n let context = Module.ViewingPdfViewAddImageRemovedFromCacheHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n let mapItem = new Map();\n mapItem.set(listener, eventObj);\n this.eventListeners.set(type, mapItem);\n }\n }\n }\n removeEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n if (type === 'viewUpdated') {\n let listeners = this.eventListeners.get(type);\n if (listeners.has(listener)) {\n let eventObj = listeners.get(listener);\n try {\n if (!Module.ViewingPdfViewRemoveViewUpdatedHandler(this.handle, eventObj === null || eventObj === void 0 ? void 0 : eventObj.context))\n Internal.NativeBase.throwLastError();\n }\n catch (err) {\n if (err instanceof NotFoundError)\n throw err;\n }\n listeners.delete(listener);\n if (listeners.size === 0)\n this.eventListeners.delete('viewUpdated');\n }\n }\n if (type === 'imageCreated') {\n let listeners = this.eventListeners.get(type);\n if (listeners.has(listener)) {\n let eventObj = listeners.get(listener);\n try {\n if (!Module.ViewingPdfViewRemoveImageCreatedHandler(this.handle, eventObj === null || eventObj === void 0 ? void 0 : eventObj.context))\n Internal.NativeBase.throwLastError();\n }\n catch (err) {\n if (err instanceof NotFoundError)\n throw err;\n }\n listeners.delete(listener);\n if (listeners.size === 0)\n this.eventListeners.delete('imageCreated');\n }\n }\n if (type === 'imageRemovedFromCache') {\n let listeners = this.eventListeners.get(type);\n if (listeners.has(listener)) {\n let eventObj = listeners.get(listener);\n try {\n if (!Module.ViewingPdfViewRemoveImageRemovedFromCacheHandler(this.handle, eventObj === null || eventObj === void 0 ? void 0 : eventObj.context))\n Internal.NativeBase.throwLastError();\n }\n catch (err) {\n if (err instanceof NotFoundError)\n throw err;\n }\n listeners.delete(listener);\n if (listeners.size === 0)\n this.eventListeners.delete('imageRemovedFromCache');\n }\n }\n }\n }\n /**\n *\n * @param document\n * The document this view is displaying.\n * @param ignoreEmbeddedPreferences\n * When set ignore any opening preferences or actions that are embedded in the PDF.\n *\n * @deprecated Deprecated in Version 3.10. Use static method View.Create instead.\n */\n constructor(document, ignoreEmbeddedPreferences) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (!(document instanceof PdfViewing.Pdf.Document))\n throw new PdfViewing.ArgumentError(\"Argument 'document' must be of type PdfViewing.Pdf.Document and must not be null or undefined.\");\n if (typeof ignoreEmbeddedPreferences !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'ignoreEmbeddedPreferences' must be of type boolean and must not be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNewView(document.handle, ignoreEmbeddedPreferences)));\n }\n this.eventListeners = new Map();\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new View({ __handle: handle });\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfViewClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n *\n * @param document\n * The document this view is displaying.\n * @param renderOptions\n * Options used for rendering the page, set `null` to use default options.\n * @param viewOptions\n * Options used for the view, set `null` to use default options.\n * @returns\n */\n static create(document, renderOptions, viewOptions) {\n if (!(document instanceof PdfViewing.Pdf.Document))\n throw new PdfViewing.ArgumentError(\"Argument 'document' must be of type PdfViewing.Pdf.Document and must not be null or undefined.\");\n if (renderOptions !== null &&\n renderOptions !== undefined &&\n !(renderOptions instanceof PdfViewing.Pdf.RenderOptions))\n throw new PdfViewing.ArgumentError(\"Argument 'renderOptions' must be of type PdfViewing.Pdf.RenderOptions or can be null or undefined.\");\n if (viewOptions !== null &&\n viewOptions !== undefined &&\n !(viewOptions instanceof PdfViewing.Pdf.ViewOptions))\n throw new PdfViewing.ArgumentError(\"Argument 'viewOptions' must be of type PdfViewing.Pdf.ViewOptions or can be null or undefined.\");\n let retVal = Module.ViewingPdfViewCreate(document.handle, renderOptions !== null && renderOptions !== undefined ? renderOptions.handle : 0, viewOptions !== null && viewOptions !== undefined ? viewOptions.handle : 0);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.View.createDynamicObject(retVal);\n }\n /**\n *\n * Stops sending `ViewUpdated` events.\n * Internally user interactions and rendering is still performed normally.\n * Resume using {@link PdfViewing.Pdf.View.resumeDrawing }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n suspendDrawing() {\n let retVal = Module.ViewingPdfViewSuspendDrawing(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n *\n * Resume sending `ViewUpdated` events.\n * Will always trigger a single `ViewUpdated` event, containing all updates since suspending.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n resumeDrawing() {\n let retVal = Module.ViewingPdfViewResumeDrawing(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n *\n * Navigate the viewport to the given destination.\n * @param destination\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} if the provided {@link PdfViewing.Pdf.View.goToDestination destination} is invalid\n */\n goToDestination(destination) {\n if (!(destination instanceof PdfViewing.Pdf.Navigation.Destination))\n throw new PdfViewing.ArgumentError(\"Argument 'destination' must be of type PdfViewing.Pdf.Navigation.Destination and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGoToDestination(this.handle, destination.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n *\n * Navigate the viewport to show the given rectangle by scrolling and zooming as little as possible.\n * @param rectangle\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} if the provided {@link PdfViewing.Pdf.View.goToRectangle rectangle} is invalid\n */\n goToRectangle(rectangle) {\n if (typeof rectangle !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'rectangle' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGoToRectangle(this.handle, rectangle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n *\n * Returns a list of {@link PdfViewing.Pdf.Content.TextFragment } at point.\n * @param point\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.NotFoundError} The given {@link PdfViewing.Pdf.View.getTextFragmentsOnPoint point} is on no page.\n * @throws {@link PdfViewing.FatalError} The page is not in cache.\n */\n getTextFragmentsOnPoint(point) {\n if (typeof point !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'point' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGetTextFragmentsOnPoint(this.handle, point);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.TextFragmentList.createDynamicObject(retVal);\n }\n /**\n *\n * Returns a list of all {@link PdfViewing.Pdf.Content.TextFragment }s on a given page.\n * @param pageNumber\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.FatalError} The page is not in cache.\n */\n getTextFragments(pageNumber) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGetTextFragments(this.handle, pageNumber);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.TextFragmentList.createDynamicObject(retVal);\n }\n /**\n *\n * Returns a textselection of all text within a rectangle.\n * Only text that is already loaded (and thus rendered) is selected.\n * Only the text on the rectangle's `PageNumber` field page is selected, even if extending the rectangle beyond the page boundaries.\n * The rectangle is defined by two corner points which may be on different pages.\n * @param startPoint\n * @param endPoint\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getRectangularTextSelection(startPoint, endPoint) {\n if (typeof startPoint !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'startPoint' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n if (typeof endPoint !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'endPoint' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGetRectangularTextSelection(this.handle, startPoint, endPoint);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.TextSelection.createDynamicObject(retVal);\n }\n /**\n *\n * Returns a textselection in between `startPoint` and `endPoint`.\n * Only text that is already loaded (and thus rendered) is selected.\n * @param startPoint\n * @param endPoint\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getTextSelection(startPoint, endPoint) {\n if (typeof startPoint !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'startPoint' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n if (typeof endPoint !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'endPoint' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGetTextSelection(this.handle, startPoint, endPoint);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0\n ? PdfViewing.Pdf.Content.TextSelection.createDynamicObject(retVal)\n : null;\n }\n /**\n *\n * Returns a {@link PdfViewing.Pdf.Content.TextSelection? } of the word at the given location.\n * If multiple word are at this location, the smallest one is returned.\n * @param point\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.NotFoundError} if there are no words at {@link PdfViewing.Pdf.View.getWordOnPoint point}\n */\n getWordOnPoint(point) {\n if (typeof point !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'point' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGetWordOnPoint(this.handle, point);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0\n ? PdfViewing.Pdf.Content.TextSelection.createDynamicObject(retVal)\n : null;\n }\n /**\n *\n * Returns a list of {@link PdfViewing.Pdf.Annotations.Annotation }s at point.\n * Returns annotations in ascending z-order, thus the most visible annotation is the last element of the returned list.\n * @param point\n * @param onlySelectable\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getAnnotationsOnPoint(point, onlySelectable) {\n if (typeof point !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'point' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.\");\n if (typeof onlySelectable !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'onlySelectable' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGetAnnotationsOnPoint(this.handle, point, onlySelectable);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.AnnotationList.createDynamicObject(retVal);\n }\n /**\n *\n * Get the rendering information to display the currently visible viewport.\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getRenderedResults() {\n let retVal = Module.ViewingPdfViewGetRenderedResults(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.RenderResults.createDynamicObject(retVal);\n }\n /**\n *\n * Transform a point from viewport coordinates (top-left origin in pixels on viewport) to on-page coordinates (bottom-left origin in dots on a page).\n * If the given point is not on any page, then the closest page will be used as a reference for the returned point.\n * @param pointOnViewport\n * @param snapToPage\n * If the transformed point is not on any page, snap it to the border of the closest page.\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n transformPointFromViewportToPage(pointOnViewport, snapToPage) {\n if (typeof pointOnViewport !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'pointOnViewport' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.\");\n if (typeof snapToPage !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'snapToPage' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewTransformPointFromViewportToPage(this.handle, pointOnViewport, snapToPage);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.PointOnPage(retVal.pageNumber, retVal.x, retVal.y);\n }\n /**\n *\n * Transform a point from viewport coordinates (top-left origin in pixels on viewport) to on-page coordinates (bottom-left origin in dots on a page).\n * If the given point is not on any page, then the closest page will be used as a reference for the returned point.\n * @param pointOnViewport\n * @param pageNumber\n * @param snapToPage\n * If the transformed point is not on any page, snap it to the border of the closest page.\n * @returns\n * Return the point in relation to the specified page.\n *\n * @throws {@link PdfViewing.ArgumentError} if the provided {@link PdfViewing.Pdf.View.transformPointFromViewportToSpecificPage pageNumber} does not exist\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n transformPointFromViewportToSpecificPage(pointOnViewport, pageNumber, snapToPage) {\n if (typeof pointOnViewport !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'pointOnViewport' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.\");\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (typeof snapToPage !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'snapToPage' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewTransformPointFromViewportToSpecificPage(this.handle, pointOnViewport, pageNumber, snapToPage);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.PointOnPage(retVal.pageNumber, retVal.x, retVal.y);\n }\n /**\n *\n * Transform a rectangle from viewport coordinates (top-left origin in pixels on viewport) to on-page coordinates (bottom-left origin in dots on a page) on a specific page.\n * @param rectangleOnViewport\n * @param pageNumber\n * @returns\n *\n * @throws {@link PdfViewing.ArgumentError} if the provided {@link PdfViewing.Pdf.View.transformRectangleFromViewportToSpecificPage pageNumber} does not exist\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n transformRectangleFromViewportToSpecificPage(rectangleOnViewport, pageNumber) {\n if (typeof rectangleOnViewport !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'rectangleOnViewport' must be of type PdfViewing.Pdf.Geometry.Integer.Rectangle and must not be null or undefined.\");\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewTransformRectangleFromViewportToSpecificPage(this.handle, rectangleOnViewport, pageNumber);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(retVal.pageNumber, retVal.x, retVal.y, retVal.width, retVal.height);\n }\n /**\n *\n * Transform a point from on-page coordinates (bottom-left origin in dots on a page) to viewport coordinates (top-left origin in pixels on viewport).\n * @param pointOnPage\n * @returns\n *\n * @throws {@link PdfViewing.ArgumentError} if {@link PdfViewing.Pdf.View.transformPointFromPageToViewport pointOnPage} is not on any page\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n transformPointFromPageToViewport(pointOnPage) {\n if (typeof pointOnPage !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'pointOnPage' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewTransformPointFromPageToViewport(this.handle, pointOnPage);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.Point(retVal.x, retVal.y);\n }\n /**\n *\n * Transform a rectangle from on-page coordinates (bottom-left origin in dots on a page) to viewport coordinates (top-left origin in pixels on viewport).\n * @param rectangleOnPage\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} if {@link PdfViewing.Pdf.View.transformRectangleFromPageToViewport rectangleOnPage} is not on any page\n */\n transformRectangleFromPageToViewport(rectangleOnPage) {\n if (typeof rectangleOnPage !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'rectangleOnPage' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewTransformRectangleFromPageToViewport(this.handle, rectangleOnPage);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.Rectangle(retVal.x, retVal.y, retVal.width, retVal.height);\n }\n /**\n *\n * Get the rectangle of a page in viewport coordinates (top-left origin in pixels on viewport).\n * If the document is newly opened this rectangle might be a guess, any updates to the loaded pagerectangles is reported in the `ViewUpdated` event with parameter `pageSizeUpdated`.\n * @param pageNumber\n * @returns\n *\n * @throws {@link PdfViewing.ArgumentError} if page with {@link PdfViewing.Pdf.View.getPageRectangleOnViewport pageNumber} is not on viewport\n * @throws {@link PdfViewing.ArgumentError} if the provided {@link PdfViewing.Pdf.View.getPageRectangleOnViewport pageNumber} does not exist\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getPageRectangleOnViewport(pageNumber) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewGetPageRectangleOnViewport(this.handle, pageNumber);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.Rectangle(retVal.x, retVal.y, retVal.width, retVal.height);\n }\n /**\n *\n * Transform a length from on-page coordinates (dots) to viewport coordinates (pixels).\n * @param pdfLength\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n transformPdfLengthToViewportLength(pdfLength) {\n if (typeof pdfLength !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pdfLength' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewTransformPdfLengthToViewportLength(this.handle, pdfLength);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n * Transform a length from viewport coordinates (pixels) to on-page coordinates (dots).\n * @param screenLength\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n transformViewportLengthToPdfLength(screenLength) {\n if (typeof screenLength !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'screenLength' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewTransformViewportLengthToPdfLength(this.handle, screenLength);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n * Set a new zoomfactor, keeping point {@link PdfViewing.Pdf.View.zoomOnLocation location} at a constant location on viewport.\n * @param zoom\n * @param location\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n zoomOnLocation(zoom, location) {\n if (typeof zoom !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'zoom' must be of type number and must not be null or undefined.\");\n if (typeof location !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'location' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewZoomOnLocation(this.handle, zoom, location);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n *\n * The currently most visible page.\n *\n * When getting, returns the page which covers most area on the view port.\n * If multiple pages cover the same amount of space,\n * the one with smaller page number is returned.\n *\n * When setting this property,\n * the view port moves to make this page the most visible page,\n * trying to align it to the top of the view port.\n *\n * Note: There are some cases in which a page cannot be made most visible.\n * Therefore setting this property to a certain value does not guarantee that the same value is returned when getting.\n * (Most notable cases are PageLayoutModes\n * {@link PdfViewing.Pdf.Navigation.PageLayoutMode.TwoColumnLeft },\n * {@link PdfViewing.Pdf.Navigation.PageLayoutMode.TwoColumnRight },\n * {@link PdfViewing.Pdf.Navigation.PageLayoutMode.TwoPageLeft },\n * {@link PdfViewing.Pdf.Navigation.PageLayoutMode.TwoPageRight },\n * and whenever viewing the end of a document with low {@link PdfViewing.Pdf.View.zoom }).\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get pageNumber() {\n let retVal = Module.ViewingPdfViewGetPageNumber(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n * The currently most visible page.\n *\n * When getting, returns the page which covers most area on the view port.\n * If multiple pages cover the same amount of space,\n * the one with smaller page number is returned.\n *\n * When setting this property,\n * the view port moves to make this page the most visible page,\n * trying to align it to the top of the view port.\n *\n * Note: There are some cases in which a page cannot be made most visible.\n * Therefore setting this property to a certain value does not guarantee that the same value is returned when getting.\n * (Most notable cases are PageLayoutModes\n * {@link PdfViewing.Pdf.Navigation.PageLayoutMode.TwoColumnLeft },\n * {@link PdfViewing.Pdf.Navigation.PageLayoutMode.TwoColumnRight },\n * {@link PdfViewing.Pdf.Navigation.PageLayoutMode.TwoPageLeft },\n * {@link PdfViewing.Pdf.Navigation.PageLayoutMode.TwoPageRight },\n * and whenever viewing the end of a document with low {@link PdfViewing.Pdf.View.zoom }).\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} if the provided page number does not exist\n */\n set pageNumber(pageNumber) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetPageNumber(this.handle, pageNumber);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The first currently visible page.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get firstVisiblePage() {\n let retVal = Module.ViewingPdfViewGetFirstVisiblePage(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The last currently visible page.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get lastVisiblePage() {\n let retVal = Module.ViewingPdfViewGetLastVisiblePage(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The current zoom factor.\n * Default is 1.0.\n * Excessive zoom factors (below 0.1 or above 10.0) are not recommended.\n * Using {@link PdfViewing.Pdf.View.zoomOnLocation } can be used to get finer control on what the viewport is focused on during zooming.\n * If setting zoom directly, top-left of the viewport is used as a focus point.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get zoom() {\n let retVal = Module.ViewingPdfViewGetZoom(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The current zoom factor.\n * Default is 1.0.\n * Excessive zoom factors (below 0.1 or above 10.0) are not recommended.\n * Using {@link PdfViewing.Pdf.View.zoomOnLocation } can be used to get finer control on what the viewport is focused on during zooming.\n * If setting zoom directly, top-left of the viewport is used as a focus point.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set zoom(zoom) {\n if (typeof zoom !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'zoom' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetZoom(this.handle, zoom);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The current x/y coordinates at which the viewport is located.\n * Determines scrollbar location in relation to scrollbar length,\n * which is given by {@link PdfViewing.Pdf.View.scrollMaxPosition }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get scrollPosition() {\n let retVal = Module.ViewingPdfViewGetScrollPosition(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.ScrollPosition(retVal.x, retVal.y);\n }\n /**\n * The current x/y coordinates at which the viewport is located.\n * Determines scrollbar location in relation to scrollbar length,\n * which is given by {@link PdfViewing.Pdf.View.scrollMaxPosition }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set scrollPosition(scrollPosition) {\n if (typeof scrollPosition !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'scrollPosition' must be of type PdfViewing.Pdf.Geometry.Integer.ScrollPosition and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetScrollPosition(this.handle, scrollPosition);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The maximum x/y coordinates that can be scrolled to.\n * Determines scrollbar ranges.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get scrollMaxPosition() {\n let retVal = Module.ViewingPdfViewGetScrollMaxPosition(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.ScrollPosition(retVal.x, retVal.y);\n }\n /**\n * Rotate all pages to a specific orientation.\n * Default is {@link PdfViewing.Pdf.Geometry.Rotation.NoRotation }\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get viewRotation() {\n let retVal = Module.ViewingPdfViewGetViewRotation(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Rotate all pages to a specific orientation.\n * Default is {@link PdfViewing.Pdf.Geometry.Rotation.NoRotation }\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set viewRotation(viewRotation) {\n if (typeof viewRotation !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'viewRotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetViewRotation(this.handle, viewRotation);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The {@link PdfViewing.Pdf.Navigation.FitMode } used to fit the viewport onto the document.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get fitMode() {\n let retVal = Module.ViewingPdfViewGetFitMode(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The {@link PdfViewing.Pdf.Navigation.FitMode } used to fit the viewport onto the document.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set fitMode(fitMode) {\n if (typeof fitMode !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'fitMode' must be of type PdfViewing.Pdf.Navigation.FitMode and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetFitMode(this.handle, fitMode);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The {@link PdfViewing.Pdf.Navigation.PageLayoutMode } used to arrange pages on the viewport.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get pageLayoutMode() {\n let retVal = Module.ViewingPdfViewGetPageLayoutMode(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The {@link PdfViewing.Pdf.Navigation.PageLayoutMode } used to arrange pages on the viewport.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set pageLayoutMode(pageLayoutMode) {\n if (typeof pageLayoutMode !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageLayoutMode' must be of type PdfViewing.Pdf.Navigation.PageLayoutMode and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetPageLayoutMode(this.handle, pageLayoutMode);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The size of the border in pixels in between pages when rendered on viewport. Default: 10px.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get borderSize() {\n let retVal = Module.ViewingPdfViewGetBorderSize(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The size of the border in pixels in between pages when rendered on viewport. Default: 10px.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} If the given value was smaller than 0\n */\n set borderSize(borderSize) {\n if (typeof borderSize !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'borderSize' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetBorderSize(this.handle, borderSize);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The size of the margin in pixels around the canvas. Default: 5px in all directions.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get canvasMargin() {\n let retVal = Module.ViewingPdfViewGetCanvasMargin(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.Padding(retVal.left, retVal.right, retVal.top, retVal.bottom);\n }\n /**\n * The size of the margin in pixels around the canvas. Default: 5px in all directions.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} If the given value was smaller than 0\n */\n set canvasMargin(canvasMargin) {\n if (typeof canvasMargin !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'canvasMargin' must be of type PdfViewing.Pdf.Geometry.Integer.Padding and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetCanvasMargin(this.handle, canvasMargin);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The Dots Per Inch of the used screen. Default `96.0`.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get screenDPI() {\n let retVal = Module.ViewingPdfViewGetScreenDPI(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The Dots Per Inch of the used screen. Default `96.0`.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set screenDPI(screenDPI) {\n if (typeof screenDPI !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'screenDPI' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetScreenDPI(this.handle, screenDPI);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The {@link PdfViewing.Pdf.Content.Byteorder } used for rendered images.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get byteorder() {\n let retVal = Module.ViewingPdfViewGetByteorder(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The {@link PdfViewing.Pdf.Content.Byteorder } used for rendered images.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set byteorder(byteorder) {\n if (typeof byteorder !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'byteorder' must be of type PdfViewing.Pdf.Content.Byteorder and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetByteorder(this.handle, byteorder);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The size of the viewport for this view.\n * Default: 720 x 480 pixels.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get viewportSize() {\n let retVal = Module.ViewingPdfViewGetViewportSize(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.Size(retVal.width, retVal.height);\n }\n /**\n * The size of the viewport for this view.\n * Default: 720 x 480 pixels.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set viewportSize(viewportSize) {\n if (typeof viewportSize !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'viewportSize' must be of type PdfViewing.Pdf.Geometry.Integer.Size and must not be null or undefined.\");\n let retVal = Module.ViewingPdfViewSetViewportSize(this.handle, viewportSize);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Pdf.View = View;\n class EventViewNativeBase {\n constructor(listener) {\n this.listener = listener;\n }\n }\n class ViewUpdatedNativeClass extends EventViewNativeBase {\n constructor(listener) {\n super(listener);\n }\n dispatchEventViewUpdated(visisblePageRangeChanged, pageNumberChanged, zoomChanged, fitmodeChanged, pageLayoutModeChanged, viewRotationChanged, scrollMaxPositionChanged, pageSizeUpdated, bitmapsUpdated) {\n this.listener({\n visisblePageRangeChanged,\n pageNumberChanged,\n zoomChanged,\n fitmodeChanged,\n pageLayoutModeChanged,\n viewRotationChanged,\n scrollMaxPositionChanged,\n pageSizeUpdated,\n bitmapsUpdated,\n });\n }\n }\n class ImageCreatedNativeClass extends EventViewNativeBase {\n constructor(listener) {\n super(listener);\n }\n dispatchEventImageCreated(image) {\n this.listener(PdfViewing.Pdf.Content.Image.createDynamicObject(image));\n }\n }\n class ImageRemovedFromCacheNativeClass extends EventViewNativeBase {\n constructor(listener) {\n super(listener);\n }\n dispatchEventImageRemovedFromCache(Id) {\n this.listener(Id);\n }\n }\n let Annotations;\n (function (Annotations) {\n /**\n *\n */\n class Color extends Internal.NativeBase {\n constructor(red, green, blue, alpha) {\n super();\n if (typeof red !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'red' must be of type number and must not be null or undefined.\");\n if (typeof green !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'green' must be of type number and must not be null or undefined.\");\n if (typeof blue !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'blue' must be of type number and must not be null or undefined.\");\n if (typeof alpha !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'alpha' must be of type number and must not be null or undefined.\");\n this.red = red;\n this.green = green;\n this.blue = blue;\n this.alpha = alpha;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.red !== obj.red)\n return false;\n if (this.green !== obj.green)\n return false;\n if (this.blue !== obj.blue)\n return false;\n if (this.alpha !== obj.alpha)\n return false;\n return true;\n }\n }\n Annotations.Color = Color;\n /**\n *\n * Specifies the text displayed for predefined {@link PdfViewing.Pdf.Annotations.TextStamp }s.\n */\n let TextStampType;\n (function (TextStampType) {\n /**\n *\n */\n TextStampType[TextStampType[\"Approved\"] = 0] = \"Approved\";\n /**\n *\n */\n TextStampType[TextStampType[\"Experimental\"] = 1] = \"Experimental\";\n /**\n *\n */\n TextStampType[TextStampType[\"NotApproved\"] = 2] = \"NotApproved\";\n /**\n *\n */\n TextStampType[TextStampType[\"AsIs\"] = 3] = \"AsIs\";\n /**\n *\n */\n TextStampType[TextStampType[\"Expired\"] = 4] = \"Expired\";\n /**\n *\n */\n TextStampType[TextStampType[\"NotForPublicRelease\"] = 5] = \"NotForPublicRelease\";\n /**\n *\n */\n TextStampType[TextStampType[\"Confidential\"] = 6] = \"Confidential\";\n /**\n *\n */\n TextStampType[TextStampType[\"Final\"] = 7] = \"Final\";\n /**\n *\n */\n TextStampType[TextStampType[\"Sold\"] = 8] = \"Sold\";\n /**\n *\n */\n TextStampType[TextStampType[\"Departmental\"] = 9] = \"Departmental\";\n /**\n *\n */\n TextStampType[TextStampType[\"ForComment\"] = 10] = \"ForComment\";\n /**\n *\n */\n TextStampType[TextStampType[\"TopSecret\"] = 11] = \"TopSecret\";\n /**\n *\n */\n TextStampType[TextStampType[\"Draft\"] = 12] = \"Draft\";\n /**\n *\n */\n TextStampType[TextStampType[\"ForPublicRelease\"] = 13] = \"ForPublicRelease\";\n })(TextStampType = Annotations.TextStampType || (Annotations.TextStampType = {}));\n /**\n *\n * Stamp color used for the appearance generation of {@link PdfViewing.Pdf.Annotations.CustomTextStamp }.\n */\n let StampColor;\n (function (StampColor) {\n /**\n *\n */\n StampColor[StampColor[\"Green\"] = 0] = \"Green\";\n /**\n *\n */\n StampColor[StampColor[\"Red\"] = 1] = \"Red\";\n /**\n *\n */\n StampColor[StampColor[\"Blue\"] = 2] = \"Blue\";\n })(StampColor = Annotations.StampColor || (Annotations.StampColor = {}));\n /**\n *\n * Specifies the type of icon displayed on a page for a {@link PdfViewing.Pdf.Annotations.FileAttachment }.\n */\n let FileAttachmentIcon;\n (function (FileAttachmentIcon) {\n /**\n *\n */\n FileAttachmentIcon[FileAttachmentIcon[\"Graph\"] = 0] = \"Graph\";\n /**\n *\n */\n FileAttachmentIcon[FileAttachmentIcon[\"PushPin\"] = 1] = \"PushPin\";\n /**\n *\n */\n FileAttachmentIcon[FileAttachmentIcon[\"Paperclip\"] = 2] = \"Paperclip\";\n /**\n *\n */\n FileAttachmentIcon[FileAttachmentIcon[\"Tag\"] = 3] = \"Tag\";\n /**\n *\n */\n FileAttachmentIcon[FileAttachmentIcon[\"CustomIcon\"] = 127] = \"CustomIcon\";\n })(FileAttachmentIcon = Annotations.FileAttachmentIcon || (Annotations.FileAttachmentIcon = {}));\n /**\n *\n * Specifies the type of styling used for the border of the annotation.\n */\n let BorderStyleType;\n (function (BorderStyleType) {\n /**\n *\n */\n BorderStyleType[BorderStyleType[\"Lined\"] = 0] = \"Lined\";\n /**\n *\n */\n BorderStyleType[BorderStyleType[\"Beveled\"] = 1] = \"Beveled\";\n /**\n *\n */\n BorderStyleType[BorderStyleType[\"Inset\"] = 2] = \"Inset\";\n /**\n *\n */\n BorderStyleType[BorderStyleType[\"Underline\"] = 3] = \"Underline\";\n })(BorderStyleType = Annotations.BorderStyleType || (Annotations.BorderStyleType = {}));\n /**\n *\n * Specifies the type of line termination for line and poly-line annotations.\n */\n let LineEnding;\n (function (LineEnding) {\n /**\n *\n */\n LineEnding[LineEnding[\"None\"] = 0] = \"None\";\n /**\n *\n */\n LineEnding[LineEnding[\"OpenArrow\"] = 1] = \"OpenArrow\";\n /**\n *\n */\n LineEnding[LineEnding[\"ClosedArrow\"] = 2] = \"ClosedArrow\";\n /**\n *\n */\n LineEnding[LineEnding[\"rectangle\"] = 3] = \"rectangle\";\n /**\n *\n */\n LineEnding[LineEnding[\"Circle\"] = 4] = \"Circle\";\n /**\n *\n */\n LineEnding[LineEnding[\"Diamond\"] = 5] = \"Diamond\";\n /**\n *\n */\n LineEnding[LineEnding[\"Butt\"] = 6] = \"Butt\";\n /**\n *\n */\n LineEnding[LineEnding[\"ReversedOpenArrow\"] = 7] = \"ReversedOpenArrow\";\n /**\n *\n */\n LineEnding[LineEnding[\"ReversedClosedArrow\"] = 8] = \"ReversedClosedArrow\";\n /**\n *\n */\n LineEnding[LineEnding[\"Slash\"] = 9] = \"Slash\";\n })(LineEnding = Annotations.LineEnding || (Annotations.LineEnding = {}));\n /**\n * A page annotation\n *\n */\n class Annotation extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfAnnotsAnnotationGetType(handle);\n switch (type) {\n case 0:\n return new Annotation(handle);\n case 1:\n return PdfViewing.Pdf.Annotations.MarkupAnnotation.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Annotations.StickyNote.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Annotations.FileAttachment.createDynamicObject(handle);\n case 4:\n return PdfViewing.Pdf.Annotations.Stamp.createDynamicObject(handle);\n case 5:\n return PdfViewing.Pdf.Annotations.TextStamp.createDynamicObject(handle);\n case 6:\n return PdfViewing.Pdf.Annotations.CustomTextStamp.createDynamicObject(handle);\n case 7:\n return PdfViewing.Pdf.Annotations.CustomImageStamp.createDynamicObject(handle);\n case 8:\n return PdfViewing.Pdf.Annotations.FreeText.createDynamicObject(handle);\n case 9:\n return PdfViewing.Pdf.Annotations.DrawingAnnotation.createDynamicObject(handle);\n case 10:\n return PdfViewing.Pdf.Annotations.LineAnnotation.createDynamicObject(handle);\n case 11:\n return PdfViewing.Pdf.Annotations.InkAnnotation.createDynamicObject(handle);\n case 12:\n return PdfViewing.Pdf.Annotations.PolyLineAnnotation.createDynamicObject(handle);\n case 13:\n return PdfViewing.Pdf.Annotations.PolygonAnnotation.createDynamicObject(handle);\n case 14:\n return PdfViewing.Pdf.Annotations.RectangleAnnotation.createDynamicObject(handle);\n case 15:\n return PdfViewing.Pdf.Annotations.EllipseAnnotation.createDynamicObject(handle);\n case 16:\n return PdfViewing.Pdf.Annotations.TextMarkup.createDynamicObject(handle);\n case 17:\n return PdfViewing.Pdf.Annotations.Highlight.createDynamicObject(handle);\n case 18:\n return PdfViewing.Pdf.Annotations.Underline.createDynamicObject(handle);\n case 19:\n return PdfViewing.Pdf.Annotations.StrikeThrough.createDynamicObject(handle);\n case 20:\n return PdfViewing.Pdf.Annotations.Squiggly.createDynamicObject(handle);\n case 21:\n return PdfViewing.Pdf.Annotations.TextInsert.createDynamicObject(handle);\n case 22:\n return PdfViewing.Pdf.Annotations.Link.createDynamicObject(handle);\n case 23:\n return PdfViewing.Pdf.Annotations.InternalLink.createDynamicObject(handle);\n case 24:\n return PdfViewing.Pdf.Annotations.WebLink.createDynamicObject(handle);\n case 25:\n return PdfViewing.Pdf.Annotations.EmbeddedPdfLink.createDynamicObject(handle);\n case 26:\n return PdfViewing.Pdf.Forms.Widget.createDynamicObject(handle);\n case 27:\n return PdfViewing.Pdf.Forms.CheckBox.createDynamicObject(handle);\n case 28:\n return PdfViewing.Pdf.Forms.RadioButton.createDynamicObject(handle);\n case 29:\n return PdfViewing.Pdf.Forms.TextBox.createDynamicObject(handle);\n case 30:\n return PdfViewing.Pdf.Forms.ListBox.createDynamicObject(handle);\n case 31:\n return PdfViewing.Pdf.Forms.ComboBox.createDynamicObject(handle);\n default:\n return new Annotation(handle);\n }\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfAnnotsAnnotationClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * The location on the page (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get boundingBox() {\n let retVal = Module.ViewingPdfAnnotsAnnotationGetBoundingBox(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(retVal.pageNumber, retVal.x, retVal.y, retVal.width, retVal.height);\n }\n /**\n * The location on the page (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set boundingBox(boundingBox) {\n if (typeof boundingBox !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsAnnotationSetBoundingBox(this.handle, boundingBox);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The annotation's visibility (Getter)\n *\n * If `true` then the annotation is present, but is invisible and not available for user interaction.\n * Depending on the {@link PdfViewing.Pdf.Annotations.Annotation.noPrint } property it will, however, still be visible when printing.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get hidden() {\n let retVal = Module.ViewingPdfAnnotsAnnotationGetHidden(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The annotation's visibility (Setter)\n *\n * If `true` then the annotation is present, but is invisible and not available for user interaction.\n * Depending on the {@link PdfViewing.Pdf.Annotations.Annotation.noPrint } property it will, however, still be visible when printing.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set hidden(hidden) {\n if (typeof hidden !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'hidden' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsAnnotationSetHidden(this.handle, hidden);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The annotation's visibility when printing (Getter)\n *\n * If `true` then the annotation is not present in a print output of the document.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get noPrint() {\n let retVal = Module.ViewingPdfAnnotsAnnotationGetNoPrint(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The annotation's visibility when printing (Setter)\n *\n * If `true` then the annotation is not present in a print output of the document.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set noPrint(noPrint) {\n if (typeof noPrint !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'noPrint' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsAnnotationSetNoPrint(this.handle, noPrint);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The annotation's scaling behavior (Getter)\n *\n * If `true` then the annotation's visual appearance does not scale with the zoom factor of a PDF viewer.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get noZoom() {\n let retVal = Module.ViewingPdfAnnotsAnnotationGetNoZoom(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The annotation's rotation behavior (Getter)\n *\n * If `true` then the annotation's visual appearance does not rotate with the rotation set in a PDF viewer.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get noRotate() {\n let retVal = Module.ViewingPdfAnnotsAnnotationGetNoRotate(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The annotation's rotation behavior (Setter)\n *\n * If `true` then the annotation's visual appearance does not rotate with the rotation set in a PDF viewer.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set noRotate(noRotate) {\n if (typeof noRotate !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'noRotate' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsAnnotationSetNoRotate(this.handle, noRotate);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The name by which the annotation is referred to.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get name() {\n let retVal = Module.ViewingPdfAnnotsAnnotationGetName(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * Private, do not use.\n */\n get privateData() {\n let retVal = Module.ViewingPdfAnnotsAnnotationGetPrivateData(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * Private, do not use.\n */\n set privateData(privateData) {\n if (typeof privateData !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'privateData' must be of type string and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsAnnotationSetPrivateData(this.handle, privateData);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Tag that identifies the source the annotation is coming from.\n * If the source is an input PDF or an input FDF, the tag comes from {@link PdfViewing.IO.InputDocument.sourceTag }.\n * Newly created annotations always return `null`.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get sourceTag() {\n let retVal = Module.ViewingPdfAnnotsAnnotationGetSourceTag(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Annotations.Annotation = Annotation;\n /**\n * Information for a markup annotation\n *\n * Holds information contained in a markup annotation or in a reply to a markup annotation.\n */\n class MarkupInfo extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new MarkupInfo(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfAnnotsMarkupInfoClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * The date of creation (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get creationDate() {\n let retVal = Module.ViewingPdfAnnotsMarkupInfoGetCreationDate(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The date of last modification (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get modificationDate() {\n let retVal = Module.ViewingPdfAnnotsMarkupInfoGetModificationDate(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Whether the content can be modified (Getter)\n *\n * This does not restrict the modification of other aspects of the annotation or its deletion.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get locked() {\n let retVal = Module.ViewingPdfAnnotsMarkupInfoGetLocked(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Whether the content can be modified (Setter)\n *\n * This does not restrict the modification of other aspects of the annotation or its deletion.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set locked(locked) {\n if (typeof locked !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'locked' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsMarkupInfoSetLocked(this.handle, locked);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The author (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get author() {\n let retVal = Module.ViewingPdfAnnotsMarkupInfoGetAuthor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * The author (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set author(author) {\n if (typeof author !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'author' must be of type string and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsMarkupInfoSetAuthor(this.handle, author);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The subject (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get subject() {\n let retVal = Module.ViewingPdfAnnotsMarkupInfoGetSubject(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * The subject (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set subject(subject) {\n if (typeof subject !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'subject' must be of type string and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsMarkupInfoSetSubject(this.handle, subject);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The information content (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get content() {\n let retVal = Module.ViewingPdfAnnotsMarkupInfoGetContent(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * The information content (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set content(content) {\n if (typeof content !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'content' must be of type string and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsMarkupInfoSetContent(this.handle, content);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.MarkupInfo = MarkupInfo;\n /**\n *\n */\n class MarkupInfoList extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new MarkupInfoList(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfAnnotsMarkupInfoListClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n throw new Error('Method not implemented.');\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingPdfAnnotsMarkupInfoListGet(this.handle, index);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.MarkupInfo.createDynamicObject(retVal);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingPdfAnnotsMarkupInfoListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Annotations.MarkupInfoList = MarkupInfoList;\n /**\n * A pop-up for a markup annotation\n *\n */\n class Popup extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new Popup(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfAnnotsPopupClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * The pop-up's visibility state (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get isOpen() {\n let retVal = Module.ViewingPdfAnnotsPopupGetIsOpen(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The pop-up's visibility state (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set isOpen(isOpen) {\n if (typeof isOpen !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'isOpen' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsPopupSetIsOpen(this.handle, isOpen);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The pop-up location (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get boundingBox() {\n let retVal = Module.ViewingPdfAnnotsPopupGetBoundingBox(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(retVal.pageNumber, retVal.x, retVal.y, retVal.width, retVal.height);\n }\n /**\n * The pop-up location (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set boundingBox(boundingBox) {\n if (typeof boundingBox !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsPopupSetBoundingBox(this.handle, boundingBox);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.Popup = Popup;\n /**\n * A markup annotation\n *\n */\n class MarkupAnnotation extends PdfViewing.Pdf.Annotations.Annotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfAnnotsMarkupAnnotationGetType(handle);\n switch (type) {\n case 0:\n return new MarkupAnnotation(handle);\n case 1:\n return PdfViewing.Pdf.Annotations.StickyNote.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Annotations.FileAttachment.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Annotations.Stamp.createDynamicObject(handle);\n case 4:\n return PdfViewing.Pdf.Annotations.TextStamp.createDynamicObject(handle);\n case 5:\n return PdfViewing.Pdf.Annotations.CustomTextStamp.createDynamicObject(handle);\n case 6:\n return PdfViewing.Pdf.Annotations.CustomImageStamp.createDynamicObject(handle);\n case 7:\n return PdfViewing.Pdf.Annotations.FreeText.createDynamicObject(handle);\n case 8:\n return PdfViewing.Pdf.Annotations.DrawingAnnotation.createDynamicObject(handle);\n case 9:\n return PdfViewing.Pdf.Annotations.LineAnnotation.createDynamicObject(handle);\n case 10:\n return PdfViewing.Pdf.Annotations.InkAnnotation.createDynamicObject(handle);\n case 11:\n return PdfViewing.Pdf.Annotations.PolyLineAnnotation.createDynamicObject(handle);\n case 12:\n return PdfViewing.Pdf.Annotations.PolygonAnnotation.createDynamicObject(handle);\n case 13:\n return PdfViewing.Pdf.Annotations.RectangleAnnotation.createDynamicObject(handle);\n case 14:\n return PdfViewing.Pdf.Annotations.EllipseAnnotation.createDynamicObject(handle);\n case 15:\n return PdfViewing.Pdf.Annotations.TextMarkup.createDynamicObject(handle);\n case 16:\n return PdfViewing.Pdf.Annotations.Highlight.createDynamicObject(handle);\n case 17:\n return PdfViewing.Pdf.Annotations.Underline.createDynamicObject(handle);\n case 18:\n return PdfViewing.Pdf.Annotations.StrikeThrough.createDynamicObject(handle);\n case 19:\n return PdfViewing.Pdf.Annotations.Squiggly.createDynamicObject(handle);\n case 20:\n return PdfViewing.Pdf.Annotations.TextInsert.createDynamicObject(handle);\n default:\n return new MarkupAnnotation(handle);\n }\n }\n /**\n * Whether the markup annotation can be modified (Getter)\n *\n * This does not restrict modification of the markup annotation's content.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get locked() {\n let retVal = Module.ViewingPdfAnnotsMarkupAnnotationGetLocked(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The information content of this markup (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get info() {\n let retVal = Module.ViewingPdfAnnotsMarkupAnnotationGetInfo(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.MarkupInfo.createDynamicObject(retVal);\n }\n /**\n * The replies to this markup (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get replies() {\n let retVal = Module.ViewingPdfAnnotsMarkupAnnotationGetReplies(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.MarkupInfoList.createDynamicObject(retVal);\n }\n }\n Annotations.MarkupAnnotation = MarkupAnnotation;\n /**\n * A sticky note annotation\n *\n */\n class StickyNote extends PdfViewing.Pdf.Annotations.MarkupAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new StickyNote(handle);\n }\n /**\n * Create a sticky note annotation.\n *\n * The returned sticky note annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param topLeft\n * The location of the annotation's upper left corner on the page.\n * @param content\n * The text content\n * @param color\n * The paint for the sticky note icon and popup.\n * If `null` then a default paint is used.\n * @returns\n * The newly created sticky note annotation\n */\n static create(topLeft, content, color) {\n if (typeof topLeft !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'topLeft' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n if (typeof content !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'content' must be of type string and must not be null or undefined.\");\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsStickyNoteCreate(topLeft, content, color);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.StickyNote.createDynamicObject(retVal);\n }\n /**\n * The paint for the sticky note icon and the popup (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get color() {\n let retVal = Module.ViewingPdfAnnotsStickyNoteGetColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n /**\n * The paint for the sticky note icon and the popup (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set color(color) {\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsStickyNoteSetColor(this.handle, color);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The pop-up (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get popup() {\n let retVal = Module.ViewingPdfAnnotsStickyNoteGetPopup(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0 ? PdfViewing.Pdf.Annotations.Popup.createDynamicObject(retVal) : null;\n }\n }\n Annotations.StickyNote = StickyNote;\n /**\n * A file attachment annotation\n *\n */\n class FileAttachment extends PdfViewing.Pdf.Annotations.MarkupAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new FileAttachment(handle);\n }\n /**\n * The displayed icon (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get icon() {\n let retVal = Module.ViewingPdfAnnotsFileAttachmentGetIcon(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The paint for the icon and the popup (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get color() {\n let retVal = Module.ViewingPdfAnnotsFileAttachmentGetColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n /**\n * The paint for the icon and the popup (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set color(color) {\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsFileAttachmentSetColor(this.handle, color);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The pop-up (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get popup() {\n let retVal = Module.ViewingPdfAnnotsFileAttachmentGetPopup(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0 ? PdfViewing.Pdf.Annotations.Popup.createDynamicObject(retVal) : null;\n }\n }\n Annotations.FileAttachment = FileAttachment;\n /**\n * A stamp annotation\n *\n */\n class Stamp extends PdfViewing.Pdf.Annotations.MarkupAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfAnnotsStampGetType(handle);\n switch (type) {\n case 0:\n return new Stamp(handle);\n case 1:\n return PdfViewing.Pdf.Annotations.TextStamp.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Annotations.CustomTextStamp.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Annotations.CustomImageStamp.createDynamicObject(handle);\n default:\n return new Stamp(handle);\n }\n }\n /**\n * The pop-up (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get popup() {\n let retVal = Module.ViewingPdfAnnotsStampGetPopup(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0 ? PdfViewing.Pdf.Annotations.Popup.createDynamicObject(retVal) : null;\n }\n /**\n * The paint for the popup (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get color() {\n let retVal = Module.ViewingPdfAnnotsStampGetColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n /**\n * The paint for the popup (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set color(color) {\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsStampSetColor(this.handle, color);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Rotation in relation to the page.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get rotation() {\n let retVal = Module.ViewingPdfAnnotsStampGetRotation(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Rotation in relation to the page.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set rotation(rotation) {\n if (typeof rotation !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsStampSetRotation(this.handle, rotation);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.Stamp = Stamp;\n /**\n * A text stamp annotation\n *\n */\n class TextStamp extends PdfViewing.Pdf.Annotations.Stamp {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new TextStamp(handle);\n }\n /**\n * Create a text stamp annotation.\n *\n * The width of the annotation is computed from the given stamp text.\n * The returned text stamp annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param topLeft\n * The location of the annotation's upper left corner on the page.\n * @param height\n * The height of the annotation.\n * @param textType\n * The text stamp type.\n * @param text\n * The text to be shown in this stamp.\n * @param rotation\n * The rotation of the annotation in relation to the unrotated view.\n * The annotation is created with a compensating (and hence opposite) {@link PdfViewing.Pdf.Annotations.Stamp.rotation },\n * such that it is upright and readable when viewing the document with said view rotation.\n * @returns\n * The newly created text stamp annotation.\n */\n static createRaw(topLeft, height, textType, text, rotation) {\n if (typeof topLeft !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'topLeft' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n if (height !== null && height !== undefined && typeof height !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'height' must be of type number or can be null or undefined.\");\n if (typeof textType !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'textType' must be of type PdfViewing.Pdf.Annotations.TextStampType and must not be null or undefined.\");\n if (typeof text !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'text' must be of type string and must not be null or undefined.\");\n if (typeof rotation !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsTextStampCreateRaw(topLeft, height, textType, text, rotation);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.TextStamp.createDynamicObject(retVal);\n }\n /**\n * The displayed text (Getter)\n *\n * This defines a predefined text for this text stamp.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.UnsupportedFeatureError} The text stamp's type is not supported.\n */\n get textType() {\n let retVal = Module.ViewingPdfAnnotsTextStampGetTextType(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Annotations.TextStamp = TextStamp;\n /**\n * A stamp annotation with user defined stamp text\n *\n */\n class CustomTextStamp extends PdfViewing.Pdf.Annotations.Stamp {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new CustomTextStamp(handle);\n }\n /**\n * Create a custom stamp annotation.\n *\n * The returned custom Textstamp annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * The custom stamp annotation's appearance is generated after it was added to a page.\n * @param boundingBox\n * The location of the annotation on the page.\n * Use {@link PdfViewing.Pdf.Document.getTextStampAspectRatio } to obtain the correct aspect ratio of width divided by height of the {@link PdfViewing.Pdf.Annotations.CustomTextStamp.create boundingBox}\n * @param stampText\n * The custom stamp text\n * @param stampColor\n * The color of the stamp appearance\n * @param rotation\n * The rotation of the annotation in relation to the unrotated view.\n * The annotation is created with a compensating (and hence opposite) {@link PdfViewing.Pdf.Annotations.Stamp.rotation },\n * such that it is upright and readable when viewing the document with said view rotation.\n * @returns\n * The newly created custom text stamp annotation.\n */\n static create(boundingBox, stampText, stampColor, rotation) {\n if (typeof boundingBox !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n if (typeof stampText !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'stampText' must be of type string and must not be null or undefined.\");\n if (typeof stampColor !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'stampColor' must be of type PdfViewing.Pdf.Annotations.StampColor and must not be null or undefined.\");\n if (typeof rotation !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsCustomTextStampCreate(boundingBox, stampText, stampColor, rotation);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.CustomTextStamp.createDynamicObject(retVal);\n }\n }\n Annotations.CustomTextStamp = CustomTextStamp;\n /**\n * A stamp annotatation based on an image\n *\n */\n class CustomImageStamp extends PdfViewing.Pdf.Annotations.Stamp {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new CustomImageStamp(handle);\n }\n /**\n * Create a custom stamp annotation.\n *\n * The returned custom Imagestamp annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * The custom stamp annotation's appearance is generated after it was added to a page.\n * @param boundingBox\n * The location of the annotation on the page.\n * For registered images the correct aspect ratio can be derived from the given image.\n * When creating the stamp from a PDF Page, the aspect ratio can be derived from the size of the page that was copied using {@link PdfViewing.Pdf.Document.getPagePdfSize }\n * @param imageId\n * The ID of an image that is already registered in the Document.\n * Image ID's can be generated from images using {@link PdfViewing.Pdf.Document.registerImage } or from a PDF Page using {@link PdfViewing.Pdf.Document.registerPdfPage }\n * @param rotation\n * The rotation of the annotation in relation to the unrotated view.\n * The annotation is created with a compensating (and hence opposite) {@link PdfViewing.Pdf.Annotations.Stamp.rotation },\n * such that it is upright and readable when viewing the document with said view rotation.\n * @returns\n * The newly created custom text stamp annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.CustomImageStamp.create imageId} argument is invalid\n */\n static create(boundingBox, imageId, rotation) {\n if (typeof boundingBox !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n if (typeof imageId !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'imageId' must be of type number and must not be null or undefined.\");\n if (typeof rotation !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsCustomImageStampCreate(boundingBox, imageId, rotation);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.CustomImageStamp.createDynamicObject(retVal);\n }\n }\n Annotations.CustomImageStamp = CustomImageStamp;\n /**\n * An annotation that displays text\n *\n * For a free-text annotation, the annotation's content is used as text to be displayed as the annotation's visual manifestation on the page.\n */\n class FreeText extends PdfViewing.Pdf.Annotations.MarkupAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new FreeText(handle);\n }\n /**\n * Create a free-text annotation.\n *\n * The returned free-text annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param boundingBox\n * The location on the page.\n * @param richText\n * The Richtextstring describing content, color and font.\n * @param backgroundColor\n * The background color of the freetext annotation. Passing null results in a transparent background.\n * @param annotationStroke\n * The stroking style for all lines\n * @param viewRotation\n * The rotation of the view, see {@link PdfViewing.Pdf.View.viewRotation }.\n * The annotation is created with a compensating (and hence opposite) {@link PdfViewing.Pdf.Annotations.FreeText.rotation },\n * such that it is upright and readable when viewing the document with said view rotation.\n * @returns\n * The newly created free text annotation.\n */\n static create(boundingBox, richText, backgroundColor, annotationStroke, viewRotation) {\n if (typeof boundingBox !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n if (typeof richText !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'richText' must be of type string and must not be null or undefined.\");\n if (backgroundColor !== null &&\n backgroundColor !== undefined &&\n typeof backgroundColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'backgroundColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n if (typeof viewRotation !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'viewRotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsFreeTextCreate(boundingBox, richText, backgroundColor, annotationStroke.handle, viewRotation);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.FreeText.createDynamicObject(retVal);\n }\n /**\n * The stroking style for all lines. (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get annotationStroke() {\n let retVal = Module.ViewingPdfAnnotsFreeTextGetAnnotationStroke(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.AnnotationStroke.createDynamicObject(retVal);\n }\n /**\n * The stroking style for all lines. (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set annotationStroke(annotationStroke) {\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsFreeTextSetAnnotationStroke(this.handle, annotationStroke.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The information content (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get richText() {\n let retVal = Module.ViewingPdfAnnotsFreeTextGetRichText(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * The information content (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set richText(richText) {\n if (typeof richText !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'richText' must be of type string and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsFreeTextSetRichText(this.handle, richText);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The background color (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get backgroundColor() {\n let retVal = Module.ViewingPdfAnnotsFreeTextGetBackgroundColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal !== null\n ? new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha)\n : null;\n }\n /**\n * The background color (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set backgroundColor(backgroundColor) {\n if (backgroundColor !== null &&\n backgroundColor !== undefined &&\n typeof backgroundColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'backgroundColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsFreeTextSetBackgroundColor(this.handle, backgroundColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Rotation in relation to the page.\n * When creating the annotation with a non-zero view rotation in {@link PdfViewing.Pdf.Annotations.FreeText.create },\n * then this property will initially be the opposite of the given view rotation.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get rotation() {\n let retVal = Module.ViewingPdfAnnotsFreeTextGetRotation(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Rotation in relation to the page.\n * When creating the annotation with a non-zero view rotation in {@link PdfViewing.Pdf.Annotations.FreeText.create },\n * then this property will initially be the opposite of the given view rotation.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set rotation(rotation) {\n if (typeof rotation !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsFreeTextSetRotation(this.handle, rotation);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.FreeText = FreeText;\n /**\n * A drawing annotation\n *\n * An annotation used to draws something on a page.\n */\n class DrawingAnnotation extends PdfViewing.Pdf.Annotations.MarkupAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfAnnotsDrawingAnnotationGetType(handle);\n switch (type) {\n case 0:\n return new DrawingAnnotation(handle);\n case 1:\n return PdfViewing.Pdf.Annotations.LineAnnotation.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Annotations.InkAnnotation.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Annotations.PolyLineAnnotation.createDynamicObject(handle);\n case 4:\n return PdfViewing.Pdf.Annotations.PolygonAnnotation.createDynamicObject(handle);\n case 5:\n return PdfViewing.Pdf.Annotations.RectangleAnnotation.createDynamicObject(handle);\n case 6:\n return PdfViewing.Pdf.Annotations.EllipseAnnotation.createDynamicObject(handle);\n default:\n return new DrawingAnnotation(handle);\n }\n }\n /**\n * The color used for any stroking and the popup.\n * The value `null` renders the color completely transparent.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get strokeColor() {\n let retVal = Module.ViewingPdfAnnotsDrawingAnnotationGetStrokeColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal !== null\n ? new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha)\n : null;\n }\n /**\n * The color used for any stroking and the popup.\n * The value `null` renders the color completely transparent.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set strokeColor(strokeColor) {\n if (strokeColor !== null && strokeColor !== undefined && typeof strokeColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsDrawingAnnotationSetStrokeColor(this.handle, strokeColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The stroking style for all lines. (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get annotationStroke() {\n let retVal = Module.ViewingPdfAnnotsDrawingAnnotationGetAnnotationStroke(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0\n ? PdfViewing.Pdf.Annotations.AnnotationStroke.createDynamicObject(retVal)\n : null;\n }\n /**\n * The stroking style for all lines. (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set annotationStroke(annotationStroke) {\n if (annotationStroke !== null &&\n annotationStroke !== undefined &&\n !(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsDrawingAnnotationSetAnnotationStroke(this.handle, annotationStroke !== null && annotationStroke !== undefined\n ? annotationStroke.handle\n : 0);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The pop-up (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get popup() {\n let retVal = Module.ViewingPdfAnnotsDrawingAnnotationGetPopup(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0 ? PdfViewing.Pdf.Annotations.Popup.createDynamicObject(retVal) : null;\n }\n /**\n * The drawing path (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get path() {\n let retVal = Module.ViewingPdfAnnotsDrawingAnnotationGetPath(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Geometry.Real.Path.createDynamicObject(retVal);\n }\n }\n Annotations.DrawingAnnotation = DrawingAnnotation;\n /**\n * A line annotation\n *\n * An annotation that draws a line on a page.\n */\n class LineAnnotation extends PdfViewing.Pdf.Annotations.DrawingAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new LineAnnotation(handle);\n }\n /**\n * Create a line annotation.\n *\n * The returned line annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param start\n * The line's start point.\n * @param end\n * The line's end point.\n * @param strokeColor\n * The color used for stroking and the popup. Pass `null` to set default grey color.\n * @param annotationStroke\n * The stroking style for all lines\n * @returns\n * The newly created line annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if points {@link PdfViewing.Pdf.Annotations.LineAnnotation.create start} and {@link PdfViewing.Pdf.Annotations.LineAnnotation.create end} are not on the same page\n */\n static create(start, end, strokeColor, annotationStroke) {\n if (typeof start !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'start' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n if (typeof end !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'end' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n if (strokeColor !== null && strokeColor !== undefined && typeof strokeColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsLineAnnotationCreate(start, end, strokeColor, annotationStroke.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.LineAnnotation.createDynamicObject(retVal);\n }\n /**\n * The line's starting point (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get start() {\n let retVal = Module.ViewingPdfAnnotsLineAnnotationGetStart(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.PointOnPage(retVal.pageNumber, retVal.x, retVal.y);\n }\n /**\n * The line's ending point (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get end() {\n let retVal = Module.ViewingPdfAnnotsLineAnnotationGetEnd(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.PointOnPage(retVal.pageNumber, retVal.x, retVal.y);\n }\n /**\n * The starting point's style (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get startStyle() {\n let retVal = Module.ViewingPdfAnnotsLineAnnotationGetStartStyle(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The ending point's style (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get endStyle() {\n let retVal = Module.ViewingPdfAnnotsLineAnnotationGetEndStyle(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The line ending filling paint (Getter)\n *\n * This paint applies to both the starting end the ending point.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get lineEndingFill() {\n let retVal = Module.ViewingPdfAnnotsLineAnnotationGetLineEndingFill(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n }\n Annotations.LineAnnotation = LineAnnotation;\n /**\n * A free-hand drawing annotation\n *\n */\n class InkAnnotation extends PdfViewing.Pdf.Annotations.DrawingAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new InkAnnotation(handle);\n }\n /**\n * Create a ink annotation.\n *\n * The returned ink annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param pageNumber\n * @param path\n * The path of the free-hand drawing.\n * @param strokeColor\n * The color used for stroking and the popup\n * @param annotationStroke\n * The stroking style for all lines\n * @returns\n * The newly created ink annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.InkAnnotation.create path} argument is `null`\n * @throws {@link PdfViewing.NotSupportedError} if the {@link PdfViewing.Pdf.Annotations.InkAnnotation.create path} is not valid for this operation\n */\n static create(pageNumber, path, strokeColor, annotationStroke) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (!(path instanceof PdfViewing.Pdf.Geometry.Real.Path))\n throw new PdfViewing.ArgumentError(\"Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.\");\n if (typeof strokeColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsInkAnnotationCreate(pageNumber, path.handle, strokeColor, annotationStroke.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.InkAnnotation.createDynamicObject(retVal);\n }\n /**\n * Set the path\n *\n * Supported {@link PdfViewing.Pdf.Geometry.Real.PathOperation }s are\n * {@link PdfViewing.Pdf.Geometry.Real.PathOperation.MoveTo } and {@link PdfViewing.Pdf.Geometry.Real.PathOperation.LineTo }.\n * @param path\n * The new path to be set for the annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.InkAnnotation.setPath path} argument is `null`\n * @throws {@link PdfViewing.NotSupportedError} if the {@link PdfViewing.Pdf.Annotations.InkAnnotation.setPath path} contains unsupported {@link PdfViewing.Pdf.Geometry.Real.PathOperation }s\n */\n setPath(path) {\n if (!(path instanceof PdfViewing.Pdf.Geometry.Real.Path))\n throw new PdfViewing.ArgumentError(\"Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsInkAnnotationSetPath(this.handle, path.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.InkAnnotation = InkAnnotation;\n /**\n * A drawing annotation that consists of several line segments\n *\n */\n class PolyLineAnnotation extends PdfViewing.Pdf.Annotations.DrawingAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new PolyLineAnnotation(handle);\n }\n /**\n * Create a poly-line annotation.\n *\n * The returned poly-line annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param pageNumber\n * @param path\n * The path of the poly line.\n * @param strokeColor\n * The color used for stroking and the popup\n * @param annotationStroke\n * The stroking style for all lines\n * @returns\n * The newly created poly-line annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.PolyLineAnnotation.create path} argument is `null`\n * @throws {@link PdfViewing.NotSupportedError} if the {@link PdfViewing.Pdf.Annotations.PolyLineAnnotation.create path} is not valid for this operation\n */\n static create(pageNumber, path, strokeColor, annotationStroke) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (!(path instanceof PdfViewing.Pdf.Geometry.Real.Path))\n throw new PdfViewing.ArgumentError(\"Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.\");\n if (typeof strokeColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsPolyLineAnnotationCreate(pageNumber, path.handle, strokeColor, annotationStroke.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.PolyLineAnnotation.createDynamicObject(retVal);\n }\n /**\n * The starting point's style (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get startStyle() {\n let retVal = Module.ViewingPdfAnnotsPolyLineAnnotationGetStartStyle(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The ending point's style (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get endStyle() {\n let retVal = Module.ViewingPdfAnnotsPolyLineAnnotationGetEndStyle(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The line ending filling paint for both start and end (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get lineEndingFill() {\n let retVal = Module.ViewingPdfAnnotsPolyLineAnnotationGetLineEndingFill(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n }\n Annotations.PolyLineAnnotation = PolyLineAnnotation;\n /**\n * A polygon annotation\n *\n */\n class PolygonAnnotation extends PdfViewing.Pdf.Annotations.DrawingAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new PolygonAnnotation(handle);\n }\n /**\n * Create a polygon annotation.\n *\n * The returned polygon annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param pageNumber\n * @param path\n * The path of the polygon.\n * @param strokeColor\n * The color used for stroking and the popup.\n * The alpha value of this color is used for stroking and filling.\n * Set `null` or a color with alpha = 0 to make stroke transparent.\n * @param annotationStroke\n * The stroking style for all lines\n * @param borderStyleType\n * The style of the stroked lines\n * @param fillColor\n * The paint used for filling the polygon.\n * If `null` then the polygon is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.PolygonAnnotation.create strokeColor} is `null` or its alpha value is 0.\n * @returns\n * The newly created polygon annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.PolygonAnnotation.create path} argument is `null`\n * @throws {@link PdfViewing.NotSupportedError} if the {@link PdfViewing.Pdf.Annotations.PolygonAnnotation.create path} is not valid for this operation\n */\n static create(pageNumber, path, strokeColor, annotationStroke, borderStyleType, fillColor) {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (!(path instanceof PdfViewing.Pdf.Geometry.Real.Path))\n throw new PdfViewing.ArgumentError(\"Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.\");\n if (strokeColor !== null && strokeColor !== undefined && typeof strokeColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n if (typeof borderStyleType !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.\");\n if (fillColor !== null && fillColor !== undefined && typeof fillColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsPolygonAnnotationCreate(pageNumber, path.handle, strokeColor, annotationStroke.handle, borderStyleType, fillColor);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.PolygonAnnotation.createDynamicObject(retVal);\n }\n /**\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get borderStyleType() {\n let retVal = Module.ViewingPdfAnnotsPolygonAnnotationGetBorderStyleType(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set borderStyleType(borderStyleType) {\n if (typeof borderStyleType !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsPolygonAnnotationSetBorderStyleType(this.handle, borderStyleType);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The filling paint (Getter)\n *\n * If `null` then the polygon is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is `null` or its alpha value is 0.\n * Otherwise alpha of {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is used.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get fillColor() {\n let retVal = Module.ViewingPdfAnnotsPolygonAnnotationGetFillColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal !== null\n ? new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha)\n : null;\n }\n /**\n * The filling paint (Setter)\n *\n * If `null` then the polygon is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is `null` or its alpha value is 0.\n * Otherwise alpha of {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is used.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set fillColor(fillColor) {\n if (fillColor !== null && fillColor !== undefined && typeof fillColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsPolygonAnnotationSetFillColor(this.handle, fillColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.PolygonAnnotation = PolygonAnnotation;\n /**\n * A rectangle drawing annotation\n *\n */\n class RectangleAnnotation extends PdfViewing.Pdf.Annotations.DrawingAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new RectangleAnnotation(handle);\n }\n /**\n * Create a rectangle annotation.\n *\n * The returned rectangle annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param boundingBox\n * The location on the page.\n * @param strokeColor\n * The color used for stroking and the popup.\n * The alpha value of this color is used for stroking and filling.\n * Set `null` or a color with alpha = 0 to make stroke transparent.\n * @param annotationStroke\n * The stroking style for all lines.\n * @param borderStyleType\n * The style of the stroked lines\n * @param fillColor\n * The paint used for filling the rectangle.\n * If `null` then the rectangle is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.RectangleAnnotation.create strokeColor} is `null` or its alpha value is 0.\n * @returns\n * The newly created rectangle annotation.\n */\n static create(boundingBox, strokeColor, annotationStroke, borderStyleType, fillColor) {\n if (typeof boundingBox !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n if (strokeColor !== null && strokeColor !== undefined && typeof strokeColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n if (typeof borderStyleType !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.\");\n if (fillColor !== null && fillColor !== undefined && typeof fillColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsRectangleAnnotationCreate(boundingBox, strokeColor, annotationStroke.handle, borderStyleType, fillColor);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.RectangleAnnotation.createDynamicObject(retVal);\n }\n /**\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get borderStyleType() {\n let retVal = Module.ViewingPdfAnnotsRectangleAnnotationGetBorderStyleType(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set borderStyleType(borderStyleType) {\n if (typeof borderStyleType !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsRectangleAnnotationSetBorderStyleType(this.handle, borderStyleType);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The filling paint (Getter)\n *\n * If `null` then the rectangle is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is `null` or its alpha value is 0.\n * Otherwise alpha of {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is used.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get fillColor() {\n let retVal = Module.ViewingPdfAnnotsRectangleAnnotationGetFillColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal !== null\n ? new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha)\n : null;\n }\n /**\n * The filling paint (Setter)\n *\n * If `null` then the rectangle is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is `null` or its alpha value is 0.\n * Otherwise alpha of {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is used.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set fillColor(fillColor) {\n if (fillColor !== null && fillColor !== undefined && typeof fillColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsRectangleAnnotationSetFillColor(this.handle, fillColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.RectangleAnnotation = RectangleAnnotation;\n /**\n * An ellipse drawing annotation\n *\n */\n class EllipseAnnotation extends PdfViewing.Pdf.Annotations.DrawingAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new EllipseAnnotation(handle);\n }\n /**\n * Create an ellipse annotation.\n *\n * The returned ellipse annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param boundingBox\n * The location on the page.\n * @param strokeColor\n * The color used for stroking and the popup.\n * The alpha value of this color is used for stroking and filling.\n * Set `null` or a color with alpha = 0 to make stroke transparent.\n * @param annotationStroke\n * The stroking style for all lines. The color is also used for the popup.\n * @param borderStyleType\n * The style of the stroked border\n * @param fillColor\n * The paint used for filling the rectangle.\n * If `null` then the rectangle is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.EllipseAnnotation.create strokeColor} is `null` or its alpha value is 0.\n * @returns\n * The newly created ellipse annotation.\n */\n static create(boundingBox, strokeColor, annotationStroke, borderStyleType, fillColor) {\n if (typeof boundingBox !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n if (strokeColor !== null && strokeColor !== undefined && typeof strokeColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n if (typeof borderStyleType !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.\");\n if (fillColor !== null && fillColor !== undefined && typeof fillColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsEllipseAnnotationCreate(boundingBox, strokeColor, annotationStroke.handle, borderStyleType, fillColor);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.EllipseAnnotation.createDynamicObject(retVal);\n }\n /**\n *\n */\n get borderStyleType() {\n let retVal = Module.ViewingPdfAnnotsEllipseAnnotationGetBorderStyleType(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n */\n set borderStyleType(borderStyleType) {\n if (typeof borderStyleType !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsEllipseAnnotationSetBorderStyleType(this.handle, borderStyleType);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The filling paint (Getter)\n *\n * If `null` then the ellipse is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is `null` or its alpha value is 0.\n * Otherwise alpha of {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is used.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get fillColor() {\n let retVal = Module.ViewingPdfAnnotsEllipseAnnotationGetFillColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal !== null\n ? new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha)\n : null;\n }\n /**\n * The filling paint (Setter)\n *\n * If `null` then the ellipse is not filled.\n * The alpha value of this color only takes effect if {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is `null` or its alpha value is 0.\n * Otherwise alpha of {@link PdfViewing.Pdf.Annotations.DrawingAnnotation.strokeColor } is used.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set fillColor(fillColor) {\n if (fillColor !== null && fillColor !== undefined && typeof fillColor !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsEllipseAnnotationSetFillColor(this.handle, fillColor);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.EllipseAnnotation = EllipseAnnotation;\n /**\n * An annotation that marks up part(s) of a text\n *\n */\n class TextMarkup extends PdfViewing.Pdf.Annotations.MarkupAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfAnnotsTextMarkupGetType(handle);\n switch (type) {\n case 0:\n return new TextMarkup(handle);\n case 1:\n return PdfViewing.Pdf.Annotations.Highlight.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Annotations.Underline.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Annotations.StrikeThrough.createDynamicObject(handle);\n case 4:\n return PdfViewing.Pdf.Annotations.Squiggly.createDynamicObject(handle);\n default:\n return new TextMarkup(handle);\n }\n }\n /**\n * The Color of the annotation and the popup (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get color() {\n let retVal = Module.ViewingPdfAnnotsTextMarkupGetColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n /**\n * The Color of the annotation and the popup (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set color(color) {\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsTextMarkupSetColor(this.handle, color);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The pop-up (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get popup() {\n let retVal = Module.ViewingPdfAnnotsTextMarkupGetPopup(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0 ? PdfViewing.Pdf.Annotations.Popup.createDynamicObject(retVal) : null;\n }\n /**\n * Area of all marked text.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get markupArea() {\n let retVal = Module.ViewingPdfAnnotsTextMarkupGetMarkupArea(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Geometry.Real.QuadrilateralList.createDynamicObject(retVal);\n }\n /**\n * Area of all marked text.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} if the list is `null`\n * @throws {@link PdfViewing.ArgumentError} if the list contains no quadrilaterals\n */\n set markupArea(markupArea) {\n if (!(markupArea instanceof PdfViewing.Pdf.Geometry.Real.QuadrilateralList))\n throw new PdfViewing.ArgumentError(\"Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsTextMarkupSetMarkupArea(this.handle, markupArea.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Text which is highlighted\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get markedText() {\n let retVal = Module.ViewingPdfAnnotsTextMarkupGetMarkedText(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n }\n Annotations.TextMarkup = TextMarkup;\n /**\n * An text highlighting annotation\n *\n */\n class Highlight extends PdfViewing.Pdf.Annotations.TextMarkup {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new Highlight(handle);\n }\n /**\n * Create a Highlight annotation.\n *\n * The returned rectangle annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param markupArea\n * List of areas to be highlighted.\n * @param color\n * The color used for the highlighted area and the popup.\n * @returns\n * The newly created highlight annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.Highlight.create markupArea} argument is `null`\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.Highlight.create markupArea} list contains no quadrilaterals\n */\n static create(markupArea, color) {\n if (!(markupArea instanceof PdfViewing.Pdf.Geometry.Real.QuadrilateralList))\n throw new PdfViewing.ArgumentError(\"Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.\");\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsHighlightCreate(markupArea.handle, color);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.Highlight.createDynamicObject(retVal);\n }\n }\n Annotations.Highlight = Highlight;\n /**\n * An text underlining annotation\n *\n */\n class Underline extends PdfViewing.Pdf.Annotations.TextMarkup {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new Underline(handle);\n }\n /**\n * Create a Highlight annotation.\n *\n * The returned rectangle annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param markupArea\n * List of areas to be underlined. The underline is drawn on the baseline of each quadpoint.\n * @param color\n * The color used for the line and the popup.\n * @returns\n * The newly created Underline annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.Underline.create markupArea} argument is `null`\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.Underline.create markupArea} list contains no quadrilaterals\n */\n static create(markupArea, color) {\n if (!(markupArea instanceof PdfViewing.Pdf.Geometry.Real.QuadrilateralList))\n throw new PdfViewing.ArgumentError(\"Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.\");\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsUnderlineCreate(markupArea.handle, color);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.Underline.createDynamicObject(retVal);\n }\n }\n Annotations.Underline = Underline;\n /**\n * An annotation for striking through text\n *\n */\n class StrikeThrough extends PdfViewing.Pdf.Annotations.TextMarkup {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new StrikeThrough(handle);\n }\n /**\n * Create a Highlight annotation.\n *\n * The returned rectangle annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param markupArea\n * List of areas to be striked through. The line is drawn in the middle of each quadpoints, parallel to its baseline.\n * @param color\n * The color used for the line and the popup.\n * @returns\n * The newly created strikethrough annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.StrikeThrough.create markupArea} argument is `null`\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.StrikeThrough.create markupArea} list contains no quadrilaterals\n */\n static create(markupArea, color) {\n if (!(markupArea instanceof PdfViewing.Pdf.Geometry.Real.QuadrilateralList))\n throw new PdfViewing.ArgumentError(\"Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.\");\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsStrikeThroughCreate(markupArea.handle, color);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.StrikeThrough.createDynamicObject(retVal);\n }\n }\n Annotations.StrikeThrough = StrikeThrough;\n /**\n * A squiggly text underlining annotation\n *\n */\n class Squiggly extends PdfViewing.Pdf.Annotations.TextMarkup {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new Squiggly(handle);\n }\n /**\n * Create a Highlight annotation.\n *\n * The returned rectangle annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param markupArea\n * List of areas to be underlined with a squiggly line. The squiggly line is drawn on the baseline of each quadpoint.\n * @param color\n * The color used for the line and the popup.\n * @returns\n * The newly created Squiggly annotation.\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.Squiggly.create markupArea} argument is `null`\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Annotations.Squiggly.create markupArea} list contains no quadrilaterals\n */\n static create(markupArea, color) {\n if (!(markupArea instanceof PdfViewing.Pdf.Geometry.Real.QuadrilateralList))\n throw new PdfViewing.ArgumentError(\"Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.\");\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsSquigglyCreate(markupArea.handle, color);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.Squiggly.createDynamicObject(retVal);\n }\n }\n Annotations.Squiggly = Squiggly;\n /**\n * An annotation that marks a point to insert text\n *\n */\n class TextInsert extends PdfViewing.Pdf.Annotations.MarkupAnnotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new TextInsert(handle);\n }\n /**\n * The Color for the annotation and the popup (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get color() {\n let retVal = Module.ViewingPdfAnnotsTextInsertGetColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n /**\n * The Color for the annotation and the popup (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set color(color) {\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsTextInsertSetColor(this.handle, color);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The pop-up (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get popup() {\n let retVal = Module.ViewingPdfAnnotsTextInsertGetPopup(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0 ? PdfViewing.Pdf.Annotations.Popup.createDynamicObject(retVal) : null;\n }\n }\n Annotations.TextInsert = TextInsert;\n /**\n * A link\n *\n */\n class Link extends PdfViewing.Pdf.Annotations.Annotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfAnnotsLinkGetType(handle);\n switch (type) {\n case 0:\n return new Link(handle);\n case 1:\n return PdfViewing.Pdf.Annotations.InternalLink.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Annotations.WebLink.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Annotations.EmbeddedPdfLink.createDynamicObject(handle);\n default:\n return new Link(handle);\n }\n }\n /**\n * The link's border stroke (Setter)\n *\n * This property defines if and how a rectangular border is drawn for the link.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} the given {@link PdfViewing.Pdf.Annotations.AnnotationStroke } object is `null`\n */\n set annotationStroke(annotationStroke) {\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsLinkSetAnnotationStroke(this.handle, annotationStroke.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The Color for the annotation (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get color() {\n let retVal = Module.ViewingPdfAnnotsLinkGetColor(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Annotations.Color(retVal.red, retVal.green, retVal.blue, retVal.alpha);\n }\n /**\n * The Color for the annotation (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set color(color) {\n if (typeof color !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsLinkSetColor(this.handle, color);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * The link area (Getter)\n *\n * This list of {@link PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage }s defines the active link area on the page.\n * A PDF viewer executes the appropriate action,\n * such as navigating to a destination or opening a web browser,\n * when a mouse click falls inside of this area.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get activeArea() {\n let retVal = Module.ViewingPdfAnnotsLinkGetActiveArea(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Geometry.Real.QuadrilateralList.createDynamicObject(retVal);\n }\n /**\n * The link area (Setter)\n *\n * This list of {@link PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage }s defines the active link area on the page.\n * A PDF viewer executes the appropriate action,\n * such as navigating to a destination or opening a web browser,\n * when a mouse click falls inside of this area.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} if the list is `null`.\n * @throws {@link PdfViewing.ArgumentError} if the list contains no quadrilaterals.\n */\n set activeArea(activeArea) {\n if (!(activeArea instanceof PdfViewing.Pdf.Geometry.Real.QuadrilateralList))\n throw new PdfViewing.ArgumentError(\"Argument 'activeArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsLinkSetActiveArea(this.handle, activeArea.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.Link = Link;\n /**\n * A document-wide link\n *\n */\n class InternalLink extends PdfViewing.Pdf.Annotations.Link {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new InternalLink(handle);\n }\n /**\n * The link target (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.InvalidOperationError} if the link has no destination\n */\n get destination() {\n let retVal = Module.ViewingPdfAnnotsInternalLinkGetDestination(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0\n ? PdfViewing.Pdf.Navigation.Destination.createDynamicObject(retVal)\n : null;\n }\n }\n Annotations.InternalLink = InternalLink;\n /**\n * An external link\n *\n */\n class WebLink extends PdfViewing.Pdf.Annotations.Link {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new WebLink(handle);\n }\n /**\n * Create a new external link\n *\n * The returned WebLink annotation is not yet part of any page.\n * It can be added to a page's list of annotations.\n * @param boundingBox\n * The location on the page.\n * @param annotationStroke\n * The given AnnotationStroke defines if and how a rectangular border is drawn for the link.\n * @param uri\n * The link target\n * @returns\n * The newly created object\n */\n static create(boundingBox, annotationStroke, uri) {\n if (typeof boundingBox !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n if (!(annotationStroke instanceof PdfViewing.Pdf.Annotations.AnnotationStroke))\n throw new PdfViewing.ArgumentError(\"Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.\");\n if (typeof uri !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'uri' must be of type string and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsWebLinkCreate(boundingBox, annotationStroke.handle, uri);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.WebLink.createDynamicObject(retVal);\n }\n /**\n * The link target (Getter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get uri() {\n let retVal = Module.ViewingPdfAnnotsWebLinkGetUri(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * The link target (Setter)\n *\n *\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set uri(uri) {\n if (typeof uri !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'uri' must be of type string and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsWebLinkSetUri(this.handle, uri);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.WebLink = WebLink;\n /**\n * A link to an embedded PDF document\n *\n */\n class EmbeddedPdfLink extends PdfViewing.Pdf.Annotations.Link {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new EmbeddedPdfLink(handle);\n }\n /**\n * The opening behavior (Getter)\n *\n * This defines the viewer's behavior when opening the target PDF document.\n * - `null`: The viewer uses its default behavior.\n * - `true`: Open the document in an additional window.\n * - `false`: Replace the parent document with the embedded document.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get newWindow() {\n let retVal = Module.ViewingPdfAnnotsEmbeddedPdfLinkGetNewWindow(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The opening behavior (Setter)\n *\n * This defines the viewer's behavior when opening the target PDF document.\n * - `null`: The viewer uses its default behavior.\n * - `true`: Open the document in an additional window.\n * - `false`: Replace the parent document with the embedded document.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set newWindow(newWindow) {\n if (newWindow !== null && newWindow !== undefined && typeof newWindow !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'newWindow' must be of type boolean or can be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsEmbeddedPdfLinkSetNewWindow(this.handle, newWindow);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.EmbeddedPdfLink = EmbeddedPdfLink;\n /**\n *\n */\n class AnnotationStroke extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfAnnotsNewAnnotationStroke()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new AnnotationStroke({ __handle: handle });\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfAnnotsAnnotationStrokeClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * Width of the line in points\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get lineWidth() {\n let retVal = Module.ViewingPdfAnnotsAnnotationStrokeGetLineWidth(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Width of the line in points\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set lineWidth(lineWidth) {\n if (typeof lineWidth !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'lineWidth' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsAnnotationStrokeSetLineWidth(this.handle, lineWidth);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Describes the sequence of dashlength and gaplength of the dashing pattern, starting with a dash in points. The pattern is repeated.\n * Leaving the {@link PdfViewing.Pdf.Annotations.AnnotationStroke.dashArray } empty results in a solid line.\n * The {@link PdfViewing.Pdf.Annotations.AnnotationStroke.dashArray } is ignored if the Annotation has a {@link PdfViewing.Pdf.Annotations.BorderStyleType } property that is not set to {@link PdfViewing.Pdf.Annotations.BorderStyleType.Lined }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get dashArray() {\n let retVal = Module.ViewingPdfAnnotsAnnotationStrokeGetDashArray(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * Describes the sequence of dashlength and gaplength of the dashing pattern, starting with a dash in points. The pattern is repeated.\n * Leaving the {@link PdfViewing.Pdf.Annotations.AnnotationStroke.dashArray } empty results in a solid line.\n * The {@link PdfViewing.Pdf.Annotations.AnnotationStroke.dashArray } is ignored if the Annotation has a {@link PdfViewing.Pdf.Annotations.BorderStyleType } property that is not set to {@link PdfViewing.Pdf.Annotations.BorderStyleType.Lined }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set dashArray(dashArray) {\n if (!Array.isArray(dashArray))\n throw new PdfViewing.ArgumentError(\"Argument 'dashArray' must be of type number and must not be null or undefined.\");\n let retVal = Module.ViewingPdfAnnotsAnnotationStrokeSetDashArray(this.handle, dashArray);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Annotations.AnnotationStroke = AnnotationStroke;\n /**\n *\n */\n class AnnotationList extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new AnnotationList(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfAnnotsAnnotationListClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n throw new Error('Method not implemented.');\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingPdfAnnotsAnnotationListGet(this.handle, index);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Annotations.Annotation.createDynamicObject(retVal);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingPdfAnnotsAnnotationListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Annotations.AnnotationList = AnnotationList;\n })(Annotations = Pdf.Annotations || (Pdf.Annotations = {}));\n let Forms;\n (function (Forms) {\n /**\n * A form field widget\n *\n */\n class Widget extends PdfViewing.Pdf.Annotations.Annotation {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfFormsWidgetGetType(handle);\n switch (type) {\n case 0:\n return new Widget(handle);\n case 1:\n return PdfViewing.Pdf.Forms.CheckBox.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Forms.RadioButton.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Forms.TextBox.createDynamicObject(handle);\n case 4:\n return PdfViewing.Pdf.Forms.ListBox.createDynamicObject(handle);\n case 5:\n return PdfViewing.Pdf.Forms.ComboBox.createDynamicObject(handle);\n default:\n return new Widget(handle);\n }\n }\n /**\n * Editing this widget is not allowed.\n */\n get readOnly() {\n let retVal = Module.ViewingPdfFormsWidgetGetReadOnly(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * When filling out form this field is not optional.\n */\n get required() {\n let retVal = Module.ViewingPdfFormsWidgetGetRequired(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Forms.Widget = Widget;\n /**\n *\n * An empty box which can be marked with a checkmark.\n */\n class CheckBox extends PdfViewing.Pdf.Forms.Widget {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new CheckBox(handle);\n }\n /**\n *\n * Toggle whether the given box is checked.\n */\n push() {\n let retVal = Module.ViewingPdfFormsCheckBoxpush(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Whether the box is checked\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get isChecked() {\n let retVal = Module.ViewingPdfFormsCheckBoxGetIsChecked(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Forms.CheckBox = CheckBox;\n /**\n *\n * A radio button allows to choose one of multiple choices by selecting one of the buttons in a radio button group.\n */\n class RadioButton extends PdfViewing.Pdf.Forms.Widget {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new RadioButton(handle);\n }\n /**\n *\n * Toggle whether the given box is checked.\n * If the radio button is not selected, then select it.\n * If the radio button is selected and the radio button has {@link PdfViewing.Pdf.Forms.RadioButton.noSelectionAllowed } set to `true`, then deselect the radio button.\n */\n push() {\n let retVal = Module.ViewingPdfFormsRadioButtonpush(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Whether this radiobutton may be deselected, resulting in no radiobuttons of this group being selected.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get noSelectionAllowed() {\n let retVal = Module.ViewingPdfFormsRadioButtonGetNoSelectionAllowed(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Whether this button is selected.\n * Note that selecting one radio button might deselect other radio buttons.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get selected() {\n let retVal = Module.ViewingPdfFormsRadioButtonGetSelected(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Forms.RadioButton = RadioButton;\n /**\n *\n * A text box allows the entry of arbitrary text.\n */\n class TextBox extends PdfViewing.Pdf.Forms.Widget {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new TextBox(handle);\n }\n /**\n * Whether horizontal scrolling of text is allowed in the text box\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get scrollAllowed() {\n let retVal = Module.ViewingPdfFormsTextBoxGetScrollAllowed(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Whether the text is may be shown on multiple lines in the text box\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get multilineAllowed() {\n let retVal = Module.ViewingPdfFormsTextBoxGetMultilineAllowed(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Interpret the given string as rich-text\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get textIsRichText() {\n let retVal = Module.ViewingPdfFormsTextBoxGetTextIsRichText(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Whether text should be monospaced\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get comb() {\n let retVal = Module.ViewingPdfFormsTextBoxGetComb(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The maximum amount of characters that {@link PdfViewing.Pdf.Forms.TextBox.text } may contain\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get maxLength() {\n let retVal = Module.ViewingPdfFormsTextBoxGetMaxLength(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The text currently set in the text box\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get text() {\n let retVal = Module.ViewingPdfFormsTextBoxGetText(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * The text currently set in the text box\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} if the given {@link PdfViewing.Pdf.Forms.TextBox.maxLength } was exceeded\n */\n set text(text) {\n if (typeof text !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'text' must be of type string and must not be null or undefined.\");\n let retVal = Module.ViewingPdfFormsTextBoxSetText(this.handle, text);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Forms.TextBox = TextBox;\n /**\n *\n * A list box shows a scrollable list of choices in a box.\n */\n class ListBox extends PdfViewing.Pdf.Forms.Widget {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new ListBox(handle);\n }\n /**\n * Whether multiple options may be selected.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get multiSelectAllowed() {\n let retVal = Module.ViewingPdfFormsListBoxGetMultiSelectAllowed(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * List of strings which can be chosen for this box.\n */\n get options() {\n let retVal = Module.ViewingPdfFormsListBoxGetOptions(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.StringList.createDynamicObject(retVal);\n }\n /**\n * This is a set of indices indicating which of the {@link PdfViewing.Pdf.Forms.ListBox.options } are currently chosen.\n * Index values may range from 0 up to size of {@link PdfViewing.Pdf.Forms.ListBox.options } - 1.\n */\n get chosen() {\n let retVal = Module.ViewingPdfFormsListBoxGetChosen(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.IntegerSet.createDynamicObject(retVal);\n }\n /**\n * This is a set of indices indicating which of the {@link PdfViewing.Pdf.Forms.ListBox.options } are currently chosen.\n * Index values may range from 0 up to size of {@link PdfViewing.Pdf.Forms.ListBox.options } - 1.\n *\n * @throws {@link PdfViewing.ArgumentError} An index is not in the allowed range.\n */\n set chosen(chosen) {\n if (!(chosen instanceof PdfViewing.IntegerSet))\n throw new PdfViewing.ArgumentError(\"Argument 'chosen' must be of type PdfViewing.IntegerSet and must not be null or undefined.\");\n let retVal = Module.ViewingPdfFormsListBoxSetChosen(this.handle, chosen.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Forms.ListBox = ListBox;\n /**\n *\n * A combo box shows a scrollable list of choices in a drop-down menu potentially combined with an editable custom entry.\n */\n class ComboBox extends PdfViewing.Pdf.Forms.Widget {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new ComboBox(handle);\n }\n /**\n * Whether the combo box supports an editable custom entry instead of one of the {@link PdfViewing.Pdf.Forms.ComboBox.options }\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get customEntryAllowed() {\n let retVal = Module.ViewingPdfFormsComboBoxGetCustomEntryAllowed(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * If {@link PdfViewing.Pdf.Forms.ComboBox.customEntryAllowed } is set a custom entry can be used instead of the entries in {@link PdfViewing.Pdf.Forms.ComboBox.options }.\n * Setting {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } to any value other than `null` automatically sets {@link PdfViewing.Pdf.Forms.ComboBox.chosen } to `null`.\n * Conversely, setting {@link PdfViewing.Pdf.Forms.ComboBox.chosen } to any value other than `null` automatically sets {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } to `null`.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get customEntry() {\n let retVal = Module.ViewingPdfFormsComboBoxGetCustomEntry(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * If {@link PdfViewing.Pdf.Forms.ComboBox.customEntryAllowed } is set a custom entry can be used instead of the entries in {@link PdfViewing.Pdf.Forms.ComboBox.options }.\n * Setting {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } to any value other than `null` automatically sets {@link PdfViewing.Pdf.Forms.ComboBox.chosen } to `null`.\n * Conversely, setting {@link PdfViewing.Pdf.Forms.ComboBox.chosen } to any value other than `null` automatically sets {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } to `null`.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.NotSupportedError} Setting a Custom Entry is only allowed if {@link PdfViewing.Pdf.Forms.ComboBox.customEntryAllowed } is set to `true`.\n * @throws {@link PdfViewing.ArgumentError} {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } may not be set to `null`.\n */\n set customEntry(customEntry) {\n if (customEntry !== null && customEntry !== undefined && typeof customEntry !== 'string')\n throw new PdfViewing.ArgumentError(\"Argument 'customEntry' must be of type string or can be null or undefined.\");\n let retVal = Module.ViewingPdfFormsComboBoxSetCustomEntry(this.handle, customEntry);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * List of strings which can be chosen for this box.\n */\n get options() {\n let retVal = Module.ViewingPdfFormsComboBoxGetOptions(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.StringList.createDynamicObject(retVal);\n }\n /**\n * The index of the currently chosen Option from {@link PdfViewing.Pdf.Forms.ComboBox.options }.\n * Setting {@link PdfViewing.Pdf.Forms.ComboBox.chosen } to any value other than `null` automatically sets {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } to `null`.\n * Conversely, setting {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } to any value other than `null` automatically sets {@link PdfViewing.Pdf.Forms.ComboBox.chosen } to `null`.\n */\n get chosen() {\n let retVal = Module.ViewingPdfFormsComboBoxGetChosen(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The index of the currently chosen Option from {@link PdfViewing.Pdf.Forms.ComboBox.options }.\n * Setting {@link PdfViewing.Pdf.Forms.ComboBox.chosen } to any value other than `null` automatically sets {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } to `null`.\n * Conversely, setting {@link PdfViewing.Pdf.Forms.ComboBox.customEntry } to any value other than `null` automatically sets {@link PdfViewing.Pdf.Forms.ComboBox.chosen } to `null`.\n *\n * @throws {@link PdfViewing.ArgumentError} Index is not in the allowed range.\n * @throws {@link PdfViewing.ArgumentError} {@link PdfViewing.Pdf.Forms.ComboBox.chosen } may not be set to `null`.\n */\n set chosen(chosen) {\n if (chosen !== null && chosen !== undefined && typeof chosen !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'chosen' must be of type number or can be null or undefined.\");\n let retVal = Module.ViewingPdfFormsComboBoxSetChosen(this.handle, chosen);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Forms.ComboBox = ComboBox;\n })(Forms = Pdf.Forms || (Pdf.Forms = {}));\n let Geometry;\n (function (Geometry) {\n /**\n *\n * Values represent the Rotation in degrees clockwise.\n */\n let Rotation;\n (function (Rotation) {\n /**\n *\n */\n Rotation[Rotation[\"NoRotation\"] = 0] = \"NoRotation\";\n /**\n *\n */\n Rotation[Rotation[\"Clockwise\"] = 90] = \"Clockwise\";\n /**\n *\n */\n Rotation[Rotation[\"UpsideDown\"] = 180] = \"UpsideDown\";\n /**\n *\n */\n Rotation[Rotation[\"CounterClockwise\"] = 270] = \"CounterClockwise\";\n })(Rotation = Geometry.Rotation || (Geometry.Rotation = {}));\n let Real;\n (function (Real) {\n /**\n *\n */\n class Size extends Internal.NativeBase {\n constructor(width, height) {\n super();\n if (typeof width !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'width' must be of type number and must not be null or undefined.\");\n if (typeof height !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'height' must be of type number and must not be null or undefined.\");\n this.width = width;\n this.height = height;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.width !== obj.width)\n return false;\n if (this.height !== obj.height)\n return false;\n return true;\n }\n }\n Real.Size = Size;\n /**\n *\n */\n class Point extends Internal.NativeBase {\n constructor(x, y) {\n super();\n if (typeof x !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'x' must be of type number and must not be null or undefined.\");\n if (typeof y !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'y' must be of type number and must not be null or undefined.\");\n this.x = x;\n this.y = y;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.x !== obj.x)\n return false;\n if (this.y !== obj.y)\n return false;\n return true;\n }\n }\n Real.Point = Point;\n /**\n *\n * A point relative to a PDF Page in PDF coordinates (double), the origin is at the bottom-left of the page, x increasing to the right and y increasing upwards.\n */\n class PointOnPage extends Internal.NativeBase {\n constructor(pageNumber, x, y) {\n super();\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (typeof x !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'x' must be of type number and must not be null or undefined.\");\n if (typeof y !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'y' must be of type number and must not be null or undefined.\");\n this.pageNumber = pageNumber;\n this.x = x;\n this.y = y;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.pageNumber !== obj.pageNumber)\n return false;\n if (this.x !== obj.x)\n return false;\n if (this.y !== obj.y)\n return false;\n return true;\n }\n }\n Real.PointOnPage = PointOnPage;\n /**\n *\n * A quadrilateral is a polygon with four sides and four corners.\n * When associated with text, the horizontal text writing direction goes from {@link PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage.pageNumber } to {@link PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage.pageNumber }.\n */\n class QuadrilateralOnPage extends Internal.NativeBase {\n constructor(pageNumber, bottomLeft, bottomRight, topRight, topLeft) {\n super();\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (typeof bottomLeft !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'bottomLeft' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n if (typeof bottomRight !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'bottomRight' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n if (typeof topRight !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'topRight' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n if (typeof topLeft !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'topLeft' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n this.pageNumber = pageNumber;\n this.bottomLeft = bottomLeft;\n this.bottomRight = bottomRight;\n this.topRight = topRight;\n this.topLeft = topLeft;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.pageNumber !== obj.pageNumber)\n return false;\n if (!this.bottomLeft.equals(obj.bottomLeft))\n return false;\n if (!this.bottomRight.equals(obj.bottomRight))\n return false;\n if (!this.topRight.equals(obj.topRight))\n return false;\n if (!this.topLeft.equals(obj.topLeft))\n return false;\n return true;\n }\n }\n Real.QuadrilateralOnPage = QuadrilateralOnPage;\n /**\n *\n * A rectangle relative to a PDF Page in PDF coordinates (double), the origin is at the bottom-left of the page , x increasing to the right and y increasing upwards\n */\n class RectangleOnPage extends Internal.NativeBase {\n constructor(pageNumber, x, y, width, height) {\n super();\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (typeof x !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'x' must be of type number and must not be null or undefined.\");\n if (typeof y !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'y' must be of type number and must not be null or undefined.\");\n if (typeof width !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'width' must be of type number and must not be null or undefined.\");\n if (typeof height !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'height' must be of type number and must not be null or undefined.\");\n this.pageNumber = pageNumber;\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.pageNumber !== obj.pageNumber)\n return false;\n if (this.x !== obj.x)\n return false;\n if (this.y !== obj.y)\n return false;\n if (this.width !== obj.width)\n return false;\n if (this.height !== obj.height)\n return false;\n return true;\n }\n }\n Real.RectangleOnPage = RectangleOnPage;\n /**\n *\n * A point relative to a PDF Page in PDF coordinates (double), the origin is at the bottom-left of the page, x increasing to the right and y increasing upwards.\n * This point will join 2 lines.\n */\n class Vertex extends Internal.NativeBase {\n constructor(pageNumber, x, y, operator) {\n super();\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (typeof x !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'x' must be of type number and must not be null or undefined.\");\n if (typeof y !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'y' must be of type number and must not be null or undefined.\");\n if (typeof operator !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'operator' must be of type PdfViewing.Pdf.Geometry.Real.PathOperation and must not be null or undefined.\");\n this.pageNumber = pageNumber;\n this.x = x;\n this.y = y;\n this.operator = operator;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.pageNumber !== obj.pageNumber)\n return false;\n if (this.x !== obj.x)\n return false;\n if (this.y !== obj.y)\n return false;\n if (this.operator !== obj.operator)\n return false;\n return true;\n }\n }\n Real.Vertex = Vertex;\n /**\n *\n * Values represent the type of path operation on the vertex.\n */\n let PathOperation;\n (function (PathOperation) {\n /**\n *\n */\n PathOperation[PathOperation[\"MoveTo\"] = 0] = \"MoveTo\";\n /**\n *\n */\n PathOperation[PathOperation[\"LineTo\"] = 1] = \"LineTo\";\n })(PathOperation = Real.PathOperation || (Real.PathOperation = {}));\n /**\n *\n * A List of {@link PdfViewing.Pdf.Geometry.Real.RectangleOnPage }s\n */\n class RectangleOnPageList extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new RectangleOnPageList(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfGeomRealRectangleOnPageListClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n throw new Error('Method not implemented.');\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingPdfGeomRealRectangleOnPageListGet(this.handle, index);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(retVal.pageNumber, retVal.x, retVal.y, retVal.width, retVal.height);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingPdfGeomRealRectangleOnPageListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Real.RectangleOnPageList = RectangleOnPageList;\n /**\n *\n * A path described by a series of vertices.\n */\n class Path extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfGeomRealNewPath()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new Path({ __handle: handle });\n }\n /**\n * List of vertices joined as a path.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get vertices() {\n let retVal = Module.ViewingPdfGeomRealPathGetVertices(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Geometry.Real.VertexList.createDynamicObject(retVal);\n }\n /**\n * List of vertices joined as a path.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.ArgumentError} The vertex list starts with a {@link PdfViewing.Pdf.Geometry.Real.PathOperation.LineTo }\n * or contains two successive {@link PdfViewing.Pdf.Geometry.Real.PathOperation.MoveTo }s\n */\n set vertices(vertices) {\n if (!(vertices instanceof PdfViewing.Pdf.Geometry.Real.VertexList))\n throw new PdfViewing.ArgumentError(\"Argument 'vertices' must be of type PdfViewing.Pdf.Geometry.Real.VertexList and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealPathSetVertices(this.handle, vertices.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Real.Path = Path;\n /**\n *\n * A List of {@link PdfViewing.Pdf.Geometry.Real.RectangleOnPage }s\n */\n class PathGenerator extends Internal.NativeObject {\n /**\n * Create a new path generator for appending to a path.\n *\n * @param path\n * the path object\n *\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Geometry.Real.PathGenerator. path} argument is `null`\n * @throws {@link PdfViewing.ArgumentError} if the {@link PdfViewing.Pdf.Geometry.Real.PathGenerator. path} object has already been closed\n */\n constructor(path) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (!(path instanceof PdfViewing.Pdf.Geometry.Real.Path))\n throw new PdfViewing.ArgumentError(\"Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfGeomRealNewPathGenerator(path.handle)));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new PathGenerator({ __handle: handle });\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfGeomRealPathGeneratorClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * Move the current position.\n *\n * Begin a new subpath by moving the current point to the specified coordinates,\n * omitting any connecting line segment.\n * If the previous path construction operator in the current path was also MoveTo,\n * the new MoveTo overrides it;\n * no vestige of the previous MoveTo operation remains in the path.\n * @param target\n * the target coordinates\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.InvalidOperationError} if the path object has already been closed\n */\n moveTo(target) {\n if (typeof target !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'target' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealPathGeneratorMoveTo(this.handle, target);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Draw a line.\n *\n * Append a straight line segment from the current point to the target coordinates.\n * The current position is changed to the target position.\n * @param target\n * the target coordinates\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.InvalidOperationError} if the path object has already been closed\n */\n lineTo(target) {\n if (typeof target !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'target' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealPathGeneratorLineTo(this.handle, target);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Draw a bezier curve.\n *\n * Append a cubic Bézier curve to the current path.\n * The curve extends from the current point to the {@link PdfViewing.Pdf.Geometry.Real.PathGenerator.bezierTo target} position,\n * using {@link PdfViewing.Pdf.Geometry.Real.PathGenerator.bezierTo ctrl1} and {@link PdfViewing.Pdf.Geometry.Real.PathGenerator.bezierTo ctrl2} as the Bézier control points.\n * The current position is changed to the target position.\n * @param ctrl1\n * the first bezier control point\n * @param ctrl2\n * the second bezier control point\n * @param target\n * the target coordinates\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.InvalidOperationError} if the path object has already been closed\n */\n bezierTo(ctrl1, ctrl2, target) {\n if (typeof ctrl1 !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'ctrl1' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n if (typeof ctrl2 !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'ctrl2' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n if (typeof target !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'target' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealPathGeneratorBezierTo(this.handle, ctrl1, ctrl2, target);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Close the current subpath.\n *\n * Close the current subpath by appending a straight line segment from the\n * current point to the starting point of the subpath.\n * This operator terminates the current subpath;\n * appending another segment to the current path will begin a new subpath,\n * even if the new segment begins at the endpoint reached by the closeSubpath() operation.\n * If the current subpath is already closed, CloseSubpath() does nothing.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.InvalidOperationError} if the path object has already been closed\n */\n closeSubpath() {\n let retVal = Module.ViewingPdfGeomRealPathGeneratorCloseSubpath(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Append a rectangle to the current path as a complete subpath.\n *\n * @param rect\n * the rectangle to be added to the path\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n * @throws {@link PdfViewing.InvalidOperationError} if the path object has already been closed\n */\n addRectangle(rect) {\n if (typeof rect !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'rect' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealPathGeneratorAddRectangle(this.handle, rect);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Real.PathGenerator = PathGenerator;\n /**\n *\n */\n class QuadrilateralList extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfGeomRealNewQuadrilateralList()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new QuadrilateralList({ __handle: handle });\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfGeomRealQuadrilateralListClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n *\n * @param pointOnPage\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n contains(pointOnPage) {\n if (typeof pointOnPage !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'pointOnPage' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealQuadrilateralListContains(this.handle, pointOnPage);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The smallest rectangle which contains all quadrilaterals of this list.\n *\n * @throws {@link PdfViewing.ArgumentError} Property may not be read if the list is empty.\n */\n get boundingBox() {\n let retVal = Module.ViewingPdfGeomRealQuadrilateralListGetBoundingBox(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(retVal.pageNumber, retVal.x, retVal.y, retVal.width, retVal.height);\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n if (typeof element !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'element' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealQuadrilateralListAdd(this.handle, element);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n return true;\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingPdfGeomRealQuadrilateralListGet(this.handle, index);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage(retVal.pageNumber, retVal.bottomLeft, retVal.bottomRight, retVal.topRight, retVal.topLeft);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingPdfGeomRealQuadrilateralListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Real.QuadrilateralList = QuadrilateralList;\n /**\n *\n */\n class VertexList extends Internal.NativeObject {\n /**\n *\n */\n constructor() {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfGeomRealNewVertexList()));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new VertexList({ __handle: handle });\n }\n /** @internal */\n indexOf(element) {\n for (var i = 0; i < this.size; i++) {\n if (element.equals(this.get(i)))\n return i;\n }\n return -1;\n }\n remove(element) {\n if (typeof element !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'element' must be of type PdfViewing.Pdf.Geometry.Real.Vertex and must not be null or undefined.\");\n let index = this.indexOf(element);\n if (index == -1)\n return false;\n let retVal = Module.ViewingPdfGeomRealVertexListRemove(this.handle, index);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n return true;\n }\n add(element) {\n if (typeof element !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'element' must be of type PdfViewing.Pdf.Geometry.Real.Vertex and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealVertexListAdd(this.handle, element);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n return true;\n }\n addRange(inputList) {\n if (!(inputList instanceof PdfViewing.Pdf.Geometry.Real.VertexList))\n throw new PdfViewing.ArgumentError(\"Argument 'inputList' must be of type PdfViewing.Pdf.Geometry.Real.VertexList and must not be null or undefined.\");\n if (inputList.size == 0)\n return false;\n let retVal = Module.ViewingPdfGeomRealVertexListAddRange(this.handle, inputList);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n return true;\n }\n set(index, element) {\n if (typeof element !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'element' must be of type PdfViewing.Pdf.Geometry.Real.Vertex and must not be null or undefined.\");\n let retVal = Module.ViewingPdfGeomRealVertexListSet(this.handle, index, element);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n clear() {\n let retVal = Module.ViewingPdfGeomRealVertexListClear(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n get(index) {\n let retVal = Module.ViewingPdfGeomRealVertexListGet(this.handle, index);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.Vertex(retVal.pageNumber, retVal.x, retVal.y, retVal.operator);\n }\n getRange(index, count) {\n let retVal = Module.ViewingPdfGeomRealVertexListGetRange(this.handle, index, count);\n if (retVal == 0)\n Internal.NativeBase.throwLastError(false);\n return VertexList.createDynamicObject(retVal);\n }\n get size() {\n let retVal = Module.ViewingPdfGeomRealVertexListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Real.VertexList = VertexList;\n })(Real = Geometry.Real || (Geometry.Real = {}));\n let Integer;\n (function (Integer) {\n /**\n *\n */\n class Size extends Internal.NativeBase {\n constructor(width, height) {\n super();\n if (typeof width !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'width' must be of type number and must not be null or undefined.\");\n if (typeof height !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'height' must be of type number and must not be null or undefined.\");\n this.width = width;\n this.height = height;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.width !== obj.width)\n return false;\n if (this.height !== obj.height)\n return false;\n return true;\n }\n }\n Integer.Size = Size;\n /**\n *\n * Describes the current position of the viewport on the document. Origin top left.\n */\n class ScrollPosition extends Internal.NativeBase {\n constructor(x, y) {\n super();\n if (typeof x !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'x' must be of type number and must not be null or undefined.\");\n if (typeof y !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'y' must be of type number and must not be null or undefined.\");\n this.x = x;\n this.y = y;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.x !== obj.x)\n return false;\n if (this.y !== obj.y)\n return false;\n return true;\n }\n }\n Integer.ScrollPosition = ScrollPosition;\n /**\n *\n * A point relative to the viewport in viewport coordinates (integer), the origin is at the top-left of the viewport, x increasing to the right and y increasing downwards\n */\n class Point extends Internal.NativeBase {\n constructor(x, y) {\n super();\n if (typeof x !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'x' must be of type number and must not be null or undefined.\");\n if (typeof y !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'y' must be of type number and must not be null or undefined.\");\n this.x = x;\n this.y = y;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.x !== obj.x)\n return false;\n if (this.y !== obj.y)\n return false;\n return true;\n }\n }\n Integer.Point = Point;\n /**\n *\n * A Rectangle relative to the viewport in viewport coordinates (integer), the origin is at the top-left of the viewport, x increasing to the right and y increasing downwards\n */\n class Rectangle extends Internal.NativeBase {\n constructor(x, y, width, height) {\n super();\n if (typeof x !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'x' must be of type number and must not be null or undefined.\");\n if (typeof y !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'y' must be of type number and must not be null or undefined.\");\n if (typeof width !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'width' must be of type number and must not be null or undefined.\");\n if (typeof height !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'height' must be of type number and must not be null or undefined.\");\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.x !== obj.x)\n return false;\n if (this.y !== obj.y)\n return false;\n if (this.width !== obj.width)\n return false;\n if (this.height !== obj.height)\n return false;\n return true;\n }\n }\n Integer.Rectangle = Rectangle;\n /**\n *\n * A set of paddings to be added at the respective sides of a rectangular object.\n */\n class Padding extends Internal.NativeBase {\n constructor(left, right, top, bottom) {\n super();\n if (typeof left !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'left' must be of type number and must not be null or undefined.\");\n if (typeof right !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'right' must be of type number and must not be null or undefined.\");\n if (typeof top !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'top' must be of type number and must not be null or undefined.\");\n if (typeof bottom !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'bottom' must be of type number and must not be null or undefined.\");\n this.left = left;\n this.right = right;\n this.top = top;\n this.bottom = bottom;\n }\n equals(obj) {\n if (obj === null)\n return false;\n if (this.left !== obj.left)\n return false;\n if (this.right !== obj.right)\n return false;\n if (this.top !== obj.top)\n return false;\n if (this.bottom !== obj.bottom)\n return false;\n return true;\n }\n }\n Integer.Padding = Padding;\n })(Integer = Geometry.Integer || (Geometry.Integer = {}));\n })(Geometry = Pdf.Geometry || (Pdf.Geometry = {}));\n let Content;\n (function (Content) {\n /**\n *\n */\n let Byteorder;\n (function (Byteorder) {\n /**\n *\n */\n Byteorder[Byteorder[\"Invalid\"] = 0] = \"Invalid\";\n })(Byteorder = Content.Byteorder || (Content.Byteorder = {}));\n /**\n *\n * A List of {@link PdfViewing.Pdf.Content.TextFragment }s\n */\n class TextFragmentList extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new TextFragmentList(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentTextFragmentListClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n throw new Error('Method not implemented.');\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingPdfContentTextFragmentListGet(this.handle, index);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.TextFragment.createDynamicObject(retVal);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingPdfContentTextFragmentListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Content.TextFragmentList = TextFragmentList;\n /**\n *\n * Calling `SearchText` returns a `TextSearchIterator` starting the search at the beginning of the specified page.\n * `GetNext` and `GetPrevious` starts the search in the respective direction and subsequent calls iterate further starting from the result of the previous call.\n * `null` is returned if no more results are found.\n */\n class TextSearchIterator extends Internal.NativeObject {\n /**\n * @event\n */\n addEventListener(type, listener) {\n if (typeof listener !== 'function')\n throw new PdfViewing.ArgumentError(\"Argument 'listener' must be a function.\");\n var eventObj;\n if (this.eventListeners.has(type)) {\n if (!this.eventListeners.get(type).has(listener)) {\n if (type === 'matchChanged') {\n eventObj = new MatchChangedNativeClass(listener);\n let context = Module.ViewingPdfContentTextSearchIteratorAddMatchChangedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n this.eventListeners.get(type).set(listener, eventObj);\n }\n }\n if (!this.eventListeners.get(type).has(listener)) {\n if (type === 'totalMatchesChanged') {\n eventObj = new TotalMatchesChangedNativeClass(listener);\n let context = Module.ViewingPdfContentTextSearchIteratorAddTotalMatchesChangedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n this.eventListeners.get(type).set(listener, eventObj);\n }\n }\n }\n else {\n if (type === 'matchChanged') {\n eventObj = new MatchChangedNativeClass(listener);\n let context = Module.ViewingPdfContentTextSearchIteratorAddMatchChangedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n let mapItem = new Map();\n mapItem.set(listener, eventObj);\n this.eventListeners.set(type, mapItem);\n }\n if (type === 'totalMatchesChanged') {\n eventObj = new TotalMatchesChangedNativeClass(listener);\n let context = Module.ViewingPdfContentTextSearchIteratorAddTotalMatchesChangedHandler(this.handle, eventObj);\n if (context == 0)\n Internal.NativeBase.throwLastError();\n else\n eventObj.context = context;\n let mapItem = new Map();\n mapItem.set(listener, eventObj);\n this.eventListeners.set(type, mapItem);\n }\n }\n }\n removeEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n if (type === 'matchChanged') {\n let listeners = this.eventListeners.get(type);\n if (listeners.has(listener)) {\n let eventObj = listeners.get(listener);\n try {\n if (!Module.ViewingPdfContentTextSearchIteratorRemoveMatchChangedHandler(this.handle, eventObj === null || eventObj === void 0 ? void 0 : eventObj.context))\n Internal.NativeBase.throwLastError();\n }\n catch (err) {\n if (err instanceof NotFoundError)\n throw err;\n }\n listeners.delete(listener);\n if (listeners.size === 0)\n this.eventListeners.delete('matchChanged');\n }\n }\n if (type === 'totalMatchesChanged') {\n let listeners = this.eventListeners.get(type);\n if (listeners.has(listener)) {\n let eventObj = listeners.get(listener);\n try {\n if (!Module.ViewingPdfContentTextSearchIteratorRemoveTotalMatchesChangedHandler(this.handle, eventObj === null || eventObj === void 0 ? void 0 : eventObj.context))\n Internal.NativeBase.throwLastError();\n }\n catch (err) {\n if (err instanceof NotFoundError)\n throw err;\n }\n listeners.delete(listener);\n if (listeners.size === 0)\n this.eventListeners.delete('totalMatchesChanged');\n }\n }\n }\n }\n /** @internal */\n constructor(handle) {\n super(handle);\n this.eventListeners = new Map();\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new TextSearchIterator(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentTextSearchIteratorClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n *\n * Update {@link PdfViewing.Pdf.Content.TextSearchIterator.match } to the next match in the document.\n * If no further rersult can be found `false` is returned and {@link PdfViewing.Pdf.Content.TextSearchIterator.match } is not updated.\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getNext() {\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfContentTextSearchIteratorGetNext(thisHandle.handle, {\n thisHandle,\n resolved,\n rejected,\n }))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n getNextCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (!retVal)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage);\n if (error === null) {\n context.resolved(retVal);\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Update {@link PdfViewing.Pdf.Content.TextSearchIterator.match } to the next match in the document in backwards direction.\n * If no further rersult can be found `false` is returned and {@link PdfViewing.Pdf.Content.TextSearchIterator.match } is not updated.\n * @returns\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n getPrevious() {\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfContentTextSearchIteratorGetPrevious(thisHandle.handle, {\n thisHandle,\n resolved,\n rejected,\n }))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n getPreviousCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (!retVal)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage);\n if (error === null) {\n context.resolved(retVal);\n }\n else\n context.rejected(error);\n }\n /**\n *\n * Start searching the entire document asynchronously.\n * The property {@link PdfViewing.Pdf.Content.TextSearchIterator.totalMatches } will be updated continuously until the entire document has been searched.\n * This is aborted if this {@link PdfViewing.Pdf.Content.TextSearchIterator } is closed.\n * @returns newly created promise for further asynchronous processing.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n loadAllMatches() {\n var thisHandle = this;\n return new Promise(function (resolved, rejected) {\n if (!Module.ViewingPdfContentTextSearchIteratorLoadAllMatches(thisHandle.handle, {\n thisHandle,\n resolved,\n rejected,\n }))\n rejected(Module.ViewingGetLastErrorMessage());\n });\n }\n loadAllMatchesCallback(context, retVal, errorCode, errorMessage) {\n let error = null;\n if (!retVal)\n error = Internal.NativeBase.createLastError(errorCode, errorMessage, false);\n if (error === null) {\n context.resolved();\n }\n else\n context.rejected(error);\n }\n /**\n * The last text that was found with this search.\n * Initial value is `null`, call {@link PdfViewing.Pdf.Content.TextSearchIterator.getNext } or {@link PdfViewing.Pdf.Content.TextSearchIterator.getPrevious }\n * to get the next matching textselection in the respective direction.\n * Property remains unchanged if call to {@link PdfViewing.Pdf.Content.TextSearchIterator.getNext } or {@link PdfViewing.Pdf.Content.TextSearchIterator.getPrevious } returns `false`.\n * Matches can occur on different kind of content, being represented as different subtypes of {@link PdfViewing.Pdf.Content.Selection }.\n * To get positional information aboutselected text cast to the respective type. e.g. {@link PdfViewing.Pdf.Content.TextSelection } for any results in flowing text.\n */\n get match() {\n let retVal = Module.ViewingPdfContentTextSearchIteratorGetMatch(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.Selection.createDynamicObject(retVal);\n }\n /**\n * Index of the current match since start of textsearchIterator.\n * First Match has index 1.\n */\n get matchIndex() {\n let retVal = Module.ViewingPdfContentTextSearchIteratorGetMatchIndex(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Total known matches in document.\n * This number might not be correct if not all text is loaded.\n */\n get totalMatches() {\n let retVal = Module.ViewingPdfContentTextSearchIteratorGetTotalMatches(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Whether when reaching beginning or end of document (depending on search direction)\n * search should be continued at other end.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get wrapping() {\n let retVal = Module.ViewingPdfContentTextSearchIteratorGetWrapping(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Whether when reaching beginning or end of document (depending on search direction)\n * search should be continued at other end.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n set wrapping(wrapping) {\n if (typeof wrapping !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'wrapping' must be of type boolean and must not be null or undefined.\");\n let retVal = Module.ViewingPdfContentTextSearchIteratorSetWrapping(this.handle, wrapping);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n }\n Content.TextSearchIterator = TextSearchIterator;\n class EventTextSearchIteratorNativeBase {\n constructor(listener) {\n this.listener = listener;\n }\n }\n class MatchChangedNativeClass extends EventTextSearchIteratorNativeBase {\n constructor(listener) {\n super(listener);\n }\n dispatchEventMatchChanged(Match) {\n this.listener(PdfViewing.Pdf.Content.TextSelection.createDynamicObject(Match));\n }\n }\n class TotalMatchesChangedNativeClass extends EventTextSearchIteratorNativeBase {\n constructor(listener) {\n super(listener);\n }\n dispatchEventTotalMatchesChanged() {\n this.listener(undefined);\n }\n }\n /**\n *\n * A rendered image of a page.\n * With high zoom only part of a page is rendered.\n */\n class Image extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfContentImageGetType(handle);\n switch (type) {\n case 0:\n return new Image(handle);\n case 1:\n return PdfViewing.Pdf.Content.PlacedImage.createDynamicObject(handle);\n default:\n return new Image(handle);\n }\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentImageClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n *\n * Removes image data from this image in order to reduce memory usage.\n * This operation invalidates {@link PdfViewing.Pdf.Content.Image.samples } and {@link PdfViewing.Pdf.Content.Image.bufferView }.\n * This functionality should only be used when image data has already been prepared in event `ImageCreated`.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n removeImageData() {\n let retVal = Module.ViewingPdfContentImageRemoveImageData(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError(false);\n }\n /**\n * Indicates whether Image data has been removed using {@link PdfViewing.Pdf.Content.Image.removeImageData }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get hasImageData() {\n let retVal = Module.ViewingPdfContentImageGetHasImageData(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * A unique identifier for this image.\n * Note that the method {@link PdfViewing.Pdf.View.getRenderedResults }\n * returns the same image with the same ID multiple times to conserve memory.\n * Whenever an image is added to the internal cache {@link PdfViewing.Pdf.ViewingPdfViewEventMap.imageCreated } is triggered\n * and when removed from the cache the same ID is returned in event {@link PdfViewing.Pdf.ViewingPdfViewEventMap.imageRemovedFromCache }.\n * An identifier is only unique in the context of the associated {@link PdfViewing.ViewerController }.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get id() {\n let retVal = Module.ViewingPdfContentImageGetId(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Width of the image in pixels\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get width() {\n let retVal = Module.ViewingPdfContentImageGetWidth(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Height of the image in pixels\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get height() {\n let retVal = Module.ViewingPdfContentImageGetHeight(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Number of bytes used per pixel of the image\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get bytePerPixel() {\n let retVal = Module.ViewingPdfContentImageGetBytePerPixel(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * Raw byte array of the image.\n * This operation returns a copy of the internal buffer.\n * If image data has been removed using {@link PdfViewing.Pdf.Content.Image.removeImageData } this array will be empty.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get samples() {\n let retVal = Module.ViewingPdfContentImageGetSamples(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new Uint8Array(retVal);\n }\n /**\n * A buffer view of the raw byte array of the image.\n * This operation returns a direct view on the internal buffer.\n * If image data has been removed using {@link PdfViewing.Pdf.Content.Image.removeImageData } this array will be empty.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get bufferView() {\n let retVal = Module.ViewingPdfContentImageGetBufferView(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Content.Image = Image;\n /**\n *\n * An image that has a specific position on the viewport.\n */\n class PlacedImage extends PdfViewing.Pdf.Content.Image {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new PlacedImage(handle);\n }\n /**\n * Rectangle in relation to the page where the image should be rendered to.\n * Note, that the image might be in different resolution to the size of this rectangle.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get imageRectangle() {\n let retVal = Module.ViewingPdfContentPlacedImageGetImageRectangle(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.Rectangle(retVal.x, retVal.y, retVal.width, retVal.height);\n }\n }\n Content.PlacedImage = PlacedImage;\n /**\n *\n * A text fragment describes part of the text on a page.\n * Usually one text fragment is one line of text, but this may vary.\n */\n class TextFragment extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new TextFragment(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentTextFragmentClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * A rectangle where on the page the text is\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get rectangleOnPage() {\n let retVal = Module.ViewingPdfContentTextFragmentGetRectangleOnPage(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(retVal.pageNumber, retVal.x, retVal.y, retVal.width, retVal.height);\n }\n /**\n * A more accurate description where the text is on the page\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get textArea() {\n let retVal = Module.ViewingPdfContentTextFragmentGetTextArea(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage(retVal.pageNumber, retVal.bottomLeft, retVal.bottomRight, retVal.topRight, retVal.topLeft);\n }\n /**\n * The content of the text\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get text() {\n let retVal = Module.ViewingPdfContentTextFragmentGetText(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * A list of offsets of the separate glyphs of the text.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get glyphOffsets() {\n let retVal = Module.ViewingPdfContentTextFragmentGetGlyphOffsets(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n }\n Content.TextFragment = TextFragment;\n /**\n *\n * A selection of text.\n */\n class Selection extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfContentSelectionGetType(handle);\n switch (type) {\n case 0:\n return new Selection(handle);\n case 1:\n return PdfViewing.Pdf.Content.TextSelection.createDynamicObject(handle);\n default:\n return new Selection(handle);\n }\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentSelectionClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * Actual content of text\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get text() {\n let retVal = Module.ViewingPdfContentSelectionGetText(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Content.Selection = Selection;\n /**\n *\n * A selection of text in the pdf with an associated area on a page.\n */\n class TextSelection extends PdfViewing.Pdf.Content.Selection {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new TextSelection(handle);\n }\n /**\n * Area of all selected text. Used for highlighting.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get textArea() {\n let retVal = Module.ViewingPdfContentTextSelectionGetTextArea(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Geometry.Real.QuadrilateralList.createDynamicObject(retVal);\n }\n }\n Content.TextSelection = TextSelection;\n /**\n *\n * Buffer of binary data\n */\n class BinaryBuffer extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new BinaryBuffer(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentBinaryBufferClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * Copy of raw buffer\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get bufferData() {\n let retVal = Module.ViewingPdfContentBinaryBufferGetBufferData(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new Uint8Array(retVal);\n }\n /**\n * View on raw buffer\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get bufferView() {\n let retVal = Module.ViewingPdfContentBinaryBufferGetBufferView(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Content.BinaryBuffer = BinaryBuffer;\n /**\n *\n * All information concerning a rendered page\n */\n class RenderedPage extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new RenderedPage(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentRenderedPageClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * Describes where a page is located on the viewport.\n * Conventionally a viewer should render this area as a white rectangle.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get pageRect() {\n let retVal = Module.ViewingPdfContentRenderedPageGetPageRect(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Integer.Rectangle(retVal.x, retVal.y, retVal.width, retVal.height);\n }\n /**\n * Describes a rendered image of this page.\n * Depending on the zoom level and resolution this image may not contain the entire page.\n * The image's location and size are relative to the top-left corner of {@link PdfViewing.Pdf.Content.RenderedPage.pageRect }\n * Returns `null` if the page has not yet been rendered.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get image() {\n let retVal = Module.ViewingPdfContentRenderedPageGetImage(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0\n ? PdfViewing.Pdf.Content.PlacedImage.createDynamicObject(retVal)\n : null;\n }\n /**\n * The pagenumber within the document of this page.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get pageNumber() {\n let retVal = Module.ViewingPdfContentRenderedPageGetPageNumber(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Content.RenderedPage = RenderedPage;\n /**\n *\n * A List of {@link PdfViewing.Pdf.Content.RenderedPage }s\n */\n class RenderedPageList extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new RenderedPageList(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentRenderedPageListClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n throw new Error('Method not implemented.');\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingPdfContentRenderedPageListGet(this.handle, index);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.RenderedPage.createDynamicObject(retVal);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingPdfContentRenderedPageListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Content.RenderedPageList = RenderedPageList;\n /**\n *\n * Rendered results concerning the current view.\n */\n class RenderResults extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new RenderResults(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfContentRenderResultsClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * A list of all pages currently visible on the viewport.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get visiblePages() {\n let retVal = Module.ViewingPdfContentRenderResultsGetVisiblePages(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Content.RenderedPageList.createDynamicObject(retVal);\n }\n }\n Content.RenderResults = RenderResults;\n })(Content = Pdf.Content || (Pdf.Content = {}));\n let Navigation;\n (function (Navigation) {\n /**\n *\n * Setting how the viewport will be fitted to the visible content\n */\n let FitMode;\n (function (FitMode) {\n /**\n *\n * Do not fit\n */\n FitMode[FitMode[\"None\"] = 0] = \"None\";\n /**\n *\n * Fit viewport to width of widest visible page\n */\n FitMode[FitMode[\"FitWidth\"] = 1] = \"FitWidth\";\n /**\n *\n * Fit viewport to be able to show largest visible page in its entirety\n */\n FitMode[FitMode[\"FitPage\"] = 2] = \"FitPage\";\n })(FitMode = Navigation.FitMode || (Navigation.FitMode = {}));\n /**\n *\n * Setting how the pages will be arranged on the viewport\n */\n let PageLayoutMode;\n (function (PageLayoutMode) {\n /**\n *\n * Display a single page at a time.\n */\n PageLayoutMode[PageLayoutMode[\"SinglePage\"] = 0] = \"SinglePage\";\n /**\n *\n * Display a Column of pages.\n */\n PageLayoutMode[PageLayoutMode[\"OneColumn\"] = 1] = \"OneColumn\";\n /**\n *\n * Display two columns of pages next to each other. The first page will be on the left.\n */\n PageLayoutMode[PageLayoutMode[\"TwoColumnLeft\"] = 2] = \"TwoColumnLeft\";\n /**\n *\n * Display two columns of pages next to each other. The first page will be on the right.\n */\n PageLayoutMode[PageLayoutMode[\"TwoColumnRight\"] = 3] = \"TwoColumnRight\";\n /**\n *\n * Display two pages next to each other. The first page will be on the left\n */\n PageLayoutMode[PageLayoutMode[\"TwoPageLeft\"] = 4] = \"TwoPageLeft\";\n /**\n *\n * Display two pages next to each other. The first page will be on the right\n */\n PageLayoutMode[PageLayoutMode[\"TwoPageRight\"] = 5] = \"TwoPageRight\";\n })(PageLayoutMode = Navigation.PageLayoutMode || (Navigation.PageLayoutMode = {}));\n /**\n *\n * A List of {@link PdfViewing.Pdf.Navigation.OutlineItem }s\n */\n class OutlineItemList extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new OutlineItemList(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfNavOutlineItemListClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n remove(element) {\n throw new Error('Method not implemented.');\n }\n add(element) {\n throw new Error('Method not implemented.');\n }\n addRange(inputList) {\n throw new Error('Method not implemented.');\n }\n set(index, element) {\n throw new Error('Method not implemented.');\n }\n clear() {\n throw new Error('Method not implemented.');\n }\n get(index) {\n let retVal = Module.ViewingPdfNavOutlineItemListGet(this.handle, index);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Navigation.OutlineItem.createDynamicObject(retVal);\n }\n getRange(index, count) {\n throw new Error('Method not implemented.');\n }\n get size() {\n let retVal = Module.ViewingPdfNavOutlineItemListGetCount(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n [Symbol.iterator]() {\n return new ListIterator(this);\n }\n }\n Navigation.OutlineItemList = OutlineItemList;\n /**\n *\n * A destination is a location in the document that\n * can be used as a jump target,\n * e.g. for outline items (bookmarks) or link annotations.\n */\n class Destination extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfNavDestinationGetType(handle);\n switch (type) {\n case 0:\n return new Destination(handle);\n case 1:\n return PdfViewing.Pdf.Navigation.NamedDestination.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Navigation.DirectDestination.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Navigation.LocationZoomDestination.createDynamicObject(handle);\n case 4:\n return PdfViewing.Pdf.Navigation.FitPageDestination.createDynamicObject(handle);\n case 5:\n return PdfViewing.Pdf.Navigation.FitWidthDestination.createDynamicObject(handle);\n case 6:\n return PdfViewing.Pdf.Navigation.FitHeightDestination.createDynamicObject(handle);\n case 7:\n return PdfViewing.Pdf.Navigation.FitRectangleDestination.createDynamicObject(handle);\n default:\n return new Destination(handle);\n }\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfNavDestinationClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * The target destination (Getter)\n *\n * For direct destinations,\n * this is just the destination itself.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get target() {\n let retVal = Module.ViewingPdfNavDestinationGetTarget(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError(false);\n return PdfViewing.Pdf.Navigation.DirectDestination.createDynamicObject(retVal);\n }\n }\n Navigation.Destination = Destination;\n /**\n *\n * A named destination that can be referred by name.\n * Named destinations have two advantages compared to direct destinations:\n * - The name can be used in web links,\n * e.g. http://www.example.com/document.pdf#destinationname\n * - If the target destination of a named destination is changed,\n * all occurrences automatically point ot the new target.\n */\n class NamedDestination extends PdfViewing.Pdf.Navigation.Destination {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new NamedDestination(handle);\n }\n /**\n * The name by which the destination is referred to.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get name() {\n let retVal = Module.ViewingPdfNavNamedDestinationGetName(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n }\n Navigation.NamedDestination = NamedDestination;\n /**\n *\n *\n * A destination that directly points to a specific location in the document.\n *\n * Note: Many PDF viewers support different viewing modes like \"fit page\" or\n * \"fit width\".\n * Most destination types will change the current viewing mode in those viewers.\n *\n * Changing the viewing mode is usually not very well received by users\n * and thus a {@link PdfViewing.Pdf.Navigation.LocationZoomDestination } should be preferred in most cases.\n */\n class DirectDestination extends PdfViewing.Pdf.Navigation.Destination {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n let type = Module.ViewingPdfNavDirectDestinationGetType(handle);\n switch (type) {\n case 0:\n return new DirectDestination(handle);\n case 1:\n return PdfViewing.Pdf.Navigation.LocationZoomDestination.createDynamicObject(handle);\n case 2:\n return PdfViewing.Pdf.Navigation.FitPageDestination.createDynamicObject(handle);\n case 3:\n return PdfViewing.Pdf.Navigation.FitWidthDestination.createDynamicObject(handle);\n case 4:\n return PdfViewing.Pdf.Navigation.FitHeightDestination.createDynamicObject(handle);\n case 5:\n return PdfViewing.Pdf.Navigation.FitRectangleDestination.createDynamicObject(handle);\n default:\n return new DirectDestination(handle);\n }\n }\n /**\n * The page in the document that this destination is pointing to.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get pageNumber() {\n let retVal = Module.ViewingPdfNavDirectDestinationGetPageNumber(this.handle);\n if (retVal === -1)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Navigation.DirectDestination = DirectDestination;\n /**\n *\n * A destination that points to a specific location on the target page,\n * using a specified zoom factor.\n * The location is displayed in the top left corner of the viewport (if possible).\n */\n class LocationZoomDestination extends PdfViewing.Pdf.Navigation.DirectDestination {\n /**\n *\n * Create a new {@link PdfViewing.Pdf.Navigation.LocationZoomDestination } object.\n * @param pageNumber\n * The page in the document that this destination is pointing to.\n * @param left\n *\n * The location of the page that is displayed at the left border\n * of the viewport or `null`.\n *\n * See property {@link PdfViewing.Pdf.Navigation.LocationZoomDestination.left } for more information.\n * @param top\n *\n * The location of the page that is displayed at the top\n * of the viewport or `null`.\n *\n * See property {@link PdfViewing.Pdf.Navigation.LocationZoomDestination.top } for more information.\n * @param zoom\n *\n * The zoom factor that is applied when jumping to the destination\n * or `null`.\n *\n * See property {@link PdfViewing.Pdf.Navigation.LocationZoomDestination.zoom } for more information.\n */\n constructor(pageNumber, left, top, zoom) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (left !== null && left !== undefined && typeof left !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'left' must be of type number or can be null or undefined.\");\n if (top !== null && top !== undefined && typeof top !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'top' must be of type number or can be null or undefined.\");\n if (zoom !== null && zoom !== undefined && typeof zoom !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'zoom' must be of type number or can be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewLocationZoomDestination(pageNumber, left, top, zoom)));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new LocationZoomDestination({ __handle: handle });\n }\n /**\n *\n * The location of the page that is displayed at the left border of the viewport (if possible).\n *\n * If the property is `null`, the value from before the jump is retained.\n *\n * Note: Due to the current zoom factor,\n * it is usually not possible for viewers to scroll as far to the right side,\n * as would be necessary to place the location at the left corner of the viewport.\n * However, viewers will ensure, that the location is at least visible.\n *\n * In practice this means, that this value is mostly irrelevant.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get left() {\n let retVal = Module.ViewingPdfNavLocationZoomDestinationGetLeft(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n * The location of the page that is displayed at the top of the viewport (if possible).\n *\n * If the property is `null`, the value from before the jump is retained.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get top() {\n let retVal = Module.ViewingPdfNavLocationZoomDestinationGetTop(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n * The zoom factor that is applied when jumping to the destination.\n *\n * A value of `null` means that the current zoom level is retained.\n *\n * Note: Many PDF viewers support different viewing modes like \"fit page\" or \"fit width\".\n *\n * A {@link PdfViewing.Pdf.Navigation.LocationZoomDestination } with a {@link PdfViewing.Pdf.Navigation.LocationZoomDestination.zoom } value of `null`\n * will usually not change the current viewing mode in most viewers.\n *\n * For other {@link PdfViewing.Pdf.Navigation.LocationZoomDestination.zoom } values however,\n * the viewer must switch to the standard mode,\n * i.e. deactivate special modes like \"fit page\" or \"fit width\".\n *\n * Because of this,\n * using a {@link PdfViewing.Pdf.Navigation.LocationZoomDestination.zoom } value other than `null` is discouraged.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get zoom() {\n let retVal = Module.ViewingPdfNavLocationZoomDestinationGetZoom(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Navigation.LocationZoomDestination = LocationZoomDestination;\n /**\n *\n *\n * A destination fits an entire page into the viewport.\n *\n * Note: Many PDF viewers support different viewing modes like \"fit page\" or\n * \"fit width\".\n * A {@link PdfViewing.Pdf.Navigation.FitPageDestination } will change the current viewing mode to\n * \"fit page\" in those viewers.\n *\n * Changing the viewing mode is usually not very well received by users\n * and thus a {@link PdfViewing.Pdf.Navigation.LocationZoomDestination } should be preferred in most cases.\n */\n class FitPageDestination extends PdfViewing.Pdf.Navigation.DirectDestination {\n /**\n *\n * @param pageNumber\n * The page in the document that this destination is pointing to.\n * @param fitActualContent\n *\n * If `true`, the viewport is fitted to the actual content of the page,\n * instead of the size of the page.\n *\n * See property {@link PdfViewing.Pdf.Navigation.FitPageDestination.fitActualContent } for more information.\n */\n constructor(pageNumber, fitActualContent) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (typeof fitActualContent !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'fitActualContent' must be of type boolean and must not be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewFitPageDestination(pageNumber, fitActualContent)));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new FitPageDestination({ __handle: handle });\n }\n /**\n *\n * If `true`, the viewport is fitted to the actual content of the page,\n * instead of the size of the page.\n *\n * Note: Many PDF viewers simply ignore this property and always treat it\n * as `false`, i.e. switching to \"fit page\" mode anyway.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get fitActualContent() {\n let retVal = Module.ViewingPdfNavFitPageDestinationGetFitActualContent(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Navigation.FitPageDestination = FitPageDestination;\n /**\n *\n *\n * A destination fits the width of a page into the viewport.\n *\n * Note: Many PDF viewers support different viewing modes like \"fit page\" or\n * \"fit width\".\n * A {@link PdfViewing.Pdf.Navigation.FitWidthDestination } will change the current viewing mode to\n * \"fit width\" in those viewers.\n *\n * Changing the viewing mode is usually not very well received by users\n * and thus a {@link PdfViewing.Pdf.Navigation.LocationZoomDestination } should be preferred in most cases.\n */\n class FitWidthDestination extends PdfViewing.Pdf.Navigation.DirectDestination {\n /**\n *\n * @param pageNumber\n * The page in the document that this destination is pointing to.\n * @param top\n *\n * The location of the page that is displayed at the top of the viewport (if possible).\n *\n * Set `null` to use top edge of the page.\n * @param fitActualContent\n *\n * If `true`, the viewport is fitted to the actual content of the page,\n * instead of the size of the page.\n *\n * See property {@link PdfViewing.Pdf.Navigation.FitWidthDestination.fitActualContent } for more information.\n */\n constructor(pageNumber, top, fitActualContent) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (top !== null && top !== undefined && typeof top !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'top' must be of type number or can be null or undefined.\");\n if (typeof fitActualContent !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'fitActualContent' must be of type boolean and must not be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewFitWidthDestination(pageNumber, top, fitActualContent)));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new FitWidthDestination({ __handle: handle });\n }\n /**\n *\n * If `true`, the viewport is fitted to the width of the actual content of the page,\n * instead of the width of the page.\n *\n * Note: Many PDF viewers simply ignore this property and always treat it\n * as `false`, i.e. switching to \"fit page\" mode anyway.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get fitActualContent() {\n let retVal = Module.ViewingPdfNavFitWidthDestinationGetFitActualContent(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n * The location of the page that is displayed at the top of the viewport (if possible).\n *\n * If the property is `null`, then the top of the page will be used.\n *\n * This value is ignored by viewers if the view is rotated.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get top() {\n let retVal = Module.ViewingPdfNavFitWidthDestinationGetTop(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Navigation.FitWidthDestination = FitWidthDestination;\n /**\n *\n *\n * A destination fits the height of a page into the viewport.\n *\n * Note: Many PDF viewers support different viewing modes like \"fit page\" or\n * \"fit width\".\n * A {@link PdfViewing.Pdf.Navigation.FitHeightDestination } will change the current viewing mode to\n * \"fit height\" in those viewers.\n *\n * Changing the viewing mode is usually not very well received by users\n * and thus a {@link PdfViewing.Pdf.Navigation.LocationZoomDestination } should be preferred in most cases.\n */\n class FitHeightDestination extends PdfViewing.Pdf.Navigation.DirectDestination {\n /**\n *\n * @param pageNumber\n * The page in the document that this destination is pointing to.\n * @param left\n *\n * The location of the page that is displayed at the left edge of the viewport (if possible).\n *\n * Set `null` to use left edge of the page.\n * @param fitActualContent\n *\n * If `true`, the viewport is fitted to the actual content of the page,\n * instead of the size of the page.\n *\n * See property {@link PdfViewing.Pdf.Navigation.FitHeightDestination.fitActualContent } for more information.\n */\n constructor(pageNumber, left, fitActualContent) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (typeof pageNumber !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'pageNumber' must be of type number and must not be null or undefined.\");\n if (left !== null && left !== undefined && typeof left !== 'number')\n throw new PdfViewing.ArgumentError(\"Argument 'left' must be of type number or can be null or undefined.\");\n if (typeof fitActualContent !== 'boolean')\n throw new PdfViewing.ArgumentError(\"Argument 'fitActualContent' must be of type boolean and must not be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewFitHeightDestination(pageNumber, left, fitActualContent)));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new FitHeightDestination({ __handle: handle });\n }\n /**\n *\n * If `true`, the viewport is fitted to the width of the actual content of the page,\n * instead of the width of the page.\n *\n * Note: Many PDF viewers simply ignore this property and always treat it\n * as `false`, i.e. switching to \"fit page\" mode anyway.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get fitActualContent() {\n let retVal = Module.ViewingPdfNavFitHeightDestinationGetFitActualContent(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n *\n * The location of the page that is displayed as the left edge of the viewport (if possible).\n *\n * If the property is `null`, then the left edge of the page will be used.\n *\n * This value is ignored by viewers if the view is rotated.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get left() {\n let retVal = Module.ViewingPdfNavFitHeightDestinationGetLeft(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Navigation.FitHeightDestination = FitHeightDestination;\n /**\n *\n *\n * A destination that fits a specified area of a page into the viewport.\n *\n * Note: Many PDF viewers support different viewing modes like \"fit page\" or\n * \"fit width\".\n * A {@link PdfViewing.Pdf.Navigation.FitRectangleDestination } will change the current viewing mode to\n * standard mode in those viewers,\n * i.e. deactivate any special mode like \"fit page\" or \"fit width\".\n *\n * Changing the viewing mode is usually not very well received by users\n * and thus a {@link PdfViewing.Pdf.Navigation.LocationZoomDestination } should be preferred in most cases.\n */\n class FitRectangleDestination extends PdfViewing.Pdf.Navigation.DirectDestination {\n /**\n *\n * @param rectangleOnPage\n * The rectangle that is displayed in the viewport.\n */\n constructor(rectangleOnPage) {\n if (arguments[0] && typeof arguments[0].__handle === `number`)\n super(arguments[0].__handle);\n else {\n if (typeof rectangleOnPage !== 'object')\n throw new PdfViewing.ArgumentError(\"Argument 'rectangleOnPage' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.\");\n super(Internal.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewFitRectangleDestination(rectangleOnPage)));\n }\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new FitRectangleDestination({ __handle: handle });\n }\n /**\n * The rectangle that is displayed in the viewport.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get rectangle() {\n let retVal = Module.ViewingPdfNavFitRectangleDestinationGetRectangle(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return new PdfViewing.Pdf.Geometry.Real.RectangleOnPage(retVal.pageNumber, retVal.x, retVal.y, retVal.width, retVal.height);\n }\n }\n Navigation.FitRectangleDestination = FitRectangleDestination;\n /**\n *\n * An outline item represents an entry in the outline tree of the document.\n * It is also known as \"Bookmark\".\n */\n class OutlineItem extends Internal.NativeObject {\n /** @internal */\n constructor(handle) {\n super(handle);\n }\n /** @internal */\n static createDynamicObject(handle) {\n return new OutlineItem(handle);\n }\n /**\n * Close the object\n *\n * Release all native resources associated with the object.\n */\n close() {\n if (!Module.ViewingPdfNavOutlineItemClose(this.handle))\n Internal.NativeBase.throwLastError();\n }\n /**\n * The title of the outline item.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get title() {\n let retVal = Module.ViewingPdfNavOutlineItemGetTitle(this.handle);\n if (retVal === null)\n Internal.NativeBase.throwLastError(false);\n return retVal;\n }\n /**\n * If `true`, the outline item is displayed in bold font.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get bold() {\n let retVal = Module.ViewingPdfNavOutlineItemGetBold(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * If `true`, the outline item is displayed in italic font.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get italic() {\n let retVal = Module.ViewingPdfNavOutlineItemGetItalic(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * The destination of the outline item.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get destination() {\n let retVal = Module.ViewingPdfNavOutlineItemGetDestination(this.handle);\n if (retVal === 0)\n Internal.NativeBase.throwLastError();\n return retVal !== 0\n ? PdfViewing.Pdf.Navigation.Destination.createDynamicObject(retVal)\n : null;\n }\n /**\n * - If `true`, the item is expanded.\n * - If `false`, the item is collapsed.\n * This is property is only meaningful if the item has child items.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get isOpen() {\n let retVal = Module.ViewingPdfNavOutlineItemGetIsOpen(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n /**\n * If `true`, this outline item has further children outline items.\n *\n * @throws {@link PdfViewing.InvalidOperationError} if the object has already been closed\n */\n get hasChildren() {\n let retVal = Module.ViewingPdfNavOutlineItemGetHasChildren(this.handle);\n if (!retVal)\n Internal.NativeBase.throwLastError();\n return retVal;\n }\n }\n Navigation.OutlineItem = OutlineItem;\n })(Navigation = Pdf.Navigation || (Pdf.Navigation = {}));\n })(Pdf = PdfViewing.Pdf || (PdfViewing.Pdf = {}));\n /**\n * A generic error occurred.\n *\n */\n class GenericError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.GenericError = GenericError;\n /**\n * A fatal error occurred.\n *\n */\n class FatalError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.FatalError = FatalError;\n /**\n * The license is not valid.\n *\n */\n class LicenseError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.LicenseError = LicenseError;\n /**\n * The format is not known.\n *\n */\n class UnknownFormatError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.UnknownFormatError = UnknownFormatError;\n /**\n * The file is corrupt and cannot be opened.\n *\n */\n class CorruptError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.CorruptError = CorruptError;\n /**\n * Invalid password specified.\n *\n */\n class PasswordError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.PasswordError = PasswordError;\n /**\n * The document has an invalid conformance level.\n *\n */\n class ConformanceError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.ConformanceError = ConformanceError;\n /**\n * The document contains an unsupported feature.\n *\n */\n class UnsupportedFeatureError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.UnsupportedFeatureError = UnsupportedFeatureError;\n /**\n * Infrastructure error occurred.\n *\n */\n class InfrastructureError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.InfrastructureError = InfrastructureError;\n /**\n * The file cannot be processed.\n *\n */\n class ProcessingError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.ProcessingError = ProcessingError;\n /**\n * The specified item already exists.\n *\n */\n class ExistsError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.ExistsError = ExistsError;\n /**\n * The update failed.\n *\n */\n class UpdateFailedError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.UpdateFailedError = UpdateFailedError;\n /**\n *\n */\n class NotSupportedError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.NotSupportedError = NotSupportedError;\n /**\n *\n */\n class InvalidOperationError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.InvalidOperationError = InvalidOperationError;\n /**\n *\n */\n class ArgumentError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.ArgumentError = ArgumentError;\n /**\n *\n */\n class NotFoundError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.NotFoundError = NotFoundError;\n /**\n *\n */\n class IOError extends PdfViewingError {\n constructor(message) {\n super(message);\n }\n }\n PdfViewing.IOError = IOError;\n let Sys;\n (function (Sys) {\n class StreamObject {\n constructor() {\n /** @internal */\n this._parameter = new Uint8Array(0);\n /** @internal */\n this.currPos = 0;\n }\n /**\n * @returns Underlying Uint8Array.\n */\n get parameter() {\n return this._parameter;\n }\n /**\n * @param value Allowed types are Uint8Array and Blob.\n */\n set parameter(value) {\n if (value instanceof Blob)\n this._parameter = new Uint8Array(new FileReaderSync().readAsArrayBuffer(value));\n else if (value instanceof Uint8Array)\n this._parameter = value;\n else\n throw new TypeError('Not allowed type for parameter in StreamObject. Allowed types are Uint8Array and Blob.');\n }\n /** @internal */\n getLength() {\n return this._parameter.byteLength;\n }\n /** @internal */\n seek(position) {\n if (position > this.getLength())\n return false;\n if (position === -1)\n this.currPos = this.getLength();\n else\n this.currPos = position;\n return true;\n }\n /** @internal */\n tell() {\n return this.currPos;\n }\n /** @internal */\n read(bufoffset, size) {\n size = Math.min(size, this._parameter.byteLength - this.currPos);\n if (size !== 0) {\n let writearr = new Uint8Array(Module.HEAP8.buffer, bufoffset, size);\n writearr.set(this._parameter.subarray(this.currPos, this.currPos + size));\n this.currPos = this.currPos + size;\n return writearr.length;\n }\n return 0;\n }\n /** @internal */\n write(bufoffset, size) {\n let requiredLength = this.currPos + size;\n if (requiredLength > this._parameter.byteLength) {\n // resize Uint8Array-View\n if (requiredLength > this._parameter.buffer.byteLength - this._parameter.byteOffset) {\n // resize underlying ArrayBuffer\n if (requiredLength > Number.MAX_SAFE_INTEGER)\n throw new IOError('Reached maximum array size.');\n let newLength = 8096;\n while (newLength < requiredLength)\n newLength *= 2;\n newLength = Math.min(newLength, Number.MAX_SAFE_INTEGER);\n let uint8ArrayTemp = new Uint8Array(new ArrayBuffer(newLength));\n uint8ArrayTemp.set(this._parameter);\n this._parameter = uint8ArrayTemp;\n }\n this._parameter = new Uint8Array(this._parameter.buffer, this._parameter.byteOffset, requiredLength);\n }\n let readarr = new Uint8Array(Module.HEAP8.buffer, bufoffset, size);\n this._parameter.subarray(this.currPos, this.currPos + size).set(readarr);\n this.currPos = this.currPos + size;\n return size;\n }\n }\n Sys.StreamObject = StreamObject;\n })(Sys = PdfViewing.Sys || (PdfViewing.Sys = {}));\n class ListIterator {\n /** @internal */\n constructor(list) {\n /** @internal */\n this.index = 0;\n this.list = list;\n }\n next() {\n if (this.index === this.list.size)\n return { done: true, value: null };\n let element = this.list.get(this.index);\n this.index++;\n return { done: element === null, value: element };\n }\n }\n class AnnotationFilterWrapper {\n constructor(callback) {\n this.callback = callback;\n }\n annotationFilter(annotation) {\n try {\n let retVal = this.callback(PdfViewing.Pdf.Annotations.Annotation.createDynamicObject(annotation));\n Module.ViewingSetLastError(0, null);\n return retVal;\n }\n catch (err) {\n if (err instanceof Error)\n setLastErrorFromCallback(err);\n return false;\n }\n }\n }\n function setLastErrorFromCallback(err) {\n if (err instanceof PdfViewing.GenericError)\n Module.ViewingSetLastError(10, err.message);\n else if (err instanceof PdfViewing.FatalError)\n Module.ViewingSetLastError(11, err.message);\n else if (err instanceof PdfViewing.LicenseError)\n Module.ViewingSetLastError(12, err.message);\n else if (err instanceof PdfViewing.UnknownFormatError)\n Module.ViewingSetLastError(15, err.message);\n else if (err instanceof PdfViewing.CorruptError)\n Module.ViewingSetLastError(16, err.message);\n else if (err instanceof PdfViewing.PasswordError)\n Module.ViewingSetLastError(17, err.message);\n else if (err instanceof PdfViewing.ConformanceError)\n Module.ViewingSetLastError(18, err.message);\n else if (err instanceof PdfViewing.UnsupportedFeatureError)\n Module.ViewingSetLastError(19, err.message);\n else if (err instanceof PdfViewing.InfrastructureError)\n Module.ViewingSetLastError(20, err.message);\n else if (err instanceof PdfViewing.ProcessingError)\n Module.ViewingSetLastError(21, err.message);\n else if (err instanceof PdfViewing.ExistsError)\n Module.ViewingSetLastError(22, err.message);\n else if (err instanceof PdfViewing.UpdateFailedError)\n Module.ViewingSetLastError(23, err.message);\n else if (err instanceof PdfViewing.NotSupportedError)\n Module.ViewingSetLastError(1, err.message);\n else if (err instanceof PdfViewing.InvalidOperationError)\n Module.ViewingSetLastError(2, err.message);\n else if (err instanceof PdfViewing.ArgumentError)\n Module.ViewingSetLastError(3, err.message);\n else if (err instanceof PdfViewing.NotFoundError)\n Module.ViewingSetLastError(5, err.message);\n else if (err instanceof PdfViewing.IOError)\n Module.ViewingSetLastError(4, err.message);\n else\n Module.ViewingSetLastError(6, err.message);\n }\n})(PdfViewing || (PdfViewing = {}));\n","import { PdfViewing } from '../pdf-viewing/PdfViewing';\nimport { app } from '../lib/hyperapp';\nimport { App } from './views/App';\nimport { FileType, } from '../pdf-viewer-api/types';\nimport { PdfItemCategory, } from '../pdf-viewer-api';\nimport { PdfViewerCanvas } from '../pdf-viewer-canvas/PdfViewerCanvas';\nimport { createState, actions } from './state/index';\nimport { DeviceType, ScreenSize } from './state/layout';\nimport { translationManager } from '../common/TranslationManager';\nimport { tooltipManager } from '../common/TooltipManager';\nimport { ColorPaletteMap, OptionsToVerify, WebViewerOptions, } from './WebViewerOptions';\nimport { getKeyboardCommands } from '../common/utils';\nexport class PdfWebViewer {\n constructor(containerElement, license, options) {\n this.visiblePageRange = {\n firstPage: 0,\n lastPage: 0,\n };\n this.eventListeners = new Map();\n this.loadThumbnailsQueue = [];\n this.loadPageThumbnailsTimer = null;\n this.metadata = {\n version: '4.3.4',\n type: 'stable',\n };\n if (!containerElement) {\n throw { error: 'PdfWebViewer container element is null' };\n }\n this.licenseKey = license;\n this.element = containerElement;\n this.options = new WebViewerOptions(options);\n if (options) {\n this.verifyOptions(options, this.options);\n }\n this.handleKeyboardShortcuts = this.handleKeyboardShortcuts.bind(this);\n this.createView = this.createView.bind(this);\n this.loadPageThumbnails = this.loadPageThumbnails.bind(this);\n this.loadDocumentOutlines = this.loadDocumentOutlines.bind(this);\n this.handleAppLoaded = this.handleAppLoaded.bind(this);\n this.handleResize = this.handleResize.bind(this);\n this.getScreenSize = this.getScreenSize.bind(this);\n this.handleDocumentOpened = this.handleDocumentOpened.bind(this);\n this.handleDocumentClosed = this.handleDocumentClosed.bind(this);\n this.handleFirstVisiblePageChanged = this.handleFirstVisiblePageChanged.bind(this);\n this.handleLastVisiblePageChanged = this.handleLastVisiblePageChanged.bind(this);\n this.handlePageNumberChanged = this.handlePageNumberChanged.bind(this);\n this.handleZoomChanged = this.handleZoomChanged.bind(this);\n this.handleRotationChanged = this.handleRotationChanged.bind(this);\n this.handleFitModeChanged = this.handleFitModeChanged.bind(this);\n this.handlePageLayoutModeChanged = this.handlePageLayoutModeChanged.bind(this);\n this.handleBusyStateChanged = this.handleBusyStateChanged.bind(this);\n this.handlePageChanged = this.handlePageChanged.bind(this);\n this.handleTextSelected = this.handleTextSelected.bind(this);\n this.handleError = this.handleError.bind(this);\n this.addPagesToThumbnailsQueue = this.addPagesToThumbnailsQueue.bind(this);\n this.handleAnnotationCreated = this.handleAnnotationCreated.bind(this);\n this.handleAnnotationUpdated = this.handleAnnotationUpdated.bind(this);\n this.handleAnnotationDeleted = this.handleAnnotationDeleted.bind(this);\n this.handleAnnotationSelected = this.handleAnnotationSelected.bind(this);\n this.handleAnnotationDeselected = this.handleAnnotationDeselected.bind(this);\n this.showUnconfirmedChangesDialog = this.showUnconfirmedChangesDialog.bind(this);\n document.addEventListener('keydown', this.handleKeyboardShortcuts, false);\n const resizeObserver = new ResizeObserver(this.handleResize);\n resizeObserver.observe(this.element);\n tooltipManager.setType(this.options.viewer.general.tooltips || 'title');\n const initialState = createState(this.options);\n initialState.layout.deviceType = /iPhone|iPad|iPod|Android|mobile/i.test(navigator.userAgent)\n ? DeviceType.Mobile\n : DeviceType.Desktop;\n initialState.layout.screenSize = this.getScreenSize();\n this.view = this.createView(app)(initialState, actions, App, this.element);\n }\n /**\n * Open a PDF and optionally one or more associated FDFs.\n * @param pdfFile\n * The PDF file to be opened.\n * @param fdfFiles\n * An array of FDF files to be opened jointly with the PDF.\n * Set to `null` if no FDF files need to be opened.\n * @param password\n * The password used for opening the PDF.\n * Set to `null` if the PDF is not encrypted.\n * @param renderOptions\n * Options used for rendering pages.\n * @param viewOptions\n * Options used for configuring the view\n * @returns\n * void\n */\n open(pdfFile, fdfFiles, password, viewOptions, renderOptions) {\n var _a;\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.api.open({\n pdfFile,\n fdfFiles,\n password,\n viewOptions,\n renderOptions,\n });\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use save method instead.\n */\n openFile(file, password, pdfAuthorization) {\n let inputFile = undefined;\n if (typeof file === 'string') {\n inputFile = { uri: file };\n if (pdfAuthorization) {\n inputFile.httpOptions = {\n headers: {\n Authorization: pdfAuthorization,\n },\n };\n }\n }\n else {\n inputFile = { data: file };\n }\n this.open(inputFile, null, password);\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use save method instead.\n */\n openFDF(pdfFile, fdfFile, password, pdfAuthorization, fdfAuthorization) {\n let pdfInputFile = undefined;\n if (typeof pdfFile === 'string') {\n pdfInputFile = { uri: pdfFile };\n if (pdfAuthorization) {\n pdfInputFile.httpOptions = {\n headers: {\n Authorization: pdfAuthorization,\n },\n };\n }\n }\n else {\n pdfInputFile = { data: pdfFile };\n }\n const fdfInputFile = typeof fdfFile === 'string'\n ? { uri: fdfFile }\n : { data: fdfFile };\n this.open(pdfInputFile, [fdfInputFile], password);\n }\n /**\n * Return the opened PDF as binary data,\n * to be used, e.g., to save the file to disk.\n * @param saveOptions\n * Options for saving the document\n * @returns\n * A Promise with an Blob containing the data or null if no document is open\n *\n */\n save(saveOptions) {\n return this.viewerCanvas ? this.viewerCanvas.save(saveOptions) : null;\n }\n /**\n * @deprecated Deprecated in Version 3.10. Use save method instead.\n */\n saveFile(asFdf) {\n return new Promise((resolve, reject) => {\n var _a;\n const fileType = asFdf ? FileType.Fdf : FileType.Pdf;\n (_a = this.save({ fileType })) === null || _a === void 0 ? void 0 : _a.then((blob) => {\n resolve(blob.arrayBuffer());\n });\n });\n }\n /**\n * saves the currently opened PDF file to the local file system\n */\n downloadFile(saveOptions) {\n if (this.view) {\n return this.view.api.downloadFile(saveOptions);\n }\n }\n /**\n * Close the currently opened PDF file.\n */\n close() {\n if (this.view) {\n return this.view.api.close();\n }\n }\n /**\n * dispose the PdfWebViewer.\n */\n destroy() {\n var _a;\n // remove all event listeners\n document.removeEventListener('keydown', this.handleKeyboardShortcuts, false);\n this.eventListeners.clear();\n if (this.viewerCanvas) {\n this.viewerCanvas.removeEventListener('appLoaded', this.handleAppLoaded);\n this.viewerCanvas.removeEventListener('firstVisiblePage', this.handleFirstVisiblePageChanged);\n this.viewerCanvas.removeEventListener('lastVisiblePage', this.handleLastVisiblePageChanged);\n this.viewerCanvas.removeEventListener('pageNumber', this.handlePageNumberChanged);\n this.viewerCanvas.removeEventListener('zoom', this.handleZoomChanged);\n this.viewerCanvas.removeEventListener('fitMode', this.handleFitModeChanged);\n this.viewerCanvas.removeEventListener('pageLayoutMode', this.handlePageLayoutModeChanged);\n this.viewerCanvas.removeEventListener('busyState', this.handleBusyStateChanged);\n this.viewerCanvas.removeEventListener('rotation', this.handleRotationChanged);\n this.viewerCanvas.removeEventListener('pageChanged', this.handlePageChanged);\n this.viewerCanvas.removeEventListener('error', this.handleError);\n this.viewerCanvas.removeEventListener('itemCreated', this.handleAnnotationCreated);\n this.viewerCanvas.removeEventListener('itemUpdated', this.handleAnnotationUpdated);\n this.viewerCanvas.removeEventListener('itemDeleted', this.handleAnnotationDeleted);\n this.viewerCanvas.removeEventListener('itemSelected', this.handleAnnotationSelected);\n this.viewerCanvas.removeEventListener('itemDeselected', this.handleAnnotationDeselected);\n }\n // destroy viewer canvas\n (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.destroy();\n this.viewerCanvas = undefined;\n this.view = undefined;\n this.loadThumbnailsQueue = [];\n if (this.loadPageThumbnailsTimer) {\n clearTimeout(this.loadPageThumbnailsTimer);\n }\n // remove all child elements\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild);\n }\n }\n /**\n * Get the total page count of the opened document.\n * @returns\n * The total number of pages of the currently opened file.\n * Returns null if no document is open\n */\n getPageCount() {\n return this.viewerCanvas ? this.viewerCanvas.getPageCount() : null;\n }\n /**\n * Get the currently most visible page.\n * @returns\n * The number of the page which covers most area on the view port.\n * If multiple pages cover the same amount of space,\n * the one with smaller page number is returned.\n * Returns null if no document is open\n */\n getPageNumber() {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getPageNumber();\n }\n return null;\n }\n /**\n * Sets the first currently visible page.\n * @param pageNumber\n * The number of the page to be displayed\n */\n setPageNumber(pageNumber) {\n if (this.viewerCanvas) {\n this.viewerCanvas.setPageNumber(pageNumber);\n }\n }\n /**\n * Rotates a page 90 degrees either clockwise or counterclockwise\n *\n * @param pageNumber\n * The number of the page to be rotated\n * @param direction\n * Specifies whether the rotation is clockwise or counterclockwise.\n */\n rotatePage(pageNumber, direction) {\n if (this.viewerCanvas) {\n this.viewerCanvas.rotatePage(pageNumber, direction);\n }\n }\n /**\n * Go to the next page.\n */\n nextPage() {\n if (this.viewerCanvas) {\n this.viewerCanvas.nextPage();\n }\n }\n /**\n * Go to the previousPage page.\n */\n previousPage() {\n if (this.viewerCanvas) {\n this.viewerCanvas.previousPage();\n }\n }\n /**\n * Get the viewer zoom.\n * @returns\n * The currently used zoom factor.\n * Returns null if no document is open.\n */\n getZoom() {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getZoom();\n }\n return null;\n }\n /**\n * Set the viewer zoom.\n * @param zoom\n * The zoom factor as a percentage of the original size.\n */\n setZoom(zoom) {\n if (this.viewerCanvas) {\n this.viewerCanvas.setZoom(zoom);\n }\n }\n /**\n * Sets the zoom to the closest higher predefined zoom Level.\n */\n zoomIn() {\n var _a;\n (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.zoomIn();\n }\n /**\n * Sets the zoom to the closest smaller predefined zoom Level.\n */\n zoomOut() {\n var _a;\n (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.zoomOut();\n }\n /**\n * Get the current fit mode.\n * @returns\n * The mode that is currently used for fitting the viewport to the visible pages.\n * Returns null if no document is open.\n */\n getFitMode() {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getFitMode();\n }\n return null;\n }\n /**\n * Set the fit mode.\n * @param fitMode\n * The mode to be used for fitting the viewport to the visible pages.\n */\n setFitMode(fitMode) {\n if (this.viewerCanvas) {\n this.viewerCanvas.setFitMode(fitMode);\n }\n }\n /**\n * Get the current page layout mode.\n * @returns\n * The mode that is currently used for arranging pages on the canvas.\n * Returns null if no document is open.\n */\n getPageLayoutMode() {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getPageLayoutMode();\n }\n return null;\n }\n /**\n * Set the page layout mode.\n * @param pageLayoutMode\n * The mode to be used for arranging pages on the canvas.\n */\n setPageLayoutMode(pageLayoutMode) {\n if (this.viewerCanvas) {\n this.viewerCanvas.setPageLayoutMode(pageLayoutMode);\n }\n }\n /**\n * Get the viewer rotation.\n * @returns\n * The currently used viewer rotation on all pages.\n * Returns null if no document is open\n */\n getRotation() {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getRotation();\n }\n return null;\n }\n /**\n * Set the viewer rotation.\n * NOTE: This only changes the view of the document and is not an operation on the document.\n * @param rotation\n * The rotation to be applied on all pages (cumulative with the embedded rotation per page).\n */\n setRotation(rotation) {\n if (this.viewerCanvas) {\n this.viewerCanvas.setRotation(rotation);\n }\n }\n /**\n * Get the product version of the viewer.\n * @returns\n * The product version of the PDF Web Viewer.\n */\n getProductVersion() {\n return PdfViewing.Sdk.version;\n }\n /**\n * Get the metadata of the viewer.\n * @returns\n * The metadata of the PDF Web Viewer.\n */\n getMetadata() {\n return this.metadata;\n }\n /**\n * Check whether there are unsaved changes in the document.\n * @returns\n * A DocumentChange enum indicating what kind of changes were made\n * Returns null if no document is open\n */\n hasChanges() {\n if (this.view) {\n return this.view.api.hasChanges();\n }\n return null;\n }\n /**\n * Opens the information pane and selects the given pane\n * @selectedPane\n * Name of the pane thath should be displayed\n */\n showInformationPane(selectedPane) {\n if (this.view) {\n if (selectedPane) {\n this.view.navigationPanel.selectNavigation(selectedPane);\n }\n else {\n this.view.navigationPanel.showNavigationPanel();\n }\n }\n }\n /**\n * Closes the information pane\n */\n hideInformationPane() {\n if (this.view) {\n this.view.navigationPanel.hideNavigationPanel();\n }\n }\n /**\n * Toggle the information pane\n */\n toggleInformationPane() {\n if (this.view) {\n this.view.navigationPanel.toggleNavigationPanel();\n }\n }\n /**\n * Opens the search tool bar and starts a new search with the given text\n * @param text\n * text to be searched for\n * @param searchOptions\n * Options for be used for searching\n */\n startSearch(searchString, searchOptions) {\n if (this.view && this.viewerCanvas) {\n const { startPage, isCaseSensitive, isWrappingEnabled, isRegex, hideToolbar } = searchOptions || {};\n const caseSensitive = Boolean(isCaseSensitive);\n const wrappingEnabled = Boolean(isWrappingEnabled);\n const regex = Boolean(isRegex);\n if (!hideToolbar) {\n this.view.search.openSearch();\n this.view.search.updateToSearch(searchString);\n this.view.search.setCaseSensitive(caseSensitive);\n this.view.search.setWrappingSearch(wrappingEnabled);\n this.view.search.setRegex(regex);\n }\n this.viewerCanvas.startSearch(searchString, startPage || 1, caseSensitive, wrappingEnabled, regex);\n }\n }\n /**\n * Highlights the next search result\n */\n nextSearchMatch() {\n if (this.viewerCanvas) {\n this.viewerCanvas.nextSearchMatch();\n }\n }\n /**\n * Highlights the previous search result\n */\n previousSearchMatch() {\n if (this.viewerCanvas) {\n this.viewerCanvas.previousSearchMatch();\n }\n }\n /**\n * Stops the current search and closes the search tool bar\n */\n endSearch() {\n if (this.view) {\n this.view.api.endSearch();\n this.view.search.closeSearch();\n }\n }\n /**\n * Opens the print dialog\n */\n print() {\n var _a;\n (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.print();\n }\n /**\n * Returns the selected text\n */\n getSelectedText() {\n var _a, _b;\n return (_b = (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.getSelectedText()) !== null && _b !== void 0 ? _b : '';\n }\n /**\n * Register a function that will be called whenever the specified event is delivered\n * @param type\n * String representing the event type to listen for.\n * @param listener\n * The function that will be executet when an event of the specified type occurs\n */\n addEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n ;\n this.eventListeners.get(type).push(listener);\n }\n else {\n this.eventListeners.set(type, [listener]);\n }\n }\n /**\n * Removes an event listener previously registered with addEventListener\n * @param type\n * String representing the event for which to remove an event listener.\n * @param listener\n * The event listener function of the event handler to remove from the event target.\n */\n removeEventListener(type, listener) {\n if (this.eventListeners.has(type)) {\n let listeners = this.eventListeners.get(type);\n listeners = listeners.filter((listenerInArray) => listenerInArray !== listener);\n if (listeners.length !== 0) {\n this.eventListeners.set(type, listeners);\n }\n else {\n this.eventListeners.delete(type);\n }\n }\n }\n dispatchEvent(type, args) {\n if (this.eventListeners.has(type)) {\n const listeners = this.eventListeners.get(type);\n listeners.forEach((listener) => listener(args));\n }\n }\n createView(nextApp) {\n return (state, a, view, element) => {\n a.initialize = () => {\n const loadTranslationPromise = translationManager.loadTranslations(this.options.viewer.general.language || 'en');\n Promise.all([window.PdfToolsPromise, loadTranslationPromise])\n .then(() => {\n var _a;\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.loadScriptsCompleted();\n })\n .catch((err) => {\n this.handleError(err);\n });\n };\n a.createCanvasView = (elm) => {\n try {\n this.viewerCanvas = new PdfViewerCanvas(elm, this.licenseKey, this.options);\n }\n catch (err) {\n this.handleError(err);\n return;\n }\n this.viewerCanvas.addEventListener('appLoaded', this.handleAppLoaded);\n this.viewerCanvas.addEventListener('firstVisiblePage', this.handleFirstVisiblePageChanged);\n this.viewerCanvas.addEventListener('lastVisiblePage', this.handleLastVisiblePageChanged);\n this.viewerCanvas.addEventListener('pageNumber', this.handlePageNumberChanged);\n this.viewerCanvas.addEventListener('zoom', this.handleZoomChanged);\n this.viewerCanvas.addEventListener('fitMode', this.handleFitModeChanged);\n this.viewerCanvas.addEventListener('rotation', this.handleRotationChanged);\n this.viewerCanvas.addEventListener('pageLayoutMode', this.handlePageLayoutModeChanged);\n this.viewerCanvas.addEventListener('busyState', this.handleBusyStateChanged);\n this.viewerCanvas.addEventListener('pageChanged', this.handlePageChanged);\n this.viewerCanvas.addEventListener('textSelected', this.handleTextSelected);\n this.viewerCanvas.addEventListener('error', this.handleError);\n /*** annotation events */\n this.viewerCanvas.addEventListener('itemCreated', this.handleAnnotationCreated);\n this.viewerCanvas.addEventListener('itemUpdated', this.handleAnnotationUpdated);\n this.viewerCanvas.addEventListener('itemDeleted', this.handleAnnotationDeleted);\n this.viewerCanvas.addEventListener('itemSelected', this.handleAnnotationSelected);\n this.viewerCanvas.addEventListener('itemDeselected', this.handleAnnotationDeselected);\n const params = new URLSearchParams(location.search);\n if (params) {\n const pdfUrl = params.get('url');\n if (pdfUrl) {\n this.open({ uri: pdfUrl, sourceTag: '' });\n }\n }\n };\n a.removeCanvasView = (elm) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.removeEventListener('firstVisiblePage', this.handleFirstVisiblePageChanged);\n this.viewerCanvas.removeEventListener('lastVisiblePage', this.handleLastVisiblePageChanged);\n this.viewerCanvas.removeEventListener(`pageNumber`, this.handlePageNumberChanged);\n this.viewerCanvas.removeEventListener('zoom', this.handleZoomChanged);\n this.viewerCanvas.removeEventListener('fitMode', this.handleFitModeChanged);\n this.viewerCanvas.removeEventListener('pageLayoutMode', this.handlePageLayoutModeChanged);\n this.viewerCanvas.removeEventListener('busyState', this.handleBusyStateChanged);\n this.viewerCanvas.removeEventListener('error', this.handleError);\n this.viewerCanvas = undefined;\n }\n };\n a.api = {\n open: (args) => {\n if (this.view) {\n this.view.loadDocumentBegin();\n if (this.viewerCanvas) {\n if (!this.beforeOpen(args)) {\n return;\n }\n if (this.viewerCanvas) {\n this.viewerCanvas\n .open(args.pdfFile, args.fdfFiles, args.password, args.viewOptions, args.renderOptions)\n .then(() => {\n this.openResolve(args);\n })\n .catch((error) => {\n this.openReject(args, error);\n });\n }\n }\n }\n },\n close: () => {\n if (this.view && this.viewerCanvas) {\n if (this.showUnconfirmedChangesDialog()) {\n this.view.showConfirmUnsavedChangesDialog(null, this.handleDocumentClosed);\n return;\n }\n this.handleDocumentClosed();\n }\n },\n downloadFile: (saveOptions) => {\n return new Promise((resolve, reject) => {\n if (this.view && this.viewerCanvas) {\n this.view.saveDocumentBegin();\n const viewState = this.view.getState();\n const filename = viewState.pdfDocument.filename;\n const mimetype = viewState.pdfDocument.mimetype;\n this.viewerCanvas\n .save(saveOptions)\n .then((data) => {\n const newBlob = new Blob([data], { type: mimetype });\n const dataUrl = window.URL.createObjectURL(newBlob);\n const link = document.createElement('a');\n link.style.position = 'absolute';\n link.style.left = '-1000px';\n link.href = dataUrl;\n link.download = filename || 'download.pdf';\n this.element.appendChild(link);\n link.click();\n setTimeout(() => {\n var _a;\n this.element.removeChild(link);\n window.URL.revokeObjectURL(dataUrl);\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.saveDocumentFulfilled();\n }, 100);\n resolve();\n })\n .catch((error) => {\n var _a;\n console.error(error);\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.saveDocumentRejected(error);\n });\n }\n });\n },\n hasChanges: () => {\n if (this.viewerCanvas) {\n return this.viewerCanvas.hasChanges();\n }\n return null;\n },\n setZoom: (zoom) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.setZoom(zoom / 100);\n }\n },\n getZoom: () => {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getZoom();\n }\n return null;\n },\n zoomIn: () => {\n if (this.viewerCanvas) {\n this.viewerCanvas.zoomIn();\n }\n },\n zoomOut: () => {\n if (this.viewerCanvas) {\n this.viewerCanvas.zoomOut();\n }\n },\n setPageNumber: (page) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.setPageNumber(page);\n }\n },\n getPageNumber: () => {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getPageNumber();\n }\n return null;\n },\n getPageCount: () => {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getPageCount();\n }\n return null;\n },\n nextPage: () => {\n if (this.viewerCanvas) {\n this.viewerCanvas.nextPage();\n }\n },\n previousPage: () => {\n if (this.viewerCanvas) {\n this.viewerCanvas.previousPage();\n }\n },\n setFitMode: (fitMode) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.setFitMode(fitMode);\n }\n },\n getFitMode: () => {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getFitMode();\n }\n return null;\n },\n setPageLayoutMode: (layoutMode) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.setPageLayoutMode(layoutMode);\n }\n },\n getPageLayoutMode: () => {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getPageLayoutMode();\n }\n return null;\n },\n rotatePage: (pageRotation) => {\n if (this.viewerCanvas) {\n return this.viewerCanvas.rotatePage(pageRotation.page, pageRotation.direction);\n }\n },\n rotate: () => {\n if (this.viewerCanvas) {\n const r = this.viewerCanvas.getRotation();\n const rotation = r >= 270 ? 0 : r + 90;\n this.viewerCanvas.setRotation(rotation);\n }\n },\n setRotation: (rotation) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.setRotation(rotation);\n }\n },\n getRotation: () => {\n if (this.viewerCanvas) {\n return this.viewerCanvas.getRotation();\n }\n return null;\n },\n startSearch: () => {\n if (this.view && this.viewerCanvas) {\n const s = this.view.getState().search;\n this.viewerCanvas.startSearch(s.searchString, 1, s.caseSensitive, s.wrapSearch, s.useRegex);\n }\n },\n nextSearchMatch: () => {\n if (this.viewerCanvas) {\n this.viewerCanvas.nextSearchMatch();\n }\n },\n previousSearchMatch: () => {\n if (this.viewerCanvas) {\n this.viewerCanvas.previousSearchMatch();\n }\n },\n endSearch: () => {\n if (this.viewerCanvas) {\n this.viewerCanvas.endSearch();\n }\n },\n updateCanvasSearchState: (state) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.updateCanvasSearchState(state);\n }\n },\n goTo: (pdfDestination) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.goTo(pdfDestination);\n }\n },\n goToAnnotation: (target) => {\n if (this.viewerCanvas) {\n if (target.annotation.isHidden()) {\n this.handleAnnotationSelected(target.annotation);\n }\n else {\n try {\n this.viewerCanvas.goToAnnotation(target.annotation, target.action);\n }\n catch (err) {\n console.error(err);\n }\n }\n }\n },\n resetViewerMode: (pdfDestination) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.resetViewerMode();\n }\n },\n loadNavigationItems: () => {\n if (this.view) {\n this.loadPageThumbnails();\n this.loadAnnotations();\n const viewState = this.view.getState();\n if (!viewState.navigationPanel.outlineItemsLoaded) {\n this.loadDocumentOutlines();\n }\n }\n },\n addPageRangeToThumbnailsQueue: (pageRange) => {\n this.addPagesToThumbnailsQueue(pageRange.from, pageRange.to);\n },\n print: () => {\n if (this.viewerCanvas) {\n this.viewerCanvas.print();\n }\n },\n activateModule: (moduleName, args) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.activateModule(moduleName, args);\n }\n },\n deactivateModule: (moduleName) => {\n if (this.viewerCanvas) {\n this.viewerCanvas.deactivateModule(moduleName);\n }\n },\n };\n a.initialize();\n return nextApp(state, a, view, element);\n };\n }\n getScreenSize() {\n var _a;\n const widthToScreenSize = (width) => {\n if (width <= ScreenSize.Small) {\n return ScreenSize.Small;\n }\n if (width <= ScreenSize.Medium) {\n return ScreenSize.Medium;\n }\n return ScreenSize.Large;\n };\n const viewerElm = this.element.firstChild;\n if (!this.view || !viewerElm) {\n return widthToScreenSize(this.element.getBoundingClientRect().width);\n }\n if (viewerElm.offsetWidth && viewerElm.offsetHeight && viewerElm.getClientRects().length) {\n return widthToScreenSize(viewerElm.getBoundingClientRect().width);\n }\n return (_a = this.view) === null || _a === void 0 ? void 0 : _a.getState().layout.screenSize;\n }\n handleResize() {\n if (this.view) {\n const screenSize = this.getScreenSize();\n if (this.view.getState().layout.screenSize !== screenSize) {\n this.view.layout.setScreenSize(screenSize);\n }\n }\n }\n handleKeyboardShortcuts(e) {\n var _a, _b, _c;\n // check if element is visible\n const rect = this.element.getBoundingClientRect();\n if (rect.width + rect.height === 0) {\n return;\n }\n const { shortcuts } = this.options;\n if (Object.keys(shortcuts).length > 0) {\n const keyboardCommands = getKeyboardCommands(e, shortcuts);\n if (!keyboardCommands.length) {\n return;\n }\n keyboardCommands.forEach((cmd) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;\n switch (cmd[0]) {\n case 'save': {\n const { allowSaveFile } = this.options.viewer.permissions;\n if (allowSaveFile) {\n e.preventDefault();\n if (this.options.viewer.callbacks.onSaveFileButtonClicked) {\n this.options.viewer.onSaveFileButtonClicked();\n }\n else {\n this.downloadFile();\n }\n }\n break;\n }\n case 'print': {\n const { allowPrinting } = this.options.viewer.permissions;\n if (allowPrinting) {\n e.preventDefault();\n (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.print();\n }\n break;\n }\n case 'cancelPrint': {\n const { allowPrinting } = this.options.viewer.permissions;\n if (allowPrinting) {\n (_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.deactivateModule('PrintServiceModule');\n }\n break;\n }\n case 'search': {\n const { enableSearch } = this.options.viewer.permissions;\n if (enableSearch) {\n e.preventDefault();\n (_c = this.view) === null || _c === void 0 ? void 0 : _c.search.openSearch();\n }\n break;\n }\n case 'searchNext': {\n const { enableSearch } = this.options.viewer.permissions;\n if (enableSearch) {\n const state = (_d = this.view) === null || _d === void 0 ? void 0 : _d.getState();\n if (state && state.search && state.search.showSearch && state.search.searchString) {\n (_e = this.viewerCanvas) === null || _e === void 0 ? void 0 : _e.nextSearchMatch();\n }\n e.preventDefault();\n }\n break;\n }\n case 'searchPrevious': {\n const { enableSearch } = this.options.viewer.permissions;\n if (enableSearch) {\n const state = (_f = this.view) === null || _f === void 0 ? void 0 : _f.getState();\n if (state && state.search && state.search.showSearch && state.search.searchString) {\n (_g = this.viewerCanvas) === null || _g === void 0 ? void 0 : _g.previousSearchMatch();\n }\n e.preventDefault();\n }\n break;\n }\n case 'closeSearch': {\n const { enableSearch } = this.options.viewer.permissions;\n if (enableSearch) {\n e.preventDefault();\n (_h = this.viewerCanvas) === null || _h === void 0 ? void 0 : _h.endSearch();\n (_j = this.view) === null || _j === void 0 ? void 0 : _j.search.closeSearch();\n }\n break;\n }\n case 'toggleSidePane': {\n const { sidebar } = this.options.viewer;\n if (sidebar.annotationNavigation ||\n sidebar.outlineNavigation ||\n sidebar.annotationNavigation) {\n e.preventDefault();\n (_k = this.view) === null || _k === void 0 ? void 0 : _k.navigationPanel.toggleNavigationPanel();\n }\n break;\n }\n case 'showAnnotations': {\n const { sidebar } = this.options.viewer;\n if (sidebar.annotationNavigation) {\n e.preventDefault();\n (_l = this.view) === null || _l === void 0 ? void 0 : _l.navigationPanel.selectNavigation('annotation');\n }\n break;\n }\n case 'showOutline': {\n const { sidebar } = this.options.viewer;\n if (sidebar.outlineNavigation) {\n e.preventDefault();\n (_m = this.view) === null || _m === void 0 ? void 0 : _m.navigationPanel.selectNavigation('outline');\n }\n break;\n }\n case 'showThumbnails': {\n const { sidebar } = this.options.viewer;\n if (sidebar.thumbnailNavigation) {\n e.preventDefault();\n (_o = this.view) === null || _o === void 0 ? void 0 : _o.navigationPanel.selectNavigation('thumbnail');\n }\n break;\n }\n }\n });\n }\n else if (e.key === 'Escape') {\n (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.deactivateModule('PrintServiceModule');\n (_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.endSearch();\n (_c = this.view) === null || _c === void 0 ? void 0 : _c.search.closeSearch();\n }\n }\n showUnconfirmedChangesDialog() {\n if (this.view && this.viewerCanvas) {\n const currentState = this.view.getState();\n const hasChanges = this.viewerCanvas.hasChanges();\n return (!currentState.unsavedChangesDialogDontSave &&\n currentState.hasDocument &&\n hasChanges &&\n this.options.viewer.general.promptOnUnsavedChange &&\n this.options.viewer.permissions.allowSaveFile);\n }\n }\n beforeOpen(args) {\n if (this.view && this.viewerCanvas) {\n if (this.showUnconfirmedChangesDialog()) {\n this.view.showConfirmUnsavedChangesDialog(args);\n return false;\n }\n this.view.navigationPanel.clear();\n this.view.loadDocumentBegin();\n return true;\n }\n }\n openResolve(fileOpenArgs) {\n if (this.view && this.viewerCanvas) {\n this.view.pdfDocument.setFileInfo(fileOpenArgs.pdfFile);\n this.view.pdfDocument.setHasChanges(false);\n const pageCount = this.viewerCanvas.getPageCount();\n this.view.pdfDocument.setPageCount(pageCount);\n this.handleDocumentOpened();\n this.view.loadDocumentFulfilled();\n this.view.api.loadNavigationItems();\n const inputFile = fileOpenArgs.pdfFile;\n const eventArg = inputFile.uri\n ? inputFile.uri\n : new File([], inputFile.sourceTag, { type: 'application/pdf' });\n this.dispatchEvent('documentLoaded', eventArg);\n }\n }\n openReject(fileOpenArgs, error) {\n if (this.view) {\n if (error.message === 'password required') {\n this.view.loadDocumentPasswordForm(fileOpenArgs);\n }\n else {\n this.view.loadDocumentRejected(error.message);\n }\n }\n }\n handleDocumentOpened() {\n if (this.view && this.viewerCanvas) {\n const pageCount = this.viewerCanvas.getPageCount();\n this.view.navigationPanel.setThumbnailPlaceholders(pageCount);\n const viewerState = this.view.getState();\n this.view.navigationPanel.clearAnnotations();\n if (viewerState.navigationPanel.showNavigation) {\n if (viewerState.navigationPanel.selectedNavigation === 'thumbnail') {\n this.loadPageThumbnails();\n }\n else if (viewerState.navigationPanel.selectedNavigation === 'outline') {\n this.loadDocumentOutlines();\n }\n else {\n this.loadAnnotations();\n }\n }\n }\n }\n loadDocumentOutlines() {\n if (this.viewerCanvas) {\n this.viewerCanvas.getDocumentOutline().then((outlines) => {\n if (this.view) {\n this.view.navigationPanel.setOutlines(outlines);\n }\n });\n }\n }\n loadPageThumbnails() {\n if (this.view && this.viewerCanvas) {\n const state = this.view.getState();\n const fromPage = state.pdfDocument.firstVisiblePage - 5;\n const toPage = state.pdfDocument.lastVisiblePage + 5;\n this.addPagesToThumbnailsQueue(fromPage, toPage);\n }\n }\n addPagesToThumbnailsQueue(fromPage, toPage) {\n if (this.view && this.viewerCanvas) {\n const state = this.view.getState();\n if (fromPage < 1) {\n fromPage = 1;\n }\n if (toPage < fromPage) {\n toPage = state.pdfDocument.firstVisiblePage + 5;\n }\n if (toPage > state.pdfDocument.pageCount) {\n toPage = state.pdfDocument.pageCount;\n }\n const pagesToLoad = state.navigationPanel.pages\n .filter((p) => p.pageNumber >= fromPage &&\n p.pageNumber <= toPage &&\n p.thumbnail === null &&\n p.loading === null)\n .map((p) => p.pageNumber);\n pagesToLoad.forEach((p) => {\n var _a;\n if (this.loadThumbnailsQueue.indexOf(p) < 0) {\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.navigationPanel.updateThumbnail({\n pageNumber: p,\n thumbnail: null,\n loading: true,\n });\n this.loadThumbnailsQueue.push(p);\n }\n });\n const getPageThumbnail = (pageNumber) => {\n this.updatePageThumbnail(pageNumber).then(() => {\n const nextPage = this.loadThumbnailsQueue.shift();\n if (nextPage) {\n getPageThumbnail(nextPage);\n }\n }).catch(() => { });\n };\n const firstPage = this.loadThumbnailsQueue.shift();\n if (firstPage) {\n getPageThumbnail(firstPage);\n }\n }\n }\n updatePageThumbnail(pageNumber) {\n return new Promise((resolve, reject) => {\n if (this.view && this.viewerCanvas) {\n this.viewerCanvas\n .renderPage(pageNumber, 200, 200)\n .then((thumbnail) => {\n var _a;\n const canvasElement = document.createElement('canvas');\n canvasElement.width = thumbnail.imageData.width;\n canvasElement.height = thumbnail.imageData.height;\n const ctx = canvasElement.getContext('2d');\n ctx && ctx.putImageData(thumbnail.imageData, 0, 0);\n const imageData = canvasElement.toDataURL('image/png');\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.navigationPanel.updateThumbnail({\n pageNumber: thumbnail.page,\n thumbnail: imageData,\n loading: false,\n });\n resolve();\n })\n .catch((error) => reject(error));\n }\n else {\n reject();\n }\n });\n }\n loadAnnotations() {\n if (!this.options.viewer.sidebar.annotationNavigation) {\n return;\n }\n if (this.view) {\n const state = this.view.getState();\n if (state.navigationPanel.annotationsLoaded) {\n return;\n }\n this.view.navigationPanel.initAnnotations(state.pdfDocument.pageCount);\n const loadNext = (pages) => {\n if (this.viewerCanvas) {\n const pageNumber = pages.shift();\n if (typeof pageNumber === 'number') {\n this.viewerCanvas\n .getAnnotationsFromPage(pageNumber)\n .then((itemsOnPage) => {\n var _a, _b;\n const selectableItems = itemsOnPage.items.filter((item) => { var _a; return (_a = item.behaviors) === null || _a === void 0 ? void 0 : _a.selectable; });\n if (selectableItems.length) {\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.navigationPanel.setPageAnnotations({\n page: itemsOnPage.page,\n itemCategory: PdfItemCategory.ANNOTATION,\n items: selectableItems,\n });\n }\n if (pages.length > 0) {\n loadNext(pages);\n }\n else {\n (_b = this.view) === null || _b === void 0 ? void 0 : _b.navigationPanel.setAnnotationLoaded();\n }\n });\n }\n }\n };\n const pageCount = this.getPageCount() || 0;\n const pageNumbers = [];\n for (let i = 1; i <= pageCount; i++) {\n pageNumbers.push(i);\n }\n loadNext(pageNumbers);\n }\n }\n handleDocumentClosed() {\n var _a, _b;\n (_a = this.view) === null || _a === void 0 ? void 0 : _a.closeDocument();\n (_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.close();\n this.handleResize();\n this.dispatchEvent('documentClosed', undefined);\n return;\n }\n handleAppLoaded(loaded) {\n if (this.view && this.viewerCanvas) {\n this.view.initializeAppFulfilled({ licenseFeatures: this.viewerCanvas.licenseFeatures });\n const canvasModules = this.viewerCanvas.getModules();\n this.view.setCanvasModules(canvasModules);\n this.dispatchEvent('appLoaded', loaded);\n }\n }\n handleFirstVisiblePageChanged(page) {\n if (this.view) {\n this.visiblePageRange.firstPage = page;\n this.updateVisiblePageRange();\n this.view.pdfDocument.setFirstVisiblePage(page);\n }\n }\n handleLastVisiblePageChanged(page) {\n if (this.view) {\n this.visiblePageRange.lastPage = page;\n this.updateVisiblePageRange();\n this.view.pdfDocument.setLastVisiblePage(page);\n }\n }\n handlePageNumberChanged(page) {\n if (this.view) {\n this.view.pdfDocument.setPageNumber(page);\n const { navigationPanel } = this.view.getState();\n if (navigationPanel.showNavigation && navigationPanel.selectedNavigation === 'thumbnail') {\n const elm = this.element.querySelector(`#pwv-thumbnail-navigation-page_${page}`);\n const container = this.element.querySelector('.pwv-NavigationPanel__Content');\n if (elm && container) {\n const containerBoundingRect = container.getBoundingClientRect();\n const pageBoundingRect = elm.getBoundingClientRect();\n if (pageBoundingRect.top < containerBoundingRect.top ||\n pageBoundingRect.bottom > containerBoundingRect.bottom) {\n elm.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n }\n }\n }\n this.dispatchEvent('pageNumberChanged', page);\n }\n }\n updateVisiblePageRange() {\n if (this.view) {\n const state = this.view.getState();\n if (state.navigationPanel.showNavigation &&\n state.navigationPanel.selectedNavigation === 'thumbnail') {\n if (this.loadPageThumbnailsTimer) {\n window.clearTimeout(this.loadPageThumbnailsTimer);\n }\n this.loadPageThumbnailsTimer = window.setTimeout(() => {\n this.loadPageThumbnailsTimer = null;\n this.loadPageThumbnails();\n }, 100);\n }\n }\n }\n handleZoomChanged(zoom) {\n if (this.view) {\n this.view.pdfDocument.setZoom(zoom * 100);\n this.dispatchEvent('zoomChanged', zoom);\n }\n }\n handleFitModeChanged(fitMode) {\n if (this.view) {\n this.view.pdfDocument.setFitMode(fitMode);\n }\n this.dispatchEvent('fitModeChanged', fitMode);\n }\n handlePageLayoutModeChanged(layoutMode) {\n if (this.view) {\n this.view.pdfDocument.setPageLayoutMode(layoutMode);\n }\n this.dispatchEvent('pageLayoutModeChanged', layoutMode);\n }\n handleRotationChanged(rotation) {\n this.dispatchEvent('rotationChanged', rotation);\n }\n handleBusyStateChanged(state) {\n this.dispatchEvent('busyState', state);\n }\n handleAnnotationSelected(item) {\n if (this.view) {\n const annotation = item;\n this.view.navigationPanel.selectAnnotation(annotation);\n const { navigationPanel } = this.view.getState();\n if (navigationPanel.showNavigation && navigationPanel.selectedNavigation === 'annotation') {\n const elm = this.element.querySelector(`#pwv-annotation-navigation-item-${annotation.id}`);\n if (elm) {\n elm.scrollIntoView({ behavior: 'smooth' });\n }\n }\n }\n }\n handleAnnotationDeselected(item) {\n if (this.view) {\n this.view.navigationPanel.deselectAnnotation();\n }\n }\n handleAnnotationCreated(item) {\n if (this.view) {\n const annotation = item;\n this.view.navigationPanel.updateAnnotation(annotation);\n const { navigationPanel } = this.view.getState();\n if (navigationPanel.showNavigation && navigationPanel.selectedNavigation === 'annotation') {\n window.setTimeout(() => {\n const elm = this.element.querySelector(`#pwv-annotation-navigation-item-${annotation.id}`);\n if (elm) {\n elm.scrollIntoView({ behavior: 'smooth' });\n }\n }, 10);\n }\n }\n }\n handleAnnotationUpdated(item) {\n if (this.view) {\n const annotation = item;\n this.view.navigationPanel.updateAnnotation(annotation);\n }\n }\n handleAnnotationDeleted(deletedItem) {\n if (this.view) {\n this.view.navigationPanel.deleteAnnotation(deletedItem);\n }\n }\n handlePageChanged(pageNumber) {\n // the list is 0 index based. E.g. page 1 is at index 0\n if (this.view) {\n const pageNavigationItem = this.view.getState().navigationPanel.pages[pageNumber - 1];\n if (pageNavigationItem && pageNavigationItem.thumbnail !== null) {\n this.updatePageThumbnail(pageNumber);\n }\n this.dispatchEvent('documentChanged', undefined);\n }\n }\n handleTextSelected(text) {\n this.dispatchEvent('textSelected', text);\n }\n verifyOptions(clientOptions, defaultOptions) {\n // Verify annotation Color options\n if (clientOptions.annotation && clientOptions.annotation.colors) {\n Object.keys(OptionsToVerify).forEach((k) => {\n if (clientOptions.annotation && clientOptions.annotation.colors[k]) {\n if (!this.isContainedInArray(clientOptions.annotation.colors[k], defaultOptions.annotation.colors[OptionsToVerify[k]])) {\n throw new Error(`Invalid ${k}: ${defaultOptions.annotation.colors[k]} has not been found in ${OptionsToVerify[k]}.\\n` +\n `Valid values are: ${defaultOptions.annotation.colors[OptionsToVerify[k]]}`);\n }\n }\n });\n Object.keys(ColorPaletteMap).forEach((k) => {\n if (clientOptions.annotation &&\n clientOptions.annotation.colors[k] &&\n !clientOptions.annotation.colors[ColorPaletteMap[k]]) {\n throw new Error(`Cannot set ${k} without setting ${ColorPaletteMap[k]}. Preset ${ColorPaletteMap[k]} might not be in ${k}`);\n }\n });\n }\n }\n isContainedInArray(item, list) {\n if (!list.find((el) => el === item)) {\n return false;\n }\n return true;\n }\n handleError(error) {\n if (this.view) {\n this.view.setError(error.message);\n }\n this.dispatchEvent('error', error);\n }\n}\n","export class UserSettings {\n constructor() {\n this.localStorageAccessible = false;\n let settingsStr = null;\n try {\n settingsStr = localStorage.getItem('PDFToolsAG.ViewerSettings');\n this.localStorageAccessible = true;\n }\n catch (err) {\n console.warn('local storage not accessible');\n }\n try {\n this.toolSettings = settingsStr ? JSON.parse(settingsStr) : {};\n }\n catch (_a) {\n this.toolSettings = {};\n }\n this.save = this.save.bind(this);\n this.getItem = this.getItem.bind(this);\n this.setItem = this.setItem.bind(this);\n }\n save() {\n if (this.localStorageAccessible) {\n const settings = JSON.stringify(this.toolSettings);\n localStorage.setItem('PDFToolsAG.ViewerSettings', settings);\n }\n }\n getItem(key, defaultValue) {\n if (this.localStorageAccessible && this.toolSettings.hasOwnProperty(key)) {\n return this.toolSettings[key];\n }\n return defaultValue;\n }\n setItem(key, value) {\n if (this.localStorageAccessible) {\n this.toolSettings[key] = value;\n this.save();\n }\n }\n}\n","import { UserSettings } from './UserSettings';\nimport { FreetextAnnotationModule, HighlightAnnotationModule, ImageAnnotationModule, InkAnnotationModule, PopupModule, ShapeAnnotationModule, StampAnnotationModule, TextAnnotationModule, PrintServiceModule, EraserModule, FormFieldModule, } from '../modules';\nimport { PdfPageLayoutMode, StampAnnotationColor, } from '../pdf-viewer-api';\nexport const defaultAnnotationColorOptions = {\n highlightColors: ['#2ADB1A', '#FFEA02', '#FF7F1F', '#FF2882', '#008AD1'],\n foregroundColors: ['#323232', '#FFFFFF', '#FFEA02', '#2ADB1A', '#0066CC', '#D82F32'],\n backgroundColors: ['#FFFFFF', '#FCF5E2', '#323232', '#FFEA02', '#D82F32', '#0066CC'],\n defaultHighlightColor: '#FFEA02',\n defaultBackgroundColor: '#FCF5E2',\n defaultForegroundColor: '#323232',\n};\nexport const defaultAnnotationFontOptions = {\n fontFamilies: ['Helvetica', 'Times', 'Courier', 'Symbol', 'ZapfDingbats'],\n fontSizes: [9, 10, 12, 14, 16, 18, 20, 24],\n defaultFontFamily: 'Helvetica',\n defaultFontSize: 12,\n};\nexport const defaultAnnotationStamps = [\n { translation_key: 'stamptext.approved', color: StampAnnotationColor.GREEN },\n { translation_key: 'stamptext.notApproved', color: StampAnnotationColor.RED },\n { translation_key: 'stamptext.draft', color: StampAnnotationColor.BLUE },\n { translation_key: 'stamptext.final', color: StampAnnotationColor.GREEN },\n { translation_key: 'stamptext.completed', color: StampAnnotationColor.GREEN },\n {\n translation_key: 'stamptext.confidential',\n color: StampAnnotationColor.BLUE,\n },\n { translation_key: 'stamptext.forPublic', color: StampAnnotationColor.BLUE },\n {\n translation_key: 'stamptext.notForPublic',\n color: StampAnnotationColor.BLUE,\n },\n { translation_key: 'stamptext.void', color: StampAnnotationColor.RED },\n { translation_key: 'stamptext.forComment', color: StampAnnotationColor.BLUE },\n {\n translation_key: 'stamptext.preliminaryResults',\n color: StampAnnotationColor.BLUE,\n },\n {\n translation_key: 'stamptext.informationOnly',\n color: StampAnnotationColor.BLUE,\n },\n];\nexport const defaultAnnotationOptions = {\n colors: defaultAnnotationColorOptions,\n stamps: defaultAnnotationStamps,\n fonts: defaultAnnotationFontOptions,\n highlightOpacity: 0.5,\n strokeWidths: [0, 1, 2, 3, 5, 8, 13, 21],\n defaultStampWidth: 120,\n defaultBorderWidth: 1,\n eraserRadius: 5,\n hideAnnotationSubject: false,\n trackHistory: false,\n onlyAuthorCanEdit: false,\n hideOnDelete: false,\n selectedStamp: 0,\n};\nexport const defaultGeneralOptions = {\n user: '',\n language: 'en',\n annotationBarPosition: 'left',\n promptOnUnsavedChange: true,\n searchMatchColor: '#3ABCFF',\n textSelectionColor: '#006395',\n rectangularTextSelection: 'none',\n pageShadow: {\n shadowBlur: 4,\n shadowColor: 'rgba(90,90,90,0.2)',\n shadowOffsetX: 0,\n shadowOffsetY: 0,\n },\n pageLayoutModes: [\n PdfPageLayoutMode.ONE_COLUMN,\n PdfPageLayoutMode.SINGLE_PAGE,\n PdfPageLayoutMode.TWO_COLUMN_LEFT,\n PdfPageLayoutMode.TWO_COLUMN_RIGHT,\n PdfPageLayoutMode.TWO_PAGE_LEFT,\n PdfPageLayoutMode.TWO_PAGE_RIGHT,\n ],\n defaultZoomLevels: [\n 0.1, 0.15, 0.2, 0.25, 0.35, 0.4, 0.5, 0.65, 0.8, 1, 1.25, 1.5, 2.0, 2.5, 3.0, 4.0,\n ],\n tooltips: 'title',\n viewOnly: false,\n disableMainToolbar: false,\n disableAnnotationToolbar: false,\n};\nexport const defaultKeyboardShortcuts = {\n zoomIn: { key: '+' },\n zoomOut: { key: '-' },\n nextPage: { key: 'PageDown' },\n previousPage: { key: 'PageUp' },\n firstPage: { key: 'Home' },\n lastPage: { key: 'End' },\n scrollUp: { key: 'ArrowUp' },\n scrollDown: { key: 'ArrowDown' },\n scrollLeft: { key: 'ArrowLeft' },\n scrollRight: { key: 'ArrowRight' },\n releaseSelection: { key: 'Escape' },\n copy: {\n key: 'c',\n ctrlKey: true,\n },\n copyMac: {\n key: 'c',\n superKey: true,\n },\n print: {\n key: 'p',\n ctrlKey: true,\n },\n cancelPrint: {\n key: 'Escape',\n },\n resetZoom: {\n key: 'z',\n altKey: true,\n },\n fitToPage: {\n key: 'p',\n altKey: true,\n },\n fitToWidth: {\n key: 'w',\n altKey: true,\n },\n rotateView: {\n key: 'r',\n altKey: true,\n },\n save: {\n key: 's',\n ctrlKey: true,\n },\n search: {\n key: 'f',\n ctrlKey: true,\n },\n searchNext: { key: 'F3' },\n searchPrevious: {\n key: 'F3',\n shiftKey: true,\n },\n closeSearch: { key: 'Escape' },\n toggleSidePane: {\n key: 's',\n altKey: true,\n },\n showAnnotations: {\n key: 'a',\n altKey: true,\n },\n showOutline: {\n key: 'o',\n altKey: true,\n },\n showThumbnails: {\n key: 't',\n altKey: true,\n },\n cancelEditAnnotation: { key: 'Escape' },\n};\nexport const defaultSidebarOptions = {\n annotationNavigation: true,\n thumbnailNavigation: true,\n outlineNavigation: true,\n};\nexport const defaultFormsOptions = {\n enabled: true,\n};\nexport const defaultPermissions = {\n allowOpenFile: true,\n allowCloseFile: false,\n allowFileDrop: true,\n allowPrinting: false,\n allowSaveFile: true,\n allowCopyText: true,\n allowRotateView: true,\n allowLockAnnotations: true,\n allowEditLockedAnnotations: false,\n allowRotatePages: true,\n enablePageLayoutMode: true,\n enableSearch: true,\n};\nexport const defaultViewerOptions = {\n general: defaultGeneralOptions,\n sidebar: defaultSidebarOptions,\n permissions: defaultPermissions,\n callbacks: {},\n customButtons: {\n annotationbar: [],\n documentbar: [],\n informationbar: [],\n },\n};\nexport const defaultViewerModules = [\n PopupModule,\n TextAnnotationModule,\n InkAnnotationModule,\n EraserModule,\n FreetextAnnotationModule,\n HighlightAnnotationModule,\n StampAnnotationModule,\n ShapeAnnotationModule,\n ImageAnnotationModule,\n];\nexport const defaultWebViewerOptions = {\n viewer: defaultViewerOptions,\n modules: defaultViewerModules,\n annotation: defaultAnnotationOptions,\n forms: defaultFormsOptions,\n shortcuts: defaultKeyboardShortcuts,\n};\nexport const OptionsToVerify = {\n defaultHighlightAnnotationColor: 'highlightColors',\n defaultFreetextBgColor: 'backgroundColors',\n defaultFreetextFontColor: 'foregroundColors',\n defaultFreetextFontFamily: 'fontFamilies',\n defaultFreetextFontSize: 'fontSizes',\n defaultInkColor: 'foregroundColors',\n defaultStickyNoteColor: 'highlightColors',\n defaultBackgroundColor: 'backgroundColors',\n defaultForegroundColor: 'foregroundColors',\n defaultHighlightColor: 'highlightColors',\n defaultFontSize: 'fontSizes',\n};\nexport const ColorPaletteMap = {\n highlightColors: 'defaultHighlightColor',\n backgroundColors: 'defaultBackgroundColor',\n foregroundColors: 'defaultForegroundColor',\n};\nclass StorageClass {\n constructor() {\n this.internalStorage = new UserSettings();\n }\n get storage() {\n return this.internalStorage;\n }\n}\nexport class GeneralOptions extends StorageClass {\n constructor(_options) {\n super();\n this.options = Object.assign(Object.assign({}, defaultGeneralOptions), _options);\n }\n get user() {\n return this.options.user;\n }\n get language() {\n return this.options.language;\n }\n get annotationBarPosition() {\n return this.options.annotationBarPosition;\n }\n set annotationBarPosition(position) {\n this.storage.setItem('annotationBarPosition', position);\n }\n get promptOnUnsavedChange() {\n return this.options.promptOnUnsavedChange;\n }\n get textSelectionColor() {\n return this.options.textSelectionColor;\n }\n get rectangularTextSelection() {\n return this.options.rectangularTextSelection;\n }\n get searchMatchColor() {\n return this.options.searchMatchColor;\n }\n get pageLayoutModes() {\n return this.options.pageLayoutModes;\n }\n get defaultZoomLevels() {\n return this.options.defaultZoomLevels;\n }\n get pageShadow() {\n return this.options.pageShadow;\n }\n get currentPageShadow() {\n return this.options.currentPageShadow;\n }\n get viewOnly() {\n return this.options.viewOnly;\n }\n get tooltips() {\n return this.options.tooltips;\n }\n get disableMainToolbar() {\n return this.options.disableMainToolbar;\n }\n get disableAnnotationToolbar() {\n return this.options.disableAnnotationToolbar;\n }\n}\nexport class SidebarOptions {\n constructor(_options) {\n this.options = Object.assign(Object.assign({}, defaultSidebarOptions), _options);\n }\n get thumbnailNavigation() {\n return this.options.thumbnailNavigation;\n }\n get outlineNavigation() {\n return this.options.outlineNavigation;\n }\n get annotationNavigation() {\n return this.options.annotationNavigation;\n }\n}\nexport class FormsOptions {\n constructor(_options) {\n this.options = Object.assign(Object.assign({}, defaultFormsOptions), _options);\n }\n get enabled() {\n return this.options.enabled;\n }\n}\nexport class ViewerOptions {\n constructor(_options) {\n var _a, _b, _c, _d, _e, _f;\n this.options = {\n general: Object.assign(Object.assign({}, defaultViewerOptions.general), _options === null || _options === void 0 ? void 0 : _options.general),\n sidebar: Object.assign(Object.assign({}, defaultViewerOptions.sidebar), _options === null || _options === void 0 ? void 0 : _options.sidebar),\n permissions: Object.assign(Object.assign({}, defaultViewerOptions.permissions), _options === null || _options === void 0 ? void 0 : _options.permissions),\n callbacks: Object.assign(Object.assign({}, defaultViewerOptions.callbacks), _options === null || _options === void 0 ? void 0 : _options.callbacks),\n customButtons: {\n annotationbar: ((_a = _options === null || _options === void 0 ? void 0 : _options.customButtons) === null || _a === void 0 ? void 0 : _a.annotationbar)\n ? (_b = _options === null || _options === void 0 ? void 0 : _options.customButtons) === null || _b === void 0 ? void 0 : _b.annotationbar\n : [],\n documentbar: ((_c = _options === null || _options === void 0 ? void 0 : _options.customButtons) === null || _c === void 0 ? void 0 : _c.documentbar)\n ? (_d = _options === null || _options === void 0 ? void 0 : _options.customButtons) === null || _d === void 0 ? void 0 : _d.documentbar\n : [],\n informationbar: ((_e = _options === null || _options === void 0 ? void 0 : _options.customButtons) === null || _e === void 0 ? void 0 : _e.informationbar)\n ? (_f = _options === null || _options === void 0 ? void 0 : _options.customButtons) === null || _f === void 0 ? void 0 : _f.informationbar\n : [],\n },\n };\n this.generalOptions = new GeneralOptions(_options === null || _options === void 0 ? void 0 : _options.general);\n }\n get general() {\n return this.generalOptions;\n }\n get sidebar() {\n return this.options.sidebar;\n }\n get permissions() {\n return this.options.permissions;\n }\n get callbacks() {\n return this.options.callbacks;\n }\n get customButtons() {\n return this.options.customButtons;\n }\n}\nexport class AnnotationColorOptions extends StorageClass {\n constructor(_options) {\n super();\n this.options = Object.assign(Object.assign({}, defaultAnnotationColorOptions), _options);\n }\n get highlightColors() {\n return this.options.highlightColors;\n }\n get foregroundColors() {\n return this.options.foregroundColors;\n }\n get backgroundColors() {\n return this.options.backgroundColors;\n }\n get defaultHighlightColor() {\n return this.options.defaultHighlightColor;\n }\n get defaultForegroundColor() {\n return this.options.defaultForegroundColor;\n }\n get defaultBackgroundColor() {\n return this.options.defaultBackgroundColor;\n }\n get highlightAnnotationColor() {\n return this.storage.getItem('highlightAnnotationColor', this.defaultHighlightColor);\n }\n set highlightAnnotationColor(color) {\n this.storage.setItem('highlightAnnotationColor', color);\n }\n get stickyNoteColor() {\n return this.storage.getItem('stickyNoteColor', this.options.defaultHighlightColor);\n }\n set stickyNoteColor(color) {\n this.storage.setItem('stickyNoteColor', color);\n }\n get freetextBackgroundColor() {\n return this.storage.getItem('freetextBackgroundColor', this.defaultBackgroundColor);\n }\n set freetextBackgroundColor(color) {\n this.storage.setItem('freetextBackgroundColor', color);\n }\n set freetextFontColor(color) {\n this.storage.setItem('freetextFontColor', color);\n }\n get freetextFontColor() {\n return this.storage.getItem('freetextFontColor', this.options.defaultForegroundColor);\n }\n get inkColor() {\n return this.storage.getItem('inkColor', this.options.defaultForegroundColor);\n }\n set inkColor(color) {\n this.storage.setItem('inkColor', color);\n }\n get inkOpacity() {\n return this.storage.getItem('inkOpacity', 100);\n }\n set inkOpacity(opacity) {\n this.storage.setItem('inkOpacity', opacity);\n }\n set shapeColor(color) {\n this.storage.setItem('shapeAnnotationColor', color);\n }\n get shapeColor() {\n return this.storage.getItem('shapeAnnotationColor', this.options.defaultForegroundColor);\n }\n set shapeFillColor(color) {\n this.storage.setItem('shapeFillColor', color);\n }\n get shapeFillColor() {\n return this.storage.getItem('shapeFillColor', this.defaultHighlightColor);\n }\n}\nexport class AnnotationFontOptions extends StorageClass {\n constructor(_options) {\n super();\n this.options = Object.assign(Object.assign({}, defaultAnnotationFontOptions), _options);\n }\n get fontFamilies() {\n return this.options.fontFamilies;\n }\n get fontSizes() {\n return this.options.fontSizes;\n }\n get defaultFontFamily() {\n return this.options.defaultFontFamily;\n }\n get defaultFontSize() {\n return this.options.defaultFontSize;\n }\n get freetextFontSize() {\n return this.storage.getItem('freetextFontSize', this.defaultFontSize);\n }\n set freetextFontSize(size) {\n this.storage.setItem('freetextFontSize', size);\n }\n get freetextFontFamily() {\n return this.storage.getItem('freetextFontFamily', this.defaultFontFamily);\n }\n set freetextFontFamily(fontFamily) {\n this.storage.setItem('freetextFontFamily', fontFamily);\n }\n}\nexport class AnnotationOptions extends StorageClass {\n constructor(_options) {\n super();\n this.options = Object.assign(Object.assign({}, defaultAnnotationOptions), _options);\n this.colorOptions = new AnnotationColorOptions(_options === null || _options === void 0 ? void 0 : _options.colors);\n this.fontOptions = new AnnotationFontOptions(_options === null || _options === void 0 ? void 0 : _options.fonts);\n }\n get stamps() {\n return this.options.stamps;\n }\n get colors() {\n return this.colorOptions;\n }\n get fonts() {\n return this.fontOptions;\n }\n get highlightOpacity() {\n return this.options.highlightOpacity;\n }\n get strokeWidths() {\n return this.options.strokeWidths;\n }\n set shapeStrokeWidth(width) {\n this.storage.setItem('shapeStrokeWidth', width);\n }\n get shapeStrokeWidth() {\n return this.storage.getItem('shapeStrokeWidth', this.options.defaultBorderWidth);\n }\n set shapeStrokeStyle(style) {\n this.storage.setItem('shapeStrokeStyle', style);\n }\n get shapeStrokeStyle() {\n return this.storage.getItem('shapeStrokeStyle', 0); // TODO use proper stroke types\n }\n set inkWidth(width) {\n this.storage.setItem('inkWidth', width);\n }\n get inkWidth() {\n return this.storage.getItem('inkWidth', this.options.defaultBorderWidth);\n }\n set freetextBorderWidth(width) {\n this.storage.setItem('freetextBorderWidth', width);\n }\n get freetextBorderWidth() {\n return this.storage.getItem('freetextBorderWidth', this.options.defaultBorderWidth);\n }\n get defaultBorderWidth() {\n return this.options.defaultBorderWidth;\n }\n get defaultStampWidth() {\n return this.options.defaultStampWidth;\n }\n get hideOnDelete() {\n return this.options.hideOnDelete;\n }\n get trackHistory() {\n return this.options.trackHistory;\n }\n get hideAnnotationSubject() {\n return this.options.hideAnnotationSubject;\n }\n get onlyAuthorCanEdit() {\n return this.options.onlyAuthorCanEdit;\n }\n get annotationPermissionCallback() {\n return this.options.annotationPermissionCallback;\n }\n get selectedStamp() {\n return this.storage.getItem('selectedStamp', 0);\n }\n set selectedStamp(stampNumber) {\n this.storage.setItem('selectedStamp', stampNumber);\n }\n set eraserRadius(width) {\n this.storage.setItem('eraserRadius', width);\n }\n get eraserRadius() {\n return this.storage.getItem('eraserRadius', 5);\n }\n}\nexport class WebViewerOptions {\n constructor(_options) {\n var _a, _b, _c;\n const mergedOptions = Object.assign(Object.assign({}, defaultWebViewerOptions), _options);\n if (!mergedOptions.modules.find((m) => m === PrintServiceModule)) {\n (_a = mergedOptions.modules) === null || _a === void 0 ? void 0 : _a.push(PrintServiceModule);\n }\n if (((_b = mergedOptions.forms) === null || _b === void 0 ? void 0 : _b.enabled) && !mergedOptions.modules.find((m) => m === FormFieldModule)) {\n (_c = mergedOptions.modules) === null || _c === void 0 ? void 0 : _c.push(FormFieldModule);\n }\n if ((_options === null || _options === void 0 ? void 0 : _options.shortcuts) === null) {\n ;\n mergedOptions.shortcuts = {};\n }\n else {\n mergedOptions.shortcuts = Object.assign(Object.assign({}, defaultWebViewerOptions.shortcuts), _options === null || _options === void 0 ? void 0 : _options.shortcuts);\n }\n this.options = mergedOptions;\n this.viewerOptions = new ViewerOptions(mergedOptions ? mergedOptions.viewer : mergedOptions);\n this.annotationOptions = new AnnotationOptions(mergedOptions ? mergedOptions.annotation : mergedOptions);\n this.formsOptions = new FormsOptions(mergedOptions ? mergedOptions.forms : mergedOptions);\n }\n get viewer() {\n return this.viewerOptions;\n }\n get annotation() {\n return this.annotationOptions;\n }\n get forms() {\n return this.formsOptions;\n }\n get modules() {\n return this.options.modules;\n }\n set modules(modules) {\n this.options.modules = modules;\n }\n get shortcuts() {\n return this.options.shortcuts;\n }\n}\n","import * as Layout from './layout';\nimport * as PasswordForm from './passwordForm';\nimport * as NavigationPanel from './navigationPanel';\nimport * as PdfDocument from './pdfDocument';\nimport * as Search from './search';\nimport { defaultWebViewerOptions } from '../WebViewerOptions';\nconst defaultState = {\n licenseFeatures: {\n annotate: false,\n fillFormFields: false,\n pageRotation: false,\n },\n scriptsLoaded: false,\n appInitialized: false,\n fileDropEnabled: false,\n hasDocument: false,\n showPasswordForm: false,\n passwordDialogTempPdfFile: null,\n passwordDialogTempFdfFile: null,\n showOpenFileErrorDialog: false,\n showUnsavedChangesDialog: false,\n fileOpenArgs: null,\n unsavedChangesDialogDontSave: false,\n showLoadingIndicator: false,\n showSaveIndicator: false,\n hasError: false,\n errorMessage: '',\n layout: Layout.state,\n passwordForm: PasswordForm.state,\n navigationPanel: NavigationPanel.state,\n pdfDocument: PdfDocument.state,\n search: Search.state,\n options: defaultWebViewerOptions,\n canvasModules: [],\n closeCallback: undefined,\n};\n/** internal */\nexport const createState = (options) => {\n const state = Object.assign(Object.assign({}, JSON.parse(JSON.stringify(defaultState))), { options });\n const { sidebar } = options.viewer;\n if (sidebar.selectedNavigation) {\n state.navigationPanel.selectedNavigation = sidebar.selectedNavigation;\n state.navigationPanel.showNavigation = true;\n }\n else if (!sidebar.thumbnailNavigation) {\n state.navigationPanel.selectedNavigation = sidebar.outlineNavigation ? 'outline' : 'annotation';\n }\n return state;\n};\n/** internal */\nexport const actions = {\n layout: Layout.actions,\n passwordForm: PasswordForm.actions,\n navigationPanel: NavigationPanel.actions,\n pdfDocument: PdfDocument.actions,\n search: Search.actions,\n loadScriptsCompleted: () => ($state) => (Object.assign(Object.assign({}, $state), { scriptsLoaded: true })),\n initializeAppFulfilled: (settings) => ($state) => (Object.assign(Object.assign({}, $state), { licenseFeatures: settings.licenseFeatures, appInitialized: true, fileDropEnabled: true })),\n initializeAppRejected: (error) => ($state) => (Object.assign(Object.assign({}, $state), { hasError: true, errorMessage: error, appInitialized: true })),\n setCanvasModules: (canvasModules) => ($state) => (Object.assign(Object.assign({}, $state), { canvasModules: canvasModules })),\n loadDocumentBegin: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { fileDropEnabled: false, showLoadingIndicator: true, unsavedChangesDialogDontSave: false });\n },\n loadDocumentFulfilled: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { hasDocument: true, fileDropEnabled: true, showPasswordForm: false, passwordDialogTempPdfFile: null, showLoadingIndicator: false });\n },\n loadDocumentCancel: () => ($state) => (Object.assign(Object.assign({}, $state), { fileDropEnabled: true, showPasswordForm: false, passwordDialogTempPdfFile: null, showLoadingIndicator: false })),\n loadDocumentRejected: (error) => ($state) => (Object.assign(Object.assign({}, $state), { fileDropEnabled: false, passwordDialogTempPdfFile: null, showPasswordForm: false, showLoadingIndicator: false, showOpenFileErrorDialog: true })),\n loadDocumentConfirmRejected: () => ($state) => (Object.assign(Object.assign({}, $state), { fileDropEnabled: true, showOpenFileErrorDialog: false })),\n loadDocumentPasswordForm: (fileOpenArgs) => ($state) => {\n $state.passwordForm.invalidPasswordError = $state.passwordDialogTempPdfFile !== null;\n return Object.assign(Object.assign({}, $state), { fileOpenArgs, showPasswordForm: true, showLoadingIndicator: false });\n },\n closeDocument: () => ($state) => (Object.assign(Object.assign({}, JSON.parse(JSON.stringify(defaultState))), { appInitialized: true, scriptsLoaded: true, fileDropEnabled: true, options: $state.options, licenseFeatures: $state.licenseFeatures })),\n // tslint:disable-next-line: max-line-length\n showConfirmUnsavedChangesDialog: (fileOpenArgs, closeCallback) => ($state) => {\n return Object.assign(Object.assign({}, $state), { fileOpenArgs,\n closeCallback, showUnsavedChangesDialog: true });\n },\n unsavedChangesDialogCancel: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { showUnsavedChangesDialog: false, showLoadingIndicator: false, hasDocument: true, closeCallback: undefined });\n },\n unsavedChangesDialogFileSaved: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { unsavedChangesDialogTempPdfFile: null, unsavedChangesDialogTempFdfFile: null, showUnsavedChangesDialog: false, closeCallback: undefined });\n },\n unsavedChangesDialogDontSave: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { unsavedChangesDialogDontSave: false, showUnsavedChangesDialog: false, hasDocument: false });\n },\n saveDocumentBegin: (error) => ($state) => (Object.assign(Object.assign({}, $state), { showSaveIndicator: true })),\n saveDocumentFulfilled: (error) => ($state) => (Object.assign(Object.assign({}, $state), { showSaveIndicator: false })),\n saveDocumentRejected: (error) => ($state) => (Object.assign(Object.assign({}, $state), { hasError: true, errorMessage: error, appInitialized: true, showSaveIndicator: false })),\n setError: (error) => ($state) => (Object.assign(Object.assign({}, $state), { hasError: true, errorMessage: error })),\n getState: () => ($state) => {\n return Object.assign({}, $state);\n },\n open: (file) => ($state) => (Object.assign({}, $state)),\n};\n","export var DeviceType;\n(function (DeviceType) {\n DeviceType[DeviceType[\"Mobile\"] = 0] = \"Mobile\";\n DeviceType[DeviceType[\"Desktop\"] = 1] = \"Desktop\";\n})(DeviceType || (DeviceType = {}));\nexport var ScreenSize;\n(function (ScreenSize) {\n ScreenSize[ScreenSize[\"Small\"] = 600] = \"Small\";\n ScreenSize[ScreenSize[\"Medium\"] = 900] = \"Medium\";\n ScreenSize[ScreenSize[\"Large\"] = 1200] = \"Large\";\n})(ScreenSize || (ScreenSize = {}));\n/** internal */\nexport const state = {\n screenSize: ScreenSize.Medium,\n deviceType: DeviceType.Desktop,\n};\n/** internal */\nexport const actions = {\n setScreenSize: (screenSize) => ($state) => (Object.assign(Object.assign({}, $state), { screenSize })),\n setDeviceType: (deviceType) => ($state) => (Object.assign(Object.assign({}, $state), { deviceType })),\n};\n","/** internal */\nexport const state = {\n showNavigation: false,\n selectedNavigation: 'thumbnail',\n outlineItemsLoaded: false,\n annotationsLoaded: false,\n pages: [],\n outlines: [],\n annotations: {},\n};\n/** internal */\nexport const actions = {\n clear: () => ($state) => (Object.assign(Object.assign({}, $state), { outlineItemsLoaded: false, pages: [], outlines: [], annotations: [] })),\n setThumbnailPlaceholders: (pageCount) => ($state) => {\n const pages = [];\n for (let i = 0; i < pageCount; i++) {\n pages.push({\n thumbnail: null,\n loading: null,\n pageNumber: i + 1,\n });\n }\n return Object.assign(Object.assign({}, $state), { pages });\n },\n updateThumbnail: (newThumbnail) => ($state) => (Object.assign(Object.assign({}, $state), { pages: $state.pages.map((p) => (p.pageNumber === newThumbnail.pageNumber ? newThumbnail : p)) })),\n setOutlines: (outlines) => ($state) => (Object.assign(Object.assign({}, $state), { outlineItemsLoaded: true, outlines })),\n toggleNavigationPanel: () => ($state) => (Object.assign(Object.assign({}, $state), { showNavigation: !$state.showNavigation })),\n showNavigationPanel: () => ($state) => (Object.assign(Object.assign({}, $state), { showNavigation: true })),\n hideNavigationPanel: () => ($state) => (Object.assign(Object.assign({}, $state), { showNavigation: false })),\n selectNavigation: (navigation) => ($state) => (Object.assign(Object.assign({}, $state), { showNavigation: true, selectedNavigation: navigation })),\n toggleOutlineItem: (path) => ($state) => {\n const newState = Object.assign({}, $state);\n let currentItem = { descendants: newState.outlines, open: false };\n path.forEach((id) => {\n const nextItem = currentItem.descendants.find((item) => item.id.toString() === id);\n if (nextItem) {\n currentItem = nextItem;\n }\n });\n currentItem.open = !currentItem.open;\n return newState;\n },\n clearAnnotations: () => ($state) => (Object.assign(Object.assign({}, $state), { annotations: {}, selectedAnnotation: undefined, annotationsLoaded: false })),\n setAnnotationLoaded: () => ($state) => (Object.assign(Object.assign({}, $state), { annotationsLoaded: true })),\n initAnnotations: (pageCount) => ($state) => {\n const annotations = {};\n for (let i = 1; i <= pageCount; i++) {\n annotations[i] = {};\n }\n return Object.assign(Object.assign({}, $state), { annotations });\n },\n setPageAnnotations: (itemsOnPage) => ($state) => {\n const itemState = {};\n itemsOnPage.items.forEach((an) => {\n const annotation = an;\n itemState[annotation.id] = annotation;\n });\n return Object.assign(Object.assign({}, $state), { annotations: Object.assign(Object.assign({}, $state.annotations), { [itemsOnPage.page]: itemState }) });\n },\n updateAnnotation: (annotation) => ($state) => {\n const page = annotation.pdfRect.page;\n const id = annotation.id;\n const itemsOnPage = $state.annotations[page] ? Object.assign({}, $state.annotations[page]) : {};\n itemsOnPage[id] = annotation;\n return Object.assign(Object.assign({}, $state), { annotations: Object.assign(Object.assign({}, $state.annotations), { [page]: itemsOnPage }) });\n },\n deleteAnnotation: (deletedItem) => ($state) => {\n const page = deletedItem.page;\n const id = deletedItem.id;\n const itemsOnPage = $state.annotations[page];\n if (!itemsOnPage) {\n return Object.assign({}, $state);\n }\n delete itemsOnPage[id];\n return Object.assign(Object.assign({}, $state), { annotations: Object.assign(Object.assign({}, $state.annotations), { [page]: itemsOnPage }) });\n },\n selectAnnotation: (annotation) => ($state) => {\n return Object.assign(Object.assign({}, $state), { selectedAnnotation: {\n page: annotation.pdfRect.page,\n annotationId: annotation.id,\n } });\n },\n deselectAnnotation: () => ($state) => (Object.assign(Object.assign({}, $state), { selectedAnnotation: undefined })),\n};\n","/** internal */\nexport const state = {\n password: '',\n passwordRequiredError: false,\n invalidPasswordError: false,\n};\n/** internal */\nexport const actions = {\n clear: () => ($state) => ({\n password: '',\n passwordRequiredError: false,\n invalidPasswordError: false,\n }),\n updatePassword: (password) => ($state) => {\n return Object.assign(Object.assign({}, $state), { password });\n },\n validateForm: () => ($state) => {\n return Object.assign(Object.assign({}, $state), { invalidPasswordError: false, passwordRequiredError: $state.password === '' });\n },\n setInvalidPasswordError: () => ($state) => (Object.assign(Object.assign({}, $state), { invalidPasswordError: true })),\n};\n","import { PdfFitMode, PdfPageLayoutMode, } from '../../pdf-viewer-api';\n/** internal */\nexport const state = {\n filename: '',\n mimetype: '',\n hasChanges: false,\n zoom: 100,\n fitMode: PdfFitMode.NONE,\n pageLayoutMode: PdfPageLayoutMode.ONE_COLUMN,\n firstVisiblePage: 0,\n lastVisiblePage: 0,\n pageNumber: 0,\n pageCount: 0,\n};\n/** internal */\nexport const actions = {\n setZoom: (zoom) => ($state) => (Object.assign(Object.assign({}, $state), { zoom })),\n setFitMode: (fitMode) => ($state) => (Object.assign(Object.assign({}, $state), { fitMode })),\n setPageLayoutMode: (pageLayoutMode) => ($state) => (Object.assign(Object.assign({}, $state), { pageLayoutMode })),\n setHasChanges: (hasChanges) => ($state) => (Object.assign(Object.assign({}, $state), { hasChanges })),\n setFirstVisiblePage: (page) => ($state) => {\n const firstVisiblePage = page <= 1 ? 1 : page < $state.pageCount ? page : $state.pageCount;\n return Object.assign(Object.assign({}, $state), { firstVisiblePage });\n },\n setLastVisiblePage: (page) => ($state) => {\n const lastVisiblePage = page <= 1 ? 1 : page < $state.pageCount ? page : $state.pageCount;\n return Object.assign(Object.assign({}, $state), { lastVisiblePage });\n },\n setPageNumber: (page) => ($state) => {\n let pageNumber;\n if ($state.pageCount === 0)\n pageNumber = page;\n else\n pageNumber = page = page <= 1 ? 1 : page < $state.pageCount ? page : $state.pageCount;\n return Object.assign(Object.assign({}, $state), { pageNumber });\n },\n setPageCount: (pageCount) => ($state) => {\n return Object.assign(Object.assign({}, $state), { pageCount });\n },\n setFileInfo: (inputDocument) => ($state) => (Object.assign(Object.assign({}, $state), { filename: inputDocument.sourceTag, mimetype: 'application/pdf' })),\n};\n","/** internal */\nexport const state = {\n showSearch: false,\n searchString: '',\n caseSensitive: false,\n wrapSearch: false,\n useRegex: false,\n page: 1,\n match: null,\n painted: false,\n};\n/** internal */\nexport const actions = {\n updateToSearch: (searchString) => ($state) => (Object.assign(Object.assign({}, $state), { searchString })),\n openSearch: () => ($state) => (Object.assign(Object.assign({}, $state), { showSearch: true })),\n closeSearch: () => ($state) => (Object.assign(Object.assign({}, $state), { searchString: '', showSearch: false })),\n toggleCaseSensitive: () => ($state) => (Object.assign(Object.assign({}, $state), { caseSensitive: !$state.caseSensitive })),\n toggleWrappingSearch: () => ($state) => (Object.assign(Object.assign({}, $state), { wrapSearch: !$state.wrapSearch })),\n toggleRegex: () => ($state) => (Object.assign(Object.assign({}, $state), { useRegex: !$state.useRegex })),\n setCaseSensitive: (enabled) => ($state) => (Object.assign(Object.assign({}, $state), { caseSensitive: enabled })),\n setWrappingSearch: (enabled) => ($state) => (Object.assign(Object.assign({}, $state), { wrapSearch: enabled })),\n setRegex: (enabled) => ($state) => (Object.assign(Object.assign({}, $state), { useRegex: enabled })),\n};\n","import { h } from '../../lib/hyperapp';\nimport { classNames } from '../../common/classNames';\nimport { ScreenSize } from '../state/layout';\nimport { Layout } from './Layout';\nimport { DropZone } from './DropZone';\nimport { Modal } from './modal/Modal';\n/** internal */\nexport const App = () => (state, actions) => {\n const sizeCssClassName = state.layout.screenSize === ScreenSize.Small\n ? 'sm'\n : state.layout.screenSize === ScreenSize.Medium\n ? 'md'\n : 'lg';\n return (h(DropZone, { className: classNames('pwv-WebViewer', `pwv-WebViewer--${sizeCssClassName}`), enabled: state.options.viewer.permissions.allowFileDrop &&\n state.fileDropEnabled &&\n state.options.viewer.permissions.allowOpenFile, onFileSelected: (file) => actions.api.open({ pdfFile: { data: file, sourceTag: file.name } }) },\n state.scriptsLoaded && h(Layout, null),\n h(Modal, null)));\n};\n","import { h } from '../../lib/hyperapp';\nimport { tooltipManager } from '../../common/TooltipManager';\n/** internal */\nexport const CustomButtons = ({ location, style }) => (state, actions) => {\n const { customButtons } = state.options.viewer;\n if (!customButtons ||\n !customButtons.hasOwnProperty(location) ||\n !customButtons[location].length) {\n return null;\n }\n const buttons = customButtons[location];\n return style === 'button' ? (h(\"div\", { class: \"pwv-CustomButtons\" }, buttons.map((ca) => (h(\"button\", Object.assign({ oncreate: tooltipManager.bindCssTooltip }, tooltipManager.createTooltip(ca.text), { class: \"pwv-ToolbarButton\", onclick: ca.onClick }),\n h(\"span\", { class: \"pwv-icon\" },\n h(\"img\", { src: ca.icon }))))))) : (h(\"div\", null, buttons.map((ca) => (h(\"button\", { class: \"pwv-DropdownItem\", onclick: ca.onClick },\n h(\"span\", { class: \"pwv-icon\" },\n h(\"img\", { src: ca.icon })),\n ca.text)))));\n};\n","import { h } from '../../lib/hyperapp';\nimport { classNames } from '../../common/classNames';\nlet allowDropTimer = 0;\n/** internal */\nexport const DropZone = ({ className, enabled, onFileSelected }, children) => {\n const handleDragOver = (e) => {\n e.preventDefault();\n if (!enabled) {\n return;\n }\n if (e.dataTransfer) {\n const dropContainer = e.currentTarget;\n const items = e.dataTransfer.items;\n if (items && items.length === 1 && items[0].type === 'application/pdf') {\n dropContainer.classList.add('pwv-dropzone-dragover');\n clearTimeout(allowDropTimer);\n allowDropTimer = window.setTimeout(() => {\n dropContainer.classList.remove('pwv-dropzone-dragover');\n }, 150);\n }\n }\n };\n const handleDrop = (e) => {\n e.preventDefault();\n if (e.dataTransfer) {\n let pdfFile = null;\n if (e.dataTransfer.items) {\n /* tslint:disable-next-line */\n for (let i = 0; i < e.dataTransfer.items.length; i++) {\n const item = e.dataTransfer.items[i];\n if (item.kind === 'file' && item.type === 'application/pdf') {\n pdfFile = item.getAsFile();\n break;\n }\n }\n }\n else {\n /* tslint:disable-next-line */\n for (let i = 0; i < e.dataTransfer.files.length; i++) {\n const file = e.dataTransfer.files[i];\n if (file.type === 'application/pdf') {\n pdfFile = file;\n break;\n }\n }\n }\n if (enabled && pdfFile !== null) {\n onFileSelected(pdfFile);\n }\n }\n };\n return (h(\"div\", { class: classNames(className, 'pwv-dropzone'), ondragover: handleDragOver, ondrop: handleDrop }, children));\n};\n","import { h } from '../../lib/hyperapp';\nimport { classNames } from '../../common/classNames';\nimport { AppBar } from './appbar/AppBar';\nimport { Annotationbar } from './annotationbar/Annotationbar';\nimport { NavigationPanel } from './navigation/NavigationPanel';\n/** internal */\nexport const Layout = ({}) => (state, actions) => {\n const { disableAnnotationToolbar, annotationBarPosition } = state.options.viewer.general;\n return (h(\"div\", { class: classNames('pwv-Viewer', {\n 'pwv-Viewer--loadFile': state.showLoadingIndicator,\n 'pwv-Viewer--saveFile': state.showSaveIndicator,\n }) },\n h(AppBar, null),\n h(\"div\", { class: \"pwv-ViewerContent\" },\n h(\"div\", { class: classNames('pwv-document-view', `pwv-annotationbar-${annotationBarPosition}`) },\n h(\"div\", { oncreate: (element) => {\n const a = actions;\n a.createCanvasView(element);\n } }),\n !disableAnnotationToolbar && h(Annotationbar, null)),\n h(NavigationPanel, null))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { ScreenSize } from '../../state/layout';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { classNames } from '../../../common/classNames';\nimport { icons } from '../../../common/icons';\nimport { CustomButtons } from '../CustomButtons';\n/** internal */\nexport const Annotationbar = ({}) => (state, actions) => {\n const smallScreen = state.layout.screenSize === ScreenSize.Small;\n if (smallScreen || !state.licenseFeatures.annotate) {\n return null;\n }\n return (h(\"div\", { class: classNames('pwv-annotationbar', `pwv-annotationbar-${state.options.viewer.general.annotationBarPosition}`) },\n state.options.modules\n .filter(({ moduleInfo }) => moduleInfo.requiredFeatures.annotate)\n .map((m) => (h(ToolbarButton, { icon: icons[m.moduleInfo.icon], tooltip: translationManager.getText(m.moduleInfo.translationKey), onClick: () => {\n actions.api.activateModule(m.moduleInfo.name, undefined);\n } }))),\n h(CustomButtons, { location: \"annotationbar\", style: \"button\" })));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { ScreenSize } from '../../state/layout';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { icons } from '../../../common/icons';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { AnnotationsMenu } from './AnnotationsMenu';\nimport { CustomButtons } from '../CustomButtons';\n/** internal */\nexport const AddonsToolbar = ({}) => (state, actions) => {\n const smallScreen = state.layout.screenSize === ScreenSize.Small;\n const mediumScreen = state.layout.screenSize <= ScreenSize.Medium;\n const { sidebar } = state.options.viewer;\n const { disableAnnotationToolbar } = state.options.viewer.general;\n return (h(ToolbarItemGroup, { className: \"pwv-AddonsBar\" },\n !disableAnnotationToolbar && smallScreen && h(AnnotationsMenu, null),\n state.options.viewer.permissions.enableSearch && (h(ToolbarButton, { name: \"toggleSearch\", tooltip: translationManager.getText('toolbar.search'), icon: icons.search, onClick: () => {\n if (!state.search.showSearch) {\n actions.api.resetViewerMode();\n actions.search.openSearch();\n }\n else {\n actions.api.endSearch();\n actions.search.closeSearch();\n }\n }, active: state.search.showSearch })),\n !smallScreen &&\n (sidebar.thumbnailNavigation ||\n sidebar.outlineNavigation ||\n sidebar.annotationNavigation) && (h(ToolbarButton, { name: \"toggleSidePane\", tooltip: translationManager.getText('toolbar.toggleSidePane'), icon: icons.docNavigation, onClick: () => {\n actions.api.loadNavigationItems();\n actions.navigationPanel.toggleNavigationPanel();\n }, active: state.navigationPanel.showNavigation })),\n h(CustomButtons, { location: \"informationbar\", style: \"button\" })));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { Icon, icons } from '../../../common/Icon';\nimport { DropdownMenu } from '../../../common/DropdownMenu';\nimport { CustomButtons } from '../CustomButtons';\n/** internal */\nexport const AnnotationsMenu = ({}) => (state, actions) => {\n if (!state.licenseFeatures.annotate) {\n return null;\n }\n return (h(DropdownMenu, { className: \"pwv-LgHidden pwv-AnnotationMenu\", tooltip: translationManager.getText('toolbar.annotationsMenuButton'), icon: icons.edit },\n h(\"div\", null,\n state.options.modules\n .filter((m) => m.moduleInfo.requiredFeatures.annotate)\n .map((m) => (h(\"button\", { class: \"pwv-DropdownItem\", onclick: () => {\n actions.api.activateModule(m.moduleInfo.name, undefined);\n } },\n h(Icon, { icon: icons[m.moduleInfo.icon] }),\n ' ',\n translationManager.getText(m.moduleInfo.translationKey)))),\n h(CustomButtons, { location: \"annotationbar\", style: \"listItem\" }))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { ScreenSize } from '../../state/layout';\nimport { Toolbar } from '../../../common/Toolbar';\nimport { ToolbarSeparator } from '../../../common/ToolbarSeparator';\nimport { Menu } from './Menu';\nimport { DocumentBar } from './DocumentBar';\nimport { NavigationBar } from './NavigationBar';\nimport { ZoomBar } from './ZoomBar';\nimport { SearchBar } from './SearchBar';\nimport { ViewBar } from './ViewBar';\nimport { AddonsToolbar } from './AddonsToolbar';\n/** internal */\nexport const AppBar = ({}) => (state, actions) => {\n const mediumScreen = state.layout.screenSize <= ScreenSize.Medium;\n const { disableMainToolbar } = state.options.viewer.general;\n return (h(\"div\", { class: \"pwv-AppBar\" },\n !state.options.viewer.general.disableMainToolbar && (h(Toolbar, { allowWrap: true },\n mediumScreen ? h(Menu, null) : h(DocumentBar, null),\n h(NavigationBar, null),\n h(ToolbarSeparator, null),\n h(ZoomBar, null),\n h(ToolbarSeparator, null),\n h(ViewBar, null),\n h(AddonsToolbar, null))),\n state.search.showSearch && state.options.viewer.permissions.enableSearch && h(SearchBar, null)));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { icons } from '../../../common/Icon';\nimport { ToolbarFileButton } from '../../../common/ToolbarFileButton';\nimport { CustomButtons } from '../CustomButtons';\n/** internal */\nexport const DocumentBar = ({}) => (state, actions) => {\n const { permissions, callbacks } = state.options.viewer;\n const onSaveFileButtonClicked = () => {\n if (callbacks.onSaveFileButtonClicked) {\n callbacks.onSaveFileButtonClicked();\n }\n else {\n actions.api.downloadFile();\n }\n };\n const onCloseFileButtonClicked = () => {\n if (callbacks.onCloseFileButtonClicked) {\n callbacks.onCloseFileButtonClicked();\n }\n else {\n actions.api.close();\n }\n };\n return (h(ToolbarItemGroup, { className: \"pwv-DocumentBar\" },\n permissions.allowOpenFile && !callbacks.onOpenFileButtonClicked && (h(ToolbarFileButton, { name: \"openDocument\", className: \"pwv-MdHidden pwv-SmHidden\", icon: icons.openFile, accept: \".pdf\", tooltip: translationManager.getText('toolbar.openDocument'), onFileSelected: (file) => actions.api.open({ pdfFile: { data: file } }) })),\n permissions.allowOpenFile && callbacks.onOpenFileButtonClicked && (h(ToolbarButton, { name: \"openDocument\", className: \"pwv-MdHidden pwv-SmHidden\", icon: icons.openFile, tooltip: translationManager.getText('toolbar.openDocument'), onClick: callbacks.onOpenFileButtonClicked })),\n permissions.allowSaveFile && (h(ToolbarButton, { name: \"saveDocument\", className: \"pwv-MdHidden pwv-SmHidden\", icon: icons.saveFile, tooltip: translationManager.getText('toolbar.saveDocument'), onClick: onSaveFileButtonClicked })),\n permissions.allowCloseFile && (h(ToolbarButton, { name: \"closeDocument\", className: \"pwv-MdHidden pwv-SmHidden\", icon: icons.closeFile, tooltip: translationManager.getText('toolbar.closeDocument'), onClick: onCloseFileButtonClicked })),\n permissions.allowPrinting && (h(ToolbarButton, { name: \"print\", className: \"pwv-MdHidden pwv-SmHidden\", icon: icons.print, tooltip: translationManager.getText('toolbar.print'), onClick: actions.api.print })),\n h(CustomButtons, { location: \"documentbar\", style: \"button\" })));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { ScreenSize } from '../../state/layout';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { Icon, icons } from '../../../common/Icon';\nimport { DropdownMenu } from '../../../common/DropdownMenu';\nimport { DropdownSeparator } from '../../../common/DropdownSeparator';\nimport { CustomButtons } from '../CustomButtons';\n/** internal */\nexport const Menu = ({}) => (state, actions) => {\n const { permissions, callbacks } = state.options.viewer;\n const { outlineNavigation, annotationNavigation } = state.options.viewer.sidebar;\n const { screenSize } = state.layout;\n const onSaveFileButtonClicked = () => {\n if (callbacks.onSaveFileButtonClicked) {\n callbacks.onSaveFileButtonClicked();\n }\n else {\n actions.api.downloadFile();\n }\n };\n const onCloseFileButtonClicked = () => {\n if (callbacks.onCloseFileButtonClicked) {\n callbacks.onCloseFileButtonClicked();\n }\n else {\n actions.api.close();\n }\n };\n return (h(ToolbarItemGroup, { className: \"pwv-DocumentBar\" },\n h(DropdownMenu, { className: \"pwv-LgHidden\", icon: icons.bars },\n h(\"div\", null,\n permissions.allowOpenFile && !callbacks.onOpenFileButtonClicked && (h(\"label\", { class: \"pwv-DropdownItem\" },\n h(Icon, { icon: icons.openFile }),\n \" \",\n translationManager.getText('toolbar.openDocument'),\n h(\"input\", { accept: \".pdf\", type: \"file\", onchange: (e) => {\n if (e.currentTarget.files && e.currentTarget.files.length) {\n const file = e.currentTarget.files[0];\n actions.api.open({ pdfFile: { data: file } });\n }\n }, style: { display: 'none' } }))),\n permissions.allowOpenFile && callbacks.onOpenFileButtonClicked && (h(\"button\", { class: \"pwv-DropdownItem\", onclick: callbacks.onOpenFileButtonClicked },\n h(Icon, { icon: icons.openFile }),\n \" \",\n translationManager.getText('toolbar.openDocument'))),\n permissions.allowSaveFile && (h(\"button\", { class: \"pwv-DropdownItem\", onclick: onSaveFileButtonClicked },\n h(Icon, { icon: icons.saveFile }),\n \" \",\n translationManager.getText('toolbar.saveDocument'))),\n permissions.allowCloseFile && (h(\"button\", { class: \"pwv-DropdownItem\", onclick: onCloseFileButtonClicked },\n h(Icon, { icon: icons.closeFile }),\n ' ',\n translationManager.getText('toolbar.closeDocument'))),\n permissions.allowPrinting && (h(\"button\", { class: \"pwv-DropdownItem\", onclick: actions.api.print },\n h(Icon, { icon: icons.print }),\n \" \",\n translationManager.getText('toolbar.print'))),\n h(CustomButtons, { location: \"documentbar\", style: \"listItem\" }),\n permissions.allowRotateView && h(DropdownSeparator, null),\n permissions.allowRotateView && (h(\"button\", { class: \"pwv-DropdownItem\", onclick: actions.api.rotate },\n h(Icon, { icon: icons.rotate }),\n \" \",\n translationManager.getText('toolbar.rotateView'))),\n screenSize === ScreenSize.Small && (outlineNavigation || annotationNavigation) && (h(DropdownSeparator, null)),\n screenSize === ScreenSize.Small && outlineNavigation && (h(\"button\", { class: \"pwv-DropdownItem\", onclick: () => {\n actions.api.loadNavigationItems();\n actions.navigationPanel.selectNavigation('outline');\n } },\n h(Icon, { icon: icons.sidePaneOutline }),\n ' ',\n translationManager.getText('sideNavigation.outline'))),\n screenSize === ScreenSize.Small && annotationNavigation && (h(\"button\", { class: \"pwv-DropdownItem\", onclick: () => {\n actions.api.loadNavigationItems();\n actions.navigationPanel.selectNavigation('annotation');\n } },\n h(Icon, { icon: icons.sidePaneAnnotation }),\n ' ',\n translationManager.getText('sideNavigation.annotation')))))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { icons } from '../../../common/icons';\nconst resizeObserver = new ResizeObserver((e) => {\n if (e.length) {\n e.forEach((elm) => {\n if (elm.target && elm.target.parentElement) {\n const input = elm.target.parentElement.querySelector('input');\n if (input) {\n input.style.minWidth = `${elm.contentRect.width + 4}px`;\n }\n }\n });\n }\n});\n/** internal */\nexport const NavigationBar = ({}) => (state, actions) => {\n const { pdfDocument } = state;\n return (h(ToolbarItemGroup, { className: \"pwv-NavigationBar\" },\n h(ToolbarButton, { name: \"previewsPage\", tooltip: translationManager.getText('toolbar.previewsPage'), icon: icons.previousPage, onClick: () => actions.api.previousPage(), disabled: pdfDocument.pageNumber <= 1 }),\n h(\"div\", { class: \"pwv-ToolbarItem pwv-navigation-toolbar-pageinput\" },\n h(\"input\", { name: \"pageNumber\", value: pdfDocument.pageNumber, onkeydown: (e) => {\n if (e.key === 'ArrowDown') {\n actions.api.nextPage();\n }\n else if (e.key === 'ArrowUp') {\n actions.api.previousPage();\n }\n else if (e.key === 'Enter') {\n const input = e.currentTarget;\n if (input && input.value) {\n actions.api.setPageNumber(parseInt(input.value, undefined));\n }\n }\n else if ((e.key.charCodeAt(0) >= 48 && e.key.charCodeAt(0) <= 57) || // allow numbers 0-9\n e.key === 'Delete' ||\n e.key === 'Backspace' ||\n e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'Tab') {\n // do nothing\n }\n else {\n e.preventDefault();\n }\n e.stopPropagation();\n }, onblur: (e) => {\n let page = parseInt(e.target.value, undefined);\n if (Number.isNaN(page)) {\n page = actions.api.getPageNumber();\n }\n else if (page < 1) {\n page = 1;\n }\n else {\n const pageCount = actions.api.getPageCount();\n if (page > pageCount) {\n page = pageCount;\n }\n }\n ;\n e.target.value = page.toString();\n actions.api.setPageNumber(page);\n }, disabled: pdfDocument.pageCount < 1 }),\n h(\"span\", null, translationManager.getText('toolbar.pageOf')),\n h(\"label\", { oncreate: (label) => {\n resizeObserver.observe(label);\n }, onremove: (label) => {\n resizeObserver.unobserve(label);\n } }, pdfDocument.pageCount)),\n h(ToolbarButton, { name: \"nextPage\", tooltip: translationManager.getText('toolbar.nextPage'), icon: icons.nextPage, onClick: () => actions.api.nextPage(), disabled: pdfDocument.pageNumber === pdfDocument.pageCount })));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { Toolbar } from '../../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { ToolbarSeparator } from '../../../common/ToolbarSeparator';\nimport { icons } from '../../../common/icons';\nimport { getKeyboardCommands } from '../../../common/utils';\nimport { SearchOptions } from './SearchOptions';\n/** internal */\nexport const SearchBar = ({}) => (state, actions) => (h(Toolbar, { className: \"pwv-SearchBar\" },\n h(ToolbarItemGroup, null,\n h(\"div\", { class: \"pwv-ToolbarItem pwv-searchbar-input\" },\n h(\"input\", { value: state.search.searchString, class: \"pwv-SearchInputField\", oncreate: (element) => {\n element.focus();\n element.addEventListener('keydown', (e) => {\n e.cancelBubble = true;\n const { shortcuts } = state.options;\n const cmd = getKeyboardCommands(e, shortcuts, []);\n if ((cmd === null || cmd === void 0 ? void 0 : cmd.length) &&\n (cmd.some(el => el[0] === 'searchNext') ||\n cmd.some(el => el[0] === 'searchPrevious') ||\n cmd.some(el => el[0] === 'closeSearch'))) {\n e.preventDefault();\n }\n }, false);\n element.addEventListener('input', (e) => {\n const inputValue = e.currentTarget.value;\n actions.search.updateToSearch(inputValue);\n if (inputValue !== '') {\n actions.api.startSearch();\n }\n else {\n actions.api.endSearch();\n }\n });\n element.addEventListener('keyup', (e) => {\n e.cancelBubble = true;\n const inputValue = e.currentTarget.value;\n const { shortcuts } = state.options;\n const cmd = getKeyboardCommands(e, shortcuts, []);\n if (cmd === null || cmd === void 0 ? void 0 : cmd.some(el => el[0] === 'searchNext')) {\n e.preventDefault();\n actions.api.nextSearchMatch();\n }\n else if (cmd === null || cmd === void 0 ? void 0 : cmd.some(el => el[0] === 'searchPrevious')) {\n e.preventDefault();\n actions.api.previousSearchMatch();\n }\n else if (cmd === null || cmd === void 0 ? void 0 : cmd.some(el => el[0] === 'closeSearch')) {\n e.preventDefault();\n actions.api.endSearch();\n actions.search.closeSearch();\n }\n else if (e.key === 'Enter' || e.key === 'ArrowDown') {\n if (inputValue !== '') {\n actions.api.nextSearchMatch();\n }\n }\n else if (e.key === 'ArrowUp') {\n if (inputValue !== '') {\n actions.api.previousSearchMatch();\n }\n }\n else if (e.key === 'Escape') {\n actions.api.endSearch();\n actions.search.closeSearch();\n }\n }, false);\n } })),\n h(ToolbarButton, { tooltip: translationManager.getText('search.previousMatch'), \n // icon={icons.previousMatch}\n icon: icons.previousPage, disabled: state.search.searchString === '', onClick: actions.api.previousSearchMatch }),\n h(ToolbarButton, { tooltip: translationManager.getText('search.nextMatch'), icon: icons.nextPage, \n // icon={icons.nextMatch}\n disabled: state.search.searchString === '', onClick: actions.api.nextSearchMatch }),\n h(SearchOptions, null),\n h(ToolbarSeparator, null)),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarButton, { icon: icons.close, onClick: () => {\n actions.api.endSearch();\n actions.search.closeSearch();\n } }))));\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { DropdownComponent } from '../../../common/Dropdown';\nimport { Icon, icons } from '../../../common/Icon';\nimport { tooltipManager } from '../../../common/TooltipManager';\n/** internal */\nexport const SearchOptions = (props) => ($state, actions) => {\n if (props.disabled) {\n return (h(\"div\", { title: translationManager.getText('search.options'), class: \"pwv-Dropdown pwv-searchoptions pwv-disabled pwv-Dropdown--alignRight\" },\n h(\"span\", { class: \"pwv-Dropdown-text\" },\n h(Icon, { icon: icons.options })),\n h(\"span\", { class: \"pwv-Dropdown-caret\" },\n h(Icon, { icon: icons.dropdownCaret }))));\n }\n else {\n return (h(\"div\", { class: \"pwv-Dropdown pwv-searchoptions pwv-Dropdown--alignRight\" },\n h(\"button\", Object.assign({}, tooltipManager.createTooltip(translationManager.getText('search.options')), { oncreate: DropdownComponent.create, onremove: DropdownComponent.remove }),\n h(\"span\", { class: \"pwv-Dropdown-text\" },\n h(Icon, { icon: icons.options })),\n h(\"span\", { class: \"pwv-Dropdown-caret\" },\n h(Icon, { icon: icons.dropdownCaret }))),\n h(\"div\", { class: \"pwv-DropdownPanel\" },\n h(\"ul\", null,\n h(\"li\", { class: \"pwv-checkbox-btn\", onclick: (e) => {\n const s = actions.search.toggleCaseSensitive();\n e.preventDefault();\n e.cancelBubble = true;\n if (s.searchString !== '') {\n actions.api.startSearch();\n }\n } },\n $state.search.caseSensitive ? (h(Icon, { icon: icons.checkboxChecked })) : (h(Icon, { icon: icons.checkbox })),\n translationManager.getText('search.optionCaseSensitive')),\n h(\"li\", { class: \"pwv-checkbox-btn\", onclick: (e) => {\n const s = actions.search.toggleWrappingSearch();\n e.preventDefault();\n e.cancelBubble = true;\n if (s.searchString !== '') {\n actions.api.startSearch();\n }\n } },\n $state.search.wrapSearch ? (h(Icon, { icon: icons.checkboxChecked })) : (h(Icon, { icon: icons.checkbox })),\n translationManager.getText('search.optionWrap')),\n h(\"li\", { class: \"pwv-checkbox-btn\", onclick: (e) => {\n const s = actions.search.toggleRegex();\n e.preventDefault();\n e.cancelBubble = true;\n if (s.searchString !== '') {\n actions.api.startSearch();\n }\n } },\n $state.search.useRegex ? (h(Icon, { icon: icons.checkboxChecked })) : (h(Icon, { icon: icons.checkbox })),\n translationManager.getText('search.optionRegularExpression'))))));\n }\n};\n","import { h } from '../../../lib/hyperapp';\nimport { PdfFitMode, PdfPageLayoutMode } from '../../../pdf-viewer-api';\nimport { ScreenSize } from '../../state/layout';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { Dropdown } from '../../../common/Dropdown';\nimport { Icon } from '../../../common/Icon';\nimport { icons } from '../../../common/icons';\nfunction getPageLayoutModeTranslation(layoutMode) {\n switch (layoutMode) {\n case PdfPageLayoutMode.ONE_COLUMN:\n return translationManager.getText('pageLayoutMode.oneColumn');\n case PdfPageLayoutMode.SINGLE_PAGE:\n return translationManager.getText('pageLayoutMode.singlePage');\n case PdfPageLayoutMode.TWO_COLUMN_LEFT:\n return translationManager.getText('pageLayoutMode.twoColumnLeft');\n case PdfPageLayoutMode.TWO_COLUMN_RIGHT:\n return translationManager.getText('pageLayoutMode.twoColumnRight');\n case PdfPageLayoutMode.TWO_PAGE_LEFT:\n return translationManager.getText('pageLayoutMode.twoPageLeft');\n case PdfPageLayoutMode.TWO_PAGE_RIGHT:\n return translationManager.getText('pageLayoutMode.twoPageRight');\n }\n}\n/** internal */\nexport const ViewBar = ({}) => (state, actions) => {\n const { pdfDocument } = state;\n const { screenSize } = state.layout;\n const layoutModeItems = state.options.viewer.general.pageLayoutModes.map((m) => ({\n text: getPageLayoutModeTranslation(m),\n value: m,\n renderItem: (i) => (h(\"span\", { className: \"pwv-page-layout-mode-item\" },\n h(Icon, { icon: icons[`pageLayoutMode${i.value}`], className: \"pwv-page-layout-mode-icon\" }),\n i.text)),\n }));\n return (h(ToolbarItemGroup, { className: \"pwv-ViewBar\" },\n pdfDocument.fitMode === PdfFitMode.NONE && (h(ToolbarButton, { name: \"fitMode\", tooltip: translationManager.getText('fitMode.none'), icon: icons.fitActualSize, onClick: () => {\n actions.api.setFitMode(PdfFitMode.FIT_PAGE);\n } })),\n pdfDocument.fitMode === PdfFitMode.FIT_PAGE && (h(ToolbarButton, { name: \"fitMode\", tooltip: translationManager.getText('fitMode.page'), icon: icons.fitPage, onClick: () => {\n actions.api.setFitMode(PdfFitMode.FIT_WIDTH);\n } })),\n pdfDocument.fitMode === PdfFitMode.FIT_WIDTH && (h(ToolbarButton, { name: \"fitMode\", tooltip: translationManager.getText('fitMode.width'), icon: icons.fitWidth, onClick: () => {\n actions.api.setFitMode(PdfFitMode.NONE);\n actions.api.setZoom(100);\n } })),\n state.options.viewer.permissions.enablePageLayoutMode && (h(Dropdown, { name: \"pageLayoutMode\", tooltip: getPageLayoutModeTranslation(pdfDocument.pageLayoutMode), items: layoutModeItems, value: pdfDocument.pageLayoutMode, className: \"pwv-page-layout-mode\", renderButton: (i, text) => (h(Icon, { icon: icons[`pageLayoutMode${i}`], className: \"pwv-page-layout-mode-icon\" })), onChange: (value) => {\n actions.api.setPageLayoutMode(value);\n } })),\n state.options.viewer.permissions.allowRotateView && screenSize === ScreenSize.Large && (h(ToolbarButton, { name: \"rotateView\", tooltip: translationManager.getText('toolbar.rotateView'), icon: icons.rotate, onClick: actions.api.rotate }))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { icons } from '../../../common/icons';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { Dropdown } from '../../../common/Dropdown';\n/** internal */\nexport const ZoomBar = ({}) => (state, actions) => {\n const { defaultZoomLevels } = state.options.viewer.general;\n const { zoom } = state.pdfDocument;\n return (h(ToolbarItemGroup, { className: \"pwv-ZoomBar\" },\n h(ToolbarButton, { name: \"zoomIn\", tooltip: translationManager.getText('toolbar.zoomIn'), className: \"pwv-MdHidden pwv-SmHidden\", icon: icons.zoomIn, disabled: zoom >= defaultZoomLevels[defaultZoomLevels.length - 1] * 100, onClick: () => actions.api.zoomIn() }),\n h(ToolbarButton, { name: \"zoomOut\", tooltip: translationManager.getText('toolbar.zoomOut'), className: \"pwv-MdHidden pwv-SmHidden\", icon: icons.zoomOut, disabled: zoom <= defaultZoomLevels[0] * 100, onClick: () => actions.api.zoomOut() }),\n h(Dropdown, { name: \"zoom\", tooltip: translationManager.getText('toolbar.zoom'), className: \"pwv-Dropdown-zoom\", items: defaultZoomLevels.map((zoom) => ({\n value: zoom * 100,\n text: Math.floor(zoom * 100) + '%',\n })), value: zoom, text: Math.floor(zoom) + '%', align: \"right\", onChange: (zoom) => actions.api.setZoom(zoom) })));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { Icon, icons } from '../../../common/Icon';\nimport { translationManager } from '../../../common/TranslationManager';\n/** internal */\nexport const ApplicationError = ({}) => (state, actions) => {\n let message = translationManager.getText('applicationError.defaultMessage');\n switch (state.errorMessage) {\n case 'Invalid License':\n message = translationManager.getText('applicationError.invalidLicense');\n break;\n }\n const btnText = translationManager.getText('applicationError.reload');\n return (h(\"div\", { class: \"pwv-modal pwv-modal--applicationError\" },\n h(\"div\", { class: \"pwv-modal-dialog\" },\n h(\"div\", { class: \"pwv-modal-header\" },\n h(Icon, { icon: icons.error }),\n h(\"h2\", null, translationManager.getText('applicationError.title'))),\n h(\"div\", { class: \"pwv-modal-body\" },\n h(\"div\", { class: \"pwv-modal-message\" },\n h(\"p\", null, message)),\n btnText && (h(\"div\", { class: \"pwv-btn-row\" },\n h(\"button\", { class: \"pwv-btn\", onclick: () => {\n document.location && document.location.reload();\n } }, btnText)))))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { Loader } from '../../../common/Loader';\n/** internal */\nexport const LoadApplication = ({}) => (h(\"div\", { class: \"pwv-modal pwv-modal--loadApplication\" },\n h(\"div\", { class: \"pwv-modal-body-noborder\" },\n h(Loader, null))));\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { Loader } from '../../../common/Loader';\n/** internal */\nexport const LoadFile = ({}) => (h(\"div\", { class: \"pwv-modal pwv-modal--loadFile\" },\n h(\"div\", { class: \"pwv-modal-dialog\" },\n h(\"div\", { class: \"pwv-modal-body\" },\n h(\"div\", { class: \"pwv-modal-message\" },\n h(\"h2\", null, translationManager.getText('loadFile.title')),\n h(Loader, null))))));\n","import { h } from '../../../lib/hyperapp';\nimport { OpenFile } from './OpenFile';\nimport { OpenFileError } from './OpenFileError';\nimport { UnsavedChanges } from './UnsavedChanges';\nimport { PasswordForm } from './PasswordForm';\nimport { LoadApplication } from './LoadApplication';\nimport { ApplicationError } from './ApplicationError';\nimport { LoadFile } from './LoadFile';\nimport { SaveFile } from './SaveFile';\n/** internal */\nexport const Modal = ({}) => (state, actions) => {\n if (state.hasError) {\n return h(ApplicationError, null);\n }\n else if (!state.scriptsLoaded && !state.appInitialized) {\n return h(LoadApplication, null);\n }\n else if (state.showOpenFileErrorDialog) {\n return h(OpenFileError, null);\n }\n else if (state.showPasswordForm) {\n return h(PasswordForm, null);\n }\n else if (state.showUnsavedChangesDialog) {\n return h(UnsavedChanges, null);\n }\n else if (state.showLoadingIndicator) {\n return h(LoadFile, null);\n }\n else if (state.showSaveIndicator) {\n return h(SaveFile, null);\n }\n else if (!state.hasDocument) {\n return h(OpenFile, null);\n }\n else {\n return null;\n }\n};\n","import { h } from '../../../lib/hyperapp';\nimport { Icon, icons } from '../../../common/Icon';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { DeviceType } from '../../state/layout';\n/** internal */\nexport const OpenFile = ({}) => (state, actions) => {\n const handleFileSelected = (e) => {\n if (e.currentTarget.files &&\n e.currentTarget.files.length &&\n e.currentTarget.files.length > 0) {\n const file = e.currentTarget.files[0];\n if (file.type === 'application/pdf') {\n actions.api.open({ pdfFile: { data: file, sourceTag: file.name } });\n }\n }\n };\n const { permissions, callbacks } = state.options.viewer;\n const { deviceType } = state.layout;\n return (h(\"div\", { class: \"pwv-modal pwv-openfile pwv-modal--openFile\" },\n h(\"div\", { class: \"pwv-modal-dialog\" },\n h(\"div\", { class: \"pwv-modal-header\" },\n h(Icon, { icon: icons.pdfFile })),\n h(\"div\", { class: \"pwv-modal-body\" },\n h(\"div\", { class: \"pwv-modal-message\" }, deviceType === DeviceType.Desktop &&\n permissions.allowFileDrop &&\n permissions.allowOpenFile ? (h(\"h2\", null, translationManager.getText('openFile.dropFileHere'))) : permissions.allowOpenFile ? (h(\"h2\", null, translationManager.getText('openFile.openDocument'))) : (h(\"h2\", null, translationManager.getText('openFile.openFileDisabled')))),\n h(\"div\", { class: \"pwv-btn-row\" }, permissions.allowOpenFile ? (callbacks.onOpenFileButtonClicked ? (h(\"button\", { class: \"pwv-btn\", onclick: callbacks.onOpenFileButtonClicked }, translationManager.getText('openFile.selectFile'))) : (h(\"label\", { class: \"pwv-btn\" },\n translationManager.getText('openFile.selectFile'),\n h(\"input\", { type: \"file\", onchange: handleFileSelected, style: { display: 'none' } })))) : (h(\"div\", null)))))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { Icon, icons } from '../../../common/Icon';\nimport { translationManager } from '../../../common/TranslationManager';\n/** internal */\nexport const OpenFileError = ({}) => (state, actions) => (h(\"div\", { class: \"pwv-modal pwv-modal--openFileError\" },\n h(\"div\", { class: \"pwv-modal-dialog\" },\n h(\"div\", { class: \"pwv-modal-header\" },\n h(Icon, { icon: icons.fileError })),\n h(\"div\", { class: \"pwv-modal-body\" },\n h(\"div\", { class: \"pwv-modal-message\" },\n h(\"p\", null, translationManager.getText('openFileError.description'))),\n h(\"div\", { class: \"pwv-btn-row\" },\n h(\"button\", { class: \"pwv-btn\", onclick: actions.loadDocumentConfirmRejected }, translationManager.getText('openFileError.ok')))))));\n","import { h } from '../../../lib/hyperapp';\nimport { Icon, icons } from '../../../common/Icon';\nimport { classNames } from '../../../common/classNames';\nimport { translationManager } from '../../../common/TranslationManager';\n/** internal */\nexport const PasswordForm = ({}) => (state, actions) => {\n const formIsValid = !state.passwordForm.passwordRequiredError &&\n !state.passwordForm.invalidPasswordError &&\n state.passwordForm.password !== '';\n return (h(\"div\", { class: \"pwv-modal pwv-modal--passwordForm\" },\n h(\"div\", { class: \"pwv-modal-dialog\" },\n h(\"div\", { class: \"pwv-modal-header\" },\n h(Icon, { icon: icons.unlock })),\n h(\"div\", { class: \"pwv-modal-body\" },\n h(\"form\", { onsubmit: (e) => {\n e.preventDefault();\n const data = new FormData(e.currentTarget);\n const password = data.get('password');\n if (password) {\n if (!state.fileOpenArgs) {\n actions.loadDocumentRejected('error');\n return;\n }\n if (state.fileOpenArgs) {\n actions.api.open(Object.assign(Object.assign({}, state.fileOpenArgs), { password }));\n }\n }\n } },\n h(\"div\", { class: \"pwv-modal-message\" },\n h(\"p\", null, translationManager.getText('passwordForm.description'))),\n h(\"div\", { class: \"pwv-form-row\" },\n h(\"div\", { class: \"pwv-form-field pwv-form-has-error-x\" },\n h(\"input\", { type: \"password\", class: \"pwv-input\", name: \"password\", onkeyup: (e) => {\n const inputValue = e.currentTarget.value;\n actions.passwordForm.updatePassword(inputValue);\n actions.passwordForm.validateForm();\n }, oncreate: (element) => {\n element.focus();\n } }),\n state.passwordForm.invalidPasswordError && (h(\"div\", { class: \"pwv-form-error\" },\n h(Icon, { icon: icons.warning }),\n h(\"span\", null, translationManager.getText('passwordForm.invalidPasswordError')))),\n state.passwordForm.passwordRequiredError && (h(\"div\", { class: \"pwv-form-error\" },\n h(Icon, { icon: icons.warning }),\n h(\"span\", null, translationManager.getText('passwordForm.passwordRequiredError')))))),\n h(\"div\", { class: \"pwv-btn-row\" },\n h(\"button\", { class: classNames('pwv-btn', {\n 'pwv-disabled': !formIsValid,\n }), type: \"submit\", disabled: !formIsValid }, translationManager.getText('passwordForm.ok')),\n h(\"button\", { class: \"pwv-btn\", type: \"button\", onclick: actions.loadDocumentCancel }, translationManager.getText('passwordForm.cancel'))))))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { Loader } from '../../../common/Loader';\n/** internal */\nexport const SaveFile = ({}) => (state, actions) => (h(\"div\", { class: \"pwv-modal pwv-modal--saveFile\" },\n h(\"div\", { class: \"pwv-modal-dialog\" },\n h(\"div\", { class: \"pwv-modal-body\" },\n h(\"div\", { class: \"pwv-modal-message\" },\n h(\"h2\", null, translationManager.getText('saveFile.title')),\n h(Loader, null))))));\n","import { h } from '../../../lib/hyperapp';\nimport { Icon, icons } from '../../../common/Icon';\nimport { translationManager } from '../../../common/TranslationManager';\n/** internal */\nexport const UnsavedChanges = ({}) => ($state, $actions) => (h(\"div\", { class: \"pwv-modal pwv-modal--unsavedChanges\" },\n h(\"div\", { class: \"pwv-modal-dialog\" },\n h(\"div\", { class: \"pwv-modal-header\" },\n h(Icon, { icon: icons.warning })),\n h(\"div\", { class: \"pwv-modal-body\" },\n h(\"div\", { class: \"pwv-modal-message\" },\n h(\"p\", null, translationManager.getText('unsavedChanges.description'))),\n h(\"div\", { class: \"pwv-btn-row\" },\n h(\"button\", { class: \"pwv-btn\", onclick: () => {\n $actions.api.downloadFile().then(() => {\n if ($state.closeCallback) {\n $state.closeCallback();\n }\n else {\n $actions.unsavedChangesDialogFileSaved();\n }\n if ($state.fileOpenArgs) {\n $actions.api.open($state.fileOpenArgs);\n }\n });\n } }, translationManager.getText('unsavedChanges.save')),\n h(\"button\", { class: \"pwv-btn\", onclick: () => {\n $actions.unsavedChangesDialogDontSave();\n if ($state.fileOpenArgs) {\n $actions.api.open($state.fileOpenArgs);\n }\n } }, translationManager.getText('unsavedChanges.dontSave')),\n h(\"button\", { class: \"pwv-btn\", onclick: $actions.unsavedChangesDialogCancel }, translationManager.getText('unsavedChanges.cancel')))))));\n","import { PdfItemType } from '../../../pdf-viewer-api/enums';\nimport { h } from '../../../lib/hyperapp';\nimport { AnnotationListItem } from './AnnotationListItem';\nimport { translationManager } from '../../../common/TranslationManager';\n/** internal */\nexport const AnnotationList = (props) => (state, actions) => {\n const { pageNumber } = props;\n const annotationsObj = state.navigationPanel.annotations[pageNumber];\n const selectedAnnotation = state.navigationPanel.selectedAnnotation;\n const annotations = Object.keys(annotationsObj).map((k) => annotationsObj[k]);\n const showHiddenAnnotations = state.options.annotation.hideOnDelete && state.options.annotation.trackHistory;\n const sortedAnnotations = annotations\n .filter((a) => a.itemType !== PdfItemType.WIDGET && (showHiddenAnnotations || a.isHidden() === false))\n .sort((f, s) => s.pdfRect.pdfY - f.pdfRect.pdfY);\n if (sortedAnnotations.length < 1) {\n return null;\n }\n return (h(\"div\", null,\n h(\"h4\", null,\n translationManager.getText('sideNavigation.annotation.page'),\n \" \",\n pageNumber),\n h(\"ul\", null, sortedAnnotations.map((annotation) => (h(AnnotationListItem, { annotation: annotation, selected: selectedAnnotation !== undefined &&\n selectedAnnotation.page === annotation.pdfRect.page &&\n selectedAnnotation.annotationId === annotation.id }))))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { PdfItemType } from '../../../pdf-viewer-api/enums';\nimport { Icon, icons } from '../../../common/Icon';\nimport { classNames } from '../../../common/classNames';\nimport { formatDate } from '../../../common/Tools';\nconst AnnotationIcon = ({ annotaion }) => (state, actions) => {\n const { itemType, color } = annotaion;\n const bg = color ? color : undefined;\n switch (itemType) {\n case PdfItemType.HIGHLIGHT:\n case PdfItemType.SQUIGGLY:\n case PdfItemType.UNDERLINE:\n case PdfItemType.STRIKE_OUT:\n return h(Icon, { icon: icons.highlighter, bg: bg });\n case PdfItemType.STAMP:\n return h(Icon, { icon: icons.stamp, bg: bg });\n case PdfItemType.FREE_TEXT:\n return h(Icon, { icon: icons.freeText, bg: bg });\n case PdfItemType.POPUP:\n case PdfItemType.TEXT:\n return h(Icon, { icon: icons.stickyNote, bg: bg });\n case PdfItemType.INK:\n return h(Icon, { icon: icons.pencil, bg: bg });\n case PdfItemType.SQUARE: {\n const fill = annotaion.fillColor;\n return h(Icon, { icon: icons.rectangle, bg: fill });\n }\n case PdfItemType.CIRCLE: {\n const fill = annotaion.fillColor;\n return h(Icon, { icon: icons.circle, bg: fill });\n }\n default:\n return h(Icon, { icon: icons.annotation, bg: bg });\n }\n};\nconst HistoryItem = ({ item }) => (state, actions) => {\n switch (item.Type) {\n case '/Create':\n return (h(\"li\", null,\n h(\"div\", null,\n h(Icon, { icon: icons.addLayer }),\n item.T && h(\"span\", { class: \"pwv-author\" }, item.T),\n h(\"time\", null, formatDate(item.D)))));\n case '/Edit':\n const params = {};\n if (item.Parms) {\n for (let i = 0; i < item.Parms.length; i += 2) {\n const key = item.Parms[i];\n let value = item.Parms[i + 1];\n value = removeParentheses(value);\n params[key] = value ? value : '';\n }\n }\n return (h(\"li\", null,\n h(\"div\", null,\n h(Icon, { icon: icons.pen }),\n item.T && h(\"span\", { class: \"pwv-author\" }, item.T),\n h(\"time\", null, formatDate(item.D))),\n h(\"div\", { class: \"pwv-ms-custom-history-content\" },\n params['/Subj'] && h(\"h5\", null, params['/Subj']),\n params['/Contents'] && h(\"p\", null, params['/Contents']))));\n case '/Lock':\n return (h(\"li\", null,\n h(\"div\", null,\n h(Icon, { icon: icons.lock }),\n item.T && h(\"span\", { class: \"pwv-author\" }, item.T),\n h(\"time\", null, formatDate(item.D)))));\n case '/Unlock':\n return (h(\"li\", null,\n h(\"div\", null,\n h(Icon, { icon: icons.unlock }),\n item.T && h(\"span\", { class: \"pwv-author\" }, item.T),\n h(\"time\", null, formatDate(item.D)))));\n case '/Delete':\n return (h(\"li\", null,\n h(\"div\", null,\n h(Icon, { icon: icons.delete }),\n item.T && h(\"span\", { class: \"pwv-author\" }, item.T),\n h(\"time\", null, formatDate(item.D)))));\n default:\n return h(\"li\", null, \"...\");\n }\n};\nconst TextMarkupPreview = ({ annotaion }) => (state, actions) => {\n const { markedText, itemType, color } = annotaion;\n switch (itemType) {\n case PdfItemType.HIGHLIGHT:\n return h(\"span\", { style: { backgroundColor: color } }, markedText);\n case PdfItemType.SQUIGGLY:\n return (h(\"span\", { style: {\n textDecoration: 'underline',\n textDecorationStyle: 'wavy',\n textDecorationColor: color,\n } }, markedText));\n case PdfItemType.UNDERLINE:\n return (h(\"span\", { style: {\n textDecoration: 'underline',\n textDecorationColor: color,\n } }, markedText));\n case PdfItemType.STRIKE_OUT:\n return (h(\"span\", { style: { textDecoration: 'line-through', textDecorationColor: color } }, markedText));\n default:\n return null;\n }\n};\nlet dblClickTimer;\n/** internal */\nexport const AnnotationListItem = ({ annotation, selected }) => (state, actions) => {\n var _a, _b, _c, _d, _e;\n const isTextMarkupAnnotation = annotation.itemType === PdfItemType.HIGHLIGHT ||\n annotation.itemType === PdfItemType.SQUIGGLY ||\n annotation.itemType === PdfItemType.UNDERLINE ||\n annotation.itemType === PdfItemType.STRIKE_OUT;\n const { annotationNavigation } = state.options.viewer.sidebar;\n const textMarkupPreview = typeof annotationNavigation === 'object' && ((_a = annotationNavigation.textMarkup) === null || _a === void 0 ? void 0 : _a.preview)\n ? annotationNavigation.textMarkup.preview\n : 'none';\n return (h(\"li\", { class: classNames('pwv-annotation-navigation-item', {\n 'pwv-selected': selected,\n 'pwv-deleted': annotation.isHidden(),\n }), id: `pwv-annotation-navigation-item-${annotation.id}`, onclick: () => {\n if (dblClickTimer) {\n window.clearTimeout(dblClickTimer);\n dblClickTimer = undefined;\n }\n else {\n dblClickTimer = window.setTimeout(() => {\n // if (!annotation.isHidden()) {\n // }\n actions.api.goToAnnotation({ annotation, action: 'select' });\n dblClickTimer = undefined;\n }, 250);\n }\n }, ondblclick: () => {\n actions.api.goToAnnotation({ annotation, action: 'edit' });\n dblClickTimer = undefined;\n } },\n h(\"div\", null,\n h(AnnotationIcon, { annotaion: annotation }),\n annotation.author && h(\"span\", { class: \"pwv-author\" }, annotation.author),\n h(\"time\", null, (_b = annotation.modificationDate) === null || _b === void 0 ? void 0 : _b.toLocaleString())),\n isTextMarkupAnnotation && textMarkupPreview === 'short' && (h(\"div\", { class: \"pwv-overflow-ellipsis\" },\n h(TextMarkupPreview, { annotaion: annotation }))),\n h(\"div\", null,\n !state.options.annotation.hideAnnotationSubject && h(\"h5\", null, annotation.subject),\n annotation.content && h(\"p\", null, annotation.content),\n !!annotation.isLocked() && h(Icon, { icon: icons.lock, className: \"pwv-locked-icon\" })),\n selected && annotation.privateData && annotation.privateData.length > 0 && (h(\"div\", { class: \"pwv-ms-custom-history-list\" },\n h(\"h5\", null, translationManager.getText('sideNavigation.annotation.history')),\n h(\"ul\", null, (_e = (_d = (_c = JSON.parse(annotation.privateData)['PDF Tools AG']) === null || _c === void 0 ? void 0 : _c.Private) === null || _d === void 0 ? void 0 : _d.History) === null || _e === void 0 ? void 0 : _e.map((history) => (h(HistoryItem, { item: history }))))))));\n};\nfunction removeParentheses(value) {\n if (value === null) {\n return value;\n }\n return value.slice(1, value.length - 1);\n}\n","import { h } from '../../../lib/hyperapp';\nimport { AnnotationList } from './AnnotationList';\nimport { translationManager } from '../../../common/TranslationManager';\n/** internal */\nexport const AnnotationNavigation = ({}) => (state, actions) => {\n const { annotations, annotationsLoaded } = state.navigationPanel;\n const pageNumbers = Object.keys(annotations).filter((pageNumber) => Object.keys(annotations[pageNumber]).length > 0);\n return (h(\"div\", { class: \"pwv-annotation-navigation\" },\n pageNumbers.length > 0 ? (pageNumbers.map((pageNumber) => h(AnnotationList, { pageNumber: pageNumber }))) : annotationsLoaded ? (h(\"div\", { class: \"pwv-NavigationPanel__NoItems\" }, translationManager.getText('sideNavigation.noAnnotations'))) : (''),\n !annotationsLoaded && h(\"div\", { class: \"pwv-ItemLoader\" })));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { ScreenSize } from '../../state/layout';\nimport { translationManager } from '../../../common/TranslationManager';\nimport { classNames } from '../../../common/classNames';\nimport { icons } from '../../../common/Icon';\nimport { Toolbar } from '../../../common/Toolbar';\nimport { ToolbarItemGroup } from '../../../common/ToolbarItemGroup';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { ThumbnailNavigation } from './ThumbnailNavigation';\nimport { OutlineNavigation } from './OutlineNavigation';\nimport { AnnotationNavigation } from './AnnotationNavigation';\nlet scrollTimer = null;\n/** internal */\nexport const NavigationPanel = ({}) => (state, actions) => {\n const { thumbnailNavigation, outlineNavigation, annotationNavigation } = state.options.viewer.sidebar;\n const tabCount = (thumbnailNavigation ? 1 : 0) + (outlineNavigation ? 1 : 0) + (annotationNavigation ? 1 : 0);\n const allowRotatePages = state.options.viewer.permissions.allowRotatePages && state.licenseFeatures.pageRotation;\n const { selectedNavigation, showNavigation } = state.navigationPanel;\n const useMobileLayout = state.layout.screenSize === ScreenSize.Small;\n return (h(\"div\", { class: classNames('pwv-NavigationPanel', { 'pwv-NavigationPanel--open': showNavigation }) },\n h(\"div\", { class: \"pwv-NavigationPanel__Box\" },\n tabCount > 1 && (h(Toolbar, null,\n !useMobileLayout && (h(ToolbarItemGroup, null,\n thumbnailNavigation && (h(ToolbarButton, { icon: icons.sidePaneThumbnails, tooltip: translationManager.getText('sideNavigation.thumbnails'), active: selectedNavigation === 'thumbnail', disabled: !showNavigation, onClick: () => actions.navigationPanel.selectNavigation('thumbnail') })),\n outlineNavigation && (h(ToolbarButton, { icon: icons.sidePaneOutline, tooltip: translationManager.getText('sideNavigation.outline'), active: selectedNavigation === 'outline', disabled: !showNavigation, onClick: () => actions.navigationPanel.selectNavigation('outline') })),\n annotationNavigation && (h(ToolbarButton, { icon: icons.sidePaneAnnotation, tooltip: translationManager.getText('sideNavigation.annotation'), active: selectedNavigation === 'annotation', disabled: !showNavigation, onClick: () => actions.navigationPanel.selectNavigation('annotation') })))),\n h(ToolbarItemGroup, { pushRight: true },\n h(ToolbarButton, { icon: icons.close, disabled: !showNavigation, onClick: actions.navigationPanel.toggleNavigationPanel })))),\n h(\"div\", { class: \"pwv-NavigationPanel__Content\", oncreate: (elm) => {\n elm.addEventListener('scroll', () => {\n if (scrollTimer) {\n window.clearTimeout(scrollTimer);\n }\n scrollTimer = window.setTimeout(() => {\n const fromPage = Math.floor(elm.scrollTop / 225) - 4;\n const toPage = fromPage + Math.floor(elm.clientHeight / 225) + 8;\n actions.api.addPageRangeToThumbnailsQueue({\n from: fromPage,\n to: toPage,\n });\n }, 100);\n });\n } },\n selectedNavigation === 'thumbnail' && thumbnailNavigation && (h(\"div\", null,\n h(ThumbnailNavigation, { pages: state.navigationPanel.pages, selectedPage: state.pdfDocument.pageNumber, currentPage: state.pdfDocument.pageNumber, allowRotatePages: allowRotatePages, onPageSelected: actions.api.setPageNumber, onRotatePage: actions.api.rotatePage }))),\n outlineNavigation && selectedNavigation === 'outline' && (h(\"div\", null,\n h(OutlineNavigation, null))),\n annotationNavigation && selectedNavigation === 'annotation' && (h(\"div\", null,\n h(AnnotationNavigation, null)))))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { classNames } from '../../../common/classNames';\nimport { Icon, icons } from '../../../common/Icon';\n/** internal */\nexport const OutlineList = ({ items, path, onToggleItem, onOutlineItemSelected, }) => (h(\"ul\", null, items.map((item) => (h(OutlineListItem, { item: item, path: path, onToggleItem: onToggleItem, onOutlineItemSelected: onOutlineItemSelected })))));\nconst OutlineListItem = ({ item, path, onToggleItem, onOutlineItemSelected, }) => {\n const childPath = path.filter((c) => true);\n childPath.push(item.id.toString());\n return (h(\"li\", null,\n h(\"div\", null,\n item.hasDescendants ? (h(\"span\", { class: classNames({ 'pwv-outline-tree-btn-expand': !item.open }, { 'pwv-outline-tree-btn-collapse': item.open }), onclick: () => {\n onToggleItem(childPath);\n } },\n h(Icon, { icon: item.open ? icons.outlineOpen : icons.outlineClosed }))) : (h(\"span\", { class: \"pwv-outline-tree-indent\" })),\n h(\"span\", { onclick: () => {\n onOutlineItemSelected(item.destination);\n }, class: \"pwv-outline-tree-lnk\" }, item.title)),\n item.open && item.descendants && (h(OutlineList, { items: item.descendants, path: childPath, onToggleItem: onToggleItem, onOutlineItemSelected: onOutlineItemSelected }))));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { OutlineList } from './OutlineList';\nimport { translationManager } from '../../../common/TranslationManager';\n/** internal */\nexport const OutlineNavigation = ({}) => (state, actions) => {\n const { outlines, outlineItemsLoaded } = state.navigationPanel;\n return (h(\"div\", { class: \"pwv-outline-navigation\" },\n outlines.length > 0 ? (h(OutlineList, { items: outlines, path: [], onToggleItem: actions.navigationPanel.toggleOutlineItem, onOutlineItemSelected: actions.api.goTo })) : outlineItemsLoaded ? (h(\"div\", { class: \"pwv-NavigationPanel__NoItems\" }, translationManager.getText('sideNavigation.noOutline'))) : (''),\n !outlineItemsLoaded && h(\"div\", { class: \"pwv-ItemLoader\" })));\n};\n","import { h } from '../../../lib/hyperapp';\nimport { classNames } from '../../../common/classNames';\nimport { icons } from '../../../common/Icon';\nimport { RotationDirection } from '../../../pdf-viewer-api/enums';\nimport { ToolbarButton } from '../../../common/ToolbarButton';\nimport { translationManager } from '../../../common/TranslationManager';\n/** internal */\n/* tslint:disable-next-line:max-line-length */\nexport const ThumbnailNavigation = ({ pages, currentPage, allowRotatePages, onPageSelected, onRotatePage }, children) => (h(\"div\", { class: \"pwv-thumbnail-navigation\" },\n h(\"ul\", null, pages.map((page) => (h(\"li\", { id: `pwv-thumbnail-navigation-page_${page.pageNumber}`, key: page.pageNumber, class: classNames('pwv-thumbnail-navigation-page', {\n 'pwv-selected': page.pageNumber === currentPage,\n }) },\n h(\"div\", { class: \"pwv-thumbnail-navigation-img-container\" }, page.thumbnail !== null ? (h(\"img\", { src: page.thumbnail, onclick: () => {\n onPageSelected(page.pageNumber);\n } })) : (h(\"div\", { class: \"pwv-page-placeholder\", onclick: () => {\n onPageSelected(page.pageNumber);\n } }, page.loading === true && h(\"div\", { class: \"pwv-ItemLoader\" })))),\n h(\"div\", { class: \"pwv-page-nr\" },\n allowRotatePages && page.pageNumber === currentPage && (h(\"div\", { class: \"pwv-page-rotation pwv-ToolbarItemGroup\" },\n h(ToolbarButton, { icon: icons.rotateLeft, tooltip: translationManager.getText('rotatePage.counterclockwise'), onClick: () => {\n onRotatePage({\n page: page.pageNumber,\n direction: RotationDirection.COUNTERCLOCKWISE,\n });\n } }),\n h(ToolbarButton, { icon: icons.rotateRight, tooltip: translationManager.getText('rotatePage.clockwise'), onClick: () => {\n onRotatePage({\n page: page.pageNumber,\n direction: RotationDirection.CLOCKWISE,\n });\n } }))),\n h(\"span\", null, page.pageNumber))))))));\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { PdfWebViewer, PdfFitMode, PdfPageLayoutMode } from '@pdf-tools/four-heights-pdf-web-viewer'\n\nconst options = {\n viewer: {\n general: {\n user: 'Webviewer Demo',\n rectangularTextSelection: 'automatic',\n },\n permissions: {\n allowPrinting: true,\n },\n sidebar: {\n selectedNavigation: 'outline',\n },\n },\n annotation: {\n colors: {\n highlightColors: ['#2ADB1A', '#FFEA02', '#FF7F1F', '#FF2882', '#008AD1'],\n foregroundColors: [\n '#323232',\n '#FFFFFF',\n '#2ADB1A',\n '#FFEA02',\n '#D82F32',\n '#0066CC',\n '#FFEA0277',\n '#D82F3277',\n '#0066CC77',\n ],\n backgroundColors: [\n 'transparent',\n '#FFFFFF',\n '#FCF5E2',\n '#323232',\n '#FFEA02',\n '#D82F32',\n '#0066CC',\n '#FFEA0277',\n '#D82F3277',\n '#0066CC77',\n ],\n defaultHighlightColor: '#FFEA02',\n defaultBackgroundColor: '#FCF5E2',\n defaultForegroundColor: '#323232',\n },\n },\n}\n\nasync function init() {\n const licenseJson = await (await fetch('license.json')).json()\n const viewerElement = document.getElementById('pdfviewer')\n const webviewer = new PdfWebViewer(viewerElement, licenseJson.license, options)\n\n webviewer.addEventListener('appLoaded', async () => {\n // const res = await fetch('WebViewer_Demo.pdf')\n // const data = await res.blob()\n webviewer.open({ uri: '../WebViewer_Demo.pdf' }, null, null, {\n initialZoom: 1,\n initialPageLayoutMode: PdfPageLayoutMode.ONE_COLUMN,\n })\n\n const versionInfo = document.createElement('div')\n versionInfo.textContent = 'Version: ' + webviewer.getProductVersion()\n versionInfo.classList.add('version-info')\n document.body.appendChild(versionInfo)\n })\n}\n\ninit()\n"],"names":[],"sourceRoot":""}