faye 1.2.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap fcb557acaeb0a9a6c1d6","webpack:///./src/faye_browser.js","webpack:///./src/util/constants.js","webpack:///./src/mixins/logging.js","webpack:///./src/util/to_json.js","webpack:///./src/protocol/client.js","webpack:///./~/asap/browser-asap.js","webpack:///./~/asap/browser-raw.js","webpack:///./src/util/class.js","webpack:///./src/util/extend.js","webpack:///./src/util/promise.js","webpack:///./src/util/uri.js","webpack:///./src/util/array.js","webpack:///./src/util/browser/event.js","webpack:///./src/util/validate_options.js","webpack:///./src/mixins/deferrable.js","webpack:///./src/mixins/publisher.js","webpack:///./src/util/event_emitter.js","webpack:///./src/protocol/channel.js","webpack:///./src/protocol/grammar.js","webpack:///./src/protocol/dispatcher.js","webpack:///./src/util/cookies/browser_cookies.js","webpack:///./src/transport/browser_transports.js","webpack:///./src/transport/transport.js","webpack:///./src/mixins/timeouts.js","webpack:///./src/transport/web_socket.js","webpack:///./src/util/set.js","webpack:///./src/util/copy_object.js","webpack:///./src/util/websocket/browser_websocket.js","webpack:///./src/transport/event_source.js","webpack:///./src/transport/xhr.js","webpack:///./src/transport/cors.js","webpack:///./src/transport/jsonp.js","webpack:///./src/protocol/scheduler.js","webpack:///./src/protocol/error.js","webpack:///./src/protocol/extensible.js","webpack:///./src/protocol/publication.js","webpack:///./src/protocol/subscription.js"],"names":[],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;;;;;;ACdA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACTA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA,UAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;;;;;;;AC9CA;;AAEA;;AAEA;AACA;AACA;AACA,IAAG;AACH;;;;;;;ACRA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAoB;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,MAAK,IAAI;;AAET;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,wCAAuC,yBAAyB;;AAEhE,QAAO;AACP;AACA,uCAAsC,oCAAoC;AAC1E;AACA;AACA,MAAK;AACL,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yCAAwC,kCAAkC;;AAE1E;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,MAAK,IAAI;AACT,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,MAAK,IAAI;AACT;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,MAAK;;AAEL;AACA;;AAEA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,QAAO,IAAI;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,QAAO,IAAI;AACX;;AAEA;AACA;AACA,QAAO;AACP,MAAK;AACL,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAiC;AACjC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,QAAO;AACP;AACA;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mEAAkE;AAClE,MAAK;AACL,IAAG;;AAEH;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,mCAAkC,iBAAiB;AACnD;AACA,EAAC;;AAED;AACA;AACA;AACA;;AAEA;;;;;;;;ACjYA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;;;;;;ACjEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAgE,kBAAkB;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA4B,oBAAoB;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3NA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtBA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACXA;;AAEA;;AAEA;AACA;AACA;;AAEA,2BAA0B,WAAW;AACrC,2BAA0B;;AAE1B;AACA;AACA;AACA;;AAEA;AACA;;AAEA,0BAAyB,uBAAuB;AAChD,0BAAyB,uBAAuB;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kCAAiC;;AAEjC;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,mCAAkC;;AAElC;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA,oBAAmB,2BAA2B;AAC9C;;AAEA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iDAAgD,iBAAiB;AACjE;;AAEA;AACA,iDAAgD,iBAAiB;AACjE;;AAEA;AACA;AACA;;AAEA;;AAEA,gBAAe,OAAO;AACtB;AACA;AACA;AACA,QAAO;AACP,MAAK;AACL,IAAG;AACH;;AAEA;AACA;AACA,yCAAwC,OAAO;AAC/C;AACA,IAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;;;;;;AChKA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA,iBAAgB;;AAEhB;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kCAAiC,OAAO;AACxC;AACA;AACA;;AAEA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AClFA;;AAEA;AACA;AACA,sCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA,qCAAoC,OAAO;AAC3C;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA,yCAAwC,OAAO;AAC/C;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,sCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACzEA;;AAEA;AACA;;AAEA;AACA,+BAA8B;;AAE9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;;;;;;ACjDA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACTA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA,uCAAsC,gCAAgC;AACtE,IAAG;;AAEH;AACA,8CAA6C,iCAAiC;AAC9E,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,IAAG;;AAEH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC/CA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA,+BAA8B;;AAE9B;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAmB,eAAe;AAClC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA2B;AAC3B,QAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAG;AACH;;AAEA;AACA,0CAAyC,OAAO;AAChD;AACA;AACA;;AAEA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC1KA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,EAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,yCAAwC,OAAO;AAC/C;AACA;AACA;AACA;;AAEA;AACA,IAAG;;AAEH;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,wCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,MAAK;;AAEL;AACA;;AAEA,2CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA,IAAG;AACH,EAAC;;AAED;;;;;;;ACnIA;;AAEA;AACA;AACA,qFAAoF,IAAI;AACxF;AACA;AACA;;;;;;;ACPA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAwB;AACxB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yDAAwD;;AAExD;AACA;AACA;AACA,uCAAsC,OAAO;AAC7C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAK;AACL,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,iDAAgD,+EAA+E;AAC/H,0CAAyC;AACzC;;AAEA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;ACxLA;;AAEA;;;;;;;ACFA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACVA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA8B;AAC9B,mBAAkB,mDAAmD;AACrE;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iCAAgC;;AAEhC;AACA;AACA,IAAG;;AAEH,uBAAsB;;AAEtB;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA,MAAK;AACL,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,MAAK;;AAEL;AACA,IAAG;;AAEH;AACA;;AAEA;AACA,sCAAqC;;AAErC;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA,wCAAuC,OAAO;AAC9C;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;;AAEA,yCAAwC,OAAO;AAC/C;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;;AAEA;AACA;AACA,MAAK,SAAS;AACd,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;;AAEA,0CAAyC,OAAO;AAChD;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mDAAkD,iCAAiC;AACnF;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAC;AACD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,+DAA8D;AAC9D;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP,MAAK;AACL;AACA,MAAK;AACL,IAAG;;AAEH;AACA;AACA;AACA,IAAG;;AAEH;AACA,qDAAoD,cAAc;AAClE,IAAG;;AAEH;AACA,EAAC;;AAED;AACA;;AAEA;;;;;;;AClNA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;;;;;;;;ACzBA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,+BAA8B,+BAA+B;AAC7D,8BAA6B,gCAAgC;AAC7D;AACA,IAAG;;AAEH;AACA;AACA,yCAAwC,OAAO;;AAE/C;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA,MAAK;;AAEL;AACA,0BAAyB,4BAA4B,aAAa;AAClE;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,YAAW,mCAAmC;;AAE9C;;AAEA;;AAEA,0CAAyC,OAAO;AAChD;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,uBAAsB;;AAEtB;;AAEA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA,EAAC;AACD;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,EAAC;;AAED;;AAEA;AACA,wDAAuD,6BAA6B;;AAEpF;;;;;;;;AChKA;;AAEA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA,kCAAiC,mBAAmB;AACpD;AACA;AACA,EAAC;;;;;;;ACjDD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;;;;;;;AClBA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;ACRA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAW,mCAAmC;;AAE9C;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA,+BAA8B,+BAA+B;AAC7D,8BAA6B,gCAAgC;AAC7D,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA,EAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL,IAAG;;AAEH;AACA,8FAA6F;AAC7F;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAC;;AAED;;AAEA;;;;;;;;AChGA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,6BAA4B;AAC5B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,EAAC;;AAED;;;;;;;;ACjFA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAW,yCAAyC;;AAEpD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,0BAAyB,iBAAiB;;AAE1C;AACA;AACA;AACA,EAAC;AACD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;;;;;;;;ACnFA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,8BAA8B;AACzC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,aAAY;AACZ;AACA,EAAC;AACD;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,EAAC;;AAED;;;;;;;;AC/DA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH,yBAAwB;;AAExB,sBAAqB;;AAErB;AACA,EAAC;;AAED;;;;;;;AC7CA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;;;;;;;ACtDA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;;;;;;AC9CA;;AAEA;AACA;;AAEA;;;;;;;ACLA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,EAAC;;AAED;;AAEA","file":"faye-browser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap fcb557acaeb0a9a6c1d6\n **/","'use strict';\n\nvar constants = require('./util/constants'),\n Logging = require('./mixins/logging');\n\nvar Faye = {\n VERSION: constants.VERSION,\n\n Client: require('./protocol/client'),\n Scheduler: require('./protocol/scheduler')\n};\n\nLogging.wrapper = Faye;\n\nmodule.exports = Faye;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/faye_browser.js\n ** module id = 0\n ** module chunks = 0\n **/","module.exports = {\n VERSION: '1.2.2',\n\n BAYEUX_VERSION: '1.0',\n ID_LENGTH: 160,\n JSONP_CALLBACK: 'jsonpcallback',\n CONNECTION_TYPES: ['long-polling', 'cross-origin-long-polling', 'callback-polling', 'websocket', 'eventsource', 'in-process'],\n\n MANDATORY_CONNECTION_TYPES: ['long-polling', 'callback-polling', 'in-process']\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/constants.js\n ** module id = 1\n ** module chunks = 0\n **/","'use strict';\n\nvar toJSON = require('../util/to_json');\n\nvar Logging = {\n LOG_LEVELS: {\n fatal: 4,\n error: 3,\n warn: 2,\n info: 1,\n debug: 0\n },\n\n writeLog: function(messageArgs, level) {\n var logger = Logging.logger || (Logging.wrapper || Logging).logger;\n if (!logger) return;\n\n var args = Array.prototype.slice.apply(messageArgs),\n banner = '[Faye',\n klass = this.className,\n\n message = args.shift().replace(/\\?/g, function() {\n try {\n return toJSON(args.shift());\n } catch (error) {\n return '[Object]';\n }\n });\n\n if (klass) banner += '.' + klass;\n banner += '] ';\n\n if (typeof logger[level] === 'function')\n logger[level](banner + message);\n else if (typeof logger === 'function')\n logger(banner + message);\n }\n};\n\nfor (var key in Logging.LOG_LEVELS)\n (function(level) {\n Logging[level] = function() {\n this.writeLog(arguments, level);\n };\n })(key);\n\nmodule.exports = Logging;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/mixins/logging.js\n ** module id = 2\n ** module chunks = 0\n **/","'use strict';\n\n// http://assanka.net/content/tech/2009/09/02/json2-js-vs-prototype/\n\nmodule.exports = function(object) {\n return JSON.stringify(object, function(key, value) {\n return (this[key] instanceof Array) ? this[key] : value;\n });\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/to_json.js\n ** module id = 3\n ** module chunks = 0\n **/","'use strict';\n\nvar asap = require('asap'),\n Class = require('../util/class'),\n Promise = require('../util/promise'),\n URI = require('../util/uri'),\n array = require('../util/array'),\n browser = require('../util/browser'),\n constants = require('../util/constants'),\n extend = require('../util/extend'),\n validateOptions = require('../util/validate_options'),\n Deferrable = require('../mixins/deferrable'),\n Logging = require('../mixins/logging'),\n Publisher = require('../mixins/publisher'),\n Channel = require('./channel'),\n Dispatcher = require('./dispatcher'),\n Error = require('./error'),\n Extensible = require('./extensible'),\n Publication = require('./publication'),\n Subscription = require('./subscription');\n\nvar Client = Class({ className: 'Client',\n UNCONNECTED: 1,\n CONNECTING: 2,\n CONNECTED: 3,\n DISCONNECTED: 4,\n\n HANDSHAKE: 'handshake',\n RETRY: 'retry',\n NONE: 'none',\n\n CONNECTION_TIMEOUT: 60,\n\n DEFAULT_ENDPOINT: '/bayeux',\n INTERVAL: 0,\n\n initialize: function(endpoint, options) {\n this.info('New client created for ?', endpoint);\n options = options || {};\n\n validateOptions(options, ['interval', 'timeout', 'endpoints', 'proxy', 'retry', 'scheduler', 'websocketExtensions', 'tls', 'ca']);\n\n this._channels = new Channel.Set();\n this._dispatcher = Dispatcher.create(this, endpoint || this.DEFAULT_ENDPOINT, options);\n\n this._messageId = 0;\n this._state = this.UNCONNECTED;\n\n this._responseCallbacks = {};\n\n this._advice = {\n reconnect: this.RETRY,\n interval: 1000 * (options.interval || this.INTERVAL),\n timeout: 1000 * (options.timeout || this.CONNECTION_TIMEOUT)\n };\n this._dispatcher.timeout = this._advice.timeout / 1000;\n\n this._dispatcher.bind('message', this._receiveMessage, this);\n\n if (browser.Event && global.onbeforeunload !== undefined)\n browser.Event.on(global, 'beforeunload', function() {\n if (array.indexOf(this._dispatcher._disabled, 'autodisconnect') < 0)\n this.disconnect();\n }, this);\n },\n\n addWebsocketExtension: function(extension) {\n return this._dispatcher.addWebsocketExtension(extension);\n },\n\n disable: function(feature) {\n return this._dispatcher.disable(feature);\n },\n\n setHeader: function(name, value) {\n return this._dispatcher.setHeader(name, value);\n },\n\n // Request\n // MUST include: * channel\n // * version\n // * supportedConnectionTypes\n // MAY include: * minimumVersion\n // * ext\n // * id\n //\n // Success Response Failed Response\n // MUST include: * channel MUST include: * channel\n // * version * successful\n // * supportedConnectionTypes * error\n // * clientId MAY include: * supportedConnectionTypes\n // * successful * advice\n // MAY include: * minimumVersion * version\n // * advice * minimumVersion\n // * ext * ext\n // * id * id\n // * authSuccessful\n handshake: function(callback, context) {\n if (this._advice.reconnect === this.NONE) return;\n if (this._state !== this.UNCONNECTED) return;\n\n this._state = this.CONNECTING;\n var self = this;\n\n this.info('Initiating handshake with ?', URI.stringify(this._dispatcher.endpoint));\n this._dispatcher.selectTransport(constants.MANDATORY_CONNECTION_TYPES);\n\n this._sendMessage({\n channel: Channel.HANDSHAKE,\n version: constants.BAYEUX_VERSION,\n supportedConnectionTypes: this._dispatcher.getConnectionTypes()\n\n }, {}, function(response) {\n\n if (response.successful) {\n this._state = this.CONNECTED;\n this._dispatcher.clientId = response.clientId;\n\n this._dispatcher.selectTransport(response.supportedConnectionTypes);\n\n this.info('Handshake successful: ?', this._dispatcher.clientId);\n\n this.subscribe(this._channels.getKeys(), true);\n if (callback) asap(function() { callback.call(context) });\n\n } else {\n this.info('Handshake unsuccessful');\n global.setTimeout(function() { self.handshake(callback, context) }, this._dispatcher.retry * 1000);\n this._state = this.UNCONNECTED;\n }\n }, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * connectionType * clientId\n // MAY include: * ext MAY include: * error\n // * id * advice\n // * ext\n // * id\n // * timestamp\n connect: function(callback, context) {\n if (this._advice.reconnect === this.NONE) return;\n if (this._state === this.DISCONNECTED) return;\n\n if (this._state === this.UNCONNECTED)\n return this.handshake(function() { this.connect(callback, context) }, this);\n\n this.callback(callback, context);\n if (this._state !== this.CONNECTED) return;\n\n this.info('Calling deferred actions for ?', this._dispatcher.clientId);\n this.setDeferredStatus('succeeded');\n this.setDeferredStatus('unknown');\n\n if (this._connectRequest) return;\n this._connectRequest = true;\n\n this.info('Initiating connection for ?', this._dispatcher.clientId);\n\n this._sendMessage({\n channel: Channel.CONNECT,\n clientId: this._dispatcher.clientId,\n connectionType: this._dispatcher.connectionType\n\n }, {}, this._cycleConnection, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // MAY include: * ext * clientId\n // * id MAY include: * error\n // * ext\n // * id\n disconnect: function() {\n if (this._state !== this.CONNECTED) return;\n this._state = this.DISCONNECTED;\n\n this.info('Disconnecting ?', this._dispatcher.clientId);\n var promise = new Publication();\n\n this._sendMessage({\n channel: Channel.DISCONNECT,\n clientId: this._dispatcher.clientId\n\n }, {}, function(response) {\n if (response.successful) {\n this._dispatcher.close();\n promise.setDeferredStatus('succeeded');\n } else {\n promise.setDeferredStatus('failed', Error.parse(response.error));\n }\n }, this);\n\n this.info('Clearing channel listeners for ?', this._dispatcher.clientId);\n this._channels = new Channel.Set();\n\n return promise;\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * subscription * clientId\n // MAY include: * ext * subscription\n // * id MAY include: * error\n // * advice\n // * ext\n // * id\n // * timestamp\n subscribe: function(channel, callback, context) {\n if (channel instanceof Array)\n return array.map(channel, function(c) {\n return this.subscribe(c, callback, context);\n }, this);\n\n var subscription = new Subscription(this, channel, callback, context),\n force = (callback === true),\n hasSubscribe = this._channels.hasSubscription(channel);\n\n if (hasSubscribe && !force) {\n this._channels.subscribe([channel], subscription);\n subscription.setDeferredStatus('succeeded');\n return subscription;\n }\n\n this.connect(function() {\n this.info('Client ? attempting to subscribe to ?', this._dispatcher.clientId, channel);\n if (!force) this._channels.subscribe([channel], subscription);\n\n this._sendMessage({\n channel: Channel.SUBSCRIBE,\n clientId: this._dispatcher.clientId,\n subscription: channel\n\n }, {}, function(response) {\n if (!response.successful) {\n subscription.setDeferredStatus('failed', Error.parse(response.error));\n return this._channels.unsubscribe(channel, subscription);\n }\n\n var channels = [].concat(response.subscription);\n this.info('Subscription acknowledged for ? to ?', this._dispatcher.clientId, channels);\n subscription.setDeferredStatus('succeeded');\n }, this);\n }, this);\n\n return subscription;\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * subscription * clientId\n // MAY include: * ext * subscription\n // * id MAY include: * error\n // * advice\n // * ext\n // * id\n // * timestamp\n unsubscribe: function(channel, subscription) {\n if (channel instanceof Array)\n return array.map(channel, function(c) {\n return this.unsubscribe(c, subscription);\n }, this);\n\n var dead = this._channels.unsubscribe(channel, subscription);\n if (!dead) return;\n\n this.connect(function() {\n this.info('Client ? attempting to unsubscribe from ?', this._dispatcher.clientId, channel);\n\n this._sendMessage({\n channel: Channel.UNSUBSCRIBE,\n clientId: this._dispatcher.clientId,\n subscription: channel\n\n }, {}, function(response) {\n if (!response.successful) return;\n\n var channels = [].concat(response.subscription);\n this.info('Unsubscription acknowledged for ? from ?', this._dispatcher.clientId, channels);\n }, this);\n }, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * data * successful\n // MAY include: * clientId MAY include: * id\n // * id * error\n // * ext * ext\n publish: function(channel, data, options) {\n validateOptions(options || {}, ['attempts', 'deadline']);\n var publication = new Publication();\n\n this.connect(function() {\n this.info('Client ? queueing published message to ?: ?', this._dispatcher.clientId, channel, data);\n\n this._sendMessage({\n channel: channel,\n data: data,\n clientId: this._dispatcher.clientId\n\n }, options, function(response) {\n if (response.successful)\n publication.setDeferredStatus('succeeded');\n else\n publication.setDeferredStatus('failed', Error.parse(response.error));\n }, this);\n }, this);\n\n return publication;\n },\n\n _sendMessage: function(message, options, callback, context) {\n message.id = this._generateMessageId();\n\n var timeout = this._advice.timeout\n ? 1.2 * this._advice.timeout / 1000\n : 1.2 * this._dispatcher.retry;\n\n this.pipeThroughExtensions('outgoing', message, null, function(message) {\n if (!message) return;\n if (callback) this._responseCallbacks[message.id] = [callback, context];\n this._dispatcher.sendMessage(message, timeout, options || {});\n }, this);\n },\n\n _generateMessageId: function() {\n this._messageId += 1;\n if (this._messageId >= Math.pow(2,32)) this._messageId = 0;\n return this._messageId.toString(36);\n },\n\n _receiveMessage: function(message) {\n var id = message.id, callback;\n\n if (message.successful !== undefined) {\n callback = this._responseCallbacks[id];\n delete this._responseCallbacks[id];\n }\n\n this.pipeThroughExtensions('incoming', message, null, function(message) {\n if (!message) return;\n if (message.advice) this._handleAdvice(message.advice);\n this._deliverMessage(message);\n if (callback) callback[0].call(callback[1], message);\n }, this);\n },\n\n _handleAdvice: function(advice) {\n extend(this._advice, advice);\n this._dispatcher.timeout = this._advice.timeout / 1000;\n\n if (this._advice.reconnect === this.HANDSHAKE && this._state !== this.DISCONNECTED) {\n this._state = this.UNCONNECTED;\n this._dispatcher.clientId = null;\n this._cycleConnection();\n }\n },\n\n _deliverMessage: function(message) {\n if (!message.channel || message.data === undefined) return;\n this.info('Client ? calling listeners for ? with ?', this._dispatcher.clientId, message.channel, message.data);\n this._channels.distributeMessage(message);\n },\n\n _cycleConnection: function() {\n if (this._connectRequest) {\n this._connectRequest = null;\n this.info('Closed connection for ?', this._dispatcher.clientId);\n }\n var self = this;\n global.setTimeout(function() { self.connect() }, this._advice.interval);\n }\n});\n\nextend(Client.prototype, Deferrable);\nextend(Client.prototype, Publisher);\nextend(Client.prototype, Logging);\nextend(Client.prototype, Extensible);\n\nmodule.exports = Client;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/client.js\n ** module id = 4\n ** module chunks = 0\n **/","\"use strict\";\n\n// rawAsap provides everything we need except exception management.\nvar rawAsap = require(\"./raw\");\n// RawTasks are recycled to reduce GC churn.\nvar freeTasks = [];\n// We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n if (pendingErrors.length) {\n throw pendingErrors.shift();\n }\n}\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nmodule.exports = asap;\nfunction asap(task) {\n var rawTask;\n if (freeTasks.length) {\n rawTask = freeTasks.pop();\n } else {\n rawTask = new RawTask();\n }\n rawTask.task = task;\n rawAsap(rawTask);\n}\n\n// We wrap tasks with recyclable task objects. A task object implements\n// `call`, just like a function.\nfunction RawTask() {\n this.task = null;\n}\n\n// The sole purpose of wrapping the task is to catch the exception and recycle\n// the task object after its single use.\nRawTask.prototype.call = function () {\n try {\n this.task.call();\n } catch (error) {\n if (asap.onerror) {\n // This hook exists purely for testing purposes.\n // Its name will be periodically randomized to break any code that\n // depends on its existence.\n asap.onerror(error);\n } else {\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n pendingErrors.push(error);\n requestErrorThrow();\n }\n } finally {\n this.task = null;\n freeTasks[freeTasks.length] = this;\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/asap/browser-asap.js\n ** module id = 5\n ** module chunks = 0\n **/","\"use strict\";\n\n// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nmodule.exports = rawAsap;\nfunction rawAsap(task) {\n if (!queue.length) {\n requestFlush();\n flushing = true;\n }\n // Equivalent to push, but avoids a function call.\n queue[queue.length] = task;\n}\n\nvar queue = [];\n// Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\nvar flushing = false;\n// `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\nvar requestFlush;\n// The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\nvar index = 0;\n// If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\nvar capacity = 1024;\n\n// The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\nfunction flush() {\n while (index < queue.length) {\n var currentIndex = index;\n // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n index = index + 1;\n queue[currentIndex].call();\n // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n if (index > capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n queue[scan] = queue[scan + index];\n }\n queue.length -= index;\n index = 0;\n }\n }\n queue.length = 0;\n index = 0;\n flushing = false;\n}\n\n// `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\nvar BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver;\n\n// MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nif (typeof BrowserMutationObserver === \"function\") {\n requestFlush = makeRequestCallFromMutationObserver(flush);\n\n// MessageChannels are desirable because they give direct access to the HTML\n// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\n} else {\n requestFlush = makeRequestCallFromTimer(flush);\n}\n\n// `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\nrawAsap.requestFlush = requestFlush;\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nfunction makeRequestCallFromMutationObserver(callback) {\n var toggle = 1;\n var observer = new BrowserMutationObserver(callback);\n var node = document.createTextNode(\"\");\n observer.observe(node, {characterData: true});\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\nfunction makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n var timeoutHandle = setTimeout(handleTimer, 0);\n // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n var intervalHandle = setInterval(handleTimer, 50);\n\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n}\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/asap/browser-raw.js\n ** module id = 6\n ** module chunks = 0\n **/","'use strict';\n\nvar extend = require('./extend');\n\nmodule.exports = function(parent, methods) {\n if (typeof parent !== 'function') {\n methods = parent;\n parent = Object;\n }\n\n var klass = function() {\n if (!this.initialize) return this;\n return this.initialize.apply(this, arguments) || this;\n };\n\n var bridge = function() {};\n bridge.prototype = parent.prototype;\n\n klass.prototype = new bridge();\n extend(klass.prototype, methods);\n\n return klass;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/class.js\n ** module id = 7\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = function(dest, source, overwrite) {\n if (!source) return dest;\n for (var key in source) {\n if (!source.hasOwnProperty(key)) continue;\n if (dest.hasOwnProperty(key) && overwrite === false) continue;\n if (dest[key] !== source[key])\n dest[key] = source[key];\n }\n return dest;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/extend.js\n ** module id = 8\n ** module chunks = 0\n **/","'use strict';\n\nvar asap = require('asap');\n\nvar PENDING = 0,\n FULFILLED = 1,\n REJECTED = 2;\n\nvar RETURN = function(x) { return x },\n THROW = function(x) { throw x };\n\nvar Promise = function(task) {\n this._state = PENDING;\n this._onFulfilled = [];\n this._onRejected = [];\n\n if (typeof task !== 'function') return;\n var self = this;\n\n task(function(value) { resolve(self, value) },\n function(reason) { reject(self, reason) });\n};\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n var next = new Promise();\n registerOnFulfilled(this, onFulfilled, next);\n registerOnRejected(this, onRejected, next);\n return next;\n};\n\nPromise.prototype.catch = function(onRejected) {\n return this.then(null, onRejected);\n};\n\nvar registerOnFulfilled = function(promise, onFulfilled, next) {\n if (typeof onFulfilled !== 'function') onFulfilled = RETURN;\n var handler = function(value) { invoke(onFulfilled, value, next) };\n\n if (promise._state === PENDING) {\n promise._onFulfilled.push(handler);\n } else if (promise._state === FULFILLED) {\n handler(promise._value);\n }\n};\n\nvar registerOnRejected = function(promise, onRejected, next) {\n if (typeof onRejected !== 'function') onRejected = THROW;\n var handler = function(reason) { invoke(onRejected, reason, next) };\n\n if (promise._state === PENDING) {\n promise._onRejected.push(handler);\n } else if (promise._state === REJECTED) {\n handler(promise._reason);\n }\n};\n\nvar invoke = function(fn, value, next) {\n asap(function() { _invoke(fn, value, next) });\n};\n\nvar _invoke = function(fn, value, next) {\n var outcome;\n\n try {\n outcome = fn(value);\n } catch (error) {\n return reject(next, error);\n }\n\n if (outcome === next) {\n reject(next, new TypeError('Recursive promise chain detected'));\n } else {\n resolve(next, outcome);\n }\n};\n\nvar resolve = function(promise, value) {\n var called = false, type, then;\n\n try {\n type = typeof value;\n then = value !== null && (type === 'function' || type === 'object') && value.then;\n\n if (typeof then !== 'function') return fulfill(promise, value);\n\n then.call(value, function(v) {\n if (!(called ^ (called = true))) return;\n resolve(promise, v);\n }, function(r) {\n if (!(called ^ (called = true))) return;\n reject(promise, r);\n });\n } catch (error) {\n if (!(called ^ (called = true))) return;\n reject(promise, error);\n }\n};\n\nvar fulfill = function(promise, value) {\n if (promise._state !== PENDING) return;\n\n promise._state = FULFILLED;\n promise._value = value;\n promise._onRejected = [];\n\n var onFulfilled = promise._onFulfilled, fn;\n while (fn = onFulfilled.shift()) fn(value);\n};\n\nvar reject = function(promise, reason) {\n if (promise._state !== PENDING) return;\n\n promise._state = REJECTED;\n promise._reason = reason;\n promise._onFulfilled = [];\n\n var onRejected = promise._onRejected, fn;\n while (fn = onRejected.shift()) fn(reason);\n};\n\nPromise.resolve = function(value) {\n return new Promise(function(resolve, reject) { resolve(value) });\n};\n\nPromise.reject = function(reason) {\n return new Promise(function(resolve, reject) { reject(reason) });\n};\n\nPromise.all = function(promises) {\n return new Promise(function(resolve, reject) {\n var list = [], n = promises.length, i;\n\n if (n === 0) return resolve(list);\n\n for (i = 0; i < n; i++) (function(promise, i) {\n Promise.resolve(promise).then(function(value) {\n list[i] = value;\n if (--n === 0) resolve(list);\n }, reject);\n })(promises[i], i);\n });\n};\n\nPromise.race = function(promises) {\n return new Promise(function(resolve, reject) {\n for (var i = 0, n = promises.length; i < n; i++)\n Promise.resolve(promises[i]).then(resolve, reject);\n });\n};\n\nPromise.deferred = Promise.pending = function() {\n var tuple = {};\n\n tuple.promise = new Promise(function(resolve, reject) {\n tuple.resolve = resolve;\n tuple.reject = reject;\n });\n return tuple;\n};\n\nmodule.exports = Promise;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/promise.js\n ** module id = 9\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = {\n isURI: function(uri) {\n return uri && uri.protocol && uri.host && uri.path;\n },\n\n isSameOrigin: function(uri) {\n return uri.protocol === location.protocol &&\n uri.hostname === location.hostname &&\n uri.port === location.port;\n },\n\n parse: function(url) {\n if (typeof url !== 'string') return url;\n var uri = {}, parts, query, pairs, i, n, data;\n\n var consume = function(name, pattern) {\n url = url.replace(pattern, function(match) {\n uri[name] = match;\n return '';\n });\n uri[name] = uri[name] || '';\n };\n\n consume('protocol', /^[a-z]+\\:/i);\n consume('host', /^\\/\\/[^\\/\\?#]+/);\n\n if (!/^\\//.test(url) && !uri.host)\n url = location.pathname.replace(/[^\\/]*$/, '') + url;\n\n consume('pathname', /^[^\\?#]*/);\n consume('search', /^\\?[^#]*/);\n consume('hash', /^#.*/);\n\n uri.protocol = uri.protocol || location.protocol;\n\n if (uri.host) {\n uri.host = uri.host.substr(2);\n parts = uri.host.split(':');\n uri.hostname = parts[0];\n uri.port = parts[1] || '';\n } else {\n uri.host = location.host;\n uri.hostname = location.hostname;\n uri.port = location.port;\n }\n\n uri.pathname = uri.pathname || '/';\n uri.path = uri.pathname + uri.search;\n\n query = uri.search.replace(/^\\?/, '');\n pairs = query ? query.split('&') : [];\n data = {};\n\n for (i = 0, n = pairs.length; i < n; i++) {\n parts = pairs[i].split('=');\n data[decodeURIComponent(parts[0] || '')] = decodeURIComponent(parts[1] || '');\n }\n\n uri.query = data;\n\n uri.href = this.stringify(uri);\n return uri;\n },\n\n stringify: function(uri) {\n var string = uri.protocol + '//' + uri.hostname;\n if (uri.port) string += ':' + uri.port;\n string += uri.pathname + this.queryString(uri.query) + (uri.hash || '');\n return string;\n },\n\n queryString: function(query) {\n var pairs = [];\n for (var key in query) {\n if (!query.hasOwnProperty(key)) continue;\n pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(query[key]));\n }\n if (pairs.length === 0) return '';\n return '?' + pairs.join('&');\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/uri.js\n ** module id = 10\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = {\n commonElement: function(lista, listb) {\n for (var i = 0, n = lista.length; i < n; i++) {\n if (this.indexOf(listb, lista[i]) !== -1)\n return lista[i];\n }\n return null;\n },\n\n indexOf: function(list, needle) {\n if (list.indexOf) return list.indexOf(needle);\n\n for (var i = 0, n = list.length; i < n; i++) {\n if (list[i] === needle) return i;\n }\n return -1;\n },\n\n map: function(object, callback, context) {\n if (object.map) return object.map(callback, context);\n var result = [];\n\n if (object instanceof Array) {\n for (var i = 0, n = object.length; i < n; i++) {\n result.push(callback.call(context || null, object[i], i));\n }\n } else {\n for (var key in object) {\n if (!object.hasOwnProperty(key)) continue;\n result.push(callback.call(context || null, key, object[key]));\n }\n }\n return result;\n },\n\n filter: function(array, callback, context) {\n if (array.filter) return array.filter(callback, context);\n var result = [];\n for (var i = 0, n = array.length; i < n; i++) {\n if (callback.call(context || null, array[i], i))\n result.push(array[i]);\n }\n return result;\n },\n\n asyncEach: function(list, iterator, callback, context) {\n var n = list.length,\n i = -1,\n calls = 0,\n looping = false;\n\n var iterate = function() {\n calls -= 1;\n i += 1;\n if (i === n) return callback && callback.call(context);\n iterator(list[i], resume);\n };\n\n var loop = function() {\n if (looping) return;\n looping = true;\n while (calls > 0) iterate();\n looping = false;\n };\n\n var resume = function() {\n calls += 1;\n loop();\n };\n resume();\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/array.js\n ** module id = 11\n ** module chunks = 0\n **/","'use strict';\n\nvar Event = {\n _registry: [],\n\n on: function(element, eventName, callback, context) {\n var wrapped = function() { callback.call(context) };\n\n if (element.addEventListener)\n element.addEventListener(eventName, wrapped, false);\n else\n element.attachEvent('on' + eventName, wrapped);\n\n this._registry.push({\n _element: element,\n _type: eventName,\n _callback: callback,\n _context: context,\n _handler: wrapped\n });\n },\n\n detach: function(element, eventName, callback, context) {\n var i = this._registry.length, register;\n while (i--) {\n register = this._registry[i];\n\n if ((element && element !== register._element) ||\n (eventName && eventName !== register._type) ||\n (callback && callback !== register._callback) ||\n (context && context !== register._context))\n continue;\n\n if (register._element.removeEventListener)\n register._element.removeEventListener(register._type, register._handler, false);\n else\n register._element.detachEvent('on' + register._type, register._handler);\n\n this._registry.splice(i,1);\n register = null;\n }\n }\n};\n\nif (global.onunload !== undefined)\n Event.on(global, 'unload', Event.detach, Event);\n\nmodule.exports = {\n Event: Event\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/browser/event.js\n ** module id = 12\n ** module chunks = 0\n **/","'use strict';\n\nvar array = require('./array');\n\nmodule.exports = function(options, validKeys) {\n for (var key in options) {\n if (array.indexOf(validKeys, key) < 0)\n throw new Error('Unrecognized option: ' + key);\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/validate_options.js\n ** module id = 13\n ** module chunks = 0\n **/","'use strict';\n\nvar Promise = require('../util/promise');\n\nmodule.exports = {\n then: function(callback, errback) {\n var self = this;\n if (!this._promise)\n this._promise = new Promise(function(resolve, reject) {\n self._resolve = resolve;\n self._reject = reject;\n });\n\n if (arguments.length === 0)\n return this._promise;\n else\n return this._promise.then(callback, errback);\n },\n\n callback: function(callback, context) {\n return this.then(function(value) { callback.call(context, value) });\n },\n\n errback: function(callback, context) {\n return this.then(null, function(reason) { callback.call(context, reason) });\n },\n\n timeout: function(seconds, message) {\n this.then();\n var self = this;\n this._timer = global.setTimeout(function() {\n self._reject(message);\n }, seconds * 1000);\n },\n\n setDeferredStatus: function(status, value) {\n if (this._timer) global.clearTimeout(this._timer);\n\n this.then();\n\n if (status === 'succeeded')\n this._resolve(value);\n else if (status === 'failed')\n this._reject(value);\n else\n delete this._promise;\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/mixins/deferrable.js\n ** module id = 14\n ** module chunks = 0\n **/","'use strict';\n\nvar extend = require('../util/extend'),\n EventEmitter = require('../util/event_emitter');\n\nvar Publisher = {\n countListeners: function(eventType) {\n return this.listeners(eventType).length;\n },\n\n bind: function(eventType, listener, context) {\n var slice = Array.prototype.slice,\n handler = function() { listener.apply(context, slice.call(arguments)) };\n\n this._listeners = this._listeners || [];\n this._listeners.push([eventType, listener, context, handler]);\n return this.on(eventType, handler);\n },\n\n unbind: function(eventType, listener, context) {\n this._listeners = this._listeners || [];\n var n = this._listeners.length, tuple;\n\n while (n--) {\n tuple = this._listeners[n];\n if (tuple[0] !== eventType) continue;\n if (listener && (tuple[1] !== listener || tuple[2] !== context)) continue;\n this._listeners.splice(n, 1);\n this.removeListener(eventType, tuple[3]);\n }\n }\n};\n\nextend(Publisher, EventEmitter.prototype);\nPublisher.trigger = Publisher.emit;\n\nmodule.exports = Publisher;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/mixins/publisher.js\n ** module id = 15\n ** module chunks = 0\n **/","/*\nCopyright Joyent, Inc. and other Node contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nvar isArray = typeof Array.isArray === 'function'\n ? Array.isArray\n : function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]'\n }\n;\nfunction indexOf (xs, x) {\n if (xs.indexOf) return xs.indexOf(x);\n for (var i = 0; i < xs.length; i++) {\n if (x === xs[i]) return i;\n }\n return -1;\n}\n\nfunction EventEmitter() {}\nmodule.exports = EventEmitter;\n\nEventEmitter.prototype.emit = function(type) {\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events || !this._events.error ||\n (isArray(this._events.error) && !this._events.error.length))\n {\n if (arguments[1] instanceof Error) {\n throw arguments[1]; // Unhandled 'error' event\n } else {\n throw new Error(\"Uncaught, unspecified 'error' event.\");\n }\n return false;\n }\n }\n\n if (!this._events) return false;\n var handler = this._events[type];\n if (!handler) return false;\n\n if (typeof handler == 'function') {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n var args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n return true;\n\n } else if (isArray(handler)) {\n var args = Array.prototype.slice.call(arguments, 1);\n\n var listeners = handler.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i].apply(this, args);\n }\n return true;\n\n } else {\n return false;\n }\n};\n\n// EventEmitter is defined in src/node_events.cc\n// EventEmitter.prototype.emit() is also defined there.\nEventEmitter.prototype.addListener = function(type, listener) {\n if ('function' !== typeof listener) {\n throw new Error('addListener only takes instances of Function');\n }\n\n if (!this._events) this._events = {};\n\n // To avoid recursion in the case that type == \"newListeners\"! Before\n // adding it to the listeners, first emit \"newListeners\".\n this.emit('newListener', type, listener);\n\n if (!this._events[type]) {\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n } else if (isArray(this._events[type])) {\n // If we've already got an array, just append.\n this._events[type].push(listener);\n } else {\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n var self = this;\n self.on(type, function g() {\n self.removeListener(type, g);\n listener.apply(this, arguments);\n });\n\n return this;\n};\n\nEventEmitter.prototype.removeListener = function(type, listener) {\n if ('function' !== typeof listener) {\n throw new Error('removeListener only takes instances of Function');\n }\n\n // does not use listeners(), so no side effect of creating _events[type]\n if (!this._events || !this._events[type]) return this;\n\n var list = this._events[type];\n\n if (isArray(list)) {\n var i = indexOf(list, listener);\n if (i < 0) return this;\n list.splice(i, 1);\n if (list.length == 0)\n delete this._events[type];\n } else if (this._events[type] === listener) {\n delete this._events[type];\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n if (arguments.length === 0) {\n this._events = {};\n return this;\n }\n\n // does not use listeners(), so no side effect of creating _events[type]\n if (type && this._events && this._events[type]) this._events[type] = null;\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n if (!this._events) this._events = {};\n if (!this._events[type]) this._events[type] = [];\n if (!isArray(this._events[type])) {\n this._events[type] = [this._events[type]];\n }\n return this._events[type];\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/event_emitter.js\n ** module id = 16\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n extend = require('../util/extend'),\n Publisher = require('../mixins/publisher'),\n Grammar = require('./grammar');\n\nvar Channel = Class({\n initialize: function(name) {\n this.id = this.name = name;\n },\n\n push: function(message) {\n this.trigger('message', message);\n },\n\n isUnused: function() {\n return this.countListeners('message') === 0;\n }\n});\n\nextend(Channel.prototype, Publisher);\n\nextend(Channel, {\n HANDSHAKE: '/meta/handshake',\n CONNECT: '/meta/connect',\n SUBSCRIBE: '/meta/subscribe',\n UNSUBSCRIBE: '/meta/unsubscribe',\n DISCONNECT: '/meta/disconnect',\n\n META: 'meta',\n SERVICE: 'service',\n\n expand: function(name) {\n var segments = this.parse(name),\n channels = ['/**', name];\n\n var copy = segments.slice();\n copy[copy.length - 1] = '*';\n channels.push(this.unparse(copy));\n\n for (var i = 1, n = segments.length; i < n; i++) {\n copy = segments.slice(0, i);\n copy.push('**');\n channels.push(this.unparse(copy));\n }\n\n return channels;\n },\n\n isValid: function(name) {\n return Grammar.CHANNEL_NAME.test(name) ||\n Grammar.CHANNEL_PATTERN.test(name);\n },\n\n parse: function(name) {\n if (!this.isValid(name)) return null;\n return name.split('/').slice(1);\n },\n\n unparse: function(segments) {\n return '/' + segments.join('/');\n },\n\n isMeta: function(name) {\n var segments = this.parse(name);\n return segments ? (segments[0] === this.META) : null;\n },\n\n isService: function(name) {\n var segments = this.parse(name);\n return segments ? (segments[0] === this.SERVICE) : null;\n },\n\n isSubscribable: function(name) {\n if (!this.isValid(name)) return null;\n return !this.isMeta(name) && !this.isService(name);\n },\n\n Set: Class({\n initialize: function() {\n this._channels = {};\n },\n\n getKeys: function() {\n var keys = [];\n for (var key in this._channels) keys.push(key);\n return keys;\n },\n\n remove: function(name) {\n delete this._channels[name];\n },\n\n hasSubscription: function(name) {\n return this._channels.hasOwnProperty(name);\n },\n\n subscribe: function(names, subscription) {\n var name;\n for (var i = 0, n = names.length; i < n; i++) {\n name = names[i];\n var channel = this._channels[name] = this._channels[name] || new Channel(name);\n channel.bind('message', subscription);\n }\n },\n\n unsubscribe: function(name, subscription) {\n var channel = this._channels[name];\n if (!channel) return false;\n channel.unbind('message', subscription);\n\n if (channel.isUnused()) {\n this.remove(name);\n return true;\n } else {\n return false;\n }\n },\n\n distributeMessage: function(message) {\n var channels = Channel.expand(message.channel);\n\n for (var i = 0, n = channels.length; i < n; i++) {\n var channel = this._channels[channels[i]];\n if (channel) channel.trigger('message', message);\n }\n }\n })\n});\n\nmodule.exports = Channel;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/channel.js\n ** module id = 17\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = {\n CHANNEL_NAME: /^\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+(\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+)*$/,\n CHANNEL_PATTERN: /^(\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+)*\\/\\*{1,2}$/,\n ERROR: /^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*(,(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*)$/,\n VERSION: /^([0-9])+(\\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\\-|\\_))*)*$/\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/grammar.js\n ** module id = 18\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n cookies = require('../util/cookies'),\n extend = require('../util/extend'),\n Logging = require('../mixins/logging'),\n Publisher = require('../mixins/publisher'),\n Transport = require('../transport'),\n Scheduler = require('./scheduler');\n\nvar Dispatcher = Class({ className: 'Dispatcher',\n MAX_REQUEST_SIZE: 2048,\n DEFAULT_RETRY: 5,\n\n UP: 1,\n DOWN: 2,\n\n initialize: function(client, endpoint, options) {\n this._client = client;\n this.endpoint = URI.parse(endpoint);\n this._alternates = options.endpoints || {};\n\n this.cookies = cookies.CookieJar && new cookies.CookieJar();\n this._disabled = [];\n this._envelopes = {};\n this.headers = {};\n this.retry = options.retry || this.DEFAULT_RETRY;\n this._scheduler = options.scheduler || Scheduler;\n this._state = 0;\n this.transports = {};\n this.wsExtensions = [];\n\n this.proxy = options.proxy || {};\n if (typeof this._proxy === 'string') this._proxy = {origin: this._proxy};\n\n var exts = options.websocketExtensions;\n if (exts) {\n exts = [].concat(exts);\n for (var i = 0, n = exts.length; i < n; i++)\n this.addWebsocketExtension(exts[i]);\n }\n\n this.tls = options.tls || {};\n this.tls.ca = this.tls.ca || options.ca;\n\n for (var type in this._alternates)\n this._alternates[type] = URI.parse(this._alternates[type]);\n\n this.maxRequestSize = this.MAX_REQUEST_SIZE;\n },\n\n endpointFor: function(connectionType) {\n return this._alternates[connectionType] || this.endpoint;\n },\n\n addWebsocketExtension: function(extension) {\n this.wsExtensions.push(extension);\n },\n\n disable: function(feature) {\n this._disabled.push(feature);\n },\n\n setHeader: function(name, value) {\n this.headers[name] = value;\n },\n\n close: function() {\n var transport = this._transport;\n delete this._transport;\n if (transport) transport.close();\n },\n\n getConnectionTypes: function() {\n return Transport.getConnectionTypes();\n },\n\n selectTransport: function(transportTypes) {\n Transport.get(this, transportTypes, this._disabled, function(transport) {\n this.debug('Selected ? transport for ?', transport.connectionType, URI.stringify(transport.endpoint));\n\n if (transport === this._transport) return;\n if (this._transport) this._transport.close();\n\n this._transport = transport;\n this.connectionType = transport.connectionType;\n }, this);\n },\n\n sendMessage: function(message, timeout, options) {\n options = options || {};\n\n var id = message.id,\n attempts = options.attempts,\n deadline = options.deadline && new Date().getTime() + (options.deadline * 1000),\n envelope = this._envelopes[id],\n scheduler;\n\n if (!envelope) {\n scheduler = new this._scheduler(message, {timeout: timeout, interval: this.retry, attempts: attempts, deadline: deadline});\n envelope = this._envelopes[id] = {message: message, scheduler: scheduler};\n }\n\n this._sendEnvelope(envelope);\n },\n\n _sendEnvelope: function(envelope) {\n if (!this._transport) return;\n if (envelope.request || envelope.timer) return;\n\n var message = envelope.message,\n scheduler = envelope.scheduler,\n self = this;\n\n if (!scheduler.isDeliverable()) {\n scheduler.abort();\n delete this._envelopes[message.id];\n return;\n }\n\n envelope.timer = global.setTimeout(function() {\n self.handleError(message);\n }, scheduler.getTimeout() * 1000);\n\n scheduler.send();\n envelope.request = this._transport.sendMessage(message);\n },\n\n handleResponse: function(reply) {\n var envelope = this._envelopes[reply.id];\n\n if (reply.successful !== undefined && envelope) {\n envelope.scheduler.succeed();\n delete this._envelopes[reply.id];\n global.clearTimeout(envelope.timer);\n }\n\n this.trigger('message', reply);\n\n if (this._state === this.UP) return;\n this._state = this.UP;\n this._client.trigger('transport:up');\n },\n\n handleError: function(message, immediate) {\n var envelope = this._envelopes[message.id],\n request = envelope && envelope.request,\n self = this;\n\n if (!request) return;\n\n request.then(function(req) {\n if (req && req.abort) req.abort();\n });\n\n var scheduler = envelope.scheduler;\n scheduler.fail();\n\n global.clearTimeout(envelope.timer);\n envelope.request = envelope.timer = null;\n\n if (immediate) {\n this._sendEnvelope(envelope);\n } else {\n envelope.timer = global.setTimeout(function() {\n envelope.timer = null;\n self._sendEnvelope(envelope);\n }, scheduler.getInterval() * 1000);\n }\n\n if (this._state === this.DOWN) return;\n this._state = this.DOWN;\n this._client.trigger('transport:down');\n }\n});\n\nDispatcher.create = function(client, endpoint, options) {\n return new Dispatcher(client, endpoint, options);\n};\n\nextend(Dispatcher.prototype, Publisher);\nextend(Dispatcher.prototype, Logging);\n\nmodule.exports = Dispatcher;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/dispatcher.js\n ** module id = 19\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = {};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/cookies/browser_cookies.js\n ** module id = 20\n ** module chunks = 0\n **/","'use strict';\n\nvar Transport = require('./transport');\n\nTransport.register('websocket', require('./web_socket'));\nTransport.register('eventsource', require('./event_source'));\nTransport.register('long-polling', require('./xhr'));\nTransport.register('cross-origin-long-polling', require('./cors'));\nTransport.register('callback-polling', require('./jsonp'));\n\nmodule.exports = Transport;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/transport/browser_transports.js\n ** module id = 21\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n Cookie = require('../util/cookies').Cookie,\n Promise = require('../util/promise'),\n URI = require('../util/uri'),\n array = require('../util/array'),\n extend = require('../util/extend'),\n Logging = require('../mixins/logging'),\n Timeouts = require('../mixins/timeouts'),\n Channel = require('../protocol/channel');\n\nvar Transport = extend(Class({ className: 'Transport',\n DEFAULT_PORTS: {'http:': 80, 'https:': 443, 'ws:': 80, 'wss:': 443},\n MAX_DELAY: 0,\n\n batching: true,\n\n initialize: function(dispatcher, endpoint) {\n this._dispatcher = dispatcher;\n this.endpoint = endpoint;\n this._outbox = [];\n this._proxy = extend({}, this._dispatcher.proxy);\n\n if (!this._proxy.origin)\n this._proxy.origin = this._findProxy();\n },\n\n close: function() {},\n\n encode: function(messages) {\n return '';\n },\n\n sendMessage: function(message) {\n this.debug('Client ? sending message to ?: ?',\n this._dispatcher.clientId, URI.stringify(this.endpoint), message);\n\n if (!this.batching) return Promise.resolve(this.request([message]));\n\n this._outbox.push(message);\n this._flushLargeBatch();\n\n if (message.channel === Channel.HANDSHAKE)\n return this._publish(0.01);\n\n if (message.channel === Channel.CONNECT)\n this._connectMessage = message;\n\n return this._publish(this.MAX_DELAY);\n },\n\n _makePromise: function() {\n var self = this;\n\n this._requestPromise = this._requestPromise || new Promise(function(resolve) {\n self._resolvePromise = resolve;\n });\n },\n\n _publish: function(delay) {\n this._makePromise();\n\n this.addTimeout('publish', delay, function() {\n this._flush();\n delete this._requestPromise;\n }, this);\n\n return this._requestPromise;\n },\n\n _flush: function() {\n this.removeTimeout('publish');\n\n if (this._outbox.length > 1 && this._connectMessage)\n this._connectMessage.advice = {timeout: 0};\n\n this._resolvePromise(this.request(this._outbox));\n\n this._connectMessage = null;\n this._outbox = [];\n },\n\n _flushLargeBatch: function() {\n var string = this.encode(this._outbox);\n if (string.length < this._dispatcher.maxRequestSize) return;\n var last = this._outbox.pop();\n\n this._makePromise();\n this._flush();\n\n if (last) this._outbox.push(last);\n },\n\n _receive: function(replies) {\n if (!replies) return;\n replies = [].concat(replies);\n\n this.debug('Client ? received from ? via ?: ?',\n this._dispatcher.clientId, URI.stringify(this.endpoint), this.connectionType, replies);\n\n for (var i = 0, n = replies.length; i < n; i++)\n this._dispatcher.handleResponse(replies[i]);\n },\n\n _handleError: function(messages, immediate) {\n messages = [].concat(messages);\n\n this.debug('Client ? failed to send to ? via ?: ?',\n this._dispatcher.clientId, URI.stringify(this.endpoint), this.connectionType, messages);\n\n for (var i = 0, n = messages.length; i < n; i++)\n this._dispatcher.handleError(messages[i]);\n },\n\n _getCookies: function() {\n var cookies = this._dispatcher.cookies,\n url = URI.stringify(this.endpoint);\n\n if (!cookies) return '';\n\n return array.map(cookies.getCookiesSync(url), function(cookie) {\n return cookie.cookieString();\n }).join('; ');\n },\n\n _storeCookies: function(setCookie) {\n var cookies = this._dispatcher.cookies,\n url = URI.stringify(this.endpoint),\n cookie;\n\n if (!setCookie || !cookies) return;\n setCookie = [].concat(setCookie);\n\n for (var i = 0, n = setCookie.length; i < n; i++) {\n cookie = Cookie.parse(setCookie[i]);\n cookies.setCookieSync(cookie, url);\n }\n },\n\n _findProxy: function() {\n if (typeof process === 'undefined') return undefined;\n\n var protocol = this.endpoint.protocol;\n if (!protocol) return undefined;\n\n var name = protocol.replace(/:$/, '').toLowerCase() + '_proxy',\n upcase = name.toUpperCase(),\n env = process.env,\n keys, proxy;\n\n if (name === 'http_proxy' && env.REQUEST_METHOD) {\n keys = Object.keys(env).filter(function(k) { return /^http_proxy$/i.test(k) });\n if (keys.length === 1) {\n if (keys[0] === name && env[upcase] === undefined)\n proxy = env[name];\n } else if (keys.length > 1) {\n proxy = env[name];\n }\n proxy = proxy || env['CGI_' + upcase];\n } else {\n proxy = env[name] || env[upcase];\n if (proxy && !env[name])\n console.warn('The environment variable ' + upcase +\n ' is discouraged. Use ' + name + '.');\n }\n return proxy;\n }\n\n}), {\n get: function(dispatcher, allowed, disabled, callback, context) {\n var endpoint = dispatcher.endpoint;\n\n array.asyncEach(this._transports, function(pair, resume) {\n var connType = pair[0], klass = pair[1],\n connEndpoint = dispatcher.endpointFor(connType);\n\n if (array.indexOf(disabled, connType) >= 0)\n return resume();\n\n if (array.indexOf(allowed, connType) < 0) {\n klass.isUsable(dispatcher, connEndpoint, function() {});\n return resume();\n }\n\n klass.isUsable(dispatcher, connEndpoint, function(isUsable) {\n if (!isUsable) return resume();\n var transport = klass.hasOwnProperty('create') ? klass.create(dispatcher, connEndpoint) : new klass(dispatcher, connEndpoint);\n callback.call(context, transport);\n });\n }, function() {\n throw new Error('Could not find a usable connection type for ' + URI.stringify(endpoint));\n });\n },\n\n register: function(type, klass) {\n this._transports.push([type, klass]);\n klass.prototype.connectionType = type;\n },\n\n getConnectionTypes: function() {\n return array.map(this._transports, function(t) { return t[0] });\n },\n\n _transports: []\n});\n\nextend(Transport.prototype, Logging);\nextend(Transport.prototype, Timeouts);\n\nmodule.exports = Transport;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/transport/transport.js\n ** module id = 22\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = {\n addTimeout: function(name, delay, callback, context) {\n this._timeouts = this._timeouts || {};\n if (this._timeouts.hasOwnProperty(name)) return;\n var self = this;\n this._timeouts[name] = global.setTimeout(function() {\n delete self._timeouts[name];\n callback.call(context);\n }, 1000 * delay);\n },\n\n removeTimeout: function(name) {\n this._timeouts = this._timeouts || {};\n var timeout = this._timeouts[name];\n if (!timeout) return;\n global.clearTimeout(timeout);\n delete this._timeouts[name];\n },\n\n removeAllTimeouts: function() {\n this._timeouts = this._timeouts || {};\n for (var name in this._timeouts) this.removeTimeout(name);\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/mixins/timeouts.js\n ** module id = 23\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n Promise = require('../util/promise'),\n Set = require('../util/set'),\n URI = require('../util/uri'),\n browser = require('../util/browser'),\n copyObject = require('../util/copy_object'),\n extend = require('../util/extend'),\n toJSON = require('../util/to_json'),\n ws = require('../util/websocket'),\n Deferrable = require('../mixins/deferrable'),\n Transport = require('./transport');\n\nvar WebSocket = extend(Class(Transport, {\n UNCONNECTED: 1,\n CONNECTING: 2,\n CONNECTED: 3,\n\n batching: false,\n\n isUsable: function(callback, context) {\n this.callback(function() { callback.call(context, true) });\n this.errback(function() { callback.call(context, false) });\n this.connect();\n },\n\n request: function(messages) {\n this._pending = this._pending || new Set();\n for (var i = 0, n = messages.length; i < n; i++) this._pending.add(messages[i]);\n\n var self = this;\n\n var promise = new Promise(function(resolve, reject) {\n self.callback(function(socket) {\n if (!socket || socket.readyState !== 1) return;\n socket.send(toJSON(messages));\n resolve(socket);\n });\n\n self.connect();\n });\n\n return {\n abort: function() { promise.then(function(ws) { ws.close() }) }\n };\n },\n\n connect: function() {\n if (WebSocket._unloaded) return;\n\n this._state = this._state || this.UNCONNECTED;\n if (this._state !== this.UNCONNECTED) return;\n this._state = this.CONNECTING;\n\n var socket = this._createSocket();\n if (!socket) return this.setDeferredStatus('failed');\n\n var self = this;\n\n socket.onopen = function() {\n if (socket.headers) self._storeCookies(socket.headers['set-cookie']);\n self._socket = socket;\n self._state = self.CONNECTED;\n self._everConnected = true;\n self._ping();\n self.setDeferredStatus('succeeded', socket);\n };\n\n var closed = false;\n socket.onclose = socket.onerror = function() {\n if (closed) return;\n closed = true;\n\n var wasConnected = (self._state === self.CONNECTED);\n socket.onopen = socket.onclose = socket.onerror = socket.onmessage = null;\n\n delete self._socket;\n self._state = self.UNCONNECTED;\n self.removeTimeout('ping');\n\n var pending = self._pending ? self._pending.toArray() : [];\n delete self._pending;\n\n if (wasConnected || self._everConnected) {\n self.setDeferredStatus('unknown');\n self._handleError(pending, wasConnected);\n } else {\n self.setDeferredStatus('failed');\n }\n };\n\n socket.onmessage = function(event) {\n var replies;\n try { replies = JSON.parse(event.data) } catch (error) {}\n\n if (!replies) return;\n\n replies = [].concat(replies);\n\n for (var i = 0, n = replies.length; i < n; i++) {\n if (replies[i].successful === undefined) continue;\n self._pending.remove(replies[i]);\n }\n self._receive(replies);\n };\n },\n\n close: function() {\n if (!this._socket) return;\n this._socket.close();\n },\n\n _createSocket: function() {\n var url = WebSocket.getSocketUrl(this.endpoint),\n headers = this._dispatcher.headers,\n extensions = this._dispatcher.wsExtensions,\n cookie = this._getCookies(),\n tls = this._dispatcher.tls,\n options = {extensions: extensions, headers: headers, proxy: this._proxy, tls: tls};\n\n if (cookie !== '') options.headers['Cookie'] = cookie;\n\n return ws.create(url, [], options);\n },\n\n _ping: function() {\n if (!this._socket || this._socket.readyState !== 1) return;\n this._socket.send('[]');\n this.addTimeout('ping', this._dispatcher.timeout / 2, this._ping, this);\n }\n\n}), {\n PROTOCOLS: {\n 'http:': 'ws:',\n 'https:': 'wss:'\n },\n\n create: function(dispatcher, endpoint) {\n var sockets = dispatcher.transports.websocket = dispatcher.transports.websocket || {};\n sockets[endpoint.href] = sockets[endpoint.href] || new this(dispatcher, endpoint);\n return sockets[endpoint.href];\n },\n\n getSocketUrl: function(endpoint) {\n endpoint = copyObject(endpoint);\n endpoint.protocol = this.PROTOCOLS[endpoint.protocol];\n return URI.stringify(endpoint);\n },\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n this.create(dispatcher, endpoint).isUsable(callback, context);\n }\n});\n\nextend(WebSocket.prototype, Deferrable);\n\nif (browser.Event && global.onbeforeunload !== undefined)\n browser.Event.on(global, 'beforeunload', function() { WebSocket._unloaded = true });\n\nmodule.exports = WebSocket;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/transport/web_socket.js\n ** module id = 24\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('./class');\n\nmodule.exports = Class({\n initialize: function() {\n this._index = {};\n },\n\n add: function(item) {\n var key = (item.id !== undefined) ? item.id : item;\n if (this._index.hasOwnProperty(key)) return false;\n this._index[key] = item;\n return true;\n },\n\n forEach: function(block, context) {\n for (var key in this._index) {\n if (this._index.hasOwnProperty(key))\n block.call(context, this._index[key]);\n }\n },\n\n isEmpty: function() {\n for (var key in this._index) {\n if (this._index.hasOwnProperty(key)) return false;\n }\n return true;\n },\n\n member: function(item) {\n for (var key in this._index) {\n if (this._index[key] === item) return true;\n }\n return false;\n },\n\n remove: function(item) {\n var key = (item.id !== undefined) ? item.id : item;\n var removed = this._index[key];\n delete this._index[key];\n return removed;\n },\n\n toArray: function() {\n var array = [];\n this.forEach(function(item) { array.push(item) });\n return array;\n }\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/set.js\n ** module id = 25\n ** module chunks = 0\n **/","'use strict';\n\nvar copyObject = function(object) {\n var clone, i, key;\n if (object instanceof Array) {\n clone = [];\n i = object.length;\n while (i--) clone[i] = copyObject(object[i]);\n return clone;\n } else if (typeof object === 'object') {\n clone = (object === null) ? null : {};\n for (key in object) clone[key] = copyObject(object[key]);\n return clone;\n } else {\n return object;\n }\n};\n\nmodule.exports = copyObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/copy_object.js\n ** module id = 26\n ** module chunks = 0\n **/","'use strict';\n\nvar WS = global.MozWebSocket || global.WebSocket;\n\nmodule.exports = {\n create: function(url, protocols, options) {\n return new WS(url);\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/util/websocket/browser_websocket.js\n ** module id = 27\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n copyObject = require('../util/copy_object'),\n extend = require('../util/extend'),\n Deferrable = require('../mixins/deferrable'),\n Transport = require('./transport'),\n XHR = require('./xhr');\n\nvar EventSource = extend(Class(Transport, {\n initialize: function(dispatcher, endpoint) {\n Transport.prototype.initialize.call(this, dispatcher, endpoint);\n if (!global.EventSource) return this.setDeferredStatus('failed');\n\n this._xhr = new XHR(dispatcher, endpoint);\n\n endpoint = copyObject(endpoint);\n endpoint.pathname += '/' + dispatcher.clientId;\n\n var socket = new global.EventSource(URI.stringify(endpoint)),\n self = this;\n\n socket.onopen = function() {\n self._everConnected = true;\n self.setDeferredStatus('succeeded');\n };\n\n socket.onerror = function() {\n if (self._everConnected) {\n self._handleError([]);\n } else {\n self.setDeferredStatus('failed');\n socket.close();\n }\n };\n\n socket.onmessage = function(event) {\n var replies;\n try { replies = JSON.parse(event.data) } catch (error) {}\n\n if (replies)\n self._receive(replies);\n else\n self._handleError([]);\n };\n\n this._socket = socket;\n },\n\n close: function() {\n if (!this._socket) return;\n this._socket.onopen = this._socket.onerror = this._socket.onmessage = null;\n this._socket.close();\n delete this._socket;\n },\n\n isUsable: function(callback, context) {\n this.callback(function() { callback.call(context, true) });\n this.errback(function() { callback.call(context, false) });\n },\n\n encode: function(messages) {\n return this._xhr.encode(messages);\n },\n\n request: function(messages) {\n return this._xhr.request(messages);\n }\n\n}), {\n isUsable: function(dispatcher, endpoint, callback, context) {\n var id = dispatcher.clientId;\n if (!id) return callback.call(context, false);\n\n XHR.isUsable(dispatcher, endpoint, function(usable) {\n if (!usable) return callback.call(context, false);\n this.create(dispatcher, endpoint).isUsable(callback, context);\n }, this);\n },\n\n create: function(dispatcher, endpoint) {\n var sockets = dispatcher.transports.eventsource = dispatcher.transports.eventsource || {},\n id = dispatcher.clientId;\n\n var url = copyObject(endpoint);\n url.pathname += '/' + (id || '');\n url = URI.stringify(url);\n\n sockets[url] = sockets[url] || new this(dispatcher, endpoint);\n return sockets[url];\n }\n});\n\nextend(EventSource.prototype, Deferrable);\n\nmodule.exports = EventSource;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/transport/event_source.js\n ** module id = 28\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n browser = require('../util/browser'),\n extend = require('../util/extend'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar XHR = extend(Class(Transport, {\n encode: function(messages) {\n return toJSON(messages);\n },\n\n request: function(messages) {\n var href = this.endpoint.href,\n self = this,\n xhr;\n\n // Prefer XMLHttpRequest over ActiveXObject if they both exist\n if (global.XMLHttpRequest) {\n xhr = new XMLHttpRequest();\n } else if (global.ActiveXObject) {\n xhr = new ActiveXObject('Microsoft.XMLHTTP');\n } else {\n return this._handleError(messages);\n }\n\n xhr.open('POST', href, true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.setRequestHeader('Pragma', 'no-cache');\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\n var headers = this._dispatcher.headers;\n for (var key in headers) {\n if (!headers.hasOwnProperty(key)) continue;\n xhr.setRequestHeader(key, headers[key]);\n }\n\n var abort = function() { xhr.abort() };\n if (global.onbeforeunload !== undefined)\n browser.Event.on(global, 'beforeunload', abort);\n\n xhr.onreadystatechange = function() {\n if (!xhr || xhr.readyState !== 4) return;\n\n var replies = null,\n status = xhr.status,\n text = xhr.responseText,\n successful = (status >= 200 && status < 300) || status === 304 || status === 1223;\n\n if (global.onbeforeunload !== undefined)\n browser.Event.detach(global, 'beforeunload', abort);\n\n xhr.onreadystatechange = function() {};\n xhr = null;\n\n if (!successful) return self._handleError(messages);\n\n try {\n replies = JSON.parse(text);\n } catch (error) {}\n\n if (replies)\n self._receive(replies);\n else\n self._handleError(messages);\n };\n\n xhr.send(this.encode(messages));\n return xhr;\n }\n}), {\n isUsable: function(dispatcher, endpoint, callback, context) {\n var usable = (navigator.product === 'ReactNative')\n || URI.isSameOrigin(endpoint);\n\n callback.call(context, usable);\n }\n});\n\nmodule.exports = XHR;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/transport/xhr.js\n ** module id = 29\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n Set = require('../util/set'),\n URI = require('../util/uri'),\n extend = require('../util/extend'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar CORS = extend(Class(Transport, {\n encode: function(messages) {\n return 'message=' + encodeURIComponent(toJSON(messages));\n },\n\n request: function(messages) {\n var xhrClass = global.XDomainRequest ? XDomainRequest : XMLHttpRequest,\n xhr = new xhrClass(),\n id = ++CORS._id,\n headers = this._dispatcher.headers,\n self = this,\n key;\n\n xhr.open('POST', URI.stringify(this.endpoint), true);\n\n if (xhr.setRequestHeader) {\n xhr.setRequestHeader('Pragma', 'no-cache');\n for (key in headers) {\n if (!headers.hasOwnProperty(key)) continue;\n xhr.setRequestHeader(key, headers[key]);\n }\n }\n\n var cleanUp = function() {\n if (!xhr) return false;\n CORS._pending.remove(id);\n xhr.onload = xhr.onerror = xhr.ontimeout = xhr.onprogress = null;\n xhr = null;\n };\n\n xhr.onload = function() {\n var replies;\n try { replies = JSON.parse(xhr.responseText) } catch (error) {}\n\n cleanUp();\n\n if (replies)\n self._receive(replies);\n else\n self._handleError(messages);\n };\n\n xhr.onerror = xhr.ontimeout = function() {\n cleanUp();\n self._handleError(messages);\n };\n\n xhr.onprogress = function() {};\n\n if (xhrClass === global.XDomainRequest)\n CORS._pending.add({id: id, xhr: xhr});\n\n xhr.send(this.encode(messages));\n return xhr;\n }\n}), {\n _id: 0,\n _pending: new Set(),\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n if (URI.isSameOrigin(endpoint))\n return callback.call(context, false);\n\n if (global.XDomainRequest)\n return callback.call(context, endpoint.protocol === location.protocol);\n\n if (global.XMLHttpRequest) {\n var xhr = new XMLHttpRequest();\n return callback.call(context, xhr.withCredentials !== undefined);\n }\n return callback.call(context, false);\n }\n});\n\nmodule.exports = CORS;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/transport/cors.js\n ** module id = 30\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n copyObject = require('../util/copy_object'),\n extend = require('../util/extend'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar JSONP = extend(Class(Transport, {\n encode: function(messages) {\n var url = copyObject(this.endpoint);\n url.query.message = toJSON(messages);\n url.query.jsonp = '__jsonp' + JSONP._cbCount + '__';\n return URI.stringify(url);\n },\n\n request: function(messages) {\n var head = document.getElementsByTagName('head')[0],\n script = document.createElement('script'),\n callbackName = JSONP.getCallbackName(),\n endpoint = copyObject(this.endpoint),\n self = this;\n\n endpoint.query.message = toJSON(messages);\n endpoint.query.jsonp = callbackName;\n\n var cleanup = function() {\n if (!global[callbackName]) return false;\n global[callbackName] = undefined;\n try { delete global[callbackName] } catch (error) {}\n script.parentNode.removeChild(script);\n };\n\n global[callbackName] = function(replies) {\n cleanup();\n self._receive(replies);\n };\n\n script.type = 'text/javascript';\n script.src = URI.stringify(endpoint);\n head.appendChild(script);\n\n script.onerror = function() {\n cleanup();\n self._handleError(messages);\n };\n\n return {abort: cleanup};\n }\n}), {\n _cbCount: 0,\n\n getCallbackName: function() {\n this._cbCount += 1;\n return '__jsonp' + this._cbCount + '__';\n },\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n callback.call(context, true);\n }\n});\n\nmodule.exports = JSONP;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/transport/jsonp.js\n ** module id = 31\n ** module chunks = 0\n **/","'use strict';\n\nvar extend = require('../util/extend');\n\nvar Scheduler = function(message, options) {\n this.message = message;\n this.options = options;\n this.attempts = 0;\n};\n\nextend(Scheduler.prototype, {\n getTimeout: function() {\n return this.options.timeout;\n },\n\n getInterval: function() {\n return this.options.interval;\n },\n\n isDeliverable: function() {\n var attempts = this.options.attempts,\n made = this.attempts,\n deadline = this.options.deadline,\n now = new Date().getTime();\n\n if (attempts !== undefined && made >= attempts)\n return false;\n\n if (deadline !== undefined && now > deadline)\n return false;\n\n return true;\n },\n\n send: function() {\n this.attempts += 1;\n },\n\n succeed: function() {},\n\n fail: function() {},\n\n abort: function() {}\n});\n\nmodule.exports = Scheduler;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/scheduler.js\n ** module id = 32\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n Grammar = require('./grammar');\n\nvar Error = Class({\n initialize: function(code, params, message) {\n this.code = code;\n this.params = Array.prototype.slice.call(params);\n this.message = message;\n },\n\n toString: function() {\n return this.code + ':' +\n this.params.join(',') + ':' +\n this.message;\n }\n});\n\nError.parse = function(message) {\n message = message || '';\n if (!Grammar.ERROR.test(message)) return new Error(null, [], message);\n\n var parts = message.split(':'),\n code = parseInt(parts[0]),\n params = parts[1].split(','),\n message = parts[2];\n\n return new Error(code, params, message);\n};\n\n// http://code.google.com/p/cometd/wiki/BayeuxCodes\nvar errors = {\n versionMismatch: [300, 'Version mismatch'],\n conntypeMismatch: [301, 'Connection types not supported'],\n extMismatch: [302, 'Extension mismatch'],\n badRequest: [400, 'Bad request'],\n clientUnknown: [401, 'Unknown client'],\n parameterMissing: [402, 'Missing required parameter'],\n channelForbidden: [403, 'Forbidden channel'],\n channelUnknown: [404, 'Unknown channel'],\n channelInvalid: [405, 'Invalid channel'],\n extUnknown: [406, 'Unknown extension'],\n publishFailed: [407, 'Failed to publish'],\n serverError: [500, 'Internal server error']\n};\n\nfor (var name in errors)\n (function(name) {\n Error[name] = function() {\n return new Error(errors[name][0], arguments, errors[name][1]).toString();\n };\n })(name);\n\nmodule.exports = Error;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/error.js\n ** module id = 33\n ** module chunks = 0\n **/","'use strict';\n\nvar extend = require('../util/extend'),\n Logging = require('../mixins/logging');\n\nvar Extensible = {\n addExtension: function(extension) {\n this._extensions = this._extensions || [];\n this._extensions.push(extension);\n if (extension.added) extension.added(this);\n },\n\n removeExtension: function(extension) {\n if (!this._extensions) return;\n var i = this._extensions.length;\n while (i--) {\n if (this._extensions[i] !== extension) continue;\n this._extensions.splice(i,1);\n if (extension.removed) extension.removed(this);\n }\n },\n\n pipeThroughExtensions: function(stage, message, request, callback, context) {\n this.debug('Passing through ? extensions: ?', stage, message);\n\n if (!this._extensions) return callback.call(context, message);\n var extensions = this._extensions.slice();\n\n var pipe = function(message) {\n if (!message) return callback.call(context, message);\n\n var extension = extensions.shift();\n if (!extension) return callback.call(context, message);\n\n var fn = extension[stage];\n if (!fn) return pipe(message);\n\n if (fn.length >= 3) extension[stage](message, request, pipe);\n else extension[stage](message, pipe);\n };\n pipe(message);\n }\n};\n\nextend(Extensible, Logging);\n\nmodule.exports = Extensible;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/extensible.js\n ** module id = 34\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n Deferrable = require('../mixins/deferrable');\n\nmodule.exports = Class(Deferrable);\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/publication.js\n ** module id = 35\n ** module chunks = 0\n **/","'use strict';\n\nvar Class = require('../util/class'),\n extend = require('../util/extend'),\n Deferrable = require('../mixins/deferrable');\n\nvar Subscription = Class({\n initialize: function(client, channels, callback, context) {\n this._client = client;\n this._channels = channels;\n this._callback = callback;\n this._context = context;\n this._cancelled = false;\n },\n\n withChannel: function(callback, context) {\n this._withChannel = [callback, context];\n return this;\n },\n\n apply: function(context, args) {\n var message = args[0];\n\n if (this._callback)\n this._callback.call(this._context, message.data);\n\n if (this._withChannel)\n this._withChannel[0].call(this._withChannel[1], message.channel, message.data);\n },\n\n cancel: function() {\n if (this._cancelled) return;\n this._client.unsubscribe(this._channels, this);\n this._cancelled = true;\n },\n\n unsubscribe: function() {\n this.cancel();\n }\n});\n\nextend(Subscription.prototype, Deferrable);\n\nmodule.exports = Subscription;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/protocol/subscription.js\n ** module id = 36\n ** module chunks = 0\n **/"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://Faye/webpack/bootstrap","webpack://Faye/./node_modules/asap/browser-asap.js","webpack://Faye/./node_modules/asap/browser-raw.js","webpack://Faye/(webpack)/buildin/global.js","webpack://Faye/./src/faye_browser.js","webpack://Faye/./src/mixins/deferrable.js","webpack://Faye/./src/mixins/logging.js","webpack://Faye/./src/mixins/publisher.js","webpack://Faye/./src/mixins/timeouts.js","webpack://Faye/./src/protocol/channel.js","webpack://Faye/./src/protocol/client.js","webpack://Faye/./src/protocol/dispatcher.js","webpack://Faye/./src/protocol/error.js","webpack://Faye/./src/protocol/extensible.js","webpack://Faye/./src/protocol/grammar.js","webpack://Faye/./src/protocol/publication.js","webpack://Faye/./src/protocol/scheduler.js","webpack://Faye/./src/protocol/subscription.js","webpack://Faye/./src/transport/browser_transports.js","webpack://Faye/./src/transport/cors.js","webpack://Faye/./src/transport/event_source.js","webpack://Faye/./src/transport/jsonp.js","webpack://Faye/./src/transport/transport.js","webpack://Faye/./src/transport/web_socket.js","webpack://Faye/./src/transport/xhr.js","webpack://Faye/./src/util/array.js","webpack://Faye/./src/util/assign.js","webpack://Faye/./src/util/browser/event.js","webpack://Faye/./src/util/class.js","webpack://Faye/./src/util/constants.js","webpack://Faye/./src/util/cookies/browser_cookies.js","webpack://Faye/./src/util/copy_object.js","webpack://Faye/./src/util/event_emitter.js","webpack://Faye/./src/util/promise.js","webpack://Faye/./src/util/set.js","webpack://Faye/./src/util/to_json.js","webpack://Faye/./src/util/uri.js","webpack://Faye/./src/util/validate_options.js","webpack://Faye/./src/util/websocket/browser_websocket.js"],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;;AAEb;AACA,cAAc,mBAAO,CAAC,iDAAO;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;;;;;;;;;;;;ACjEA,8CAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,kBAAkB;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,oBAAoB;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC9NA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;;;;;;ACnBa;;AAEb,gBAAgB,mBAAO,CAAC,iDAAkB;AAC1C,gBAAgB,mBAAO,CAAC,iDAAkB;;AAE1C;AACA;;AAEA,cAAc,mBAAO,CAAC,mDAAmB;AACzC,cAAc,mBAAO,CAAC,yDAAsB;AAC5C;;AAEA;;AAEA;;;;;;;;;;;;;ACdA,8CAAa;;AAEb,gBAAgB,mBAAO,CAAC,8CAAiB;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,sCAAsC,gCAAgC;AACtE,GAAG;;AAEH;AACA,6CAA6C,iCAAiC;AAC9E,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC/Ca;;AAEb,aAAa,mBAAO,CAAC,8CAAiB;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;;;;;;;;;;;;AC9Ca;;AAEb,mBAAmB,mBAAO,CAAC,4CAAgB;AAC3C,mBAAmB,mBAAO,CAAC,0DAAuB;;AAElD;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,8BAA8B;;AAE9B;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;;;;ACpCA,8CAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACzBa;;AAEb,gBAAgB,mBAAO,CAAC,0CAAe;AACvC,gBAAgB,mBAAO,CAAC,4CAAgB;AACxC,gBAAgB,mBAAO,CAAC,sDAAqB;AAC7C,gBAAgB,mBAAO,CAAC,4CAAW;;AAEnC;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wCAAwC,OAAO;AAC/C;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;;AAED;;;;;;;;;;;;;ACnIA,8CAAa;;AAEb,sBAAsB,mBAAO,CAAC,iDAAM;AACpC,sBAAsB,mBAAO,CAAC,0CAAe;AAC7C,sBAAsB,mBAAO,CAAC,8CAAiB;AAC/C,sBAAsB,mBAAO,CAAC,0CAAe;AAC7C,sBAAsB,mBAAO,CAAC,oDAAiB;AAC/C,sBAAsB,mBAAO,CAAC,kDAAmB;AACjD,sBAAsB,mBAAO,CAAC,4CAAgB;AAC9C,sBAAsB,mBAAO,CAAC,gEAA0B;AACxD,sBAAsB,mBAAO,CAAC,wDAAsB;AACpD,sBAAsB,mBAAO,CAAC,kDAAmB;AACjD,sBAAsB,mBAAO,CAAC,sDAAqB;AACnD,sBAAsB,mBAAO,CAAC,4CAAW;AACzC,sBAAsB,mBAAO,CAAC,kDAAc;AAC5C,sBAAsB,mBAAO,CAAC,wCAAS;AACvC,sBAAsB,mBAAO,CAAC,kDAAc;AAC5C,sBAAsB,mBAAO,CAAC,oDAAe;AAC7C,sBAAsB,mBAAO,CAAC,sDAAgB;;AAE9C,oBAAoB;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK,IAAI;;AAET;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,uCAAuC,yBAAyB;;AAEhE,OAAO;AACP;AACA,sCAAsC,oCAAoC;AAC1E;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC,kCAAkC;;AAE1E;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK,IAAI;AACT,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK,IAAI;AACT;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,OAAO,IAAI;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,OAAO,IAAI;AACX;;AAEA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kEAAkE;AAClE,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,iBAAiB;AACnD;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;;;;;;;;;;;;;;AChYA,8CAAa;;AAEb,gBAAgB,mBAAO,CAAC,0CAAe;AACvC,gBAAgB,mBAAO,CAAC,sCAAa;AACrC,gBAAgB,mBAAO,CAAC,8DAAiB;AACzC,gBAAgB,mBAAO,CAAC,4CAAgB;AACxC,gBAAgB,mBAAO,CAAC,kDAAmB;AAC3C,gBAAgB,mBAAO,CAAC,sDAAqB;AAC7C,gBAAgB,mBAAO,CAAC,2DAAc;AACtC,gBAAgB,mBAAO,CAAC,gDAAa;;AAErC,wBAAwB;AACxB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wDAAwD;;AAExD;AACA;AACA;AACA,sCAAsC,OAAO;AAC7C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,iFAAiF;AACjI,yCAAyC;AACzC;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;;;;;ACzLa;;AAEb,cAAc,mBAAO,CAAC,0CAAe;AACrC,cAAc,mBAAO,CAAC,4CAAW;;AAEjC;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;;;;;;;;;;;;ACtDa;;AAEb,cAAc,mBAAO,CAAC,4CAAgB;AACtC,cAAc,mBAAO,CAAC,kDAAmB;;AAEzC;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;;;;;;;;;;;;AC9Ca;;AAEb;AACA;AACA,oFAAoF,IAAI;AACxF;AACA;AACA;;;;;;;;;;;;;ACPa;;AAEb,iBAAiB,mBAAO,CAAC,0CAAe;AACxC,iBAAiB,mBAAO,CAAC,wDAAsB;;AAE/C;;;;;;;;;;;;;ACLa;;AAEb,aAAa,mBAAO,CAAC,4CAAgB;;AAErC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH,wBAAwB;;AAExB,qBAAqB;;AAErB;AACA,CAAC;;AAED;;;;;;;;;;;;;AC7Ca;;AAEb,iBAAiB,mBAAO,CAAC,0CAAe;AACxC,iBAAiB,mBAAO,CAAC,4CAAgB;AACzC,iBAAiB,mBAAO,CAAC,wDAAsB;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;;;;;;;;;;;;AC3Ca;;AAEb,gBAAgB,mBAAO,CAAC,iDAAa;;AAErC,gCAAgC,mBAAO,CAAC,mDAAc;AACtD,kCAAkC,mBAAO,CAAC,uDAAgB;AAC1D,mCAAmC,mBAAO,CAAC,qCAAO;AAClD,gDAAgD,mBAAO,CAAC,uCAAQ;AAChE,uCAAuC,mBAAO,CAAC,yCAAS;;AAExD;;;;;;;;;;;;;ACVA,8CAAa;;AAEb,gBAAgB,mBAAO,CAAC,0CAAe;AACvC,gBAAgB,mBAAO,CAAC,sCAAa;AACrC,gBAAgB,mBAAO,CAAC,sCAAa;AACrC,gBAAgB,mBAAO,CAAC,4CAAgB;AACxC,gBAAgB,mBAAO,CAAC,8CAAiB;AACzC,gBAAgB,mBAAO,CAAC,iDAAa;;AAErC;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,yCAAyC;;AAEpD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,yBAAyB,mBAAmB;;AAE5C;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;;;;;;;;;;;;;ACpFA,8CAAa;;AAEb,iBAAiB,mBAAO,CAAC,0CAAe;AACxC,iBAAiB,mBAAO,CAAC,sCAAa;AACtC,iBAAiB,mBAAO,CAAC,sDAAqB;AAC9C,iBAAiB,mBAAO,CAAC,4CAAgB;AACzC,iBAAiB,mBAAO,CAAC,wDAAsB;AAC/C,iBAAiB,mBAAO,CAAC,iDAAa;AACtC,iBAAiB,mBAAO,CAAC,qCAAO;;AAEhC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,mCAAmC;;AAE9C;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,8BAA8B,+BAA+B;AAC7D,6BAA6B,gCAAgC;AAC7D,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA,6FAA6F;AAC7F;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;;;;;;;;;;;;;AChGA,8CAAa;;AAEb,iBAAiB,mBAAO,CAAC,0CAAe;AACxC,iBAAiB,mBAAO,CAAC,sCAAa;AACtC,iBAAiB,mBAAO,CAAC,sDAAqB;AAC9C,iBAAiB,mBAAO,CAAC,4CAAgB;AACzC,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C,iBAAiB,mBAAO,CAAC,iDAAa;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,8BAA8B;AACzC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;AACA,CAAC;AACD;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,CAAC;;AAED;;;;;;;;;;;;;;AC/Da;;AAEb,eAAe,mBAAO,CAAC,0CAAe;AACtC,eAAe,mBAAO,CAAC,8DAAiB;AACxC,eAAe,mBAAO,CAAC,8CAAiB;AACxC,eAAe,mBAAO,CAAC,0CAAe;AACtC,eAAe,mBAAO,CAAC,4CAAgB;AACvC,eAAe,mBAAO,CAAC,kDAAmB;AAC1C,eAAe,mBAAO,CAAC,oDAAoB;AAC3C,eAAe,mBAAO,CAAC,sDAAqB;;AAE5C,8BAA8B;AAC9B,kBAAkB,qDAAqD;AACvE;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gCAAgC;;AAEhC;AACA;AACA,GAAG;;AAEH,sBAAsB;;AAEtB;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,GAAG;;AAEH;AACA;;AAEA;AACA,qCAAqC;;AAErC;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA,uCAAuC,OAAO;AAC9C;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA,wCAAwC,OAAO;AAC/C;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK,SAAS;AACd,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;;AAEA,yCAAyC,OAAO;AAChD;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD,iCAAiC;AACnF;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,8DAA8D;AAC9D;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA,oDAAoD,cAAc;AAClE,GAAG;;AAEH;AACA;;AAEA,mBAAmB,6BAA6B;AAChD;AACA,GAAG;;AAEH;AACA,CAAC;;AAED;AACA;;AAEA;;;;;;;;;;;;;ACxNA,8CAAa;;AAEb,iBAAiB,mBAAO,CAAC,0CAAe;AACxC,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C,iBAAiB,mBAAO,CAAC,sCAAa;AACtC,iBAAiB,mBAAO,CAAC,sCAAa;AACtC,iBAAiB,mBAAO,CAAC,oDAAiB;AAC1C,iBAAiB,mBAAO,CAAC,sDAAqB;AAC9C,iBAAiB,mBAAO,CAAC,4CAAgB;AACzC,iBAAiB,mBAAO,CAAC,8CAAiB;AAC1C,iBAAiB,mBAAO,CAAC,oEAAmB;AAC5C,iBAAiB,mBAAO,CAAC,wDAAsB;AAC/C,iBAAiB,mBAAO,CAAC,iDAAa;;AAEtC;AACA;AACA;AACA;;AAEA;;AAEA;AACA,8BAA8B,+BAA+B;AAC7D,6BAA6B,gCAAgC;AAC7D;AACA,GAAG;;AAEH;AACA;AACA,wCAAwC,OAAO;;AAE/C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA,KAAK;;AAEL;AACA,yBAAyB,4BAA4B,aAAa;AAClE;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,WAAW,mCAAmC;;AAE9C;;AAEA;;AAEA,yCAAyC,OAAO;AAChD;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;;AAEtB;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;;;;;;;;;;;;;;AChKA,8CAAa;;AAEb,gBAAgB,mBAAO,CAAC,0CAAe;AACvC,gBAAgB,mBAAO,CAAC,sCAAa;AACrC,gBAAgB,mBAAO,CAAC,oDAAiB;AACzC,gBAAgB,mBAAO,CAAC,4CAAgB;AACxC,gBAAgB,mBAAO,CAAC,8CAAiB;AACzC,gBAAgB,mBAAO,CAAC,iDAAa;;AAErC;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B;AAC5B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;;;;;;;;;;;;;;ACjFa;;AAEb;AACA;AACA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,oCAAoC,OAAO;AAC3C;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA,wCAAwC,OAAO;AAC/C;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACzEa;;AAEb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;;;;;;;;;;;;ACfA,8CAAa;;AAEb;AACA;;AAEA;AACA,8BAA8B;;AAE9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;ACjDa;;AAEb,aAAa,mBAAO,CAAC,sCAAU;;AAE/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;ACtBA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACTa;;AAEb;;;;;;;;;;;;;ACFa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;;;;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;;AAEA;AACA,yCAAyC,OAAO;AAChD;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC1Ka;;AAEb,WAAW,mBAAO,CAAC,iDAAM;;AAEzB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,gDAAgD,iBAAiB;AACjE;;AAEA;AACA,gDAAgD,iBAAiB;AACjE;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA,eAAe,OAAO;AACtB,GAAG;AACH;;AAEA;AACA;AACA,wCAAwC,OAAO;AAC/C;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;;;;;;;;;;;;AC3Ka;;AAEb,YAAY,mBAAO,CAAC,oCAAS;;AAE7B;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,iCAAiC,mBAAmB;AACpD;AACA;AACA,CAAC;;;;;;;;;;;;;ACjDY;;AAEb;;AAEA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;;;ACRa;;AAEb;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,gBAAgB;;AAEhB;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,iCAAiC,OAAO;AACxC;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACzFa;;AAEb,YAAY,mBAAO,CAAC,oCAAS;;AAE7B;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACTA,8CAAa;;AAEb;;AAEA;AACA;AACA;AACA;AACA;AACA","file":"build/client/faye-browser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/faye_browser.js\");\n","\"use strict\";\n\n// rawAsap provides everything we need except exception management.\nvar rawAsap = require(\"./raw\");\n// RawTasks are recycled to reduce GC churn.\nvar freeTasks = [];\n// We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n if (pendingErrors.length) {\n throw pendingErrors.shift();\n }\n}\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nmodule.exports = asap;\nfunction asap(task) {\n var rawTask;\n if (freeTasks.length) {\n rawTask = freeTasks.pop();\n } else {\n rawTask = new RawTask();\n }\n rawTask.task = task;\n rawAsap(rawTask);\n}\n\n// We wrap tasks with recyclable task objects. A task object implements\n// `call`, just like a function.\nfunction RawTask() {\n this.task = null;\n}\n\n// The sole purpose of wrapping the task is to catch the exception and recycle\n// the task object after its single use.\nRawTask.prototype.call = function () {\n try {\n this.task.call();\n } catch (error) {\n if (asap.onerror) {\n // This hook exists purely for testing purposes.\n // Its name will be periodically randomized to break any code that\n // depends on its existence.\n asap.onerror(error);\n } else {\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n pendingErrors.push(error);\n requestErrorThrow();\n }\n } finally {\n this.task = null;\n freeTasks[freeTasks.length] = this;\n }\n};\n","\"use strict\";\n\n// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nmodule.exports = rawAsap;\nfunction rawAsap(task) {\n if (!queue.length) {\n requestFlush();\n flushing = true;\n }\n // Equivalent to push, but avoids a function call.\n queue[queue.length] = task;\n}\n\nvar queue = [];\n// Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\nvar flushing = false;\n// `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\nvar requestFlush;\n// The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\nvar index = 0;\n// If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\nvar capacity = 1024;\n\n// The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\nfunction flush() {\n while (index < queue.length) {\n var currentIndex = index;\n // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n index = index + 1;\n queue[currentIndex].call();\n // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n if (index > capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n queue[scan] = queue[scan + index];\n }\n queue.length -= index;\n index = 0;\n }\n }\n queue.length = 0;\n index = 0;\n flushing = false;\n}\n\n// `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\nvar scope = typeof global !== \"undefined\" ? global : self;\nvar BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;\n\n// MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nif (typeof BrowserMutationObserver === \"function\") {\n requestFlush = makeRequestCallFromMutationObserver(flush);\n\n// MessageChannels are desirable because they give direct access to the HTML\n// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\n} else {\n requestFlush = makeRequestCallFromTimer(flush);\n}\n\n// `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\nrawAsap.requestFlush = requestFlush;\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nfunction makeRequestCallFromMutationObserver(callback) {\n var toggle = 1;\n var observer = new BrowserMutationObserver(callback);\n var node = document.createTextNode(\"\");\n observer.observe(node, {characterData: true});\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\nfunction makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n var timeoutHandle = setTimeout(handleTimer, 0);\n // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n var intervalHandle = setInterval(handleTimer, 50);\n\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n}\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","'use strict';\n\nvar constants = require('./util/constants'),\n Logging = require('./mixins/logging');\n\nvar Faye = {\n VERSION: constants.VERSION,\n\n Client: require('./protocol/client'),\n Scheduler: require('./protocol/scheduler')\n};\n\nLogging.wrapper = Faye;\n\nmodule.exports = Faye;\n","'use strict';\n\nvar Promise = require('../util/promise');\n\nmodule.exports = {\n then: function(callback, errback) {\n var self = this;\n if (!this._promise)\n this._promise = new Promise(function(resolve, reject) {\n self._resolve = resolve;\n self._reject = reject;\n });\n\n if (arguments.length === 0)\n return this._promise;\n else\n return this._promise.then(callback, errback);\n },\n\n callback: function(callback, context) {\n return this.then(function(value) { callback.call(context, value) });\n },\n\n errback: function(callback, context) {\n return this.then(null, function(reason) { callback.call(context, reason) });\n },\n\n timeout: function(seconds, message) {\n this.then();\n var self = this;\n this._timer = global.setTimeout(function() {\n self._reject(message);\n }, seconds * 1000);\n },\n\n setDeferredStatus: function(status, value) {\n if (this._timer) global.clearTimeout(this._timer);\n\n this.then();\n\n if (status === 'succeeded')\n this._resolve(value);\n else if (status === 'failed')\n this._reject(value);\n else\n delete this._promise;\n }\n};\n","'use strict';\n\nvar toJSON = require('../util/to_json');\n\nvar Logging = {\n LOG_LEVELS: {\n fatal: 4,\n error: 3,\n warn: 2,\n info: 1,\n debug: 0\n },\n\n writeLog: function(messageArgs, level) {\n var logger = Logging.logger || (Logging.wrapper || Logging).logger;\n if (!logger) return;\n\n var args = Array.prototype.slice.apply(messageArgs),\n banner = '[Faye',\n klass = this.className,\n\n message = args.shift().replace(/\\?/g, function() {\n try {\n return toJSON(args.shift());\n } catch (error) {\n return '[Object]';\n }\n });\n\n if (klass) banner += '.' + klass;\n banner += '] ';\n\n if (typeof logger[level] === 'function')\n logger[level](banner + message);\n else if (typeof logger === 'function')\n logger(banner + message);\n }\n};\n\nfor (var key in Logging.LOG_LEVELS)\n (function(level) {\n Logging[level] = function() {\n this.writeLog(arguments, level);\n };\n })(key);\n\nmodule.exports = Logging;\n","'use strict';\n\nvar assign = require('../util/assign'),\n EventEmitter = require('../util/event_emitter');\n\nvar Publisher = {\n countListeners: function(eventType) {\n return this.listeners(eventType).length;\n },\n\n bind: function(eventType, listener, context) {\n var slice = Array.prototype.slice,\n handler = function() { listener.apply(context, slice.call(arguments)) };\n\n this._listeners = this._listeners || [];\n this._listeners.push([eventType, listener, context, handler]);\n return this.on(eventType, handler);\n },\n\n unbind: function(eventType, listener, context) {\n this._listeners = this._listeners || [];\n var n = this._listeners.length, tuple;\n\n while (n--) {\n tuple = this._listeners[n];\n if (tuple[0] !== eventType) continue;\n if (listener && (tuple[1] !== listener || tuple[2] !== context)) continue;\n this._listeners.splice(n, 1);\n this.removeListener(eventType, tuple[3]);\n }\n }\n};\n\nassign(Publisher, EventEmitter.prototype);\nPublisher.trigger = Publisher.emit;\n\nmodule.exports = Publisher;\n","'use strict';\n\nmodule.exports = {\n addTimeout: function(name, delay, callback, context) {\n this._timeouts = this._timeouts || {};\n if (this._timeouts.hasOwnProperty(name)) return;\n var self = this;\n this._timeouts[name] = global.setTimeout(function() {\n delete self._timeouts[name];\n callback.call(context);\n }, 1000 * delay);\n },\n\n removeTimeout: function(name) {\n this._timeouts = this._timeouts || {};\n var timeout = this._timeouts[name];\n if (!timeout) return;\n global.clearTimeout(timeout);\n delete this._timeouts[name];\n },\n\n removeAllTimeouts: function() {\n this._timeouts = this._timeouts || {};\n for (var name in this._timeouts) this.removeTimeout(name);\n }\n};\n","'use strict';\n\nvar Class = require('../util/class'),\n assign = require('../util/assign'),\n Publisher = require('../mixins/publisher'),\n Grammar = require('./grammar');\n\nvar Channel = Class({\n initialize: function(name) {\n this.id = this.name = name;\n },\n\n push: function(message) {\n this.trigger('message', message);\n },\n\n isUnused: function() {\n return this.countListeners('message') === 0;\n }\n});\n\nassign(Channel.prototype, Publisher);\n\nassign(Channel, {\n HANDSHAKE: '/meta/handshake',\n CONNECT: '/meta/connect',\n SUBSCRIBE: '/meta/subscribe',\n UNSUBSCRIBE: '/meta/unsubscribe',\n DISCONNECT: '/meta/disconnect',\n\n META: 'meta',\n SERVICE: 'service',\n\n expand: function(name) {\n var segments = this.parse(name),\n channels = ['/**', name];\n\n var copy = segments.slice();\n copy[copy.length - 1] = '*';\n channels.push(this.unparse(copy));\n\n for (var i = 1, n = segments.length; i < n; i++) {\n copy = segments.slice(0, i);\n copy.push('**');\n channels.push(this.unparse(copy));\n }\n\n return channels;\n },\n\n isValid: function(name) {\n return Grammar.CHANNEL_NAME.test(name) ||\n Grammar.CHANNEL_PATTERN.test(name);\n },\n\n parse: function(name) {\n if (!this.isValid(name)) return null;\n return name.split('/').slice(1);\n },\n\n unparse: function(segments) {\n return '/' + segments.join('/');\n },\n\n isMeta: function(name) {\n var segments = this.parse(name);\n return segments ? (segments[0] === this.META) : null;\n },\n\n isService: function(name) {\n var segments = this.parse(name);\n return segments ? (segments[0] === this.SERVICE) : null;\n },\n\n isSubscribable: function(name) {\n if (!this.isValid(name)) return null;\n return !this.isMeta(name) && !this.isService(name);\n },\n\n Set: Class({\n initialize: function() {\n this._channels = {};\n },\n\n getKeys: function() {\n var keys = [];\n for (var key in this._channels) keys.push(key);\n return keys;\n },\n\n remove: function(name) {\n delete this._channels[name];\n },\n\n hasSubscription: function(name) {\n return this._channels.hasOwnProperty(name);\n },\n\n subscribe: function(names, subscription) {\n var name;\n for (var i = 0, n = names.length; i < n; i++) {\n name = names[i];\n var channel = this._channels[name] = this._channels[name] || new Channel(name);\n channel.bind('message', subscription);\n }\n },\n\n unsubscribe: function(name, subscription) {\n var channel = this._channels[name];\n if (!channel) return false;\n channel.unbind('message', subscription);\n\n if (channel.isUnused()) {\n this.remove(name);\n return true;\n } else {\n return false;\n }\n },\n\n distributeMessage: function(message) {\n var channels = Channel.expand(message.channel);\n\n for (var i = 0, n = channels.length; i < n; i++) {\n var channel = this._channels[channels[i]];\n if (channel) channel.trigger('message', message);\n }\n }\n })\n});\n\nmodule.exports = Channel;\n","'use strict';\n\nvar asap = require('asap'),\n Class = require('../util/class'),\n Promise = require('../util/promise'),\n array = require('../util/array'),\n browser = require('../util/browser'),\n constants = require('../util/constants'),\n assign = require('../util/assign'),\n validateOptions = require('../util/validate_options'),\n Deferrable = require('../mixins/deferrable'),\n Logging = require('../mixins/logging'),\n Publisher = require('../mixins/publisher'),\n Channel = require('./channel'),\n Dispatcher = require('./dispatcher'),\n Error = require('./error'),\n Extensible = require('./extensible'),\n Publication = require('./publication'),\n Subscription = require('./subscription');\n\nvar Client = Class({ className: 'Client',\n UNCONNECTED: 1,\n CONNECTING: 2,\n CONNECTED: 3,\n DISCONNECTED: 4,\n\n HANDSHAKE: 'handshake',\n RETRY: 'retry',\n NONE: 'none',\n\n CONNECTION_TIMEOUT: 60,\n\n DEFAULT_ENDPOINT: '/bayeux',\n INTERVAL: 0,\n\n initialize: function(endpoint, options) {\n this.info('New client created for ?', endpoint);\n options = options || {};\n\n validateOptions(options, ['interval', 'timeout', 'endpoints', 'proxy', 'retry', 'scheduler', 'websocketExtensions', 'tls', 'ca']);\n\n this._channels = new Channel.Set();\n this._dispatcher = Dispatcher.create(this, endpoint || this.DEFAULT_ENDPOINT, options);\n\n this._messageId = 0;\n this._state = this.UNCONNECTED;\n\n this._responseCallbacks = {};\n\n this._advice = {\n reconnect: this.RETRY,\n interval: 1000 * (options.interval || this.INTERVAL),\n timeout: 1000 * (options.timeout || this.CONNECTION_TIMEOUT)\n };\n this._dispatcher.timeout = this._advice.timeout / 1000;\n\n this._dispatcher.bind('message', this._receiveMessage, this);\n\n if (browser.Event && global.onbeforeunload !== undefined)\n browser.Event.on(global, 'beforeunload', function() {\n if (array.indexOf(this._dispatcher._disabled, 'autodisconnect') < 0)\n this.disconnect();\n }, this);\n },\n\n addWebsocketExtension: function(extension) {\n return this._dispatcher.addWebsocketExtension(extension);\n },\n\n disable: function(feature) {\n return this._dispatcher.disable(feature);\n },\n\n setHeader: function(name, value) {\n return this._dispatcher.setHeader(name, value);\n },\n\n // Request\n // MUST include: * channel\n // * version\n // * supportedConnectionTypes\n // MAY include: * minimumVersion\n // * ext\n // * id\n //\n // Success Response Failed Response\n // MUST include: * channel MUST include: * channel\n // * version * successful\n // * supportedConnectionTypes * error\n // * clientId MAY include: * supportedConnectionTypes\n // * successful * advice\n // MAY include: * minimumVersion * version\n // * advice * minimumVersion\n // * ext * ext\n // * id * id\n // * authSuccessful\n handshake: function(callback, context) {\n if (this._advice.reconnect === this.NONE) return;\n if (this._state !== this.UNCONNECTED) return;\n\n this._state = this.CONNECTING;\n var self = this;\n\n this.info('Initiating handshake with ?', this._dispatcher.endpoint.href);\n this._dispatcher.selectTransport(constants.MANDATORY_CONNECTION_TYPES);\n\n this._sendMessage({\n channel: Channel.HANDSHAKE,\n version: constants.BAYEUX_VERSION,\n supportedConnectionTypes: this._dispatcher.getConnectionTypes()\n\n }, {}, function(response) {\n\n if (response.successful) {\n this._state = this.CONNECTED;\n this._dispatcher.clientId = response.clientId;\n\n this._dispatcher.selectTransport(response.supportedConnectionTypes);\n\n this.info('Handshake successful: ?', this._dispatcher.clientId);\n\n this.subscribe(this._channels.getKeys(), true);\n if (callback) asap(function() { callback.call(context) });\n\n } else {\n this.info('Handshake unsuccessful');\n global.setTimeout(function() { self.handshake(callback, context) }, this._dispatcher.retry * 1000);\n this._state = this.UNCONNECTED;\n }\n }, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * connectionType * clientId\n // MAY include: * ext MAY include: * error\n // * id * advice\n // * ext\n // * id\n // * timestamp\n connect: function(callback, context) {\n if (this._advice.reconnect === this.NONE) return;\n if (this._state === this.DISCONNECTED) return;\n\n if (this._state === this.UNCONNECTED)\n return this.handshake(function() { this.connect(callback, context) }, this);\n\n this.callback(callback, context);\n if (this._state !== this.CONNECTED) return;\n\n this.info('Calling deferred actions for ?', this._dispatcher.clientId);\n this.setDeferredStatus('succeeded');\n this.setDeferredStatus('unknown');\n\n if (this._connectRequest) return;\n this._connectRequest = true;\n\n this.info('Initiating connection for ?', this._dispatcher.clientId);\n\n this._sendMessage({\n channel: Channel.CONNECT,\n clientId: this._dispatcher.clientId,\n connectionType: this._dispatcher.connectionType\n\n }, {}, this._cycleConnection, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // MAY include: * ext * clientId\n // * id MAY include: * error\n // * ext\n // * id\n disconnect: function() {\n if (this._state !== this.CONNECTED) return;\n this._state = this.DISCONNECTED;\n\n this.info('Disconnecting ?', this._dispatcher.clientId);\n var promise = new Publication();\n\n this._sendMessage({\n channel: Channel.DISCONNECT,\n clientId: this._dispatcher.clientId\n\n }, {}, function(response) {\n if (response.successful) {\n this._dispatcher.close();\n promise.setDeferredStatus('succeeded');\n } else {\n promise.setDeferredStatus('failed', Error.parse(response.error));\n }\n }, this);\n\n this.info('Clearing channel listeners for ?', this._dispatcher.clientId);\n this._channels = new Channel.Set();\n\n return promise;\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * subscription * clientId\n // MAY include: * ext * subscription\n // * id MAY include: * error\n // * advice\n // * ext\n // * id\n // * timestamp\n subscribe: function(channel, callback, context) {\n if (channel instanceof Array)\n return array.map(channel, function(c) {\n return this.subscribe(c, callback, context);\n }, this);\n\n var subscription = new Subscription(this, channel, callback, context),\n force = (callback === true),\n hasSubscribe = this._channels.hasSubscription(channel);\n\n if (hasSubscribe && !force) {\n this._channels.subscribe([channel], subscription);\n subscription.setDeferredStatus('succeeded');\n return subscription;\n }\n\n this.connect(function() {\n this.info('Client ? attempting to subscribe to ?', this._dispatcher.clientId, channel);\n if (!force) this._channels.subscribe([channel], subscription);\n\n this._sendMessage({\n channel: Channel.SUBSCRIBE,\n clientId: this._dispatcher.clientId,\n subscription: channel\n\n }, {}, function(response) {\n if (!response.successful) {\n subscription.setDeferredStatus('failed', Error.parse(response.error));\n return this._channels.unsubscribe(channel, subscription);\n }\n\n var channels = [].concat(response.subscription);\n this.info('Subscription acknowledged for ? to ?', this._dispatcher.clientId, channels);\n subscription.setDeferredStatus('succeeded');\n }, this);\n }, this);\n\n return subscription;\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * subscription * clientId\n // MAY include: * ext * subscription\n // * id MAY include: * error\n // * advice\n // * ext\n // * id\n // * timestamp\n unsubscribe: function(channel, subscription) {\n if (channel instanceof Array)\n return array.map(channel, function(c) {\n return this.unsubscribe(c, subscription);\n }, this);\n\n var dead = this._channels.unsubscribe(channel, subscription);\n if (!dead) return;\n\n this.connect(function() {\n this.info('Client ? attempting to unsubscribe from ?', this._dispatcher.clientId, channel);\n\n this._sendMessage({\n channel: Channel.UNSUBSCRIBE,\n clientId: this._dispatcher.clientId,\n subscription: channel\n\n }, {}, function(response) {\n if (!response.successful) return;\n\n var channels = [].concat(response.subscription);\n this.info('Unsubscription acknowledged for ? from ?', this._dispatcher.clientId, channels);\n }, this);\n }, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * data * successful\n // MAY include: * clientId MAY include: * id\n // * id * error\n // * ext * ext\n publish: function(channel, data, options) {\n validateOptions(options || {}, ['attempts', 'deadline']);\n var publication = new Publication();\n\n this.connect(function() {\n this.info('Client ? queueing published message to ?: ?', this._dispatcher.clientId, channel, data);\n\n this._sendMessage({\n channel: channel,\n data: data,\n clientId: this._dispatcher.clientId\n\n }, options, function(response) {\n if (response.successful)\n publication.setDeferredStatus('succeeded');\n else\n publication.setDeferredStatus('failed', Error.parse(response.error));\n }, this);\n }, this);\n\n return publication;\n },\n\n _sendMessage: function(message, options, callback, context) {\n message.id = this._generateMessageId();\n\n var timeout = this._advice.timeout\n ? 1.2 * this._advice.timeout / 1000\n : 1.2 * this._dispatcher.retry;\n\n this.pipeThroughExtensions('outgoing', message, null, function(message) {\n if (!message) return;\n if (callback) this._responseCallbacks[message.id] = [callback, context];\n this._dispatcher.sendMessage(message, timeout, options || {});\n }, this);\n },\n\n _generateMessageId: function() {\n this._messageId += 1;\n if (this._messageId >= Math.pow(2,32)) this._messageId = 0;\n return this._messageId.toString(36);\n },\n\n _receiveMessage: function(message) {\n var id = message.id, callback;\n\n if (message.successful !== undefined) {\n callback = this._responseCallbacks[id];\n delete this._responseCallbacks[id];\n }\n\n this.pipeThroughExtensions('incoming', message, null, function(message) {\n if (!message) return;\n if (message.advice) this._handleAdvice(message.advice);\n this._deliverMessage(message);\n if (callback) callback[0].call(callback[1], message);\n }, this);\n },\n\n _handleAdvice: function(advice) {\n assign(this._advice, advice);\n this._dispatcher.timeout = this._advice.timeout / 1000;\n\n if (this._advice.reconnect === this.HANDSHAKE && this._state !== this.DISCONNECTED) {\n this._state = this.UNCONNECTED;\n this._dispatcher.clientId = null;\n this._cycleConnection();\n }\n },\n\n _deliverMessage: function(message) {\n if (!message.channel || message.data === undefined) return;\n this.info('Client ? calling listeners for ? with ?', this._dispatcher.clientId, message.channel, message.data);\n this._channels.distributeMessage(message);\n },\n\n _cycleConnection: function() {\n if (this._connectRequest) {\n this._connectRequest = null;\n this.info('Closed connection for ?', this._dispatcher.clientId);\n }\n var self = this;\n global.setTimeout(function() { self.connect() }, this._advice.interval);\n }\n});\n\nassign(Client.prototype, Deferrable);\nassign(Client.prototype, Publisher);\nassign(Client.prototype, Logging);\nassign(Client.prototype, Extensible);\n\nmodule.exports = Client;\n","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n cookies = require('../util/cookies'),\n assign = require('../util/assign'),\n Logging = require('../mixins/logging'),\n Publisher = require('../mixins/publisher'),\n Transport = require('../transport'),\n Scheduler = require('./scheduler');\n\nvar Dispatcher = Class({ className: 'Dispatcher',\n MAX_REQUEST_SIZE: 2048,\n DEFAULT_RETRY: 5,\n\n UP: 1,\n DOWN: 2,\n\n initialize: function(client, endpoint, options) {\n this._client = client;\n this.endpoint = URI.parse(endpoint);\n this._alternates = options.endpoints || {};\n\n this.cookies = cookies.CookieJar && new cookies.CookieJar();\n this._disabled = [];\n this._envelopes = {};\n this.headers = {};\n this.retry = options.retry || this.DEFAULT_RETRY;\n this._scheduler = options.scheduler || Scheduler;\n this._state = 0;\n this.transports = {};\n this.wsExtensions = [];\n\n this.proxy = options.proxy || {};\n if (typeof this._proxy === 'string') this._proxy = { origin: this._proxy };\n\n var exts = options.websocketExtensions;\n if (exts) {\n exts = [].concat(exts);\n for (var i = 0, n = exts.length; i < n; i++)\n this.addWebsocketExtension(exts[i]);\n }\n\n this.tls = options.tls || {};\n this.tls.ca = this.tls.ca || options.ca;\n\n for (var type in this._alternates)\n this._alternates[type] = URI.parse(this._alternates[type]);\n\n this.maxRequestSize = this.MAX_REQUEST_SIZE;\n },\n\n endpointFor: function(connectionType) {\n return this._alternates[connectionType] || this.endpoint;\n },\n\n addWebsocketExtension: function(extension) {\n this.wsExtensions.push(extension);\n },\n\n disable: function(feature) {\n this._disabled.push(feature);\n Transport.disable(feature);\n },\n\n setHeader: function(name, value) {\n this.headers[name] = value;\n },\n\n close: function() {\n var transport = this._transport;\n delete this._transport;\n if (transport) transport.close();\n },\n\n getConnectionTypes: function() {\n return Transport.getConnectionTypes();\n },\n\n selectTransport: function(transportTypes) {\n Transport.get(this, transportTypes, this._disabled, function(transport) {\n this.debug('Selected ? transport for ?', transport.connectionType, transport.endpoint.href);\n\n if (transport === this._transport) return;\n if (this._transport) this._transport.close();\n\n this._transport = transport;\n this.connectionType = transport.connectionType;\n }, this);\n },\n\n sendMessage: function(message, timeout, options) {\n options = options || {};\n\n var id = message.id,\n attempts = options.attempts,\n deadline = options.deadline && new Date().getTime() + (options.deadline * 1000),\n envelope = this._envelopes[id],\n scheduler;\n\n if (!envelope) {\n scheduler = new this._scheduler(message, { timeout: timeout, interval: this.retry, attempts: attempts, deadline: deadline });\n envelope = this._envelopes[id] = { message: message, scheduler: scheduler };\n }\n\n this._sendEnvelope(envelope);\n },\n\n _sendEnvelope: function(envelope) {\n if (!this._transport) return;\n if (envelope.request || envelope.timer) return;\n\n var message = envelope.message,\n scheduler = envelope.scheduler,\n self = this;\n\n if (!scheduler.isDeliverable()) {\n scheduler.abort();\n delete this._envelopes[message.id];\n return;\n }\n\n envelope.timer = global.setTimeout(function() {\n self.handleError(message);\n }, scheduler.getTimeout() * 1000);\n\n scheduler.send();\n envelope.request = this._transport.sendMessage(message);\n },\n\n handleResponse: function(reply) {\n var envelope = this._envelopes[reply.id];\n\n if (reply.successful !== undefined && envelope) {\n envelope.scheduler.succeed();\n delete this._envelopes[reply.id];\n global.clearTimeout(envelope.timer);\n }\n\n this.trigger('message', reply);\n\n if (this._state === this.UP) return;\n this._state = this.UP;\n this._client.trigger('transport:up');\n },\n\n handleError: function(message, immediate) {\n var envelope = this._envelopes[message.id],\n request = envelope && envelope.request,\n self = this;\n\n if (!request) return;\n\n request.then(function(req) {\n if (req && req.abort) req.abort();\n });\n\n var scheduler = envelope.scheduler;\n scheduler.fail();\n\n global.clearTimeout(envelope.timer);\n envelope.request = envelope.timer = null;\n\n if (immediate) {\n this._sendEnvelope(envelope);\n } else {\n envelope.timer = global.setTimeout(function() {\n envelope.timer = null;\n self._sendEnvelope(envelope);\n }, scheduler.getInterval() * 1000);\n }\n\n if (this._state === this.DOWN) return;\n this._state = this.DOWN;\n this._client.trigger('transport:down');\n }\n});\n\nDispatcher.create = function(client, endpoint, options) {\n return new Dispatcher(client, endpoint, options);\n};\n\nassign(Dispatcher.prototype, Publisher);\nassign(Dispatcher.prototype, Logging);\n\nmodule.exports = Dispatcher;\n","'use strict';\n\nvar Class = require('../util/class'),\n Grammar = require('./grammar');\n\nvar Error = Class({\n initialize: function(code, params, message) {\n this.code = code;\n this.params = Array.prototype.slice.call(params);\n this.message = message;\n },\n\n toString: function() {\n return this.code + ':' +\n this.params.join(',') + ':' +\n this.message;\n }\n});\n\nError.parse = function(message) {\n message = message || '';\n if (!Grammar.ERROR.test(message)) return new Error(null, [], message);\n\n var parts = message.split(':'),\n code = parseInt(parts[0]),\n params = parts[1].split(','),\n message = parts[2];\n\n return new Error(code, params, message);\n};\n\n// http://code.google.com/p/cometd/wiki/BayeuxCodes\nvar errors = {\n versionMismatch: [300, 'Version mismatch'],\n conntypeMismatch: [301, 'Connection types not supported'],\n extMismatch: [302, 'Extension mismatch'],\n badRequest: [400, 'Bad request'],\n clientUnknown: [401, 'Unknown client'],\n parameterMissing: [402, 'Missing required parameter'],\n channelForbidden: [403, 'Forbidden channel'],\n channelUnknown: [404, 'Unknown channel'],\n channelInvalid: [405, 'Invalid channel'],\n extUnknown: [406, 'Unknown extension'],\n publishFailed: [407, 'Failed to publish'],\n serverError: [500, 'Internal server error']\n};\n\nfor (var name in errors)\n (function(name) {\n Error[name] = function() {\n return new Error(errors[name][0], arguments, errors[name][1]).toString();\n };\n })(name);\n\nmodule.exports = Error;\n","'use strict';\n\nvar assign = require('../util/assign'),\n Logging = require('../mixins/logging');\n\nvar Extensible = {\n addExtension: function(extension) {\n this._extensions = this._extensions || [];\n this._extensions.push(extension);\n if (extension.added) extension.added(this);\n },\n\n removeExtension: function(extension) {\n if (!this._extensions) return;\n var i = this._extensions.length;\n while (i--) {\n if (this._extensions[i] !== extension) continue;\n this._extensions.splice(i,1);\n if (extension.removed) extension.removed(this);\n }\n },\n\n pipeThroughExtensions: function(stage, message, request, callback, context) {\n this.debug('Passing through ? extensions: ?', stage, message);\n\n if (!this._extensions) return callback.call(context, message);\n var extensions = this._extensions.slice();\n\n var pipe = function(message) {\n if (!message) return callback.call(context, message);\n\n var extension = extensions.shift();\n if (!extension) return callback.call(context, message);\n\n var fn = extension[stage];\n if (!fn) return pipe(message);\n\n if (fn.length >= 3) extension[stage](message, request, pipe);\n else extension[stage](message, pipe);\n };\n pipe(message);\n }\n};\n\nassign(Extensible, Logging);\n\nmodule.exports = Extensible;\n","'use strict';\n\nmodule.exports = {\n CHANNEL_NAME: /^\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+(\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+)*$/,\n CHANNEL_PATTERN: /^(\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+)*\\/\\*{1,2}$/,\n ERROR: /^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*(,(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*)$/,\n VERSION: /^([0-9])+(\\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\\-|\\_))*)*$/\n};\n","'use strict';\n\nvar Class = require('../util/class'),\n Deferrable = require('../mixins/deferrable');\n\nmodule.exports = Class(Deferrable);\n","'use strict';\n\nvar assign = require('../util/assign');\n\nvar Scheduler = function(message, options) {\n this.message = message;\n this.options = options;\n this.attempts = 0;\n};\n\nassign(Scheduler.prototype, {\n getTimeout: function() {\n return this.options.timeout;\n },\n\n getInterval: function() {\n return this.options.interval;\n },\n\n isDeliverable: function() {\n var attempts = this.options.attempts,\n made = this.attempts,\n deadline = this.options.deadline,\n now = new Date().getTime();\n\n if (attempts !== undefined && made >= attempts)\n return false;\n\n if (deadline !== undefined && now > deadline)\n return false;\n\n return true;\n },\n\n send: function() {\n this.attempts += 1;\n },\n\n succeed: function() {},\n\n fail: function() {},\n\n abort: function() {}\n});\n\nmodule.exports = Scheduler;\n","'use strict';\n\nvar Class = require('../util/class'),\n assign = require('../util/assign'),\n Deferrable = require('../mixins/deferrable');\n\nvar Subscription = Class({\n initialize: function(client, channels, callback, context) {\n this._client = client;\n this._channels = channels;\n this._callback = callback;\n this._context = context;\n this._cancelled = false;\n },\n\n withChannel: function(callback, context) {\n this._withChannel = [callback, context];\n return this;\n },\n\n apply: function(context, args) {\n var message = args[0];\n\n if (this._callback)\n this._callback.call(this._context, message.data);\n\n if (this._withChannel)\n this._withChannel[0].call(this._withChannel[1], message.channel, message.data);\n },\n\n cancel: function() {\n if (this._cancelled) return;\n this._client.unsubscribe(this._channels, this);\n this._cancelled = true;\n },\n\n unsubscribe: function() {\n this.cancel();\n }\n});\n\nassign(Subscription.prototype, Deferrable);\n\nmodule.exports = Subscription;\n","'use strict';\n\nvar Transport = require('./transport');\n\nTransport.register('websocket', require('./web_socket'));\nTransport.register('eventsource', require('./event_source'));\nTransport.register('long-polling', require('./xhr'));\nTransport.register('cross-origin-long-polling', require('./cors'));\nTransport.register('callback-polling', require('./jsonp'));\n\nmodule.exports = Transport;\n","'use strict';\n\nvar Class = require('../util/class'),\n Set = require('../util/set'),\n URI = require('../util/uri'),\n assign = require('../util/assign'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar CORS = assign(Class(Transport, {\n encode: function(messages) {\n return 'message=' + encodeURIComponent(toJSON(messages));\n },\n\n request: function(messages) {\n var xhrClass = global.XDomainRequest ? XDomainRequest : XMLHttpRequest,\n xhr = new xhrClass(),\n id = ++CORS._id,\n headers = this._dispatcher.headers,\n self = this,\n key;\n\n xhr.open('POST', this.endpoint.href, true);\n xhr.withCredentials = true;\n\n if (xhr.setRequestHeader) {\n xhr.setRequestHeader('Pragma', 'no-cache');\n for (key in headers) {\n if (!headers.hasOwnProperty(key)) continue;\n xhr.setRequestHeader(key, headers[key]);\n }\n }\n\n var cleanUp = function() {\n if (!xhr) return false;\n CORS._pending.remove(id);\n xhr.onload = xhr.onerror = xhr.ontimeout = xhr.onprogress = null;\n xhr = null;\n };\n\n xhr.onload = function() {\n var replies;\n try { replies = JSON.parse(xhr.responseText) } catch (error) {}\n\n cleanUp();\n\n if (replies)\n self._receive(replies);\n else\n self._handleError(messages);\n };\n\n xhr.onerror = xhr.ontimeout = function() {\n cleanUp();\n self._handleError(messages);\n };\n\n xhr.onprogress = function() {};\n\n if (xhrClass === global.XDomainRequest)\n CORS._pending.add({ id: id, xhr: xhr });\n\n xhr.send(this.encode(messages));\n return xhr;\n }\n}), {\n _id: 0,\n _pending: new Set(),\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n if (URI.isSameOrigin(endpoint))\n return callback.call(context, false);\n\n if (global.XDomainRequest)\n return callback.call(context, endpoint.protocol === location.protocol);\n\n if (global.XMLHttpRequest) {\n var xhr = new XMLHttpRequest();\n return callback.call(context, xhr.withCredentials !== undefined);\n }\n return callback.call(context, false);\n }\n});\n\nmodule.exports = CORS;\n","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n copyObject = require('../util/copy_object'),\n assign = require('../util/assign'),\n Deferrable = require('../mixins/deferrable'),\n Transport = require('./transport'),\n XHR = require('./xhr');\n\nvar EventSource = assign(Class(Transport, {\n initialize: function(dispatcher, endpoint) {\n Transport.prototype.initialize.call(this, dispatcher, endpoint);\n if (!global.EventSource) return this.setDeferredStatus('failed');\n\n this._xhr = new XHR(dispatcher, endpoint);\n\n endpoint = copyObject(endpoint);\n endpoint.pathname += '/' + dispatcher.clientId;\n\n var socket = new global.EventSource(URI.stringify(endpoint)),\n self = this;\n\n socket.onopen = function() {\n self._everConnected = true;\n self.setDeferredStatus('succeeded');\n };\n\n socket.onerror = function() {\n if (self._everConnected) {\n self._handleError([]);\n } else {\n self.setDeferredStatus('failed');\n socket.close();\n }\n };\n\n socket.onmessage = function(event) {\n var replies;\n try { replies = JSON.parse(event.data) } catch (error) {}\n\n if (replies)\n self._receive(replies);\n else\n self._handleError([]);\n };\n\n this._socket = socket;\n },\n\n close: function() {\n if (!this._socket) return;\n this._socket.onopen = this._socket.onerror = this._socket.onmessage = null;\n this._socket.close();\n delete this._socket;\n },\n\n isUsable: function(callback, context) {\n this.callback(function() { callback.call(context, true) });\n this.errback(function() { callback.call(context, false) });\n },\n\n encode: function(messages) {\n return this._xhr.encode(messages);\n },\n\n request: function(messages) {\n return this._xhr.request(messages);\n }\n\n}), {\n isUsable: function(dispatcher, endpoint, callback, context) {\n var id = dispatcher.clientId;\n if (!id) return callback.call(context, false);\n\n XHR.isUsable(dispatcher, endpoint, function(usable) {\n if (!usable) return callback.call(context, false);\n this.create(dispatcher, endpoint).isUsable(callback, context);\n }, this);\n },\n\n create: function(dispatcher, endpoint) {\n var sockets = dispatcher.transports.eventsource = dispatcher.transports.eventsource || {},\n id = dispatcher.clientId;\n\n var url = copyObject(endpoint);\n url.pathname += '/' + (id || '');\n url = URI.stringify(url);\n\n sockets[url] = sockets[url] || new this(dispatcher, endpoint);\n return sockets[url];\n }\n});\n\nassign(EventSource.prototype, Deferrable);\n\nmodule.exports = EventSource;\n","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n copyObject = require('../util/copy_object'),\n assign = require('../util/assign'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar JSONP = assign(Class(Transport, {\n encode: function(messages) {\n var url = copyObject(this.endpoint);\n url.query.message = toJSON(messages);\n url.query.jsonp = '__jsonp' + JSONP._cbCount + '__';\n return URI.stringify(url);\n },\n\n request: function(messages) {\n var head = document.getElementsByTagName('head')[0],\n script = document.createElement('script'),\n callbackName = JSONP.getCallbackName(),\n endpoint = copyObject(this.endpoint),\n self = this;\n\n endpoint.query.message = toJSON(messages);\n endpoint.query.jsonp = callbackName;\n\n var cleanup = function() {\n if (!global[callbackName]) return false;\n global[callbackName] = undefined;\n try { delete global[callbackName] } catch (error) {}\n script.parentNode.removeChild(script);\n };\n\n global[callbackName] = function(replies) {\n cleanup();\n self._receive(replies);\n };\n\n script.type = 'text/javascript';\n script.src = URI.stringify(endpoint);\n head.appendChild(script);\n\n script.onerror = function() {\n cleanup();\n self._handleError(messages);\n };\n\n return { abort: cleanup };\n }\n}), {\n _cbCount: 0,\n\n getCallbackName: function() {\n this._cbCount += 1;\n return '__jsonp' + this._cbCount + '__';\n },\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n callback.call(context, true);\n }\n});\n\nmodule.exports = JSONP;\n","'use strict';\n\nvar Class = require('../util/class'),\n Cookie = require('../util/cookies').Cookie,\n Promise = require('../util/promise'),\n array = require('../util/array'),\n assign = require('../util/assign'),\n Logging = require('../mixins/logging'),\n Timeouts = require('../mixins/timeouts'),\n Channel = require('../protocol/channel');\n\nvar Transport = assign(Class({ className: 'Transport',\n DEFAULT_PORTS: { 'http:': 80, 'https:': 443, 'ws:': 80, 'wss:': 443 },\n MAX_DELAY: 0,\n\n batching: true,\n\n initialize: function(dispatcher, endpoint) {\n this._dispatcher = dispatcher;\n this.endpoint = endpoint;\n this._outbox = [];\n this._proxy = assign({}, this._dispatcher.proxy);\n\n if (!this._proxy.origin)\n this._proxy.origin = this._findProxy();\n },\n\n close: function() {},\n\n encode: function(messages) {\n return '';\n },\n\n sendMessage: function(message) {\n this.debug('Client ? sending message to ?: ?',\n this._dispatcher.clientId, this.endpoint.href, message);\n\n if (!this.batching) return Promise.resolve(this.request([message]));\n\n this._outbox.push(message);\n this._flushLargeBatch();\n\n if (message.channel === Channel.HANDSHAKE)\n return this._publish(0.01);\n\n if (message.channel === Channel.CONNECT)\n this._connectMessage = message;\n\n return this._publish(this.MAX_DELAY);\n },\n\n _makePromise: function() {\n var self = this;\n\n this._requestPromise = this._requestPromise || new Promise(function(resolve) {\n self._resolvePromise = resolve;\n });\n },\n\n _publish: function(delay) {\n this._makePromise();\n\n this.addTimeout('publish', delay, function() {\n this._flush();\n delete this._requestPromise;\n }, this);\n\n return this._requestPromise;\n },\n\n _flush: function() {\n this.removeTimeout('publish');\n\n if (this._outbox.length > 1 && this._connectMessage)\n this._connectMessage.advice = { timeout: 0 };\n\n this._resolvePromise(this.request(this._outbox));\n\n this._connectMessage = null;\n this._outbox = [];\n },\n\n _flushLargeBatch: function() {\n var string = this.encode(this._outbox);\n if (string.length < this._dispatcher.maxRequestSize) return;\n var last = this._outbox.pop();\n\n this._makePromise();\n this._flush();\n\n if (last) this._outbox.push(last);\n },\n\n _receive: function(replies) {\n if (!replies) return;\n replies = [].concat(replies);\n\n this.debug('Client ? received from ? via ?: ?',\n this._dispatcher.clientId, this.endpoint.href, this.connectionType, replies);\n\n for (var i = 0, n = replies.length; i < n; i++)\n this._dispatcher.handleResponse(replies[i]);\n },\n\n _handleError: function(messages, immediate) {\n messages = [].concat(messages);\n\n this.debug('Client ? failed to send to ? via ?: ?',\n this._dispatcher.clientId, this.endpoint.href, this.connectionType, messages);\n\n for (var i = 0, n = messages.length; i < n; i++)\n this._dispatcher.handleError(messages[i]);\n },\n\n _getCookies: function() {\n var cookies = this._dispatcher.cookies,\n url = this.endpoint.href;\n\n if (!cookies) return '';\n\n return array.map(cookies.getCookiesSync(url), function(cookie) {\n return cookie.cookieString();\n }).join('; ');\n },\n\n _storeCookies: function(setCookie) {\n var cookies = this._dispatcher.cookies,\n url = this.endpoint.href,\n cookie;\n\n if (!setCookie || !cookies) return;\n setCookie = [].concat(setCookie);\n\n for (var i = 0, n = setCookie.length; i < n; i++) {\n cookie = Cookie.parse(setCookie[i]);\n cookies.setCookieSync(cookie, url);\n }\n },\n\n _findProxy: function() {\n if (typeof process === 'undefined') return undefined;\n\n var protocol = this.endpoint.protocol;\n if (!protocol) return undefined;\n\n var name = protocol.replace(/:$/, '').toLowerCase() + '_proxy',\n upcase = name.toUpperCase(),\n env = process.env,\n keys, proxy;\n\n if (name === 'http_proxy' && env.REQUEST_METHOD) {\n keys = Object.keys(env).filter(function(k) { return /^http_proxy$/i.test(k) });\n if (keys.length === 1) {\n if (keys[0] === name && env[upcase] === undefined)\n proxy = env[name];\n } else if (keys.length > 1) {\n proxy = env[name];\n }\n proxy = proxy || env['CGI_' + upcase];\n } else {\n proxy = env[name] || env[upcase];\n if (proxy && !env[name])\n console.warn('The environment variable ' + upcase +\n ' is discouraged. Use ' + name + '.');\n }\n return proxy;\n }\n\n}), {\n get: function(dispatcher, allowed, disabled, callback, context) {\n var endpoint = dispatcher.endpoint;\n\n array.asyncEach(this._transports, function(pair, resume) {\n var connType = pair[0], klass = pair[1],\n connEndpoint = dispatcher.endpointFor(connType);\n\n if (array.indexOf(disabled, connType) >= 0)\n return resume();\n\n if (array.indexOf(allowed, connType) < 0) {\n klass.isUsable(dispatcher, connEndpoint, function() {});\n return resume();\n }\n\n klass.isUsable(dispatcher, connEndpoint, function(isUsable) {\n if (!isUsable) return resume();\n var transport = klass.hasOwnProperty('create') ? klass.create(dispatcher, connEndpoint) : new klass(dispatcher, connEndpoint);\n callback.call(context, transport);\n });\n }, function() {\n throw new Error('Could not find a usable connection type for ' + endpoint.href);\n });\n },\n\n register: function(type, klass) {\n this._transports.push([type, klass]);\n klass.prototype.connectionType = type;\n },\n\n getConnectionTypes: function() {\n return array.map(this._transports, function(t) { return t[0] });\n },\n\n disable: function(feature) {\n if (feature !== 'autodisconnect') return;\n\n for (var i = 0; i < this._transports.length; i++)\n this._transports[i][1]._unloaded = false;\n },\n\n _transports: []\n});\n\nassign(Transport.prototype, Logging);\nassign(Transport.prototype, Timeouts);\n\nmodule.exports = Transport;\n","'use strict';\n\nvar Class = require('../util/class'),\n Promise = require('../util/promise'),\n Set = require('../util/set'),\n URI = require('../util/uri'),\n browser = require('../util/browser'),\n copyObject = require('../util/copy_object'),\n assign = require('../util/assign'),\n toJSON = require('../util/to_json'),\n ws = require('../util/websocket'),\n Deferrable = require('../mixins/deferrable'),\n Transport = require('./transport');\n\nvar WebSocket = assign(Class(Transport, {\n UNCONNECTED: 1,\n CONNECTING: 2,\n CONNECTED: 3,\n\n batching: false,\n\n isUsable: function(callback, context) {\n this.callback(function() { callback.call(context, true) });\n this.errback(function() { callback.call(context, false) });\n this.connect();\n },\n\n request: function(messages) {\n this._pending = this._pending || new Set();\n for (var i = 0, n = messages.length; i < n; i++) this._pending.add(messages[i]);\n\n var self = this;\n\n var promise = new Promise(function(resolve, reject) {\n self.callback(function(socket) {\n if (!socket || socket.readyState !== 1) return;\n socket.send(toJSON(messages));\n resolve(socket);\n });\n\n self.connect();\n });\n\n return {\n abort: function() { promise.then(function(ws) { ws.close() }) }\n };\n },\n\n connect: function() {\n if (WebSocket._unloaded) return;\n\n this._state = this._state || this.UNCONNECTED;\n if (this._state !== this.UNCONNECTED) return;\n this._state = this.CONNECTING;\n\n var socket = this._createSocket();\n if (!socket) return this.setDeferredStatus('failed');\n\n var self = this;\n\n socket.onopen = function() {\n if (socket.headers) self._storeCookies(socket.headers['set-cookie']);\n self._socket = socket;\n self._state = self.CONNECTED;\n self._everConnected = true;\n self.setDeferredStatus('succeeded', socket);\n };\n\n var closed = false;\n socket.onclose = socket.onerror = function() {\n if (closed) return;\n closed = true;\n\n var wasConnected = (self._state === self.CONNECTED);\n socket.onopen = socket.onclose = socket.onerror = socket.onmessage = null;\n\n delete self._socket;\n self._state = self.UNCONNECTED;\n\n var pending = self._pending ? self._pending.toArray() : [];\n delete self._pending;\n\n if (wasConnected || self._everConnected) {\n self.setDeferredStatus('unknown');\n self._handleError(pending, wasConnected);\n } else {\n self.setDeferredStatus('failed');\n }\n };\n\n socket.onmessage = function(event) {\n var replies;\n try { replies = JSON.parse(event.data) } catch (error) {}\n\n if (!replies) return;\n\n replies = [].concat(replies);\n\n for (var i = 0, n = replies.length; i < n; i++) {\n if (replies[i].successful === undefined) continue;\n self._pending.remove(replies[i]);\n }\n self._receive(replies);\n };\n },\n\n close: function() {\n if (!this._socket) return;\n this._socket.close();\n },\n\n _createSocket: function() {\n var url = WebSocket.getSocketUrl(this.endpoint),\n headers = this._dispatcher.headers,\n extensions = this._dispatcher.wsExtensions,\n cookie = this._getCookies(),\n tls = this._dispatcher.tls,\n options = { extensions: extensions, headers: headers, proxy: this._proxy, tls: tls };\n\n if (cookie !== '') options.headers['Cookie'] = cookie;\n\n try {\n return ws.create(url, [], options);\n } catch (e) {\n // catch CSP error to allow transport to fallback to next connType\n }\n }\n\n}), {\n PROTOCOLS: {\n 'http:': 'ws:',\n 'https:': 'wss:'\n },\n\n create: function(dispatcher, endpoint) {\n var sockets = dispatcher.transports.websocket = dispatcher.transports.websocket || {};\n sockets[endpoint.href] = sockets[endpoint.href] || new this(dispatcher, endpoint);\n return sockets[endpoint.href];\n },\n\n getSocketUrl: function(endpoint) {\n endpoint = copyObject(endpoint);\n endpoint.protocol = this.PROTOCOLS[endpoint.protocol];\n return URI.stringify(endpoint);\n },\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n this.create(dispatcher, endpoint).isUsable(callback, context);\n }\n});\n\nassign(WebSocket.prototype, Deferrable);\n\nif (browser.Event && global.onbeforeunload !== undefined) {\n browser.Event.on(global, 'beforeunload', function() {\n if (WebSocket._unloaded === undefined)\n WebSocket._unloaded = true;\n });\n}\n\nmodule.exports = WebSocket;\n","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n browser = require('../util/browser'),\n assign = require('../util/assign'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar XHR = assign(Class(Transport, {\n encode: function(messages) {\n return toJSON(messages);\n },\n\n request: function(messages) {\n var href = this.endpoint.href,\n self = this,\n xhr;\n\n // Prefer XMLHttpRequest over ActiveXObject if they both exist\n if (global.XMLHttpRequest) {\n xhr = new XMLHttpRequest();\n } else if (global.ActiveXObject) {\n xhr = new ActiveXObject('Microsoft.XMLHTTP');\n } else {\n return this._handleError(messages);\n }\n\n xhr.open('POST', href, true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.setRequestHeader('Pragma', 'no-cache');\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\n var headers = this._dispatcher.headers;\n for (var key in headers) {\n if (!headers.hasOwnProperty(key)) continue;\n xhr.setRequestHeader(key, headers[key]);\n }\n\n var abort = function() { xhr.abort() };\n if (global.onbeforeunload !== undefined)\n browser.Event.on(global, 'beforeunload', abort);\n\n xhr.onreadystatechange = function() {\n if (!xhr || xhr.readyState !== 4) return;\n\n var replies = null,\n status = xhr.status,\n text = xhr.responseText,\n successful = (status >= 200 && status < 300) || status === 304 || status === 1223;\n\n if (global.onbeforeunload !== undefined)\n browser.Event.detach(global, 'beforeunload', abort);\n\n xhr.onreadystatechange = function() {};\n xhr = null;\n\n if (!successful) return self._handleError(messages);\n\n try {\n replies = JSON.parse(text);\n } catch (error) {}\n\n if (replies)\n self._receive(replies);\n else\n self._handleError(messages);\n };\n\n xhr.send(this.encode(messages));\n return xhr;\n }\n}), {\n isUsable: function(dispatcher, endpoint, callback, context) {\n var usable = (navigator.product === 'ReactNative')\n || URI.isSameOrigin(endpoint);\n\n callback.call(context, usable);\n }\n});\n\nmodule.exports = XHR;\n","'use strict';\n\nmodule.exports = {\n commonElement: function(lista, listb) {\n for (var i = 0, n = lista.length; i < n; i++) {\n if (this.indexOf(listb, lista[i]) !== -1)\n return lista[i];\n }\n return null;\n },\n\n indexOf: function(list, needle) {\n if (list.indexOf) return list.indexOf(needle);\n\n for (var i = 0, n = list.length; i < n; i++) {\n if (list[i] === needle) return i;\n }\n return -1;\n },\n\n map: function(object, callback, context) {\n if (object.map) return object.map(callback, context);\n var result = [];\n\n if (object instanceof Array) {\n for (var i = 0, n = object.length; i < n; i++) {\n result.push(callback.call(context || null, object[i], i));\n }\n } else {\n for (var key in object) {\n if (!object.hasOwnProperty(key)) continue;\n result.push(callback.call(context || null, key, object[key]));\n }\n }\n return result;\n },\n\n filter: function(array, callback, context) {\n if (array.filter) return array.filter(callback, context);\n var result = [];\n for (var i = 0, n = array.length; i < n; i++) {\n if (callback.call(context || null, array[i], i))\n result.push(array[i]);\n }\n return result;\n },\n\n asyncEach: function(list, iterator, callback, context) {\n var n = list.length,\n i = -1,\n calls = 0,\n looping = false;\n\n var iterate = function() {\n calls -= 1;\n i += 1;\n if (i === n) return callback && callback.call(context);\n iterator(list[i], resume);\n };\n\n var loop = function() {\n if (looping) return;\n looping = true;\n while (calls > 0) iterate();\n looping = false;\n };\n\n var resume = function() {\n calls += 1;\n loop();\n };\n resume();\n }\n};\n","'use strict';\n\nvar forEach = Array.prototype.forEach,\n hasOwn = Object.prototype.hasOwnProperty;\n\nmodule.exports = function(target) {\n forEach.call(arguments, function(source, i) {\n if (i === 0) return;\n\n for (var key in source) {\n if (hasOwn.call(source, key)) target[key] = source[key];\n }\n });\n\n return target;\n};\n","'use strict';\n\nvar Event = {\n _registry: [],\n\n on: function(element, eventName, callback, context) {\n var wrapped = function() { callback.call(context) };\n\n if (element.addEventListener)\n element.addEventListener(eventName, wrapped, false);\n else\n element.attachEvent('on' + eventName, wrapped);\n\n this._registry.push({\n _element: element,\n _type: eventName,\n _callback: callback,\n _context: context,\n _handler: wrapped\n });\n },\n\n detach: function(element, eventName, callback, context) {\n var i = this._registry.length, register;\n while (i--) {\n register = this._registry[i];\n\n if ((element && element !== register._element) ||\n (eventName && eventName !== register._type) ||\n (callback && callback !== register._callback) ||\n (context && context !== register._context))\n continue;\n\n if (register._element.removeEventListener)\n register._element.removeEventListener(register._type, register._handler, false);\n else\n register._element.detachEvent('on' + register._type, register._handler);\n\n this._registry.splice(i,1);\n register = null;\n }\n }\n};\n\nif (global.onunload !== undefined)\n Event.on(global, 'unload', Event.detach, Event);\n\nmodule.exports = {\n Event: Event\n};\n","'use strict';\n\nvar assign = require('./assign');\n\nmodule.exports = function(parent, methods) {\n if (typeof parent !== 'function') {\n methods = parent;\n parent = Object;\n }\n\n var klass = function() {\n if (!this.initialize) return this;\n return this.initialize.apply(this, arguments) || this;\n };\n\n var bridge = function() {};\n bridge.prototype = parent.prototype;\n\n klass.prototype = new bridge();\n assign(klass.prototype, methods);\n\n return klass;\n};\n","module.exports = {\n VERSION: '1.4.0',\n\n BAYEUX_VERSION: '1.0',\n ID_LENGTH: 160,\n JSONP_CALLBACK: 'jsonpcallback',\n CONNECTION_TYPES: ['long-polling', 'cross-origin-long-polling', 'callback-polling', 'websocket', 'eventsource', 'in-process'],\n\n MANDATORY_CONNECTION_TYPES: ['long-polling', 'callback-polling', 'in-process']\n};\n","'use strict';\n\nmodule.exports = {};\n","'use strict';\n\nvar copyObject = function(object) {\n var clone, i, key;\n if (object instanceof Array) {\n clone = [];\n i = object.length;\n while (i--) clone[i] = copyObject(object[i]);\n return clone;\n } else if (typeof object === 'object') {\n clone = (object === null) ? null : {};\n for (key in object) clone[key] = copyObject(object[key]);\n return clone;\n } else {\n return object;\n }\n};\n\nmodule.exports = copyObject;\n","/*\nCopyright Joyent, Inc. and other Node contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nvar isArray = typeof Array.isArray === 'function'\n ? Array.isArray\n : function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]'\n }\n;\nfunction indexOf (xs, x) {\n if (xs.indexOf) return xs.indexOf(x);\n for (var i = 0; i < xs.length; i++) {\n if (x === xs[i]) return i;\n }\n return -1;\n}\n\nfunction EventEmitter() {}\nmodule.exports = EventEmitter;\n\nEventEmitter.prototype.emit = function(type) {\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events || !this._events.error ||\n (isArray(this._events.error) && !this._events.error.length))\n {\n if (arguments[1] instanceof Error) {\n throw arguments[1]; // Unhandled 'error' event\n } else {\n throw new Error(\"Uncaught, unspecified 'error' event.\");\n }\n return false;\n }\n }\n\n if (!this._events) return false;\n var handler = this._events[type];\n if (!handler) return false;\n\n if (typeof handler == 'function') {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n var args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n return true;\n\n } else if (isArray(handler)) {\n var args = Array.prototype.slice.call(arguments, 1);\n\n var listeners = handler.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i].apply(this, args);\n }\n return true;\n\n } else {\n return false;\n }\n};\n\n// EventEmitter is defined in src/node_events.cc\n// EventEmitter.prototype.emit() is also defined there.\nEventEmitter.prototype.addListener = function(type, listener) {\n if ('function' !== typeof listener) {\n throw new Error('addListener only takes instances of Function');\n }\n\n if (!this._events) this._events = {};\n\n // To avoid recursion in the case that type == \"newListeners\"! Before\n // adding it to the listeners, first emit \"newListeners\".\n this.emit('newListener', type, listener);\n\n if (!this._events[type]) {\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n } else if (isArray(this._events[type])) {\n // If we've already got an array, just append.\n this._events[type].push(listener);\n } else {\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n var self = this;\n self.on(type, function g() {\n self.removeListener(type, g);\n listener.apply(this, arguments);\n });\n\n return this;\n};\n\nEventEmitter.prototype.removeListener = function(type, listener) {\n if ('function' !== typeof listener) {\n throw new Error('removeListener only takes instances of Function');\n }\n\n // does not use listeners(), so no side effect of creating _events[type]\n if (!this._events || !this._events[type]) return this;\n\n var list = this._events[type];\n\n if (isArray(list)) {\n var i = indexOf(list, listener);\n if (i < 0) return this;\n list.splice(i, 1);\n if (list.length == 0)\n delete this._events[type];\n } else if (this._events[type] === listener) {\n delete this._events[type];\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n if (arguments.length === 0) {\n this._events = {};\n return this;\n }\n\n // does not use listeners(), so no side effect of creating _events[type]\n if (type && this._events && this._events[type]) this._events[type] = null;\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n if (!this._events) this._events = {};\n if (!this._events[type]) this._events[type] = [];\n if (!isArray(this._events[type])) {\n this._events[type] = [this._events[type]];\n }\n return this._events[type];\n};\n","'use strict';\n\nvar asap = require('asap');\n\nvar PENDING = -1,\n FULFILLED = 0,\n REJECTED = 1;\n\nvar Promise = function(task) {\n this._state = PENDING;\n this._value = null;\n this._defer = [];\n\n execute(this, task);\n};\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n var promise = new Promise();\n\n var deferred = {\n promise: promise,\n onFulfilled: onFulfilled,\n onRejected: onRejected\n };\n\n if (this._state === PENDING)\n this._defer.push(deferred);\n else\n propagate(this, deferred);\n\n return promise;\n};\n\nPromise.prototype['catch'] = function(onRejected) {\n return this.then(null, onRejected);\n};\n\nvar execute = function(promise, task) {\n if (typeof task !== 'function') return;\n\n var calls = 0;\n\n var resolvePromise = function(value) {\n if (calls++ === 0) resolve(promise, value);\n };\n\n var rejectPromise = function(reason) {\n if (calls++ === 0) reject(promise, reason);\n };\n\n try {\n task(resolvePromise, rejectPromise);\n } catch (error) {\n rejectPromise(error);\n }\n};\n\nvar propagate = function(promise, deferred) {\n var state = promise._state,\n value = promise._value,\n next = deferred.promise,\n handler = [deferred.onFulfilled, deferred.onRejected][state],\n pass = [resolve, reject][state];\n\n if (typeof handler !== 'function')\n return pass(next, value);\n\n asap(function() {\n try {\n resolve(next, handler(value));\n } catch (error) {\n reject(next, error);\n }\n });\n};\n\nvar resolve = function(promise, value) {\n if (promise === value)\n return reject(promise, new TypeError('Recursive promise chain detected'));\n\n var then;\n\n try {\n then = getThen(value);\n } catch (error) {\n return reject(promise, error);\n }\n\n if (!then) return fulfill(promise, value);\n\n execute(promise, function(resolvePromise, rejectPromise) {\n then.call(value, resolvePromise, rejectPromise);\n });\n};\n\nvar getThen = function(value) {\n var type = typeof value,\n then = (type === 'object' || type === 'function') && value && value.then;\n\n return (typeof then === 'function')\n ? then\n : null;\n};\n\nvar fulfill = function(promise, value) {\n settle(promise, FULFILLED, value);\n};\n\nvar reject = function(promise, reason) {\n settle(promise, REJECTED, reason);\n};\n\nvar settle = function(promise, state, value) {\n var defer = promise._defer, i = 0;\n\n promise._state = state;\n promise._value = value;\n promise._defer = null;\n\n if (defer.length === 0) return;\n while (i < defer.length) propagate(promise, defer[i++]);\n};\n\nPromise.resolve = function(value) {\n try {\n if (getThen(value)) return value;\n } catch (error) {\n return Promise.reject(error);\n }\n\n return new Promise(function(resolve, reject) { resolve(value) });\n};\n\nPromise.reject = function(reason) {\n return new Promise(function(resolve, reject) { reject(reason) });\n};\n\nPromise.all = function(promises) {\n return new Promise(function(resolve, reject) {\n var list = [], n = promises.length, i;\n\n if (n === 0) return resolve(list);\n\n var push = function(promise, i) {\n Promise.resolve(promise).then(function(value) {\n list[i] = value;\n if (--n === 0) resolve(list);\n }, reject);\n };\n\n for (i = 0; i < n; i++) push(promises[i], i);\n });\n};\n\nPromise.race = function(promises) {\n return new Promise(function(resolve, reject) {\n for (var i = 0, n = promises.length; i < n; i++)\n Promise.resolve(promises[i]).then(resolve, reject);\n });\n};\n\nPromise.deferred = function() {\n var tuple = {};\n\n tuple.promise = new Promise(function(resolve, reject) {\n tuple.resolve = resolve;\n tuple.reject = reject;\n });\n return tuple;\n};\n\nmodule.exports = Promise;\n","'use strict';\n\nvar Class = require('./class');\n\nmodule.exports = Class({\n initialize: function() {\n this._index = {};\n },\n\n add: function(item) {\n var key = (item.id !== undefined) ? item.id : item;\n if (this._index.hasOwnProperty(key)) return false;\n this._index[key] = item;\n return true;\n },\n\n forEach: function(block, context) {\n for (var key in this._index) {\n if (this._index.hasOwnProperty(key))\n block.call(context, this._index[key]);\n }\n },\n\n isEmpty: function() {\n for (var key in this._index) {\n if (this._index.hasOwnProperty(key)) return false;\n }\n return true;\n },\n\n member: function(item) {\n for (var key in this._index) {\n if (this._index[key] === item) return true;\n }\n return false;\n },\n\n remove: function(item) {\n var key = (item.id !== undefined) ? item.id : item;\n var removed = this._index[key];\n delete this._index[key];\n return removed;\n },\n\n toArray: function() {\n var array = [];\n this.forEach(function(item) { array.push(item) });\n return array;\n }\n});\n","'use strict';\n\n// http://assanka.net/content/tech/2009/09/02/json2-js-vs-prototype/\n\nmodule.exports = function(object) {\n return JSON.stringify(object, function(key, value) {\n return (this[key] instanceof Array) ? this[key] : value;\n });\n};\n","'use strict';\n\nmodule.exports = {\n isURI: function(uri) {\n return uri && uri.protocol && uri.host && uri.path;\n },\n\n isSameOrigin: function(uri) {\n return uri.protocol === location.protocol &&\n uri.hostname === location.hostname &&\n uri.port === location.port;\n },\n\n parse: function(url) {\n if (typeof url !== 'string') return url;\n var uri = {}, parts, query, pairs, i, n, data;\n\n var consume = function(name, pattern) {\n url = url.replace(pattern, function(match) {\n uri[name] = match;\n return '';\n });\n uri[name] = uri[name] || '';\n };\n\n consume('protocol', /^[a-z]+\\:/i);\n consume('host', /^\\/\\/[^\\/\\?#]+/);\n\n if (!/^\\//.test(url) && !uri.host)\n url = location.pathname.replace(/[^\\/]*$/, '') + url;\n\n consume('pathname', /^[^\\?#]*/);\n consume('search', /^\\?[^#]*/);\n consume('hash', /^#.*/);\n\n uri.protocol = uri.protocol || location.protocol;\n\n if (uri.host) {\n uri.host = uri.host.substr(2);\n\n if (/@/.test(uri.host)) {\n uri.auth = uri.host.split('@')[0];\n uri.host = uri.host.split('@')[1];\n }\n parts = uri.host.match(/^\\[([^\\]]+)\\]|^[^:]+/);\n uri.hostname = parts[1] || parts[0];\n uri.port = (uri.host.match(/:(\\d+)$/) || [])[1] || '';\n } else {\n uri.host = location.host;\n uri.hostname = location.hostname;\n uri.port = location.port;\n }\n\n uri.pathname = uri.pathname || '/';\n uri.path = uri.pathname + uri.search;\n\n query = uri.search.replace(/^\\?/, '');\n pairs = query ? query.split('&') : [];\n data = {};\n\n for (i = 0, n = pairs.length; i < n; i++) {\n parts = pairs[i].split('=');\n data[decodeURIComponent(parts[0] || '')] = decodeURIComponent(parts[1] || '');\n }\n\n uri.query = data;\n\n uri.href = this.stringify(uri);\n return uri;\n },\n\n stringify: function(uri) {\n var auth = uri.auth ? uri.auth + '@' : '',\n string = uri.protocol + '//' + auth + uri.host;\n\n string += uri.pathname + this.queryString(uri.query) + (uri.hash || '');\n\n return string;\n },\n\n queryString: function(query) {\n var pairs = [];\n for (var key in query) {\n if (!query.hasOwnProperty(key)) continue;\n pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(query[key]));\n }\n if (pairs.length === 0) return '';\n return '?' + pairs.join('&');\n }\n};\n","'use strict';\n\nvar array = require('./array');\n\nmodule.exports = function(options, validKeys) {\n for (var key in options) {\n if (array.indexOf(validKeys, key) < 0)\n throw new Error('Unrecognized option: ' + key);\n }\n};\n","'use strict';\n\nvar WS = global.MozWebSocket || global.WebSocket;\n\nmodule.exports = {\n create: function(url, protocols, options) {\n if (typeof WS !== 'function') return null;\n return new WS(url);\n }\n};\n"],"sourceRoot":""}
@@ -14,7 +14,7 @@ require 'time'
14
14
  require 'uri'
