Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"Exception caught during observer callback: @data:text/javascript;base64,CiAgICBQb2x5bWVyKCdwb2x5bWVyLXNlbGVjdG9yJywgewogICAgICAvKioKICAgICAgICogR2V0cyBvciBzZXRzIHRoZSBzZWxlY3RlZCBlbGVtZW50LiAgRGVmYXVsdCB0byB1c2UgdGhlIGluZGV4CiAgICAgICAqIG9mIHRoZSBpdGVtIGVsZW1lbnQuCiAgICAgICAqCiAgICAgICAqIElmIHlvdSB3YW50IGEgc3BlY2lmaWMgYXR0cmlidXRlIHZhbHVlIG9mIHRoZSBlbGVtZW50IHRvIGJlCiAgICAgICAqIHVzZWQgaW5zdGVhZCBvZiBpbmRleCwgc2V0ICJ2YWx1ZWF0dHIiIHRvIHRoYXQgYXR0cmlidXRlIG5hbWUuCiAgICAgICAqCiAgICAgICAqIEV4YW1wbGU6CiAgICAgICAqCiAgICAgICAqICAgICA8cG9seW1lci1zZWxlY3RvciB2YWx1ZWF0dHI9ImxhYmVsIiBzZWxlY3RlZD0iZm9vIj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iZm9vIj48L2Rpdj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iYmFyIj48L2Rpdj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iem90Ij48L2Rpdj4KICAgICAgICogICAgIDwvcG9seW1lci1zZWxlY3Rvcj4KICAgICAgICoKICAgICAgICogSW4gbXVsdGktc2VsZWN0aW9uIHRoaXMgc2hvdWxkIGJlIGFuIGFycmF5IG9mIHZhbHVlcy4KICAgICAgICoKICAgICAgICogRXhhbXBsZToKICAgICAgICoKICAgICAgICogICAgIDxwb2x5bWVyLXNlbGVjdG9yIGlkPSJzZWxlY3RvciIgdmFsdWVhdHRyPSJsYWJlbCIgbXVsdGk+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9ImZvbyI+PC9kaXY+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9ImJhciI+PC9kaXY+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9InpvdCI+PC9kaXY+CiAgICAgICAqICAgICA8L3BvbHltZXItc2VsZWN0b3I+CiAgICAgICAqCiAgICAgICAqICAgICB0aGlzLiQuc2VsZWN0b3Iuc2VsZWN0ZWQgPSBbJ2ZvbycsICd6b3QnXTsKICAgICAgICoKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZAogICAgICAgKiBAdHlwZSBPYmplY3QKICAgICAgICogQGRlZmF1bHQgbnVsbAogICAgICAgKi8KICAgICAgc2VsZWN0ZWQ6IG51bGwsCiAgICAgIC8qKgogICAgICAgKiBJZiB0cnVlLCBtdWx0aXBsZSBzZWxlY3Rpb25zIGFyZSBhbGxvd2VkLgogICAgICAgKgogICAgICAgKiBAYXR0cmlidXRlIG11bHRpCiAgICAgICAqIEB0eXBlIGJvb2xlYW4KICAgICAgICogQGRlZmF1bHQgZmFsc2UKICAgICAgICovCiAgICAgIG11bHRpOiBmYWxzZSwKICAgICAgLyoqCiAgICAgICAqIFNwZWNpZmllcyB0aGUgYXR0cmlidXRlIHRvIGJlIHVzZWQgZm9yICJzZWxlY3RlZCIgYXR0cmlidXRlLgogICAgICAgKgogICAgICAgKiBAYXR0cmlidXRlIHZhbHVlYXR0cgogICAgICAgKiBAdHlwZSBzdHJpbmcKICAgICAgICogQGRlZmF1bHQgJ25hbWUnCiAgICAgICAqLwogICAgICB2YWx1ZWF0dHI6ICduYW1lJywKICAgICAgLyoqCiAgICAgICAqIFNwZWNpZmllcyB0aGUgQ1NTIGNsYXNzIHRvIGJlIHVzZWQgdG8gYWRkIHRvIHRoZSBzZWxlY3RlZCBlbGVtZW50LgogICAgICAgKiAKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZENsYXNzCiAgICAgICAqIEB0eXBlIHN0cmluZwogICAgICAgKiBAZGVmYXVsdCAncG9seW1lci1zZWxlY3RlZCcKICAgICAgICovCiAgICAgIHNlbGVjdGVkQ2xhc3M6ICd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0dXJucyB0aGUgbW9kZWwgYXNzb2NpYXRlZCB3aXRoIHRoZQogICAgICAgKiBzZWxlY3RlZCBlbGVtZW50LgogICAgICAgKiAKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZE1vZGVsCiAgICAgICAqIEB0eXBlIE9iamVjdAogICAgICAgKiBAZGVmYXVsdCBudWxsCiAgICAgICAqLwogICAgICBzZWxlY3RlZE1vZGVsOiBudWxsLAogICAgICAvKioKICAgICAgICogSW4gc2luZ2xlIHNlbGVjdGlvbiwgdGhpcyByZXR1cm5zIHRoZSBzZWxlY3RlZCBpbmRleC4KICAgICAgICoKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZEluZGV4CiAgICAgICAqIEB0eXBlIG51bWJlcgogICAgICAgKiBAZGVmYXVsdCAtMQogICAgICAgKi8KICAgICAgc2VsZWN0ZWRJbmRleDogLTEsCiAgICAgIC8qKgogICAgICAgKiBUaGUgdGFyZ2V0IGVsZW1lbnQgdGhhdCBjb250YWlucyBpdGVtcy4gIElmIHRoaXMgaXMgbm90IHNldCAKICAgICAgICogcG9seW1lci1zZWxlY3RvciBpcyB0aGUgY29udGFpbmVyLgogICAgICAgKiAKICAgICAgICogQGF0dHJpYnV0ZSB0YXJnZXQKICAgICAgICogQHR5cGUgT2JqZWN0CiAgICAgICAqIEBkZWZhdWx0IG51bGwKICAgICAgICovCiAgICAgIHRhcmdldDogbnVsbCwKICAgICAgLyoqCiAgICAgICAqIFRoaXMgY2FuIGJlIHVzZWQgdG8gcXVlcnkgbm9kZXMgZnJvbSB0aGUgdGFyZ2V0IG5vZGUgdG8gYmUgdXNlZCBmb3IgCiAgICAgICAqIHNlbGVjdGlvbiBpdGVtcy4gIE5vdGUgdGhpcyBvbmx5IHdvcmtzIGlmIHRoZSAndGFyZ2V0JyBwcm9wZXJ0eSBpcyBzZXQuCiAgICAgICAqCiAgICAgICAqIEV4YW1wbGU6CiAgICAgICAqCiAgICAgICAqICAgICA8cG9seW1lci1zZW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IH0KICAgICAgICB9CiAgICAgIH0sCiAgICAgIC8vIGV2ZW50IGZpcmVkIGZyb20gaG9zdAogICAgICBhY3RpdmF0ZUhhbmRsZXI6IGZ1bmN0aW9uKGUpIHsKICAgICAgICBpZiAoIXRoaXMubm90YXApIHsKICAgICAgICAgIHZhciBpID0gdGhpcy5maW5kRGlzdHJpYnV0ZWRUYXJnZXQoZS50YXJnZXQsIHRoaXMuaXRlbXMpOwogICAgICAgICAgaWYgKGkgPj0gMCkgewogICAgICAgICAgICB2YXIgaXRlbSA9IHRoaXMuaXRlbXNbaV07CiAgICAgICAgICAgIHZhciBzID0gdGhpcy52YWx1ZUZvck5vZGUoaXRlbSkgfHwgaTsKICAgICAgICAgICAgaWYgKHRoaXMubXVsdGkpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5zZWxlY3RlZCkgewogICAgICAgICAgICAgICAgdGhpcy5hZGRSZW1vdmVTZWxlY3RlZChzKTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZCA9IFtzXTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZCA9IHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5hc3luY0ZpcmUoJ3BvbHltZXItYWN0aXZhdGUnLCB7aXRlbTogaXRlbX0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfSwKICAgICAgYWRkUmVtb3ZlU2VsZWN0ZWQ6IGZ1bmN0aW9uKHZhbHVlKSB7CiAgICAgICAgdmFyIGkgPSB0aGlzLnNlbGVjdGVkLmluZGV4T2YodmFsdWUpOwogICAgICAgIGlmIChpID49IDApIHsKICAgICAgICAgIHRoaXMuc2VsZWN0ZWQuc3BsaWNlKGksIDEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB0aGlzLnNlbGVjdGVkLnB1c2godmFsdWUpOwogICAgICAgIH0KICAgICAgICB0aGlzLnZhbHVlVG9TZWxlY3Rpb24odmFsdWUpOwogICAgICB9LAogICAgICBmaW5kRGlzdHJpYnV0ZWRUYXJnZXQ6IGZ1bmN0aW9uKHRhcmdldCwgbm9kZXMpIHsKICAgICAgICAvLyBmaW5kIGZpcnN0IGFuY2VzdG9yIG9mIHRhcmdldCAoaW5jbHVkaW5nIGl0c2VsZikgdGhhdAogICAgICAgIC8vIGlzIGluIG5vZGVzLCBpZiBhbnkKICAgICAgICB3aGlsZSAodGFyZ2V0ICYmIHRhcmdldCAhPSB0aGlzKSB7CiAgICAgICAgICB2YXIgaSA9IEFycmF5LnByb3RvdHlwZS5pbmRleE9mLmNhbGwobm9kZXMsIHRhcmdldCk7CiAgICAgICAgICBpZiAoaSA+PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgfQogICAgICAgICAgdGFyZ2V0ID0gdGFyZ2V0LnBhcmVudE5vZGU7CiAgICAgICAgfQogICAgICB9CiAgICB9KTsKICAKLy8jIHNvdXJjZVVSTD1odHRwOi8vYWRkeW9zbWFuaS5naXRodWIuaW8vcG9seW1lci11aS1jYXJvdXNlbC9ib3dlcl9jb21wb25lbnRzL3BvbHltZXItc2VsZWN0b3IvcG9seW1lci1zZWxlY3Rvci5odG1sL3BvbHltZXItc2VsZWN0b3IuanMK:151
@data:text/javascript;base64,CiAgICBQb2x5bWVyKCdwb2x5bWVyLXNlbGVjdG9yJywgewogICAgICAvKioKICAgICAgICogR2V0cyBvciBzZXRzIHRoZSBzZWxlY3RlZCBlbGVtZW50LiAgRGVmYXVsdCB0byB1c2UgdGhlIGluZGV4CiAgICAgICAqIG9mIHRoZSBpdGVtIGVsZW1lbnQuCiAgICAgICAqCiAgICAgICAqIElmIHlvdSB3YW50IGEgc3BlY2lmaWMgYXR0cmlidXRlIHZhbHVlIG9mIHRoZSBlbGVtZW50IHRvIGJlCiAgICAgICAqIHVzZWQgaW5zdGVhZCBvZiBpbmRleCwgc2V0ICJ2YWx1ZWF0dHIiIHRvIHRoYXQgYXR0cmlidXRlIG5hbWUuCiAgICAgICAqCiAgICAgICAqIEV4YW1wbGU6CiAgICAgICAqCiAgICAgICAqICAgICA8cG9seW1lci1zZWxlY3RvciB2YWx1ZWF0dHI9ImxhYmVsIiBzZWxlY3RlZD0iZm9vIj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iZm9vIj48L2Rpdj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iYmFyIj48L2Rpdj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iem90Ij48L2Rpdj4KICAgICAgICogICAgIDwvcG9seW1lci1zZWxlY3Rvcj4KICAgICAgICoKICAgICAgICogSW4gbXVsdGktc2VsZWN0aW9uIHRoaXMgc2hvdWxkIGJlIGFuIGFycmF5IG9mIHZhbHVlcy4KICAgICAgICoKICAgICAgICogRXhhbXBsZToKICAgICAgICoKICAgICAgICogICAgIDxwb2x5bWVyLXNlbGVjdG9yIGlkPSJzZWxlY3RvciIgdmFsdWVhdHRyPSJsYWJlbCIgbXVsdGk+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9ImZvbyI+PC9kaXY+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9ImJhciI+PC9kaXY+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9InpvdCI+PC9kaXY+CiAgICAgICAqICAgICA8L3BvbHltZXItc2VsZWN0b3I+CiAgICAgICAqCiAgICAgICAqICAgICB0aGlzLiQuc2VsZWN0b3Iuc2VsZWN0ZWQgPSBbJ2ZvbycsICd6b3QnXTsKICAgICAgICoKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZAogICAgICAgKiBAdHlwZSBPYmplY3QKICAgICAgICogQGRlZmF1bHQgbnVsbAogICAgICAgKi8KICAgICAgc2VsZWN0ZWQ6IG51bGwsCiAgICAgIC8qKgogICAgICAgKiBJZiB0cnVlLCBtdWx0aXBsZSBzZWxlY3Rpb25zIGFyZSBhbGxvd2VkLgogICAgICAgKgogICAgICAgKiBAYXR0cmlidXRlIG11bHRpCiAgICAgICAqIEB0eXBlIGJvb2xlYW4KICAgICAgICogQGRlZmF1bHQgZmFsc2UKICAgICAgICovCiAgICAgIG11bHRpOiBmYWxzZSwKICAgICAgLyoqCiAgICAgICAqIFNwZWNpZmllcyB0aGUgYXR0cmlidXRlIHRvIGJlIHVzZWQgZm9yICJzZWxlY3RlZCIgYXR0cmlidXRlLgogICAgICAgKgogICAgICAgKiBAYXR0cmlidXRlIHZhbHVlYXR0cgogICAgICAgKiBAdHlwZSBzdHJpbmcKICAgICAgICogQGRlZmF1bHQgJ25hbWUnCiAgICAgICAqLwogICAgICB2YWx1ZWF0dHI6ICduYW1lJywKICAgICAgLyoqCiAgICAgICAqIFNwZWNpZmllcyB0aGUgQ1NTIGNsYXNzIHRvIGJlIHVzZWQgdG8gYWRkIHRvIHRoZSBzZWxlY3RlZCBlbGVtZW50LgogICAgICAgKiAKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZENsYXNzCiAgICAgICAqIEB0eXBlIHN0cmluZwogICAgICAgKiBAZGVmYXVsdCAncG9seW1lci1zZWxlY3RlZCcKICAgICAgICovCiAgICAgIHNlbGVjdGVkQ2xhc3M6ICdwb2x5bWVyLXNlbGVjdGVkJywKICAgICAgLyoqCiAgICAgICAqIFNwZWNpZmllcyB0aGUgcHJvcGVydHkgdG8gYmUgdXNlZCB0byBzZXQgb24gdGhlIHNlbGVjdGVkIGVsZW1lbnQKICAgICAgICogdG8gaW5kaWNhdGUgaXRzIGFjdGl2ZSBzdGF0ZS4KICAgICAgICoKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZFByb3BlcnR5CiAgICAgICAqIEB0eXBlIHN0cmluZwogICAgICAgKiBAZGVmYXVsdCAnJwogICAgICAgKi8KICAgICAgc2VsZWN0ZWRQcm9wZXJ0eTogJycsCiAgICAgIC8qKgogICAgICAgKiBTcGVjaWZpZXMgdGhlIHByb3BlcnR5IHR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MubXVsdGkpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5zZWxlY3RlZCkgewogICAgICAgICAgICAgICAgdGhpcy5hZGRSZW1vdmVTZWxlY3RlZChzKTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZCA9IFtzXTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZCA9IHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5hc3luY0ZpcmUoJ3BvbHltZXItYWN0aXZhdGUnLCB7aXRlbTogaXRlbX0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfSwKICAgICAgYWRkUmVtb3ZlU2VsZWN0ZWQ6IGZ1bmN0aW9uKHZhbHVlKSB7CiAgICAgICAgdmFyIGkgPSB0aGlzLnNlbGVjdGVkLmluZGV4T2YodmFsdWUpOwogICAgICAgIGlmIChpID49IDApIHsKICAgICAgICAgIHRoaXMuc2VsZWN0ZWQuc3BsaWNlKGksIDEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB0aGlzLnNlbGVjdGVkLnB1c2godmFsdWUpOwogICAgICAgIH0KICAgICAgICB0aGlzLnZhbHVlVG9TZWxlY3Rpb24odmFsdWUpOwogICAgICB9LAogICAgICBmaW5kRGlzdHJpYnV0ZWRUYXJnZXQ6IGZ1bmN0aW9uKHRhcmdldCwgbm9kZXMpIHsKICAgICAgICAvLyBmaW5kIGZpcnN0IGFuY2VzdG9yIG9mIHRhcmdldCAoaW5jbHVkaW5nIGl0c2VsZikgdGhhdAogICAgICAgIC8vIGlzIGluIG5vZGVzLCBpZiBhbnkKICAgICAgICB3aGlsZSAodGFyZ2V0ICYmIHRhcmdldCAhPSB0aGlzKSB7CiAgICAgICAgICB2YXIgaSA9IEFycmF5LnByb3RvdHlwZS5pbmRleE9mLmNhbGwobm9kZXMsIHRhcmdldCk7CiAgICAgICAgICBpZiAoaSA+PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgfQogICAgICAgICAgdGFyZ2V0ID0gdGFyZ2V0LnBhcmVudE5vZGU7CiAgICAgICAgfQogICAgICB9CiAgICB9KTsKICAKLy8jIHNvdXJjZVVSTD1odHRwOi8vYWRkeW9zbWFuaS5naXRodWIuaW8vcG9seW1lci11aS1jYXJvdXNlbC9ib3dlcl9jb21wb25lbnRzL3BvbHltZXItc2VsZWN0b3IvcG9seW1lci1zZWxlY3Rvci5odG1sL3BvbHltZXItc2VsZWN0b3IuanMK:209
@data:text/javascript;base64,CiAgICBQb2x5bWVyKCdwb2x5bWVyLXNlbGVjdG9yJywgewogICAgICAvKioKICAgICAgICogR2V0cyBvciBzZXRzIHRoZSBzZWxlY3RlZCBlbGVtZW50LiAgRGVmYXVsdCB0byB1c2UgdGhlIGluZGV4CiAgICAgICAqIG9mIHRoZSBpdGVtIGVsZW1lbnQuCiAgICAgICAqCiAgICAgICAqIElmIHlvdSB3YW50IGEgc3BlY2lmaWMgYXR0cmlidXRlIHZhbHVlIG9mIHRoZSBlbGVtZW50IHRvIGJlCiAgICAgICAqIHVzZWQgaW5zdGVhZCBvZiBpbmRleCwgc2V0ICJ2YWx1ZWF0dHIiIHRvIHRoYXQgYXR0cmlidXRlIG5hbWUuCiAgICAgICAqCiAgICAgICAqIEV4YW1wbGU6CiAgICAgICAqCiAgICAgICAqICAgICA8cG9seW1lci1zZWxlY3RvciB2YWx1ZWF0dHI9ImxhYmVsIiBzZWxlY3RlZD0iZm9vIj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iZm9vIj48L2Rpdj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iYmFyIj48L2Rpdj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iem90Ij48L2Rpdj4KICAgICAgICogICAgIDwvcG9seW1lci1zZWxlY3Rvcj4KICAgICAgICoKICAgICAgICogSW4gbXVsdGktc2VsZWN0aW9uIHRoaXMgc2hvdWxkIGJlIGFuIGFycmF5IG9mIHZhbHVlcy4KICAgICAgICoKICAgICAgICogRXhhbXBsZToKICAgICAgICoKICAgICAgICogICAgIDxwb2x5bWVyLXNlbGVjdG9yIGlkPSJzZWxlY3RvciIgdmFsdWVhdHRyPSJsYWJlbCIgbXVsdGk+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9ImZvbyI+PC9kaXY+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9ImJhciI+PC9kaXY+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9InpvdCI+PC9kaXY+CiAgICAgICAqICAgICA8L3BvbHltZXItc2VsZWN0b3I+CiAgICAgICAqCiAgICAgICAqICAgICB0aGlzLiQuc2VsZWN0b3Iuc2VsZWN0ZWQgPSBbJ2ZvbycsICd6b3QnXTsKICAgICAgICoKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZAogICAgICAgKiBAdHlwZSBPYmplY3QKICAgICAgICogQGRlZmF1bHQgbnVsbAogICAgICAgKi8KICAgICAgc2VsZWN0ZWQ6IG51bGwsCiAgICAgIC8qKgogICAgICAgKiBJZiB0cnVlLCBtdWx0aXBsZSBzZWxlY3Rpb25zIGFyZSBhbGxvd2VkLgogICAgICAgKgogICAgICAgKiBAYXR0cmlidXRlIG11bHRpCiAgICAgICAqIEB0eXBlIGJvb2xlYW4KICAgICAgICogQGRlZmF1bHQgZmFsc2UKICAgICAgICovCiAgICAgIG11bHRpOiBmYWxzZSwKICAgICAgLyoqCiAgICAgICAqIFNwZWNpZmllcyB0aGUgYXR0cmlidXRlIHRvIGJlIHVzZWQgZm9yICJzZWxlY3RlZCIgYXR0cmlidXRlLgogICAgICAgKgogICAgICAgKiBAYXR0cmlidXRlIHZhbHVlYXR0cgogICAgICAgKiBAdHlwZSBzdHJpbmcKICAgICAgICogQGRlZmF1bHQgJ25hbWUnCiAgICAgICAqLwogICAgICB2YWx1ZWF0dHI6ICduYW1lJywKICAgICAgLyoq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m5zCiAgICAgICAqIGFuIGFycmF5IG9mIHNlbGVjdGVkIGVsZW1lbnRzLgogICAgICAgKiAKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZEl0ZW0KICAgICAgICogQHR5cGUgT2JqZWN0CiAgICAgICAqIEBkZWZhdWx0IG51bGwKICAgICAgICovCiAgICAgIHNlbGVjdGVkSXRlbTogbnVsbCwKICAgICAgLyoqCiAgICAgICAqIEluIHNpbmdsZSBzZWxlY3Rpb24sIHRoaXMgcmV0dXJucyB0aGUgbW9kZWwgYXNzb2NpYXRlZCB3aXRoIHRoZQogICAgICAgKiBzZWxlY3RlZCBlbGVtZW50LgogICAgICAgKiAKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZE1vZGVsCiAgICAgICAqIEB0eXBlIE9iamVjdAogICAgICAgKiBAZGVmYXVsdCBudWxsCiAgICAgICAqLwogICAgICBzZWxlY3RlZE1vZGVsOiBudWxsLAogICAgICAvKioKICAgICAgICogSW4gc2luZ2xlIHNlbGVjdGlvbiwgdGhpcyByZXR1cm5zIHRoZSBzZWxlY3RlZCBpbmRleC4KICAgICAgICoKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZEluZGV4CiAgICAgICAqIEB0eXBlIG51bWJlcgogICAgICAgKiBAZGVmYXVsdCAtMQogICAgICAgKi8KICAgICAgc2VsZWN0ZWRJbmRleDogLTEsCiAgICAgIC8qKgogICAgICAgKiBUaGUgdGFyZ2V0IGVsZW1lbnQgdGhhdCBjb250YWlucyBpdGVtcy4gIElmIHRoaXMgaXMgbm90IHNldCAKICAgICAgICogcG9seW1lci1zZWxlY3RvciBpcyB0aGUgY29udGFpbmVyLgogICAgICAgKiAKICAgICAgICogQGF0dHJpYnV0ZSB0YXJnZXQKICAgICAgICogQHR5cGUgT2JqZWN0CiAgICAgICAqIEBkZWZhdWx0IG51bGwKICAgICAgICovCiAgICAgIHRhcmdldDogbnVsbCwKICAgICAgLyoqCiAgICAgICAqIFRoaXMgY2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bGVjdGVkQXR0cmlidXRlICYmIGl0ZW0uc2V0QXR0cmlidXRlKSB7CiAgICAgICAgICBpZiAoaXNTZWxlY3RlZCkgewogICAgICAgICAgICBpdGVtLnNldEF0dHJpYnV0ZSh0aGlzLnNlbGVjdGVkQXR0cmlidXRlLCAnJyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBpdGVtLnJlbW92ZUF0dHJpYnV0ZSh0aGlzLnNlbGVjdGVkQXR0cmlidXRlKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0sCiAgICAgIC8vIGV2ZW50IGZpcmVkIGZyb20gaG9zdAogICAgICBhY3RpdmF0ZUhhbmRsZXI6IGZ1bmN0aW9uKGUpIHsKICAgICAgICBpZiAoIXRoaXMubm90YXApIHsKICAgICAgICAgIHZhciBpID0gdGhpcy5maW5kRGlzdHJpYnV0ZWRUYXJnZXQoZS50YXJnZXQsIHRoaXMuaXRlbXMpOwogICAgICAgICAgaWYgKGkgPj0gMCkgewogICAgICAgICAgICB2YXIgaXRlbSA9IHRoaXMuaXRlbXNbaV07CiAgICAgICAgICAgIHZhciBzID0gdGhpcy52YWx1ZUZvck5vZGUoaXRlbSkgfHwgaTsKICAgICAgICAgICAgaWYgKHRoaXMubXVsdGkpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5zZWxlY3RlZCkgewogICAgICAgICAgICAgICAgdGhpcy5hZGRSZW1vdmVTZWxlY3RlZChzKTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZCA9IFtzXTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZCA9IHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5hc3luY0ZpcmUoJ3BvbHltZXItYWN0aXZhdGUnLCB7aXRlbTogaXRlbX0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfSwKICAgICAgYWRkUmVtb3ZlU2VsZWN0ZWQ6IGZ1bmN0aW9uKHZhbHVlKSB7CiAgICAgICAgdmFyIGkgPSB0aGlzLnNlbGVjdGVkLmluZGV4T2YodmFsdWUpOwogICAgICAgIGlmIChpID49IDApIHsKICAgICAgICAgIHRoaXMuc2VsZWN0ZWQuc3BsaWNlKGksIDEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB0aGlzLnNlbGVjdGVkLnB1c2godmFsdWUpOwogICAgICAgIH0KICAgICAgICB0aGlzLnZhbHVlVG9TZWxlY3Rpb24odmFsdWUpOwogICAgICB9LAogICAgICBmaW5kRGlzdHJpYnV0ZWRUYXJnZXQ6IGZ1bmN0aW9uKHRhcmdldCwgbm9kZXMpIHsKICAgICAgICAvLyBmaW5kIGZpcnN0IGFuY2VzdG9yIG9mIHRhcmdldCAoaW5jbHVkaW5nIGl0c2VsZikgdGhhdAogICAgICAgIC8vIGlzIGluIG5vZGVzLCBpZiBhbnkKICAgICAgICB3aGlsZSAodGFyZ2V0ICYmIHRhcmdldCAhPSB0aGlzKSB7CiAgICAgICAgICB2YXIgaSA9IEFycmF5LnByb3RvdHlwZS5pbmRleE9mLmNhbGwobm9kZXMsIHRhcmdldCk7CiAgICAgICAgICBpZiAoaSA+PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgfQogICAgICAgICAgdGFyZ2V0ID0gdGFyZ2V0LnBhcmVudE5vZGU7CiAgICAgICAgfQogICAgICB9CiAgICB9KTsKICAKLy8jIHNvdXJjZVVSTD1odHRwOi8vYWRkeW9zbWFuaS5naXRodWIuaW8vcG9seW1lci11aS1jYXJvdXNlbC9ib3dlcl9jb21wb25lbnRzL3BvbHltZXItc2VsZWN0b3IvcG9seW1lci1zZWxlY3Rvci5odG1sL3BvbHltZXItc2VsZWN0b3IuanMK:186
@data:text/javascript;base64,CiAgICBQb2x5bWVyKCdwb2x5bWVyLXNlbGVjdG9yJywgewogICAgICAvKioKICAgICAgICogR2V0cyBvciBzZXRzIHRoZSBzZWxlY3RlZCBlbGVtZW50LiAgRGVmYXVsdCB0byB1c2UgdGhlIGluZGV4CiAgICAgICAqIG9mIHRoZSBpdGVtIGVsZW1lbnQuCiAgICAgICAqCiAgICAgICAqIElmIHlvdSB3YW50IGEgc3BlY2lmaWMgYXR0cmlidXRlIHZhbHVlIG9mIHRoZSBlbGVtZW50IHRvIGJlCiAgICAgICAqIHVzZWQgaW5zdGVhZCBvZiBpbmRleCwgc2V0ICJ2YWx1ZWF0dHIiIHRvIHRoYXQgYXR0cmlidXRlIG5hbWUuCiAgICAgICAqCiAgICAgICAqIEV4YW1wbGU6CiAgICAgICAqCiAgICAgICAqICAgICA8cG9seW1lci1zZWxlY3RvciB2YWx1ZWF0dHI9ImxhYmVsIiBzZWxlY3RlZD0iZm9vIj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iZm9vIj48L2Rpdj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iYmFyIj48L2Rpdj4KICAgICAgICogICAgICAgPGRpdiBsYWJlbD0iem90Ij48L2Rpdj4KICAgICAgICogICAgIDwvcG9seW1lci1zZWxlY3Rvcj4KICAgICAgICoKICAgICAgICogSW4gbXVsdGktc2VsZWN0aW9uIHRoaXMgc2hvdWxkIGJlIGFuIGFycmF5IG9mIHZhbHVlcy4KICAgICAgICoKICAgICAgICogRXhhbXBsZToKICAgICAgICoKICAgICAgICogICAgIDxwb2x5bWVyLXNlbGVjdG9yIGlkPSJzZWxlY3RvciIgdmFsdWVhdHRyPSJsYWJlbCIgbXVsdGk+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9ImZvbyI+PC9kaXY+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9ImJhciI+PC9kaXY+CiAgICAgICAqICAgICAgIDxkaXYgbGFiZWw9InpvdCI+PC9kaXY+CiAgICAgICAqICAgICA8L3BvbHltZXItc2VsZWN0b3I+CiAgICAgICAqCiAgICAgICAqICAgICB0aGlzLiQu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ZE1vZGVsCiAgICAgICAqIEB0eXBlIE9iamVjdAogICAgICAgKiBAZGVmYXVsdCBudWxsCiAgICAgICAqLwogICAgICBzZWxlY3RlZE1vZGVsOiBudWxsLAogICAgICAvKioKICAgICAgICogSW4gc2luZ2xlIHNlbGVjdGlvbiwgdGhpcyByZXR1cm5zIHRoZSBzZWxlY3RlZCBpbmRleC4KICAgICAgICoKICAgICAgICogQGF0dHJpYnV0ZSBzZWxlY3RlZEluZGV4CiAgICAgICAqIEB0eXBlIG51bWJlcgogICAgICAgKiBAZGVmYXVsdCAtMQogICAgICAgKi8KICAgICAgc2VsZWN0ZWRJbmRleDogLTEsCiAgICAgIC8qKgogICAgICAgKiBUaGUgdGFyZ2V0IGVsZW1lbnQgdGhhdCBjb250YWlucyBpdGVtcy4gIElmIHRoaXMgaXMgbm90IHNldCAKICAgICAgICogcG9seW1lci1zZWxlY3RvciBpcyB0aGUgY29udGFpbmVyLgogICAgICAgKiAKICAgICAgICogQGF0dHJpYnV0ZSB0YXJnZXQKICAgICAgICogQHR5cGUgT2JqZWN0CiAgICAgICAqIEBkZWZhdWx0IG51bGwKICAgICAgICovCiAgICAgIHRhcmdldDogbnVsbCwKICAgICAgLyoqCiAgICAgICAqIFRoaXMgY2FuIGJlIHVzZWQgdG8gcXVlcnkgbm9kZXMgZnJvbSB0aGUgdGFyZ2V0IG5vZGUgdG8gYmUgdXNlZCBmb3IgCiAgICAgICAqIHNlbGVjdGlvbiBpdGVtcy4gIE5vdGUgdGhpcyBvbmx5IHdvcmtzIGlmIHRoZSAndGFyZ2V0JyBwcm9wZXJ0eSBpcyBzZXQuCiAgICAgICAqCiAgICAgICAqIEV4YW1wbGU6CiAgICAgICAqCiAgICAgICAqICAgICA8cG9seW1lci1zZWxlY3RvciB0YXJnZXQ9Int7JC5teUZvcm19fSIgaXRlbXNTZWxlY3Rvcj0iaW5wdXRbdHlwZT1yYWRpb10iPjwvcG9seW1lci1zZWxlY3Rvcj4KICAgICAgICogICAgIDxmb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ZiAoIXRoaXMubm90YXApIHsKICAgICAgICAgIHZhciBpID0gdGhpcy5maW5kRGlzdHJpYnV0ZWRUYXJnZXQoZS50YXJnZXQsIHRoaXMuaXRlbXMpOwogICAgICAgICAgaWYgKGkgPj0gMCkgewogICAgICAgICAgICB2YXIgaXRlbSA9IHRoaXMuaXRlbXNbaV07CiAgICAgICAgICAgIHZhciBzID0gdGhpcy52YWx1ZUZvck5vZGUoaXRlbSkgfHwgaTsKICAgICAgICAgICAgaWYgKHRoaXMubXVsdGkpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5zZWxlY3RlZCkgewogICAgICAgICAgICAgICAgdGhpcy5hZGRSZW1vdmVTZWxlY3RlZChzKTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZCA9IFtzXTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZCA9IHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5hc3luY0ZpcmUoJ3BvbHltZXItYWN0aXZhdGUnLCB7aXRlbTogaXRlbX0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfSwKICAgICAgYWRkUmVtb3ZlU2VsZWN0ZWQ6IGZ1bmN0aW9uKHZhbHVlKSB7CiAgICAgICAgdmFyIGkgPSB0aGlzLnNlbGVjdGVkLmluZGV4T2YodmFsdWUpOwogICAgICAgIGlmIChpID49IDApIHsKICAgICAgICAgIHRoaXMuc2VsZWN0ZWQuc3BsaWNlKGksIDEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB0aGlzLnNlbGVjdGVkLnB1c2godmFsdWUpOwogICAgICAgIH0KICAgICAgICB0aGlzLnZhbHVlVG9TZWxlY3Rpb24odmFsdWUpOwogICAgICB9LAogICAgICBmaW5kRGlzdHJpYnV0ZWRUYXJnZXQ6IGZ1bmN0aW9uKHRhcmdldCwgbm9kZXMpIHsKICAgICAgICAvLyBmaW5kIGZpcnN0IGFuY2VzdG9yIG9mIHRhcmdldCAoaW5jbHVkaW5nIGl0c2VsZikgdGhhdAogICAgICAgIC8vIGlzIGluIG5vZGVzLCBpZiBhbnkKICAgICAgICB3aGlsZSAodGFyZ2V0ICYmIHRhcmdldCAhPSB0aGlzKSB7CiAgICAgICAgICB2YXIgaSA9IEFycmF5LnByb3RvdHlwZS5pbmRleE9mLmNhbGwobm9kZXMsIHRhcmdldCk7CiAgICAgICAgICBpZiAoaSA+PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgfQogICAgICAgICAgdGFyZ2V0ID0gdGFyZ2V0LnBhcmVudE5vZGU7CiAgICAgICAgfQogICAgICB9CiAgICB9KTsKICAKLy8jIHNvdXJjZVVSTD1odHRwOi8vYWRkeW9zbWFuaS5naXRodWIuaW8vcG9seW1lci11aS1jYXJvdXNlbC9ib3dlcl9jb21wb25lbnRzL3BvbHltZXItc2VsZWN0b3IvcG9seW1lci1zZWxlY3Rvci5odG1sL3BvbHltZXItc2VsZWN0b3IuanMK:176
d.invokeMethod@http://addyosmani.github.io/polymer-ui-carousel/bower_components/polymer/polymer.js:29
d.notifyPropertyChanges@http://addyosmani.github.io/polymer-ui-carousel/bower_components/polymer/polymer.js:29
t.prototype.report_@http://addyosmani.github.io/polymer-ui-carousel/bower_components/platform/platform.js:32
z.prototype<.check_@http://addyosmani.github.io/polymer-ui-carousel/bower_components/platform/platform.js:32
a.Platform.performMicrotaskCheckpoint@http://addyosmani.github.io/polymer-ui-carousel/bower_components/platform/platform.js:32
b/<@http://addyosmani.github.io/polymer-ui-carousel/bower_components/platform/platform.js:37
c@http://addyosmani.github.io/polymer-ui-carousel/bower_components/platform/platform.js:34
c@http://addyosmani.github.io/polymer-ui-carousel/bower_components/platform/platform.js:32
b@http://addyosmani.github.io/polymer-ui-carousel/bower_components/platform/platform.js:32
" platform.js:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.