");var h=""+u+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(h),this.myIFrame.doc.close()}catch(e){r.log("frame writing exception"),e.stack&&r.log(e.stack),r.log(e)}}}return e.Ln=function(){var e=document.createElement("iframe");if(e.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(e);try{e.contentWindow.document||r.log("No IE domain setting required")}catch(n){var t=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+t+"';document.close();})())"}return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e},e.prototype.close=function(){var n=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==n.myIFrame&&(document.body.removeChild(n.myIFrame),n.myIFrame=null)},0)),l.isNodeSdk()&&this.myID){var r={};r[t.FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM]="t",r[t.FIREBASE_LONGPOLL_ID_PARAM]=this.myID,r[t.FIREBASE_LONGPOLL_PW_PARAM]=this.myPW;var i=this.urlFn(r);e.nodeRestRequest(i)}var o=this.onDisconnect;o&&(this.onDisconnect=null,o())},e.prototype.startLongPoll=function(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.Fn();){}},e.prototype.Fn=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(0
=this.pendingSegs[0].d.length+30+r.length;){o=this.pendingSegs.shift();r=r+"&"+t.FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM+i+"="+o.seg+"&"+t.FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET+i+"="+o.ts+"&"+t.FIREBASE_LONGPOLL_DATA_PARAM+i+"="+o.d,i++}return n+=r,this.xn(n,this.currentSerial),!0}return!1},e.prototype.enqueueSegment=function(e,t,n){this.pendingSegs.push({seg:e,ts:t,d:n}),this.alive&&this.Fn()},e.prototype.xn=function(e,t){var n=this;this.outstandingRequests.add(t,1);var r=function(){n.outstandingRequests.remove(t),n.Fn()},i=setTimeout(r,25000);this.addTag(e,function o(){clearTimeout(i),r()})},e.prototype.addTag=function(e,t){var n=this;l.isNodeSdk()?this.doNodeLongPoll(e,t):setTimeout(function(){try{if(!n.sendNewPolls)return;var i=n.myIFrame.doc.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){var e=i.readyState;e&&"loaded"!==e&&"complete"!==e||(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),t())},i.onerror=function(){r.log("Long-poll script failed to load: "+e),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(i)}catch(e){}},1)},e}();t.FirebaseIFrameScriptHolder=c},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),o=n(0),a=n(1),s=n(27),u=n(15),l=n(0),h=n(14),c=n(0),p=n(0),d=null;"undefined"!=typeof MozWebSocket?d=MozWebSocket:"undefined"!=typeof WebSocket&&(d=WebSocket),t.setWebSocketImpl=function(e){d=e};var f=function(){function t(e,n,r,i){this.connId=e,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.de=a.logWrapper(this.connId),this.$=s.StatsManager.getCollection(n),this.connURL=t.kn(n,r,i)}return t.kn=function(e,t,n){var r={};return r[u.VERSION_PARAM]=u.PROTOCOL_VERSION,!p.isNodeSdk()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(u.FORGE_DOMAIN)&&(r[u.REFERER_PARAM]=u.FORGE_REF),t&&(r[u.TRANSPORT_SESSION_PARAM]=t),n&&(r[u.LAST_SESSION_PARAM]=n),e.connectionURL(u.WEBSOCKET,r)},t.prototype.open=function(t,n){var r=this;this.onDisconnect=n,this.onMessage=t,this.de("Websocket connecting to "+this.connURL),this.Tn=!1,h.PersistentStorage.set("previous_websocket_failure",!0);try{if(p.isNodeSdk()){var o=l.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",a={headers:{"User-Agent":"Firebase/"+u.PROTOCOL_VERSION+"/"+i.default.SDK_VERSION+"/"+e.platform+"/"+o}},s=e.env,c=0==this.connURL.indexOf("wss://")?s.HTTPS_PROXY||s.https_proxy:s.HTTP_PROXY||s.http_proxy;c&&(a.proxy={origin:c}),this.mySock=new d(this.connURL,[],a)}else this.mySock=new d(this.connURL)}catch(e){this.de("Error instantiating WebSocket.");var f=e.message||e.data;return f&&this.de(f),void this.wn()}this.mySock.onopen=function(){r.de("Websocket connected."),r.Tn=!0},this.mySock.onclose=function(){r.de("Websocket connection was disconnected."),r.mySock=null,r.wn()},this.mySock.onmessage=function(e){r.handleIncomingFrame(e)},this.mySock.onerror=function(e){r.de("WebSocket error. Closing connection.");var t=e.message||e.data;t&&r.de(t),r.wn()}},t.prototype.start=function(){},t.forceDisallow=function(){t.Dn=!0},t.isAvailable=function(){var e=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var n=/Android ([0-9]{0,}\.[0-9]{0,})/,r=navigator.userAgent.match(n);r&&1parseFloat(r[1])&&(e=!0)}return!e&&null!==d&&!t.Dn},t.previouslyFailed=function(){return h.PersistentStorage.isInMemoryStorage||!0===h.PersistentStorage.get("previous_websocket_failure")},t.prototype.markConnectionHealthy=function(){h.PersistentStorage.remove("previous_websocket_failure")},t.prototype.Wn=function(e){if(this.frames.push(e),this.frames.length==this.totalFrames){var t=this.frames.join("");this.frames=null;var n=c.jsonEval(t);this.onMessage(n)}},t.prototype.Vn=function(e){this.totalFrames=e,this.frames=[]},t.prototype.Qn=function(e){if(o.assert(null===this.frames,"We already have a frame buffer"),6>=e.length){var t=+e;if(!isNaN(t))return this.Vn(t),null}return this.Vn(1),e},t.prototype.handleIncomingFrame=function(e){if(null!==this.mySock){var t=e.data;if(this.bytesReceived+=t.length,this.$.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames)this.Wn(t);else{var n=this.Qn(t);null!==n&&this.Wn(n)}}},t.prototype.send=function(e){this.resetKeepAlive();var t=c.stringify(e);this.bytesSent+=t.length,this.$.incrementCounter("bytes_sent",t.length);var n=a.splitStringBySize(t,16384);1=this.Ee.compare(this.getStartPost(),e)&&0>=this.Ee.compare(e,this.getEndPost())},e.prototype.updateChild=function(e,t,n,r,i,s){return this.matches(new o.NamedNode(t,n))||(n=a.ChildrenNode.EMPTY_NODE),this.jn.updateChild(e,t,n,r,i,s)},e.prototype.updateFullNode=function(e,t,n){t.isLeafNode()&&(t=a.ChildrenNode.EMPTY_NODE);var r=t.withIndex(this.Ee);r=r.updatePriority(a.ChildrenNode.EMPTY_NODE);var s=this;return t.forEachChild(i.PRIORITY_INDEX,function(e,t){s.matches(new o.NamedNode(e,t))||(r=r.updateImmediateChild(e,a.ChildrenNode.EMPTY_NODE))}),this.jn.updateFullNode(e,r,n)},e.prototype.updatePriority=function(e){return e},e.prototype.filtersNodes=function(){return!0},e.prototype.getIndexedFilter=function(){return this.jn},e.prototype.getIndex=function(){return this.Ee},e.Bn=function(e){if(e.hasStart()){var t=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),t)}return e.getIndex().minPost()},e.Gn=function(e){if(e.hasEnd()){var t=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),t)}return e.getIndex().maxPost()},e}();t.RangedFilter=s},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(81)},function(e,t,n){"use strict";function r(t){var n=t.INTERNAL.registerService("database",function(e,t,n){return l.RepoManager.getInstance().databaseFromApp(e,n)},{Reference:s.Reference,Query:a.Query,Database:o.Database,enableLogging:u.enableLogging,INTERNAL:h,ServerValue:d,TEST_ACCESS:c},null,!0);p.isNodeSdk()&&(e.exports=n)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),o=n(34);t.Database=o.Database;var a=n(38);t.Query=a.Query;var s=n(23);t.Reference=s.Reference;var u=n(1);t.enableLogging=u.enableLogging;var l=n(28),h=n(113),c=n(114),p=n(0),d=o.Database.ServerValue;t.ServerValue=d,t.registerDatabase=r,r(i.default);var f=n(24);t.DataSnapshot=f.DataSnapshot;var _=n(37);t.OnDisconnect=_.OnDisconnect},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(e){this.Kn=e,this.Yn="firebase:"}return e.prototype.set=function(e,t){null==t?this.Kn.removeItem(this.Xn(e)):this.Kn.setItem(this.Xn(e),r.stringify(t))},e.prototype.get=function(e){var t=this.Kn.getItem(this.Xn(e));return null==t?null:r.jsonEval(t)},e.prototype.remove=function(e){this.Kn.removeItem(this.Xn(e))},e.prototype.Xn=function(e){return this.Yn+e},e.prototype.toString=function(){return""+this.Kn},e}();t.DOMStorageWrapper=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(){this.zn={},this.isInMemoryStorage=!0}return e.prototype.set=function(e,t){null==t?delete this.zn[e]:this.zn[e]=t},e.prototype.get=function(e){return r.contains(this.zn,e)?this.zn[e]:null},e.prototype.remove=function(e){delete this.zn[e]},e}();t.MemoryStorage=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(e,t){this.committed=e,this.snapshot=t}return e.prototype.toJSON=function(){return r.validateArgCount("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},e}();t.TransactionResult=i},function(e,t,n){"use strict";var _Mathfloor4=Math.floor;Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);t.nextPushId=function(){var e="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",t=0,n=[];return function(i){var o=i===t;t=i;var a,s=Array(8);for(a=7;0<=a;a--){s[a]=e.charAt(i%64),i=_Mathfloor4(i/64)}r.assert(0===i,"Cannot push at time == 0");var u=s.join("");if(o){for(a=11;0<=a&&63===n[a];a--){n[a]=0}n[a]++}else for(a=0;12>a;a++){n[a]=_Mathfloor4(64*Math.random())}for(a=0;12>a;a++){u+=e.charAt(n[a])}return r.assert(20===u.length,"nextPushId: Length should be 20."),u}}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(24),i=n(87),o=n(0),a=n(0),s=function(){function e(e,t,n){this.Jn=e,this.$n=t,this.Zn=n}return e.prototype.respondsTo=function(e){return"value"===e},e.prototype.createEvent=function(e,t){var n=t.getQueryParams().getIndex();return new i.DataEvent("value",this,new r.DataSnapshot(e.snapshotNode,t.getRef(),n))},e.prototype.getEventRunner=function(e){var t=this.Zn;if("cancel"===e.getEventType()){a.assert(this.$n,"Raising a cancel event on a listener with no cancel callback");var n=this.$n;return function(){n.call(t,e.error)}}var r=this.Jn;return function(){r.call(t,e.snapshot)}},e.prototype.createCancelEvent=function(e,t){return this.$n?new i.CancelEvent(this,e,t):null},e.prototype.matches=function(t){return babelHelpers.instanceof(t,e)&&(!t.Jn||!this.Jn||t.Jn===this.Jn&&t.Zn===this.Zn)},e.prototype.hasAnyCallback=function(){return null!==this.Jn},e}();t.ValueEventRegistration=s;var u=function(){function e(e,t,n){this.er=e,this.$n=t,this.Zn=n}return e.prototype.respondsTo=function(e){var t="children_added"===e?"child_added":e;return t="children_removed"===t?"child_removed":t,o.contains(this.er,t)},e.prototype.createCancelEvent=function(e,t){return this.$n?new i.CancelEvent(this,e,t):null},e.prototype.createEvent=function(e,t){a.assert(null!=e.childName,"Child events should have a childName.");var n=t.getRef().child(e.childName),o=t.getQueryParams().getIndex();return new i.DataEvent(e.type,this,new r.DataSnapshot(e.snapshotNode,n,o),e.prevName)},e.prototype.getEventRunner=function(e){var t=this.Zn;if("cancel"===e.getEventType()){a.assert(this.$n,"Raising a cancel event on a listener with no cancel callback");var n=this.$n;return function(){n.call(t,e.error)}}var r=this.er[e.eventType];return function(){r.call(t,e.snapshot,e.prevName)}},e.prototype.matches=function(t){if(babelHelpers.instanceof(t,e)){if(!this.er||!t.er)return!0;if(this.Zn===t.Zn){var n=o.getCount(t.er);if(n===o.getCount(this.er)){if(1===n){var r=o.getAnyKey(t.er),i=o.getAnyKey(this.er);return!(i!==r||t.er[r]&&this.er[i]&&t.er[r]!==this.er[i])}return o.every(this.er,function(e,n){return t.er[e]===n})}}}return!1},e.prototype.hasAnyCallback=function(){return null!==this.er},e}();t.ChildEventRegistration=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(e,t,n,r){this.eventType=e,this.eventRegistration=t,this.snapshot=n,this.prevName=r}return e.prototype.getPath=function(){var e=this.snapshot.getRef();return"value"===this.eventType?e.path:e.getParent().path},e.prototype.getEventType=function(){return this.eventType},e.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},e.prototype.toString=function(){return this.getPath()+":"+this.eventType+":"+r.stringify(this.snapshot.exportVal())},e}();t.DataEvent=i;var o=function(){function e(e,t,n){this.eventRegistration=e,this.error=t,this.path=n}return e.prototype.getPath=function(){return this.path},e.prototype.getEventType=function(){return"cancel"},e.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},e.prototype.toString=function(){return this.path+":cancel"},e}();t.CancelEvent=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(1),o=n(89),a=n(5),s=n(0),u=n(25),l=n(90),h=n(91),c=n(9),p=n(48),d=n(3),f=n(49),_=n(97),y=function(){function e(e){this.tr=e,this.nr=u.ImmutableTree.Empty,this.rr=new _.WriteTree,this.ir={},this.or={}}return e.prototype.applyUserOverwrite=function(e,t,n,r){return this.rr.addOverwrite(e,t,n,r),r?this.ar(new p.Overwrite(c.OperationSource.User,e,t)):[]},e.prototype.applyUserMerge=function(e,t,n){this.rr.addMerge(e,t,n);var r=u.ImmutableTree.fromObject(t);return this.ar(new h.Merge(c.OperationSource.User,e,r))},e.prototype.ackUserWrite=function(e,t){void 0===t&&(t=!1);var n=this.rr.getWrite(e);if(this.rr.removeWrite(e)){var r=u.ImmutableTree.Empty;return null!=n.snap?r=r.set(d.Path.Empty,!0):s.forEach(n.children,function(e,t){r=r.set(new d.Path(e),t)}),this.ar(new o.AckUserWrite(n.path,r,t))}return[]},e.prototype.applyServerOverwrite=function(e,t){return this.ar(new p.Overwrite(c.OperationSource.Server,e,t))},e.prototype.applyServerMerge=function(e,t){var n=u.ImmutableTree.fromObject(t);return this.ar(new h.Merge(c.OperationSource.Server,e,n))},e.prototype.applyListenComplete=function(e){return this.ar(new l.ListenComplete(c.OperationSource.Server,e))},e.prototype.applyTaggedQueryOverwrite=function(t,n,r){var i=this.sr(r);if(null!=i){var o=e.ur(i),a=o.path,s=o.queryId,u=d.Path.relativePath(a,t),l=new p.Overwrite(c.OperationSource.forServerTaggedQuery(s),u,n);return this.lr(a,l)}return[]},e.prototype.applyTaggedQueryMerge=function(t,n,r){var i=this.sr(r);if(i){var o=e.ur(i),a=o.path,s=o.queryId,l=d.Path.relativePath(a,t),p=u.ImmutableTree.fromObject(n),f=new h.Merge(c.OperationSource.forServerTaggedQuery(s),l,p);return this.lr(a,f)}return[]},e.prototype.applyTaggedListenComplete=function(t,n){var r=this.sr(n);if(r){var i=e.ur(r),o=i.path,a=i.queryId,s=d.Path.relativePath(o,t),u=new l.ListenComplete(c.OperationSource.forServerTaggedQuery(a),s);return this.lr(o,u)}return[]},e.prototype.addEventRegistration=function(t,n){var i=t.path,o=null,s=!1;this.nr.foreachOnPath(i,function(e,t){var n=d.Path.relativePath(e,i);o=o||t.getCompleteServerCache(n),s=s||t.hasCompleteView()});var u=this.nr.get(i);u?(s=s||u.hasCompleteView(),o=o||u.getCompleteServerCache(d.Path.Empty)):(u=new f.SyncPoint,this.nr=this.nr.set(i,u));var l;null!=o?l=!0:(l=!1,o=a.ChildrenNode.EMPTY_NODE,this.nr.subtree(i).foreachChild(function(e,t){var n=t.getCompleteServerCache(d.Path.Empty);n&&(o=o.updateImmediateChild(e,n))}));var h=u.viewExistsForQuery(t);if(!h&&!t.getQueryParams().loadsAllData()){var c=e.hr(t);r.assert(!(c in this.or),"View does not exist, but we have a tag");var p=e.cr();this.or[c]=p,this.ir["_"+p]=c}var _=this.rr.childWrites(i),y=u.addEventRegistration(t,n,_,o,l);if(!h&&!s){var v=u.viewForQuery(t);y=y.concat(this.pr(t,v))}return y},e.prototype.removeEventRegistration=function(t,n,r){var i=this,o=t.path,a=this.nr.get(o),s=[];if(a&&("default"===t.queryIdentifier()||a.viewExistsForQuery(t))){var u=a.removeEventRegistration(t,n,r);a.isEmpty()&&(this.nr=this.nr.remove(o));var l=u.removed;s=u.events;var h=-1!==l.findIndex(function(e){return e.getQueryParams().loadsAllData()}),c=this.nr.findOnPath(o,function(e,t){return t.hasCompleteView()});if(h&&!c){var p=this.nr.subtree(o);if(!p.isEmpty())for(var d=this.dr(p),f=0;fthis.Yr,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.Kr.push({path:e,snap:t,writeId:n,visible:r}),r&&(this.Gr=this.Gr.addWrite(e,t)),this.Yr=n},e.prototype.addMerge=function(e,t,n){i.assert(n>this.Yr,"Stacking an older merge on top of newer ones"),this.Kr.push({path:e,children:t,writeId:n,visible:!0}),this.Gr=this.Gr.addWrites(e,t),this.Yr=n},e.prototype.getWrite=function(e){for(var t=0,n;t=n&&this.Xr(l,o.path)?a=!1:o.path.contains(l.path)&&(s=!0)),u--}if(a){if(s)return this.zr(),!0;if(o.snap)this.Gr=this.Gr.removeWrite(o.path);else{var h=o.children;r.forEach(h,function(e){t.Gr=t.Gr.removeWrite(o.path.child(e))})}return!0}return!1},e.prototype.getCompleteWriteData=function(e){return this.Gr.getCompleteNode(e)},e.prototype.calcCompleteEventCache=function(t,n,r,i){if(r||i){var a=this.Gr.childCompoundWrite(t);if(!i&&a.isEmpty())return n;if(i||null!=n||a.hasCompleteWrite(o.Path.Empty)){var s=function(e){return(e.visible||i)&&(!r||!~r.indexOf(e.writeId))&&(e.path.contains(t)||t.contains(e.path))},l=e.Jr(this.Kr,s,t),h=n||u.ChildrenNode.EMPTY_NODE;return l.apply(h)}return null}var c=this.Gr.getCompleteNode(t);if(null!=c)return c;var p=this.Gr.childCompoundWrite(t);if(p.isEmpty())return n;if(null!=n||p.hasCompleteWrite(o.Path.Empty)){var h=n||u.ChildrenNode.EMPTY_NODE;return p.apply(h)}return null},e.prototype.calcCompleteEventChildren=function(e,t){var n=u.ChildrenNode.EMPTY_NODE,r=this.Gr.getCompleteNode(e);if(r)return r.isLeafNode()||r.forEachChild(s.PRIORITY_INDEX,function(e,t){n=n.updateImmediateChild(e,t)}),n;if(t){var i=this.Gr.childCompoundWrite(e);return t.forEachChild(s.PRIORITY_INDEX,function(e,t){var r=i.childCompoundWrite(new o.Path(e)).apply(t);n=n.updateImmediateChild(e,r)}),i.getCompleteChildren().forEach(function(e){n=n.updateImmediateChild(e.name,e.node)}),n}return this.Gr.childCompoundWrite(e).getCompleteChildren().forEach(function(e){n=n.updateImmediateChild(e.name,e.node)}),n},e.prototype.calcEventCacheAfterServerOverwrite=function(e,t,n,r){i.assert(n||r,"Either existingEventSnap or existingServerSnap must exist");var o=e.child(t);if(this.Gr.hasCompleteWrite(o))return null;var a=this.Gr.childCompoundWrite(o);return a.isEmpty()?r.getChild(t):a.apply(r.getChild(t))},e.prototype.calcCompleteChild=function(e,t,n){var r=e.child(t),i=this.Gr.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(t)?this.Gr.childCompoundWrite(r).apply(n.getNode().getImmediateChild(t)):null},e.prototype.shadowingWrite=function(e){return this.Gr.getCompleteNode(e)},e.prototype.calcIndexedSlice=function(e,t,n,r,i,a){var s,u=this.Gr.childCompoundWrite(e),l=u.getCompleteNode(o.Path.Empty);if(null!=l)s=l;else{if(null==t)return[];s=u.apply(t)}if(s=s.withIndex(a),s.isEmpty()||s.isLeafNode())return[];for(var h=[],c=a.getCompare(),p=i?s.getReverseIteratorFrom(n,a):s.getIteratorFrom(n,a),d=p.getNext();d&&h.lengthh.status){try{e=a.jsonEval(h.responseText)}catch(e){o.warn("Failed to parse JSON response for "+l+": "+h.responseText)}n(null,e)}else 401!==h.status&&404!==h.status&&o.warn("Got unsuccessful REST response for "+l+" Status: "+h.status),n(h.status);n=null}},h.open("GET",l,!0),h.send()})},t}(l.ServerActions);t.ReadonlyRestClient=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(1),o=n(12),a=n(4),s=n(40),u=n(44),l=n(26),h=n(110),c=n(58),p=n(0),d=function(){function e(){this.yi=!1,this.vi=!1,this.gi=!1,this.mi=!1,this.Ci=!1,this.Ei=0,this.Ni="",this.Pi=null,this.Si="",this.bi=null,this.Ti="",this.Ee=a.PRIORITY_INDEX}return e.prototype.hasStart=function(){return this.vi},e.prototype.isViewFromLeft=function(){return""===this.Ni?this.vi:this.Ni===e.Ri.VIEW_FROM_LEFT},e.prototype.getIndexStartValue=function(){return r.assert(this.vi,"Only valid if start has been set"),this.Pi},e.prototype.getIndexStartName=function(){return r.assert(this.vi,"Only valid if start has been set"),this.gi?this.Si:i.MIN_NAME},e.prototype.hasEnd=function(){return this.mi},e.prototype.getIndexEndValue=function(){return r.assert(this.mi,"Only valid if end has been set"),this.bi},e.prototype.getIndexEndName=function(){return r.assert(this.mi,"Only valid if end has been set"),this.Ci?this.Ti:i.MAX_NAME},e.prototype.hasLimit=function(){return this.yi},e.prototype.hasAnchoredLimit=function(){return this.yi&&""!==this.Ni},e.prototype.getLimit=function(){return r.assert(this.yi,"Only valid if limit has been set"),this.Ei},e.prototype.getIndex=function(){return this.Ee},e.prototype.Ii=function(){var t=new e;return t.yi=this.yi,t.Ei=this.Ei,t.vi=this.vi,t.Pi=this.Pi,t.gi=this.gi,t.Si=this.Si,t.mi=this.mi,t.bi=this.bi,t.Ci=this.Ci,t.Ti=this.Ti,t.Ee=this.Ee,t.Ni=this.Ni,t},e.prototype.limit=function(e){var t=this.Ii();return t.yi=!0,t.Ei=e,t.Ni="",t},e.prototype.limitToFirst=function(t){var n=this.Ii();return n.yi=!0,n.Ei=t,n.Ni=e.Ri.VIEW_FROM_LEFT,n},e.prototype.limitToLast=function(t){var n=this.Ii();return n.yi=!0,n.Ei=t,n.Ni=e.Ri.VIEW_FROM_RIGHT,n},e.prototype.startAt=function(e,t){var n=this.Ii();return n.vi=!0,void 0===e&&(e=null),n.Pi=e,null!=t?(n.gi=!0,n.Si=t):(n.gi=!1,n.Si=""),n},e.prototype.endAt=function(e,t){var n=this.Ii();return n.mi=!0,void 0===e&&(e=null),n.bi=e,void 0!==t?(n.Ci=!0,n.Ti=t):(n.Ci=!1,n.Ti=""),n},e.prototype.orderBy=function(e){var t=this.Ii();return t.Ee=e,t},e.prototype.getQueryObject=function(){var t=e.Ri,n={};if(this.vi&&(n[t.INDEX_START_VALUE]=this.Pi,this.gi&&(n[t.INDEX_START_NAME]=this.Si)),this.mi&&(n[t.INDEX_END_VALUE]=this.bi,this.Ci&&(n[t.INDEX_END_NAME]=this.Ti)),this.yi){n[t.LIMIT]=this.Ei;var r=this.Ni;""===r&&(r=this.isViewFromLeft()?t.VIEW_FROM_LEFT:t.VIEW_FROM_RIGHT),n[t.VIEW_FROM]=r}return this.Ee!==a.PRIORITY_INDEX&&(n[t.INDEX]=""+this.Ee),n},e.prototype.loadsAllData=function(){return!(this.vi||this.mi||this.yi)},e.prototype.isDefault=function(){return this.loadsAllData()&&this.Ee==a.PRIORITY_INDEX},e.prototype.getNodeFilter=function(){return this.loadsAllData()?new l.IndexedFilter(this.getIndex()):this.hasLimit()?new h.LimitedFilter(this):new c.RangedFilter(this)},e.prototype.toRestQueryStringParameters=function(){var t=e.wi,n={};if(this.isDefault())return n;var i;return this.Ee===a.PRIORITY_INDEX?i=t.PRIORITY_INDEX:this.Ee===s.VALUE_INDEX?i=t.VALUE_INDEX:this.Ee===o.KEY_INDEX?i=t.KEY_INDEX:(r.assert(babelHelpers.instanceof(this.Ee,u.PathIndex),"Unrecognized index type!"),i=""+this.Ee),n[t.ORDER_BY]=p.stringify(i),this.vi&&(n[t.START_AT]=p.stringify(this.Pi),this.gi&&(n[t.START_AT]+=","+p.stringify(this.Si))),this.mi&&(n[t.END_AT]=p.stringify(this.bi),this.Ci&&(n[t.END_AT]+=","+p.stringify(this.Ti))),this.yi&&(this.isViewFromLeft()?n[t.LIMIT_TO_FIRST]=this.Ei:n[t.LIMIT_TO_LAST]=this.Ei),n},e.Ri={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},e.wi={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},e.DEFAULT=new e,e}();t.QueryParams=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(58),i=n(5),o=n(6),a=n(0),s=n(10),u=function(){function e(e){this.Oi=new r.RangedFilter(e),this.Ee=e.getIndex(),this.Ei=e.getLimit(),this.Ai=!e.isViewFromLeft()}return e.prototype.updateChild=function(e,t,n,r,a,s){return this.Oi.matches(new o.NamedNode(t,n))||(n=i.ChildrenNode.EMPTY_NODE),e.getImmediateChild(t).equals(n)?e:e.numChildren()=this.Ee.compare(this.Oi.getStartPost(),s):0>=this.Ee.compare(s,this.Oi.getEndPost())))break;r=r.updateImmediateChild(s.name,s.node),a++}}else{r=t.withIndex(this.Ee),r=r.updatePriority(i.ChildrenNode.EMPTY_NODE);var l,h,c,o=void 0;if(this.Ai){o=r.getReverseIterator(this.Ee),l=this.Oi.getEndPost(),h=this.Oi.getStartPost();var p=this.Ee.getCompare();c=function(e,t){return p(t,e)}}else o=r.getIterator(this.Ee),l=this.Oi.getStartPost(),h=this.Oi.getEndPost(),c=this.Ee.getCompare();for(var a=0,d=!1,s;o.hasNext();){s=o.getNext();!d&&0>=c(l,s)&&(d=!0);var u=d&&a=c(s,h);u?a++:r=r.updateImmediateChild(s.name,i.ChildrenNode.EMPTY_NODE)}}return this.Oi.getIndexedFilter().updateFullNode(e,r,n)},e.prototype.updatePriority=function(e){return e},e.prototype.filtersNodes=function(){return!0},e.prototype.getIndexedFilter=function(){return this.Oi.getIndexedFilter()},e.prototype.getIndex=function(){return this.Ee},e.prototype.Di=function(e,t,n,r,u){var l;if(this.Ai){var h=this.Ee.getCompare();l=function(e,t){return h(t,e)}}else l=this.Ee.getCompare();var c=e;a.assert(c.numChildren()==this.Ei,"");var p=new o.NamedNode(t,n),d=this.Ai?c.getFirstChild(this.Ee):c.getLastChild(this.Ee),f=this.Oi.matches(p);if(c.hasChild(t)){for(var _=c.getImmediateChild(t),y=r.getChildAfterChild(this.Ee,d,this.Ai);null!=y&&(y.name==t||c.hasChild(y.name));){y=r.getChildAfterChild(this.Ee,y,this.Ai)}var v=null==y?1:l(y,p);if(f&&!n.isEmpty()&&0<=v)return null!=u&&u.trackChildChange(s.Change.childChangedChange(t,n,_)),c.updateImmediateChild(t,n);null!=u&&u.trackChildChange(s.Change.childRemovedChange(t,_));var g=c.updateImmediateChild(t,i.ChildrenNode.EMPTY_NODE);return null!=y&&this.Oi.matches(y)?(null!=u&&u.trackChildChange(s.Change.childAddedChange(y.name,y.node)),g.updateImmediateChild(y.name,y.node)):g}return n.isEmpty()?e:f&&0<=l(d,p)?(null!=u&&(u.trackChildChange(s.Change.childRemovedChange(d.name,d.node)),u.trackChildChange(s.Change.childAddedChange(t,n))),c.updateImmediateChild(t,n).updateImmediateChild(d.name,i.ChildrenNode.EMPTY_NODE)):e},e}();t.LimitedFilter=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(0),o=n(23),a=n(24),s=n(3),u=n(112),l=n(4),h=n(1),c=n(45),p=n(8),d=n(0),f=n(13),_=n(5),y=n(19);!function(e){e[e.RUN=0]="RUN",e[e.SENT=1]="SENT",e[e.COMPLETED=2]="COMPLETED",e[e.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",e[e.NEEDS_ABORT=4]="NEEDS_ABORT"}(r=t.TransactionStatus||(t.TransactionStatus={})),y.Repo.Mi=25,y.Repo.prototype.ie=function(){this.Li=new u.Tree},y.Repo.prototype.startTransaction=function(e,t,n,s){this.de("transaction on "+e);var u=function(){},y=new o.Reference(this,e);y.on("value",u);var g={path:e,update:t,onComplete:n,status:null,order:h.LUIDGenerator(),applyLocally:s,retryCount:0,unwatcher:function v(){y.off("value",u)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},m=this.Fi(e);g.currentInputSnapshot=m;var C=g.update(m.val());if(void 0===C){if(g.unwatcher(),g.currentOutputSnapshotRaw=null,g.currentOutputSnapshotResolved=null,g.onComplete){var E=new a.DataSnapshot(g.currentInputSnapshot,new o.Reference(this,g.path),l.PRIORITY_INDEX);g.onComplete(null,!1,E)}}else{p.validateFirebaseData("transaction failed: Data returned ",C,g.path),g.status=r.RUN;var N=this.Li.subTree(e),P=N.getValue()||[];P.push(g),N.setValue(P);var S;"object"==babelHelpers.typeof(C)&&null!==C&&d.contains(C,".priority")?(S=d.safeGet(C,".priority"),i.assert(p.isValidPriority(S),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):S=(this.ue.calcCompleteEventCache(e)||_.ChildrenNode.EMPTY_NODE).getPriority().val(),S=S;var b=this.generateServerValues(),T=f.nodeFromJSON(C,S),R=c.resolveDeferredValueSnapshot(T,b);g.currentOutputSnapshotRaw=T,g.currentOutputSnapshotResolved=R,g.currentWriteId=this.pe();var I=this.ue.applyUserOverwrite(e,R,g.currentWriteId,g.applyLocally);this.K.raiseEventsForChangedPath(e,I),this.xi()}},y.Repo.prototype.Fi=function(e,t){return this.ue.calcCompleteEventCache(e,t)||_.ChildrenNode.EMPTY_NODE},y.Repo.prototype.xi=function(e){var t=this;if(void 0===e&&(e=this.Li),e||this.ki(e),null!==e.getValue()){var n=this.Wi(e);i.assert(0=y.Repo.Mi)E=!0,N="maxretry",u=u.concat(this.ue.ackUserWrite(m.currentWriteId,!0));else{var P=this.Fi(m.path,v);m.currentInputSnapshot=P;var S=e[g].update(P.val());if(void 0!==S){p.validateFirebaseData("transaction failed: Data returned ",S,m.path);var b=f.nodeFromJSON(S),T="object"==babelHelpers.typeof(S)&&null!=S&&d.contains(S,".priority");T||(b=b.updatePriority(P.getPriority()));var R=m.currentWriteId,I=this.generateServerValues(),w=c.resolveDeferredValueSnapshot(b,I);m.currentOutputSnapshotRaw=b,m.currentOutputSnapshotResolved=w,m.currentWriteId=this.pe(),v.splice(v.indexOf(R),1),u=u.concat(this.ue.applyUserOverwrite(m.path,w,m.currentWriteId,m.applyLocally)),u=u.concat(this.ue.ackUserWrite(R,!0))}else E=!0,N="nodata",u=u.concat(this.ue.ackUserWrite(m.currentWriteId,!0))}if(this.K.raiseEventsForChangedPath(t,u),u=[],E&&(e[g].status=r.COMPLETED,function(e){setTimeout(e,0)}(e[g].unwatcher),e[g].onComplete))if("nodata"===N){var O=new o.Reference(this,e[g].path),A=e[g].currentInputSnapshot,D=new a.DataSnapshot(A,O,l.PRIORITY_INDEX);n.push(e[g].onComplete.bind(null,null,!1,D))}else n.push(e[g].onComplete.bind(null,Error(N),!1,null))}this.ki(this.Li);for(var g=0;g