15
15
 
16
16
  module Faye
17
- VERSION = '1.2.2'
17
+ VERSION = '1.4.0'
18
18
 
19
19
  ROOT = File.expand_path(File.dirname(__FILE__))
20
20
 
@@ -81,10 +81,6 @@ module Faye
81
81
  end
82
82
  end
83
83
 
84
- def self.parse_url(url)
85
- String === url ? URI.parse(url) : url
86
- end
87
-
88
84
  def self.to_json(value)
89
85
  case value
90
86
  when Hash, Array then MultiJson.dump(value)
@@ -11,9 +11,9 @@ module Faye
11
11
  DEFAULT_ENDPOINT = '/bayeux'
12
12
  SCRIPT_PATH = 'faye-browser-min.js'
13
13
 
14
- TYPE_JSON = {'Content-Type' => 'application/json; charset=utf-8'}
15
- TYPE_SCRIPT = {'Content-Type' => 'text/javascript; charset=utf-8'}
16
- TYPE_TEXT = {'Content-Type' => 'text/plain; charset=utf-8'}
14
+ TYPE_JSON = { 'Content-Type' => 'application/json; charset=utf-8' }
15
+ TYPE_SCRIPT = { 'Content-Type' => 'text/javascript; charset=utf-8' }
16
+ TYPE_TEXT = { 'Content-Type' => 'text/plain; charset=utf-8' }
17
17
 
