{"version":3,"file":"vendors-b127fdff.9729664bca28a8e6916d.bundle.js","mappings":";;;;;;;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://www.zeusteam.com/./node_modules/tinymce/tinymce.js"],"sourcesContent":["// 4.9.11 (2020-07-13)\n(function () {\n(function (domGlobals) {\n 'use strict';\n\n var noop = function () {\n };\n var compose = function (fa, fb) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return fa(fb.apply(null, args));\n };\n };\n var constant = function (value) {\n return function () {\n return value;\n };\n };\n var identity = function (x) {\n return x;\n };\n function curry(fn) {\n var initialArgs = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n initialArgs[_i - 1] = arguments[_i];\n }\n return function () {\n var restArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n restArgs[_i] = arguments[_i];\n }\n var all = initialArgs.concat(restArgs);\n return fn.apply(null, all);\n };\n }\n var not = function (f) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return !f.apply(null, args);\n };\n };\n var die = function (msg) {\n return function () {\n throw new Error(msg);\n };\n };\n var never = constant(false);\n var always = constant(true);\n\n var none = function () {\n return NONE;\n };\n var NONE = function () {\n var eq = function (o) {\n return o.isNone();\n };\n var call = function (thunk) {\n return thunk();\n };\n var id = function (n) {\n return n;\n };\n var me = {\n fold: function (n, s) {\n return n();\n },\n is: never,\n isSome: never,\n isNone: always,\n getOr: id,\n getOrThunk: call,\n getOrDie: function (msg) {\n throw new Error(msg || 'error: getOrDie called on none.');\n },\n getOrNull: constant(null),\n getOrUndefined: constant(undefined),\n or: id,\n orThunk: call,\n map: none,\n each: noop,\n bind: none,\n exists: never,\n forall: always,\n filter: none,\n equals: eq,\n equals_: eq,\n toArray: function () {\n return [];\n },\n toString: constant('none()')\n };\n if (Object.freeze) {\n Object.freeze(me);\n }\n return me;\n }();\n var some = function (a) {\n var constant_a = constant(a);\n var self = function () {\n return me;\n };\n var bind = function (f) {\n return f(a);\n };\n var me = {\n fold: function (n, s) {\n return s(a);\n },\n is: function (v) {\n return a === v;\n },\n isSome: always,\n isNone: never,\n getOr: constant_a,\n getOrThunk: constant_a,\n getOrDie: constant_a,\n getOrNull: constant_a,\n getOrUndefined: constant_a,\n or: self,\n orThunk: self,\n map: function (f) {\n return some(f(a));\n },\n each: function (f) {\n f(a);\n },\n bind: bind,\n exists: bind,\n forall: bind,\n filter: function (f) {\n return f(a) ? me : NONE;\n },\n toArray: function () {\n return [a];\n },\n toString: function () {\n return 'some(' + a + ')';\n },\n equals: function (o) {\n return o.is(a);\n },\n equals_: function (o, elementEq) {\n return o.fold(never, function (b) {\n return elementEq(a, b);\n });\n }\n };\n return me;\n };\n var from = function (value) {\n return value === null || value === undefined ? NONE : some(value);\n };\n var Option = {\n some: some,\n none: none,\n from: from\n };\n\n var typeOf = function (x) {\n if (x === null) {\n return 'null';\n }\n var t = typeof x;\n if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n return 'array';\n }\n if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n return 'string';\n }\n return t;\n };\n var isType = function (type) {\n return function (value) {\n return typeOf(value) === type;\n };\n };\n var isString = isType('string');\n var isObject = isType('object');\n var isArray = isType('array');\n var isNull = isType('null');\n var isBoolean = isType('boolean');\n var isFunction = isType('function');\n var isNumber = isType('number');\n\n var nativeSlice = Array.prototype.slice;\n var nativeIndexOf = Array.prototype.indexOf;\n var nativePush = Array.prototype.push;\n var rawIndexOf = function (ts, t) {\n return nativeIndexOf.call(ts, t);\n };\n var indexOf = function (xs, x) {\n var r = rawIndexOf(xs, x);\n return r === -1 ? Option.none() : Option.some(r);\n };\n var contains = function (xs, x) {\n return rawIndexOf(xs, x) > -1;\n };\n var exists = function (xs, pred) {\n for (var i = 0, len = xs.length; i < len; i++) {\n var x = xs[i];\n if (pred(x, i)) {\n return true;\n }\n }\n return false;\n };\n var map = function (xs, f) {\n var len = xs.length;\n var r = new Array(len);\n for (var i = 0; i < len; i++) {\n var x = xs[i];\n r[i] = f(x, i);\n }\n return r;\n };\n var each = function (xs, f) {\n for (var i = 0, len = xs.length; i < len; i++) {\n var x = xs[i];\n f(x, i);\n }\n };\n var eachr = function (xs, f) {\n for (var i = xs.length - 1; i >= 0; i--) {\n var x = xs[i];\n f(x, i);\n }\n };\n var partition = function (xs, pred) {\n var pass = [];\n var fail = [];\n for (var i = 0, len = xs.length; i < len; i++) {\n var x = xs[i];\n var arr = pred(x, i) ? pass : fail;\n arr.push(x);\n }\n return {\n pass: pass,\n fail: fail\n };\n };\n var filter = function (xs, pred) {\n var r = [];\n for (var i = 0, len = xs.length; i < len; i++) {\n var x = xs[i];\n if (pred(x, i)) {\n r.push(x);\n }\n }\n return r;\n };\n var foldr = function (xs, f, acc) {\n eachr(xs, function (x) {\n acc = f(acc, x);\n });\n return acc;\n };\n var foldl = function (xs, f, acc) {\n each(xs, function (x) {\n acc = f(acc, x);\n });\n return acc;\n };\n var find = function (xs, pred) {\n for (var i = 0, len = xs.length; i < len; i++) {\n var x = xs[i];\n if (pred(x, i)) {\n return Option.some(x);\n }\n }\n return Option.none();\n };\n var findIndex = function (xs, pred) {\n for (var i = 0, len = xs.length; i < len; i++) {\n var x = xs[i];\n if (pred(x, i)) {\n return Option.some(i);\n }\n }\n return Option.none();\n };\n var flatten = function (xs) {\n var r = [];\n for (var i = 0, len = xs.length; i < len; ++i) {\n if (!isArray(xs[i])) {\n throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n }\n nativePush.apply(r, xs[i]);\n }\n return r;\n };\n var bind = function (xs, f) {\n var output = map(xs, f);\n return flatten(output);\n };\n var forall = function (xs, pred) {\n for (var i = 0, len = xs.length; i < len; ++i) {\n var x = xs[i];\n if (pred(x, i) !== true) {\n return false;\n }\n }\n return true;\n };\n var reverse = function (xs) {\n var r = nativeSlice.call(xs, 0);\n r.reverse();\n return r;\n };\n var difference = function (a1, a2) {\n return filter(a1, function (x) {\n return !contains(a2, x);\n });\n };\n var mapToObject = function (xs, f) {\n var r = {};\n for (var i = 0, len = xs.length; i < len; i++) {\n var x = xs[i];\n r[String(x)] = f(x, i);\n }\n return r;\n };\n var sort = function (xs, comparator) {\n var copy = nativeSlice.call(xs, 0);\n copy.sort(comparator);\n return copy;\n };\n var head = function (xs) {\n return xs.length === 0 ? Option.none() : Option.some(xs[0]);\n };\n var last = function (xs) {\n return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);\n };\n var from$1 = isFunction(Array.from) ? Array.from : function (x) {\n return nativeSlice.call(x);\n };\n\n var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')();\n\n var path = function (parts, scope) {\n var o = scope !== undefined && scope !== null ? scope : Global;\n for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i) {\n o = o[parts[i]];\n }\n return o;\n };\n var resolve = function (p, scope) {\n var parts = p.split('.');\n return path(parts, scope);\n };\n\n var unsafe = function (name, scope) {\n return resolve(name, scope);\n };\n var getOrDie = function (name, scope) {\n var actual = unsafe(name, scope);\n if (actual === undefined || actual === null) {\n throw new Error(name + ' not available on this browser');\n }\n return actual;\n };\n var Global$1 = { getOrDie: getOrDie };\n\n var url = function () {\n return Global$1.getOrDie('URL');\n };\n var createObjectURL = function (blob) {\n return url().createObjectURL(blob);\n };\n var revokeObjectURL = function (u) {\n url().revokeObjectURL(u);\n };\n var URL = {\n createObjectURL: createObjectURL,\n revokeObjectURL: revokeObjectURL\n };\n\n var nav = domGlobals.navigator, userAgent = nav.userAgent;\n var opera, webkit, ie, ie11, ie12, gecko, mac, iDevice, android, fileApi, phone, tablet, windowsPhone;\n var matchMediaQuery = function (query) {\n return 'matchMedia' in domGlobals.window ? domGlobals.matchMedia(query).matches : false;\n };\n opera = false;\n android = /Android/.test(userAgent);\n webkit = /WebKit/.test(userAgent);\n ie = !webkit && !opera && /MSIE/gi.test(userAgent) && /Explorer/gi.test(nav.appName);\n ie = ie && /MSIE (\\w+)\\./.exec(userAgent)[1];\n ie11 = userAgent.indexOf('Trident/') !== -1 && (userAgent.indexOf('rv:') !== -1 || nav.appName.indexOf('Netscape') !== -1) ? 11 : false;\n ie12 = userAgent.indexOf('Edge/') !== -1 && !ie && !ie11 ? 12 : false;\n ie = ie || ie11 || ie12;\n gecko = !webkit && !ie11 && /Gecko/.test(userAgent);\n mac = userAgent.indexOf('Mac') !== -1;\n iDevice = /(iPad|iPhone)/.test(userAgent);\n fileApi = 'FormData' in domGlobals.window && 'FileReader' in domGlobals.window && 'URL' in domGlobals.window && !!URL.createObjectURL;\n phone = matchMediaQuery('only screen and (max-device-width: 480px)') && (android || iDevice);\n tablet = matchMediaQuery('only screen and (min-width: 800px)') && (android || iDevice);\n windowsPhone = userAgent.indexOf('Windows Phone') !== -1;\n if (ie12) {\n webkit = false;\n }\n var contentEditable = !iDevice || fileApi || parseInt(userAgent.match(/AppleWebKit\\/(\\d*)/)[1], 10) >= 534;\n var Env = {\n opera: opera,\n webkit: webkit,\n ie: ie,\n gecko: gecko,\n mac: mac,\n iOS: iDevice,\n android: android,\n contentEditable: contentEditable,\n transparentSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',\n caretAfter: ie !== 8,\n range: domGlobals.window.getSelection && 'Range' in domGlobals.window,\n documentMode: ie && !ie12 ? domGlobals.document.documentMode || 7 : 10,\n fileApi: fileApi,\n ceFalse: ie === false || ie > 8,\n cacheSuffix: null,\n container: null,\n overrideViewPort: null,\n experimentalShadowDom: false,\n canHaveCSP: ie === false || ie > 11,\n desktop: !phone && !tablet,\n windowsPhone: windowsPhone\n };\n\n var promise = function () {\n function bind(fn, thisArg) {\n return function () {\n fn.apply(thisArg, arguments);\n };\n }\n var isArray = Array.isArray || function (value) {\n return Object.prototype.toString.call(value) === '[object Array]';\n };\n var Promise = function (fn) {\n if (typeof this !== 'object') {\n throw new TypeError('Promises must be constructed via new');\n }\n if (typeof fn !== 'function') {\n throw new TypeError('not a function');\n }\n this._state = null;\n this._value = null;\n this._deferreds = [];\n doResolve(fn, bind(resolve, this), bind(reject, this));\n };\n var asap = Promise.immediateFn || typeof setImmediate === 'function' && setImmediate || function (fn) {\n setTimeout(fn, 1);\n };\n function handle(deferred) {\n var me = this;\n if (this._state === null) {\n this._deferreds.push(deferred);\n return;\n }\n asap(function () {\n var cb = me._state ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n (me._state ? deferred.resolve : deferred.reject)(me._value);\n return;\n }\n var ret;\n try {\n ret = cb(me._value);\n } catch (e) {\n deferred.reject(e);\n return;\n }\n deferred.resolve(ret);\n });\n }\n function resolve(newValue) {\n try {\n if (newValue === this) {\n throw new TypeError('A promise cannot be resolved with itself.');\n }\n if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {\n var then = newValue.then;\n if (typeof then === 'function') {\n doResolve(bind(then, newValue), bind(resolve, this), bind(reject, this));\n return;\n }\n }\n this._state = true;\n this._value = newValue;\n finale.call(this);\n } catch (e) {\n reject.call(this, e);\n }\n }\n function reject(newValue) {\n this._state = false;\n this._value = newValue;\n finale.call(this);\n }\n function finale() {\n for (var i = 0, len = this._deferreds.length; i < len; i++) {\n handle.call(this, this._deferreds[i]);\n }\n this._deferreds = null;\n }\n function Handler(onFulfilled, onRejected, resolve, reject) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.resolve = resolve;\n this.reject = reject;\n }\n function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function (value) {\n if (done) {\n return;\n }\n done = true;\n onFulfilled(value);\n }, function (reason) {\n if (done) {\n return;\n }\n done = true;\n onRejected(reason);\n });\n } catch (ex) {\n if (done) {\n return;\n }\n done = true;\n onRejected(ex);\n }\n }\n Promise.prototype.catch = function (onRejected) {\n return this.then(null, onRejected);\n };\n Promise.prototype.then = function (onFulfilled, onRejected) {\n var me = this;\n return new Promise(function (resolve, reject) {\n handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject));\n });\n };\n Promise.all = function () {\n var args = Array.prototype.slice.call(arguments.length === 1 && isArray(arguments[0]) ? arguments[0] : arguments);\n return new Promise(function (resolve, reject) {\n if (args.length === 0) {\n return resolve([]);\n }\n var remaining = args.length;\n function res(i, val) {\n try {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n var then = val.then;\n if (typeof then === 'function') {\n then.call(val, function (val) {\n res(i, val);\n }, reject);\n return;\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n } catch (ex) {\n reject(ex);\n }\n }\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n };\n Promise.resolve = function (value) {\n if (value && typeof value === 'object' && value.constructor === Promise) {\n return value;\n }\n return new Promise(function (resolve) {\n resolve(value);\n });\n };\n Promise.reject = function (value) {\n return new Promise(function (resolve, reject) {\n reject(value);\n });\n };\n Promise.race = function (values) {\n return new Promise(function (resolve, reject) {\n for (var i = 0, len = values.length; i < len; i++) {\n values[i].then(resolve, reject);\n }\n });\n };\n return Promise;\n };\n var promiseObj = window.Promise ? window.Promise : promise();\n\n var requestAnimationFramePromise;\n var requestAnimationFrame = function (callback, element) {\n var i, requestAnimationFrameFunc = domGlobals.window.requestAnimationFrame;\n var vendors = [\n 'ms',\n 'moz',\n 'webkit'\n ];\n var featurefill = function (callback) {\n domGlobals.window.setTimeout(callback, 0);\n };\n for (i = 0; i < vendors.length && !requestAnimationFrameFunc; i++) {\n requestAnimationFrameFunc = domGlobals.window[vendors[i] + 'RequestAnimationFrame'];\n }\n if (!requestAnimationFrameFunc) {\n requestAnimationFrameFunc = featurefill;\n }\n requestAnimationFrameFunc(callback, element);\n };\n var wrappedSetTimeout = function (callback, time) {\n if (typeof time !== 'number') {\n time = 0;\n }\n return setTimeout(callback, time);\n };\n var wrappedSetInterval = function (callback, time) {\n if (typeof time !== 'number') {\n time = 1;\n }\n return setInterval(callback, time);\n };\n var wrappedClearTimeout = function (id) {\n return clearTimeout(id);\n };\n var wrappedClearInterval = function (id) {\n return clearInterval(id);\n };\n var debounce = function (callback, time) {\n var timer, func;\n func = function () {\n var args = arguments;\n clearTimeout(timer);\n timer = wrappedSetTimeout(function () {\n callback.apply(this, args);\n }, time);\n };\n func.stop = function () {\n clearTimeout(timer);\n };\n return func;\n };\n var Delay = {\n requestAnimationFrame: function (callback, element) {\n if (requestAnimationFramePromise) {\n requestAnimationFramePromise.then(callback);\n return;\n }\n requestAnimationFramePromise = new promiseObj(function (resolve) {\n if (!element) {\n element = domGlobals.document.body;\n }\n requestAnimationFrame(resolve, element);\n }).then(callback);\n },\n setTimeout: wrappedSetTimeout,\n setInterval: wrappedSetInterval,\n setEditorTimeout: function (editor, callback, time) {\n return wrappedSetTimeout(function () {\n if (!editor.removed) {\n callback();\n }\n }, time);\n },\n setEditorInterval: function (editor, callback, time) {\n var timer;\n timer = wrappedSetInterval(function () {\n if (!editor.removed) {\n callback();\n } else {\n clearInterval(timer);\n }\n }, time);\n return timer;\n },\n debounce: debounce,\n throttle: debounce,\n clearInterval: wrappedClearInterval,\n clearTimeout: wrappedClearTimeout\n };\n\n var eventExpandoPrefix = 'mce-data-';\n var mouseEventRe = /^(?:mouse|contextmenu)|click/;\n var deprecated = {\n keyLocation: 1,\n layerX: 1,\n layerY: 1,\n returnValue: 1,\n webkitMovementX: 1,\n webkitMovementY: 1,\n keyIdentifier: 1\n };\n var hasIsDefaultPrevented = function (event) {\n return event.isDefaultPrevented === returnTrue || event.isDefaultPrevented === returnFalse;\n };\n var returnFalse = function () {\n return false;\n };\n var returnTrue = function () {\n return true;\n };\n var addEvent = function (target, name, callback, capture) {\n if (target.addEventListener) {\n target.addEventListener(name, callback, capture || false);\n } else if (target.attachEvent) {\n target.attachEvent('on' + name, callback);\n }\n };\n var removeEvent = function (target, name, callback, capture) {\n if (target.removeEventListener) {\n target.removeEventListener(name, callback, capture || false);\n } else if (target.detachEvent) {\n target.detachEvent('on' + name, callback);\n }\n };\n var getTargetFromShadowDom = function (event, defaultTarget) {\n if (event.composedPath) {\n var composedPath = event.composedPath();\n if (composedPath && composedPath.length > 0) {\n return composedPath[0];\n }\n }\n return defaultTarget;\n };\n var fix = function (originalEvent, data) {\n var name;\n var event = data || {};\n for (name in originalEvent) {\n if (!deprecated[name]) {\n event[name] = originalEvent[name];\n }\n }\n if (!event.target) {\n event.target = event.srcElement || domGlobals.document;\n }\n if (Env.experimentalShadowDom) {\n event.target = getTargetFromShadowDom(originalEvent, event.target);\n }\n if (originalEvent && mouseEventRe.test(originalEvent.type) && originalEvent.pageX === undefined && originalEvent.clientX !== undefined) {\n var eventDoc = event.target.ownerDocument || domGlobals.document;\n var doc = eventDoc.documentElement;\n var body = eventDoc.body;\n event.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n event.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);\n }\n event.preventDefault = function () {\n event.isDefaultPrevented = returnTrue;\n if (originalEvent) {\n if (originalEvent.preventDefault) {\n originalEvent.preventDefault();\n } else {\n originalEvent.returnValue = false;\n }\n }\n };\n event.stopPropagation = function () {\n event.isPropagationStopped = returnTrue;\n if (originalEvent) {\n if (originalEvent.stopPropagation) {\n originalEvent.stopPropagation();\n } else {\n originalEvent.cancelBubble = true;\n }\n }\n };\n event.stopImmediatePropagation = function () {\n event.isImmediatePropagationStopped = returnTrue;\n event.stopPropagation();\n };\n if (hasIsDefaultPrevented(event) === false) {\n event.isDefaultPrevented = returnFalse;\n event.isPropagationStopped = returnFalse;\n event.isImmediatePropagationStopped = returnFalse;\n }\n if (typeof event.metaKey === 'undefined') {\n event.metaKey = false;\n }\n return event;\n };\n var bindOnReady = function (win, callback, eventUtils) {\n var doc = win.document, event = { type: 'ready' };\n if (eventUtils.domLoaded) {\n callback(event);\n return;\n }\n var isDocReady = function () {\n return doc.readyState === 'complete' || doc.readyState === 'interactive' && doc.body;\n };\n var readyHandler = function () {\n if (!eventUtils.domLoaded) {\n eventUtils.domLoaded = true;\n callback(event);\n }\n };\n var waitForDomLoaded = function () {\n if (isDocReady()) {\n removeEvent(doc, 'readystatechange', waitForDomLoaded);\n readyHandler();\n }\n };\n var tryScroll = function () {\n try {\n doc.documentElement.doScroll('left');\n } catch (ex) {\n Delay.setTimeout(tryScroll);\n return;\n }\n readyHandler();\n };\n if (doc.addEventListener && !(Env.ie && Env.ie < 11)) {\n if (isDocReady()) {\n readyHandler();\n } else {\n addEvent(win, 'DOMContentLoaded', readyHandler);\n }\n } else {\n addEvent(doc, 'readystatechange', waitForDomLoaded);\n if (doc.documentElement.doScroll && win.self === win.top) {\n tryScroll();\n }\n }\n addEvent(win, 'load', readyHandler);\n };\n var EventUtils = function () {\n var self = this;\n var events = {}, count, expando, hasFocusIn, hasMouseEnterLeave, mouseEnterLeave;\n expando = eventExpandoPrefix + (+new Date()).toString(32);\n hasMouseEnterLeave = 'onmouseenter' in domGlobals.document.documentElement;\n hasFocusIn = 'onfocusin' in domGlobals.document.documentElement;\n mouseEnterLeave = {\n mouseenter: 'mouseover',\n mouseleave: 'mouseout'\n };\n count = 1;\n self.domLoaded = false;\n self.events = events;\n var executeHandlers = function (evt, id) {\n var callbackList, i, l, callback;\n var container = events[id];\n callbackList = container && container[evt.type];\n if (callbackList) {\n for (i = 0, l = callbackList.length; i < l; i++) {\n callback = callbackList[i];\n if (callback && callback.func.call(callback.scope, evt) === false) {\n evt.preventDefault();\n }\n if (evt.isImmediatePropagationStopped()) {\n return;\n }\n }\n }\n };\n self.bind = function (target, names, callback, scope) {\n var id, callbackList, i, name, fakeName, nativeHandler, capture;\n var win = domGlobals.window;\n var defaultNativeHandler = function (evt) {\n executeHandlers(fix(evt || win.event), id);\n };\n if (!target || target.nodeType === 3 || target.nodeType === 8) {\n return;\n }\n if (!target[expando]) {\n id = count++;\n target[expando] = id;\n events[id] = {};\n } else {\n id = target[expando];\n }\n scope = scope || target;\n names = names.split(' ');\n i = names.length;\n while (i--) {\n name = names[i];\n nativeHandler = defaultNativeHandler;\n fakeName = capture = false;\n if (name === 'DOMContentLoaded') {\n name = 'ready';\n }\n if (self.domLoaded && name === 'ready' && target.readyState === 'complete') {\n callback.call(scope, fix({ type: name }));\n continue;\n }\n if (!hasMouseEnterLeave) {\n fakeName = mouseEnterLeave[name];\n if (fakeName) {\n nativeHandler = function (evt) {\n var current, related;\n current = evt.currentTarget;\n related = evt.relatedTarget;\n if (related && current.contains) {\n related = current.contains(related);\n } else {\n while (related && related !== current) {\n related = related.parentNode;\n }\n }\n if (!related) {\n evt = fix(evt || win.event);\n evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter';\n evt.target = current;\n executeHandlers(evt, id);\n }\n };\n }\n }\n if (!hasFocusIn && (name === 'focusin' || name === 'focusout')) {\n capture = true;\n fakeName = name === 'focusin' ? 'focus' : 'blur';\n nativeHandler = function (evt) {\n evt = fix(evt || win.event);\n evt.type = evt.type === 'focus' ? 'focusin' : 'focusout';\n executeHandlers(evt, id);\n };\n }\n callbackList = events[id][name];\n if (!callbackList) {\n events[id][name] = callbackList = [{\n func: callback,\n scope: scope\n }];\n callbackList.fakeName = fakeName;\n callbackList.capture = capture;\n callbackList.nativeHandler = nativeHandler;\n if (name === 'ready') {\n bindOnReady(target, nativeHandler, self);\n } else {\n addEvent(target, fakeName || name, nativeHandler, capture);\n }\n } else {\n if (name === 'ready' && self.domLoaded) {\n callback({ type: name });\n } else {\n callbackList.push({\n func: callback,\n scope: scope\n });\n }\n }\n }\n target = callbackList = 0;\n return callback;\n };\n self.unbind = function (target, names, callback) {\n var id, callbackList, i, ci, name, eventMap;\n if (!target || target.nodeType === 3 || target.nodeType === 8) {\n return self;\n }\n id = target[expando];\n if (id) {\n eventMap = events[id];\n if (names) {\n names = names.split(' ');\n i = names.length;\n while (i--) {\n name = names[i];\n callbackList = eventMap[name];\n if (callbackList) {\n if (callback) {\n ci = callbackList.length;\n while (ci--) {\n if (callbackList[ci].func === callback) {\n var nativeHandler = callbackList.nativeHandler;\n var fakeName = callbackList.fakeName, capture = callbackList.capture;\n callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1));\n callbackList.nativeHandler = nativeHandler;\n callbackList.fakeName = fakeName;\n callbackList.capture = capture;\n eventMap[name] = callbackList;\n }\n }\n }\n if (!callback || callbackList.length === 0) {\n delete eventMap[name];\n removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);\n }\n }\n }\n } else {\n for (name in eventMap) {\n callbackList = eventMap[name];\n removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);\n }\n eventMap = {};\n }\n for (name in eventMap) {\n return self;\n }\n delete events[id];\n try {\n delete target[expando];\n } catch (ex) {\n target[expando] = null;\n }\n }\n return self;\n };\n self.fire = function (target, name, args) {\n var id;\n if (!target || target.nodeType === 3 || target.nodeType === 8) {\n return self;\n }\n args = fix(null, args);\n args.type = name;\n args.target = target;\n do {\n id = target[expando];\n if (id) {\n executeHandlers(args, id);\n }\n target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow;\n } while (target && !args.isPropagationStopped());\n return self;\n };\n self.clean = function (target) {\n var i, children;\n var unbind = self.unbind;\n if (!target || target.nodeType === 3 || target.nodeType === 8) {\n return self;\n }\n if (target[expando]) {\n unbind(target);\n }\n if (!target.getElementsByTagName) {\n target = target.document;\n }\n if (target && target.getElementsByTagName) {\n unbind(target);\n children = target.getElementsByTagName('*');\n i = children.length;\n while (i--) {\n target = children[i];\n if (target[expando]) {\n unbind(target);\n }\n }\n }\n return self;\n };\n self.destroy = function () {\n events = {};\n };\n self.cancel = function (e) {\n if (e) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n return false;\n };\n };\n EventUtils.Event = new EventUtils();\n EventUtils.Event.bind(domGlobals.window, 'ready', function () {\n });\n\n var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains$1, expando = 'sizzle' + -new Date(), preferredDoc = domGlobals.window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function (a, b) {\n if (a === b) {\n hasDuplicate = true;\n }\n return 0;\n }, strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, indexOf$1 = arr.indexOf || function (elem) {\n var i = 0, len = this.length;\n for (; i < len; i++) {\n if (this[i] === elem) {\n return i;\n }\n }\n return -1;\n }, booleans = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped', whitespace = '[\\\\x20\\\\t\\\\r\\\\n\\\\f]', identifier = '(?:\\\\\\\\.|[\\\\w-]|[^\\\\x00-\\\\xa0])+', attributes = '\\\\[' + whitespace + '*(' + identifier + ')(?:' + whitespace + '*([*^$|!~]?=)' + whitespace + '*(?:\\'((?:\\\\\\\\.|[^\\\\\\\\\\'])*)\\'|\"((?:\\\\\\\\.|[^\\\\\\\\\"])*)\"|(' + identifier + '))|)' + whitespace + '*\\\\]', pseudos = ':(' + identifier + ')(?:\\\\((' + '(\\'((?:\\\\\\\\.|[^\\\\\\\\\\'])*)\\'|\"((?:\\\\\\\\.|[^\\\\\\\\\"])*)\")|' + '((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|' + attributes + ')*)|' + '.*' + ')\\\\)|)', rtrim = new RegExp('^' + whitespace + '+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)' + whitespace + '+$', 'g'), rcomma = new RegExp('^' + whitespace + '*,' + whitespace + '*'), rcombinators = new RegExp('^' + whitespace + '*([>+~]|' + whitespace + ')' + whitespace + '*'), rattributeQuotes = new RegExp('=' + whitespace + '*([^\\\\]\\'\"]*?)' + whitespace + '*\\\\]', 'g'), rpseudo = new RegExp(pseudos), ridentifier = new RegExp('^' + identifier + '$'), matchExpr = {\n ID: new RegExp('^#(' + identifier + ')'),\n CLASS: new RegExp('^\\\\.(' + identifier + ')'),\n TAG: new RegExp('^(' + identifier + '|[*])'),\n ATTR: new RegExp('^' + attributes),\n PSEUDO: new RegExp('^' + pseudos),\n CHILD: new RegExp('^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(' + whitespace + '*(even|odd|(([+-]|)(\\\\d*)n|)' + whitespace + '*(?:([+-]|)' + whitespace + '*(\\\\d+)|))' + whitespace + '*\\\\)|)', 'i'),\n bool: new RegExp('^(?:' + booleans + ')$', 'i'),\n needsContext: new RegExp('^' + whitespace + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(' + whitespace + '*((?:-\\\\d)?\\\\d*)' + whitespace + '*\\\\)|)(?=[^-]|$)', 'i')\n }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\\d$/i, rnative = /^[^{]+\\{\\s*\\[native \\w/, rquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\\\/g, runescape = new RegExp('\\\\\\\\([\\\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig'), funescape = function (_, escaped, escapedWhitespace) {\n var high = '0x' + escaped - 65536;\n return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);\n };\n try {\n push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);\n arr[preferredDoc.childNodes.length].nodeType;\n } catch (e) {\n push = {\n apply: arr.length ? function (target, els) {\n push_native.apply(target, slice.call(els));\n } : function (target, els) {\n var j = target.length, i = 0;\n while (target[j++] = els[i++]) {\n }\n target.length = j - 1;\n }\n };\n }\n var Sizzle = function (selector, context, results, seed) {\n var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;\n if ((context ? context.ownerDocument || context : preferredDoc) !== document) {\n setDocument(context);\n }\n context = context || document;\n results = results || [];\n if (!selector || typeof selector !== 'string') {\n return results;\n }\n if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) {\n return [];\n }\n if (documentIsHTML && !seed) {\n if (match = rquickExpr.exec(selector)) {\n if (m = match[1]) {\n if (nodeType === 9) {\n elem = context.getElementById(m);\n if (elem && elem.parentNode) {\n if (elem.id === m) {\n results.push(elem);\n return results;\n }\n } else {\n return results;\n }\n } else {\n if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains$1(context, elem) && elem.id === m) {\n results.push(elem);\n return results;\n }\n }\n } else if (match[2]) {\n push.apply(results, context.getElementsByTagName(selector));\n return results;\n } else if ((m = match[3]) && support.getElementsByClassName) {\n push.apply(results, context.getElementsByClassName(m));\n return results;\n }\n }\n if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {\n nid = old = expando;\n newContext = context;\n newSelector = nodeType === 9 && selector;\n if (nodeType === 1 && context.nodeName.toLowerCase() !== 'object') {\n groups = tokenize(selector);\n if (old = context.getAttribute('id')) {\n nid = old.replace(rescape, '\\\\$&');\n } else {\n context.setAttribute('id', nid);\n }\n nid = '[id=\\'' + nid + '\\'] ';\n i = groups.length;\n while (i--) {\n groups[i] = nid + toSelector(groups[i]);\n }\n newContext = rsibling.test(selector) && testContext(context.parentNode) || context;\n newSelector = groups.join(',');\n }\n if (newSelector) {\n try {\n push.apply(results, newContext.querySelectorAll(newSelector));\n return results;\n } catch (qsaError) {\n } finally {\n if (!old) {\n context.removeAttribute('id');\n }\n }\n }\n }\n }\n return select(selector.replace(rtrim, '$1'), context, results, seed);\n };\n function createCache() {\n var keys = [];\n function cache(key, value) {\n if (keys.push(key + ' ') > Expr.cacheLength) {\n delete cache[keys.shift()];\n }\n return cache[key + ' '] = value;\n }\n return cache;\n }\n function markFunction(fn) {\n fn[expando] = true;\n return fn;\n }\n function siblingCheck(a, b) {\n var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);\n if (diff) {\n return diff;\n }\n if (cur) {\n while (cur = cur.nextSibling) {\n if (cur === b) {\n return -1;\n }\n }\n }\n return a ? 1 : -1;\n }\n function createInputPseudo(type) {\n return function (elem) {\n var name = elem.nodeName.toLowerCase();\n return name === 'input' && elem.type === type;\n };\n }\n function createButtonPseudo(type) {\n return function (elem) {\n var name = elem.nodeName.toLowerCase();\n return (name === 'input' || name === 'button') && elem.type === type;\n };\n }\n function createPositionalPseudo(fn) {\n return markFunction(function (argument) {\n argument = +argument;\n return markFunction(function (seed, matches) {\n var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length;\n while (i--) {\n if (seed[j = matchIndexes[i]]) {\n seed[j] = !(matches[j] = seed[j]);\n }\n }\n });\n });\n }\n function testContext(context) {\n return context && typeof context.getElementsByTagName !== strundefined && context;\n }\n support = Sizzle.support = {};\n isXML = Sizzle.isXML = function (elem) {\n var documentElement = elem && (elem.ownerDocument || elem).documentElement;\n return documentElement ? documentElement.nodeName !== 'HTML' : false;\n };\n setDocument = Sizzle.setDocument = function (node) {\n var hasCompare, doc = node ? node.ownerDocument || node : preferredDoc, parent = doc.defaultView;\n function getTop(win) {\n try {\n return win.top;\n } catch (ex) {\n }\n return null;\n }\n if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {\n return document;\n }\n document = doc;\n docElem = doc.documentElement;\n documentIsHTML = !isXML(doc);\n if (parent && parent !== getTop(parent)) {\n if (parent.addEventListener) {\n parent.addEventListener('unload', function () {\n setDocument();\n }, false);\n } else if (parent.attachEvent) {\n parent.attachEvent('onunload', function () {\n setDocument();\n });\n }\n }\n support.attributes = true;\n support.getElementsByTagName = true;\n support.getElementsByClassName = rnative.test(doc.getElementsByClassName);\n support.getById = true;\n Expr.find.ID = function (id, context) {\n if (typeof context.getElementById !== strundefined && documentIsHTML) {\n var m = context.getElementById(id);\n return m && m.parentNode ? [m] : [];\n }\n };\n Expr.filter.ID = function (id) {\n var attrId = id.replace(runescape, funescape);\n return function (elem) {\n return elem.getAttribute('id') === attrId;\n };\n };\n Expr.find.TAG = support.getElementsByTagName ? function (tag, context) {\n if (typeof context.getElementsByTagName !== strundefined) {\n return context.getElementsByTagName(tag);\n }\n } : function (tag, context) {\n var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag);\n if (tag === '*') {\n while (elem = results[i++]) {\n if (elem.nodeType === 1) {\n tmp.push(elem);\n }\n }\n return tmp;\n }\n return results;\n };\n Expr.find.CLASS = support.getElementsByClassName && function (className, context) {\n if (documentIsHTML) {\n return context.getElementsByClassName(className);\n }\n };\n rbuggyMatches = [];\n rbuggyQSA = [];\n support.disconnectedMatch = true;\n rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join('|'));\n rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join('|'));\n hasCompare = rnative.test(docElem.compareDocumentPosition);\n contains$1 = hasCompare || rnative.test(docElem.contains) ? function (a, b) {\n var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode;\n return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));\n } : function (a, b) {\n if (b) {\n while (b = b.parentNode) {\n if (b === a) {\n return true;\n }\n }\n }\n return false;\n };\n sortOrder = hasCompare ? function (a, b) {\n if (a === b) {\n hasDuplicate = true;\n return 0;\n }\n var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n if (compare) {\n return compare;\n }\n compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;\n if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {\n if (a === doc || a.ownerDocument === preferredDoc && contains$1(preferredDoc, a)) {\n return -1;\n }\n if (b === doc || b.ownerDocument === preferredDoc && contains$1(preferredDoc, b)) {\n return 1;\n }\n return sortInput ? indexOf$1.call(sortInput, a) - indexOf$1.call(sortInput, b) : 0;\n }\n return compare & 4 ? -1 : 1;\n } : function (a, b) {\n if (a === b) {\n hasDuplicate = true;\n return 0;\n }\n var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b];\n if (!aup || !bup) {\n return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf$1.call(sortInput, a) - indexOf$1.call(sortInput, b) : 0;\n } else if (aup === bup) {\n return siblingCheck(a, b);\n }\n cur = a;\n while (cur = cur.parentNode) {\n ap.unshift(cur);\n }\n cur = b;\n while (cur = cur.parentNode) {\n bp.unshift(cur);\n }\n while (ap[i] === bp[i]) {\n i++;\n }\n return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;\n };\n return doc;\n };\n Sizzle.matches = function (expr, elements) {\n return Sizzle(expr, null, null, elements);\n };\n Sizzle.matchesSelector = function (elem, expr) {\n if ((elem.ownerDocument || elem) !== document) {\n setDocument(elem);\n }\n expr = expr.replace(rattributeQuotes, '=\\'$1\\']');\n if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {\n try {\n var ret = matches.call(elem, expr);\n if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {\n return ret;\n }\n } catch (e) {\n }\n }\n return Sizzle(expr, document, null, [elem]).length > 0;\n };\n Sizzle.contains = function (context, elem) {\n if ((context.ownerDocument || context) !== document) {\n setDocument(context);\n }\n return contains$1(context, elem);\n };\n Sizzle.attr = function (elem, name) {\n if ((elem.ownerDocument || elem) !== document) {\n setDocument(elem);\n }\n var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;\n return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;\n };\n Sizzle.error = function (msg) {\n throw new Error('Syntax error, unrecognized expression: ' + msg);\n };\n Sizzle.uniqueSort = function (results) {\n var elem, duplicates = [], j = 0, i = 0;\n hasDuplicate = !support.detectDuplicates;\n sortInput = !support.sortStable && results.slice(0);\n results.sort(sortOrder);\n if (hasDuplicate) {\n while (elem = results[i++]) {\n if (elem === results[i]) {\n j = duplicates.push(i);\n }\n }\n while (j--) {\n results.splice(duplicates[j], 1);\n }\n }\n sortInput = null;\n return results;\n };\n getText = Sizzle.getText = function (elem) {\n var node, ret = '', i = 0, nodeType = elem.nodeType;\n if (!nodeType) {\n while (node = elem[i++]) {\n ret += getText(node);\n }\n } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {\n if (typeof elem.textContent === 'string') {\n return elem.textContent;\n } else {\n for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n ret += getText(elem);\n }\n }\n } else if (nodeType === 3 || nodeType === 4) {\n return elem.nodeValue;\n }\n return ret;\n };\n Expr = Sizzle.selectors = {\n cacheLength: 50,\n createPseudo: markFunction,\n match: matchExpr,\n attrHandle: {},\n find: {},\n relative: {\n '>': {\n dir: 'parentNode',\n first: true\n },\n ' ': { dir: 'parentNode' },\n '+': {\n dir: 'previousSibling',\n first: true\n },\n '~': { dir: 'previousSibling' }\n },\n preFilter: {\n ATTR: function (match) {\n match[1] = match[1].replace(runescape, funescape);\n match[3] = (match[3] || match[4] || match[5] || '').replace(runescape, funescape);\n if (match[2] === '~=') {\n match[3] = ' ' + match[3] + ' ';\n }\n return match.slice(0, 4);\n },\n CHILD: function (match) {\n match[1] = match[1].toLowerCase();\n if (match[1].slice(0, 3) === 'nth') {\n if (!match[3]) {\n Sizzle.error(match[0]);\n }\n match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === 'even' || match[3] === 'odd'));\n match[5] = +(match[7] + match[8] || match[3] === 'odd');\n } else if (match[3]) {\n Sizzle.error(match[0]);\n }\n return match;\n },\n PSEUDO: function (match) {\n var excess, unquoted = !match[6] && match[2];\n if (matchExpr.CHILD.test(match[0])) {\n return null;\n }\n if (match[3]) {\n match[2] = match[4] || match[5] || '';\n } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(')', unquoted.length - excess) - unquoted.length)) {\n match[0] = match[0].slice(0, excess);\n match[2] = unquoted.slice(0, excess);\n }\n return match.slice(0, 3);\n }\n },\n filter: {\n TAG: function (nodeNameSelector) {\n var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();\n return nodeNameSelector === '*' ? function () {\n return true;\n } : function (elem) {\n return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n };\n },\n CLASS: function (className) {\n var pattern = classCache[className + ' '];\n return pattern || (pattern = new RegExp('(^|' + whitespace + ')' + className + '(' + whitespace + '|$)')) && classCache(className, function (elem) {\n return pattern.test(typeof elem.className === 'string' && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute('class') || '');\n });\n },\n ATTR: function (name, operator, check) {\n return function (elem) {\n var result = Sizzle.attr(elem, name);\n if (result == null) {\n return operator === '!=';\n }\n if (!operator) {\n return true;\n }\n result += '';\n return operator === '=' ? result === check : operator === '!=' ? result !== check : operator === '^=' ? check && result.indexOf(check) === 0 : operator === '*=' ? check && result.indexOf(check) > -1 : operator === '$=' ? check && result.slice(-check.length) === check : operator === '~=' ? (' ' + result + ' ').indexOf(check) > -1 : operator === '|=' ? result === check || result.slice(0, check.length + 1) === check + '-' : false;\n };\n },\n CHILD: function (type, what, argument, first, last) {\n var simple = type.slice(0, 3) !== 'nth', forward = type.slice(-4) !== 'last', ofType = what === 'of-type';\n return first === 1 && last === 0 ? function (elem) {\n return !!elem.parentNode;\n } : function (elem, context, xml) {\n var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? 'nextSibling' : 'previousSibling', parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType;\n if (parent) {\n if (simple) {\n while (dir) {\n node = elem;\n while (node = node[dir]) {\n if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {\n return false;\n }\n }\n start = dir = type === 'only' && !start && 'nextSibling';\n }\n return true;\n }\n start = [forward ? parent.firstChild : parent.lastChild];\n if (forward && useCache) {\n outerCache = parent[expando] || (parent[expando] = {});\n cache = outerCache[type] || [];\n nodeIndex = cache[0] === dirruns && cache[1];\n diff = cache[0] === dirruns && cache[2];\n node = nodeIndex && parent.childNodes[nodeIndex];\n while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {\n if (node.nodeType === 1 && ++diff && node === elem) {\n outerCache[type] = [\n dirruns,\n nodeIndex,\n diff\n ];\n break;\n }\n }\n } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {\n diff = cache[1];\n } else {\n while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {\n if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {\n if (useCache) {\n (node[expando] || (node[expando] = {}))[type] = [\n dirruns,\n diff\n ];\n }\n if (node === elem) {\n break;\n }\n }\n }\n }\n diff -= last;\n return diff === first || diff % first === 0 && diff / first >= 0;\n }\n };\n },\n PSEUDO: function (pseudo, argument) {\n var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error('unsupported pseudo: ' + pseudo);\n if (fn[expando]) {\n return fn(argument);\n }\n if (fn.length > 1) {\n args = [\n pseudo,\n pseudo,\n '',\n argument\n ];\n return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {\n var idx, matched = fn(seed, argument), i = matched.length;\n while (i--) {\n idx = indexOf$1.call(seed, matched[i]);\n seed[idx] = !(matches[idx] = matched[i]);\n }\n }) : function (elem) {\n return fn(elem, 0, args);\n };\n }\n return fn;\n }\n },\n pseudos: {\n not: markFunction(function (selector) {\n var input = [], results = [], matcher = compile(selector.replace(rtrim, '$1'));\n return matcher[expando] ? markFunction(function (seed, matches, context, xml) {\n var elem, unmatched = matcher(seed, null, xml, []), i = seed.length;\n while (i--) {\n if (elem = unmatched[i]) {\n seed[i] = !(matches[i] = elem);\n }\n }\n }) : function (elem, context, xml) {\n input[0] = elem;\n matcher(input, null, xml, results);\n return !results.pop();\n };\n }),\n has: markFunction(function (selector) {\n return function (elem) {\n return Sizzle(selector, elem).length > 0;\n };\n }),\n contains: markFunction(function (text) {\n text = text.replace(runescape, funescape);\n return function (elem) {\n return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;\n };\n }),\n lang: markFunction(function (lang) {\n if (!ridentifier.test(lang || '')) {\n Sizzle.error('unsupported lang: ' + lang);\n }\n lang = lang.replace(runescape, funescape).toLowerCase();\n return function (elem) {\n var elemLang;\n do {\n if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute('xml:lang') || elem.getAttribute('lang')) {\n elemLang = elemLang.toLowerCase();\n return elemLang === lang || elemLang.indexOf(lang + '-') === 0;\n }\n } while ((elem = elem.parentNode) && elem.nodeType === 1);\n return false;\n };\n }),\n target: function (elem) {\n var hash = domGlobals.window.location && domGlobals.window.location.hash;\n return hash && hash.slice(1) === elem.id;\n },\n root: function (elem) {\n return elem === docElem;\n },\n focus: function (elem) {\n return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n },\n enabled: function (elem) {\n return elem.disabled === false;\n },\n disabled: function (elem) {\n return elem.disabled === true;\n },\n checked: function (elem) {\n var nodeName = elem.nodeName.toLowerCase();\n return nodeName === 'input' && !!elem.checked || nodeName === 'option' && !!elem.selected;\n },\n selected: function (elem) {\n if (elem.parentNode) {\n elem.parentNode.selectedIndex;\n }\n return elem.selected === true;\n },\n empty: function (elem) {\n for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n if (elem.nodeType < 6) {\n return false;\n }\n }\n return true;\n },\n parent: function (elem) {\n return !Expr.pseudos.empty(elem);\n },\n header: function (elem) {\n return rheader.test(elem.nodeName);\n },\n input: function (elem) {\n return rinputs.test(elem.nodeName);\n },\n button: function (elem) {\n var name = elem.nodeName.toLowerCase();\n return name === 'input' && elem.type === 'button' || name === 'button';\n },\n text: function (elem) {\n var attr;\n return elem.nodeName.toLowerCase() === 'input' && elem.type === 'text' && ((attr = elem.getAttribute('type')) == null || attr.toLowerCase() === 'text');\n },\n first: createPositionalPseudo(function () {\n return [0];\n }),\n last: createPositionalPseudo(function (matchIndexes, length) {\n return [length - 1];\n }),\n eq: createPositionalPseudo(function (matchIndexes, length, argument) {\n return [argument < 0 ? argument + length : argument];\n }),\n even: createPositionalPseudo(function (matchIndexes, length) {\n var i = 0;\n for (; i < length; i += 2) {\n matchIndexes.push(i);\n }\n return matchIndexes;\n }),\n odd: createPositionalPseudo(function (matchIndexes, length) {\n var i = 1;\n for (; i < length; i += 2) {\n matchIndexes.push(i);\n }\n return matchIndexes;\n }),\n lt: createPositionalPseudo(function (matchIndexes, length, argument) {\n var i = argument < 0 ? argument + length : argument;\n for (; --i >= 0;) {\n matchIndexes.push(i);\n }\n return matchIndexes;\n }),\n gt: createPositionalPseudo(function (matchIndexes, length, argument) {\n var i = argument < 0 ? argument + length : argument;\n for (; ++i < length;) {\n matchIndexes.push(i);\n }\n return matchIndexes;\n })\n }\n };\n Expr.pseudos.nth = Expr.pseudos.eq;\n for (i in {\n radio: true,\n checkbox: true,\n file: true,\n password: true,\n image: true\n }) {\n Expr.pseudos[i] = createInputPseudo(i);\n }\n for (i in {\n submit: true,\n reset: true\n }) {\n Expr.pseudos[i] = createButtonPseudo(i);\n }\n function setFilters() {\n }\n setFilters.prototype = Expr.filters = Expr.pseudos;\n Expr.setFilters = new setFilters();\n tokenize = Sizzle.tokenize = function (selector, parseOnly) {\n var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + ' '];\n if (cached) {\n return parseOnly ? 0 : cached.slice(0);\n }\n soFar = selector;\n groups = [];\n preFilters = Expr.preFilter;\n while (soFar) {\n if (!matched || (match = rcomma.exec(soFar))) {\n if (match) {\n soFar = soFar.slice(match[0].length) || soFar;\n }\n groups.push(tokens = []);\n }\n matched = false;\n if (match = rcombinators.exec(soFar)) {\n matched = match.shift();\n tokens.push({\n value: matched,\n type: match[0].replace(rtrim, ' ')\n });\n soFar = soFar.slice(matched.length);\n }\n for (type in Expr.filter) {\n if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {\n matched = match.shift();\n tokens.push({\n value: matched,\n type: type,\n matches: match\n });\n soFar = soFar.slice(matched.length);\n }\n }\n if (!matched) {\n break;\n }\n }\n return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0);\n };\n function toSelector(tokens) {\n var i = 0, len = tokens.length, selector = '';\n for (; i < len; i++) {\n selector += tokens[i].value;\n }\n return selector;\n }\n function addCombinator(matcher, combinator, base) {\n var dir = combinator.dir, checkNonElements = base && dir === 'parentNode', doneName = done++;\n return combinator.first ? function (elem, context, xml) {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n return matcher(elem, context, xml);\n }\n }\n } : function (elem, context, xml) {\n var oldCache, outerCache, newCache = [\n dirruns,\n doneName\n ];\n if (xml) {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n if (matcher(elem, context, xml)) {\n return true;\n }\n }\n }\n } else {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n outerCache = elem[expando] || (elem[expando] = {});\n if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {\n return newCache[2] = oldCache[2];\n } else {\n outerCache[dir] = newCache;\n if (newCache[2] = matcher(elem, context, xml)) {\n return true;\n }\n }\n }\n }\n }\n };\n }\n function elementMatcher(matchers) {\n return matchers.length > 1 ? function (elem, context, xml) {\n var i = matchers.length;\n while (i--) {\n if (!matchers[i](elem, context, xml)) {\n return false;\n }\n }\n return true;\n } : matchers[0];\n }\n function multipleContexts(selector, contexts, results) {\n var i = 0, len = contexts.length;\n for (; i < len; i++) {\n Sizzle(selector, contexts[i], results);\n }\n return results;\n }\n function condense(unmatched, map, filter, context, xml) {\n var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null;\n for (; i < len; i++) {\n if (elem = unmatched[i]) {\n if (!filter || filter(elem, context, xml)) {\n newUnmatched.push(elem);\n if (mapped) {\n map.push(i);\n }\n }\n }\n }\n return newUnmatched;\n }\n function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {\n if (postFilter && !postFilter[expando]) {\n postFilter = setMatcher(postFilter);\n }\n if (postFinder && !postFinder[expando]) {\n postFinder = setMatcher(postFinder, postSelector);\n }\n return markFunction(function (seed, results, context, xml) {\n var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || '*', context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;\n if (matcher) {\n matcher(matcherIn, matcherOut, context, xml);\n }\n if (postFilter) {\n temp = condense(matcherOut, postMap);\n postFilter(temp, [], context, xml);\n i = temp.length;\n while (i--) {\n if (elem = temp[i]) {\n matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);\n }\n }\n }\n if (seed) {\n if (postFinder || preFilter) {\n if (postFinder) {\n temp = [];\n i = matcherOut.length;\n while (i--) {\n if (elem = matcherOut[i]) {\n temp.push(matcherIn[i] = elem);\n }\n }\n postFinder(null, matcherOut = [], temp, xml);\n }\n i = matcherOut.length;\n while (i--) {\n if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf$1.call(seed, elem) : preMap[i]) > -1) {\n seed[temp] = !(results[temp] = elem);\n }\n }\n }\n } else {\n matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);\n if (postFinder) {\n postFinder(null, results, matcherOut, xml);\n } else {\n push.apply(results, matcherOut);\n }\n }\n });\n }\n function matcherFromTokens(tokens) {\n var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[' '], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function (elem) {\n return elem === checkContext;\n }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) {\n return indexOf$1.call(checkContext, elem) > -1;\n }, implicitRelative, true), matchers = [function (elem, context, xml) {\n return !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));\n }];\n for (; i < len; i++) {\n if (matcher = Expr.relative[tokens[i].type]) {\n matchers = [addCombinator(elementMatcher(matchers), matcher)];\n } else {\n matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);\n if (matcher[expando]) {\n j = ++i;\n for (; j < len; j++) {\n if (Expr.relative[tokens[j].type]) {\n break;\n }\n }\n return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === ' ' ? '*' : '' })).replace(rtrim, '$1'), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));\n }\n matchers.push(matcher);\n }\n }\n return elementMatcher(matchers);\n }\n function matcherFromGroupMatchers(elementMatchers, setMatchers) {\n var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, outermost) {\n var elem, j, matcher, matchedCount = 0, i = '0', unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG('*', outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length;\n if (outermost) {\n outermostContext = context !== document && context;\n }\n for (; i !== len && (elem = elems[i]) != null; i++) {\n if (byElement && elem) {\n j = 0;\n while (matcher = elementMatchers[j++]) {\n if (matcher(elem, context, xml)) {\n results.push(elem);\n break;\n }\n }\n if (outermost) {\n dirruns = dirrunsUnique;\n }\n }\n if (bySet) {\n if (elem = !matcher && elem) {\n matchedCount--;\n }\n if (seed) {\n unmatched.push(elem);\n }\n }\n }\n matchedCount += i;\n if (bySet && i !== matchedCount) {\n j = 0;\n while (matcher = setMatchers[j++]) {\n matcher(unmatched, setMatched, context, xml);\n }\n if (seed) {\n if (matchedCount > 0) {\n while (i--) {\n if (!(unmatched[i] || setMatched[i])) {\n setMatched[i] = pop.call(results);\n }\n }\n }\n setMatched = condense(setMatched);\n }\n push.apply(results, setMatched);\n if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {\n Sizzle.uniqueSort(results);\n }\n }\n if (outermost) {\n dirruns = dirrunsUnique;\n outermostContext = contextBackup;\n }\n return unmatched;\n };\n return bySet ? markFunction(superMatcher) : superMatcher;\n }\n compile = Sizzle.compile = function (selector, match) {\n var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + ' '];\n if (!cached) {\n if (!match) {\n match = tokenize(selector);\n }\n i = match.length;\n while (i--) {\n cached = matcherFromTokens(match[i]);\n if (cached[expando]) {\n setMatchers.push(cached);\n } else {\n elementMatchers.push(cached);\n }\n }\n cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));\n cached.selector = selector;\n }\n return cached;\n };\n select = Sizzle.select = function (selector, context, results, seed) {\n var i, tokens, token, type, find, compiled = typeof selector === 'function' && selector, match = !seed && tokenize(selector = compiled.selector || selector);\n results = results || [];\n if (match.length === 1) {\n tokens = match[0] = match[0].slice(0);\n if (tokens.length > 2 && (token = tokens[0]).type === 'ID' && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {\n context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0];\n if (!context) {\n return results;\n } else if (compiled) {\n context = context.parentNode;\n }\n selector = selector.slice(tokens.shift().value.length);\n }\n i = matchExpr.needsContext.test(selector) ? 0 : tokens.length;\n while (i--) {\n token = tokens[i];\n if (Expr.relative[type = token.type]) {\n break;\n }\n if (find = Expr.find[type]) {\n if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {\n tokens.splice(i, 1);\n selector = seed.length && toSelector(tokens);\n if (!selector) {\n push.apply(results, seed);\n return results;\n }\n break;\n }\n }\n }\n }\n (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context);\n return results;\n };\n support.sortStable = expando.split('').sort(sortOrder).join('') === expando;\n support.detectDuplicates = !!hasDuplicate;\n setDocument();\n support.sortDetached = true;\n\n var isArray$1 = Array.isArray;\n var toArray = function (obj) {\n var array = obj, i, l;\n if (!isArray$1(obj)) {\n array = [];\n for (i = 0, l = obj.length; i < l; i++) {\n array[i] = obj[i];\n }\n }\n return array;\n };\n var each$1 = function (o, cb, s) {\n var n, l;\n if (!o) {\n return 0;\n }\n s = s || o;\n if (o.length !== undefined) {\n for (n = 0, l = o.length; n < l; n++) {\n if (cb.call(s, o[n], n, o) === false) {\n return 0;\n }\n }\n } else {\n for (n in o) {\n if (o.hasOwnProperty(n)) {\n if (cb.call(s, o[n], n, o) === false) {\n return 0;\n }\n }\n }\n }\n return 1;\n };\n var map$1 = function (array, callback) {\n var out = [];\n each$1(array, function (item, index) {\n out.push(callback(item, index, array));\n });\n return out;\n };\n var filter$1 = function (a, f) {\n var o = [];\n each$1(a, function (v, index) {\n if (!f || f(v, index, a)) {\n o.push(v);\n }\n });\n return o;\n };\n var indexOf$2 = function (a, v) {\n var i, l;\n if (a) {\n for (i = 0, l = a.length; i < l; i++) {\n if (a[i] === v) {\n return i;\n }\n }\n }\n return -1;\n };\n var reduce = function (collection, iteratee, accumulator, thisArg) {\n var i = 0;\n if (arguments.length < 3) {\n accumulator = collection[0];\n }\n for (; i < collection.length; i++) {\n accumulator = iteratee.call(thisArg, accumulator, collection[i], i);\n }\n return accumulator;\n };\n var findIndex$1 = function (array, predicate, thisArg) {\n var i, l;\n for (i = 0, l = array.length; i < l; i++) {\n if (predicate.call(thisArg, array[i], i, array)) {\n return i;\n }\n }\n return -1;\n };\n var find$1 = function (array, predicate, thisArg) {\n var idx = findIndex$1(array, predicate, thisArg);\n if (idx !== -1) {\n return array[idx];\n }\n return undefined;\n };\n var last$1 = function (collection) {\n return collection[collection.length - 1];\n };\n var ArrUtils = {\n isArray: isArray$1,\n toArray: toArray,\n each: each$1,\n map: map$1,\n filter: filter$1,\n indexOf: indexOf$2,\n reduce: reduce,\n findIndex: findIndex$1,\n find: find$1,\n last: last$1\n };\n\n var whiteSpaceRegExp = /^\\s*|\\s*$/g;\n var trim = function (str) {\n return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp, '');\n };\n var is = function (obj, type) {\n if (!type) {\n return obj !== undefined;\n }\n if (type === 'array' && ArrUtils.isArray(obj)) {\n return true;\n }\n return typeof obj === type;\n };\n var makeMap = function (items, delim, map) {\n var i;\n items = items || [];\n delim = delim || ',';\n if (typeof items === 'string') {\n items = items.split(delim);\n }\n map = map || {};\n i = items.length;\n while (i--) {\n map[items[i]] = {};\n }\n return map;\n };\n var hasOwnProperty = function (obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n };\n var create = function (s, p, root) {\n var self = this;\n var sp, ns, cn, scn, c, de = 0;\n s = /^((static) )?([\\w.]+)(:([\\w.]+))?/.exec(s);\n cn = s[3].match(/(^|\\.)(\\w+)$/i)[2];\n ns = self.createNS(s[3].replace(/\\.\\w+$/, ''), root);\n if (ns[cn]) {\n return;\n }\n if (s[2] === 'static') {\n ns[cn] = p;\n if (this.onCreate) {\n this.onCreate(s[2], s[3], ns[cn]);\n }\n return;\n }\n if (!p[cn]) {\n p[cn] = function () {\n };\n de = 1;\n }\n ns[cn] = p[cn];\n self.extend(ns[cn].prototype, p);\n if (s[5]) {\n sp = self.resolve(s[5]).prototype;\n scn = s[5].match(/\\.(\\w+)$/i)[1];\n c = ns[cn];\n if (de) {\n ns[cn] = function () {\n return sp[scn].apply(this, arguments);\n };\n } else {\n ns[cn] = function () {\n this.parent = sp[scn];\n return c.apply(this, arguments);\n };\n }\n ns[cn].prototype[cn] = ns[cn];\n self.each(sp, function (f, n) {\n ns[cn].prototype[n] = sp[n];\n });\n self.each(p, function (f, n) {\n if (sp[n]) {\n ns[cn].prototype[n] = function () {\n this.parent = sp[n];\n return f.apply(this, arguments);\n };\n } else {\n if (n !== cn) {\n ns[cn].prototype[n] = f;\n }\n }\n });\n }\n self.each(p.static, function (f, n) {\n ns[cn][n] = f;\n });\n };\n var extend = function (obj, ext) {\n var x = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n x[_i - 2] = arguments[_i];\n }\n var i, l, name;\n var args = arguments;\n var value;\n for (i = 1, l = args.length; i < l; i++) {\n ext = args[i];\n for (name in ext) {\n if (ext.hasOwnProperty(name)) {\n value = ext[name];\n if (value !== undefined) {\n obj[name] = value;\n }\n }\n }\n }\n return obj;\n };\n var walk = function (o, f, n, s) {\n s = s || this;\n if (o) {\n if (n) {\n o = o[n];\n }\n ArrUtils.each(o, function (o, i) {\n if (f.call(s, o, i, n) === false) {\n return false;\n }\n walk(o, f, n, s);\n });\n }\n };\n var createNS = function (n, o) {\n var i, v;\n o = o || domGlobals.window;\n n = n.split('.');\n for (i = 0; i < n.length; i++) {\n v = n[i];\n if (!o[v]) {\n o[v] = {};\n }\n o = o[v];\n }\n return o;\n };\n var resolve$1 = function (n, o) {\n var i, l;\n o = o || domGlobals.window;\n n = n.split('.');\n for (i = 0, l = n.length; i < l; i++) {\n o = o[n[i]];\n if (!o) {\n break;\n }\n }\n return o;\n };\n var explode = function (s, d) {\n if (!s || is(s, 'array')) {\n return s;\n }\n return ArrUtils.map(s.split(d || ','), trim);\n };\n var _addCacheSuffix = function (url) {\n var cacheSuffix = Env.cacheSuffix;\n if (cacheSuffix) {\n url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix;\n }\n return url;\n };\n var Tools = {\n trim: trim,\n isArray: ArrUtils.isArray,\n is: is,\n toArray: ArrUtils.toArray,\n makeMap: makeMap,\n each: ArrUtils.each,\n map: ArrUtils.map,\n grep: ArrUtils.filter,\n inArray: ArrUtils.indexOf,\n hasOwn: hasOwnProperty,\n extend: extend,\n create: create,\n walk: walk,\n createNS: createNS,\n resolve: resolve$1,\n explode: explode,\n _addCacheSuffix: _addCacheSuffix\n };\n\n var doc = domGlobals.document, push$1 = Array.prototype.push, slice$1 = Array.prototype.slice;\n var rquickExpr$1 = /^(?:[^#<]*(<[\\w\\W]+>)[^>]*$|#([\\w\\-]*)$)/;\n var Event = EventUtils.Event;\n var skipUniques = Tools.makeMap('children,contents,next,prev');\n var isDefined = function (obj) {\n return typeof obj !== 'undefined';\n };\n var isString$1 = function (obj) {\n return typeof obj === 'string';\n };\n var isWindow = function (obj) {\n return obj && obj === obj.window;\n };\n var createFragment = function (html, fragDoc) {\n var frag, node, container;\n fragDoc = fragDoc || doc;\n container = fragDoc.createElement('div');\n frag = fragDoc.createDocumentFragment();\n container.innerHTML = html;\n while (node = container.firstChild) {\n frag.appendChild(node);\n }\n return frag;\n };\n var domManipulate = function (targetNodes, sourceItem, callback, reverse) {\n var i;\n if (isString$1(sourceItem)) {\n sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0]));\n } else if (sourceItem.length && !sourceItem.nodeType) {\n sourceItem = DomQuery.makeArray(sourceItem);\n if (reverse) {\n for (i = sourceItem.length - 1; i >= 0; i--) {\n domManipulate(targetNodes, sourceItem[i], callback, reverse);\n }\n } else {\n for (i = 0; i < sourceItem.length; i++) {\n domManipulate(targetNodes, sourceItem[i], callback, reverse);\n }\n }\n return targetNodes;\n }\n if (sourceItem.nodeType) {\n i = targetNodes.length;\n while (i--) {\n callback.call(targetNodes[i], sourceItem);\n }\n }\n return targetNodes;\n };\n var hasClass = function (node, className) {\n return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1;\n };\n var wrap = function (elements, wrapper, all) {\n var lastParent, newWrapper;\n wrapper = DomQuery(wrapper)[0];\n elements.each(function () {\n var self = this;\n if (!all || lastParent !== self.parentNode) {\n lastParent = self.parentNode;\n newWrapper = wrapper.cloneNode(false);\n self.parentNode.insertBefore(newWrapper, self);\n newWrapper.appendChild(self);\n } else {\n newWrapper.appendChild(self);\n }\n });\n return elements;\n };\n var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' ');\n var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' ');\n var propFix = {\n for: 'htmlFor',\n class: 'className',\n readonly: 'readOnly'\n };\n var cssFix = { float: 'cssFloat' };\n var attrHooks = {}, cssHooks = {};\n var DomQuery = function (selector, context) {\n return new DomQuery.fn.init(selector, context);\n };\n var inArray = function (item, array) {\n var i;\n if (array.indexOf) {\n return array.indexOf(item);\n }\n i = array.length;\n while (i--) {\n if (array[i] === item) {\n return i;\n }\n }\n return -1;\n };\n var whiteSpaceRegExp$1 = /^\\s*|\\s*$/g;\n var trim$1 = function (str) {\n return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp$1, '');\n };\n var each$2 = function (obj, callback) {\n var length, key, i, value;\n if (obj) {\n length = obj.length;\n if (length === undefined) {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n value = obj[key];\n if (callback.call(value, key, value) === false) {\n break;\n }\n }\n }\n } else {\n for (i = 0; i < length; i++) {\n value = obj[i];\n if (callback.call(value, i, value) === false) {\n break;\n }\n }\n }\n }\n return obj;\n };\n var grep = function (array, callback) {\n var out = [];\n each$2(array, function (i, item) {\n if (callback(item, i)) {\n out.push(item);\n }\n });\n return out;\n };\n var getElementDocument = function (element) {\n if (!element) {\n return doc;\n }\n if (element.nodeType === 9) {\n return element;\n }\n return element.ownerDocument;\n };\n DomQuery.fn = DomQuery.prototype = {\n constructor: DomQuery,\n selector: '',\n context: null,\n length: 0,\n init: function (selector, context) {\n var self = this;\n var match, node;\n if (!selector) {\n return self;\n }\n if (selector.nodeType) {\n self.context = self[0] = selector;\n self.length = 1;\n return self;\n }\n if (context && context.nodeType) {\n self.context = context;\n } else {\n if (context) {\n return DomQuery(selector).attr(context);\n }\n self.context = context = domGlobals.document;\n }\n if (isString$1(selector)) {\n self.selector = selector;\n if (selector.charAt(0) === '<' && selector.charAt(selector.length - 1) === '>' && selector.length >= 3) {\n match = [\n null,\n selector,\n null\n ];\n } else {\n match = rquickExpr$1.exec(selector);\n }\n if (match) {\n if (match[1]) {\n node = createFragment(selector, getElementDocument(context)).firstChild;\n while (node) {\n push$1.call(self, node);\n node = node.nextSibling;\n }\n } else {\n node = getElementDocument(context).getElementById(match[2]);\n if (!node) {\n return self;\n }\n if (node.id !== match[2]) {\n return self.find(selector);\n }\n self.length = 1;\n self[0] = node;\n }\n } else {\n return DomQuery(context).find(selector);\n }\n } else {\n this.add(selector, false);\n }\n return self;\n },\n toArray: function () {\n return Tools.toArray(this);\n },\n add: function (items, sort) {\n var self = this;\n var nodes, i;\n if (isString$1(items)) {\n return self.add(DomQuery(items));\n }\n if (sort !== false) {\n nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items)));\n self.length = nodes.length;\n for (i = 0; i < nodes.length; i++) {\n self[i] = nodes[i];\n }\n } else {\n push$1.apply(self, DomQuery.makeArray(items));\n }\n return self;\n },\n attr: function (name, value) {\n var self = this;\n var hook;\n if (typeof name === 'object') {\n each$2(name, function (name, value) {\n self.attr(name, value);\n });\n } else if (isDefined(value)) {\n this.each(function () {\n var hook;\n if (this.nodeType === 1) {\n hook = attrHooks[name];\n if (hook && hook.set) {\n hook.set(this, value);\n return;\n }\n if (value === null) {\n this.removeAttribute(name, 2);\n } else {\n this.setAttribute(name, value, 2);\n }\n }\n });\n } else {\n if (self[0] && self[0].nodeType === 1) {\n hook = attrHooks[name];\n if (hook && hook.get) {\n return hook.get(self[0], name);\n }\n if (booleanMap[name]) {\n return self.prop(name) ? name : undefined;\n }\n value = self[0].getAttribute(name, 2);\n if (value === null) {\n value = undefined;\n }\n }\n return value;\n }\n return self;\n },\n removeAttr: function (name) {\n return this.attr(name, null);\n },\n prop: function (name, value) {\n var self = this;\n name = propFix[name] || name;\n if (typeof name === 'object') {\n each$2(name, function (name, value) {\n self.prop(name, value);\n });\n } else if (isDefined(value)) {\n this.each(function () {\n if (this.nodeType === 1) {\n this[name] = value;\n }\n });\n } else {\n if (self[0] && self[0].nodeType && name in self[0]) {\n return self[0][name];\n }\n return value;\n }\n return self;\n },\n css: function (name, value) {\n var self = this;\n var elm, hook;\n var camel = function (name) {\n return name.replace(/-(\\D)/g, function (a, b) {\n return b.toUpperCase();\n });\n };\n var dashed = function (name) {\n return name.replace(/[A-Z]/g, function (a) {\n return '-' + a;\n });\n };\n if (typeof name === 'object') {\n each$2(name, function (name, value) {\n self.css(name, value);\n });\n } else {\n if (isDefined(value)) {\n name = camel(name);\n if (typeof value === 'number' && !numericCssMap[name]) {\n value = value.toString() + 'px';\n }\n self.each(function () {\n var style = this.style;\n hook = cssHooks[name];\n if (hook && hook.set) {\n hook.set(this, value);\n return;\n }\n try {\n this.style[cssFix[name] || name] = value;\n } catch (ex) {\n }\n if (value === null || value === '') {\n if (style.removeProperty) {\n style.removeProperty(dashed(name));\n } else {\n style.removeAttribute(name);\n }\n }\n });\n } else {\n elm = self[0];\n hook = cssHooks[name];\n if (hook && hook.get) {\n return hook.get(elm);\n }\n if (elm.ownerDocument.defaultView) {\n try {\n return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name));\n } catch (ex) {\n return undefined;\n }\n } else if (elm.currentStyle) {\n return elm.currentStyle[camel(name)];\n } else {\n return '';\n }\n }\n }\n return self;\n },\n remove: function () {\n var self = this;\n var node, i = this.length;\n while (i--) {\n node = self[i];\n Event.clean(node);\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n }\n return this;\n },\n empty: function () {\n var self = this;\n var node, i = this.length;\n while (i--) {\n node = self[i];\n while (node.firstChild) {\n node.removeChild(node.firstChild);\n }\n }\n return this;\n },\n html: function (value) {\n var self = this;\n var i;\n if (isDefined(value)) {\n i = self.length;\n try {\n while (i--) {\n self[i].innerHTML = value;\n }\n } catch (ex) {\n DomQuery(self[i]).empty().append(value);\n }\n return self;\n }\n return self[0] ? self[0].innerHTML : '';\n },\n text: function (value) {\n var self = this;\n var i;\n if (isDefined(value)) {\n i = self.length;\n while (i--) {\n if ('innerText' in self[i]) {\n self[i].innerText = value;\n } else {\n self[0].textContent = value;\n }\n }\n return self;\n }\n return self[0] ? self[0].innerText || self[0].textContent : '';\n },\n append: function () {\n return domManipulate(this, arguments, function (node) {\n if (this.nodeType === 1 || this.host && this.host.nodeType === 1) {\n this.appendChild(node);\n }\n });\n },\n prepend: function () {\n return domManipulate(this, arguments, function (node) {\n if (this.nodeType === 1 || this.host && this.host.nodeType === 1) {\n this.insertBefore(node, this.firstChild);\n }\n }, true);\n },\n before: function () {\n var self = this;\n if (self[0] && self[0].parentNode) {\n return domManipulate(self, arguments, function (node) {\n this.parentNode.insertBefore(node, this);\n });\n }\n return self;\n },\n after: function () {\n var self = this;\n if (self[0] && self[0].parentNode) {\n return domManipulate(self, arguments, function (node) {\n this.parentNode.insertBefore(node, this.nextSibling);\n }, true);\n }\n return self;\n },\n appendTo: function (val) {\n DomQuery(val).append(this);\n return this;\n },\n prependTo: function (val) {\n DomQuery(val).prepend(this);\n return this;\n },\n replaceWith: function (content) {\n return this.before(content).remove();\n },\n wrap: function (content) {\n return wrap(this, content);\n },\n wrapAll: function (content) {\n return wrap(this, content, true);\n },\n wrapInner: function (content) {\n this.each(function () {\n DomQuery(this).contents().wrapAll(content);\n });\n return this;\n },\n unwrap: function () {\n return this.parent().each(function () {\n DomQuery(this).replaceWith(this.childNodes);\n });\n },\n clone: function () {\n var result = [];\n this.each(function () {\n result.push(this.cloneNode(true));\n });\n return DomQuery(result);\n },\n addClass: function (className) {\n return this.toggleClass(className, true);\n },\n removeClass: function (className) {\n return this.toggleClass(className, false);\n },\n toggleClass: function (className, state) {\n var self = this;\n if (typeof className !== 'string') {\n return self;\n }\n if (className.indexOf(' ') !== -1) {\n each$2(className.split(' '), function () {\n self.toggleClass(this, state);\n });\n } else {\n self.each(function (index, node) {\n var existingClassName, classState;\n classState = hasClass(node, className);\n if (classState !== state) {\n existingClassName = node.className;\n if (classState) {\n node.className = trim$1((' ' + existingClassName + ' ').replace(' ' + className + ' ', ' '));\n } else {\n node.className += existingClassName ? ' ' + className : className;\n }\n }\n });\n }\n return self;\n },\n hasClass: function (className) {\n return hasClass(this[0], className);\n },\n each: function (callback) {\n return each$2(this, callback);\n },\n on: function (name, callback) {\n return this.each(function () {\n Event.bind(this, name, callback);\n });\n },\n off: function (name, callback) {\n return this.each(function () {\n Event.unbind(this, name, callback);\n });\n },\n trigger: function (name) {\n return this.each(function () {\n if (typeof name === 'object') {\n Event.fire(this, name.type, name);\n } else {\n Event.fire(this, name);\n }\n });\n },\n show: function () {\n return this.css('display', '');\n },\n hide: function () {\n return this.css('display', 'none');\n },\n slice: function () {\n return new DomQuery(slice$1.apply(this, arguments));\n },\n eq: function (index) {\n return index === -1 ? this.slice(index) : this.slice(index, +index + 1);\n },\n first: function () {\n return this.eq(0);\n },\n last: function () {\n return this.eq(-1);\n },\n find: function (selector) {\n var i, l;\n var ret = [];\n for (i = 0, l = this.length; i < l; i++) {\n DomQuery.find(selector, this[i], ret);\n }\n return DomQuery(ret);\n },\n filter: function (selector) {\n if (typeof selector === 'function') {\n return DomQuery(grep(this.toArray(), function (item, i) {\n return selector(i, item);\n }));\n }\n return DomQuery(DomQuery.filter(selector, this.toArray()));\n },\n closest: function (selector) {\n var result = [];\n if (selector instanceof DomQuery) {\n selector = selector[0];\n }\n this.each(function (i, node) {\n while (node) {\n if (typeof selector === 'string' && DomQuery(node).is(selector)) {\n result.push(node);\n break;\n } else if (node === selector) {\n result.push(node);\n break;\n }\n node = node.parentNode;\n }\n });\n return DomQuery(result);\n },\n offset: function (offset) {\n var elm, doc, docElm;\n var x = 0, y = 0, pos;\n if (!offset) {\n elm = this[0];\n if (elm) {\n doc = elm.ownerDocument;\n docElm = doc.documentElement;\n if (elm.getBoundingClientRect) {\n pos = elm.getBoundingClientRect();\n x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft;\n y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop;\n }\n }\n return {\n left: x,\n top: y\n };\n }\n return this.css(offset);\n },\n push: push$1,\n sort: [].sort,\n splice: [].splice\n };\n Tools.extend(DomQuery, {\n extend: Tools.extend,\n makeArray: function (object) {\n if (isWindow(object) || object.nodeType) {\n return [object];\n }\n return Tools.toArray(object);\n },\n inArray: inArray,\n isArray: Tools.isArray,\n each: each$2,\n trim: trim$1,\n grep: grep,\n find: Sizzle,\n expr: Sizzle.selectors,\n unique: Sizzle.uniqueSort,\n text: Sizzle.getText,\n contains: Sizzle.contains,\n filter: function (expr, elems, not) {\n var i = elems.length;\n if (not) {\n expr = ':not(' + expr + ')';\n }\n while (i--) {\n if (elems[i].nodeType !== 1) {\n elems.splice(i, 1);\n }\n }\n if (elems.length === 1) {\n elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [];\n } else {\n elems = DomQuery.find.matches(expr, elems);\n }\n return elems;\n }\n });\n var dir = function (el, prop, until) {\n var matched = [];\n var cur = el[prop];\n if (typeof until !== 'string' && until instanceof DomQuery) {\n until = until[0];\n }\n while (cur && cur.nodeType !== 9) {\n if (until !== undefined) {\n if (cur === until) {\n break;\n }\n if (typeof until === 'string' && DomQuery(cur).is(until)) {\n break;\n }\n }\n if (cur.nodeType === 1) {\n matched.push(cur);\n }\n cur = cur[prop];\n }\n return matched;\n };\n var sibling = function (node, siblingName, nodeType, until) {\n var result = [];\n if (until instanceof DomQuery) {\n until = until[0];\n }\n for (; node; node = node[siblingName]) {\n if (nodeType && node.nodeType !== nodeType) {\n continue;\n }\n if (until !== undefined) {\n if (node === until) {\n break;\n }\n if (typeof until === 'string' && DomQuery(node).is(until)) {\n break;\n }\n }\n result.push(node);\n }\n return result;\n };\n var firstSibling = function (node, siblingName, nodeType) {\n for (node = node[siblingName]; node; node = node[siblingName]) {\n if (node.nodeType === nodeType) {\n return node;\n }\n }\n return null;\n };\n each$2({\n parent: function (node) {\n var parent = node.parentNode;\n return parent && parent.nodeType !== 11 ? parent : null;\n },\n parents: function (node) {\n return dir(node, 'parentNode');\n },\n next: function (node) {\n return firstSibling(node, 'nextSibling', 1);\n },\n prev: function (node) {\n return firstSibling(node, 'previousSibling', 1);\n },\n children: function (node) {\n return sibling(node.firstChild, 'nextSibling', 1);\n },\n contents: function (node) {\n return Tools.toArray((node.nodeName === 'iframe' ? node.contentDocument || node.contentWindow.document : node).childNodes);\n }\n }, function (name, fn) {\n DomQuery.fn[name] = function (selector) {\n var self = this;\n var result = [];\n self.each(function () {\n var nodes = fn.call(result, this, selector, result);\n if (nodes) {\n if (DomQuery.isArray(nodes)) {\n result.push.apply(result, nodes);\n } else {\n result.push(nodes);\n }\n }\n });\n if (this.length > 1) {\n if (!skipUniques[name]) {\n result = DomQuery.unique(result);\n }\n if (name.indexOf('parents') === 0) {\n result = result.reverse();\n }\n }\n result = DomQuery(result);\n if (selector) {\n return result.filter(selector);\n }\n return result;\n };\n });\n each$2({\n parentsUntil: function (node, until) {\n return dir(node, 'parentNode', until);\n },\n nextUntil: function (node, until) {\n return sibling(node, 'nextSibling', 1, until).slice(1);\n },\n prevUntil: function (node, until) {\n return sibling(node, 'previousSibling', 1, until).slice(1);\n }\n }, function (name, fn) {\n DomQuery.fn[name] = function (selector, filter) {\n var self = this;\n var result = [];\n self.each(function () {\n var nodes = fn.call(result, this, selector, result);\n if (nodes) {\n if (DomQuery.isArray(nodes)) {\n result.push.apply(result, nodes);\n } else {\n result.push(nodes);\n }\n }\n });\n if (this.length > 1) {\n result = DomQuery.unique(result);\n if (name.indexOf('parents') === 0 || name === 'prevUntil') {\n result = result.reverse();\n }\n }\n result = DomQuery(result);\n if (filter) {\n return result.filter(filter);\n }\n return result;\n };\n });\n DomQuery.fn.is = function (selector) {\n return !!selector && this.filter(selector).length > 0;\n };\n DomQuery.fn.init.prototype = DomQuery.fn;\n DomQuery.overrideDefaults = function (callback) {\n var defaults;\n var sub = function (selector, context) {\n defaults = defaults || callback();\n if (arguments.length === 0) {\n selector = defaults.element;\n }\n if (!context) {\n context = defaults.context;\n }\n return new sub.fn.init(selector, context);\n };\n DomQuery.extend(sub, this);\n return sub;\n };\n var appendHooks = function (targetHooks, prop, hooks) {\n each$2(hooks, function (name, func) {\n targetHooks[name] = targetHooks[name] || {};\n targetHooks[name][prop] = func;\n });\n };\n if (Env.ie && Env.ie < 8) {\n appendHooks(attrHooks, 'get', {\n maxlength: function (elm) {\n var value = elm.maxLength;\n if (value === 2147483647) {\n return undefined;\n }\n return value;\n },\n size: function (elm) {\n var value = elm.size;\n if (value === 20) {\n return undefined;\n }\n return value;\n },\n class: function (elm) {\n return elm.className;\n },\n style: function (elm) {\n var value = elm.style.cssText;\n if (value.length === 0) {\n return undefined;\n }\n return value;\n }\n });\n appendHooks(attrHooks, 'set', {\n class: function (elm, value) {\n elm.className = value;\n },\n style: function (elm, value) {\n elm.style.cssText = value;\n }\n });\n }\n if (Env.ie && Env.ie < 9) {\n cssFix.float = 'styleFloat';\n appendHooks(cssHooks, 'set', {\n opacity: function (elm, value) {\n var style = elm.style;\n if (value === null || value === '') {\n style.removeAttribute('filter');\n } else {\n style.zoom = 1;\n style.filter = 'alpha(opacity=' + value * 100 + ')';\n }\n }\n });\n }\n DomQuery.attrHooks = attrHooks;\n DomQuery.cssHooks = cssHooks;\n\n var cached = function (f) {\n var called = false;\n var r;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (!called) {\n called = true;\n r = f.apply(null, args);\n }\n return r;\n };\n };\n\n var firstMatch = function (regexes, s) {\n for (var i = 0; i < regexes.length; i++) {\n var x = regexes[i];\n if (x.test(s)) {\n return x;\n }\n }\n return undefined;\n };\n var find$2 = function (regexes, agent) {\n var r = firstMatch(regexes, agent);\n if (!r) {\n return {\n major: 0,\n minor: 0\n };\n }\n var group = function (i) {\n return Number(agent.replace(r, '$' + i));\n };\n return nu(group(1), group(2));\n };\n var detect = function (versionRegexes, agent) {\n var cleanedAgent = String(agent).toLowerCase();\n if (versionRegexes.length === 0) {\n return unknown();\n }\n return find$2(versionRegexes, cleanedAgent);\n };\n var unknown = function () {\n return nu(0, 0);\n };\n var nu = function (major, minor) {\n return {\n major: major,\n minor: minor\n };\n };\n var Version = {\n nu: nu,\n detect: detect,\n unknown: unknown\n };\n\n var edge = 'Edge';\n var chrome = 'Chrome';\n var ie$1 = 'IE';\n var opera$1 = 'Opera';\n var firefox = 'Firefox';\n var safari = 'Safari';\n var isBrowser = function (name, current) {\n return function () {\n return current === name;\n };\n };\n var unknown$1 = function () {\n return nu$1({\n current: undefined,\n version: Version.unknown()\n });\n };\n var nu$1 = function (info) {\n var current = info.current;\n var version = info.version;\n return {\n current: current,\n version: version,\n isEdge: isBrowser(edge, current),\n isChrome: isBrowser(chrome, current),\n isIE: isBrowser(ie$1, current),\n isOpera: isBrowser(opera$1, current),\n isFirefox: isBrowser(firefox, current),\n isSafari: isBrowser(safari, current)\n };\n };\n var Browser = {\n unknown: unknown$1,\n nu: nu$1,\n edge: constant(edge),\n chrome: constant(chrome),\n ie: constant(ie$1),\n opera: constant(opera$1),\n firefox: constant(firefox),\n safari: constant(safari)\n };\n\n var windows = 'Windows';\n var ios = 'iOS';\n var android$1 = 'Android';\n var linux = 'Linux';\n var osx = 'OSX';\n var solaris = 'Solaris';\n var freebsd = 'FreeBSD';\n var isOS = function (name, current) {\n return function () {\n return current === name;\n };\n };\n var unknown$2 = function () {\n return nu$2({\n current: undefined,\n version: Version.unknown()\n });\n };\n var nu$2 = function (info) {\n var current = info.current;\n var version = info.version;\n return {\n current: current,\n version: version,\n isWindows: isOS(windows, current),\n isiOS: isOS(ios, current),\n isAndroid: isOS(android$1, current),\n isOSX: isOS(osx, current),\n isLinux: isOS(linux, current),\n isSolaris: isOS(solaris, current),\n isFreeBSD: isOS(freebsd, current)\n };\n };\n var OperatingSystem = {\n unknown: unknown$2,\n nu: nu$2,\n windows: constant(windows),\n ios: constant(ios),\n android: constant(android$1),\n linux: constant(linux),\n osx: constant(osx),\n solaris: constant(solaris),\n freebsd: constant(freebsd)\n };\n\n var DeviceType = function (os, browser, userAgent) {\n var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;\n var isiPhone = os.isiOS() && !isiPad;\n var isAndroid3 = os.isAndroid() && os.version.major === 3;\n var isAndroid4 = os.isAndroid() && os.version.major === 4;\n var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;\n var isTouch = os.isiOS() || os.isAndroid();\n var isPhone = isTouch && !isTablet;\n var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;\n return {\n isiPad: constant(isiPad),\n isiPhone: constant(isiPhone),\n isTablet: constant(isTablet),\n isPhone: constant(isPhone),\n isTouch: constant(isTouch),\n isAndroid: os.isAndroid,\n isiOS: os.isiOS,\n isWebView: constant(iOSwebview)\n };\n };\n\n var detect$1 = function (candidates, userAgent) {\n var agent = String(userAgent).toLowerCase();\n return find(candidates, function (candidate) {\n return candidate.search(agent);\n });\n };\n var detectBrowser = function (browsers, userAgent) {\n return detect$1(browsers, userAgent).map(function (browser) {\n var version = Version.detect(browser.versionRegexes, userAgent);\n return {\n current: browser.name,\n version: version\n };\n });\n };\n var detectOs = function (oses, userAgent) {\n return detect$1(oses, userAgent).map(function (os) {\n var version = Version.detect(os.versionRegexes, userAgent);\n return {\n current: os.name,\n version: version\n };\n });\n };\n var UaString = {\n detectBrowser: detectBrowser,\n detectOs: detectOs\n };\n\n var contains$2 = function (str, substr) {\n return str.indexOf(substr) !== -1;\n };\n var trim$2 = function (str) {\n return str.replace(/^\\s+|\\s+$/g, '');\n };\n var lTrim = function (str) {\n return str.replace(/^\\s+/g, '');\n };\n var rTrim = function (str) {\n return str.replace(/\\s+$/g, '');\n };\n\n var normalVersionRegex = /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/;\n var checkContains = function (target) {\n return function (uastring) {\n return contains$2(uastring, target);\n };\n };\n var browsers = [\n {\n name: 'Edge',\n versionRegexes: [/.*?edge\\/ ?([0-9]+)\\.([0-9]+)$/],\n search: function (uastring) {\n return contains$2(uastring, 'edge/') && contains$2(uastring, 'chrome') && contains$2(uastring, 'safari') && contains$2(uastring, 'applewebkit');\n }\n },\n {\n name: 'Chrome',\n versionRegexes: [\n /.*?chrome\\/([0-9]+)\\.([0-9]+).*/,\n normalVersionRegex\n ],\n search: function (uastring) {\n return contains$2(uastring, 'chrome') && !contains$2(uastring, 'chromeframe');\n }\n },\n {\n name: 'IE',\n versionRegexes: [\n /.*?msie\\ ?([0-9]+)\\.([0-9]+).*/,\n /.*?rv:([0-9]+)\\.([0-9]+).*/\n ],\n search: function (uastring) {\n return contains$2(uastring, 'msie') || contains$2(uastring, 'trident');\n }\n },\n {\n name: 'Opera',\n versionRegexes: [\n normalVersionRegex,\n /.*?opera\\/([0-9]+)\\.([0-9]+).*/\n ],\n search: checkContains('opera')\n },\n {\n name: 'Firefox',\n versionRegexes: [/.*?firefox\\/\\ ?([0-9]+)\\.([0-9]+).*/],\n search: checkContains('firefox')\n },\n {\n name: 'Safari',\n versionRegexes: [\n normalVersionRegex,\n /.*?cpu os ([0-9]+)_([0-9]+).*/\n ],\n search: function (uastring) {\n return (contains$2(uastring, 'safari') || contains$2(uastring, 'mobile/')) && contains$2(uastring, 'applewebkit');\n }\n }\n ];\n var oses = [\n {\n name: 'Windows',\n search: checkContains('win'),\n versionRegexes: [/.*?windows\\ nt\\ ?([0-9]+)\\.([0-9]+).*/]\n },\n {\n name: 'iOS',\n search: function (uastring) {\n return contains$2(uastring, 'iphone') || contains$2(uastring, 'ipad');\n },\n versionRegexes: [\n /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/,\n /.*cpu os ([0-9]+)_([0-9]+).*/,\n /.*cpu iphone os ([0-9]+)_([0-9]+).*/\n ]\n },\n {\n name: 'Android',\n search: checkContains('android'),\n versionRegexes: [/.*?android\\ ?([0-9]+)\\.([0-9]+).*/]\n },\n {\n name: 'OSX',\n search: checkContains('os x'),\n versionRegexes: [/.*?os\\ x\\ ?([0-9]+)_([0-9]+).*/]\n },\n {\n name: 'Linux',\n search: checkContains('linux'),\n versionRegexes: []\n },\n {\n name: 'Solaris',\n search: checkContains('sunos'),\n versionRegexes: []\n },\n {\n name: 'FreeBSD',\n search: checkContains('freebsd'),\n versionRegexes: []\n }\n ];\n var PlatformInfo = {\n browsers: constant(browsers),\n oses: constant(oses)\n };\n\n var detect$2 = function (userAgent) {\n var browsers = PlatformInfo.browsers();\n var oses = PlatformInfo.oses();\n var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu);\n var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);\n var deviceType = DeviceType(os, browser, userAgent);\n return {\n browser: browser,\n os: os,\n deviceType: deviceType\n };\n };\n var PlatformDetection = { detect: detect$2 };\n\n var detect$3 = cached(function () {\n var userAgent = domGlobals.navigator.userAgent;\n return PlatformDetection.detect(userAgent);\n });\n var PlatformDetection$1 = { detect: detect$3 };\n\n var fromHtml = function (html, scope) {\n var doc = scope || domGlobals.document;\n var div = doc.createElement('div');\n div.innerHTML = html;\n if (!div.hasChildNodes() || div.childNodes.length > 1) {\n domGlobals.console.error('HTML does not have a single root node', html);\n throw new Error('HTML must have a single root node');\n }\n return fromDom(div.childNodes[0]);\n };\n var fromTag = function (tag, scope) {\n var doc = scope || domGlobals.document;\n var node = doc.createElement(tag);\n return fromDom(node);\n };\n var fromText = function (text, scope) {\n var doc = scope || domGlobals.document;\n var node = doc.createTextNode(text);\n return fromDom(node);\n };\n var fromDom = function (node) {\n if (node === null || node === undefined) {\n throw new Error('Node cannot be null or undefined');\n }\n return { dom: constant(node) };\n };\n var fromPoint = function (docElm, x, y) {\n var doc = docElm.dom();\n return Option.from(doc.elementFromPoint(x, y)).map(fromDom);\n };\n var Element = {\n fromHtml: fromHtml,\n fromTag: fromTag,\n fromText: fromText,\n fromDom: fromDom,\n fromPoint: fromPoint\n };\n\n var ATTRIBUTE = domGlobals.Node.ATTRIBUTE_NODE;\n var CDATA_SECTION = domGlobals.Node.CDATA_SECTION_NODE;\n var COMMENT = domGlobals.Node.COMMENT_NODE;\n var DOCUMENT = domGlobals.Node.DOCUMENT_NODE;\n var DOCUMENT_TYPE = domGlobals.Node.DOCUMENT_TYPE_NODE;\n var DOCUMENT_FRAGMENT = domGlobals.Node.DOCUMENT_FRAGMENT_NODE;\n var ELEMENT = domGlobals.Node.ELEMENT_NODE;\n var TEXT = domGlobals.Node.TEXT_NODE;\n var PROCESSING_INSTRUCTION = domGlobals.Node.PROCESSING_INSTRUCTION_NODE;\n var ENTITY_REFERENCE = domGlobals.Node.ENTITY_REFERENCE_NODE;\n var ENTITY = domGlobals.Node.ENTITY_NODE;\n var NOTATION = domGlobals.Node.NOTATION_NODE;\n\n var name = function (element) {\n var r = element.dom().nodeName;\n return r.toLowerCase();\n };\n var type = function (element) {\n return element.dom().nodeType;\n };\n var isType$1 = function (t) {\n return function (element) {\n return type(element) === t;\n };\n };\n var isElement = isType$1(ELEMENT);\n var isText = isType$1(TEXT);\n\n var keys = Object.keys;\n var hasOwnProperty$1 = Object.hasOwnProperty;\n var each$3 = function (obj, f) {\n var props = keys(obj);\n for (var k = 0, len = props.length; k < len; k++) {\n var i = props[k];\n var x = obj[i];\n f(x, i);\n }\n };\n var map$2 = function (obj, f) {\n return tupleMap(obj, function (x, i) {\n return {\n k: i,\n v: f(x, i)\n };\n });\n };\n var tupleMap = function (obj, f) {\n var r = {};\n each$3(obj, function (x, i) {\n var tuple = f(x, i);\n r[tuple.k] = tuple.v;\n });\n return r;\n };\n var bifilter = function (obj, pred) {\n var t = {};\n var f = {};\n each$3(obj, function (x, i) {\n var branch = pred(x, i) ? t : f;\n branch[i] = x;\n });\n return {\n t: t,\n f: f\n };\n };\n var has = function (obj, key) {\n return hasOwnProperty$1.call(obj, key);\n };\n\n var isSupported = function (dom) {\n return dom.style !== undefined && isFunction(dom.style.getPropertyValue);\n };\n\n var inBody = function (element) {\n var dom = isText(element) ? element.dom().parentNode : element.dom();\n return dom !== undefined && dom !== null && dom.ownerDocument.body.contains(dom);\n };\n\n var rawSet = function (dom, key, value) {\n if (isString(value) || isBoolean(value) || isNumber(value)) {\n dom.setAttribute(key, value + '');\n } else {\n domGlobals.console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value, ':: Element ', dom);\n throw new Error('Attribute value was not simple');\n }\n };\n var set = function (element, key, value) {\n rawSet(element.dom(), key, value);\n };\n var setAll = function (element, attrs) {\n var dom = element.dom();\n each$3(attrs, function (v, k) {\n rawSet(dom, k, v);\n });\n };\n var get = function (element, key) {\n var v = element.dom().getAttribute(key);\n return v === null ? undefined : v;\n };\n var has$1 = function (element, key) {\n var dom = element.dom();\n return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;\n };\n var remove = function (element, key) {\n element.dom().removeAttribute(key);\n };\n\n var internalSet = function (dom, property, value) {\n if (!isString(value)) {\n domGlobals.console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);\n throw new Error('CSS value must be a string: ' + value);\n }\n if (isSupported(dom)) {\n dom.style.setProperty(property, value);\n }\n };\n var setAll$1 = function (element, css) {\n var dom = element.dom();\n each$3(css, function (v, k) {\n internalSet(dom, k, v);\n });\n };\n var get$1 = function (element, property) {\n var dom = element.dom();\n var styles = domGlobals.window.getComputedStyle(dom);\n var r = styles.getPropertyValue(property);\n var v = r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;\n return v === null ? undefined : v;\n };\n var getUnsafeProperty = function (dom, property) {\n return isSupported(dom) ? dom.style.getPropertyValue(property) : '';\n };\n var getRaw = function (element, property) {\n var dom = element.dom();\n var raw = getUnsafeProperty(dom, property);\n return Option.from(raw).filter(function (r) {\n return r.length > 0;\n });\n };\n var getAllRaw = function (element) {\n var css = {};\n var dom = element.dom();\n if (isSupported(dom)) {\n for (var i = 0; i < dom.style.length; i++) {\n var ruleName = dom.style.item(i);\n css[ruleName] = dom.style[ruleName];\n }\n }\n return css;\n };\n\n var Immutable = function () {\n var fields = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fields[_i] = arguments[_i];\n }\n return function () {\n var values = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n values[_i] = arguments[_i];\n }\n if (fields.length !== values.length) {\n throw new Error('Wrong number of arguments to struct. Expected \"[' + fields.length + ']\", got ' + values.length + ' arguments');\n }\n var struct = {};\n each(fields, function (name, i) {\n struct[name] = constant(values[i]);\n });\n return struct;\n };\n };\n\n var toArray$1 = function (target, f) {\n var r = [];\n var recurse = function (e) {\n r.push(e);\n return f(e);\n };\n var cur = f(target);\n do {\n cur = cur.bind(recurse);\n } while (cur.isSome());\n return r;\n };\n var Recurse = { toArray: toArray$1 };\n\n var node = function () {\n var f = Global$1.getOrDie('Node');\n return f;\n };\n var compareDocumentPosition = function (a, b, match) {\n return (a.compareDocumentPosition(b) & match) !== 0;\n };\n var documentPositionPreceding = function (a, b) {\n return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);\n };\n var documentPositionContainedBy = function (a, b) {\n return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);\n };\n var Node = {\n documentPositionPreceding: documentPositionPreceding,\n documentPositionContainedBy: documentPositionContainedBy\n };\n\n var ELEMENT$1 = ELEMENT;\n var DOCUMENT$1 = DOCUMENT;\n var is$1 = function (element, selector) {\n var dom = element.dom();\n if (dom.nodeType !== ELEMENT$1) {\n return false;\n } else {\n var elem = dom;\n if (elem.matches !== undefined) {\n return elem.matches(selector);\n } else if (elem.msMatchesSelector !== undefined) {\n return elem.msMatchesSelector(selector);\n } else if (elem.webkitMatchesSelector !== undefined) {\n return elem.webkitMatchesSelector(selector);\n } else if (elem.mozMatchesSelector !== undefined) {\n return elem.mozMatchesSelector(selector);\n } else {\n throw new Error('Browser lacks native selectors');\n }\n }\n };\n var bypassSelector = function (dom) {\n return dom.nodeType !== ELEMENT$1 && dom.nodeType !== DOCUMENT$1 || dom.childElementCount === 0;\n };\n var all = function (selector, scope) {\n var base = scope === undefined ? domGlobals.document : scope.dom();\n return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), Element.fromDom);\n };\n var one = function (selector, scope) {\n var base = scope === undefined ? domGlobals.document : scope.dom();\n return bypassSelector(base) ? Option.none() : Option.from(base.querySelector(selector)).map(Element.fromDom);\n };\n\n var eq = function (e1, e2) {\n return e1.dom() === e2.dom();\n };\n var regularContains = function (e1, e2) {\n var d1 = e1.dom();\n var d2 = e2.dom();\n return d1 === d2 ? false : d1.contains(d2);\n };\n var ieContains = function (e1, e2) {\n return Node.documentPositionContainedBy(e1.dom(), e2.dom());\n };\n var browser = PlatformDetection$1.detect().browser;\n var contains$3 = browser.isIE() ? ieContains : regularContains;\n\n var owner = function (element) {\n return Element.fromDom(element.dom().ownerDocument);\n };\n var documentElement = function (element) {\n return Element.fromDom(element.dom().ownerDocument.documentElement);\n };\n var defaultView = function (element) {\n return Element.fromDom(element.dom().ownerDocument.defaultView);\n };\n var parent = function (element) {\n return Option.from(element.dom().parentNode).map(Element.fromDom);\n };\n var parents = function (element, isRoot) {\n var stop = isFunction(isRoot) ? isRoot : never;\n var dom = element.dom();\n var ret = [];\n while (dom.parentNode !== null && dom.parentNode !== undefined) {\n var rawParent = dom.parentNode;\n var p = Element.fromDom(rawParent);\n ret.push(p);\n if (stop(p) === true) {\n break;\n } else {\n dom = rawParent;\n }\n }\n return ret;\n };\n var prevSibling = function (element) {\n return Option.from(element.dom().previousSibling).map(Element.fromDom);\n };\n var nextSibling = function (element) {\n return Option.from(element.dom().nextSibling).map(Element.fromDom);\n };\n var prevSiblings = function (element) {\n return reverse(Recurse.toArray(element, prevSibling));\n };\n var nextSiblings = function (element) {\n return Recurse.toArray(element, nextSibling);\n };\n var children = function (element) {\n return map(element.dom().childNodes, Element.fromDom);\n };\n var child = function (element, index) {\n var cs = element.dom().childNodes;\n return Option.from(cs[index]).map(Element.fromDom);\n };\n var firstChild = function (element) {\n return child(element, 0);\n };\n var lastChild = function (element) {\n return child(element, element.dom().childNodes.length - 1);\n };\n var childNodesCount = function (element) {\n return element.dom().childNodes.length;\n };\n var spot = Immutable('element', 'offset');\n\n var browser$1 = PlatformDetection$1.detect().browser;\n var firstElement = function (nodes) {\n return find(nodes, isElement);\n };\n var getTableCaptionDeltaY = function (elm) {\n if (browser$1.isFirefox() && name(elm) === 'table') {\n return firstElement(children(elm)).filter(function (elm) {\n return name(elm) === 'caption';\n }).bind(function (caption) {\n return firstElement(nextSiblings(caption)).map(function (body) {\n var bodyTop = body.dom().offsetTop;\n var captionTop = caption.dom().offsetTop;\n var captionHeight = caption.dom().offsetHeight;\n return bodyTop <= captionTop ? -captionHeight : 0;\n });\n }).getOr(0);\n } else {\n return 0;\n }\n };\n var getPos = function (body, elm, rootElm) {\n var x = 0, y = 0, offsetParent;\n var doc = body.ownerDocument;\n var pos;\n rootElm = rootElm ? rootElm : body;\n if (elm) {\n if (rootElm === body && elm.getBoundingClientRect && get$1(Element.fromDom(body), 'position') === 'static') {\n pos = elm.getBoundingClientRect();\n x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - doc.documentElement.clientLeft;\n y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - doc.documentElement.clientTop;\n return {\n x: x,\n y: y\n };\n }\n offsetParent = elm;\n while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType) {\n x += offsetParent.offsetLeft || 0;\n y += offsetParent.offsetTop || 0;\n offsetParent = offsetParent.offsetParent;\n }\n offsetParent = elm.parentNode;\n while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType) {\n x -= offsetParent.scrollLeft || 0;\n y -= offsetParent.scrollTop || 0;\n offsetParent = offsetParent.parentNode;\n }\n y += getTableCaptionDeltaY(Element.fromDom(elm));\n }\n return {\n x: x,\n y: y\n };\n };\n var Position = { getPos: getPos };\n\n var exports$1 = {}, module$1 = { exports: exports$1 };\n (function (define, exports, module, require) {\n (function (f) {\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n module.exports = f();\n } else if (typeof define === 'function' && define.amd) {\n define([], f);\n } else {\n var g;\n if (typeof window !== 'undefined') {\n g = window;\n } else if (typeof global !== 'undefined') {\n g = global;\n } else if (typeof self !== 'undefined') {\n g = self;\n } else {\n g = this;\n }\n g.EphoxContactWrapper = f();\n }\n }(function () {\n return function () {\n function r(e, n, t) {\n function o(i, f) {\n if (!n[i]) {\n if (!e[i]) {\n var c = 'function' == typeof require && require;\n if (!f && c)\n return c(i, !0);\n if (u)\n return u(i, !0);\n var a = new Error('Cannot find module \\'' + i + '\\'');\n throw a.code = 'MODULE_NOT_FOUND', a;\n }\n var p = n[i] = { exports: {} };\n e[i][0].call(p.exports, function (r) {\n var n = e[i][1][r];\n return o(n || r);\n }, p, p.exports, r, e, n, t);\n }\n return n[i].exports;\n }\n for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++)\n o(t[i]);\n return o;\n }\n return r;\n }()({\n 1: [\n function (require, module, exports) {\n var process = module.exports = {};\n var cachedSetTimeout;\n var cachedClearTimeout;\n function defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n }\n function defaultClearTimeout() {\n throw new Error('clearTimeout has not been defined');\n }\n (function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n }());\n function runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n return setTimeout(fun, 0);\n }\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n return cachedSetTimeout(fun, 0);\n } catch (e) {\n try {\n return cachedSetTimeout.call(null, fun, 0);\n } catch (e) {\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n }\n function runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n return clearTimeout(marker);\n }\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n return cachedClearTimeout(marker);\n } catch (e) {\n try {\n return cachedClearTimeout.call(null, marker);\n } catch (e) {\n return cachedClearTimeout.call(this, marker);\n }\n }\n }\n var queue = [];\n var draining = false;\n var currentQueue;\n var queueIndex = -1;\n function cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n }\n function drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n var len = queue.length;\n while (len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n }\n process.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n };\n function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n }\n Item.prototype.run = function () {\n this.fun.apply(null, this.array);\n };\n process.title = 'browser';\n process.browser = true;\n process.env = {};\n process.argv = [];\n process.version = '';\n process.versions = {};\n function noop() {\n }\n process.on = noop;\n process.addListener = noop;\n process.once = noop;\n process.off = noop;\n process.removeListener = noop;\n process.removeAllListeners = noop;\n process.emit = noop;\n process.prependListener = noop;\n process.prependOnceListener = noop;\n process.listeners = function (name) {\n return [];\n };\n process.binding = function (name) {\n throw new Error('process.binding is not supported');\n };\n process.cwd = function () {\n return '/';\n };\n process.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n };\n process.umask = function () {\n return 0;\n };\n },\n {}\n ],\n 2: [\n function (require, module, exports) {\n (function (setImmediate) {\n (function (root) {\n var setTimeoutFunc = setTimeout;\n function noop() {\n }\n function bind(fn, thisArg) {\n return function () {\n fn.apply(thisArg, arguments);\n };\n }\n function Promise(fn) {\n if (typeof this !== 'object')\n throw new TypeError('Promises must be constructed via new');\n if (typeof fn !== 'function')\n throw new TypeError('not a function');\n this._state = 0;\n this._handled = false;\n this._value = undefined;\n this._deferreds = [];\n doResolve(fn, this);\n }\n function handle(self, deferred) {\n while (self._state === 3) {\n self = self._value;\n }\n if (self._state === 0) {\n self._deferreds.push(deferred);\n return;\n }\n self._handled = true;\n Promise._immediateFn(function () {\n var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n return;\n }\n var ret;\n try {\n ret = cb(self._value);\n } catch (e) {\n reject(deferred.promise, e);\n return;\n }\n resolve(deferred.promise, ret);\n });\n }\n function resolve(self, newValue) {\n try {\n if (newValue === self)\n throw new TypeError('A promise cannot be resolved with itself.');\n if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {\n var then = newValue.then;\n if (newValue instanceof Promise) {\n self._state = 3;\n self._value = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(bind(then, newValue), self);\n return;\n }\n }\n self._state = 1;\n self._value = newValue;\n finale(self);\n } catch (e) {\n reject(self, e);\n }\n }\n function reject(self, newValue) {\n self._state = 2;\n self._value = newValue;\n finale(self);\n }\n function finale(self) {\n if (self._state === 2 && self._deferreds.length === 0) {\n Promise._immediateFn(function () {\n if (!self._handled) {\n Promise._unhandledRejectionFn(self._value);\n }\n });\n }\n for (var i = 0, len = self._deferreds.length; i < len; i++) {\n handle(self, self._deferreds[i]);\n }\n self._deferreds = null;\n }\n function Handler(onFulfilled, onRejected, promise) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n }\n function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done)\n return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done)\n return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done)\n return;\n done = true;\n reject(self, ex);\n }\n }\n Promise.prototype['catch'] = function (onRejected) {\n return this.then(null, onRejected);\n };\n Promise.prototype.then = function (onFulfilled, onRejected) {\n var prom = new this.constructor(noop);\n handle(this, new Handler(onFulfilled, onRejected, prom));\n return prom;\n };\n Promise.all = function (arr) {\n var args = Array.prototype.slice.call(arr);\n return new Promise(function (resolve, reject) {\n if (args.length === 0)\n return resolve([]);\n var remaining = args.length;\n function res(i, val) {\n try {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n var then = val.then;\n if (typeof then === 'function') {\n then.call(val, function (val) {\n res(i, val);\n }, reject);\n return;\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n } catch (ex) {\n reject(ex);\n }\n }\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n };\n Promise.resolve = function (value) {\n if (value && typeof value === 'object' && value.constructor === Promise) {\n return value;\n }\n return new Promise(function (resolve) {\n resolve(value);\n });\n };\n Promise.reject = function (value) {\n return new Promise(function (resolve, reject) {\n reject(value);\n });\n };\n Promise.race = function (values) {\n return new Promise(function (resolve, reject) {\n for (var i = 0, len = values.length; i < len; i++) {\n values[i].then(resolve, reject);\n }\n });\n };\n Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) {\n setImmediate(fn);\n } : function (fn) {\n setTimeoutFunc(fn, 0);\n };\n Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n if (typeof console !== 'undefined' && console) {\n console.warn('Possible Unhandled Promise Rejection:', err);\n }\n };\n Promise._setImmediateFn = function _setImmediateFn(fn) {\n Promise._immediateFn = fn;\n };\n Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {\n Promise._unhandledRejectionFn = fn;\n };\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Promise;\n } else if (!root.Promise) {\n root.Promise = Promise;\n }\n }(this));\n }.call(this, require('timers').setImmediate));\n },\n { 'timers': 3 }\n ],\n 3: [\n function (require, module, exports) {\n (function (setImmediate, clearImmediate) {\n var nextTick = require('process/browser.js').nextTick;\n var apply = Function.prototype.apply;\n var slice = Array.prototype.slice;\n var immediateIds = {};\n var nextImmediateId = 0;\n exports.setTimeout = function () {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n };\n exports.setInterval = function () {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n };\n exports.clearTimeout = exports.clearInterval = function (timeout) {\n timeout.close();\n };\n function Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n }\n Timeout.prototype.unref = Timeout.prototype.ref = function () {\n };\n Timeout.prototype.close = function () {\n this._clearFn.call(window, this._id);\n };\n exports.enroll = function (item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n };\n exports.unenroll = function (item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n };\n exports._unrefActive = exports.active = function (item) {\n clearTimeout(item._idleTimeoutId);\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n };\n exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) {\n var id = nextImmediateId++;\n var args = arguments.length < 2 ? false : slice.call(arguments, 1);\n immediateIds[id] = true;\n nextTick(function onNextTick() {\n if (immediateIds[id]) {\n if (args) {\n fn.apply(null, args);\n } else {\n fn.call(null);\n }\n exports.clearImmediate(id);\n }\n });\n return id;\n };\n exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) {\n delete immediateIds[id];\n };\n }.call(this, require('timers').setImmediate, require('timers').clearImmediate));\n },\n {\n 'process/browser.js': 1,\n 'timers': 3\n }\n ],\n 4: [\n function (require, module, exports) {\n var promisePolyfill = require('promise-polyfill');\n var Global = function () {\n if (typeof window !== 'undefined') {\n return window;\n } else {\n return Function('return this;')();\n }\n }();\n module.exports = { boltExport: Global.Promise || promisePolyfill };\n },\n { 'promise-polyfill': 2 }\n ]\n }, {}, [4])(4);\n }));\n }(undefined, exports$1, module$1, undefined));\n var Promise = module$1.exports.boltExport;\n\n var nu$3 = function (baseFn) {\n var data = Option.none();\n var callbacks = [];\n var map = function (f) {\n return nu$3(function (nCallback) {\n get(function (data) {\n nCallback(f(data));\n });\n });\n };\n var get = function (nCallback) {\n if (isReady()) {\n call(nCallback);\n } else {\n callbacks.push(nCallback);\n }\n };\n var set = function (x) {\n data = Option.some(x);\n run(callbacks);\n callbacks = [];\n };\n var isReady = function () {\n return data.isSome();\n };\n var run = function (cbs) {\n each(cbs, call);\n };\n var call = function (cb) {\n data.each(function (x) {\n domGlobals.setTimeout(function () {\n cb(x);\n }, 0);\n });\n };\n baseFn(set);\n return {\n get: get,\n map: map,\n isReady: isReady\n };\n };\n var pure = function (a) {\n return nu$3(function (callback) {\n callback(a);\n });\n };\n var LazyValue = {\n nu: nu$3,\n pure: pure\n };\n\n var errorReporter = function (err) {\n domGlobals.setTimeout(function () {\n throw err;\n }, 0);\n };\n var make = function (run) {\n var get = function (callback) {\n run().then(callback, errorReporter);\n };\n var map = function (fab) {\n return make(function () {\n return run().then(fab);\n });\n };\n var bind = function (aFutureB) {\n return make(function () {\n return run().then(function (v) {\n return aFutureB(v).toPromise();\n });\n });\n };\n var anonBind = function (futureB) {\n return make(function () {\n return run().then(function () {\n return futureB.toPromise();\n });\n });\n };\n var toLazy = function () {\n return LazyValue.nu(get);\n };\n var toCached = function () {\n var cache = null;\n return make(function () {\n if (cache === null) {\n cache = run();\n }\n return cache;\n });\n };\n var toPromise = run;\n return {\n map: map,\n bind: bind,\n anonBind: anonBind,\n toLazy: toLazy,\n toCached: toCached,\n toPromise: toPromise,\n get: get\n };\n };\n var nu$4 = function (baseFn) {\n return make(function () {\n return new Promise(baseFn);\n });\n };\n var pure$1 = function (a) {\n return make(function () {\n return Promise.resolve(a);\n });\n };\n var Future = {\n nu: nu$4,\n pure: pure$1\n };\n\n var par = function (asyncValues, nu) {\n return nu(function (callback) {\n var r = [];\n var count = 0;\n var cb = function (i) {\n return function (value) {\n r[i] = value;\n count++;\n if (count >= asyncValues.length) {\n callback(r);\n }\n };\n };\n if (asyncValues.length === 0) {\n callback([]);\n } else {\n each(asyncValues, function (asyncValue, i) {\n asyncValue.get(cb(i));\n });\n }\n });\n };\n\n var par$1 = function (futures) {\n return par(futures, Future.nu);\n };\n\n var value = function (o) {\n var is = function (v) {\n return o === v;\n };\n var or = function (opt) {\n return value(o);\n };\n var orThunk = function (f) {\n return value(o);\n };\n var map = function (f) {\n return value(f(o));\n };\n var mapError = function (f) {\n return value(o);\n };\n var each = function (f) {\n f(o);\n };\n var bind = function (f) {\n return f(o);\n };\n var fold = function (_, onValue) {\n return onValue(o);\n };\n var exists = function (f) {\n return f(o);\n };\n var forall = function (f) {\n return f(o);\n };\n var toOption = function () {\n return Option.some(o);\n };\n return {\n is: is,\n isValue: always,\n isError: never,\n getOr: constant(o),\n getOrThunk: constant(o),\n getOrDie: constant(o),\n or: or,\n orThunk: orThunk,\n fold: fold,\n map: map,\n mapError: mapError,\n each: each,\n bind: bind,\n exists: exists,\n forall: forall,\n toOption: toOption\n };\n };\n var error = function (message) {\n var getOrThunk = function (f) {\n return f();\n };\n var getOrDie = function () {\n return die(String(message))();\n };\n var or = function (opt) {\n return opt;\n };\n var orThunk = function (f) {\n return f();\n };\n var map = function (f) {\n return error(message);\n };\n var mapError = function (f) {\n return error(f(message));\n };\n var bind = function (f) {\n return error(message);\n };\n var fold = function (onError, _) {\n return onError(message);\n };\n return {\n is: never,\n isValue: never,\n isError: always,\n getOr: identity,\n getOrThunk: getOrThunk,\n getOrDie: getOrDie,\n or: or,\n orThunk: orThunk,\n fold: fold,\n map: map,\n mapError: mapError,\n each: noop,\n bind: bind,\n exists: never,\n forall: always,\n toOption: Option.none\n };\n };\n var fromOption = function (opt, err) {\n return opt.fold(function () {\n return error(err);\n }, value);\n };\n var Result = {\n value: value,\n error: error,\n fromOption: fromOption\n };\n\n function StyleSheetLoader(document, settings) {\n if (settings === void 0) {\n settings = {};\n }\n var idCount = 0;\n var loadedStates = {};\n var maxLoadTime;\n maxLoadTime = settings.maxLoadTime || 5000;\n var appendToHead = function (node) {\n document.getElementsByTagName('head')[0].appendChild(node);\n };\n var load = function (url, loadedCallback, errorCallback) {\n var link, style, startTime, state;\n var passed = function () {\n var callbacks = state.passed;\n var i = callbacks.length;\n while (i--) {\n callbacks[i]();\n }\n state.status = 2;\n state.passed = [];\n state.failed = [];\n };\n var failed = function () {\n var callbacks = state.failed;\n var i = callbacks.length;\n while (i--) {\n callbacks[i]();\n }\n state.status = 3;\n state.passed = [];\n state.failed = [];\n };\n var isOldWebKit = function () {\n var webKitChunks = domGlobals.navigator.userAgent.match(/WebKit\\/(\\d*)/);\n return !!(webKitChunks && parseInt(webKitChunks[1], 10) < 536);\n };\n var wait = function (testCallback, waitCallback) {\n if (!testCallback()) {\n if (new Date().getTime() - startTime < maxLoadTime) {\n Delay.setTimeout(waitCallback);\n } else {\n failed();\n }\n }\n };\n var waitForWebKitLinkLoaded = function () {\n wait(function () {\n var styleSheets = document.styleSheets;\n var styleSheet, i = styleSheets.length, owner;\n while (i--) {\n styleSheet = styleSheets[i];\n owner = styleSheet.ownerNode ? styleSheet.ownerNode : styleSheet.owningElement;\n if (owner && owner.id === link.id) {\n passed();\n return true;\n }\n }\n }, waitForWebKitLinkLoaded);\n };\n var waitForGeckoLinkLoaded = function () {\n wait(function () {\n try {\n var cssRules = style.sheet.cssRules;\n passed();\n return !!cssRules;\n } catch (ex) {\n }\n }, waitForGeckoLinkLoaded);\n };\n url = Tools._addCacheSuffix(url);\n if (!loadedStates[url]) {\n state = {\n passed: [],\n failed: []\n };\n loadedStates[url] = state;\n } else {\n state = loadedStates[url];\n }\n if (loadedCallback) {\n state.passed.push(loadedCallback);\n }\n if (errorCallback) {\n state.failed.push(errorCallback);\n }\n if (state.status === 1) {\n return;\n }\n if (state.status === 2) {\n passed();\n return;\n }\n if (state.status === 3) {\n failed();\n return;\n }\n state.status = 1;\n link = document.createElement('link');\n link.rel = 'stylesheet';\n link.type = 'text/css';\n link.id = 'u' + idCount++;\n link.async = false;\n link.defer = false;\n startTime = new Date().getTime();\n if (settings.contentCssCors) {\n link.crossOrigin = 'anonymous';\n }\n if ('onload' in link && !isOldWebKit()) {\n link.onload = waitForWebKitLinkLoaded;\n link.onerror = failed;\n } else {\n if (domGlobals.navigator.userAgent.indexOf('Firefox') > 0) {\n style = document.createElement('style');\n style.textContent = '@import \"' + url + '\"';\n waitForGeckoLinkLoaded();\n appendToHead(style);\n return;\n }\n waitForWebKitLinkLoaded();\n }\n appendToHead(link);\n link.href = url;\n };\n var loadF = function (url) {\n return Future.nu(function (resolve) {\n load(url, compose(resolve, constant(Result.value(url))), compose(resolve, constant(Result.error(url))));\n });\n };\n var unbox = function (result) {\n return result.fold(identity, identity);\n };\n var loadAll = function (urls, success, failure) {\n par$1(map(urls, loadF)).get(function (result) {\n var parts = partition(result, function (r) {\n return r.isValue();\n });\n if (parts.fail.length > 0) {\n failure(parts.fail.map(unbox));\n } else {\n success(parts.pass.map(unbox));\n }\n });\n };\n return {\n load: load,\n loadAll: loadAll\n };\n }\n\n function TreeWalker (startNode, rootNode) {\n var node = startNode;\n var findSibling = function (node, startName, siblingName, shallow) {\n var sibling, parent;\n if (node) {\n if (!shallow && node[startName]) {\n return node[startName];\n }\n if (node !== rootNode) {\n sibling = node[siblingName];\n if (sibling) {\n return sibling;\n }\n for (parent = node.parentNode; parent && parent !== rootNode; parent = parent.parentNode) {\n sibling = parent[siblingName];\n if (sibling) {\n return sibling;\n }\n }\n }\n }\n };\n var findPreviousNode = function (node, startName, siblingName, shallow) {\n var sibling, parent, child;\n if (node) {\n sibling = node[siblingName];\n if (rootNode && sibling === rootNode) {\n return;\n }\n if (sibling) {\n if (!shallow) {\n for (child = sibling[startName]; child; child = child[startName]) {\n if (!child[startName]) {\n return child;\n }\n }\n }\n return sibling;\n }\n parent = node.parentNode;\n if (parent && parent !== rootNode) {\n return parent;\n }\n }\n };\n this.current = function () {\n return node;\n };\n this.next = function (shallow) {\n node = findSibling(node, 'firstChild', 'nextSibling', shallow);\n return node;\n };\n this.prev = function (shallow) {\n node = findSibling(node, 'lastChild', 'previousSibling', shallow);\n return node;\n };\n this.prev2 = function (shallow) {\n node = findPreviousNode(node, 'lastChild', 'previousSibling', shallow);\n return node;\n };\n }\n\n var blocks = [\n 'article',\n 'aside',\n 'details',\n 'div',\n 'dt',\n 'figcaption',\n 'footer',\n 'form',\n 'fieldset',\n 'header',\n 'hgroup',\n 'html',\n 'main',\n 'nav',\n 'section',\n 'summary',\n 'body',\n 'p',\n 'dl',\n 'multicol',\n 'dd',\n 'figure',\n 'address',\n 'center',\n 'blockquote',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'listing',\n 'xmp',\n 'pre',\n 'plaintext',\n 'menu',\n 'dir',\n 'ul',\n 'ol',\n 'li',\n 'hr',\n 'table',\n 'tbody',\n 'thead',\n 'tfoot',\n 'th',\n 'tr',\n 'td',\n 'caption'\n ];\n var voids = [\n 'area',\n 'base',\n 'basefont',\n 'br',\n 'col',\n 'frame',\n 'hr',\n 'img',\n 'input',\n 'isindex',\n 'link',\n 'meta',\n 'param',\n 'embed',\n 'source',\n 'wbr',\n 'track'\n ];\n var tableCells = [\n 'td',\n 'th'\n ];\n var tableSections = [\n 'thead',\n 'tbody',\n 'tfoot'\n ];\n var textBlocks = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'p',\n 'div',\n 'address',\n 'pre',\n 'form',\n 'blockquote',\n 'center',\n 'dir',\n 'fieldset',\n 'header',\n 'footer',\n 'article',\n 'section',\n 'hgroup',\n 'aside',\n 'nav',\n 'figure'\n ];\n var headings = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6'\n ];\n var listItems = [\n 'li',\n 'dd',\n 'dt'\n ];\n var lists = [\n 'ul',\n 'ol',\n 'dl'\n ];\n var wsElements = [\n 'pre',\n 'script',\n 'textarea',\n 'style'\n ];\n var lazyLookup = function (items) {\n var lookup;\n return function (node) {\n lookup = lookup ? lookup : mapToObject(items, constant(true));\n return lookup.hasOwnProperty(name(node));\n };\n };\n var isHeading = lazyLookup(headings);\n var isBlock = lazyLookup(blocks);\n var isInline = function (node) {\n return isElement(node) && !isBlock(node);\n };\n var isBr = function (node) {\n return isElement(node) && name(node) === 'br';\n };\n var isTextBlock = lazyLookup(textBlocks);\n var isList = lazyLookup(lists);\n var isListItem = lazyLookup(listItems);\n var isVoid = lazyLookup(voids);\n var isTableSection = lazyLookup(tableSections);\n var isTableCell = lazyLookup(tableCells);\n var isWsPreserveElement = lazyLookup(wsElements);\n\n var isNodeType = function (type) {\n return function (node) {\n return !!node && node.nodeType === type;\n };\n };\n var isRestrictedNode = function (node) {\n return !!node && !Object.getPrototypeOf(node);\n };\n var isElement$1 = isNodeType(1);\n var matchNodeNames = function (names) {\n var items = names.toLowerCase().split(' ');\n return function (node) {\n var i, name;\n if (node && node.nodeType) {\n name = node.nodeName.toLowerCase();\n for (i = 0; i < items.length; i++) {\n if (name === items[i]) {\n return true;\n }\n }\n }\n return false;\n };\n };\n var matchStyleValues = function (name, values) {\n var items = values.toLowerCase().split(' ');\n return function (node) {\n var i, cssValue;\n if (isElement$1(node)) {\n for (i = 0; i < items.length; i++) {\n var computed = node.ownerDocument.defaultView.getComputedStyle(node, null);\n cssValue = computed ? computed.getPropertyValue(name) : null;\n if (cssValue === items[i]) {\n return true;\n }\n }\n }\n return false;\n };\n };\n var hasPropValue = function (propName, propValue) {\n return function (node) {\n return isElement$1(node) && node[propName] === propValue;\n };\n };\n var hasAttribute = function (attrName, attrValue) {\n return function (node) {\n return isElement$1(node) && node.hasAttribute(attrName);\n };\n };\n var hasAttributeValue = function (attrName, attrValue) {\n return function (node) {\n return isElement$1(node) && node.getAttribute(attrName) === attrValue;\n };\n };\n var isBogus = function (node) {\n return isElement$1(node) && node.hasAttribute('data-mce-bogus');\n };\n var isBogusAll = function (node) {\n return isElement$1(node) && node.getAttribute('data-mce-bogus') === 'all';\n };\n var isTable = function (node) {\n return isElement$1(node) && node.tagName === 'TABLE';\n };\n var hasContentEditableState = function (value) {\n return function (node) {\n if (isElement$1(node)) {\n if (node.contentEditable === value) {\n return true;\n }\n if (node.getAttribute('data-mce-contenteditable') === value) {\n return true;\n }\n }\n return false;\n };\n };\n var isText$1 = isNodeType(3);\n var isComment = isNodeType(8);\n var isDocument = isNodeType(9);\n var isDocumentFragment = isNodeType(11);\n var isBr$1 = matchNodeNames('br');\n var isContentEditableTrue = hasContentEditableState('true');\n var isContentEditableFalse = hasContentEditableState('false');\n var NodeType = {\n isText: isText$1,\n isElement: isElement$1,\n isComment: isComment,\n isDocument: isDocument,\n isDocumentFragment: isDocumentFragment,\n isBr: isBr$1,\n isContentEditableTrue: isContentEditableTrue,\n isContentEditableFalse: isContentEditableFalse,\n isRestrictedNode: isRestrictedNode,\n matchNodeNames: matchNodeNames,\n hasPropValue: hasPropValue,\n hasAttribute: hasAttribute,\n hasAttributeValue: hasAttributeValue,\n matchStyleValues: matchStyleValues,\n isBogus: isBogus,\n isBogusAll: isBogusAll,\n isTable: isTable\n };\n\n var surroundedBySpans = function (node) {\n var previousIsSpan = node.previousSibling && node.previousSibling.nodeName === 'SPAN';\n var nextIsSpan = node.nextSibling && node.nextSibling.nodeName === 'SPAN';\n return previousIsSpan && nextIsSpan;\n };\n var isBookmarkNode = function (node) {\n return node && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark';\n };\n var trimNode = function (dom, node) {\n var i, children = node.childNodes;\n if (NodeType.isElement(node) && isBookmarkNode(node)) {\n return;\n }\n for (i = children.length - 1; i >= 0; i--) {\n trimNode(dom, children[i]);\n }\n if (NodeType.isDocument(node) === false) {\n if (NodeType.isText(node) && node.nodeValue.length > 0) {\n var trimmedLength = Tools.trim(node.nodeValue).length;\n if (dom.isBlock(node.parentNode) || trimmedLength > 0) {\n return;\n }\n if (trimmedLength === 0 && surroundedBySpans(node)) {\n return;\n }\n } else if (NodeType.isElement(node)) {\n children = node.childNodes;\n if (children.length === 1 && isBookmarkNode(children[0])) {\n node.parentNode.insertBefore(children[0], node);\n }\n if (children.length || isVoid(Element.fromDom(node))) {\n return;\n }\n }\n dom.remove(node);\n }\n return node;\n };\n var TrimNode = { trimNode: trimNode };\n\n var makeMap$1 = Tools.makeMap;\n var namedEntities, baseEntities, reverseEntities;\n var attrsCharsRegExp = /[&<>\\\"\\u0060\\u007E-\\uD7FF\\uE000-\\uFFEF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n var textCharsRegExp = /[<>&\\u007E-\\uD7FF\\uE000-\\uFFEF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n var rawCharsRegExp = /[<>&\\\"\\']/g;\n var entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi;\n var asciiMap = {\n 128: '\\u20AC',\n 130: '\\u201A',\n 131: '\\u0192',\n 132: '\\u201E',\n 133: '\\u2026',\n 134: '\\u2020',\n 135: '\\u2021',\n 136: '\\u02c6',\n 137: '\\u2030',\n 138: '\\u0160',\n 139: '\\u2039',\n 140: '\\u0152',\n 142: '\\u017d',\n 145: '\\u2018',\n 146: '\\u2019',\n 147: '\\u201C',\n 148: '\\u201D',\n 149: '\\u2022',\n 150: '\\u2013',\n 151: '\\u2014',\n 152: '\\u02DC',\n 153: '\\u2122',\n 154: '\\u0161',\n 155: '\\u203A',\n 156: '\\u0153',\n 158: '\\u017e',\n 159: '\\u0178'\n };\n baseEntities = {\n '\"': '"',\n '\\'': ''',\n '<': '<',\n '>': '>',\n '&': '&',\n '`': '`'\n };\n reverseEntities = {\n '<': '<',\n '>': '>',\n '&': '&',\n '"': '\"',\n ''': '\\''\n };\n var nativeDecode = function (text) {\n var elm;\n elm = Element.fromTag('div').dom();\n elm.innerHTML = text;\n return elm.textContent || elm.innerText || text;\n };\n var buildEntitiesLookup = function (items, radix) {\n var i, chr, entity;\n var lookup = {};\n if (items) {\n items = items.split(',');\n radix = radix || 10;\n for (i = 0; i < items.length; i += 2) {\n chr = String.fromCharCode(parseInt(items[i], radix));\n if (!baseEntities[chr]) {\n entity = '&' + items[i + 1] + ';';\n lookup[chr] = entity;\n lookup[entity] = chr;\n }\n }\n return lookup;\n }\n };\n namedEntities = buildEntitiesLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);\n var encodeRaw = function (text, attr) {\n return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {\n return baseEntities[chr] || chr;\n });\n };\n var encodeAllRaw = function (text) {\n return ('' + text).replace(rawCharsRegExp, function (chr) {\n return baseEntities[chr] || chr;\n });\n };\n var encodeNumeric = function (text, attr) {\n return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {\n if (chr.length > 1) {\n return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';';\n }\n return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';\n });\n };\n var encodeNamed = function (text, attr, entities) {\n entities = entities || namedEntities;\n return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {\n return baseEntities[chr] || entities[chr] || chr;\n });\n };\n var getEncodeFunc = function (name, entities) {\n var entitiesMap = buildEntitiesLookup(entities) || namedEntities;\n var encodeNamedAndNumeric = function (text, attr) {\n return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {\n if (baseEntities[chr] !== undefined) {\n return baseEntities[chr];\n }\n if (entitiesMap[chr] !== undefined) {\n return entitiesMap[chr];\n }\n if (chr.length > 1) {\n return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';';\n }\n return '&#' + chr.charCodeAt(0) + ';';\n });\n };\n var encodeCustomNamed = function (text, attr) {\n return encodeNamed(text, attr, entitiesMap);\n };\n var nameMap = makeMap$1(name.replace(/\\+/g, ','));\n if (nameMap.named && nameMap.numeric) {\n return encodeNamedAndNumeric;\n }\n if (nameMap.named) {\n if (entities) {\n return encodeCustomNamed;\n }\n return encodeNamed;\n }\n if (nameMap.numeric) {\n return encodeNumeric;\n }\n return encodeRaw;\n };\n var decode = function (text) {\n return text.replace(entityRegExp, function (all, numeric) {\n if (numeric) {\n if (numeric.charAt(0).toLowerCase() === 'x') {\n numeric = parseInt(numeric.substr(1), 16);\n } else {\n numeric = parseInt(numeric, 10);\n }\n if (numeric > 65535) {\n numeric -= 65536;\n return String.fromCharCode(55296 + (numeric >> 10), 56320 + (numeric & 1023));\n }\n return asciiMap[numeric] || String.fromCharCode(numeric);\n }\n return reverseEntities[all] || namedEntities[all] || nativeDecode(all);\n });\n };\n var Entities = {\n encodeRaw: encodeRaw,\n encodeAllRaw: encodeAllRaw,\n encodeNumeric: encodeNumeric,\n encodeNamed: encodeNamed,\n getEncodeFunc: getEncodeFunc,\n decode: decode\n };\n\n var mapCache = {}, dummyObj = {};\n var makeMap$2 = Tools.makeMap, each$4 = Tools.each, extend$1 = Tools.extend, explode$1 = Tools.explode, inArray$1 = Tools.inArray;\n var split = function (items, delim) {\n items = Tools.trim(items);\n return items ? items.split(delim || ' ') : [];\n };\n var compileSchema = function (type) {\n var schema = {};\n var globalAttributes, blockContent;\n var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent;\n var add = function (name, attributes, children) {\n var ni, attributesOrder, element;\n var arrayToMap = function (array, obj) {\n var map = {};\n var i, l;\n for (i = 0, l = array.length; i < l; i++) {\n map[array[i]] = obj || {};\n }\n return map;\n };\n children = children || [];\n attributes = attributes || '';\n if (typeof children === 'string') {\n children = split(children);\n }\n name = split(name);\n ni = name.length;\n while (ni--) {\n attributesOrder = split([\n globalAttributes,\n attributes\n ].join(' '));\n element = {\n attributes: arrayToMap(attributesOrder),\n attributesOrder: attributesOrder,\n children: arrayToMap(children, dummyObj)\n };\n schema[name[ni]] = element;\n }\n };\n var addAttrs = function (name, attributes) {\n var ni, schemaItem, i, l;\n name = split(name);\n ni = name.length;\n attributes = split(attributes);\n while (ni--) {\n schemaItem = schema[name[ni]];\n for (i = 0, l = attributes.length; i < l; i++) {\n schemaItem.attributes[attributes[i]] = {};\n schemaItem.attributesOrder.push(attributes[i]);\n }\n }\n };\n if (mapCache[type]) {\n return mapCache[type];\n }\n globalAttributes = 'id accesskey class dir lang style tabindex title role';\n blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul';\n phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment';\n if (type !== 'html4') {\n globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate';\n blockContent += ' article aside details dialog figure main header footer hgroup section nav';\n phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen';\n }\n if (type !== 'html5-strict') {\n globalAttributes += ' xml:lang';\n html4PhrasingContent = 'acronym applet basefont big font strike tt';\n phrasingContent = [\n phrasingContent,\n html4PhrasingContent\n ].join(' ');\n each$4(split(html4PhrasingContent), function (name) {\n add(name, '', phrasingContent);\n });\n html4BlockContent = 'center dir isindex noframes';\n blockContent = [\n blockContent,\n html4BlockContent\n ].join(' ');\n flowContent = [\n blockContent,\n phrasingContent\n ].join(' ');\n each$4(split(html4BlockContent), function (name) {\n add(name, '', flowContent);\n });\n }\n flowContent = flowContent || [\n blockContent,\n phrasingContent\n ].join(' ');\n add('html', 'manifest', 'head body');\n add('head', '', 'base command link meta noscript script style title');\n add('title hr noscript br');\n add('base', 'href target');\n add('link', 'href rel media hreflang type sizes hreflang');\n add('meta', 'name http-equiv content charset');\n add('style', 'media type scoped');\n add('script', 'src async defer type charset');\n add('body', 'onafterprint onbeforeprint onbeforeunload onblur onerror onfocus ' + 'onhashchange onload onmessage onoffline ononline onpagehide onpageshow ' + 'onpopstate onresize onscroll onstorage onunload', flowContent);\n add('address dt dd div caption', '', flowContent);\n add('h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn', '', phrasingContent);\n add('blockquote', 'cite', flowContent);\n add('ol', 'reversed start type', 'li');\n add('ul', '', 'li');\n add('li', 'value', flowContent);\n add('dl', '', 'dt dd');\n add('a', 'href target rel media hreflang type', phrasingContent);\n add('q', 'cite', phrasingContent);\n add('ins del', 'cite datetime', flowContent);\n add('img', 'src sizes srcset alt usemap ismap width height');\n add('iframe', 'src name width height', flowContent);\n add('embed', 'src type width height');\n add('object', 'data type typemustmatch name usemap form width height', [\n flowContent,\n 'param'\n ].join(' '));\n add('param', 'name value');\n add('map', 'name', [\n flowContent,\n 'area'\n ].join(' '));\n add('area', 'alt coords shape href target rel media hreflang type');\n add('table', 'border', 'caption colgroup thead tfoot tbody tr' + (type === 'html4' ? ' col' : ''));\n add('colgroup', 'span', 'col');\n add('col', 'span');\n add('tbody thead tfoot', '', 'tr');\n add('tr', '', 'td th');\n add('td', 'colspan rowspan headers', flowContent);\n add('th', 'colspan rowspan headers scope abbr', flowContent);\n add('form', 'accept-charset action autocomplete enctype method name novalidate target', flowContent);\n add('fieldset', 'disabled form name', [\n flowContent,\n 'legend'\n ].join(' '));\n add('label', 'form for', phrasingContent);\n add('input', 'accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate ' + 'formtarget height list max maxlength min multiple name pattern readonly required size src step type value width');\n add('button', 'disabled form formaction formenctype formmethod formnovalidate formtarget name type value', type === 'html4' ? flowContent : phrasingContent);\n add('select', 'disabled form multiple name required size', 'option optgroup');\n add('optgroup', 'disabled label', 'option');\n add('option', 'disabled label selected value');\n add('textarea', 'cols dirname disabled form maxlength name readonly required rows wrap');\n add('menu', 'type label', [\n flowContent,\n 'li'\n ].join(' '));\n add('noscript', '', flowContent);\n if (type !== 'html4') {\n add('wbr');\n add('ruby', '', [\n phrasingContent,\n 'rt rp'\n ].join(' '));\n add('figcaption', '', flowContent);\n add('mark rt rp summary bdi', '', phrasingContent);\n add('canvas', 'width height', flowContent);\n add('video', 'src crossorigin poster preload autoplay mediagroup loop ' + 'muted controls width height buffered', [\n flowContent,\n 'track source'\n ].join(' '));\n add('audio', 'src crossorigin preload autoplay mediagroup loop muted controls ' + 'buffered volume', [\n flowContent,\n 'track source'\n ].join(' '));\n add('picture', '', 'img source');\n add('source', 'src srcset type media sizes');\n add('track', 'kind src srclang label default');\n add('datalist', '', [\n phrasingContent,\n 'option'\n ].join(' '));\n add('article section nav aside main header footer', '', flowContent);\n add('hgroup', '', 'h1 h2 h3 h4 h5 h6');\n add('figure', '', [\n flowContent,\n 'figcaption'\n ].join(' '));\n add('time', 'datetime', phrasingContent);\n add('dialog', 'open', flowContent);\n add('command', 'type label icon disabled checked radiogroup command');\n add('output', 'for form name', phrasingContent);\n add('progress', 'value max', phrasingContent);\n add('meter', 'value min max low high optimum', phrasingContent);\n add('details', 'open', [\n flowContent,\n 'summary'\n ].join(' '));\n add('keygen', 'autofocus challenge disabled form keytype name');\n }\n if (type !== 'html5-strict') {\n addAttrs('script', 'language xml:space');\n addAttrs('style', 'xml:space');\n addAttrs('object', 'declare classid code codebase codetype archive standby align border hspace vspace');\n addAttrs('embed', 'align name hspace vspace');\n addAttrs('param', 'valuetype type');\n addAttrs('a', 'charset name rev shape coords');\n addAttrs('br', 'clear');\n addAttrs('applet', 'codebase archive code object alt name width height align hspace vspace');\n addAttrs('img', 'name longdesc align border hspace vspace');\n addAttrs('iframe', 'longdesc frameborder marginwidth marginheight scrolling align');\n addAttrs('font basefont', 'size color face');\n addAttrs('input', 'usemap align');\n addAttrs('select', 'onchange');\n addAttrs('textarea');\n addAttrs('h1 h2 h3 h4 h5 h6 div p legend caption', 'align');\n addAttrs('ul', 'type compact');\n addAttrs('li', 'type');\n addAttrs('ol dl menu dir', 'compact');\n addAttrs('pre', 'width xml:space');\n addAttrs('hr', 'align noshade size width');\n addAttrs('isindex', 'prompt');\n addAttrs('table', 'summary width frame rules cellspacing cellpadding align bgcolor');\n addAttrs('col', 'width align char charoff valign');\n addAttrs('colgroup', 'width align char charoff valign');\n addAttrs('thead', 'align char charoff valign');\n addAttrs('tr', 'align char charoff valign bgcolor');\n addAttrs('th', 'axis align char charoff valign nowrap bgcolor width height');\n addAttrs('form', 'accept');\n addAttrs('td', 'abbr axis scope align char charoff valign nowrap bgcolor width height');\n addAttrs('tfoot', 'align char charoff valign');\n addAttrs('tbody', 'align char charoff valign');\n addAttrs('area', 'nohref');\n addAttrs('body', 'background bgcolor text link vlink alink');\n }\n if (type !== 'html4') {\n addAttrs('input button select textarea', 'autofocus');\n addAttrs('input textarea', 'placeholder');\n addAttrs('a', 'download');\n addAttrs('link script img', 'crossorigin');\n addAttrs('iframe', 'sandbox seamless allowfullscreen');\n }\n each$4(split('a form meter progress dfn'), function (name) {\n if (schema[name]) {\n delete schema[name].children[name];\n }\n });\n delete schema.caption.children.table;\n delete schema.script;\n mapCache[type] = schema;\n return schema;\n };\n var compileElementMap = function (value, mode) {\n var styles;\n if (value) {\n styles = {};\n if (typeof value === 'string') {\n value = { '*': value };\n }\n each$4(value, function (value, key) {\n styles[key] = styles[key.toUpperCase()] = mode === 'map' ? makeMap$2(value, /[, ]/) : explode$1(value, /[, ]/);\n });\n }\n return styles;\n };\n function Schema(settings) {\n var elements = {};\n var children = {};\n var patternElements = [];\n var validStyles;\n var invalidStyles;\n var schemaItems;\n var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, validClasses;\n var blockElementsMap, nonEmptyElementsMap, moveCaretBeforeOnEnterElementsMap, textBlockElementsMap, textInlineElementsMap;\n var customElementsMap = {}, specialElements = {};\n var createLookupTable = function (option, defaultValue, extendWith) {\n var value = settings[option];\n if (!value) {\n value = mapCache[option];\n if (!value) {\n value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' '));\n value = extend$1(value, extendWith);\n mapCache[option] = value;\n }\n } else {\n value = makeMap$2(value, /[, ]/, makeMap$2(value.toUpperCase(), /[, ]/));\n }\n return value;\n };\n settings = settings || {};\n schemaItems = compileSchema(settings.schema);\n if (settings.verify_html === false) {\n settings.valid_elements = '*[*]';\n }\n validStyles = compileElementMap(settings.valid_styles);\n invalidStyles = compileElementMap(settings.invalid_styles, 'map');\n validClasses = compileElementMap(settings.valid_classes, 'map');\n whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object code');\n selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');\n shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' + 'meta param embed source wbr track');\n boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' + 'noshade nowrap readonly selected autoplay loop controls');\n nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object ' + 'script pre code', shortEndedElementsMap);\n moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', 'table', nonEmptyElementsMap);\n textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + 'blockquote center dir fieldset header footer article section hgroup aside main nav figure');\n blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + 'datalist select optgroup figcaption details summary', textBlockElementsMap);\n textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + 'dfn code mark q sup sub samp');\n each$4((settings.special || 'script noscript iframe noframes noembed title style textarea xmp').split(' '), function (name) {\n specialElements[name] = new RegExp(']*>', 'gi');\n });\n var patternToRegExp = function (str) {\n return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');\n };\n var addValidElements = function (validElements) {\n var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, prefix, outputName, globalAttributes, globalAttributesOrder, key, value;\n var elementRuleRegExp = /^([#+\\-])?([^\\[!\\/]+)(?:\\/([^\\[!]+))?(?:(!?)\\[([^\\]]+)\\])?$/, attrRuleRegExp = /^([!\\-])?(\\w+[\\\\:]:\\w+|[^=:<]+)?(?:([=:<])(.*))?$/, hasPatternsRegExp = /[*?+]/;\n if (validElements) {\n validElements = split(validElements, ',');\n if (elements['@']) {\n globalAttributes = elements['@'].attributes;\n globalAttributesOrder = elements['@'].attributesOrder;\n }\n for (ei = 0, el = validElements.length; ei < el; ei++) {\n matches = elementRuleRegExp.exec(validElements[ei]);\n if (matches) {\n prefix = matches[1];\n elementName = matches[2];\n outputName = matches[3];\n attrData = matches[5];\n attributes = {};\n attributesOrder = [];\n element = {\n attributes: attributes,\n attributesOrder: attributesOrder\n };\n if (prefix === '#') {\n element.paddEmpty = true;\n }\n if (prefix === '-') {\n element.removeEmpty = true;\n }\n if (matches[4] === '!') {\n element.removeEmptyAttrs = true;\n }\n if (globalAttributes) {\n for (key in globalAttributes) {\n attributes[key] = globalAttributes[key];\n }\n attributesOrder.push.apply(attributesOrder, globalAttributesOrder);\n }\n if (attrData) {\n attrData = split(attrData, '|');\n for (ai = 0, al = attrData.length; ai < al; ai++) {\n matches = attrRuleRegExp.exec(attrData[ai]);\n if (matches) {\n attr = {};\n attrType = matches[1];\n attrName = matches[2].replace(/[\\\\:]:/g, ':');\n prefix = matches[3];\n value = matches[4];\n if (attrType === '!') {\n element.attributesRequired = element.attributesRequired || [];\n element.attributesRequired.push(attrName);\n attr.required = true;\n }\n if (attrType === '-') {\n delete attributes[attrName];\n attributesOrder.splice(inArray$1(attributesOrder, attrName), 1);\n continue;\n }\n if (prefix) {\n if (prefix === '=') {\n element.attributesDefault = element.attributesDefault || [];\n element.attributesDefault.push({\n name: attrName,\n value: value\n });\n attr.defaultValue = value;\n }\n if (prefix === ':') {\n element.attributesForced = element.attributesForced || [];\n element.attributesForced.push({\n name: attrName,\n value: value\n });\n attr.forcedValue = value;\n }\n if (prefix === '<') {\n attr.validValues = makeMap$2(value, '?');\n }\n }\n if (hasPatternsRegExp.test(attrName)) {\n element.attributePatterns = element.attributePatterns || [];\n attr.pattern = patternToRegExp(attrName);\n element.attributePatterns.push(attr);\n } else {\n if (!attributes[attrName]) {\n attributesOrder.push(attrName);\n }\n attributes[attrName] = attr;\n }\n }\n }\n }\n if (!globalAttributes && elementName === '@') {\n globalAttributes = attributes;\n globalAttributesOrder = attributesOrder;\n }\n if (outputName) {\n element.outputName = elementName;\n elements[outputName] = element;\n }\n if (hasPatternsRegExp.test(elementName)) {\n element.pattern = patternToRegExp(elementName);\n patternElements.push(element);\n } else {\n elements[elementName] = element;\n }\n }\n }\n }\n };\n var setValidElements = function (validElements) {\n elements = {};\n patternElements = [];\n addValidElements(validElements);\n each$4(schemaItems, function (element, name) {\n children[name] = element.children;\n });\n };\n var addCustomElements = function (customElements) {\n var customElementRegExp = /^(~)?(.+)$/;\n if (customElements) {\n mapCache.text_block_elements = mapCache.block_elements = null;\n each$4(split(customElements, ','), function (rule) {\n var matches = customElementRegExp.exec(rule), inline = matches[1] === '~', cloneName = inline ? 'span' : 'div', name = matches[2];\n children[name] = children[cloneName];\n customElementsMap[name] = cloneName;\n if (!inline) {\n blockElementsMap[name.toUpperCase()] = {};\n blockElementsMap[name] = {};\n }\n if (!elements[name]) {\n var customRule = elements[cloneName];\n customRule = extend$1({}, customRule);\n delete customRule.removeEmptyAttrs;\n delete customRule.removeEmpty;\n elements[name] = customRule;\n }\n each$4(children, function (element, elmName) {\n if (element[cloneName]) {\n children[elmName] = element = extend$1({}, children[elmName]);\n element[name] = element[cloneName];\n }\n });\n });\n }\n };\n var addValidChildren = function (validChildren) {\n var childRuleRegExp = /^([+\\-]?)(\\w+)\\[([^\\]]+)\\]$/;\n mapCache[settings.schema] = null;\n if (validChildren) {\n each$4(split(validChildren, ','), function (rule) {\n var matches = childRuleRegExp.exec(rule);\n var parent, prefix;\n if (matches) {\n prefix = matches[1];\n if (prefix) {\n parent = children[matches[2]];\n } else {\n parent = children[matches[2]] = { '#comment': {} };\n }\n parent = children[matches[2]];\n each$4(split(matches[3], '|'), function (child) {\n if (prefix === '-') {\n delete parent[child];\n } else {\n parent[child] = {};\n }\n });\n }\n });\n }\n };\n var getElementRule = function (name) {\n var element = elements[name], i;\n if (element) {\n return element;\n }\n i = patternElements.length;\n while (i--) {\n element = patternElements[i];\n if (element.pattern.test(name)) {\n return element;\n }\n }\n };\n if (!settings.valid_elements) {\n each$4(schemaItems, function (element, name) {\n elements[name] = {\n attributes: element.attributes,\n attributesOrder: element.attributesOrder\n };\n children[name] = element.children;\n });\n if (settings.schema !== 'html5') {\n each$4(split('strong/b em/i'), function (item) {\n item = split(item, '/');\n elements[item[1]].outputName = item[0];\n });\n }\n each$4(split('ol ul sub sup blockquote span font a table tbody tr strong em b i'), function (name) {\n if (elements[name]) {\n elements[name].removeEmpty = true;\n }\n });\n each$4(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption li'), function (name) {\n elements[name].paddEmpty = true;\n });\n each$4(split('span'), function (name) {\n elements[name].removeEmptyAttrs = true;\n });\n } else {\n setValidElements(settings.valid_elements);\n }\n addCustomElements(settings.custom_elements);\n addValidChildren(settings.valid_children);\n addValidElements(settings.extended_valid_elements);\n addValidChildren('+ol[ul|ol],+ul[ul|ol]');\n each$4({\n dd: 'dl',\n dt: 'dl',\n li: 'ul ol',\n td: 'tr',\n th: 'tr',\n tr: 'tbody thead tfoot',\n tbody: 'table',\n thead: 'table',\n tfoot: 'table',\n legend: 'fieldset',\n area: 'map',\n param: 'video audio object'\n }, function (parents, item) {\n if (elements[item]) {\n elements[item].parentsRequired = split(parents);\n }\n });\n if (settings.invalid_elements) {\n each$4(explode$1(settings.invalid_elements), function (item) {\n if (elements[item]) {\n delete elements[item];\n }\n });\n }\n if (!getElementRule('span')) {\n addValidElements('span[!data-mce-type|*]');\n }\n var getValidStyles = function () {\n return validStyles;\n };\n var getInvalidStyles = function () {\n return invalidStyles;\n };\n var getValidClasses = function () {\n return validClasses;\n };\n var getBoolAttrs = function () {\n return boolAttrMap;\n };\n var getBlockElements = function () {\n return blockElementsMap;\n };\n var getTextBlockElements = function () {\n return textBlockElementsMap;\n };\n var getTextInlineElements = function () {\n return textInlineElementsMap;\n };\n var getShortEndedElements = function () {\n return shortEndedElementsMap;\n };\n var getSelfClosingElements = function () {\n return selfClosingElementsMap;\n };\n var getNonEmptyElements = function () {\n return nonEmptyElementsMap;\n };\n var getMoveCaretBeforeOnEnterElements = function () {\n return moveCaretBeforeOnEnterElementsMap;\n };\n var getWhiteSpaceElements = function () {\n return whiteSpaceElementsMap;\n };\n var getSpecialElements = function () {\n return specialElements;\n };\n var isValidChild = function (name, child) {\n var parent = children[name.toLowerCase()];\n return !!(parent && parent[child.toLowerCase()]);\n };\n var isValid = function (name, attr) {\n var attrPatterns, i;\n var rule = getElementRule(name);\n if (rule) {\n if (attr) {\n if (rule.attributes[attr]) {\n return true;\n }\n attrPatterns = rule.attributePatterns;\n if (attrPatterns) {\n i = attrPatterns.length;\n while (i--) {\n if (attrPatterns[i].pattern.test(name)) {\n return true;\n }\n }\n }\n } else {\n return true;\n }\n }\n return false;\n };\n var getCustomElements = function () {\n return customElementsMap;\n };\n return {\n children: children,\n elements: elements,\n getValidStyles: getValidStyles,\n getValidClasses: getValidClasses,\n getBlockElements: getBlockElements,\n getInvalidStyles: getInvalidStyles,\n getShortEndedElements: getShortEndedElements,\n getTextBlockElements: getTextBlockElements,\n getTextInlineElements: getTextInlineElements,\n getBoolAttrs: getBoolAttrs,\n getElementRule: getElementRule,\n getSelfClosingElements: getSelfClosingElements,\n getNonEmptyElements: getNonEmptyElements,\n getMoveCaretBeforeOnEnterElements: getMoveCaretBeforeOnEnterElements,\n getWhiteSpaceElements: getWhiteSpaceElements,\n getSpecialElements: getSpecialElements,\n isValidChild: isValidChild,\n isValid: isValid,\n getCustomElements: getCustomElements,\n addValidElements: addValidElements,\n setValidElements: setValidElements,\n addCustomElements: addCustomElements,\n addValidChildren: addValidChildren\n };\n }\n\n var toHex = function (match, r, g, b) {\n var hex = function (val) {\n val = parseInt(val, 10).toString(16);\n return val.length > 1 ? val : '0' + val;\n };\n return '#' + hex(r) + hex(g) + hex(b);\n };\n function Styles(settings, schema) {\n var rgbRegExp = /rgb\\s*\\(\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*\\)/gi;\n var urlOrStrRegExp = /(?:url(?:(?:\\(\\s*\\\"([^\\\"]+)\\\"\\s*\\))|(?:\\(\\s*\\'([^\\']+)\\'\\s*\\))|(?:\\(\\s*([^)\\s]+)\\s*\\))))|(?:\\'([^\\']+)\\')|(?:\\\"([^\\\"]+)\\\")/gi;\n var styleRegExp = /\\s*([^:]+):\\s*([^;]+);?/g;\n var trimRightRegExp = /\\s+$/;\n var i;\n var encodingLookup = {};\n var encodingItems;\n var validStyles;\n var invalidStyles;\n var invisibleChar = '\\uFEFF';\n settings = settings || {};\n if (schema) {\n validStyles = schema.getValidStyles();\n invalidStyles = schema.getInvalidStyles();\n }\n encodingItems = ('\\\\\" \\\\\\' \\\\; \\\\: ; : ' + invisibleChar).split(' ');\n for (i = 0; i < encodingItems.length; i++) {\n encodingLookup[encodingItems[i]] = invisibleChar + i;\n encodingLookup[invisibleChar + i] = encodingItems[i];\n }\n return {\n toHex: function (color) {\n return color.replace(rgbRegExp, toHex);\n },\n parse: function (css) {\n var styles = {};\n var matches, name, value, isEncoded;\n var urlConverter = settings.url_converter;\n var urlConverterScope = settings.url_converter_scope || this;\n var compress = function (prefix, suffix, noJoin) {\n var top, right, bottom, left;\n top = styles[prefix + '-top' + suffix];\n if (!top) {\n return;\n }\n right = styles[prefix + '-right' + suffix];\n if (!right) {\n return;\n }\n bottom = styles[prefix + '-bottom' + suffix];\n if (!bottom) {\n return;\n }\n left = styles[prefix + '-left' + suffix];\n if (!left) {\n return;\n }\n var box = [\n top,\n right,\n bottom,\n left\n ];\n i = box.length - 1;\n while (i--) {\n if (box[i] !== box[i + 1]) {\n break;\n }\n }\n if (i > -1 && noJoin) {\n return;\n }\n styles[prefix + suffix] = i === -1 ? box[0] : box.join(' ');\n delete styles[prefix + '-top' + suffix];\n delete styles[prefix + '-right' + suffix];\n delete styles[prefix + '-bottom' + suffix];\n delete styles[prefix + '-left' + suffix];\n };\n var canCompress = function (key) {\n var value = styles[key], i;\n if (!value) {\n return;\n }\n value = value.split(' ');\n i = value.length;\n while (i--) {\n if (value[i] !== value[0]) {\n return false;\n }\n }\n styles[key] = value[0];\n return true;\n };\n var compress2 = function (target, a, b, c) {\n if (!canCompress(a)) {\n return;\n }\n if (!canCompress(b)) {\n return;\n }\n if (!canCompress(c)) {\n return;\n }\n styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c];\n delete styles[a];\n delete styles[b];\n delete styles[c];\n };\n var encode = function (str) {\n isEncoded = true;\n return encodingLookup[str];\n };\n var decode = function (str, keepSlashes) {\n if (isEncoded) {\n str = str.replace(/\\uFEFF[0-9]/g, function (str) {\n return encodingLookup[str];\n });\n }\n if (!keepSlashes) {\n str = str.replace(/\\\\([\\'\\\";:])/g, '$1');\n }\n return str;\n };\n var decodeSingleHexSequence = function (escSeq) {\n return String.fromCharCode(parseInt(escSeq.slice(1), 16));\n };\n var decodeHexSequences = function (value) {\n return value.replace(/\\\\[0-9a-f]+/gi, decodeSingleHexSequence);\n };\n var processUrl = function (match, url, url2, url3, str, str2) {\n str = str || str2;\n if (str) {\n str = decode(str);\n return '\\'' + str.replace(/\\'/g, '\\\\\\'') + '\\'';\n }\n url = decode(url || url2 || url3);\n if (!settings.allow_script_urls) {\n var scriptUrl = url.replace(/[\\s\\r\\n]+/g, '');\n if (/(java|vb)script:/i.test(scriptUrl)) {\n return '';\n }\n if (!settings.allow_svg_data_urls && /^data:image\\/svg/i.test(scriptUrl)) {\n return '';\n }\n }\n if (urlConverter) {\n url = urlConverter.call(urlConverterScope, url, 'style');\n }\n return 'url(\\'' + url.replace(/\\'/g, '\\\\\\'') + '\\')';\n };\n if (css) {\n css = css.replace(/[\\u0000-\\u001F]/g, '');\n css = css.replace(/\\\\[\\\"\\';:\\uFEFF]/g, encode).replace(/\\\"[^\\\"]+\\\"|\\'[^\\']+\\'/g, function (str) {\n return str.replace(/[;:]/g, encode);\n });\n while (matches = styleRegExp.exec(css)) {\n styleRegExp.lastIndex = matches.index + matches[0].length;\n name = matches[1].replace(trimRightRegExp, '').toLowerCase();\n value = matches[2].replace(trimRightRegExp, '');\n if (name && value) {\n name = decodeHexSequences(name);\n value = decodeHexSequences(value);\n if (name.indexOf(invisibleChar) !== -1 || name.indexOf('\"') !== -1) {\n continue;\n }\n if (!settings.allow_script_urls && (name === 'behavior' || /expression\\s*\\(|\\/\\*|\\*\\//.test(value))) {\n continue;\n }\n if (name === 'font-weight' && value === '700') {\n value = 'bold';\n } else if (name === 'color' || name === 'background-color') {\n value = value.toLowerCase();\n }\n value = value.replace(rgbRegExp, toHex);\n value = value.replace(urlOrStrRegExp, processUrl);\n styles[name] = isEncoded ? decode(value, true) : value;\n }\n }\n compress('border', '', true);\n compress('border', '-width');\n compress('border', '-color');\n compress('border', '-style');\n compress('padding', '');\n compress('margin', '');\n compress2('border', 'border-width', 'border-style', 'border-color');\n if (styles.border === 'medium none') {\n delete styles.border;\n }\n if (styles['border-image'] === 'none') {\n delete styles['border-image'];\n }\n }\n return styles;\n },\n serialize: function (styles, elementName) {\n var css = '', name, value;\n var serializeStyles = function (name) {\n var styleList, i, l, value;\n styleList = validStyles[name];\n if (styleList) {\n for (i = 0, l = styleList.length; i < l; i++) {\n name = styleList[i];\n value = styles[name];\n if (value) {\n css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\n }\n }\n }\n };\n var isValid = function (name, elementName) {\n var styleMap;\n styleMap = invalidStyles['*'];\n if (styleMap && styleMap[name]) {\n return false;\n }\n styleMap = invalidStyles[elementName];\n if (styleMap && styleMap[name]) {\n return false;\n }\n return true;\n };\n if (elementName && validStyles) {\n serializeStyles('*');\n serializeStyles(elementName);\n } else {\n for (name in styles) {\n value = styles[name];\n if (value && (!invalidStyles || isValid(name, elementName))) {\n css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\n }\n }\n }\n return css;\n }\n };\n }\n\n var each$5 = Tools.each;\n var grep$1 = Tools.grep;\n var isIE = Env.ie;\n var simpleSelectorRe = /^([a-z0-9],?)+$/i;\n var whiteSpaceRegExp$2 = /^[ \\t\\r\\n]*$/;\n var setupAttrHooks = function (styles, settings, getContext) {\n var attrHooks = {};\n var keepValues = settings.keep_values;\n var keepUrlHook = {\n set: function ($elm, value, name) {\n if (settings.url_converter) {\n value = settings.url_converter.call(settings.url_converter_scope || getContext(), value, name, $elm[0]);\n }\n $elm.attr('data-mce-' + name, value).attr(name, value);\n },\n get: function ($elm, name) {\n return $elm.attr('data-mce-' + name) || $elm.attr(name);\n }\n };\n attrHooks = {\n style: {\n set: function ($elm, value) {\n if (value !== null && typeof value === 'object') {\n $elm.css(value);\n return;\n }\n if (keepValues) {\n $elm.attr('data-mce-style', value);\n }\n $elm.attr('style', value);\n },\n get: function ($elm) {\n var value = $elm.attr('data-mce-style') || $elm.attr('style');\n value = styles.serialize(styles.parse(value), $elm[0].nodeName);\n return value;\n }\n }\n };\n if (keepValues) {\n attrHooks.href = attrHooks.src = keepUrlHook;\n }\n return attrHooks;\n };\n var updateInternalStyleAttr = function (styles, $elm) {\n var rawValue = $elm.attr('style');\n var value = styles.serialize(styles.parse(rawValue), $elm[0].nodeName);\n if (!value) {\n value = null;\n }\n $elm.attr('data-mce-style', value);\n };\n var findNodeIndex = function (node, normalized) {\n var idx = 0, lastNodeType, nodeType;\n if (node) {\n for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) {\n nodeType = node.nodeType;\n if (normalized && nodeType === 3) {\n if (nodeType === lastNodeType || !node.nodeValue.length) {\n continue;\n }\n }\n idx++;\n lastNodeType = nodeType;\n }\n }\n return idx;\n };\n function DOMUtils(doc, settings) {\n var _this = this;\n if (settings === void 0) {\n settings = {};\n }\n var attrHooks;\n var addedStyles = {};\n var win = domGlobals.window;\n var files = {};\n var counter = 0;\n var stdMode = true;\n var boxModel = true;\n var styleSheetLoader = StyleSheetLoader(doc, { contentCssCors: settings.contentCssCors });\n var boundEvents = [];\n var schema = settings.schema ? settings.schema : Schema({});\n var styles = Styles({\n url_converter: settings.url_converter,\n url_converter_scope: settings.url_converter_scope\n }, settings.schema);\n var events = settings.ownEvents ? new EventUtils(settings.proxy) : EventUtils.Event;\n var blockElementsMap = schema.getBlockElements();\n var $ = DomQuery.overrideDefaults(function () {\n return {\n context: doc,\n element: self.getRoot()\n };\n });\n var isBlock = function (node) {\n if (typeof node === 'string') {\n return !!blockElementsMap[node];\n } else if (node) {\n var type = node.nodeType;\n if (type) {\n return !!(type === 1 && blockElementsMap[node.nodeName]);\n }\n }\n return false;\n };\n var get = function (elm) {\n if (elm && doc && typeof elm === 'string') {\n var node = doc.getElementById(elm);\n if (node && node.id !== elm) {\n return doc.getElementsByName(elm)[1];\n } else {\n return node;\n }\n }\n return elm;\n };\n var $$ = function (elm) {\n if (typeof elm === 'string') {\n elm = get(elm);\n }\n return $(elm);\n };\n var getAttrib = function (elm, name, defaultVal) {\n var hook, value;\n var $elm = $$(elm);\n if ($elm.length) {\n hook = attrHooks[name];\n if (hook && hook.get) {\n value = hook.get($elm, name);\n } else {\n value = $elm.attr(name);\n }\n }\n if (typeof value === 'undefined') {\n value = defaultVal || '';\n }\n return value;\n };\n var getAttribs = function (elm) {\n var node = get(elm);\n if (!node) {\n return [];\n }\n return node.attributes;\n };\n var setAttrib = function (elm, name, value) {\n var originalValue, hook;\n if (value === '') {\n value = null;\n }\n var $elm = $$(elm);\n originalValue = $elm.attr(name);\n if (!$elm.length) {\n return;\n }\n hook = attrHooks[name];\n if (hook && hook.set) {\n hook.set($elm, value, name);\n } else {\n $elm.attr(name, value);\n }\n if (originalValue !== value && settings.onSetAttrib) {\n settings.onSetAttrib({\n attrElm: $elm,\n attrName: name,\n attrValue: value\n });\n }\n };\n var clone = function (node, deep) {\n if (!isIE || node.nodeType !== 1 || deep) {\n return node.cloneNode(deep);\n }\n if (!deep) {\n var clone_1 = doc.createElement(node.nodeName);\n each$5(getAttribs(node), function (attr) {\n setAttrib(clone_1, attr.nodeName, getAttrib(node, attr.nodeName));\n });\n return clone_1;\n }\n return null;\n };\n var getRoot = function () {\n return settings.root_element || doc.body;\n };\n var getViewPort = function (argWin) {\n var actWin = !argWin ? win : argWin;\n var doc = actWin.document;\n var rootElm = doc.documentElement ;\n return {\n x: actWin.pageXOffset || rootElm.scrollLeft,\n y: actWin.pageYOffset || rootElm.scrollTop,\n w: actWin.innerWidth || rootElm.clientWidth,\n h: actWin.innerHeight || rootElm.clientHeight\n };\n };\n var getPos = function (elm, rootElm) {\n return Position.getPos(doc.body, get(elm), rootElm);\n };\n var setStyle = function (elm, name, value) {\n var $elm = $$(elm).css(name, value);\n if (settings.update_styles) {\n updateInternalStyleAttr(styles, $elm);\n }\n };\n var setStyles = function (elm, stylesArg) {\n var $elm = $$(elm).css(stylesArg);\n if (settings.update_styles) {\n updateInternalStyleAttr(styles, $elm);\n }\n };\n var getStyle = function (elm, name, computed) {\n var $elm = $$(elm);\n if (computed) {\n return $elm.css(name);\n }\n name = name.replace(/-(\\D)/g, function (a, b) {\n return b.toUpperCase();\n });\n if (name === 'float') {\n name = Env.ie && Env.ie < 12 ? 'styleFloat' : 'cssFloat';\n }\n return $elm[0] && $elm[0].style ? $elm[0].style[name] : undefined;\n };\n var getSize = function (elm) {\n var w, h;\n elm = get(elm);\n w = getStyle(elm, 'width');\n h = getStyle(elm, 'height');\n if (w.indexOf('px') === -1) {\n w = 0;\n }\n if (h.indexOf('px') === -1) {\n h = 0;\n }\n return {\n w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth,\n h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight\n };\n };\n var getRect = function (elm) {\n var pos, size;\n elm = get(elm);\n pos = getPos(elm);\n size = getSize(elm);\n return {\n x: pos.x,\n y: pos.y,\n w: size.w,\n h: size.h\n };\n };\n var is = function (elm, selector) {\n var i;\n if (!elm) {\n return false;\n }\n if (!Array.isArray(elm)) {\n if (selector === '*') {\n return elm.nodeType === 1;\n }\n if (simpleSelectorRe.test(selector)) {\n var selectors = selector.toLowerCase().split(/,/);\n var elmName = elm.nodeName.toLowerCase();\n for (i = selectors.length - 1; i >= 0; i--) {\n if (selectors[i] === elmName) {\n return true;\n }\n }\n return false;\n }\n if (elm.nodeType && elm.nodeType !== 1) {\n return false;\n }\n }\n var elms = !Array.isArray(elm) ? [elm] : elm;\n return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0;\n };\n var getParents = function (elm, selector, root, collect) {\n var result = [];\n var selectorVal;\n var node = get(elm);\n collect = collect === undefined;\n root = root || (getRoot().nodeName !== 'BODY' ? getRoot().parentNode : null);\n if (Tools.is(selector, 'string')) {\n selectorVal = selector;\n if (selector === '*') {\n selector = function (node) {\n return node.nodeType === 1;\n };\n } else {\n selector = function (node) {\n return is(node, selectorVal);\n };\n }\n }\n while (node) {\n if (node === root || !node.nodeType || node.nodeType === 9) {\n break;\n }\n if (!selector || typeof selector === 'function' && selector(node)) {\n if (collect) {\n result.push(node);\n } else {\n return [node];\n }\n }\n node = node.parentNode;\n }\n return collect ? result : null;\n };\n var getParent = function (node, selector, root) {\n var parents = getParents(node, selector, root, false);\n return parents && parents.length > 0 ? parents[0] : null;\n };\n var _findSib = function (node, selector, name) {\n var func = selector;\n if (node) {\n if (typeof selector === 'string') {\n func = function (node) {\n return is(node, selector);\n };\n }\n for (node = node[name]; node; node = node[name]) {\n if (typeof func === 'function' && func(node)) {\n return node;\n }\n }\n }\n return null;\n };\n var getNext = function (node, selector) {\n return _findSib(node, selector, 'nextSibling');\n };\n var getPrev = function (node, selector) {\n return _findSib(node, selector, 'previousSibling');\n };\n var select = function (selector, scope) {\n return Sizzle(selector, get(scope) || settings.root_element || doc, []);\n };\n var run = function (elm, func, scope) {\n var result;\n var node = typeof elm === 'string' ? get(elm) : elm;\n if (!node) {\n return false;\n }\n if (Tools.isArray(node) && (node.length || node.length === 0)) {\n result = [];\n each$5(node, function (elm, i) {\n if (elm) {\n if (typeof elm === 'string') {\n elm = get(elm);\n }\n result.push(func.call(scope, elm, i));\n }\n });\n return result;\n }\n var context = scope ? scope : _this;\n return func.call(context, node);\n };\n var setAttribs = function (elm, attrs) {\n $$(elm).each(function (i, node) {\n each$5(attrs, function (value, name) {\n setAttrib(node, name, value);\n });\n });\n };\n var setHTML = function (elm, html) {\n var $elm = $$(elm);\n if (isIE) {\n $elm.each(function (i, target) {\n if (target.canHaveHTML === false) {\n return;\n }\n while (target.firstChild) {\n target.removeChild(target.firstChild);\n }\n try {\n target.innerHTML = '
' + html;\n target.removeChild(target.firstChild);\n } catch (ex) {\n DomQuery('
').html('
' + html).contents().slice(1).appendTo(target);\n }\n return html;\n });\n } else {\n $elm.html(html);\n }\n };\n var add = function (parentElm, name, attrs, html, create) {\n return run(parentElm, function (parentElm) {\n var newElm = typeof name === 'string' ? doc.createElement(name) : name;\n setAttribs(newElm, attrs);\n if (html) {\n if (typeof html !== 'string' && html.nodeType) {\n newElm.appendChild(html);\n } else if (typeof html === 'string') {\n setHTML(newElm, html);\n }\n }\n return !create ? parentElm.appendChild(newElm) : newElm;\n });\n };\n var create = function (name, attrs, html) {\n return add(doc.createElement(name), name, attrs, html, true);\n };\n var decode = Entities.decode;\n var encode = Entities.encodeAllRaw;\n var createHTML = function (name, attrs, html) {\n var outHtml = '', key;\n outHtml += '<' + name;\n for (key in attrs) {\n if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] !== 'undefined') {\n outHtml += ' ' + key + '=\"' + encode(attrs[key]) + '\"';\n }\n }\n if (typeof html !== 'undefined') {\n return outHtml + '>' + html + '';\n }\n return outHtml + ' />';\n };\n var createFragment = function (html) {\n var node;\n var container = doc.createElement('div');\n var frag = doc.createDocumentFragment();\n frag.appendChild(container);\n if (html) {\n container.innerHTML = html;\n }\n while (node = container.firstChild) {\n frag.appendChild(node);\n }\n frag.removeChild(container);\n return frag;\n };\n var remove = function (node, keepChildren) {\n var $node = $$(node);\n if (keepChildren) {\n $node.each(function () {\n var child;\n while (child = this.firstChild) {\n if (child.nodeType === 3 && child.data.length === 0) {\n this.removeChild(child);\n } else {\n this.parentNode.insertBefore(child, this);\n }\n }\n }).remove();\n } else {\n $node.remove();\n }\n return $node.length > 1 ? $node.toArray() : $node[0];\n };\n var removeAllAttribs = function (e) {\n return run(e, function (e) {\n var i;\n var attrs = e.attributes;\n for (i = attrs.length - 1; i >= 0; i--) {\n e.removeAttributeNode(attrs.item(i));\n }\n });\n };\n var parseStyle = function (cssText) {\n return styles.parse(cssText);\n };\n var serializeStyle = function (stylesArg, name) {\n return styles.serialize(stylesArg, name);\n };\n var addStyle = function (cssText) {\n var head, styleElm;\n if (self !== DOMUtils.DOM && doc === domGlobals.document) {\n if (addedStyles[cssText]) {\n return;\n }\n addedStyles[cssText] = true;\n }\n styleElm = doc.getElementById('mceDefaultStyles');\n if (!styleElm) {\n styleElm = doc.createElement('style');\n styleElm.id = 'mceDefaultStyles';\n styleElm.type = 'text/css';\n head = doc.getElementsByTagName('head')[0];\n if (head.firstChild) {\n head.insertBefore(styleElm, head.firstChild);\n } else {\n head.appendChild(styleElm);\n }\n }\n if (styleElm.styleSheet) {\n styleElm.styleSheet.cssText += cssText;\n } else {\n styleElm.appendChild(doc.createTextNode(cssText));\n }\n };\n var loadCSS = function (url) {\n var head;\n if (self !== DOMUtils.DOM && doc === domGlobals.document) {\n DOMUtils.DOM.loadCSS(url);\n return;\n }\n if (!url) {\n url = '';\n }\n head = doc.getElementsByTagName('head')[0];\n each$5(url.split(','), function (url) {\n var link;\n url = Tools._addCacheSuffix(url);\n if (files[url]) {\n return;\n }\n files[url] = true;\n link = create('link', {\n rel: 'stylesheet',\n href: url\n });\n head.appendChild(link);\n });\n };\n var toggleClass = function (elm, cls, state) {\n $$(elm).toggleClass(cls, state).each(function () {\n if (this.className === '') {\n DomQuery(this).attr('class', null);\n }\n });\n };\n var addClass = function (elm, cls) {\n $$(elm).addClass(cls);\n };\n var removeClass = function (elm, cls) {\n toggleClass(elm, cls, false);\n };\n var hasClass = function (elm, cls) {\n return $$(elm).hasClass(cls);\n };\n var show = function (elm) {\n $$(elm).show();\n };\n var hide = function (elm) {\n $$(elm).hide();\n };\n var isHidden = function (elm) {\n return $$(elm).css('display') === 'none';\n };\n var uniqueId = function (prefix) {\n return (!prefix ? 'mce_' : prefix) + counter++;\n };\n var getOuterHTML = function (elm) {\n var node = typeof elm === 'string' ? get(elm) : elm;\n return NodeType.isElement(node) ? node.outerHTML : DomQuery('
').append(DomQuery(node).clone()).html();\n };\n var setOuterHTML = function (elm, html) {\n $$(elm).each(function () {\n try {\n if ('outerHTML' in this) {\n this.outerHTML = html;\n return;\n }\n } catch (ex) {\n }\n remove(DomQuery(this).html(html), true);\n });\n };\n var insertAfter = function (node, reference) {\n var referenceNode = get(reference);\n return run(node, function (node) {\n var parent, nextSibling;\n parent = referenceNode.parentNode;\n nextSibling = referenceNode.nextSibling;\n if (nextSibling) {\n parent.insertBefore(node, nextSibling);\n } else {\n parent.appendChild(node);\n }\n return node;\n });\n };\n var replace = function (newElm, oldElm, keepChildren) {\n return run(oldElm, function (oldElm) {\n if (Tools.is(oldElm, 'array')) {\n newElm = newElm.cloneNode(true);\n }\n if (keepChildren) {\n each$5(grep$1(oldElm.childNodes), function (node) {\n newElm.appendChild(node);\n });\n }\n return oldElm.parentNode.replaceChild(newElm, oldElm);\n });\n };\n var rename = function (elm, name) {\n var newElm;\n if (elm.nodeName !== name.toUpperCase()) {\n newElm = create(name);\n each$5(getAttribs(elm), function (attrNode) {\n setAttrib(newElm, attrNode.nodeName, getAttrib(elm, attrNode.nodeName));\n });\n replace(newElm, elm, true);\n }\n return newElm || elm;\n };\n var findCommonAncestor = function (a, b) {\n var ps = a, pe;\n while (ps) {\n pe = b;\n while (pe && ps !== pe) {\n pe = pe.parentNode;\n }\n if (ps === pe) {\n break;\n }\n ps = ps.parentNode;\n }\n if (!ps && a.ownerDocument) {\n return a.ownerDocument.documentElement;\n }\n return ps;\n };\n var toHex = function (rgbVal) {\n return styles.toHex(Tools.trim(rgbVal));\n };\n var isEmpty = function (node, elements) {\n var i, attributes, type, whitespace, walker, name, brCount = 0;\n node = node.firstChild;\n if (node) {\n walker = new TreeWalker(node, node.parentNode);\n elements = elements || (schema ? schema.getNonEmptyElements() : null);\n whitespace = schema ? schema.getWhiteSpaceElements() : {};\n do {\n type = node.nodeType;\n if (NodeType.isElement(node)) {\n var bogusVal = node.getAttribute('data-mce-bogus');\n if (bogusVal) {\n node = walker.next(bogusVal === 'all');\n continue;\n }\n name = node.nodeName.toLowerCase();\n if (elements && elements[name]) {\n if (name === 'br') {\n brCount++;\n node = walker.next();\n continue;\n }\n return false;\n }\n attributes = getAttribs(node);\n i = attributes.length;\n while (i--) {\n name = attributes[i].nodeName;\n if (name === 'name' || name === 'data-mce-bookmark') {\n return false;\n }\n }\n }\n if (type === 8) {\n return false;\n }\n if (type === 3 && !whiteSpaceRegExp$2.test(node.nodeValue)) {\n return false;\n }\n if (type === 3 && node.parentNode && whitespace[node.parentNode.nodeName] && whiteSpaceRegExp$2.test(node.nodeValue)) {\n return false;\n }\n node = walker.next();\n } while (node);\n }\n return brCount <= 1;\n };\n var createRng = function () {\n return doc.createRange();\n };\n var split = function (parentElm, splitElm, replacementElm) {\n var r = createRng(), bef, aft, pa;\n if (parentElm && splitElm) {\n r.setStart(parentElm.parentNode, findNodeIndex(parentElm));\n r.setEnd(splitElm.parentNode, findNodeIndex(splitElm));\n bef = r.extractContents();\n r = createRng();\n r.setStart(splitElm.parentNode, findNodeIndex(splitElm) + 1);\n r.setEnd(parentElm.parentNode, findNodeIndex(parentElm) + 1);\n aft = r.extractContents();\n pa = parentElm.parentNode;\n pa.insertBefore(TrimNode.trimNode(self, bef), parentElm);\n if (replacementElm) {\n pa.insertBefore(replacementElm, parentElm);\n } else {\n pa.insertBefore(splitElm, parentElm);\n }\n pa.insertBefore(TrimNode.trimNode(self, aft), parentElm);\n remove(parentElm);\n return replacementElm || splitElm;\n }\n };\n var bind = function (target, name, func, scope) {\n if (Tools.isArray(target)) {\n var i = target.length;\n while (i--) {\n target[i] = bind(target[i], name, func, scope);\n }\n return target;\n }\n if (settings.collect && (target === doc || target === win)) {\n boundEvents.push([\n target,\n name,\n func,\n scope\n ]);\n }\n return events.bind(target, name, func, scope || self);\n };\n var unbind = function (target, name, func) {\n var i;\n if (Tools.isArray(target)) {\n i = target.length;\n while (i--) {\n target[i] = unbind(target[i], name, func);\n }\n return target;\n }\n if (boundEvents && (target === doc || target === win)) {\n i = boundEvents.length;\n while (i--) {\n var item = boundEvents[i];\n if (target === item[0] && (!name || name === item[1]) && (!func || func === item[2])) {\n events.unbind(item[0], item[1], item[2]);\n }\n }\n }\n return events.unbind(target, name, func);\n };\n var fire = function (target, name, evt) {\n return events.fire(target, name, evt);\n };\n var getContentEditable = function (node) {\n if (node && NodeType.isElement(node)) {\n var contentEditable = node.getAttribute('data-mce-contenteditable');\n if (contentEditable && contentEditable !== 'inherit') {\n return contentEditable;\n }\n return node.contentEditable !== 'inherit' ? node.contentEditable : null;\n } else {\n return null;\n }\n };\n var getContentEditableParent = function (node) {\n var root = getRoot();\n var state = null;\n for (; node && node !== root; node = node.parentNode) {\n state = getContentEditable(node);\n if (state !== null) {\n break;\n }\n }\n return state;\n };\n var destroy = function () {\n if (boundEvents) {\n var i = boundEvents.length;\n while (i--) {\n var item = boundEvents[i];\n events.unbind(item[0], item[1], item[2]);\n }\n }\n if (Sizzle.setDocument) {\n Sizzle.setDocument();\n }\n };\n var isChildOf = function (node, parent) {\n while (node) {\n if (parent === node) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n };\n var dumpRng = function (r) {\n return 'startContainer: ' + r.startContainer.nodeName + ', startOffset: ' + r.startOffset + ', endContainer: ' + r.endContainer.nodeName + ', endOffset: ' + r.endOffset;\n };\n var self = {\n doc: doc,\n settings: settings,\n win: win,\n files: files,\n stdMode: stdMode,\n boxModel: boxModel,\n styleSheetLoader: styleSheetLoader,\n boundEvents: boundEvents,\n styles: styles,\n schema: schema,\n events: events,\n isBlock: isBlock,\n $: $,\n $$: $$,\n root: null,\n clone: clone,\n getRoot: getRoot,\n getViewPort: getViewPort,\n getRect: getRect,\n getSize: getSize,\n getParent: getParent,\n getParents: getParents,\n get: get,\n getNext: getNext,\n getPrev: getPrev,\n select: select,\n is: is,\n add: add,\n create: create,\n createHTML: createHTML,\n createFragment: createFragment,\n remove: remove,\n setStyle: setStyle,\n getStyle: getStyle,\n setStyles: setStyles,\n removeAllAttribs: removeAllAttribs,\n setAttrib: setAttrib,\n setAttribs: setAttribs,\n getAttrib: getAttrib,\n getPos: getPos,\n parseStyle: parseStyle,\n serializeStyle: serializeStyle,\n addStyle: addStyle,\n loadCSS: loadCSS,\n addClass: addClass,\n removeClass: removeClass,\n hasClass: hasClass,\n toggleClass: toggleClass,\n show: show,\n hide: hide,\n isHidden: isHidden,\n uniqueId: uniqueId,\n setHTML: setHTML,\n getOuterHTML: getOuterHTML,\n setOuterHTML: setOuterHTML,\n decode: decode,\n encode: encode,\n insertAfter: insertAfter,\n replace: replace,\n rename: rename,\n findCommonAncestor: findCommonAncestor,\n toHex: toHex,\n run: run,\n getAttribs: getAttribs,\n isEmpty: isEmpty,\n createRng: createRng,\n nodeIndex: findNodeIndex,\n split: split,\n bind: bind,\n unbind: unbind,\n fire: fire,\n getContentEditable: getContentEditable,\n getContentEditableParent: getContentEditableParent,\n destroy: destroy,\n isChildOf: isChildOf,\n dumpRng: dumpRng\n };\n attrHooks = setupAttrHooks(styles, settings, function () {\n return self;\n });\n return self;\n }\n (function (DOMUtils) {\n DOMUtils.DOM = DOMUtils(domGlobals.document);\n DOMUtils.nodeIndex = findNodeIndex;\n }(DOMUtils || (DOMUtils = {})));\n var DOMUtils$1 = DOMUtils;\n\n var DOM = DOMUtils$1.DOM;\n var each$6 = Tools.each, grep$2 = Tools.grep;\n var isFunction$1 = function (f) {\n return typeof f === 'function';\n };\n var ScriptLoader = function () {\n var QUEUED = 0;\n var LOADING = 1;\n var LOADED = 2;\n var FAILED = 3;\n var states = {};\n var queue = [];\n var scriptLoadedCallbacks = {};\n var queueLoadedCallbacks = [];\n var loading = 0;\n var loadScript = function (url, success, failure) {\n var dom = DOM;\n var elm, id;\n var done = function () {\n dom.remove(id);\n if (elm) {\n elm.onreadystatechange = elm.onload = elm = null;\n }\n success();\n };\n var error = function () {\n if (isFunction$1(failure)) {\n failure();\n } else {\n if (typeof console !== 'undefined' && console.log) {\n console.log('Failed to load script: ' + url);\n }\n }\n };\n id = dom.uniqueId();\n elm = domGlobals.document.createElement('script');\n elm.id = id;\n elm.type = 'text/javascript';\n elm.src = Tools._addCacheSuffix(url);\n elm.onload = done;\n elm.onerror = error;\n (domGlobals.document.getElementsByTagName('head')[0] || domGlobals.document.body).appendChild(elm);\n };\n this.isDone = function (url) {\n return states[url] === LOADED;\n };\n this.markDone = function (url) {\n states[url] = LOADED;\n };\n this.add = this.load = function (url, success, scope, failure) {\n var state = states[url];\n if (state === undefined) {\n queue.push(url);\n states[url] = QUEUED;\n }\n if (success) {\n if (!scriptLoadedCallbacks[url]) {\n scriptLoadedCallbacks[url] = [];\n }\n scriptLoadedCallbacks[url].push({\n success: success,\n failure: failure,\n scope: scope || this\n });\n }\n };\n this.remove = function (url) {\n delete states[url];\n delete scriptLoadedCallbacks[url];\n };\n this.loadQueue = function (success, scope, failure) {\n this.loadScripts(queue, success, scope, failure);\n };\n this.loadScripts = function (scripts, success, scope, failure) {\n var loadScripts;\n var failures = [];\n var execCallbacks = function (name, url) {\n each$6(scriptLoadedCallbacks[url], function (callback) {\n if (isFunction$1(callback[name])) {\n callback[name].call(callback.scope);\n }\n });\n scriptLoadedCallbacks[url] = undefined;\n };\n queueLoadedCallbacks.push({\n success: success,\n failure: failure,\n scope: scope || this\n });\n loadScripts = function () {\n var loadingScripts = grep$2(scripts);\n scripts.length = 0;\n each$6(loadingScripts, function (url) {\n if (states[url] === LOADED) {\n execCallbacks('success', url);\n return;\n }\n if (states[url] === FAILED) {\n execCallbacks('failure', url);\n return;\n }\n if (states[url] !== LOADING) {\n states[url] = LOADING;\n loading++;\n loadScript(url, function () {\n states[url] = LOADED;\n loading--;\n execCallbacks('success', url);\n loadScripts();\n }, function () {\n states[url] = FAILED;\n loading--;\n failures.push(url);\n execCallbacks('failure', url);\n loadScripts();\n });\n }\n });\n if (!loading) {\n var notifyCallbacks = queueLoadedCallbacks.slice(0);\n queueLoadedCallbacks.length = 0;\n each$6(notifyCallbacks, function (callback) {\n if (failures.length === 0) {\n if (isFunction$1(callback.success)) {\n callback.success.call(callback.scope);\n }\n } else {\n if (isFunction$1(callback.failure)) {\n callback.failure.call(callback.scope, failures);\n }\n }\n });\n }\n };\n loadScripts();\n };\n };\n ScriptLoader.ScriptLoader = new ScriptLoader();\n\n var each$7 = Tools.each;\n function AddOnManager() {\n var _this = this;\n var items = [];\n var urls = {};\n var lookup = {};\n var _listeners = [];\n var get = function (name) {\n if (lookup[name]) {\n return lookup[name].instance;\n }\n return undefined;\n };\n var dependencies = function (name) {\n var result;\n if (lookup[name]) {\n result = lookup[name].dependencies;\n }\n return result || [];\n };\n var requireLangPack = function (name, languages) {\n var language = AddOnManager.language;\n if (language && AddOnManager.languageLoad !== false) {\n if (languages) {\n languages = ',' + languages + ',';\n if (languages.indexOf(',' + language.substr(0, 2) + ',') !== -1) {\n language = language.substr(0, 2);\n } else if (languages.indexOf(',' + language + ',') === -1) {\n return;\n }\n }\n ScriptLoader.ScriptLoader.add(urls[name] + '/langs/' + language + '.js');\n }\n };\n var add = function (id, addOn, dependencies) {\n items.push(addOn);\n lookup[id] = {\n instance: addOn,\n dependencies: dependencies\n };\n var result = partition(_listeners, function (listener) {\n return listener.name === id;\n });\n _listeners = result.fail;\n each$7(result.pass, function (listener) {\n listener.callback();\n });\n return addOn;\n };\n var remove = function (name) {\n delete urls[name];\n delete lookup[name];\n };\n var createUrl = function (baseUrl, dep) {\n if (typeof dep === 'object') {\n return dep;\n }\n return typeof baseUrl === 'string' ? {\n prefix: '',\n resource: dep,\n suffix: ''\n } : {\n prefix: baseUrl.prefix,\n resource: dep,\n suffix: baseUrl.suffix\n };\n };\n var addComponents = function (pluginName, scripts) {\n var pluginUrl = _this.urls[pluginName];\n each$7(scripts, function (script) {\n ScriptLoader.ScriptLoader.add(pluginUrl + '/' + script);\n });\n };\n var loadDependencies = function (name, addOnUrl, success, scope) {\n var deps = dependencies(name);\n each$7(deps, function (dep) {\n var newUrl = createUrl(addOnUrl, dep);\n load(newUrl.resource, newUrl, undefined, undefined);\n });\n if (success) {\n if (scope) {\n success.call(scope);\n } else {\n success.call(ScriptLoader);\n }\n }\n };\n var load = function (name, addOnUrl, success, scope, failure) {\n if (urls[name]) {\n return;\n }\n var urlString = typeof addOnUrl === 'string' ? addOnUrl : addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix;\n if (urlString.indexOf('/') !== 0 && urlString.indexOf('://') === -1) {\n urlString = AddOnManager.baseURL + '/' + urlString;\n }\n urls[name] = urlString.substring(0, urlString.lastIndexOf('/'));\n if (lookup[name]) {\n loadDependencies(name, addOnUrl, success, scope);\n } else {\n ScriptLoader.ScriptLoader.add(urlString, function () {\n return loadDependencies(name, addOnUrl, success, scope);\n }, scope, failure);\n }\n };\n var waitFor = function (name, callback) {\n if (lookup.hasOwnProperty(name)) {\n callback();\n } else {\n _listeners.push({\n name: name,\n callback: callback\n });\n }\n };\n return {\n items: items,\n urls: urls,\n lookup: lookup,\n _listeners: _listeners,\n get: get,\n dependencies: dependencies,\n requireLangPack: requireLangPack,\n add: add,\n remove: remove,\n createUrl: createUrl,\n addComponents: addComponents,\n load: load,\n waitFor: waitFor\n };\n }\n (function (AddOnManager) {\n AddOnManager.PluginManager = AddOnManager();\n AddOnManager.ThemeManager = AddOnManager();\n }(AddOnManager || (AddOnManager = {})));\n\n var before = function (marker, element) {\n var parent$1 = parent(marker);\n parent$1.each(function (v) {\n v.dom().insertBefore(element.dom(), marker.dom());\n });\n };\n var after = function (marker, element) {\n var sibling = nextSibling(marker);\n sibling.fold(function () {\n var parent$1 = parent(marker);\n parent$1.each(function (v) {\n append(v, element);\n });\n }, function (v) {\n before(v, element);\n });\n };\n var prepend = function (parent, element) {\n var firstChild$1 = firstChild(parent);\n firstChild$1.fold(function () {\n append(parent, element);\n }, function (v) {\n parent.dom().insertBefore(element.dom(), v.dom());\n });\n };\n var append = function (parent, element) {\n parent.dom().appendChild(element.dom());\n };\n var wrap$1 = function (element, wrapper) {\n before(element, wrapper);\n append(wrapper, element);\n };\n\n var before$1 = function (marker, elements) {\n each(elements, function (x) {\n before(marker, x);\n });\n };\n var append$1 = function (parent, elements) {\n each(elements, function (x) {\n append(parent, x);\n });\n };\n\n var empty = function (element) {\n element.dom().textContent = '';\n each(children(element), function (rogue) {\n remove$1(rogue);\n });\n };\n var remove$1 = function (element) {\n var dom = element.dom();\n if (dom.parentNode !== null) {\n dom.parentNode.removeChild(dom);\n }\n };\n var unwrap = function (wrapper) {\n var children$1 = children(wrapper);\n if (children$1.length > 0) {\n before$1(wrapper, children$1);\n }\n remove$1(wrapper);\n };\n\n var first = function (fn, rate) {\n var timer = null;\n var cancel = function () {\n if (timer !== null) {\n domGlobals.clearTimeout(timer);\n timer = null;\n }\n };\n var throttle = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (timer === null) {\n timer = domGlobals.setTimeout(function () {\n fn.apply(null, args);\n timer = null;\n }, rate);\n }\n };\n return {\n cancel: cancel,\n throttle: throttle\n };\n };\n var last$2 = function (fn, rate) {\n var timer = null;\n var cancel = function () {\n if (timer !== null) {\n domGlobals.clearTimeout(timer);\n timer = null;\n }\n };\n var throttle = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (timer !== null) {\n domGlobals.clearTimeout(timer);\n }\n timer = domGlobals.setTimeout(function () {\n fn.apply(null, args);\n timer = null;\n }, rate);\n };\n return {\n cancel: cancel,\n throttle: throttle\n };\n };\n\n var Cell = function (initial) {\n var value = initial;\n var get = function () {\n return value;\n };\n var set = function (v) {\n value = v;\n };\n var clone = function () {\n return Cell(get());\n };\n return {\n get: get,\n set: set,\n clone: clone\n };\n };\n\n var read = function (element, attr) {\n var value = get(element, attr);\n return value === undefined || value === '' ? [] : value.split(' ');\n };\n var add = function (element, attr, id) {\n var old = read(element, attr);\n var nu = old.concat([id]);\n set(element, attr, nu.join(' '));\n return true;\n };\n var remove$2 = function (element, attr, id) {\n var nu = filter(read(element, attr), function (v) {\n return v !== id;\n });\n if (nu.length > 0) {\n set(element, attr, nu.join(' '));\n } else {\n remove(element, attr);\n }\n return false;\n };\n\n var supports = function (element) {\n return element.dom().classList !== undefined;\n };\n var get$2 = function (element) {\n return read(element, 'class');\n };\n var add$1 = function (element, clazz) {\n return add(element, 'class', clazz);\n };\n var remove$3 = function (element, clazz) {\n return remove$2(element, 'class', clazz);\n };\n\n var add$2 = function (element, clazz) {\n if (supports(element)) {\n element.dom().classList.add(clazz);\n } else {\n add$1(element, clazz);\n }\n };\n var cleanClass = function (element) {\n var classList = supports(element) ? element.dom().classList : get$2(element);\n if (classList.length === 0) {\n remove(element, 'class');\n }\n };\n var remove$4 = function (element, clazz) {\n if (supports(element)) {\n var classList = element.dom().classList;\n classList.remove(clazz);\n } else {\n remove$3(element, clazz);\n }\n cleanClass(element);\n };\n var has$2 = function (element, clazz) {\n return supports(element) && element.dom().classList.contains(clazz);\n };\n\n var descendants = function (scope, predicate) {\n var result = [];\n each(children(scope), function (x) {\n if (predicate(x)) {\n result = result.concat([x]);\n }\n result = result.concat(descendants(x, predicate));\n });\n return result;\n };\n\n var descendants$1 = function (scope, selector) {\n return all(selector, scope);\n };\n\n function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {\n return is(scope, a) ? Option.some(scope) : isFunction(isRoot) && isRoot(scope) ? Option.none() : ancestor(scope, a, isRoot);\n }\n\n var ancestor = function (scope, predicate, isRoot) {\n var element = scope.dom();\n var stop = isFunction(isRoot) ? isRoot : constant(false);\n while (element.parentNode) {\n element = element.parentNode;\n var el = Element.fromDom(element);\n if (predicate(el)) {\n return Option.some(el);\n } else if (stop(el)) {\n break;\n }\n }\n return Option.none();\n };\n var closest = function (scope, predicate, isRoot) {\n var is = function (s, test) {\n return test(s);\n };\n return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot);\n };\n\n var ancestor$1 = function (scope, selector, isRoot) {\n return ancestor(scope, function (e) {\n return is$1(e, selector);\n }, isRoot);\n };\n var descendant = function (scope, selector) {\n return one(selector, scope);\n };\n var closest$1 = function (scope, selector, isRoot) {\n return ClosestOrAncestor(is$1, ancestor$1, scope, selector, isRoot);\n };\n\n var annotation = constant('mce-annotation');\n var dataAnnotation = constant('data-mce-annotation');\n var dataAnnotationId = constant('data-mce-annotation-uid');\n\n var identify = function (editor, annotationName) {\n var rng = editor.selection.getRng();\n var start = Element.fromDom(rng.startContainer);\n var root = Element.fromDom(editor.getBody());\n var selector = annotationName.fold(function () {\n return '.' + annotation();\n }, function (an) {\n return '[' + dataAnnotation() + '=\"' + an + '\"]';\n });\n var newStart = child(start, rng.startOffset).getOr(start);\n var closest = closest$1(newStart, selector, function (n) {\n return eq(n, root);\n });\n var getAttr = function (c, property) {\n if (has$1(c, property)) {\n return Option.some(get(c, property));\n } else {\n return Option.none();\n }\n };\n return closest.bind(function (c) {\n return getAttr(c, '' + dataAnnotationId()).bind(function (uid) {\n return getAttr(c, '' + dataAnnotation()).map(function (name) {\n var elements = findMarkers(editor, uid);\n return {\n uid: uid,\n name: name,\n elements: elements\n };\n });\n });\n });\n };\n var isAnnotation = function (elem) {\n return isElement(elem) && has$2(elem, annotation());\n };\n var findMarkers = function (editor, uid) {\n var body = Element.fromDom(editor.getBody());\n return descendants$1(body, '[' + dataAnnotationId() + '=\"' + uid + '\"]');\n };\n var findAll = function (editor, name) {\n var body = Element.fromDom(editor.getBody());\n var markers = descendants$1(body, '[' + dataAnnotation() + '=\"' + name + '\"]');\n var directory = {};\n each(markers, function (m) {\n var uid = get(m, dataAnnotationId());\n var nodesAlready = directory.hasOwnProperty(uid) ? directory[uid] : [];\n directory[uid] = nodesAlready.concat([m]);\n });\n return directory;\n };\n\n var setup = function (editor, registry) {\n var changeCallbacks = Cell({});\n var initData = function () {\n return {\n listeners: [],\n previous: Cell(Option.none())\n };\n };\n var withCallbacks = function (name, f) {\n updateCallbacks(name, function (data) {\n f(data);\n return data;\n });\n };\n var updateCallbacks = function (name, f) {\n var callbackMap = changeCallbacks.get();\n var data = callbackMap.hasOwnProperty(name) ? callbackMap[name] : initData();\n var outputData = f(data);\n callbackMap[name] = outputData;\n changeCallbacks.set(callbackMap);\n };\n var fireCallbacks = function (name, uid, elements) {\n withCallbacks(name, function (data) {\n each(data.listeners, function (f) {\n return f(true, name, {\n uid: uid,\n nodes: map(elements, function (elem) {\n return elem.dom();\n })\n });\n });\n });\n };\n var fireNoAnnotation = function (name) {\n withCallbacks(name, function (data) {\n each(data.listeners, function (f) {\n return f(false, name);\n });\n });\n };\n var onNodeChange = last$2(function () {\n var callbackMap = changeCallbacks.get();\n var annotations = sort(keys(callbackMap));\n each(annotations, function (name) {\n updateCallbacks(name, function (data) {\n var prev = data.previous.get();\n identify(editor, Option.some(name)).fold(function () {\n if (prev.isSome()) {\n fireNoAnnotation(name);\n data.previous.set(Option.none());\n }\n }, function (_a) {\n var uid = _a.uid, name = _a.name, elements = _a.elements;\n if (!prev.is(uid)) {\n fireCallbacks(name, uid, elements);\n data.previous.set(Option.some(uid));\n }\n });\n return {\n previous: data.previous,\n listeners: data.listeners\n };\n });\n });\n }, 30);\n editor.on('remove', function () {\n onNodeChange.cancel();\n });\n editor.on('nodeChange', function () {\n onNodeChange.throttle();\n });\n var addListener = function (name, f) {\n updateCallbacks(name, function (data) {\n return {\n previous: data.previous,\n listeners: data.listeners.concat([f])\n };\n });\n };\n return { addListener: addListener };\n };\n\n var setup$1 = function (editor, registry) {\n var identifyParserNode = function (span) {\n var optAnnotation = Option.from(span.attributes.map[dataAnnotation()]);\n return optAnnotation.bind(registry.lookup);\n };\n editor.on('init', function () {\n editor.serializer.addNodeFilter('span', function (spans) {\n each(spans, function (span) {\n identifyParserNode(span).each(function (settings) {\n if (settings.persistent === false) {\n span.unwrap();\n }\n });\n });\n });\n });\n };\n\n var create$1 = function () {\n var annotations = {};\n var register = function (name, settings) {\n annotations[name] = {\n name: name,\n settings: settings\n };\n };\n var lookup = function (name) {\n return annotations.hasOwnProperty(name) ? Option.from(annotations[name]).map(function (a) {\n return a.settings;\n }) : Option.none();\n };\n return {\n register: register,\n lookup: lookup\n };\n };\n\n var __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __rest(s, e) {\n var t = {};\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === 'function')\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++)\n s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n }\n\n var unique = 0;\n var generate = function (prefix) {\n var date = new Date();\n var time = date.getTime();\n var random = Math.floor(Math.random() * 1000000000);\n unique++;\n return prefix + '_' + random + unique + String(time);\n };\n\n var add$3 = function (element, classes) {\n each(classes, function (x) {\n add$2(element, x);\n });\n };\n\n var clone = function (original, isDeep) {\n return Element.fromDom(original.dom().cloneNode(isDeep));\n };\n var shallow = function (original) {\n return clone(original, false);\n };\n var deep = function (original) {\n return clone(original, true);\n };\n\n var fromHtml$1 = function (html, scope) {\n var doc = scope || domGlobals.document;\n var div = doc.createElement('div');\n div.innerHTML = html;\n return children(Element.fromDom(div));\n };\n\n var get$3 = function (element) {\n return element.dom().innerHTML;\n };\n var set$1 = function (element, content) {\n var owner$1 = owner(element);\n var docDom = owner$1.dom();\n var fragment = Element.fromDom(docDom.createDocumentFragment());\n var contentElements = fromHtml$1(content, docDom);\n append$1(fragment, contentElements);\n empty(element);\n append(element, fragment);\n };\n\n var ZWSP = '\\uFEFF';\n var isZwsp = function (chr) {\n return chr === ZWSP;\n };\n var trim$3 = function (text) {\n return text.replace(new RegExp(ZWSP, 'g'), '');\n };\n var Zwsp = {\n isZwsp: isZwsp,\n ZWSP: ZWSP,\n trim: trim$3\n };\n\n var isElement$2 = NodeType.isElement;\n var isText$2 = NodeType.isText;\n var isCaretContainerBlock = function (node) {\n if (isText$2(node)) {\n node = node.parentNode;\n }\n return isElement$2(node) && node.hasAttribute('data-mce-caret');\n };\n var isCaretContainerInline = function (node) {\n return isText$2(node) && Zwsp.isZwsp(node.data);\n };\n var isCaretContainer = function (node) {\n return isCaretContainerBlock(node) || isCaretContainerInline(node);\n };\n var hasContent = function (node) {\n return node.firstChild !== node.lastChild || !NodeType.isBr(node.firstChild);\n };\n var insertInline = function (node, before) {\n var doc, sibling, textNode, parentNode;\n doc = node.ownerDocument;\n textNode = doc.createTextNode(Zwsp.ZWSP);\n parentNode = node.parentNode;\n if (!before) {\n sibling = node.nextSibling;\n if (isText$2(sibling)) {\n if (isCaretContainer(sibling)) {\n return sibling;\n }\n if (startsWithCaretContainer(sibling)) {\n sibling.splitText(1);\n return sibling;\n }\n }\n if (node.nextSibling) {\n parentNode.insertBefore(textNode, node.nextSibling);\n } else {\n parentNode.appendChild(textNode);\n }\n } else {\n sibling = node.previousSibling;\n if (isText$2(sibling)) {\n if (isCaretContainer(sibling)) {\n return sibling;\n }\n if (endsWithCaretContainer(sibling)) {\n return sibling.splitText(sibling.data.length - 1);\n }\n }\n parentNode.insertBefore(textNode, node);\n }\n return textNode;\n };\n var isBeforeInline = function (pos) {\n var container = pos.container();\n if (!pos || !NodeType.isText(container)) {\n return false;\n }\n return container.data.charAt(pos.offset()) === Zwsp.ZWSP || pos.isAtStart() && isCaretContainerInline(container.previousSibling);\n };\n var isAfterInline = function (pos) {\n var container = pos.container();\n if (!pos || !NodeType.isText(container)) {\n return false;\n }\n return container.data.charAt(pos.offset() - 1) === Zwsp.ZWSP || pos.isAtEnd() && isCaretContainerInline(container.nextSibling);\n };\n var createBogusBr = function () {\n var br = domGlobals.document.createElement('br');\n br.setAttribute('data-mce-bogus', '1');\n return br;\n };\n var insertBlock = function (blockName, node, before) {\n var doc, blockNode, parentNode;\n doc = node.ownerDocument;\n blockNode = doc.createElement(blockName);\n blockNode.setAttribute('data-mce-caret', before ? 'before' : 'after');\n blockNode.setAttribute('data-mce-bogus', 'all');\n blockNode.appendChild(createBogusBr());\n parentNode = node.parentNode;\n if (!before) {\n if (node.nextSibling) {\n parentNode.insertBefore(blockNode, node.nextSibling);\n } else {\n parentNode.appendChild(blockNode);\n }\n } else {\n parentNode.insertBefore(blockNode, node);\n }\n return blockNode;\n };\n var startsWithCaretContainer = function (node) {\n return isText$2(node) && node.data[0] === Zwsp.ZWSP;\n };\n var endsWithCaretContainer = function (node) {\n return isText$2(node) && node.data[node.data.length - 1] === Zwsp.ZWSP;\n };\n var trimBogusBr = function (elm) {\n var brs = elm.getElementsByTagName('br');\n var lastBr = brs[brs.length - 1];\n if (NodeType.isBogus(lastBr)) {\n lastBr.parentNode.removeChild(lastBr);\n }\n };\n var showCaretContainerBlock = function (caretContainer) {\n if (caretContainer && caretContainer.hasAttribute('data-mce-caret')) {\n trimBogusBr(caretContainer);\n caretContainer.removeAttribute('data-mce-caret');\n caretContainer.removeAttribute('data-mce-bogus');\n caretContainer.removeAttribute('style');\n caretContainer.removeAttribute('_moz_abspos');\n return caretContainer;\n }\n return null;\n };\n var isRangeInCaretContainerBlock = function (range) {\n return isCaretContainerBlock(range.startContainer);\n };\n\n var isContentEditableTrue$1 = NodeType.isContentEditableTrue;\n var isContentEditableFalse$1 = NodeType.isContentEditableFalse;\n var isBr$2 = NodeType.isBr;\n var isText$3 = NodeType.isText;\n var isInvalidTextElement = NodeType.matchNodeNames('script style textarea');\n var isAtomicInline = NodeType.matchNodeNames('img input textarea hr iframe video audio object');\n var isTable$1 = NodeType.matchNodeNames('table');\n var isCaretContainer$1 = isCaretContainer;\n var isCaretCandidate = function (node) {\n if (isCaretContainer$1(node)) {\n return false;\n }\n if (isText$3(node)) {\n if (isInvalidTextElement(node.parentNode)) {\n return false;\n }\n return true;\n }\n return isAtomicInline(node) || isBr$2(node) || isTable$1(node) || isNonUiContentEditableFalse(node);\n };\n var isUnselectable = function (node) {\n return NodeType.isElement(node) && node.getAttribute('unselectable') === 'true';\n };\n var isNonUiContentEditableFalse = function (node) {\n return isUnselectable(node) === false && isContentEditableFalse$1(node);\n };\n var isInEditable = function (node, root) {\n for (node = node.parentNode; node && node !== root; node = node.parentNode) {\n if (isNonUiContentEditableFalse(node)) {\n return false;\n }\n if (isContentEditableTrue$1(node)) {\n return true;\n }\n }\n return true;\n };\n var isAtomicContentEditableFalse = function (node) {\n if (!isNonUiContentEditableFalse(node)) {\n return false;\n }\n return foldl(from$1(node.getElementsByTagName('*')), function (result, elm) {\n return result || isContentEditableTrue$1(elm);\n }, false) !== true;\n };\n var isAtomic = function (node) {\n return isAtomicInline(node) || isAtomicContentEditableFalse(node);\n };\n var isEditableCaretCandidate = function (node, root) {\n return isCaretCandidate(node) && isInEditable(node, root);\n };\n\n var round = Math.round;\n var clone$1 = function (rect) {\n if (!rect) {\n return {\n left: 0,\n top: 0,\n bottom: 0,\n right: 0,\n width: 0,\n height: 0\n };\n }\n return {\n left: round(rect.left),\n top: round(rect.top),\n bottom: round(rect.bottom),\n right: round(rect.right),\n width: round(rect.width),\n height: round(rect.height)\n };\n };\n var collapse = function (rect, toStart) {\n rect = clone$1(rect);\n if (toStart) {\n rect.right = rect.left;\n } else {\n rect.left = rect.left + rect.width;\n rect.right = rect.left;\n }\n rect.width = 0;\n return rect;\n };\n var isEqual = function (rect1, rect2) {\n return rect1.left === rect2.left && rect1.top === rect2.top && rect1.bottom === rect2.bottom && rect1.right === rect2.right;\n };\n var isValidOverflow = function (overflowY, rect1, rect2) {\n return overflowY >= 0 && overflowY <= Math.min(rect1.height, rect2.height) / 2;\n };\n var isAbove = function (rect1, rect2) {\n var halfHeight = Math.min(rect2.height / 2, rect1.height / 2);\n if (rect1.bottom - halfHeight < rect2.top) {\n return true;\n }\n if (rect1.top > rect2.bottom) {\n return false;\n }\n return isValidOverflow(rect2.top - rect1.bottom, rect1, rect2);\n };\n var isBelow = function (rect1, rect2) {\n if (rect1.top > rect2.bottom) {\n return true;\n }\n if (rect1.bottom < rect2.top) {\n return false;\n }\n return isValidOverflow(rect2.bottom - rect1.top, rect1, rect2);\n };\n var containsXY = function (rect, clientX, clientY) {\n return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;\n };\n var overflowX = function (outer, inner) {\n if (inner.left > outer.left && inner.right < outer.right) {\n return 0;\n } else {\n return inner.left < outer.left ? inner.left - outer.left : inner.right - outer.right;\n }\n };\n var overflowY = function (outer, inner) {\n if (inner.top > outer.top && inner.bottom < outer.bottom) {\n return 0;\n } else {\n return inner.top < outer.top ? inner.top - outer.top : inner.bottom - outer.bottom;\n }\n };\n var getOverflow = function (outer, inner) {\n return {\n x: overflowX(outer, inner),\n y: overflowY(outer, inner)\n };\n };\n\n var getSelectedNode = function (range) {\n var startContainer = range.startContainer, startOffset = range.startOffset;\n if (startContainer.hasChildNodes() && range.endOffset === startOffset + 1) {\n return startContainer.childNodes[startOffset];\n }\n return null;\n };\n var getNode = function (container, offset) {\n if (container.nodeType === 1 && container.hasChildNodes()) {\n if (offset >= container.childNodes.length) {\n offset = container.childNodes.length - 1;\n }\n container = container.childNodes[offset];\n }\n return container;\n };\n\n var extendingChars = new RegExp('[\\u0300-\\u036f\\u0483-\\u0487\\u0488-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u0610-\\u061a' + '\\u064b-\\u065f\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7-\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0' + '\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u08e3-\\u0902\\u093a\\u093c' + '\\u0941-\\u0948\\u094d\\u0951-\\u0957\\u0962-\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2-\\u09e3' + '\\u0a01-\\u0a02\\u0a3c\\u0a41-\\u0a42\\u0a47-\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70-\\u0a71\\u0a75\\u0a81-\\u0a82\\u0abc' + '\\u0ac1-\\u0ac5\\u0ac7-\\u0ac8\\u0acd\\u0ae2-\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57' + '\\u0b62-\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c00\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55-\\u0c56' + '\\u0c62-\\u0c63\\u0c81\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc-\\u0ccd\\u0cd5-\\u0cd6\\u0ce2-\\u0ce3\\u0d01\\u0d3e\\u0d41-\\u0d44' + '\\u0d4d\\u0d57\\u0d62-\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9' + '\\u0ebb-\\u0ebc\\u0ec8-\\u0ecd\\u0f18-\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97' + '\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039-\\u103a\\u103d-\\u103e\\u1058-\\u1059\\u105e-\\u1060\\u1071-\\u1074' + '\\u1082\\u1085-\\u1086\\u108d\\u109d\\u135d-\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752-\\u1753\\u1772-\\u1773\\u17b4-\\u17b5' + '\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927-\\u1928\\u1932\\u1939-\\u193b\\u1a17-\\u1a18' + '\\u1a1b\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1ab0-\\u1abd\\u1ABE\\u1b00-\\u1b03\\u1b34' + '\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80-\\u1b81\\u1ba2-\\u1ba5\\u1ba8-\\u1ba9\\u1bab-\\u1bad\\u1be6\\u1be8-\\u1be9' + '\\u1bed\\u1bef-\\u1bf1\\u1c2c-\\u1c33\\u1c36-\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1cf4\\u1cf8-\\u1cf9' + '\\u1dc0-\\u1df5\\u1dfc-\\u1dff\\u200c-\\u200d\\u20d0-\\u20dc\\u20DD-\\u20E0\\u20e1\\u20E2-\\u20E4\\u20e5-\\u20f0\\u2cef-\\u2cf1' + '\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302d\\u302e-\\u302f\\u3099-\\u309a\\ua66f\\uA670-\\uA672\\ua674-\\ua67d\\ua69e-\\ua69f\\ua6f0-\\ua6f1' + '\\ua802\\ua806\\ua80b\\ua825-\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc' + '\\ua9e5\\uaa29-\\uaa2e\\uaa31-\\uaa32\\uaa35-\\uaa36\\uaa43\\uaa4c\\uaa7c\\uaab0\\uaab2-\\uaab4\\uaab7-\\uaab8\\uaabe-\\uaabf\\uaac1' + '\\uaaec-\\uaaed\\uaaf6\\uabe5\\uabe8\\uabed\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\uff9e-\\uff9f]');\n var isExtendingChar = function (ch) {\n return typeof ch === 'string' && ch.charCodeAt(0) >= 768 && extendingChars.test(ch);\n };\n\n var lift2 = function (oa, ob, f) {\n return oa.isSome() && ob.isSome() ? Option.some(f(oa.getOrDie(), ob.getOrDie())) : Option.none();\n };\n var lift3 = function (oa, ob, oc, f) {\n return oa.isSome() && ob.isSome() && oc.isSome() ? Option.some(f(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Option.none();\n };\n\n var slice$2 = [].slice;\n var or = function () {\n var x = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n x[_i] = arguments[_i];\n }\n var args = slice$2.call(arguments);\n return function (x) {\n for (var i = 0; i < args.length; i++) {\n if (args[i](x)) {\n return true;\n }\n }\n return false;\n };\n };\n var and = function () {\n var x = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n x[_i] = arguments[_i];\n }\n var args = slice$2.call(arguments);\n return function (x) {\n for (var i = 0; i < args.length; i++) {\n if (!args[i](x)) {\n return false;\n }\n }\n return true;\n };\n };\n var Predicate = {\n and: and,\n or: or\n };\n\n var isElement$3 = NodeType.isElement;\n var isCaretCandidate$1 = isCaretCandidate;\n var isBlock$1 = NodeType.matchStyleValues('display', 'block table');\n var isFloated = NodeType.matchStyleValues('float', 'left right');\n var isValidElementCaretCandidate = Predicate.and(isElement$3, isCaretCandidate$1, not(isFloated));\n var isNotPre = not(NodeType.matchStyleValues('white-space', 'pre pre-line pre-wrap'));\n var isText$4 = NodeType.isText;\n var isBr$3 = NodeType.isBr;\n var nodeIndex = DOMUtils$1.nodeIndex;\n var resolveIndex = getNode;\n var createRange = function (doc) {\n return 'createRange' in doc ? doc.createRange() : DOMUtils$1.DOM.createRng();\n };\n var isWhiteSpace = function (chr) {\n return chr && /[\\r\\n\\t ]/.test(chr);\n };\n var isRange = function (rng) {\n return !!rng.setStart && !!rng.setEnd;\n };\n var isHiddenWhiteSpaceRange = function (range) {\n var container = range.startContainer;\n var offset = range.startOffset;\n var text;\n if (isWhiteSpace(range.toString()) && isNotPre(container.parentNode) && NodeType.isText(container)) {\n text = container.data;\n if (isWhiteSpace(text[offset - 1]) || isWhiteSpace(text[offset + 1])) {\n return true;\n }\n }\n return false;\n };\n var getBrClientRect = function (brNode) {\n var doc = brNode.ownerDocument;\n var rng = createRange(doc);\n var nbsp = doc.createTextNode('\\xA0');\n var parentNode = brNode.parentNode;\n var clientRect;\n parentNode.insertBefore(nbsp, brNode);\n rng.setStart(nbsp, 0);\n rng.setEnd(nbsp, 1);\n clientRect = clone$1(rng.getBoundingClientRect());\n parentNode.removeChild(nbsp);\n return clientRect;\n };\n var getBoundingClientRectWebKitText = function (rng) {\n var sc = rng.startContainer;\n var ec = rng.endContainer;\n var so = rng.startOffset;\n var eo = rng.endOffset;\n if (sc === ec && NodeType.isText(ec) && so === 0 && eo === 1) {\n var newRng = rng.cloneRange();\n newRng.setEndAfter(ec);\n return getBoundingClientRect(newRng);\n } else {\n return null;\n }\n };\n var isZeroRect = function (r) {\n return r.left === 0 && r.right === 0 && r.top === 0 && r.bottom === 0;\n };\n var getBoundingClientRect = function (item) {\n var clientRect, clientRects;\n clientRects = item.getClientRects();\n if (clientRects.length > 0) {\n clientRect = clone$1(clientRects[0]);\n } else {\n clientRect = clone$1(item.getBoundingClientRect());\n }\n if (!isRange(item) && isBr$3(item) && isZeroRect(clientRect)) {\n return getBrClientRect(item);\n }\n if (isZeroRect(clientRect) && isRange(item)) {\n return getBoundingClientRectWebKitText(item);\n }\n return clientRect;\n };\n var collapseAndInflateWidth = function (clientRect, toStart) {\n var newClientRect = collapse(clientRect, toStart);\n newClientRect.width = 1;\n newClientRect.right = newClientRect.left + 1;\n return newClientRect;\n };\n var getCaretPositionClientRects = function (caretPosition) {\n var clientRects = [];\n var beforeNode, node;\n var addUniqueAndValidRect = function (clientRect) {\n if (clientRect.height === 0) {\n return;\n }\n if (clientRects.length > 0) {\n if (isEqual(clientRect, clientRects[clientRects.length - 1])) {\n return;\n }\n }\n clientRects.push(clientRect);\n };\n var addCharacterOffset = function (container, offset) {\n var range = createRange(container.ownerDocument);\n if (offset < container.data.length) {\n if (isExtendingChar(container.data[offset])) {\n return clientRects;\n }\n if (isExtendingChar(container.data[offset - 1])) {\n range.setStart(container, offset);\n range.setEnd(container, offset + 1);\n if (!isHiddenWhiteSpaceRange(range)) {\n addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false));\n return clientRects;\n }\n }\n }\n if (offset > 0) {\n range.setStart(container, offset - 1);\n range.setEnd(container, offset);\n if (!isHiddenWhiteSpaceRange(range)) {\n addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false));\n }\n }\n if (offset < container.data.length) {\n range.setStart(container, offset);\n range.setEnd(container, offset + 1);\n if (!isHiddenWhiteSpaceRange(range)) {\n addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), true));\n }\n }\n };\n if (isText$4(caretPosition.container())) {\n addCharacterOffset(caretPosition.container(), caretPosition.offset());\n return clientRects;\n }\n if (isElement$3(caretPosition.container())) {\n if (caretPosition.isAtEnd()) {\n node = resolveIndex(caretPosition.container(), caretPosition.offset());\n if (isText$4(node)) {\n addCharacterOffset(node, node.data.length);\n }\n if (isValidElementCaretCandidate(node) && !isBr$3(node)) {\n addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false));\n }\n } else {\n node = resolveIndex(caretPosition.container(), caretPosition.offset());\n if (isText$4(node)) {\n addCharacterOffset(node, 0);\n }\n if (isValidElementCaretCandidate(node) && caretPosition.isAtEnd()) {\n addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false));\n return clientRects;\n }\n beforeNode = resolveIndex(caretPosition.container(), caretPosition.offset() - 1);\n if (isValidElementCaretCandidate(beforeNode) && !isBr$3(beforeNode)) {\n if (isBlock$1(beforeNode) || isBlock$1(node) || !isValidElementCaretCandidate(node)) {\n addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(beforeNode), false));\n }\n }\n if (isValidElementCaretCandidate(node)) {\n addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), true));\n }\n }\n }\n return clientRects;\n };\n function CaretPosition(container, offset, clientRects) {\n var isAtStart = function () {\n if (isText$4(container)) {\n return offset === 0;\n }\n return offset === 0;\n };\n var isAtEnd = function () {\n if (isText$4(container)) {\n return offset >= container.data.length;\n }\n return offset >= container.childNodes.length;\n };\n var toRange = function () {\n var range;\n range = createRange(container.ownerDocument);\n range.setStart(container, offset);\n range.setEnd(container, offset);\n return range;\n };\n var getClientRects = function () {\n if (!clientRects) {\n clientRects = getCaretPositionClientRects(CaretPosition(container, offset));\n }\n return clientRects;\n };\n var isVisible = function () {\n return getClientRects().length > 0;\n };\n var isEqual = function (caretPosition) {\n return caretPosition && container === caretPosition.container() && offset === caretPosition.offset();\n };\n var getNode = function (before) {\n return resolveIndex(container, before ? offset - 1 : offset);\n };\n return {\n container: constant(container),\n offset: constant(offset),\n toRange: toRange,\n getClientRects: getClientRects,\n isVisible: isVisible,\n isAtStart: isAtStart,\n isAtEnd: isAtEnd,\n isEqual: isEqual,\n getNode: getNode\n };\n }\n (function (CaretPosition) {\n CaretPosition.fromRangeStart = function (range) {\n return CaretPosition(range.startContainer, range.startOffset);\n };\n CaretPosition.fromRangeEnd = function (range) {\n return CaretPosition(range.endContainer, range.endOffset);\n };\n CaretPosition.after = function (node) {\n return CaretPosition(node.parentNode, nodeIndex(node) + 1);\n };\n CaretPosition.before = function (node) {\n return CaretPosition(node.parentNode, nodeIndex(node));\n };\n CaretPosition.isAbove = function (pos1, pos2) {\n return lift2(head(pos2.getClientRects()), last(pos1.getClientRects()), isAbove).getOr(false);\n };\n CaretPosition.isBelow = function (pos1, pos2) {\n return lift2(last(pos2.getClientRects()), head(pos1.getClientRects()), isBelow).getOr(false);\n };\n CaretPosition.isAtStart = function (pos) {\n return pos ? pos.isAtStart() : false;\n };\n CaretPosition.isAtEnd = function (pos) {\n return pos ? pos.isAtEnd() : false;\n };\n CaretPosition.isTextPosition = function (pos) {\n return pos ? NodeType.isText(pos.container()) : false;\n };\n CaretPosition.isElementPosition = function (pos) {\n return CaretPosition.isTextPosition(pos) === false;\n };\n }(CaretPosition || (CaretPosition = {})));\n var CaretPosition$1 = CaretPosition;\n\n var isText$5 = NodeType.isText;\n var isBogus$1 = NodeType.isBogus;\n var nodeIndex$1 = DOMUtils$1.nodeIndex;\n var normalizedParent = function (node) {\n var parentNode = node.parentNode;\n if (isBogus$1(parentNode)) {\n return normalizedParent(parentNode);\n }\n return parentNode;\n };\n var getChildNodes = function (node) {\n if (!node) {\n return [];\n }\n return ArrUtils.reduce(node.childNodes, function (result, node) {\n if (isBogus$1(node) && node.nodeName !== 'BR') {\n result = result.concat(getChildNodes(node));\n } else {\n result.push(node);\n }\n return result;\n }, []);\n };\n var normalizedTextOffset = function (node, offset) {\n while (node = node.previousSibling) {\n if (!isText$5(node)) {\n break;\n }\n offset += node.data.length;\n }\n return offset;\n };\n var equal = function (a) {\n return function (b) {\n return a === b;\n };\n };\n var normalizedNodeIndex = function (node) {\n var nodes, index, numTextFragments;\n nodes = getChildNodes(normalizedParent(node));\n index = ArrUtils.findIndex(nodes, equal(node), node);\n nodes = nodes.slice(0, index + 1);\n numTextFragments = ArrUtils.reduce(nodes, function (result, node, i) {\n if (isText$5(node) && isText$5(nodes[i - 1])) {\n result++;\n }\n return result;\n }, 0);\n nodes = ArrUtils.filter(nodes, NodeType.matchNodeNames(node.nodeName));\n index = ArrUtils.findIndex(nodes, equal(node), node);\n return index - numTextFragments;\n };\n var createPathItem = function (node) {\n var name;\n if (isText$5(node)) {\n name = 'text()';\n } else {\n name = node.nodeName.toLowerCase();\n }\n return name + '[' + normalizedNodeIndex(node) + ']';\n };\n var parentsUntil = function (root, node, predicate) {\n var parents = [];\n for (node = node.parentNode; node !== root; node = node.parentNode) {\n if (predicate && predicate(node)) {\n break;\n }\n parents.push(node);\n }\n return parents;\n };\n var create$2 = function (root, caretPosition) {\n var container, offset, path = [], outputOffset, childNodes, parents;\n container = caretPosition.container();\n offset = caretPosition.offset();\n if (isText$5(container)) {\n outputOffset = normalizedTextOffset(container, offset);\n } else {\n childNodes = container.childNodes;\n if (offset >= childNodes.length) {\n outputOffset = 'after';\n offset = childNodes.length - 1;\n } else {\n outputOffset = 'before';\n }\n container = childNodes[offset];\n }\n path.push(createPathItem(container));\n parents = parentsUntil(root, container);\n parents = ArrUtils.filter(parents, not(NodeType.isBogus));\n path = path.concat(ArrUtils.map(parents, function (node) {\n return createPathItem(node);\n }));\n return path.reverse().join('/') + ',' + outputOffset;\n };\n var resolvePathItem = function (node, name, index) {\n var nodes = getChildNodes(node);\n nodes = ArrUtils.filter(nodes, function (node, index) {\n return !isText$5(node) || !isText$5(nodes[index - 1]);\n });\n nodes = ArrUtils.filter(nodes, NodeType.matchNodeNames(name));\n return nodes[index];\n };\n var findTextPosition = function (container, offset) {\n var node = container, targetOffset = 0, dataLen;\n while (isText$5(node)) {\n dataLen = node.data.length;\n if (offset >= targetOffset && offset <= targetOffset + dataLen) {\n container = node;\n offset = offset - targetOffset;\n break;\n }\n if (!isText$5(node.nextSibling)) {\n container = node;\n offset = dataLen;\n break;\n }\n targetOffset += dataLen;\n node = node.nextSibling;\n }\n if (isText$5(container) && offset > container.data.length) {\n offset = container.data.length;\n }\n return CaretPosition$1(container, offset);\n };\n var resolve$2 = function (root, path) {\n var parts, container, offset;\n if (!path) {\n return null;\n }\n parts = path.split(',');\n path = parts[0].split('/');\n offset = parts.length > 1 ? parts[1] : 'before';\n container = ArrUtils.reduce(path, function (result, value) {\n value = /([\\w\\-\\(\\)]+)\\[([0-9]+)\\]/.exec(value);\n if (!value) {\n return null;\n }\n if (value[1] === 'text()') {\n value[1] = '#text';\n }\n return resolvePathItem(result, value[1], parseInt(value[2], 10));\n }, root);\n if (!container) {\n return null;\n }\n if (!isText$5(container)) {\n if (offset === 'after') {\n offset = nodeIndex$1(container) + 1;\n } else {\n offset = nodeIndex$1(container);\n }\n return CaretPosition$1(container.parentNode, offset);\n }\n return findTextPosition(container, parseInt(offset, 10));\n };\n\n var trimEmptyTextNode = function (dom, node) {\n if (NodeType.isText(node) && node.data.length === 0) {\n dom.remove(node);\n }\n };\n var insertNode = function (dom, rng, node) {\n rng.insertNode(node);\n trimEmptyTextNode(dom, node.previousSibling);\n trimEmptyTextNode(dom, node.nextSibling);\n };\n var insertFragment = function (dom, rng, frag) {\n var firstChild = Option.from(frag.firstChild);\n var lastChild = Option.from(frag.lastChild);\n rng.insertNode(frag);\n firstChild.each(function (child) {\n return trimEmptyTextNode(dom, child.previousSibling);\n });\n lastChild.each(function (child) {\n return trimEmptyTextNode(dom, child.nextSibling);\n });\n };\n var rangeInsertNode = function (dom, rng, node) {\n if (NodeType.isDocumentFragment(node)) {\n insertFragment(dom, rng, node);\n } else {\n insertNode(dom, rng, node);\n }\n };\n\n var isContentEditableFalse$2 = NodeType.isContentEditableFalse;\n var getNormalizedTextOffset = function (trim, container, offset) {\n var node, trimmedOffset;\n trimmedOffset = trim(container.data.slice(0, offset)).length;\n for (node = container.previousSibling; node && NodeType.isText(node); node = node.previousSibling) {\n trimmedOffset += trim(node.data).length;\n }\n return trimmedOffset;\n };\n var getPoint = function (dom, trim, normalized, rng, start) {\n var container = rng[start ? 'startContainer' : 'endContainer'];\n var offset = rng[start ? 'startOffset' : 'endOffset'];\n var point = [];\n var childNodes, after = 0;\n var root = dom.getRoot();\n if (NodeType.isText(container)) {\n point.push(normalized ? getNormalizedTextOffset(trim, container, offset) : offset);\n } else {\n childNodes = container.childNodes;\n if (offset >= childNodes.length && childNodes.length) {\n after = 1;\n offset = Math.max(0, childNodes.length - 1);\n }\n point.push(dom.nodeIndex(childNodes[offset], normalized) + after);\n }\n for (; container && container !== root; container = container.parentNode) {\n point.push(dom.nodeIndex(container, normalized));\n }\n return point;\n };\n var getLocation = function (trim, selection, normalized, rng) {\n var dom = selection.dom, bookmark = {};\n bookmark.start = getPoint(dom, trim, normalized, rng, true);\n if (!selection.isCollapsed()) {\n bookmark.end = getPoint(dom, trim, normalized, rng, false);\n }\n return bookmark;\n };\n var findIndex$2 = function (dom, name, element) {\n var count = 0;\n Tools.each(dom.select(name), function (node) {\n if (node.getAttribute('data-mce-bogus') === 'all') {\n return;\n }\n if (node === element) {\n return false;\n }\n count++;\n });\n return count;\n };\n var moveEndPoint = function (rng, start) {\n var container, offset, childNodes;\n var prefix = start ? 'start' : 'end';\n container = rng[prefix + 'Container'];\n offset = rng[prefix + 'Offset'];\n if (NodeType.isElement(container) && container.nodeName === 'TR') {\n childNodes = container.childNodes;\n container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)];\n if (container) {\n offset = start ? 0 : container.childNodes.length;\n rng['set' + (start ? 'Start' : 'End')](container, offset);\n }\n }\n };\n var normalizeTableCellSelection = function (rng) {\n moveEndPoint(rng, true);\n moveEndPoint(rng, false);\n return rng;\n };\n var findSibling = function (node, offset) {\n var sibling;\n if (NodeType.isElement(node)) {\n node = getNode(node, offset);\n if (isContentEditableFalse$2(node)) {\n return node;\n }\n }\n if (isCaretContainer(node)) {\n if (NodeType.isText(node) && isCaretContainerBlock(node)) {\n node = node.parentNode;\n }\n sibling = node.previousSibling;\n if (isContentEditableFalse$2(sibling)) {\n return sibling;\n }\n sibling = node.nextSibling;\n if (isContentEditableFalse$2(sibling)) {\n return sibling;\n }\n }\n };\n var findAdjacentContentEditableFalseElm = function (rng) {\n return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset);\n };\n var getOffsetBookmark = function (trim, normalized, selection) {\n var element = selection.getNode();\n var name = element ? element.nodeName : null;\n var rng = selection.getRng();\n if (isContentEditableFalse$2(element) || name === 'IMG') {\n return {\n name: name,\n index: findIndex$2(selection.dom, name, element)\n };\n }\n var sibling = findAdjacentContentEditableFalseElm(rng);\n if (sibling) {\n name = sibling.tagName;\n return {\n name: name,\n index: findIndex$2(selection.dom, name, sibling)\n };\n }\n return getLocation(trim, selection, normalized, rng);\n };\n var getCaretBookmark = function (selection) {\n var rng = selection.getRng();\n return {\n start: create$2(selection.dom.getRoot(), CaretPosition$1.fromRangeStart(rng)),\n end: create$2(selection.dom.getRoot(), CaretPosition$1.fromRangeEnd(rng))\n };\n };\n var getRangeBookmark = function (selection) {\n return { rng: selection.getRng() };\n };\n var createBookmarkSpan = function (dom, id, filled) {\n var args = {\n 'data-mce-type': 'bookmark',\n 'id': id,\n 'style': 'overflow:hidden;line-height:0px'\n };\n return filled ? dom.create('span', args, '') : dom.create('span', args);\n };\n var getPersistentBookmark = function (selection, filled) {\n var dom = selection.dom;\n var rng = selection.getRng();\n var id = dom.uniqueId();\n var collapsed = selection.isCollapsed();\n var element = selection.getNode();\n var name = element.nodeName;\n if (name === 'IMG') {\n return {\n name: name,\n index: findIndex$2(dom, name, element)\n };\n }\n var rng2 = normalizeTableCellSelection(rng.cloneRange());\n if (!collapsed) {\n rng2.collapse(false);\n var endBookmarkNode = createBookmarkSpan(dom, id + '_end', filled);\n rangeInsertNode(dom, rng2, endBookmarkNode);\n }\n rng = normalizeTableCellSelection(rng);\n rng.collapse(true);\n var startBookmarkNode = createBookmarkSpan(dom, id + '_start', filled);\n rangeInsertNode(dom, rng, startBookmarkNode);\n selection.moveToBookmark({\n id: id,\n keep: 1\n });\n return { id: id };\n };\n var getBookmark = function (selection, type, normalized) {\n if (type === 2) {\n return getOffsetBookmark(Zwsp.trim, normalized, selection);\n } else if (type === 3) {\n return getCaretBookmark(selection);\n } else if (type) {\n return getRangeBookmark(selection);\n } else {\n return getPersistentBookmark(selection, false);\n }\n };\n var GetBookmark = {\n getBookmark: getBookmark,\n getUndoBookmark: curry(getOffsetBookmark, identity, true),\n getPersistentBookmark: getPersistentBookmark\n };\n\n var CARET_ID = '_mce_caret';\n var isCaretNode = function (node) {\n return NodeType.isElement(node) && node.id === CARET_ID;\n };\n var getParentCaretContainer = function (body, node) {\n while (node && node !== body) {\n if (node.id === CARET_ID) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n };\n\n var isElement$4 = NodeType.isElement;\n var isText$6 = NodeType.isText;\n var removeNode = function (node) {\n var parentNode = node.parentNode;\n if (parentNode) {\n parentNode.removeChild(node);\n }\n };\n var getNodeValue = function (node) {\n try {\n return node.nodeValue;\n } catch (ex) {\n return '';\n }\n };\n var setNodeValue = function (node, text) {\n if (text.length === 0) {\n removeNode(node);\n } else {\n node.nodeValue = text;\n }\n };\n var trimCount = function (text) {\n var trimmedText = Zwsp.trim(text);\n return {\n count: text.length - trimmedText.length,\n text: trimmedText\n };\n };\n var removeUnchanged = function (caretContainer, pos) {\n remove$5(caretContainer);\n return pos;\n };\n var removeTextAndReposition = function (caretContainer, pos) {\n var before = trimCount(caretContainer.data.substr(0, pos.offset()));\n var after = trimCount(caretContainer.data.substr(pos.offset()));\n var text = before.text + after.text;\n if (text.length > 0) {\n setNodeValue(caretContainer, text);\n return CaretPosition$1(caretContainer, pos.offset() - before.count);\n } else {\n return pos;\n }\n };\n var removeElementAndReposition = function (caretContainer, pos) {\n var parentNode = pos.container();\n var newPosition = indexOf(from$1(parentNode.childNodes), caretContainer).map(function (index) {\n return index < pos.offset() ? CaretPosition$1(parentNode, pos.offset() - 1) : pos;\n }).getOr(pos);\n remove$5(caretContainer);\n return newPosition;\n };\n var removeTextCaretContainer = function (caretContainer, pos) {\n return isText$6(caretContainer) && pos.container() === caretContainer ? removeTextAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);\n };\n var removeElementCaretContainer = function (caretContainer, pos) {\n return pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);\n };\n var removeAndReposition = function (container, pos) {\n return CaretPosition$1.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos);\n };\n var remove$5 = function (caretContainerNode) {\n if (isElement$4(caretContainerNode) && isCaretContainer(caretContainerNode)) {\n if (hasContent(caretContainerNode)) {\n caretContainerNode.removeAttribute('data-mce-caret');\n } else {\n removeNode(caretContainerNode);\n }\n }\n if (isText$6(caretContainerNode)) {\n var text = Zwsp.trim(getNodeValue(caretContainerNode));\n setNodeValue(caretContainerNode, text);\n }\n };\n var CaretContainerRemove = {\n removeAndReposition: removeAndReposition,\n remove: remove$5\n };\n\n var browser$2 = PlatformDetection$1.detect().browser;\n var isContentEditableFalse$3 = NodeType.isContentEditableFalse;\n var isTableCell$1 = function (node) {\n return NodeType.isElement(node) && /^(TD|TH)$/i.test(node.tagName);\n };\n var getAbsoluteClientRect = function (root, element, before) {\n var clientRect = collapse(element.getBoundingClientRect(), before);\n var docElm, scrollX, scrollY, margin, rootRect;\n if (root.tagName === 'BODY') {\n docElm = root.ownerDocument.documentElement;\n scrollX = root.scrollLeft || docElm.scrollLeft;\n scrollY = root.scrollTop || docElm.scrollTop;\n } else {\n rootRect = root.getBoundingClientRect();\n scrollX = root.scrollLeft - rootRect.left;\n scrollY = root.scrollTop - rootRect.top;\n }\n clientRect.left += scrollX;\n clientRect.right += scrollX;\n clientRect.top += scrollY;\n clientRect.bottom += scrollY;\n clientRect.width = 1;\n margin = element.offsetWidth - element.clientWidth;\n if (margin > 0) {\n if (before) {\n margin *= -1;\n }\n clientRect.left += margin;\n clientRect.right += margin;\n }\n return clientRect;\n };\n var trimInlineCaretContainers = function (root) {\n var contentEditableFalseNodes, node, sibling, i, data;\n contentEditableFalseNodes = DomQuery('*[contentEditable=false]', root);\n for (i = 0; i < contentEditableFalseNodes.length; i++) {\n node = contentEditableFalseNodes[i];\n sibling = node.previousSibling;\n if (endsWithCaretContainer(sibling)) {\n data = sibling.data;\n if (data.length === 1) {\n sibling.parentNode.removeChild(sibling);\n } else {\n sibling.deleteData(data.length - 1, 1);\n }\n }\n sibling = node.nextSibling;\n if (startsWithCaretContainer(sibling)) {\n data = sibling.data;\n if (data.length === 1) {\n sibling.parentNode.removeChild(sibling);\n } else {\n sibling.deleteData(0, 1);\n }\n }\n }\n };\n var FakeCaret = function (root, isBlock, hasFocus) {\n var lastVisualCaret = Cell(Option.none());\n var cursorInterval, caretContainerNode;\n var show = function (before, element) {\n var clientRect, rng;\n hide();\n if (isTableCell$1(element)) {\n return null;\n }\n if (isBlock(element)) {\n caretContainerNode = insertBlock('p', element, before);\n clientRect = getAbsoluteClientRect(root, element, before);\n DomQuery(caretContainerNode).css('top', clientRect.top);\n var caret = DomQuery('
').css(clientRect).appendTo(root)[0];\n lastVisualCaret.set(Option.some({\n caret: caret,\n element: element,\n before: before\n }));\n lastVisualCaret.get().each(function (caretState) {\n if (before) {\n DomQuery(caretState.caret).addClass('mce-visual-caret-before');\n }\n });\n startBlink();\n rng = element.ownerDocument.createRange();\n rng.setStart(caretContainerNode, 0);\n rng.setEnd(caretContainerNode, 0);\n } else {\n caretContainerNode = insertInline(element, before);\n rng = element.ownerDocument.createRange();\n if (isContentEditableFalse$3(caretContainerNode.nextSibling)) {\n rng.setStart(caretContainerNode, 0);\n rng.setEnd(caretContainerNode, 0);\n } else {\n rng.setStart(caretContainerNode, 1);\n rng.setEnd(caretContainerNode, 1);\n }\n return rng;\n }\n return rng;\n };\n var hide = function () {\n trimInlineCaretContainers(root);\n if (caretContainerNode) {\n CaretContainerRemove.remove(caretContainerNode);\n caretContainerNode = null;\n }\n lastVisualCaret.get().each(function (caretState) {\n DomQuery(caretState.caret).remove();\n lastVisualCaret.set(Option.none());\n });\n clearInterval(cursorInterval);\n };\n var startBlink = function () {\n cursorInterval = Delay.setInterval(function () {\n if (hasFocus()) {\n DomQuery('div.mce-visual-caret', root).toggleClass('mce-visual-caret-hidden');\n } else {\n DomQuery('div.mce-visual-caret', root).addClass('mce-visual-caret-hidden');\n }\n }, 500);\n };\n var reposition = function () {\n lastVisualCaret.get().each(function (caretState) {\n var clientRect = getAbsoluteClientRect(root, caretState.element, caretState.before);\n DomQuery(caretState.caret).css(clientRect);\n });\n };\n var destroy = function () {\n return Delay.clearInterval(cursorInterval);\n };\n var getCss = function () {\n return '.mce-visual-caret {' + 'position: absolute;' + 'background-color: black;' + 'background-color: currentcolor;' + '}' + '.mce-visual-caret-hidden {' + 'display: none;' + '}' + '*[data-mce-caret] {' + 'position: absolute;' + 'left: -1000px;' + 'right: auto;' + 'top: 0;' + 'margin: 0;' + 'padding: 0;' + '}';\n };\n return {\n show: show,\n hide: hide,\n getCss: getCss,\n reposition: reposition,\n destroy: destroy\n };\n };\n var isFakeCaretTableBrowser = function () {\n return browser$2.isIE() || browser$2.isEdge() || browser$2.isFirefox();\n };\n var isFakeCaretTarget = function (node) {\n return isContentEditableFalse$3(node) || NodeType.isTable(node) && isFakeCaretTableBrowser();\n };\n\n var isContentEditableFalse$4 = NodeType.isContentEditableFalse;\n var isBlockLike = NodeType.matchStyleValues('display', 'block table table-cell table-caption list-item');\n var isCaretContainer$2 = isCaretContainer;\n var isCaretContainerBlock$1 = isCaretContainerBlock;\n var isElement$5 = NodeType.isElement;\n var isCaretCandidate$2 = isCaretCandidate;\n var isForwards = function (direction) {\n return direction > 0;\n };\n var isBackwards = function (direction) {\n return direction < 0;\n };\n var skipCaretContainers = function (walk, shallow) {\n var node;\n while (node = walk(shallow)) {\n if (!isCaretContainerBlock$1(node)) {\n return node;\n }\n }\n return null;\n };\n var findNode = function (node, direction, predicateFn, rootNode, shallow) {\n var walker = new TreeWalker(node, rootNode);\n if (isBackwards(direction)) {\n if (isContentEditableFalse$4(node) || isCaretContainerBlock$1(node)) {\n node = skipCaretContainers(walker.prev, true);\n if (predicateFn(node)) {\n return node;\n }\n }\n while (node = skipCaretContainers(walker.prev, shallow)) {\n if (predicateFn(node)) {\n return node;\n }\n }\n }\n if (isForwards(direction)) {\n if (isContentEditableFalse$4(node) || isCaretContainerBlock$1(node)) {\n node = skipCaretContainers(walker.next, true);\n if (predicateFn(node)) {\n return node;\n }\n }\n while (node = skipCaretContainers(walker.next, shallow)) {\n if (predicateFn(node)) {\n return node;\n }\n }\n }\n return null;\n };\n var getParentBlock = function (node, rootNode) {\n while (node && node !== rootNode) {\n if (isBlockLike(node)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n };\n var isInSameBlock = function (caretPosition1, caretPosition2, rootNode) {\n return getParentBlock(caretPosition1.container(), rootNode) === getParentBlock(caretPosition2.container(), rootNode);\n };\n var getChildNodeAtRelativeOffset = function (relativeOffset, caretPosition) {\n var container, offset;\n if (!caretPosition) {\n return null;\n }\n container = caretPosition.container();\n offset = caretPosition.offset();\n if (!isElement$5(container)) {\n return null;\n }\n return container.childNodes[offset + relativeOffset];\n };\n var beforeAfter = function (before, node) {\n var range = node.ownerDocument.createRange();\n if (before) {\n range.setStartBefore(node);\n range.setEndBefore(node);\n } else {\n range.setStartAfter(node);\n range.setEndAfter(node);\n }\n return range;\n };\n var isNodesInSameBlock = function (root, node1, node2) {\n return getParentBlock(node1, root) === getParentBlock(node2, root);\n };\n var lean = function (left, root, node) {\n var sibling, siblingName;\n if (left) {\n siblingName = 'previousSibling';\n } else {\n siblingName = 'nextSibling';\n }\n while (node && node !== root) {\n sibling = node[siblingName];\n if (isCaretContainer$2(sibling)) {\n sibling = sibling[siblingName];\n }\n if (isContentEditableFalse$4(sibling)) {\n if (isNodesInSameBlock(root, sibling, node)) {\n return sibling;\n }\n break;\n }\n if (isCaretCandidate$2(sibling)) {\n break;\n }\n node = node.parentNode;\n }\n return null;\n };\n var before$2 = curry(beforeAfter, true);\n var after$1 = curry(beforeAfter, false);\n var normalizeRange = function (direction, root, range) {\n var node, container, offset, location;\n var leanLeft = curry(lean, true, root);\n var leanRight = curry(lean, false, root);\n container = range.startContainer;\n offset = range.startOffset;\n if (isCaretContainerBlock(container)) {\n if (!isElement$5(container)) {\n container = container.parentNode;\n }\n location = container.getAttribute('data-mce-caret');\n if (location === 'before') {\n node = container.nextSibling;\n if (isFakeCaretTarget(node)) {\n return before$2(node);\n }\n }\n if (location === 'after') {\n node = container.previousSibling;\n if (isFakeCaretTarget(node)) {\n return after$1(node);\n }\n }\n }\n if (!range.collapsed) {\n return range;\n }\n if (NodeType.isText(container)) {\n if (isCaretContainer$2(container)) {\n if (direction === 1) {\n node = leanRight(container);\n if (node) {\n return before$2(node);\n }\n node = leanLeft(container);\n if (node) {\n return after$1(node);\n }\n }\n if (direction === -1) {\n node = leanLeft(container);\n if (node) {\n return after$1(node);\n }\n node = leanRight(container);\n if (node) {\n return before$2(node);\n }\n }\n return range;\n }\n if (endsWithCaretContainer(container) && offset >= container.data.length - 1) {\n if (direction === 1) {\n node = leanRight(container);\n if (node) {\n return before$2(node);\n }\n }\n return range;\n }\n if (startsWithCaretContainer(container) && offset <= 1) {\n if (direction === -1) {\n node = leanLeft(container);\n if (node) {\n return after$1(node);\n }\n }\n return range;\n }\n if (offset === container.data.length) {\n node = leanRight(container);\n if (node) {\n return before$2(node);\n }\n return range;\n }\n if (offset === 0) {\n node = leanLeft(container);\n if (node) {\n return after$1(node);\n }\n return range;\n }\n }\n return range;\n };\n var getRelativeCefElm = function (forward, caretPosition) {\n return Option.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, caretPosition)).filter(isContentEditableFalse$4);\n };\n var getNormalizedRangeEndPoint = function (direction, root, range) {\n var normalizedRange = normalizeRange(direction, root, range);\n if (direction === -1) {\n return CaretPosition.fromRangeStart(normalizedRange);\n }\n return CaretPosition.fromRangeEnd(normalizedRange);\n };\n var getElementFromPosition = function (pos) {\n return Option.from(pos.getNode()).map(Element.fromDom);\n };\n var getElementFromPrevPosition = function (pos) {\n return Option.from(pos.getNode(true)).map(Element.fromDom);\n };\n var getVisualCaretPosition = function (walkFn, caretPosition) {\n while (caretPosition = walkFn(caretPosition)) {\n if (caretPosition.isVisible()) {\n return caretPosition;\n }\n }\n return caretPosition;\n };\n var isMoveInsideSameBlock = function (from, to) {\n var inSameBlock = isInSameBlock(from, to);\n if (!inSameBlock && NodeType.isBr(from.getNode())) {\n return true;\n }\n return inSameBlock;\n };\n\n var HDirection;\n (function (HDirection) {\n HDirection[HDirection['Backwards'] = -1] = 'Backwards';\n HDirection[HDirection['Forwards'] = 1] = 'Forwards';\n }(HDirection || (HDirection = {})));\n var isContentEditableFalse$5 = NodeType.isContentEditableFalse;\n var isText$7 = NodeType.isText;\n var isElement$6 = NodeType.isElement;\n var isBr$4 = NodeType.isBr;\n var isCaretCandidate$3 = isCaretCandidate;\n var isAtomic$1 = isAtomic;\n var isEditableCaretCandidate$1 = isEditableCaretCandidate;\n var getParents = function (node, root) {\n var parents = [];\n while (node && node !== root) {\n parents.push(node);\n node = node.parentNode;\n }\n return parents;\n };\n var nodeAtIndex = function (container, offset) {\n if (container.hasChildNodes() && offset < container.childNodes.length) {\n return container.childNodes[offset];\n }\n return null;\n };\n var getCaretCandidatePosition = function (direction, node) {\n if (isForwards(direction)) {\n if (isCaretCandidate$3(node.previousSibling) && !isText$7(node.previousSibling)) {\n return CaretPosition$1.before(node);\n }\n if (isText$7(node)) {\n return CaretPosition$1(node, 0);\n }\n }\n if (isBackwards(direction)) {\n if (isCaretCandidate$3(node.nextSibling) && !isText$7(node.nextSibling)) {\n return CaretPosition$1.after(node);\n }\n if (isText$7(node)) {\n return CaretPosition$1(node, node.data.length);\n }\n }\n if (isBackwards(direction)) {\n if (isBr$4(node)) {\n return CaretPosition$1.before(node);\n }\n return CaretPosition$1.after(node);\n }\n return CaretPosition$1.before(node);\n };\n var moveForwardFromBr = function (root, nextNode) {\n var nextSibling = nextNode.nextSibling;\n if (nextSibling && isCaretCandidate$3(nextSibling)) {\n if (isText$7(nextSibling)) {\n return CaretPosition$1(nextSibling, 0);\n } else {\n return CaretPosition$1.before(nextSibling);\n }\n } else {\n return findCaretPosition(HDirection.Forwards, CaretPosition$1.after(nextNode), root);\n }\n };\n var findCaretPosition = function (direction, startPos, root) {\n var node, nextNode, innerNode;\n var rootContentEditableFalseElm, caretPosition;\n if (!isElement$6(root) || !startPos) {\n return null;\n }\n if (startPos.isEqual(CaretPosition$1.after(root)) && root.lastChild) {\n caretPosition = CaretPosition$1.after(root.lastChild);\n if (isBackwards(direction) && isCaretCandidate$3(root.lastChild) && isElement$6(root.lastChild)) {\n return isBr$4(root.lastChild) ? CaretPosition$1.before(root.lastChild) : caretPosition;\n }\n } else {\n caretPosition = startPos;\n }\n var container = caretPosition.container();\n var offset = caretPosition.offset();\n if (isText$7(container)) {\n if (isBackwards(direction) && offset > 0) {\n return CaretPosition$1(container, --offset);\n }\n if (isForwards(direction) && offset < container.length) {\n return CaretPosition$1(container, ++offset);\n }\n node = container;\n } else {\n if (isBackwards(direction) && offset > 0) {\n nextNode = nodeAtIndex(container, offset - 1);\n if (isCaretCandidate$3(nextNode)) {\n if (!isAtomic$1(nextNode)) {\n innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode);\n if (innerNode) {\n if (isText$7(innerNode)) {\n return CaretPosition$1(innerNode, innerNode.data.length);\n }\n return CaretPosition$1.after(innerNode);\n }\n }\n if (isText$7(nextNode)) {\n return CaretPosition$1(nextNode, nextNode.data.length);\n }\n return CaretPosition$1.before(nextNode);\n }\n }\n if (isForwards(direction) && offset < container.childNodes.length) {\n nextNode = nodeAtIndex(container, offset);\n if (isCaretCandidate$3(nextNode)) {\n if (isBr$4(nextNode)) {\n return moveForwardFromBr(root, nextNode);\n }\n if (!isAtomic$1(nextNode)) {\n innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode);\n if (innerNode) {\n if (isText$7(innerNode)) {\n return CaretPosition$1(innerNode, 0);\n }\n return CaretPosition$1.before(innerNode);\n }\n }\n if (isText$7(nextNode)) {\n return CaretPosition$1(nextNode, 0);\n }\n return CaretPosition$1.after(nextNode);\n }\n }\n node = nextNode ? nextNode : caretPosition.getNode();\n }\n if (isForwards(direction) && caretPosition.isAtEnd() || isBackwards(direction) && caretPosition.isAtStart()) {\n node = findNode(node, direction, constant(true), root, true);\n if (isEditableCaretCandidate$1(node, root)) {\n return getCaretCandidatePosition(direction, node);\n }\n }\n nextNode = findNode(node, direction, isEditableCaretCandidate$1, root);\n rootContentEditableFalseElm = ArrUtils.last(filter(getParents(container, root), isContentEditableFalse$5));\n if (rootContentEditableFalseElm && (!nextNode || !rootContentEditableFalseElm.contains(nextNode))) {\n if (isForwards(direction)) {\n caretPosition = CaretPosition$1.after(rootContentEditableFalseElm);\n } else {\n caretPosition = CaretPosition$1.before(rootContentEditableFalseElm);\n }\n return caretPosition;\n }\n if (nextNode) {\n return getCaretCandidatePosition(direction, nextNode);\n }\n return null;\n };\n var CaretWalker = function (root) {\n return {\n next: function (caretPosition) {\n return findCaretPosition(HDirection.Forwards, caretPosition, root);\n },\n prev: function (caretPosition) {\n return findCaretPosition(HDirection.Backwards, caretPosition, root);\n }\n };\n };\n\n var walkToPositionIn = function (forward, root, start) {\n var position = forward ? CaretPosition$1.before(start) : CaretPosition$1.after(start);\n return fromPosition(forward, root, position);\n };\n var afterElement = function (node) {\n return NodeType.isBr(node) ? CaretPosition$1.before(node) : CaretPosition$1.after(node);\n };\n var isBeforeOrStart = function (position) {\n if (CaretPosition$1.isTextPosition(position)) {\n return position.offset() === 0;\n } else {\n return isCaretCandidate(position.getNode());\n }\n };\n var isAfterOrEnd = function (position) {\n if (CaretPosition$1.isTextPosition(position)) {\n var container = position.container();\n return position.offset() === container.data.length;\n } else {\n return isCaretCandidate(position.getNode(true));\n }\n };\n var isBeforeAfterSameElement = function (from, to) {\n return !CaretPosition$1.isTextPosition(from) && !CaretPosition$1.isTextPosition(to) && from.getNode() === to.getNode(true);\n };\n var isAtBr = function (position) {\n return !CaretPosition$1.isTextPosition(position) && NodeType.isBr(position.getNode());\n };\n var shouldSkipPosition = function (forward, from, to) {\n if (forward) {\n return !isBeforeAfterSameElement(from, to) && !isAtBr(from) && isAfterOrEnd(from) && isBeforeOrStart(to);\n } else {\n return !isBeforeAfterSameElement(to, from) && isBeforeOrStart(from) && isAfterOrEnd(to);\n }\n };\n var fromPosition = function (forward, root, pos) {\n var walker = CaretWalker(root);\n return Option.from(forward ? walker.next(pos) : walker.prev(pos));\n };\n var navigate = function (forward, root, from) {\n return fromPosition(forward, root, from).bind(function (to) {\n if (isInSameBlock(from, to, root) && shouldSkipPosition(forward, from, to)) {\n return fromPosition(forward, root, to);\n } else {\n return Option.some(to);\n }\n });\n };\n var navigateIgnore = function (forward, root, from, ignoreFilter) {\n return navigate(forward, root, from).bind(function (pos) {\n return ignoreFilter(pos) ? navigateIgnore(forward, root, pos, ignoreFilter) : Option.some(pos);\n });\n };\n var positionIn = function (forward, element) {\n var startNode = forward ? element.firstChild : element.lastChild;\n if (NodeType.isText(startNode)) {\n return Option.some(CaretPosition$1(startNode, forward ? 0 : startNode.data.length));\n } else if (startNode) {\n if (isCaretCandidate(startNode)) {\n return Option.some(forward ? CaretPosition$1.before(startNode) : afterElement(startNode));\n } else {\n return walkToPositionIn(forward, element, startNode);\n }\n } else {\n return Option.none();\n }\n };\n var nextPosition = curry(fromPosition, true);\n var prevPosition = curry(fromPosition, false);\n var CaretFinder = {\n fromPosition: fromPosition,\n nextPosition: nextPosition,\n prevPosition: prevPosition,\n navigate: navigate,\n navigateIgnore: navigateIgnore,\n positionIn: positionIn,\n firstPositionIn: curry(positionIn, true),\n lastPositionIn: curry(positionIn, false)\n };\n\n var isStringPathBookmark = function (bookmark) {\n return typeof bookmark.start === 'string';\n };\n var isRangeBookmark = function (bookmark) {\n return bookmark.hasOwnProperty('rng');\n };\n var isIdBookmark = function (bookmark) {\n return bookmark.hasOwnProperty('id');\n };\n var isIndexBookmark = function (bookmark) {\n return bookmark.hasOwnProperty('name');\n };\n var isPathBookmark = function (bookmark) {\n return Tools.isArray(bookmark.start);\n };\n\n var addBogus = function (dom, node) {\n if (NodeType.isElement(node) && dom.isBlock(node) && !node.innerHTML && !Env.ie) {\n node.innerHTML = '
';\n }\n return node;\n };\n var resolveCaretPositionBookmark = function (dom, bookmark) {\n var rng, pos;\n rng = dom.createRng();\n pos = resolve$2(dom.getRoot(), bookmark.start);\n rng.setStart(pos.container(), pos.offset());\n pos = resolve$2(dom.getRoot(), bookmark.end);\n rng.setEnd(pos.container(), pos.offset());\n return rng;\n };\n var insertZwsp = function (node, rng) {\n var textNode = node.ownerDocument.createTextNode(Zwsp.ZWSP);\n node.appendChild(textNode);\n rng.setStart(textNode, 0);\n rng.setEnd(textNode, 0);\n };\n var isEmpty = function (node) {\n return node.hasChildNodes() === false;\n };\n var tryFindRangePosition = function (node, rng) {\n return CaretFinder.lastPositionIn(node).fold(function () {\n return false;\n }, function (pos) {\n rng.setStart(pos.container(), pos.offset());\n rng.setEnd(pos.container(), pos.offset());\n return true;\n });\n };\n var padEmptyCaretContainer = function (root, node, rng) {\n if (isEmpty(node) && getParentCaretContainer(root, node)) {\n insertZwsp(node, rng);\n return true;\n } else {\n return false;\n }\n };\n var setEndPoint = function (dom, start, bookmark, rng) {\n var point = bookmark[start ? 'start' : 'end'];\n var i, node, offset, children;\n var root = dom.getRoot();\n if (point) {\n offset = point[0];\n for (node = root, i = point.length - 1; i >= 1; i--) {\n children = node.childNodes;\n if (padEmptyCaretContainer(root, node, rng)) {\n return true;\n }\n if (point[i] > children.length - 1) {\n if (padEmptyCaretContainer(root, node, rng)) {\n return true;\n }\n return tryFindRangePosition(node, rng);\n }\n node = children[point[i]];\n }\n if (node.nodeType === 3) {\n offset = Math.min(point[0], node.nodeValue.length);\n }\n if (node.nodeType === 1) {\n offset = Math.min(point[0], node.childNodes.length);\n }\n if (start) {\n rng.setStart(node, offset);\n } else {\n rng.setEnd(node, offset);\n }\n }\n return true;\n };\n var isValidTextNode = function (node) {\n return NodeType.isText(node) && node.data.length > 0;\n };\n var restoreEndPoint = function (dom, suffix, bookmark) {\n var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev;\n var keep = bookmark.keep;\n var container, offset;\n if (marker) {\n node = marker.parentNode;\n if (suffix === 'start') {\n if (!keep) {\n idx = dom.nodeIndex(marker);\n } else {\n if (marker.hasChildNodes()) {\n node = marker.firstChild;\n idx = 1;\n } else if (isValidTextNode(marker.nextSibling)) {\n node = marker.nextSibling;\n idx = 0;\n } else if (isValidTextNode(marker.previousSibling)) {\n node = marker.previousSibling;\n idx = marker.previousSibling.data.length;\n } else {\n node = marker.parentNode;\n idx = dom.nodeIndex(marker) + 1;\n }\n }\n container = node;\n offset = idx;\n } else {\n if (!keep) {\n idx = dom.nodeIndex(marker);\n } else {\n if (marker.hasChildNodes()) {\n node = marker.firstChild;\n idx = 1;\n } else if (isValidTextNode(marker.previousSibling)) {\n node = marker.previousSibling;\n idx = marker.previousSibling.data.length;\n } else {\n node = marker.parentNode;\n idx = dom.nodeIndex(marker);\n }\n }\n container = node;\n offset = idx;\n }\n if (!keep) {\n prev = marker.previousSibling;\n next = marker.nextSibling;\n Tools.each(Tools.grep(marker.childNodes), function (node) {\n if (NodeType.isText(node)) {\n node.nodeValue = node.nodeValue.replace(/\\uFEFF/g, '');\n }\n });\n while (marker = dom.get(bookmark.id + '_' + suffix)) {\n dom.remove(marker, true);\n }\n if (prev && next && prev.nodeType === next.nodeType && NodeType.isText(prev) && !Env.opera) {\n idx = prev.nodeValue.length;\n prev.appendData(next.nodeValue);\n dom.remove(next);\n if (suffix === 'start') {\n container = prev;\n offset = idx;\n } else {\n container = prev;\n offset = idx;\n }\n }\n }\n return Option.some(CaretPosition$1(container, offset));\n } else {\n return Option.none();\n }\n };\n var alt = function (o1, o2) {\n return o1.isSome() ? o1 : o2;\n };\n var resolvePaths = function (dom, bookmark) {\n var rng = dom.createRng();\n if (setEndPoint(dom, true, bookmark, rng) && setEndPoint(dom, false, bookmark, rng)) {\n return Option.some(rng);\n } else {\n return Option.none();\n }\n };\n var resolveId = function (dom, bookmark) {\n var startPos = restoreEndPoint(dom, 'start', bookmark);\n var endPos = restoreEndPoint(dom, 'end', bookmark);\n return lift2(startPos, alt(endPos, startPos), function (spos, epos) {\n var rng = dom.createRng();\n rng.setStart(addBogus(dom, spos.container()), spos.offset());\n rng.setEnd(addBogus(dom, epos.container()), epos.offset());\n return rng;\n });\n };\n var resolveIndex$1 = function (dom, bookmark) {\n return Option.from(dom.select(bookmark.name)[bookmark.index]).map(function (elm) {\n var rng = dom.createRng();\n rng.selectNode(elm);\n return rng;\n });\n };\n var resolve$3 = function (selection, bookmark) {\n var dom = selection.dom;\n if (bookmark) {\n if (isPathBookmark(bookmark)) {\n return resolvePaths(dom, bookmark);\n } else if (isStringPathBookmark(bookmark)) {\n return Option.some(resolveCaretPositionBookmark(dom, bookmark));\n } else if (isIdBookmark(bookmark)) {\n return resolveId(dom, bookmark);\n } else if (isIndexBookmark(bookmark)) {\n return resolveIndex$1(dom, bookmark);\n } else if (isRangeBookmark(bookmark)) {\n return Option.some(bookmark.rng);\n }\n }\n return Option.none();\n };\n var ResolveBookmark = { resolve: resolve$3 };\n\n var getBookmark$1 = function (selection, type, normalized) {\n return GetBookmark.getBookmark(selection, type, normalized);\n };\n var moveToBookmark = function (selection, bookmark) {\n ResolveBookmark.resolve(selection, bookmark).each(function (rng) {\n selection.setRng(rng);\n });\n };\n var isBookmarkNode$1 = function (node) {\n return NodeType.isElement(node) && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark';\n };\n var Bookmarks = {\n getBookmark: getBookmark$1,\n moveToBookmark: moveToBookmark,\n isBookmarkNode: isBookmarkNode$1\n };\n\n var isInlineBlock = function (node) {\n return node && /^(IMG)$/.test(node.nodeName);\n };\n var moveStart = function (dom, selection, rng) {\n var offset = rng.startOffset;\n var container = rng.startContainer, walker, node, nodes;\n if (rng.startContainer === rng.endContainer) {\n if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {\n return;\n }\n }\n if (container.nodeType === 1) {\n nodes = container.childNodes;\n if (offset < nodes.length) {\n container = nodes[offset];\n walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));\n } else {\n container = nodes[nodes.length - 1];\n walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));\n walker.next(true);\n }\n for (node = walker.current(); node; node = walker.next()) {\n if (node.nodeType === 3 && !isWhiteSpaceNode(node)) {\n rng.setStart(node, 0);\n selection.setRng(rng);\n return;\n }\n }\n }\n };\n var getNonWhiteSpaceSibling = function (node, next, inc) {\n if (node) {\n next = next ? 'nextSibling' : 'previousSibling';\n for (node = inc ? node : node[next]; node; node = node[next]) {\n if (node.nodeType === 1 || !isWhiteSpaceNode(node)) {\n return node;\n }\n }\n }\n };\n var isTextBlock$1 = function (editor, name) {\n if (name.nodeType) {\n name = name.nodeName;\n }\n return !!editor.schema.getTextBlockElements()[name.toLowerCase()];\n };\n var isValid = function (ed, parent, child) {\n return ed.schema.isValidChild(parent, child);\n };\n var isWhiteSpaceNode = function (node) {\n return node && node.nodeType === 3 && /^([\\t \\r\\n]+|)$/.test(node.nodeValue);\n };\n var replaceVars = function (value, vars) {\n if (typeof value !== 'string') {\n value = value(vars);\n } else if (vars) {\n value = value.replace(/%(\\w+)/g, function (str, name) {\n return vars[name] || str;\n });\n }\n return value;\n };\n var isEq = function (str1, str2) {\n str1 = str1 || '';\n str2 = str2 || '';\n str1 = '' + (str1.nodeName || str1);\n str2 = '' + (str2.nodeName || str2);\n return str1.toLowerCase() === str2.toLowerCase();\n };\n var normalizeStyleValue = function (dom, value, name) {\n if (name === 'color' || name === 'backgroundColor') {\n value = dom.toHex(value);\n }\n if (name === 'fontWeight' && value === 700) {\n value = 'bold';\n }\n if (name === 'fontFamily') {\n value = value.replace(/[\\'\\\"]/g, '').replace(/,\\s+/g, ',');\n }\n return '' + value;\n };\n var getStyle = function (dom, node, name) {\n return normalizeStyleValue(dom, dom.getStyle(node, name), name);\n };\n var getTextDecoration = function (dom, node) {\n var decoration;\n dom.getParent(node, function (n) {\n decoration = dom.getStyle(n, 'text-decoration');\n return decoration && decoration !== 'none';\n });\n return decoration;\n };\n var getParents$1 = function (dom, node, selector) {\n return dom.getParents(node, selector, dom.getRoot());\n };\n var FormatUtils = {\n isInlineBlock: isInlineBlock,\n moveStart: moveStart,\n getNonWhiteSpaceSibling: getNonWhiteSpaceSibling,\n isTextBlock: isTextBlock$1,\n isValid: isValid,\n isWhiteSpaceNode: isWhiteSpaceNode,\n replaceVars: replaceVars,\n isEq: isEq,\n normalizeStyleValue: normalizeStyleValue,\n getStyle: getStyle,\n getTextDecoration: getTextDecoration,\n getParents: getParents$1\n };\n\n var isBookmarkNode$2 = Bookmarks.isBookmarkNode;\n var getParents$2 = FormatUtils.getParents, isWhiteSpaceNode$1 = FormatUtils.isWhiteSpaceNode, isTextBlock$2 = FormatUtils.isTextBlock;\n var findLeaf = function (node, offset) {\n if (typeof offset === 'undefined') {\n offset = node.nodeType === 3 ? node.length : node.childNodes.length;\n }\n while (node && node.hasChildNodes()) {\n node = node.childNodes[offset];\n if (node) {\n offset = node.nodeType === 3 ? node.length : node.childNodes.length;\n }\n }\n return {\n node: node,\n offset: offset\n };\n };\n var excludeTrailingWhitespace = function (endContainer, endOffset) {\n var leaf = findLeaf(endContainer, endOffset);\n if (leaf.node) {\n while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling) {\n leaf = findLeaf(leaf.node.previousSibling);\n }\n if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 && leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') {\n if (leaf.offset > 1) {\n endContainer = leaf.node;\n endContainer.splitText(leaf.offset - 1);\n }\n }\n }\n return endContainer;\n };\n var isBogusBr = function (node) {\n return node.nodeName === 'BR' && node.getAttribute('data-mce-bogus') && !node.nextSibling;\n };\n var findParentContentEditable = function (dom, node) {\n var parent = node;\n while (parent) {\n if (parent.nodeType === 1 && dom.getContentEditable(parent)) {\n return dom.getContentEditable(parent) === 'false' ? parent : node;\n }\n parent = parent.parentNode;\n }\n return node;\n };\n var findSpace = function (start, remove, node, offset) {\n var pos, pos2;\n var str = node.nodeValue;\n if (typeof offset === 'undefined') {\n offset = start ? str.length : 0;\n }\n if (start) {\n pos = str.lastIndexOf(' ', offset);\n pos2 = str.lastIndexOf('\\xA0', offset);\n pos = pos > pos2 ? pos : pos2;\n if (pos !== -1 && !remove && (pos < offset || !start) && pos <= str.length) {\n pos++;\n }\n } else {\n pos = str.indexOf(' ', offset);\n pos2 = str.indexOf('\\xA0', offset);\n pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2;\n }\n return pos;\n };\n var findWordEndPoint = function (dom, body, container, offset, start, remove) {\n var walker, node, pos, lastTextNode;\n if (container.nodeType === 3) {\n pos = findSpace(start, remove, container, offset);\n if (pos !== -1) {\n return {\n container: container,\n offset: pos\n };\n }\n lastTextNode = container;\n }\n walker = new TreeWalker(container, dom.getParent(container, dom.isBlock) || body);\n while (node = walker[start ? 'prev' : 'next']()) {\n if (node.nodeType === 3 && !isBookmarkNode$2(node.parentNode)) {\n lastTextNode = node;\n pos = findSpace(start, remove, node);\n if (pos !== -1) {\n return {\n container: node,\n offset: pos\n };\n }\n } else if (dom.isBlock(node) || FormatUtils.isEq(node, 'BR')) {\n break;\n }\n }\n if (lastTextNode) {\n if (start) {\n offset = 0;\n } else {\n offset = lastTextNode.length;\n }\n return {\n container: lastTextNode,\n offset: offset\n };\n }\n };\n var findSelectorEndPoint = function (dom, format, rng, container, siblingName) {\n var parents, i, y, curFormat;\n if (container.nodeType === 3 && container.nodeValue.length === 0 && container[siblingName]) {\n container = container[siblingName];\n }\n parents = getParents$2(dom, container);\n for (i = 0; i < parents.length; i++) {\n for (y = 0; y < format.length; y++) {\n curFormat = format[y];\n if ('collapsed' in curFormat && curFormat.collapsed !== rng.collapsed) {\n continue;\n }\n if (dom.is(parents[i], curFormat.selector)) {\n return parents[i];\n }\n }\n }\n return container;\n };\n var findBlockEndPoint = function (editor, format, container, siblingName) {\n var node;\n var dom = editor.dom;\n var root = dom.getRoot();\n if (!format[0].wrapper) {\n node = dom.getParent(container, format[0].block, root);\n }\n if (!node) {\n var scopeRoot = dom.getParent(container, 'LI,TD,TH');\n node = dom.getParent(container.nodeType === 3 ? container.parentNode : container, function (node) {\n return node !== root && isTextBlock$2(editor, node);\n }, scopeRoot);\n }\n if (node && format[0].wrapper) {\n node = getParents$2(dom, node, 'ul,ol').reverse()[0] || node;\n }\n if (!node) {\n node = container;\n while (node[siblingName] && !dom.isBlock(node[siblingName])) {\n node = node[siblingName];\n if (FormatUtils.isEq(node, 'br')) {\n break;\n }\n }\n }\n return node || container;\n };\n var findParentContainer = function (dom, format, startContainer, startOffset, endContainer, endOffset, start) {\n var container, parent, sibling, siblingName, root;\n container = parent = start ? startContainer : endContainer;\n siblingName = start ? 'previousSibling' : 'nextSibling';\n root = dom.getRoot();\n if (container.nodeType === 3 && !isWhiteSpaceNode$1(container)) {\n if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {\n return container;\n }\n }\n while (true) {\n if (!format[0].block_expand && dom.isBlock(parent)) {\n return parent;\n }\n for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {\n if (!isBookmarkNode$2(sibling) && !isWhiteSpaceNode$1(sibling) && !isBogusBr(sibling)) {\n return parent;\n }\n }\n if (parent === root || parent.parentNode === root) {\n container = parent;\n break;\n }\n parent = parent.parentNode;\n }\n return container;\n };\n var expandRng = function (editor, rng, format, remove) {\n var endPoint, startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset;\n var dom = editor.dom;\n if (startContainer.nodeType === 1 && startContainer.hasChildNodes()) {\n startContainer = getNode(startContainer, startOffset);\n if (startContainer.nodeType === 3) {\n startOffset = 0;\n }\n }\n if (endContainer.nodeType === 1 && endContainer.hasChildNodes()) {\n endContainer = getNode(endContainer, rng.collapsed ? endOffset : endOffset - 1);\n if (endContainer.nodeType === 3) {\n endOffset = endContainer.nodeValue.length;\n }\n }\n startContainer = findParentContentEditable(dom, startContainer);\n endContainer = findParentContentEditable(dom, endContainer);\n if (isBookmarkNode$2(startContainer.parentNode) || isBookmarkNode$2(startContainer)) {\n startContainer = isBookmarkNode$2(startContainer) ? startContainer : startContainer.parentNode;\n if (rng.collapsed) {\n startContainer = startContainer.previousSibling || startContainer;\n } else {\n startContainer = startContainer.nextSibling || startContainer;\n }\n if (startContainer.nodeType === 3) {\n startOffset = rng.collapsed ? startContainer.length : 0;\n }\n }\n if (isBookmarkNode$2(endContainer.parentNode) || isBookmarkNode$2(endContainer)) {\n endContainer = isBookmarkNode$2(endContainer) ? endContainer : endContainer.parentNode;\n if (rng.collapsed) {\n endContainer = endContainer.nextSibling || endContainer;\n } else {\n endContainer = endContainer.previousSibling || endContainer;\n }\n if (endContainer.nodeType === 3) {\n endOffset = rng.collapsed ? 0 : endContainer.length;\n }\n }\n if (rng.collapsed) {\n endPoint = findWordEndPoint(dom, editor.getBody(), startContainer, startOffset, true, remove);\n if (endPoint) {\n startContainer = endPoint.container;\n startOffset = endPoint.offset;\n }\n endPoint = findWordEndPoint(dom, editor.getBody(), endContainer, endOffset, false, remove);\n if (endPoint) {\n endContainer = endPoint.container;\n endOffset = endPoint.offset;\n }\n }\n if (format[0].inline) {\n endContainer = remove ? endContainer : excludeTrailingWhitespace(endContainer, endOffset);\n }\n if (format[0].inline || format[0].block_expand) {\n if (!format[0].inline || (startContainer.nodeType !== 3 || startOffset === 0)) {\n startContainer = findParentContainer(dom, format, startContainer, startOffset, endContainer, endOffset, true);\n }\n if (!format[0].inline || (endContainer.nodeType !== 3 || endOffset === endContainer.nodeValue.length)) {\n endContainer = findParentContainer(dom, format, startContainer, startOffset, endContainer, endOffset, false);\n }\n }\n if (format[0].selector && format[0].expand !== false && !format[0].inline) {\n startContainer = findSelectorEndPoint(dom, format, rng, startContainer, 'previousSibling');\n endContainer = findSelectorEndPoint(dom, format, rng, endContainer, 'nextSibling');\n }\n if (format[0].block || format[0].selector) {\n startContainer = findBlockEndPoint(editor, format, startContainer, 'previousSibling');\n endContainer = findBlockEndPoint(editor, format, endContainer, 'nextSibling');\n if (format[0].block) {\n if (!dom.isBlock(startContainer)) {\n startContainer = findParentContainer(dom, format, startContainer, startOffset, endContainer, endOffset, true);\n }\n if (!dom.isBlock(endContainer)) {\n endContainer = findParentContainer(dom, format, startContainer, startOffset, endContainer, endOffset, false);\n }\n }\n }\n if (startContainer.nodeType === 1) {\n startOffset = dom.nodeIndex(startContainer);\n startContainer = startContainer.parentNode;\n }\n if (endContainer.nodeType === 1) {\n endOffset = dom.nodeIndex(endContainer) + 1;\n endContainer = endContainer.parentNode;\n }\n return {\n startContainer: startContainer,\n startOffset: startOffset,\n endContainer: endContainer,\n endOffset: endOffset\n };\n };\n var ExpandRange = { expandRng: expandRng };\n\n var each$8 = Tools.each;\n var getEndChild = function (container, index) {\n var childNodes = container.childNodes;\n index--;\n if (index > childNodes.length - 1) {\n index = childNodes.length - 1;\n } else if (index < 0) {\n index = 0;\n }\n return childNodes[index] || container;\n };\n var walk$1 = function (dom, rng, callback) {\n var startContainer = rng.startContainer;\n var startOffset = rng.startOffset;\n var endContainer = rng.endContainer;\n var endOffset = rng.endOffset;\n var ancestor;\n var startPoint;\n var endPoint;\n var node;\n var parent;\n var siblings;\n var nodes;\n nodes = dom.select('td[data-mce-selected],th[data-mce-selected]');\n if (nodes.length > 0) {\n each$8(nodes, function (node) {\n callback([node]);\n });\n return;\n }\n var exclude = function (nodes) {\n var node;\n node = nodes[0];\n if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) {\n nodes.splice(0, 1);\n }\n node = nodes[nodes.length - 1];\n if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) {\n nodes.splice(nodes.length - 1, 1);\n }\n return nodes;\n };\n var collectSiblings = function (node, name, endNode) {\n var siblings = [];\n for (; node && node !== endNode; node = node[name]) {\n siblings.push(node);\n }\n return siblings;\n };\n var findEndPoint = function (node, root) {\n do {\n if (node.parentNode === root) {\n return node;\n }\n node = node.parentNode;\n } while (node);\n };\n var walkBoundary = function (startNode, endNode, next) {\n var siblingName = next ? 'nextSibling' : 'previousSibling';\n for (node = startNode, parent = node.parentNode; node && node !== endNode; node = parent) {\n parent = node.parentNode;\n siblings = collectSiblings(node === startNode ? node : node[siblingName], siblingName);\n if (siblings.length) {\n if (!next) {\n siblings.reverse();\n }\n callback(exclude(siblings));\n }\n }\n };\n if (startContainer.nodeType === 1 && startContainer.hasChildNodes()) {\n startContainer = startContainer.childNodes[startOffset];\n }\n if (endContainer.nodeType === 1 && endContainer.hasChildNodes()) {\n endContainer = getEndChild(endContainer, endOffset);\n }\n if (startContainer === endContainer) {\n return callback(exclude([startContainer]));\n }\n ancestor = dom.findCommonAncestor(startContainer, endContainer);\n for (node = startContainer; node; node = node.parentNode) {\n if (node === endContainer) {\n return walkBoundary(startContainer, ancestor, true);\n }\n if (node === ancestor) {\n break;\n }\n }\n for (node = endContainer; node; node = node.parentNode) {\n if (node === startContainer) {\n return walkBoundary(endContainer, ancestor);\n }\n if (node === ancestor) {\n break;\n }\n }\n startPoint = findEndPoint(startContainer, ancestor) || startContainer;\n endPoint = findEndPoint(endContainer, ancestor) || endContainer;\n walkBoundary(startContainer, startPoint, true);\n siblings = collectSiblings(startPoint === startContainer ? startPoint : startPoint.nextSibling, 'nextSibling', endPoint === endContainer ? endPoint.nextSibling : endPoint);\n if (siblings.length) {\n callback(exclude(siblings));\n }\n walkBoundary(endContainer, endPoint);\n };\n var RangeWalk = { walk: walk$1 };\n\n var zeroWidth = function () {\n return '\\uFEFF';\n };\n\n function NodeValue (is, name) {\n var get = function (element) {\n if (!is(element)) {\n throw new Error('Can only get ' + name + ' value of a ' + name + ' node');\n }\n return getOption(element).getOr('');\n };\n var getOption = function (element) {\n return is(element) ? Option.from(element.dom().nodeValue) : Option.none();\n };\n var set = function (element, value) {\n if (!is(element)) {\n throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');\n }\n element.dom().nodeValue = value;\n };\n return {\n get: get,\n getOption: getOption,\n set: set\n };\n }\n\n var api = NodeValue(isText, 'text');\n var get$4 = function (element) {\n return api.get(element);\n };\n\n var isZeroWidth = function (elem) {\n return isText(elem) && get$4(elem) === zeroWidth();\n };\n var context = function (editor, elem, wrapName, nodeName) {\n return parent(elem).fold(function () {\n return 'skipping';\n }, function (parent) {\n if (nodeName === 'br' || isZeroWidth(elem)) {\n return 'valid';\n } else if (isAnnotation(elem)) {\n return 'existing';\n } else if (isCaretNode(elem)) {\n return 'caret';\n } else if (!FormatUtils.isValid(editor, wrapName, nodeName) || !FormatUtils.isValid(editor, name(parent), wrapName)) {\n return 'invalid-child';\n } else {\n return 'valid';\n }\n });\n };\n\n var shouldApplyToTrailingSpaces = function (rng) {\n return rng.startContainer.nodeType === 3 && rng.startContainer.nodeValue.length >= rng.startOffset && rng.startContainer.nodeValue[rng.startOffset] === '\\xA0';\n };\n var applyWordGrab = function (editor, rng) {\n var r = ExpandRange.expandRng(editor, rng, [{ inline: true }], shouldApplyToTrailingSpaces(rng));\n rng.setStart(r.startContainer, r.startOffset);\n rng.setEnd(r.endContainer, r.endOffset);\n editor.selection.setRng(rng);\n };\n var makeAnnotation = function (eDoc, _a, annotationName, decorate) {\n var _b = _a.uid, uid = _b === void 0 ? generate('mce-annotation') : _b, data = __rest(_a, ['uid']);\n var master = Element.fromTag('span', eDoc);\n add$2(master, annotation());\n set(master, '' + dataAnnotationId(), uid);\n set(master, '' + dataAnnotation(), annotationName);\n var _c = decorate(uid, data), _d = _c.attributes, attributes = _d === void 0 ? {} : _d, _e = _c.classes, classes = _e === void 0 ? [] : _e;\n setAll(master, attributes);\n add$3(master, classes);\n return master;\n };\n var annotate = function (editor, rng, annotationName, decorate, data) {\n var newWrappers = [];\n var master = makeAnnotation(editor.getDoc(), data, annotationName, decorate);\n var wrapper = Cell(Option.none());\n var finishWrapper = function () {\n wrapper.set(Option.none());\n };\n var getOrOpenWrapper = function () {\n return wrapper.get().getOrThunk(function () {\n var nu = shallow(master);\n newWrappers.push(nu);\n wrapper.set(Option.some(nu));\n return nu;\n });\n };\n var processElements = function (elems) {\n each(elems, processElement);\n };\n var processElement = function (elem) {\n var ctx = context(editor, elem, 'span', name(elem));\n switch (ctx) {\n case 'invalid-child': {\n finishWrapper();\n var children$1 = children(elem);\n processElements(children$1);\n finishWrapper();\n break;\n }\n case 'valid': {\n var w = getOrOpenWrapper();\n wrap$1(elem, w);\n break;\n }\n case 'skipping':\n case 'existing':\n case 'caret':\n }\n };\n var processNodes = function (nodes) {\n var elems = map(nodes, Element.fromDom);\n processElements(elems);\n };\n RangeWalk.walk(editor.dom, rng, function (nodes) {\n finishWrapper();\n processNodes(nodes);\n });\n return newWrappers;\n };\n var annotateWithBookmark = function (editor, name, settings, data) {\n editor.undoManager.transact(function () {\n var initialRng = editor.selection.getRng();\n if (initialRng.collapsed) {\n applyWordGrab(editor, initialRng);\n }\n if (editor.selection.getRng().collapsed) {\n var wrapper = makeAnnotation(editor.getDoc(), data, name, settings.decorate);\n set$1(wrapper, '\\xA0');\n editor.selection.getRng().insertNode(wrapper.dom());\n editor.selection.select(wrapper.dom());\n } else {\n var bookmark = GetBookmark.getPersistentBookmark(editor.selection, false);\n var rng = editor.selection.getRng();\n annotate(editor, rng, name, settings.decorate, data);\n editor.selection.moveToBookmark(bookmark);\n }\n });\n };\n\n function Annotator (editor) {\n var registry = create$1();\n setup$1(editor, registry);\n var changes = setup(editor);\n return {\n register: function (name, settings) {\n registry.register(name, settings);\n },\n annotate: function (name, data) {\n registry.lookup(name).each(function (settings) {\n annotateWithBookmark(editor, name, settings, data);\n });\n },\n annotationChanged: function (name, callback) {\n changes.addListener(name, callback);\n },\n remove: function (name) {\n identify(editor, Option.some(name)).each(function (_a) {\n var elements = _a.elements;\n each(elements, unwrap);\n });\n },\n getAll: function (name) {\n var directory = findAll(editor, name);\n return map$2(directory, function (elems) {\n return map(elems, function (elem) {\n return elem.dom();\n });\n });\n }\n };\n }\n\n var hasOnlyOneChild = function (node) {\n return node.firstChild && node.firstChild === node.lastChild;\n };\n var isPaddingNode = function (node) {\n return node.name === 'br' || node.value === '\\xA0';\n };\n var isPaddedEmptyBlock = function (schema, node) {\n var blockElements = schema.getBlockElements();\n return blockElements[node.name] && hasOnlyOneChild(node) && isPaddingNode(node.firstChild);\n };\n var isEmptyFragmentElement = function (schema, node) {\n var nonEmptyElements = schema.getNonEmptyElements();\n return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema, node));\n };\n var isListFragment = function (schema, fragment) {\n var firstChild = fragment.firstChild;\n var lastChild = fragment.lastChild;\n if (firstChild && firstChild.name === 'meta') {\n firstChild = firstChild.next;\n }\n if (lastChild && lastChild.attr('id') === 'mce_marker') {\n lastChild = lastChild.prev;\n }\n if (isEmptyFragmentElement(schema, lastChild)) {\n lastChild = lastChild.prev;\n }\n if (!firstChild || firstChild !== lastChild) {\n return false;\n }\n return firstChild.name === 'ul' || firstChild.name === 'ol';\n };\n var cleanupDomFragment = function (domFragment) {\n var firstChild = domFragment.firstChild;\n var lastChild = domFragment.lastChild;\n if (firstChild && firstChild.nodeName === 'META') {\n firstChild.parentNode.removeChild(firstChild);\n }\n if (lastChild && lastChild.id === 'mce_marker') {\n lastChild.parentNode.removeChild(lastChild);\n }\n return domFragment;\n };\n var toDomFragment = function (dom, serializer, fragment) {\n var html = serializer.serialize(fragment);\n var domFragment = dom.createFragment(html);\n return cleanupDomFragment(domFragment);\n };\n var listItems$1 = function (elm) {\n return Tools.grep(elm.childNodes, function (child) {\n return child.nodeName === 'LI';\n });\n };\n var isPadding = function (node) {\n return node.data === '\\xA0' || NodeType.isBr(node);\n };\n var isListItemPadded = function (node) {\n return node && node.firstChild && node.firstChild === node.lastChild && isPadding(node.firstChild);\n };\n var isEmptyOrPadded = function (elm) {\n return !elm.firstChild || isListItemPadded(elm);\n };\n var trimListItems = function (elms) {\n return elms.length > 0 && isEmptyOrPadded(elms[elms.length - 1]) ? elms.slice(0, -1) : elms;\n };\n var getParentLi = function (dom, node) {\n var parentBlock = dom.getParent(node, dom.isBlock);\n return parentBlock && parentBlock.nodeName === 'LI' ? parentBlock : null;\n };\n var isParentBlockLi = function (dom, node) {\n return !!getParentLi(dom, node);\n };\n var getSplit = function (parentNode, rng) {\n var beforeRng = rng.cloneRange();\n var afterRng = rng.cloneRange();\n beforeRng.setStartBefore(parentNode);\n afterRng.setEndAfter(parentNode);\n return [\n beforeRng.cloneContents(),\n afterRng.cloneContents()\n ];\n };\n var findFirstIn = function (node, rootNode) {\n var caretPos = CaretPosition$1.before(node);\n var caretWalker = CaretWalker(rootNode);\n var newCaretPos = caretWalker.next(caretPos);\n return newCaretPos ? newCaretPos.toRange() : null;\n };\n var findLastOf = function (node, rootNode) {\n var caretPos = CaretPosition$1.after(node);\n var caretWalker = CaretWalker(rootNode);\n var newCaretPos = caretWalker.prev(caretPos);\n return newCaretPos ? newCaretPos.toRange() : null;\n };\n var insertMiddle = function (target, elms, rootNode, rng) {\n var parts = getSplit(target, rng);\n var parentElm = target.parentNode;\n parentElm.insertBefore(parts[0], target);\n Tools.each(elms, function (li) {\n parentElm.insertBefore(li, target);\n });\n parentElm.insertBefore(parts[1], target);\n parentElm.removeChild(target);\n return findLastOf(elms[elms.length - 1], rootNode);\n };\n var insertBefore = function (target, elms, rootNode) {\n var parentElm = target.parentNode;\n Tools.each(elms, function (elm) {\n parentElm.insertBefore(elm, target);\n });\n return findFirstIn(target, rootNode);\n };\n var insertAfter = function (target, elms, rootNode, dom) {\n dom.insertAfter(elms.reverse(), target);\n return findLastOf(elms[0], rootNode);\n };\n var insertAtCaret = function (serializer, dom, rng, fragment) {\n var domFragment = toDomFragment(dom, serializer, fragment);\n var liTarget = getParentLi(dom, rng.startContainer);\n var liElms = trimListItems(listItems$1(domFragment.firstChild));\n var BEGINNING = 1, END = 2;\n var rootNode = dom.getRoot();\n var isAt = function (location) {\n var caretPos = CaretPosition$1.fromRangeStart(rng);\n var caretWalker = CaretWalker(dom.getRoot());\n var newPos = location === BEGINNING ? caretWalker.prev(caretPos) : caretWalker.next(caretPos);\n return newPos ? getParentLi(dom, newPos.getNode()) !== liTarget : true;\n };\n if (isAt(BEGINNING)) {\n return insertBefore(liTarget, liElms, rootNode);\n } else if (isAt(END)) {\n return insertAfter(liTarget, liElms, rootNode, dom);\n }\n return insertMiddle(liTarget, liElms, rootNode, rng);\n };\n var InsertList = {\n isListFragment: isListFragment,\n insertAtCaret: insertAtCaret,\n isParentBlockLi: isParentBlockLi,\n trimListItems: trimListItems,\n listItems: listItems$1\n };\n\n var each$9 = Tools.each;\n var ElementUtils = function (dom) {\n this.compare = function (node1, node2) {\n if (node1.nodeName !== node2.nodeName) {\n return false;\n }\n var getAttribs = function (node) {\n var attribs = {};\n each$9(dom.getAttribs(node), function (attr) {\n var name = attr.nodeName.toLowerCase();\n if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) {\n attribs[name] = dom.getAttrib(node, name);\n }\n });\n return attribs;\n };\n var compareObjects = function (obj1, obj2) {\n var value, name;\n for (name in obj1) {\n if (obj1.hasOwnProperty(name)) {\n value = obj2[name];\n if (typeof value === 'undefined') {\n return false;\n }\n if (obj1[name] !== value) {\n return false;\n }\n delete obj2[name];\n }\n }\n for (name in obj2) {\n if (obj2.hasOwnProperty(name)) {\n return false;\n }\n }\n return true;\n };\n if (!compareObjects(getAttribs(node1), getAttribs(node2))) {\n return false;\n }\n if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) {\n return false;\n }\n return !Bookmarks.isBookmarkNode(node1) && !Bookmarks.isBookmarkNode(node2);\n };\n };\n\n var getLastChildren = function (elm) {\n var children = [];\n var rawNode = elm.dom();\n while (rawNode) {\n children.push(Element.fromDom(rawNode));\n rawNode = rawNode.lastChild;\n }\n return children;\n };\n var removeTrailingBr = function (elm) {\n var allBrs = descendants$1(elm, 'br');\n var brs = filter(getLastChildren(elm).slice(-1), isBr);\n if (allBrs.length === brs.length) {\n each(brs, remove$1);\n }\n };\n var fillWithPaddingBr = function (elm) {\n empty(elm);\n append(elm, Element.fromHtml('
'));\n };\n var isPaddingContents = function (elm) {\n return isText(elm) ? get$4(elm) === '\\xA0' : isBr(elm);\n };\n var isPaddedElement = function (elm) {\n return filter(children(elm), isPaddingContents).length === 1;\n };\n var trimBlockTrailingBr = function (elm) {\n lastChild(elm).each(function (lastChild) {\n prevSibling(lastChild).each(function (lastChildPrevSibling) {\n if (isBlock(elm) && isBr(lastChild) && isBlock(lastChildPrevSibling)) {\n remove$1(lastChild);\n }\n });\n });\n };\n var PaddingBr = {\n removeTrailingBr: removeTrailingBr,\n fillWithPaddingBr: fillWithPaddingBr,\n isPaddedElement: isPaddedElement,\n trimBlockTrailingBr: trimBlockTrailingBr\n };\n\n var makeMap$3 = Tools.makeMap;\n function Writer (settings) {\n var html = [];\n var indent, indentBefore, indentAfter, encode, htmlOutput;\n settings = settings || {};\n indent = settings.indent;\n indentBefore = makeMap$3(settings.indent_before || '');\n indentAfter = makeMap$3(settings.indent_after || '');\n encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);\n htmlOutput = settings.element_format === 'html';\n return {\n start: function (name, attrs, empty) {\n var i, l, attr, value;\n if (indent && indentBefore[name] && html.length > 0) {\n value = html[html.length - 1];\n if (value.length > 0 && value !== '\\n') {\n html.push('\\n');\n }\n }\n html.push('<', name);\n if (attrs) {\n for (i = 0, l = attrs.length; i < l; i++) {\n attr = attrs[i];\n html.push(' ', attr.name, '=\"', encode(attr.value, true), '\"');\n }\n }\n if (!empty || htmlOutput) {\n html[html.length] = '>';\n } else {\n html[html.length] = ' />';\n }\n if (empty && indent && indentAfter[name] && html.length > 0) {\n value = html[html.length - 1];\n if (value.length > 0 && value !== '\\n') {\n html.push('\\n');\n }\n }\n },\n end: function (name) {\n var value;\n html.push('');\n if (indent && indentAfter[name] && html.length > 0) {\n value = html[html.length - 1];\n if (value.length > 0 && value !== '\\n') {\n html.push('\\n');\n }\n }\n },\n text: function (text, raw) {\n if (text.length > 0) {\n html[html.length] = raw ? text : encode(text);\n }\n },\n cdata: function (text) {\n html.push('');\n },\n comment: function (text) {\n html.push('');\n },\n pi: function (name, text) {\n if (text) {\n html.push('');\n } else {\n html.push('');\n }\n if (indent) {\n html.push('\\n');\n }\n },\n doctype: function (text) {\n html.push('', indent ? '\\n' : '');\n },\n reset: function () {\n html.length = 0;\n },\n getContent: function () {\n return html.join('').replace(/\\n$/, '');\n }\n };\n }\n\n function HtmlSerializer (settings, schema) {\n if (schema === void 0) {\n schema = Schema();\n }\n var writer = Writer(settings);\n settings = settings || {};\n settings.validate = 'validate' in settings ? settings.validate : true;\n var serialize = function (node) {\n var handlers, validate;\n validate = settings.validate;\n handlers = {\n 3: function (node) {\n writer.text(node.value, node.raw);\n },\n 8: function (node) {\n writer.comment(node.value);\n },\n 7: function (node) {\n writer.pi(node.name, node.value);\n },\n 10: function (node) {\n writer.doctype(node.value);\n },\n 4: function (node) {\n writer.cdata(node.value);\n },\n 11: function (node) {\n if (node = node.firstChild) {\n do {\n walk(node);\n } while (node = node.next);\n }\n }\n };\n writer.reset();\n var walk = function (node) {\n var handler = handlers[node.type];\n var name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;\n if (!handler) {\n name = node.name;\n isEmpty = node.shortEnded;\n attrs = node.attributes;\n if (validate && attrs && attrs.length > 1) {\n sortedAttrs = [];\n sortedAttrs.map = {};\n elementRule = schema.getElementRule(node.name);\n if (elementRule) {\n for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {\n attrName = elementRule.attributesOrder[i];\n if (attrName in attrs.map) {\n attrValue = attrs.map[attrName];\n sortedAttrs.map[attrName] = attrValue;\n sortedAttrs.push({\n name: attrName,\n value: attrValue\n });\n }\n }\n for (i = 0, l = attrs.length; i < l; i++) {\n attrName = attrs[i].name;\n if (!(attrName in sortedAttrs.map)) {\n attrValue = attrs.map[attrName];\n sortedAttrs.map[attrName] = attrValue;\n sortedAttrs.push({\n name: attrName,\n value: attrValue\n });\n }\n }\n attrs = sortedAttrs;\n }\n }\n writer.start(node.name, attrs, isEmpty);\n if (!isEmpty) {\n if (node = node.firstChild) {\n do {\n walk(node);\n } while (node = node.next);\n }\n writer.end(name);\n }\n } else {\n handler(node);\n }\n };\n if (node.type === 1 && !settings.inner) {\n walk(node);\n } else {\n handlers[11](node);\n }\n return writer.getContent();\n };\n return { serialize: serialize };\n }\n\n var createRange$1 = function (sc, so, ec, eo) {\n var rng = domGlobals.document.createRange();\n rng.setStart(sc, so);\n rng.setEnd(ec, eo);\n return rng;\n };\n var normalizeBlockSelectionRange = function (rng) {\n var startPos = CaretPosition$1.fromRangeStart(rng);\n var endPos = CaretPosition$1.fromRangeEnd(rng);\n var rootNode = rng.commonAncestorContainer;\n return CaretFinder.fromPosition(false, rootNode, endPos).map(function (newEndPos) {\n if (!isInSameBlock(startPos, endPos, rootNode) && isInSameBlock(startPos, newEndPos, rootNode)) {\n return createRange$1(startPos.container(), startPos.offset(), newEndPos.container(), newEndPos.offset());\n } else {\n return rng;\n }\n }).getOr(rng);\n };\n var normalize = function (rng) {\n return rng.collapsed ? rng : normalizeBlockSelectionRange(rng);\n };\n var RangeNormalizer = { normalize: normalize };\n\n var isAfterNbsp = function (container, offset) {\n return NodeType.isText(container) && container.nodeValue[offset - 1] === '\\xA0';\n };\n var trimOrPadLeftRight = function (rng, html) {\n var container, offset;\n container = rng.startContainer;\n offset = rng.startOffset;\n var hasSiblingText = function (siblingName) {\n return container[siblingName] && container[siblingName].nodeType === 3;\n };\n if (container.nodeType === 3) {\n if (offset > 0) {\n html = html.replace(/^ /, ' ');\n } else if (!hasSiblingText('previousSibling')) {\n html = html.replace(/^ /, ' ');\n }\n if (offset < container.length) {\n html = html.replace(/ (
|)$/, ' ');\n } else if (!hasSiblingText('nextSibling')) {\n html = html.replace(/( | )(
|)$/, ' ');\n }\n }\n return html;\n };\n var trimNbspAfterDeleteAndPadValue = function (rng, value) {\n var container, offset;\n container = rng.startContainer;\n offset = rng.startOffset;\n if (container.nodeType === 3 && rng.collapsed) {\n if (container.data[offset] === '\\xA0') {\n container.deleteData(offset, 1);\n if (!/[\\u00a0| ]$/.test(value)) {\n value += ' ';\n }\n } else if (container.data[offset - 1] === '\\xA0') {\n container.deleteData(offset - 1, 1);\n if (!/[\\u00a0| ]$/.test(value)) {\n value = ' ' + value;\n }\n }\n }\n return value;\n };\n\n var isTableCell$2 = NodeType.matchNodeNames('td th');\n var selectionSetContent = function (editor, content) {\n var rng = editor.selection.getRng();\n var container = rng.startContainer;\n var offset = rng.startOffset;\n if (rng.collapsed && isAfterNbsp(container, offset) && NodeType.isText(container)) {\n container.insertData(offset - 1, ' ');\n container.deleteData(offset, 1);\n rng.setStart(container, offset);\n rng.setEnd(container, offset);\n editor.selection.setRng(rng);\n }\n editor.selection.setContent(content);\n };\n var validInsertion = function (editor, value, parentNode) {\n if (parentNode.getAttribute('data-mce-bogus') === 'all') {\n parentNode.parentNode.insertBefore(editor.dom.createFragment(value), parentNode);\n } else {\n var node = parentNode.firstChild;\n var node2 = parentNode.lastChild;\n if (!node || node === node2 && node.nodeName === 'BR') {\n editor.dom.setHTML(parentNode, value);\n } else {\n selectionSetContent(editor, value);\n }\n }\n };\n var trimBrsFromTableCell = function (dom, elm) {\n Option.from(dom.getParent(elm, 'td,th')).map(Element.fromDom).each(PaddingBr.trimBlockTrailingBr);\n };\n var reduceInlineTextElements = function (editor, merge) {\n var textInlineElements = editor.schema.getTextInlineElements();\n var dom = editor.dom;\n if (merge) {\n var root_1 = editor.getBody(), elementUtils_1 = new ElementUtils(dom);\n Tools.each(dom.select('*[data-mce-fragment]'), function (node) {\n for (var testNode = node.parentNode; testNode && testNode !== root_1; testNode = testNode.parentNode) {\n if (textInlineElements[node.nodeName.toLowerCase()] && elementUtils_1.compare(testNode, node)) {\n dom.remove(node, true);\n }\n }\n });\n }\n };\n var markFragmentElements = function (fragment) {\n var node = fragment;\n while (node = node.walk()) {\n if (node.type === 1) {\n node.attr('data-mce-fragment', '1');\n }\n }\n };\n var umarkFragmentElements = function (elm) {\n Tools.each(elm.getElementsByTagName('*'), function (elm) {\n elm.removeAttribute('data-mce-fragment');\n });\n };\n var isPartOfFragment = function (node) {\n return !!node.getAttribute('data-mce-fragment');\n };\n var canHaveChildren = function (editor, node) {\n return node && !editor.schema.getShortEndedElements()[node.nodeName];\n };\n var moveSelectionToMarker = function (editor, marker) {\n var parentEditableFalseElm, parentBlock, nextRng;\n var dom = editor.dom, selection = editor.selection;\n var node, node2;\n var getContentEditableFalseParent = function (node) {\n var root = editor.getBody();\n for (; node && node !== root; node = node.parentNode) {\n if (editor.dom.getContentEditable(node) === 'false') {\n return node;\n }\n }\n return null;\n };\n if (!marker) {\n return;\n }\n editor.selection.scrollIntoView(marker);\n parentEditableFalseElm = getContentEditableFalseParent(marker);\n if (parentEditableFalseElm) {\n dom.remove(marker);\n selection.select(parentEditableFalseElm);\n return;\n }\n var rng = dom.createRng();\n node = marker.previousSibling;\n if (node && node.nodeType === 3) {\n rng.setStart(node, node.nodeValue.length);\n if (!Env.ie) {\n node2 = marker.nextSibling;\n if (node2 && node2.nodeType === 3) {\n node.appendData(node2.data);\n node2.parentNode.removeChild(node2);\n }\n }\n } else {\n rng.setStartBefore(marker);\n rng.setEndBefore(marker);\n }\n var findNextCaretRng = function (rng) {\n var caretPos = CaretPosition$1.fromRangeStart(rng);\n var caretWalker = CaretWalker(editor.getBody());\n caretPos = caretWalker.next(caretPos);\n if (caretPos) {\n return caretPos.toRange();\n }\n };\n parentBlock = dom.getParent(marker, dom.isBlock);\n dom.remove(marker);\n if (parentBlock && dom.isEmpty(parentBlock)) {\n editor.$(parentBlock).empty();\n rng.setStart(parentBlock, 0);\n rng.setEnd(parentBlock, 0);\n if (!isTableCell$2(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) {\n rng = nextRng;\n dom.remove(parentBlock);\n } else {\n dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' }));\n }\n }\n selection.setRng(rng);\n };\n var insertHtmlAtCaret = function (editor, value, details) {\n var parser, serializer, parentNode, rootNode, fragment, args;\n var marker, rng, node, bookmarkHtml, merge;\n var selection = editor.selection, dom = editor.dom;\n if (/^ | $/.test(value)) {\n value = trimOrPadLeftRight(selection.getRng(), value);\n }\n parser = editor.parser;\n merge = details.merge;\n serializer = HtmlSerializer({ validate: editor.settings.validate }, editor.schema);\n bookmarkHtml = '​';\n args = {\n content: value,\n format: 'html',\n selection: true,\n paste: details.paste\n };\n args = editor.fire('BeforeSetContent', args);\n if (args.isDefaultPrevented()) {\n editor.fire('SetContent', {\n content: args.content,\n format: 'html',\n selection: true,\n paste: details.paste\n });\n return;\n }\n value = args.content;\n if (value.indexOf('{$caret}') === -1) {\n value += '{$caret}';\n }\n value = value.replace(/\\{\\$caret\\}/, bookmarkHtml);\n rng = selection.getRng();\n var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null);\n var body = editor.getBody();\n if (caretElement === body && selection.isCollapsed()) {\n if (dom.isBlock(body.firstChild) && canHaveChildren(editor, body.firstChild) && dom.isEmpty(body.firstChild)) {\n rng = dom.createRng();\n rng.setStart(body.firstChild, 0);\n rng.setEnd(body.firstChild, 0);\n selection.setRng(rng);\n }\n }\n if (!selection.isCollapsed()) {\n editor.selection.setRng(RangeNormalizer.normalize(editor.selection.getRng()));\n editor.getDoc().execCommand('Delete', false, null);\n value = trimNbspAfterDeleteAndPadValue(editor.selection.getRng(), value);\n }\n parentNode = selection.getNode();\n var parserArgs = {\n context: parentNode.nodeName.toLowerCase(),\n data: details.data,\n insert: true\n };\n fragment = parser.parse(value, parserArgs);\n if (details.paste === true && InsertList.isListFragment(editor.schema, fragment) && InsertList.isParentBlockLi(dom, parentNode)) {\n rng = InsertList.insertAtCaret(serializer, dom, editor.selection.getRng(), fragment);\n editor.selection.setRng(rng);\n editor.fire('SetContent', args);\n return;\n }\n markFragmentElements(fragment);\n node = fragment.lastChild;\n if (node.attr('id') === 'mce_marker') {\n marker = node;\n for (node = node.prev; node; node = node.walk(true)) {\n if (node.type === 3 || !dom.isBlock(node.name)) {\n if (editor.schema.isValidChild(node.parent.name, 'span')) {\n node.parent.insert(marker, node, node.name === 'br');\n }\n break;\n }\n }\n }\n editor._selectionOverrides.showBlockCaretContainer(parentNode);\n if (!parserArgs.invalid) {\n value = serializer.serialize(fragment);\n validInsertion(editor, value, parentNode);\n } else {\n selectionSetContent(editor, bookmarkHtml);\n parentNode = selection.getNode();\n rootNode = editor.getBody();\n if (parentNode.nodeType === 9) {\n parentNode = node = rootNode;\n } else {\n node = parentNode;\n }\n while (node !== rootNode) {\n parentNode = node;\n node = node.parentNode;\n }\n value = parentNode === rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode);\n value = serializer.serialize(parser.parse(value.replace(//i, function () {\n return serializer.serialize(fragment);\n })));\n if (parentNode === rootNode) {\n dom.setHTML(rootNode, value);\n } else {\n dom.setOuterHTML(parentNode, value);\n }\n }\n reduceInlineTextElements(editor, merge);\n moveSelectionToMarker(editor, dom.get('mce_marker'));\n umarkFragmentElements(editor.getBody());\n trimBrsFromTableCell(editor.dom, editor.selection.getStart());\n editor.fire('SetContent', args);\n editor.addVisual();\n };\n var processValue = function (value) {\n var details;\n if (typeof value !== 'string') {\n details = Tools.extend({\n paste: value.paste,\n data: { paste: value.paste }\n }, value);\n return {\n content: value.content,\n details: details\n };\n }\n return {\n content: value,\n details: {}\n };\n };\n var insertAtCaret$1 = function (editor, value) {\n var result = processValue(value);\n insertHtmlAtCaret(editor, result.content, result.details);\n };\n var InsertContent = { insertAtCaret: insertAtCaret$1 };\n\n var strongRtl = /[\\u0591-\\u07FF\\uFB1D-\\uFDFF\\uFE70-\\uFEFC]/;\n var hasStrongRtl = function (text) {\n return strongRtl.test(text);\n };\n\n var getBodySetting = function (editor, name, defaultValue) {\n var value = editor.getParam(name, defaultValue);\n if (value.indexOf('=') !== -1) {\n var bodyObj = editor.getParam(name, '', 'hash');\n return bodyObj.hasOwnProperty(editor.id) ? bodyObj[editor.id] : defaultValue;\n } else {\n return value;\n }\n };\n var getIframeAttrs = function (editor) {\n return editor.getParam('iframe_attrs', {});\n };\n var getDocType = function (editor) {\n return editor.getParam('doctype', '');\n };\n var getDocumentBaseUrl = function (editor) {\n return editor.getParam('document_base_url', '');\n };\n var getBodyId = function (editor) {\n return getBodySetting(editor, 'body_id', 'tinymce');\n };\n var getBodyClass = function (editor) {\n return getBodySetting(editor, 'body_class', '');\n };\n var getContentSecurityPolicy = function (editor) {\n return editor.getParam('content_security_policy', '');\n };\n var shouldPutBrInPre = function (editor) {\n return editor.getParam('br_in_pre', true);\n };\n var getForcedRootBlock = function (editor) {\n if (editor.getParam('force_p_newlines', false)) {\n return 'p';\n }\n var block = editor.getParam('forced_root_block', 'p');\n return block === false ? '' : block;\n };\n var getForcedRootBlockAttrs = function (editor) {\n return editor.getParam('forced_root_block_attrs', {});\n };\n var getBrNewLineSelector = function (editor) {\n return editor.getParam('br_newline_selector', '.mce-toc h2,figcaption,caption');\n };\n var getNoNewLineSelector = function (editor) {\n return editor.getParam('no_newline_selector', '');\n };\n var shouldKeepStyles = function (editor) {\n return editor.getParam('keep_styles', true);\n };\n var shouldEndContainerOnEmptyBlock = function (editor) {\n return editor.getParam('end_container_on_empty_block', false);\n };\n var getFontStyleValues = function (editor) {\n return Tools.explode(editor.getParam('font_size_style_values', ''));\n };\n var getFontSizeClasses = function (editor) {\n return Tools.explode(editor.getParam('font_size_classes', ''));\n };\n var getImagesDataImgFilter = function (editor) {\n return editor.getParam('images_dataimg_filter', constant(true), 'function');\n };\n var isAutomaticUploadsEnabled = function (editor) {\n return editor.getParam('automatic_uploads', true, 'boolean');\n };\n var shouldReuseFileName = function (editor) {\n return editor.getParam('images_reuse_filename', false, 'boolean');\n };\n var shouldReplaceBlobUris = function (editor) {\n return editor.getParam('images_replace_blob_uris', true, 'boolean');\n };\n var getImageUploadUrl = function (editor) {\n return editor.getParam('images_upload_url', '', 'string');\n };\n var getImageUploadBasePath = function (editor) {\n return editor.getParam('images_upload_base_path', '', 'string');\n };\n var getImagesUploadCredentials = function (editor) {\n return editor.getParam('images_upload_credentials', false, 'boolean');\n };\n var getImagesUploadHandler = function (editor) {\n return editor.getParam('images_upload_handler', null, 'function');\n };\n var shouldUseContentCssCors = function (editor) {\n return editor.getParam('content_css_cors', false, 'boolean');\n };\n var getInlineBoundarySelector = function (editor) {\n return editor.getParam('inline_boundaries_selector', 'a[href],code,.mce-annotation', 'string');\n };\n var Settings = {\n getIframeAttrs: getIframeAttrs,\n getDocType: getDocType,\n getDocumentBaseUrl: getDocumentBaseUrl,\n getBodyId: getBodyId,\n getBodyClass: getBodyClass,\n getContentSecurityPolicy: getContentSecurityPolicy,\n shouldPutBrInPre: shouldPutBrInPre,\n getForcedRootBlock: getForcedRootBlock,\n getForcedRootBlockAttrs: getForcedRootBlockAttrs,\n getBrNewLineSelector: getBrNewLineSelector,\n getNoNewLineSelector: getNoNewLineSelector,\n shouldKeepStyles: shouldKeepStyles,\n shouldEndContainerOnEmptyBlock: shouldEndContainerOnEmptyBlock,\n getFontStyleValues: getFontStyleValues,\n getFontSizeClasses: getFontSizeClasses,\n getImagesDataImgFilter: getImagesDataImgFilter,\n isAutomaticUploadsEnabled: isAutomaticUploadsEnabled,\n shouldReuseFileName: shouldReuseFileName,\n shouldReplaceBlobUris: shouldReplaceBlobUris,\n getImageUploadUrl: getImageUploadUrl,\n getImageUploadBasePath: getImageUploadBasePath,\n getImagesUploadCredentials: getImagesUploadCredentials,\n getImagesUploadHandler: getImagesUploadHandler,\n shouldUseContentCssCors: shouldUseContentCssCors,\n getInlineBoundarySelector: getInlineBoundarySelector\n };\n\n var isInlineTarget = function (editor, elm) {\n return is$1(Element.fromDom(elm), Settings.getInlineBoundarySelector(editor));\n };\n var isRtl = function (element) {\n return DOMUtils$1.DOM.getStyle(element, 'direction', true) === 'rtl' || hasStrongRtl(element.textContent);\n };\n var findInlineParents = function (isInlineTarget, rootNode, pos) {\n return filter(DOMUtils$1.DOM.getParents(pos.container(), '*', rootNode), isInlineTarget);\n };\n var findRootInline = function (isInlineTarget, rootNode, pos) {\n var parents = findInlineParents(isInlineTarget, rootNode, pos);\n return Option.from(parents[parents.length - 1]);\n };\n var hasSameParentBlock = function (rootNode, node1, node2) {\n var block1 = getParentBlock(node1, rootNode);\n var block2 = getParentBlock(node2, rootNode);\n return block1 && block1 === block2;\n };\n var isAtZwsp = function (pos) {\n return isBeforeInline(pos) || isAfterInline(pos);\n };\n var normalizePosition = function (forward, pos) {\n if (!pos) {\n return pos;\n }\n var container = pos.container(), offset = pos.offset();\n if (forward) {\n if (isCaretContainerInline(container)) {\n if (NodeType.isText(container.nextSibling)) {\n return CaretPosition$1(container.nextSibling, 0);\n } else {\n return CaretPosition$1.after(container);\n }\n } else {\n return isBeforeInline(pos) ? CaretPosition$1(container, offset + 1) : pos;\n }\n } else {\n if (isCaretContainerInline(container)) {\n if (NodeType.isText(container.previousSibling)) {\n return CaretPosition$1(container.previousSibling, container.previousSibling.data.length);\n } else {\n return CaretPosition$1.before(container);\n }\n } else {\n return isAfterInline(pos) ? CaretPosition$1(container, offset - 1) : pos;\n }\n }\n };\n var normalizeForwards = curry(normalizePosition, true);\n var normalizeBackwards = curry(normalizePosition, false);\n var InlineUtils = {\n isInlineTarget: isInlineTarget,\n findRootInline: findRootInline,\n isRtl: isRtl,\n isAtZwsp: isAtZwsp,\n normalizePosition: normalizePosition,\n normalizeForwards: normalizeForwards,\n normalizeBackwards: normalizeBackwards,\n hasSameParentBlock: hasSameParentBlock\n };\n\n var isBeforeRoot = function (rootNode) {\n return function (elm) {\n return eq(rootNode, Element.fromDom(elm.dom().parentNode));\n };\n };\n var getParentBlock$1 = function (rootNode, elm) {\n return contains$3(rootNode, elm) ? closest(elm, function (element) {\n return isTextBlock(element) || isListItem(element);\n }, isBeforeRoot(rootNode)) : Option.none();\n };\n var placeCaretInEmptyBody = function (editor) {\n var body = editor.getBody();\n var node = body.firstChild && editor.dom.isBlock(body.firstChild) ? body.firstChild : body;\n editor.selection.setCursorLocation(node, 0);\n };\n var paddEmptyBody = function (editor) {\n if (editor.dom.isEmpty(editor.getBody())) {\n editor.setContent('');\n placeCaretInEmptyBody(editor);\n }\n };\n var willDeleteLastPositionInElement = function (forward, fromPos, elm) {\n return lift2(CaretFinder.firstPositionIn(elm), CaretFinder.lastPositionIn(elm), function (firstPos, lastPos) {\n var normalizedFirstPos = InlineUtils.normalizePosition(true, firstPos);\n var normalizedLastPos = InlineUtils.normalizePosition(false, lastPos);\n var normalizedFromPos = InlineUtils.normalizePosition(false, fromPos);\n if (forward) {\n return CaretFinder.nextPosition(elm, normalizedFromPos).map(function (nextPos) {\n return nextPos.isEqual(normalizedLastPos) && fromPos.isEqual(normalizedFirstPos);\n }).getOr(false);\n } else {\n return CaretFinder.prevPosition(elm, normalizedFromPos).map(function (prevPos) {\n return prevPos.isEqual(normalizedFirstPos) && fromPos.isEqual(normalizedLastPos);\n }).getOr(false);\n }\n }).getOr(true);\n };\n var DeleteUtils = {\n getParentBlock: getParentBlock$1,\n paddEmptyBody: paddEmptyBody,\n willDeleteLastPositionInElement: willDeleteLastPositionInElement\n };\n\n var ancestor$2 = function (scope, selector, isRoot) {\n return ancestor$1(scope, selector, isRoot).isSome();\n };\n\n var hasWhitespacePreserveParent = function (rootNode, node) {\n var rootElement = Element.fromDom(rootNode);\n var startNode = Element.fromDom(node);\n return ancestor$2(startNode, 'pre,code', curry(eq, rootElement));\n };\n var isWhitespace = function (rootNode, node) {\n return NodeType.isText(node) && /^[ \\t\\r\\n]*$/.test(node.data) && hasWhitespacePreserveParent(rootNode, node) === false;\n };\n var isNamedAnchor = function (node) {\n return NodeType.isElement(node) && node.nodeName === 'A' && node.hasAttribute('name');\n };\n var isContent = function (rootNode, node) {\n return isCaretCandidate(node) && isWhitespace(rootNode, node) === false || isNamedAnchor(node) || isBookmark(node);\n };\n var isBookmark = NodeType.hasAttribute('data-mce-bookmark');\n var isBogus$2 = NodeType.hasAttribute('data-mce-bogus');\n var isBogusAll$1 = NodeType.hasAttributeValue('data-mce-bogus', 'all');\n var isEmptyNode = function (targetNode) {\n var walker, node, brCount = 0;\n if (isContent(targetNode, targetNode)) {\n return false;\n } else {\n node = targetNode.firstChild;\n if (!node) {\n return true;\n }\n walker = new TreeWalker(node, targetNode);\n do {\n if (isBogusAll$1(node)) {\n node = walker.next(true);\n continue;\n }\n if (isBogus$2(node)) {\n node = walker.next();\n continue;\n }\n if (NodeType.isBr(node)) {\n brCount++;\n node = walker.next();\n continue;\n }\n if (isContent(targetNode, node)) {\n return false;\n }\n node = walker.next();\n } while (node);\n return brCount <= 1;\n }\n };\n var isEmpty$1 = function (elm) {\n return isEmptyNode(elm.dom());\n };\n var Empty = { isEmpty: isEmpty$1 };\n\n var BlockPosition = Immutable('block', 'position');\n var BlockBoundary = Immutable('from', 'to');\n var getBlockPosition = function (rootNode, pos) {\n var rootElm = Element.fromDom(rootNode);\n var containerElm = Element.fromDom(pos.container());\n return DeleteUtils.getParentBlock(rootElm, containerElm).map(function (block) {\n return BlockPosition(block, pos);\n });\n };\n var isDifferentBlocks = function (blockBoundary) {\n return eq(blockBoundary.from().block(), blockBoundary.to().block()) === false;\n };\n var hasSameParent = function (blockBoundary) {\n return parent(blockBoundary.from().block()).bind(function (parent1) {\n return parent(blockBoundary.to().block()).filter(function (parent2) {\n return eq(parent1, parent2);\n });\n }).isSome();\n };\n var isEditable = function (blockBoundary) {\n return NodeType.isContentEditableFalse(blockBoundary.from().block().dom()) === false && NodeType.isContentEditableFalse(blockBoundary.to().block().dom()) === false;\n };\n var skipLastBr = function (rootNode, forward, blockPosition) {\n if (NodeType.isBr(blockPosition.position().getNode()) && Empty.isEmpty(blockPosition.block()) === false) {\n return CaretFinder.positionIn(false, blockPosition.block().dom()).bind(function (lastPositionInBlock) {\n if (lastPositionInBlock.isEqual(blockPosition.position())) {\n return CaretFinder.fromPosition(forward, rootNode, lastPositionInBlock).bind(function (to) {\n return getBlockPosition(rootNode, to);\n });\n } else {\n return Option.some(blockPosition);\n }\n }).getOr(blockPosition);\n } else {\n return blockPosition;\n }\n };\n var readFromRange = function (rootNode, forward, rng) {\n var fromBlockPos = getBlockPosition(rootNode, CaretPosition$1.fromRangeStart(rng));\n var toBlockPos = fromBlockPos.bind(function (blockPos) {\n return CaretFinder.fromPosition(forward, rootNode, blockPos.position()).bind(function (to) {\n return getBlockPosition(rootNode, to).map(function (blockPos) {\n return skipLastBr(rootNode, forward, blockPos);\n });\n });\n });\n return lift2(fromBlockPos, toBlockPos, BlockBoundary).filter(function (blockBoundary) {\n return isDifferentBlocks(blockBoundary) && hasSameParent(blockBoundary) && isEditable(blockBoundary);\n });\n };\n var read$1 = function (rootNode, forward, rng) {\n return rng.collapsed ? readFromRange(rootNode, forward, rng) : Option.none();\n };\n var BlockMergeBoundary = { read: read$1 };\n\n var dropLast = function (xs) {\n return xs.slice(0, -1);\n };\n var parentsUntil$1 = function (start, root, predicate) {\n if (contains$3(root, start)) {\n return dropLast(parents(start, function (elm) {\n return predicate(elm) || eq(elm, root);\n }));\n } else {\n return [];\n }\n };\n var parents$1 = function (start, root) {\n return parentsUntil$1(start, root, constant(false));\n };\n var parentsAndSelf = function (start, root) {\n return [start].concat(parents$1(start, root));\n };\n var Parents = {\n parentsUntil: parentsUntil$1,\n parents: parents$1,\n parentsAndSelf: parentsAndSelf\n };\n\n var getChildrenUntilBlockBoundary = function (block) {\n var children$1 = children(block);\n return findIndex(children$1, isBlock).fold(function () {\n return children$1;\n }, function (index) {\n return children$1.slice(0, index);\n });\n };\n var extractChildren = function (block) {\n var children = getChildrenUntilBlockBoundary(block);\n each(children, remove$1);\n return children;\n };\n var removeEmptyRoot = function (rootNode, block) {\n var parents = Parents.parentsAndSelf(block, rootNode);\n return find(parents.reverse(), Empty.isEmpty).each(remove$1);\n };\n var isEmptyBefore = function (el) {\n return filter(prevSiblings(el), function (el) {\n return !Empty.isEmpty(el);\n }).length === 0;\n };\n var nestedBlockMerge = function (rootNode, fromBlock, toBlock, insertionPoint) {\n if (Empty.isEmpty(toBlock)) {\n PaddingBr.fillWithPaddingBr(toBlock);\n return CaretFinder.firstPositionIn(toBlock.dom());\n }\n if (isEmptyBefore(insertionPoint) && Empty.isEmpty(fromBlock)) {\n before(insertionPoint, Element.fromTag('br'));\n }\n var position = CaretFinder.prevPosition(toBlock.dom(), CaretPosition$1.before(insertionPoint.dom()));\n each(extractChildren(fromBlock), function (child) {\n before(insertionPoint, child);\n });\n removeEmptyRoot(rootNode, fromBlock);\n return position;\n };\n var sidelongBlockMerge = function (rootNode, fromBlock, toBlock) {\n if (Empty.isEmpty(toBlock)) {\n remove$1(toBlock);\n if (Empty.isEmpty(fromBlock)) {\n PaddingBr.fillWithPaddingBr(fromBlock);\n }\n return CaretFinder.firstPositionIn(fromBlock.dom());\n }\n var position = CaretFinder.lastPositionIn(toBlock.dom());\n each(extractChildren(fromBlock), function (child) {\n append(toBlock, child);\n });\n removeEmptyRoot(rootNode, fromBlock);\n return position;\n };\n var findInsertionPoint = function (toBlock, block) {\n var parentsAndSelf = Parents.parentsAndSelf(block, toBlock);\n return Option.from(parentsAndSelf[parentsAndSelf.length - 1]);\n };\n var getInsertionPoint = function (fromBlock, toBlock) {\n return contains$3(toBlock, fromBlock) ? findInsertionPoint(toBlock, fromBlock) : Option.none();\n };\n var trimBr = function (first, block) {\n CaretFinder.positionIn(first, block.dom()).map(function (position) {\n return position.getNode();\n }).map(Element.fromDom).filter(isBr).each(remove$1);\n };\n var mergeBlockInto = function (rootNode, fromBlock, toBlock) {\n trimBr(true, fromBlock);\n trimBr(false, toBlock);\n return getInsertionPoint(fromBlock, toBlock).fold(curry(sidelongBlockMerge, rootNode, fromBlock, toBlock), curry(nestedBlockMerge, rootNode, fromBlock, toBlock));\n };\n var mergeBlocks = function (rootNode, forward, block1, block2) {\n return forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2);\n };\n var MergeBlocks = { mergeBlocks: mergeBlocks };\n\n var backspaceDelete = function (editor, forward) {\n var position;\n var rootNode = Element.fromDom(editor.getBody());\n position = BlockMergeBoundary.read(rootNode.dom(), forward, editor.selection.getRng()).bind(function (blockBoundary) {\n return MergeBlocks.mergeBlocks(rootNode, forward, blockBoundary.from().block(), blockBoundary.to().block());\n });\n position.each(function (pos) {\n editor.selection.setRng(pos.toRange());\n });\n return position.isSome();\n };\n var BlockBoundaryDelete = { backspaceDelete: backspaceDelete };\n\n var deleteRangeMergeBlocks = function (rootNode, selection) {\n var rng = selection.getRng();\n return lift2(DeleteUtils.getParentBlock(rootNode, Element.fromDom(rng.startContainer)), DeleteUtils.getParentBlock(rootNode, Element.fromDom(rng.endContainer)), function (block1, block2) {\n if (eq(block1, block2) === false) {\n rng.deleteContents();\n MergeBlocks.mergeBlocks(rootNode, true, block1, block2).each(function (pos) {\n selection.setRng(pos.toRange());\n });\n return true;\n } else {\n return false;\n }\n }).getOr(false);\n };\n var isRawNodeInTable = function (root, rawNode) {\n var node = Element.fromDom(rawNode);\n var isRoot = curry(eq, root);\n return ancestor(node, isTableCell, isRoot).isSome();\n };\n var isSelectionInTable = function (root, rng) {\n return isRawNodeInTable(root, rng.startContainer) || isRawNodeInTable(root, rng.endContainer);\n };\n var isEverythingSelected = function (root, rng) {\n var noPrevious = CaretFinder.prevPosition(root.dom(), CaretPosition$1.fromRangeStart(rng)).isNone();\n var noNext = CaretFinder.nextPosition(root.dom(), CaretPosition$1.fromRangeEnd(rng)).isNone();\n return !isSelectionInTable(root, rng) && noPrevious && noNext;\n };\n var emptyEditor = function (editor) {\n editor.setContent('');\n editor.selection.setCursorLocation();\n return true;\n };\n var deleteRange = function (editor) {\n var rootNode = Element.fromDom(editor.getBody());\n var rng = editor.selection.getRng();\n return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection);\n };\n var backspaceDelete$1 = function (editor, forward) {\n return editor.selection.isCollapsed() ? false : deleteRange(editor);\n };\n var BlockRangeDelete = { backspaceDelete: backspaceDelete$1 };\n\n var generate$1 = function (cases) {\n if (!isArray(cases)) {\n throw new Error('cases must be an array');\n }\n if (cases.length === 0) {\n throw new Error('there must be at least one case');\n }\n var constructors = [];\n var adt = {};\n each(cases, function (acase, count) {\n var keys$1 = keys(acase);\n if (keys$1.length !== 1) {\n throw new Error('one and only one name per case');\n }\n var key = keys$1[0];\n var value = acase[key];\n if (adt[key] !== undefined) {\n throw new Error('duplicate key detected:' + key);\n } else if (key === 'cata') {\n throw new Error('cannot have a case named cata (sorry)');\n } else if (!isArray(value)) {\n throw new Error('case arguments must be an array');\n }\n constructors.push(key);\n adt[key] = function () {\n var argLength = arguments.length;\n if (argLength !== value.length) {\n throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);\n }\n var args = new Array(argLength);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n var match = function (branches) {\n var branchKeys = keys(branches);\n if (constructors.length !== branchKeys.length) {\n throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\\nActual: ' + branchKeys.join(','));\n }\n var allReqd = forall(constructors, function (reqKey) {\n return contains(branchKeys, reqKey);\n });\n if (!allReqd) {\n throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\\nRequired: ' + constructors.join(', '));\n }\n return branches[key].apply(null, args);\n };\n return {\n fold: function () {\n if (arguments.length !== cases.length) {\n throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length);\n }\n var target = arguments[count];\n return target.apply(null, args);\n },\n match: match,\n log: function (label) {\n domGlobals.console.log(label, {\n constructors: constructors,\n constructor: key,\n params: args\n });\n }\n };\n };\n });\n return adt;\n };\n var Adt = { generate: generate$1 };\n\n var isBr$5 = function (pos) {\n return getElementFromPosition(pos).exists(isBr);\n };\n var findBr = function (forward, root, pos) {\n var parentBlocks = filter(Parents.parentsAndSelf(Element.fromDom(pos.container()), root), isBlock);\n var scope = head(parentBlocks).getOr(root);\n return CaretFinder.fromPosition(forward, scope.dom(), pos).filter(isBr$5);\n };\n var isBeforeBr = function (root, pos) {\n return getElementFromPosition(pos).exists(isBr) || findBr(true, root, pos).isSome();\n };\n var isAfterBr = function (root, pos) {\n return getElementFromPrevPosition(pos).exists(isBr) || findBr(false, root, pos).isSome();\n };\n var findPreviousBr = curry(findBr, false);\n var findNextBr = curry(findBr, true);\n\n var is$2 = function (expected) {\n return function (actual) {\n return expected === actual;\n };\n };\n var isNbsp = is$2('\\xA0');\n var isWhiteSpace$1 = function (chr) {\n return /^[\\r\\n\\t ]$/.test(chr);\n };\n var isContent$1 = function (chr) {\n return !isWhiteSpace$1(chr) && !isNbsp(chr);\n };\n\n var isChar = function (forward, predicate, pos) {\n return Option.from(pos.container()).filter(NodeType.isText).exists(function (text) {\n var delta = forward ? 0 : -1;\n return predicate(text.data.charAt(pos.offset() + delta));\n });\n };\n var isBeforeSpace = curry(isChar, true, isWhiteSpace$1);\n var isAfterSpace = curry(isChar, false, isWhiteSpace$1);\n var isEmptyText = function (pos) {\n var container = pos.container();\n return NodeType.isText(container) && container.data.length === 0;\n };\n var isNextToContentEditableFalse = function (relativeOffset, caretPosition) {\n var node = getChildNodeAtRelativeOffset(relativeOffset, caretPosition);\n return NodeType.isContentEditableFalse(node) && !NodeType.isBogusAll(node);\n };\n var isBeforeContentEditableFalse = curry(isNextToContentEditableFalse, 0);\n var isAfterContentEditableFalse = curry(isNextToContentEditableFalse, -1);\n var isNextToTable = function (relativeOffset, caretPosition) {\n return NodeType.isTable(getChildNodeAtRelativeOffset(relativeOffset, caretPosition));\n };\n var isBeforeTable = curry(isNextToTable, 0);\n var isAfterTable = curry(isNextToTable, -1);\n\n var isCompoundElement = function (node) {\n return isTableCell(Element.fromDom(node)) || isListItem(Element.fromDom(node));\n };\n var DeleteAction = Adt.generate([\n { remove: ['element'] },\n { moveToElement: ['element'] },\n { moveToPosition: ['position'] }\n ]);\n var isAtContentEditableBlockCaret = function (forward, from) {\n var elm = from.getNode(forward === false);\n var caretLocation = forward ? 'after' : 'before';\n return NodeType.isElement(elm) && elm.getAttribute('data-mce-caret') === caretLocation;\n };\n var isDeleteFromCefDifferentBlocks = function (root, forward, from, to) {\n var inSameBlock = function (elm) {\n return isInline(Element.fromDom(elm)) && !isInSameBlock(from, to, root);\n };\n return getRelativeCefElm(!forward, from).fold(function () {\n return getRelativeCefElm(forward, to).fold(constant(false), inSameBlock);\n }, inSameBlock);\n };\n var deleteEmptyBlockOrMoveToCef = function (root, forward, from, to) {\n var toCefElm = to.getNode(forward === false);\n return DeleteUtils.getParentBlock(Element.fromDom(root), Element.fromDom(from.getNode())).map(function (blockElm) {\n return Empty.isEmpty(blockElm) ? DeleteAction.remove(blockElm.dom()) : DeleteAction.moveToElement(toCefElm);\n }).orThunk(function () {\n return Option.some(DeleteAction.moveToElement(toCefElm));\n });\n };\n var findCefPosition = function (root, forward, from) {\n return CaretFinder.fromPosition(forward, root, from).bind(function (to) {\n if (isCompoundElement(to.getNode())) {\n return Option.none();\n } else if (isDeleteFromCefDifferentBlocks(root, forward, from, to)) {\n return Option.none();\n } else if (forward && NodeType.isContentEditableFalse(to.getNode())) {\n return deleteEmptyBlockOrMoveToCef(root, forward, from, to);\n } else if (forward === false && NodeType.isContentEditableFalse(to.getNode(true))) {\n return deleteEmptyBlockOrMoveToCef(root, forward, from, to);\n } else if (forward && isAfterContentEditableFalse(from)) {\n return Option.some(DeleteAction.moveToPosition(to));\n } else if (forward === false && isBeforeContentEditableFalse(from)) {\n return Option.some(DeleteAction.moveToPosition(to));\n } else {\n return Option.none();\n }\n });\n };\n var getContentEditableBlockAction = function (forward, elm) {\n if (forward && NodeType.isContentEditableFalse(elm.nextSibling)) {\n return Option.some(DeleteAction.moveToElement(elm.nextSibling));\n } else if (forward === false && NodeType.isContentEditableFalse(elm.previousSibling)) {\n return Option.some(DeleteAction.moveToElement(elm.previousSibling));\n } else {\n return Option.none();\n }\n };\n var skipMoveToActionFromInlineCefToContent = function (root, from, deleteAction) {\n return deleteAction.fold(function (elm) {\n return Option.some(DeleteAction.remove(elm));\n }, function (elm) {\n return Option.some(DeleteAction.moveToElement(elm));\n }, function (to) {\n if (isInSameBlock(from, to, root)) {\n return Option.none();\n } else {\n return Option.some(DeleteAction.moveToPosition(to));\n }\n });\n };\n var getContentEditableAction = function (root, forward, from) {\n if (isAtContentEditableBlockCaret(forward, from)) {\n return getContentEditableBlockAction(forward, from.getNode(forward === false)).fold(function () {\n return findCefPosition(root, forward, from);\n }, Option.some);\n } else {\n return findCefPosition(root, forward, from).bind(function (deleteAction) {\n return skipMoveToActionFromInlineCefToContent(root, from, deleteAction);\n });\n }\n };\n var read$2 = function (root, forward, rng) {\n var normalizedRange = normalizeRange(forward ? 1 : -1, root, rng);\n var from = CaretPosition$1.fromRangeStart(normalizedRange);\n var rootElement = Element.fromDom(root);\n if (forward === false && isAfterContentEditableFalse(from)) {\n return Option.some(DeleteAction.remove(from.getNode(true)));\n } else if (forward && isBeforeContentEditableFalse(from)) {\n return Option.some(DeleteAction.remove(from.getNode()));\n } else if (forward === false && isBeforeContentEditableFalse(from) && isAfterBr(rootElement, from)) {\n return findPreviousBr(rootElement, from).map(function (br) {\n return DeleteAction.remove(br.getNode());\n });\n } else if (forward && isAfterContentEditableFalse(from) && isBeforeBr(rootElement, from)) {\n return findNextBr(rootElement, from).map(function (br) {\n return DeleteAction.remove(br.getNode());\n });\n } else {\n return getContentEditableAction(root, forward, from);\n }\n };\n\n var isCollapsibleWhitespace = function (c) {\n return ' \\f\\n\\r\\t\\x0B'.indexOf(c) !== -1;\n };\n var normalizeContent = function (content, isStartOfContent, isEndOfContent) {\n var result = foldl(content.split(''), function (acc, c) {\n if (isCollapsibleWhitespace(c) || c === '\\xA0') {\n if (acc.previousCharIsSpace || acc.str === '' && isStartOfContent || acc.str.length === content.length - 1 && isEndOfContent) {\n return {\n previousCharIsSpace: false,\n str: acc.str + '\\xA0'\n };\n } else {\n return {\n previousCharIsSpace: true,\n str: acc.str + ' '\n };\n }\n } else {\n return {\n previousCharIsSpace: false,\n str: acc.str + c\n };\n }\n }, {\n previousCharIsSpace: false,\n str: ''\n });\n return result.str;\n };\n var normalize$1 = function (node, offset, count) {\n if (count === 0) {\n return;\n }\n var whitespace = node.data.slice(offset, offset + count);\n var isEndOfContent = offset + count >= node.data.length;\n var isStartOfContent = offset === 0;\n node.replaceData(offset, count, normalizeContent(whitespace, isStartOfContent, isEndOfContent));\n };\n var normalizeWhitespaceAfter = function (node, offset) {\n var content = node.data.slice(offset);\n var whitespaceCount = content.length - lTrim(content).length;\n return normalize$1(node, offset, whitespaceCount);\n };\n var normalizeWhitespaceBefore = function (node, offset) {\n var content = node.data.slice(0, offset);\n var whitespaceCount = content.length - rTrim(content).length;\n return normalize$1(node, offset - whitespaceCount, whitespaceCount);\n };\n var mergeTextNodes = function (prevNode, nextNode, normalizeWhitespace) {\n var whitespaceOffset = rTrim(prevNode.data).length;\n prevNode.appendData(nextNode.data);\n remove$1(Element.fromDom(nextNode));\n if (normalizeWhitespace) {\n normalizeWhitespaceAfter(prevNode, whitespaceOffset);\n }\n return prevNode;\n };\n\n var needsReposition = function (pos, elm) {\n var container = pos.container();\n var offset = pos.offset();\n return CaretPosition$1.isTextPosition(pos) === false && container === elm.parentNode && offset > CaretPosition$1.before(elm).offset();\n };\n var reposition = function (elm, pos) {\n return needsReposition(pos, elm) ? CaretPosition$1(pos.container(), pos.offset() - 1) : pos;\n };\n var beforeOrStartOf = function (node) {\n return NodeType.isText(node) ? CaretPosition$1(node, 0) : CaretPosition$1.before(node);\n };\n var afterOrEndOf = function (node) {\n return NodeType.isText(node) ? CaretPosition$1(node, node.data.length) : CaretPosition$1.after(node);\n };\n var getPreviousSiblingCaretPosition = function (elm) {\n if (isCaretCandidate(elm.previousSibling)) {\n return Option.some(afterOrEndOf(elm.previousSibling));\n } else {\n return elm.previousSibling ? CaretFinder.lastPositionIn(elm.previousSibling) : Option.none();\n }\n };\n var getNextSiblingCaretPosition = function (elm) {\n if (isCaretCandidate(elm.nextSibling)) {\n return Option.some(beforeOrStartOf(elm.nextSibling));\n } else {\n return elm.nextSibling ? CaretFinder.firstPositionIn(elm.nextSibling) : Option.none();\n }\n };\n var findCaretPositionBackwardsFromElm = function (rootElement, elm) {\n var startPosition = CaretPosition$1.before(elm.previousSibling ? elm.previousSibling : elm.parentNode);\n return CaretFinder.prevPosition(rootElement, startPosition).fold(function () {\n return CaretFinder.nextPosition(rootElement, CaretPosition$1.after(elm));\n }, Option.some);\n };\n var findCaretPositionForwardsFromElm = function (rootElement, elm) {\n return CaretFinder.nextPosition(rootElement, CaretPosition$1.after(elm)).fold(function () {\n return CaretFinder.prevPosition(rootElement, CaretPosition$1.before(elm));\n }, Option.some);\n };\n var findCaretPositionBackwards = function (rootElement, elm) {\n return getPreviousSiblingCaretPosition(elm).orThunk(function () {\n return getNextSiblingCaretPosition(elm);\n }).orThunk(function () {\n return findCaretPositionBackwardsFromElm(rootElement, elm);\n });\n };\n var findCaretPositionForward = function (rootElement, elm) {\n return getNextSiblingCaretPosition(elm).orThunk(function () {\n return getPreviousSiblingCaretPosition(elm);\n }).orThunk(function () {\n return findCaretPositionForwardsFromElm(rootElement, elm);\n });\n };\n var findCaretPosition$1 = function (forward, rootElement, elm) {\n return forward ? findCaretPositionForward(rootElement, elm) : findCaretPositionBackwards(rootElement, elm);\n };\n var findCaretPosOutsideElmAfterDelete = function (forward, rootElement, elm) {\n return findCaretPosition$1(forward, rootElement, elm).map(curry(reposition, elm));\n };\n var setSelection = function (editor, forward, pos) {\n pos.fold(function () {\n editor.focus();\n }, function (pos) {\n editor.selection.setRng(pos.toRange(), forward);\n });\n };\n var eqRawNode = function (rawNode) {\n return function (elm) {\n return elm.dom() === rawNode;\n };\n };\n var isBlock$2 = function (editor, elm) {\n return elm && editor.schema.getBlockElements().hasOwnProperty(name(elm));\n };\n var paddEmptyBlock = function (elm) {\n if (Empty.isEmpty(elm)) {\n var br = Element.fromHtml('
');\n empty(elm);\n append(elm, br);\n return Option.some(CaretPosition$1.before(br.dom()));\n } else {\n return Option.none();\n }\n };\n var deleteNormalized = function (elm, afterDeletePosOpt, normalizeWhitespace) {\n var prevTextOpt = prevSibling(elm).filter(isText);\n var nextTextOpt = nextSibling(elm).filter(isText);\n remove$1(elm);\n return lift3(prevTextOpt, nextTextOpt, afterDeletePosOpt, function (prev, next, pos) {\n var prevNode = prev.dom(), nextNode = next.dom();\n var offset = prevNode.data.length;\n mergeTextNodes(prevNode, nextNode, normalizeWhitespace);\n return pos.container() === nextNode ? CaretPosition$1(prevNode, offset) : pos;\n }).orThunk(function () {\n if (normalizeWhitespace) {\n prevTextOpt.each(function (elm) {\n return normalizeWhitespaceBefore(elm.dom(), elm.dom().length);\n });\n nextTextOpt.each(function (elm) {\n return normalizeWhitespaceAfter(elm.dom(), 0);\n });\n }\n return afterDeletePosOpt;\n });\n };\n var isInlineElement = function (editor, element) {\n return has(editor.schema.getTextInlineElements(), name(element));\n };\n var deleteElement = function (editor, forward, elm, moveCaret) {\n if (moveCaret === void 0) {\n moveCaret = true;\n }\n var afterDeletePos = findCaretPosOutsideElmAfterDelete(forward, editor.getBody(), elm.dom());\n var parentBlock = ancestor(elm, curry(isBlock$2, editor), eqRawNode(editor.getBody()));\n var normalizedAfterDeletePos = deleteNormalized(elm, afterDeletePos, isInlineElement(editor, elm));\n if (editor.dom.isEmpty(editor.getBody())) {\n editor.setContent('');\n editor.selection.setCursorLocation();\n } else {\n parentBlock.bind(paddEmptyBlock).fold(function () {\n if (moveCaret) {\n setSelection(editor, forward, normalizedAfterDeletePos);\n }\n }, function (paddPos) {\n if (moveCaret) {\n setSelection(editor, forward, Option.some(paddPos));\n }\n });\n }\n };\n var DeleteElement = { deleteElement: deleteElement };\n\n var deleteElement$1 = function (editor, forward) {\n return function (element) {\n editor._selectionOverrides.hideFakeCaret();\n DeleteElement.deleteElement(editor, forward, Element.fromDom(element));\n return true;\n };\n };\n var moveToElement = function (editor, forward) {\n return function (element) {\n var pos = forward ? CaretPosition$1.before(element) : CaretPosition$1.after(element);\n editor.selection.setRng(pos.toRange());\n return true;\n };\n };\n var moveToPosition = function (editor) {\n return function (pos) {\n editor.selection.setRng(pos.toRange());\n return true;\n };\n };\n var backspaceDeleteCaret = function (editor, forward) {\n var result = read$2(editor.getBody(), forward, editor.selection.getRng()).map(function (deleteAction) {\n return deleteAction.fold(deleteElement$1(editor, forward), moveToElement(editor, forward), moveToPosition(editor));\n });\n return result.getOr(false);\n };\n var deleteOffscreenSelection = function (rootElement) {\n each(descendants$1(rootElement, '.mce-offscreen-selection'), remove$1);\n };\n var backspaceDeleteRange = function (editor, forward) {\n var selectedElement = editor.selection.getNode();\n if (NodeType.isContentEditableFalse(selectedElement)) {\n deleteOffscreenSelection(Element.fromDom(editor.getBody()));\n DeleteElement.deleteElement(editor, forward, Element.fromDom(editor.selection.getNode()));\n DeleteUtils.paddEmptyBody(editor);\n return true;\n } else {\n return false;\n }\n };\n var getContentEditableRoot = function (root, node) {\n while (node && node !== root) {\n if (NodeType.isContentEditableTrue(node) || NodeType.isContentEditableFalse(node)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n };\n var paddEmptyElement = function (editor) {\n var br;\n var ceRoot = getContentEditableRoot(editor.getBody(), editor.selection.getNode());\n if (NodeType.isContentEditableTrue(ceRoot) && editor.dom.isBlock(ceRoot) && editor.dom.isEmpty(ceRoot)) {\n br = editor.dom.create('br', { 'data-mce-bogus': '1' });\n editor.dom.setHTML(ceRoot, '');\n ceRoot.appendChild(br);\n editor.selection.setRng(CaretPosition$1.before(br).toRange());\n }\n return true;\n };\n var backspaceDelete$2 = function (editor, forward) {\n if (editor.selection.isCollapsed()) {\n return backspaceDeleteCaret(editor, forward);\n } else {\n return backspaceDeleteRange(editor, forward);\n }\n };\n var CefDelete = {\n backspaceDelete: backspaceDelete$2,\n paddEmptyElement: paddEmptyElement\n };\n\n var isText$8 = NodeType.isText;\n var startsWithCaretContainer$1 = function (node) {\n return isText$8(node) && node.data[0] === Zwsp.ZWSP;\n };\n var endsWithCaretContainer$1 = function (node) {\n return isText$8(node) && node.data[node.data.length - 1] === Zwsp.ZWSP;\n };\n var createZwsp = function (node) {\n return node.ownerDocument.createTextNode(Zwsp.ZWSP);\n };\n var insertBefore$1 = function (node) {\n if (isText$8(node.previousSibling)) {\n if (endsWithCaretContainer$1(node.previousSibling)) {\n return node.previousSibling;\n } else {\n node.previousSibling.appendData(Zwsp.ZWSP);\n return node.previousSibling;\n }\n } else if (isText$8(node)) {\n if (startsWithCaretContainer$1(node)) {\n return node;\n } else {\n node.insertData(0, Zwsp.ZWSP);\n return node;\n }\n } else {\n var newNode = createZwsp(node);\n node.parentNode.insertBefore(newNode, node);\n return newNode;\n }\n };\n var insertAfter$1 = function (node) {\n if (isText$8(node.nextSibling)) {\n if (startsWithCaretContainer$1(node.nextSibling)) {\n return node.nextSibling;\n } else {\n node.nextSibling.insertData(0, Zwsp.ZWSP);\n return node.nextSibling;\n }\n } else if (isText$8(node)) {\n if (endsWithCaretContainer$1(node)) {\n return node;\n } else {\n node.appendData(Zwsp.ZWSP);\n return node;\n }\n } else {\n var newNode = createZwsp(node);\n if (node.nextSibling) {\n node.parentNode.insertBefore(newNode, node.nextSibling);\n } else {\n node.parentNode.appendChild(newNode);\n }\n return newNode;\n }\n };\n var insertInline$1 = function (before, node) {\n return before ? insertBefore$1(node) : insertAfter$1(node);\n };\n var insertInlineBefore = curry(insertInline$1, true);\n var insertInlineAfter = curry(insertInline$1, false);\n\n var insertInlinePos = function (pos, before) {\n if (NodeType.isText(pos.container())) {\n return insertInline$1(before, pos.container());\n } else {\n return insertInline$1(before, pos.getNode());\n }\n };\n var isPosCaretContainer = function (pos, caret) {\n var caretNode = caret.get();\n return caretNode && pos.container() === caretNode && isCaretContainerInline(caretNode);\n };\n var renderCaret = function (caret, location) {\n return location.fold(function (element) {\n CaretContainerRemove.remove(caret.get());\n var text = insertInlineBefore(element);\n caret.set(text);\n return Option.some(CaretPosition$1(text, text.length - 1));\n }, function (element) {\n return CaretFinder.firstPositionIn(element).map(function (pos) {\n if (!isPosCaretContainer(pos, caret)) {\n CaretContainerRemove.remove(caret.get());\n var text = insertInlinePos(pos, true);\n caret.set(text);\n return CaretPosition$1(text, 1);\n } else {\n return CaretPosition$1(caret.get(), 1);\n }\n });\n }, function (element) {\n return CaretFinder.lastPositionIn(element).map(function (pos) {\n if (!isPosCaretContainer(pos, caret)) {\n CaretContainerRemove.remove(caret.get());\n var text = insertInlinePos(pos, false);\n caret.set(text);\n return CaretPosition$1(text, text.length - 1);\n } else {\n return CaretPosition$1(caret.get(), caret.get().length - 1);\n }\n });\n }, function (element) {\n CaretContainerRemove.remove(caret.get());\n var text = insertInlineAfter(element);\n caret.set(text);\n return Option.some(CaretPosition$1(text, 1));\n });\n };\n var BoundaryCaret = { renderCaret: renderCaret };\n\n var evaluateUntil = function (fns, args) {\n for (var i = 0; i < fns.length; i++) {\n var result = fns[i].apply(null, args);\n if (result.isSome()) {\n return result;\n }\n }\n return Option.none();\n };\n var LazyEvaluator = { evaluateUntil: evaluateUntil };\n\n var Location = Adt.generate([\n { before: ['element'] },\n { start: ['element'] },\n { end: ['element'] },\n { after: ['element'] }\n ]);\n var rescope = function (rootNode, node) {\n var parentBlock = getParentBlock(node, rootNode);\n return parentBlock ? parentBlock : rootNode;\n };\n var before$3 = function (isInlineTarget, rootNode, pos) {\n var nPos = InlineUtils.normalizeForwards(pos);\n var scope = rescope(rootNode, nPos.container());\n return InlineUtils.findRootInline(isInlineTarget, scope, nPos).fold(function () {\n return CaretFinder.nextPosition(scope, nPos).bind(curry(InlineUtils.findRootInline, isInlineTarget, scope)).map(function (inline) {\n return Location.before(inline);\n });\n }, Option.none);\n };\n var isNotInsideFormatCaretContainer = function (rootNode, elm) {\n return getParentCaretContainer(rootNode, elm) === null;\n };\n var findInsideRootInline = function (isInlineTarget, rootNode, pos) {\n return InlineUtils.findRootInline(isInlineTarget, rootNode, pos).filter(curry(isNotInsideFormatCaretContainer, rootNode));\n };\n var start = function (isInlineTarget, rootNode, pos) {\n var nPos = InlineUtils.normalizeBackwards(pos);\n return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) {\n var prevPos = CaretFinder.prevPosition(inline, nPos);\n return prevPos.isNone() ? Option.some(Location.start(inline)) : Option.none();\n });\n };\n var end = function (isInlineTarget, rootNode, pos) {\n var nPos = InlineUtils.normalizeForwards(pos);\n return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) {\n var nextPos = CaretFinder.nextPosition(inline, nPos);\n return nextPos.isNone() ? Option.some(Location.end(inline)) : Option.none();\n });\n };\n var after$2 = function (isInlineTarget, rootNode, pos) {\n var nPos = InlineUtils.normalizeBackwards(pos);\n var scope = rescope(rootNode, nPos.container());\n return InlineUtils.findRootInline(isInlineTarget, scope, nPos).fold(function () {\n return CaretFinder.prevPosition(scope, nPos).bind(curry(InlineUtils.findRootInline, isInlineTarget, scope)).map(function (inline) {\n return Location.after(inline);\n });\n }, Option.none);\n };\n var isValidLocation = function (location) {\n return InlineUtils.isRtl(getElement(location)) === false;\n };\n var readLocation = function (isInlineTarget, rootNode, pos) {\n var location = LazyEvaluator.evaluateUntil([\n before$3,\n start,\n end,\n after$2\n ], [\n isInlineTarget,\n rootNode,\n pos\n ]);\n return location.filter(isValidLocation);\n };\n var getElement = function (location) {\n return location.fold(identity, identity, identity, identity);\n };\n var getName = function (location) {\n return location.fold(constant('before'), constant('start'), constant('end'), constant('after'));\n };\n var outside = function (location) {\n return location.fold(Location.before, Location.before, Location.after, Location.after);\n };\n var inside = function (location) {\n return location.fold(Location.start, Location.start, Location.end, Location.end);\n };\n var isEq$1 = function (location1, location2) {\n return getName(location1) === getName(location2) && getElement(location1) === getElement(location2);\n };\n var betweenInlines = function (forward, isInlineTarget, rootNode, from, to, location) {\n return lift2(InlineUtils.findRootInline(isInlineTarget, rootNode, from), InlineUtils.findRootInline(isInlineTarget, rootNode, to), function (fromInline, toInline) {\n if (fromInline !== toInline && InlineUtils.hasSameParentBlock(rootNode, fromInline, toInline)) {\n return Location.after(forward ? fromInline : toInline);\n } else {\n return location;\n }\n }).getOr(location);\n };\n var skipNoMovement = function (fromLocation, toLocation) {\n return fromLocation.fold(constant(true), function (fromLocation) {\n return !isEq$1(fromLocation, toLocation);\n });\n };\n var findLocationTraverse = function (forward, isInlineTarget, rootNode, fromLocation, pos) {\n var from = InlineUtils.normalizePosition(forward, pos);\n var to = CaretFinder.fromPosition(forward, rootNode, from).map(curry(InlineUtils.normalizePosition, forward));\n var location = to.fold(function () {\n return fromLocation.map(outside);\n }, function (to) {\n return readLocation(isInlineTarget, rootNode, to).map(curry(betweenInlines, forward, isInlineTarget, rootNode, from, to)).filter(curry(skipNoMovement, fromLocation));\n });\n return location.filter(isValidLocation);\n };\n var findLocationSimple = function (forward, location) {\n if (forward) {\n return location.fold(compose(Option.some, Location.start), Option.none, compose(Option.some, Location.after), Option.none);\n } else {\n return location.fold(Option.none, compose(Option.some, Location.before), Option.none, compose(Option.some, Location.end));\n }\n };\n var findLocation = function (forward, isInlineTarget, rootNode, pos) {\n var from = InlineUtils.normalizePosition(forward, pos);\n var fromLocation = readLocation(isInlineTarget, rootNode, from);\n return readLocation(isInlineTarget, rootNode, from).bind(curry(findLocationSimple, forward)).orThunk(function () {\n return findLocationTraverse(forward, isInlineTarget, rootNode, fromLocation, pos);\n });\n };\n var BoundaryLocation = {\n readLocation: readLocation,\n findLocation: findLocation,\n prevLocation: curry(findLocation, false),\n nextLocation: curry(findLocation, true),\n getElement: getElement,\n outside: outside,\n inside: inside\n };\n\n var hasSelectionModifyApi = function (editor) {\n return isFunction(editor.selection.getSel().modify);\n };\n var moveRel = function (forward, selection, pos) {\n var delta = forward ? 1 : -1;\n selection.setRng(CaretPosition$1(pos.container(), pos.offset() + delta).toRange());\n selection.getSel().modify('move', forward ? 'forward' : 'backward', 'word');\n return true;\n };\n var moveByWord = function (forward, editor) {\n var rng = editor.selection.getRng();\n var pos = forward ? CaretPosition$1.fromRangeEnd(rng) : CaretPosition$1.fromRangeStart(rng);\n if (!hasSelectionModifyApi(editor)) {\n return false;\n } else if (forward && isBeforeInline(pos)) {\n return moveRel(true, editor.selection, pos);\n } else if (!forward && isAfterInline(pos)) {\n return moveRel(false, editor.selection, pos);\n } else {\n return false;\n }\n };\n var WordSelection = {\n hasSelectionModifyApi: hasSelectionModifyApi,\n moveByWord: moveByWord\n };\n\n var setCaretPosition = function (editor, pos) {\n var rng = editor.dom.createRng();\n rng.setStart(pos.container(), pos.offset());\n rng.setEnd(pos.container(), pos.offset());\n editor.selection.setRng(rng);\n };\n var isFeatureEnabled = function (editor) {\n return editor.settings.inline_boundaries !== false;\n };\n var setSelected = function (state, elm) {\n if (state) {\n elm.setAttribute('data-mce-selected', 'inline-boundary');\n } else {\n elm.removeAttribute('data-mce-selected');\n }\n };\n var renderCaretLocation = function (editor, caret, location) {\n return BoundaryCaret.renderCaret(caret, location).map(function (pos) {\n setCaretPosition(editor, pos);\n return location;\n });\n };\n var findLocation$1 = function (editor, caret, forward) {\n var rootNode = editor.getBody();\n var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n var isInlineTarget = curry(InlineUtils.isInlineTarget, editor);\n var location = BoundaryLocation.findLocation(forward, isInlineTarget, rootNode, from);\n return location.bind(function (location) {\n return renderCaretLocation(editor, caret, location);\n });\n };\n var toggleInlines = function (isInlineTarget, dom, elms) {\n var selectedInlines = filter(dom.select('*[data-mce-selected=\"inline-boundary\"]'), isInlineTarget);\n var targetInlines = filter(elms, isInlineTarget);\n each(difference(selectedInlines, targetInlines), curry(setSelected, false));\n each(difference(targetInlines, selectedInlines), curry(setSelected, true));\n };\n var safeRemoveCaretContainer = function (editor, caret) {\n if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) {\n var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n if (CaretPosition$1.isTextPosition(pos) && InlineUtils.isAtZwsp(pos) === false) {\n setCaretPosition(editor, CaretContainerRemove.removeAndReposition(caret.get(), pos));\n caret.set(null);\n }\n }\n };\n var renderInsideInlineCaret = function (isInlineTarget, editor, caret, elms) {\n if (editor.selection.isCollapsed()) {\n var inlines = filter(elms, isInlineTarget);\n each(inlines, function (inline) {\n var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n BoundaryLocation.readLocation(isInlineTarget, editor.getBody(), pos).bind(function (location) {\n return renderCaretLocation(editor, caret, location);\n });\n });\n }\n };\n var move = function (editor, caret, forward) {\n return function () {\n return isFeatureEnabled(editor) ? findLocation$1(editor, caret, forward).isSome() : false;\n };\n };\n var moveWord = function (forward, editor, caret) {\n return function () {\n return isFeatureEnabled(editor) ? WordSelection.moveByWord(forward, editor) : false;\n };\n };\n var setupSelectedState = function (editor) {\n var caret = Cell(null);\n var isInlineTarget = curry(InlineUtils.isInlineTarget, editor);\n editor.on('NodeChange', function (e) {\n if (isFeatureEnabled(editor)) {\n toggleInlines(isInlineTarget, editor.dom, e.parents);\n safeRemoveCaretContainer(editor, caret);\n renderInsideInlineCaret(isInlineTarget, editor, caret, e.parents);\n }\n });\n return caret;\n };\n var moveNextWord = curry(moveWord, true);\n var movePrevWord = curry(moveWord, false);\n var BoundarySelection = {\n move: move,\n moveNextWord: moveNextWord,\n movePrevWord: movePrevWord,\n setupSelectedState: setupSelectedState,\n setCaretPosition: setCaretPosition\n };\n\n var isFeatureEnabled$1 = function (editor) {\n return editor.settings.inline_boundaries !== false;\n };\n var rangeFromPositions = function (from, to) {\n var range = domGlobals.document.createRange();\n range.setStart(from.container(), from.offset());\n range.setEnd(to.container(), to.offset());\n return range;\n };\n var hasOnlyTwoOrLessPositionsLeft = function (elm) {\n return lift2(CaretFinder.firstPositionIn(elm), CaretFinder.lastPositionIn(elm), function (firstPos, lastPos) {\n var normalizedFirstPos = InlineUtils.normalizePosition(true, firstPos);\n var normalizedLastPos = InlineUtils.normalizePosition(false, lastPos);\n return CaretFinder.nextPosition(elm, normalizedFirstPos).map(function (pos) {\n return pos.isEqual(normalizedLastPos);\n }).getOr(true);\n }).getOr(true);\n };\n var setCaretLocation = function (editor, caret) {\n return function (location) {\n return BoundaryCaret.renderCaret(caret, location).map(function (pos) {\n BoundarySelection.setCaretPosition(editor, pos);\n return true;\n }).getOr(false);\n };\n };\n var deleteFromTo = function (editor, caret, from, to) {\n var rootNode = editor.getBody();\n var isInlineTarget = curry(InlineUtils.isInlineTarget, editor);\n editor.undoManager.ignore(function () {\n editor.selection.setRng(rangeFromPositions(from, to));\n editor.execCommand('Delete');\n BoundaryLocation.readLocation(isInlineTarget, rootNode, CaretPosition$1.fromRangeStart(editor.selection.getRng())).map(BoundaryLocation.inside).map(setCaretLocation(editor, caret));\n });\n editor.nodeChanged();\n };\n var rescope$1 = function (rootNode, node) {\n var parentBlock = getParentBlock(node, rootNode);\n return parentBlock ? parentBlock : rootNode;\n };\n var backspaceDeleteCollapsed = function (editor, caret, forward, from) {\n var rootNode = rescope$1(editor.getBody(), from.container());\n var isInlineTarget = curry(InlineUtils.isInlineTarget, editor);\n var fromLocation = BoundaryLocation.readLocation(isInlineTarget, rootNode, from);\n return fromLocation.bind(function (location) {\n if (forward) {\n return location.fold(constant(Option.some(BoundaryLocation.inside(location))), Option.none, constant(Option.some(BoundaryLocation.outside(location))), Option.none);\n } else {\n return location.fold(Option.none, constant(Option.some(BoundaryLocation.outside(location))), Option.none, constant(Option.some(BoundaryLocation.inside(location))));\n }\n }).map(setCaretLocation(editor, caret)).getOrThunk(function () {\n var toPosition = CaretFinder.navigate(forward, rootNode, from);\n var toLocation = toPosition.bind(function (pos) {\n return BoundaryLocation.readLocation(isInlineTarget, rootNode, pos);\n });\n if (fromLocation.isSome() && toLocation.isSome()) {\n return InlineUtils.findRootInline(isInlineTarget, rootNode, from).map(function (elm) {\n if (hasOnlyTwoOrLessPositionsLeft(elm)) {\n DeleteElement.deleteElement(editor, forward, Element.fromDom(elm));\n return true;\n } else {\n return false;\n }\n }).getOr(false);\n } else {\n return toLocation.bind(function (_) {\n return toPosition.map(function (to) {\n if (forward) {\n deleteFromTo(editor, caret, from, to);\n } else {\n deleteFromTo(editor, caret, to, from);\n }\n return true;\n });\n }).getOr(false);\n }\n });\n };\n var backspaceDelete$3 = function (editor, caret, forward) {\n if (editor.selection.isCollapsed() && isFeatureEnabled$1(editor)) {\n var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n return backspaceDeleteCollapsed(editor, caret, forward, from);\n }\n return false;\n };\n var InlineBoundaryDelete = { backspaceDelete: backspaceDelete$3 };\n\n var tableCellRng = Immutable('start', 'end');\n var tableSelection = Immutable('rng', 'table', 'cells');\n var deleteAction = Adt.generate([\n { removeTable: ['element'] },\n { emptyCells: ['cells'] }\n ]);\n var isRootFromElement = function (root) {\n return curry(eq, root);\n };\n var getClosestCell = function (container, isRoot) {\n return closest$1(Element.fromDom(container), 'td,th', isRoot);\n };\n var getClosestTable = function (cell, isRoot) {\n return ancestor$1(cell, 'table', isRoot);\n };\n var isExpandedCellRng = function (cellRng) {\n return eq(cellRng.start(), cellRng.end()) === false;\n };\n var getTableFromCellRng = function (cellRng, isRoot) {\n return getClosestTable(cellRng.start(), isRoot).bind(function (startParentTable) {\n return getClosestTable(cellRng.end(), isRoot).bind(function (endParentTable) {\n return eq(startParentTable, endParentTable) ? Option.some(startParentTable) : Option.none();\n });\n });\n };\n var getTableCells = function (table) {\n return descendants$1(table, 'td,th');\n };\n var getCellRangeFromStartTable = function (cellRng, isRoot) {\n return getClosestTable(cellRng.start(), isRoot).bind(function (table) {\n return last(getTableCells(table)).map(function (endCell) {\n return tableCellRng(cellRng.start(), endCell);\n });\n });\n };\n var partialSelection = function (isRoot, rng) {\n var startCell = getClosestCell(rng.startContainer, isRoot);\n var endCell = getClosestCell(rng.endContainer, isRoot);\n return rng.collapsed ? Option.none() : lift2(startCell, endCell, tableCellRng).fold(function () {\n return startCell.fold(function () {\n return endCell.bind(function (endCell) {\n return getClosestTable(endCell, isRoot).bind(function (table) {\n return head(getTableCells(table)).map(function (startCell) {\n return tableCellRng(startCell, endCell);\n });\n });\n });\n }, function (startCell) {\n return getClosestTable(startCell, isRoot).bind(function (table) {\n return last(getTableCells(table)).map(function (endCell) {\n return tableCellRng(startCell, endCell);\n });\n });\n });\n }, function (cellRng) {\n return isWithinSameTable(isRoot, cellRng) ? Option.none() : getCellRangeFromStartTable(cellRng, isRoot);\n });\n };\n var isWithinSameTable = function (isRoot, cellRng) {\n return getTableFromCellRng(cellRng, isRoot).isSome();\n };\n var getCellRng = function (rng, isRoot) {\n var startCell = getClosestCell(rng.startContainer, isRoot);\n var endCell = getClosestCell(rng.endContainer, isRoot);\n return lift2(startCell, endCell, tableCellRng).filter(isExpandedCellRng).filter(function (cellRng) {\n return isWithinSameTable(isRoot, cellRng);\n }).orThunk(function () {\n return partialSelection(isRoot, rng);\n });\n };\n var getTableSelectionFromCellRng = function (cellRng, isRoot) {\n return getTableFromCellRng(cellRng, isRoot).map(function (table) {\n return tableSelection(cellRng, table, getTableCells(table));\n });\n };\n var getTableSelectionFromRng = function (root, rng) {\n var isRoot = isRootFromElement(root);\n return getCellRng(rng, isRoot).bind(function (cellRng) {\n return getTableSelectionFromCellRng(cellRng, isRoot);\n });\n };\n var getCellIndex = function (cells, cell) {\n return findIndex(cells, function (x) {\n return eq(x, cell);\n });\n };\n var getSelectedCells = function (tableSelection) {\n return lift2(getCellIndex(tableSelection.cells(), tableSelection.rng().start()), getCellIndex(tableSelection.cells(), tableSelection.rng().end()), function (startIndex, endIndex) {\n return tableSelection.cells().slice(startIndex, endIndex + 1);\n });\n };\n var getAction = function (tableSelection) {\n return getSelectedCells(tableSelection).map(function (selected) {\n var cells = tableSelection.cells();\n return selected.length === cells.length ? deleteAction.removeTable(tableSelection.table()) : deleteAction.emptyCells(selected);\n });\n };\n var getActionFromCells = function (cells) {\n return deleteAction.emptyCells(cells);\n };\n var getActionFromRange = function (root, rng) {\n return getTableSelectionFromRng(root, rng).bind(getAction);\n };\n var TableDeleteAction = {\n getActionFromRange: getActionFromRange,\n getActionFromCells: getActionFromCells\n };\n\n var getRanges = function (selection) {\n var ranges = [];\n if (selection) {\n for (var i = 0; i < selection.rangeCount; i++) {\n ranges.push(selection.getRangeAt(i));\n }\n }\n return ranges;\n };\n var getSelectedNodes = function (ranges) {\n return bind(ranges, function (range) {\n var node = getSelectedNode(range);\n return node ? [Element.fromDom(node)] : [];\n });\n };\n var hasMultipleRanges = function (selection) {\n return getRanges(selection).length > 1;\n };\n var MultiRange = {\n getRanges: getRanges,\n getSelectedNodes: getSelectedNodes,\n hasMultipleRanges: hasMultipleRanges\n };\n\n var getCellsFromRanges = function (ranges) {\n return filter(MultiRange.getSelectedNodes(ranges), isTableCell);\n };\n var getCellsFromElement = function (elm) {\n var selectedCells = descendants$1(elm, 'td[data-mce-selected],th[data-mce-selected]');\n return selectedCells;\n };\n var getCellsFromElementOrRanges = function (ranges, element) {\n var selectedCells = getCellsFromElement(element);\n var rangeCells = getCellsFromRanges(ranges);\n return selectedCells.length > 0 ? selectedCells : rangeCells;\n };\n var getCellsFromEditor = function (editor) {\n return getCellsFromElementOrRanges(MultiRange.getRanges(editor.selection.getSel()), Element.fromDom(editor.getBody()));\n };\n var TableCellSelection = {\n getCellsFromRanges: getCellsFromRanges,\n getCellsFromElement: getCellsFromElement,\n getCellsFromElementOrRanges: getCellsFromElementOrRanges,\n getCellsFromEditor: getCellsFromEditor\n };\n\n var emptyCells = function (editor, cells) {\n each(cells, PaddingBr.fillWithPaddingBr);\n editor.selection.setCursorLocation(cells[0].dom(), 0);\n return true;\n };\n var deleteTableElement = function (editor, table) {\n DeleteElement.deleteElement(editor, false, table);\n return true;\n };\n var deleteCellRange = function (editor, rootElm, rng) {\n return TableDeleteAction.getActionFromRange(rootElm, rng).map(function (action) {\n return action.fold(curry(deleteTableElement, editor), curry(emptyCells, editor));\n });\n };\n var deleteCaptionRange = function (editor, caption) {\n return emptyElement(editor, caption);\n };\n var deleteTableRange = function (editor, rootElm, rng, startElm) {\n return getParentCaption(rootElm, startElm).fold(function () {\n return deleteCellRange(editor, rootElm, rng);\n }, function (caption) {\n return deleteCaptionRange(editor, caption);\n }).getOr(false);\n };\n var deleteRange$1 = function (editor, startElm) {\n var rootNode = Element.fromDom(editor.getBody());\n var rng = editor.selection.getRng();\n var selectedCells = TableCellSelection.getCellsFromEditor(editor);\n return selectedCells.length !== 0 ? emptyCells(editor, selectedCells) : deleteTableRange(editor, rootNode, rng, startElm);\n };\n var getParentCell = function (rootElm, elm) {\n return find(Parents.parentsAndSelf(elm, rootElm), isTableCell);\n };\n var getParentCaption = function (rootElm, elm) {\n return find(Parents.parentsAndSelf(elm, rootElm), function (elm) {\n return name(elm) === 'caption';\n });\n };\n var deleteBetweenCells = function (editor, rootElm, forward, fromCell, from) {\n return CaretFinder.navigate(forward, editor.getBody(), from).bind(function (to) {\n return getParentCell(rootElm, Element.fromDom(to.getNode())).map(function (toCell) {\n return eq(toCell, fromCell) === false;\n });\n });\n };\n var emptyElement = function (editor, elm) {\n PaddingBr.fillWithPaddingBr(elm);\n editor.selection.setCursorLocation(elm.dom(), 0);\n return Option.some(true);\n };\n var isDeleteOfLastCharPos = function (fromCaption, forward, from, to) {\n return CaretFinder.firstPositionIn(fromCaption.dom()).bind(function (first) {\n return CaretFinder.lastPositionIn(fromCaption.dom()).map(function (last) {\n return forward ? from.isEqual(first) && to.isEqual(last) : from.isEqual(last) && to.isEqual(first);\n });\n }).getOr(true);\n };\n var emptyCaretCaption = function (editor, elm) {\n return emptyElement(editor, elm);\n };\n var validateCaretCaption = function (rootElm, fromCaption, to) {\n return getParentCaption(rootElm, Element.fromDom(to.getNode())).map(function (toCaption) {\n return eq(toCaption, fromCaption) === false;\n });\n };\n var deleteCaretInsideCaption = function (editor, rootElm, forward, fromCaption, from) {\n return CaretFinder.navigate(forward, editor.getBody(), from).bind(function (to) {\n return isDeleteOfLastCharPos(fromCaption, forward, from, to) ? emptyCaretCaption(editor, fromCaption) : validateCaretCaption(rootElm, fromCaption, to);\n }).or(Option.some(true));\n };\n var deleteCaretCells = function (editor, forward, rootElm, startElm) {\n var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n return getParentCell(rootElm, startElm).bind(function (fromCell) {\n return Empty.isEmpty(fromCell) ? emptyElement(editor, fromCell) : deleteBetweenCells(editor, rootElm, forward, fromCell, from);\n });\n };\n var deleteCaretCaption = function (editor, forward, rootElm, fromCaption) {\n var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n return Empty.isEmpty(fromCaption) ? emptyElement(editor, fromCaption) : deleteCaretInsideCaption(editor, rootElm, forward, fromCaption, from);\n };\n var deleteCaret = function (editor, forward, startElm) {\n var rootElm = Element.fromDom(editor.getBody());\n return getParentCaption(rootElm, startElm).fold(function () {\n return deleteCaretCells(editor, forward, rootElm, startElm);\n }, function (fromCaption) {\n return deleteCaretCaption(editor, forward, rootElm, fromCaption);\n }).getOr(false);\n };\n var backspaceDelete$4 = function (editor, forward) {\n var startElm = Element.fromDom(editor.selection.getStart(true));\n var cells = TableCellSelection.getCellsFromEditor(editor);\n return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret(editor, forward, startElm) : deleteRange$1(editor, startElm);\n };\n var TableDelete = { backspaceDelete: backspaceDelete$4 };\n\n var isEq$2 = FormatUtils.isEq;\n var matchesUnInheritedFormatSelector = function (ed, node, name) {\n var formatList = ed.formatter.get(name);\n if (formatList) {\n for (var i = 0; i < formatList.length; i++) {\n if (formatList[i].inherit === false && ed.dom.is(node, formatList[i].selector)) {\n return true;\n }\n }\n }\n return false;\n };\n var matchParents = function (editor, node, name, vars) {\n var root = editor.dom.getRoot();\n if (node === root) {\n return false;\n }\n node = editor.dom.getParent(node, function (node) {\n if (matchesUnInheritedFormatSelector(editor, node, name)) {\n return true;\n }\n return node.parentNode === root || !!matchNode(editor, node, name, vars, true);\n });\n return matchNode(editor, node, name, vars);\n };\n var matchName = function (dom, node, format) {\n if (isEq$2(node, format.inline)) {\n return true;\n }\n if (isEq$2(node, format.block)) {\n return true;\n }\n if (format.selector) {\n return node.nodeType === 1 && dom.is(node, format.selector);\n }\n };\n var matchItems = function (dom, node, format, itemName, similar, vars) {\n var key, value;\n var items = format[itemName];\n var i;\n if (format.onmatch) {\n return format.onmatch(node, format, itemName);\n }\n if (items) {\n if (typeof items.length === 'undefined') {\n for (key in items) {\n if (items.hasOwnProperty(key)) {\n if (itemName === 'attributes') {\n value = dom.getAttrib(node, key);\n } else {\n value = FormatUtils.getStyle(dom, node, key);\n }\n if (similar && !value && !format.exact) {\n return;\n }\n if ((!similar || format.exact) && !isEq$2(value, FormatUtils.normalizeStyleValue(dom, FormatUtils.replaceVars(items[key], vars), key))) {\n return;\n }\n }\n }\n } else {\n for (i = 0; i < items.length; i++) {\n if (itemName === 'attributes' ? dom.getAttrib(node, items[i]) : FormatUtils.getStyle(dom, node, items[i])) {\n return format;\n }\n }\n }\n }\n return format;\n };\n var matchNode = function (ed, node, name, vars, similar) {\n var formatList = ed.formatter.get(name);\n var format, i, x, classes;\n var dom = ed.dom;\n if (formatList && node) {\n for (i = 0; i < formatList.length; i++) {\n format = formatList[i];\n if (matchName(ed.dom, node, format) && matchItems(dom, node, format, 'attributes', similar, vars) && matchItems(dom, node, format, 'styles', similar, vars)) {\n if (classes = format.classes) {\n for (x = 0; x < classes.length; x++) {\n if (!ed.dom.hasClass(node, classes[x])) {\n return;\n }\n }\n }\n return format;\n }\n }\n }\n };\n var match = function (editor, name, vars, node) {\n var startNode;\n if (node) {\n return matchParents(editor, node, name, vars);\n }\n node = editor.selection.getNode();\n if (matchParents(editor, node, name, vars)) {\n return true;\n }\n startNode = editor.selection.getStart();\n if (startNode !== node) {\n if (matchParents(editor, startNode, name, vars)) {\n return true;\n }\n }\n return false;\n };\n var matchAll = function (editor, names, vars) {\n var startElement;\n var matchedFormatNames = [];\n var checkedMap = {};\n startElement = editor.selection.getStart();\n editor.dom.getParent(startElement, function (node) {\n var i, name;\n for (i = 0; i < names.length; i++) {\n name = names[i];\n if (!checkedMap[name] && matchNode(editor, node, name, vars)) {\n checkedMap[name] = true;\n matchedFormatNames.push(name);\n }\n }\n }, editor.dom.getRoot());\n return matchedFormatNames;\n };\n var canApply = function (editor, name) {\n var formatList = editor.formatter.get(name);\n var startNode, parents, i, x, selector;\n var dom = editor.dom;\n if (formatList) {\n startNode = editor.selection.getStart();\n parents = FormatUtils.getParents(dom, startNode);\n for (x = formatList.length - 1; x >= 0; x--) {\n selector = formatList[x].selector;\n if (!selector || formatList[x].defaultBlock) {\n return true;\n }\n for (i = parents.length - 1; i >= 0; i--) {\n if (dom.is(parents[i], selector)) {\n return true;\n }\n }\n }\n }\n return false;\n };\n var MatchFormat = {\n matchNode: matchNode,\n matchName: matchName,\n match: match,\n matchAll: matchAll,\n canApply: canApply,\n matchesUnInheritedFormatSelector: matchesUnInheritedFormatSelector\n };\n\n var splitText = function (node, offset) {\n return node.splitText(offset);\n };\n var split$1 = function (rng) {\n var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset;\n if (startContainer === endContainer && NodeType.isText(startContainer)) {\n if (startOffset > 0 && startOffset < startContainer.nodeValue.length) {\n endContainer = splitText(startContainer, startOffset);\n startContainer = endContainer.previousSibling;\n if (endOffset > startOffset) {\n endOffset = endOffset - startOffset;\n startContainer = endContainer = splitText(endContainer, endOffset).previousSibling;\n endOffset = endContainer.nodeValue.length;\n startOffset = 0;\n } else {\n endOffset = 0;\n }\n }\n } else {\n if (NodeType.isText(startContainer) && startOffset > 0 && startOffset < startContainer.nodeValue.length) {\n startContainer = splitText(startContainer, startOffset);\n startOffset = 0;\n }\n if (NodeType.isText(endContainer) && endOffset > 0 && endOffset < endContainer.nodeValue.length) {\n endContainer = splitText(endContainer, endOffset).previousSibling;\n endOffset = endContainer.nodeValue.length;\n }\n }\n return {\n startContainer: startContainer,\n startOffset: startOffset,\n endContainer: endContainer,\n endOffset: endOffset\n };\n };\n var SplitRange = { split: split$1 };\n\n var ZWSP$1 = Zwsp.ZWSP, CARET_ID$1 = '_mce_caret';\n var importNode = function (ownerDocument, node) {\n return ownerDocument.importNode(node, true);\n };\n var getEmptyCaretContainers = function (node) {\n var nodes = [];\n while (node) {\n if (node.nodeType === 3 && node.nodeValue !== ZWSP$1 || node.childNodes.length > 1) {\n return [];\n }\n if (node.nodeType === 1) {\n nodes.push(node);\n }\n node = node.firstChild;\n }\n return nodes;\n };\n var isCaretContainerEmpty = function (node) {\n return getEmptyCaretContainers(node).length > 0;\n };\n var findFirstTextNode = function (node) {\n var walker;\n if (node) {\n walker = new TreeWalker(node, node);\n for (node = walker.current(); node; node = walker.next()) {\n if (node.nodeType === 3) {\n return node;\n }\n }\n }\n return null;\n };\n var createCaretContainer = function (fill) {\n var caretContainer = Element.fromTag('span');\n setAll(caretContainer, {\n 'id': CARET_ID$1,\n 'data-mce-bogus': '1',\n 'data-mce-type': 'format-caret'\n });\n if (fill) {\n append(caretContainer, Element.fromText(ZWSP$1));\n }\n return caretContainer;\n };\n var trimZwspFromCaretContainer = function (caretContainerNode) {\n var textNode = findFirstTextNode(caretContainerNode);\n if (textNode && textNode.nodeValue.charAt(0) === ZWSP$1) {\n textNode.deleteData(0, 1);\n }\n return textNode;\n };\n var removeCaretContainerNode = function (editor, node, moveCaret) {\n if (moveCaret === void 0) {\n moveCaret = true;\n }\n var dom = editor.dom, selection = editor.selection;\n if (isCaretContainerEmpty(node)) {\n DeleteElement.deleteElement(editor, false, Element.fromDom(node), moveCaret);\n } else {\n var rng = selection.getRng();\n var block = dom.getParent(node, dom.isBlock);\n var textNode = trimZwspFromCaretContainer(node);\n if (rng.startContainer === textNode && rng.startOffset > 0) {\n rng.setStart(textNode, rng.startOffset - 1);\n }\n if (rng.endContainer === textNode && rng.endOffset > 0) {\n rng.setEnd(textNode, rng.endOffset - 1);\n }\n dom.remove(node, true);\n if (block && dom.isEmpty(block)) {\n PaddingBr.fillWithPaddingBr(Element.fromDom(block));\n }\n selection.setRng(rng);\n }\n };\n var removeCaretContainer = function (editor, node, moveCaret) {\n if (moveCaret === void 0) {\n moveCaret = true;\n }\n var dom = editor.dom, selection = editor.selection;\n if (!node) {\n node = getParentCaretContainer(editor.getBody(), selection.getStart());\n if (!node) {\n while (node = dom.get(CARET_ID$1)) {\n removeCaretContainerNode(editor, node, false);\n }\n }\n } else {\n removeCaretContainerNode(editor, node, moveCaret);\n }\n };\n var insertCaretContainerNode = function (editor, caretContainer, formatNode) {\n var dom = editor.dom, block = dom.getParent(formatNode, curry(FormatUtils.isTextBlock, editor));\n if (block && dom.isEmpty(block)) {\n formatNode.parentNode.replaceChild(caretContainer, formatNode);\n } else {\n PaddingBr.removeTrailingBr(Element.fromDom(formatNode));\n if (dom.isEmpty(formatNode)) {\n formatNode.parentNode.replaceChild(caretContainer, formatNode);\n } else {\n dom.insertAfter(caretContainer, formatNode);\n }\n }\n };\n var appendNode = function (parentNode, node) {\n parentNode.appendChild(node);\n return node;\n };\n var insertFormatNodesIntoCaretContainer = function (formatNodes, caretContainer) {\n var innerMostFormatNode = foldr(formatNodes, function (parentNode, formatNode) {\n return appendNode(parentNode, formatNode.cloneNode(false));\n }, caretContainer);\n return appendNode(innerMostFormatNode, innerMostFormatNode.ownerDocument.createTextNode(ZWSP$1));\n };\n var applyCaretFormat = function (editor, name, vars) {\n var rng, caretContainer, textNode, offset, bookmark, container, text;\n var selection = editor.selection;\n rng = selection.getRng(true);\n offset = rng.startOffset;\n container = rng.startContainer;\n text = container.nodeValue;\n caretContainer = getParentCaretContainer(editor.getBody(), selection.getStart());\n if (caretContainer) {\n textNode = findFirstTextNode(caretContainer);\n }\n var wordcharRegex = /[^\\s\\u00a0\\u00ad\\u200b\\ufeff]/;\n if (text && offset > 0 && offset < text.length && wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) {\n bookmark = selection.getBookmark();\n rng.collapse(true);\n rng = ExpandRange.expandRng(editor, rng, editor.formatter.get(name));\n rng = SplitRange.split(rng);\n editor.formatter.apply(name, vars, rng);\n selection.moveToBookmark(bookmark);\n } else {\n if (!caretContainer || textNode.nodeValue !== ZWSP$1) {\n caretContainer = importNode(editor.getDoc(), createCaretContainer(true).dom());\n textNode = caretContainer.firstChild;\n rng.insertNode(caretContainer);\n offset = 1;\n editor.formatter.apply(name, vars, caretContainer);\n } else {\n editor.formatter.apply(name, vars, caretContainer);\n }\n selection.setCursorLocation(textNode, offset);\n }\n };\n var removeCaretFormat = function (editor, name, vars, similar) {\n var dom = editor.dom, selection = editor.selection;\n var container, offset, bookmark;\n var hasContentAfter, node, formatNode;\n var parents = [], rng = selection.getRng();\n var caretContainer;\n container = rng.startContainer;\n offset = rng.startOffset;\n node = container;\n if (container.nodeType === 3) {\n if (offset !== container.nodeValue.length) {\n hasContentAfter = true;\n }\n node = node.parentNode;\n }\n while (node) {\n if (MatchFormat.matchNode(editor, node, name, vars, similar)) {\n formatNode = node;\n break;\n }\n if (node.nextSibling) {\n hasContentAfter = true;\n }\n parents.push(node);\n node = node.parentNode;\n }\n if (!formatNode) {\n return;\n }\n if (hasContentAfter) {\n bookmark = selection.getBookmark();\n rng.collapse(true);\n var expandedRng = ExpandRange.expandRng(editor, rng, editor.formatter.get(name), true);\n expandedRng = SplitRange.split(expandedRng);\n editor.formatter.remove(name, vars, expandedRng);\n selection.moveToBookmark(bookmark);\n } else {\n caretContainer = getParentCaretContainer(editor.getBody(), formatNode);\n var newCaretContainer = createCaretContainer(false).dom();\n var caretNode = insertFormatNodesIntoCaretContainer(parents, newCaretContainer);\n if (caretContainer) {\n insertCaretContainerNode(editor, newCaretContainer, caretContainer);\n } else {\n insertCaretContainerNode(editor, newCaretContainer, formatNode);\n }\n removeCaretContainerNode(editor, caretContainer, false);\n selection.setCursorLocation(caretNode, 1);\n if (dom.isEmpty(formatNode)) {\n dom.remove(formatNode);\n }\n }\n };\n var disableCaretContainer = function (editor, keyCode) {\n var selection = editor.selection, body = editor.getBody();\n removeCaretContainer(editor, null, false);\n if ((keyCode === 8 || keyCode === 46) && selection.isCollapsed() && selection.getStart().innerHTML === ZWSP$1) {\n removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart()));\n }\n if (keyCode === 37 || keyCode === 39) {\n removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart()));\n }\n };\n var setup$2 = function (editor) {\n editor.on('mouseup keydown', function (e) {\n disableCaretContainer(editor, e.keyCode);\n });\n };\n var replaceWithCaretFormat = function (targetNode, formatNodes) {\n var caretContainer = createCaretContainer(false);\n var innerMost = insertFormatNodesIntoCaretContainer(formatNodes, caretContainer.dom());\n before(Element.fromDom(targetNode), caretContainer);\n remove$1(Element.fromDom(targetNode));\n return CaretPosition$1(innerMost, 0);\n };\n var isFormatElement = function (editor, element) {\n var inlineElements = editor.schema.getTextInlineElements();\n return inlineElements.hasOwnProperty(name(element)) && !isCaretNode(element.dom()) && !NodeType.isBogus(element.dom());\n };\n var isEmptyCaretFormatElement = function (element) {\n return isCaretNode(element.dom()) && isCaretContainerEmpty(element.dom());\n };\n\n var getParentInlines = function (rootElm, startElm) {\n var parents = Parents.parentsAndSelf(startElm, rootElm);\n return findIndex(parents, isBlock).fold(constant(parents), function (index) {\n return parents.slice(0, index);\n });\n };\n var hasOnlyOneChild$1 = function (elm) {\n return children(elm).length === 1;\n };\n var deleteLastPosition = function (forward, editor, target, parentInlines) {\n var isFormatElement$1 = curry(isFormatElement, editor);\n var formatNodes = map(filter(parentInlines, isFormatElement$1), function (elm) {\n return elm.dom();\n });\n if (formatNodes.length === 0) {\n DeleteElement.deleteElement(editor, forward, target);\n } else {\n var pos = replaceWithCaretFormat(target.dom(), formatNodes);\n editor.selection.setRng(pos.toRange());\n }\n };\n var deleteCaret$1 = function (editor, forward) {\n var rootElm = Element.fromDom(editor.getBody());\n var startElm = Element.fromDom(editor.selection.getStart());\n var parentInlines = filter(getParentInlines(rootElm, startElm), hasOnlyOneChild$1);\n return last(parentInlines).map(function (target) {\n var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n if (DeleteUtils.willDeleteLastPositionInElement(forward, fromPos, target.dom()) && !isEmptyCaretFormatElement(target)) {\n deleteLastPosition(forward, editor, target, parentInlines);\n return true;\n } else {\n return false;\n }\n }).getOr(false);\n };\n var backspaceDelete$5 = function (editor, forward) {\n return editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : false;\n };\n var InlineFormatDelete = { backspaceDelete: backspaceDelete$5 };\n\n var getPos$1 = function (elm) {\n var x = 0, y = 0;\n var offsetParent = elm;\n while (offsetParent && offsetParent.nodeType) {\n x += offsetParent.offsetLeft || 0;\n y += offsetParent.offsetTop || 0;\n offsetParent = offsetParent.offsetParent;\n }\n return {\n x: x,\n y: y\n };\n };\n var fireScrollIntoViewEvent = function (editor, elm, alignToTop) {\n var scrollEvent = {\n elm: elm,\n alignToTop: alignToTop\n };\n editor.fire('scrollIntoView', scrollEvent);\n return scrollEvent.isDefaultPrevented();\n };\n var scrollElementIntoView = function (editor, elm, alignToTop) {\n var y, viewPort;\n var dom = editor.dom;\n var root = dom.getRoot();\n var viewPortY, viewPortH, offsetY = 0;\n if (fireScrollIntoViewEvent(editor, elm, alignToTop)) {\n return;\n }\n if (!NodeType.isElement(elm)) {\n return;\n }\n if (alignToTop === false) {\n offsetY = elm.offsetHeight;\n }\n if (root.nodeName !== 'BODY') {\n var scrollContainer = editor.selection.getScrollContainer();\n if (scrollContainer) {\n y = getPos$1(elm).y - getPos$1(scrollContainer).y + offsetY;\n viewPortH = scrollContainer.clientHeight;\n viewPortY = scrollContainer.scrollTop;\n if (y < viewPortY || y + 25 > viewPortY + viewPortH) {\n scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25;\n }\n return;\n }\n }\n viewPort = dom.getViewPort(editor.getWin());\n y = dom.getPos(elm).y + offsetY;\n viewPortY = viewPort.y;\n viewPortH = viewPort.h;\n if (y < viewPort.y || y + 25 > viewPortY + viewPortH) {\n editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25);\n }\n };\n var getViewPortRect = function (editor) {\n if (editor.inline) {\n return editor.getBody().getBoundingClientRect();\n } else {\n var win = editor.getWin();\n return {\n left: 0,\n right: win.innerWidth,\n top: 0,\n bottom: win.innerHeight,\n width: win.innerWidth,\n height: win.innerHeight\n };\n }\n };\n var scrollBy = function (editor, dx, dy) {\n if (editor.inline) {\n editor.getBody().scrollLeft += dx;\n editor.getBody().scrollTop += dy;\n } else {\n editor.getWin().scrollBy(dx, dy);\n }\n };\n var scrollRangeIntoView = function (editor, rng) {\n head(CaretPosition.fromRangeStart(rng).getClientRects()).each(function (rngRect) {\n var bodyRect = getViewPortRect(editor);\n var overflow = getOverflow(bodyRect, rngRect);\n var margin = 4;\n var dx = overflow.x > 0 ? overflow.x + margin : overflow.x - margin;\n var dy = overflow.y > 0 ? overflow.y + margin : overflow.y - margin;\n scrollBy(editor, overflow.x !== 0 ? dx : 0, overflow.y !== 0 ? dy : 0);\n });\n };\n var ScrollIntoView = {\n scrollElementIntoView: scrollElementIntoView,\n scrollRangeIntoView: scrollRangeIntoView\n };\n\n var isContentEditableTrue$2 = NodeType.isContentEditableTrue;\n var isContentEditableFalse$6 = NodeType.isContentEditableFalse;\n var showCaret = function (direction, editor, node, before, scrollIntoView) {\n return editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView);\n };\n var getNodeRange = function (node) {\n var rng = node.ownerDocument.createRange();\n rng.selectNode(node);\n return rng;\n };\n var selectNode = function (editor, node) {\n var e = editor.fire('BeforeObjectSelected', { target: node });\n if (e.isDefaultPrevented()) {\n return null;\n }\n return getNodeRange(node);\n };\n var renderCaretAtRange = function (editor, range, scrollIntoView) {\n var normalizedRange = normalizeRange(1, editor.getBody(), range);\n var caretPosition = CaretPosition$1.fromRangeStart(normalizedRange);\n var caretPositionNode = caretPosition.getNode();\n if (isContentEditableFalse$6(caretPositionNode)) {\n return showCaret(1, editor, caretPositionNode, !caretPosition.isAtEnd(), false);\n }\n var caretPositionBeforeNode = caretPosition.getNode(true);\n if (isContentEditableFalse$6(caretPositionBeforeNode)) {\n return showCaret(1, editor, caretPositionBeforeNode, false, false);\n }\n var ceRoot = editor.dom.getParent(caretPosition.getNode(), function (node) {\n return isContentEditableFalse$6(node) || isContentEditableTrue$2(node);\n });\n if (isContentEditableFalse$6(ceRoot)) {\n return showCaret(1, editor, ceRoot, false, scrollIntoView);\n }\n return null;\n };\n var renderRangeCaret = function (editor, range, scrollIntoView) {\n if (!range || !range.collapsed) {\n return range;\n }\n var caretRange = renderCaretAtRange(editor, range, scrollIntoView);\n if (caretRange) {\n return caretRange;\n }\n return range;\n };\n var moveToRange = function (editor, rng) {\n editor.selection.setRng(rng);\n ScrollIntoView.scrollRangeIntoView(editor, editor.selection.getRng());\n };\n\n var trimEmptyTextNode$1 = function (dom, node) {\n if (NodeType.isText(node) && node.data.length === 0) {\n dom.remove(node);\n }\n };\n var deleteContentAndShowCaret = function (editor, range, node, direction, forward, peekCaretPosition) {\n var caretRange = showCaret(direction, editor, peekCaretPosition.getNode(!forward), forward, true);\n if (range.collapsed) {\n var deleteRange = range.cloneRange();\n if (forward) {\n deleteRange.setEnd(caretRange.startContainer, caretRange.startOffset);\n } else {\n deleteRange.setStart(caretRange.endContainer, caretRange.endOffset);\n }\n deleteRange.deleteContents();\n } else {\n range.deleteContents();\n }\n editor.selection.setRng(caretRange);\n trimEmptyTextNode$1(editor.dom, node);\n return true;\n };\n var deleteCefBoundaryText = function (editor, forward) {\n var range = editor.selection.getRng();\n if (!NodeType.isText(range.commonAncestorContainer)) {\n return false;\n }\n var direction = forward ? HDirection.Forwards : HDirection.Backwards;\n var caretWalker = CaretWalker(editor.getBody());\n var getNextVisualCaretPosition = curry(getVisualCaretPosition, caretWalker.next);\n var getPrevVisualCaretPosition = curry(getVisualCaretPosition, caretWalker.prev);\n var getNextPosFn = forward ? getNextVisualCaretPosition : getPrevVisualCaretPosition;\n var isBeforeContentEditableFalseFn = forward ? isBeforeContentEditableFalse : isAfterContentEditableFalse;\n var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);\n var nextCaretPosition = InlineUtils.normalizePosition(forward, getNextPosFn(caretPosition));\n if (!nextCaretPosition) {\n return false;\n } else if (isBeforeContentEditableFalseFn(nextCaretPosition)) {\n return deleteContentAndShowCaret(editor, range, caretPosition.getNode(), direction, forward, nextCaretPosition);\n }\n var peekCaretPosition = getNextPosFn(nextCaretPosition);\n if (peekCaretPosition && isBeforeContentEditableFalseFn(peekCaretPosition)) {\n if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) {\n return deleteContentAndShowCaret(editor, range, caretPosition.getNode(), direction, forward, peekCaretPosition);\n }\n }\n return false;\n };\n var backspaceDelete$6 = function (editor, forward) {\n return deleteCefBoundaryText(editor, forward);\n };\n var CefBoundaryDelete = { backspaceDelete: backspaceDelete$6 };\n\n var nativeCommand = function (editor, command) {\n editor.getDoc().execCommand(command, false, null);\n };\n var deleteCommand = function (editor) {\n if (CefDelete.backspaceDelete(editor, false)) {\n return;\n } else if (CefBoundaryDelete.backspaceDelete(editor, false)) {\n return;\n } else if (InlineBoundaryDelete.backspaceDelete(editor, false)) {\n return;\n } else if (BlockBoundaryDelete.backspaceDelete(editor, false)) {\n return;\n } else if (TableDelete.backspaceDelete(editor)) {\n return;\n } else if (BlockRangeDelete.backspaceDelete(editor, false)) {\n return;\n } else if (InlineFormatDelete.backspaceDelete(editor, false)) {\n return;\n } else {\n nativeCommand(editor, 'Delete');\n DeleteUtils.paddEmptyBody(editor);\n }\n };\n var forwardDeleteCommand = function (editor) {\n if (CefDelete.backspaceDelete(editor, true)) {\n return;\n } else if (CefBoundaryDelete.backspaceDelete(editor, true)) {\n return;\n } else if (InlineBoundaryDelete.backspaceDelete(editor, true)) {\n return;\n } else if (BlockBoundaryDelete.backspaceDelete(editor, true)) {\n return;\n } else if (TableDelete.backspaceDelete(editor)) {\n return;\n } else if (BlockRangeDelete.backspaceDelete(editor, true)) {\n return;\n } else if (InlineFormatDelete.backspaceDelete(editor, true)) {\n return;\n } else {\n nativeCommand(editor, 'ForwardDelete');\n }\n };\n var DeleteCommands = {\n deleteCommand: deleteCommand,\n forwardDeleteCommand: forwardDeleteCommand\n };\n\n var getSpecifiedFontProp = function (propName, rootElm, elm) {\n var getProperty = function (elm) {\n return getRaw(elm, propName);\n };\n var isRoot = function (elm) {\n return eq(Element.fromDom(rootElm), elm);\n };\n return closest(Element.fromDom(elm), function (elm) {\n return getProperty(elm).isSome();\n }, isRoot).bind(getProperty);\n };\n var round$1 = function (number, precision) {\n var factor = Math.pow(10, precision);\n return Math.round(number * factor) / factor;\n };\n var toPt = function (fontSize, precision) {\n if (/[0-9.]+px$/.test(fontSize)) {\n return round$1(parseInt(fontSize, 10) * 72 / 96, precision || 0) + 'pt';\n }\n return fontSize;\n };\n var normalizeFontFamily = function (fontFamily) {\n return fontFamily.replace(/[\\'\\\"\\\\]/g, '').replace(/,\\s+/g, ',');\n };\n var getComputedFontProp = function (propName, elm) {\n return Option.from(DOMUtils$1.DOM.getStyle(elm, propName, true));\n };\n var getFontProp = function (propName) {\n return function (rootElm, elm) {\n return Option.from(elm).map(Element.fromDom).filter(isElement).bind(function (element) {\n return getSpecifiedFontProp(propName, rootElm, element.dom()).or(getComputedFontProp(propName, element.dom()));\n }).getOr('');\n };\n };\n var FontInfo = {\n getFontSize: getFontProp('font-size'),\n getFontFamily: compose(normalizeFontFamily, getFontProp('font-family')),\n toPt: toPt\n };\n\n var findFirstCaretElement = function (editor) {\n return CaretFinder.firstPositionIn(editor.getBody()).map(function (caret) {\n var container = caret.container();\n return NodeType.isText(container) ? container.parentNode : container;\n });\n };\n var isRangeAtStartOfNode = function (rng, root) {\n return rng.startContainer === root && rng.startOffset === 0;\n };\n var getCaretElement = function (editor) {\n return Option.from(editor.selection.getRng()).bind(function (rng) {\n var root = editor.getBody();\n return isRangeAtStartOfNode(rng, root) ? Option.none() : Option.from(editor.selection.getStart(true));\n });\n };\n var fromFontSizeNumber = function (editor, value) {\n if (/^[0-9\\.]+$/.test(value)) {\n var fontSizeNumber = parseInt(value, 10);\n if (fontSizeNumber >= 1 && fontSizeNumber <= 7) {\n var fontSizes = Settings.getFontStyleValues(editor);\n var fontClasses = Settings.getFontSizeClasses(editor);\n if (fontClasses) {\n return fontClasses[fontSizeNumber - 1] || value;\n } else {\n return fontSizes[fontSizeNumber - 1] || value;\n }\n } else {\n return value;\n }\n } else {\n return value;\n }\n };\n var fontNameAction = function (editor, value) {\n editor.formatter.toggle('fontname', { value: fromFontSizeNumber(editor, value) });\n editor.nodeChanged();\n };\n var fontNameQuery = function (editor) {\n return getCaretElement(editor).fold(function () {\n return findFirstCaretElement(editor).map(function (caretElement) {\n return FontInfo.getFontFamily(editor.getBody(), caretElement);\n }).getOr('');\n }, function (caretElement) {\n return FontInfo.getFontFamily(editor.getBody(), caretElement);\n });\n };\n var fontSizeAction = function (editor, value) {\n editor.formatter.toggle('fontsize', { value: fromFontSizeNumber(editor, value) });\n editor.nodeChanged();\n };\n var fontSizeQuery = function (editor) {\n return getCaretElement(editor).fold(function () {\n return findFirstCaretElement(editor).map(function (caretElement) {\n return FontInfo.getFontSize(editor.getBody(), caretElement);\n }).getOr('');\n }, function (caretElement) {\n return FontInfo.getFontSize(editor.getBody(), caretElement);\n });\n };\n\n var isEq$3 = function (rng1, rng2) {\n return rng1 && rng2 && (rng1.startContainer === rng2.startContainer && rng1.startOffset === rng2.startOffset) && (rng1.endContainer === rng2.endContainer && rng1.endOffset === rng2.endOffset);\n };\n var RangeCompare = { isEq: isEq$3 };\n\n var findParent = function (node, rootNode, predicate) {\n while (node && node !== rootNode) {\n if (predicate(node)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n };\n var hasParent = function (node, rootNode, predicate) {\n return findParent(node, rootNode, predicate) !== null;\n };\n var hasParentWithName = function (node, rootNode, name) {\n return hasParent(node, rootNode, function (node) {\n return node.nodeName === name;\n });\n };\n var isTable$2 = function (node) {\n return node && node.nodeName === 'TABLE';\n };\n var isTableCell$3 = function (node) {\n return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);\n };\n var isCeFalseCaretContainer = function (node, rootNode) {\n return isCaretContainer(node) && hasParent(node, rootNode, isCaretNode) === false;\n };\n var hasBrBeforeAfter = function (dom, node, left) {\n var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || dom.getRoot());\n while (node = walker[left ? 'prev' : 'next']()) {\n if (NodeType.isBr(node)) {\n return true;\n }\n }\n };\n var isPrevNode = function (node, name) {\n return node.previousSibling && node.previousSibling.nodeName === name;\n };\n var hasContentEditableFalseParent = function (body, node) {\n while (node && node !== body) {\n if (NodeType.isContentEditableFalse(node)) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n };\n var findTextNodeRelative = function (dom, isAfterNode, collapsed, left, startNode) {\n var walker, lastInlineElement, parentBlockContainer;\n var body = dom.getRoot();\n var node;\n var nonEmptyElementsMap = dom.schema.getNonEmptyElements();\n parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body;\n if (left && NodeType.isBr(startNode) && isAfterNode && dom.isEmpty(parentBlockContainer)) {\n return Option.some(CaretPosition(startNode.parentNode, dom.nodeIndex(startNode)));\n }\n walker = new TreeWalker(startNode, parentBlockContainer);\n while (node = walker[left ? 'prev' : 'next']()) {\n if (dom.getContentEditableParent(node) === 'false' || isCeFalseCaretContainer(node, body)) {\n return Option.none();\n }\n if (NodeType.isText(node) && node.nodeValue.length > 0) {\n if (hasParentWithName(node, body, 'A') === false) {\n return Option.some(CaretPosition(node, left ? node.nodeValue.length : 0));\n }\n return Option.none();\n }\n if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) {\n return Option.none();\n }\n lastInlineElement = node;\n }\n if (collapsed && lastInlineElement) {\n return Option.some(CaretPosition(lastInlineElement, 0));\n }\n return Option.none();\n };\n var normalizeEndPoint = function (dom, collapsed, start, rng) {\n var container, offset, walker;\n var body = dom.getRoot();\n var node, nonEmptyElementsMap;\n var directionLeft, isAfterNode, normalized = false;\n container = rng[(start ? 'start' : 'end') + 'Container'];\n offset = rng[(start ? 'start' : 'end') + 'Offset'];\n isAfterNode = NodeType.isElement(container) && offset === container.childNodes.length;\n nonEmptyElementsMap = dom.schema.getNonEmptyElements();\n directionLeft = start;\n if (isCaretContainer(container)) {\n return Option.none();\n }\n if (NodeType.isElement(container) && offset > container.childNodes.length - 1) {\n directionLeft = false;\n }\n if (NodeType.isDocument(container)) {\n container = body;\n offset = 0;\n }\n if (container === body) {\n if (directionLeft) {\n node = container.childNodes[offset > 0 ? offset - 1 : 0];\n if (node) {\n if (isCaretContainer(node)) {\n return Option.none();\n }\n if (nonEmptyElementsMap[node.nodeName] || isTable$2(node)) {\n return Option.none();\n }\n }\n }\n if (container.hasChildNodes()) {\n offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1);\n container = container.childNodes[offset];\n offset = NodeType.isText(container) && isAfterNode ? container.data.length : 0;\n if (!collapsed && container === body.lastChild && isTable$2(container)) {\n return Option.none();\n }\n if (hasContentEditableFalseParent(body, container) || isCaretContainer(container)) {\n return Option.none();\n }\n if (container.hasChildNodes() && isTable$2(container) === false) {\n node = container;\n walker = new TreeWalker(container, body);\n do {\n if (NodeType.isContentEditableFalse(node) || isCaretContainer(node)) {\n normalized = false;\n break;\n }\n if (NodeType.isText(node) && node.nodeValue.length > 0) {\n offset = directionLeft ? 0 : node.nodeValue.length;\n container = node;\n normalized = true;\n break;\n }\n if (nonEmptyElementsMap[node.nodeName.toLowerCase()] && !isTableCell$3(node)) {\n offset = dom.nodeIndex(node);\n container = node.parentNode;\n if (!directionLeft) {\n offset++;\n }\n normalized = true;\n break;\n }\n } while (node = directionLeft ? walker.next() : walker.prev());\n }\n }\n }\n if (collapsed) {\n if (NodeType.isText(container) && offset === 0) {\n findTextNodeRelative(dom, isAfterNode, collapsed, true, container).each(function (pos) {\n container = pos.container();\n offset = pos.offset();\n normalized = true;\n });\n }\n if (NodeType.isElement(container)) {\n node = container.childNodes[offset];\n if (!node) {\n node = container.childNodes[offset - 1];\n }\n if (node && NodeType.isBr(node) && !isPrevNode(node, 'A') && !hasBrBeforeAfter(dom, node, false) && !hasBrBeforeAfter(dom, node, true)) {\n findTextNodeRelative(dom, isAfterNode, collapsed, true, node).each(function (pos) {\n container = pos.container();\n offset = pos.offset();\n normalized = true;\n });\n }\n }\n }\n if (directionLeft && !collapsed && NodeType.isText(container) && offset === container.nodeValue.length) {\n findTextNodeRelative(dom, isAfterNode, collapsed, false, container).each(function (pos) {\n container = pos.container();\n offset = pos.offset();\n normalized = true;\n });\n }\n return normalized ? Option.some(CaretPosition(container, offset)) : Option.none();\n };\n var normalize$2 = function (dom, rng) {\n var collapsed = rng.collapsed, normRng = rng.cloneRange();\n var startPos = CaretPosition.fromRangeStart(rng);\n normalizeEndPoint(dom, collapsed, true, normRng).each(function (pos) {\n if (!collapsed || !CaretPosition.isAbove(startPos, pos)) {\n normRng.setStart(pos.container(), pos.offset());\n }\n });\n if (!collapsed) {\n normalizeEndPoint(dom, collapsed, false, normRng).each(function (pos) {\n normRng.setEnd(pos.container(), pos.offset());\n });\n }\n if (collapsed) {\n normRng.collapse(true);\n }\n return RangeCompare.isEq(rng, normRng) ? Option.none() : Option.some(normRng);\n };\n var NormalizeRange = { normalize: normalize$2 };\n\n var hasRightSideContent = function (schema, container, parentBlock) {\n var walker = new TreeWalker(container, parentBlock);\n var node;\n var nonEmptyElementsMap = schema.getNonEmptyElements();\n while (node = walker.next()) {\n if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {\n return true;\n }\n }\n };\n var scrollToBr = function (dom, selection, brElm) {\n var marker = dom.create('span', {}, ' ');\n brElm.parentNode.insertBefore(marker, brElm);\n selection.scrollIntoView(marker);\n dom.remove(marker);\n };\n var moveSelectionToBr = function (dom, selection, brElm, extraBr) {\n var rng = dom.createRng();\n if (!extraBr) {\n rng.setStartAfter(brElm);\n rng.setEndAfter(brElm);\n } else {\n rng.setStartBefore(brElm);\n rng.setEndBefore(brElm);\n }\n selection.setRng(rng);\n };\n var insertBrAtCaret = function (editor, evt) {\n var selection = editor.selection;\n var dom = editor.dom;\n var rng = selection.getRng();\n var brElm;\n var extraBr;\n NormalizeRange.normalize(dom, rng).each(function (normRng) {\n rng.setStart(normRng.startContainer, normRng.startOffset);\n rng.setEnd(normRng.endContainer, normRng.endOffset);\n });\n var offset = rng.startOffset;\n var container = rng.startContainer;\n if (container.nodeType === 1 && container.hasChildNodes()) {\n var isAfterLastNodeInContainer = offset > container.childNodes.length - 1;\n container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;\n if (isAfterLastNodeInContainer && container.nodeType === 3) {\n offset = container.nodeValue.length;\n } else {\n offset = 0;\n }\n }\n var parentBlock = dom.getParent(container, dom.isBlock);\n var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;\n var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : '';\n var isControlKey = evt && evt.ctrlKey;\n if (containerBlockName === 'LI' && !isControlKey) {\n parentBlock = containerBlock;\n }\n if (container && container.nodeType === 3 && offset >= container.nodeValue.length) {\n if (!hasRightSideContent(editor.schema, container, parentBlock)) {\n brElm = dom.create('br');\n rng.insertNode(brElm);\n rng.setStartAfter(brElm);\n rng.setEndAfter(brElm);\n extraBr = true;\n }\n }\n brElm = dom.create('br');\n rangeInsertNode(dom, rng, brElm);\n scrollToBr(dom, selection, brElm);\n moveSelectionToBr(dom, selection, brElm, extraBr);\n editor.undoManager.add();\n };\n var insertBrBefore = function (editor, inline) {\n var br = Element.fromTag('br');\n before(Element.fromDom(inline), br);\n editor.undoManager.add();\n };\n var insertBrAfter = function (editor, inline) {\n if (!hasBrAfter(editor.getBody(), inline)) {\n after(Element.fromDom(inline), Element.fromTag('br'));\n }\n var br = Element.fromTag('br');\n after(Element.fromDom(inline), br);\n scrollToBr(editor.dom, editor.selection, br.dom());\n moveSelectionToBr(editor.dom, editor.selection, br.dom(), false);\n editor.undoManager.add();\n };\n var isBeforeBr$1 = function (pos) {\n return NodeType.isBr(pos.getNode());\n };\n var hasBrAfter = function (rootNode, startNode) {\n if (isBeforeBr$1(CaretPosition$1.after(startNode))) {\n return true;\n } else {\n return CaretFinder.nextPosition(rootNode, CaretPosition$1.after(startNode)).map(function (pos) {\n return NodeType.isBr(pos.getNode());\n }).getOr(false);\n }\n };\n var isAnchorLink = function (elm) {\n return elm && elm.nodeName === 'A' && 'href' in elm;\n };\n var isInsideAnchor = function (location) {\n return location.fold(constant(false), isAnchorLink, isAnchorLink, constant(false));\n };\n var readInlineAnchorLocation = function (editor) {\n var isInlineTarget = curry(InlineUtils.isInlineTarget, editor);\n var position = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n return BoundaryLocation.readLocation(isInlineTarget, editor.getBody(), position).filter(isInsideAnchor);\n };\n var insertBrOutsideAnchor = function (editor, location) {\n location.fold(noop, curry(insertBrBefore, editor), curry(insertBrAfter, editor), noop);\n };\n var insert = function (editor, evt) {\n var anchorLocation = readInlineAnchorLocation(editor);\n if (anchorLocation.isSome()) {\n anchorLocation.each(curry(insertBrOutsideAnchor, editor));\n } else {\n insertBrAtCaret(editor, evt);\n }\n };\n var InsertBr = { insert: insert };\n\n var create$3 = Immutable('start', 'soffset', 'finish', 'foffset');\n var SimRange = { create: create$3 };\n\n var adt = Adt.generate([\n { before: ['element'] },\n {\n on: [\n 'element',\n 'offset'\n ]\n },\n { after: ['element'] }\n ]);\n var cata = function (subject, onBefore, onOn, onAfter) {\n return subject.fold(onBefore, onOn, onAfter);\n };\n var getStart = function (situ) {\n return situ.fold(identity, identity, identity);\n };\n var before$4 = adt.before;\n var on = adt.on;\n var after$3 = adt.after;\n var Situ = {\n before: before$4,\n on: on,\n after: after$3,\n cata: cata,\n getStart: getStart\n };\n\n var adt$1 = Adt.generate([\n { domRange: ['rng'] },\n {\n relative: [\n 'startSitu',\n 'finishSitu'\n ]\n },\n {\n exact: [\n 'start',\n 'soffset',\n 'finish',\n 'foffset'\n ]\n }\n ]);\n var exactFromRange = function (simRange) {\n return adt$1.exact(simRange.start(), simRange.soffset(), simRange.finish(), simRange.foffset());\n };\n var getStart$1 = function (selection) {\n return selection.match({\n domRange: function (rng) {\n return Element.fromDom(rng.startContainer);\n },\n relative: function (startSitu, finishSitu) {\n return Situ.getStart(startSitu);\n },\n exact: function (start, soffset, finish, foffset) {\n return start;\n }\n });\n };\n var domRange = adt$1.domRange;\n var relative = adt$1.relative;\n var exact = adt$1.exact;\n var getWin = function (selection) {\n var start = getStart$1(selection);\n return defaultView(start);\n };\n var range = SimRange.create;\n var Selection = {\n domRange: domRange,\n relative: relative,\n exact: exact,\n exactFromRange: exactFromRange,\n getWin: getWin,\n range: range\n };\n\n var browser$3 = PlatformDetection$1.detect().browser;\n var clamp = function (offset, element) {\n var max = isText(element) ? get$4(element).length : children(element).length + 1;\n if (offset > max) {\n return max;\n } else if (offset < 0) {\n return 0;\n }\n return offset;\n };\n var normalizeRng = function (rng) {\n return Selection.range(rng.start(), clamp(rng.soffset(), rng.start()), rng.finish(), clamp(rng.foffset(), rng.finish()));\n };\n var isOrContains = function (root, elm) {\n return !NodeType.isRestrictedNode(elm.dom()) && (contains$3(root, elm) || eq(root, elm));\n };\n var isRngInRoot = function (root) {\n return function (rng) {\n return isOrContains(root, rng.start()) && isOrContains(root, rng.finish());\n };\n };\n var shouldStore = function (editor) {\n return editor.inline === true || browser$3.isIE();\n };\n var nativeRangeToSelectionRange = function (r) {\n return Selection.range(Element.fromDom(r.startContainer), r.startOffset, Element.fromDom(r.endContainer), r.endOffset);\n };\n var readRange = function (win) {\n var selection = win.getSelection();\n var rng = !selection || selection.rangeCount === 0 ? Option.none() : Option.from(selection.getRangeAt(0));\n return rng.map(nativeRangeToSelectionRange);\n };\n var getBookmark$2 = function (root) {\n var win = defaultView(root);\n return readRange(win.dom()).filter(isRngInRoot(root));\n };\n var validate = function (root, bookmark) {\n return Option.from(bookmark).filter(isRngInRoot(root)).map(normalizeRng);\n };\n var bookmarkToNativeRng = function (bookmark) {\n var rng = domGlobals.document.createRange();\n try {\n rng.setStart(bookmark.start().dom(), bookmark.soffset());\n rng.setEnd(bookmark.finish().dom(), bookmark.foffset());\n return Option.some(rng);\n } catch (_) {\n return Option.none();\n }\n };\n var store = function (editor) {\n var newBookmark = shouldStore(editor) ? getBookmark$2(Element.fromDom(editor.getBody())) : Option.none();\n editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark;\n };\n var storeNative = function (editor, rng) {\n var root = Element.fromDom(editor.getBody());\n var range = shouldStore(editor) ? Option.from(rng) : Option.none();\n var newBookmark = range.map(nativeRangeToSelectionRange).filter(isRngInRoot(root));\n editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark;\n };\n var getRng = function (editor) {\n var bookmark = editor.bookmark ? editor.bookmark : Option.none();\n return bookmark.bind(curry(validate, Element.fromDom(editor.getBody()))).bind(bookmarkToNativeRng);\n };\n var restore = function (editor) {\n getRng(editor).each(function (rng) {\n editor.selection.setRng(rng);\n });\n };\n var SelectionBookmark = {\n store: store,\n storeNative: storeNative,\n readRange: readRange,\n restore: restore,\n getRng: getRng,\n getBookmark: getBookmark$2,\n validate: validate\n };\n\n var indentElement = function (dom, command, useMargin, value, unit, element) {\n if (dom.getContentEditable(element) === 'false') {\n return;\n }\n var indentStyleName = useMargin ? 'margin' : 'padding';\n indentStyleName = element.nodeName === 'TABLE' ? 'margin' : indentStyleName;\n indentStyleName += dom.getStyle(element, 'direction', true) === 'rtl' ? 'Right' : 'Left';\n if (command === 'outdent') {\n var styleValue = Math.max(0, parseInt(element.style[indentStyleName] || 0, 10) - value);\n dom.setStyle(element, indentStyleName, styleValue ? styleValue + unit : '');\n } else {\n var styleValue = parseInt(element.style[indentStyleName] || 0, 10) + value + unit;\n dom.setStyle(element, indentStyleName, styleValue);\n }\n };\n var isListComponent = function (el) {\n return isList(el) || isListItem(el);\n };\n var parentIsListComponent = function (el) {\n return parent(el).map(isListComponent).getOr(false);\n };\n var getBlocksToIndent = function (editor) {\n return filter(map(editor.selection.getSelectedBlocks(), Element.fromDom), function (el) {\n return !isListComponent(el) && !parentIsListComponent(el);\n });\n };\n var handle = function (editor, command) {\n var settings = editor.settings, dom = editor.dom, selection = editor.selection, formatter = editor.formatter;\n var indentUnit = /[a-z%]+$/i.exec(settings.indentation)[0];\n var indentValue = parseInt(settings.indentation, 10);\n var useMargin = editor.getParam('indent_use_margin', false);\n if (!editor.queryCommandState('InsertUnorderedList') && !editor.queryCommandState('InsertOrderedList')) {\n if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) {\n formatter.apply('div');\n }\n }\n each(getBlocksToIndent(editor), function (block) {\n indentElement(dom, command, useMargin, indentValue, indentUnit, block.dom());\n });\n };\n\n var each$a = Tools.each, extend$2 = Tools.extend;\n var map$3 = Tools.map, inArray$2 = Tools.inArray;\n function EditorCommands (editor) {\n var dom, selection, formatter;\n var commands = {\n state: {},\n exec: {},\n value: {}\n };\n var settings = editor.settings, bookmark;\n editor.on('PreInit', function () {\n dom = editor.dom;\n selection = editor.selection;\n settings = editor.settings;\n formatter = editor.formatter;\n });\n var execCommand = function (command, ui, value, args) {\n var func, customCommand, state = false;\n if (editor.removed) {\n return;\n }\n if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) {\n editor.focus();\n } else {\n SelectionBookmark.restore(editor);\n }\n args = editor.fire('BeforeExecCommand', {\n command: command,\n ui: ui,\n value: value\n });\n if (args.isDefaultPrevented()) {\n return false;\n }\n customCommand = command.toLowerCase();\n if (func = commands.exec[customCommand]) {\n func(customCommand, ui, value);\n editor.fire('ExecCommand', {\n command: command,\n ui: ui,\n value: value\n });\n return true;\n }\n each$a(editor.plugins, function (p) {\n if (p.execCommand && p.execCommand(command, ui, value)) {\n editor.fire('ExecCommand', {\n command: command,\n ui: ui,\n value: value\n });\n state = true;\n return false;\n }\n });\n if (state) {\n return state;\n }\n if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) {\n editor.fire('ExecCommand', {\n command: command,\n ui: ui,\n value: value\n });\n return true;\n }\n try {\n state = editor.getDoc().execCommand(command, ui, value);\n } catch (ex) {\n }\n if (state) {\n editor.fire('ExecCommand', {\n command: command,\n ui: ui,\n value: value\n });\n return true;\n }\n return false;\n };\n var queryCommandState = function (command) {\n var func;\n if (editor.quirks.isHidden() || editor.removed) {\n return;\n }\n command = command.toLowerCase();\n if (func = commands.state[command]) {\n return func(command);\n }\n try {\n return editor.getDoc().queryCommandState(command);\n } catch (ex) {\n }\n return false;\n };\n var queryCommandValue = function (command) {\n var func;\n if (editor.quirks.isHidden() || editor.removed) {\n return;\n }\n command = command.toLowerCase();\n if (func = commands.value[command]) {\n return func(command);\n }\n try {\n return editor.getDoc().queryCommandValue(command);\n } catch (ex) {\n }\n };\n var addCommands = function (commandList, type) {\n type = type || 'exec';\n each$a(commandList, function (callback, command) {\n each$a(command.toLowerCase().split(','), function (command) {\n commands[type][command] = callback;\n });\n });\n };\n var addCommand = function (command, callback, scope) {\n command = command.toLowerCase();\n commands.exec[command] = function (command, ui, value, args) {\n return callback.call(scope || editor, ui, value, args);\n };\n };\n var queryCommandSupported = function (command) {\n command = command.toLowerCase();\n if (commands.exec[command]) {\n return true;\n }\n try {\n return editor.getDoc().queryCommandSupported(command);\n } catch (ex) {\n }\n return false;\n };\n var addQueryStateHandler = function (command, callback, scope) {\n command = command.toLowerCase();\n commands.state[command] = function () {\n return callback.call(scope || editor);\n };\n };\n var addQueryValueHandler = function (command, callback, scope) {\n command = command.toLowerCase();\n commands.value[command] = function () {\n return callback.call(scope || editor);\n };\n };\n var hasCustomCommand = function (command) {\n command = command.toLowerCase();\n return !!commands.exec[command];\n };\n extend$2(this, {\n execCommand: execCommand,\n queryCommandState: queryCommandState,\n queryCommandValue: queryCommandValue,\n queryCommandSupported: queryCommandSupported,\n addCommands: addCommands,\n addCommand: addCommand,\n addQueryStateHandler: addQueryStateHandler,\n addQueryValueHandler: addQueryValueHandler,\n hasCustomCommand: hasCustomCommand\n });\n var execNativeCommand = function (command, ui, value) {\n if (ui === undefined) {\n ui = false;\n }\n if (value === undefined) {\n value = null;\n }\n return editor.getDoc().execCommand(command, ui, value);\n };\n var isFormatMatch = function (name) {\n return formatter.match(name);\n };\n var toggleFormat = function (name, value) {\n formatter.toggle(name, value ? { value: value } : undefined);\n editor.nodeChanged();\n };\n var storeSelection = function (type) {\n bookmark = selection.getBookmark(type);\n };\n var restoreSelection = function () {\n selection.moveToBookmark(bookmark);\n };\n addCommands({\n 'mceResetDesignMode,mceBeginUndoLevel': function () {\n },\n 'mceEndUndoLevel,mceAddUndoLevel': function () {\n editor.undoManager.add();\n },\n 'Cut,Copy,Paste': function (command) {\n var doc = editor.getDoc();\n var failed;\n try {\n execNativeCommand(command);\n } catch (ex) {\n failed = true;\n }\n if (command === 'paste' && !doc.queryCommandEnabled(command)) {\n failed = true;\n }\n if (failed || !doc.queryCommandSupported(command)) {\n var msg = editor.translate('Your browser doesn\\'t support direct access to the clipboard. ' + 'Please use the Ctrl+X/C/V keyboard shortcuts instead.');\n if (Env.mac) {\n msg = msg.replace(/Ctrl\\+/g, '\\u2318+');\n }\n editor.notificationManager.open({\n text: msg,\n type: 'error'\n });\n }\n },\n 'unlink': function () {\n if (selection.isCollapsed()) {\n var elm = editor.dom.getParent(editor.selection.getStart(), 'a');\n if (elm) {\n editor.dom.remove(elm, true);\n }\n return;\n }\n formatter.remove('link');\n },\n 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone': function (command) {\n var align = command.substring(7);\n if (align === 'full') {\n align = 'justify';\n }\n each$a('left,center,right,justify'.split(','), function (name) {\n if (align !== name) {\n formatter.remove('align' + name);\n }\n });\n if (align !== 'none') {\n toggleFormat('align' + align);\n }\n },\n 'InsertUnorderedList,InsertOrderedList': function (command) {\n var listElm, listParent;\n execNativeCommand(command);\n listElm = dom.getParent(selection.getNode(), 'ol,ul');\n if (listElm) {\n listParent = listElm.parentNode;\n if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {\n storeSelection();\n dom.split(listParent, listElm);\n restoreSelection();\n }\n }\n },\n 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) {\n toggleFormat(command);\n },\n 'ForeColor,HiliteColor': function (command, ui, value) {\n toggleFormat(command, value);\n },\n 'FontName': function (command, ui, value) {\n fontNameAction(editor, value);\n },\n 'FontSize': function (command, ui, value) {\n fontSizeAction(editor, value);\n },\n 'RemoveFormat': function (command) {\n formatter.remove(command);\n },\n 'mceBlockQuote': function () {\n toggleFormat('blockquote');\n },\n 'FormatBlock': function (command, ui, value) {\n return toggleFormat(value || 'p');\n },\n 'mceCleanup': function () {\n var bookmark = selection.getBookmark();\n editor.setContent(editor.getContent());\n selection.moveToBookmark(bookmark);\n },\n 'mceRemoveNode': function (command, ui, value) {\n var node = value || selection.getNode();\n if (node !== editor.getBody()) {\n storeSelection();\n editor.dom.remove(node, true);\n restoreSelection();\n }\n },\n 'mceSelectNodeDepth': function (command, ui, value) {\n var counter = 0;\n dom.getParent(selection.getNode(), function (node) {\n if (node.nodeType === 1 && counter++ === value) {\n selection.select(node);\n return false;\n }\n }, editor.getBody());\n },\n 'mceSelectNode': function (command, ui, value) {\n selection.select(value);\n },\n 'mceInsertContent': function (command, ui, value) {\n InsertContent.insertAtCaret(editor, value);\n },\n 'mceInsertRawHTML': function (command, ui, value) {\n selection.setContent('tiny_mce_marker');\n var content = editor.getContent();\n editor.setContent(content.replace(/tiny_mce_marker/g, function () {\n return value;\n }));\n },\n 'mceToggleFormat': function (command, ui, value) {\n toggleFormat(value);\n },\n 'mceSetContent': function (command, ui, value) {\n editor.setContent(value);\n },\n 'Indent,Outdent': function (command) {\n handle(editor, command);\n },\n 'mceRepaint': function () {\n },\n 'InsertHorizontalRule': function () {\n editor.execCommand('mceInsertContent', false, '
');\n },\n 'mceToggleVisualAid': function () {\n editor.hasVisual = !editor.hasVisual;\n editor.addVisual();\n },\n 'mceReplaceContent': function (command, ui, value) {\n editor.execCommand('mceInsertContent', false, value.replace(/\\{\\$selection\\}/g, selection.getContent({ format: 'text' })));\n },\n 'mceInsertLink': function (command, ui, value) {\n var anchor;\n if (typeof value === 'string') {\n value = { href: value };\n }\n anchor = dom.getParent(selection.getNode(), 'a');\n value.href = value.href.replace(' ', '%20');\n if (!anchor || !value.href) {\n formatter.remove('link');\n }\n if (value.href) {\n formatter.apply('link', value, anchor);\n }\n },\n 'selectAll': function () {\n var editingHost = dom.getParent(selection.getStart(), NodeType.isContentEditableTrue);\n if (editingHost) {\n var rng = dom.createRng();\n rng.selectNodeContents(editingHost);\n selection.setRng(rng);\n }\n },\n 'delete': function () {\n DeleteCommands.deleteCommand(editor);\n },\n 'forwardDelete': function () {\n DeleteCommands.forwardDeleteCommand(editor);\n },\n 'mceNewDocument': function () {\n editor.setContent('');\n },\n 'InsertLineBreak': function (command, ui, value) {\n InsertBr.insert(editor, value);\n return true;\n }\n });\n var alignStates = function (name) {\n return function () {\n var nodes = selection.isCollapsed() ? [dom.getParent(selection.getNode(), dom.isBlock)] : selection.getSelectedBlocks();\n var matches = map$3(nodes, function (node) {\n return !!formatter.matchNode(node, name);\n });\n return inArray$2(matches, true) !== -1;\n };\n };\n addCommands({\n 'JustifyLeft': alignStates('alignleft'),\n 'JustifyCenter': alignStates('aligncenter'),\n 'JustifyRight': alignStates('alignright'),\n 'JustifyFull': alignStates('alignjustify'),\n 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) {\n return isFormatMatch(command);\n },\n 'mceBlockQuote': function () {\n return isFormatMatch('blockquote');\n },\n 'Outdent': function () {\n var node;\n if (settings.inline_styles) {\n if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) {\n return true;\n }\n if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) {\n return true;\n }\n }\n return queryCommandState('InsertUnorderedList') || queryCommandState('InsertOrderedList') || !settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE');\n },\n 'InsertUnorderedList,InsertOrderedList': function (command) {\n var list = dom.getParent(selection.getNode(), 'ul,ol');\n return list && (command === 'insertunorderedlist' && list.tagName === 'UL' || command === 'insertorderedlist' && list.tagName === 'OL');\n }\n }, 'state');\n addCommands({\n Undo: function () {\n editor.undoManager.undo();\n },\n Redo: function () {\n editor.undoManager.redo();\n }\n });\n addQueryValueHandler('FontName', function () {\n return fontNameQuery(editor);\n }, this);\n addQueryValueHandler('FontSize', function () {\n return fontSizeQuery(editor);\n }, this);\n }\n\n var nativeEvents = Tools.makeMap('focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange ' + 'mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover ' + 'draggesture dragdrop drop drag submit ' + 'compositionstart compositionend compositionupdate touchstart touchmove touchend', ' ');\n var Dispatcher = function (settings) {\n var self = this;\n var scope, bindings = {}, toggleEvent;\n var returnFalse = function () {\n return false;\n };\n var returnTrue = function () {\n return true;\n };\n settings = settings || {};\n scope = settings.scope || self;\n toggleEvent = settings.toggleEvent || returnFalse;\n var fire = function (name, args) {\n var handlers, i, l, callback;\n name = name.toLowerCase();\n args = args || {};\n args.type = name;\n if (!args.target) {\n args.target = scope;\n }\n if (!args.preventDefault) {\n args.preventDefault = function () {\n args.isDefaultPrevented = returnTrue;\n };\n args.stopPropagation = function () {\n args.isPropagationStopped = returnTrue;\n };\n args.stopImmediatePropagation = function () {\n args.isImmediatePropagationStopped = returnTrue;\n };\n args.isDefaultPrevented = returnFalse;\n args.isPropagationStopped = returnFalse;\n args.isImmediatePropagationStopped = returnFalse;\n }\n if (settings.beforeFire) {\n settings.beforeFire(args);\n }\n handlers = bindings[name];\n if (handlers) {\n for (i = 0, l = handlers.length; i < l; i++) {\n callback = handlers[i];\n if (callback.once) {\n off(name, callback.func);\n }\n if (args.isImmediatePropagationStopped()) {\n args.stopPropagation();\n return args;\n }\n if (callback.func.call(scope, args) === false) {\n args.preventDefault();\n return args;\n }\n }\n }\n return args;\n };\n var on = function (name, callback, prepend, extra) {\n var handlers, names, i;\n if (callback === false) {\n callback = returnFalse;\n }\n if (callback) {\n callback = { func: callback };\n if (extra) {\n Tools.extend(callback, extra);\n }\n names = name.toLowerCase().split(' ');\n i = names.length;\n while (i--) {\n name = names[i];\n handlers = bindings[name];\n if (!handlers) {\n handlers = bindings[name] = [];\n toggleEvent(name, true);\n }\n if (prepend) {\n handlers.unshift(callback);\n } else {\n handlers.push(callback);\n }\n }\n }\n return self;\n };\n var off = function (name, callback) {\n var i, handlers, bindingName, names, hi;\n if (name) {\n names = name.toLowerCase().split(' ');\n i = names.length;\n while (i--) {\n name = names[i];\n handlers = bindings[name];\n if (!name) {\n for (bindingName in bindings) {\n toggleEvent(bindingName, false);\n delete bindings[bindingName];\n }\n return self;\n }\n if (handlers) {\n if (!callback) {\n handlers.length = 0;\n } else {\n hi = handlers.length;\n while (hi--) {\n if (handlers[hi].func === callback) {\n handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1));\n bindings[name] = handlers;\n }\n }\n }\n if (!handlers.length) {\n toggleEvent(name, false);\n delete bindings[name];\n }\n }\n }\n } else {\n for (name in bindings) {\n toggleEvent(name, false);\n }\n bindings = {};\n }\n return self;\n };\n var once = function (name, callback, prepend) {\n return on(name, callback, prepend, { once: true });\n };\n var has = function (name) {\n name = name.toLowerCase();\n return !(!bindings[name] || bindings[name].length === 0);\n };\n self.fire = fire;\n self.on = on;\n self.off = off;\n self.once = once;\n self.has = has;\n };\n Dispatcher.isNative = function (name) {\n return !!nativeEvents[name.toLowerCase()];\n };\n\n var getEventDispatcher = function (obj) {\n if (!obj._eventDispatcher) {\n obj._eventDispatcher = new Dispatcher({\n scope: obj,\n toggleEvent: function (name, state) {\n if (Dispatcher.isNative(name) && obj.toggleNativeEvent) {\n obj.toggleNativeEvent(name, state);\n }\n }\n });\n }\n return obj._eventDispatcher;\n };\n var Observable = {\n fire: function (name, args, bubble) {\n var self = this;\n if (self.removed && name !== 'remove' && name !== 'detach') {\n return args;\n }\n args = getEventDispatcher(self).fire(name, args, bubble);\n if (bubble !== false && self.parent) {\n var parent = self.parent();\n while (parent && !args.isPropagationStopped()) {\n parent.fire(name, args, false);\n parent = parent.parent();\n }\n }\n return args;\n },\n on: function (name, callback, prepend) {\n return getEventDispatcher(this).on(name, callback, prepend);\n },\n off: function (name, callback) {\n return getEventDispatcher(this).off(name, callback);\n },\n once: function (name, callback) {\n return getEventDispatcher(this).once(name, callback);\n },\n hasEventListeners: function (name) {\n return getEventDispatcher(this).has(name);\n }\n };\n\n var firePreProcess = function (editor, args) {\n return editor.fire('PreProcess', args);\n };\n var firePostProcess = function (editor, args) {\n return editor.fire('PostProcess', args);\n };\n var fireRemove = function (editor) {\n return editor.fire('remove');\n };\n var fireDetach = function (editor) {\n return editor.fire('detach');\n };\n var fireSwitchMode = function (editor, mode) {\n return editor.fire('SwitchMode', { mode: mode });\n };\n var fireObjectResizeStart = function (editor, target, width, height) {\n editor.fire('ObjectResizeStart', {\n target: target,\n width: width,\n height: height\n });\n };\n var fireObjectResized = function (editor, target, width, height) {\n editor.fire('ObjectResized', {\n target: target,\n width: width,\n height: height\n });\n };\n var Events = {\n firePreProcess: firePreProcess,\n firePostProcess: firePostProcess,\n fireRemove: fireRemove,\n fireDetach: fireDetach,\n fireSwitchMode: fireSwitchMode,\n fireObjectResizeStart: fireObjectResizeStart,\n fireObjectResized: fireObjectResized\n };\n\n var setEditorCommandState = function (editor, cmd, state) {\n try {\n editor.getDoc().execCommand(cmd, false, state);\n } catch (ex) {\n }\n };\n var toggleClass = function (elm, cls, state) {\n if (has$2(elm, cls) && state === false) {\n remove$4(elm, cls);\n } else if (state) {\n add$2(elm, cls);\n }\n };\n var toggleReadOnly = function (editor, state) {\n toggleClass(Element.fromDom(editor.getBody()), 'mce-content-readonly', state);\n if (state) {\n editor.selection.controlSelection.hideResizeRect();\n editor.readonly = true;\n editor.getBody().contentEditable = 'false';\n } else {\n editor.readonly = false;\n editor.getBody().contentEditable = 'true';\n setEditorCommandState(editor, 'StyleWithCSS', false);\n setEditorCommandState(editor, 'enableInlineTableEditing', false);\n setEditorCommandState(editor, 'enableObjectResizing', false);\n editor.focus();\n editor.nodeChanged();\n }\n };\n var setMode = function (editor, mode) {\n if (mode === getMode(editor)) {\n return;\n }\n if (editor.initialized) {\n toggleReadOnly(editor, mode === 'readonly');\n } else {\n editor.on('init', function () {\n toggleReadOnly(editor, mode === 'readonly');\n });\n }\n Events.fireSwitchMode(editor, mode);\n };\n var getMode = function (editor) {\n return editor.readonly ? 'readonly' : 'design';\n };\n var isReadOnly = function (editor) {\n return editor.readonly === true;\n };\n\n var DOM$1 = DOMUtils$1.DOM;\n var customEventRootDelegates;\n var getEventTarget = function (editor, eventName) {\n if (eventName === 'selectionchange') {\n return editor.getDoc();\n }\n if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {\n return editor.getDoc().documentElement;\n }\n if (editor.settings.event_root) {\n if (!editor.eventRoot) {\n editor.eventRoot = DOM$1.select(editor.settings.event_root)[0];\n }\n return editor.eventRoot;\n }\n return editor.getBody();\n };\n var isListening = function (editor) {\n return !editor.hidden && !editor.readonly;\n };\n var fireEvent = function (editor, eventName, e) {\n if (isListening(editor)) {\n editor.fire(eventName, e);\n } else if (isReadOnly(editor)) {\n e.preventDefault();\n }\n };\n var bindEventDelegate = function (editor, eventName) {\n var eventRootElm, delegate;\n if (!editor.delegates) {\n editor.delegates = {};\n }\n if (editor.delegates[eventName] || editor.removed) {\n return;\n }\n eventRootElm = getEventTarget(editor, eventName);\n if (editor.settings.event_root) {\n if (!customEventRootDelegates) {\n customEventRootDelegates = {};\n editor.editorManager.on('removeEditor', function () {\n var name;\n if (!editor.editorManager.activeEditor) {\n if (customEventRootDelegates) {\n for (name in customEventRootDelegates) {\n editor.dom.unbind(getEventTarget(editor, name));\n }\n customEventRootDelegates = null;\n }\n }\n });\n }\n if (customEventRootDelegates[eventName]) {\n return;\n }\n delegate = function (e) {\n var target = e.target;\n var editors = editor.editorManager.get();\n var i = editors.length;\n while (i--) {\n var body = editors[i].getBody();\n if (body === target || DOM$1.isChildOf(target, body)) {\n fireEvent(editors[i], eventName, e);\n }\n }\n };\n customEventRootDelegates[eventName] = delegate;\n DOM$1.bind(eventRootElm, eventName, delegate);\n } else {\n delegate = function (e) {\n fireEvent(editor, eventName, e);\n };\n DOM$1.bind(eventRootElm, eventName, delegate);\n editor.delegates[eventName] = delegate;\n }\n };\n var EditorObservable = {\n bindPendingEventDelegates: function () {\n var self = this;\n Tools.each(self._pendingNativeEvents, function (name) {\n bindEventDelegate(self, name);\n });\n },\n toggleNativeEvent: function (name, state) {\n var self = this;\n if (name === 'focus' || name === 'blur') {\n return;\n }\n if (state) {\n if (self.initialized) {\n bindEventDelegate(self, name);\n } else {\n if (!self._pendingNativeEvents) {\n self._pendingNativeEvents = [name];\n } else {\n self._pendingNativeEvents.push(name);\n }\n }\n } else if (self.initialized) {\n self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);\n delete self.delegates[name];\n }\n },\n unbindAllNativeEvents: function () {\n var self = this;\n var body = self.getBody();\n var dom = self.dom;\n var name;\n if (self.delegates) {\n for (name in self.delegates) {\n self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);\n }\n delete self.delegates;\n }\n if (!self.inline && body && dom) {\n body.onload = null;\n dom.unbind(self.getWin());\n dom.unbind(self.getDoc());\n }\n if (dom) {\n dom.unbind(body);\n dom.unbind(self.getContainer());\n }\n }\n };\n EditorObservable = Tools.extend({}, Observable, EditorObservable);\n var EditorObservable$1 = EditorObservable;\n\n var sectionResult = Immutable('sections', 'settings');\n var detection = PlatformDetection$1.detect();\n var isTouch = detection.deviceType.isTouch();\n var mobilePlugins = [\n 'lists',\n 'autolink',\n 'autosave'\n ];\n var defaultMobileSettings = { theme: 'mobile' };\n var normalizePlugins = function (plugins) {\n var pluginNames = isArray(plugins) ? plugins.join(' ') : plugins;\n var trimmedPlugins = map(isString(pluginNames) ? pluginNames.split(' ') : [], trim$2);\n return filter(trimmedPlugins, function (item) {\n return item.length > 0;\n });\n };\n var filterMobilePlugins = function (plugins) {\n return filter(plugins, curry(contains, mobilePlugins));\n };\n var extractSections = function (keys, settings) {\n var result = bifilter(settings, function (value, key) {\n return contains(keys, key);\n });\n return sectionResult(result.t, result.f);\n };\n var getSection = function (sectionResult, name, defaults) {\n var sections = sectionResult.sections();\n var sectionSettings = sections.hasOwnProperty(name) ? sections[name] : {};\n return Tools.extend({}, defaults, sectionSettings);\n };\n var hasSection = function (sectionResult, name) {\n return sectionResult.sections().hasOwnProperty(name);\n };\n var getDefaultSettings = function (id, documentBaseUrl, editor) {\n return {\n id: id,\n theme: 'modern',\n delta_width: 0,\n delta_height: 0,\n popup_css: '',\n plugins: '',\n document_base_url: documentBaseUrl,\n add_form_submit_trigger: true,\n submit_patch: true,\n add_unload_trigger: true,\n convert_urls: true,\n relative_urls: true,\n remove_script_host: true,\n object_resizing: true,\n doctype: '',\n visual: true,\n font_size_style_values: 'xx-small,x-small,small,medium,large,x-large,xx-large',\n font_size_legacy_values: 'xx-small,small,medium,large,x-large,xx-large,300%',\n forced_root_block: 'p',\n hidden_input: true,\n render_ui: true,\n indentation: '40px',\n inline_styles: true,\n convert_fonts_to_spans: true,\n indent: 'simple',\n indent_before: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',\n indent_after: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',\n entity_encoding: 'named',\n url_converter: editor.convertURL,\n url_converter_scope: editor,\n ie7_compat: true\n };\n };\n var getExternalPlugins = function (overrideSettings, settings) {\n var userDefinedExternalPlugins = settings.external_plugins ? settings.external_plugins : {};\n if (overrideSettings && overrideSettings.external_plugins) {\n return Tools.extend({}, overrideSettings.external_plugins, userDefinedExternalPlugins);\n } else {\n return userDefinedExternalPlugins;\n }\n };\n var combinePlugins = function (forcedPlugins, plugins) {\n return [].concat(normalizePlugins(forcedPlugins)).concat(normalizePlugins(plugins));\n };\n var processPlugins = function (isTouchDevice, sectionResult, defaultOverrideSettings, settings) {\n var forcedPlugins = normalizePlugins(defaultOverrideSettings.forced_plugins);\n var plugins = normalizePlugins(settings.plugins);\n var platformPlugins = isTouchDevice && hasSection(sectionResult, 'mobile') ? filterMobilePlugins(plugins) : plugins;\n var combinedPlugins = combinePlugins(forcedPlugins, platformPlugins);\n return Tools.extend(settings, { plugins: combinedPlugins.join(' ') });\n };\n var isOnMobile = function (isTouchDevice, sectionResult) {\n var isInline = sectionResult.settings().inline;\n return isTouchDevice && hasSection(sectionResult, 'mobile') && !isInline;\n };\n var combineSettings = function (isTouchDevice, defaultSettings, defaultOverrideSettings, settings) {\n var sectionResult = extractSections(['mobile'], settings);\n var extendedSettings = Tools.extend(defaultSettings, defaultOverrideSettings, sectionResult.settings(), isOnMobile(isTouchDevice, sectionResult) ? getSection(sectionResult, 'mobile', defaultMobileSettings) : {}, {\n validate: true,\n content_editable: sectionResult.settings().inline,\n external_plugins: getExternalPlugins(defaultOverrideSettings, sectionResult.settings())\n });\n return processPlugins(isTouchDevice, sectionResult, defaultOverrideSettings, extendedSettings);\n };\n var getEditorSettings = function (editor, id, documentBaseUrl, defaultOverrideSettings, settings) {\n var defaultSettings = getDefaultSettings(id, documentBaseUrl, editor);\n return combineSettings(isTouch, defaultSettings, defaultOverrideSettings, settings);\n };\n var getFiltered = function (predicate, editor, name) {\n return Option.from(editor.settings[name]).filter(predicate);\n };\n var getParamObject = function (value) {\n var output = {};\n if (typeof value === 'string') {\n each(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(','), function (val) {\n var arr = val.split('=');\n if (arr.length > 1) {\n output[Tools.trim(arr[0])] = Tools.trim(arr[1]);\n } else {\n output[Tools.trim(arr[0])] = Tools.trim(arr);\n }\n });\n } else {\n output = value;\n }\n return output;\n };\n var isArrayOf = function (p) {\n return function (a) {\n return isArray(a) && forall(a, p);\n };\n };\n var getParam = function (editor, name, defaultVal, type) {\n var value = name in editor.settings ? editor.settings[name] : defaultVal;\n if (type === 'hash') {\n return getParamObject(value);\n } else if (type === 'string') {\n return getFiltered(isString, editor, name).getOr(defaultVal);\n } else if (type === 'number') {\n return getFiltered(isNumber, editor, name).getOr(defaultVal);\n } else if (type === 'boolean') {\n return getFiltered(isBoolean, editor, name).getOr(defaultVal);\n } else if (type === 'object') {\n return getFiltered(isObject, editor, name).getOr(defaultVal);\n } else if (type === 'array') {\n return getFiltered(isArray, editor, name).getOr(defaultVal);\n } else if (type === 'string[]') {\n return getFiltered(isArrayOf(isString), editor, name).getOr(defaultVal);\n } else if (type === 'function') {\n return getFiltered(isFunction, editor, name).getOr(defaultVal);\n } else {\n return value;\n }\n };\n\n var each$b = Tools.each, explode$2 = Tools.explode;\n var keyCodeLookup = {\n f1: 112,\n f2: 113,\n f3: 114,\n f4: 115,\n f5: 116,\n f6: 117,\n f7: 118,\n f8: 119,\n f9: 120,\n f10: 121,\n f11: 122,\n f12: 123\n };\n var modifierNames = Tools.makeMap('alt,ctrl,shift,meta,access');\n function Shortcuts (editor) {\n var self = this;\n var shortcuts = {};\n var pendingPatterns = [];\n var parseShortcut = function (pattern) {\n var id, key;\n var shortcut = {};\n each$b(explode$2(pattern, '+'), function (value) {\n if (value in modifierNames) {\n shortcut[value] = true;\n } else {\n if (/^[0-9]{2,}$/.test(value)) {\n shortcut.keyCode = parseInt(value, 10);\n } else {\n shortcut.charCode = value.charCodeAt(0);\n shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0);\n }\n }\n });\n id = [shortcut.keyCode];\n for (key in modifierNames) {\n if (shortcut[key]) {\n id.push(key);\n } else {\n shortcut[key] = false;\n }\n }\n shortcut.id = id.join(',');\n if (shortcut.access) {\n shortcut.alt = true;\n if (Env.mac) {\n shortcut.ctrl = true;\n } else {\n shortcut.shift = true;\n }\n }\n if (shortcut.meta) {\n if (Env.mac) {\n shortcut.meta = true;\n } else {\n shortcut.ctrl = true;\n shortcut.meta = false;\n }\n }\n return shortcut;\n };\n var createShortcut = function (pattern, desc, cmdFunc, scope) {\n var shortcuts;\n shortcuts = Tools.map(explode$2(pattern, '>'), parseShortcut);\n shortcuts[shortcuts.length - 1] = Tools.extend(shortcuts[shortcuts.length - 1], {\n func: cmdFunc,\n scope: scope || editor\n });\n return Tools.extend(shortcuts[0], {\n desc: editor.translate(desc),\n subpatterns: shortcuts.slice(1)\n });\n };\n var hasModifier = function (e) {\n return e.altKey || e.ctrlKey || e.metaKey;\n };\n var isFunctionKey = function (e) {\n return e.type === 'keydown' && e.keyCode >= 112 && e.keyCode <= 123;\n };\n var matchShortcut = function (e, shortcut) {\n if (!shortcut) {\n return false;\n }\n if (shortcut.ctrl !== e.ctrlKey || shortcut.meta !== e.metaKey) {\n return false;\n }\n if (shortcut.alt !== e.altKey || shortcut.shift !== e.shiftKey) {\n return false;\n }\n if (e.keyCode === shortcut.keyCode || e.charCode && e.charCode === shortcut.charCode) {\n e.preventDefault();\n return true;\n }\n return false;\n };\n var executeShortcutAction = function (shortcut) {\n return shortcut.func ? shortcut.func.call(shortcut.scope) : null;\n };\n editor.on('keyup keypress keydown', function (e) {\n if ((hasModifier(e) || isFunctionKey(e)) && !e.isDefaultPrevented()) {\n each$b(shortcuts, function (shortcut) {\n if (matchShortcut(e, shortcut)) {\n pendingPatterns = shortcut.subpatterns.slice(0);\n if (e.type === 'keydown') {\n executeShortcutAction(shortcut);\n }\n return true;\n }\n });\n if (matchShortcut(e, pendingPatterns[0])) {\n if (pendingPatterns.length === 1) {\n if (e.type === 'keydown') {\n executeShortcutAction(pendingPatterns[0]);\n }\n }\n pendingPatterns.shift();\n }\n }\n });\n self.add = function (pattern, desc, cmdFunc, scope) {\n var cmd;\n cmd = cmdFunc;\n if (typeof cmdFunc === 'string') {\n cmdFunc = function () {\n editor.execCommand(cmd, false, null);\n };\n } else if (Tools.isArray(cmd)) {\n cmdFunc = function () {\n editor.execCommand(cmd[0], cmd[1], cmd[2]);\n };\n }\n each$b(explode$2(Tools.trim(pattern.toLowerCase())), function (pattern) {\n var shortcut = createShortcut(pattern, desc, cmdFunc, scope);\n shortcuts[shortcut.id] = shortcut;\n });\n return true;\n };\n self.remove = function (pattern) {\n var shortcut = createShortcut(pattern);\n if (shortcuts[shortcut.id]) {\n delete shortcuts[shortcut.id];\n return true;\n }\n return false;\n };\n }\n\n var hasFocus = function (element) {\n var doc = owner(element).dom();\n return element.dom() === doc.activeElement;\n };\n var active = function (_doc) {\n var doc = _doc !== undefined ? _doc.dom() : domGlobals.document;\n return Option.from(doc.activeElement).map(Element.fromDom);\n };\n var search = function (element) {\n return active(owner(element)).filter(function (e) {\n return element.dom().contains(e.dom());\n });\n };\n\n var getContentEditableHost = function (editor, node) {\n return editor.dom.getParent(node, function (node) {\n return editor.dom.getContentEditable(node) === 'true';\n });\n };\n var getCollapsedNode = function (rng) {\n return rng.collapsed ? Option.from(getNode(rng.startContainer, rng.startOffset)).map(Element.fromDom) : Option.none();\n };\n var getFocusInElement = function (root, rng) {\n return getCollapsedNode(rng).bind(function (node) {\n if (isTableSection(node)) {\n return Option.some(node);\n } else if (contains$3(root, node) === false) {\n return Option.some(root);\n } else {\n return Option.none();\n }\n });\n };\n var normalizeSelection = function (editor, rng) {\n getFocusInElement(Element.fromDom(editor.getBody()), rng).bind(function (elm) {\n return CaretFinder.firstPositionIn(elm.dom());\n }).fold(function () {\n editor.selection.normalize();\n return;\n }, function (caretPos) {\n return editor.selection.setRng(caretPos.toRange());\n });\n };\n var focusBody = function (body) {\n if (body.setActive) {\n try {\n body.setActive();\n } catch (ex) {\n body.focus();\n }\n } else {\n body.focus();\n }\n };\n var hasElementFocus = function (elm) {\n return hasFocus(elm) || search(elm).isSome();\n };\n var hasIframeFocus = function (editor) {\n return editor.iframeElement && hasFocus(Element.fromDom(editor.iframeElement));\n };\n var hasInlineFocus = function (editor) {\n var rawBody = editor.getBody();\n return rawBody && hasElementFocus(Element.fromDom(rawBody));\n };\n var hasFocus$1 = function (editor) {\n return editor.inline ? hasInlineFocus(editor) : hasIframeFocus(editor);\n };\n var focusEditor = function (editor) {\n var selection = editor.selection, contentEditable = editor.settings.content_editable;\n var body = editor.getBody();\n var rng = selection.getRng();\n editor.quirks.refreshContentEditable();\n var contentEditableHost = getContentEditableHost(editor, selection.getNode());\n if (editor.$.contains(body, contentEditableHost)) {\n focusBody(contentEditableHost);\n normalizeSelection(editor, rng);\n activateEditor(editor);\n return;\n }\n if (editor.bookmark !== undefined && hasFocus$1(editor) === false) {\n SelectionBookmark.getRng(editor).each(function (bookmarkRng) {\n editor.selection.setRng(bookmarkRng);\n rng = bookmarkRng;\n });\n }\n if (!contentEditable) {\n if (!Env.opera) {\n focusBody(body);\n }\n editor.getWin().focus();\n }\n if (Env.gecko || contentEditable) {\n focusBody(body);\n normalizeSelection(editor, rng);\n }\n activateEditor(editor);\n };\n var activateEditor = function (editor) {\n return editor.editorManager.setActive(editor);\n };\n var focus = function (editor, skipFocus) {\n if (editor.removed) {\n return;\n }\n skipFocus ? activateEditor(editor) : focusEditor(editor);\n };\n var EditorFocus = {\n focus: focus,\n hasFocus: hasFocus$1\n };\n\n var getProp = function (propName, elm) {\n var rawElm = elm.dom();\n return rawElm[propName];\n };\n var getComputedSizeProp = function (propName, elm) {\n return parseInt(get$1(elm, propName), 10);\n };\n var getClientWidth = curry(getProp, 'clientWidth');\n var getClientHeight = curry(getProp, 'clientHeight');\n var getMarginTop = curry(getComputedSizeProp, 'margin-top');\n var getMarginLeft = curry(getComputedSizeProp, 'margin-left');\n var getBoundingClientRect$1 = function (elm) {\n return elm.dom().getBoundingClientRect();\n };\n var isInsideElementContentArea = function (bodyElm, clientX, clientY) {\n var clientWidth = getClientWidth(bodyElm);\n var clientHeight = getClientHeight(bodyElm);\n return clientX >= 0 && clientY >= 0 && clientX <= clientWidth && clientY <= clientHeight;\n };\n var transpose = function (inline, elm, clientX, clientY) {\n var clientRect = getBoundingClientRect$1(elm);\n var deltaX = inline ? clientRect.left + elm.dom().clientLeft + getMarginLeft(elm) : 0;\n var deltaY = inline ? clientRect.top + elm.dom().clientTop + getMarginTop(elm) : 0;\n var x = clientX - deltaX;\n var y = clientY - deltaY;\n return {\n x: x,\n y: y\n };\n };\n var isXYInContentArea = function (editor, clientX, clientY) {\n var bodyElm = Element.fromDom(editor.getBody());\n var targetElm = editor.inline ? bodyElm : documentElement(bodyElm);\n var transposedPoint = transpose(editor.inline, targetElm, clientX, clientY);\n return isInsideElementContentArea(targetElm, transposedPoint.x, transposedPoint.y);\n };\n var fromDomSafe = function (node) {\n return Option.from(node).map(Element.fromDom);\n };\n var isEditorAttachedToDom = function (editor) {\n var rawContainer = editor.inline ? editor.getBody() : editor.getContentAreaContainer();\n return fromDomSafe(rawContainer).map(function (container) {\n return contains$3(owner(container), container);\n }).getOr(false);\n };\n var EditorView = {\n isXYInContentArea: isXYInContentArea,\n isEditorAttachedToDom: isEditorAttachedToDom\n };\n\n function NotificationManagerImpl () {\n var unimplemented = function () {\n throw new Error('Theme did not provide a NotificationManager implementation.');\n };\n return {\n open: unimplemented,\n close: unimplemented,\n reposition: unimplemented,\n getArgs: unimplemented\n };\n }\n\n function NotificationManager (editor) {\n var notifications = [];\n var getImplementation = function () {\n var theme = editor.theme;\n return theme && theme.getNotificationManagerImpl ? theme.getNotificationManagerImpl() : NotificationManagerImpl();\n };\n var getTopNotification = function () {\n return Option.from(notifications[0]);\n };\n var isEqual = function (a, b) {\n return a.type === b.type && a.text === b.text && !a.progressBar && !a.timeout && !b.progressBar && !b.timeout;\n };\n var reposition = function () {\n if (notifications.length > 0) {\n getImplementation().reposition(notifications);\n }\n };\n var addNotification = function (notification) {\n notifications.push(notification);\n };\n var closeNotification = function (notification) {\n findIndex(notifications, function (otherNotification) {\n return otherNotification === notification;\n }).each(function (index) {\n notifications.splice(index, 1);\n });\n };\n var open = function (args) {\n if (editor.removed || !EditorView.isEditorAttachedToDom(editor)) {\n return;\n }\n return find(notifications, function (notification) {\n return isEqual(getImplementation().getArgs(notification), args);\n }).getOrThunk(function () {\n editor.editorManager.setActive(editor);\n var notification = getImplementation().open(args, function () {\n closeNotification(notification);\n reposition();\n });\n addNotification(notification);\n reposition();\n return notification;\n });\n };\n var close = function () {\n getTopNotification().each(function (notification) {\n getImplementation().close(notification);\n closeNotification(notification);\n reposition();\n });\n };\n var getNotifications = function () {\n return notifications;\n };\n var registerEvents = function (editor) {\n editor.on('SkinLoaded', function () {\n var serviceMessage = editor.settings.service_message;\n if (serviceMessage) {\n open({\n text: serviceMessage,\n type: 'warning',\n timeout: 0,\n icon: ''\n });\n }\n });\n editor.on('ResizeEditor ResizeWindow', function () {\n Delay.requestAnimationFrame(reposition);\n });\n editor.on('remove', function () {\n each(notifications.slice(), function (notification) {\n getImplementation().close(notification);\n });\n });\n };\n registerEvents(editor);\n return {\n open: open,\n close: close,\n getNotifications: getNotifications\n };\n }\n\n function WindowManagerImpl () {\n var unimplemented = function () {\n throw new Error('Theme did not provide a WindowManager implementation.');\n };\n return {\n open: unimplemented,\n alert: unimplemented,\n confirm: unimplemented,\n close: unimplemented,\n getParams: unimplemented,\n setParams: unimplemented\n };\n }\n\n function WindowManager (editor) {\n var windows = [];\n var getImplementation = function () {\n var theme = editor.theme;\n return theme && theme.getWindowManagerImpl ? theme.getWindowManagerImpl() : WindowManagerImpl();\n };\n var funcBind = function (scope, f) {\n return function () {\n return f ? f.apply(scope, arguments) : undefined;\n };\n };\n var fireOpenEvent = function (win) {\n editor.fire('OpenWindow', { win: win });\n };\n var fireCloseEvent = function (win) {\n editor.fire('CloseWindow', { win: win });\n };\n var addWindow = function (win) {\n windows.push(win);\n fireOpenEvent(win);\n };\n var closeWindow = function (win) {\n findIndex(windows, function (otherWindow) {\n return otherWindow === win;\n }).each(function (index) {\n windows.splice(index, 1);\n fireCloseEvent(win);\n if (windows.length === 0) {\n editor.focus();\n }\n });\n };\n var getTopWindow = function () {\n return Option.from(windows[windows.length - 1]);\n };\n var open = function (args, params) {\n editor.editorManager.setActive(editor);\n SelectionBookmark.store(editor);\n var win = getImplementation().open(args, params, closeWindow);\n addWindow(win);\n return win;\n };\n var alert = function (message, callback, scope) {\n var win = getImplementation().alert(message, funcBind(scope ? scope : this, callback), closeWindow);\n addWindow(win);\n };\n var confirm = function (message, callback, scope) {\n var win = getImplementation().confirm(message, funcBind(scope ? scope : this, callback), closeWindow);\n addWindow(win);\n };\n var close = function () {\n getTopWindow().each(function (win) {\n getImplementation().close(win);\n closeWindow(win);\n });\n };\n var getParams = function () {\n return getTopWindow().map(getImplementation().getParams).getOr(null);\n };\n var setParams = function (params) {\n getTopWindow().each(function (win) {\n getImplementation().setParams(win, params);\n });\n };\n var getWindows = function () {\n return windows;\n };\n editor.on('remove', function () {\n each(windows.slice(0), function (win) {\n getImplementation().close(win);\n });\n });\n return {\n windows: windows,\n open: open,\n alert: alert,\n confirm: confirm,\n close: close,\n getParams: getParams,\n setParams: setParams,\n getWindows: getWindows\n };\n }\n\n var data = {};\n var code = 'en';\n var I18n = {\n setCode: function (newCode) {\n if (newCode) {\n code = newCode;\n this.rtl = this.data[newCode] ? this.data[newCode]._dir === 'rtl' : false;\n }\n },\n getCode: function () {\n return code;\n },\n rtl: false,\n add: function (code, items) {\n var langData = data[code];\n if (!langData) {\n data[code] = langData = {};\n }\n for (var name in items) {\n langData[name] = items[name];\n }\n this.setCode(code);\n },\n translate: function (text) {\n var langData = data[code] || {};\n var toString = function (obj) {\n if (Tools.is(obj, 'function')) {\n return Object.prototype.toString.call(obj);\n }\n return !isEmpty(obj) ? '' + obj : '';\n };\n var isEmpty = function (text) {\n return text === '' || text === null || Tools.is(text, 'undefined');\n };\n var getLangData = function (text) {\n text = toString(text);\n return Tools.hasOwn(langData, text) ? toString(langData[text]) : text;\n };\n if (isEmpty(text)) {\n return '';\n }\n if (Tools.is(text, 'object') && Tools.hasOwn(text, 'raw')) {\n return toString(text.raw);\n }\n if (Tools.is(text, 'array')) {\n var values_1 = text.slice(1);\n text = getLangData(text[0]).replace(/\\{([0-9]+)\\}/g, function ($1, $2) {\n return Tools.hasOwn(values_1, $2) ? toString(values_1[$2]) : $1;\n });\n }\n return getLangData(text).replace(/{context:\\w+}$/, '');\n },\n data: data\n };\n\n var PluginManager = AddOnManager.PluginManager;\n var resolvePluginName = function (targetUrl, suffix) {\n for (var name in PluginManager.urls) {\n var matchUrl = PluginManager.urls[name] + '/plugin' + suffix + '.js';\n if (matchUrl === targetUrl) {\n return name;\n }\n }\n return null;\n };\n var pluginUrlToMessage = function (editor, url) {\n var plugin = resolvePluginName(url, editor.suffix);\n return plugin ? I18n.translate([\n 'Failed to load plugin: {0} from url {1}',\n plugin,\n url\n ]) : I18n.translate([\n 'Failed to load plugin url: {0}',\n url\n ]);\n };\n var displayNotification = function (editor, message) {\n editor.notificationManager.open({\n type: 'error',\n text: message\n });\n };\n var displayError = function (editor, message) {\n if (editor._skinLoaded) {\n displayNotification(editor, message);\n } else {\n editor.on('SkinLoaded', function () {\n displayNotification(editor, message);\n });\n }\n };\n var uploadError = function (editor, message) {\n displayError(editor, I18n.translate([\n 'Failed to upload image: {0}',\n message\n ]));\n };\n var pluginLoadError = function (editor, url) {\n displayError(editor, pluginUrlToMessage(editor, url));\n };\n var pluginInitError = function (editor, name, err) {\n var message = I18n.translate([\n 'Failed to initialize plugin: {0}',\n name\n ]);\n initError(message, err);\n displayError(editor, message);\n };\n var initError = function (message) {\n var x = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n x[_i - 1] = arguments[_i];\n }\n var console = domGlobals.window.console;\n if (console) {\n if (console.error) {\n console.error.apply(console, arguments);\n } else {\n console.log.apply(console, arguments);\n }\n }\n };\n var ErrorReporter = {\n pluginLoadError: pluginLoadError,\n pluginInitError: pluginInitError,\n uploadError: uploadError,\n displayError: displayError,\n initError: initError\n };\n\n var PluginManager$1 = AddOnManager.PluginManager;\n\n var ThemeManager = AddOnManager.ThemeManager;\n\n function XMLHttpRequest () {\n var f = Global$1.getOrDie('XMLHttpRequest');\n return new f();\n }\n\n function Uploader (uploadStatus, settings) {\n var pendingPromises = {};\n var pathJoin = function (path1, path2) {\n if (path1) {\n return path1.replace(/\\/$/, '') + '/' + path2.replace(/^\\//, '');\n }\n return path2;\n };\n var defaultHandler = function (blobInfo, success, failure, progress) {\n var xhr, formData;\n xhr = XMLHttpRequest();\n xhr.open('POST', settings.url);\n xhr.withCredentials = settings.credentials;\n xhr.upload.onprogress = function (e) {\n progress(e.loaded / e.total * 100);\n };\n xhr.onerror = function () {\n failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);\n };\n xhr.onload = function () {\n var json;\n if (xhr.status < 200 || xhr.status >= 300) {\n failure('HTTP Error: ' + xhr.status);\n return;\n }\n json = JSON.parse(xhr.responseText);\n if (!json || typeof json.location !== 'string') {\n failure('Invalid JSON: ' + xhr.responseText);\n return;\n }\n success(pathJoin(settings.basePath, json.location));\n };\n formData = new domGlobals.FormData();\n formData.append('file', blobInfo.blob(), blobInfo.filename());\n xhr.send(formData);\n };\n var noUpload = function () {\n return new promiseObj(function (resolve) {\n resolve([]);\n });\n };\n var handlerSuccess = function (blobInfo, url) {\n return {\n url: url,\n blobInfo: blobInfo,\n status: true\n };\n };\n var handlerFailure = function (blobInfo, error) {\n return {\n url: '',\n blobInfo: blobInfo,\n status: false,\n error: error\n };\n };\n var resolvePending = function (blobUri, result) {\n Tools.each(pendingPromises[blobUri], function (resolve) {\n resolve(result);\n });\n delete pendingPromises[blobUri];\n };\n var uploadBlobInfo = function (blobInfo, handler, openNotification) {\n uploadStatus.markPending(blobInfo.blobUri());\n return new promiseObj(function (resolve) {\n var notification, progress;\n var noop = function () {\n };\n try {\n var closeNotification_1 = function () {\n if (notification) {\n notification.close();\n progress = noop;\n }\n };\n var success = function (url) {\n closeNotification_1();\n uploadStatus.markUploaded(blobInfo.blobUri(), url);\n resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));\n resolve(handlerSuccess(blobInfo, url));\n };\n var failure = function (error) {\n closeNotification_1();\n uploadStatus.removeFailed(blobInfo.blobUri());\n resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error));\n resolve(handlerFailure(blobInfo, error));\n };\n progress = function (percent) {\n if (percent < 0 || percent > 100) {\n return;\n }\n if (!notification) {\n notification = openNotification();\n }\n notification.progressBar.value(percent);\n };\n handler(blobInfo, success, failure, progress);\n } catch (ex) {\n resolve(handlerFailure(blobInfo, ex.message));\n }\n });\n };\n var isDefaultHandler = function (handler) {\n return handler === defaultHandler;\n };\n var pendingUploadBlobInfo = function (blobInfo) {\n var blobUri = blobInfo.blobUri();\n return new promiseObj(function (resolve) {\n pendingPromises[blobUri] = pendingPromises[blobUri] || [];\n pendingPromises[blobUri].push(resolve);\n });\n };\n var uploadBlobs = function (blobInfos, openNotification) {\n blobInfos = Tools.grep(blobInfos, function (blobInfo) {\n return !uploadStatus.isUploaded(blobInfo.blobUri());\n });\n return promiseObj.all(Tools.map(blobInfos, function (blobInfo) {\n return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);\n }));\n };\n var upload = function (blobInfos, openNotification) {\n return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification);\n };\n if (isFunction(settings.handler) === false) {\n settings.handler = defaultHandler;\n }\n return { upload: upload };\n }\n\n function FileReader () {\n var f = Global$1.getOrDie('FileReader');\n return new f();\n }\n\n function Uint8Array (arr) {\n var f = Global$1.getOrDie('Uint8Array');\n return new f(arr);\n }\n\n var requestAnimationFrame$1 = function (callback) {\n var f = Global$1.getOrDie('requestAnimationFrame');\n f(callback);\n };\n var atob = function (base64) {\n var f = Global$1.getOrDie('atob');\n return f(base64);\n };\n var Window = {\n atob: atob,\n requestAnimationFrame: requestAnimationFrame$1\n };\n\n var blobUriToBlob = function (url) {\n return new promiseObj(function (resolve, reject) {\n var rejectWithError = function () {\n reject('Cannot convert ' + url + ' to Blob. Resource might not exist or is inaccessible.');\n };\n try {\n var xhr = XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'blob';\n xhr.onload = function () {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n rejectWithError();\n }\n };\n xhr.onerror = rejectWithError;\n xhr.send();\n } catch (ex) {\n rejectWithError();\n }\n });\n };\n var parseDataUri = function (uri) {\n var type, matches;\n var uriParts = decodeURIComponent(uri).split(',');\n matches = /data:([^;]+)/.exec(uriParts[0]);\n if (matches) {\n type = matches[1];\n }\n return {\n type: type,\n data: uriParts[1]\n };\n };\n var dataUriToBlob = function (uri) {\n return new promiseObj(function (resolve) {\n var str, arr, i;\n var uriParts = parseDataUri(uri);\n try {\n str = Window.atob(uriParts.data);\n } catch (e) {\n resolve(new domGlobals.Blob([]));\n return;\n }\n arr = Uint8Array(str.length);\n for (i = 0; i < arr.length; i++) {\n arr[i] = str.charCodeAt(i);\n }\n resolve(new domGlobals.Blob([arr], { type: uriParts.type }));\n });\n };\n var uriToBlob = function (url) {\n if (url.indexOf('blob:') === 0) {\n return blobUriToBlob(url);\n }\n if (url.indexOf('data:') === 0) {\n return dataUriToBlob(url);\n }\n return null;\n };\n var blobToDataUri = function (blob) {\n return new promiseObj(function (resolve) {\n var reader = FileReader();\n reader.onloadend = function () {\n resolve(reader.result);\n };\n reader.readAsDataURL(blob);\n });\n };\n var Conversions = {\n uriToBlob: uriToBlob,\n blobToDataUri: blobToDataUri,\n parseDataUri: parseDataUri\n };\n\n var count = 0;\n var uniqueId = function (prefix) {\n return (prefix || 'blobid') + count++;\n };\n var imageToBlobInfo = function (blobCache, img, resolve, reject) {\n var base64, blobInfo;\n if (img.src.indexOf('blob:') === 0) {\n blobInfo = blobCache.getByUri(img.src);\n if (blobInfo) {\n resolve({\n image: img,\n blobInfo: blobInfo\n });\n } else {\n Conversions.uriToBlob(img.src).then(function (blob) {\n Conversions.blobToDataUri(blob).then(function (dataUri) {\n base64 = Conversions.parseDataUri(dataUri).data;\n blobInfo = blobCache.create(uniqueId(), blob, base64);\n blobCache.add(blobInfo);\n resolve({\n image: img,\n blobInfo: blobInfo\n });\n });\n }, function (err) {\n reject(err);\n });\n }\n return;\n }\n base64 = Conversions.parseDataUri(img.src).data;\n blobInfo = blobCache.findFirst(function (cachedBlobInfo) {\n return cachedBlobInfo.base64() === base64;\n });\n if (blobInfo) {\n resolve({\n image: img,\n blobInfo: blobInfo\n });\n } else {\n Conversions.uriToBlob(img.src).then(function (blob) {\n blobInfo = blobCache.create(uniqueId(), blob, base64);\n blobCache.add(blobInfo);\n resolve({\n image: img,\n blobInfo: blobInfo\n });\n }, function (err) {\n reject(err);\n });\n }\n };\n var getAllImages = function (elm) {\n return elm ? from$1(elm.getElementsByTagName('img')) : [];\n };\n function ImageScanner (uploadStatus, blobCache) {\n var cachedPromises = {};\n var findAll = function (elm, predicate) {\n var images;\n if (!predicate) {\n predicate = constant(true);\n }\n images = filter(getAllImages(elm), function (img) {\n var src = img.src;\n if (!Env.fileApi) {\n return false;\n }\n if (img.hasAttribute('data-mce-bogus')) {\n return false;\n }\n if (img.hasAttribute('data-mce-placeholder')) {\n return false;\n }\n if (!src || src === Env.transparentSrc) {\n return false;\n }\n if (src.indexOf('blob:') === 0) {\n return !uploadStatus.isUploaded(src) && predicate(img);\n }\n if (src.indexOf('data:') === 0) {\n return predicate(img);\n }\n return false;\n });\n var promises = map(images, function (img) {\n if (cachedPromises[img.src]) {\n return new promiseObj(function (resolve) {\n cachedPromises[img.src].then(function (imageInfo) {\n if (typeof imageInfo === 'string') {\n return imageInfo;\n }\n resolve({\n image: img,\n blobInfo: imageInfo.blobInfo\n });\n });\n });\n }\n var newPromise = new promiseObj(function (resolve, reject) {\n imageToBlobInfo(blobCache, img, resolve, reject);\n }).then(function (result) {\n delete cachedPromises[result.image.src];\n return result;\n }).catch(function (error) {\n delete cachedPromises[img.src];\n return error;\n });\n cachedPromises[img.src] = newPromise;\n return newPromise;\n });\n return promiseObj.all(promises);\n };\n return { findAll: findAll };\n }\n\n var count$1 = 0;\n var seed = function () {\n var rnd = function () {\n return Math.round(Math.random() * 4294967295).toString(36);\n };\n var now = new Date().getTime();\n return 's' + now.toString(36) + rnd() + rnd() + rnd();\n };\n var uuid = function (prefix) {\n return prefix + count$1++ + seed();\n };\n var Uuid = { uuid: uuid };\n\n function BlobCache () {\n var cache = [];\n var mimeToExt = function (mime) {\n var mimes = {\n 'image/jpeg': 'jpg',\n 'image/jpg': 'jpg',\n 'image/gif': 'gif',\n 'image/png': 'png'\n };\n return mimes[mime.toLowerCase()] || 'dat';\n };\n var create = function (o, blob, base64, filename) {\n if (isString(o)) {\n var id = o;\n return toBlobInfo({\n id: id,\n name: filename,\n blob: blob,\n base64: base64\n });\n } else if (isObject(o)) {\n return toBlobInfo(o);\n } else {\n throw new Error('Unknown input type');\n }\n };\n var toBlobInfo = function (o) {\n var id, name;\n if (!o.blob || !o.base64) {\n throw new Error('blob and base64 representations of the image are required for BlobInfo to be created');\n }\n id = o.id || Uuid.uuid('blobid');\n name = o.name || id;\n return {\n id: constant(id),\n name: constant(name),\n filename: constant(name + '.' + mimeToExt(o.blob.type)),\n blob: constant(o.blob),\n base64: constant(o.base64),\n blobUri: constant(o.blobUri || URL.createObjectURL(o.blob)),\n uri: constant(o.uri)\n };\n };\n var add = function (blobInfo) {\n if (!get(blobInfo.id())) {\n cache.push(blobInfo);\n }\n };\n var get = function (id) {\n return findFirst(function (cachedBlobInfo) {\n return cachedBlobInfo.id() === id;\n });\n };\n var findFirst = function (predicate) {\n return filter(cache, predicate)[0];\n };\n var getByUri = function (blobUri) {\n return findFirst(function (blobInfo) {\n return blobInfo.blobUri() === blobUri;\n });\n };\n var removeByUri = function (blobUri) {\n cache = filter(cache, function (blobInfo) {\n if (blobInfo.blobUri() === blobUri) {\n URL.revokeObjectURL(blobInfo.blobUri());\n return false;\n }\n return true;\n });\n };\n var destroy = function () {\n each(cache, function (cachedBlobInfo) {\n URL.revokeObjectURL(cachedBlobInfo.blobUri());\n });\n cache = [];\n };\n return {\n create: create,\n add: add,\n get: get,\n getByUri: getByUri,\n findFirst: findFirst,\n removeByUri: removeByUri,\n destroy: destroy\n };\n }\n\n function UploadStatus () {\n var PENDING = 1, UPLOADED = 2;\n var blobUriStatuses = {};\n var createStatus = function (status, resultUri) {\n return {\n status: status,\n resultUri: resultUri\n };\n };\n var hasBlobUri = function (blobUri) {\n return blobUri in blobUriStatuses;\n };\n var getResultUri = function (blobUri) {\n var result = blobUriStatuses[blobUri];\n return result ? result.resultUri : null;\n };\n var isPending = function (blobUri) {\n return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === PENDING : false;\n };\n var isUploaded = function (blobUri) {\n return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === UPLOADED : false;\n };\n var markPending = function (blobUri) {\n blobUriStatuses[blobUri] = createStatus(PENDING, null);\n };\n var markUploaded = function (blobUri, resultUri) {\n blobUriStatuses[blobUri] = createStatus(UPLOADED, resultUri);\n };\n var removeFailed = function (blobUri) {\n delete blobUriStatuses[blobUri];\n };\n var destroy = function () {\n blobUriStatuses = {};\n };\n return {\n hasBlobUri: hasBlobUri,\n getResultUri: getResultUri,\n isPending: isPending,\n isUploaded: isUploaded,\n markPending: markPending,\n markUploaded: markUploaded,\n removeFailed: removeFailed,\n destroy: destroy\n };\n }\n\n function EditorUpload (editor) {\n var blobCache = BlobCache();\n var uploader, imageScanner;\n var uploadStatus = UploadStatus();\n var urlFilters = [];\n var aliveGuard = function (callback) {\n return function (result) {\n if (editor.selection) {\n return callback(result);\n }\n return [];\n };\n };\n var cacheInvalidator = function () {\n return '?' + new Date().getTime();\n };\n var replaceString = function (content, search, replace) {\n var index = 0;\n do {\n index = content.indexOf(search, index);\n if (index !== -1) {\n content = content.substring(0, index) + replace + content.substr(index + search.length);\n index += replace.length - search.length + 1;\n }\n } while (index !== -1);\n return content;\n };\n var replaceImageUrl = function (content, targetUrl, replacementUrl) {\n content = replaceString(content, 'src=\"' + targetUrl + '\"', 'src=\"' + replacementUrl + '\"');\n content = replaceString(content, 'data-mce-src=\"' + targetUrl + '\"', 'data-mce-src=\"' + replacementUrl + '\"');\n return content;\n };\n var replaceUrlInUndoStack = function (targetUrl, replacementUrl) {\n each(editor.undoManager.data, function (level) {\n if (level.type === 'fragmented') {\n level.fragments = map(level.fragments, function (fragment) {\n return replaceImageUrl(fragment, targetUrl, replacementUrl);\n });\n } else {\n level.content = replaceImageUrl(level.content, targetUrl, replacementUrl);\n }\n });\n };\n var openNotification = function () {\n return editor.notificationManager.open({\n text: editor.translate('Image uploading...'),\n type: 'info',\n timeout: -1,\n progressBar: true\n });\n };\n var replaceImageUri = function (image, resultUri) {\n blobCache.removeByUri(image.src);\n replaceUrlInUndoStack(image.src, resultUri);\n editor.$(image).attr({\n 'src': Settings.shouldReuseFileName(editor) ? resultUri + cacheInvalidator() : resultUri,\n 'data-mce-src': editor.convertURL(resultUri, 'src')\n });\n };\n var uploadImages = function (callback) {\n if (!uploader) {\n uploader = Uploader(uploadStatus, {\n url: Settings.getImageUploadUrl(editor),\n basePath: Settings.getImageUploadBasePath(editor),\n credentials: Settings.getImagesUploadCredentials(editor),\n handler: Settings.getImagesUploadHandler(editor)\n });\n }\n return scanForImages().then(aliveGuard(function (imageInfos) {\n var blobInfos;\n blobInfos = map(imageInfos, function (imageInfo) {\n return imageInfo.blobInfo;\n });\n return uploader.upload(blobInfos, openNotification).then(aliveGuard(function (result) {\n var filteredResult = map(result, function (uploadInfo, index) {\n var image = imageInfos[index].image;\n if (uploadInfo.status && Settings.shouldReplaceBlobUris(editor)) {\n replaceImageUri(image, uploadInfo.url);\n } else if (uploadInfo.error) {\n ErrorReporter.uploadError(editor, uploadInfo.error);\n }\n return {\n element: image,\n status: uploadInfo.status\n };\n });\n if (callback) {\n callback(filteredResult);\n }\n return filteredResult;\n }));\n }));\n };\n var uploadImagesAuto = function (callback) {\n if (Settings.isAutomaticUploadsEnabled(editor)) {\n return uploadImages(callback);\n }\n };\n var isValidDataUriImage = function (imgElm) {\n if (forall(urlFilters, function (filter) {\n return filter(imgElm);\n }) === false) {\n return false;\n }\n if (imgElm.getAttribute('src').indexOf('data:') === 0) {\n var dataImgFilter = Settings.getImagesDataImgFilter(editor);\n return dataImgFilter(imgElm);\n }\n return true;\n };\n var addFilter = function (filter) {\n urlFilters.push(filter);\n };\n var scanForImages = function () {\n if (!imageScanner) {\n imageScanner = ImageScanner(uploadStatus, blobCache);\n }\n return imageScanner.findAll(editor.getBody(), isValidDataUriImage).then(aliveGuard(function (result) {\n result = filter(result, function (resultItem) {\n if (typeof resultItem === 'string') {\n ErrorReporter.displayError(editor, resultItem);\n return false;\n }\n return true;\n });\n each(result, function (resultItem) {\n replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri());\n resultItem.image.src = resultItem.blobInfo.blobUri();\n resultItem.image.removeAttribute('data-mce-src');\n });\n return result;\n }));\n };\n var destroy = function () {\n blobCache.destroy();\n uploadStatus.destroy();\n imageScanner = uploader = null;\n };\n var replaceBlobUris = function (content) {\n return content.replace(/src=\"(blob:[^\"]+)\"/g, function (match, blobUri) {\n var resultUri = uploadStatus.getResultUri(blobUri);\n if (resultUri) {\n return 'src=\"' + resultUri + '\"';\n }\n var blobInfo = blobCache.getByUri(blobUri);\n if (!blobInfo) {\n blobInfo = foldl(editor.editorManager.get(), function (result, editor) {\n return result || editor.editorUpload && editor.editorUpload.blobCache.getByUri(blobUri);\n }, null);\n }\n if (blobInfo) {\n var blob = blobInfo.blob();\n return 'src=\"data:' + blob.type + ';base64,' + blobInfo.base64() + '\"';\n }\n return match;\n });\n };\n editor.on('setContent', function () {\n if (Settings.isAutomaticUploadsEnabled(editor)) {\n uploadImagesAuto();\n } else {\n scanForImages();\n }\n });\n editor.on('RawSaveContent', function (e) {\n e.content = replaceBlobUris(e.content);\n });\n editor.on('getContent', function (e) {\n if (e.source_view || e.format === 'raw') {\n return;\n }\n e.content = replaceBlobUris(e.content);\n });\n editor.on('PostRender', function () {\n editor.parser.addNodeFilter('img', function (images) {\n each(images, function (img) {\n var src = img.attr('src');\n if (blobCache.getByUri(src)) {\n return;\n }\n var resultUri = uploadStatus.getResultUri(src);\n if (resultUri) {\n img.attr('src', resultUri);\n }\n });\n });\n });\n return {\n blobCache: blobCache,\n addFilter: addFilter,\n uploadImages: uploadImages,\n uploadImagesAuto: uploadImagesAuto,\n scanForImages: scanForImages,\n destroy: destroy\n };\n }\n\n var isBlockElement = function (blockElements, node) {\n return blockElements.hasOwnProperty(node.nodeName);\n };\n var isValidTarget = function (blockElements, node) {\n if (NodeType.isText(node)) {\n return true;\n } else if (NodeType.isElement(node)) {\n return !isBlockElement(blockElements, node) && !Bookmarks.isBookmarkNode(node);\n } else {\n return false;\n }\n };\n var hasBlockParent = function (blockElements, root, node) {\n return exists(Parents.parents(Element.fromDom(node), Element.fromDom(root)), function (elm) {\n return isBlockElement(blockElements, elm.dom());\n });\n };\n var shouldRemoveTextNode = function (blockElements, node) {\n if (NodeType.isText(node)) {\n if (node.nodeValue.length === 0) {\n return true;\n } else if (/^\\s+$/.test(node.nodeValue) && (!node.nextSibling || isBlockElement(blockElements, node.nextSibling))) {\n return true;\n }\n }\n return false;\n };\n var addRootBlocks = function (editor) {\n var settings = editor.settings, dom = editor.dom, selection = editor.selection;\n var schema = editor.schema, blockElements = schema.getBlockElements();\n var node = selection.getStart();\n var rootNode = editor.getBody();\n var rng;\n var startContainer, startOffset, endContainer, endOffset, rootBlockNode;\n var tempNode, wrapped, restoreSelection;\n var rootNodeName, forcedRootBlock;\n forcedRootBlock = settings.forced_root_block;\n if (!node || !NodeType.isElement(node) || !forcedRootBlock) {\n return;\n }\n rootNodeName = rootNode.nodeName.toLowerCase();\n if (!schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, node)) {\n return;\n }\n rng = selection.getRng();\n startContainer = rng.startContainer;\n startOffset = rng.startOffset;\n endContainer = rng.endContainer;\n endOffset = rng.endOffset;\n restoreSelection = EditorFocus.hasFocus(editor);\n node = rootNode.firstChild;\n while (node) {\n if (isValidTarget(blockElements, node)) {\n if (shouldRemoveTextNode(blockElements, node)) {\n tempNode = node;\n node = node.nextSibling;\n dom.remove(tempNode);\n continue;\n }\n if (!rootBlockNode) {\n rootBlockNode = dom.create(forcedRootBlock, editor.settings.forced_root_block_attrs);\n node.parentNode.insertBefore(rootBlockNode, node);\n wrapped = true;\n }\n tempNode = node;\n node = node.nextSibling;\n rootBlockNode.appendChild(tempNode);\n } else {\n rootBlockNode = null;\n node = node.nextSibling;\n }\n }\n if (wrapped && restoreSelection) {\n rng.setStart(startContainer, startOffset);\n rng.setEnd(endContainer, endOffset);\n selection.setRng(rng);\n editor.nodeChanged();\n }\n };\n var setup$3 = function (editor) {\n if (editor.settings.forced_root_block) {\n editor.on('NodeChange', curry(addRootBlocks, editor));\n }\n };\n var ForceBlocks = { setup: setup$3 };\n\n var getStartNode = function (rng) {\n var sc = rng.startContainer, so = rng.startOffset;\n if (NodeType.isText(sc)) {\n return so === 0 ? Option.some(Element.fromDom(sc)) : Option.none();\n } else {\n return Option.from(sc.childNodes[so]).map(Element.fromDom);\n }\n };\n var getEndNode = function (rng) {\n var ec = rng.endContainer, eo = rng.endOffset;\n if (NodeType.isText(ec)) {\n return eo === ec.data.length ? Option.some(Element.fromDom(ec)) : Option.none();\n } else {\n return Option.from(ec.childNodes[eo - 1]).map(Element.fromDom);\n }\n };\n var getFirstChildren = function (node) {\n return firstChild(node).fold(constant([node]), function (child) {\n return [node].concat(getFirstChildren(child));\n });\n };\n var getLastChildren$1 = function (node) {\n return lastChild(node).fold(constant([node]), function (child) {\n if (name(child) === 'br') {\n return prevSibling(child).map(function (sibling) {\n return [node].concat(getLastChildren$1(sibling));\n }).getOr([]);\n } else {\n return [node].concat(getLastChildren$1(child));\n }\n });\n };\n var hasAllContentsSelected = function (elm, rng) {\n return lift2(getStartNode(rng), getEndNode(rng), function (startNode, endNode) {\n var start = find(getFirstChildren(elm), curry(eq, startNode));\n var end = find(getLastChildren$1(elm), curry(eq, endNode));\n return start.isSome() && end.isSome();\n }).getOr(false);\n };\n var moveEndPoint$1 = function (dom, rng, node, start) {\n var root = node, walker = new TreeWalker(node, root);\n var nonEmptyElementsMap = dom.schema.getNonEmptyElements();\n do {\n if (node.nodeType === 3 && Tools.trim(node.nodeValue).length !== 0) {\n if (start) {\n rng.setStart(node, 0);\n } else {\n rng.setEnd(node, node.nodeValue.length);\n }\n return;\n }\n if (nonEmptyElementsMap[node.nodeName] && !/^(TD|TH)$/.test(node.nodeName)) {\n if (start) {\n rng.setStartBefore(node);\n } else {\n if (node.nodeName === 'BR') {\n rng.setEndBefore(node);\n } else {\n rng.setEndAfter(node);\n }\n }\n return;\n }\n if (Env.ie && Env.ie < 11 && dom.isBlock(node) && dom.isEmpty(node)) {\n if (start) {\n rng.setStart(node, 0);\n } else {\n rng.setEnd(node, 0);\n }\n return;\n }\n } while (node = start ? walker.next() : walker.prev());\n if (root.nodeName === 'BODY') {\n if (start) {\n rng.setStart(root, 0);\n } else {\n rng.setEnd(root, root.childNodes.length);\n }\n }\n };\n var hasAnyRanges = function (editor) {\n var sel = editor.selection.getSel();\n return sel && sel.rangeCount > 0;\n };\n\n function NodeChange (editor) {\n var lastRng, lastPath = [];\n var isSameElementPath = function (startElm) {\n var i, currentPath;\n currentPath = editor.$(startElm).parentsUntil(editor.getBody()).add(startElm);\n if (currentPath.length === lastPath.length) {\n for (i = currentPath.length; i >= 0; i--) {\n if (currentPath[i] !== lastPath[i]) {\n break;\n }\n }\n if (i === -1) {\n lastPath = currentPath;\n return true;\n }\n }\n lastPath = currentPath;\n return false;\n };\n if (!('onselectionchange' in editor.getDoc())) {\n editor.on('NodeChange Click MouseUp KeyUp Focus', function (e) {\n var nativeRng, fakeRng;\n nativeRng = editor.selection.getRng();\n fakeRng = {\n startContainer: nativeRng.startContainer,\n startOffset: nativeRng.startOffset,\n endContainer: nativeRng.endContainer,\n endOffset: nativeRng.endOffset\n };\n if (e.type === 'nodechange' || !RangeCompare.isEq(fakeRng, lastRng)) {\n editor.fire('SelectionChange');\n }\n lastRng = fakeRng;\n });\n }\n editor.on('contextmenu', function () {\n editor.fire('SelectionChange');\n });\n editor.on('SelectionChange', function () {\n var startElm = editor.selection.getStart(true);\n if (!startElm || !Env.range && editor.selection.isCollapsed()) {\n return;\n }\n if (hasAnyRanges(editor) && !isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) {\n editor.nodeChanged({ selectionChange: true });\n }\n });\n editor.on('MouseUp', function (e) {\n if (!e.isDefaultPrevented() && hasAnyRanges(editor)) {\n if (editor.selection.getNode().nodeName === 'IMG') {\n Delay.setEditorTimeout(editor, function () {\n editor.nodeChanged();\n });\n } else {\n editor.nodeChanged();\n }\n }\n });\n this.nodeChanged = function (args) {\n var selection = editor.selection;\n var node, parents, root;\n if (editor.initialized && selection && !editor.settings.disable_nodechange && !editor.readonly) {\n root = editor.getBody();\n node = selection.getStart(true) || root;\n if (node.ownerDocument !== editor.getDoc() || !editor.dom.isChildOf(node, root)) {\n node = root;\n }\n parents = [];\n editor.dom.getParent(node, function (node) {\n if (node === root) {\n return true;\n }\n parents.push(node);\n });\n args = args || {};\n args.element = node;\n args.parents = parents;\n editor.fire('NodeChange', args);\n }\n };\n }\n\n var VK = {\n BACKSPACE: 8,\n DELETE: 46,\n DOWN: 40,\n ENTER: 13,\n LEFT: 37,\n RIGHT: 39,\n SPACEBAR: 32,\n TAB: 9,\n UP: 38,\n END: 35,\n HOME: 36,\n modifierPressed: function (e) {\n return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);\n },\n metaKeyPressed: function (e) {\n return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey;\n }\n };\n\n var getNodeClientRects = function (node) {\n var toArrayWithNode = function (clientRects) {\n return map(clientRects, function (clientRect) {\n clientRect = clone$1(clientRect);\n clientRect.node = node;\n return clientRect;\n });\n };\n if (NodeType.isElement(node)) {\n return toArrayWithNode(node.getClientRects());\n }\n if (NodeType.isText(node)) {\n var rng = node.ownerDocument.createRange();\n rng.setStart(node, 0);\n rng.setEnd(node, node.data.length);\n return toArrayWithNode(rng.getClientRects());\n }\n };\n var getClientRects = function (node) {\n return foldl(node, function (result, node) {\n return result.concat(getNodeClientRects(node));\n }, []);\n };\n\n var VDirection;\n (function (VDirection) {\n VDirection[VDirection['Up'] = -1] = 'Up';\n VDirection[VDirection['Down'] = 1] = 'Down';\n }(VDirection || (VDirection = {})));\n var findUntil = function (direction, root, predicateFn, node) {\n while (node = findNode(node, direction, isEditableCaretCandidate, root)) {\n if (predicateFn(node)) {\n return;\n }\n }\n };\n var walkUntil = function (direction, isAboveFn, isBeflowFn, root, predicateFn, caretPosition) {\n var line = 0, node;\n var result = [];\n var targetClientRect;\n var add = function (node) {\n var i, clientRect, clientRects;\n clientRects = getClientRects([node]);\n if (direction === -1) {\n clientRects = clientRects.reverse();\n }\n for (i = 0; i < clientRects.length; i++) {\n clientRect = clientRects[i];\n if (isBeflowFn(clientRect, targetClientRect)) {\n continue;\n }\n if (result.length > 0 && isAboveFn(clientRect, ArrUtils.last(result))) {\n line++;\n }\n clientRect.line = line;\n if (predicateFn(clientRect)) {\n return true;\n }\n result.push(clientRect);\n }\n };\n targetClientRect = ArrUtils.last(caretPosition.getClientRects());\n if (!targetClientRect) {\n return result;\n }\n node = caretPosition.getNode();\n add(node);\n findUntil(direction, root, add, node);\n return result;\n };\n var aboveLineNumber = function (lineNumber, clientRect) {\n return clientRect.line > lineNumber;\n };\n var isLineNumber = function (lineNumber, clientRect) {\n return clientRect.line === lineNumber;\n };\n var upUntil = curry(walkUntil, VDirection.Up, isAbove, isBelow);\n var downUntil = curry(walkUntil, VDirection.Down, isBelow, isAbove);\n var positionsUntil = function (direction, root, predicateFn, node) {\n var caretWalker = CaretWalker(root);\n var walkFn, isBelowFn, isAboveFn, caretPosition;\n var result = [];\n var line = 0, clientRect, targetClientRect;\n var getClientRect = function (caretPosition) {\n if (direction === 1) {\n return ArrUtils.last(caretPosition.getClientRects());\n }\n return ArrUtils.last(caretPosition.getClientRects());\n };\n if (direction === 1) {\n walkFn = caretWalker.next;\n isBelowFn = isBelow;\n isAboveFn = isAbove;\n caretPosition = CaretPosition$1.after(node);\n } else {\n walkFn = caretWalker.prev;\n isBelowFn = isAbove;\n isAboveFn = isBelow;\n caretPosition = CaretPosition$1.before(node);\n }\n targetClientRect = getClientRect(caretPosition);\n do {\n if (!caretPosition.isVisible()) {\n continue;\n }\n clientRect = getClientRect(caretPosition);\n if (isAboveFn(clientRect, targetClientRect)) {\n continue;\n }\n if (result.length > 0 && isBelowFn(clientRect, ArrUtils.last(result))) {\n line++;\n }\n clientRect = clone$1(clientRect);\n clientRect.position = caretPosition;\n clientRect.line = line;\n if (predicateFn(clientRect)) {\n return result;\n }\n result.push(clientRect);\n } while (caretPosition = walkFn(caretPosition));\n return result;\n };\n var isAboveLine = function (lineNumber) {\n return function (clientRect) {\n return aboveLineNumber(lineNumber, clientRect);\n };\n };\n var isLine = function (lineNumber) {\n return function (clientRect) {\n return isLineNumber(lineNumber, clientRect);\n };\n };\n\n var isContentEditableFalse$7 = NodeType.isContentEditableFalse;\n var findNode$1 = findNode;\n var distanceToRectLeft = function (clientRect, clientX) {\n return Math.abs(clientRect.left - clientX);\n };\n var distanceToRectRight = function (clientRect, clientX) {\n return Math.abs(clientRect.right - clientX);\n };\n var isInside = function (clientX, clientRect) {\n return clientX >= clientRect.left && clientX <= clientRect.right;\n };\n var findClosestClientRect = function (clientRects, clientX) {\n return ArrUtils.reduce(clientRects, function (oldClientRect, clientRect) {\n var oldDistance, newDistance;\n oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX));\n newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX));\n if (isInside(clientX, clientRect)) {\n return clientRect;\n }\n if (isInside(clientX, oldClientRect)) {\n return oldClientRect;\n }\n if (newDistance === oldDistance && isContentEditableFalse$7(clientRect.node)) {\n return clientRect;\n }\n if (newDistance < oldDistance) {\n return clientRect;\n }\n return oldClientRect;\n });\n };\n var walkUntil$1 = function (direction, root, predicateFn, node) {\n while (node = findNode$1(node, direction, isEditableCaretCandidate, root)) {\n if (predicateFn(node)) {\n return;\n }\n }\n };\n var findLineNodeRects = function (root, targetNodeRect) {\n var clientRects = [];\n var collect = function (checkPosFn, node) {\n var lineRects;\n lineRects = filter(getClientRects([node]), function (clientRect) {\n return !checkPosFn(clientRect, targetNodeRect);\n });\n clientRects = clientRects.concat(lineRects);\n return lineRects.length === 0;\n };\n clientRects.push(targetNodeRect);\n walkUntil$1(VDirection.Up, root, curry(collect, isAbove), targetNodeRect.node);\n walkUntil$1(VDirection.Down, root, curry(collect, isBelow), targetNodeRect.node);\n return clientRects;\n };\n var getFakeCaretTargets = function (root) {\n return filter(from$1(root.getElementsByTagName('*')), isFakeCaretTarget);\n };\n var caretInfo = function (clientRect, clientX) {\n return {\n node: clientRect.node,\n before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX)\n };\n };\n var closestCaret = function (root, clientX, clientY) {\n var closestNodeRect;\n var contentEditableFalseNodeRects = getClientRects(getFakeCaretTargets(root));\n var targetNodeRects = filter(contentEditableFalseNodeRects, function (rect) {\n return clientY >= rect.top && clientY <= rect.bottom;\n });\n closestNodeRect = findClosestClientRect(targetNodeRects, clientX);\n if (closestNodeRect) {\n closestNodeRect = findClosestClientRect(findLineNodeRects(root, closestNodeRect), clientX);\n if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) {\n return caretInfo(closestNodeRect, clientX);\n }\n }\n return null;\n };\n\n var isXYWithinRange = function (clientX, clientY, range) {\n if (range.collapsed) {\n return false;\n }\n if (Env.ie && Env.ie <= 11 && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) {\n var elm = range.startContainer.childNodes[range.startOffset];\n if (NodeType.isElement(elm)) {\n return exists(elm.getClientRects(), function (rect) {\n return containsXY(rect, clientX, clientY);\n });\n }\n }\n return exists(range.getClientRects(), function (rect) {\n return containsXY(rect, clientX, clientY);\n });\n };\n var RangePoint = { isXYWithinRange: isXYWithinRange };\n\n var getAbsolutePosition = function (elm) {\n var doc, docElem, win, clientRect;\n clientRect = elm.getBoundingClientRect();\n doc = elm.ownerDocument;\n docElem = doc.documentElement;\n win = doc.defaultView;\n return {\n top: clientRect.top + win.pageYOffset - docElem.clientTop,\n left: clientRect.left + win.pageXOffset - docElem.clientLeft\n };\n };\n var getBodyPosition = function (editor) {\n return editor.inline ? getAbsolutePosition(editor.getBody()) : {\n left: 0,\n top: 0\n };\n };\n var getScrollPosition = function (editor) {\n var body = editor.getBody();\n return editor.inline ? {\n left: body.scrollLeft,\n top: body.scrollTop\n } : {\n left: 0,\n top: 0\n };\n };\n var getBodyScroll = function (editor) {\n var body = editor.getBody(), docElm = editor.getDoc().documentElement;\n var inlineScroll = {\n left: body.scrollLeft,\n top: body.scrollTop\n };\n var iframeScroll = {\n left: body.scrollLeft || docElm.scrollLeft,\n top: body.scrollTop || docElm.scrollTop\n };\n return editor.inline ? inlineScroll : iframeScroll;\n };\n var getMousePosition = function (editor, event) {\n if (event.target.ownerDocument !== editor.getDoc()) {\n var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());\n var scrollPosition = getBodyScroll(editor);\n return {\n left: event.pageX - iframePosition.left + scrollPosition.left,\n top: event.pageY - iframePosition.top + scrollPosition.top\n };\n }\n return {\n left: event.pageX,\n top: event.pageY\n };\n };\n var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {\n return {\n pageX: mousePosition.left - bodyPosition.left + scrollPosition.left,\n pageY: mousePosition.top - bodyPosition.top + scrollPosition.top\n };\n };\n var calc = function (editor, event) {\n return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));\n };\n var MousePosition = { calc: calc };\n\n var isContentEditableFalse$8 = NodeType.isContentEditableFalse, isContentEditableTrue$3 = NodeType.isContentEditableTrue;\n var isDraggable = function (rootElm, elm) {\n return isContentEditableFalse$8(elm) && elm !== rootElm;\n };\n var isValidDropTarget = function (editor, targetElement, dragElement) {\n if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {\n return false;\n }\n if (isContentEditableFalse$8(targetElement)) {\n return false;\n }\n return true;\n };\n var cloneElement = function (elm) {\n var cloneElm = elm.cloneNode(true);\n cloneElm.removeAttribute('data-mce-selected');\n return cloneElm;\n };\n var createGhost = function (editor, elm, width, height) {\n var clonedElm = elm.cloneNode(true);\n editor.dom.setStyles(clonedElm, {\n width: width,\n height: height\n });\n editor.dom.setAttrib(clonedElm, 'data-mce-selected', null);\n var ghostElm = editor.dom.create('div', {\n 'class': 'mce-drag-container',\n 'data-mce-bogus': 'all',\n 'unselectable': 'on',\n 'contenteditable': 'false'\n });\n editor.dom.setStyles(ghostElm, {\n position: 'absolute',\n opacity: 0.5,\n overflow: 'hidden',\n border: 0,\n padding: 0,\n margin: 0,\n width: width,\n height: height\n });\n editor.dom.setStyles(clonedElm, {\n margin: 0,\n boxSizing: 'border-box'\n });\n ghostElm.appendChild(clonedElm);\n return ghostElm;\n };\n var appendGhostToBody = function (ghostElm, bodyElm) {\n if (ghostElm.parentNode !== bodyElm) {\n bodyElm.appendChild(ghostElm);\n }\n };\n var moveGhost = function (ghostElm, position, width, height, maxX, maxY) {\n var overflowX = 0, overflowY = 0;\n ghostElm.style.left = position.pageX + 'px';\n ghostElm.style.top = position.pageY + 'px';\n if (position.pageX + width > maxX) {\n overflowX = position.pageX + width - maxX;\n }\n if (position.pageY + height > maxY) {\n overflowY = position.pageY + height - maxY;\n }\n ghostElm.style.width = width - overflowX + 'px';\n ghostElm.style.height = height - overflowY + 'px';\n };\n var removeElement = function (elm) {\n if (elm && elm.parentNode) {\n elm.parentNode.removeChild(elm);\n }\n };\n var isLeftMouseButtonPressed = function (e) {\n return e.button === 0;\n };\n var hasDraggableElement = function (state) {\n return state.element;\n };\n var applyRelPos = function (state, position) {\n return {\n pageX: position.pageX - state.relX,\n pageY: position.pageY + 5\n };\n };\n var start$1 = function (state, editor) {\n return function (e) {\n if (isLeftMouseButtonPressed(e)) {\n var ceElm = find(editor.dom.getParents(e.target), Predicate.or(isContentEditableFalse$8, isContentEditableTrue$3)).getOr(null);\n if (isDraggable(editor.getBody(), ceElm)) {\n var elmPos = editor.dom.getPos(ceElm);\n var bodyElm = editor.getBody();\n var docElm = editor.getDoc().documentElement;\n state.element = ceElm;\n state.screenX = e.screenX;\n state.screenY = e.screenY;\n state.maxX = (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2;\n state.maxY = (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2;\n state.relX = e.pageX - elmPos.x;\n state.relY = e.pageY - elmPos.y;\n state.width = ceElm.offsetWidth;\n state.height = ceElm.offsetHeight;\n state.ghost = createGhost(editor, ceElm, state.width, state.height);\n }\n }\n };\n };\n var move$1 = function (state, editor) {\n var throttledPlaceCaretAt = Delay.throttle(function (clientX, clientY) {\n editor._selectionOverrides.hideFakeCaret();\n editor.selection.placeCaretAt(clientX, clientY);\n }, 0);\n return function (e) {\n var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY));\n if (hasDraggableElement(state) && !state.dragging && movement > 10) {\n var args = editor.fire('dragstart', { target: state.element });\n if (args.isDefaultPrevented()) {\n return;\n }\n state.dragging = true;\n editor.focus();\n }\n if (state.dragging) {\n var targetPos = applyRelPos(state, MousePosition.calc(editor, e));\n appendGhostToBody(state.ghost, editor.getBody());\n moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY);\n throttledPlaceCaretAt(e.clientX, e.clientY);\n }\n };\n };\n var getRawTarget = function (selection) {\n var rng = selection.getSel().getRangeAt(0);\n var startContainer = rng.startContainer;\n return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer;\n };\n var drop = function (state, editor) {\n return function (e) {\n if (state.dragging) {\n if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) {\n var targetClone_1 = cloneElement(state.element);\n var args = editor.fire('drop', {\n targetClone: targetClone_1,\n clientX: e.clientX,\n clientY: e.clientY\n });\n if (!args.isDefaultPrevented()) {\n targetClone_1 = args.targetClone;\n editor.undoManager.transact(function () {\n removeElement(state.element);\n editor.insertContent(editor.dom.getOuterHTML(targetClone_1));\n editor._selectionOverrides.hideFakeCaret();\n });\n }\n }\n }\n removeDragState(state);\n };\n };\n var stop = function (state, editor) {\n return function () {\n if (state.dragging) {\n editor.fire('dragend');\n }\n removeDragState(state);\n };\n };\n var removeDragState = function (state) {\n state.dragging = false;\n state.element = null;\n removeElement(state.ghost);\n };\n var bindFakeDragEvents = function (editor) {\n var state = {};\n var pageDom, dragStartHandler, dragHandler, dropHandler, dragEndHandler, rootDocument;\n pageDom = DOMUtils$1.DOM;\n rootDocument = domGlobals.document;\n dragStartHandler = start$1(state, editor);\n dragHandler = move$1(state, editor);\n dropHandler = drop(state, editor);\n dragEndHandler = stop(state, editor);\n editor.on('mousedown', dragStartHandler);\n editor.on('mousemove', dragHandler);\n editor.on('mouseup', dropHandler);\n pageDom.bind(rootDocument, 'mousemove', dragHandler);\n pageDom.bind(rootDocument, 'mouseup', dragEndHandler);\n editor.on('remove', function () {\n pageDom.unbind(rootDocument, 'mousemove', dragHandler);\n pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);\n });\n };\n var blockIeDrop = function (editor) {\n editor.on('drop', function (e) {\n var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;\n if (isContentEditableFalse$8(realTarget) || isContentEditableFalse$8(editor.dom.getContentEditableParent(realTarget))) {\n e.preventDefault();\n }\n });\n };\n var init = function (editor) {\n bindFakeDragEvents(editor);\n blockIeDrop(editor);\n };\n var DragDropOverrides = { init: init };\n\n var setup$4 = function (editor) {\n var renderFocusCaret = first(function () {\n if (!editor.removed) {\n var rng = editor.selection.getRng();\n if (rng.collapsed) {\n var caretRange = renderRangeCaret(editor, editor.selection.getRng(), false);\n editor.selection.setRng(caretRange);\n }\n }\n }, 0);\n editor.on('focus', function () {\n renderFocusCaret.throttle();\n });\n editor.on('blur', function () {\n renderFocusCaret.cancel();\n });\n };\n var CefFocus = { setup: setup$4 };\n\n var isContentEditableTrue$4 = NodeType.isContentEditableTrue;\n var isContentEditableFalse$9 = NodeType.isContentEditableFalse;\n var getContentEditableRoot$1 = function (editor, node) {\n var root = editor.getBody();\n while (node && node !== root) {\n if (isContentEditableTrue$4(node) || isContentEditableFalse$9(node)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n };\n var SelectionOverrides = function (editor) {\n var isBlock = function (node) {\n return editor.dom.isBlock(node);\n };\n var rootNode = editor.getBody();\n var fakeCaret = FakeCaret(editor.getBody(), isBlock, function () {\n return EditorFocus.hasFocus(editor);\n });\n var realSelectionId = 'sel-' + editor.dom.uniqueId();\n var selectedContentEditableNode;\n var isFakeSelectionElement = function (elm) {\n return editor.dom.hasClass(elm, 'mce-offscreen-selection');\n };\n var getRealSelectionElement = function () {\n var container = editor.dom.get(realSelectionId);\n return container ? container.getElementsByTagName('*')[0] : container;\n };\n var setRange = function (range) {\n if (range) {\n editor.selection.setRng(range);\n }\n };\n var getRange = function () {\n return editor.selection.getRng();\n };\n var showCaret = function (direction, node, before, scrollIntoView) {\n if (scrollIntoView === void 0) {\n scrollIntoView = true;\n }\n var e;\n e = editor.fire('ShowCaret', {\n target: node,\n direction: direction,\n before: before\n });\n if (e.isDefaultPrevented()) {\n return null;\n }\n if (scrollIntoView) {\n editor.selection.scrollIntoView(node, direction === -1);\n }\n return fakeCaret.show(before, node);\n };\n var getNormalizedRangeEndPoint = function (direction, range) {\n range = normalizeRange(direction, rootNode, range);\n if (direction === -1) {\n return CaretPosition$1.fromRangeStart(range);\n }\n return CaretPosition$1.fromRangeEnd(range);\n };\n var showBlockCaretContainer = function (blockCaretContainer) {\n if (blockCaretContainer.hasAttribute('data-mce-caret')) {\n showCaretContainerBlock(blockCaretContainer);\n setRange(getRange());\n editor.selection.scrollIntoView(blockCaretContainer[0]);\n }\n };\n var registerEvents = function () {\n editor.on('mouseup', function (e) {\n var range = getRange();\n if (range.collapsed && EditorView.isXYInContentArea(editor, e.clientX, e.clientY)) {\n setRange(renderCaretAtRange(editor, range, false));\n }\n });\n editor.on('click', function (e) {\n var contentEditableRoot;\n contentEditableRoot = getContentEditableRoot$1(editor, e.target);\n if (contentEditableRoot) {\n if (isContentEditableFalse$9(contentEditableRoot)) {\n e.preventDefault();\n editor.focus();\n }\n if (isContentEditableTrue$4(contentEditableRoot)) {\n if (editor.dom.isChildOf(contentEditableRoot, editor.selection.getNode())) {\n removeContentEditableSelection();\n }\n }\n }\n });\n editor.on('blur NewBlock', function () {\n removeContentEditableSelection();\n });\n editor.on('ResizeWindow FullscreenStateChanged', function () {\n return fakeCaret.reposition();\n });\n var handleTouchSelect = function (editor) {\n var moved = false;\n editor.on('touchstart', function () {\n moved = false;\n });\n editor.on('touchmove', function () {\n moved = true;\n });\n editor.on('touchend', function (e) {\n var contentEditableRoot = getContentEditableRoot$1(editor, e.target);\n if (isContentEditableFalse$9(contentEditableRoot)) {\n if (!moved) {\n e.preventDefault();\n setContentEditableSelection(selectNode(editor, contentEditableRoot));\n }\n }\n });\n };\n var hasNormalCaretPosition = function (elm) {\n var caretWalker = CaretWalker(elm);\n if (!elm.firstChild) {\n return false;\n }\n var startPos = CaretPosition$1.before(elm.firstChild);\n var newPos = caretWalker.next(startPos);\n return newPos && !isBeforeContentEditableFalse(newPos) && !isAfterContentEditableFalse(newPos);\n };\n var isInSameBlock = function (node1, node2) {\n var block1 = editor.dom.getParent(node1, editor.dom.isBlock);\n var block2 = editor.dom.getParent(node2, editor.dom.isBlock);\n return block1 === block2;\n };\n var hasBetterMouseTarget = function (targetNode, caretNode) {\n var targetBlock = editor.dom.getParent(targetNode, editor.dom.isBlock);\n var caretBlock = editor.dom.getParent(caretNode, editor.dom.isBlock);\n if (targetBlock && editor.dom.isChildOf(targetBlock, caretBlock) && isContentEditableFalse$9(getContentEditableRoot$1(editor, targetBlock)) === false) {\n return true;\n }\n return targetBlock && !isInSameBlock(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock);\n };\n handleTouchSelect(editor);\n editor.on('mousedown', function (e) {\n var contentEditableRoot;\n var targetElm = e.target;\n if (targetElm !== rootNode && targetElm.nodeName !== 'HTML' && !editor.dom.isChildOf(targetElm, rootNode)) {\n return;\n }\n if (EditorView.isXYInContentArea(editor, e.clientX, e.clientY) === false) {\n return;\n }\n contentEditableRoot = getContentEditableRoot$1(editor, targetElm);\n if (contentEditableRoot) {\n if (isContentEditableFalse$9(contentEditableRoot)) {\n e.preventDefault();\n setContentEditableSelection(selectNode(editor, contentEditableRoot));\n } else {\n removeContentEditableSelection();\n if (!(isContentEditableTrue$4(contentEditableRoot) && e.shiftKey) && !RangePoint.isXYWithinRange(e.clientX, e.clientY, editor.selection.getRng())) {\n hideFakeCaret();\n editor.selection.placeCaretAt(e.clientX, e.clientY);\n }\n }\n } else if (isFakeCaretTarget(targetElm) === false) {\n removeContentEditableSelection();\n hideFakeCaret();\n var caretInfo = closestCaret(rootNode, e.clientX, e.clientY);\n if (caretInfo) {\n if (!hasBetterMouseTarget(e.target, caretInfo.node)) {\n e.preventDefault();\n var range = showCaret(1, caretInfo.node, caretInfo.before, false);\n editor.getBody().focus();\n setRange(range);\n }\n }\n }\n });\n editor.on('keypress', function (e) {\n if (VK.modifierPressed(e)) {\n return;\n }\n switch (e.keyCode) {\n default:\n if (isContentEditableFalse$9(editor.selection.getNode())) {\n e.preventDefault();\n }\n break;\n }\n });\n editor.on('getSelectionRange', function (e) {\n var rng = e.range;\n if (selectedContentEditableNode) {\n if (!selectedContentEditableNode.parentNode) {\n selectedContentEditableNode = null;\n return;\n }\n rng = rng.cloneRange();\n rng.selectNode(selectedContentEditableNode);\n e.range = rng;\n }\n });\n editor.on('setSelectionRange', function (e) {\n e.range = normalizeShortEndedElementSelection(e.range);\n var rng = setContentEditableSelection(e.range, e.forward);\n if (rng) {\n e.range = rng;\n }\n });\n var isPasteBin = function (node) {\n return node.id === 'mcepastebin';\n };\n editor.on('AfterSetSelectionRange', function (e) {\n var rng = e.range;\n if (!isRangeInCaretContainer(rng) && !isPasteBin(rng.startContainer.parentNode)) {\n hideFakeCaret();\n }\n if (!isFakeSelectionElement(rng.startContainer.parentNode)) {\n removeContentEditableSelection();\n }\n });\n editor.on('copy', function (e) {\n var clipboardData = e.clipboardData;\n if (!e.isDefaultPrevented() && e.clipboardData && !Env.ie) {\n var realSelectionElement = getRealSelectionElement();\n if (realSelectionElement) {\n e.preventDefault();\n clipboardData.clearData();\n clipboardData.setData('text/html', realSelectionElement.outerHTML);\n clipboardData.setData('text/plain', realSelectionElement.outerText);\n }\n }\n });\n DragDropOverrides.init(editor);\n CefFocus.setup(editor);\n };\n var addCss = function () {\n var styles = editor.contentStyles, rootClass = '.mce-content-body';\n styles.push(fakeCaret.getCss());\n styles.push(rootClass + ' .mce-offscreen-selection {' + 'position: absolute;' + 'left: -9999999999px;' + 'max-width: 1000000px;' + '}' + rootClass + ' *[contentEditable=false] {' + 'cursor: default;' + '}' + rootClass + ' *[contentEditable=true] {' + 'cursor: text;' + '}');\n };\n var isWithinCaretContainer = function (node) {\n return isCaretContainer(node) || startsWithCaretContainer(node) || endsWithCaretContainer(node);\n };\n var isRangeInCaretContainer = function (rng) {\n return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer);\n };\n var normalizeShortEndedElementSelection = function (rng) {\n var shortEndedElements = editor.schema.getShortEndedElements();\n var newRng = editor.dom.createRng();\n var startContainer = rng.startContainer;\n var startOffset = rng.startOffset;\n var endContainer = rng.endContainer;\n var endOffset = rng.endOffset;\n if (has(shortEndedElements, startContainer.nodeName.toLowerCase())) {\n if (startOffset === 0) {\n newRng.setStartBefore(startContainer);\n } else {\n newRng.setStartAfter(startContainer);\n }\n } else {\n newRng.setStart(startContainer, startOffset);\n }\n if (has(shortEndedElements, endContainer.nodeName.toLowerCase())) {\n if (endOffset === 0) {\n newRng.setEndBefore(endContainer);\n } else {\n newRng.setEndAfter(endContainer);\n }\n } else {\n newRng.setEnd(endContainer, endOffset);\n }\n return newRng;\n };\n var setContentEditableSelection = function (range, forward) {\n var node;\n var $ = editor.$;\n var dom = editor.dom;\n var $realSelectionContainer, sel, startContainer, startOffset, endOffset, e, caretPosition, targetClone, origTargetClone;\n if (!range) {\n return null;\n }\n if (range.collapsed) {\n if (!isRangeInCaretContainer(range)) {\n if (forward === false) {\n caretPosition = getNormalizedRangeEndPoint(-1, range);\n if (isFakeCaretTarget(caretPosition.getNode(true))) {\n return showCaret(-1, caretPosition.getNode(true), false, false);\n }\n if (isFakeCaretTarget(caretPosition.getNode())) {\n return showCaret(-1, caretPosition.getNode(), !caretPosition.isAtEnd(), false);\n }\n } else {\n caretPosition = getNormalizedRangeEndPoint(1, range);\n if (isFakeCaretTarget(caretPosition.getNode())) {\n return showCaret(1, caretPosition.getNode(), !caretPosition.isAtEnd(), false);\n }\n if (isFakeCaretTarget(caretPosition.getNode(true))) {\n return showCaret(1, caretPosition.getNode(true), false, false);\n }\n }\n }\n return null;\n }\n startContainer = range.startContainer;\n startOffset = range.startOffset;\n endOffset = range.endOffset;\n if (startContainer.nodeType === 3 && startOffset === 0 && isContentEditableFalse$9(startContainer.parentNode)) {\n startContainer = startContainer.parentNode;\n startOffset = dom.nodeIndex(startContainer);\n startContainer = startContainer.parentNode;\n }\n if (startContainer.nodeType !== 1) {\n return null;\n }\n if (endOffset === startOffset + 1 && startContainer === range.endContainer) {\n node = startContainer.childNodes[startOffset];\n }\n if (!isContentEditableFalse$9(node)) {\n return null;\n }\n targetClone = origTargetClone = node.cloneNode(true);\n e = editor.fire('ObjectSelected', {\n target: node,\n targetClone: targetClone\n });\n if (e.isDefaultPrevented()) {\n return null;\n }\n $realSelectionContainer = descendant(Element.fromDom(editor.getBody()), '#' + realSelectionId).fold(function () {\n return $([]);\n }, function (elm) {\n return $([elm.dom()]);\n });\n targetClone = e.targetClone;\n if ($realSelectionContainer.length === 0) {\n $realSelectionContainer = $('
').attr('id', realSelectionId);\n $realSelectionContainer.appendTo(editor.getBody());\n }\n range = editor.dom.createRng();\n if (targetClone === origTargetClone && Env.ie) {\n $realSelectionContainer.empty().append('

\\xA0

').append(targetClone);\n range.setStartAfter($realSelectionContainer[0].firstChild.firstChild);\n range.setEndAfter(targetClone);\n } else {\n $realSelectionContainer.empty().append('\\xA0').append(targetClone).append('\\xA0');\n range.setStart($realSelectionContainer[0].firstChild, 1);\n range.setEnd($realSelectionContainer[0].lastChild, 0);\n }\n $realSelectionContainer.css({ top: dom.getPos(node, editor.getBody()).y });\n $realSelectionContainer[0].focus();\n sel = editor.selection.getSel();\n sel.removeAllRanges();\n sel.addRange(range);\n each(descendants$1(Element.fromDom(editor.getBody()), '*[data-mce-selected]'), function (elm) {\n remove(elm, 'data-mce-selected');\n });\n node.setAttribute('data-mce-selected', '1');\n selectedContentEditableNode = node;\n hideFakeCaret();\n return range;\n };\n var removeContentEditableSelection = function () {\n if (selectedContentEditableNode) {\n selectedContentEditableNode.removeAttribute('data-mce-selected');\n descendant(Element.fromDom(editor.getBody()), '#' + realSelectionId).each(remove$1);\n selectedContentEditableNode = null;\n }\n descendant(Element.fromDom(editor.getBody()), '#' + realSelectionId).each(remove$1);\n selectedContentEditableNode = null;\n };\n var destroy = function () {\n fakeCaret.destroy();\n selectedContentEditableNode = null;\n };\n var hideFakeCaret = function () {\n fakeCaret.hide();\n };\n if (Env.ceFalse) {\n registerEvents();\n addCss();\n }\n return {\n showCaret: showCaret,\n showBlockCaretContainer: showBlockCaretContainer,\n hideFakeCaret: hideFakeCaret,\n destroy: destroy\n };\n };\n\n var isValidPrefixAttrName = function (name) {\n return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0;\n };\n var trimComments = function (text) {\n var sanitizedText = text;\n while (/';\n }\n return '';\n };\n var createFragment$1 = function (html) {\n var frag, node, container;\n container = domGlobals.document.createElement('div');\n frag = domGlobals.document.createDocumentFragment();\n if (html) {\n container.innerHTML = html;\n }\n while (node = container.firstChild) {\n frag.appendChild(node);\n }\n return frag;\n };\n var insertAt = function (elm, html, index) {\n var fragment = createFragment$1(html);\n if (elm.hasChildNodes() && index < elm.childNodes.length) {\n var target = elm.childNodes[index];\n target.parentNode.insertBefore(fragment, target);\n } else {\n elm.appendChild(fragment);\n }\n };\n var removeAt = function (elm, index) {\n if (elm.hasChildNodes() && index < elm.childNodes.length) {\n var target = elm.childNodes[index];\n target.parentNode.removeChild(target);\n }\n };\n var applyDiff = function (diff, elm) {\n var index = 0;\n each(diff, function (action) {\n if (action[0] === Diff.KEEP) {\n index++;\n } else if (action[0] === Diff.INSERT) {\n insertAt(elm, action[1], index);\n index++;\n } else if (action[0] === Diff.DELETE) {\n removeAt(elm, index);\n }\n });\n };\n var read$3 = function (elm) {\n return filter(map(from$1(elm.childNodes), getOuterHtml), function (item) {\n return item.length > 0;\n });\n };\n var write = function (fragments, elm) {\n var currentFragments = map(from$1(elm.childNodes), getOuterHtml);\n applyDiff(Diff.diff(currentFragments, fragments), elm);\n return elm;\n };\n var Fragments = {\n read: read$3,\n write: write\n };\n\n var undoLevelDocument = Cell(Option.none());\n var lazyTempDocument = function () {\n return undoLevelDocument.get().getOrThunk(function () {\n var doc = domGlobals.document.implementation.createHTMLDocument('undo');\n undoLevelDocument.set(Option.some(doc));\n return doc;\n });\n };\n var hasIframes = function (html) {\n return html.indexOf('') !== -1;\n };\n var createFragmentedLevel = function (fragments) {\n return {\n type: 'fragmented',\n fragments: fragments,\n content: '',\n bookmark: null,\n beforeBookmark: null\n };\n };\n var createCompleteLevel = function (content) {\n return {\n type: 'complete',\n fragments: null,\n content: content,\n bookmark: null,\n beforeBookmark: null\n };\n };\n var createFromEditor = function (editor) {\n var fragments, content, trimmedFragments;\n fragments = Fragments.read(editor.getBody());\n trimmedFragments = bind(fragments, function (html) {\n var trimmed = TrimHtml.trimInternal(editor.serializer, html);\n return trimmed.length > 0 ? [trimmed] : [];\n });\n content = trimmedFragments.join('');\n return hasIframes(content) ? createFragmentedLevel(trimmedFragments) : createCompleteLevel(content);\n };\n var applyToEditor = function (editor, level, before) {\n if (level.type === 'fragmented') {\n Fragments.write(level.fragments, editor.getBody());\n } else {\n editor.setContent(level.content, { format: 'raw' });\n }\n editor.selection.moveToBookmark(before ? level.beforeBookmark : level.bookmark);\n };\n var getLevelContent = function (level) {\n return level.type === 'fragmented' ? level.fragments.join('') : level.content;\n };\n var getCleanLevelContent = function (level) {\n var elm = Element.fromTag('body', lazyTempDocument());\n set$1(elm, getLevelContent(level));\n each(descendants$1(elm, '*[data-mce-bogus]'), unwrap);\n return get$3(elm);\n };\n var hasEqualContent = function (level1, level2) {\n return getLevelContent(level1) === getLevelContent(level2);\n };\n var hasEqualCleanedContent = function (level1, level2) {\n return getCleanLevelContent(level1) === getCleanLevelContent(level2);\n };\n var isEq$4 = function (level1, level2) {\n if (!level1 || !level2) {\n return false;\n } else if (hasEqualContent(level1, level2)) {\n return true;\n } else {\n return hasEqualCleanedContent(level1, level2);\n }\n };\n var Levels = {\n createFragmentedLevel: createFragmentedLevel,\n createCompleteLevel: createCompleteLevel,\n createFromEditor: createFromEditor,\n applyToEditor: applyToEditor,\n isEq: isEq$4\n };\n\n function UndoManager (editor) {\n var self = this, index = 0, data = [], beforeBookmark, isFirstTypedCharacter, locks = 0;\n var isUnlocked = function () {\n return locks === 0;\n };\n var setTyping = function (typing) {\n if (isUnlocked()) {\n self.typing = typing;\n }\n };\n var setDirty = function (state) {\n editor.setDirty(state);\n };\n var addNonTypingUndoLevel = function (e) {\n setTyping(false);\n self.add({}, e);\n };\n var endTyping = function () {\n if (self.typing) {\n setTyping(false);\n self.add();\n }\n };\n editor.on('init', function () {\n self.add();\n });\n editor.on('BeforeExecCommand', function (e) {\n var cmd = e.command;\n if (cmd !== 'Undo' && cmd !== 'Redo' && cmd !== 'mceRepaint') {\n endTyping();\n self.beforeChange();\n }\n });\n editor.on('ExecCommand', function (e) {\n var cmd = e.command;\n if (cmd !== 'Undo' && cmd !== 'Redo' && cmd !== 'mceRepaint') {\n addNonTypingUndoLevel(e);\n }\n });\n editor.on('ObjectResizeStart Cut', function () {\n self.beforeChange();\n });\n editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel);\n editor.on('DragEnd', addNonTypingUndoLevel);\n editor.on('KeyUp', function (e) {\n var keyCode = e.keyCode;\n if (e.isDefaultPrevented()) {\n return;\n }\n if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45 || e.ctrlKey) {\n addNonTypingUndoLevel();\n editor.nodeChanged();\n }\n if (keyCode === 46 || keyCode === 8) {\n editor.nodeChanged();\n }\n if (isFirstTypedCharacter && self.typing && Levels.isEq(Levels.createFromEditor(editor), data[0]) === false) {\n if (editor.isDirty() === false) {\n setDirty(true);\n editor.fire('change', {\n level: data[0],\n lastLevel: null\n });\n }\n editor.fire('TypingUndo');\n isFirstTypedCharacter = false;\n editor.nodeChanged();\n }\n });\n editor.on('KeyDown', function (e) {\n var keyCode = e.keyCode;\n if (e.isDefaultPrevented()) {\n return;\n }\n if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45) {\n if (self.typing) {\n addNonTypingUndoLevel(e);\n }\n return;\n }\n var modKey = e.ctrlKey && !e.altKey || e.metaKey;\n if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !self.typing && !modKey) {\n self.beforeChange();\n setTyping(true);\n self.add({}, e);\n isFirstTypedCharacter = true;\n }\n });\n editor.on('MouseDown', function (e) {\n if (self.typing) {\n addNonTypingUndoLevel(e);\n }\n });\n var isInsertReplacementText = function (event) {\n return event.inputType === 'insertReplacementText';\n };\n var isInsertTextDataNull = function (event) {\n return event.inputType === 'insertText' && event.data === null;\n };\n editor.on('input', function (e) {\n if (e.inputType && (isInsertReplacementText(e) || isInsertTextDataNull(e))) {\n addNonTypingUndoLevel(e);\n }\n });\n editor.addShortcut('meta+z', '', 'Undo');\n editor.addShortcut('meta+y,meta+shift+z', '', 'Redo');\n editor.on('AddUndo Undo Redo ClearUndos', function (e) {\n if (!e.isDefaultPrevented()) {\n editor.nodeChanged();\n }\n });\n self = {\n data: data,\n typing: false,\n beforeChange: function () {\n if (isUnlocked()) {\n beforeBookmark = GetBookmark.getUndoBookmark(editor.selection);\n }\n },\n add: function (level, event) {\n var i;\n var settings = editor.settings;\n var lastLevel, currentLevel;\n currentLevel = Levels.createFromEditor(editor);\n level = level || {};\n level = Tools.extend(level, currentLevel);\n if (isUnlocked() === false || editor.removed) {\n return null;\n }\n lastLevel = data[index];\n if (editor.fire('BeforeAddUndo', {\n level: level,\n lastLevel: lastLevel,\n originalEvent: event\n }).isDefaultPrevented()) {\n return null;\n }\n if (lastLevel && Levels.isEq(lastLevel, level)) {\n return null;\n }\n if (data[index]) {\n data[index].beforeBookmark = beforeBookmark;\n }\n if (settings.custom_undo_redo_levels) {\n if (data.length > settings.custom_undo_redo_levels) {\n for (i = 0; i < data.length - 1; i++) {\n data[i] = data[i + 1];\n }\n data.length--;\n index = data.length;\n }\n }\n level.bookmark = GetBookmark.getUndoBookmark(editor.selection);\n if (index < data.length - 1) {\n data.length = index + 1;\n }\n data.push(level);\n index = data.length - 1;\n var args = {\n level: level,\n lastLevel: lastLevel,\n originalEvent: event\n };\n editor.fire('AddUndo', args);\n if (index > 0) {\n setDirty(true);\n editor.fire('change', args);\n }\n return level;\n },\n undo: function () {\n var level;\n if (self.typing) {\n self.add();\n self.typing = false;\n setTyping(false);\n }\n if (index > 0) {\n level = data[--index];\n Levels.applyToEditor(editor, level, true);\n setDirty(true);\n editor.fire('undo', { level: level });\n }\n return level;\n },\n redo: function () {\n var level;\n if (index < data.length - 1) {\n level = data[++index];\n Levels.applyToEditor(editor, level, false);\n setDirty(true);\n editor.fire('redo', { level: level });\n }\n return level;\n },\n clear: function () {\n data = [];\n index = 0;\n self.typing = false;\n self.data = data;\n editor.fire('ClearUndos');\n },\n hasUndo: function () {\n return index > 0 || self.typing && data[0] && !Levels.isEq(Levels.createFromEditor(editor), data[0]);\n },\n hasRedo: function () {\n return index < data.length - 1 && !self.typing;\n },\n transact: function (callback) {\n endTyping();\n self.beforeChange();\n self.ignore(callback);\n return self.add();\n },\n ignore: function (callback) {\n try {\n locks++;\n callback();\n } finally {\n locks--;\n }\n },\n extra: function (callback1, callback2) {\n var lastLevel, bookmark;\n if (self.transact(callback1)) {\n bookmark = data[index].bookmark;\n lastLevel = data[index - 1];\n Levels.applyToEditor(editor, lastLevel, true);\n if (self.transact(callback2)) {\n data[index - 1].beforeBookmark = bookmark;\n }\n }\n }\n };\n return self;\n }\n\n var postProcessHooks = {}, filter$2 = ArrUtils.filter, each$c = ArrUtils.each;\n var addPostProcessHook = function (name, hook) {\n var hooks = postProcessHooks[name];\n if (!hooks) {\n postProcessHooks[name] = hooks = [];\n }\n postProcessHooks[name].push(hook);\n };\n var postProcess = function (name, editor) {\n each$c(postProcessHooks[name], function (hook) {\n hook(editor);\n });\n };\n addPostProcessHook('pre', function (editor) {\n var rng = editor.selection.getRng();\n var isPre, blocks;\n var hasPreSibling = function (pre) {\n return isPre(pre.previousSibling) && ArrUtils.indexOf(blocks, pre.previousSibling) !== -1;\n };\n var joinPre = function (pre1, pre2) {\n DomQuery(pre2).remove();\n DomQuery(pre1).append('

').append(pre2.childNodes);\n };\n isPre = NodeType.matchNodeNames('pre');\n if (!rng.collapsed) {\n blocks = editor.selection.getSelectedBlocks();\n each$c(filter$2(filter$2(blocks, isPre), hasPreSibling), function (pre) {\n joinPre(pre.previousSibling, pre);\n });\n }\n });\n var Hooks = { postProcess: postProcess };\n\n var MCE_ATTR_RE = /^(src|href|style)$/;\n var each$d = Tools.each;\n var isEq$5 = FormatUtils.isEq;\n var isTableCell$4 = function (node) {\n return /^(TH|TD)$/.test(node.nodeName);\n };\n var isChildOfInlineParent = function (dom, node, parent) {\n return dom.isChildOf(node, parent) && node !== parent && !dom.isBlock(parent);\n };\n var getContainer = function (ed, rng, start) {\n var container, offset, lastIdx;\n container = rng[start ? 'startContainer' : 'endContainer'];\n offset = rng[start ? 'startOffset' : 'endOffset'];\n if (NodeType.isElement(container)) {\n lastIdx = container.childNodes.length - 1;\n if (!start && offset) {\n offset--;\n }\n container = container.childNodes[offset > lastIdx ? lastIdx : offset];\n }\n if (NodeType.isText(container) && start && offset >= container.nodeValue.length) {\n container = new TreeWalker(container, ed.getBody()).next() || container;\n }\n if (NodeType.isText(container) && !start && offset === 0) {\n container = new TreeWalker(container, ed.getBody()).prev() || container;\n }\n return container;\n };\n var wrap$2 = function (dom, node, name, attrs) {\n var wrapper = dom.create(name, attrs);\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n };\n var wrapWithSiblings = function (dom, node, next, name, attrs) {\n var start = Element.fromDom(node);\n var wrapper = Element.fromDom(dom.create(name, attrs));\n var siblings = next ? nextSiblings(start) : prevSiblings(start);\n append$1(wrapper, siblings);\n if (next) {\n before(start, wrapper);\n prepend(wrapper, start);\n } else {\n after(start, wrapper);\n append(wrapper, start);\n }\n return wrapper.dom();\n };\n var matchName$1 = function (dom, node, format) {\n if (isEq$5(node, format.inline)) {\n return true;\n }\n if (isEq$5(node, format.block)) {\n return true;\n }\n if (format.selector) {\n return NodeType.isElement(node) && dom.is(node, format.selector);\n }\n };\n var isColorFormatAndAnchor = function (node, format) {\n return format.links && node.tagName === 'A';\n };\n var find$3 = function (dom, node, next, inc) {\n node = FormatUtils.getNonWhiteSpaceSibling(node, next, inc);\n return !node || (node.nodeName === 'BR' || dom.isBlock(node));\n };\n var removeNode$1 = function (ed, node, format) {\n var parentNode = node.parentNode;\n var rootBlockElm;\n var dom = ed.dom, forcedRootBlock = ed.settings.forced_root_block;\n if (format.block) {\n if (!forcedRootBlock) {\n if (dom.isBlock(node) && !dom.isBlock(parentNode)) {\n if (!find$3(dom, node, false) && !find$3(dom, node.firstChild, true, 1)) {\n node.insertBefore(dom.create('br'), node.firstChild);\n }\n if (!find$3(dom, node, true) && !find$3(dom, node.lastChild, false, 1)) {\n node.appendChild(dom.create('br'));\n }\n }\n } else {\n if (parentNode === dom.getRoot()) {\n if (!format.list_block || !isEq$5(node, format.list_block)) {\n each$d(Tools.grep(node.childNodes), function (node) {\n if (FormatUtils.isValid(ed, forcedRootBlock, node.nodeName.toLowerCase())) {\n if (!rootBlockElm) {\n rootBlockElm = wrap$2(dom, node, forcedRootBlock);\n dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs);\n } else {\n rootBlockElm.appendChild(node);\n }\n } else {\n rootBlockElm = 0;\n }\n });\n }\n }\n }\n }\n if (format.selector && format.inline && !isEq$5(format.inline, node)) {\n return;\n }\n dom.remove(node, 1);\n };\n var removeFormat = function (ed, format, vars, node, compareNode) {\n var i, attrs, stylesModified;\n var dom = ed.dom;\n if (!matchName$1(dom, node, format) && !isColorFormatAndAnchor(node, format)) {\n return false;\n }\n if (format.remove !== 'all') {\n each$d(format.styles, function (value, name) {\n value = FormatUtils.normalizeStyleValue(dom, FormatUtils.replaceVars(value, vars), name);\n if (typeof name === 'number') {\n name = value;\n compareNode = 0;\n }\n if (format.remove_similar || (!compareNode || isEq$5(FormatUtils.getStyle(dom, compareNode, name), value))) {\n dom.setStyle(node, name, '');\n }\n stylesModified = 1;\n });\n if (stylesModified && dom.getAttrib(node, 'style') === '') {\n node.removeAttribute('style');\n node.removeAttribute('data-mce-style');\n }\n each$d(format.attributes, function (value, name) {\n var valueOut;\n value = FormatUtils.replaceVars(value, vars);\n if (typeof name === 'number') {\n name = value;\n compareNode = 0;\n }\n if (!compareNode || isEq$5(dom.getAttrib(compareNode, name), value)) {\n if (name === 'class') {\n value = dom.getAttrib(node, name);\n if (value) {\n valueOut = '';\n each$d(value.split(/\\s+/), function (cls) {\n if (/mce\\-\\w+/.test(cls)) {\n valueOut += (valueOut ? ' ' : '') + cls;\n }\n });\n if (valueOut) {\n dom.setAttrib(node, name, valueOut);\n return;\n }\n }\n }\n if (name === 'class') {\n node.removeAttribute('className');\n }\n if (MCE_ATTR_RE.test(name)) {\n node.removeAttribute('data-mce-' + name);\n }\n node.removeAttribute(name);\n }\n });\n each$d(format.classes, function (value) {\n value = FormatUtils.replaceVars(value, vars);\n if (!compareNode || dom.hasClass(compareNode, value)) {\n dom.removeClass(node, value);\n }\n });\n attrs = dom.getAttribs(node);\n for (i = 0; i < attrs.length; i++) {\n var attrName = attrs[i].nodeName;\n if (attrName.indexOf('_') !== 0 && attrName.indexOf('data-') !== 0) {\n return false;\n }\n }\n }\n if (format.remove !== 'none') {\n removeNode$1(ed, node, format);\n return true;\n }\n };\n var findFormatRoot = function (editor, container, name, vars, similar) {\n var formatRoot;\n each$d(FormatUtils.getParents(editor.dom, container.parentNode).reverse(), function (parent) {\n var format;\n if (!formatRoot && parent.id !== '_start' && parent.id !== '_end') {\n format = MatchFormat.matchNode(editor, parent, name, vars, similar);\n if (format && format.split !== false) {\n formatRoot = parent;\n }\n }\n });\n return formatRoot;\n };\n var wrapAndSplit = function (editor, formatList, formatRoot, container, target, split, format, vars) {\n var parent, clone, lastClone, firstClone, i, formatRootParent;\n var dom = editor.dom;\n if (formatRoot) {\n formatRootParent = formatRoot.parentNode;\n for (parent = container.parentNode; parent && parent !== formatRootParent; parent = parent.parentNode) {\n clone = dom.clone(parent, false);\n for (i = 0; i < formatList.length; i++) {\n if (removeFormat(editor, formatList[i], vars, clone, clone)) {\n clone = 0;\n break;\n }\n }\n if (clone) {\n if (lastClone) {\n clone.appendChild(lastClone);\n }\n if (!firstClone) {\n firstClone = clone;\n }\n lastClone = clone;\n }\n }\n if (split && (!format.mixed || !dom.isBlock(formatRoot))) {\n container = dom.split(formatRoot, container);\n }\n if (lastClone) {\n target.parentNode.insertBefore(lastClone, target);\n firstClone.appendChild(target);\n }\n }\n return container;\n };\n var remove$6 = function (ed, name, vars, node, similar) {\n var formatList = ed.formatter.get(name), format = formatList[0];\n var bookmark, rng, contentEditable = true;\n var dom = ed.dom;\n var selection = ed.selection;\n var splitToFormatRoot = function (container) {\n var formatRoot = findFormatRoot(ed, container, name, vars, similar);\n return wrapAndSplit(ed, formatList, formatRoot, container, container, true, format, vars);\n };\n var isRemoveBookmarkNode = function (node) {\n return Bookmarks.isBookmarkNode(node) && NodeType.isElement(node) && (node.id === '_start' || node.id === '_end');\n };\n var process = function (node) {\n var children, i, l, lastContentEditable, hasContentEditableState;\n if (NodeType.isElement(node) && dom.getContentEditable(node)) {\n lastContentEditable = contentEditable;\n contentEditable = dom.getContentEditable(node) === 'true';\n hasContentEditableState = true;\n }\n children = Tools.grep(node.childNodes);\n if (contentEditable && !hasContentEditableState) {\n for (i = 0, l = formatList.length; i < l; i++) {\n if (removeFormat(ed, formatList[i], vars, node, node)) {\n break;\n }\n }\n }\n if (format.deep) {\n if (children.length) {\n for (i = 0, l = children.length; i < l; i++) {\n process(children[i]);\n }\n if (hasContentEditableState) {\n contentEditable = lastContentEditable;\n }\n }\n }\n };\n var unwrap = function (start) {\n var node = dom.get(start ? '_start' : '_end');\n var out = node[start ? 'firstChild' : 'lastChild'];\n if (isRemoveBookmarkNode(out)) {\n out = out[start ? 'firstChild' : 'lastChild'];\n }\n if (NodeType.isText(out) && out.data.length === 0) {\n out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling;\n }\n dom.remove(node, true);\n return out;\n };\n var removeRngStyle = function (rng) {\n var startContainer, endContainer;\n var commonAncestorContainer = rng.commonAncestorContainer;\n rng = ExpandRange.expandRng(ed, rng, formatList, true);\n if (format.split) {\n rng = SplitRange.split(rng);\n startContainer = getContainer(ed, rng, true);\n endContainer = getContainer(ed, rng);\n if (startContainer !== endContainer) {\n if (/^(TR|TH|TD)$/.test(startContainer.nodeName) && startContainer.firstChild) {\n if (startContainer.nodeName === 'TR') {\n startContainer = startContainer.firstChild.firstChild || startContainer;\n } else {\n startContainer = startContainer.firstChild || startContainer;\n }\n }\n if (commonAncestorContainer && /^T(HEAD|BODY|FOOT|R)$/.test(commonAncestorContainer.nodeName) && isTableCell$4(endContainer) && endContainer.firstChild) {\n endContainer = endContainer.firstChild || endContainer;\n }\n if (isChildOfInlineParent(dom, startContainer, endContainer)) {\n var marker = Option.from(startContainer.firstChild).getOr(startContainer);\n splitToFormatRoot(wrapWithSiblings(dom, marker, true, 'span', {\n 'id': '_start',\n 'data-mce-type': 'bookmark'\n }));\n unwrap(true);\n return;\n }\n if (isChildOfInlineParent(dom, endContainer, startContainer)) {\n var marker = Option.from(endContainer.lastChild).getOr(endContainer);\n splitToFormatRoot(wrapWithSiblings(dom, marker, false, 'span', {\n 'id': '_end',\n 'data-mce-type': 'bookmark'\n }));\n unwrap(false);\n return;\n }\n startContainer = wrap$2(dom, startContainer, 'span', {\n 'id': '_start',\n 'data-mce-type': 'bookmark'\n });\n endContainer = wrap$2(dom, endContainer, 'span', {\n 'id': '_end',\n 'data-mce-type': 'bookmark'\n });\n splitToFormatRoot(startContainer);\n splitToFormatRoot(endContainer);\n startContainer = unwrap(true);\n endContainer = unwrap();\n } else {\n startContainer = endContainer = splitToFormatRoot(startContainer);\n }\n rng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer;\n rng.startOffset = dom.nodeIndex(startContainer);\n rng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer;\n rng.endOffset = dom.nodeIndex(endContainer) + 1;\n }\n RangeWalk.walk(dom, rng, function (nodes) {\n each$d(nodes, function (node) {\n process(node);\n if (NodeType.isElement(node) && ed.dom.getStyle(node, 'text-decoration') === 'underline' && node.parentNode && FormatUtils.getTextDecoration(dom, node.parentNode) === 'underline') {\n removeFormat(ed, {\n deep: false,\n exact: true,\n inline: 'span',\n styles: { textDecoration: 'underline' }\n }, null, node);\n }\n });\n });\n };\n if (node) {\n if (node.nodeType) {\n rng = dom.createRng();\n rng.setStartBefore(node);\n rng.setEndAfter(node);\n removeRngStyle(rng);\n } else {\n removeRngStyle(node);\n }\n return;\n }\n if (dom.getContentEditable(selection.getNode()) === 'false') {\n node = selection.getNode();\n for (var i = 0, l = formatList.length; i < l; i++) {\n if (formatList[i].ceFalseOverride) {\n if (removeFormat(ed, formatList[i], vars, node, node)) {\n break;\n }\n }\n }\n return;\n }\n if (!selection.isCollapsed() || !format.inline || dom.select('td[data-mce-selected],th[data-mce-selected]').length) {\n bookmark = GetBookmark.getPersistentBookmark(ed.selection, true);\n removeRngStyle(selection.getRng());\n selection.moveToBookmark(bookmark);\n if (format.inline && MatchFormat.match(ed, name, vars, selection.getStart())) {\n FormatUtils.moveStart(dom, selection, selection.getRng());\n }\n ed.nodeChanged();\n } else {\n removeCaretFormat(ed, name, vars, similar);\n }\n };\n var RemoveFormat = {\n removeFormat: removeFormat,\n remove: remove$6\n };\n\n var each$e = Tools.each;\n var isElementNode = function (node) {\n return node && node.nodeType === 1 && !Bookmarks.isBookmarkNode(node) && !isCaretNode(node) && !NodeType.isBogus(node);\n };\n var findElementSibling = function (node, siblingName) {\n var sibling;\n for (sibling = node; sibling; sibling = sibling[siblingName]) {\n if (sibling.nodeType === 3 && sibling.nodeValue.length !== 0) {\n return node;\n }\n if (sibling.nodeType === 1 && !Bookmarks.isBookmarkNode(sibling)) {\n return sibling;\n }\n }\n return node;\n };\n var mergeSiblingsNodes = function (dom, prev, next) {\n var sibling, tmpSibling;\n var elementUtils = new ElementUtils(dom);\n if (prev && next) {\n prev = findElementSibling(prev, 'previousSibling');\n next = findElementSibling(next, 'nextSibling');\n if (elementUtils.compare(prev, next)) {\n for (sibling = prev.nextSibling; sibling && sibling !== next;) {\n tmpSibling = sibling;\n sibling = sibling.nextSibling;\n prev.appendChild(tmpSibling);\n }\n dom.remove(next);\n Tools.each(Tools.grep(next.childNodes), function (node) {\n prev.appendChild(node);\n });\n return prev;\n }\n }\n return next;\n };\n var processChildElements = function (node, filter, process) {\n each$e(node.childNodes, function (node) {\n if (isElementNode(node)) {\n if (filter(node)) {\n process(node);\n }\n if (node.hasChildNodes()) {\n processChildElements(node, filter, process);\n }\n }\n });\n };\n var hasStyle = function (dom, name) {\n return curry(function (name, node) {\n return !!(node && FormatUtils.getStyle(dom, node, name));\n }, name);\n };\n var applyStyle = function (dom, name, value) {\n return curry(function (name, value, node) {\n dom.setStyle(node, name, value);\n if (node.getAttribute('style') === '') {\n node.removeAttribute('style');\n }\n unwrapEmptySpan(dom, node);\n }, name, value);\n };\n var unwrapEmptySpan = function (dom, node) {\n if (node.nodeName === 'SPAN' && dom.getAttribs(node).length === 0) {\n dom.remove(node, true);\n }\n };\n var processUnderlineAndColor = function (dom, node) {\n var textDecoration;\n if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) {\n textDecoration = FormatUtils.getTextDecoration(dom, node.parentNode);\n if (dom.getStyle(node, 'color') && textDecoration) {\n dom.setStyle(node, 'text-decoration', textDecoration);\n } else if (dom.getStyle(node, 'text-decoration') === textDecoration) {\n dom.setStyle(node, 'text-decoration', null);\n }\n }\n };\n var mergeUnderlineAndColor = function (dom, format, vars, node) {\n if (format.styles.color || format.styles.textDecoration) {\n Tools.walk(node, curry(processUnderlineAndColor, dom), 'childNodes');\n processUnderlineAndColor(dom, node);\n }\n };\n var mergeBackgroundColorAndFontSize = function (dom, format, vars, node) {\n if (format.styles && format.styles.backgroundColor) {\n processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'backgroundColor', FormatUtils.replaceVars(format.styles.backgroundColor, vars)));\n }\n };\n var mergeSubSup = function (dom, format, vars, node) {\n if (format.inline === 'sub' || format.inline === 'sup') {\n processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'fontSize', ''));\n dom.remove(dom.select(format.inline === 'sup' ? 'sub' : 'sup', node), true);\n }\n };\n var mergeSiblings = function (dom, format, vars, node) {\n if (node && format.merge_siblings !== false) {\n node = mergeSiblingsNodes(dom, FormatUtils.getNonWhiteSpaceSibling(node), node);\n node = mergeSiblingsNodes(dom, node, FormatUtils.getNonWhiteSpaceSibling(node, true));\n }\n };\n var clearChildStyles = function (dom, format, node) {\n if (format.clear_child_styles) {\n var selector = format.links ? '*:not(a)' : '*';\n each$e(dom.select(selector, node), function (node) {\n if (isElementNode(node)) {\n each$e(format.styles, function (value, name) {\n dom.setStyle(node, name, '');\n });\n }\n });\n }\n };\n var mergeWithChildren = function (editor, formatList, vars, node) {\n each$e(formatList, function (format) {\n each$e(editor.dom.select(format.inline, node), function (child) {\n if (!isElementNode(child)) {\n return;\n }\n RemoveFormat.removeFormat(editor, format, vars, child, format.exact ? child : null);\n });\n clearChildStyles(editor.dom, format, node);\n });\n };\n var mergeWithParents = function (editor, format, name, vars, node) {\n if (MatchFormat.matchNode(editor, node.parentNode, name, vars)) {\n if (RemoveFormat.removeFormat(editor, format, vars, node)) {\n return;\n }\n }\n if (format.merge_with_parents) {\n editor.dom.getParent(node.parentNode, function (parent) {\n if (MatchFormat.matchNode(editor, parent, name, vars)) {\n RemoveFormat.removeFormat(editor, format, vars, node);\n return true;\n }\n });\n }\n };\n var MergeFormats = {\n mergeWithChildren: mergeWithChildren,\n mergeUnderlineAndColor: mergeUnderlineAndColor,\n mergeBackgroundColorAndFontSize: mergeBackgroundColorAndFontSize,\n mergeSubSup: mergeSubSup,\n mergeSiblings: mergeSiblings,\n mergeWithParents: mergeWithParents\n };\n\n var each$f = Tools.each;\n var isElementNode$1 = function (node) {\n return node && node.nodeType === 1 && !Bookmarks.isBookmarkNode(node) && !isCaretNode(node) && !NodeType.isBogus(node);\n };\n var applyFormat = function (ed, name, vars, node) {\n var formatList = ed.formatter.get(name);\n var format = formatList[0];\n var bookmark, rng;\n var isCollapsed = !node && ed.selection.isCollapsed();\n var dom = ed.dom, selection = ed.selection;\n var setElementFormat = function (elm, fmt) {\n fmt = fmt || format;\n if (elm) {\n if (fmt.onformat) {\n fmt.onformat(elm, fmt, vars, node);\n }\n each$f(fmt.styles, function (value, name) {\n dom.setStyle(elm, name, FormatUtils.replaceVars(value, vars));\n });\n if (fmt.styles) {\n var styleVal = dom.getAttrib(elm, 'style');\n if (styleVal) {\n elm.setAttribute('data-mce-style', styleVal);\n }\n }\n each$f(fmt.attributes, function (value, name) {\n dom.setAttrib(elm, name, FormatUtils.replaceVars(value, vars));\n });\n each$f(fmt.classes, function (value) {\n value = FormatUtils.replaceVars(value, vars);\n if (!dom.hasClass(elm, value)) {\n dom.addClass(elm, value);\n }\n });\n }\n };\n var applyNodeStyle = function (formatList, node) {\n var found = false;\n if (!format.selector) {\n return false;\n }\n each$f(formatList, function (format) {\n if ('collapsed' in format && format.collapsed !== isCollapsed) {\n return;\n }\n if (dom.is(node, format.selector) && !isCaretNode(node)) {\n setElementFormat(node, format);\n found = true;\n return false;\n }\n });\n return found;\n };\n var applyRngStyle = function (dom, rng, bookmark, nodeSpecific) {\n var newWrappers = [];\n var wrapName, wrapElm, contentEditable = true;\n wrapName = format.inline || format.block;\n wrapElm = dom.create(wrapName);\n setElementFormat(wrapElm);\n RangeWalk.walk(dom, rng, function (nodes) {\n var currentWrapElm;\n var process = function (node) {\n var nodeName, parentName, hasContentEditableState, lastContentEditable;\n lastContentEditable = contentEditable;\n nodeName = node.nodeName.toLowerCase();\n parentName = node.parentNode.nodeName.toLowerCase();\n if (node.nodeType === 1 && dom.getContentEditable(node)) {\n lastContentEditable = contentEditable;\n contentEditable = dom.getContentEditable(node) === 'true';\n hasContentEditableState = true;\n }\n if (FormatUtils.isEq(nodeName, 'br')) {\n currentWrapElm = 0;\n if (format.block) {\n dom.remove(node);\n }\n return;\n }\n if (format.wrapper && MatchFormat.matchNode(ed, node, name, vars)) {\n currentWrapElm = 0;\n return;\n }\n if (contentEditable && !hasContentEditableState && format.block && !format.wrapper && FormatUtils.isTextBlock(ed, nodeName) && FormatUtils.isValid(ed, parentName, wrapName)) {\n node = dom.rename(node, wrapName);\n setElementFormat(node);\n newWrappers.push(node);\n currentWrapElm = 0;\n return;\n }\n if (format.selector) {\n var found = applyNodeStyle(formatList, node);\n if (!format.inline || found) {\n currentWrapElm = 0;\n return;\n }\n }\n if (contentEditable && !hasContentEditableState && FormatUtils.isValid(ed, wrapName, nodeName) && FormatUtils.isValid(ed, parentName, wrapName) && !(!nodeSpecific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node) && (!format.inline || !dom.isBlock(node))) {\n if (!currentWrapElm) {\n currentWrapElm = dom.clone(wrapElm, false);\n node.parentNode.insertBefore(currentWrapElm, node);\n newWrappers.push(currentWrapElm);\n }\n currentWrapElm.appendChild(node);\n } else {\n currentWrapElm = 0;\n each$f(Tools.grep(node.childNodes), process);\n if (hasContentEditableState) {\n contentEditable = lastContentEditable;\n }\n currentWrapElm = 0;\n }\n };\n each$f(nodes, process);\n });\n if (format.links === true) {\n each$f(newWrappers, function (node) {\n var process = function (node) {\n if (node.nodeName === 'A') {\n setElementFormat(node, format);\n }\n each$f(Tools.grep(node.childNodes), process);\n };\n process(node);\n });\n }\n each$f(newWrappers, function (node) {\n var childCount;\n var getChildCount = function (node) {\n var count = 0;\n each$f(node.childNodes, function (node) {\n if (!FormatUtils.isWhiteSpaceNode(node) && !Bookmarks.isBookmarkNode(node)) {\n count++;\n }\n });\n return count;\n };\n var getChildElementNode = function (root) {\n var child = false;\n each$f(root.childNodes, function (node) {\n if (isElementNode$1(node)) {\n child = node;\n return false;\n }\n });\n return child;\n };\n var mergeStyles = function (node) {\n var child, clone;\n child = getChildElementNode(node);\n if (child && !Bookmarks.isBookmarkNode(child) && MatchFormat.matchName(dom, child, format)) {\n clone = dom.clone(child, false);\n setElementFormat(clone);\n dom.replace(clone, node, true);\n dom.remove(child, 1);\n }\n return clone || node;\n };\n childCount = getChildCount(node);\n if ((newWrappers.length > 1 || !dom.isBlock(node)) && childCount === 0) {\n dom.remove(node, 1);\n return;\n }\n if (format.inline || format.wrapper) {\n if (!format.exact && childCount === 1) {\n node = mergeStyles(node);\n }\n MergeFormats.mergeWithChildren(ed, formatList, vars, node);\n MergeFormats.mergeWithParents(ed, format, name, vars, node);\n MergeFormats.mergeBackgroundColorAndFontSize(dom, format, vars, node);\n MergeFormats.mergeSubSup(dom, format, vars, node);\n MergeFormats.mergeSiblings(dom, format, vars, node);\n }\n });\n };\n if (dom.getContentEditable(selection.getNode()) === 'false') {\n node = selection.getNode();\n for (var i = 0, l = formatList.length; i < l; i++) {\n if (formatList[i].ceFalseOverride && dom.is(node, formatList[i].selector)) {\n setElementFormat(node, formatList[i]);\n return;\n }\n }\n return;\n }\n if (format) {\n if (node) {\n if (node.nodeType) {\n if (!applyNodeStyle(formatList, node)) {\n rng = dom.createRng();\n rng.setStartBefore(node);\n rng.setEndAfter(node);\n applyRngStyle(dom, ExpandRange.expandRng(ed, rng, formatList), null, true);\n }\n } else {\n applyRngStyle(dom, node, null, true);\n }\n } else {\n if (!isCollapsed || !format.inline || dom.select('td[data-mce-selected],th[data-mce-selected]').length) {\n var curSelNode = ed.selection.getNode();\n if (!ed.settings.forced_root_block && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) {\n applyFormat(ed, formatList[0].defaultBlock);\n }\n ed.selection.setRng(RangeNormalizer.normalize(ed.selection.getRng()));\n bookmark = GetBookmark.getPersistentBookmark(ed.selection, true);\n applyRngStyle(dom, ExpandRange.expandRng(ed, selection.getRng(), formatList));\n if (format.styles) {\n MergeFormats.mergeUnderlineAndColor(dom, format, vars, curSelNode);\n }\n selection.moveToBookmark(bookmark);\n FormatUtils.moveStart(dom, selection, selection.getRng());\n ed.nodeChanged();\n } else {\n applyCaretFormat(ed, name, vars);\n }\n }\n Hooks.postProcess(name, ed);\n }\n };\n var ApplyFormat = { applyFormat: applyFormat };\n\n var each$g = Tools.each;\n var setup$5 = function (formatChangeData, editor) {\n var currentFormats = {};\n formatChangeData.set({});\n editor.on('NodeChange', function (e) {\n var parents = FormatUtils.getParents(editor.dom, e.element);\n var matchedFormats = {};\n parents = Tools.grep(parents, function (node) {\n return node.nodeType === 1 && !node.getAttribute('data-mce-bogus');\n });\n each$g(formatChangeData.get(), function (callbacks, format) {\n each$g(parents, function (node) {\n if (editor.formatter.matchNode(node, format, {}, callbacks.similar)) {\n if (!currentFormats[format]) {\n each$g(callbacks, function (callback) {\n callback(true, {\n node: node,\n format: format,\n parents: parents\n });\n });\n currentFormats[format] = callbacks;\n }\n matchedFormats[format] = callbacks;\n return false;\n }\n if (MatchFormat.matchesUnInheritedFormatSelector(editor, node, format)) {\n return false;\n }\n });\n });\n each$g(currentFormats, function (callbacks, format) {\n if (!matchedFormats[format]) {\n delete currentFormats[format];\n each$g(callbacks, function (callback) {\n callback(false, {\n node: e.element,\n format: format,\n parents: parents\n });\n });\n }\n });\n });\n };\n var addListeners = function (formatChangeData, formats, callback, similar) {\n var formatChangeItems = formatChangeData.get();\n each$g(formats.split(','), function (format) {\n if (!formatChangeItems[format]) {\n formatChangeItems[format] = [];\n formatChangeItems[format].similar = similar;\n }\n formatChangeItems[format].push(callback);\n });\n formatChangeData.set(formatChangeItems);\n };\n var formatChanged = function (editor, formatChangeState, formats, callback, similar) {\n if (formatChangeState.get() === null) {\n setup$5(formatChangeState, editor);\n }\n addListeners(formatChangeState, formats, callback, similar);\n };\n var FormatChanged = { formatChanged: formatChanged };\n\n var get$5 = function (dom) {\n var formats = {\n valigntop: [{\n selector: 'td,th',\n styles: { verticalAlign: 'top' }\n }],\n valignmiddle: [{\n selector: 'td,th',\n styles: { verticalAlign: 'middle' }\n }],\n valignbottom: [{\n selector: 'td,th',\n styles: { verticalAlign: 'bottom' }\n }],\n alignleft: [\n {\n selector: 'figure.image',\n collapsed: false,\n classes: 'align-left',\n ceFalseOverride: true,\n preview: 'font-family font-size'\n },\n {\n selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',\n styles: { textAlign: 'left' },\n inherit: false,\n preview: false,\n defaultBlock: 'div'\n },\n {\n selector: 'img,table',\n collapsed: false,\n styles: { float: 'left' },\n preview: 'font-family font-size'\n }\n ],\n aligncenter: [\n {\n selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',\n styles: { textAlign: 'center' },\n inherit: false,\n preview: 'font-family font-size',\n defaultBlock: 'div'\n },\n {\n selector: 'figure.image',\n collapsed: false,\n classes: 'align-center',\n ceFalseOverride: true,\n preview: 'font-family font-size'\n },\n {\n selector: 'img',\n collapsed: false,\n styles: {\n display: 'block',\n marginLeft: 'auto',\n marginRight: 'auto'\n },\n preview: false\n },\n {\n selector: 'table',\n collapsed: false,\n styles: {\n marginLeft: 'auto',\n marginRight: 'auto'\n },\n preview: 'font-family font-size'\n }\n ],\n alignright: [\n {\n selector: 'figure.image',\n collapsed: false,\n classes: 'align-right',\n ceFalseOverride: true,\n preview: 'font-family font-size'\n },\n {\n selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',\n styles: { textAlign: 'right' },\n inherit: false,\n preview: 'font-family font-size',\n defaultBlock: 'div'\n },\n {\n selector: 'img,table',\n collapsed: false,\n styles: { float: 'right' },\n preview: 'font-family font-size'\n }\n ],\n alignjustify: [{\n selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',\n styles: { textAlign: 'justify' },\n inherit: false,\n defaultBlock: 'div',\n preview: 'font-family font-size'\n }],\n bold: [\n {\n inline: 'strong',\n remove: 'all'\n },\n {\n inline: 'span',\n styles: { fontWeight: 'bold' }\n },\n {\n inline: 'b',\n remove: 'all'\n }\n ],\n italic: [\n {\n inline: 'em',\n remove: 'all'\n },\n {\n inline: 'span',\n styles: { fontStyle: 'italic' }\n },\n {\n inline: 'i',\n remove: 'all'\n }\n ],\n underline: [\n {\n inline: 'span',\n styles: { textDecoration: 'underline' },\n exact: true\n },\n {\n inline: 'u',\n remove: 'all'\n }\n ],\n strikethrough: [\n {\n inline: 'span',\n styles: { textDecoration: 'line-through' },\n exact: true\n },\n {\n inline: 'strike',\n remove: 'all'\n }\n ],\n forecolor: {\n inline: 'span',\n styles: { color: '%value' },\n links: true,\n remove_similar: true,\n clear_child_styles: true\n },\n hilitecolor: {\n inline: 'span',\n styles: { backgroundColor: '%value' },\n links: true,\n remove_similar: true,\n clear_child_styles: true\n },\n fontname: {\n inline: 'span',\n toggle: false,\n styles: { fontFamily: '%value' },\n clear_child_styles: true\n },\n fontsize: {\n inline: 'span',\n toggle: false,\n styles: { fontSize: '%value' },\n clear_child_styles: true\n },\n fontsize_class: {\n inline: 'span',\n attributes: { class: '%value' }\n },\n blockquote: {\n block: 'blockquote',\n wrapper: 1,\n remove: 'all'\n },\n subscript: { inline: 'sub' },\n superscript: { inline: 'sup' },\n code: { inline: 'code' },\n link: {\n inline: 'a',\n selector: 'a',\n remove: 'all',\n split: true,\n deep: true,\n onmatch: function () {\n return true;\n },\n onformat: function (elm, fmt, vars) {\n Tools.each(vars, function (value, key) {\n dom.setAttrib(elm, key, value);\n });\n }\n },\n removeformat: [\n {\n selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins',\n remove: 'all',\n split: true,\n expand: false,\n block_expand: true,\n deep: true\n },\n {\n selector: 'span',\n attributes: [\n 'style',\n 'class'\n ],\n remove: 'empty',\n split: true,\n expand: false,\n deep: true\n },\n {\n selector: '*',\n attributes: [\n 'style',\n 'class'\n ],\n split: false,\n expand: false,\n deep: true\n }\n ]\n };\n Tools.each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\\s/), function (name) {\n formats[name] = {\n block: name,\n remove: 'all'\n };\n });\n return formats;\n };\n var DefaultFormats = { get: get$5 };\n\n function FormatRegistry (editor) {\n var formats = {};\n var get = function (name) {\n return name ? formats[name] : formats;\n };\n var register = function (name, format) {\n if (name) {\n if (typeof name !== 'string') {\n Tools.each(name, function (format, name) {\n register(name, format);\n });\n } else {\n format = format.length ? format : [format];\n Tools.each(format, function (format) {\n if (typeof format.deep === 'undefined') {\n format.deep = !format.selector;\n }\n if (typeof format.split === 'undefined') {\n format.split = !format.selector || format.inline;\n }\n if (typeof format.remove === 'undefined' && format.selector && !format.inline) {\n format.remove = 'none';\n }\n if (format.selector && format.inline) {\n format.mixed = true;\n format.block_expand = true;\n }\n if (typeof format.classes === 'string') {\n format.classes = format.classes.split(/\\s+/);\n }\n });\n formats[name] = format;\n }\n }\n };\n var unregister = function (name) {\n if (name && formats[name]) {\n delete formats[name];\n }\n return formats;\n };\n register(DefaultFormats.get(editor.dom));\n register(editor.settings.formats);\n return {\n get: get,\n register: register,\n unregister: unregister\n };\n }\n\n var each$h = Tools.each;\n var dom = DOMUtils$1.DOM;\n var parsedSelectorToHtml = function (ancestry, editor) {\n var elm, item, fragment;\n var schema = editor && editor.schema || Schema({});\n var decorate = function (elm, item) {\n if (item.classes.length) {\n dom.addClass(elm, item.classes.join(' '));\n }\n dom.setAttribs(elm, item.attrs);\n };\n var createElement = function (sItem) {\n var elm;\n item = typeof sItem === 'string' ? {\n name: sItem,\n classes: [],\n attrs: {}\n } : sItem;\n elm = dom.create(item.name);\n decorate(elm, item);\n return elm;\n };\n var getRequiredParent = function (elm, candidate) {\n var name = typeof elm !== 'string' ? elm.nodeName.toLowerCase() : elm;\n var elmRule = schema.getElementRule(name);\n var parentsRequired = elmRule && elmRule.parentsRequired;\n if (parentsRequired && parentsRequired.length) {\n return candidate && Tools.inArray(parentsRequired, candidate) !== -1 ? candidate : parentsRequired[0];\n } else {\n return false;\n }\n };\n var wrapInHtml = function (elm, ancestry, siblings) {\n var parent, parentCandidate, parentRequired;\n var ancestor = ancestry.length > 0 && ancestry[0];\n var ancestorName = ancestor && ancestor.name;\n parentRequired = getRequiredParent(elm, ancestorName);\n if (parentRequired) {\n if (ancestorName === parentRequired) {\n parentCandidate = ancestry[0];\n ancestry = ancestry.slice(1);\n } else {\n parentCandidate = parentRequired;\n }\n } else if (ancestor) {\n parentCandidate = ancestry[0];\n ancestry = ancestry.slice(1);\n } else if (!siblings) {\n return elm;\n }\n if (parentCandidate) {\n parent = createElement(parentCandidate);\n parent.appendChild(elm);\n }\n if (siblings) {\n if (!parent) {\n parent = dom.create('div');\n parent.appendChild(elm);\n }\n Tools.each(siblings, function (sibling) {\n var siblingElm = createElement(sibling);\n parent.insertBefore(siblingElm, elm);\n });\n }\n return wrapInHtml(parent, ancestry, parentCandidate && parentCandidate.siblings);\n };\n if (ancestry && ancestry.length) {\n item = ancestry[0];\n elm = createElement(item);\n fragment = dom.create('div');\n fragment.appendChild(wrapInHtml(elm, ancestry.slice(1), item.siblings));\n return fragment;\n } else {\n return '';\n }\n };\n var selectorToHtml = function (selector, editor) {\n return parsedSelectorToHtml(parseSelector(selector), editor);\n };\n var parseSelectorItem = function (item) {\n var tagName;\n var obj = {\n classes: [],\n attrs: {}\n };\n item = obj.selector = Tools.trim(item);\n if (item !== '*') {\n tagName = item.replace(/(?:([#\\.]|::?)([\\w\\-]+)|(\\[)([^\\]]+)\\]?)/g, function ($0, $1, $2, $3, $4) {\n switch ($1) {\n case '#':\n obj.attrs.id = $2;\n break;\n case '.':\n obj.classes.push($2);\n break;\n case ':':\n if (Tools.inArray('checked disabled enabled read-only required'.split(' '), $2) !== -1) {\n obj.attrs[$2] = $2;\n }\n break;\n }\n if ($3 === '[') {\n var m = $4.match(/([\\w\\-]+)(?:\\=\\\"([^\\\"]+))?/);\n if (m) {\n obj.attrs[m[1]] = m[2];\n }\n }\n return '';\n });\n }\n obj.name = tagName || 'div';\n return obj;\n };\n var parseSelector = function (selector) {\n if (!selector || typeof selector !== 'string') {\n return [];\n }\n selector = selector.split(/\\s*,\\s*/)[0];\n selector = selector.replace(/\\s*(~\\+|~|\\+|>)\\s*/g, '$1');\n return Tools.map(selector.split(/(?:>|\\s+(?![^\\[\\]]+\\]))/), function (item) {\n var siblings = Tools.map(item.split(/(?:~\\+|~|\\+)/), parseSelectorItem);\n var obj = siblings.pop();\n if (siblings.length) {\n obj.siblings = siblings;\n }\n return obj;\n }).reverse();\n };\n var getCssText = function (editor, format) {\n var name, previewFrag, previewElm, items;\n var previewCss = '', parentFontSize, previewStyles;\n previewStyles = editor.settings.preview_styles;\n if (previewStyles === false) {\n return '';\n }\n if (typeof previewStyles !== 'string') {\n previewStyles = 'font-family font-size font-weight font-style text-decoration ' + 'text-transform color background-color border border-radius outline text-shadow';\n }\n var removeVars = function (val) {\n return val.replace(/%(\\w+)/g, '');\n };\n if (typeof format === 'string') {\n format = editor.formatter.get(format);\n if (!format) {\n return;\n }\n format = format[0];\n }\n if ('preview' in format) {\n previewStyles = format.preview;\n if (previewStyles === false) {\n return '';\n }\n }\n name = format.block || format.inline || 'span';\n items = parseSelector(format.selector);\n if (items.length) {\n if (!items[0].name) {\n items[0].name = name;\n }\n name = format.selector;\n previewFrag = parsedSelectorToHtml(items, editor);\n } else {\n previewFrag = parsedSelectorToHtml([name], editor);\n }\n previewElm = dom.select(name, previewFrag)[0] || previewFrag.firstChild;\n each$h(format.styles, function (value, name) {\n value = removeVars(value);\n if (value) {\n dom.setStyle(previewElm, name, value);\n }\n });\n each$h(format.attributes, function (value, name) {\n value = removeVars(value);\n if (value) {\n dom.setAttrib(previewElm, name, value);\n }\n });\n each$h(format.classes, function (value) {\n value = removeVars(value);\n if (!dom.hasClass(previewElm, value)) {\n dom.addClass(previewElm, value);\n }\n });\n editor.fire('PreviewFormats');\n dom.setStyles(previewFrag, {\n position: 'absolute',\n left: -65535\n });\n editor.getBody().appendChild(previewFrag);\n parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true);\n parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;\n each$h(previewStyles.split(' '), function (name) {\n var value = dom.getStyle(previewElm, name, true);\n if (name === 'background-color' && /transparent|rgba\\s*\\([^)]+,\\s*0\\)/.test(value)) {\n value = dom.getStyle(editor.getBody(), name, true);\n if (dom.toHex(value).toLowerCase() === '#ffffff') {\n return;\n }\n }\n if (name === 'color') {\n if (dom.toHex(value).toLowerCase() === '#000000') {\n return;\n }\n }\n if (name === 'font-size') {\n if (/em|%$/.test(value)) {\n if (parentFontSize === 0) {\n return;\n }\n var numValue = parseFloat(value) / (/%$/.test(value) ? 100 : 1);\n value = numValue * parentFontSize + 'px';\n }\n }\n if (name === 'border' && value) {\n previewCss += 'padding:0 2px;';\n }\n previewCss += name + ':' + value + ';';\n });\n editor.fire('AfterPreviewFormats');\n dom.remove(previewFrag);\n return previewCss;\n };\n var Preview = {\n getCssText: getCssText,\n parseSelector: parseSelector,\n selectorToHtml: selectorToHtml\n };\n\n var toggle = function (editor, formats, name, vars, node) {\n var fmt = formats.get(name);\n if (MatchFormat.match(editor, name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) {\n RemoveFormat.remove(editor, name, vars, node);\n } else {\n ApplyFormat.applyFormat(editor, name, vars, node);\n }\n };\n var ToggleFormat = { toggle: toggle };\n\n var setup$6 = function (editor) {\n editor.addShortcut('meta+b', '', 'Bold');\n editor.addShortcut('meta+i', '', 'Italic');\n editor.addShortcut('meta+u', '', 'Underline');\n for (var i = 1; i <= 6; i++) {\n editor.addShortcut('access+' + i, '', [\n 'FormatBlock',\n false,\n 'h' + i\n ]);\n }\n editor.addShortcut('access+7', '', [\n 'FormatBlock',\n false,\n 'p'\n ]);\n editor.addShortcut('access+8', '', [\n 'FormatBlock',\n false,\n 'div'\n ]);\n editor.addShortcut('access+9', '', [\n 'FormatBlock',\n false,\n 'address'\n ]);\n };\n var FormatShortcuts = { setup: setup$6 };\n\n function Formatter (editor) {\n var formats = FormatRegistry(editor);\n var formatChangeState = Cell(null);\n FormatShortcuts.setup(editor);\n setup$2(editor);\n return {\n get: formats.get,\n register: formats.register,\n unregister: formats.unregister,\n apply: curry(ApplyFormat.applyFormat, editor),\n remove: curry(RemoveFormat.remove, editor),\n toggle: curry(ToggleFormat.toggle, editor, formats),\n match: curry(MatchFormat.match, editor),\n matchAll: curry(MatchFormat.matchAll, editor),\n matchNode: curry(MatchFormat.matchNode, editor),\n canApply: curry(MatchFormat.canApply, editor),\n formatChanged: curry(FormatChanged.formatChanged, editor, formatChangeState),\n getCssText: curry(Preview.getCssText, editor)\n };\n }\n\n var hasOwnProperty$2 = Object.prototype.hasOwnProperty;\n var shallow$1 = function (old, nu) {\n return nu;\n };\n var baseMerge = function (merger) {\n return function () {\n var objects = new Array(arguments.length);\n for (var i = 0; i < objects.length; i++) {\n objects[i] = arguments[i];\n }\n if (objects.length === 0) {\n throw new Error('Can\\'t merge zero objects');\n }\n var ret = {};\n for (var j = 0; j < objects.length; j++) {\n var curObject = objects[j];\n for (var key in curObject) {\n if (hasOwnProperty$2.call(curObject, key)) {\n ret[key] = merger(ret[key], curObject[key]);\n }\n }\n }\n return ret;\n };\n };\n var merge = baseMerge(shallow$1);\n\n var register = function (htmlParser, settings, dom) {\n htmlParser.addAttributeFilter('data-mce-tabindex', function (nodes, name) {\n var i = nodes.length, node;\n while (i--) {\n node = nodes[i];\n node.attr('tabindex', node.attributes.map['data-mce-tabindex']);\n node.attr(name, null);\n }\n });\n htmlParser.addAttributeFilter('src,href,style', function (nodes, name) {\n var i = nodes.length, node, value;\n var internalName = 'data-mce-' + name;\n var urlConverter = settings.url_converter;\n var urlConverterScope = settings.url_converter_scope;\n while (i--) {\n node = nodes[i];\n value = node.attributes.map[internalName];\n if (value !== undefined) {\n node.attr(name, value.length > 0 ? value : null);\n node.attr(internalName, null);\n } else {\n value = node.attributes.map[name];\n if (name === 'style') {\n value = dom.serializeStyle(dom.parseStyle(value), node.name);\n } else if (urlConverter) {\n value = urlConverter.call(urlConverterScope, value, name, node.name);\n }\n node.attr(name, value.length > 0 ? value : null);\n }\n }\n });\n htmlParser.addAttributeFilter('class', function (nodes) {\n var i = nodes.length, node, value;\n while (i--) {\n node = nodes[i];\n value = node.attr('class');\n if (value) {\n value = node.attr('class').replace(/(?:^|\\s)mce-item-\\w+(?!\\S)/g, '');\n node.attr('class', value.length > 0 ? value : null);\n }\n }\n });\n htmlParser.addAttributeFilter('data-mce-type', function (nodes, name, args) {\n var i = nodes.length, node;\n while (i--) {\n node = nodes[i];\n if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup) {\n var hasChildren = Option.from(node.firstChild).exists(function (firstChild) {\n return !Zwsp.isZwsp(firstChild.value);\n });\n if (hasChildren) {\n node.unwrap();\n } else {\n node.remove();\n }\n }\n }\n });\n htmlParser.addNodeFilter('noscript', function (nodes) {\n var i = nodes.length, node;\n while (i--) {\n node = nodes[i].firstChild;\n if (node) {\n node.value = Entities.decode(node.value);\n }\n }\n });\n htmlParser.addNodeFilter('script,style', function (nodes, name) {\n var i = nodes.length, node, value, type;\n var trim = function (value) {\n return value.replace(/()/g, '\\n').replace(/^[\\r\\n]*|[\\r\\n]*$/g, '').replace(/^\\s*(()?|\\s*\\/\\/\\s*\\]\\]>(-->)?|\\/\\/\\s*(-->)?|\\]\\]>|\\/\\*\\s*-->\\s*\\*\\/|\\s*-->\\s*)\\s*$/g, '');\n };\n while (i--) {\n node = nodes[i];\n value = node.firstChild ? node.firstChild.value : '';\n if (name === 'script') {\n type = node.attr('type');\n if (type) {\n node.attr('type', type === 'mce-no/type' ? null : type.replace(/^mce\\-/, ''));\n }\n if (settings.element_format === 'xhtml' && value.length > 0) {\n node.firstChild.value = '// ';\n }\n } else {\n if (settings.element_format === 'xhtml' && value.length > 0) {\n node.firstChild.value = '';\n }\n }\n }\n });\n htmlParser.addNodeFilter('#comment', function (nodes) {\n var i = nodes.length, node;\n while (i--) {\n node = nodes[i];\n if (node.value.indexOf('[CDATA[') === 0) {\n node.name = '#cdata';\n node.type = 4;\n node.value = node.value.replace(/^\\[CDATA\\[|\\]\\]$/g, '');\n } else if (node.value.indexOf('mce:protected ') === 0) {\n node.name = '#text';\n node.type = 3;\n node.raw = true;\n node.value = unescape(node.value).substr(14);\n }\n }\n });\n htmlParser.addNodeFilter('xml:namespace,input', function (nodes, name) {\n var i = nodes.length, node;\n while (i--) {\n node = nodes[i];\n if (node.type === 7) {\n node.remove();\n } else if (node.type === 1) {\n if (name === 'input' && !('type' in node.attributes.map)) {\n node.attr('type', 'text');\n }\n }\n }\n });\n htmlParser.addAttributeFilter('data-mce-type', function (nodes) {\n each(nodes, function (node) {\n if (node.attr('data-mce-type') === 'format-caret') {\n if (node.isEmpty(htmlParser.schema.getNonEmptyElements())) {\n node.remove();\n } else {\n node.unwrap();\n }\n }\n });\n });\n htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style,' + 'data-mce-selected,data-mce-expando,' + 'data-mce-type,data-mce-resize', function (nodes, name) {\n var i = nodes.length;\n while (i--) {\n nodes[i].attr(name, null);\n }\n });\n };\n var trimTrailingBr = function (rootNode) {\n var brNode1, brNode2;\n var isBr = function (node) {\n return node && node.name === 'br';\n };\n brNode1 = rootNode.lastChild;\n if (isBr(brNode1)) {\n brNode2 = brNode1.prev;\n if (isBr(brNode2)) {\n brNode1.remove();\n brNode2.remove();\n }\n }\n };\n var DomSerializerFilters = {\n register: register,\n trimTrailingBr: trimTrailingBr\n };\n\n var preProcess = function (editor, node, args) {\n var impl, doc, oldDoc;\n var dom = editor.dom;\n node = node.cloneNode(true);\n impl = domGlobals.document.implementation;\n if (impl.createHTMLDocument) {\n doc = impl.createHTMLDocument('');\n Tools.each(node.nodeName === 'BODY' ? node.childNodes : [node], function (node) {\n doc.body.appendChild(doc.importNode(node, true));\n });\n if (node.nodeName !== 'BODY') {\n node = doc.body.firstChild;\n } else {\n node = doc.body;\n }\n oldDoc = dom.doc;\n dom.doc = doc;\n }\n Events.firePreProcess(editor, merge(args, { node: node }));\n if (oldDoc) {\n dom.doc = oldDoc;\n }\n return node;\n };\n var shouldFireEvent = function (editor, args) {\n return editor && editor.hasEventListeners('PreProcess') && !args.no_events;\n };\n var process = function (editor, node, args) {\n return shouldFireEvent(editor, args) ? preProcess(editor, node, args) : node;\n };\n var DomSerializerPreProcess = { process: process };\n\n var removeAttrs = function (node, names) {\n each(names, function (name) {\n node.attr(name, null);\n });\n };\n var addFontToSpansFilter = function (domParser, styles, fontSizes) {\n domParser.addNodeFilter('font', function (nodes) {\n each(nodes, function (node) {\n var props = styles.parse(node.attr('style'));\n var color = node.attr('color');\n var face = node.attr('face');\n var size = node.attr('size');\n if (color) {\n props.color = color;\n }\n if (face) {\n props['font-family'] = face;\n }\n if (size) {\n props['font-size'] = fontSizes[parseInt(node.attr('size'), 10) - 1];\n }\n node.name = 'span';\n node.attr('style', styles.serialize(props));\n removeAttrs(node, [\n 'color',\n 'face',\n 'size'\n ]);\n });\n });\n };\n var addStrikeToSpanFilter = function (domParser, styles) {\n domParser.addNodeFilter('strike', function (nodes) {\n each(nodes, function (node) {\n var props = styles.parse(node.attr('style'));\n props['text-decoration'] = 'line-through';\n node.name = 'span';\n node.attr('style', styles.serialize(props));\n });\n });\n };\n var addFilters = function (domParser, settings) {\n var styles = Styles();\n if (settings.convert_fonts_to_spans) {\n addFontToSpansFilter(domParser, styles, Tools.explode(settings.font_size_legacy_values));\n }\n addStrikeToSpanFilter(domParser, styles);\n };\n var register$1 = function (domParser, settings) {\n if (settings.inline_styles) {\n addFilters(domParser, settings);\n }\n };\n var LegacyFilter = { register: register$1 };\n\n var whiteSpaceRegExp$3 = /^[ \\t\\r\\n]*$/;\n var typeLookup = {\n '#text': 3,\n '#comment': 8,\n '#cdata': 4,\n '#pi': 7,\n '#doctype': 10,\n '#document-fragment': 11\n };\n var walk$2 = function (node, root, prev) {\n var sibling;\n var parent;\n var startName = prev ? 'lastChild' : 'firstChild';\n var siblingName = prev ? 'prev' : 'next';\n if (node[startName]) {\n return node[startName];\n }\n if (node !== root) {\n sibling = node[siblingName];\n if (sibling) {\n return sibling;\n }\n for (parent = node.parent; parent && parent !== root; parent = parent.parent) {\n sibling = parent[siblingName];\n if (sibling) {\n return sibling;\n }\n }\n }\n };\n var Node$1 = function () {\n function Node(name, type) {\n this.name = name;\n this.type = type;\n if (type === 1) {\n this.attributes = [];\n this.attributes.map = {};\n }\n }\n Node.create = function (name, attrs) {\n var node, attrName;\n node = new Node(name, typeLookup[name] || 1);\n if (attrs) {\n for (attrName in attrs) {\n node.attr(attrName, attrs[attrName]);\n }\n }\n return node;\n };\n Node.prototype.replace = function (node) {\n var self = this;\n if (node.parent) {\n node.remove();\n }\n self.insert(node, self);\n self.remove();\n return self;\n };\n Node.prototype.attr = function (name, value) {\n var self = this;\n var attrs, i;\n if (typeof name !== 'string') {\n for (i in name) {\n self.attr(i, name[i]);\n }\n return self;\n }\n if (attrs = self.attributes) {\n if (value !== undefined) {\n if (value === null) {\n if (name in attrs.map) {\n delete attrs.map[name];\n i = attrs.length;\n while (i--) {\n if (attrs[i].name === name) {\n attrs = attrs.splice(i, 1);\n return self;\n }\n }\n }\n return self;\n }\n if (name in attrs.map) {\n i = attrs.length;\n while (i--) {\n if (attrs[i].name === name) {\n attrs[i].value = value;\n break;\n }\n }\n } else {\n attrs.push({\n name: name,\n value: value\n });\n }\n attrs.map[name] = value;\n return self;\n }\n return attrs.map[name];\n }\n };\n Node.prototype.clone = function () {\n var self = this;\n var clone = new Node(self.name, self.type);\n var i, l, selfAttrs, selfAttr, cloneAttrs;\n if (selfAttrs = self.attributes) {\n cloneAttrs = [];\n cloneAttrs.map = {};\n for (i = 0, l = selfAttrs.length; i < l; i++) {\n selfAttr = selfAttrs[i];\n if (selfAttr.name !== 'id') {\n cloneAttrs[cloneAttrs.length] = {\n name: selfAttr.name,\n value: selfAttr.value\n };\n cloneAttrs.map[selfAttr.name] = selfAttr.value;\n }\n }\n clone.attributes = cloneAttrs;\n }\n clone.value = self.value;\n clone.shortEnded = self.shortEnded;\n return clone;\n };\n Node.prototype.wrap = function (wrapper) {\n var self = this;\n self.parent.insert(wrapper, self);\n wrapper.append(self);\n return self;\n };\n Node.prototype.unwrap = function () {\n var self = this;\n var node, next;\n for (node = self.firstChild; node;) {\n next = node.next;\n self.insert(node, self, true);\n node = next;\n }\n self.remove();\n };\n Node.prototype.remove = function () {\n var self = this, parent = self.parent, next = self.next, prev = self.prev;\n if (parent) {\n if (parent.firstChild === self) {\n parent.firstChild = next;\n if (next) {\n next.prev = null;\n }\n } else {\n prev.next = next;\n }\n if (parent.lastChild === self) {\n parent.lastChild = prev;\n if (prev) {\n prev.next = null;\n }\n } else {\n next.prev = prev;\n }\n self.parent = self.next = self.prev = null;\n }\n return self;\n };\n Node.prototype.append = function (node) {\n var self = this;\n var last;\n if (node.parent) {\n node.remove();\n }\n last = self.lastChild;\n if (last) {\n last.next = node;\n node.prev = last;\n self.lastChild = node;\n } else {\n self.lastChild = self.firstChild = node;\n }\n node.parent = self;\n return node;\n };\n Node.prototype.insert = function (node, refNode, before) {\n var parent;\n if (node.parent) {\n node.remove();\n }\n parent = refNode.parent || this;\n if (before) {\n if (refNode === parent.firstChild) {\n parent.firstChild = node;\n } else {\n refNode.prev.next = node;\n }\n node.prev = refNode.prev;\n node.next = refNode;\n refNode.prev = node;\n } else {\n if (refNode === parent.lastChild) {\n parent.lastChild = node;\n } else {\n refNode.next.prev = node;\n }\n node.next = refNode.next;\n node.prev = refNode;\n refNode.next = node;\n }\n node.parent = parent;\n return node;\n };\n Node.prototype.getAll = function (name) {\n var self = this;\n var node;\n var collection = [];\n for (node = self.firstChild; node; node = walk$2(node, self)) {\n if (node.name === name) {\n collection.push(node);\n }\n }\n return collection;\n };\n Node.prototype.empty = function () {\n var self = this;\n var nodes, i, node;\n if (self.firstChild) {\n nodes = [];\n for (node = self.firstChild; node; node = walk$2(node, self)) {\n nodes.push(node);\n }\n i = nodes.length;\n while (i--) {\n node = nodes[i];\n node.parent = node.firstChild = node.lastChild = node.next = node.prev = null;\n }\n }\n self.firstChild = self.lastChild = null;\n return self;\n };\n Node.prototype.isEmpty = function (elements, whitespace, predicate) {\n var self = this;\n var node = self.firstChild, i, name;\n whitespace = whitespace || {};\n if (node) {\n do {\n if (node.type === 1) {\n if (node.attributes.map['data-mce-bogus']) {\n continue;\n }\n if (elements[node.name]) {\n return false;\n }\n i = node.attributes.length;\n while (i--) {\n name = node.attributes[i].name;\n if (name === 'name' || name.indexOf('data-mce-bookmark') === 0) {\n return false;\n }\n }\n }\n if (node.type === 8) {\n return false;\n }\n if (node.type === 3 && !whiteSpaceRegExp$3.test(node.value)) {\n return false;\n }\n if (node.type === 3 && node.parent && whitespace[node.parent.name] && whiteSpaceRegExp$3.test(node.value)) {\n return false;\n }\n if (predicate && predicate(node)) {\n return false;\n }\n } while (node = walk$2(node, self));\n }\n return true;\n };\n Node.prototype.walk = function (prev) {\n return walk$2(this, null, prev);\n };\n return Node;\n }();\n\n var paddEmptyNode = function (settings, args, blockElements, node) {\n var brPreferred = settings.padd_empty_with_br || args.insert;\n if (brPreferred && blockElements[node.name]) {\n node.empty().append(new Node$1('br', 1)).shortEnded = true;\n } else {\n node.empty().append(new Node$1('#text', 3)).value = '\\xA0';\n }\n };\n var isPaddedWithNbsp = function (node) {\n return hasOnlyChild(node, '#text') && node.firstChild.value === '\\xA0';\n };\n var hasOnlyChild = function (node, name) {\n return node && node.firstChild && node.firstChild === node.lastChild && node.firstChild.name === name;\n };\n var isPadded = function (schema, node) {\n var rule = schema.getElementRule(node.name);\n return rule && rule.paddEmpty;\n };\n var isEmpty$2 = function (schema, nonEmptyElements, whitespaceElements, node) {\n return node.isEmpty(nonEmptyElements, whitespaceElements, function (node) {\n return isPadded(schema, node);\n });\n };\n var isLineBreakNode = function (node, blockElements) {\n return node && (blockElements[node.name] || node.name === 'br');\n };\n\n var register$2 = function (parser, settings) {\n var schema = parser.schema;\n if (settings.remove_trailing_brs) {\n parser.addNodeFilter('br', function (nodes, _, args) {\n var i;\n var l = nodes.length;\n var node;\n var blockElements = Tools.extend({}, schema.getBlockElements());\n var nonEmptyElements = schema.getNonEmptyElements();\n var parent, lastParent, prev, prevName;\n var whiteSpaceElements = schema.getWhiteSpaceElements();\n var elementRule, textNode;\n blockElements.body = 1;\n for (i = 0; i < l; i++) {\n node = nodes[i];\n parent = node.parent;\n if (blockElements[node.parent.name] && node === parent.lastChild) {\n prev = node.prev;\n while (prev) {\n prevName = prev.name;\n if (prevName !== 'span' || prev.attr('data-mce-type') !== 'bookmark') {\n if (prevName !== 'br') {\n break;\n }\n if (prevName === 'br') {\n node = null;\n break;\n }\n }\n prev = prev.prev;\n }\n if (node) {\n node.remove();\n if (isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, parent)) {\n elementRule = schema.getElementRule(parent.name);\n if (elementRule) {\n if (elementRule.removeEmpty) {\n parent.remove();\n } else if (elementRule.paddEmpty) {\n paddEmptyNode(settings, args, blockElements, parent);\n }\n }\n }\n }\n } else {\n lastParent = node;\n while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) {\n lastParent = parent;\n if (blockElements[parent.name]) {\n break;\n }\n parent = parent.parent;\n }\n if (lastParent === parent && settings.padd_empty_with_br !== true) {\n textNode = new Node$1('#text', 3);\n textNode.value = '\\xA0';\n node.replace(textNode);\n }\n }\n }\n });\n }\n parser.addAttributeFilter('href', function (nodes) {\n var i = nodes.length, node;\n var appendRel = function (rel) {\n var parts = rel.split(' ').filter(function (p) {\n return p.length > 0;\n });\n return parts.concat(['noopener']).sort().join(' ');\n };\n var addNoOpener = function (rel) {\n var newRel = rel ? Tools.trim(rel) : '';\n if (!/\\b(noopener)\\b/g.test(newRel)) {\n return appendRel(newRel);\n } else {\n return newRel;\n }\n };\n if (!settings.allow_unsafe_link_target) {\n while (i--) {\n node = nodes[i];\n if (node.name === 'a' && node.attr('target') === '_blank') {\n node.attr('rel', addNoOpener(node.attr('rel')));\n }\n }\n }\n });\n if (!settings.allow_html_in_named_anchor) {\n parser.addAttributeFilter('id,name', function (nodes) {\n var i = nodes.length, sibling, prevSibling, parent, node;\n while (i--) {\n node = nodes[i];\n if (node.name === 'a' && node.firstChild && !node.attr('href')) {\n parent = node.parent;\n sibling = node.lastChild;\n do {\n prevSibling = sibling.prev;\n parent.insert(sibling, node);\n sibling = prevSibling;\n } while (sibling);\n }\n }\n });\n }\n if (settings.fix_list_elements) {\n parser.addNodeFilter('ul,ol', function (nodes) {\n var i = nodes.length, node, parentNode;\n while (i--) {\n node = nodes[i];\n parentNode = node.parent;\n if (parentNode.name === 'ul' || parentNode.name === 'ol') {\n if (node.prev && node.prev.name === 'li') {\n node.prev.append(node);\n } else {\n var li = new Node$1('li', 1);\n li.attr('style', 'list-style-type: none');\n node.wrap(li);\n }\n }\n }\n });\n }\n if (settings.validate && schema.getValidClasses()) {\n parser.addAttributeFilter('class', function (nodes) {\n var i = nodes.length, node, classList, ci, className, classValue;\n var validClasses = schema.getValidClasses();\n var validClassesMap, valid;\n while (i--) {\n node = nodes[i];\n classList = node.attr('class').split(' ');\n classValue = '';\n for (ci = 0; ci < classList.length; ci++) {\n className = classList[ci];\n valid = false;\n validClassesMap = validClasses['*'];\n if (validClassesMap && validClassesMap[className]) {\n valid = true;\n }\n validClassesMap = validClasses[node.name];\n if (!valid && validClassesMap && validClassesMap[className]) {\n valid = true;\n }\n if (valid) {\n if (classValue) {\n classValue += ' ';\n }\n classValue += className;\n }\n }\n if (!classValue.length) {\n classValue = null;\n }\n node.attr('class', classValue);\n }\n });\n }\n };\n\n var makeMap$4 = Tools.makeMap, each$i = Tools.each, explode$3 = Tools.explode, extend$3 = Tools.extend;\n function DomParser (settings, schema) {\n if (schema === void 0) {\n schema = Schema();\n }\n var nodeFilters = {};\n var attributeFilters = [];\n var matchedNodes = {};\n var matchedAttributes = {};\n settings = settings || {};\n settings.validate = 'validate' in settings ? settings.validate : true;\n settings.root_name = settings.root_name || 'body';\n var fixInvalidChildren = function (nodes) {\n var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i;\n var nonEmptyElements, whitespaceElements, nonSplitableElements, textBlockElements, specialElements, sibling, nextNode;\n nonSplitableElements = makeMap$4('tr,td,th,tbody,thead,tfoot,table');\n nonEmptyElements = schema.getNonEmptyElements();\n whitespaceElements = schema.getWhiteSpaceElements();\n textBlockElements = schema.getTextBlockElements();\n specialElements = schema.getSpecialElements();\n for (ni = 0; ni < nodes.length; ni++) {\n node = nodes[ni];\n if (!node.parent || node.fixed) {\n continue;\n }\n if (textBlockElements[node.name] && node.parent.name === 'li') {\n sibling = node.next;\n while (sibling) {\n if (textBlockElements[sibling.name]) {\n sibling.name = 'li';\n sibling.fixed = true;\n node.parent.insert(sibling, node.parent);\n } else {\n break;\n }\n sibling = sibling.next;\n }\n node.unwrap(node);\n continue;\n }\n parents = [node];\n for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent) {\n parents.push(parent);\n }\n if (parent && parents.length > 1) {\n parents.reverse();\n newParent = currentNode = filterNode(parents[0].clone());\n for (i = 0; i < parents.length - 1; i++) {\n if (schema.isValidChild(currentNode.name, parents[i].name)) {\n tempNode = filterNode(parents[i].clone());\n currentNode.append(tempNode);\n } else {\n tempNode = currentNode;\n }\n for (childNode = parents[i].firstChild; childNode && childNode !== parents[i + 1];) {\n nextNode = childNode.next;\n tempNode.append(childNode);\n childNode = nextNode;\n }\n currentNode = tempNode;\n }\n if (!isEmpty$2(schema, nonEmptyElements, whitespaceElements, newParent)) {\n parent.insert(newParent, parents[0], true);\n parent.insert(node, newParent);\n } else {\n parent.insert(node, parents[0], true);\n }\n parent = parents[0];\n if (isEmpty$2(schema, nonEmptyElements, whitespaceElements, parent) || hasOnlyChild(parent, 'br')) {\n parent.empty().remove();\n }\n } else if (node.parent) {\n if (node.name === 'li') {\n sibling = node.prev;\n if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {\n sibling.append(node);\n continue;\n }\n sibling = node.next;\n if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {\n sibling.insert(node, sibling.firstChild, true);\n continue;\n }\n node.wrap(filterNode(new Node$1('ul', 1)));\n continue;\n }\n if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) {\n node.wrap(filterNode(new Node$1('div', 1)));\n } else {\n if (specialElements[node.name]) {\n node.empty().remove();\n } else {\n node.unwrap();\n }\n }\n }\n }\n };\n var filterNode = function (node) {\n var i, name, list;\n name = node.name;\n if (name in nodeFilters) {\n list = matchedNodes[name];\n if (list) {\n list.push(node);\n } else {\n matchedNodes[name] = [node];\n }\n }\n i = attributeFilters.length;\n while (i--) {\n name = attributeFilters[i].name;\n if (name in node.attributes.map) {\n list = matchedAttributes[name];\n if (list) {\n list.push(node);\n } else {\n matchedAttributes[name] = [node];\n }\n }\n }\n return node;\n };\n var addNodeFilter = function (name, callback) {\n each$i(explode$3(name), function (name) {\n var list = nodeFilters[name];\n if (!list) {\n nodeFilters[name] = list = [];\n }\n list.push(callback);\n });\n };\n var getNodeFilters = function () {\n var out = [];\n for (var name in nodeFilters) {\n if (nodeFilters.hasOwnProperty(name)) {\n out.push({\n name: name,\n callbacks: nodeFilters[name]\n });\n }\n }\n return out;\n };\n var addAttributeFilter = function (name, callback) {\n each$i(explode$3(name), function (name) {\n var i;\n for (i = 0; i < attributeFilters.length; i++) {\n if (attributeFilters[i].name === name) {\n attributeFilters[i].callbacks.push(callback);\n return;\n }\n }\n attributeFilters.push({\n name: name,\n callbacks: [callback]\n });\n });\n };\n var getAttributeFilters = function () {\n return [].concat(attributeFilters);\n };\n var parse = function (html, args) {\n var parser, nodes, i, l, fi, fl, list, name;\n var blockElements;\n var invalidChildren = [];\n var isInWhiteSpacePreservedElement;\n var node;\n args = args || {};\n matchedNodes = {};\n matchedAttributes = {};\n blockElements = extend$3(makeMap$4('script,style,head,html,body,title,meta,param'), schema.getBlockElements());\n var nonEmptyElements = schema.getNonEmptyElements();\n var children = schema.children;\n var validate = settings.validate;\n var rootBlockName = 'forced_root_block' in args ? args.forced_root_block : settings.forced_root_block;\n var whiteSpaceElements = schema.getWhiteSpaceElements();\n var startWhiteSpaceRegExp = /^[ \\t\\r\\n]+/;\n var endWhiteSpaceRegExp = /[ \\t\\r\\n]+$/;\n var allWhiteSpaceRegExp = /[ \\t\\r\\n]+/g;\n var isAllWhiteSpaceRegExp = /^[ \\t\\r\\n]+$/;\n isInWhiteSpacePreservedElement = whiteSpaceElements.hasOwnProperty(args.context) || whiteSpaceElements.hasOwnProperty(settings.root_name);\n var addRootBlocks = function () {\n var node = rootNode.firstChild, next, rootBlockNode;\n var trim = function (rootBlockNode) {\n if (rootBlockNode) {\n node = rootBlockNode.firstChild;\n if (node && node.type === 3) {\n node.value = node.value.replace(startWhiteSpaceRegExp, '');\n }\n node = rootBlockNode.lastChild;\n if (node && node.type === 3) {\n node.value = node.value.replace(endWhiteSpaceRegExp, '');\n }\n }\n };\n if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) {\n return;\n }\n while (node) {\n next = node.next;\n if (node.type === 3 || node.type === 1 && node.name !== 'p' && !blockElements[node.name] && !node.attr('data-mce-type')) {\n if (!rootBlockNode) {\n rootBlockNode = createNode(rootBlockName, 1);\n rootBlockNode.attr(settings.forced_root_block_attrs);\n rootNode.insert(rootBlockNode, node);\n rootBlockNode.append(node);\n } else {\n rootBlockNode.append(node);\n }\n } else {\n trim(rootBlockNode);\n rootBlockNode = null;\n }\n node = next;\n }\n trim(rootBlockNode);\n };\n var createNode = function (name, type) {\n var node = new Node$1(name, type);\n var list;\n if (name in nodeFilters) {\n list = matchedNodes[name];\n if (list) {\n list.push(node);\n } else {\n matchedNodes[name] = [node];\n }\n }\n return node;\n };\n var removeWhitespaceBefore = function (node) {\n var textNode, textNodeNext, textVal, sibling;\n var blockElements = schema.getBlockElements();\n for (textNode = node.prev; textNode && textNode.type === 3;) {\n textVal = textNode.value.replace(endWhiteSpaceRegExp, '');\n if (textVal.length > 0) {\n textNode.value = textVal;\n return;\n }\n textNodeNext = textNode.next;\n if (textNodeNext) {\n if (textNodeNext.type === 3 && textNodeNext.value.length) {\n textNode = textNode.prev;\n continue;\n }\n if (!blockElements[textNodeNext.name] && textNodeNext.name !== 'script' && textNodeNext.name !== 'style') {\n textNode = textNode.prev;\n continue;\n }\n }\n sibling = textNode.prev;\n textNode.remove();\n textNode = sibling;\n }\n };\n var cloneAndExcludeBlocks = function (input) {\n var name;\n var output = {};\n for (name in input) {\n if (name !== 'li' && name !== 'p') {\n output[name] = input[name];\n }\n }\n return output;\n };\n parser = SaxParser$1({\n validate: validate,\n allow_script_urls: settings.allow_script_urls,\n allow_conditional_comments: settings.allow_conditional_comments,\n self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()),\n cdata: function (text) {\n node.append(createNode('#cdata', 4)).value = text;\n },\n text: function (text, raw) {\n var textNode;\n if (!isInWhiteSpacePreservedElement) {\n text = text.replace(allWhiteSpaceRegExp, ' ');\n if (isLineBreakNode(node.lastChild, blockElements)) {\n text = text.replace(startWhiteSpaceRegExp, '');\n }\n }\n if (text.length !== 0) {\n textNode = createNode('#text', 3);\n textNode.raw = !!raw;\n node.append(textNode).value = text;\n }\n },\n comment: function (text) {\n node.append(createNode('#comment', 8)).value = text;\n },\n pi: function (name, text) {\n node.append(createNode(name, 7)).value = text;\n removeWhitespaceBefore(node);\n },\n doctype: function (text) {\n var newNode;\n newNode = node.append(createNode('#doctype', 10));\n newNode.value = text;\n removeWhitespaceBefore(node);\n },\n start: function (name, attrs, empty) {\n var newNode, attrFiltersLen, elementRule, attrName, parent;\n elementRule = validate ? schema.getElementRule(name) : {};\n if (elementRule) {\n newNode = createNode(elementRule.outputName || name, 1);\n newNode.attributes = attrs;\n newNode.shortEnded = empty;\n node.append(newNode);\n parent = children[node.name];\n if (parent && children[newNode.name] && !parent[newNode.name]) {\n invalidChildren.push(newNode);\n }\n attrFiltersLen = attributeFilters.length;\n while (attrFiltersLen--) {\n attrName = attributeFilters[attrFiltersLen].name;\n if (attrName in attrs.map) {\n list = matchedAttributes[attrName];\n if (list) {\n list.push(newNode);\n } else {\n matchedAttributes[attrName] = [newNode];\n }\n }\n }\n if (blockElements[name]) {\n removeWhitespaceBefore(newNode);\n }\n if (!empty) {\n node = newNode;\n }\n if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {\n isInWhiteSpacePreservedElement = true;\n }\n }\n },\n end: function (name) {\n var textNode, elementRule, text, sibling, tempNode;\n elementRule = validate ? schema.getElementRule(name) : {};\n if (elementRule) {\n if (blockElements[name]) {\n if (!isInWhiteSpacePreservedElement) {\n textNode = node.firstChild;\n if (textNode && textNode.type === 3) {\n text = textNode.value.replace(startWhiteSpaceRegExp, '');\n if (text.length > 0) {\n textNode.value = text;\n textNode = textNode.next;\n } else {\n sibling = textNode.next;\n textNode.remove();\n textNode = sibling;\n while (textNode && textNode.type === 3) {\n text = textNode.value;\n sibling = textNode.next;\n if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {\n textNode.remove();\n textNode = sibling;\n }\n textNode = sibling;\n }\n }\n }\n textNode = node.lastChild;\n if (textNode && textNode.type === 3) {\n text = textNode.value.replace(endWhiteSpaceRegExp, '');\n if (text.length > 0) {\n textNode.value = text;\n textNode = textNode.prev;\n } else {\n sibling = textNode.prev;\n textNode.remove();\n textNode = sibling;\n while (textNode && textNode.type === 3) {\n text = textNode.value;\n sibling = textNode.prev;\n if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {\n textNode.remove();\n textNode = sibling;\n }\n textNode = sibling;\n }\n }\n }\n }\n }\n if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {\n isInWhiteSpacePreservedElement = false;\n }\n if (elementRule.removeEmpty && isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, node)) {\n if (!node.attributes.map.name && !node.attr('id')) {\n tempNode = node.parent;\n if (blockElements[node.name]) {\n node.empty().remove();\n } else {\n node.unwrap();\n }\n node = tempNode;\n return;\n }\n }\n if (elementRule.paddEmpty && (isPaddedWithNbsp(node) || isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, node))) {\n paddEmptyNode(settings, args, blockElements, node);\n }\n node = node.parent;\n }\n }\n }, schema);\n var rootNode = node = new Node$1(args.context || settings.root_name, 11);\n parser.parse(html);\n if (validate && invalidChildren.length) {\n if (!args.context) {\n fixInvalidChildren(invalidChildren);\n } else {\n args.invalid = true;\n }\n }\n if (rootBlockName && (rootNode.name === 'body' || args.isRootContent)) {\n addRootBlocks();\n }\n if (!args.invalid) {\n for (name in matchedNodes) {\n list = nodeFilters[name];\n nodes = matchedNodes[name];\n fi = nodes.length;\n while (fi--) {\n if (!nodes[fi].parent) {\n nodes.splice(fi, 1);\n }\n }\n for (i = 0, l = list.length; i < l; i++) {\n list[i](nodes, name, args);\n }\n }\n for (i = 0, l = attributeFilters.length; i < l; i++) {\n list = attributeFilters[i];\n if (list.name in matchedAttributes) {\n nodes = matchedAttributes[list.name];\n fi = nodes.length;\n while (fi--) {\n if (!nodes[fi].parent) {\n nodes.splice(fi, 1);\n }\n }\n for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) {\n list.callbacks[fi](nodes, list.name, args);\n }\n }\n }\n }\n return rootNode;\n };\n var exports = {\n schema: schema,\n addAttributeFilter: addAttributeFilter,\n getAttributeFilters: getAttributeFilters,\n addNodeFilter: addNodeFilter,\n getNodeFilters: getNodeFilters,\n filterNode: filterNode,\n parse: parse\n };\n register$2(exports, settings);\n LegacyFilter.register(exports, settings);\n return exports;\n }\n\n var addTempAttr = function (htmlParser, tempAttrs, name) {\n if (Tools.inArray(tempAttrs, name) === -1) {\n htmlParser.addAttributeFilter(name, function (nodes, name) {\n var i = nodes.length;\n while (i--) {\n nodes[i].attr(name, null);\n }\n });\n tempAttrs.push(name);\n }\n };\n var postProcess$1 = function (editor, args, content) {\n if (!args.no_events && editor) {\n var outArgs = Events.firePostProcess(editor, merge(args, { content: content }));\n return outArgs.content;\n } else {\n return content;\n }\n };\n var getHtmlFromNode = function (dom, node, args) {\n var html = Zwsp.trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node));\n return args.selection || isWsPreserveElement(Element.fromDom(node)) ? html : Tools.trim(html);\n };\n var parseHtml = function (htmlParser, html, args) {\n var parserArgs = args.selection ? merge({ forced_root_block: false }, args) : args;\n var rootNode = htmlParser.parse(html, parserArgs);\n DomSerializerFilters.trimTrailingBr(rootNode);\n return rootNode;\n };\n var serializeNode = function (settings, schema, node) {\n var htmlSerializer = HtmlSerializer(settings, schema);\n return htmlSerializer.serialize(node);\n };\n var toHtml = function (editor, settings, schema, rootNode, args) {\n var content = serializeNode(settings, schema, rootNode);\n return postProcess$1(editor, args, content);\n };\n function DomSerializer (settings, editor) {\n var dom, schema, htmlParser;\n var tempAttrs = ['data-mce-selected'];\n dom = editor && editor.dom ? editor.dom : DOMUtils$1.DOM;\n schema = editor && editor.schema ? editor.schema : Schema(settings);\n settings.entity_encoding = settings.entity_encoding || 'named';\n settings.remove_trailing_brs = 'remove_trailing_brs' in settings ? settings.remove_trailing_brs : true;\n htmlParser = DomParser(settings, schema);\n DomSerializerFilters.register(htmlParser, settings, dom);\n var serialize = function (node, parserArgs) {\n var args = merge({ format: 'html' }, parserArgs ? parserArgs : {});\n var targetNode = DomSerializerPreProcess.process(editor, node, args);\n var html = getHtmlFromNode(dom, targetNode, args);\n var rootNode = parseHtml(htmlParser, html, args);\n return args.format === 'tree' ? rootNode : toHtml(editor, settings, schema, rootNode, args);\n };\n return {\n schema: schema,\n addNodeFilter: htmlParser.addNodeFilter,\n addAttributeFilter: htmlParser.addAttributeFilter,\n serialize: serialize,\n addRules: function (rules) {\n schema.addValidElements(rules);\n },\n setRules: function (rules) {\n schema.setValidElements(rules);\n },\n addTempAttr: curry(addTempAttr, htmlParser, tempAttrs),\n getTempAttrs: function () {\n return tempAttrs;\n }\n };\n }\n\n function DomSerializer$1 (settings, editor) {\n var domSerializer = DomSerializer(settings, editor);\n return {\n schema: domSerializer.schema,\n addNodeFilter: domSerializer.addNodeFilter,\n addAttributeFilter: domSerializer.addAttributeFilter,\n serialize: domSerializer.serialize,\n addRules: domSerializer.addRules,\n setRules: domSerializer.setRules,\n addTempAttr: domSerializer.addTempAttr,\n getTempAttrs: domSerializer.getTempAttrs\n };\n }\n\n function BookmarkManager(selection) {\n return {\n getBookmark: curry(Bookmarks.getBookmark, selection),\n moveToBookmark: curry(Bookmarks.moveToBookmark, selection)\n };\n }\n (function (BookmarkManager) {\n BookmarkManager.isBookmarkNode = Bookmarks.isBookmarkNode;\n }(BookmarkManager || (BookmarkManager = {})));\n var BookmarkManager$1 = BookmarkManager;\n\n var isContentEditableFalse$a = NodeType.isContentEditableFalse;\n var isContentEditableTrue$5 = NodeType.isContentEditableTrue;\n var getContentEditableRoot$2 = function (root, node) {\n while (node && node !== root) {\n if (isContentEditableTrue$5(node) || isContentEditableFalse$a(node)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n };\n var ControlSelection = function (selection, editor) {\n var dom = editor.dom, each = Tools.each;\n var selectedElm, selectedElmGhost, resizeHelper, resizeHandles, selectedHandle;\n var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted;\n var width, height;\n var editableDoc = editor.getDoc(), rootDocument = domGlobals.document;\n var abs = Math.abs, round = Math.round, rootElement = editor.getBody();\n var startScrollWidth, startScrollHeight;\n resizeHandles = {\n nw: [\n 0,\n 0,\n -1,\n -1\n ],\n ne: [\n 1,\n 0,\n 1,\n -1\n ],\n se: [\n 1,\n 1,\n 1,\n 1\n ],\n sw: [\n 0,\n 1,\n -1,\n 1\n ]\n };\n var rootClass = '.mce-content-body';\n editor.contentStyles.push(rootClass + ' div.mce-resizehandle {' + 'position: absolute;' + 'border: 1px solid black;' + 'box-sizing: content-box;' + 'background: #FFF;' + 'width: 7px;' + 'height: 7px;' + 'z-index: 10000' + '}' + rootClass + ' .mce-resizehandle:hover {' + 'background: #000' + '}' + rootClass + ' img[data-mce-selected],' + rootClass + ' hr[data-mce-selected] {' + 'outline: 1px solid black;' + 'resize: none' + '}' + rootClass + ' .mce-clonedresizable {' + 'position: absolute;' + (Env.gecko ? '' : 'outline: 1px dashed black;') + 'opacity: .5;' + 'filter: alpha(opacity=50);' + 'z-index: 10000' + '}' + rootClass + ' .mce-resize-helper {' + 'background: #555;' + 'background: rgba(0,0,0,0.75);' + 'border-radius: 3px;' + 'border: 1px;' + 'color: white;' + 'display: none;' + 'font-family: sans-serif;' + 'font-size: 12px;' + 'white-space: nowrap;' + 'line-height: 14px;' + 'margin: 5px 10px;' + 'padding: 5px;' + 'position: absolute;' + 'z-index: 10001' + '}');\n var isImage = function (elm) {\n return elm && (elm.nodeName === 'IMG' || editor.dom.is(elm, 'figure.image'));\n };\n var isEventOnImageOutsideRange = function (evt, range) {\n return isImage(evt.target) && !RangePoint.isXYWithinRange(evt.clientX, evt.clientY, range);\n };\n var contextMenuSelectImage = function (evt) {\n var target = evt.target;\n if (isEventOnImageOutsideRange(evt, editor.selection.getRng()) && !evt.isDefaultPrevented()) {\n editor.selection.select(target);\n }\n };\n var getResizeTarget = function (elm) {\n return editor.dom.is(elm, 'figure.image') ? elm.querySelector('img') : elm;\n };\n var isResizable = function (elm) {\n var selector = editor.settings.object_resizing;\n if (selector === false || Env.iOS) {\n return false;\n }\n if (typeof selector !== 'string') {\n selector = 'table,img,figure.image,div';\n }\n if (elm.getAttribute('data-mce-resize') === 'false') {\n return false;\n }\n if (elm === editor.getBody()) {\n return false;\n }\n return is$1(Element.fromDom(elm), selector);\n };\n var resizeGhostElement = function (e) {\n var deltaX, deltaY, proportional;\n var resizeHelperX, resizeHelperY;\n deltaX = e.screenX - startX;\n deltaY = e.screenY - startY;\n width = deltaX * selectedHandle[2] + startW;\n height = deltaY * selectedHandle[3] + startH;\n width = width < 5 ? 5 : width;\n height = height < 5 ? 5 : height;\n if (isImage(selectedElm) && editor.settings.resize_img_proportional !== false) {\n proportional = !VK.modifierPressed(e);\n } else {\n proportional = VK.modifierPressed(e) || isImage(selectedElm) && selectedHandle[2] * selectedHandle[3] !== 0;\n }\n if (proportional) {\n if (abs(deltaX) > abs(deltaY)) {\n height = round(width * ratio);\n width = round(height / ratio);\n } else {\n width = round(height / ratio);\n height = round(width * ratio);\n }\n }\n dom.setStyles(getResizeTarget(selectedElmGhost), {\n width: width,\n height: height\n });\n resizeHelperX = selectedHandle.startPos.x + deltaX;\n resizeHelperY = selectedHandle.startPos.y + deltaY;\n resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0;\n resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0;\n dom.setStyles(resizeHelper, {\n left: resizeHelperX,\n top: resizeHelperY,\n display: 'block'\n });\n resizeHelper.innerHTML = width + ' × ' + height;\n if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {\n dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));\n }\n if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {\n dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));\n }\n deltaX = rootElement.scrollWidth - startScrollWidth;\n deltaY = rootElement.scrollHeight - startScrollHeight;\n if (deltaX + deltaY !== 0) {\n dom.setStyles(resizeHelper, {\n left: resizeHelperX - deltaX,\n top: resizeHelperY - deltaY\n });\n }\n if (!resizeStarted) {\n Events.fireObjectResizeStart(editor, selectedElm, startW, startH);\n resizeStarted = true;\n }\n };\n var endGhostResize = function () {\n resizeStarted = false;\n var setSizeProp = function (name, value) {\n if (value) {\n if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) {\n dom.setStyle(getResizeTarget(selectedElm), name, value);\n } else {\n dom.setAttrib(getResizeTarget(selectedElm), name, value);\n }\n }\n };\n setSizeProp('width', width);\n setSizeProp('height', height);\n dom.unbind(editableDoc, 'mousemove', resizeGhostElement);\n dom.unbind(editableDoc, 'mouseup', endGhostResize);\n if (rootDocument !== editableDoc) {\n dom.unbind(rootDocument, 'mousemove', resizeGhostElement);\n dom.unbind(rootDocument, 'mouseup', endGhostResize);\n }\n dom.remove(selectedElmGhost);\n dom.remove(resizeHelper);\n showResizeRect(selectedElm);\n Events.fireObjectResized(editor, selectedElm, width, height);\n dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style'));\n editor.nodeChanged();\n };\n var showResizeRect = function (targetElm) {\n var position, targetWidth, targetHeight, e, rect;\n hideResizeRect();\n unbindResizeHandleEvents();\n position = dom.getPos(targetElm, rootElement);\n selectedElmX = position.x;\n selectedElmY = position.y;\n rect = targetElm.getBoundingClientRect();\n targetWidth = rect.width || rect.right - rect.left;\n targetHeight = rect.height || rect.bottom - rect.top;\n if (selectedElm !== targetElm) {\n selectedElm = targetElm;\n width = height = 0;\n }\n e = editor.fire('ObjectSelected', { target: targetElm });\n if (isResizable(targetElm) && !e.isDefaultPrevented()) {\n each(resizeHandles, function (handle, name) {\n var handleElm;\n var startDrag = function (e) {\n startX = e.screenX;\n startY = e.screenY;\n startW = getResizeTarget(selectedElm).clientWidth;\n startH = getResizeTarget(selectedElm).clientHeight;\n ratio = startH / startW;\n selectedHandle = handle;\n handle.startPos = {\n x: targetWidth * handle[0] + selectedElmX,\n y: targetHeight * handle[1] + selectedElmY\n };\n startScrollWidth = rootElement.scrollWidth;\n startScrollHeight = rootElement.scrollHeight;\n selectedElmGhost = selectedElm.cloneNode(true);\n dom.addClass(selectedElmGhost, 'mce-clonedresizable');\n dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all');\n selectedElmGhost.contentEditable = false;\n selectedElmGhost.unSelectabe = true;\n dom.setStyles(selectedElmGhost, {\n left: selectedElmX,\n top: selectedElmY,\n margin: 0\n });\n selectedElmGhost.removeAttribute('data-mce-selected');\n rootElement.appendChild(selectedElmGhost);\n dom.bind(editableDoc, 'mousemove', resizeGhostElement);\n dom.bind(editableDoc, 'mouseup', endGhostResize);\n if (rootDocument !== editableDoc) {\n dom.bind(rootDocument, 'mousemove', resizeGhostElement);\n dom.bind(rootDocument, 'mouseup', endGhostResize);\n }\n resizeHelper = dom.add(rootElement, 'div', {\n 'class': 'mce-resize-helper',\n 'data-mce-bogus': 'all'\n }, startW + ' × ' + startH);\n };\n handleElm = dom.get('mceResizeHandle' + name);\n if (handleElm) {\n dom.remove(handleElm);\n }\n handleElm = dom.add(rootElement, 'div', {\n 'id': 'mceResizeHandle' + name,\n 'data-mce-bogus': 'all',\n 'class': 'mce-resizehandle',\n 'unselectable': true,\n 'style': 'cursor:' + name + '-resize; margin:0; padding:0'\n });\n if (Env.ie === 11) {\n handleElm.contentEditable = false;\n }\n dom.bind(handleElm, 'mousedown', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n startDrag(e);\n });\n handle.elm = handleElm;\n dom.setStyles(handleElm, {\n left: targetWidth * handle[0] + selectedElmX - handleElm.offsetWidth / 2,\n top: targetHeight * handle[1] + selectedElmY - handleElm.offsetHeight / 2\n });\n });\n } else {\n hideResizeRect();\n }\n selectedElm.setAttribute('data-mce-selected', '1');\n };\n var hideResizeRect = function () {\n var name, handleElm;\n unbindResizeHandleEvents();\n if (selectedElm) {\n selectedElm.removeAttribute('data-mce-selected');\n }\n for (name in resizeHandles) {\n handleElm = dom.get('mceResizeHandle' + name);\n if (handleElm) {\n dom.unbind(handleElm);\n dom.remove(handleElm);\n }\n }\n };\n var updateResizeRect = function (e) {\n var startElm, controlElm;\n var isChildOrEqual = function (node, parent) {\n if (node) {\n do {\n if (node === parent) {\n return true;\n }\n } while (node = node.parentNode);\n }\n };\n if (resizeStarted || editor.removed) {\n return;\n }\n each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function (img) {\n img.removeAttribute('data-mce-selected');\n });\n controlElm = e.type === 'mousedown' ? e.target : selection.getNode();\n controlElm = dom.$(controlElm).closest('table,img,figure.image,hr')[0];\n if (isChildOrEqual(controlElm, rootElement)) {\n disableGeckoResize();\n startElm = selection.getStart(true);\n if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) {\n showResizeRect(controlElm);\n return;\n }\n }\n hideResizeRect();\n };\n var isWithinContentEditableFalse = function (elm) {\n return isContentEditableFalse$a(getContentEditableRoot$2(editor.getBody(), elm));\n };\n var unbindResizeHandleEvents = function () {\n for (var name in resizeHandles) {\n var handle = resizeHandles[name];\n if (handle.elm) {\n dom.unbind(handle.elm);\n delete handle.elm;\n }\n }\n };\n var disableGeckoResize = function () {\n try {\n editor.getDoc().execCommand('enableObjectResizing', false, false);\n } catch (ex) {\n }\n };\n editor.on('init', function () {\n disableGeckoResize();\n if (Env.ie && Env.ie >= 11) {\n editor.on('mousedown click', function (e) {\n var target = e.target, nodeName = target.nodeName;\n if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) {\n if (e.button !== 2) {\n editor.selection.select(target, nodeName === 'TABLE');\n }\n if (e.type === 'mousedown') {\n editor.nodeChanged();\n }\n }\n });\n editor.dom.bind(rootElement, 'mscontrolselect', function (e) {\n var delayedSelect = function (node) {\n Delay.setEditorTimeout(editor, function () {\n editor.selection.select(node);\n });\n };\n if (isWithinContentEditableFalse(e.target)) {\n e.preventDefault();\n delayedSelect(e.target);\n return;\n }\n if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) {\n e.preventDefault();\n if (e.target.tagName === 'IMG') {\n delayedSelect(e.target);\n }\n }\n });\n }\n var throttledUpdateResizeRect = Delay.throttle(function (e) {\n if (!editor.composing) {\n updateResizeRect(e);\n }\n });\n editor.on('nodechange ResizeEditor ResizeWindow drop FullscreenStateChanged', throttledUpdateResizeRect);\n editor.on('keyup compositionend', function (e) {\n if (selectedElm && selectedElm.nodeName === 'TABLE') {\n throttledUpdateResizeRect(e);\n }\n });\n editor.on('hide blur', hideResizeRect);\n editor.on('contextmenu', contextMenuSelectImage);\n });\n editor.on('remove', unbindResizeHandleEvents);\n var destroy = function () {\n selectedElm = selectedElmGhost = null;\n };\n return {\n isResizable: isResizable,\n showResizeRect: showResizeRect,\n hideResizeRect: hideResizeRect,\n updateResizeRect: updateResizeRect,\n destroy: destroy\n };\n };\n\n var hasCeProperty = function (node) {\n return NodeType.isContentEditableTrue(node) || NodeType.isContentEditableFalse(node);\n };\n var findParent$1 = function (node, rootNode, predicate) {\n while (node && node !== rootNode) {\n if (predicate(node)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n };\n var findClosestIeRange = function (clientX, clientY, doc) {\n var element, rng, rects;\n element = doc.elementFromPoint(clientX, clientY);\n rng = doc.body.createTextRange();\n if (!element || element.tagName === 'HTML') {\n element = doc.body;\n }\n rng.moveToElementText(element);\n rects = Tools.toArray(rng.getClientRects());\n rects = rects.sort(function (a, b) {\n a = Math.abs(Math.max(a.top - clientY, a.bottom - clientY));\n b = Math.abs(Math.max(b.top - clientY, b.bottom - clientY));\n return a - b;\n });\n if (rects.length > 0) {\n clientY = (rects[0].bottom + rects[0].top) / 2;\n try {\n rng.moveToPoint(clientX, clientY);\n rng.collapse(true);\n return rng;\n } catch (ex) {\n }\n }\n return null;\n };\n var moveOutOfContentEditableFalse = function (rng, rootNode) {\n var parentElement = rng && rng.parentElement ? rng.parentElement() : null;\n return NodeType.isContentEditableFalse(findParent$1(parentElement, rootNode, hasCeProperty)) ? null : rng;\n };\n var fromPoint$1 = function (clientX, clientY, doc) {\n var rng, point;\n var pointDoc = doc;\n if (pointDoc.caretPositionFromPoint) {\n point = pointDoc.caretPositionFromPoint(clientX, clientY);\n if (point) {\n rng = doc.createRange();\n rng.setStart(point.offsetNode, point.offset);\n rng.collapse(true);\n }\n } else if (doc.caretRangeFromPoint) {\n rng = doc.caretRangeFromPoint(clientX, clientY);\n } else if (pointDoc.body.createTextRange) {\n rng = pointDoc.body.createTextRange();\n try {\n rng.moveToPoint(clientX, clientY);\n rng.collapse(true);\n } catch (ex) {\n rng = findClosestIeRange(clientX, clientY, doc);\n }\n return moveOutOfContentEditableFalse(rng, doc.body);\n }\n return rng;\n };\n var CaretRangeFromPoint = { fromPoint: fromPoint$1 };\n\n var processRanges = function (editor, ranges) {\n return map(ranges, function (range) {\n var evt = editor.fire('GetSelectionRange', { range: range });\n return evt.range !== range ? evt.range : range;\n });\n };\n var EventProcessRanges = { processRanges: processRanges };\n\n var fromElements = function (elements, scope) {\n var doc = scope || domGlobals.document;\n var fragment = doc.createDocumentFragment();\n each(elements, function (element) {\n fragment.appendChild(element.dom());\n });\n return Element.fromDom(fragment);\n };\n\n var tableModel = Immutable('element', 'width', 'rows');\n var tableRow = Immutable('element', 'cells');\n var cellPosition = Immutable('x', 'y');\n var getSpan = function (td, key) {\n var value = parseInt(get(td, key), 10);\n return isNaN(value) ? 1 : value;\n };\n var fillout = function (table, x, y, tr, td) {\n var rowspan = getSpan(td, 'rowspan');\n var colspan = getSpan(td, 'colspan');\n var rows = table.rows();\n for (var y2 = y; y2 < y + rowspan; y2++) {\n if (!rows[y2]) {\n rows[y2] = tableRow(deep(tr), []);\n }\n for (var x2 = x; x2 < x + colspan; x2++) {\n var cells = rows[y2].cells();\n cells[x2] = y2 === y && x2 === x ? td : shallow(td);\n }\n }\n };\n var cellExists = function (table, x, y) {\n var rows = table.rows();\n var cells = rows[y] ? rows[y].cells() : [];\n return !!cells[x];\n };\n var skipCellsX = function (table, x, y) {\n while (cellExists(table, x, y)) {\n x++;\n }\n return x;\n };\n var getWidth = function (rows) {\n return foldl(rows, function (acc, row) {\n return row.cells().length > acc ? row.cells().length : acc;\n }, 0);\n };\n var findElementPos = function (table, element) {\n var rows = table.rows();\n for (var y = 0; y < rows.length; y++) {\n var cells = rows[y].cells();\n for (var x = 0; x < cells.length; x++) {\n if (eq(cells[x], element)) {\n return Option.some(cellPosition(x, y));\n }\n }\n }\n return Option.none();\n };\n var extractRows = function (table, sx, sy, ex, ey) {\n var newRows = [];\n var rows = table.rows();\n for (var y = sy; y <= ey; y++) {\n var cells = rows[y].cells();\n var slice = sx < ex ? cells.slice(sx, ex + 1) : cells.slice(ex, sx + 1);\n newRows.push(tableRow(rows[y].element(), slice));\n }\n return newRows;\n };\n var subTable = function (table, startPos, endPos) {\n var sx = startPos.x(), sy = startPos.y();\n var ex = endPos.x(), ey = endPos.y();\n var newRows = sy < ey ? extractRows(table, sx, sy, ex, ey) : extractRows(table, sx, ey, ex, sy);\n return tableModel(table.element(), getWidth(newRows), newRows);\n };\n var createDomTable = function (table, rows) {\n var tableElement = shallow(table.element());\n var tableBody = Element.fromTag('tbody');\n append$1(tableBody, rows);\n append(tableElement, tableBody);\n return tableElement;\n };\n var modelRowsToDomRows = function (table) {\n return map(table.rows(), function (row) {\n var cells = map(row.cells(), function (cell) {\n var td = deep(cell);\n remove(td, 'colspan');\n remove(td, 'rowspan');\n return td;\n });\n var tr = shallow(row.element());\n append$1(tr, cells);\n return tr;\n });\n };\n var fromDom$1 = function (tableElm) {\n var table = tableModel(shallow(tableElm), 0, []);\n each(descendants$1(tableElm, 'tr'), function (tr, y) {\n each(descendants$1(tr, 'td,th'), function (td, x) {\n fillout(table, skipCellsX(table, x, y), y, tr, td);\n });\n });\n return tableModel(table.element(), getWidth(table.rows()), table.rows());\n };\n var toDom = function (table) {\n return createDomTable(table, modelRowsToDomRows(table));\n };\n var subsection = function (table, startElement, endElement) {\n return findElementPos(table, startElement).bind(function (startPos) {\n return findElementPos(table, endElement).map(function (endPos) {\n return subTable(table, startPos, endPos);\n });\n });\n };\n var SimpleTableModel = {\n fromDom: fromDom$1,\n toDom: toDom,\n subsection: subsection\n };\n\n var findParentListContainer = function (parents) {\n return find(parents, function (elm) {\n return name(elm) === 'ul' || name(elm) === 'ol';\n });\n };\n var getFullySelectedListWrappers = function (parents, rng) {\n return find(parents, function (elm) {\n return name(elm) === 'li' && hasAllContentsSelected(elm, rng);\n }).fold(constant([]), function (li) {\n return findParentListContainer(parents).map(function (listCont) {\n return [\n Element.fromTag('li'),\n Element.fromTag(name(listCont))\n ];\n }).getOr([]);\n });\n };\n var wrap$3 = function (innerElm, elms) {\n var wrapped = foldl(elms, function (acc, elm) {\n append(elm, acc);\n return elm;\n }, innerElm);\n return elms.length > 0 ? fromElements([wrapped]) : wrapped;\n };\n var directListWrappers = function (commonAnchorContainer) {\n if (isListItem(commonAnchorContainer)) {\n return parent(commonAnchorContainer).filter(isList).fold(constant([]), function (listElm) {\n return [\n commonAnchorContainer,\n listElm\n ];\n });\n } else {\n return isList(commonAnchorContainer) ? [commonAnchorContainer] : [];\n }\n };\n var getWrapElements = function (rootNode, rng) {\n var commonAnchorContainer = Element.fromDom(rng.commonAncestorContainer);\n var parents = Parents.parentsAndSelf(commonAnchorContainer, rootNode);\n var wrapElements = filter(parents, function (elm) {\n return isInline(elm) || isHeading(elm);\n });\n var listWrappers = getFullySelectedListWrappers(parents, rng);\n var allWrappers = wrapElements.concat(listWrappers.length ? listWrappers : directListWrappers(commonAnchorContainer));\n return map(allWrappers, shallow);\n };\n var emptyFragment = function () {\n return fromElements([]);\n };\n var getFragmentFromRange = function (rootNode, rng) {\n return wrap$3(Element.fromDom(rng.cloneContents()), getWrapElements(rootNode, rng));\n };\n var getParentTable = function (rootElm, cell) {\n return ancestor$1(cell, 'table', curry(eq, rootElm));\n };\n var getTableFragment = function (rootNode, selectedTableCells) {\n return getParentTable(rootNode, selectedTableCells[0]).bind(function (tableElm) {\n var firstCell = selectedTableCells[0];\n var lastCell = selectedTableCells[selectedTableCells.length - 1];\n var fullTableModel = SimpleTableModel.fromDom(tableElm);\n return SimpleTableModel.subsection(fullTableModel, firstCell, lastCell).map(function (sectionedTableModel) {\n return fromElements([SimpleTableModel.toDom(sectionedTableModel)]);\n });\n }).getOrThunk(emptyFragment);\n };\n var getSelectionFragment = function (rootNode, ranges) {\n return ranges.length > 0 && ranges[0].collapsed ? emptyFragment() : getFragmentFromRange(rootNode, ranges[0]);\n };\n var read$4 = function (rootNode, ranges) {\n var selectedCells = TableCellSelection.getCellsFromElementOrRanges(ranges, rootNode);\n return selectedCells.length > 0 ? getTableFragment(rootNode, selectedCells) : getSelectionFragment(rootNode, ranges);\n };\n var FragmentReader = { read: read$4 };\n\n var getTextContent = function (editor) {\n return Option.from(editor.selection.getRng()).map(function (rng) {\n var bin = editor.dom.add(editor.getBody(), 'div', {\n 'data-mce-bogus': 'all',\n 'style': 'overflow: hidden; opacity: 0;'\n }, rng.cloneContents());\n var text = Zwsp.trim(bin.innerText);\n editor.dom.remove(bin);\n return text;\n }).getOr('');\n };\n var getHtmlContent = function (editor, args) {\n var rng = editor.selection.getRng(), tmpElm = editor.dom.create('body');\n var sel = editor.selection.getSel();\n var fragment;\n var ranges = EventProcessRanges.processRanges(editor, MultiRange.getRanges(sel));\n fragment = args.contextual ? FragmentReader.read(Element.fromDom(editor.getBody()), ranges).dom() : rng.cloneContents();\n if (fragment) {\n tmpElm.appendChild(fragment);\n }\n return editor.selection.serializer.serialize(tmpElm, args);\n };\n var getContent = function (editor, args) {\n if (args === void 0) {\n args = {};\n }\n args.get = true;\n args.format = args.format || 'html';\n args.selection = true;\n args = editor.fire('BeforeGetContent', args);\n if (args.isDefaultPrevented()) {\n editor.fire('GetContent', args);\n return args.content;\n }\n if (args.format === 'text') {\n return getTextContent(editor);\n } else {\n args.getInner = true;\n var content = getHtmlContent(editor, args);\n if (args.format === 'tree') {\n return content;\n } else {\n args.content = editor.selection.isCollapsed() ? '' : content;\n editor.fire('GetContent', args);\n return args.content;\n }\n }\n };\n var GetSelectionContent = { getContent: getContent };\n\n var setupArgs = function (args, content) {\n return __assign(__assign({ format: 'html' }, args), {\n set: true,\n selection: true,\n content: content\n });\n };\n var cleanContent = function (editor, args) {\n if (args.format !== 'raw') {\n var node = editor.parser.parse(args.content, __assign({\n isRootContent: true,\n forced_root_block: false\n }, args));\n return HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(node);\n } else {\n return args.content;\n }\n };\n var setContent = function (editor, content, args) {\n var contentArgs = setupArgs(args, content);\n var rng = editor.selection.getRng(), caretNode;\n var doc = editor.getDoc();\n var frag, temp;\n if (!contentArgs.no_events) {\n contentArgs = editor.fire('BeforeSetContent', contentArgs);\n if (contentArgs.isDefaultPrevented()) {\n editor.fire('SetContent', contentArgs);\n return;\n }\n }\n content = cleanContent(editor, contentArgs);\n if (rng.insertNode) {\n content += '_';\n if (rng.startContainer === doc && rng.endContainer === doc) {\n doc.body.innerHTML = content;\n } else {\n rng.deleteContents();\n if (doc.body.childNodes.length === 0) {\n doc.body.innerHTML = content;\n } else {\n if (rng.createContextualFragment) {\n rng.insertNode(rng.createContextualFragment(content));\n } else {\n frag = doc.createDocumentFragment();\n temp = doc.createElement('div');\n frag.appendChild(temp);\n temp.outerHTML = content;\n rng.insertNode(frag);\n }\n }\n }\n caretNode = editor.dom.get('__caret');\n rng = doc.createRange();\n rng.setStartBefore(caretNode);\n rng.setEndBefore(caretNode);\n editor.selection.setRng(rng);\n editor.dom.remove('__caret');\n try {\n editor.selection.setRng(rng);\n } catch (ex) {\n }\n } else {\n var anyRng = rng;\n if (anyRng.item) {\n doc.execCommand('Delete', false, null);\n anyRng = editor.selection.getRng();\n }\n if (/^\\s+/.test(content)) {\n anyRng.pasteHTML('_' + content);\n editor.dom.remove('__mce_tmp');\n } else {\n anyRng.pasteHTML(content);\n }\n }\n if (!contentArgs.no_events) {\n editor.fire('SetContent', contentArgs);\n }\n };\n var SetSelectionContent = { setContent: setContent };\n\n var getEndpointElement = function (root, rng, start, real, resolve) {\n var container = start ? rng.startContainer : rng.endContainer;\n var offset = start ? rng.startOffset : rng.endOffset;\n return Option.from(container).map(Element.fromDom).map(function (elm) {\n return !real || !rng.collapsed ? child(elm, resolve(elm, offset)).getOr(elm) : elm;\n }).bind(function (elm) {\n return isElement(elm) ? Option.some(elm) : parent(elm);\n }).map(function (elm) {\n return elm.dom();\n }).getOr(root);\n };\n var getStart$2 = function (root, rng, real) {\n return getEndpointElement(root, rng, true, real, function (elm, offset) {\n return Math.min(childNodesCount(elm), offset);\n });\n };\n var getEnd = function (root, rng, real) {\n return getEndpointElement(root, rng, false, real, function (elm, offset) {\n return offset > 0 ? offset - 1 : offset;\n });\n };\n var skipEmptyTextNodes = function (node, forwards) {\n var orig = node;\n while (node && NodeType.isText(node) && node.length === 0) {\n node = forwards ? node.nextSibling : node.previousSibling;\n }\n return node || orig;\n };\n var getNode$1 = function (root, rng) {\n var elm, startContainer, endContainer, startOffset, endOffset;\n if (!rng) {\n return root;\n }\n startContainer = rng.startContainer;\n endContainer = rng.endContainer;\n startOffset = rng.startOffset;\n endOffset = rng.endOffset;\n elm = rng.commonAncestorContainer;\n if (!rng.collapsed) {\n if (startContainer === endContainer) {\n if (endOffset - startOffset < 2) {\n if (startContainer.hasChildNodes()) {\n elm = startContainer.childNodes[startOffset];\n }\n }\n }\n if (startContainer.nodeType === 3 && endContainer.nodeType === 3) {\n if (startContainer.length === startOffset) {\n startContainer = skipEmptyTextNodes(startContainer.nextSibling, true);\n } else {\n startContainer = startContainer.parentNode;\n }\n if (endOffset === 0) {\n endContainer = skipEmptyTextNodes(endContainer.previousSibling, false);\n } else {\n endContainer = endContainer.parentNode;\n }\n if (startContainer && startContainer === endContainer) {\n return startContainer;\n }\n }\n }\n if (elm && elm.nodeType === 3) {\n return elm.parentNode;\n }\n return elm;\n };\n var getSelectedBlocks = function (dom, rng, startElm, endElm) {\n var node, root;\n var selectedBlocks = [];\n root = dom.getRoot();\n startElm = dom.getParent(startElm || getStart$2(root, rng, rng.collapsed), dom.isBlock);\n endElm = dom.getParent(endElm || getEnd(root, rng, rng.collapsed), dom.isBlock);\n if (startElm && startElm !== root) {\n selectedBlocks.push(startElm);\n }\n if (startElm && endElm && startElm !== endElm) {\n node = startElm;\n var walker = new TreeWalker(startElm, root);\n while ((node = walker.next()) && node !== endElm) {\n if (dom.isBlock(node)) {\n selectedBlocks.push(node);\n }\n }\n }\n if (endElm && startElm !== endElm && endElm !== root) {\n selectedBlocks.push(endElm);\n }\n return selectedBlocks;\n };\n var select$1 = function (dom, node, content) {\n return Option.from(node).map(function (node) {\n var idx = dom.nodeIndex(node);\n var rng = dom.createRng();\n rng.setStart(node.parentNode, idx);\n rng.setEnd(node.parentNode, idx + 1);\n if (content) {\n moveEndPoint$1(dom, rng, node, true);\n moveEndPoint$1(dom, rng, node, false);\n }\n return rng;\n });\n };\n\n var each$j = Tools.each;\n var isNativeIeSelection = function (rng) {\n return !!rng.select;\n };\n var isAttachedToDom = function (node) {\n return !!(node && node.ownerDocument) && contains$3(Element.fromDom(node.ownerDocument), Element.fromDom(node));\n };\n var isValidRange = function (rng) {\n if (!rng) {\n return false;\n } else if (isNativeIeSelection(rng)) {\n return true;\n } else {\n return isAttachedToDom(rng.startContainer) && isAttachedToDom(rng.endContainer);\n }\n };\n var Selection$1 = function (dom, win, serializer, editor) {\n var bookmarkManager, controlSelection;\n var selectedRange, explicitRange, selectorChangedData;\n var setCursorLocation = function (node, offset) {\n var rng = dom.createRng();\n if (!node) {\n moveEndPoint$1(dom, rng, editor.getBody(), true);\n setRng(rng);\n } else {\n rng.setStart(node, offset);\n rng.setEnd(node, offset);\n setRng(rng);\n collapse(false);\n }\n };\n var getContent = function (args) {\n return GetSelectionContent.getContent(editor, args);\n };\n var setContent = function (content, args) {\n return SetSelectionContent.setContent(editor, content, args);\n };\n var getStart = function (real) {\n return getStart$2(editor.getBody(), getRng(), real);\n };\n var getEnd$1 = function (real) {\n return getEnd(editor.getBody(), getRng(), real);\n };\n var getBookmark = function (type, normalized) {\n return bookmarkManager.getBookmark(type, normalized);\n };\n var moveToBookmark = function (bookmark) {\n return bookmarkManager.moveToBookmark(bookmark);\n };\n var select = function (node, content) {\n select$1(dom, node, content).each(setRng);\n return node;\n };\n var isCollapsed = function () {\n var rng = getRng(), sel = getSel();\n if (!rng || rng.item) {\n return false;\n }\n if (rng.compareEndPoints) {\n return rng.compareEndPoints('StartToEnd', rng) === 0;\n }\n return !sel || rng.collapsed;\n };\n var collapse = function (toStart) {\n var rng = getRng();\n rng.collapse(!!toStart);\n setRng(rng);\n };\n var getSel = function () {\n return win.getSelection ? win.getSelection() : win.document.selection;\n };\n var getRng = function () {\n var selection, rng, elm, doc;\n var tryCompareBoundaryPoints = function (how, sourceRange, destinationRange) {\n try {\n return sourceRange.compareBoundaryPoints(how, destinationRange);\n } catch (ex) {\n return -1;\n }\n };\n if (!win) {\n return null;\n }\n doc = win.document;\n if (typeof doc === 'undefined' || doc === null) {\n return null;\n }\n if (editor.bookmark !== undefined && EditorFocus.hasFocus(editor) === false) {\n var bookmark = SelectionBookmark.getRng(editor);\n if (bookmark.isSome()) {\n return bookmark.map(function (r) {\n return EventProcessRanges.processRanges(editor, [r])[0];\n }).getOr(doc.createRange());\n }\n }\n try {\n if ((selection = getSel()) && !NodeType.isRestrictedNode(selection.anchorNode)) {\n if (selection.rangeCount > 0) {\n rng = selection.getRangeAt(0);\n } else {\n rng = selection.createRange ? selection.createRange() : doc.createRange();\n }\n }\n } catch (ex) {\n }\n rng = EventProcessRanges.processRanges(editor, [rng])[0];\n if (!rng) {\n rng = doc.createRange ? doc.createRange() : doc.body.createTextRange();\n }\n if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) {\n elm = dom.getRoot();\n rng.setStart(elm, 0);\n rng.setEnd(elm, 0);\n }\n if (selectedRange && explicitRange) {\n if (tryCompareBoundaryPoints(rng.START_TO_START, rng, selectedRange) === 0 && tryCompareBoundaryPoints(rng.END_TO_END, rng, selectedRange) === 0) {\n rng = explicitRange;\n } else {\n selectedRange = null;\n explicitRange = null;\n }\n }\n return rng;\n };\n var setRng = function (rng, forward) {\n var sel, node, evt;\n if (!isValidRange(rng)) {\n return;\n }\n var ieRange = isNativeIeSelection(rng) ? rng : null;\n if (ieRange) {\n explicitRange = null;\n try {\n ieRange.select();\n } catch (ex) {\n }\n return;\n }\n sel = getSel();\n evt = editor.fire('SetSelectionRange', {\n range: rng,\n forward: forward\n });\n rng = evt.range;\n if (sel) {\n explicitRange = rng;\n try {\n sel.removeAllRanges();\n sel.addRange(rng);\n } catch (ex) {\n }\n if (forward === false && sel.extend) {\n sel.collapse(rng.endContainer, rng.endOffset);\n sel.extend(rng.startContainer, rng.startOffset);\n }\n selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n }\n if (!rng.collapsed && rng.startContainer === rng.endContainer && sel.setBaseAndExtent && !Env.ie) {\n if (rng.endOffset - rng.startOffset < 2) {\n if (rng.startContainer.hasChildNodes()) {\n node = rng.startContainer.childNodes[rng.startOffset];\n if (node && node.tagName === 'IMG') {\n sel.setBaseAndExtent(rng.startContainer, rng.startOffset, rng.endContainer, rng.endOffset);\n if (sel.anchorNode !== rng.startContainer || sel.focusNode !== rng.endContainer) {\n sel.setBaseAndExtent(node, 0, node, 1);\n }\n }\n }\n }\n }\n editor.fire('AfterSetSelectionRange', {\n range: rng,\n forward: forward\n });\n };\n var setNode = function (elm) {\n setContent(dom.getOuterHTML(elm));\n return elm;\n };\n var getNode = function () {\n return getNode$1(editor.getBody(), getRng());\n };\n var getSelectedBlocks$1 = function (startElm, endElm) {\n return getSelectedBlocks(dom, getRng(), startElm, endElm);\n };\n var isForward = function () {\n var sel = getSel();\n var anchorRange, focusRange;\n if (!sel || !sel.anchorNode || !sel.focusNode) {\n return true;\n }\n anchorRange = dom.createRng();\n anchorRange.setStart(sel.anchorNode, sel.anchorOffset);\n anchorRange.collapse(true);\n focusRange = dom.createRng();\n focusRange.setStart(sel.focusNode, sel.focusOffset);\n focusRange.collapse(true);\n return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0;\n };\n var normalize = function () {\n var rng = getRng();\n var sel = getSel();\n if (!MultiRange.hasMultipleRanges(sel) && hasAnyRanges(editor)) {\n var normRng = NormalizeRange.normalize(dom, rng);\n normRng.each(function (normRng) {\n setRng(normRng, isForward());\n });\n return normRng.getOr(rng);\n }\n return rng;\n };\n var selectorChanged = function (selector, callback) {\n var currentSelectors;\n if (!selectorChangedData) {\n selectorChangedData = {};\n currentSelectors = {};\n editor.on('NodeChange', function (e) {\n var node = e.element, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {};\n each$j(selectorChangedData, function (callbacks, selector) {\n each$j(parents, function (node) {\n if (dom.is(node, selector)) {\n if (!currentSelectors[selector]) {\n each$j(callbacks, function (callback) {\n callback(true, {\n node: node,\n selector: selector,\n parents: parents\n });\n });\n currentSelectors[selector] = callbacks;\n }\n matchedSelectors[selector] = callbacks;\n return false;\n }\n });\n });\n each$j(currentSelectors, function (callbacks, selector) {\n if (!matchedSelectors[selector]) {\n delete currentSelectors[selector];\n each$j(callbacks, function (callback) {\n callback(false, {\n node: node,\n selector: selector,\n parents: parents\n });\n });\n }\n });\n });\n }\n if (!selectorChangedData[selector]) {\n selectorChangedData[selector] = [];\n }\n selectorChangedData[selector].push(callback);\n return exports;\n };\n var getScrollContainer = function () {\n var scrollContainer;\n var node = dom.getRoot();\n while (node && node.nodeName !== 'BODY') {\n if (node.scrollHeight > node.clientHeight) {\n scrollContainer = node;\n break;\n }\n node = node.parentNode;\n }\n return scrollContainer;\n };\n var scrollIntoView = function (elm, alignToTop) {\n return ScrollIntoView.scrollElementIntoView(editor, elm, alignToTop);\n };\n var placeCaretAt = function (clientX, clientY) {\n return setRng(CaretRangeFromPoint.fromPoint(clientX, clientY, editor.getDoc()));\n };\n var getBoundingClientRect = function () {\n var rng = getRng();\n return rng.collapsed ? CaretPosition$1.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect();\n };\n var destroy = function () {\n win = selectedRange = explicitRange = null;\n controlSelection.destroy();\n };\n var exports = {\n bookmarkManager: null,\n controlSelection: null,\n dom: dom,\n win: win,\n serializer: serializer,\n editor: editor,\n collapse: collapse,\n setCursorLocation: setCursorLocation,\n getContent: getContent,\n setContent: setContent,\n getBookmark: getBookmark,\n moveToBookmark: moveToBookmark,\n select: select,\n isCollapsed: isCollapsed,\n isForward: isForward,\n setNode: setNode,\n getNode: getNode,\n getSel: getSel,\n setRng: setRng,\n getRng: getRng,\n getStart: getStart,\n getEnd: getEnd$1,\n getSelectedBlocks: getSelectedBlocks$1,\n normalize: normalize,\n selectorChanged: selectorChanged,\n getScrollContainer: getScrollContainer,\n scrollIntoView: scrollIntoView,\n placeCaretAt: placeCaretAt,\n getBoundingClientRect: getBoundingClientRect,\n destroy: destroy\n };\n bookmarkManager = BookmarkManager$1(exports);\n controlSelection = ControlSelection(exports, editor);\n exports.bookmarkManager = bookmarkManager;\n exports.controlSelection = controlSelection;\n return exports;\n };\n\n var BreakType;\n (function (BreakType) {\n BreakType[BreakType['Br'] = 0] = 'Br';\n BreakType[BreakType['Block'] = 1] = 'Block';\n BreakType[BreakType['Wrap'] = 2] = 'Wrap';\n BreakType[BreakType['Eol'] = 3] = 'Eol';\n }(BreakType || (BreakType = {})));\n var flip = function (direction, positions) {\n return direction === HDirection.Backwards ? positions.reverse() : positions;\n };\n var walk$3 = function (direction, caretWalker, pos) {\n return direction === HDirection.Forwards ? caretWalker.next(pos) : caretWalker.prev(pos);\n };\n var getBreakType = function (scope, direction, currentPos, nextPos) {\n if (NodeType.isBr(nextPos.getNode(direction === HDirection.Forwards))) {\n return BreakType.Br;\n } else if (isInSameBlock(currentPos, nextPos) === false) {\n return BreakType.Block;\n } else {\n return BreakType.Wrap;\n }\n };\n var getPositionsUntil = function (predicate, direction, scope, start) {\n var caretWalker = CaretWalker(scope);\n var currentPos = start, nextPos;\n var positions = [];\n while (currentPos) {\n nextPos = walk$3(direction, caretWalker, currentPos);\n if (!nextPos) {\n break;\n }\n if (NodeType.isBr(nextPos.getNode(false))) {\n if (direction === HDirection.Forwards) {\n return {\n positions: flip(direction, positions).concat([nextPos]),\n breakType: BreakType.Br,\n breakAt: Option.some(nextPos)\n };\n } else {\n return {\n positions: flip(direction, positions),\n breakType: BreakType.Br,\n breakAt: Option.some(nextPos)\n };\n }\n }\n if (!nextPos.isVisible()) {\n currentPos = nextPos;\n continue;\n }\n if (predicate(currentPos, nextPos)) {\n var breakType = getBreakType(scope, direction, currentPos, nextPos);\n return {\n positions: flip(direction, positions),\n breakType: breakType,\n breakAt: Option.some(nextPos)\n };\n }\n positions.push(nextPos);\n currentPos = nextPos;\n }\n return {\n positions: flip(direction, positions),\n breakType: BreakType.Eol,\n breakAt: Option.none()\n };\n };\n var getAdjacentLinePositions = function (direction, getPositionsUntilBreak, scope, start) {\n return getPositionsUntilBreak(scope, start).breakAt.map(function (pos) {\n var positions = getPositionsUntilBreak(scope, pos).positions;\n return direction === HDirection.Backwards ? positions.concat(pos) : [pos].concat(positions);\n }).getOr([]);\n };\n var findClosestHorizontalPositionFromPoint = function (positions, x) {\n return foldl(positions, function (acc, newPos) {\n return acc.fold(function () {\n return Option.some(newPos);\n }, function (lastPos) {\n return lift2(head(lastPos.getClientRects()), head(newPos.getClientRects()), function (lastRect, newRect) {\n var lastDist = Math.abs(x - lastRect.left);\n var newDist = Math.abs(x - newRect.left);\n return newDist <= lastDist ? newPos : lastPos;\n }).or(acc);\n });\n }, Option.none());\n };\n var findClosestHorizontalPosition = function (positions, pos) {\n return head(pos.getClientRects()).bind(function (targetRect) {\n return findClosestHorizontalPositionFromPoint(positions, targetRect.left);\n });\n };\n var getPositionsUntilPreviousLine = curry(getPositionsUntil, CaretPosition.isAbove, -1);\n var getPositionsUntilNextLine = curry(getPositionsUntil, CaretPosition.isBelow, 1);\n var isAtFirstLine = function (scope, pos) {\n return getPositionsUntilPreviousLine(scope, pos).breakAt.isNone();\n };\n var isAtLastLine = function (scope, pos) {\n return getPositionsUntilNextLine(scope, pos).breakAt.isNone();\n };\n var getPositionsAbove = curry(getAdjacentLinePositions, -1, getPositionsUntilPreviousLine);\n var getPositionsBelow = curry(getAdjacentLinePositions, 1, getPositionsUntilNextLine);\n var getFirstLinePositions = function (scope) {\n return CaretFinder.firstPositionIn(scope).map(function (pos) {\n return [pos].concat(getPositionsUntilNextLine(scope, pos).positions);\n }).getOr([]);\n };\n var getLastLinePositions = function (scope) {\n return CaretFinder.lastPositionIn(scope).map(function (pos) {\n return getPositionsUntilPreviousLine(scope, pos).positions.concat(pos);\n }).getOr([]);\n };\n\n var isContentEditableFalse$b = NodeType.isContentEditableFalse;\n var getSelectedNode$1 = getSelectedNode;\n var moveToCeFalseHorizontally = function (direction, editor, getNextPosFn, range) {\n var forwards = direction === HDirection.Forwards;\n var isBeforeContentEditableFalseFn = forwards ? isBeforeContentEditableFalse : isAfterContentEditableFalse;\n if (!range.collapsed) {\n var node = getSelectedNode$1(range);\n if (isContentEditableFalse$b(node)) {\n return showCaret(direction, editor, node, direction === HDirection.Backwards, true);\n }\n }\n var rangeIsInContainerBlock = isRangeInCaretContainerBlock(range);\n var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);\n if (isBeforeContentEditableFalseFn(caretPosition)) {\n return selectNode(editor, caretPosition.getNode(!forwards));\n }\n var nextCaretPosition = InlineUtils.normalizePosition(forwards, getNextPosFn(caretPosition));\n if (!nextCaretPosition) {\n if (rangeIsInContainerBlock) {\n return range;\n }\n return null;\n }\n if (isBeforeContentEditableFalseFn(nextCaretPosition)) {\n return showCaret(direction, editor, nextCaretPosition.getNode(!forwards), forwards, true);\n }\n var peekCaretPosition = getNextPosFn(nextCaretPosition);\n if (peekCaretPosition && isBeforeContentEditableFalseFn(peekCaretPosition)) {\n if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) {\n return showCaret(direction, editor, peekCaretPosition.getNode(!forwards), forwards, true);\n }\n }\n if (rangeIsInContainerBlock) {\n return renderRangeCaret(editor, nextCaretPosition.toRange(), true);\n }\n return null;\n };\n var moveToCeFalseVertically = function (direction, editor, walkerFn, range) {\n var caretPosition, linePositions, nextLinePositions;\n var closestNextLineRect, caretClientRect, clientX;\n var dist1, dist2, contentEditableFalseNode;\n contentEditableFalseNode = getSelectedNode$1(range);\n caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);\n linePositions = walkerFn(editor.getBody(), isAboveLine(1), caretPosition);\n nextLinePositions = filter(linePositions, isLine(1));\n caretClientRect = ArrUtils.last(caretPosition.getClientRects());\n if (isBeforeContentEditableFalse(caretPosition) || isBeforeTable(caretPosition)) {\n contentEditableFalseNode = caretPosition.getNode();\n }\n if (isAfterContentEditableFalse(caretPosition) || isAfterTable(caretPosition)) {\n contentEditableFalseNode = caretPosition.getNode(true);\n }\n if (!caretClientRect) {\n return null;\n }\n clientX = caretClientRect.left;\n closestNextLineRect = findClosestClientRect(nextLinePositions, clientX);\n if (closestNextLineRect) {\n if (isContentEditableFalse$b(closestNextLineRect.node)) {\n dist1 = Math.abs(clientX - closestNextLineRect.left);\n dist2 = Math.abs(clientX - closestNextLineRect.right);\n return showCaret(direction, editor, closestNextLineRect.node, dist1 < dist2, true);\n }\n }\n if (contentEditableFalseNode) {\n var caretPositions = positionsUntil(direction, editor.getBody(), isAboveLine(1), contentEditableFalseNode);\n closestNextLineRect = findClosestClientRect(filter(caretPositions, isLine(1)), clientX);\n if (closestNextLineRect) {\n return renderRangeCaret(editor, closestNextLineRect.position.toRange(), true);\n }\n closestNextLineRect = ArrUtils.last(filter(caretPositions, isLine(0)));\n if (closestNextLineRect) {\n return renderRangeCaret(editor, closestNextLineRect.position.toRange(), true);\n }\n }\n };\n var createTextBlock = function (editor) {\n var textBlock = editor.dom.create(Settings.getForcedRootBlock(editor));\n if (!Env.ie || Env.ie >= 11) {\n textBlock.innerHTML = '
';\n }\n return textBlock;\n };\n var exitPreBlock = function (editor, direction, range) {\n var pre, caretPos, newBlock;\n var caretWalker = CaretWalker(editor.getBody());\n var getNextVisualCaretPosition = curry(getVisualCaretPosition, caretWalker.next);\n var getPrevVisualCaretPosition = curry(getVisualCaretPosition, caretWalker.prev);\n if (range.collapsed && editor.settings.forced_root_block) {\n pre = editor.dom.getParent(range.startContainer, 'PRE');\n if (!pre) {\n return;\n }\n if (direction === 1) {\n caretPos = getNextVisualCaretPosition(CaretPosition$1.fromRangeStart(range));\n } else {\n caretPos = getPrevVisualCaretPosition(CaretPosition$1.fromRangeStart(range));\n }\n if (!caretPos) {\n newBlock = createTextBlock(editor);\n if (direction === 1) {\n editor.$(pre).after(newBlock);\n } else {\n editor.$(pre).before(newBlock);\n }\n editor.selection.select(newBlock, true);\n editor.selection.collapse();\n }\n }\n };\n var getHorizontalRange = function (editor, forward) {\n var caretWalker = CaretWalker(editor.getBody());\n var getNextVisualCaretPosition = curry(getVisualCaretPosition, caretWalker.next);\n var getPrevVisualCaretPosition = curry(getVisualCaretPosition, caretWalker.prev);\n var newRange;\n var direction = forward ? HDirection.Forwards : HDirection.Backwards;\n var getNextPosFn = forward ? getNextVisualCaretPosition : getPrevVisualCaretPosition;\n var range = editor.selection.getRng();\n newRange = moveToCeFalseHorizontally(direction, editor, getNextPosFn, range);\n if (newRange) {\n return newRange;\n }\n newRange = exitPreBlock(editor, direction, range);\n if (newRange) {\n return newRange;\n }\n return null;\n };\n var getVerticalRange = function (editor, down) {\n var newRange;\n var direction = down ? 1 : -1;\n var walkerFn = down ? downUntil : upUntil;\n var range = editor.selection.getRng();\n newRange = moveToCeFalseVertically(direction, editor, walkerFn, range);\n if (newRange) {\n return newRange;\n }\n newRange = exitPreBlock(editor, direction, range);\n if (newRange) {\n return newRange;\n }\n return null;\n };\n var moveH = function (editor, forward) {\n return function () {\n var newRng = getHorizontalRange(editor, forward);\n if (newRng) {\n moveToRange(editor, newRng);\n return true;\n } else {\n return false;\n }\n };\n };\n var moveV = function (editor, down) {\n return function () {\n var newRng = getVerticalRange(editor, down);\n if (newRng) {\n moveToRange(editor, newRng);\n return true;\n } else {\n return false;\n }\n };\n };\n var isCefPosition = function (forward) {\n return function (pos) {\n return forward ? isAfterContentEditableFalse(pos) : isBeforeContentEditableFalse(pos);\n };\n };\n var moveToLineEndPoint = function (editor, forward) {\n return function () {\n var from = forward ? CaretPosition$1.fromRangeEnd(editor.selection.getRng()) : CaretPosition$1.fromRangeStart(editor.selection.getRng());\n var result = forward ? getPositionsUntilNextLine(editor.getBody(), from) : getPositionsUntilPreviousLine(editor.getBody(), from);\n var to = forward ? last(result.positions) : head(result.positions);\n return to.filter(isCefPosition(forward)).fold(constant(false), function (pos) {\n editor.selection.setRng(pos.toRange());\n return true;\n });\n };\n };\n\n var deflate = function (rect, delta) {\n return {\n left: rect.left - delta,\n top: rect.top - delta,\n right: rect.right + delta * 2,\n bottom: rect.bottom + delta * 2,\n width: rect.width + delta,\n height: rect.height + delta\n };\n };\n var getCorners = function (getYAxisValue, tds) {\n return bind(tds, function (td) {\n var rect = deflate(clone$1(td.getBoundingClientRect()), -1);\n return [\n {\n x: rect.left,\n y: getYAxisValue(rect),\n cell: td\n },\n {\n x: rect.right,\n y: getYAxisValue(rect),\n cell: td\n }\n ];\n });\n };\n var findClosestCorner = function (corners, x, y) {\n return foldl(corners, function (acc, newCorner) {\n return acc.fold(function () {\n return Option.some(newCorner);\n }, function (oldCorner) {\n var oldDist = Math.sqrt(Math.abs(oldCorner.x - x) + Math.abs(oldCorner.y - y));\n var newDist = Math.sqrt(Math.abs(newCorner.x - x) + Math.abs(newCorner.y - y));\n return Option.some(newDist < oldDist ? newCorner : oldCorner);\n });\n }, Option.none());\n };\n var getClosestCell$1 = function (getYAxisValue, isTargetCorner, table, x, y) {\n var cells = descendants$1(Element.fromDom(table), 'td,th,caption').map(function (e) {\n return e.dom();\n });\n var corners = filter(getCorners(getYAxisValue, cells), function (corner) {\n return isTargetCorner(corner, y);\n });\n return findClosestCorner(corners, x, y).map(function (corner) {\n return corner.cell;\n });\n };\n var getBottomValue = function (rect) {\n return rect.bottom;\n };\n var getTopValue = function (rect) {\n return rect.top;\n };\n var isAbove$1 = function (corner, y) {\n return corner.y < y;\n };\n var isBelow$1 = function (corner, y) {\n return corner.y > y;\n };\n var getClosestCellAbove = curry(getClosestCell$1, getBottomValue, isAbove$1);\n var getClosestCellBelow = curry(getClosestCell$1, getTopValue, isBelow$1);\n var findClosestPositionInAboveCell = function (table, pos) {\n return head(pos.getClientRects()).bind(function (rect) {\n return getClosestCellAbove(table, rect.left, rect.top);\n }).bind(function (cell) {\n return findClosestHorizontalPosition(getLastLinePositions(cell), pos);\n });\n };\n var findClosestPositionInBelowCell = function (table, pos) {\n return last(pos.getClientRects()).bind(function (rect) {\n return getClosestCellBelow(table, rect.left, rect.top);\n }).bind(function (cell) {\n return findClosestHorizontalPosition(getFirstLinePositions(cell), pos);\n });\n };\n\n var hasNextBreak = function (getPositionsUntil, scope, lineInfo) {\n return lineInfo.breakAt.map(function (breakPos) {\n return getPositionsUntil(scope, breakPos).breakAt.isSome();\n }).getOr(false);\n };\n var startsWithWrapBreak = function (lineInfo) {\n return lineInfo.breakType === BreakType.Wrap && lineInfo.positions.length === 0;\n };\n var startsWithBrBreak = function (lineInfo) {\n return lineInfo.breakType === BreakType.Br && lineInfo.positions.length === 1;\n };\n var isAtTableCellLine = function (getPositionsUntil, scope, pos) {\n var lineInfo = getPositionsUntil(scope, pos);\n if (startsWithWrapBreak(lineInfo) || !NodeType.isBr(pos.getNode()) && startsWithBrBreak(lineInfo)) {\n return !hasNextBreak(getPositionsUntil, scope, lineInfo);\n } else {\n return lineInfo.breakAt.isNone();\n }\n };\n var isAtFirstTableCellLine = curry(isAtTableCellLine, getPositionsUntilPreviousLine);\n var isAtLastTableCellLine = curry(isAtTableCellLine, getPositionsUntilNextLine);\n var isCaretAtStartOrEndOfTable = function (forward, rng, table) {\n var caretPos = CaretPosition$1.fromRangeStart(rng);\n return CaretFinder.positionIn(!forward, table).map(function (pos) {\n return pos.isEqual(caretPos);\n }).getOr(false);\n };\n var navigateHorizontally = function (editor, forward, table, td) {\n var rng = editor.selection.getRng();\n var direction = forward ? 1 : -1;\n if (isFakeCaretTableBrowser() && isCaretAtStartOrEndOfTable(forward, rng, table)) {\n var newRng = showCaret(direction, editor, table, !forward, true);\n moveToRange(editor, newRng);\n return true;\n }\n return false;\n };\n var getClosestAbovePosition = function (root, table, start) {\n return findClosestPositionInAboveCell(table, start).orThunk(function () {\n return head(start.getClientRects()).bind(function (rect) {\n return findClosestHorizontalPositionFromPoint(getPositionsAbove(root, CaretPosition$1.before(table)), rect.left);\n });\n }).getOr(CaretPosition$1.before(table));\n };\n var getClosestBelowPosition = function (root, table, start) {\n return findClosestPositionInBelowCell(table, start).orThunk(function () {\n return head(start.getClientRects()).bind(function (rect) {\n return findClosestHorizontalPositionFromPoint(getPositionsBelow(root, CaretPosition$1.after(table)), rect.left);\n });\n }).getOr(CaretPosition$1.after(table));\n };\n var getTable = function (previous, pos) {\n var node = pos.getNode(previous);\n return NodeType.isElement(node) && node.nodeName === 'TABLE' ? Option.some(node) : Option.none();\n };\n var renderBlock = function (down, editor, table, pos) {\n var forcedRootBlock = Settings.getForcedRootBlock(editor);\n if (forcedRootBlock) {\n editor.undoManager.transact(function () {\n var element = Element.fromTag(forcedRootBlock);\n setAll(element, Settings.getForcedRootBlockAttrs(editor));\n append(element, Element.fromTag('br'));\n if (down) {\n after(Element.fromDom(table), element);\n } else {\n before(Element.fromDom(table), element);\n }\n var rng = editor.dom.createRng();\n rng.setStart(element.dom(), 0);\n rng.setEnd(element.dom(), 0);\n moveToRange(editor, rng);\n });\n } else {\n moveToRange(editor, pos.toRange());\n }\n };\n var moveCaret = function (editor, down, pos) {\n var table = down ? getTable(true, pos) : getTable(false, pos);\n var last = down === false;\n table.fold(function () {\n return moveToRange(editor, pos.toRange());\n }, function (table) {\n return CaretFinder.positionIn(last, editor.getBody()).filter(function (lastPos) {\n return lastPos.isEqual(pos);\n }).fold(function () {\n return moveToRange(editor, pos.toRange());\n }, function (_) {\n return renderBlock(down, editor, table, pos);\n });\n });\n };\n var navigateVertically = function (editor, down, table, td) {\n var rng = editor.selection.getRng();\n var pos = CaretPosition$1.fromRangeStart(rng);\n var root = editor.getBody();\n if (!down && isAtFirstTableCellLine(td, pos)) {\n var newPos = getClosestAbovePosition(root, table, pos);\n moveCaret(editor, down, newPos);\n return true;\n } else if (down && isAtLastTableCellLine(td, pos)) {\n var newPos = getClosestBelowPosition(root, table, pos);\n moveCaret(editor, down, newPos);\n return true;\n } else {\n return false;\n }\n };\n var moveH$1 = function (editor, forward) {\n return function () {\n return Option.from(editor.dom.getParent(editor.selection.getNode(), 'td,th')).bind(function (td) {\n return Option.from(editor.dom.getParent(td, 'table')).map(function (table) {\n return navigateHorizontally(editor, forward, table);\n });\n }).getOr(false);\n };\n };\n var moveV$1 = function (editor, forward) {\n return function () {\n return Option.from(editor.dom.getParent(editor.selection.getNode(), 'td,th')).bind(function (td) {\n return Option.from(editor.dom.getParent(td, 'table')).map(function (table) {\n return navigateVertically(editor, forward, table, td);\n });\n }).getOr(false);\n };\n };\n\n var isTarget = function (node) {\n return contains(['figcaption'], name(node));\n };\n var rangeBefore = function (target) {\n var rng = domGlobals.document.createRange();\n rng.setStartBefore(target.dom());\n rng.setEndBefore(target.dom());\n return rng;\n };\n var insertElement = function (root, elm, forward) {\n if (forward) {\n append(root, elm);\n } else {\n prepend(root, elm);\n }\n };\n var insertBr = function (root, forward) {\n var br = Element.fromTag('br');\n insertElement(root, br, forward);\n return rangeBefore(br);\n };\n var insertBlock$1 = function (root, forward, blockName, attrs) {\n var block = Element.fromTag(blockName);\n var br = Element.fromTag('br');\n setAll(block, attrs);\n append(block, br);\n insertElement(root, block, forward);\n return rangeBefore(br);\n };\n var insertEmptyLine = function (root, rootBlockName, attrs, forward) {\n if (rootBlockName === '') {\n return insertBr(root, forward);\n } else {\n return insertBlock$1(root, forward, rootBlockName, attrs);\n }\n };\n var getClosestTargetBlock = function (pos, root) {\n var isRoot = curry(eq, root);\n return closest(Element.fromDom(pos.container()), isBlock, isRoot).filter(isTarget);\n };\n var isAtFirstOrLastLine = function (root, forward, pos) {\n return forward ? isAtLastLine(root.dom(), pos) : isAtFirstLine(root.dom(), pos);\n };\n var moveCaretToNewEmptyLine = function (editor, forward) {\n var root = Element.fromDom(editor.getBody());\n var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n var rootBlock = Settings.getForcedRootBlock(editor);\n var rootBlockAttrs = Settings.getForcedRootBlockAttrs(editor);\n return getClosestTargetBlock(pos, root).exists(function () {\n if (isAtFirstOrLastLine(root, forward, pos)) {\n var rng = insertEmptyLine(root, rootBlock, rootBlockAttrs, forward);\n editor.selection.setRng(rng);\n return true;\n } else {\n return false;\n }\n });\n };\n var moveV$2 = function (editor, forward) {\n return function () {\n if (editor.selection.isCollapsed()) {\n return moveCaretToNewEmptyLine(editor, forward);\n } else {\n return false;\n }\n };\n };\n\n var defaultPatterns = function (patterns) {\n return map(patterns, function (pattern) {\n return merge({\n shiftKey: false,\n altKey: false,\n ctrlKey: false,\n metaKey: false,\n keyCode: 0,\n action: noop\n }, pattern);\n });\n };\n var matchesEvent = function (pattern, evt) {\n return evt.keyCode === pattern.keyCode && evt.shiftKey === pattern.shiftKey && evt.altKey === pattern.altKey && evt.ctrlKey === pattern.ctrlKey && evt.metaKey === pattern.metaKey;\n };\n var match$1 = function (patterns, evt) {\n return bind(defaultPatterns(patterns), function (pattern) {\n return matchesEvent(pattern, evt) ? [pattern] : [];\n });\n };\n var action = function (f) {\n var x = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n x[_i - 1] = arguments[_i];\n }\n var args = Array.prototype.slice.call(arguments, 1);\n return function () {\n return f.apply(null, args);\n };\n };\n var execute = function (patterns, evt) {\n return find(match$1(patterns, evt), function (pattern) {\n return pattern.action();\n });\n };\n var MatchKeys = {\n match: match$1,\n action: action,\n execute: execute\n };\n\n var executeKeydownOverride = function (editor, caret, evt) {\n var os = PlatformDetection$1.detect().os;\n MatchKeys.execute([\n {\n keyCode: VK.RIGHT,\n action: moveH(editor, true)\n },\n {\n keyCode: VK.LEFT,\n action: moveH(editor, false)\n },\n {\n keyCode: VK.UP,\n action: moveV(editor, false)\n },\n {\n keyCode: VK.DOWN,\n action: moveV(editor, true)\n },\n {\n keyCode: VK.RIGHT,\n action: moveH$1(editor, true)\n },\n {\n keyCode: VK.LEFT,\n action: moveH$1(editor, false)\n },\n {\n keyCode: VK.UP,\n action: moveV$1(editor, false)\n },\n {\n keyCode: VK.DOWN,\n action: moveV$1(editor, true)\n },\n {\n keyCode: VK.RIGHT,\n action: BoundarySelection.move(editor, caret, true)\n },\n {\n keyCode: VK.LEFT,\n action: BoundarySelection.move(editor, caret, false)\n },\n {\n keyCode: VK.RIGHT,\n ctrlKey: !os.isOSX(),\n altKey: os.isOSX(),\n action: BoundarySelection.moveNextWord(editor, caret)\n },\n {\n keyCode: VK.LEFT,\n ctrlKey: !os.isOSX(),\n altKey: os.isOSX(),\n action: BoundarySelection.movePrevWord(editor, caret)\n },\n {\n keyCode: VK.UP,\n action: moveV$2(editor, false)\n },\n {\n keyCode: VK.DOWN,\n action: moveV$2(editor, true)\n }\n ], evt).each(function (_) {\n evt.preventDefault();\n });\n };\n var setup$7 = function (editor, caret) {\n editor.on('keydown', function (evt) {\n if (evt.isDefaultPrevented() === false) {\n executeKeydownOverride(editor, caret, evt);\n }\n });\n };\n var ArrowKeys = { setup: setup$7 };\n\n var executeKeydownOverride$1 = function (editor, caret, evt) {\n MatchKeys.execute([\n {\n keyCode: VK.BACKSPACE,\n action: MatchKeys.action(CefDelete.backspaceDelete, editor, false)\n },\n {\n keyCode: VK.DELETE,\n action: MatchKeys.action(CefDelete.backspaceDelete, editor, true)\n },\n {\n keyCode: VK.BACKSPACE,\n action: MatchKeys.action(CefBoundaryDelete.backspaceDelete, editor, false)\n },\n {\n keyCode: VK.DELETE,\n action: MatchKeys.action(CefBoundaryDelete.backspaceDelete, editor, true)\n },\n {\n keyCode: VK.BACKSPACE,\n action: MatchKeys.action(InlineBoundaryDelete.backspaceDelete, editor, caret, false)\n },\n {\n keyCode: VK.DELETE,\n action: MatchKeys.action(InlineBoundaryDelete.backspaceDelete, editor, caret, true)\n },\n {\n keyCode: VK.BACKSPACE,\n action: MatchKeys.action(TableDelete.backspaceDelete, editor, false)\n },\n {\n keyCode: VK.DELETE,\n action: MatchKeys.action(TableDelete.backspaceDelete, editor, true)\n },\n {\n keyCode: VK.BACKSPACE,\n action: MatchKeys.action(BlockRangeDelete.backspaceDelete, editor, false)\n },\n {\n keyCode: VK.DELETE,\n action: MatchKeys.action(BlockRangeDelete.backspaceDelete, editor, true)\n },\n {\n keyCode: VK.BACKSPACE,\n action: MatchKeys.action(BlockBoundaryDelete.backspaceDelete, editor, false)\n },\n {\n keyCode: VK.DELETE,\n action: MatchKeys.action(BlockBoundaryDelete.backspaceDelete, editor, true)\n },\n {\n keyCode: VK.BACKSPACE,\n action: MatchKeys.action(InlineFormatDelete.backspaceDelete, editor, false)\n },\n {\n keyCode: VK.DELETE,\n action: MatchKeys.action(InlineFormatDelete.backspaceDelete, editor, true)\n }\n ], evt).each(function (_) {\n evt.preventDefault();\n });\n };\n var executeKeyupOverride = function (editor, evt) {\n MatchKeys.execute([\n {\n keyCode: VK.BACKSPACE,\n action: MatchKeys.action(CefDelete.paddEmptyElement, editor)\n },\n {\n keyCode: VK.DELETE,\n action: MatchKeys.action(CefDelete.paddEmptyElement, editor)\n }\n ], evt);\n };\n var setup$8 = function (editor, caret) {\n editor.on('keydown', function (evt) {\n if (evt.isDefaultPrevented() === false) {\n executeKeydownOverride$1(editor, caret, evt);\n }\n });\n editor.on('keyup', function (evt) {\n if (evt.isDefaultPrevented() === false) {\n executeKeyupOverride(editor, evt);\n }\n });\n };\n var DeleteBackspaceKeys = { setup: setup$8 };\n\n var firstNonWhiteSpaceNodeSibling = function (node) {\n while (node) {\n if (node.nodeType === 1 || node.nodeType === 3 && node.data && /[\\r\\n\\s]/.test(node.data)) {\n return node;\n }\n node = node.nextSibling;\n }\n };\n var moveToCaretPosition = function (editor, root) {\n var walker, node, rng, lastNode = root, tempElm;\n var dom = editor.dom;\n var moveCaretBeforeOnEnterElementsMap = editor.schema.getMoveCaretBeforeOnEnterElements();\n if (!root) {\n return;\n }\n if (/^(LI|DT|DD)$/.test(root.nodeName)) {\n var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild);\n if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) {\n root.insertBefore(dom.doc.createTextNode('\\xA0'), root.firstChild);\n }\n }\n rng = dom.createRng();\n root.normalize();\n if (root.hasChildNodes()) {\n walker = new TreeWalker(root, root);\n while (node = walker.current()) {\n if (NodeType.isText(node)) {\n rng.setStart(node, 0);\n rng.setEnd(node, 0);\n break;\n }\n if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) {\n rng.setStartBefore(node);\n rng.setEndBefore(node);\n break;\n }\n lastNode = node;\n node = walker.next();\n }\n if (!node) {\n rng.setStart(lastNode, 0);\n rng.setEnd(lastNode, 0);\n }\n } else {\n if (NodeType.isBr(root)) {\n if (root.nextSibling && dom.isBlock(root.nextSibling)) {\n rng.setStartBefore(root);\n rng.setEndBefore(root);\n } else {\n rng.setStartAfter(root);\n rng.setEndAfter(root);\n }\n } else {\n rng.setStart(root, 0);\n rng.setEnd(root, 0);\n }\n }\n editor.selection.setRng(rng);\n dom.remove(tempElm);\n editor.selection.scrollIntoView(root);\n };\n var getEditableRoot = function (dom, node) {\n var root = dom.getRoot();\n var parent, editableRoot;\n parent = node;\n while (parent !== root && dom.getContentEditable(parent) !== 'false') {\n if (dom.getContentEditable(parent) === 'true') {\n editableRoot = parent;\n }\n parent = parent.parentNode;\n }\n return parent !== root ? editableRoot : root;\n };\n var getParentBlock$2 = function (editor) {\n return Option.from(editor.dom.getParent(editor.selection.getStart(true), editor.dom.isBlock));\n };\n var getParentBlockName = function (editor) {\n return getParentBlock$2(editor).fold(constant(''), function (parentBlock) {\n return parentBlock.nodeName.toUpperCase();\n });\n };\n var isListItemParentBlock = function (editor) {\n return getParentBlock$2(editor).filter(function (elm) {\n return isListItem(Element.fromDom(elm));\n }).isSome();\n };\n var NewLineUtils = {\n moveToCaretPosition: moveToCaretPosition,\n getEditableRoot: getEditableRoot,\n getParentBlock: getParentBlock$2,\n getParentBlockName: getParentBlockName,\n isListItemParentBlock: isListItemParentBlock\n };\n\n var hasFirstChild = function (elm, name) {\n return elm.firstChild && elm.firstChild.nodeName === name;\n };\n var hasParent$1 = function (elm, parentName) {\n return elm && elm.parentNode && elm.parentNode.nodeName === parentName;\n };\n var isListBlock = function (elm) {\n return elm && /^(OL|UL|LI)$/.test(elm.nodeName);\n };\n var isNestedList = function (elm) {\n return isListBlock(elm) && isListBlock(elm.parentNode);\n };\n var getContainerBlock = function (containerBlock) {\n var containerBlockParent = containerBlock.parentNode;\n if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) {\n return containerBlockParent;\n }\n return containerBlock;\n };\n var isFirstOrLastLi = function (containerBlock, parentBlock, first) {\n var node = containerBlock[first ? 'firstChild' : 'lastChild'];\n while (node) {\n if (NodeType.isElement(node)) {\n break;\n }\n node = node[first ? 'nextSibling' : 'previousSibling'];\n }\n return node === parentBlock;\n };\n var insert$1 = function (editor, createNewBlock, containerBlock, parentBlock, newBlockName) {\n var dom = editor.dom;\n var rng = editor.selection.getRng();\n if (containerBlock === editor.getBody()) {\n return;\n }\n if (isNestedList(containerBlock)) {\n newBlockName = 'LI';\n }\n var newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR');\n if (isFirstOrLastLi(containerBlock, parentBlock, true) && isFirstOrLastLi(containerBlock, parentBlock, false)) {\n if (hasParent$1(containerBlock, 'LI')) {\n dom.insertAfter(newBlock, getContainerBlock(containerBlock));\n } else {\n dom.replace(newBlock, containerBlock);\n }\n } else if (isFirstOrLastLi(containerBlock, parentBlock, true)) {\n if (hasParent$1(containerBlock, 'LI')) {\n dom.insertAfter(newBlock, getContainerBlock(containerBlock));\n newBlock.appendChild(dom.doc.createTextNode(' '));\n newBlock.appendChild(containerBlock);\n } else {\n containerBlock.parentNode.insertBefore(newBlock, containerBlock);\n }\n } else if (isFirstOrLastLi(containerBlock, parentBlock, false)) {\n dom.insertAfter(newBlock, getContainerBlock(containerBlock));\n } else {\n containerBlock = getContainerBlock(containerBlock);\n var tmpRng = rng.cloneRange();\n tmpRng.setStartAfter(parentBlock);\n tmpRng.setEndAfter(containerBlock);\n var fragment = tmpRng.extractContents();\n if (newBlockName === 'LI' && hasFirstChild(fragment, 'LI')) {\n newBlock = fragment.firstChild;\n dom.insertAfter(fragment, containerBlock);\n } else {\n dom.insertAfter(fragment, containerBlock);\n dom.insertAfter(newBlock, containerBlock);\n }\n }\n dom.remove(parentBlock);\n NewLineUtils.moveToCaretPosition(editor, newBlock);\n };\n var InsertLi = { insert: insert$1 };\n\n var trimZwsp = function (fragment) {\n each(descendants(Element.fromDom(fragment), isText), function (text) {\n var rawNode = text.dom();\n rawNode.nodeValue = Zwsp.trim(rawNode.nodeValue);\n });\n };\n var isEmptyAnchor = function (dom, elm) {\n return elm && elm.nodeName === 'A' && dom.isEmpty(elm);\n };\n var isTableCell$5 = function (node) {\n return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);\n };\n var emptyBlock = function (elm) {\n elm.innerHTML = '
';\n };\n var containerAndSiblingName = function (container, nodeName) {\n return container.nodeName === nodeName || container.previousSibling && container.previousSibling.nodeName === nodeName;\n };\n var canSplitBlock = function (dom, node) {\n return node && dom.isBlock(node) && !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && !/^(fixed|absolute)/i.test(node.style.position) && dom.getContentEditable(node) !== 'true';\n };\n var trimInlineElementsOnLeftSideOfBlock = function (dom, nonEmptyElementsMap, block) {\n var node = block;\n var firstChilds = [];\n var i;\n if (!node) {\n return;\n }\n while (node = node.firstChild) {\n if (dom.isBlock(node)) {\n return;\n }\n if (NodeType.isElement(node) && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) {\n firstChilds.push(node);\n }\n }\n i = firstChilds.length;\n while (i--) {\n node = firstChilds[i];\n if (!node.hasChildNodes() || node.firstChild === node.lastChild && node.firstChild.nodeValue === '') {\n dom.remove(node);\n } else {\n if (isEmptyAnchor(dom, node)) {\n dom.remove(node);\n }\n }\n }\n };\n var normalizeZwspOffset = function (start, container, offset) {\n if (NodeType.isText(container) === false) {\n return offset;\n } else if (start) {\n return offset === 1 && container.data.charAt(offset - 1) === Zwsp.ZWSP ? 0 : offset;\n } else {\n return offset === container.data.length - 1 && container.data.charAt(offset) === Zwsp.ZWSP ? container.data.length : offset;\n }\n };\n var includeZwspInRange = function (rng) {\n var newRng = rng.cloneRange();\n newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset));\n newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset));\n return newRng;\n };\n var trimLeadingLineBreaks = function (node) {\n do {\n if (NodeType.isText(node)) {\n node.nodeValue = node.nodeValue.replace(/^[\\r\\n]+/, '');\n }\n node = node.firstChild;\n } while (node);\n };\n var getEditableRoot$1 = function (dom, node) {\n var root = dom.getRoot();\n var parent, editableRoot;\n parent = node;\n while (parent !== root && dom.getContentEditable(parent) !== 'false') {\n if (dom.getContentEditable(parent) === 'true') {\n editableRoot = parent;\n }\n parent = parent.parentNode;\n }\n return parent !== root ? editableRoot : root;\n };\n var applyAttributes = function (editor, node, forcedRootBlockAttrs) {\n Option.from(forcedRootBlockAttrs.style).map(editor.dom.parseStyle).each(function (attrStyles) {\n var currentStyles = getAllRaw(Element.fromDom(node));\n var newStyles = __assign(__assign({}, currentStyles), attrStyles);\n editor.dom.setStyles(node, newStyles);\n });\n var attrClassesOpt = Option.from(forcedRootBlockAttrs.class).map(function (attrClasses) {\n return attrClasses.split(/\\s+/);\n });\n var currentClassesOpt = Option.from(node.className).map(function (currentClasses) {\n return filter(currentClasses.split(/\\s+/), function (clazz) {\n return clazz !== '';\n });\n });\n lift2(attrClassesOpt, currentClassesOpt, function (attrClasses, currentClasses) {\n var filteredClasses = filter(currentClasses, function (clazz) {\n return !contains(attrClasses, clazz);\n });\n var newClasses = __spreadArrays(attrClasses, filteredClasses);\n editor.dom.setAttrib(node, 'class', newClasses.join(' '));\n });\n var appliedAttrs = [\n 'style',\n 'class'\n ];\n var remainingAttrs = bifilter(forcedRootBlockAttrs, function (_, attrs) {\n return !contains(appliedAttrs, attrs);\n }).t;\n editor.dom.setAttribs(node, remainingAttrs);\n };\n var setForcedBlockAttrs = function (editor, node) {\n var forcedRootBlockName = Settings.getForcedRootBlock(editor);\n if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {\n var forcedRootBlockAttrs = Settings.getForcedRootBlockAttrs(editor);\n applyAttributes(editor, node, forcedRootBlockAttrs);\n }\n };\n var wrapSelfAndSiblingsInDefaultBlock = function (editor, newBlockName, rng, container, offset) {\n var newBlock, parentBlock, startNode, node, next, rootBlockName;\n var blockName = newBlockName || 'P';\n var dom = editor.dom, editableRoot = getEditableRoot$1(dom, container);\n parentBlock = dom.getParent(container, dom.isBlock);\n if (!parentBlock || !canSplitBlock(dom, parentBlock)) {\n parentBlock = parentBlock || editableRoot;\n if (parentBlock === editor.getBody() || isTableCell$5(parentBlock)) {\n rootBlockName = parentBlock.nodeName.toLowerCase();\n } else {\n rootBlockName = parentBlock.parentNode.nodeName.toLowerCase();\n }\n if (!parentBlock.hasChildNodes()) {\n newBlock = dom.create(blockName);\n setForcedBlockAttrs(editor, newBlock);\n parentBlock.appendChild(newBlock);\n rng.setStart(newBlock, 0);\n rng.setEnd(newBlock, 0);\n return newBlock;\n }\n node = container;\n while (node.parentNode !== parentBlock) {\n node = node.parentNode;\n }\n while (node && !dom.isBlock(node)) {\n startNode = node;\n node = node.previousSibling;\n }\n if (startNode && editor.schema.isValidChild(rootBlockName, blockName.toLowerCase())) {\n newBlock = dom.create(blockName);\n setForcedBlockAttrs(editor, newBlock);\n startNode.parentNode.insertBefore(newBlock, startNode);\n node = startNode;\n while (node && !dom.isBlock(node)) {\n next = node.nextSibling;\n newBlock.appendChild(node);\n node = next;\n }\n rng.setStart(container, offset);\n rng.setEnd(container, offset);\n }\n }\n return container;\n };\n var addBrToBlockIfNeeded = function (dom, block) {\n var lastChild;\n block.normalize();\n lastChild = block.lastChild;\n if (!lastChild || /^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true))) {\n dom.add(block, 'br');\n }\n };\n var insert$2 = function (editor, evt) {\n var tmpRng, editableRoot, container, offset, parentBlock, shiftKey;\n var newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer;\n var dom = editor.dom;\n var schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements();\n var rng = editor.selection.getRng();\n var createNewBlock = function (name) {\n var node = container, block, clonedNode, caretNode;\n var textInlineElements = schema.getTextInlineElements();\n if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {\n block = dom.create(name || newBlockName);\n } else {\n block = parentBlock.cloneNode(false);\n }\n caretNode = block;\n if (Settings.shouldKeepStyles(editor) === false) {\n dom.setAttrib(block, 'style', null);\n dom.setAttrib(block, 'class', null);\n } else {\n do {\n if (textInlineElements[node.nodeName]) {\n if (isCaretNode(node) || Bookmarks.isBookmarkNode(node)) {\n continue;\n }\n clonedNode = node.cloneNode(false);\n dom.setAttrib(clonedNode, 'id', '');\n if (block.hasChildNodes()) {\n clonedNode.appendChild(block.firstChild);\n block.appendChild(clonedNode);\n } else {\n caretNode = clonedNode;\n block.appendChild(clonedNode);\n }\n }\n } while ((node = node.parentNode) && node !== editableRoot);\n }\n setForcedBlockAttrs(editor, block);\n emptyBlock(caretNode);\n return block;\n };\n var isCaretAtStartOrEndOfBlock = function (start) {\n var walker, node, name, normalizedOffset;\n normalizedOffset = normalizeZwspOffset(start, container, offset);\n if (NodeType.isText(container) && (start ? normalizedOffset > 0 : normalizedOffset < container.nodeValue.length)) {\n return false;\n }\n if (container.parentNode === parentBlock && isAfterLastNodeInContainer && !start) {\n return true;\n }\n if (start && NodeType.isElement(container) && container === parentBlock.firstChild) {\n return true;\n }\n if (containerAndSiblingName(container, 'TABLE') || containerAndSiblingName(container, 'HR')) {\n return isAfterLastNodeInContainer && !start || !isAfterLastNodeInContainer && start;\n }\n walker = new TreeWalker(container, parentBlock);\n if (NodeType.isText(container)) {\n if (start && normalizedOffset === 0) {\n walker.prev();\n } else if (!start && normalizedOffset === container.nodeValue.length) {\n walker.next();\n }\n }\n while (node = walker.current()) {\n if (NodeType.isElement(node)) {\n if (!node.getAttribute('data-mce-bogus')) {\n name = node.nodeName.toLowerCase();\n if (nonEmptyElementsMap[name] && name !== 'br') {\n return false;\n }\n }\n } else if (NodeType.isText(node) && !/^[ \\t\\r\\n]*$/.test(node.nodeValue)) {\n return false;\n }\n if (start) {\n walker.prev();\n } else {\n walker.next();\n }\n }\n return true;\n };\n var insertNewBlockAfter = function () {\n if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName !== 'HGROUP') {\n newBlock = createNewBlock(newBlockName);\n } else {\n newBlock = createNewBlock();\n }\n if (Settings.shouldEndContainerOnEmptyBlock(editor) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock)) {\n newBlock = dom.split(containerBlock, parentBlock);\n } else {\n dom.insertAfter(newBlock, parentBlock);\n }\n NewLineUtils.moveToCaretPosition(editor, newBlock);\n };\n NormalizeRange.normalize(dom, rng).each(function (normRng) {\n rng.setStart(normRng.startContainer, normRng.startOffset);\n rng.setEnd(normRng.endContainer, normRng.endOffset);\n });\n container = rng.startContainer;\n offset = rng.startOffset;\n newBlockName = Settings.getForcedRootBlock(editor);\n shiftKey = evt.shiftKey;\n if (NodeType.isElement(container) && container.hasChildNodes()) {\n isAfterLastNodeInContainer = offset > container.childNodes.length - 1;\n container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;\n if (isAfterLastNodeInContainer && NodeType.isText(container)) {\n offset = container.nodeValue.length;\n } else {\n offset = 0;\n }\n }\n editableRoot = getEditableRoot$1(dom, container);\n if (!editableRoot) {\n return;\n }\n if (newBlockName && !shiftKey || !newBlockName && shiftKey) {\n container = wrapSelfAndSiblingsInDefaultBlock(editor, newBlockName, rng, container, offset);\n }\n parentBlock = dom.getParent(container, dom.isBlock);\n containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;\n parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : '';\n containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : '';\n if (containerBlockName === 'LI' && !evt.ctrlKey) {\n parentBlock = containerBlock;\n containerBlock = containerBlock.parentNode;\n parentBlockName = containerBlockName;\n }\n if (/^(LI|DT|DD)$/.test(parentBlockName)) {\n if (dom.isEmpty(parentBlock)) {\n InsertLi.insert(editor, createNewBlock, containerBlock, parentBlock, newBlockName);\n return;\n }\n }\n if (newBlockName && parentBlock === editor.getBody()) {\n return;\n }\n newBlockName = newBlockName || 'P';\n if (isCaretContainerBlock(parentBlock)) {\n newBlock = showCaretContainerBlock(parentBlock);\n if (dom.isEmpty(parentBlock)) {\n emptyBlock(parentBlock);\n }\n setForcedBlockAttrs(editor, newBlock);\n NewLineUtils.moveToCaretPosition(editor, newBlock);\n } else if (isCaretAtStartOrEndOfBlock()) {\n insertNewBlockAfter();\n } else if (isCaretAtStartOrEndOfBlock(true)) {\n newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock);\n NewLineUtils.moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') ? newBlock : parentBlock);\n } else {\n tmpRng = includeZwspInRange(rng).cloneRange();\n tmpRng.setEndAfter(parentBlock);\n fragment = tmpRng.extractContents();\n trimZwsp(fragment);\n trimLeadingLineBreaks(fragment);\n newBlock = fragment.firstChild;\n dom.insertAfter(fragment, parentBlock);\n trimInlineElementsOnLeftSideOfBlock(dom, nonEmptyElementsMap, newBlock);\n addBrToBlockIfNeeded(dom, parentBlock);\n if (dom.isEmpty(parentBlock)) {\n emptyBlock(parentBlock);\n }\n newBlock.normalize();\n if (dom.isEmpty(newBlock)) {\n dom.remove(newBlock);\n insertNewBlockAfter();\n } else {\n setForcedBlockAttrs(editor, newBlock);\n NewLineUtils.moveToCaretPosition(editor, newBlock);\n }\n }\n dom.setAttrib(newBlock, 'id', '');\n editor.fire('NewBlock', { newBlock: newBlock });\n };\n var InsertBlock = { insert: insert$2 };\n\n var matchesSelector = function (editor, selector) {\n return NewLineUtils.getParentBlock(editor).filter(function (parentBlock) {\n return selector.length > 0 && is$1(Element.fromDom(parentBlock), selector);\n }).isSome();\n };\n var shouldInsertBr = function (editor) {\n return matchesSelector(editor, Settings.getBrNewLineSelector(editor));\n };\n var shouldBlockNewLine = function (editor) {\n return matchesSelector(editor, Settings.getNoNewLineSelector(editor));\n };\n var ContextSelectors = {\n shouldInsertBr: shouldInsertBr,\n shouldBlockNewLine: shouldBlockNewLine\n };\n\n var newLineAction = Adt.generate([\n { br: [] },\n { block: [] },\n { none: [] }\n ]);\n var shouldBlockNewLine$1 = function (editor, shiftKey) {\n return ContextSelectors.shouldBlockNewLine(editor);\n };\n var isBrMode = function (requiredState) {\n return function (editor, shiftKey) {\n var brMode = Settings.getForcedRootBlock(editor) === '';\n return brMode === requiredState;\n };\n };\n var inListBlock = function (requiredState) {\n return function (editor, shiftKey) {\n return NewLineUtils.isListItemParentBlock(editor) === requiredState;\n };\n };\n var inBlock = function (blockName, requiredState) {\n return function (editor, shiftKey) {\n var state = NewLineUtils.getParentBlockName(editor) === blockName.toUpperCase();\n return state === requiredState;\n };\n };\n var inPreBlock = function (requiredState) {\n return inBlock('pre', requiredState);\n };\n var inSummaryBlock = function () {\n return inBlock('summary', true);\n };\n var shouldPutBrInPre$1 = function (requiredState) {\n return function (editor, shiftKey) {\n return Settings.shouldPutBrInPre(editor) === requiredState;\n };\n };\n var inBrContext = function (editor, shiftKey) {\n return ContextSelectors.shouldInsertBr(editor);\n };\n var hasShiftKey = function (editor, shiftKey) {\n return shiftKey;\n };\n var canInsertIntoEditableRoot = function (editor) {\n var forcedRootBlock = Settings.getForcedRootBlock(editor);\n var rootEditable = NewLineUtils.getEditableRoot(editor.dom, editor.selection.getStart());\n return rootEditable && editor.schema.isValidChild(rootEditable.nodeName, forcedRootBlock ? forcedRootBlock : 'P');\n };\n var match$2 = function (predicates, action) {\n return function (editor, shiftKey) {\n var isMatch = foldl(predicates, function (res, p) {\n return res && p(editor, shiftKey);\n }, true);\n return isMatch ? Option.some(action) : Option.none();\n };\n };\n var getAction$1 = function (editor, evt) {\n return LazyEvaluator.evaluateUntil([\n match$2([shouldBlockNewLine$1], newLineAction.none()),\n match$2([inSummaryBlock()], newLineAction.br()),\n match$2([\n inPreBlock(true),\n shouldPutBrInPre$1(false),\n hasShiftKey\n ], newLineAction.br()),\n match$2([\n inPreBlock(true),\n shouldPutBrInPre$1(false)\n ], newLineAction.block()),\n match$2([\n inPreBlock(true),\n shouldPutBrInPre$1(true),\n hasShiftKey\n ], newLineAction.block()),\n match$2([\n inPreBlock(true),\n shouldPutBrInPre$1(true)\n ], newLineAction.br()),\n match$2([\n inListBlock(true),\n hasShiftKey\n ], newLineAction.br()),\n match$2([inListBlock(true)], newLineAction.block()),\n match$2([\n isBrMode(true),\n hasShiftKey,\n canInsertIntoEditableRoot\n ], newLineAction.block()),\n match$2([isBrMode(true)], newLineAction.br()),\n match$2([inBrContext], newLineAction.br()),\n match$2([\n isBrMode(false),\n hasShiftKey\n ], newLineAction.br()),\n match$2([canInsertIntoEditableRoot], newLineAction.block())\n ], [\n editor,\n evt.shiftKey\n ]).getOr(newLineAction.none());\n };\n var NewLineAction = { getAction: getAction$1 };\n\n var insert$3 = function (editor, evt) {\n NewLineAction.getAction(editor, evt).fold(function () {\n InsertBr.insert(editor, evt);\n }, function () {\n InsertBlock.insert(editor, evt);\n }, noop);\n };\n var InsertNewLine = { insert: insert$3 };\n\n var endTypingLevel = function (undoManager) {\n if (undoManager.typing) {\n undoManager.typing = false;\n undoManager.add();\n }\n };\n var handleEnterKeyEvent = function (editor, event) {\n if (event.isDefaultPrevented()) {\n return;\n }\n event.preventDefault();\n endTypingLevel(editor.undoManager);\n editor.undoManager.transact(function () {\n if (editor.selection.isCollapsed() === false) {\n editor.execCommand('Delete');\n }\n InsertNewLine.insert(editor, event);\n });\n };\n var setup$9 = function (editor) {\n editor.on('keydown', function (event) {\n if (event.keyCode === VK.ENTER) {\n handleEnterKeyEvent(editor, event);\n }\n });\n };\n var EnterKey = { setup: setup$9 };\n\n var insertTextAtPosition = function (text, pos) {\n var container = pos.container();\n var offset = pos.offset();\n if (NodeType.isText(container)) {\n container.insertData(offset, text);\n return Option.some(CaretPosition(container, offset + text.length));\n } else {\n return getElementFromPosition(pos).map(function (elm) {\n var textNode = Element.fromText(text);\n if (pos.isAtEnd()) {\n after(elm, textNode);\n } else {\n before(elm, textNode);\n }\n return CaretPosition(textNode.dom(), text.length);\n });\n }\n };\n var insertNbspAtPosition = curry(insertTextAtPosition, '\\xA0');\n var insertSpaceAtPosition = curry(insertTextAtPosition, ' ');\n\n var navigateIgnoreEmptyTextNodes = function (forward, root, from) {\n return CaretFinder.navigateIgnore(forward, root, from, isEmptyText);\n };\n var getClosestBlock = function (root, pos) {\n return find(Parents.parentsAndSelf(Element.fromDom(pos.container()), root), isBlock);\n };\n var isAtBeforeAfterBlockBoundary = function (forward, root, pos) {\n return navigateIgnoreEmptyTextNodes(forward, root.dom(), pos).forall(function (newPos) {\n return getClosestBlock(root, pos).fold(function () {\n return isInSameBlock(newPos, pos, root.dom()) === false;\n }, function (fromBlock) {\n return isInSameBlock(newPos, pos, root.dom()) === false && contains$3(fromBlock, Element.fromDom(newPos.container()));\n });\n });\n };\n var isAtBlockBoundary = function (forward, root, pos) {\n return getClosestBlock(root, pos).fold(function () {\n return navigateIgnoreEmptyTextNodes(forward, root.dom(), pos).forall(function (newPos) {\n return isInSameBlock(newPos, pos, root.dom()) === false;\n });\n }, function (parent) {\n return navigateIgnoreEmptyTextNodes(forward, parent.dom(), pos).isNone();\n });\n };\n var isAtStartOfBlock = curry(isAtBlockBoundary, false);\n var isAtEndOfBlock = curry(isAtBlockBoundary, true);\n var isBeforeBlock = curry(isAtBeforeAfterBlockBoundary, false);\n var isAfterBlock = curry(isAtBeforeAfterBlockBoundary, true);\n\n var nbsp = '\\xA0';\n var isInMiddleOfText = function (pos) {\n return CaretPosition.isTextPosition(pos) && !pos.isAtStart() && !pos.isAtEnd();\n };\n var getClosestBlock$1 = function (root, pos) {\n var parentBlocks = filter(Parents.parentsAndSelf(Element.fromDom(pos.container()), root), isBlock);\n return head(parentBlocks).getOr(root);\n };\n var hasSpaceBefore = function (root, pos) {\n if (isInMiddleOfText(pos)) {\n return isAfterSpace(pos);\n } else {\n return isAfterSpace(pos) || CaretFinder.prevPosition(getClosestBlock$1(root, pos).dom(), pos).exists(isAfterSpace);\n }\n };\n var hasSpaceAfter = function (root, pos) {\n if (isInMiddleOfText(pos)) {\n return isBeforeSpace(pos);\n } else {\n return isBeforeSpace(pos) || CaretFinder.nextPosition(getClosestBlock$1(root, pos).dom(), pos).exists(isBeforeSpace);\n }\n };\n var isPreValue = function (value) {\n return contains([\n 'pre',\n 'pre-wrap'\n ], value);\n };\n var isInPre = function (pos) {\n return getElementFromPosition(pos).bind(function (elm) {\n return closest(elm, isElement);\n }).exists(function (elm) {\n return isPreValue(get$1(elm, 'white-space'));\n });\n };\n var isAtBeginningOfBody = function (root, pos) {\n return CaretFinder.prevPosition(root.dom(), pos).isNone();\n };\n var isAtEndOfBody = function (root, pos) {\n return CaretFinder.nextPosition(root.dom(), pos).isNone();\n };\n var isAtLineBoundary = function (root, pos) {\n return isAtBeginningOfBody(root, pos) || isAtEndOfBody(root, pos) || isAtStartOfBlock(root, pos) || isAtEndOfBlock(root, pos) || isAfterBr(root, pos) || isBeforeBr(root, pos);\n };\n var needsToHaveNbsp = function (root, pos) {\n if (isInPre(pos)) {\n return false;\n } else {\n return isAtLineBoundary(root, pos) || hasSpaceBefore(root, pos) || hasSpaceAfter(root, pos);\n }\n };\n var needsToBeNbspLeft = function (root, pos) {\n if (isInPre(pos)) {\n return false;\n } else {\n return isAtStartOfBlock(root, pos) || isBeforeBlock(root, pos) || isAfterBr(root, pos) || hasSpaceBefore(root, pos);\n }\n };\n var leanRight = function (pos) {\n var container = pos.container();\n var offset = pos.offset();\n if (NodeType.isText(container) && offset < container.data.length) {\n return CaretPosition(container, offset + 1);\n } else {\n return pos;\n }\n };\n var needsToBeNbspRight = function (root, pos) {\n var afterPos = leanRight(pos);\n if (isInPre(afterPos)) {\n return false;\n } else {\n return isAtEndOfBlock(root, afterPos) || isAfterBlock(root, afterPos) || isBeforeBr(root, afterPos) || hasSpaceAfter(root, afterPos);\n }\n };\n var needsToBeNbsp = function (root, pos) {\n return needsToBeNbspLeft(root, pos) || needsToBeNbspRight(root, pos);\n };\n var isNbspAt = function (text, offset) {\n return isNbsp(text.charAt(offset));\n };\n var hasNbsp = function (pos) {\n var container = pos.container();\n return NodeType.isText(container) && contains$2(container.data, nbsp);\n };\n var normalizeNbspMiddle = function (text) {\n var chars = text.split('');\n return map(chars, function (chr, i) {\n if (isNbsp(chr) && i > 0 && i < chars.length - 1 && isContent$1(chars[i - 1]) && isContent$1(chars[i + 1])) {\n return ' ';\n } else {\n return chr;\n }\n }).join('');\n };\n var normalizeNbspAtStart = function (root, node) {\n var text = node.data;\n var firstPos = CaretPosition(node, 0);\n if (isNbspAt(text, 0) && !needsToBeNbsp(root, firstPos)) {\n node.data = ' ' + text.slice(1);\n return true;\n } else {\n return false;\n }\n };\n var normalizeNbspInMiddleOfTextNode = function (node) {\n var text = node.data;\n var newText = normalizeNbspMiddle(text);\n if (newText !== text) {\n node.data = newText;\n return true;\n } else {\n return false;\n }\n };\n var normalizeNbspAtEnd = function (root, node) {\n var text = node.data;\n var lastPos = CaretPosition(node, text.length - 1);\n if (isNbspAt(text, text.length - 1) && !needsToBeNbsp(root, lastPos)) {\n node.data = text.slice(0, -1) + ' ';\n return true;\n } else {\n return false;\n }\n };\n var normalizeNbsps = function (root, pos) {\n return Option.some(pos).filter(hasNbsp).bind(function (pos) {\n var container = pos.container();\n var normalized = normalizeNbspAtStart(root, container) || normalizeNbspInMiddleOfTextNode(container) || normalizeNbspAtEnd(root, container);\n return normalized ? Option.some(pos) : Option.none();\n });\n };\n var normalizeNbspsInEditor = function (editor) {\n var root = Element.fromDom(editor.getBody());\n if (editor.selection.isCollapsed()) {\n normalizeNbsps(root, CaretPosition.fromRangeStart(editor.selection.getRng())).each(function (pos) {\n editor.selection.setRng(pos.toRange());\n });\n }\n };\n\n var locationToCaretPosition = function (root) {\n return function (location) {\n return location.fold(function (element) {\n return CaretFinder.prevPosition(root.dom(), CaretPosition$1.before(element));\n }, function (element) {\n return CaretFinder.firstPositionIn(element);\n }, function (element) {\n return CaretFinder.lastPositionIn(element);\n }, function (element) {\n return CaretFinder.nextPosition(root.dom(), CaretPosition$1.after(element));\n });\n };\n };\n var insertInlineBoundarySpaceOrNbsp = function (root, pos) {\n return function (checkPos) {\n return needsToHaveNbsp(root, checkPos) ? insertNbspAtPosition(pos) : insertSpaceAtPosition(pos);\n };\n };\n var setSelection$1 = function (editor) {\n return function (pos) {\n editor.selection.setRng(pos.toRange());\n editor.nodeChanged();\n return true;\n };\n };\n var insertSpaceOrNbspAtSelection = function (editor) {\n var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n var root = Element.fromDom(editor.getBody());\n if (editor.selection.isCollapsed()) {\n var isInlineTarget = curry(InlineUtils.isInlineTarget, editor);\n var caretPosition = CaretPosition$1.fromRangeStart(editor.selection.getRng());\n return BoundaryLocation.readLocation(isInlineTarget, editor.getBody(), caretPosition).bind(locationToCaretPosition(root)).bind(insertInlineBoundarySpaceOrNbsp(root, pos)).exists(setSelection$1(editor));\n } else {\n return false;\n }\n };\n\n var executeKeydownOverride$2 = function (editor, evt) {\n MatchKeys.execute([{\n keyCode: VK.SPACEBAR,\n action: MatchKeys.action(insertSpaceOrNbspAtSelection, editor)\n }], evt).each(function (_) {\n evt.preventDefault();\n });\n };\n var setup$a = function (editor) {\n editor.on('keydown', function (evt) {\n if (evt.isDefaultPrevented() === false) {\n executeKeydownOverride$2(editor, evt);\n }\n });\n };\n var SpaceKey = { setup: setup$a };\n\n var findBlockCaretContainer = function (editor) {\n return descendant(Element.fromDom(editor.getBody()), '*[data-mce-caret]').fold(constant(null), function (elm) {\n return elm.dom();\n });\n };\n var removeIeControlRect = function (editor) {\n editor.selection.setRng(editor.selection.getRng());\n };\n var showBlockCaretContainer = function (editor, blockCaretContainer) {\n if (blockCaretContainer.hasAttribute('data-mce-caret')) {\n showCaretContainerBlock(blockCaretContainer);\n removeIeControlRect(editor);\n editor.selection.scrollIntoView(blockCaretContainer);\n }\n };\n var handleBlockContainer = function (editor, e) {\n var blockCaretContainer = findBlockCaretContainer(editor);\n if (!blockCaretContainer) {\n return;\n }\n if (e.type === 'compositionstart') {\n e.preventDefault();\n e.stopPropagation();\n showBlockCaretContainer(editor, blockCaretContainer);\n return;\n }\n if (hasContent(blockCaretContainer)) {\n showBlockCaretContainer(editor, blockCaretContainer);\n editor.undoManager.add();\n }\n };\n var setup$b = function (editor) {\n editor.on('keyup compositionstart', curry(handleBlockContainer, editor));\n };\n var CaretContainerInput = { setup: setup$b };\n\n var browser$4 = PlatformDetection$1.detect().browser;\n var setupIeInput = function (editor) {\n var keypressThrotter = first(function () {\n if (!editor.composing) {\n normalizeNbspsInEditor(editor);\n }\n }, 0);\n if (browser$4.isIE()) {\n editor.on('keypress', function (e) {\n keypressThrotter.throttle();\n });\n editor.on('remove', function (e) {\n keypressThrotter.cancel();\n });\n }\n };\n var setup$c = function (editor) {\n setupIeInput(editor);\n editor.on('input', function (e) {\n if (e.isComposing === false) {\n normalizeNbspsInEditor(editor);\n }\n });\n };\n\n var executeKeydownOverride$3 = function (editor, evt) {\n MatchKeys.execute([\n {\n keyCode: VK.END,\n action: moveToLineEndPoint(editor, true)\n },\n {\n keyCode: VK.HOME,\n action: moveToLineEndPoint(editor, false)\n }\n ], evt).each(function (_) {\n evt.preventDefault();\n });\n };\n var setup$d = function (editor) {\n editor.on('keydown', function (evt) {\n if (evt.isDefaultPrevented() === false) {\n executeKeydownOverride$3(editor, evt);\n }\n });\n };\n var HomeEndKeys = { setup: setup$d };\n\n var setup$e = function (editor) {\n var caret = BoundarySelection.setupSelectedState(editor);\n CaretContainerInput.setup(editor);\n ArrowKeys.setup(editor, caret);\n DeleteBackspaceKeys.setup(editor, caret);\n EnterKey.setup(editor);\n SpaceKey.setup(editor);\n setup$c(editor);\n HomeEndKeys.setup(editor);\n };\n var KeyboardOverrides = { setup: setup$e };\n\n function Quirks (editor) {\n var each = Tools.each;\n var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, settings = editor.settings, parser = editor.parser;\n var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit;\n var mceInternalUrlPrefix = 'data:text/mce-internal,';\n var mceInternalDataType = isIE ? 'Text' : 'URL';\n var setEditorCommandState = function (cmd, state) {\n try {\n editor.getDoc().execCommand(cmd, false, state);\n } catch (ex) {\n }\n };\n var isDefaultPrevented = function (e) {\n return e.isDefaultPrevented();\n };\n var setMceInternalContent = function (e) {\n var selectionHtml, internalContent;\n if (e.dataTransfer) {\n if (editor.selection.isCollapsed() && e.target.tagName === 'IMG') {\n selection.select(e.target);\n }\n selectionHtml = editor.selection.getContent();\n if (selectionHtml.length > 0) {\n internalContent = mceInternalUrlPrefix + escape(editor.id) + ',' + escape(selectionHtml);\n e.dataTransfer.setData(mceInternalDataType, internalContent);\n }\n }\n };\n var getMceInternalContent = function (e) {\n var internalContent;\n if (e.dataTransfer) {\n internalContent = e.dataTransfer.getData(mceInternalDataType);\n if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) {\n internalContent = internalContent.substr(mceInternalUrlPrefix.length).split(',');\n return {\n id: unescape(internalContent[0]),\n html: unescape(internalContent[1])\n };\n }\n }\n return null;\n };\n var insertClipboardContents = function (content, internal) {\n if (editor.queryCommandSupported('mceInsertClipboardContent')) {\n editor.execCommand('mceInsertClipboardContent', false, {\n content: content,\n internal: internal\n });\n } else {\n editor.execCommand('mceInsertContent', false, content);\n }\n };\n var emptyEditorWhenDeleting = function () {\n var serializeRng = function (rng) {\n var body = dom.create('body');\n var contents = rng.cloneContents();\n body.appendChild(contents);\n return selection.serializer.serialize(body, { format: 'html' });\n };\n var allContentsSelected = function (rng) {\n var selection = serializeRng(rng);\n var allRng = dom.createRng();\n allRng.selectNode(editor.getBody());\n var allSelection = serializeRng(allRng);\n return selection === allSelection;\n };\n editor.on('keydown', function (e) {\n var keyCode = e.keyCode;\n var isCollapsed, body;\n if (!isDefaultPrevented(e) && (keyCode === DELETE || keyCode === BACKSPACE)) {\n isCollapsed = editor.selection.isCollapsed();\n body = editor.getBody();\n if (isCollapsed && !dom.isEmpty(body)) {\n return;\n }\n if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {\n return;\n }\n e.preventDefault();\n editor.setContent('');\n if (body.firstChild && dom.isBlock(body.firstChild)) {\n editor.selection.setCursorLocation(body.firstChild, 0);\n } else {\n editor.selection.setCursorLocation(body, 0);\n }\n editor.nodeChanged();\n }\n });\n };\n var selectAll = function () {\n editor.shortcuts.add('meta+a', null, 'SelectAll');\n };\n var inputMethodFocus = function () {\n if (!editor.settings.content_editable) {\n dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) {\n var rng;\n if (e.target === editor.getDoc().documentElement) {\n rng = selection.getRng();\n editor.getBody().focus();\n if (e.type === 'mousedown') {\n if (isCaretContainer(rng.startContainer)) {\n return;\n }\n selection.placeCaretAt(e.clientX, e.clientY);\n } else {\n selection.setRng(rng);\n }\n }\n });\n }\n };\n var removeHrOnBackspace = function () {\n editor.on('keydown', function (e) {\n if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {\n if (!editor.getBody().getElementsByTagName('hr').length) {\n return;\n }\n if (selection.isCollapsed() && selection.getRng().startOffset === 0) {\n var node = selection.getNode();\n var previousSibling = node.previousSibling;\n if (node.nodeName === 'HR') {\n dom.remove(node);\n e.preventDefault();\n return;\n }\n if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'hr') {\n dom.remove(previousSibling);\n e.preventDefault();\n }\n }\n }\n });\n };\n var focusBody = function () {\n if (!domGlobals.Range.prototype.getClientRects) {\n editor.on('mousedown', function (e) {\n if (!isDefaultPrevented(e) && e.target.nodeName === 'HTML') {\n var body_1 = editor.getBody();\n body_1.blur();\n Delay.setEditorTimeout(editor, function () {\n body_1.focus();\n });\n }\n });\n }\n };\n var selectControlElements = function () {\n editor.on('click', function (e) {\n var target = e.target;\n if (/^(IMG|HR)$/.test(target.nodeName) && dom.getContentEditableParent(target) !== 'false') {\n e.preventDefault();\n editor.selection.select(target);\n editor.nodeChanged();\n }\n if (target.nodeName === 'A' && dom.hasClass(target, 'mce-item-anchor')) {\n e.preventDefault();\n selection.select(target);\n }\n });\n };\n var removeStylesWhenDeletingAcrossBlockElements = function () {\n var getAttributeApplyFunction = function () {\n var template = dom.getAttribs(selection.getStart().cloneNode(false));\n return function () {\n var target = selection.getStart();\n if (target !== editor.getBody()) {\n dom.setAttrib(target, 'style', null);\n each(template, function (attr) {\n target.setAttributeNode(attr.cloneNode(true));\n });\n }\n };\n };\n var isSelectionAcrossElements = function () {\n return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) !== dom.getParent(selection.getEnd(), dom.isBlock);\n };\n editor.on('keypress', function (e) {\n var applyAttributes;\n if (!isDefaultPrevented(e) && (e.keyCode === 8 || e.keyCode === 46) && isSelectionAcrossElements()) {\n applyAttributes = getAttributeApplyFunction();\n editor.getDoc().execCommand('delete', false, null);\n applyAttributes();\n e.preventDefault();\n return false;\n }\n });\n dom.bind(editor.getDoc(), 'cut', function (e) {\n var applyAttributes;\n if (!isDefaultPrevented(e) && isSelectionAcrossElements()) {\n applyAttributes = getAttributeApplyFunction();\n Delay.setEditorTimeout(editor, function () {\n applyAttributes();\n });\n }\n });\n };\n var disableBackspaceIntoATable = function () {\n editor.on('keydown', function (e) {\n if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {\n if (selection.isCollapsed() && selection.getRng().startOffset === 0) {\n var previousSibling = selection.getNode().previousSibling;\n if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'table') {\n e.preventDefault();\n return false;\n }\n }\n }\n });\n };\n var removeBlockQuoteOnBackSpace = function () {\n editor.on('keydown', function (e) {\n var rng, container, offset, root, parent;\n if (isDefaultPrevented(e) || e.keyCode !== VK.BACKSPACE) {\n return;\n }\n rng = selection.getRng();\n container = rng.startContainer;\n offset = rng.startOffset;\n root = dom.getRoot();\n parent = container;\n if (!rng.collapsed || offset !== 0) {\n return;\n }\n while (parent && parent.parentNode && parent.parentNode.firstChild === parent && parent.parentNode !== root) {\n parent = parent.parentNode;\n }\n if (parent.tagName === 'BLOCKQUOTE') {\n editor.formatter.toggle('blockquote', null, parent);\n rng = dom.createRng();\n rng.setStart(container, 0);\n rng.setEnd(container, 0);\n selection.setRng(rng);\n }\n });\n };\n var setGeckoEditingOptions = function () {\n var setOpts = function () {\n setEditorCommandState('StyleWithCSS', false);\n setEditorCommandState('enableInlineTableEditing', false);\n if (!settings.object_resizing) {\n setEditorCommandState('enableObjectResizing', false);\n }\n };\n if (!settings.readonly) {\n editor.on('BeforeExecCommand MouseDown', setOpts);\n }\n };\n var addBrAfterLastLinks = function () {\n var fixLinks = function () {\n each(dom.select('a'), function (node) {\n var parentNode = node.parentNode;\n var root = dom.getRoot();\n if (parentNode.lastChild === node) {\n while (parentNode && !dom.isBlock(parentNode)) {\n if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) {\n return;\n }\n parentNode = parentNode.parentNode;\n }\n dom.add(parentNode, 'br', { 'data-mce-bogus': 1 });\n }\n });\n };\n editor.on('SetContent ExecCommand', function (e) {\n if (e.type === 'setcontent' || e.command === 'mceInsertLink') {\n fixLinks();\n }\n });\n };\n var setDefaultBlockType = function () {\n if (settings.forced_root_block) {\n editor.on('init', function () {\n setEditorCommandState('DefaultParagraphSeparator', settings.forced_root_block);\n });\n }\n };\n var normalizeSelection = function () {\n editor.on('keyup focusin mouseup', function (e) {\n if (!VK.modifierPressed(e)) {\n selection.normalize();\n }\n }, true);\n };\n var showBrokenImageIcon = function () {\n editor.contentStyles.push('img:-moz-broken {' + '-moz-force-broken-image-icon:1;' + 'min-width:24px;' + 'min-height:24px' + '}');\n };\n var restoreFocusOnKeyDown = function () {\n if (!editor.inline) {\n editor.on('keydown', function () {\n if (domGlobals.document.activeElement === domGlobals.document.body) {\n editor.getWin().focus();\n }\n });\n }\n };\n var bodyHeight = function () {\n if (!editor.inline) {\n editor.contentStyles.push('body {min-height: 150px}');\n editor.on('click', function (e) {\n var rng;\n if (e.target.nodeName === 'HTML') {\n if (Env.ie > 11) {\n editor.getBody().focus();\n return;\n }\n rng = editor.selection.getRng();\n editor.getBody().focus();\n editor.selection.setRng(rng);\n editor.selection.normalize();\n editor.nodeChanged();\n }\n });\n }\n };\n var blockCmdArrowNavigation = function () {\n if (Env.mac) {\n editor.on('keydown', function (e) {\n if (VK.metaKeyPressed(e) && !e.shiftKey && (e.keyCode === 37 || e.keyCode === 39)) {\n e.preventDefault();\n editor.selection.getSel().modify('move', e.keyCode === 37 ? 'backward' : 'forward', 'lineboundary');\n }\n });\n }\n };\n var disableAutoUrlDetect = function () {\n setEditorCommandState('AutoUrlDetect', false);\n };\n var tapLinksAndImages = function () {\n editor.on('click', function (e) {\n var elm = e.target;\n do {\n if (elm.tagName === 'A') {\n e.preventDefault();\n return;\n }\n } while (elm = elm.parentNode);\n });\n editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}');\n };\n var blockFormSubmitInsideEditor = function () {\n editor.on('init', function () {\n editor.dom.bind(editor.getBody(), 'submit', function (e) {\n e.preventDefault();\n });\n });\n };\n var removeAppleInterchangeBrs = function () {\n parser.addNodeFilter('br', function (nodes) {\n var i = nodes.length;\n while (i--) {\n if (nodes[i].attr('class') === 'Apple-interchange-newline') {\n nodes[i].remove();\n }\n }\n });\n };\n var ieInternalDragAndDrop = function () {\n editor.on('dragstart', function (e) {\n setMceInternalContent(e);\n });\n editor.on('drop', function (e) {\n if (!isDefaultPrevented(e)) {\n var internalContent = getMceInternalContent(e);\n if (internalContent && internalContent.id !== editor.id) {\n e.preventDefault();\n var rng = CaretRangeFromPoint.fromPoint(e.x, e.y, editor.getDoc());\n selection.setRng(rng);\n insertClipboardContents(internalContent.html, true);\n }\n }\n });\n };\n var refreshContentEditable = function () {\n };\n var isHidden = function () {\n var sel;\n if (!isGecko || editor.removed) {\n return 0;\n }\n sel = editor.selection.getSel();\n return !sel || !sel.rangeCount || sel.rangeCount === 0;\n };\n removeBlockQuoteOnBackSpace();\n emptyEditorWhenDeleting();\n if (!Env.windowsPhone) {\n normalizeSelection();\n }\n if (isWebKit) {\n inputMethodFocus();\n selectControlElements();\n setDefaultBlockType();\n blockFormSubmitInsideEditor();\n disableBackspaceIntoATable();\n removeAppleInterchangeBrs();\n if (Env.iOS) {\n restoreFocusOnKeyDown();\n bodyHeight();\n tapLinksAndImages();\n } else {\n selectAll();\n }\n }\n if (Env.ie >= 11) {\n bodyHeight();\n disableBackspaceIntoATable();\n }\n if (Env.ie) {\n selectAll();\n disableAutoUrlDetect();\n ieInternalDragAndDrop();\n }\n if (isGecko) {\n removeHrOnBackspace();\n focusBody();\n removeStylesWhenDeletingAcrossBlockElements();\n setGeckoEditingOptions();\n addBrAfterLastLinks();\n showBrokenImageIcon();\n blockCmdArrowNavigation();\n disableBackspaceIntoATable();\n }\n return {\n refreshContentEditable: refreshContentEditable,\n isHidden: isHidden\n };\n }\n\n var isTextBlockNode = function (node) {\n return NodeType.isElement(node) && isTextBlock(Element.fromDom(node));\n };\n var normalizeSelection$1 = function (editor) {\n var rng = editor.selection.getRng();\n var startPos = CaretPosition.fromRangeStart(rng);\n var endPos = CaretPosition.fromRangeEnd(rng);\n if (CaretPosition.isElementPosition(startPos)) {\n var container = startPos.container();\n if (isTextBlockNode(container)) {\n CaretFinder.firstPositionIn(container).each(function (pos) {\n return rng.setStart(pos.container(), pos.offset());\n });\n }\n }\n if (CaretPosition.isElementPosition(endPos)) {\n var container = startPos.container();\n if (isTextBlockNode(container)) {\n CaretFinder.lastPositionIn(container).each(function (pos) {\n return rng.setEnd(pos.container(), pos.offset());\n });\n }\n }\n editor.selection.setRng(RangeNormalizer.normalize(rng));\n };\n var setup$f = function (editor) {\n editor.on('click', function (e) {\n if (e.detail >= 3) {\n normalizeSelection$1(editor);\n }\n });\n };\n\n var preventSummaryToggle = function (editor) {\n editor.on('click', function (e) {\n if (editor.dom.getParent(e.target, 'details')) {\n e.preventDefault();\n }\n });\n };\n var filterDetails = function (editor) {\n editor.parser.addNodeFilter('details', function (elms) {\n each(elms, function (details) {\n details.attr('data-mce-open', details.attr('open'));\n details.attr('open', 'open');\n });\n });\n editor.serializer.addNodeFilter('details', function (elms) {\n each(elms, function (details) {\n var open = details.attr('data-mce-open');\n details.attr('open', isString(open) ? open : null);\n details.attr('data-mce-open', null);\n });\n });\n };\n var setup$g = function (editor) {\n preventSummaryToggle(editor);\n filterDetails(editor);\n };\n\n var DOM$2 = DOMUtils$1.DOM;\n var appendStyle = function (editor, text) {\n var head = Element.fromDom(editor.getDoc().head);\n var tag = Element.fromTag('style');\n set(tag, 'type', 'text/css');\n append(tag, Element.fromText(text));\n append(head, tag);\n };\n var createParser = function (editor) {\n var parser = DomParser(editor.settings, editor.schema);\n parser.addAttributeFilter('src,href,style,tabindex', function (nodes, name) {\n var i = nodes.length, node;\n var dom = editor.dom;\n var value, internalName;\n while (i--) {\n node = nodes[i];\n value = node.attr(name);\n internalName = 'data-mce-' + name;\n if (!node.attributes.map[internalName]) {\n if (value.indexOf('data:') === 0 || value.indexOf('blob:') === 0) {\n continue;\n }\n if (name === 'style') {\n value = dom.serializeStyle(dom.parseStyle(value), node.name);\n if (!value.length) {\n value = null;\n }\n node.attr(internalName, value);\n node.attr(name, value);\n } else if (name === 'tabindex') {\n node.attr(internalName, value);\n node.attr(name, null);\n } else {\n node.attr(internalName, editor.convertURL(value, name, node.name));\n }\n }\n }\n });\n parser.addNodeFilter('script', function (nodes) {\n var i = nodes.length, node, type;\n while (i--) {\n node = nodes[i];\n type = node.attr('type') || 'no/type';\n if (type.indexOf('mce-') !== 0) {\n node.attr('type', 'mce-' + type);\n }\n }\n });\n parser.addNodeFilter('#cdata', function (nodes) {\n var i = nodes.length, node;\n while (i--) {\n node = nodes[i];\n node.type = 8;\n node.name = '#comment';\n node.value = '[CDATA[' + node.value + ']]';\n }\n });\n parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function (nodes) {\n var i = nodes.length, node;\n var nonEmptyElements = editor.schema.getNonEmptyElements();\n while (i--) {\n node = nodes[i];\n if (node.isEmpty(nonEmptyElements) && node.getAll('br').length === 0) {\n node.append(new Node$1('br', 1)).shortEnded = true;\n }\n }\n });\n return parser;\n };\n var autoFocus = function (editor) {\n if (editor.settings.auto_focus) {\n Delay.setEditorTimeout(editor, function () {\n var focusEditor;\n if (editor.settings.auto_focus === true) {\n focusEditor = editor;\n } else {\n focusEditor = editor.editorManager.get(editor.settings.auto_focus);\n }\n if (!focusEditor.destroyed) {\n focusEditor.focus();\n }\n }, 100);\n }\n };\n var initEditor = function (editor) {\n editor.bindPendingEventDelegates();\n editor.initialized = true;\n editor.fire('init');\n editor.focus(true);\n editor.nodeChanged({ initial: true });\n editor.execCallback('init_instance_callback', editor);\n autoFocus(editor);\n };\n var getStyleSheetLoader = function (editor) {\n return editor.inline ? DOM$2.styleSheetLoader : editor.dom.styleSheetLoader;\n };\n var initContentBody = function (editor, skipWrite) {\n var settings = editor.settings;\n var targetElm = editor.getElement();\n var doc = editor.getDoc(), body, contentCssText;\n if (!settings.inline) {\n editor.getElement().style.visibility = editor.orgVisibility;\n }\n if (!skipWrite && !settings.content_editable) {\n doc.open();\n doc.write(editor.iframeHTML);\n doc.close();\n }\n if (settings.content_editable) {\n editor.on('remove', function () {\n var bodyEl = this.getBody();\n DOM$2.removeClass(bodyEl, 'mce-content-body');\n DOM$2.removeClass(bodyEl, 'mce-edit-focus');\n DOM$2.setAttrib(bodyEl, 'contentEditable', null);\n });\n DOM$2.addClass(targetElm, 'mce-content-body');\n editor.contentDocument = doc = settings.content_document || domGlobals.document;\n editor.contentWindow = settings.content_window || domGlobals.window;\n editor.bodyElement = targetElm;\n settings.content_document = settings.content_window = null;\n settings.root_name = targetElm.nodeName.toLowerCase();\n }\n body = editor.getBody();\n body.disabled = true;\n editor.readonly = settings.readonly;\n if (!editor.readonly) {\n if (editor.inline && DOM$2.getStyle(body, 'position', true) === 'static') {\n body.style.position = 'relative';\n }\n body.contentEditable = editor.getParam('content_editable_state', true);\n }\n body.disabled = false;\n editor.editorUpload = EditorUpload(editor);\n editor.schema = Schema(settings);\n editor.dom = DOMUtils$1(doc, {\n keep_values: true,\n url_converter: editor.convertURL,\n url_converter_scope: editor,\n hex_colors: settings.force_hex_style_colors,\n class_filter: settings.class_filter,\n update_styles: true,\n root_element: editor.inline ? editor.getBody() : null,\n collect: settings.content_editable,\n schema: editor.schema,\n contentCssCors: Settings.shouldUseContentCssCors(editor),\n onSetAttrib: function (e) {\n editor.fire('SetAttrib', e);\n }\n });\n editor.parser = createParser(editor);\n editor.serializer = DomSerializer$1(settings, editor);\n editor.selection = Selection$1(editor.dom, editor.getWin(), editor.serializer, editor);\n editor.annotator = Annotator(editor);\n editor.formatter = Formatter(editor);\n editor.undoManager = UndoManager(editor);\n editor._nodeChangeDispatcher = new NodeChange(editor);\n editor._selectionOverrides = SelectionOverrides(editor);\n setup$g(editor);\n setup$f(editor);\n KeyboardOverrides.setup(editor);\n ForceBlocks.setup(editor);\n editor.fire('PreInit');\n if (!settings.browser_spellcheck && !settings.gecko_spellcheck) {\n doc.body.spellcheck = false;\n DOM$2.setAttrib(body, 'spellcheck', 'false');\n }\n editor.quirks = Quirks(editor);\n editor.fire('PostRender');\n if (settings.directionality) {\n body.dir = settings.directionality;\n }\n if (settings.nowrap) {\n body.style.whiteSpace = 'nowrap';\n }\n if (settings.protect) {\n editor.on('BeforeSetContent', function (e) {\n Tools.each(settings.protect, function (pattern) {\n e.content = e.content.replace(pattern, function (str) {\n return '';\n });\n });\n });\n }\n editor.on('SetContent', function () {\n editor.addVisual(editor.getBody());\n });\n editor.load({\n initial: true,\n format: 'html'\n });\n editor.startContent = editor.getContent({ format: 'raw' });\n editor.on('compositionstart compositionend', function (e) {\n editor.composing = e.type === 'compositionstart';\n });\n if (editor.contentStyles.length > 0) {\n contentCssText = '';\n Tools.each(editor.contentStyles, function (style) {\n contentCssText += style + '\\r\\n';\n });\n editor.dom.addStyle(contentCssText);\n }\n getStyleSheetLoader(editor).loadAll(editor.contentCSS, function (_) {\n initEditor(editor);\n }, function (urls) {\n initEditor(editor);\n });\n if (settings.content_style) {\n appendStyle(editor, settings.content_style);\n }\n };\n var InitContentBody = { initContentBody: initContentBody };\n\n var DOM$3 = DOMUtils$1.DOM;\n var relaxDomain = function (editor, ifr) {\n if (domGlobals.document.domain !== domGlobals.window.location.hostname && Env.ie && Env.ie < 12) {\n var bodyUuid = Uuid.uuid('mce');\n editor[bodyUuid] = function () {\n InitContentBody.initContentBody(editor);\n };\n var domainRelaxUrl = 'javascript:(function(){' + 'document.open();document.domain=\"' + domGlobals.document.domain + '\";' + 'var ed = window.parent.tinymce.get(\"' + editor.id + '\");document.write(ed.iframeHTML);' + 'document.close();ed.' + bodyUuid + '(true);})()';\n DOM$3.setAttrib(ifr, 'src', domainRelaxUrl);\n return true;\n }\n return false;\n };\n var normalizeHeight = function (height) {\n var normalizedHeight = typeof height === 'number' ? height + 'px' : height;\n return normalizedHeight ? normalizedHeight : '';\n };\n var createIframeElement = function (id, title, height, customAttrs) {\n var iframe = Element.fromTag('iframe');\n setAll(iframe, customAttrs);\n setAll(iframe, {\n id: id + '_ifr',\n frameBorder: '0',\n allowTransparency: 'true',\n title: title\n });\n setAll$1(iframe, {\n width: '100%',\n height: normalizeHeight(height),\n display: 'block'\n });\n return iframe;\n };\n var getIframeHtml = function (editor) {\n var bodyId, bodyClass, iframeHTML;\n iframeHTML = Settings.getDocType(editor) + '';\n if (Settings.getDocumentBaseUrl(editor) !== editor.documentBaseUrl) {\n iframeHTML += '';\n }\n iframeHTML += '';\n bodyId = Settings.getBodyId(editor);\n bodyClass = Settings.getBodyClass(editor);\n if (Settings.getContentSecurityPolicy(editor)) {\n iframeHTML += '';\n }\n iframeHTML += '
';\n return iframeHTML;\n };\n var createIframe = function (editor, o) {\n var title = editor.editorManager.translate('Rich Text Area. Press ALT-F9 for menu. ' + 'Press ALT-F10 for toolbar. Press ALT-0 for help');\n var ifr = createIframeElement(editor.id, title, o.height, Settings.getIframeAttrs(editor)).dom();\n ifr.onload = function () {\n ifr.onload = null;\n editor.fire('load');\n };\n var isDomainRelaxed = relaxDomain(editor, ifr);\n editor.contentAreaContainer = o.iframeContainer;\n editor.iframeElement = ifr;\n editor.iframeHTML = getIframeHtml(editor);\n DOM$3.add(o.iframeContainer, ifr);\n return isDomainRelaxed;\n };\n var init$1 = function (editor, boxInfo) {\n var isDomainRelaxed = createIframe(editor, boxInfo);\n if (boxInfo.editorContainer) {\n DOM$3.get(boxInfo.editorContainer).style.display = editor.orgDisplay;\n editor.hidden = DOM$3.isHidden(boxInfo.editorContainer);\n }\n editor.getElement().style.display = 'none';\n DOM$3.setAttrib(editor.id, 'aria-hidden', 'true');\n if (!isDomainRelaxed) {\n InitContentBody.initContentBody(editor);\n }\n };\n var InitIframe = { init: init$1 };\n\n var DOM$4 = DOMUtils$1.DOM;\n var initPlugin = function (editor, initializedPlugins, plugin) {\n var Plugin = PluginManager$1.get(plugin);\n var pluginUrl = PluginManager$1.urls[plugin] || editor.documentBaseUrl.replace(/\\/$/, '');\n plugin = Tools.trim(plugin);\n if (Plugin && Tools.inArray(initializedPlugins, plugin) === -1) {\n Tools.each(PluginManager$1.dependencies(plugin), function (dep) {\n initPlugin(editor, initializedPlugins, dep);\n });\n if (editor.plugins[plugin]) {\n return;\n }\n try {\n var pluginInstance = new Plugin(editor, pluginUrl, editor.$);\n editor.plugins[plugin] = pluginInstance;\n if (pluginInstance.init) {\n pluginInstance.init(editor, pluginUrl);\n initializedPlugins.push(plugin);\n }\n } catch (e) {\n ErrorReporter.pluginInitError(editor, plugin, e);\n }\n }\n };\n var trimLegacyPrefix = function (name) {\n return name.replace(/^\\-/, '');\n };\n var initPlugins = function (editor) {\n var initializedPlugins = [];\n Tools.each(editor.settings.plugins.split(/[ ,]/), function (name) {\n initPlugin(editor, initializedPlugins, trimLegacyPrefix(name));\n });\n };\n var initTheme = function (editor) {\n var Theme;\n var theme = editor.settings.theme;\n if (isString(theme)) {\n editor.settings.theme = trimLegacyPrefix(theme);\n Theme = ThemeManager.get(theme);\n editor.theme = new Theme(editor, ThemeManager.urls[theme]);\n if (editor.theme.init) {\n editor.theme.init(editor, ThemeManager.urls[theme] || editor.documentBaseUrl.replace(/\\/$/, ''), editor.$);\n }\n } else {\n editor.theme = {};\n }\n };\n var renderFromLoadedTheme = function (editor) {\n var w, h, minHeight, re, info;\n var settings = editor.settings;\n var elm = editor.getElement();\n w = settings.width || DOM$4.getStyle(elm, 'width') || '100%';\n h = settings.height || DOM$4.getStyle(elm, 'height') || elm.offsetHeight;\n minHeight = settings.min_height || 100;\n re = /^[0-9\\.]+(|px)$/i;\n if (re.test('' + w)) {\n w = Math.max(parseInt(w, 10), 100);\n }\n if (re.test('' + h)) {\n h = Math.max(parseInt(h, 10), minHeight);\n }\n info = editor.theme.renderUI({\n targetNode: elm,\n width: w,\n height: h,\n deltaWidth: settings.delta_width,\n deltaHeight: settings.delta_height\n });\n if (!settings.content_editable) {\n h = (info.iframeHeight || h) + (typeof h === 'number' ? info.deltaHeight || 0 : '');\n if (h < minHeight) {\n h = minHeight;\n }\n }\n info.height = h;\n return info;\n };\n var renderFromThemeFunc = function (editor) {\n var info;\n var elm = editor.getElement();\n info = editor.settings.theme(editor, elm);\n if (info.editorContainer.nodeType) {\n info.editorContainer.id = info.editorContainer.id || editor.id + '_parent';\n }\n if (info.iframeContainer && info.iframeContainer.nodeType) {\n info.iframeContainer.id = info.iframeContainer.id || editor.id + '_iframecontainer';\n }\n info.height = info.iframeHeight ? info.iframeHeight : elm.offsetHeight;\n return info;\n };\n var createThemeFalseResult = function (element) {\n return {\n editorContainer: element,\n iframeContainer: element\n };\n };\n var renderThemeFalseIframe = function (targetElement) {\n var iframeContainer = DOM$4.create('div');\n DOM$4.insertAfter(iframeContainer, targetElement);\n return createThemeFalseResult(iframeContainer);\n };\n var renderThemeFalse = function (editor) {\n var targetElement = editor.getElement();\n return editor.inline ? createThemeFalseResult(null) : renderThemeFalseIframe(targetElement);\n };\n var renderThemeUi = function (editor) {\n var settings = editor.settings, elm = editor.getElement();\n editor.orgDisplay = elm.style.display;\n if (isString(settings.theme)) {\n return renderFromLoadedTheme(editor);\n } else if (isFunction(settings.theme)) {\n return renderFromThemeFunc(editor);\n } else {\n return renderThemeFalse(editor);\n }\n };\n var init$2 = function (editor) {\n var settings = editor.settings;\n var elm = editor.getElement();\n var boxInfo;\n editor.rtl = settings.rtl_ui || editor.editorManager.i18n.rtl;\n editor.editorManager.i18n.setCode(settings.language);\n settings.aria_label = settings.aria_label || DOM$4.getAttrib(elm, 'aria-label', editor.getLang('aria.rich_text_area'));\n editor.fire('ScriptsLoaded');\n initTheme(editor);\n initPlugins(editor);\n boxInfo = renderThemeUi(editor);\n editor.editorContainer = boxInfo.editorContainer ? boxInfo.editorContainer : null;\n if (settings.content_css) {\n Tools.each(Tools.explode(settings.content_css), function (u) {\n editor.contentCSS.push(editor.documentBaseURI.toAbsolute(u));\n });\n }\n if (settings.content_editable) {\n return InitContentBody.initContentBody(editor);\n } else {\n return InitIframe.init(editor, boxInfo);\n }\n };\n var Init = { init: init$2 };\n\n var DOM$5 = DOMUtils$1.DOM;\n var hasSkipLoadPrefix = function (name) {\n return name.charAt(0) === '-';\n };\n var loadLanguage = function (scriptLoader, editor) {\n var settings = editor.settings;\n if (settings.language && settings.language !== 'en' && !settings.language_url) {\n settings.language_url = editor.editorManager.baseURL + '/langs/' + settings.language + '.js';\n }\n if (settings.language_url && !editor.editorManager.i18n.data[settings.language]) {\n scriptLoader.add(settings.language_url);\n }\n };\n var loadTheme = function (scriptLoader, editor, suffix, callback) {\n var settings = editor.settings, theme = settings.theme;\n if (isString(theme)) {\n if (!hasSkipLoadPrefix(theme) && !ThemeManager.urls.hasOwnProperty(theme)) {\n var themeUrl = settings.theme_url;\n if (themeUrl) {\n ThemeManager.load(theme, editor.documentBaseURI.toAbsolute(themeUrl));\n } else {\n ThemeManager.load(theme, 'themes/' + theme + '/theme' + suffix + '.js');\n }\n }\n scriptLoader.loadQueue(function () {\n ThemeManager.waitFor(theme, callback);\n });\n } else {\n callback();\n }\n };\n var loadPlugins = function (settings, suffix) {\n if (Tools.isArray(settings.plugins)) {\n settings.plugins = settings.plugins.join(' ');\n }\n Tools.each(settings.external_plugins, function (url, name) {\n PluginManager$1.load(name, url);\n settings.plugins += ' ' + name;\n });\n Tools.each(settings.plugins.split(/[ ,]/), function (plugin) {\n plugin = Tools.trim(plugin);\n if (plugin && !PluginManager$1.urls[plugin]) {\n if (hasSkipLoadPrefix(plugin)) {\n plugin = plugin.substr(1, plugin.length);\n var dependencies = PluginManager$1.dependencies(plugin);\n Tools.each(dependencies, function (dep) {\n var defaultSettings = {\n prefix: 'plugins/',\n resource: dep,\n suffix: '/plugin' + suffix + '.js'\n };\n dep = PluginManager$1.createUrl(defaultSettings, dep);\n PluginManager$1.load(dep.resource, dep);\n });\n } else {\n PluginManager$1.load(plugin, {\n prefix: 'plugins/',\n resource: plugin,\n suffix: '/plugin' + suffix + '.js'\n });\n }\n }\n });\n };\n var loadScripts = function (editor, suffix) {\n var scriptLoader = ScriptLoader.ScriptLoader;\n loadTheme(scriptLoader, editor, suffix, function () {\n loadLanguage(scriptLoader, editor);\n loadPlugins(editor.settings, suffix);\n scriptLoader.loadQueue(function () {\n if (!editor.removed) {\n Init.init(editor);\n }\n }, editor, function (urls) {\n ErrorReporter.pluginLoadError(editor, urls[0]);\n if (!editor.removed) {\n Init.init(editor);\n }\n });\n });\n };\n var render = function (editor) {\n var settings = editor.settings, id = editor.id;\n var readyHandler = function () {\n DOM$5.unbind(domGlobals.window, 'ready', readyHandler);\n editor.render();\n };\n if (!EventUtils.Event.domLoaded) {\n DOM$5.bind(domGlobals.window, 'ready', readyHandler);\n return;\n }\n if (!editor.getElement()) {\n return;\n }\n if (!Env.contentEditable) {\n return;\n }\n if (!settings.inline) {\n editor.orgVisibility = editor.getElement().style.visibility;\n editor.getElement().style.visibility = 'hidden';\n } else {\n editor.inline = true;\n }\n var form = editor.getElement().form || DOM$5.getParent(id, 'form');\n if (form) {\n editor.formElement = form;\n if (settings.hidden_input && !/TEXTAREA|INPUT/i.test(editor.getElement().nodeName)) {\n DOM$5.insertAfter(DOM$5.create('input', {\n type: 'hidden',\n name: id\n }), id);\n editor.hasHiddenInput = true;\n }\n editor.formEventDelegate = function (e) {\n editor.fire(e.type, e);\n };\n DOM$5.bind(form, 'submit reset', editor.formEventDelegate);\n editor.on('reset', function () {\n editor.setContent(editor.startContent, { format: 'raw' });\n });\n if (settings.submit_patch && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) {\n form._mceOldSubmit = form.submit;\n form.submit = function () {\n editor.editorManager.triggerSave();\n editor.setDirty(false);\n return form._mceOldSubmit(form);\n };\n }\n }\n editor.windowManager = WindowManager(editor);\n editor.notificationManager = NotificationManager(editor);\n if (settings.encoding === 'xml') {\n editor.on('GetContent', function (e) {\n if (e.save) {\n e.content = DOM$5.encode(e.content);\n }\n });\n }\n if (settings.add_form_submit_trigger) {\n editor.on('submit', function () {\n if (editor.initialized) {\n editor.save();\n }\n });\n }\n if (settings.add_unload_trigger) {\n editor._beforeUnload = function () {\n if (editor.initialized && !editor.destroyed && !editor.isHidden()) {\n editor.save({\n format: 'raw',\n no_events: true,\n set_dirty: false\n });\n }\n };\n editor.editorManager.on('BeforeUnload', editor._beforeUnload);\n }\n editor.editorManager.add(editor);\n loadScripts(editor, editor.suffix);\n };\n var Render = { render: render };\n\n var add$4 = function (editor, name, settings) {\n var sidebars = editor.sidebars ? editor.sidebars : [];\n sidebars.push({\n name: name,\n settings: settings\n });\n editor.sidebars = sidebars;\n };\n var Sidebar = { add: add$4 };\n\n var each$k = Tools.each, trim$4 = Tools.trim;\n var queryParts = 'source protocol authority userInfo user password host port relative path directory file query anchor'.split(' ');\n var DEFAULT_PORTS = {\n ftp: 21,\n http: 80,\n https: 443,\n mailto: 25\n };\n var URI = function (url, settings) {\n var self = this;\n var baseUri, baseUrl;\n url = trim$4(url);\n settings = self.settings = settings || {};\n baseUri = settings.base_uri;\n if (/^([\\w\\-]+):([^\\/]{2})/i.test(url) || /^\\s*#/.test(url)) {\n self.source = url;\n return;\n }\n var isProtocolRelative = url.indexOf('//') === 0;\n if (url.indexOf('/') === 0 && !isProtocolRelative) {\n url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url;\n }\n if (!/^[\\w\\-]*:?\\/\\//.test(url)) {\n baseUrl = settings.base_uri ? settings.base_uri.path : new URI(domGlobals.document.location.href).directory;\n if (settings.base_uri.protocol == '') {\n url = '//mce_host' + self.toAbsPath(baseUrl, url);\n } else {\n url = /([^#?]*)([#?]?.*)/.exec(url);\n url = (baseUri && baseUri.protocol || 'http') + '://mce_host' + self.toAbsPath(baseUrl, url[1]) + url[2];\n }\n }\n url = url.replace(/@@/g, '(mce_at)');\n url = /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@\\/]*):?([^:@\\/]*))?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/.exec(url);\n each$k(queryParts, function (v, i) {\n var part = url[i];\n if (part) {\n part = part.replace(/\\(mce_at\\)/g, '@@');\n }\n self[v] = part;\n });\n if (baseUri) {\n if (!self.protocol) {\n self.protocol = baseUri.protocol;\n }\n if (!self.userInfo) {\n self.userInfo = baseUri.userInfo;\n }\n if (!self.port && self.host === 'mce_host') {\n self.port = baseUri.port;\n }\n if (!self.host || self.host === 'mce_host') {\n self.host = baseUri.host;\n }\n self.source = '';\n }\n if (isProtocolRelative) {\n self.protocol = '';\n }\n };\n URI.prototype = {\n setPath: function (path) {\n var self = this;\n path = /^(.*?)\\/?(\\w+)?$/.exec(path);\n self.path = path[0];\n self.directory = path[1];\n self.file = path[2];\n self.source = '';\n self.getURI();\n },\n toRelative: function (uri) {\n var self = this;\n var output;\n if (uri === './') {\n return uri;\n }\n uri = new URI(uri, { base_uri: self });\n if (uri.host !== 'mce_host' && self.host !== uri.host && uri.host || self.port !== uri.port || self.protocol !== uri.protocol && uri.protocol !== '') {\n return uri.getURI();\n }\n var tu = self.getURI(), uu = uri.getURI();\n if (tu === uu || tu.charAt(tu.length - 1) === '/' && tu.substr(0, tu.length - 1) === uu) {\n return tu;\n }\n output = self.toRelPath(self.path, uri.path);\n if (uri.query) {\n output += '?' + uri.query;\n }\n if (uri.anchor) {\n output += '#' + uri.anchor;\n }\n return output;\n },\n toAbsolute: function (uri, noHost) {\n uri = new URI(uri, { base_uri: this });\n return uri.getURI(noHost && this.isSameOrigin(uri));\n },\n isSameOrigin: function (uri) {\n if (this.host == uri.host && this.protocol == uri.protocol) {\n if (this.port == uri.port) {\n return true;\n }\n var defaultPort = DEFAULT_PORTS[this.protocol];\n if (defaultPort && (this.port || defaultPort) == (uri.port || defaultPort)) {\n return true;\n }\n }\n return false;\n },\n toRelPath: function (base, path) {\n var items, breakPoint = 0, out = '', i, l;\n base = base.substring(0, base.lastIndexOf('/'));\n base = base.split('/');\n items = path.split('/');\n if (base.length >= items.length) {\n for (i = 0, l = base.length; i < l; i++) {\n if (i >= items.length || base[i] !== items[i]) {\n breakPoint = i + 1;\n break;\n }\n }\n }\n if (base.length < items.length) {\n for (i = 0, l = items.length; i < l; i++) {\n if (i >= base.length || base[i] !== items[i]) {\n breakPoint = i + 1;\n break;\n }\n }\n }\n if (breakPoint === 1) {\n return path;\n }\n for (i = 0, l = base.length - (breakPoint - 1); i < l; i++) {\n out += '../';\n }\n for (i = breakPoint - 1, l = items.length; i < l; i++) {\n if (i !== breakPoint - 1) {\n out += '/' + items[i];\n } else {\n out += items[i];\n }\n }\n return out;\n },\n toAbsPath: function (base, path) {\n var i, nb = 0, o = [], tr, outPath;\n tr = /\\/$/.test(path) ? '/' : '';\n base = base.split('/');\n path = path.split('/');\n each$k(base, function (k) {\n if (k) {\n o.push(k);\n }\n });\n base = o;\n for (i = path.length - 1, o = []; i >= 0; i--) {\n if (path[i].length === 0 || path[i] === '.') {\n continue;\n }\n if (path[i] === '..') {\n nb++;\n continue;\n }\n if (nb > 0) {\n nb--;\n continue;\n }\n o.push(path[i]);\n }\n i = base.length - nb;\n if (i <= 0) {\n outPath = o.reverse().join('/');\n } else {\n outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');\n }\n if (outPath.indexOf('/') !== 0) {\n outPath = '/' + outPath;\n }\n if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) {\n outPath += tr;\n }\n return outPath;\n },\n getURI: function (noProtoHost) {\n var s;\n var self = this;\n if (!self.source || noProtoHost) {\n s = '';\n if (!noProtoHost) {\n if (self.protocol) {\n s += self.protocol + '://';\n } else {\n s += '//';\n }\n if (self.userInfo) {\n s += self.userInfo + '@';\n }\n if (self.host) {\n s += self.host;\n }\n if (self.port) {\n s += ':' + self.port;\n }\n }\n if (self.path) {\n s += self.path;\n }\n if (self.query) {\n s += '?' + self.query;\n }\n if (self.anchor) {\n s += '#' + self.anchor;\n }\n self.source = s;\n }\n return self.source;\n }\n };\n URI.parseDataUri = function (uri) {\n var type, matches;\n uri = decodeURIComponent(uri).split(',');\n matches = /data:([^;]+)/.exec(uri[0]);\n if (matches) {\n type = matches[1];\n }\n return {\n type: type,\n data: uri[1]\n };\n };\n URI.getDocumentBaseUrl = function (loc) {\n var baseUrl;\n if (loc.protocol.indexOf('http') !== 0 && loc.protocol !== 'file:') {\n baseUrl = loc.href;\n } else {\n baseUrl = loc.protocol + '//' + loc.host + loc.pathname;\n }\n if (/^[^:]+:\\/\\/\\/?[^\\/]+\\//.test(baseUrl)) {\n baseUrl = baseUrl.replace(/[\\?#].*$/, '').replace(/[\\/\\\\][^\\/]+$/, '');\n if (!/[\\/\\\\]$/.test(baseUrl)) {\n baseUrl += '/';\n }\n }\n return baseUrl;\n };\n\n var defaultFormat = 'html';\n var trimEmptyContents = function (editor, html) {\n var blockName = Settings.getForcedRootBlock(editor);\n var emptyRegExp = new RegExp('^(<' + blockName + '[^>]*>( | |\\\\s|\\xA0|
|)<\\\\/' + blockName + '>[\\r\\n]*|
[\\r\\n]*)$');\n return html.replace(emptyRegExp, '');\n };\n var getContentFromBody = function (editor, args, body) {\n var content;\n args.format = args.format ? args.format : defaultFormat;\n args.get = true;\n args.getInner = true;\n if (!args.no_events) {\n editor.fire('BeforeGetContent', args);\n }\n if (args.format === 'raw') {\n content = Tools.trim(TrimHtml.trimExternal(editor.serializer, body.innerHTML));\n } else if (args.format === 'text') {\n content = Zwsp.trim(body.innerText || body.textContent);\n } else if (args.format === 'tree') {\n return editor.serializer.serialize(body, args);\n } else {\n content = trimEmptyContents(editor, editor.serializer.serialize(body, args));\n }\n if (args.format !== 'text' && !isWsPreserveElement(Element.fromDom(body))) {\n args.content = Tools.trim(content);\n } else {\n args.content = content;\n }\n if (!args.no_events) {\n editor.fire('GetContent', args);\n }\n return args.content;\n };\n var getContent$1 = function (editor, args) {\n if (args === void 0) {\n args = {};\n }\n return Option.from(editor.getBody()).fold(constant(args.format === 'tree' ? new Node$1('body', 11) : ''), function (body) {\n return getContentFromBody(editor, args, body);\n });\n };\n\n var traverse = function (node, fn) {\n fn(node);\n if (node.firstChild) {\n traverse(node.firstChild, fn);\n }\n if (node.next) {\n traverse(node.next, fn);\n }\n };\n var findMatchingNodes = function (nodeFilters, attributeFilters, node) {\n var nodeMatches = {};\n var attrMatches = {};\n var matches = [];\n if (node.firstChild) {\n traverse(node.firstChild, function (node) {\n each(nodeFilters, function (filter) {\n if (filter.name === node.name) {\n if (nodeMatches[filter.name]) {\n nodeMatches[filter.name].nodes.push(node);\n } else {\n nodeMatches[filter.name] = {\n filter: filter,\n nodes: [node]\n };\n }\n }\n });\n each(attributeFilters, function (filter) {\n if (typeof node.attr(filter.name) === 'string') {\n if (attrMatches[filter.name]) {\n attrMatches[filter.name].nodes.push(node);\n } else {\n attrMatches[filter.name] = {\n filter: filter,\n nodes: [node]\n };\n }\n }\n });\n });\n }\n for (var name in nodeMatches) {\n if (nodeMatches.hasOwnProperty(name)) {\n matches.push(nodeMatches[name]);\n }\n }\n for (var name in attrMatches) {\n if (attrMatches.hasOwnProperty(name)) {\n matches.push(attrMatches[name]);\n }\n }\n return matches;\n };\n var filter$3 = function (nodeFilters, attributeFilters, node) {\n var matches = findMatchingNodes(nodeFilters, attributeFilters, node);\n each(matches, function (match) {\n each(match.filter.callbacks, function (callback) {\n callback(match.nodes, match.filter.name, {});\n });\n });\n };\n\n var defaultFormat$1 = 'html';\n var isTreeNode = function (content) {\n return content instanceof Node$1;\n };\n var moveSelection = function (editor) {\n if (EditorFocus.hasFocus(editor)) {\n CaretFinder.firstPositionIn(editor.getBody()).each(function (pos) {\n var node = pos.getNode();\n var caretPos = NodeType.isTable(node) ? CaretFinder.firstPositionIn(node).getOr(pos) : pos;\n editor.selection.setRng(caretPos.toRange());\n });\n }\n };\n var setEditorHtml = function (editor, html) {\n editor.dom.setHTML(editor.getBody(), html);\n moveSelection(editor);\n };\n var setContentString = function (editor, body, content, args) {\n var forcedRootBlockName, padd;\n if (content.length === 0 || /^\\s+$/.test(content)) {\n padd = '
';\n if (body.nodeName === 'TABLE') {\n content = '' + padd + '';\n } else if (/^(UL|OL)$/.test(body.nodeName)) {\n content = '
  • ' + padd + '
  • ';\n }\n forcedRootBlockName = Settings.getForcedRootBlock(editor);\n if (forcedRootBlockName && editor.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) {\n content = padd;\n content = editor.dom.createHTML(forcedRootBlockName, editor.settings.forced_root_block_attrs, content);\n } else if (!content) {\n content = '
    ';\n }\n setEditorHtml(editor, content);\n editor.fire('SetContent', args);\n } else {\n if (args.format !== 'raw') {\n content = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(editor.parser.parse(content, {\n isRootContent: true,\n insert: true\n }));\n }\n args.content = isWsPreserveElement(Element.fromDom(body)) ? content : Tools.trim(content);\n setEditorHtml(editor, args.content);\n if (!args.no_events) {\n editor.fire('SetContent', args);\n }\n }\n return args.content;\n };\n var setContentTree = function (editor, body, content, args) {\n filter$3(editor.parser.getNodeFilters(), editor.parser.getAttributeFilters(), content);\n var html = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(content);\n args.content = isWsPreserveElement(Element.fromDom(body)) ? html : Tools.trim(html);\n setEditorHtml(editor, args.content);\n if (!args.no_events) {\n editor.fire('SetContent', args);\n }\n return content;\n };\n var setContent$1 = function (editor, content, args) {\n if (args === void 0) {\n args = {};\n }\n args.format = args.format ? args.format : defaultFormat$1;\n args.set = true;\n args.content = isTreeNode(content) ? '' : content;\n if (!isTreeNode(content) && !args.no_events) {\n editor.fire('BeforeSetContent', args);\n content = args.content;\n }\n return Option.from(editor.getBody()).fold(constant(content), function (body) {\n return isTreeNode(content) ? setContentTree(editor, body, content, args) : setContentString(editor, body, content, args);\n });\n };\n\n var DOM$6 = DOMUtils$1.DOM;\n var restoreOriginalStyles = function (editor) {\n DOM$6.setStyle(editor.id, 'display', editor.orgDisplay);\n };\n var safeDestroy = function (x) {\n return Option.from(x).each(function (x) {\n return x.destroy();\n });\n };\n var clearDomReferences = function (editor) {\n editor.contentAreaContainer = editor.formElement = editor.container = editor.editorContainer = null;\n editor.bodyElement = editor.contentDocument = editor.contentWindow = null;\n editor.iframeElement = editor.targetElm = null;\n if (editor.selection) {\n editor.selection = editor.selection.win = editor.selection.dom = editor.selection.dom.doc = null;\n }\n };\n var restoreForm = function (editor) {\n var form = editor.formElement;\n if (form) {\n if (form._mceOldSubmit) {\n form.submit = form._mceOldSubmit;\n form._mceOldSubmit = null;\n }\n DOM$6.unbind(form, 'submit reset', editor.formEventDelegate);\n }\n };\n var remove$7 = function (editor) {\n if (!editor.removed) {\n var _selectionOverrides = editor._selectionOverrides, editorUpload = editor.editorUpload;\n var body = editor.getBody();\n var element = editor.getElement();\n if (body) {\n editor.save({ is_removing: true });\n }\n editor.removed = true;\n editor.unbindAllNativeEvents();\n if (editor.hasHiddenInput && element) {\n DOM$6.remove(element.nextSibling);\n }\n Events.fireRemove(editor);\n editor.editorManager.remove(editor);\n if (!editor.inline && body) {\n restoreOriginalStyles(editor);\n }\n Events.fireDetach(editor);\n DOM$6.remove(editor.getContainer());\n safeDestroy(_selectionOverrides);\n safeDestroy(editorUpload);\n editor.destroy();\n }\n };\n var destroy = function (editor, automatic) {\n var selection = editor.selection, dom = editor.dom;\n if (editor.destroyed) {\n return;\n }\n if (!automatic && !editor.removed) {\n editor.remove();\n return;\n }\n if (!automatic) {\n editor.editorManager.off('beforeunload', editor._beforeUnload);\n if (editor.theme && editor.theme.destroy) {\n editor.theme.destroy();\n }\n safeDestroy(selection);\n safeDestroy(dom);\n }\n restoreForm(editor);\n clearDomReferences(editor);\n editor.destroyed = true;\n };\n\n var DOM$7 = DOMUtils$1.DOM;\n var extend$4 = Tools.extend, each$l = Tools.each;\n var resolve$4 = Tools.resolve;\n var ie$2 = Env.ie;\n var Editor = function (id, settings, editorManager) {\n var self = this;\n var documentBaseUrl = self.documentBaseUrl = editorManager.documentBaseURL;\n var baseUri = editorManager.baseURI;\n settings = getEditorSettings(self, id, documentBaseUrl, editorManager.defaultSettings, settings);\n self.settings = settings;\n AddOnManager.language = settings.language || 'en';\n AddOnManager.languageLoad = settings.language_load;\n AddOnManager.baseURL = editorManager.baseURL;\n self.id = id;\n self.setDirty(false);\n self.plugins = {};\n self.documentBaseURI = new URI(settings.document_base_url, { base_uri: baseUri });\n self.baseURI = baseUri;\n self.contentCSS = [];\n self.contentStyles = [];\n self.shortcuts = new Shortcuts(self);\n self.loadedCSS = {};\n self.editorCommands = new EditorCommands(self);\n self.suffix = editorManager.suffix;\n self.editorManager = editorManager;\n self.inline = settings.inline;\n self.buttons = {};\n self.menuItems = {};\n if (settings.cache_suffix) {\n Env.cacheSuffix = settings.cache_suffix.replace(/^[\\?\\&]+/, '');\n }\n if (settings.override_viewport === false) {\n Env.overrideViewPort = false;\n }\n editorManager.fire('SetupEditor', { editor: self });\n self.execCallback('setup', self);\n self.$ = DomQuery.overrideDefaults(function () {\n return {\n context: self.inline ? self.getBody() : self.getDoc(),\n element: self.getBody()\n };\n });\n };\n Editor.prototype = {\n render: function () {\n Render.render(this);\n },\n focus: function (skipFocus) {\n EditorFocus.focus(this, skipFocus);\n },\n hasFocus: function () {\n return EditorFocus.hasFocus(this);\n },\n execCallback: function (name) {\n var x = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n x[_i - 1] = arguments[_i];\n }\n var self = this;\n var callback = self.settings[name], scope;\n if (!callback) {\n return;\n }\n if (self.callbackLookup && (scope = self.callbackLookup[name])) {\n callback = scope.func;\n scope = scope.scope;\n }\n if (typeof callback === 'string') {\n scope = callback.replace(/\\.\\w+$/, '');\n scope = scope ? resolve$4(scope) : 0;\n callback = resolve$4(callback);\n self.callbackLookup = self.callbackLookup || {};\n self.callbackLookup[name] = {\n func: callback,\n scope: scope\n };\n }\n return callback.apply(scope || self, Array.prototype.slice.call(arguments, 1));\n },\n translate: function (text) {\n if (text && Tools.is(text, 'string')) {\n var lang_1 = this.settings.language || 'en', i18n_1 = this.editorManager.i18n;\n text = i18n_1.data[lang_1 + '.' + text] || text.replace(/\\{\\#([^\\}]+)\\}/g, function (a, b) {\n return i18n_1.data[lang_1 + '.' + b] || '{#' + b + '}';\n });\n }\n return this.editorManager.translate(text);\n },\n getLang: function (name, defaultVal) {\n return this.editorManager.i18n.data[(this.settings.language || 'en') + '.' + name] || (defaultVal !== undefined ? defaultVal : '{#' + name + '}');\n },\n getParam: function (name, defaultVal, type) {\n return getParam(this, name, defaultVal, type);\n },\n nodeChanged: function (args) {\n this._nodeChangeDispatcher.nodeChanged(args);\n },\n addButton: function (name, settings) {\n var self = this;\n if (settings.cmd) {\n settings.onclick = function () {\n self.execCommand(settings.cmd);\n };\n }\n if (settings.stateSelector && typeof settings.active === 'undefined') {\n settings.active = false;\n }\n if (!settings.text && !settings.icon) {\n settings.icon = name;\n }\n settings.tooltip = settings.tooltip || settings.title;\n self.buttons[name] = settings;\n },\n addSidebar: function (name, settings) {\n return Sidebar.add(this, name, settings);\n },\n addMenuItem: function (name, settings) {\n var self = this;\n if (settings.cmd) {\n settings.onclick = function () {\n self.execCommand(settings.cmd);\n };\n }\n self.menuItems[name] = settings;\n },\n addContextToolbar: function (predicate, items) {\n var self = this;\n var selector;\n self.contextToolbars = self.contextToolbars || [];\n if (typeof predicate === 'string') {\n selector = predicate;\n predicate = function (elm) {\n return self.dom.is(elm, selector);\n };\n }\n self.contextToolbars.push({\n id: Uuid.uuid('mcet'),\n predicate: predicate,\n items: items\n });\n },\n addCommand: function (name, callback, scope) {\n this.editorCommands.addCommand(name, callback, scope);\n },\n addQueryStateHandler: function (name, callback, scope) {\n this.editorCommands.addQueryStateHandler(name, callback, scope);\n },\n addQueryValueHandler: function (name, callback, scope) {\n this.editorCommands.addQueryValueHandler(name, callback, scope);\n },\n addShortcut: function (pattern, desc, cmdFunc, scope) {\n this.shortcuts.add(pattern, desc, cmdFunc, scope);\n },\n execCommand: function (cmd, ui, value, args) {\n return this.editorCommands.execCommand(cmd, ui, value, args);\n },\n queryCommandState: function (cmd) {\n return this.editorCommands.queryCommandState(cmd);\n },\n queryCommandValue: function (cmd) {\n return this.editorCommands.queryCommandValue(cmd);\n },\n queryCommandSupported: function (cmd) {\n return this.editorCommands.queryCommandSupported(cmd);\n },\n show: function () {\n var self = this;\n if (self.hidden) {\n self.hidden = false;\n if (self.inline) {\n self.getBody().contentEditable = true;\n } else {\n DOM$7.show(self.getContainer());\n DOM$7.hide(self.id);\n }\n self.load();\n self.fire('show');\n }\n },\n hide: function () {\n var self = this, doc = self.getDoc();\n if (!self.hidden) {\n if (ie$2 && doc && !self.inline) {\n doc.execCommand('SelectAll');\n }\n self.save();\n if (self.inline) {\n self.getBody().contentEditable = false;\n if (self === self.editorManager.focusedEditor) {\n self.editorManager.focusedEditor = null;\n }\n } else {\n DOM$7.hide(self.getContainer());\n DOM$7.setStyle(self.id, 'display', self.orgDisplay);\n }\n self.hidden = true;\n self.fire('hide');\n }\n },\n isHidden: function () {\n return !!this.hidden;\n },\n setProgressState: function (state, time) {\n this.fire('ProgressState', {\n state: state,\n time: time\n });\n },\n load: function (args) {\n var self = this;\n var elm = self.getElement(), html;\n if (self.removed) {\n return '';\n }\n if (elm) {\n args = args || {};\n args.load = true;\n html = self.setContent(elm.value !== undefined ? elm.value : elm.innerHTML, args);\n args.element = elm;\n if (!args.no_events) {\n self.fire('LoadContent', args);\n }\n args.element = elm = null;\n return html;\n }\n },\n save: function (args) {\n var self = this;\n var elm = self.getElement(), html, form;\n if (!elm || !self.initialized || self.removed) {\n return;\n }\n args = args || {};\n args.save = true;\n args.element = elm;\n html = args.content = self.getContent(args);\n if (!args.no_events) {\n self.fire('SaveContent', args);\n }\n if (args.format === 'raw') {\n self.fire('RawSaveContent', args);\n }\n html = args.content;\n if (!/TEXTAREA|INPUT/i.test(elm.nodeName)) {\n if (args.is_removing || !self.inline) {\n elm.innerHTML = html;\n }\n if (form = DOM$7.getParent(self.id, 'form')) {\n each$l(form.elements, function (elm) {\n if (elm.name === self.id) {\n elm.value = html;\n return false;\n }\n });\n }\n } else {\n elm.value = html;\n }\n args.element = elm = null;\n if (args.set_dirty !== false) {\n self.setDirty(false);\n }\n return html;\n },\n setContent: function (content, args) {\n return setContent$1(this, content, args);\n },\n getContent: function (args) {\n return getContent$1(this, args);\n },\n insertContent: function (content, args) {\n if (args) {\n content = extend$4({ content: content }, args);\n }\n this.execCommand('mceInsertContent', false, content);\n },\n isDirty: function () {\n return !this.isNotDirty;\n },\n setDirty: function (state) {\n var oldState = !this.isNotDirty;\n this.isNotDirty = !state;\n if (state && state !== oldState) {\n this.fire('dirty');\n }\n },\n setMode: function (mode) {\n setMode(this, mode);\n },\n getContainer: function () {\n var self = this;\n if (!self.container) {\n self.container = DOM$7.get(self.editorContainer || self.id + '_parent');\n }\n return self.container;\n },\n getContentAreaContainer: function () {\n return this.contentAreaContainer;\n },\n getElement: function () {\n if (!this.targetElm) {\n this.targetElm = DOM$7.get(this.id);\n }\n return this.targetElm;\n },\n getWin: function () {\n var self = this;\n var elm;\n if (!self.contentWindow) {\n elm = self.iframeElement;\n if (elm) {\n self.contentWindow = elm.contentWindow;\n }\n }\n return self.contentWindow;\n },\n getDoc: function () {\n var self = this;\n var win;\n if (!self.contentDocument) {\n win = self.getWin();\n if (win) {\n self.contentDocument = win.document;\n }\n }\n return self.contentDocument;\n },\n getBody: function () {\n var doc = this.getDoc();\n return this.bodyElement || (doc ? doc.body : null);\n },\n convertURL: function (url, name, elm) {\n var self = this, settings = self.settings;\n if (settings.urlconverter_callback) {\n return self.execCallback('urlconverter_callback', url, elm, true, name);\n }\n if (!settings.convert_urls || elm && elm.nodeName === 'LINK' || url.indexOf('file:') === 0 || url.length === 0) {\n return url;\n }\n if (settings.relative_urls) {\n return self.documentBaseURI.toRelative(url);\n }\n url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host);\n return url;\n },\n addVisual: function (elm) {\n var self = this;\n var settings = self.settings;\n var dom = self.dom;\n var cls;\n elm = elm || self.getBody();\n if (self.hasVisual === undefined) {\n self.hasVisual = settings.visual;\n }\n each$l(dom.select('table,a', elm), function (elm) {\n var value;\n switch (elm.nodeName) {\n case 'TABLE':\n cls = settings.visual_table_class || 'mce-item-table';\n value = dom.getAttrib(elm, 'border');\n if ((!value || value === '0') && self.hasVisual) {\n dom.addClass(elm, cls);\n } else {\n dom.removeClass(elm, cls);\n }\n return;\n case 'A':\n if (!dom.getAttrib(elm, 'href')) {\n value = dom.getAttrib(elm, 'name') || elm.id;\n cls = settings.visual_anchor_class || 'mce-item-anchor';\n if (value && self.hasVisual) {\n dom.addClass(elm, cls);\n } else {\n dom.removeClass(elm, cls);\n }\n }\n return;\n }\n });\n self.fire('VisualAid', {\n element: elm,\n hasVisual: self.hasVisual\n });\n },\n remove: function () {\n remove$7(this);\n },\n destroy: function (automatic) {\n destroy(this, automatic);\n },\n uploadImages: function (callback) {\n return this.editorUpload.uploadImages(callback);\n },\n _scanForImages: function () {\n return this.editorUpload.scanForImages();\n }\n };\n extend$4(Editor.prototype, EditorObservable$1);\n\n var isEditorUIElement = function (elm) {\n return elm.className.toString().indexOf('mce-') !== -1;\n };\n var FocusManager = { isEditorUIElement: isEditorUIElement };\n\n var isManualNodeChange = function (e) {\n return e.type === 'nodechange' && e.selectionChange;\n };\n var registerPageMouseUp = function (editor, throttledStore) {\n var mouseUpPage = function () {\n throttledStore.throttle();\n };\n DOMUtils$1.DOM.bind(domGlobals.document, 'mouseup', mouseUpPage);\n editor.on('remove', function () {\n DOMUtils$1.DOM.unbind(domGlobals.document, 'mouseup', mouseUpPage);\n });\n };\n var registerFocusOut = function (editor) {\n editor.on('focusout', function () {\n SelectionBookmark.store(editor);\n });\n };\n var registerMouseUp = function (editor, throttledStore) {\n editor.on('mouseup touchend', function (e) {\n throttledStore.throttle();\n });\n };\n var registerEditorEvents = function (editor, throttledStore) {\n var browser = PlatformDetection$1.detect().browser;\n if (browser.isIE()) {\n registerFocusOut(editor);\n } else {\n registerMouseUp(editor, throttledStore);\n }\n editor.on('keyup nodechange', function (e) {\n if (!isManualNodeChange(e)) {\n SelectionBookmark.store(editor);\n }\n });\n };\n var register$3 = function (editor) {\n var throttledStore = first(function () {\n SelectionBookmark.store(editor);\n }, 0);\n if (editor.inline) {\n registerPageMouseUp(editor, throttledStore);\n }\n editor.on('init', function () {\n registerEditorEvents(editor, throttledStore);\n });\n editor.on('remove', function () {\n throttledStore.cancel();\n });\n };\n var SelectionRestore = { register: register$3 };\n\n var documentFocusInHandler;\n var DOM$8 = DOMUtils$1.DOM;\n var isEditorUIElement$1 = function (elm) {\n return FocusManager.isEditorUIElement(elm);\n };\n var isUIElement = function (editor, elm) {\n var customSelector = editor ? editor.settings.custom_ui_selector : '';\n var parent = DOM$8.getParent(elm, function (elm) {\n return isEditorUIElement$1(elm) || (customSelector ? editor.dom.is(elm, customSelector) : false);\n });\n return parent !== null;\n };\n var getActiveElement = function () {\n try {\n return domGlobals.document.activeElement;\n } catch (ex) {\n return domGlobals.document.body;\n }\n };\n var registerEvents = function (editorManager, e) {\n var editor = e.editor;\n SelectionRestore.register(editor);\n editor.on('focusin', function () {\n var self = this;\n var focusedEditor = editorManager.focusedEditor;\n if (focusedEditor !== self) {\n if (focusedEditor) {\n focusedEditor.fire('blur', { focusedEditor: self });\n }\n editorManager.setActive(self);\n editorManager.focusedEditor = self;\n self.fire('focus', { blurredEditor: focusedEditor });\n self.focus(true);\n }\n });\n editor.on('focusout', function () {\n var self = this;\n Delay.setEditorTimeout(self, function () {\n var focusedEditor = editorManager.focusedEditor;\n if (!isUIElement(self, getActiveElement()) && focusedEditor === self) {\n self.fire('blur', { focusedEditor: null });\n editorManager.focusedEditor = null;\n }\n });\n });\n if (!documentFocusInHandler) {\n documentFocusInHandler = function (e) {\n var activeEditor = editorManager.activeEditor;\n var target;\n target = e.target;\n if (activeEditor && target.ownerDocument === domGlobals.document) {\n if (target !== domGlobals.document.body && !isUIElement(activeEditor, target) && editorManager.focusedEditor === activeEditor) {\n activeEditor.fire('blur', { focusedEditor: null });\n editorManager.focusedEditor = null;\n }\n }\n };\n DOM$8.bind(domGlobals.document, 'focusin', documentFocusInHandler);\n }\n };\n var unregisterDocumentEvents = function (editorManager, e) {\n if (editorManager.focusedEditor === e.editor) {\n editorManager.focusedEditor = null;\n }\n if (!editorManager.activeEditor) {\n DOM$8.unbind(domGlobals.document, 'focusin', documentFocusInHandler);\n documentFocusInHandler = null;\n }\n };\n var setup$h = function (editorManager) {\n editorManager.on('AddEditor', curry(registerEvents, editorManager));\n editorManager.on('RemoveEditor', curry(unregisterDocumentEvents, editorManager));\n };\n var FocusController = {\n setup: setup$h,\n isEditorUIElement: isEditorUIElement$1,\n isUIElement: isUIElement\n };\n\n var DOM$9 = DOMUtils$1.DOM;\n var explode$4 = Tools.explode, each$m = Tools.each, extend$5 = Tools.extend;\n var instanceCounter = 0, beforeUnloadDelegate, EditorManager, boundGlobalEvents = false;\n var legacyEditors = [];\n var editors = [];\n var isValidLegacyKey = function (id) {\n return id !== 'length';\n };\n var globalEventDelegate = function (e) {\n var type = e.type;\n each$m(EditorManager.get(), function (editor) {\n switch (type) {\n case 'scroll':\n editor.fire('ScrollWindow', e);\n break;\n case 'resize':\n editor.fire('ResizeWindow', e);\n break;\n }\n });\n };\n var toggleGlobalEvents = function (state) {\n if (state !== boundGlobalEvents) {\n if (state) {\n DomQuery(window).on('resize scroll', globalEventDelegate);\n } else {\n DomQuery(window).off('resize scroll', globalEventDelegate);\n }\n boundGlobalEvents = state;\n }\n };\n var removeEditorFromList = function (targetEditor) {\n var oldEditors = editors;\n delete legacyEditors[targetEditor.id];\n for (var i = 0; i < legacyEditors.length; i++) {\n if (legacyEditors[i] === targetEditor) {\n legacyEditors.splice(i, 1);\n break;\n }\n }\n editors = filter(editors, function (editor) {\n return targetEditor !== editor;\n });\n if (EditorManager.activeEditor === targetEditor) {\n EditorManager.activeEditor = editors.length > 0 ? editors[0] : null;\n }\n if (EditorManager.focusedEditor === targetEditor) {\n EditorManager.focusedEditor = null;\n }\n return oldEditors.length !== editors.length;\n };\n var purgeDestroyedEditor = function (editor) {\n if (editor && editor.initialized && !(editor.getContainer() || editor.getBody()).parentNode) {\n removeEditorFromList(editor);\n editor.unbindAllNativeEvents();\n editor.destroy(true);\n editor.removed = true;\n editor = null;\n }\n return editor;\n };\n EditorManager = {\n defaultSettings: {},\n $: DomQuery,\n majorVersion: '4',\n minorVersion: '9.11',\n releaseDate: '2020-07-13',\n editors: legacyEditors,\n i18n: I18n,\n activeEditor: null,\n settings: {},\n setup: function () {\n var self = this;\n var baseURL, documentBaseURL, suffix = '';\n documentBaseURL = URI.getDocumentBaseUrl(domGlobals.document.location);\n if (/^[^:]+:\\/\\/\\/?[^\\/]+\\//.test(documentBaseURL)) {\n documentBaseURL = documentBaseURL.replace(/[\\?#].*$/, '').replace(/[\\/\\\\][^\\/]+$/, '');\n if (!/[\\/\\\\]$/.test(documentBaseURL)) {\n documentBaseURL += '/';\n }\n }\n var preInit = window.tinymce || window.tinyMCEPreInit;\n if (preInit) {\n baseURL = preInit.base || preInit.baseURL;\n suffix = preInit.suffix;\n } else {\n var scripts = domGlobals.document.getElementsByTagName('script');\n for (var i = 0; i < scripts.length; i++) {\n var src = scripts[i].src || '';\n if (src === '') {\n continue;\n }\n var srcScript = src.substring(src.lastIndexOf('/'));\n if (/tinymce(\\.full|\\.jquery|)(\\.min|\\.dev|)\\.js/.test(src)) {\n if (srcScript.indexOf('.min') !== -1) {\n suffix = '.min';\n }\n baseURL = src.substring(0, src.lastIndexOf('/'));\n break;\n }\n }\n if (!baseURL && domGlobals.document.currentScript) {\n var src = domGlobals.document.currentScript.src;\n if (src.indexOf('.min') !== -1) {\n suffix = '.min';\n }\n baseURL = src.substring(0, src.lastIndexOf('/'));\n }\n }\n self.baseURL = new URI(documentBaseURL).toAbsolute(baseURL);\n self.documentBaseURL = documentBaseURL;\n self.baseURI = new URI(self.baseURL);\n self.suffix = suffix;\n FocusController.setup(self);\n },\n overrideDefaults: function (defaultSettings) {\n var baseUrl, suffix;\n baseUrl = defaultSettings.base_url;\n if (baseUrl) {\n this.baseURL = new URI(this.documentBaseURL).toAbsolute(baseUrl.replace(/\\/+$/, ''));\n this.baseURI = new URI(this.baseURL);\n }\n suffix = defaultSettings.suffix;\n if (defaultSettings.suffix) {\n this.suffix = suffix;\n }\n this.defaultSettings = defaultSettings;\n var pluginBaseUrls = defaultSettings.plugin_base_urls;\n for (var name in pluginBaseUrls) {\n AddOnManager.PluginManager.urls[name] = pluginBaseUrls[name];\n }\n },\n init: function (settings) {\n var self = this;\n var result, invalidInlineTargets;\n invalidInlineTargets = Tools.makeMap('area base basefont br col frame hr img input isindex link meta param embed source wbr track ' + 'colgroup option tbody tfoot thead tr script noscript style textarea video audio iframe object menu', ' ');\n var isInvalidInlineTarget = function (settings, elm) {\n return settings.inline && elm.tagName.toLowerCase() in invalidInlineTargets;\n };\n var createId = function (elm) {\n var id = elm.id;\n if (!id) {\n id = elm.name;\n if (id && !DOM$9.get(id)) {\n id = elm.name;\n } else {\n id = DOM$9.uniqueId();\n }\n elm.setAttribute('id', id);\n }\n return id;\n };\n var execCallback = function (name) {\n var callback = settings[name];\n if (!callback) {\n return;\n }\n return callback.apply(self, Array.prototype.slice.call(arguments, 2));\n };\n var hasClass = function (elm, className) {\n return className.constructor === RegExp ? className.test(elm.className) : DOM$9.hasClass(elm, className);\n };\n var findTargets = function (settings) {\n var l, targets = [];\n if (Env.ie && Env.ie < 11) {\n ErrorReporter.initError('TinyMCE does not support the browser you are using. For a list of supported' + ' browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/');\n return [];\n }\n if (settings.types) {\n each$m(settings.types, function (type) {\n targets = targets.concat(DOM$9.select(type.selector));\n });\n return targets;\n } else if (settings.selector) {\n return DOM$9.select(settings.selector);\n } else if (settings.target) {\n return [settings.target];\n }\n switch (settings.mode) {\n case 'exact':\n l = settings.elements || '';\n if (l.length > 0) {\n each$m(explode$4(l), function (id) {\n var elm;\n if (elm = DOM$9.get(id)) {\n targets.push(elm);\n } else {\n each$m(domGlobals.document.forms, function (f) {\n each$m(f.elements, function (e) {\n if (e.name === id) {\n id = 'mce_editor_' + instanceCounter++;\n DOM$9.setAttrib(e, 'id', id);\n targets.push(e);\n }\n });\n });\n }\n });\n }\n break;\n case 'textareas':\n case 'specific_textareas':\n each$m(DOM$9.select('textarea'), function (elm) {\n if (settings.editor_deselector && hasClass(elm, settings.editor_deselector)) {\n return;\n }\n if (!settings.editor_selector || hasClass(elm, settings.editor_selector)) {\n targets.push(elm);\n }\n });\n break;\n }\n return targets;\n };\n var provideResults = function (editors) {\n result = editors;\n };\n var initEditors = function () {\n var initCount = 0;\n var editors = [];\n var targets;\n var createEditor = function (id, settings, targetElm) {\n var editor = new Editor(id, settings, self);\n editors.push(editor);\n editor.on('init', function () {\n if (++initCount === targets.length) {\n provideResults(editors);\n }\n });\n editor.targetElm = editor.targetElm || targetElm;\n editor.render();\n };\n DOM$9.unbind(window, 'ready', initEditors);\n execCallback('onpageload');\n targets = DomQuery.unique(findTargets(settings));\n if (settings.types) {\n each$m(settings.types, function (type) {\n Tools.each(targets, function (elm) {\n if (DOM$9.is(elm, type.selector)) {\n createEditor(createId(elm), extend$5({}, settings, type), elm);\n return false;\n }\n return true;\n });\n });\n return;\n }\n Tools.each(targets, function (elm) {\n purgeDestroyedEditor(self.get(elm.id));\n });\n targets = Tools.grep(targets, function (elm) {\n return !self.get(elm.id);\n });\n if (targets.length === 0) {\n provideResults([]);\n } else {\n each$m(targets, function (elm) {\n if (isInvalidInlineTarget(settings, elm)) {\n ErrorReporter.initError('Could not initialize inline editor on invalid inline target element', elm);\n } else {\n createEditor(createId(elm), settings, elm);\n }\n });\n }\n };\n self.settings = settings;\n DOM$9.bind(window, 'ready', initEditors);\n return new promiseObj(function (resolve) {\n if (result) {\n resolve(result);\n } else {\n provideResults = function (editors) {\n resolve(editors);\n };\n }\n });\n },\n get: function (id) {\n if (arguments.length === 0) {\n return editors.slice(0);\n } else if (isString(id)) {\n return find(editors, function (editor) {\n return editor.id === id;\n }).getOr(null);\n } else if (isNumber(id)) {\n return editors[id] ? editors[id] : null;\n } else {\n return null;\n }\n },\n add: function (editor) {\n var self = this;\n var existingEditor;\n existingEditor = legacyEditors[editor.id];\n if (existingEditor === editor) {\n return editor;\n }\n if (self.get(editor.id) === null) {\n if (isValidLegacyKey(editor.id)) {\n legacyEditors[editor.id] = editor;\n }\n legacyEditors.push(editor);\n editors.push(editor);\n }\n toggleGlobalEvents(true);\n self.activeEditor = editor;\n self.fire('AddEditor', { editor: editor });\n if (!beforeUnloadDelegate) {\n beforeUnloadDelegate = function () {\n self.fire('BeforeUnload');\n };\n DOM$9.bind(window, 'beforeunload', beforeUnloadDelegate);\n }\n return editor;\n },\n createEditor: function (id, settings) {\n return this.add(new Editor(id, settings, this));\n },\n remove: function (selector) {\n var self = this;\n var i, editor;\n if (!selector) {\n for (i = editors.length - 1; i >= 0; i--) {\n self.remove(editors[i]);\n }\n return;\n }\n if (isString(selector)) {\n each$m(DOM$9.select(selector), function (elm) {\n editor = self.get(elm.id);\n if (editor) {\n self.remove(editor);\n }\n });\n return;\n }\n editor = selector;\n if (isNull(self.get(editor.id))) {\n return null;\n }\n if (removeEditorFromList(editor)) {\n self.fire('RemoveEditor', { editor: editor });\n }\n if (editors.length === 0) {\n DOM$9.unbind(window, 'beforeunload', beforeUnloadDelegate);\n }\n editor.remove();\n toggleGlobalEvents(editors.length > 0);\n return editor;\n },\n execCommand: function (cmd, ui, value) {\n var self = this, editor = self.get(value);\n switch (cmd) {\n case 'mceAddEditor':\n if (!self.get(value)) {\n new Editor(value, self.settings, self).render();\n }\n return true;\n case 'mceRemoveEditor':\n if (editor) {\n editor.remove();\n }\n return true;\n case 'mceToggleEditor':\n if (!editor) {\n self.execCommand('mceAddEditor', 0, value);\n return true;\n }\n if (editor.isHidden()) {\n editor.show();\n } else {\n editor.hide();\n }\n return true;\n }\n if (self.activeEditor) {\n return self.activeEditor.execCommand(cmd, ui, value);\n }\n return false;\n },\n triggerSave: function () {\n each$m(editors, function (editor) {\n editor.save();\n });\n },\n addI18n: function (code, items) {\n I18n.add(code, items);\n },\n translate: function (text) {\n return I18n.translate(text);\n },\n setActive: function (editor) {\n var activeEditor = this.activeEditor;\n if (this.activeEditor !== editor) {\n if (activeEditor) {\n activeEditor.fire('deactivate', { relatedTarget: editor });\n }\n editor.fire('activate', { relatedTarget: activeEditor });\n }\n this.activeEditor = editor;\n }\n };\n extend$5(EditorManager, Observable);\n EditorManager.setup();\n var EditorManager$1 = EditorManager;\n\n function RangeUtils(dom) {\n var walk = function (rng, callback) {\n return RangeWalk.walk(dom, rng, callback);\n };\n var split = SplitRange.split;\n var normalize = function (rng) {\n return NormalizeRange.normalize(dom, rng).fold(constant(false), function (normalizedRng) {\n rng.setStart(normalizedRng.startContainer, normalizedRng.startOffset);\n rng.setEnd(normalizedRng.endContainer, normalizedRng.endOffset);\n return true;\n });\n };\n return {\n walk: walk,\n split: split,\n normalize: normalize\n };\n }\n (function (RangeUtils) {\n RangeUtils.compareRanges = RangeCompare.isEq;\n RangeUtils.getCaretRangeFromPoint = CaretRangeFromPoint.fromPoint;\n RangeUtils.getSelectedNode = getSelectedNode;\n RangeUtils.getNode = getNode;\n }(RangeUtils || (RangeUtils = {})));\n var RangeUtils$1 = RangeUtils;\n\n var min = Math.min, max = Math.max, round$2 = Math.round;\n var relativePosition = function (rect, targetRect, rel) {\n var x, y, w, h, targetW, targetH;\n x = targetRect.x;\n y = targetRect.y;\n w = rect.w;\n h = rect.h;\n targetW = targetRect.w;\n targetH = targetRect.h;\n rel = (rel || '').split('');\n if (rel[0] === 'b') {\n y += targetH;\n }\n if (rel[1] === 'r') {\n x += targetW;\n }\n if (rel[0] === 'c') {\n y += round$2(targetH / 2);\n }\n if (rel[1] === 'c') {\n x += round$2(targetW / 2);\n }\n if (rel[3] === 'b') {\n y -= h;\n }\n if (rel[4] === 'r') {\n x -= w;\n }\n if (rel[3] === 'c') {\n y -= round$2(h / 2);\n }\n if (rel[4] === 'c') {\n x -= round$2(w / 2);\n }\n return create$4(x, y, w, h);\n };\n var findBestRelativePosition = function (rect, targetRect, constrainRect, rels) {\n var pos, i;\n for (i = 0; i < rels.length; i++) {\n pos = relativePosition(rect, targetRect, rels[i]);\n if (pos.x >= constrainRect.x && pos.x + pos.w <= constrainRect.w + constrainRect.x && pos.y >= constrainRect.y && pos.y + pos.h <= constrainRect.h + constrainRect.y) {\n return rels[i];\n }\n }\n return null;\n };\n var inflate = function (rect, w, h) {\n return create$4(rect.x - w, rect.y - h, rect.w + w * 2, rect.h + h * 2);\n };\n var intersect = function (rect, cropRect) {\n var x1, y1, x2, y2;\n x1 = max(rect.x, cropRect.x);\n y1 = max(rect.y, cropRect.y);\n x2 = min(rect.x + rect.w, cropRect.x + cropRect.w);\n y2 = min(rect.y + rect.h, cropRect.y + cropRect.h);\n if (x2 - x1 < 0 || y2 - y1 < 0) {\n return null;\n }\n return create$4(x1, y1, x2 - x1, y2 - y1);\n };\n var clamp$1 = function (rect, clampRect, fixedSize) {\n var underflowX1, underflowY1, overflowX2, overflowY2, x1, y1, x2, y2, cx2, cy2;\n x1 = rect.x;\n y1 = rect.y;\n x2 = rect.x + rect.w;\n y2 = rect.y + rect.h;\n cx2 = clampRect.x + clampRect.w;\n cy2 = clampRect.y + clampRect.h;\n underflowX1 = max(0, clampRect.x - x1);\n underflowY1 = max(0, clampRect.y - y1);\n overflowX2 = max(0, x2 - cx2);\n overflowY2 = max(0, y2 - cy2);\n x1 += underflowX1;\n y1 += underflowY1;\n if (fixedSize) {\n x2 += underflowX1;\n y2 += underflowY1;\n x1 -= overflowX2;\n y1 -= overflowY2;\n }\n x2 -= overflowX2;\n y2 -= overflowY2;\n return create$4(x1, y1, x2 - x1, y2 - y1);\n };\n var create$4 = function (x, y, w, h) {\n return {\n x: x,\n y: y,\n w: w,\n h: h\n };\n };\n var fromClientRect = function (clientRect) {\n return create$4(clientRect.left, clientRect.top, clientRect.width, clientRect.height);\n };\n var Rect = {\n inflate: inflate,\n relativePosition: relativePosition,\n findBestRelativePosition: findBestRelativePosition,\n intersect: intersect,\n clamp: clamp$1,\n create: create$4,\n fromClientRect: fromClientRect\n };\n\n var types = {};\n var Factory = {\n add: function (type, typeClass) {\n types[type.toLowerCase()] = typeClass;\n },\n has: function (type) {\n return !!types[type.toLowerCase()];\n },\n get: function (type) {\n var lctype = type.toLowerCase();\n var controlType = types.hasOwnProperty(lctype) ? types[lctype] : null;\n if (controlType === null) {\n throw new Error('Could not find module for type: ' + type);\n }\n return controlType;\n },\n create: function (type, settings) {\n var ControlType;\n if (typeof type === 'string') {\n settings = settings || {};\n settings.type = type;\n } else {\n settings = type;\n type = settings.type;\n }\n type = type.toLowerCase();\n ControlType = types[type];\n if (!ControlType) {\n throw new Error('Could not find control by type: ' + type);\n }\n ControlType = new ControlType(settings);\n ControlType.type = type;\n return ControlType;\n }\n };\n\n var each$n = Tools.each, extend$6 = Tools.extend;\n var extendClass, initializing;\n var Class = function () {\n };\n Class.extend = extendClass = function (prop) {\n var self = this;\n var _super = self.prototype;\n var prototype, name, member;\n var Class = function () {\n var i, mixins, mixin;\n var self = this;\n if (!initializing) {\n if (self.init) {\n self.init.apply(self, arguments);\n }\n mixins = self.Mixins;\n if (mixins) {\n i = mixins.length;\n while (i--) {\n mixin = mixins[i];\n if (mixin.init) {\n mixin.init.apply(self, arguments);\n }\n }\n }\n }\n };\n var dummy = function () {\n return this;\n };\n var createMethod = function (name, fn) {\n return function () {\n var self = this;\n var tmp = self._super;\n var ret;\n self._super = _super[name];\n ret = fn.apply(self, arguments);\n self._super = tmp;\n return ret;\n };\n };\n initializing = true;\n prototype = new self();\n initializing = false;\n if (prop.Mixins) {\n each$n(prop.Mixins, function (mixin) {\n for (var name_1 in mixin) {\n if (name_1 !== 'init') {\n prop[name_1] = mixin[name_1];\n }\n }\n });\n if (_super.Mixins) {\n prop.Mixins = _super.Mixins.concat(prop.Mixins);\n }\n }\n if (prop.Methods) {\n each$n(prop.Methods.split(','), function (name) {\n prop[name] = dummy;\n });\n }\n if (prop.Properties) {\n each$n(prop.Properties.split(','), function (name) {\n var fieldName = '_' + name;\n prop[name] = function (value) {\n var self = this;\n if (value !== undefined) {\n self[fieldName] = value;\n return self;\n }\n return self[fieldName];\n };\n });\n }\n if (prop.Statics) {\n each$n(prop.Statics, function (func, name) {\n Class[name] = func;\n });\n }\n if (prop.Defaults && _super.Defaults) {\n prop.Defaults = extend$6({}, _super.Defaults, prop.Defaults);\n }\n for (name in prop) {\n member = prop[name];\n if (typeof member === 'function' && _super[name]) {\n prototype[name] = createMethod(name, member);\n } else {\n prototype[name] = member;\n }\n }\n Class.prototype = prototype;\n Class.constructor = Class;\n Class.extend = extendClass;\n return Class;\n };\n\n var min$1 = Math.min, max$1 = Math.max, round$3 = Math.round;\n var Color = function (value) {\n var self = {};\n var r = 0, g = 0, b = 0;\n var rgb2hsv = function (r, g, b) {\n var h, s, v, d, minRGB, maxRGB;\n h = 0;\n s = 0;\n v = 0;\n r = r / 255;\n g = g / 255;\n b = b / 255;\n minRGB = min$1(r, min$1(g, b));\n maxRGB = max$1(r, max$1(g, b));\n if (minRGB === maxRGB) {\n v = minRGB;\n return {\n h: 0,\n s: 0,\n v: v * 100\n };\n }\n d = r === minRGB ? g - b : b === minRGB ? r - g : b - r;\n h = r === minRGB ? 3 : b === minRGB ? 1 : 5;\n h = 60 * (h - d / (maxRGB - minRGB));\n s = (maxRGB - minRGB) / maxRGB;\n v = maxRGB;\n return {\n h: round$3(h),\n s: round$3(s * 100),\n v: round$3(v * 100)\n };\n };\n var hsvToRgb = function (hue, saturation, brightness) {\n var side, chroma, x, match;\n hue = (parseInt(hue, 10) || 0) % 360;\n saturation = parseInt(saturation, 10) / 100;\n brightness = parseInt(brightness, 10) / 100;\n saturation = max$1(0, min$1(saturation, 1));\n brightness = max$1(0, min$1(brightness, 1));\n if (saturation === 0) {\n r = g = b = round$3(255 * brightness);\n return;\n }\n side = hue / 60;\n chroma = brightness * saturation;\n x = chroma * (1 - Math.abs(side % 2 - 1));\n match = brightness - chroma;\n switch (Math.floor(side)) {\n case 0:\n r = chroma;\n g = x;\n b = 0;\n break;\n case 1:\n r = x;\n g = chroma;\n b = 0;\n break;\n case 2:\n r = 0;\n g = chroma;\n b = x;\n break;\n case 3:\n r = 0;\n g = x;\n b = chroma;\n break;\n case 4:\n r = x;\n g = 0;\n b = chroma;\n break;\n case 5:\n r = chroma;\n g = 0;\n b = x;\n break;\n default:\n r = g = b = 0;\n }\n r = round$3(255 * (r + match));\n g = round$3(255 * (g + match));\n b = round$3(255 * (b + match));\n };\n var toHex = function () {\n var hex = function (val) {\n val = parseInt(val, 10).toString(16);\n return val.length > 1 ? val : '0' + val;\n };\n return '#' + hex(r) + hex(g) + hex(b);\n };\n var toRgb = function () {\n return {\n r: r,\n g: g,\n b: b\n };\n };\n var toHsv = function () {\n return rgb2hsv(r, g, b);\n };\n var parse = function (value) {\n var matches;\n if (typeof value === 'object') {\n if ('r' in value) {\n r = value.r;\n g = value.g;\n b = value.b;\n } else if ('v' in value) {\n hsvToRgb(value.h, value.s, value.v);\n }\n } else {\n if (matches = /rgb\\s*\\(\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*,\\s*([0-9]+)[^\\)]*\\)/gi.exec(value)) {\n r = parseInt(matches[1], 10);\n g = parseInt(matches[2], 10);\n b = parseInt(matches[3], 10);\n } else if (matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value)) {\n r = parseInt(matches[1], 16);\n g = parseInt(matches[2], 16);\n b = parseInt(matches[3], 16);\n } else if (matches = /#([0-F])([0-F])([0-F])/gi.exec(value)) {\n r = parseInt(matches[1] + matches[1], 16);\n g = parseInt(matches[2] + matches[2], 16);\n b = parseInt(matches[3] + matches[3], 16);\n }\n }\n r = r < 0 ? 0 : r > 255 ? 255 : r;\n g = g < 0 ? 0 : g > 255 ? 255 : g;\n b = b < 0 ? 0 : b > 255 ? 255 : b;\n return self;\n };\n if (value) {\n parse(value);\n }\n self.toRgb = toRgb;\n self.toHsv = toHsv;\n self.toHex = toHex;\n self.parse = parse;\n return self;\n };\n\n var serialize = function (o, quote) {\n var i, v, t, name;\n quote = quote || '\"';\n if (o === null) {\n return 'null';\n }\n t = typeof o;\n if (t === 'string') {\n v = '\\bb\\tt\\nn\\ff\\rr\"\"\\'\\'\\\\\\\\';\n return quote + o.replace(/([\\u0080-\\uFFFF\\x00-\\x1f\\\"\\'\\\\])/g, function (a, b) {\n if (quote === '\"' && a === '\\'') {\n return a;\n }\n i = v.indexOf(b);\n if (i + 1) {\n return '\\\\' + v.charAt(i + 1);\n }\n a = b.charCodeAt().toString(16);\n return '\\\\u' + '0000'.substring(a.length) + a;\n }) + quote;\n }\n if (t === 'object') {\n if (o.hasOwnProperty && Object.prototype.toString.call(o) === '[object Array]') {\n for (i = 0, v = '['; i < o.length; i++) {\n v += (i > 0 ? ',' : '') + serialize(o[i], quote);\n }\n return v + ']';\n }\n v = '{';\n for (name in o) {\n if (o.hasOwnProperty(name)) {\n v += typeof o[name] !== 'function' ? (v.length > 1 ? ',' + quote : quote) + name + quote + ':' + serialize(o[name], quote) : '';\n }\n }\n return v + '}';\n }\n return '' + o;\n };\n var JSON$1 = {\n serialize: serialize,\n parse: function (text) {\n try {\n return JSON.parse(text);\n } catch (ex) {\n }\n }\n };\n\n var JSONP = {\n callbacks: {},\n count: 0,\n send: function (settings) {\n var self = this, dom = DOMUtils$1.DOM, count = settings.count !== undefined ? settings.count : self.count;\n var id = 'tinymce_jsonp_' + count;\n self.callbacks[count] = function (json) {\n dom.remove(id);\n delete self.callbacks[count];\n settings.callback(json);\n };\n dom.add(dom.doc.body, 'script', {\n id: id,\n src: settings.url,\n type: 'text/javascript'\n });\n self.count++;\n }\n };\n\n var XHR = {\n send: function (settings) {\n var xhr, count = 0;\n var ready = function () {\n if (!settings.async || xhr.readyState === 4 || count++ > 10000) {\n if (settings.success && count < 10000 && xhr.status === 200) {\n settings.success.call(settings.success_scope, '' + xhr.responseText, xhr, settings);\n } else if (settings.error) {\n settings.error.call(settings.error_scope, count > 10000 ? 'TIMED_OUT' : 'GENERAL', xhr, settings);\n }\n xhr = null;\n } else {\n setTimeout(ready, 10);\n }\n };\n settings.scope = settings.scope || this;\n settings.success_scope = settings.success_scope || settings.scope;\n settings.error_scope = settings.error_scope || settings.scope;\n settings.async = settings.async === false ? false : true;\n settings.data = settings.data || '';\n XHR.fire('beforeInitialize', { settings: settings });\n xhr = XMLHttpRequest();\n if (xhr) {\n if (xhr.overrideMimeType) {\n xhr.overrideMimeType(settings.content_type);\n }\n xhr.open(settings.type || (settings.data ? 'POST' : 'GET'), settings.url, settings.async);\n if (settings.crossDomain) {\n xhr.withCredentials = true;\n }\n if (settings.content_type) {\n xhr.setRequestHeader('Content-Type', settings.content_type);\n }\n if (settings.requestheaders) {\n Tools.each(settings.requestheaders, function (header) {\n xhr.setRequestHeader(header.key, header.value);\n });\n }\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n xhr = XHR.fire('beforeSend', {\n xhr: xhr,\n settings: settings\n }).xhr;\n xhr.send(settings.data);\n if (!settings.async) {\n return ready();\n }\n setTimeout(ready, 10);\n }\n }\n };\n Tools.extend(XHR, Observable);\n\n var extend$7 = Tools.extend;\n var JSONRequest = function (settings) {\n this.settings = extend$7({}, settings);\n this.count = 0;\n };\n JSONRequest.sendRPC = function (o) {\n return new JSONRequest().send(o);\n };\n JSONRequest.prototype = {\n send: function (args) {\n var ecb = args.error, scb = args.success;\n args = extend$7(this.settings, args);\n args.success = function (c, x) {\n c = JSON$1.parse(c);\n if (typeof c === 'undefined') {\n c = { error: 'JSON Parse error.' };\n }\n if (c.error) {\n ecb.call(args.error_scope || args.scope, c.error, x);\n } else {\n scb.call(args.success_scope || args.scope, c.result);\n }\n };\n args.error = function (ty, x) {\n if (ecb) {\n ecb.call(args.error_scope || args.scope, ty, x);\n }\n };\n args.data = JSON$1.serialize({\n id: args.id || 'c' + this.count++,\n method: args.method,\n params: args.params\n });\n args.content_type = 'application/json';\n XHR.send(args);\n }\n };\n\n var create$5 = function () {\n return function () {\n var data = {};\n var keys = [];\n var storage = {\n getItem: function (key) {\n var item = data[key];\n return item ? item : null;\n },\n setItem: function (key, value) {\n keys.push(key);\n data[key] = String(value);\n },\n key: function (index) {\n return keys[index];\n },\n removeItem: function (key) {\n keys = keys.filter(function (k) {\n return k === key;\n });\n delete data[key];\n },\n clear: function () {\n keys = [];\n data = {};\n },\n length: 0\n };\n Object.defineProperty(storage, 'length', {\n get: function () {\n return keys.length;\n },\n configurable: false,\n enumerable: false\n });\n return storage;\n }();\n };\n\n var localStorage;\n try {\n localStorage = domGlobals.window.localStorage;\n } catch (e) {\n localStorage = create$5();\n }\n var LocalStorage = localStorage;\n\n var tinymce = EditorManager$1;\n var publicApi = {\n geom: { Rect: Rect },\n util: {\n Promise: promiseObj,\n Delay: Delay,\n Tools: Tools,\n VK: VK,\n URI: URI,\n Class: Class,\n EventDispatcher: Dispatcher,\n Observable: Observable,\n I18n: I18n,\n XHR: XHR,\n JSON: JSON$1,\n JSONRequest: JSONRequest,\n JSONP: JSONP,\n LocalStorage: LocalStorage,\n Color: Color\n },\n dom: {\n EventUtils: EventUtils,\n Sizzle: Sizzle,\n DomQuery: DomQuery,\n TreeWalker: TreeWalker,\n DOMUtils: DOMUtils$1,\n ScriptLoader: ScriptLoader,\n RangeUtils: RangeUtils$1,\n Serializer: DomSerializer$1,\n ControlSelection: ControlSelection,\n BookmarkManager: BookmarkManager$1,\n Selection: Selection$1,\n Event: EventUtils.Event\n },\n html: {\n Styles: Styles,\n Entities: Entities,\n Node: Node$1,\n Schema: Schema,\n SaxParser: SaxParser$1,\n DomParser: DomParser,\n Writer: Writer,\n Serializer: HtmlSerializer\n },\n ui: { Factory: Factory },\n Env: Env,\n AddOnManager: AddOnManager,\n Annotator: Annotator,\n Formatter: Formatter,\n UndoManager: UndoManager,\n EditorCommands: EditorCommands,\n WindowManager: WindowManager,\n NotificationManager: NotificationManager,\n EditorObservable: EditorObservable$1,\n Shortcuts: Shortcuts,\n Editor: Editor,\n FocusManager: FocusManager,\n EditorManager: EditorManager$1,\n DOM: DOMUtils$1.DOM,\n ScriptLoader: ScriptLoader.ScriptLoader,\n PluginManager: AddOnManager.PluginManager,\n ThemeManager: AddOnManager.ThemeManager,\n trim: Tools.trim,\n isArray: Tools.isArray,\n is: Tools.is,\n toArray: Tools.toArray,\n makeMap: Tools.makeMap,\n each: Tools.each,\n map: Tools.map,\n grep: Tools.grep,\n inArray: Tools.inArray,\n extend: Tools.extend,\n create: Tools.create,\n walk: Tools.walk,\n createNS: Tools.createNS,\n resolve: Tools.resolve,\n explode: Tools.explode,\n _addCacheSuffix: Tools._addCacheSuffix,\n isOpera: Env.opera,\n isWebKit: Env.webkit,\n isIE: Env.ie,\n isGecko: Env.gecko,\n isMac: Env.mac\n };\n tinymce = Tools.extend(tinymce, publicApi);\n var Tinymce = tinymce;\n\n var exportToModuleLoaders = function (tinymce) {\n if (typeof module === 'object') {\n try {\n module.exports = tinymce;\n } catch (_) {\n }\n }\n };\n var exportToWindowGlobal = function (tinymce) {\n window.tinymce = tinymce;\n window.tinyMCE = tinymce;\n };\n exportToWindowGlobal(Tinymce);\n exportToModuleLoaders(Tinymce);\n\n}(window));\n})();\n"],"names":[],"sourceRoot":""}