{"version":3,"file":"vendors-fcadf5bb.47e839c4edc29ae0ca22.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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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://client-app/./node_modules/aurelia-templating/dist/native-modules/aurelia-templating.js"],"sourcesContent":["import { DOM, FEATURE, PLATFORM } from 'aurelia-pal';\nimport { TemplateRegistryEntry, Loader } from 'aurelia-loader';\nimport { metadata, Origin, protocol } from 'aurelia-metadata';\nimport { relativeToFile } from 'aurelia-path';\nimport * as LogManager from 'aurelia-logging';\nimport { subscriberCollection, bindingMode, createOverrideContext, ValueConverterResource, BindingBehaviorResource, ObserverLocator, camelCase, EventManager } from 'aurelia-binding';\nimport { Container, resolver, inject } from 'aurelia-dependency-injection';\nimport { TaskQueue } from 'aurelia-task-queue';\n\nvar ElementEvents = (function () {\r\n function ElementEvents(element) {\r\n this.element = element;\r\n this.subscriptions = {};\r\n }\r\n ElementEvents.prototype._enqueueHandler = function (handler) {\r\n this.subscriptions[handler.eventName] = this.subscriptions[handler.eventName] || [];\r\n this.subscriptions[handler.eventName].push(handler);\r\n };\r\n ElementEvents.prototype._dequeueHandler = function (handler) {\r\n var index;\r\n var subscriptions = this.subscriptions[handler.eventName];\r\n if (subscriptions) {\r\n index = subscriptions.indexOf(handler);\r\n if (index > -1) {\r\n subscriptions.splice(index, 1);\r\n }\r\n }\r\n return handler;\r\n };\r\n ElementEvents.prototype.publish = function (eventName, detail, bubbles, cancelable) {\r\n if (detail === void 0) { detail = {}; }\r\n if (bubbles === void 0) { bubbles = true; }\r\n if (cancelable === void 0) { cancelable = true; }\r\n var event = DOM.createCustomEvent(eventName, { cancelable: cancelable, bubbles: bubbles, detail: detail });\r\n this.element.dispatchEvent(event);\r\n };\r\n ElementEvents.prototype.subscribe = function (eventName, handler, captureOrOptions) {\r\n if (typeof handler === 'function') {\r\n if (captureOrOptions === undefined) {\r\n captureOrOptions = ElementEvents.defaultListenerOptions;\r\n }\r\n var eventHandler = new EventHandlerImpl(this, eventName, handler, captureOrOptions, false);\r\n return eventHandler;\r\n }\r\n return undefined;\r\n };\r\n ElementEvents.prototype.subscribeOnce = function (eventName, handler, captureOrOptions) {\r\n if (typeof handler === 'function') {\r\n if (captureOrOptions === undefined) {\r\n captureOrOptions = ElementEvents.defaultListenerOptions;\r\n }\r\n var eventHandler = new EventHandlerImpl(this, eventName, handler, captureOrOptions, true);\r\n return eventHandler;\r\n }\r\n return undefined;\r\n };\r\n ElementEvents.prototype.dispose = function (eventName) {\r\n if (eventName && typeof eventName === 'string') {\r\n var subscriptions = this.subscriptions[eventName];\r\n if (subscriptions) {\r\n while (subscriptions.length) {\r\n var subscription = subscriptions.pop();\r\n if (subscription) {\r\n subscription.dispose();\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n this.disposeAll();\r\n }\r\n };\r\n ElementEvents.prototype.disposeAll = function () {\r\n for (var key in this.subscriptions) {\r\n this.dispose(key);\r\n }\r\n };\r\n ElementEvents.defaultListenerOptions = true;\r\n return ElementEvents;\r\n}());\r\nvar EventHandlerImpl = (function () {\r\n function EventHandlerImpl(owner, eventName, handler, captureOrOptions, once) {\r\n this.owner = owner;\r\n this.eventName = eventName;\r\n this.handler = handler;\r\n this.capture = typeof captureOrOptions === 'boolean' ? captureOrOptions : captureOrOptions.capture;\r\n this.bubbles = !this.capture;\r\n this.captureOrOptions = captureOrOptions;\r\n this.once = once;\r\n owner.element.addEventListener(eventName, this, captureOrOptions);\r\n owner._enqueueHandler(this);\r\n }\r\n EventHandlerImpl.prototype.handleEvent = function (e) {\r\n var fn = this.handler;\r\n fn(e);\r\n if (this.once) {\r\n this.dispose();\r\n }\r\n };\r\n EventHandlerImpl.prototype.dispose = function () {\r\n this.owner.element.removeEventListener(this.eventName, this, this.captureOrOptions);\r\n this.owner._dequeueHandler(this);\r\n this.owner = this.handler = null;\r\n };\r\n return EventHandlerImpl;\r\n}());\n\nvar ResourceLoadContext = (function () {\r\n function ResourceLoadContext() {\r\n this.dependencies = {};\r\n }\r\n ResourceLoadContext.prototype.addDependency = function (url) {\r\n this.dependencies[url] = true;\r\n };\r\n ResourceLoadContext.prototype.hasDependency = function (url) {\r\n return url in this.dependencies;\r\n };\r\n return ResourceLoadContext;\r\n}());\r\nvar ViewCompileInstruction = (function () {\r\n function ViewCompileInstruction(targetShadowDOM, compileSurrogate) {\r\n if (targetShadowDOM === void 0) { targetShadowDOM = false; }\r\n if (compileSurrogate === void 0) { compileSurrogate = false; }\r\n this.targetShadowDOM = targetShadowDOM;\r\n this.compileSurrogate = compileSurrogate;\r\n this.associatedModuleId = null;\r\n }\r\n ViewCompileInstruction.normal = new ViewCompileInstruction();\r\n return ViewCompileInstruction;\r\n}());\r\nvar BehaviorInstruction = (function () {\r\n function BehaviorInstruction() {\r\n }\r\n BehaviorInstruction.enhance = function () {\r\n var instruction = new BehaviorInstruction();\r\n instruction.enhance = true;\r\n return instruction;\r\n };\r\n BehaviorInstruction.unitTest = function (type, attributes) {\r\n var instruction = new BehaviorInstruction();\r\n instruction.type = type;\r\n instruction.attributes = attributes || {};\r\n return instruction;\r\n };\r\n BehaviorInstruction.element = function (node, type) {\r\n var instruction = new BehaviorInstruction();\r\n instruction.type = type;\r\n instruction.attributes = {};\r\n instruction.anchorIsContainer = !(node.hasAttribute('containerless') || type.containerless);\r\n instruction.initiatedByBehavior = true;\r\n return instruction;\r\n };\r\n BehaviorInstruction.attribute = function (attrName, type) {\r\n var instruction = new BehaviorInstruction();\r\n instruction.attrName = attrName;\r\n instruction.type = type || null;\r\n instruction.attributes = {};\r\n return instruction;\r\n };\r\n BehaviorInstruction.dynamic = function (host, viewModel, viewFactory) {\r\n var instruction = new BehaviorInstruction();\r\n instruction.host = host;\r\n instruction.viewModel = viewModel;\r\n instruction.viewFactory = viewFactory;\r\n instruction.inheritBindingContext = true;\r\n return instruction;\r\n };\r\n BehaviorInstruction.normal = new BehaviorInstruction();\r\n return BehaviorInstruction;\r\n}());\r\nvar biProto = BehaviorInstruction.prototype;\r\nbiProto.initiatedByBehavior = false;\r\nbiProto.enhance = false;\r\nbiProto.partReplacements = null;\r\nbiProto.viewFactory = null;\r\nbiProto.originalAttrName = null;\r\nbiProto.skipContentProcessing = false;\r\nbiProto.contentFactory = null;\r\nbiProto.viewModel = null;\r\nbiProto.anchorIsContainer = false;\r\nbiProto.host = null;\r\nbiProto.attributes = null;\r\nbiProto.type = null;\r\nbiProto.attrName = null;\r\nbiProto.inheritBindingContext = false;\r\nvar TargetInstruction = (function () {\r\n function TargetInstruction() {\r\n }\r\n TargetInstruction.shadowSlot = function (parentInjectorId) {\r\n var instruction = new TargetInstruction();\r\n instruction.parentInjectorId = parentInjectorId;\r\n instruction.shadowSlot = true;\r\n return instruction;\r\n };\r\n TargetInstruction.contentExpression = function (expression) {\r\n var instruction = new TargetInstruction();\r\n instruction.contentExpression = expression;\r\n return instruction;\r\n };\r\n TargetInstruction.letElement = function (expressions) {\r\n var instruction = new TargetInstruction();\r\n instruction.expressions = expressions;\r\n instruction.letElement = true;\r\n return instruction;\r\n };\r\n TargetInstruction.lifting = function (parentInjectorId, liftingInstruction) {\r\n var instruction = new TargetInstruction();\r\n instruction.parentInjectorId = parentInjectorId;\r\n instruction.expressions = TargetInstruction.noExpressions;\r\n instruction.behaviorInstructions = [liftingInstruction];\r\n instruction.viewFactory = liftingInstruction.viewFactory;\r\n instruction.providers = [liftingInstruction.type.target];\r\n instruction.lifting = true;\r\n return instruction;\r\n };\r\n TargetInstruction.normal = function (injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction) {\r\n var instruction = new TargetInstruction();\r\n instruction.injectorId = injectorId;\r\n instruction.parentInjectorId = parentInjectorId;\r\n instruction.providers = providers;\r\n instruction.behaviorInstructions = behaviorInstructions;\r\n instruction.expressions = expressions;\r\n instruction.anchorIsContainer = elementInstruction ? elementInstruction.anchorIsContainer : true;\r\n instruction.elementInstruction = elementInstruction;\r\n return instruction;\r\n };\r\n TargetInstruction.surrogate = function (providers, behaviorInstructions, expressions, values) {\r\n var instruction = new TargetInstruction();\r\n instruction.expressions = expressions;\r\n instruction.behaviorInstructions = behaviorInstructions;\r\n instruction.providers = providers;\r\n instruction.values = values;\r\n return instruction;\r\n };\r\n TargetInstruction.noExpressions = Object.freeze([]);\r\n return TargetInstruction;\r\n}());\r\nvar tiProto = TargetInstruction.prototype;\r\ntiProto.injectorId = null;\r\ntiProto.parentInjectorId = null;\r\ntiProto.shadowSlot = false;\r\ntiProto.slotName = null;\r\ntiProto.slotFallbackFactory = null;\r\ntiProto.contentExpression = null;\r\ntiProto.letElement = false;\r\ntiProto.expressions = null;\r\ntiProto.expressions = null;\r\ntiProto.providers = null;\r\ntiProto.viewFactory = null;\r\ntiProto.anchorIsContainer = false;\r\ntiProto.elementInstruction = null;\r\ntiProto.lifting = false;\r\ntiProto.values = null;\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\n\nvar capitalMatcher = /([A-Z])/g;\r\nfunction addHyphenAndLower(char) {\r\n return '-' + char.toLowerCase();\r\n}\r\nfunction _hyphenate(name) {\r\n return (name.charAt(0).toLowerCase() + name.slice(1)).replace(capitalMatcher, addHyphenAndLower);\r\n}\r\nfunction _isAllWhitespace(node) {\r\n return !(node.auInterpolationTarget || (/[^\\t\\n\\r ]/.test(node.textContent)));\r\n}\n\nvar BehaviorPropertyObserver = (function () {\r\n function BehaviorPropertyObserver(taskQueue, obj, propertyName, selfSubscriber, initialValue) {\r\n this.taskQueue = taskQueue;\r\n this.obj = obj;\r\n this.propertyName = propertyName;\r\n this.notqueued = true;\r\n this.publishing = false;\r\n this.selfSubscriber = selfSubscriber;\r\n this.currentValue = this.oldValue = initialValue;\r\n }\r\n BehaviorPropertyObserver.prototype.getValue = function () {\r\n return this.currentValue;\r\n };\r\n BehaviorPropertyObserver.prototype.setValue = function (newValue) {\r\n var oldValue = this.currentValue;\r\n if (!Object.is(newValue, oldValue)) {\r\n this.oldValue = oldValue;\r\n this.currentValue = newValue;\r\n if (this.publishing && this.notqueued) {\r\n if (this.taskQueue.flushing) {\r\n this.call();\r\n }\r\n else {\r\n this.notqueued = false;\r\n this.taskQueue.queueMicroTask(this);\r\n }\r\n }\r\n }\r\n };\r\n BehaviorPropertyObserver.prototype.call = function () {\r\n var oldValue = this.oldValue;\r\n var newValue = this.currentValue;\r\n this.notqueued = true;\r\n if (Object.is(newValue, oldValue)) {\r\n return;\r\n }\r\n if (this.selfSubscriber) {\r\n this.selfSubscriber(newValue, oldValue);\r\n }\r\n this.callSubscribers(newValue, oldValue);\r\n this.oldValue = newValue;\r\n };\r\n BehaviorPropertyObserver.prototype.callSubscribers = function (newValue, oldValue) {\r\n throw new Error('Method not implemented.');\r\n };\r\n BehaviorPropertyObserver.prototype.subscribe = function (context, callable) {\r\n this.addSubscriber(context, callable);\r\n };\r\n BehaviorPropertyObserver.prototype.addSubscriber = function (context, callable) {\r\n throw new Error('Method not implemented.');\r\n };\r\n BehaviorPropertyObserver.prototype.unsubscribe = function (context, callable) {\r\n this.removeSubscriber(context, callable);\r\n };\r\n BehaviorPropertyObserver.prototype.removeSubscriber = function (context, callable) {\r\n throw new Error('Method not implemented.');\r\n };\r\n BehaviorPropertyObserver = __decorate([\r\n subscriberCollection()\r\n ], BehaviorPropertyObserver);\r\n return BehaviorPropertyObserver;\r\n}());\n\nfunction getObserver(instance, name) {\r\n var lookup = instance.__observers__;\r\n if (lookup === undefined) {\r\n var ctor = Object.getPrototypeOf(instance).constructor;\r\n var behavior = metadata.get(metadata.resource, ctor);\r\n if (!behavior.isInitialized) {\r\n behavior.initialize(Container.instance || new Container(), instance.constructor);\r\n }\r\n lookup = behavior.observerLocator.getOrCreateObserversLookup(instance);\r\n behavior._ensurePropertiesDefined(instance, lookup);\r\n }\r\n return lookup[name];\r\n}\r\nvar BindableProperty = (function () {\r\n function BindableProperty(nameOrConfig) {\r\n if (typeof nameOrConfig === 'string') {\r\n this.name = nameOrConfig;\r\n }\r\n else {\r\n Object.assign(this, nameOrConfig);\r\n }\r\n this.attribute = this.attribute || _hyphenate(this.name);\r\n var defaultBindingMode = this.defaultBindingMode;\r\n if (defaultBindingMode === null || defaultBindingMode === undefined) {\r\n this.defaultBindingMode = bindingMode.oneWay;\r\n }\r\n else if (typeof defaultBindingMode === 'string') {\r\n this.defaultBindingMode = bindingMode[defaultBindingMode] || bindingMode.oneWay;\r\n }\r\n this.changeHandler = this.changeHandler || null;\r\n this.owner = null;\r\n this.descriptor = null;\r\n }\r\n BindableProperty.prototype.registerWith = function (target, behavior, descriptor) {\r\n behavior.properties.push(this);\r\n behavior.attributes[this.attribute] = this;\r\n this.owner = behavior;\r\n if (descriptor) {\r\n this.descriptor = descriptor;\r\n return this._configureDescriptor(descriptor);\r\n }\r\n return undefined;\r\n };\r\n BindableProperty.prototype._configureDescriptor = function (descriptor) {\r\n var name = this.name;\r\n descriptor.configurable = true;\r\n descriptor.enumerable = true;\r\n if ('initializer' in descriptor) {\r\n this.defaultValue = descriptor.initializer;\r\n delete descriptor.initializer;\r\n delete descriptor.writable;\r\n }\r\n if ('value' in descriptor) {\r\n this.defaultValue = descriptor.value;\r\n delete descriptor.value;\r\n delete descriptor.writable;\r\n }\r\n descriptor.get = function () {\r\n return getObserver(this, name).getValue();\r\n };\r\n descriptor.set = function (value) {\r\n getObserver(this, name).setValue(value);\r\n };\r\n descriptor.get.getObserver = function (obj) {\r\n return getObserver(obj, name);\r\n };\r\n return descriptor;\r\n };\r\n BindableProperty.prototype.defineOn = function (target, behavior) {\r\n var name = this.name;\r\n var handlerName;\r\n if (this.changeHandler === null) {\r\n handlerName = name + 'Changed';\r\n if (handlerName in target.prototype) {\r\n this.changeHandler = handlerName;\r\n }\r\n }\r\n if (this.descriptor === null) {\r\n Object.defineProperty(target.prototype, name, this._configureDescriptor({}));\r\n }\r\n };\r\n BindableProperty.prototype.createObserver = function (viewModel) {\r\n var selfSubscriber = null;\r\n var defaultValue = this.defaultValue;\r\n var changeHandlerName = this.changeHandler;\r\n var name = this.name;\r\n var initialValue;\r\n if (this.hasOptions) {\r\n return undefined;\r\n }\r\n if (changeHandlerName in viewModel) {\r\n if ('propertyChanged' in viewModel) {\r\n selfSubscriber = function (newValue, oldValue) {\r\n viewModel[changeHandlerName](newValue, oldValue);\r\n viewModel.propertyChanged(name, newValue, oldValue);\r\n };\r\n }\r\n else {\r\n selfSubscriber = function (newValue, oldValue) { return viewModel[changeHandlerName](newValue, oldValue); };\r\n }\r\n }\r\n else if ('propertyChanged' in viewModel) {\r\n selfSubscriber = function (newValue, oldValue) { return viewModel.propertyChanged(name, newValue, oldValue); };\r\n }\r\n else if (changeHandlerName !== null) {\r\n throw new Error(\"Change handler \".concat(changeHandlerName, \" was specified but not declared on the class.\"));\r\n }\r\n if (defaultValue !== undefined) {\r\n initialValue = typeof defaultValue === 'function' ? defaultValue.call(viewModel) : defaultValue;\r\n }\r\n return new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, this.name, selfSubscriber, initialValue);\r\n };\r\n BindableProperty.prototype._initialize = function (viewModel, observerLookup, attributes, behaviorHandlesBind, boundProperties) {\r\n var selfSubscriber;\r\n var observer;\r\n var attribute;\r\n var defaultValue = this.defaultValue;\r\n if (this.isDynamic) {\r\n for (var key in attributes) {\r\n this._createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, key, attributes[key], boundProperties);\r\n }\r\n }\r\n else if (!this.hasOptions) {\r\n observer = observerLookup[this.name];\r\n if (attributes !== null) {\r\n selfSubscriber = observer.selfSubscriber;\r\n attribute = attributes[this.attribute];\r\n if (behaviorHandlesBind) {\r\n observer.selfSubscriber = null;\r\n }\r\n if (typeof attribute === 'string') {\r\n viewModel[this.name] = attribute;\r\n observer.call();\r\n }\r\n else if (attribute) {\r\n boundProperties.push({ observer: observer, binding: attribute.createBinding(viewModel) });\r\n }\r\n else if (defaultValue !== undefined) {\r\n observer.call();\r\n }\r\n observer.selfSubscriber = selfSubscriber;\r\n }\r\n observer.publishing = true;\r\n }\r\n };\r\n BindableProperty.prototype._createDynamicProperty = function (viewModel, observerLookup, behaviorHandlesBind, name, attribute, boundProperties) {\r\n var changeHandlerName = name + 'Changed';\r\n var selfSubscriber = null;\r\n var observer;\r\n var info;\r\n if (changeHandlerName in viewModel) {\r\n if ('propertyChanged' in viewModel) {\r\n selfSubscriber = function (newValue, oldValue) {\r\n viewModel[changeHandlerName](newValue, oldValue);\r\n viewModel.propertyChanged(name, newValue, oldValue);\r\n };\r\n }\r\n else {\r\n selfSubscriber = function (newValue, oldValue) { return viewModel[changeHandlerName](newValue, oldValue); };\r\n }\r\n }\r\n else if ('propertyChanged' in viewModel) {\r\n selfSubscriber = function (newValue, oldValue) { return viewModel.propertyChanged(name, newValue, oldValue); };\r\n }\r\n observer = observerLookup[name] = new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, name, selfSubscriber);\r\n Object.defineProperty(viewModel, name, {\r\n configurable: true,\r\n enumerable: true,\r\n get: observer.getValue.bind(observer),\r\n set: observer.setValue.bind(observer)\r\n });\r\n if (behaviorHandlesBind) {\r\n observer.selfSubscriber = null;\r\n }\r\n if (typeof attribute === 'string') {\r\n viewModel[name] = attribute;\r\n observer.call();\r\n }\r\n else if (attribute) {\r\n info = { observer: observer, binding: attribute.createBinding(viewModel) };\r\n boundProperties.push(info);\r\n }\r\n observer.publishing = true;\r\n observer.selfSubscriber = selfSubscriber;\r\n };\r\n return BindableProperty;\r\n}());\n\nvar ViewLocator = (function () {\r\n function ViewLocator() {\r\n }\r\n ViewLocator.prototype.getViewStrategy = function (value) {\r\n if (!value) {\r\n return null;\r\n }\r\n if (typeof value === 'object' && 'getViewStrategy' in value) {\r\n var origin_1 = Origin.get(value.constructor);\r\n value = value.getViewStrategy();\r\n if (typeof value === 'string') {\r\n value = new RelativeViewStrategy(value);\r\n }\r\n viewStrategy.assert(value);\r\n if (origin_1.moduleId) {\r\n value.makeRelativeTo(origin_1.moduleId);\r\n }\r\n return value;\r\n }\r\n if (typeof value === 'string') {\r\n value = new RelativeViewStrategy(value);\r\n }\r\n if (viewStrategy.validate(value)) {\r\n return value;\r\n }\r\n if (typeof value !== 'function') {\r\n value = value.constructor;\r\n }\r\n if ('$view' in value) {\r\n var c = value.$view;\r\n var view = void 0;\r\n c = typeof c === 'function' ? c.call(value) : c;\r\n if (c === null) {\r\n view = new NoViewStrategy();\r\n }\r\n else {\r\n view = c instanceof StaticViewStrategy ? c : new StaticViewStrategy(c);\r\n }\r\n metadata.define(ViewLocator.viewStrategyMetadataKey, view, value);\r\n return view;\r\n }\r\n var origin = Origin.get(value);\r\n var strategy = metadata.get(ViewLocator.viewStrategyMetadataKey, value);\r\n if (!strategy) {\r\n if (!origin.moduleId) {\r\n throw new Error('Cannot determine default view strategy for object.\\n' + value);\r\n }\r\n strategy = this.createFallbackViewStrategy(origin);\r\n }\r\n else if (origin.moduleId) {\r\n strategy.moduleId = origin.moduleId;\r\n }\r\n return strategy;\r\n };\r\n ViewLocator.prototype.createFallbackViewStrategy = function (origin) {\r\n return new ConventionalViewStrategy(this, origin);\r\n };\r\n ViewLocator.prototype.convertOriginToViewUrl = function (origin) {\r\n var moduleId = origin.moduleId;\r\n var id = (moduleId.endsWith('.js') || moduleId.endsWith('.ts')) ? moduleId.substring(0, moduleId.length - 3) : moduleId;\r\n return id + '.html';\r\n };\r\n ViewLocator.viewStrategyMetadataKey = 'aurelia:view-strategy';\r\n return ViewLocator;\r\n}());\n\nfunction mi(name) {\r\n throw new Error(\"BindingLanguage must implement \".concat(name, \"().\"));\r\n}\r\nvar BindingLanguage = (function () {\r\n function BindingLanguage() {\r\n }\r\n BindingLanguage.prototype.inspectAttribute = function (resources, elementName, attrName, attrValue) {\r\n mi('inspectAttribute');\r\n };\r\n BindingLanguage.prototype.createAttributeInstruction = function (resources, element, info, existingInstruction, context) {\r\n mi('createAttributeInstruction');\r\n };\r\n BindingLanguage.prototype.createLetExpressions = function (resources, element) {\r\n mi('createLetExpressions');\r\n };\r\n BindingLanguage.prototype.inspectTextContent = function (resources, value) {\r\n mi('inspectTextContent');\r\n };\r\n return BindingLanguage;\r\n}());\n\nvar noNodes = Object.freeze([]);\r\nvar SlotCustomAttribute = (function () {\r\n function SlotCustomAttribute(element) {\r\n this.element = element;\r\n this.element.auSlotAttribute = this;\r\n }\r\n SlotCustomAttribute.inject = function () {\r\n return [DOM.Element];\r\n };\r\n SlotCustomAttribute.prototype.valueChanged = function (newValue, oldValue) { };\r\n return SlotCustomAttribute;\r\n}());\r\nvar PassThroughSlot = (function () {\r\n function PassThroughSlot(anchor, name, destinationName, fallbackFactory) {\r\n this.anchor = anchor;\r\n this.anchor.viewSlot = this;\r\n this.name = name;\r\n this.destinationName = destinationName;\r\n this.fallbackFactory = fallbackFactory;\r\n this.destinationSlot = null;\r\n this.projections = 0;\r\n this.contentView = null;\r\n var attr = new SlotCustomAttribute(this.anchor);\r\n attr.value = this.destinationName;\r\n }\r\n Object.defineProperty(PassThroughSlot.prototype, \"needsFallbackRendering\", {\r\n get: function () {\r\n return this.fallbackFactory && this.projections === 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n PassThroughSlot.prototype.renderFallbackContent = function (view, nodes, projectionSource, index) {\r\n if (this.contentView === null) {\r\n this.contentView = this.fallbackFactory.create(this.ownerView.container);\r\n this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);\r\n var slots = Object.create(null);\r\n slots[this.destinationSlot.name] = this.destinationSlot;\r\n ShadowDOM.distributeView(this.contentView, slots, projectionSource, index, this.destinationSlot.name);\r\n }\r\n };\r\n PassThroughSlot.prototype.passThroughTo = function (destinationSlot) {\r\n this.destinationSlot = destinationSlot;\r\n };\r\n PassThroughSlot.prototype.addNode = function (view, node, projectionSource, index) {\r\n if (this.contentView !== null) {\r\n this.contentView.removeNodes();\r\n this.contentView.detached();\r\n this.contentView.unbind();\r\n this.contentView = null;\r\n }\r\n if (node.viewSlot instanceof PassThroughSlot) {\r\n node.viewSlot.passThroughTo(this);\r\n return;\r\n }\r\n this.projections++;\r\n this.destinationSlot.addNode(view, node, projectionSource, index);\r\n };\r\n PassThroughSlot.prototype.removeView = function (view, projectionSource) {\r\n this.projections--;\r\n this.destinationSlot.removeView(view, projectionSource);\r\n if (this.needsFallbackRendering) {\r\n this.renderFallbackContent(null, noNodes, projectionSource);\r\n }\r\n };\r\n PassThroughSlot.prototype.removeAll = function (projectionSource) {\r\n this.projections = 0;\r\n this.destinationSlot.removeAll(projectionSource);\r\n if (this.needsFallbackRendering) {\r\n this.renderFallbackContent(null, noNodes, projectionSource);\r\n }\r\n };\r\n PassThroughSlot.prototype.projectFrom = function (view, projectionSource) {\r\n this.destinationSlot.projectFrom(view, projectionSource);\r\n };\r\n PassThroughSlot.prototype.created = function (ownerView) {\r\n this.ownerView = ownerView;\r\n };\r\n PassThroughSlot.prototype.bind = function (view) {\r\n if (this.contentView) {\r\n this.contentView.bind(view.bindingContext, view.overrideContext);\r\n }\r\n };\r\n PassThroughSlot.prototype.attached = function () {\r\n if (this.contentView) {\r\n this.contentView.attached();\r\n }\r\n };\r\n PassThroughSlot.prototype.detached = function () {\r\n if (this.contentView) {\r\n this.contentView.detached();\r\n }\r\n };\r\n PassThroughSlot.prototype.unbind = function () {\r\n if (this.contentView) {\r\n this.contentView.unbind();\r\n }\r\n };\r\n return PassThroughSlot;\r\n}());\r\nvar ShadowSlot = (function () {\r\n function ShadowSlot(anchor, name, fallbackFactory) {\r\n this.anchor = anchor;\r\n this.anchor.isContentProjectionSource = true;\r\n this.anchor.viewSlot = this;\r\n this.name = name;\r\n this.fallbackFactory = fallbackFactory;\r\n this.contentView = null;\r\n this.projections = 0;\r\n this.children = [];\r\n this.projectFromAnchors = null;\r\n this.destinationSlots = null;\r\n }\r\n Object.defineProperty(ShadowSlot.prototype, \"needsFallbackRendering\", {\r\n get: function () {\r\n return this.fallbackFactory && this.projections === 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ShadowSlot.prototype.addNode = function (view, node, projectionSource, index, destination) {\r\n var $node = node;\r\n if (this.contentView !== null) {\r\n this.contentView.removeNodes();\r\n this.contentView.detached();\r\n this.contentView.unbind();\r\n this.contentView = null;\r\n }\r\n if ($node.viewSlot instanceof PassThroughSlot) {\r\n $node.viewSlot.passThroughTo(this);\r\n return;\r\n }\r\n if (this.destinationSlots !== null) {\r\n ShadowDOM.distributeNodes(view, [$node], this.destinationSlots, this, index);\r\n }\r\n else {\r\n $node.auOwnerView = view;\r\n $node.auProjectionSource = projectionSource;\r\n $node.auAssignedSlot = this;\r\n var anchor = this._findAnchor(view, $node, projectionSource, index);\r\n var parent_1 = anchor.parentNode;\r\n parent_1.insertBefore($node, anchor);\r\n this.children.push($node);\r\n this.projections++;\r\n }\r\n };\r\n ShadowSlot.prototype.removeView = function (view, projectionSource) {\r\n if (this.destinationSlots !== null) {\r\n ShadowDOM.undistributeView(view, this.destinationSlots, this);\r\n }\r\n else if (this.contentView && this.contentView.hasSlots) {\r\n ShadowDOM.undistributeView(view, this.contentView.slots, projectionSource);\r\n }\r\n else {\r\n var found = this.children.find(function (x) { return x.auSlotProjectFrom === projectionSource; });\r\n if (found) {\r\n var children = found.auProjectionChildren;\r\n var ownChildren = this.children;\r\n for (var i = 0, ii = children.length; i < ii; ++i) {\r\n var child = children[i];\r\n if (child.auOwnerView === view) {\r\n children.splice(i, 1);\r\n view.fragment.appendChild(child);\r\n i--;\r\n ii--;\r\n this.projections--;\r\n var idx = ownChildren.indexOf(child);\r\n if (idx > -1) {\r\n ownChildren.splice(idx, 1);\r\n }\r\n }\r\n }\r\n if (this.needsFallbackRendering) {\r\n this.renderFallbackContent(view, noNodes, projectionSource);\r\n }\r\n }\r\n }\r\n };\r\n ShadowSlot.prototype.removeAll = function (projectionSource) {\r\n if (this.destinationSlots !== null) {\r\n ShadowDOM.undistributeAll(this.destinationSlots, this);\r\n }\r\n else if (this.contentView && this.contentView.hasSlots) {\r\n ShadowDOM.undistributeAll(this.contentView.slots, projectionSource);\r\n }\r\n else {\r\n var found = this.children.find(function (x) { return x.auSlotProjectFrom === projectionSource; });\r\n if (found) {\r\n var children = found.auProjectionChildren;\r\n var ownChildren = this.children;\r\n for (var i = 0, ii = children.length; i < ii; ++i) {\r\n var child = children[i];\r\n child.auOwnerView.fragment.appendChild(child);\r\n this.projections--;\r\n var idx = ownChildren.indexOf(child);\r\n if (idx > -1) {\r\n ownChildren.splice(idx, 1);\r\n }\r\n }\r\n found.auProjectionChildren = [];\r\n if (this.needsFallbackRendering) {\r\n this.renderFallbackContent(null, noNodes, projectionSource);\r\n }\r\n }\r\n }\r\n };\r\n ShadowSlot.prototype._findAnchor = function (view, node, projectionSource, index) {\r\n if (projectionSource) {\r\n var found = this.children.find(function (x) { return x.auSlotProjectFrom === projectionSource; });\r\n if (found) {\r\n if (index !== undefined) {\r\n var children = found.auProjectionChildren;\r\n var viewIndex = -1;\r\n var lastView = void 0;\r\n for (var i = 0, ii = children.length; i < ii; ++i) {\r\n var current = children[i];\r\n if (current.auOwnerView !== lastView) {\r\n viewIndex++;\r\n lastView = current.auOwnerView;\r\n if (viewIndex >= index && lastView !== view) {\r\n children.splice(i, 0, node);\r\n return current;\r\n }\r\n }\r\n }\r\n }\r\n found.auProjectionChildren.push(node);\r\n return found;\r\n }\r\n }\r\n return this.anchor;\r\n };\r\n ShadowSlot.prototype.projectTo = function (slots) {\r\n this.destinationSlots = slots;\r\n };\r\n ShadowSlot.prototype.projectFrom = function (view, projectionSource) {\r\n var anchor = DOM.createComment('anchor');\r\n var parent = this.anchor.parentNode;\r\n anchor.auSlotProjectFrom = projectionSource;\r\n anchor.auOwnerView = view;\r\n anchor.auProjectionChildren = [];\r\n parent.insertBefore(anchor, this.anchor);\r\n this.children.push(anchor);\r\n if (this.projectFromAnchors === null) {\r\n this.projectFromAnchors = [];\r\n }\r\n this.projectFromAnchors.push(anchor);\r\n };\r\n ShadowSlot.prototype.renderFallbackContent = function (view, nodes, projectionSource, index) {\r\n if (this.contentView === null) {\r\n this.contentView = this.fallbackFactory.create(this.ownerView.container);\r\n this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);\r\n this.contentView.insertNodesBefore(this.anchor);\r\n }\r\n if (this.contentView.hasSlots) {\r\n var slots = this.contentView.slots;\r\n var projectFromAnchors = this.projectFromAnchors;\r\n if (projectFromAnchors !== null) {\r\n for (var slotName in slots) {\r\n var slot = slots[slotName];\r\n for (var i = 0, ii = projectFromAnchors.length; i < ii; ++i) {\r\n var anchor = projectFromAnchors[i];\r\n slot.projectFrom(anchor.auOwnerView, anchor.auSlotProjectFrom);\r\n }\r\n }\r\n }\r\n this.fallbackSlots = slots;\r\n ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index);\r\n }\r\n };\r\n ShadowSlot.prototype.created = function (ownerView) {\r\n this.ownerView = ownerView;\r\n };\r\n ShadowSlot.prototype.bind = function (view) {\r\n if (this.contentView) {\r\n this.contentView.bind(view.bindingContext, view.overrideContext);\r\n }\r\n };\r\n ShadowSlot.prototype.attached = function () {\r\n if (this.contentView) {\r\n this.contentView.attached();\r\n }\r\n };\r\n ShadowSlot.prototype.detached = function () {\r\n if (this.contentView) {\r\n this.contentView.detached();\r\n }\r\n };\r\n ShadowSlot.prototype.unbind = function () {\r\n if (this.contentView) {\r\n this.contentView.unbind();\r\n }\r\n };\r\n return ShadowSlot;\r\n}());\r\nvar ShadowDOM = (function () {\r\n function ShadowDOM() {\r\n }\r\n ShadowDOM.getSlotName = function (node) {\r\n if (node.auSlotAttribute === undefined) {\r\n return ShadowDOM.defaultSlotKey;\r\n }\r\n return node.auSlotAttribute.value;\r\n };\r\n ShadowDOM.distributeView = function (view, slots, projectionSource, index, destinationOverride) {\r\n var nodes;\r\n if (view === null) {\r\n nodes = noNodes;\r\n }\r\n else {\r\n var childNodes = view.fragment.childNodes;\r\n var ii = childNodes.length;\r\n nodes = new Array(ii);\r\n for (var i = 0; i < ii; ++i) {\r\n nodes[i] = childNodes[i];\r\n }\r\n }\r\n ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride);\r\n };\r\n ShadowDOM.undistributeView = function (view, slots, projectionSource) {\r\n for (var slotName in slots) {\r\n slots[slotName].removeView(view, projectionSource);\r\n }\r\n };\r\n ShadowDOM.undistributeAll = function (slots, projectionSource) {\r\n for (var slotName in slots) {\r\n slots[slotName].removeAll(projectionSource);\r\n }\r\n };\r\n ShadowDOM.distributeNodes = function (view, nodes, slots, projectionSource, index, destinationOverride) {\r\n for (var i = 0, ii = nodes.length; i < ii; ++i) {\r\n var currentNode = nodes[i];\r\n var nodeType = currentNode.nodeType;\r\n if (currentNode.isContentProjectionSource) {\r\n currentNode.viewSlot.projectTo(slots);\r\n for (var slotName in slots) {\r\n slots[slotName].projectFrom(view, currentNode.viewSlot);\r\n }\r\n nodes.splice(i, 1);\r\n ii--;\r\n i--;\r\n }\r\n else if (nodeType === 1 || nodeType === 3 || currentNode.viewSlot instanceof PassThroughSlot) {\r\n if (nodeType === 3 && _isAllWhitespace(currentNode)) {\r\n nodes.splice(i, 1);\r\n ii--;\r\n i--;\r\n }\r\n else {\r\n var found = slots[destinationOverride || ShadowDOM.getSlotName(currentNode)];\r\n if (found) {\r\n found.addNode(view, currentNode, projectionSource, index);\r\n nodes.splice(i, 1);\r\n ii--;\r\n i--;\r\n }\r\n }\r\n }\r\n else {\r\n nodes.splice(i, 1);\r\n ii--;\r\n i--;\r\n }\r\n }\r\n for (var slotName in slots) {\r\n var slot = slots[slotName];\r\n if (slot.needsFallbackRendering) {\r\n slot.renderFallbackContent(view, nodes, projectionSource, index);\r\n }\r\n }\r\n };\r\n ShadowDOM.defaultSlotKey = '__au-default-slot-key__';\r\n return ShadowDOM;\r\n}());\n\nvar CompositionTransactionNotifier = (function () {\r\n function CompositionTransactionNotifier(owner) {\r\n this.owner = owner;\r\n this.owner._compositionCount++;\r\n }\r\n CompositionTransactionNotifier.prototype.done = function () {\r\n this.owner._compositionCount--;\r\n this.owner._tryCompleteTransaction();\r\n };\r\n return CompositionTransactionNotifier;\r\n}());\r\nvar CompositionTransactionOwnershipToken = (function () {\r\n function CompositionTransactionOwnershipToken(owner) {\r\n this.owner = owner;\r\n this.owner._ownershipToken = this;\r\n this.thenable = this._createThenable();\r\n }\r\n CompositionTransactionOwnershipToken.prototype.waitForCompositionComplete = function () {\r\n this.owner._tryCompleteTransaction();\r\n return this.thenable;\r\n };\r\n CompositionTransactionOwnershipToken.prototype.resolve = function () {\r\n this._resolveCallback();\r\n };\r\n CompositionTransactionOwnershipToken.prototype._resolveCallback = function () {\r\n throw new Error(\"Method not implemented.\");\r\n };\r\n CompositionTransactionOwnershipToken.prototype._createThenable = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this._resolveCallback = resolve;\r\n });\r\n };\r\n return CompositionTransactionOwnershipToken;\r\n}());\r\nvar CompositionTransaction = (function () {\r\n function CompositionTransaction() {\r\n this._ownershipToken = null;\r\n this._compositionCount = 0;\r\n }\r\n CompositionTransaction.prototype.tryCapture = function () {\r\n return this._ownershipToken === null\r\n ? new CompositionTransactionOwnershipToken(this)\r\n : null;\r\n };\r\n CompositionTransaction.prototype.enlist = function () {\r\n return new CompositionTransactionNotifier(this);\r\n };\r\n CompositionTransaction.prototype._tryCompleteTransaction = function () {\r\n if (this._compositionCount <= 0) {\r\n this._compositionCount = 0;\r\n if (this._ownershipToken !== null) {\r\n var token = this._ownershipToken;\r\n this._ownershipToken = null;\r\n token.resolve();\r\n }\r\n }\r\n };\r\n return CompositionTransaction;\r\n}());\n\nvar View = (function () {\r\n function View(container, viewFactory, fragment, controllers, bindings, children, slots) {\r\n this.container = container;\r\n this.viewFactory = viewFactory;\r\n this.resources = viewFactory.resources;\r\n this.fragment = fragment;\r\n this.firstChild = fragment.firstChild;\r\n this.lastChild = fragment.lastChild;\r\n this.controllers = controllers;\r\n this.bindings = bindings;\r\n this.children = children;\r\n this.slots = slots;\r\n this.hasSlots = false;\r\n this.fromCache = false;\r\n this.isBound = false;\r\n this.isAttached = false;\r\n this.bindingContext = null;\r\n this.overrideContext = null;\r\n this.controller = null;\r\n this.viewModelScope = null;\r\n this.animatableElement = undefined;\r\n this._isUserControlled = false;\r\n this.contentView = null;\r\n for (var _ in slots) {\r\n this.hasSlots = true;\r\n break;\r\n }\r\n }\r\n View.prototype.returnToCache = function () {\r\n this.viewFactory.returnViewToCache(this);\r\n };\r\n View.prototype.created = function () {\r\n var i;\r\n var ii;\r\n var controllers = this.controllers;\r\n for (i = 0, ii = controllers.length; i < ii; ++i) {\r\n controllers[i].created(this);\r\n }\r\n };\r\n View.prototype.bind = function (bindingContext, overrideContext, _systemUpdate) {\r\n var controllers;\r\n var bindings;\r\n var children;\r\n var i;\r\n var ii;\r\n if (_systemUpdate && this._isUserControlled) {\r\n return;\r\n }\r\n if (this.isBound) {\r\n if (this.bindingContext === bindingContext) {\r\n return;\r\n }\r\n this.unbind();\r\n }\r\n this.isBound = true;\r\n this.bindingContext = bindingContext;\r\n this.overrideContext = overrideContext || createOverrideContext(bindingContext);\r\n this.resources._invokeHook('beforeBind', this);\r\n bindings = this.bindings;\r\n for (i = 0, ii = bindings.length; i < ii; ++i) {\r\n bindings[i].bind(this);\r\n }\r\n if (this.viewModelScope !== null) {\r\n bindingContext.bind(this.viewModelScope.bindingContext, this.viewModelScope.overrideContext);\r\n this.viewModelScope = null;\r\n }\r\n controllers = this.controllers;\r\n for (i = 0, ii = controllers.length; i < ii; ++i) {\r\n controllers[i].bind(this);\r\n }\r\n children = this.children;\r\n for (i = 0, ii = children.length; i < ii; ++i) {\r\n children[i].bind(bindingContext, overrideContext, true);\r\n }\r\n if (this.hasSlots) {\r\n ShadowDOM.distributeView(this.contentView, this.slots);\r\n }\r\n };\r\n View.prototype.addBinding = function (binding) {\r\n this.bindings.push(binding);\r\n if (this.isBound) {\r\n binding.bind(this);\r\n }\r\n };\r\n View.prototype.unbind = function () {\r\n var controllers;\r\n var bindings;\r\n var children;\r\n var i;\r\n var ii;\r\n if (this.isBound) {\r\n this.isBound = false;\r\n this.resources._invokeHook('beforeUnbind', this);\r\n if (this.controller !== null) {\r\n this.controller.unbind();\r\n }\r\n bindings = this.bindings;\r\n for (i = 0, ii = bindings.length; i < ii; ++i) {\r\n bindings[i].unbind();\r\n }\r\n controllers = this.controllers;\r\n for (i = 0, ii = controllers.length; i < ii; ++i) {\r\n controllers[i].unbind();\r\n }\r\n children = this.children;\r\n for (i = 0, ii = children.length; i < ii; ++i) {\r\n children[i].unbind();\r\n }\r\n this.bindingContext = null;\r\n this.overrideContext = null;\r\n }\r\n };\r\n View.prototype.insertNodesBefore = function (refNode) {\r\n refNode.parentNode.insertBefore(this.fragment, refNode);\r\n };\r\n View.prototype.appendNodesTo = function (parent) {\r\n parent.appendChild(this.fragment);\r\n };\r\n View.prototype.removeNodes = function () {\r\n var fragment = this.fragment;\r\n var current = this.firstChild;\r\n var end = this.lastChild;\r\n var next;\r\n while (current) {\r\n next = current.nextSibling;\r\n fragment.appendChild(current);\r\n if (current === end) {\r\n break;\r\n }\r\n current = next;\r\n }\r\n };\r\n View.prototype.attached = function () {\r\n var controllers;\r\n var children;\r\n var i;\r\n var ii;\r\n if (this.isAttached) {\r\n return;\r\n }\r\n this.isAttached = true;\r\n if (this.controller !== null) {\r\n this.controller.attached();\r\n }\r\n controllers = this.controllers;\r\n for (i = 0, ii = controllers.length; i < ii; ++i) {\r\n controllers[i].attached();\r\n }\r\n children = this.children;\r\n for (i = 0, ii = children.length; i < ii; ++i) {\r\n children[i].attached();\r\n }\r\n };\r\n View.prototype.detached = function () {\r\n var controllers;\r\n var children;\r\n var i;\r\n var ii;\r\n if (this.isAttached) {\r\n this.isAttached = false;\r\n if (this.controller !== null) {\r\n this.controller.detached();\r\n }\r\n controllers = this.controllers;\r\n for (i = 0, ii = controllers.length; i < ii; ++i) {\r\n controllers[i].detached();\r\n }\r\n children = this.children;\r\n for (i = 0, ii = children.length; i < ii; ++i) {\r\n children[i].detached();\r\n }\r\n }\r\n };\r\n return View;\r\n}());\n\nvar Animator = (function () {\r\n function Animator() {\r\n }\r\n Animator.prototype.enter = function (element) {\r\n return Promise.resolve(false);\r\n };\r\n Animator.prototype.leave = function (element) {\r\n return Promise.resolve(false);\r\n };\r\n Animator.prototype.removeClass = function (element, className) {\r\n element.classList.remove(className);\r\n return Promise.resolve(false);\r\n };\r\n Animator.prototype.addClass = function (element, className) {\r\n element.classList.add(className);\r\n return Promise.resolve(false);\r\n };\r\n Animator.prototype.animate = function (element, className) {\r\n return Promise.resolve(false);\r\n };\r\n Animator.prototype.runSequence = function (animations) {\r\n return Promise.resolve(false);\r\n };\r\n Animator.prototype.registerEffect = function (effectName, properties) { };\r\n Animator.prototype.unregisterEffect = function (effectName) { };\r\n return Animator;\r\n}());\n\nfunction getAnimatableElement(view) {\r\n if (view.animatableElement !== undefined) {\r\n return view.animatableElement;\r\n }\r\n var current = view.firstChild;\r\n while (current && current.nodeType !== 1) {\r\n current = current.nextSibling;\r\n }\r\n if (current && current.nodeType === 1) {\r\n return (view.animatableElement = current.classList.contains('au-animate') ? current : null);\r\n }\r\n return (view.animatableElement = null);\r\n}\r\nvar ViewSlot = (function () {\r\n function ViewSlot(anchor, anchorIsContainer, animator) {\r\n if (animator === void 0) { animator = Animator.instance; }\r\n this.anchor = anchor;\r\n this.anchorIsContainer = anchorIsContainer;\r\n this.bindingContext = null;\r\n this.overrideContext = null;\r\n this.animator = animator;\r\n this.children = [];\r\n this.isBound = false;\r\n this.isAttached = false;\r\n this.contentSelectors = null;\r\n anchor.viewSlot = this;\r\n anchor.isContentProjectionSource = false;\r\n }\r\n ViewSlot.prototype.animateView = function (view, direction) {\r\n if (direction === void 0) { direction = 'enter'; }\r\n var animatableElement = getAnimatableElement(view);\r\n if (animatableElement !== null) {\r\n switch (direction) {\r\n case 'enter':\r\n return this.animator.enter(animatableElement);\r\n case 'leave':\r\n return this.animator.leave(animatableElement);\r\n default:\r\n throw new Error('Invalid animation direction: ' + direction);\r\n }\r\n }\r\n };\r\n ViewSlot.prototype.transformChildNodesIntoView = function () {\r\n var parent = this.anchor;\r\n this.children.push({\r\n fragment: parent,\r\n firstChild: parent.firstChild,\r\n lastChild: parent.lastChild,\r\n returnToCache: function () { },\r\n removeNodes: function () {\r\n var last;\r\n while (last = parent.lastChild) {\r\n parent.removeChild(last);\r\n }\r\n },\r\n created: function () { },\r\n bind: function () { },\r\n unbind: function () { },\r\n attached: function () { },\r\n detached: function () { }\r\n });\r\n };\r\n ViewSlot.prototype.bind = function (bindingContext, overrideContext) {\r\n var i;\r\n var ii;\r\n var children;\r\n if (this.isBound) {\r\n if (this.bindingContext === bindingContext) {\r\n return;\r\n }\r\n this.unbind();\r\n }\r\n this.isBound = true;\r\n this.bindingContext = bindingContext = bindingContext || this.bindingContext;\r\n this.overrideContext = overrideContext = overrideContext || this.overrideContext;\r\n children = this.children;\r\n for (i = 0, ii = children.length; i < ii; ++i) {\r\n children[i].bind(bindingContext, overrideContext, true);\r\n }\r\n };\r\n ViewSlot.prototype.unbind = function () {\r\n if (this.isBound) {\r\n var i = void 0;\r\n var ii = void 0;\r\n var children = this.children;\r\n this.isBound = false;\r\n this.bindingContext = null;\r\n this.overrideContext = null;\r\n for (i = 0, ii = children.length; i < ii; ++i) {\r\n children[i].unbind();\r\n }\r\n }\r\n };\r\n ViewSlot.prototype.add = function (view) {\r\n if (this.anchorIsContainer) {\r\n view.appendNodesTo(this.anchor);\r\n }\r\n else {\r\n view.insertNodesBefore(this.anchor);\r\n }\r\n this.children.push(view);\r\n if (this.isAttached) {\r\n view.attached();\r\n return this.animateView(view, 'enter');\r\n }\r\n };\r\n ViewSlot.prototype.insert = function (index, view) {\r\n var children = this.children;\r\n var length = children.length;\r\n if ((index === 0 && length === 0) || index >= length) {\r\n return this.add(view);\r\n }\r\n view.insertNodesBefore(children[index].firstChild);\r\n children.splice(index, 0, view);\r\n if (this.isAttached) {\r\n view.attached();\r\n return this.animateView(view, 'enter');\r\n }\r\n };\r\n ViewSlot.prototype.move = function (sourceIndex, targetIndex) {\r\n if (sourceIndex === targetIndex) {\r\n return;\r\n }\r\n var children = this.children;\r\n var view = children[sourceIndex];\r\n view.removeNodes();\r\n view.insertNodesBefore(children[targetIndex].firstChild);\r\n children.splice(sourceIndex, 1);\r\n children.splice(targetIndex, 0, view);\r\n };\r\n ViewSlot.prototype.remove = function (view, returnToCache, skipAnimation) {\r\n return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation);\r\n };\r\n ViewSlot.prototype.removeMany = function (viewsToRemove, returnToCache, skipAnimation) {\r\n var _this = this;\r\n var children = this.children;\r\n var ii = viewsToRemove.length;\r\n var i;\r\n var rmPromises = [];\r\n viewsToRemove.forEach(function (child) {\r\n if (skipAnimation) {\r\n child.removeNodes();\r\n return;\r\n }\r\n var animation = _this.animateView(child, 'leave');\r\n if (animation) {\r\n rmPromises.push(animation.then(function () { return child.removeNodes(); }));\r\n }\r\n else {\r\n child.removeNodes();\r\n }\r\n });\r\n var removeAction = function () {\r\n if (_this.isAttached) {\r\n for (i = 0; i < ii; ++i) {\r\n viewsToRemove[i].detached();\r\n }\r\n }\r\n if (returnToCache) {\r\n for (i = 0; i < ii; ++i) {\r\n viewsToRemove[i].returnToCache();\r\n }\r\n }\r\n for (i = 0; i < ii; ++i) {\r\n var index = children.indexOf(viewsToRemove[i]);\r\n if (index >= 0) {\r\n children.splice(index, 1);\r\n }\r\n }\r\n };\r\n if (rmPromises.length > 0) {\r\n return Promise.all(rmPromises).then(function () { return removeAction(); });\r\n }\r\n return removeAction();\r\n };\r\n ViewSlot.prototype.removeAt = function (index, returnToCache, skipAnimation) {\r\n var _this = this;\r\n var view = this.children[index];\r\n var removeAction = function () {\r\n index = _this.children.indexOf(view);\r\n view.removeNodes();\r\n _this.children.splice(index, 1);\r\n if (_this.isAttached) {\r\n view.detached();\r\n }\r\n if (returnToCache) {\r\n view.returnToCache();\r\n }\r\n return view;\r\n };\r\n if (!skipAnimation) {\r\n var animation = this.animateView(view, 'leave');\r\n if (animation) {\r\n return animation.then(function () { return removeAction(); });\r\n }\r\n }\r\n return removeAction();\r\n };\r\n ViewSlot.prototype.removeAll = function (returnToCache, skipAnimation) {\r\n var _this = this;\r\n var children = this.children;\r\n var ii = children.length;\r\n var i;\r\n var rmPromises = [];\r\n children.forEach(function (child) {\r\n if (skipAnimation) {\r\n child.removeNodes();\r\n return;\r\n }\r\n var animation = _this.animateView(child, 'leave');\r\n if (animation) {\r\n rmPromises.push(animation.then(function () { return child.removeNodes(); }));\r\n }\r\n else {\r\n child.removeNodes();\r\n }\r\n });\r\n var removeAction = function () {\r\n if (_this.isAttached) {\r\n for (i = 0; i < ii; ++i) {\r\n children[i].detached();\r\n }\r\n }\r\n if (returnToCache) {\r\n for (i = 0; i < ii; ++i) {\r\n var child = children[i];\r\n if (child) {\r\n child.returnToCache();\r\n }\r\n }\r\n }\r\n _this.children = [];\r\n };\r\n if (rmPromises.length > 0) {\r\n return Promise.all(rmPromises).then(function () { return removeAction(); });\r\n }\r\n return removeAction();\r\n };\r\n ViewSlot.prototype.attached = function () {\r\n var i;\r\n var ii;\r\n var children;\r\n var child;\r\n if (this.isAttached) {\r\n return;\r\n }\r\n this.isAttached = true;\r\n children = this.children;\r\n for (i = 0, ii = children.length; i < ii; ++i) {\r\n child = children[i];\r\n child.attached();\r\n this.animateView(child, 'enter');\r\n }\r\n };\r\n ViewSlot.prototype.detached = function () {\r\n var i;\r\n var ii;\r\n var children;\r\n if (this.isAttached) {\r\n this.isAttached = false;\r\n children = this.children;\r\n for (i = 0, ii = children.length; i < ii; ++i) {\r\n children[i].detached();\r\n }\r\n }\r\n };\r\n ViewSlot.prototype.projectTo = function (slots) {\r\n var _this = this;\r\n this.projectToSlots = slots;\r\n this.add = this._projectionAdd;\r\n this.insert = this._projectionInsert;\r\n this.move = this._projectionMove;\r\n this.remove = this._projectionRemove;\r\n this.removeAt = this._projectionRemoveAt;\r\n this.removeMany = this._projectionRemoveMany;\r\n this.removeAll = this._projectionRemoveAll;\r\n this.children.forEach(function (view) { return ShadowDOM.distributeView(view, slots, _this); });\r\n };\r\n ViewSlot.prototype._projectionAdd = function (view) {\r\n ShadowDOM.distributeView(view, this.projectToSlots, this);\r\n this.children.push(view);\r\n if (this.isAttached) {\r\n view.attached();\r\n }\r\n };\r\n ViewSlot.prototype._projectionInsert = function (index, view) {\r\n if ((index === 0 && !this.children.length) || index >= this.children.length) {\r\n this.add(view);\r\n }\r\n else {\r\n ShadowDOM.distributeView(view, this.projectToSlots, this, index);\r\n this.children.splice(index, 0, view);\r\n if (this.isAttached) {\r\n view.attached();\r\n }\r\n }\r\n };\r\n ViewSlot.prototype._projectionMove = function (sourceIndex, targetIndex) {\r\n if (sourceIndex === targetIndex) {\r\n return;\r\n }\r\n var children = this.children;\r\n var view = children[sourceIndex];\r\n ShadowDOM.undistributeView(view, this.projectToSlots, this);\r\n ShadowDOM.distributeView(view, this.projectToSlots, this, targetIndex);\r\n children.splice(sourceIndex, 1);\r\n children.splice(targetIndex, 0, view);\r\n };\r\n ViewSlot.prototype._projectionRemove = function (view, returnToCache) {\r\n ShadowDOM.undistributeView(view, this.projectToSlots, this);\r\n this.children.splice(this.children.indexOf(view), 1);\r\n if (this.isAttached) {\r\n view.detached();\r\n }\r\n if (returnToCache) {\r\n view.returnToCache();\r\n }\r\n };\r\n ViewSlot.prototype._projectionRemoveAt = function (index, returnToCache) {\r\n var view = this.children[index];\r\n ShadowDOM.undistributeView(view, this.projectToSlots, this);\r\n this.children.splice(index, 1);\r\n if (this.isAttached) {\r\n view.detached();\r\n }\r\n if (returnToCache) {\r\n view.returnToCache();\r\n }\r\n };\r\n ViewSlot.prototype._projectionRemoveMany = function (viewsToRemove, returnToCache) {\r\n var _this = this;\r\n viewsToRemove.forEach(function (view) { return _this.remove(view, returnToCache); });\r\n };\r\n ViewSlot.prototype._projectionRemoveAll = function (returnToCache) {\r\n ShadowDOM.undistributeAll(this.projectToSlots, this);\r\n var children = this.children;\r\n var ii = children.length;\r\n for (var i = 0; i < ii; ++i) {\r\n if (returnToCache) {\r\n children[i].returnToCache();\r\n }\r\n else if (this.isAttached) {\r\n children[i].detached();\r\n }\r\n }\r\n this.children = [];\r\n };\r\n return ViewSlot;\r\n}());\n\nvar $resolver = resolver;\r\nvar ProviderResolver = (function () {\r\n function ProviderResolver() {\r\n }\r\n ProviderResolver.prototype.get = function (container, key) {\r\n var id = key.__providerId__;\r\n return id in container ? container[id] : (container[id] = container.invoke(key));\r\n };\r\n ProviderResolver = __decorate([\r\n $resolver\r\n ], ProviderResolver);\r\n return ProviderResolver;\r\n}());\r\nvar providerResolverInstance = new ProviderResolver();\r\nfunction elementContainerGet(key) {\r\n if (key === DOM.Element) {\r\n return this.element;\r\n }\r\n if (key === BoundViewFactory) {\r\n if (this.boundViewFactory) {\r\n return this.boundViewFactory;\r\n }\r\n var factory = this.instruction.viewFactory;\r\n var partReplacements = this.partReplacements;\r\n if (partReplacements) {\r\n factory = partReplacements[factory.part] || factory;\r\n }\r\n this.boundViewFactory = new BoundViewFactory(this, factory, partReplacements);\r\n return this.boundViewFactory;\r\n }\r\n if (key === ViewSlot) {\r\n if (this.viewSlot === undefined) {\r\n this.viewSlot = new ViewSlot(this.element, this.instruction.anchorIsContainer);\r\n this.element.isContentProjectionSource = this.instruction.lifting;\r\n this.children.push(this.viewSlot);\r\n }\r\n return this.viewSlot;\r\n }\r\n if (key === ElementEvents) {\r\n return this.elementEvents || (this.elementEvents = new ElementEvents(this.element));\r\n }\r\n if (key === CompositionTransaction) {\r\n return this.compositionTransaction || (this.compositionTransaction = this.parent.get(key));\r\n }\r\n if (key === ViewResources) {\r\n return this.viewResources;\r\n }\r\n if (key === TargetInstruction) {\r\n return this.instruction;\r\n }\r\n return this.superGet(key);\r\n}\r\nfunction createElementContainer(parent, element, instruction, children, partReplacements, resources) {\r\n var container = parent.createChild();\r\n var providers;\r\n var i;\r\n container.element = element;\r\n container.instruction = instruction;\r\n container.children = children;\r\n container.viewResources = resources;\r\n container.partReplacements = partReplacements;\r\n providers = instruction.providers;\r\n i = providers.length;\r\n while (i--) {\r\n container._resolvers.set(providers[i], providerResolverInstance);\r\n }\r\n container.superGet = container.get;\r\n container.get = elementContainerGet;\r\n return container;\r\n}\r\nfunction hasAttribute(name) {\r\n return this._element.hasAttribute(name);\r\n}\r\nfunction getAttribute(name) {\r\n return this._element.getAttribute(name);\r\n}\r\nfunction setAttribute(name, value) {\r\n this._element.setAttribute(name, value);\r\n}\r\nfunction makeElementIntoAnchor(element, elementInstruction) {\r\n var anchor = DOM.createComment('anchor');\r\n if (elementInstruction) {\r\n var firstChild = element.firstChild;\r\n if (firstChild && firstChild.tagName === 'AU-CONTENT') {\r\n anchor.contentElement = firstChild;\r\n }\r\n anchor._element = element;\r\n anchor.hasAttribute = hasAttribute;\r\n anchor.getAttribute = getAttribute;\r\n anchor.setAttribute = setAttribute;\r\n }\r\n DOM.replaceNode(anchor, element);\r\n return anchor;\r\n}\r\nfunction applyInstructions(containers, element, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources) {\r\n var behaviorInstructions = instruction.behaviorInstructions;\r\n var expressions = instruction.expressions;\r\n var elementContainer;\r\n var i;\r\n var ii;\r\n var current;\r\n var instance;\r\n if (instruction.contentExpression) {\r\n bindings.push(instruction.contentExpression.createBinding(element.nextSibling));\r\n element.nextSibling.auInterpolationTarget = true;\r\n element.parentNode.removeChild(element);\r\n return;\r\n }\r\n if (instruction.shadowSlot) {\r\n var commentAnchor = DOM.createComment('slot');\r\n var slot = void 0;\r\n if (instruction.slotDestination) {\r\n slot = new PassThroughSlot(commentAnchor, instruction.slotName, instruction.slotDestination, instruction.slotFallbackFactory);\r\n }\r\n else {\r\n slot = new ShadowSlot(commentAnchor, instruction.slotName, instruction.slotFallbackFactory);\r\n }\r\n DOM.replaceNode(commentAnchor, element);\r\n shadowSlots[instruction.slotName] = slot;\r\n controllers.push(slot);\r\n return;\r\n }\r\n if (instruction.letElement) {\r\n for (i = 0, ii = expressions.length; i < ii; ++i) {\r\n bindings.push(expressions[i].createBinding());\r\n }\r\n element.parentNode.removeChild(element);\r\n return;\r\n }\r\n if (behaviorInstructions.length) {\r\n if (!instruction.anchorIsContainer) {\r\n element = makeElementIntoAnchor(element, instruction.elementInstruction);\r\n }\r\n containers[instruction.injectorId] = elementContainer =\r\n createElementContainer(containers[instruction.parentInjectorId], element, instruction, children, partReplacements, resources);\r\n for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {\r\n current = behaviorInstructions[i];\r\n instance = current.type.create(elementContainer, current, element, bindings);\r\n controllers.push(instance);\r\n }\r\n }\r\n for (i = 0, ii = expressions.length; i < ii; ++i) {\r\n bindings.push(expressions[i].createBinding(element));\r\n }\r\n}\r\nfunction styleStringToObject(style, target) {\r\n var attributes = style.split(';');\r\n var firstIndexOfColon;\r\n var i;\r\n var current;\r\n var key;\r\n var value;\r\n target = target || {};\r\n for (i = 0; i < attributes.length; i++) {\r\n current = attributes[i];\r\n firstIndexOfColon = current.indexOf(':');\r\n key = current.substring(0, firstIndexOfColon).trim();\r\n value = current.substring(firstIndexOfColon + 1).trim();\r\n target[key] = value;\r\n }\r\n return target;\r\n}\r\nfunction styleObjectToString(obj) {\r\n var result = '';\r\n for (var key in obj) {\r\n result += key + ':' + obj[key] + ';';\r\n }\r\n return result;\r\n}\r\nfunction applySurrogateInstruction(container, element, instruction, controllers, bindings, children) {\r\n var behaviorInstructions = instruction.behaviorInstructions;\r\n var expressions = instruction.expressions;\r\n var providers = instruction.providers;\r\n var values = instruction.values;\r\n var i;\r\n var ii;\r\n var current;\r\n var instance;\r\n var currentAttributeValue;\r\n i = providers.length;\r\n while (i--) {\r\n container._resolvers.set(providers[i], providerResolverInstance);\r\n }\r\n for (var key in values) {\r\n currentAttributeValue = element.getAttribute(key);\r\n if (currentAttributeValue) {\r\n if (key === 'class') {\r\n element.setAttribute('class', currentAttributeValue + ' ' + values[key]);\r\n }\r\n else if (key === 'style') {\r\n var styleObject = styleStringToObject(values[key]);\r\n styleStringToObject(currentAttributeValue, styleObject);\r\n element.setAttribute('style', styleObjectToString(styleObject));\r\n }\r\n }\r\n else {\r\n element.setAttribute(key, values[key]);\r\n }\r\n }\r\n if (behaviorInstructions.length) {\r\n for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {\r\n current = behaviorInstructions[i];\r\n instance = current.type.create(container, current, element, bindings);\r\n if (instance.contentView) {\r\n children.push(instance.contentView);\r\n }\r\n controllers.push(instance);\r\n }\r\n }\r\n for (i = 0, ii = expressions.length; i < ii; ++i) {\r\n bindings.push(expressions[i].createBinding(element));\r\n }\r\n}\r\nvar BoundViewFactory = (function () {\r\n function BoundViewFactory(parentContainer, viewFactory, partReplacements) {\r\n this.parentContainer = parentContainer;\r\n this.viewFactory = viewFactory;\r\n this.factoryCreateInstruction = { partReplacements: partReplacements };\r\n }\r\n BoundViewFactory.prototype.create = function () {\r\n var view = this.viewFactory.create(this.parentContainer.createChild(), this.factoryCreateInstruction);\r\n view._isUserControlled = true;\r\n return view;\r\n };\r\n Object.defineProperty(BoundViewFactory.prototype, \"isCaching\", {\r\n get: function () {\r\n return this.viewFactory.isCaching;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n BoundViewFactory.prototype.setCacheSize = function (size, doNotOverrideIfAlreadySet) {\r\n this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet);\r\n };\r\n BoundViewFactory.prototype.getCachedView = function () {\r\n return this.viewFactory.getCachedView();\r\n };\r\n BoundViewFactory.prototype.returnViewToCache = function (view) {\r\n this.viewFactory.returnViewToCache(view);\r\n };\r\n return BoundViewFactory;\r\n}());\r\nvar ViewFactory = (function () {\r\n function ViewFactory(template, instructions, resources) {\r\n this.isCaching = false;\r\n this.template = template;\r\n this.instructions = instructions;\r\n this.resources = resources;\r\n this.cacheSize = -1;\r\n this.cache = null;\r\n }\r\n ViewFactory.prototype.setCacheSize = function (size, doNotOverrideIfAlreadySet) {\r\n if (size) {\r\n if (size === '*') {\r\n size = Number.MAX_VALUE;\r\n }\r\n else if (typeof size === 'string') {\r\n size = parseInt(size, 10);\r\n }\r\n }\r\n if (this.cacheSize === -1 || !doNotOverrideIfAlreadySet) {\r\n this.cacheSize = Number(size);\r\n }\r\n if (this.cacheSize > 0) {\r\n this.cache = [];\r\n }\r\n else {\r\n this.cache = null;\r\n }\r\n this.isCaching = this.cacheSize > 0;\r\n };\r\n ViewFactory.prototype.getCachedView = function () {\r\n return this.cache !== null ? (this.cache.pop() || null) : null;\r\n };\r\n ViewFactory.prototype.returnViewToCache = function (view) {\r\n if (view.isAttached) {\r\n view.detached();\r\n }\r\n if (view.isBound) {\r\n view.unbind();\r\n }\r\n if (this.cache !== null && this.cache.length < this.cacheSize) {\r\n view.fromCache = true;\r\n this.cache.push(view);\r\n }\r\n };\r\n ViewFactory.prototype.create = function (container, createInstruction, element) {\r\n createInstruction = createInstruction || BehaviorInstruction.normal;\r\n var cachedView = this.getCachedView();\r\n if (cachedView !== null) {\r\n return cachedView;\r\n }\r\n var fragment = createInstruction.enhance ? this.template : this.template.cloneNode(true);\r\n var instructables = fragment.querySelectorAll('.au-target');\r\n var instructions = this.instructions;\r\n var resources = this.resources;\r\n var controllers = [];\r\n var bindings = [];\r\n var children = [];\r\n var shadowSlots = Object.create(null);\r\n var containers = { root: container };\r\n var partReplacements = createInstruction.partReplacements;\r\n var i;\r\n var ii;\r\n var view;\r\n var instructable;\r\n var instruction;\r\n this.resources._invokeHook('beforeCreate', this, container, fragment, createInstruction);\r\n if (element && this.surrogateInstruction !== null) {\r\n applySurrogateInstruction(container, element, this.surrogateInstruction, controllers, bindings, children);\r\n }\r\n if (createInstruction.enhance && fragment.hasAttribute('au-target-id')) {\r\n instructable = fragment;\r\n instruction = instructions[instructable.getAttribute('au-target-id')];\r\n applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources);\r\n }\r\n for (i = 0, ii = instructables.length; i < ii; ++i) {\r\n instructable = instructables[i];\r\n instruction = instructions[instructable.getAttribute('au-target-id')];\r\n applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources);\r\n }\r\n view = new View(container, this, fragment, controllers, bindings, children, shadowSlots);\r\n if (!createInstruction.initiatedByBehavior) {\r\n view.created();\r\n }\r\n this.resources._invokeHook('afterCreate', view);\r\n return view;\r\n };\r\n return ViewFactory;\r\n}());\n\nvar nextInjectorId = 0;\r\nfunction getNextInjectorId() {\r\n return ++nextInjectorId;\r\n}\r\nvar lastAUTargetID = 0;\r\nfunction getNextAUTargetID() {\r\n return (++lastAUTargetID).toString();\r\n}\r\nfunction makeIntoInstructionTarget(element) {\r\n var value = element.getAttribute('class');\r\n var auTargetID = getNextAUTargetID();\r\n element.setAttribute('class', (value ? value + ' au-target' : 'au-target'));\r\n element.setAttribute('au-target-id', auTargetID);\r\n return auTargetID;\r\n}\r\nfunction makeShadowSlot(compiler, resources, node, instructions, parentInjectorId) {\r\n var auShadowSlot = DOM.createElement('au-shadow-slot');\r\n DOM.replaceNode(auShadowSlot, node);\r\n var auTargetID = makeIntoInstructionTarget(auShadowSlot);\r\n var instruction = TargetInstruction.shadowSlot(parentInjectorId);\r\n instruction.slotName = node.getAttribute('name') || ShadowDOM.defaultSlotKey;\r\n instruction.slotDestination = node.getAttribute('slot');\r\n if (node.innerHTML.trim()) {\r\n var fragment = DOM.createDocumentFragment();\r\n var child = void 0;\r\n while (child = node.firstChild) {\r\n fragment.appendChild(child);\r\n }\r\n instruction.slotFallbackFactory = compiler.compile(fragment, resources);\r\n }\r\n instructions[auTargetID] = instruction;\r\n return auShadowSlot;\r\n}\r\nvar defaultLetHandler = BindingLanguage.prototype.createLetExpressions;\r\nvar ViewCompiler = (function () {\r\n function ViewCompiler(bindingLanguage, resources) {\r\n this.bindingLanguage = bindingLanguage;\r\n this.resources = resources;\r\n }\r\n ViewCompiler.inject = function () {\r\n return [BindingLanguage, ViewResources];\r\n };\r\n ViewCompiler.prototype.compile = function (source, resources, compileInstruction) {\r\n resources = resources || this.resources;\r\n compileInstruction = compileInstruction || ViewCompileInstruction.normal;\r\n source = typeof source === 'string' ? DOM.createTemplateFromMarkup(source) : source;\r\n var content;\r\n var part;\r\n var cacheSize;\r\n if (source.content) {\r\n part = source.getAttribute('part');\r\n cacheSize = source.getAttribute('view-cache');\r\n content = DOM.adoptNode(source.content);\r\n }\r\n else {\r\n content = source;\r\n }\r\n compileInstruction.targetShadowDOM = compileInstruction.targetShadowDOM && FEATURE.shadowDOM;\r\n resources._invokeHook('beforeCompile', content, resources, compileInstruction);\r\n var instructions = {};\r\n this._compileNode(content, resources, instructions, source, 'root', !compileInstruction.targetShadowDOM);\r\n var firstChild = content.firstChild;\r\n if (firstChild && firstChild.nodeType === 1) {\r\n var targetId = firstChild.getAttribute('au-target-id');\r\n if (targetId) {\r\n var ins = instructions[targetId];\r\n if (ins.shadowSlot || ins.lifting || (ins.elementInstruction && !ins.elementInstruction.anchorIsContainer)) {\r\n content.insertBefore(DOM.createComment('view'), firstChild);\r\n }\r\n }\r\n }\r\n var factory = new ViewFactory(content, instructions, resources);\r\n factory.surrogateInstruction = compileInstruction.compileSurrogate ? this._compileSurrogate(source, resources) : null;\r\n factory.part = part;\r\n if (cacheSize) {\r\n factory.setCacheSize(cacheSize);\r\n }\r\n resources._invokeHook('afterCompile', factory);\r\n return factory;\r\n };\r\n ViewCompiler.prototype._compileNode = function (node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) {\r\n switch (node.nodeType) {\r\n case 1:\r\n return this._compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM);\r\n case 3:\r\n var expression = resources.getBindingLanguage(this.bindingLanguage).inspectTextContent(resources, node.wholeText);\r\n if (expression) {\r\n var marker = DOM.createElement('au-marker');\r\n var auTargetID = makeIntoInstructionTarget(marker);\r\n (node.parentNode || parentNode).insertBefore(marker, node);\r\n node.textContent = ' ';\r\n instructions[auTargetID] = TargetInstruction.contentExpression(expression);\r\n while (node.nextSibling && node.nextSibling.nodeType === 3) {\r\n (node.parentNode || parentNode).removeChild(node.nextSibling);\r\n }\r\n }\r\n else {\r\n while (node.nextSibling && node.nextSibling.nodeType === 3) {\r\n node = node.nextSibling;\r\n }\r\n }\r\n return node.nextSibling;\r\n case 11:\r\n var currentChild = node.firstChild;\r\n while (currentChild) {\r\n currentChild = this._compileNode(currentChild, resources, instructions, node, parentInjectorId, targetLightDOM);\r\n }\r\n break;\r\n }\r\n return node.nextSibling;\r\n };\r\n ViewCompiler.prototype._compileSurrogate = function (node, resources) {\r\n var tagName = node.tagName.toLowerCase();\r\n var attributes = node.attributes;\r\n var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage);\r\n var knownAttribute;\r\n var property;\r\n var instruction;\r\n var i;\r\n var ii;\r\n var attr;\r\n var attrName;\r\n var attrValue;\r\n var info;\r\n var type;\r\n var expressions = [];\r\n var expression;\r\n var behaviorInstructions = [];\r\n var values = {};\r\n var hasValues = false;\r\n var providers = [];\r\n for (i = 0, ii = attributes.length; i < ii; ++i) {\r\n attr = attributes[i];\r\n attrName = attr.name;\r\n attrValue = attr.value;\r\n info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue);\r\n type = resources.getAttribute(info.attrName);\r\n if (type) {\r\n knownAttribute = resources.mapAttribute(info.attrName);\r\n if (knownAttribute) {\r\n property = type.attributes[knownAttribute];\r\n if (property) {\r\n info.defaultBindingMode = property.defaultBindingMode;\r\n if (!info.command && !info.expression) {\r\n info.command = property.hasOptions ? 'options' : null;\r\n }\r\n if (info.command && (info.command !== 'options') && type.primaryProperty) {\r\n var primaryProperty = type.primaryProperty;\r\n attrName = info.attrName = primaryProperty.attribute;\r\n info.defaultBindingMode = primaryProperty.defaultBindingMode;\r\n }\r\n }\r\n }\r\n }\r\n instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type);\r\n if (instruction) {\r\n if (instruction.alteredAttr) {\r\n type = resources.getAttribute(instruction.attrName);\r\n }\r\n if (instruction.discrete) {\r\n expressions.push(instruction);\r\n }\r\n else {\r\n if (type) {\r\n instruction.type = type;\r\n this._configureProperties(instruction, resources);\r\n if (type.liftsContent) {\r\n throw new Error('You cannot place a template controller on a surrogate element.');\r\n }\r\n else {\r\n behaviorInstructions.push(instruction);\r\n }\r\n }\r\n else {\r\n expressions.push(instruction.attributes[instruction.attrName]);\r\n }\r\n }\r\n }\r\n else {\r\n if (type) {\r\n instruction = BehaviorInstruction.attribute(attrName, type);\r\n instruction.attributes[resources.mapAttribute(attrName)] = attrValue;\r\n if (type.liftsContent) {\r\n throw new Error('You cannot place a template controller on a surrogate element.');\r\n }\r\n else {\r\n behaviorInstructions.push(instruction);\r\n }\r\n }\r\n else if (attrName !== 'id' && attrName !== 'part' && attrName !== 'replace-part') {\r\n hasValues = true;\r\n values[attrName] = attrValue;\r\n }\r\n }\r\n }\r\n if (expressions.length || behaviorInstructions.length || hasValues) {\r\n for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {\r\n instruction = behaviorInstructions[i];\r\n instruction.type.compile(this, resources, node, instruction);\r\n providers.push(instruction.type.target);\r\n }\r\n for (i = 0, ii = expressions.length; i < ii; ++i) {\r\n expression = expressions[i];\r\n if (expression.attrToRemove !== undefined) {\r\n node.removeAttribute(expression.attrToRemove);\r\n }\r\n }\r\n return TargetInstruction.surrogate(providers, behaviorInstructions, expressions, values);\r\n }\r\n return null;\r\n };\r\n ViewCompiler.prototype._compileElement = function (node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) {\r\n var tagName = node.tagName.toLowerCase();\r\n var attributes = node.attributes;\r\n var expressions = [];\r\n var expression;\r\n var behaviorInstructions = [];\r\n var providers = [];\r\n var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage);\r\n var liftingInstruction;\r\n var viewFactory;\r\n var type;\r\n var elementInstruction;\r\n var elementProperty;\r\n var i;\r\n var ii;\r\n var attr;\r\n var attrName;\r\n var attrValue;\r\n var originalAttrName;\r\n var instruction;\r\n var info;\r\n var property;\r\n var knownAttribute;\r\n var auTargetID;\r\n var injectorId;\r\n if (tagName === 'slot') {\r\n if (targetLightDOM) {\r\n node = makeShadowSlot(this, resources, node, instructions, parentInjectorId);\r\n }\r\n return node.nextSibling;\r\n }\r\n else if (tagName === 'template') {\r\n if (!('content' in node)) {\r\n throw new Error('You cannot place a template element within ' + node.namespaceURI + ' namespace');\r\n }\r\n viewFactory = this.compile(node, resources);\r\n viewFactory.part = node.getAttribute('part');\r\n }\r\n else {\r\n type = resources.getElement(node.getAttribute('as-element') || tagName);\r\n if (tagName === 'let' && !type && bindingLanguage.createLetExpressions !== defaultLetHandler) {\r\n expressions = bindingLanguage.createLetExpressions(resources, node);\r\n auTargetID = makeIntoInstructionTarget(node);\r\n instructions[auTargetID] = TargetInstruction.letElement(expressions);\r\n return node.nextSibling;\r\n }\r\n if (type) {\r\n elementInstruction = BehaviorInstruction.element(node, type);\r\n type.processAttributes(this, resources, node, attributes, elementInstruction);\r\n behaviorInstructions.push(elementInstruction);\r\n }\r\n }\r\n for (i = 0, ii = attributes.length; i < ii; ++i) {\r\n attr = attributes[i];\r\n originalAttrName = attrName = attr.name;\r\n attrValue = attr.value;\r\n info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue);\r\n if (targetLightDOM && info.attrName === 'slot') {\r\n info.attrName = attrName = 'au-slot';\r\n }\r\n type = resources.getAttribute(info.attrName);\r\n elementProperty = null;\r\n if (type) {\r\n knownAttribute = resources.mapAttribute(info.attrName);\r\n if (knownAttribute) {\r\n property = type.attributes[knownAttribute];\r\n if (property) {\r\n info.defaultBindingMode = property.defaultBindingMode;\r\n if (!info.command && !info.expression) {\r\n info.command = property.hasOptions ? 'options' : null;\r\n }\r\n if (info.command && (info.command !== 'options') && type.primaryProperty) {\r\n var primaryProperty = type.primaryProperty;\r\n attrName = info.attrName = primaryProperty.attribute;\r\n info.defaultBindingMode = primaryProperty.defaultBindingMode;\r\n }\r\n }\r\n }\r\n }\r\n else if (elementInstruction) {\r\n elementProperty = elementInstruction.type.attributes[info.attrName];\r\n if (elementProperty) {\r\n info.defaultBindingMode = elementProperty.defaultBindingMode;\r\n }\r\n }\r\n if (elementProperty) {\r\n instruction = bindingLanguage.createAttributeInstruction(resources, node, info, elementInstruction);\r\n }\r\n else {\r\n instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type);\r\n }\r\n if (instruction) {\r\n if (instruction.alteredAttr) {\r\n type = resources.getAttribute(instruction.attrName);\r\n }\r\n if (instruction.discrete) {\r\n expressions.push(instruction);\r\n }\r\n else {\r\n if (type) {\r\n instruction.type = type;\r\n this._configureProperties(instruction, resources);\r\n if (type.liftsContent) {\r\n instruction.originalAttrName = originalAttrName;\r\n liftingInstruction = instruction;\r\n break;\r\n }\r\n else {\r\n behaviorInstructions.push(instruction);\r\n }\r\n }\r\n else if (elementProperty) {\r\n elementInstruction.attributes[info.attrName].targetProperty = elementProperty.name;\r\n }\r\n else {\r\n expressions.push(instruction.attributes[instruction.attrName]);\r\n }\r\n }\r\n }\r\n else {\r\n if (type) {\r\n instruction = BehaviorInstruction.attribute(attrName, type);\r\n instruction.attributes[resources.mapAttribute(attrName)] = attrValue;\r\n if (type.liftsContent) {\r\n instruction.originalAttrName = originalAttrName;\r\n liftingInstruction = instruction;\r\n break;\r\n }\r\n else {\r\n behaviorInstructions.push(instruction);\r\n }\r\n }\r\n else if (elementProperty) {\r\n elementInstruction.attributes[attrName] = attrValue;\r\n }\r\n }\r\n }\r\n if (liftingInstruction) {\r\n liftingInstruction.viewFactory = viewFactory;\r\n node = liftingInstruction.type.compile(this, resources, node, liftingInstruction, parentNode);\r\n auTargetID = makeIntoInstructionTarget(node);\r\n instructions[auTargetID] = TargetInstruction.lifting(parentInjectorId, liftingInstruction);\r\n }\r\n else {\r\n var skipContentProcessing = false;\r\n if (expressions.length || behaviorInstructions.length) {\r\n injectorId = behaviorInstructions.length ? getNextInjectorId() : false;\r\n for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {\r\n instruction = behaviorInstructions[i];\r\n instruction.type.compile(this, resources, node, instruction, parentNode);\r\n providers.push(instruction.type.target);\r\n skipContentProcessing = skipContentProcessing || instruction.skipContentProcessing;\r\n }\r\n for (i = 0, ii = expressions.length; i < ii; ++i) {\r\n expression = expressions[i];\r\n if (expression.attrToRemove !== undefined) {\r\n node.removeAttribute(expression.attrToRemove);\r\n }\r\n }\r\n auTargetID = makeIntoInstructionTarget(node);\r\n instructions[auTargetID] = TargetInstruction.normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction);\r\n }\r\n if (skipContentProcessing) {\r\n return node.nextSibling;\r\n }\r\n var currentChild = node.firstChild;\r\n while (currentChild) {\r\n currentChild = this._compileNode(currentChild, resources, instructions, node, injectorId || parentInjectorId, targetLightDOM);\r\n }\r\n }\r\n return node.nextSibling;\r\n };\r\n ViewCompiler.prototype._configureProperties = function (instruction, resources) {\r\n var type = instruction.type;\r\n var attrName = instruction.attrName;\r\n var attributes = instruction.attributes;\r\n var property;\r\n var key;\r\n var value;\r\n var knownAttribute = resources.mapAttribute(attrName);\r\n if (knownAttribute && attrName in attributes && knownAttribute !== attrName) {\r\n attributes[knownAttribute] = attributes[attrName];\r\n delete attributes[attrName];\r\n }\r\n for (key in attributes) {\r\n value = attributes[key];\r\n if (value !== null && typeof value === 'object') {\r\n property = type.attributes[key];\r\n if (property !== undefined) {\r\n value.targetProperty = property.name;\r\n }\r\n else {\r\n value.targetProperty = key;\r\n }\r\n }\r\n }\r\n };\r\n return ViewCompiler;\r\n}());\n\nvar ViewEngineHooksResource = (function () {\r\n function ViewEngineHooksResource() {\r\n }\r\n ViewEngineHooksResource.prototype.initialize = function (container, target) {\r\n this.instance = container.get(target);\r\n };\r\n ViewEngineHooksResource.prototype.register = function (registry, name) {\r\n registry.registerViewEngineHooks(this.instance);\r\n };\r\n ViewEngineHooksResource.prototype.load = function (container, target) { };\r\n ViewEngineHooksResource.convention = function (name) {\r\n if (name.endsWith('ViewEngineHooks')) {\r\n return new ViewEngineHooksResource();\r\n }\r\n };\r\n return ViewEngineHooksResource;\r\n}());\r\nfunction viewEngineHooks(target) {\r\n var deco = function (t) {\r\n metadata.define(metadata.resource, new ViewEngineHooksResource(), t);\r\n };\r\n return target ? deco(target) : deco;\r\n}\n\nvar ResourceModule = (function () {\r\n function ResourceModule(moduleId) {\r\n this.id = moduleId;\r\n this.moduleInstance = null;\r\n this.mainResource = null;\r\n this.resources = null;\r\n this.viewStrategy = null;\r\n this.isInitialized = false;\r\n this.onLoaded = null;\r\n this.loadContext = null;\r\n }\r\n ResourceModule.prototype.initialize = function (container) {\r\n var current = this.mainResource;\r\n var resources = this.resources;\r\n var vs = this.viewStrategy;\r\n if (this.isInitialized) {\r\n return;\r\n }\r\n this.isInitialized = true;\r\n if (current !== undefined) {\r\n current.metadata.viewStrategy = vs;\r\n current.initialize(container);\r\n }\r\n for (var i = 0, ii = resources.length; i < ii; ++i) {\r\n current = resources[i];\r\n current.metadata.viewStrategy = vs;\r\n current.initialize(container);\r\n }\r\n };\r\n ResourceModule.prototype.register = function (registry, name) {\r\n var main = this.mainResource;\r\n var resources = this.resources;\r\n if (main !== undefined) {\r\n main.register(registry, name);\r\n name = null;\r\n }\r\n for (var i = 0, ii = resources.length; i < ii; ++i) {\r\n resources[i].register(registry, name);\r\n name = null;\r\n }\r\n };\r\n ResourceModule.prototype.load = function (container, loadContext) {\r\n if (this.onLoaded !== null) {\r\n return this.loadContext === loadContext ? Promise.resolve() : this.onLoaded;\r\n }\r\n var main = this.mainResource;\r\n var resources = this.resources;\r\n var loads;\r\n if (main !== undefined) {\r\n loads = new Array(resources.length + 1);\r\n loads[0] = main.load(container, loadContext);\r\n for (var i = 0, ii = resources.length; i < ii; ++i) {\r\n loads[i + 1] = resources[i].load(container, loadContext);\r\n }\r\n }\r\n else {\r\n loads = new Array(resources.length);\r\n for (var i = 0, ii = resources.length; i < ii; ++i) {\r\n loads[i] = resources[i].load(container, loadContext);\r\n }\r\n }\r\n this.loadContext = loadContext;\r\n this.onLoaded = Promise.all(loads);\r\n return this.onLoaded;\r\n };\r\n return ResourceModule;\r\n}());\r\nvar ResourceDescription = (function () {\r\n function ResourceDescription(key, exportedValue, resourceTypeMeta) {\r\n if (!resourceTypeMeta) {\r\n resourceTypeMeta = metadata.get(metadata.resource, exportedValue);\r\n if (!resourceTypeMeta) {\r\n resourceTypeMeta = new HtmlBehaviorResource();\r\n resourceTypeMeta.elementName = _hyphenate(key);\r\n metadata.define(metadata.resource, resourceTypeMeta, exportedValue);\r\n }\r\n }\r\n if (resourceTypeMeta instanceof HtmlBehaviorResource) {\r\n if (resourceTypeMeta.elementName === undefined) {\r\n resourceTypeMeta.elementName = _hyphenate(key);\r\n }\r\n else if (resourceTypeMeta.attributeName === undefined) {\r\n resourceTypeMeta.attributeName = _hyphenate(key);\r\n }\r\n else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\r\n HtmlBehaviorResource.convention(key, resourceTypeMeta);\r\n }\r\n }\r\n else if (!resourceTypeMeta.name) {\r\n resourceTypeMeta.name = _hyphenate(key);\r\n }\r\n this.metadata = resourceTypeMeta;\r\n this.value = exportedValue;\r\n }\r\n ResourceDescription.prototype.initialize = function (container) {\r\n this.metadata.initialize(container, this.value);\r\n };\r\n ResourceDescription.prototype.register = function (registry, name) {\r\n this.metadata.register(registry, name);\r\n };\r\n ResourceDescription.prototype.load = function (container, loadContext) {\r\n return this.metadata.load(container, this.value, loadContext);\r\n };\r\n return ResourceDescription;\r\n}());\r\nvar ModuleAnalyzer = (function () {\r\n function ModuleAnalyzer() {\r\n this.cache = Object.create(null);\r\n }\r\n ModuleAnalyzer.prototype.getAnalysis = function (moduleId) {\r\n return this.cache[moduleId];\r\n };\r\n ModuleAnalyzer.prototype.analyze = function (moduleId, moduleInstance, mainResourceKey) {\r\n var mainResource;\r\n var fallbackValue;\r\n var fallbackKey;\r\n var resourceTypeMeta;\r\n var key;\r\n var exportedValue;\r\n var resources = [];\r\n var conventional;\r\n var vs;\r\n var resourceModule;\r\n resourceModule = this.cache[moduleId];\r\n if (resourceModule) {\r\n return resourceModule;\r\n }\r\n resourceModule = new ResourceModule(moduleId);\r\n this.cache[moduleId] = resourceModule;\r\n if (typeof moduleInstance === 'function') {\r\n moduleInstance = { 'default': moduleInstance };\r\n }\r\n if (mainResourceKey) {\r\n mainResource = new ResourceDescription(mainResourceKey, moduleInstance[mainResourceKey]);\r\n }\r\n for (key in moduleInstance) {\r\n exportedValue = moduleInstance[key];\r\n if (key === mainResourceKey || typeof exportedValue !== 'function') {\r\n continue;\r\n }\r\n resourceTypeMeta = metadata.get(metadata.resource, exportedValue);\r\n if (resourceTypeMeta) {\r\n if (resourceTypeMeta instanceof HtmlBehaviorResource) {\r\n ViewResources.convention(exportedValue, resourceTypeMeta);\r\n if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\r\n HtmlBehaviorResource.convention(key, resourceTypeMeta);\r\n }\r\n if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\r\n resourceTypeMeta.elementName = _hyphenate(key);\r\n }\r\n }\r\n if (!mainResource && resourceTypeMeta instanceof HtmlBehaviorResource && resourceTypeMeta.elementName !== null) {\r\n mainResource = new ResourceDescription(key, exportedValue, resourceTypeMeta);\r\n }\r\n else {\r\n resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta));\r\n }\r\n }\r\n else if (viewStrategy.decorates(exportedValue)) {\r\n vs = exportedValue;\r\n }\r\n else if (exportedValue instanceof TemplateRegistryEntry) {\r\n vs = new TemplateRegistryViewStrategy(moduleId, exportedValue);\r\n }\r\n else {\r\n if (conventional = ViewResources.convention(exportedValue)) {\r\n if (conventional.elementName !== null && !mainResource) {\r\n mainResource = new ResourceDescription(key, exportedValue, conventional);\r\n }\r\n else {\r\n resources.push(new ResourceDescription(key, exportedValue, conventional));\r\n }\r\n metadata.define(metadata.resource, conventional, exportedValue);\r\n }\r\n else if (conventional = HtmlBehaviorResource.convention(key)) {\r\n if (conventional.elementName !== null && !mainResource) {\r\n mainResource = new ResourceDescription(key, exportedValue, conventional);\r\n }\r\n else {\r\n resources.push(new ResourceDescription(key, exportedValue, conventional));\r\n }\r\n metadata.define(metadata.resource, conventional, exportedValue);\r\n }\r\n else if (conventional = ValueConverterResource.convention(key)\r\n || BindingBehaviorResource.convention(key)\r\n || ViewEngineHooksResource.convention(key)) {\r\n resources.push(new ResourceDescription(key, exportedValue, conventional));\r\n metadata.define(metadata.resource, conventional, exportedValue);\r\n }\r\n else if (!fallbackValue) {\r\n fallbackValue = exportedValue;\r\n fallbackKey = key;\r\n }\r\n }\r\n }\r\n if (!mainResource && fallbackValue) {\r\n mainResource = new ResourceDescription(fallbackKey, fallbackValue);\r\n }\r\n resourceModule.moduleInstance = moduleInstance;\r\n resourceModule.mainResource = mainResource;\r\n resourceModule.resources = resources;\r\n resourceModule.viewStrategy = vs;\r\n return resourceModule;\r\n };\r\n return ModuleAnalyzer;\r\n}());\n\nvar logger = LogManager.getLogger('templating');\r\nfunction ensureRegistryEntry(loader, urlOrRegistryEntry) {\r\n if (urlOrRegistryEntry instanceof TemplateRegistryEntry) {\r\n return Promise.resolve(urlOrRegistryEntry);\r\n }\r\n return loader.loadTemplate(urlOrRegistryEntry);\r\n}\r\nvar ProxyViewFactory = (function () {\r\n function ProxyViewFactory(promise) {\r\n var _this = this;\r\n promise.then(function (x) { return _this.viewFactory = x; });\r\n }\r\n ProxyViewFactory.prototype.create = function (container, bindingContext, createInstruction, element) {\r\n return this.viewFactory.create(container, bindingContext, createInstruction, element);\r\n };\r\n Object.defineProperty(ProxyViewFactory.prototype, \"isCaching\", {\r\n get: function () {\r\n return this.viewFactory.isCaching;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ProxyViewFactory.prototype.setCacheSize = function (size, doNotOverrideIfAlreadySet) {\r\n this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet);\r\n };\r\n ProxyViewFactory.prototype.getCachedView = function () {\r\n return this.viewFactory.getCachedView();\r\n };\r\n ProxyViewFactory.prototype.returnViewToCache = function (view) {\r\n this.viewFactory.returnViewToCache(view);\r\n };\r\n return ProxyViewFactory;\r\n}());\r\nvar auSlotBehavior = null;\r\nvar ViewEngine = (function () {\r\n function ViewEngine(loader, container, viewCompiler, moduleAnalyzer, appResources) {\r\n this.loader = loader;\r\n this.container = container;\r\n this.viewCompiler = viewCompiler;\r\n this.moduleAnalyzer = moduleAnalyzer;\r\n this.appResources = appResources;\r\n this._pluginMap = {};\r\n if (auSlotBehavior === null) {\r\n auSlotBehavior = new HtmlBehaviorResource();\r\n auSlotBehavior.attributeName = 'au-slot';\r\n metadata.define(metadata.resource, auSlotBehavior, SlotCustomAttribute);\r\n }\r\n auSlotBehavior.initialize(container, SlotCustomAttribute);\r\n auSlotBehavior.register(appResources);\r\n }\r\n ViewEngine.inject = function () {\r\n return [Loader, Container, ViewCompiler, ModuleAnalyzer, ViewResources];\r\n };\r\n ViewEngine.prototype.addResourcePlugin = function (extension, implementation) {\r\n var name = extension.replace('.', '') + '-resource-plugin';\r\n this._pluginMap[extension] = name;\r\n this.loader.addPlugin(name, implementation);\r\n };\r\n ViewEngine.prototype.loadViewFactory = function (urlOrRegistryEntry, compileInstruction, loadContext, target) {\r\n var _this = this;\r\n loadContext = loadContext || new ResourceLoadContext();\r\n return ensureRegistryEntry(this.loader, urlOrRegistryEntry).then(function (registryEntry) {\r\n var url = registryEntry.address;\r\n if (registryEntry.onReady) {\r\n if (!loadContext.hasDependency(url)) {\r\n loadContext.addDependency(url);\r\n return registryEntry.onReady;\r\n }\r\n if (registryEntry.template === null) {\r\n return registryEntry.onReady;\r\n }\r\n return Promise.resolve(new ProxyViewFactory(registryEntry.onReady));\r\n }\r\n loadContext.addDependency(url);\r\n registryEntry.onReady = _this.loadTemplateResources(registryEntry, compileInstruction, loadContext, target).then(function (resources) {\r\n registryEntry.resources = resources;\r\n if (registryEntry.template === null) {\r\n return registryEntry.factory = null;\r\n }\r\n var viewFactory = _this.viewCompiler.compile(registryEntry.template, resources, compileInstruction);\r\n return registryEntry.factory = viewFactory;\r\n });\r\n return registryEntry.onReady;\r\n });\r\n };\r\n ViewEngine.prototype.loadTemplateResources = function (registryEntry, compileInstruction, loadContext, target) {\r\n var resources = new ViewResources(this.appResources, registryEntry.address);\r\n var dependencies = registryEntry.dependencies;\r\n var importIds;\r\n var names;\r\n compileInstruction = compileInstruction || ViewCompileInstruction.normal;\r\n if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {\r\n return Promise.resolve(resources);\r\n }\r\n importIds = dependencies.map(function (x) { return x.src; });\r\n names = dependencies.map(function (x) { return x.name; });\r\n logger.debug(\"importing resources for \".concat(registryEntry.address), importIds);\r\n if (target) {\r\n var viewModelRequires = metadata.get(ViewEngine.viewModelRequireMetadataKey, target);\r\n if (viewModelRequires) {\r\n var templateImportCount = importIds.length;\r\n for (var i = 0, ii = viewModelRequires.length; i < ii; ++i) {\r\n var req = viewModelRequires[i];\r\n var importId = typeof req === 'function'\r\n ? Origin.get(req).moduleId\r\n : relativeToFile(req.src || req, registryEntry.address);\r\n if (importIds.indexOf(importId) === -1) {\r\n importIds.push(importId);\r\n names.push(req.as);\r\n }\r\n }\r\n logger.debug(\"importing ViewModel resources for \".concat(compileInstruction.associatedModuleId), importIds.slice(templateImportCount));\r\n }\r\n }\r\n return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);\r\n };\r\n ViewEngine.prototype.importViewModelResource = function (moduleImport, moduleMember) {\r\n var _this = this;\r\n return this.loader.loadModule(moduleImport).then(function (viewModelModule) {\r\n var normalizedId = Origin.get(viewModelModule).moduleId;\r\n var resourceModule = _this.moduleAnalyzer.analyze(normalizedId, viewModelModule, moduleMember);\r\n if (!resourceModule.mainResource) {\r\n throw new Error(\"No view model found in module \\\"\".concat(moduleImport, \"\\\".\"));\r\n }\r\n resourceModule.initialize(_this.container);\r\n return resourceModule.mainResource;\r\n });\r\n };\r\n ViewEngine.prototype.importViewResources = function (moduleIds, names, resources, compileInstruction, loadContext) {\r\n var _this = this;\r\n loadContext = loadContext || new ResourceLoadContext();\r\n compileInstruction = compileInstruction || ViewCompileInstruction.normal;\r\n moduleIds = moduleIds.map(function (x) { return _this._applyLoaderPlugin(x); });\r\n return this.loader.loadAllModules(moduleIds).then(function (imports) {\r\n var i;\r\n var ii;\r\n var analysis;\r\n var normalizedId;\r\n var current;\r\n var associatedModule;\r\n var container = _this.container;\r\n var moduleAnalyzer = _this.moduleAnalyzer;\r\n var allAnalysis = new Array(imports.length);\r\n for (i = 0, ii = imports.length; i < ii; ++i) {\r\n current = imports[i];\r\n normalizedId = Origin.get(current).moduleId;\r\n analysis = moduleAnalyzer.analyze(normalizedId, current);\r\n analysis.initialize(container);\r\n analysis.register(resources, names[i]);\r\n allAnalysis[i] = analysis;\r\n }\r\n if (compileInstruction.associatedModuleId) {\r\n associatedModule = moduleAnalyzer.getAnalysis(compileInstruction.associatedModuleId);\r\n if (associatedModule) {\r\n associatedModule.register(resources);\r\n }\r\n }\r\n for (i = 0, ii = allAnalysis.length; i < ii; ++i) {\r\n allAnalysis[i] = allAnalysis[i].load(container, loadContext);\r\n }\r\n return Promise.all(allAnalysis).then(function () { return resources; });\r\n });\r\n };\r\n ViewEngine.prototype._applyLoaderPlugin = function (id) {\r\n var index = id.lastIndexOf('.');\r\n if (index !== -1) {\r\n var ext = id.substring(index);\r\n var pluginName = this._pluginMap[ext];\r\n if (pluginName === undefined) {\r\n return id;\r\n }\r\n return this.loader.applyPluginToUrl(id, pluginName);\r\n }\r\n return id;\r\n };\r\n ViewEngine.viewModelRequireMetadataKey = 'aurelia:view-model-require';\r\n return ViewEngine;\r\n}());\n\nvar Controller = (function () {\r\n function Controller(behavior, instruction, viewModel, container) {\r\n this.behavior = behavior;\r\n this.instruction = instruction;\r\n this.viewModel = viewModel;\r\n this.isAttached = false;\r\n this.view = null;\r\n this.isBound = false;\r\n this.scope = null;\r\n this.container = container;\r\n this.elementEvents = container.elementEvents || null;\r\n var observerLookup = behavior.observerLocator.getOrCreateObserversLookup(viewModel);\r\n var handlesBind = behavior.handlesBind;\r\n var attributes = instruction.attributes;\r\n var boundProperties = this.boundProperties = [];\r\n var properties = behavior.properties;\r\n var i;\r\n var ii;\r\n behavior._ensurePropertiesDefined(viewModel, observerLookup);\r\n for (i = 0, ii = properties.length; i < ii; ++i) {\r\n properties[i]._initialize(viewModel, observerLookup, attributes, handlesBind, boundProperties);\r\n }\r\n }\r\n Controller.prototype.created = function (owningView) {\r\n if (this.behavior.handlesCreated) {\r\n this.viewModel.created(owningView, this.view);\r\n }\r\n };\r\n Controller.prototype.automate = function (overrideContext, owningView) {\r\n this.view.bindingContext = this.viewModel;\r\n this.view.overrideContext = overrideContext || createOverrideContext(this.viewModel);\r\n this.view._isUserControlled = true;\r\n if (this.behavior.handlesCreated) {\r\n this.viewModel.created(owningView || null, this.view);\r\n }\r\n this.bind(this.view);\r\n };\r\n Controller.prototype.bind = function (scope) {\r\n var skipSelfSubscriber = this.behavior.handlesBind;\r\n var boundProperties = this.boundProperties;\r\n var i;\r\n var ii;\r\n var x;\r\n var observer;\r\n var selfSubscriber;\r\n if (this.isBound) {\r\n if (this.scope === scope) {\r\n return;\r\n }\r\n this.unbind();\r\n }\r\n this.isBound = true;\r\n this.scope = scope;\r\n for (i = 0, ii = boundProperties.length; i < ii; ++i) {\r\n x = boundProperties[i];\r\n observer = x.observer;\r\n selfSubscriber = observer.selfSubscriber;\r\n observer.publishing = false;\r\n if (skipSelfSubscriber) {\r\n observer.selfSubscriber = null;\r\n }\r\n x.binding.bind(scope);\r\n observer.call();\r\n observer.publishing = true;\r\n observer.selfSubscriber = selfSubscriber;\r\n }\r\n var overrideContext;\r\n if (this.view !== null) {\r\n if (skipSelfSubscriber) {\r\n this.view.viewModelScope = scope;\r\n }\r\n if (this.viewModel === scope.overrideContext.bindingContext) {\r\n overrideContext = scope.overrideContext;\r\n }\r\n else if (this.instruction.inheritBindingContext) {\r\n overrideContext = createOverrideContext(this.viewModel, scope.overrideContext);\r\n }\r\n else {\r\n overrideContext = createOverrideContext(this.viewModel);\r\n overrideContext.__parentOverrideContext = scope.overrideContext;\r\n }\r\n this.view.bind(this.viewModel, overrideContext);\r\n }\r\n else if (skipSelfSubscriber) {\r\n overrideContext = scope.overrideContext;\r\n if (scope.overrideContext.__parentOverrideContext !== undefined\r\n && this.viewModel.viewFactory && this.viewModel.viewFactory.factoryCreateInstruction.partReplacements) {\r\n overrideContext = Object.assign({}, scope.overrideContext);\r\n overrideContext.parentOverrideContext = scope.overrideContext.__parentOverrideContext;\r\n }\r\n this.viewModel.bind(scope.bindingContext, overrideContext);\r\n }\r\n };\r\n Controller.prototype.unbind = function () {\r\n if (this.isBound) {\r\n var boundProperties = this.boundProperties;\r\n var i = void 0;\r\n var ii = void 0;\r\n this.isBound = false;\r\n this.scope = null;\r\n if (this.view !== null) {\r\n this.view.unbind();\r\n }\r\n if (this.behavior.handlesUnbind) {\r\n this.viewModel.unbind();\r\n }\r\n if (this.elementEvents !== null) {\r\n this.elementEvents.disposeAll();\r\n }\r\n for (i = 0, ii = boundProperties.length; i < ii; ++i) {\r\n boundProperties[i].binding.unbind();\r\n }\r\n }\r\n };\r\n Controller.prototype.attached = function () {\r\n if (this.isAttached) {\r\n return;\r\n }\r\n this.isAttached = true;\r\n if (this.behavior.handlesAttached) {\r\n this.viewModel.attached();\r\n }\r\n if (this.view !== null) {\r\n this.view.attached();\r\n }\r\n };\r\n Controller.prototype.detached = function () {\r\n if (this.isAttached) {\r\n this.isAttached = false;\r\n if (this.view !== null) {\r\n this.view.detached();\r\n }\r\n if (this.behavior.handlesDetached) {\r\n this.viewModel.detached();\r\n }\r\n }\r\n };\r\n return Controller;\r\n}());\n\nvar lastProviderId = 0;\r\nfunction nextProviderId() {\r\n return ++lastProviderId;\r\n}\r\nfunction doProcessContent() { return true; }\r\nfunction doProcessAttributes() { }\r\nvar HtmlBehaviorResource = (function () {\r\n function HtmlBehaviorResource() {\r\n this.elementName = null;\r\n this.attributeName = null;\r\n this.attributeDefaultBindingMode = undefined;\r\n this.liftsContent = false;\r\n this.targetShadowDOM = false;\r\n this.shadowDOMOptions = null;\r\n this.processAttributes = doProcessAttributes;\r\n this.processContent = doProcessContent;\r\n this.usesShadowDOM = false;\r\n this.childBindings = null;\r\n this.hasDynamicOptions = false;\r\n this.containerless = false;\r\n this.properties = [];\r\n this.attributes = {};\r\n this.isInitialized = false;\r\n this.primaryProperty = null;\r\n }\r\n HtmlBehaviorResource.convention = function (name, existing) {\r\n var behavior;\r\n if (name.endsWith('CustomAttribute')) {\r\n behavior = existing || new HtmlBehaviorResource();\r\n behavior.attributeName = _hyphenate(name.substring(0, name.length - 15));\r\n }\r\n if (name.endsWith('CustomElement')) {\r\n behavior = existing || new HtmlBehaviorResource();\r\n behavior.elementName = _hyphenate(name.substring(0, name.length - 13));\r\n }\r\n return behavior;\r\n };\r\n HtmlBehaviorResource.prototype.addChildBinding = function (behavior) {\r\n if (this.childBindings === null) {\r\n this.childBindings = [];\r\n }\r\n this.childBindings.push(behavior);\r\n };\r\n HtmlBehaviorResource.prototype.initialize = function (container, target) {\r\n var proto = target.prototype;\r\n var properties = this.properties;\r\n var attributeName = this.attributeName;\r\n var attributeDefaultBindingMode = this.attributeDefaultBindingMode;\r\n var i;\r\n var ii;\r\n var current;\r\n if (this.isInitialized) {\r\n return;\r\n }\r\n this.isInitialized = true;\r\n target.__providerId__ = nextProviderId();\r\n this.observerLocator = container.get(ObserverLocator);\r\n this.taskQueue = container.get(TaskQueue);\r\n this.target = target;\r\n this.usesShadowDOM = this.targetShadowDOM && FEATURE.shadowDOM;\r\n this.handlesCreated = ('created' in proto);\r\n this.handlesBind = ('bind' in proto);\r\n this.handlesUnbind = ('unbind' in proto);\r\n this.handlesAttached = ('attached' in proto);\r\n this.handlesDetached = ('detached' in proto);\r\n this.htmlName = this.elementName || this.attributeName;\r\n if (attributeName !== null) {\r\n if (properties.length === 0) {\r\n new BindableProperty({\r\n name: 'value',\r\n changeHandler: 'valueChanged' in proto ? 'valueChanged' : null,\r\n attribute: attributeName,\r\n defaultBindingMode: attributeDefaultBindingMode\r\n }).registerWith(target, this);\r\n }\r\n current = properties[0];\r\n if (properties.length === 1 && current.name === 'value') {\r\n current.isDynamic = current.hasOptions = this.hasDynamicOptions;\r\n current.defineOn(target, this);\r\n }\r\n else {\r\n for (i = 0, ii = properties.length; i < ii; ++i) {\r\n properties[i].defineOn(target, this);\r\n if (properties[i].primaryProperty) {\r\n if (this.primaryProperty) {\r\n throw new Error('Only one bindable property on a custom element can be defined as the default');\r\n }\r\n this.primaryProperty = properties[i];\r\n }\r\n }\r\n current = new BindableProperty({\r\n name: 'value',\r\n changeHandler: 'valueChanged' in proto ? 'valueChanged' : null,\r\n attribute: attributeName,\r\n defaultBindingMode: attributeDefaultBindingMode\r\n });\r\n current.hasOptions = true;\r\n current.registerWith(target, this);\r\n }\r\n }\r\n else {\r\n for (i = 0, ii = properties.length; i < ii; ++i) {\r\n properties[i].defineOn(target, this);\r\n }\r\n this._copyInheritedProperties(container, target);\r\n }\r\n };\r\n HtmlBehaviorResource.prototype.register = function (registry, name) {\r\n var _this = this;\r\n if (this.attributeName !== null) {\r\n registry.registerAttribute(name || this.attributeName, this, this.attributeName);\r\n if (Array.isArray(this.aliases)) {\r\n this.aliases\r\n .forEach(function (alias) {\r\n registry.registerAttribute(alias, _this, _this.attributeName);\r\n });\r\n }\r\n }\r\n if (this.elementName !== null) {\r\n registry.registerElement(name || this.elementName, this);\r\n }\r\n };\r\n HtmlBehaviorResource.prototype.aliases = function (aliases) {\r\n throw new Error('Method not implemented.');\r\n };\r\n HtmlBehaviorResource.prototype.load = function (container, target, loadContext, viewStrategy, transientView) {\r\n var _this = this;\r\n var options;\r\n if (this.elementName !== null) {\r\n viewStrategy = container.get(ViewLocator).getViewStrategy(viewStrategy || this.viewStrategy || target);\r\n options = new ViewCompileInstruction(this.targetShadowDOM, true);\r\n if (!viewStrategy.moduleId) {\r\n viewStrategy.moduleId = Origin.get(target).moduleId;\r\n }\r\n return viewStrategy\r\n .loadViewFactory(container.get(ViewEngine), options, loadContext, target)\r\n .then(function (viewFactory) {\r\n if (!transientView || !_this.viewFactory) {\r\n _this.viewFactory = viewFactory;\r\n }\r\n return viewFactory;\r\n });\r\n }\r\n return Promise.resolve(this);\r\n };\r\n HtmlBehaviorResource.prototype.compile = function (compiler, resources, node, instruction, parentNode) {\r\n if (this.liftsContent) {\r\n if (!instruction.viewFactory) {\r\n var template = DOM.createElement('template');\r\n var fragment = DOM.createDocumentFragment();\r\n var cacheSize = node.getAttribute('view-cache');\r\n var part = node.getAttribute('part');\r\n node.removeAttribute(instruction.originalAttrName);\r\n DOM.replaceNode(template, node, parentNode);\r\n fragment.appendChild(node);\r\n instruction.viewFactory = compiler.compile(fragment, resources);\r\n if (part) {\r\n instruction.viewFactory.part = part;\r\n node.removeAttribute('part');\r\n }\r\n if (cacheSize) {\r\n instruction.viewFactory.setCacheSize(cacheSize);\r\n node.removeAttribute('view-cache');\r\n }\r\n node = template;\r\n }\r\n }\r\n else if (this.elementName !== null) {\r\n var partReplacements = {};\r\n if (this.processContent(compiler, resources, node, instruction) && node.hasChildNodes()) {\r\n var currentChild = node.firstChild;\r\n var contentElement = this.usesShadowDOM ? null : DOM.createElement('au-content');\r\n var nextSibling = void 0;\r\n var toReplace = void 0;\r\n while (currentChild) {\r\n nextSibling = currentChild.nextSibling;\r\n if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) {\r\n partReplacements[toReplace] = compiler.compile(currentChild, resources);\r\n DOM.removeNode(currentChild, parentNode);\r\n instruction.partReplacements = partReplacements;\r\n }\r\n else if (contentElement !== null) {\r\n if (currentChild.nodeType === 3 && _isAllWhitespace(currentChild)) {\r\n DOM.removeNode(currentChild, parentNode);\r\n }\r\n else {\r\n contentElement.appendChild(currentChild);\r\n }\r\n }\r\n currentChild = nextSibling;\r\n }\r\n if (contentElement !== null && contentElement.hasChildNodes()) {\r\n node.appendChild(contentElement);\r\n }\r\n instruction.skipContentProcessing = false;\r\n }\r\n else {\r\n instruction.skipContentProcessing = true;\r\n }\r\n }\r\n else if (!this.processContent(compiler, resources, node, instruction)) {\r\n instruction.skipContentProcessing = true;\r\n }\r\n return node;\r\n };\r\n HtmlBehaviorResource.prototype.create = function (container, instruction, element, bindings) {\r\n var viewHost;\r\n var au = null;\r\n instruction = instruction || BehaviorInstruction.normal;\r\n element = element || null;\r\n bindings = bindings || null;\r\n if (this.elementName !== null && element) {\r\n if (this.usesShadowDOM) {\r\n viewHost = element.attachShadow(this.shadowDOMOptions);\r\n container.registerInstance(DOM.boundary, viewHost);\r\n }\r\n else {\r\n viewHost = element;\r\n if (this.targetShadowDOM) {\r\n container.registerInstance(DOM.boundary, viewHost);\r\n }\r\n }\r\n }\r\n if (element !== null) {\r\n element.au = au = element.au || {};\r\n }\r\n var viewModel = instruction.viewModel || container.get(this.target);\r\n var controller = new Controller(this, instruction, viewModel, container);\r\n var childBindings = this.childBindings;\r\n var viewFactory;\r\n if (this.liftsContent) {\r\n au.controller = controller;\r\n }\r\n else if (this.elementName !== null) {\r\n viewFactory = instruction.viewFactory || this.viewFactory;\r\n container.viewModel = viewModel;\r\n if (viewFactory) {\r\n controller.view = viewFactory.create(container, instruction, element);\r\n }\r\n if (element !== null) {\r\n au.controller = controller;\r\n if (controller.view) {\r\n if (!this.usesShadowDOM && (element.childNodes.length === 1 || element.contentElement)) {\r\n var contentElement = element.childNodes[0] || element.contentElement;\r\n controller.view.contentView = { fragment: contentElement };\r\n contentElement.parentNode && DOM.removeNode(contentElement);\r\n }\r\n if (instruction.anchorIsContainer) {\r\n if (childBindings !== null) {\r\n for (var i = 0, ii = childBindings.length; i < ii; ++i) {\r\n controller.view.addBinding(childBindings[i].create(element, viewModel, controller));\r\n }\r\n }\r\n controller.view.appendNodesTo(viewHost);\r\n }\r\n else {\r\n controller.view.insertNodesBefore(viewHost);\r\n }\r\n }\r\n else if (childBindings !== null) {\r\n for (var i = 0, ii = childBindings.length; i < ii; ++i) {\r\n bindings.push(childBindings[i].create(element, viewModel, controller));\r\n }\r\n }\r\n }\r\n else if (controller.view) {\r\n controller.view.controller = controller;\r\n if (childBindings !== null) {\r\n for (var i = 0, ii = childBindings.length; i < ii; ++i) {\r\n controller.view.addBinding(childBindings[i].create(instruction.host, viewModel, controller));\r\n }\r\n }\r\n }\r\n else if (childBindings !== null) {\r\n for (var i = 0, ii = childBindings.length; i < ii; ++i) {\r\n bindings.push(childBindings[i].create(instruction.host, viewModel, controller));\r\n }\r\n }\r\n }\r\n else if (childBindings !== null) {\r\n for (var i = 0, ii = childBindings.length; i < ii; ++i) {\r\n bindings.push(childBindings[i].create(element, viewModel, controller));\r\n }\r\n }\r\n if (au !== null) {\r\n au[this.htmlName] = controller;\r\n }\r\n if (instruction.initiatedByBehavior && viewFactory) {\r\n controller.view.created();\r\n }\r\n return controller;\r\n };\r\n HtmlBehaviorResource.prototype._ensurePropertiesDefined = function (instance, lookup) {\r\n var properties;\r\n var i;\r\n var ii;\r\n var observer;\r\n if ('__propertiesDefined__' in lookup) {\r\n return;\r\n }\r\n lookup.__propertiesDefined__ = true;\r\n properties = this.properties;\r\n for (i = 0, ii = properties.length; i < ii; ++i) {\r\n observer = properties[i].createObserver(instance);\r\n if (observer !== undefined) {\r\n lookup[observer.propertyName] = observer;\r\n }\r\n }\r\n };\r\n HtmlBehaviorResource.prototype._copyInheritedProperties = function (container, target) {\r\n var behavior;\r\n var derived = target;\r\n while (true) {\r\n var proto = Object.getPrototypeOf(target.prototype);\r\n target = proto && proto.constructor;\r\n if (!target) {\r\n return;\r\n }\r\n behavior = metadata.getOwn(metadata.resource, target);\r\n if (behavior) {\r\n break;\r\n }\r\n }\r\n behavior.initialize(container, target);\r\n var _loop_1 = function (i, ii) {\r\n var prop = behavior.properties[i];\r\n if (this_1.properties.some(function (p) { return p.name === prop.name; })) {\r\n return \"continue\";\r\n }\r\n new BindableProperty(prop).registerWith(derived, this_1);\r\n };\r\n var this_1 = this;\r\n for (var i = 0, ii = behavior.properties.length; i < ii; ++i) {\r\n _loop_1(i);\r\n }\r\n };\r\n return HtmlBehaviorResource;\r\n}());\n\nfunction register(lookup, name, resource, type) {\r\n if (!name) {\r\n return;\r\n }\r\n var existing = lookup[name];\r\n if (existing) {\r\n if (existing !== resource) {\r\n throw new Error(\"Attempted to register \".concat(type, \" when one with the same name already exists. Name: \").concat(name, \".\"));\r\n }\r\n return;\r\n }\r\n lookup[name] = resource;\r\n}\r\nfunction validateBehaviorName(name, type) {\r\n if (/[A-Z]/.test(name)) {\r\n var newName = _hyphenate(name);\r\n LogManager\r\n .getLogger('templating')\r\n .warn(\"'\".concat(name, \"' is not a valid \").concat(type, \" name and has been converted to '\").concat(newName, \"'. Upper-case letters are not allowed because the DOM is not case-sensitive.\"));\r\n return newName;\r\n }\r\n return name;\r\n}\r\nvar conventionMark = '__au_resource__';\r\nvar ViewResources = (function () {\r\n function ViewResources(parent, viewUrl) {\r\n this.bindingLanguage = null;\r\n this.parent = parent || null;\r\n this.hasParent = this.parent !== null;\r\n this.viewUrl = viewUrl || '';\r\n this.lookupFunctions = {\r\n valueConverters: this.getValueConverter.bind(this),\r\n bindingBehaviors: this.getBindingBehavior.bind(this)\r\n };\r\n this.attributes = Object.create(null);\r\n this.elements = Object.create(null);\r\n this.valueConverters = Object.create(null);\r\n this.bindingBehaviors = Object.create(null);\r\n this.attributeMap = Object.create(null);\r\n this.values = Object.create(null);\r\n this.beforeCompile = this.afterCompile = this.beforeCreate = this.afterCreate = this.beforeBind = this.beforeUnbind = false;\r\n }\r\n ViewResources.convention = function (target, existing) {\r\n var resource;\r\n if (existing && conventionMark in existing) {\r\n return existing;\r\n }\r\n if ('$resource' in target) {\r\n var config = target.$resource;\r\n if (typeof config === 'string') {\r\n resource = existing || new HtmlBehaviorResource();\r\n resource[conventionMark] = true;\r\n if (!resource.elementName) {\r\n resource.elementName = validateBehaviorName(config, 'custom element');\r\n }\r\n }\r\n else {\r\n if (typeof config === 'function') {\r\n config = config.call(target);\r\n }\r\n if (typeof config === 'string') {\r\n config = { name: config };\r\n }\r\n config = Object.assign({}, config);\r\n var resourceType = config.type || 'element';\r\n var name_1 = config.name;\r\n switch (resourceType) {\r\n case 'element':\r\n case 'attribute':\r\n resource = existing || new HtmlBehaviorResource();\r\n resource[conventionMark] = true;\r\n if (resourceType === 'element') {\r\n if (!resource.elementName) {\r\n resource.elementName = name_1\r\n ? validateBehaviorName(name_1, 'custom element')\r\n : _hyphenate(target.name);\r\n }\r\n }\r\n else {\r\n if (!resource.attributeName) {\r\n resource.attributeName = name_1\r\n ? validateBehaviorName(name_1, 'custom attribute')\r\n : _hyphenate(target.name);\r\n }\r\n }\r\n if ('templateController' in config) {\r\n config.liftsContent = config.templateController;\r\n delete config.templateController;\r\n }\r\n if ('defaultBindingMode' in config && resource.attributeDefaultBindingMode !== undefined) {\r\n config.attributeDefaultBindingMode = config.defaultBindingMode;\r\n delete config.defaultBindingMode;\r\n }\r\n delete config.name;\r\n Object.assign(resource, config);\r\n break;\r\n case 'valueConverter':\r\n resource = new ValueConverterResource(camelCase(name_1 || target.name));\r\n break;\r\n case 'bindingBehavior':\r\n resource = new BindingBehaviorResource(camelCase(name_1 || target.name));\r\n break;\r\n case 'viewEngineHooks':\r\n resource = new ViewEngineHooksResource();\r\n break;\r\n }\r\n }\r\n if (resource instanceof HtmlBehaviorResource) {\r\n var bindables = typeof config === 'string' ? undefined : config.bindables;\r\n var currentProps = resource.properties;\r\n if (Array.isArray(bindables)) {\r\n for (var i = 0, ii = bindables.length; ii > i; ++i) {\r\n var prop = bindables[i];\r\n if (!prop || (typeof prop !== 'string' && !prop.name)) {\r\n throw new Error(\"Invalid bindable property at \\\"\".concat(i, \"\\\" for class \\\"\").concat(target.name, \"\\\". Expected either a string or an object with \\\"name\\\" property.\"));\r\n }\r\n var newProp = new BindableProperty(prop);\r\n var existed = false;\r\n for (var j = 0, jj = currentProps.length; jj > j; ++j) {\r\n if (currentProps[j].name === newProp.name) {\r\n existed = true;\r\n break;\r\n }\r\n }\r\n if (existed) {\r\n continue;\r\n }\r\n newProp.registerWith(target, resource);\r\n }\r\n }\r\n }\r\n }\r\n return resource;\r\n };\r\n ViewResources.prototype._tryAddHook = function (obj, name) {\r\n if (typeof obj[name] === 'function') {\r\n var func = obj[name].bind(obj);\r\n var counter = 1;\r\n var callbackName = void 0;\r\n while (this[callbackName = name + counter.toString()] !== undefined) {\r\n counter++;\r\n }\r\n this[name] = true;\r\n this[callbackName] = func;\r\n }\r\n };\r\n ViewResources.prototype._invokeHook = function (name, one, two, three, four) {\r\n if (this.hasParent) {\r\n this.parent._invokeHook(name, one, two, three, four);\r\n }\r\n if (this[name]) {\r\n this[name + '1'](one, two, three, four);\r\n var callbackName = name + '2';\r\n if (this[callbackName]) {\r\n this[callbackName](one, two, three, four);\r\n callbackName = name + '3';\r\n if (this[callbackName]) {\r\n this[callbackName](one, two, three, four);\r\n var counter = 4;\r\n while (this[callbackName = name + counter.toString()] !== undefined) {\r\n this[callbackName](one, two, three, four);\r\n counter++;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n ViewResources.prototype.registerViewEngineHooks = function (hooks) {\r\n this._tryAddHook(hooks, 'beforeCompile');\r\n this._tryAddHook(hooks, 'afterCompile');\r\n this._tryAddHook(hooks, 'beforeCreate');\r\n this._tryAddHook(hooks, 'afterCreate');\r\n this._tryAddHook(hooks, 'beforeBind');\r\n this._tryAddHook(hooks, 'beforeUnbind');\r\n };\r\n ViewResources.prototype.getBindingLanguage = function (bindingLanguageFallback) {\r\n return this.bindingLanguage || (this.bindingLanguage = bindingLanguageFallback);\r\n };\r\n ViewResources.prototype.patchInParent = function (newParent) {\r\n var originalParent = this.parent;\r\n this.parent = newParent || null;\r\n this.hasParent = this.parent !== null;\r\n if (newParent.parent === null) {\r\n newParent.parent = originalParent;\r\n newParent.hasParent = originalParent !== null;\r\n }\r\n };\r\n ViewResources.prototype.relativeToView = function (path) {\r\n return relativeToFile(path, this.viewUrl);\r\n };\r\n ViewResources.prototype.registerElement = function (tagName, behavior) {\r\n register(this.elements, tagName, behavior, 'an Element');\r\n };\r\n ViewResources.prototype.getElement = function (tagName) {\r\n return this.elements[tagName] || (this.hasParent ? this.parent.getElement(tagName) : null);\r\n };\r\n ViewResources.prototype.mapAttribute = function (attribute) {\r\n return this.attributeMap[attribute] || (this.hasParent ? this.parent.mapAttribute(attribute) : null);\r\n };\r\n ViewResources.prototype.registerAttribute = function (attribute, behavior, knownAttribute) {\r\n this.attributeMap[attribute] = knownAttribute;\r\n register(this.attributes, attribute, behavior, 'an Attribute');\r\n };\r\n ViewResources.prototype.getAttribute = function (attribute) {\r\n return this.attributes[attribute] || (this.hasParent ? this.parent.getAttribute(attribute) : null);\r\n };\r\n ViewResources.prototype.registerValueConverter = function (name, valueConverter) {\r\n register(this.valueConverters, name, valueConverter, 'a ValueConverter');\r\n };\r\n ViewResources.prototype.getValueConverter = function (name) {\r\n return this.valueConverters[name] || (this.hasParent ? this.parent.getValueConverter(name) : null);\r\n };\r\n ViewResources.prototype.registerBindingBehavior = function (name, bindingBehavior) {\r\n register(this.bindingBehaviors, name, bindingBehavior, 'a BindingBehavior');\r\n };\r\n ViewResources.prototype.getBindingBehavior = function (name) {\r\n return this.bindingBehaviors[name] || (this.hasParent ? this.parent.getBindingBehavior(name) : null);\r\n };\r\n ViewResources.prototype.registerValue = function (name, value) {\r\n register(this.values, name, value, 'a value');\r\n };\r\n ViewResources.prototype.getValue = function (name) {\r\n return this.values[name] || (this.hasParent ? this.parent.getValue(name) : null);\r\n };\r\n ViewResources.prototype.autoRegister = function (container, impl) {\r\n var resourceTypeMeta = metadata.getOwn(metadata.resource, impl);\r\n if (resourceTypeMeta) {\r\n if (resourceTypeMeta instanceof HtmlBehaviorResource) {\r\n ViewResources.convention(impl, resourceTypeMeta);\r\n if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\r\n HtmlBehaviorResource.convention(impl.name, resourceTypeMeta);\r\n }\r\n if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\r\n resourceTypeMeta.elementName = _hyphenate(impl.name);\r\n }\r\n }\r\n }\r\n else {\r\n resourceTypeMeta = ViewResources.convention(impl)\r\n || HtmlBehaviorResource.convention(impl.name)\r\n || ValueConverterResource.convention(impl.name)\r\n || BindingBehaviorResource.convention(impl.name)\r\n || ViewEngineHooksResource.convention(impl.name);\r\n if (!resourceTypeMeta) {\r\n resourceTypeMeta = new HtmlBehaviorResource();\r\n resourceTypeMeta.elementName = _hyphenate(impl.name);\r\n }\r\n metadata.define(metadata.resource, resourceTypeMeta, impl);\r\n }\r\n resourceTypeMeta.initialize(container, impl);\r\n resourceTypeMeta.register(this, undefined);\r\n return resourceTypeMeta;\r\n };\r\n return ViewResources;\r\n}());\n\nvar viewStrategy = protocol.create('aurelia:view-strategy', {\r\n validate: function (target) {\r\n if (!(typeof target.loadViewFactory === 'function')) {\r\n return 'View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise';\r\n }\r\n return true;\r\n },\r\n compose: function (target) {\r\n if (!(typeof target.makeRelativeTo === 'function')) {\r\n target.makeRelativeTo = PLATFORM.noop;\r\n }\r\n }\r\n});\r\nvar RelativeViewStrategy = (function () {\r\n function RelativeViewStrategy(path) {\r\n this.path = path;\r\n this.absolutePath = null;\r\n }\r\n RelativeViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) {\r\n if (this.absolutePath === null && this.moduleId) {\r\n this.absolutePath = relativeToFile(this.path, this.moduleId);\r\n }\r\n compileInstruction.associatedModuleId = this.moduleId;\r\n return viewEngine.loadViewFactory(this.absolutePath || this.path, compileInstruction, loadContext, target);\r\n };\r\n RelativeViewStrategy.prototype.makeRelativeTo = function (file) {\r\n if (this.absolutePath === null) {\r\n this.absolutePath = relativeToFile(this.path, file);\r\n }\r\n };\r\n RelativeViewStrategy = __decorate([\r\n viewStrategy()\r\n ], RelativeViewStrategy);\r\n return RelativeViewStrategy;\r\n}());\r\nvar ConventionalViewStrategy = (function () {\r\n function ConventionalViewStrategy(viewLocator, origin) {\r\n this.moduleId = origin.moduleId;\r\n this.viewUrl = viewLocator.convertOriginToViewUrl(origin);\r\n }\r\n ConventionalViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) {\r\n compileInstruction.associatedModuleId = this.moduleId;\r\n return viewEngine.loadViewFactory(this.viewUrl, compileInstruction, loadContext, target);\r\n };\r\n ConventionalViewStrategy = __decorate([\r\n viewStrategy()\r\n ], ConventionalViewStrategy);\r\n return ConventionalViewStrategy;\r\n}());\r\nvar NoViewStrategy = (function () {\r\n function NoViewStrategy(dependencies, dependencyBaseUrl) {\r\n this.dependencies = dependencies || null;\r\n this.dependencyBaseUrl = dependencyBaseUrl || '';\r\n }\r\n NoViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) {\r\n var entry = this.entry;\r\n var dependencies = this.dependencies;\r\n if (entry && entry.factoryIsReady) {\r\n return Promise.resolve(null);\r\n }\r\n this.entry = entry = new TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl);\r\n entry.dependencies = [];\r\n entry.templateIsLoaded = true;\r\n if (dependencies !== null) {\r\n for (var i = 0, ii = dependencies.length; i < ii; ++i) {\r\n var current = dependencies[i];\r\n if (typeof current === 'string' || typeof current === 'function') {\r\n entry.addDependency(current);\r\n }\r\n else {\r\n entry.addDependency(current.from, current.as);\r\n }\r\n }\r\n }\r\n compileInstruction.associatedModuleId = this.moduleId;\r\n return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);\r\n };\r\n NoViewStrategy = __decorate([\r\n viewStrategy()\r\n ], NoViewStrategy);\r\n return NoViewStrategy;\r\n}());\r\nvar TemplateRegistryViewStrategy = (function () {\r\n function TemplateRegistryViewStrategy(moduleId, entry) {\r\n this.moduleId = moduleId;\r\n this.entry = entry;\r\n }\r\n TemplateRegistryViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) {\r\n var entry = this.entry;\r\n if (entry.factoryIsReady) {\r\n return Promise.resolve(entry.factory);\r\n }\r\n compileInstruction.associatedModuleId = this.moduleId;\r\n return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);\r\n };\r\n TemplateRegistryViewStrategy = __decorate([\r\n viewStrategy()\r\n ], TemplateRegistryViewStrategy);\r\n return TemplateRegistryViewStrategy;\r\n}());\r\nvar InlineViewStrategy = (function () {\r\n function InlineViewStrategy(markup, dependencies, dependencyBaseUrl) {\r\n this.markup = markup;\r\n this.dependencies = dependencies || null;\r\n this.dependencyBaseUrl = dependencyBaseUrl || '';\r\n }\r\n InlineViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) {\r\n var entry = this.entry;\r\n var dependencies = this.dependencies;\r\n if (entry && entry.factoryIsReady) {\r\n return Promise.resolve(entry.factory);\r\n }\r\n this.entry = entry = new TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl);\r\n entry.template = DOM.createTemplateFromMarkup(this.markup);\r\n if (dependencies !== null) {\r\n for (var i = 0, ii = dependencies.length; i < ii; ++i) {\r\n var current = dependencies[i];\r\n if (typeof current === 'string' || typeof current === 'function') {\r\n entry.addDependency(current);\r\n }\r\n else {\r\n entry.addDependency(current.from, current.as);\r\n }\r\n }\r\n }\r\n compileInstruction.associatedModuleId = this.moduleId;\r\n return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);\r\n };\r\n InlineViewStrategy = __decorate([\r\n viewStrategy()\r\n ], InlineViewStrategy);\r\n return InlineViewStrategy;\r\n}());\r\nvar StaticViewStrategy = (function () {\r\n function StaticViewStrategy(config) {\r\n if (typeof config === 'string' || (config instanceof DOM.Element && config.tagName === 'TEMPLATE')) {\r\n config = {\r\n template: config\r\n };\r\n }\r\n this.template = config.template;\r\n this.dependencies = config.dependencies || [];\r\n this.factoryIsReady = false;\r\n this.onReady = null;\r\n this.moduleId = 'undefined';\r\n }\r\n StaticViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) {\r\n var _this = this;\r\n if (this.factoryIsReady) {\r\n return Promise.resolve(this.factory);\r\n }\r\n var $deps = this.dependencies;\r\n var deps = typeof $deps === 'function' ? $deps() : $deps;\r\n deps = deps ? deps : [];\r\n deps = Array.isArray(deps) ? deps : [deps];\r\n return Promise.all(deps).then(function (dependencies) {\r\n var container = viewEngine.container;\r\n var appResources = viewEngine.appResources;\r\n var viewCompiler = viewEngine.viewCompiler;\r\n var viewResources = new ViewResources(appResources);\r\n var resource;\r\n var elDeps = [];\r\n if (target) {\r\n viewResources.autoRegister(container, target);\r\n }\r\n for (var _i = 0, dependencies_1 = dependencies; _i < dependencies_1.length; _i++) {\r\n var dep = dependencies_1[_i];\r\n if (typeof dep === 'function') {\r\n resource = viewResources.autoRegister(container, dep);\r\n if (resource.elementName !== null) {\r\n elDeps.push(resource);\r\n }\r\n }\r\n else if (dep && typeof dep === 'object') {\r\n for (var key in dep) {\r\n var exported = dep[key];\r\n if (typeof exported === 'function') {\r\n resource = viewResources.autoRegister(container, exported);\r\n if (resource.elementName !== null) {\r\n elDeps.push(resource);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n throw new Error(\"dependency neither function nor object. Received: \\\"\".concat(typeof dep, \"\\\"\"));\r\n }\r\n }\r\n return Promise.all(elDeps.map(function (el) { return el.load(container, el.target); })).then(function () {\r\n var factory = _this.template !== null\r\n ? viewCompiler.compile(_this.template, viewResources, compileInstruction)\r\n : null;\r\n _this.factoryIsReady = true;\r\n _this.factory = factory;\r\n return factory;\r\n });\r\n });\r\n };\r\n StaticViewStrategy = __decorate([\r\n viewStrategy()\r\n ], StaticViewStrategy);\r\n return StaticViewStrategy;\r\n}());\n\nfunction remove(viewSlot, previous) {\r\n return Array.isArray(previous)\r\n ? viewSlot.removeMany(previous, true)\r\n : viewSlot.remove(previous, true);\r\n}\r\nvar SwapStrategies = {\r\n before: function (viewSlot, previous, callback) {\r\n return (previous === undefined)\r\n ? callback()\r\n : callback().then(function () { return remove(viewSlot, previous); });\r\n },\r\n with: function (viewSlot, previous, callback) {\r\n return (previous === undefined)\r\n ? callback()\r\n : Promise.all([remove(viewSlot, previous), callback()]);\r\n },\r\n after: function (viewSlot, previous, callback) {\r\n return Promise.resolve(viewSlot.removeAll(true)).then(callback);\r\n }\r\n};\n\nfunction tryActivateViewModel(context) {\r\n if (context.skipActivation || typeof context.viewModel.activate !== 'function') {\r\n return Promise.resolve();\r\n }\r\n return context.viewModel.activate(context.model) || Promise.resolve();\r\n}\r\nvar CompositionEngine = (function () {\r\n function CompositionEngine(viewEngine, viewLocator) {\r\n this.viewEngine = viewEngine;\r\n this.viewLocator = viewLocator;\r\n }\r\n CompositionEngine.prototype._swap = function (context, view) {\r\n var swapStrategy = SwapStrategies[context.swapOrder] || SwapStrategies.after;\r\n var previousViews = context.viewSlot.children.slice();\r\n return swapStrategy(context.viewSlot, previousViews, function () {\r\n return Promise.resolve(context.viewSlot.add(view)).then(function () {\r\n if (context.currentController) {\r\n context.currentController.unbind();\r\n }\r\n });\r\n }).then(function () {\r\n if (context.compositionTransactionNotifier) {\r\n context.compositionTransactionNotifier.done();\r\n }\r\n });\r\n };\r\n CompositionEngine.prototype._createControllerAndSwap = function (context) {\r\n var _this = this;\r\n return this.createController(context).then(function (controller) {\r\n if (context.compositionTransactionOwnershipToken) {\r\n return context.compositionTransactionOwnershipToken\r\n .waitForCompositionComplete()\r\n .then(function () {\r\n controller.automate(context.overrideContext, context.owningView);\r\n return _this._swap(context, controller.view);\r\n })\r\n .then(function () { return controller; });\r\n }\r\n controller.automate(context.overrideContext, context.owningView);\r\n return _this._swap(context, controller.view).then(function () { return controller; });\r\n });\r\n };\r\n CompositionEngine.prototype.createController = function (context) {\r\n var _this = this;\r\n var childContainer;\r\n var viewModel;\r\n var viewModelResource;\r\n var m;\r\n return this\r\n .ensureViewModel(context)\r\n .then(tryActivateViewModel)\r\n .then(function () {\r\n childContainer = context.childContainer;\r\n viewModel = context.viewModel;\r\n viewModelResource = context.viewModelResource;\r\n m = viewModelResource.metadata;\r\n var viewStrategy = _this.viewLocator.getViewStrategy(context.view || viewModel);\r\n if (context.viewResources) {\r\n viewStrategy.makeRelativeTo(context.viewResources.viewUrl);\r\n }\r\n return m.load(childContainer, viewModelResource.value, null, viewStrategy, true);\r\n }).then(function (viewFactory) { return m.create(childContainer, BehaviorInstruction.dynamic(context.host, viewModel, viewFactory)); });\r\n };\r\n CompositionEngine.prototype.ensureViewModel = function (context) {\r\n var childContainer = context.childContainer = (context.childContainer || context.container.createChild());\r\n if (typeof context.viewModel === 'string') {\r\n context.viewModel = context.viewResources\r\n ? context.viewResources.relativeToView(context.viewModel)\r\n : context.viewModel;\r\n return this.viewEngine.importViewModelResource(context.viewModel).then(function (viewModelResource) {\r\n childContainer.autoRegister(viewModelResource.value);\r\n if (context.host) {\r\n childContainer.registerInstance(DOM.Element, context.host);\r\n }\r\n context.viewModel = childContainer.viewModel = childContainer.get(viewModelResource.value);\r\n context.viewModelResource = viewModelResource;\r\n return context;\r\n });\r\n }\r\n var ctor = context.viewModel.constructor;\r\n var isClass = typeof context.viewModel === 'function';\r\n if (isClass) {\r\n ctor = context.viewModel;\r\n childContainer.autoRegister(ctor);\r\n }\r\n var m = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, ctor);\r\n m.elementName = m.elementName || 'dynamic-element';\r\n m.initialize(isClass ? childContainer : (context.container || childContainer), ctor);\r\n context.viewModelResource = { metadata: m, value: ctor };\r\n if (context.host) {\r\n childContainer.registerInstance(DOM.Element, context.host);\r\n }\r\n childContainer.viewModel = context.viewModel = isClass ? childContainer.get(ctor) : context.viewModel;\r\n return Promise.resolve(context);\r\n };\r\n CompositionEngine.prototype.compose = function (context) {\r\n var _this = this;\r\n context.childContainer = context.childContainer || context.container.createChild();\r\n context.view = this.viewLocator.getViewStrategy(context.view);\r\n var transaction = context.childContainer.get(CompositionTransaction);\r\n var compositionTransactionOwnershipToken = transaction.tryCapture();\r\n if (compositionTransactionOwnershipToken) {\r\n context.compositionTransactionOwnershipToken = compositionTransactionOwnershipToken;\r\n }\r\n else {\r\n context.compositionTransactionNotifier = transaction.enlist();\r\n }\r\n if (context.viewModel) {\r\n return this._createControllerAndSwap(context);\r\n }\r\n else if (context.view) {\r\n if (context.viewResources) {\r\n context.view.makeRelativeTo(context.viewResources.viewUrl);\r\n }\r\n return context.view.loadViewFactory(this.viewEngine, new ViewCompileInstruction()).then(function (viewFactory) {\r\n var result = viewFactory.create(context.childContainer);\r\n result.bind(context.bindingContext, context.overrideContext);\r\n if (context.compositionTransactionOwnershipToken) {\r\n return context.compositionTransactionOwnershipToken.waitForCompositionComplete()\r\n .then(function () { return _this._swap(context, result); })\r\n .then(function () { return result; });\r\n }\r\n return _this._swap(context, result).then(function () { return result; });\r\n });\r\n }\r\n else if (context.viewSlot) {\r\n context.viewSlot.removeAll();\r\n if (context.compositionTransactionNotifier) {\r\n context.compositionTransactionNotifier.done();\r\n }\r\n return Promise.resolve(null);\r\n }\r\n return Promise.resolve(null);\r\n };\r\n CompositionEngine = __decorate([\r\n inject(ViewEngine, ViewLocator)\r\n ], CompositionEngine);\r\n return CompositionEngine;\r\n}());\n\nvar animationEvent = {\r\n enterBegin: 'animation:enter:begin',\r\n enterActive: 'animation:enter:active',\r\n enterDone: 'animation:enter:done',\r\n enterTimeout: 'animation:enter:timeout',\r\n leaveBegin: 'animation:leave:begin',\r\n leaveActive: 'animation:leave:active',\r\n leaveDone: 'animation:leave:done',\r\n leaveTimeout: 'animation:leave:timeout',\r\n staggerNext: 'animation:stagger:next',\r\n removeClassBegin: 'animation:remove-class:begin',\r\n removeClassActive: 'animation:remove-class:active',\r\n removeClassDone: 'animation:remove-class:done',\r\n removeClassTimeout: 'animation:remove-class:timeout',\r\n addClassBegin: 'animation:add-class:begin',\r\n addClassActive: 'animation:add-class:active',\r\n addClassDone: 'animation:add-class:done',\r\n addClassTimeout: 'animation:add-class:timeout',\r\n animateBegin: 'animation:animate:begin',\r\n animateActive: 'animation:animate:active',\r\n animateDone: 'animation:animate:done',\r\n animateTimeout: 'animation:animate:timeout',\r\n sequenceBegin: 'animation:sequence:begin',\r\n sequenceDone: 'animation:sequence:done'\r\n};\n\nfunction createChildObserverDecorator(selectorOrConfig, all) {\r\n return function (target, key, descriptor) {\r\n var actualTarget = typeof key === 'string' ? target.constructor : target;\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, actualTarget);\r\n if (typeof selectorOrConfig === 'string') {\r\n selectorOrConfig = {\r\n selector: selectorOrConfig,\r\n name: key\r\n };\r\n }\r\n if (descriptor) {\r\n descriptor.writable = true;\r\n descriptor.configurable = true;\r\n }\r\n selectorOrConfig.all = all;\r\n r.addChildBinding(new ChildObserver(selectorOrConfig));\r\n };\r\n}\r\nfunction children(selectorOrConfig) {\r\n return createChildObserverDecorator(selectorOrConfig, true);\r\n}\r\nfunction child(selectorOrConfig) {\r\n return createChildObserverDecorator(selectorOrConfig, false);\r\n}\r\nvar ChildObserver = (function () {\r\n function ChildObserver(config) {\r\n this.name = config.name;\r\n this.changeHandler = config.changeHandler || this.name + 'Changed';\r\n this.selector = config.selector;\r\n this.all = config.all;\r\n }\r\n ChildObserver.prototype.create = function (viewHost, viewModel, controller) {\r\n return new ChildObserverBinder(this.selector, viewHost, this.name, viewModel, controller, this.changeHandler, this.all);\r\n };\r\n return ChildObserver;\r\n}());\r\nvar noMutations = [];\r\nfunction trackMutation(groupedMutations, binder, record) {\r\n var mutations = groupedMutations.get(binder);\r\n if (!mutations) {\r\n mutations = [];\r\n groupedMutations.set(binder, mutations);\r\n }\r\n mutations.push(record);\r\n}\r\nfunction onChildChange(mutations, observer) {\r\n var binders = observer.binders;\r\n var bindersLength = binders.length;\r\n var groupedMutations = new Map();\r\n for (var i = 0, ii = mutations.length; i < ii; ++i) {\r\n var record = mutations[i];\r\n var added = record.addedNodes;\r\n var removed = record.removedNodes;\r\n for (var j = 0, jj = removed.length; j < jj; ++j) {\r\n var node = removed[j];\r\n if (node.nodeType === 1) {\r\n for (var k = 0; k < bindersLength; ++k) {\r\n var binder = binders[k];\r\n if (binder.onRemove(node)) {\r\n trackMutation(groupedMutations, binder, record);\r\n }\r\n }\r\n }\r\n }\r\n for (var j = 0, jj = added.length; j < jj; ++j) {\r\n var node = added[j];\r\n if (node.nodeType === 1) {\r\n for (var k = 0; k < bindersLength; ++k) {\r\n var binder = binders[k];\r\n if (binder.onAdd(node)) {\r\n trackMutation(groupedMutations, binder, record);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n groupedMutations.forEach(function (mutationRecords, binder) {\r\n if (binder.isBound && binder.changeHandler !== null) {\r\n binder.viewModel[binder.changeHandler](mutationRecords);\r\n }\r\n });\r\n}\r\nvar ChildObserverBinder = (function () {\r\n function ChildObserverBinder(selector, viewHost, property, viewModel, controller, changeHandler, all) {\r\n this.selector = selector;\r\n this.viewHost = viewHost;\r\n this.property = property;\r\n this.viewModel = viewModel;\r\n this.controller = controller;\r\n this.changeHandler = changeHandler in viewModel ? changeHandler : null;\r\n this.usesShadowDOM = controller.behavior.usesShadowDOM;\r\n this.all = all;\r\n if (!this.usesShadowDOM && controller.view && controller.view.contentView) {\r\n this.contentView = controller.view.contentView;\r\n }\r\n else {\r\n this.contentView = null;\r\n }\r\n this.source = null;\r\n this.isBound = false;\r\n }\r\n ChildObserverBinder.prototype.matches = function (element) {\r\n if (element.matches(this.selector)) {\r\n if (this.contentView === null) {\r\n return true;\r\n }\r\n var contentView = this.contentView;\r\n var assignedSlot = element.auAssignedSlot;\r\n if (assignedSlot && assignedSlot.projectFromAnchors) {\r\n var anchors = assignedSlot.projectFromAnchors;\r\n for (var i = 0, ii = anchors.length; i < ii; ++i) {\r\n if (anchors[i].auOwnerView === contentView) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n return element.auOwnerView === contentView;\r\n }\r\n return false;\r\n };\r\n ChildObserverBinder.prototype.bind = function (source) {\r\n if (this.isBound) {\r\n if (this.source === source) {\r\n return;\r\n }\r\n this.source = source;\r\n }\r\n this.isBound = true;\r\n var viewHost = this.viewHost;\r\n var viewModel = this.viewModel;\r\n var observer = viewHost.__childObserver__;\r\n if (!observer) {\r\n observer = viewHost.__childObserver__ = DOM.createMutationObserver(onChildChange);\r\n var options = {\r\n childList: true,\r\n subtree: !this.usesShadowDOM\r\n };\r\n observer.observe(viewHost, options);\r\n observer.binders = [];\r\n }\r\n observer.binders.push(this);\r\n if (this.usesShadowDOM) {\r\n var current = viewHost.firstElementChild;\r\n if (this.all) {\r\n var items = viewModel[this.property];\r\n if (!items) {\r\n items = viewModel[this.property] = [];\r\n }\r\n else {\r\n items.splice(0);\r\n }\r\n while (current) {\r\n if (this.matches(current)) {\r\n items.push(current.au && current.au.controller ? current.au.controller.viewModel : current);\r\n }\r\n current = current.nextElementSibling;\r\n }\r\n if (this.changeHandler !== null) {\r\n this.viewModel[this.changeHandler](noMutations);\r\n }\r\n }\r\n else {\r\n while (current) {\r\n if (this.matches(current)) {\r\n var value = current.au && current.au.controller ? current.au.controller.viewModel : current;\r\n this.viewModel[this.property] = value;\r\n if (this.changeHandler !== null) {\r\n this.viewModel[this.changeHandler](value);\r\n }\r\n break;\r\n }\r\n current = current.nextElementSibling;\r\n }\r\n }\r\n }\r\n };\r\n ChildObserverBinder.prototype.onRemove = function (element) {\r\n if (this.matches(element)) {\r\n var value = element.au && element.au.controller ? element.au.controller.viewModel : element;\r\n if (this.all) {\r\n var items = (this.viewModel[this.property] || (this.viewModel[this.property] = []));\r\n var index = items.indexOf(value);\r\n if (index !== -1) {\r\n items.splice(index, 1);\r\n }\r\n return true;\r\n }\r\n var currentValue = this.viewModel[this.property];\r\n if (currentValue === value) {\r\n this.viewModel[this.property] = null;\r\n if (this.isBound && this.changeHandler !== null) {\r\n this.viewModel[this.changeHandler](value);\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n ChildObserverBinder.prototype.onAdd = function (element) {\r\n if (this.matches(element)) {\r\n var value = element.au && element.au.controller ? element.au.controller.viewModel : element;\r\n if (this.all) {\r\n var items = (this.viewModel[this.property] || (this.viewModel[this.property] = []));\r\n if (this.selector === '*') {\r\n items.push(value);\r\n return true;\r\n }\r\n var index = 0;\r\n var prev = element.previousElementSibling;\r\n while (prev) {\r\n if (this.matches(prev)) {\r\n index++;\r\n }\r\n prev = prev.previousElementSibling;\r\n }\r\n items.splice(index, 0, value);\r\n return true;\r\n }\r\n this.viewModel[this.property] = value;\r\n if (this.isBound && this.changeHandler !== null) {\r\n this.viewModel[this.changeHandler](value);\r\n }\r\n }\r\n return false;\r\n };\r\n ChildObserverBinder.prototype.unbind = function () {\r\n if (!this.isBound) {\r\n return;\r\n }\r\n this.isBound = false;\r\n this.source = null;\r\n var childObserver = this.viewHost.__childObserver__;\r\n if (childObserver) {\r\n var binders = childObserver.binders;\r\n if (binders && binders.length) {\r\n var idx = binders.indexOf(this);\r\n if (idx !== -1) {\r\n binders.splice(idx, 1);\r\n }\r\n if (binders.length === 0) {\r\n childObserver.disconnect();\r\n this.viewHost.__childObserver__ = null;\r\n }\r\n }\r\n if (this.usesShadowDOM) {\r\n this.viewModel[this.property] = null;\r\n }\r\n }\r\n };\r\n return ChildObserverBinder;\r\n}());\n\nvar ElementConfigResource = (function () {\r\n function ElementConfigResource() {\r\n }\r\n ElementConfigResource.prototype.initialize = function (container, target) { };\r\n ElementConfigResource.prototype.register = function (registry, name) { };\r\n ElementConfigResource.prototype.load = function (container, target) {\r\n var config = new target();\r\n var eventManager = container.get(EventManager);\r\n eventManager.registerElementConfig(config);\r\n };\r\n return ElementConfigResource;\r\n}());\n\nfunction resource(instanceOrConfig) {\r\n return function (target) {\r\n var isConfig = typeof instanceOrConfig === 'string' || Object.getPrototypeOf(instanceOrConfig) === Object.prototype;\r\n if (isConfig) {\r\n target.$resource = instanceOrConfig;\r\n }\r\n else {\r\n metadata.define(metadata.resource, instanceOrConfig, target);\r\n }\r\n };\r\n}\r\nfunction behavior(override) {\r\n return function (target) {\r\n if (override instanceof HtmlBehaviorResource) {\r\n metadata.define(metadata.resource, override, target);\r\n }\r\n else {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, target);\r\n Object.assign(r, override);\r\n }\r\n };\r\n}\r\nfunction customElement(name) {\r\n return function (target) {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, target);\r\n r.elementName = validateBehaviorName(name, 'custom element');\r\n };\r\n}\r\nfunction customAttribute(name, defaultBindingMode, aliases) {\r\n return function (target) {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, target);\r\n r.attributeName = validateBehaviorName(name, 'custom attribute');\r\n r.attributeDefaultBindingMode = defaultBindingMode;\r\n r.aliases = aliases;\r\n };\r\n}\r\nfunction templateController(target) {\r\n var deco = function (t) {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);\r\n r.liftsContent = true;\r\n };\r\n return target ? deco(target) : deco;\r\n}\r\nfunction bindable(nameOrConfigOrTarget, key, descriptor) {\r\n var deco = function (target, key2, descriptor2) {\r\n var actualTarget = key2 ? target.constructor : target;\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, actualTarget);\r\n var prop;\r\n if (key2) {\r\n nameOrConfigOrTarget = nameOrConfigOrTarget || {};\r\n nameOrConfigOrTarget.name = key2;\r\n }\r\n prop = new BindableProperty(nameOrConfigOrTarget);\r\n return prop.registerWith(actualTarget, r, descriptor2);\r\n };\r\n if (!nameOrConfigOrTarget) {\r\n return deco;\r\n }\r\n if (key) {\r\n var target = nameOrConfigOrTarget;\r\n nameOrConfigOrTarget = null;\r\n return deco(target, key, descriptor);\r\n }\r\n return deco;\r\n}\r\nfunction dynamicOptions(target) {\r\n var deco = function (t) {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);\r\n r.hasDynamicOptions = true;\r\n };\r\n return target ? deco(target) : deco;\r\n}\r\nvar defaultShadowDOMOptions = { mode: 'open' };\r\nfunction useShadowDOM(targetOrOptions) {\r\n var options = typeof targetOrOptions === 'function' || !targetOrOptions\r\n ? defaultShadowDOMOptions\r\n : targetOrOptions;\r\n var deco = function (t) {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);\r\n r.targetShadowDOM = true;\r\n r.shadowDOMOptions = options;\r\n };\r\n return typeof targetOrOptions === 'function' ? deco(targetOrOptions) : deco;\r\n}\r\nfunction processAttributes(processor) {\r\n return function (t) {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);\r\n r.processAttributes = function (compiler, resources, node, attributes, elementInstruction) {\r\n try {\r\n processor(compiler, resources, node, attributes, elementInstruction);\r\n }\r\n catch (error) {\r\n LogManager.getLogger('templating').error(error);\r\n }\r\n };\r\n };\r\n}\r\nfunction doNotProcessContent() { return false; }\r\nfunction processContent(processor) {\r\n return function (t) {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);\r\n r.processContent = processor ? function (compiler, resources, node, instruction) {\r\n try {\r\n return processor(compiler, resources, node, instruction);\r\n }\r\n catch (error) {\r\n LogManager.getLogger('templating').error(error);\r\n return false;\r\n }\r\n } : doNotProcessContent;\r\n };\r\n}\r\nfunction containerless(target) {\r\n var deco = function (t) {\r\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);\r\n r.containerless = true;\r\n };\r\n return target ? deco(target) : deco;\r\n}\r\nfunction useViewStrategy(strategy) {\r\n return function (target) {\r\n metadata.define(ViewLocator.viewStrategyMetadataKey, strategy, target);\r\n };\r\n}\r\nfunction useView(path) {\r\n return useViewStrategy(new RelativeViewStrategy(path));\r\n}\r\nfunction inlineView(markup, dependencies, dependencyBaseUrl) {\r\n return useViewStrategy(new InlineViewStrategy(markup, dependencies, dependencyBaseUrl));\r\n}\r\nfunction noView(targetOrDependencies, dependencyBaseUrl) {\r\n var target;\r\n var dependencies;\r\n if (typeof targetOrDependencies === 'function') {\r\n target = targetOrDependencies;\r\n }\r\n else {\r\n dependencies = targetOrDependencies;\r\n target = undefined;\r\n }\r\n var deco = function (t) {\r\n metadata.define(ViewLocator.viewStrategyMetadataKey, new NoViewStrategy(dependencies, dependencyBaseUrl), t);\r\n };\r\n return target ? deco(target) : deco;\r\n}\r\nfunction view(templateOrConfig) {\r\n return function (target) {\r\n target.$view = templateOrConfig;\r\n };\r\n}\r\nfunction elementConfig(target) {\r\n var deco = function (t) {\r\n metadata.define(metadata.resource, new ElementConfigResource(), t);\r\n };\r\n return target ? deco(target) : deco;\r\n}\r\nfunction viewResources() {\r\n var resources = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n resources[_i] = arguments[_i];\r\n }\r\n return function (target) {\r\n metadata.define(ViewEngine.viewModelRequireMetadataKey, resources, target);\r\n };\r\n}\n\nvar TemplatingEngine = (function () {\r\n function TemplatingEngine(container, moduleAnalyzer, viewCompiler, compositionEngine) {\r\n this._container = container;\r\n this._moduleAnalyzer = moduleAnalyzer;\r\n this._viewCompiler = viewCompiler;\r\n this._compositionEngine = compositionEngine;\r\n container.registerInstance(Animator, Animator.instance = new Animator());\r\n }\r\n TemplatingEngine.prototype.configureAnimator = function (animator) {\r\n this._container.unregister(Animator);\r\n this._container.registerInstance(Animator, Animator.instance = animator);\r\n };\r\n TemplatingEngine.prototype.compose = function (context) {\r\n return this._compositionEngine.compose(context);\r\n };\r\n TemplatingEngine.prototype.enhance = function (instruction) {\r\n if (instruction instanceof DOM.Element) {\r\n instruction = { element: instruction };\r\n }\r\n var compilerInstructions = { letExpressions: [] };\r\n var resources = instruction.resources || this._container.get(ViewResources);\r\n this._viewCompiler._compileNode(instruction.element, resources, compilerInstructions, instruction.element.parentNode, 'root', true);\r\n var factory = new ViewFactory(instruction.element, compilerInstructions, resources);\r\n var container = instruction.container || this._container.createChild();\r\n var view = factory.create(container, BehaviorInstruction.enhance());\r\n view.bind(instruction.bindingContext || {}, instruction.overrideContext);\r\n view.firstChild = view.lastChild = view.fragment;\r\n view.fragment = DOM.createDocumentFragment();\r\n view.attached();\r\n return view;\r\n };\r\n TemplatingEngine.inject = [Container, ModuleAnalyzer, ViewCompiler, CompositionEngine];\r\n return TemplatingEngine;\r\n}());\n\nexport { Animator, BehaviorInstruction, BehaviorPropertyObserver, BindableProperty, BindingLanguage, BoundViewFactory, CompositionEngine, CompositionTransaction, CompositionTransactionNotifier, CompositionTransactionOwnershipToken, Controller, ConventionalViewStrategy, ElementConfigResource, ElementEvents, HtmlBehaviorResource, InlineViewStrategy, ModuleAnalyzer, NoViewStrategy, PassThroughSlot, RelativeViewStrategy, ResourceDescription, ResourceLoadContext, ResourceModule, ShadowDOM, ShadowSlot, SlotCustomAttribute, StaticViewStrategy, SwapStrategies, TargetInstruction, TemplateRegistryViewStrategy, TemplatingEngine, View, ViewCompileInstruction, ViewCompiler, ViewEngine, ViewEngineHooksResource, ViewFactory, ViewLocator, ViewResources, ViewSlot, _hyphenate, _isAllWhitespace, animationEvent, behavior, bindable, child, children, containerless, customAttribute, customElement, dynamicOptions, elementConfig, inlineView, noView, processAttributes, processContent, resource, templateController, useShadowDOM, useView, useViewStrategy, validateBehaviorName, view, viewEngineHooks, viewResources, viewStrategy };\n//# sourceMappingURL=aurelia-templating.js.map\n"],"names":[],"sourceRoot":""}