18
18
  VALID_JSONP_CALLBACK = /^[a-z_\$][a-z0-9_\$]*(\.[a-z_\$][a-z0-9_\$]*)*$/i
19
19
 
@@ -79,14 +79,14 @@ module Faye
79
79
  unless request.path_info =~ @endpoint_re
80
80
  env['faye.client'] = get_client
81
81
  return @app ? @app.call(env) :
82
- [404, TYPE_TEXT, ["Sure you're not looking for #{@endpoint} ?"]]
82
+ [404, TYPE_TEXT, ["Sure you're not looking for #{ @endpoint } ?"]]
83
83
  end
84
84
 
85
85
  return @static.call(env) if @static =~ request.path_info
86
86
 
87
87
  # http://groups.google.com/group/faye-users/browse_thread/thread/4a01bb7d25d3636a
88
88
  if env['REQUEST_METHOD'] == 'OPTIONS' or env['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'POST'
89
- return handle_options
89
+ return handle_options(request)
90
90
  end
91
91
 
92
92
  return handle_websocket(request) if Faye::WebSocket.websocket?(env)
@@ -108,7 +108,7 @@ module Faye
108
108
  return [400, TYPE_TEXT, ['Bad request']]
109
109
  end
110
110
 
111
- debug("Received message via HTTP #{request.request_method}: ?", json_msg)
111
+ debug("Received message via HTTP #{ request.request_method }: ?", json_msg)
112
112
 
113
113
  message = parse_json(json_msg)
114
114
  jsonp = request.params['jsonp'] || JSONP_CALLBACK
@@ -121,10 +121,14 @@ module Faye
121
121
  return [400, TYPE_TEXT, ['Bad request']]
122
122
  end
123
123
 
124
- headers['Access-Control-Allow-Origin'] = origin if origin
125
124
  headers['Cache-Control'] = 'no-cache, no-store'
126
125
  headers['X-Content-Type-Options'] = 'nosniff'
127
126
 
127
+ if origin
128
+ headers['Access-Control-Allow-Credentials'] = 'true'
129
+ headers['Access-Control-Allow-Origin'] = origin
130
+ end
131
+
128
132
  request.env['rack.hijack'].call if request.env['rack.hijack']
129
133
  hijack = request.env['rack.hijack_io']
130
134
 
@@ -145,7 +149,7 @@ module Faye
145
149
 
146
150
  ASYNC_RESPONSE
147
151
  rescue => e
148
- error "#{e.message}\nBacktrace:\n#{e.backtrace * "\n"}"
152
+ error "#{ e.message }\nBacktrace:\n#{ e.backtrace * "\n" }"
149
153
  [400, TYPE_TEXT, ['Bad request']]
150
154
  end
151
155
 
@@ -172,9 +176,9 @@ module Faye
172
176
  def send_response(response, hijack, callback)
173
177
  return callback.call(response) if callback
174
178
 
175
- buffer = "HTTP/1.1 #{response[0]} OK\r\n"
179
+ buffer = "HTTP/1.1 #{ response[0] } OK\r\n"
176
180
  response[1].each do |name, value|
177
- buffer << "#{name}: #{value}\r\n"
181
+ buffer << "#{ name }: #{ value }\r\n"
178
182
  end
179
183
  buffer << "\r\n"
180
184
  response[2].each do |chunk|
@@ -187,13 +191,13 @@ module Faye
187
191
  end
188
192
 
189
193
  def handle_websocket(request)
190
- options = {:extensions => @extensions, :ping => @options[:ping]}
194
+ options = { :extensions => @extensions, :ping => @options[:ping] }
191
195
  ws = Faye::WebSocket.new(request.env, [], options)
192
196
  client_id = nil
193
197
 
194
198
  ws.onmessage = lambda do |event|
195
199
  begin
196
- debug("Received message via WebSocket[#{ws.version}]: ?", event.data)
200
+ debug("Received message via WebSocket[#{ ws.version }]: ?", event.data)
197
201
 
198
202
  message = parse_json(event.data)
199
203
  cid = Faye.client_id_from_messages(message)
@@ -206,7 +210,7 @@ module Faye
206
210
  ws.send(Faye.to_json(replies)) if ws
207
211
  end
208
212
  rescue => e
209
- error "#{e.message}\nBacktrace:\n#{e.backtrace * "\n"}"
213
+ error "#{ e.message }\nBacktrace:\n#{ e.backtrace * "\n" }"
210
214
  end
211
215
  end
212
216
 
@@ -233,12 +237,14 @@ module Faye
233
237
  es.rack_response
234
238
  end
235
239
 
236
- def handle_options
240
+ def handle_options(request)
241
+ origin = request.env['HTTP_ORIGIN'] || request.env['HTTP_REFERER']
242
+
237
243
  headers = {
238
- 'Access-Control-Allow-Credentials' => 'false',
244
+ 'Access-Control-Allow-Credentials' => 'true',
239
245
  'Access-Control-Allow-Headers' => 'Accept, Authorization, Content-Type, Pragma, X-Requested-With',
240
246
  'Access-Control-Allow-Methods' => 'POST, GET',
241
- 'Access-Control-Allow-Origin' => '*',
247
+ 'Access-Control-Allow-Origin' => origin || '*',
242
248
  'Access-Control-Max-Age' => '86400'
243
249
  }
244
250
  [200, headers, []]
@@ -252,11 +258,11 @@ module Faye
252
258
 
253
259
  def format_request(request)
254
260
  request.body.rewind
255
- string = "curl -X #{request.request_method.upcase}"
256
- string << " '#{request.url}'"
261
+ string = "curl -X #{ request.request_method.upcase }"
262
+ string << " '#{ request.url }'"
257
263
  if request.post?
258
- string << " -H 'Content-Type: #{request.env['CONTENT_TYPE']}'"
259
- string << " -d '#{request.body.read}'"
264
+ string << " -H 'Content-Type: #{ request.env['CONTENT_TYPE'] }'"
265
+ string << " -d '#{ request.body.read }'"
260
266
  end
261
267
  string
262
268
  end
@@ -6,14 +6,14 @@ module Faye
6
6
  include Logging
7
7
  include Extensible
8
8
 
9
- UNCONNECTED = 1
10
- CONNECTING = 2
11
- CONNECTED = 3
12
- DISCONNECTED = 4
9
+ UNCONNECTED = 1
10
+ CONNECTING = 2
11
+ CONNECTED = 3
12
+ DISCONNECTED = 4
13
13
 
14
- HANDSHAKE = 'handshake'
15
- RETRY = 'retry'
16
- NONE = 'none'
14
+ HANDSHAKE = 'handshake'
15
+ RETRY = 'retry'
16
+ NONE = 'none'
17
17
 
18
18
  CONNECTION_TIMEOUT = 60.0
19
19
 
@@ -21,7 +21,7 @@ module Faye
21
21
  def_delegators :@dispatcher, :add_websocket_extension, :disable, :set_header
22
22
 
23
23
  def initialize(endpoint = nil, options = {})
24
- ::WebSocket::Driver.validate_options(options, [:interval, :timeout, :endpoints, :proxy, :retry, :scheduler, :websocket_extensions])
24
+ ::WebSocket::Driver.validate_options(options, [:interval, :timeout, :endpoints, :proxy, :retry, :scheduler, :websocket_extensions, :tls])
25
25
  super()
26
26
  info('New client created for ?', endpoint)
27
27
 
@@ -16,13 +16,14 @@ module Faye
16
16
  def_delegators :@transport, :connection_type
17
17
 
18
18
  attr_accessor :client_id, :timeout
19
- attr_reader :cookies, :endpoint, :headers, :max_request_size, :proxy, :retry, :transports, :ws_extensions
19
+ attr_reader :endpoint, :tls, :headers, :cookies, :proxy, :retry
20
+ attr_reader :max_request_size, :transports, :ws_extensions
20
21
 
21
22
  def initialize(client, endpoint, options)
22
23
  super()
23
24
 
24
25
  @client = client
25
- @endpoint = Faye.parse_url(endpoint)
26
+ @endpoint = String === endpoint ? URI(endpoint) : endpoint
26
27
  @alternates = options[:endpoints] || {}
27
28
 
28
29
  @cookies = CookieJar::Jar.new
@@ -36,14 +37,16 @@ module Faye
36
37
  @ws_extensions = []
37
38
 
38
39
  @proxy = options[:proxy] || {}
39
- @proxy = {:origin => @proxy} if String === @proxy
40
+ @proxy = { :origin => @proxy } if String === @proxy
40
41
 
41
42
  [*options[:websocket_extensions]].each do |extension|
42
43
  add_websocket_extension(extension)
43
44
  end
44
45
 
46
+ @tls = { :verify_peer => true }.merge(options[:tls] || {})
47
+
45
48
  @alternates.each do |type, url|
46
- @alternates[type] = Faye.parse_url(url)
49
+ @alternates[type] = URI(url)
47
50
  end
48
51
 
49
52
  @max_request_size = MAX_REQUEST_SIZE
@@ -123,9 +126,7 @@ module Faye
123
126
  private :send_envelope
124
127
 
125
128
  def handle_response(reply)
126
- envelope = @envelopes.delete(reply['id'])
127
-
128
- if reply.has_key?('successful') and envelope
129
+ if reply.has_key?('successful') and envelope = @envelopes.delete(reply['id'])
129
130
  envelope.scheduler.succeed!
130
131
  EventMachine.cancel_timer(envelope.timer) if envelope.timer
131
132
  end
@@ -6,8 +6,6 @@ module Faye
6
6
  include Logging
7
7
  include Extensible
8
8
 
9
- META_METHODS = %w[handshake connect disconnect subscribe unsubscribe]
10
-
11
9
  attr_reader :engine
12
10
 
13
11
  def initialize(options = {})
@@ -94,6 +92,10 @@ module Faye
94
92
  error = Faye::Error.channel_invalid(channel_name)
95
93
  end
96
94
 
95
+ if message['data'].nil?
96
+ error = Faye::Error.parameter_missing('data')
97
+ end
98
+
97
99
  @engine.publish(message) unless error
98
100
 
99
101
  response = make_response(message)
@@ -103,9 +105,9 @@ module Faye
103
105
  end
104
106
 
105
107
  def handle_meta(message, local, &callback)
106
- method = Channel.parse(message['channel'])[1]
108
+ method = method_for(message)
107
109
 
108
- unless META_METHODS.include?(method)
110
+ unless method
109
111
  response = make_response(message)
110
112
  response['error'] = Faye::Error.channel_forbidden(message['channel'])
111
113
  response['successful'] = false
@@ -119,6 +121,16 @@ module Faye
119
121
  end
120
122
  end
121
123
 
124
+ def method_for(message)
125
+ case message['channel']
126
+ when Channel::HANDSHAKE then :handshake
127
+ when Channel::CONNECT then :connect
128
+ when Channel::SUBSCRIBE then :subscribe
129
+ when Channel::UNSUBSCRIBE then :unsubscribe
130
+ when Channel::DISCONNECT then :disconnect
131
+ end
132
+ end
133
+
122
134
  def advize(response, connection_type)
123
135
  return unless [Channel::HANDSHAKE, Channel::CONNECT].include?(response['channel'])
124
136
 
@@ -29,15 +29,15 @@ module Faye
29
29
  private
30
30
 
31
31
  def build_params(content)
32
+ headers = {
33
+ 'Content-Length' => content.bytesize,
34
+ 'Content-Type' => 'application/json',
35
+ 'Host' => @endpoint.host + (@endpoint.port ? ":#{ @endpoint.port }" : '')
36
+ }
37
+
32
38
  params = {
33
- :head => {
34
- 'Content-Length' => content.bytesize,
35
- 'Content-Type' => 'application/json',
36
- 'Host' => @endpoint.host + (@endpoint.port ? ":#{@endpoint.port}" : '')
37
- }.merge(@dispatcher.headers),
38
-
39
- :body => content,
40
- :timeout => -1 # for em-http-request < 1.0
39
+ :head => headers.merge(@dispatcher.headers),
40
+ :body => content
41
41
  }
42
42
 
43
43
  cookie = get_cookies
@@ -47,26 +47,20 @@ module Faye
47
47
  end
48
48
 
49
49
  def create_request(params)
50
- version = EventMachine::HttpRequest::VERSION.split('.')[0].to_i
51
50
  options = {
52
51
  :inactivity_timeout => 0,
53
- :tls => {:sni_hostname => @endpoint.hostname}
52
+ :tls => @dispatcher.tls
54
53
  }
55
54
 
56
55
  if @proxy[:origin]
57
- uri = URI.parse(@proxy[:origin])
58
- options[:proxy] = {:host => uri.host, :port => uri.port}
56
+ uri = URI(@proxy[:origin])
57
+ options[:proxy] = { :host => uri.host, :port => uri.port }
59
58
  if uri.user
60
59
  options[:proxy][:authorization] = [uri.user, uri.password]
61
60
  end
62
61
  end
63
62
 
64
- if version >= 1
65
- client = EventMachine::HttpRequest.new(@endpoint.to_s, options)
66
- else
67
- client = EventMachine::HttpRequest.new(@endpoint.to_s)
68
- end
69
-
63
+ client = EventMachine::HttpRequest.new(@endpoint.to_s, options)
70
64
  client.post(params)
71
65
  end
72
66
 
@@ -5,7 +5,7 @@ module Faye
5
5
  include Publisher
6
6
  include Timeouts
7
7
 
8
- DEFAULT_PORTS = {'http' => 80, 'https' => 433, 'ws' => 80, 'wss' => 443}
8
+ DEFAULT_PORTS = { 'http' => 80, 'https' => 433, 'ws' => 80, 'wss' => 443 }
9
9
 
10
10
  attr_reader :endpoint
11
11
 
@@ -76,7 +76,7 @@ module Faye
76
76
  remove_timeout(:publish)
77
77
 
78
78
  if @outbox.size > 1 and @connection_message
79
- @connection_message['advice'] = {'timeout' => 0}
79
+ @connection_message['advice'] = { 'timeout' => 0 }
80
80
  end
81
81
 
82
82
  @promise.succeed(request(@outbox))
@@ -72,7 +72,7 @@ module Faye
72
72
  :extensions => extensions,
73
73
  :headers => headers,
74
74
  :proxy => @proxy,
75
- :tls => {:sni_hostname => url.hostname}
75
+ :tls => @dispatcher.tls
76
76
  }
77
77
 
78
78
  socket = Faye::WebSocket::Client.new(url.to_s, [], options)
@@ -82,7 +82,6 @@ module Faye
82
82
  @socket = socket
83
83
  @state = CONNECTED
84
84
  @ever_connected = true
85
- ping
86
85
  set_deferred_status(:succeeded, socket)
87
86
  end
88
87
 
@@ -96,7 +95,6 @@ module Faye
96
95
 
97
96
  @socket = nil
98
97
  @state = UNCONNECTED
99
- remove_timeout(:ping)
100
98
 
101
99
  pending = @pending ? @pending.to_a : []
102
100
  @pending = nil
@@ -127,14 +125,6 @@ module Faye
127
125
  return unless @socket
128
126
  @socket.close
129
127
  end
130
-
131
- private
132
-
133
- def ping
134
- return unless @socket and @socket.ready_state == 1
135
- @socket.send('[]')
136
- add_timeout(:ping, @dispatcher.timeout / 2) { ping }
137
- end
138
128
  end
139
129
 
140
130
  Transport.register 'websocket', Transport::WebSocket
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faye
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2020-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cookiejar
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: 1.1.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.0
40
+ version: 1.1.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: eventmachine
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.1
61
+ version: 0.11.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.9.1
68
+ version: 0.11.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: multi_json
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: RedCloth
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 3.0.0
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 3.0.0
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: rspec
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -235,19 +249,19 @@ dependencies:
235
249
  - !ruby/object:Gem::Version
236
250
  version: 0.2.0
237
251
  - !ruby/object:Gem::Dependency
238
- name: RedCloth
252
+ name: sass
239
253
  requirement: !ruby/object:Gem::Requirement
240
254
  requirements:
241
255
  - - "~>"
242
256
  - !ruby/object:Gem::Version
243
- version: 3.0.0
257
+ version: 3.2.0
244
258
  type: :development
245
259
  prerelease: false
246
260
  version_requirements: !ruby/object:Gem::Requirement
247
261
  requirements:
248
262
  - - "~>"
249
263
  - !ruby/object:Gem::Version
250
- version: 3.0.0
264
+ version: 3.2.0
251
265
  - !ruby/object:Gem::Dependency
252
266
  name: sinatra
253
267
  requirement: !ruby/object:Gem::Requirement
@@ -262,20 +276,6 @@ dependencies:
262
276
  - - ">="
263
277
  - !ruby/object:Gem::Version
264
278
  version: '0'
265
- - !ruby/object:Gem::Dependency
266
- name: sass
267
- requirement: !ruby/object:Gem::Requirement
268
- requirements:
269
- - - "~>"
270
- - !ruby/object:Gem::Version
271
- version: 3.2.0
272
- type: :development
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - "~>"
277
- - !ruby/object:Gem::Version
278
- version: 3.2.0
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: staticmatic
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -346,7 +346,7 @@ dependencies:
346
346
  - - ">="
347
347
  - !ruby/object:Gem::Version
348
348
  version: 4.0.0
349
- description:
349
+ description:
350
350
  email: jcoglan@gmail.com
351
351
  executables: []
352
352
  extensions: []
@@ -354,6 +354,7 @@ extra_rdoc_files:
354
354
  - README.md
355
355
  files:
356
356
  - CHANGELOG.md
357
+ - LICENSE.md
357
358
  - README.md
358
359
  - build/client/faye-browser-min.js
359
360
  - build/client/faye-browser-min.js.map
@@ -387,9 +388,9 @@ files:
387
388
  - lib/faye/util/namespace.rb
388
389
  homepage: https://faye.jcoglan.com
389
390
  licenses:
390
- - MIT
391
+ - Apache-2.0
391
392
  metadata: {}
392
- post_install_message:
393
+ post_install_message:
393
394
  rdoc_options:
394
395
  - "--main"
395
396
  - README.md
@@ -408,9 +409,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
409
  - !ruby/object:Gem::Version
409
410
  version: '0'
410
411
  requirements: []
411
- rubyforge_project:
412
- rubygems_version: 2.5.1
413
- signing_key:
412
+ rubygems_version: 3.1.2
413
+ signing_key:
414
414
  specification_version: 4
415
415
  summary: Simple pub/sub messaging for the web
416
416
  test_files: []