@operato/scene-firebase 8.0.0-beta.1 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/demo/index.html DELETED
@@ -1,212 +0,0 @@
1
- <!--
2
- @license
3
- Copyright © 2017 HatioLab Inc. All rights reserved.
4
- -->
5
- <!doctype html>
6
-
7
- <html>
8
- <head>
9
- <meta charset="utf-8">
10
- <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
11
- <title>firebase Demo</title>
12
- <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
13
-
14
- <link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
15
- <link rel="import" href="../../things-scene-viewer/things-scene-layer.html">
16
- <link rel="import" href="../../things-scene-viewer/things-scene-handler.html">
17
-
18
- <link rel="import" href="../../things-designer-elements/things-editor-properties.html">
19
-
20
- <link rel="import" href="./things-scene-firebase.html">
21
-
22
- <style is="custom-style">
23
-
24
- things-scene-viewer {
25
- display: block;
26
- width: 640px;
27
- height: 480px;
28
- }
29
- </style>
30
- </head>
31
- <body unresolved>
32
-
33
- <template is="dom-bind" id="app">
34
- <p>An example of <code>&lt;firebase&gt;</code>:</p>
35
-
36
- <things-scene-viewer id='scene'
37
- scene='{{scene}}'
38
- selected='{{selected}}'
39
- model='[[model]]'
40
- mode="0">
41
- <things-scene-layer type="selection-layer"></things-scene-layer>
42
- <things-scene-layer type="modeling-layer"></things-scene-layer>
43
- <things-scene-handler type="text-editor"></things-scene-handler>
44
- <things-scene-handler type="move-handler"></things-scene-handler>
45
- </things-scene-viewer>
46
-
47
- <p>Properties</p>
48
- <things-editor-properties id='props' target="{{props}}" props="[[selected.0.nature.properties]]">
49
- </things-editor-properties>
50
-
51
- </template>
52
-
53
- <script>
54
- window.addEventListener('WebComponentsReady', function(e) {
55
- var app = document.querySelector('#app')
56
-
57
- app.props = {}
58
-
59
- setTimeout(function() {
60
- app.scene.on('selected', function(after) {
61
- var target = after[0]
62
- var props = {}
63
- if(target) {
64
- target.nature.properties.forEach(function(prop) {
65
- var property = prop.property
66
- props[property] = target.model[property]
67
- })
68
- }
69
- app.props = props
70
- });
71
- });
72
-
73
- app.$.props.addEventListener('change', function() {
74
- app.selected[0].set(app.props)
75
- });
76
-
77
- app.model = {
78
- width: 800,
79
- height: 800,
80
- components: [{
81
- type: "rect",
82
- left: 150,
83
- top: 150,
84
- rotation: 10,
85
- width: 20,
86
- height: 20,
87
- strokeStyle: "black",
88
- templatePrefix: "RECT-",
89
- retention: 10000,
90
- data: {
91
- location: {
92
- x: 100,
93
- y: 100
94
- },
95
- status: 1
96
- },
97
- animation: {
98
- oncreate: {
99
- type: "rotation",
100
- duration: 2000,
101
- tilt: 30,
102
- cycle: 50,
103
- theta: 3.14,
104
- roundtrip: true,
105
- scale: 1.3,
106
- repeat: false
107
- }
108
- },
109
- mappings: [{
110
- accessor: "location",
111
- target: "(self)",
112
- property: "location",
113
- rule: "value"
114
- }, {
115
- accessor: "status",
116
- target: "(self)",
117
- property: "fillStyle",
118
- rule: "map",
119
- param: {
120
- 1: "blue",
121
- 2: "green",
122
- 3: "red",
123
- 4: "gray",
124
- 5: "lightgray",
125
- 6: "darkgray",
126
- 7: "yellow",
127
- 8: "white",
128
- 9: "black",
129
- default: "cyan"
130
- }
131
- }, {
132
- accessor: "status",
133
- target: "(self)",
134
- property: "rotation",
135
- rule: "value"
136
- }]
137
- }, {
138
- type: "ellipse",
139
- strokeStyle: "black",
140
- cx: 50,
141
- cy: 50,
142
- rx: 10,
143
- ry: 10,
144
- templatePrefix: "CIRC-",
145
- retention: 10000,
146
- animation: {
147
- oncreate: {
148
- type: "heartbeat",
149
- duration: 2000,
150
- tilt: 30,
151
- cycle: 50,
152
- theta: 1,
153
- roundtrip: true,
154
- scale: 1.3,
155
- repeat: false
156
- }
157
- },
158
- data: {
159
- location: {
160
- x: 200,
161
- y: 200
162
- },
163
- status: 2
164
- },
165
- mappings: [{
166
- accessor: "location",
167
- target: "(self)",
168
- property: "location",
169
- rule: "value"
170
- }, {
171
- accessor: "status",
172
- target: "(self)",
173
- property: "fillStyle",
174
- rule: "map",
175
- param: {
176
- 1: "blue",
177
- 2: "green",
178
- 3: "red",
179
- 4: "gray",
180
- 5: "lightgray",
181
- 6: "darkgray",
182
- 7: "yellow",
183
- 8: "white",
184
- 9: "black",
185
- default: "cyan"
186
- }
187
- }]
188
- }, {
189
- type: 'firebase',
190
- top: 50,
191
- left: 50,
192
- width: 30,
193
- height: 30,
194
- fillStyle: '#00ff00',
195
- strokeStyle: '#000',
196
- lineWidth: 2,
197
-
198
- apiKey: "AIzaSyCfqM_viu8mcuUbIupgv0Qh2xD6NWf1thA",
199
- authDomain: "things-board-399e6.firebaseapp.com",
200
- databaseURL: "https://things-board-399e6.firebaseio.com",
201
- projectId: "things-board-399e6",
202
- storageBucket: "things-board-399e6.appspot.com",
203
- messagingSenderId: "74237077394",
204
- childDataPath: "boards/template/data",
205
- email: 'test@example.com',
206
- password: 'testpass'
207
- }]
208
- };
209
- });
210
- </script>
211
- </body>
212
- </html>
package/demo/simulator.js DELETED
@@ -1,59 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- var firebase = require('firebase')
5
-
6
- firebase.initializeApp({
7
- apiKey: "AIzaSyCfqM_viu8mcuUbIupgv0Qh2xD6NWf1thA",
8
- authDomain: "things-board-399e6.firebaseapp.com",
9
- databaseURL: "https://things-board-399e6.firebaseio.com",
10
- projectId: "things-board-399e6",
11
- storageBucket: "things-board-399e6.appspot.com",
12
- messagingSenderId: "74237077394",
13
- })
14
-
15
- var email = 'test@example.com';
16
- var password = 'testpass';
17
- var mo_path = "boards/template/data/CIRC-03";
18
- var simulation_path = "boards/template/simulation/CIRC-03";
19
-
20
- this._database = firebase.database();
21
-
22
- const auth = firebase.auth();
23
-
24
- var self = this
25
- var exit = false
26
-
27
- auth.onAuthStateChanged(firebaseUser => {
28
- if (firebaseUser) {
29
- console.log('logged in');
30
- var ref_mo = firebase.database().ref().child(mo_path);
31
- var ref_sim = firebase.database().ref().child(simulation_path);
32
- setInterval(() => {
33
- var data = {
34
- location: {
35
- x: Math.round(Math.random() * 400),
36
- y: Math.round(Math.random() * 400)
37
- },
38
- status: Math.floor(Math.random() * 5)
39
- }
40
- ref_mo.set(data); // Moving Object가 없는 경우에는 set을 해야할 것 같음.
41
- // ref_mo.update(data);
42
- ref_sim.push(data);
43
- }, 1000)
44
- } else {
45
- if (exit) {
46
- console.log('logged out, about to exit');
47
- process.exit(1);
48
- }
49
- }
50
- })
51
-
52
- const promise = email ? auth.signInWithEmailAndPassword(email, password) : auth.signInAnonymously();
53
-
54
- promise.catch(e => console.log(e.message))
55
-
56
- setTimeout(() => {
57
- exit = true;
58
- firebase.auth().signOut();
59
- }, 100000);
@@ -1,5 +0,0 @@
1
- <!--
2
- @license
3
- Copyright © 2017 HatioLab Inc. All rights reserved.
4
- -->
5
- <script src="../things-scene-firebase.js"></script>
package/src/firebase.ts DELETED
@@ -1,185 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { Component, ComponentNature, DataSource, error, RectPath, Shape } from '@hatiolab/things-scene'
6
- import { initializeApp, deleteApp } from 'firebase/app'
7
- import { getDatabase, ref, child, onValue } from 'firebase/database'
8
- import { getAuth, onAuthStateChanged, signInAnonymously, signInWithEmailAndPassword, signOut } from 'firebase/auth'
9
-
10
- declare global {
11
- var firebase: any
12
- }
13
-
14
- const NATURE: ComponentNature = {
15
- mutable: false,
16
- resizable: true,
17
- rotatable: true,
18
- properties: [
19
- {
20
- type: 'string',
21
- label: 'api-key',
22
- name: 'apiKey',
23
- property: 'apiKey'
24
- },
25
- {
26
- type: 'string',
27
- label: 'auth-domain',
28
- name: 'authDomain',
29
- property: 'authDomain'
30
- },
31
- {
32
- type: 'string',
33
- label: 'database-url',
34
- name: 'databaseURL',
35
- property: 'databaseURL'
36
- },
37
- {
38
- type: 'string',
39
- label: 'project-id',
40
- name: 'projectId',
41
- property: 'projectId'
42
- },
43
- {
44
- type: 'string',
45
- label: 'storage-bucket',
46
- name: 'storageBucket',
47
- property: 'storageBucket'
48
- },
49
- {
50
- type: 'string',
51
- label: 'messaging-sender-id',
52
- name: 'messagingSenderId',
53
- property: 'messagingSenderId'
54
- },
55
- {
56
- type: 'string',
57
- label: 'child-data-path',
58
- name: 'childDataPath',
59
- property: 'childDataPath'
60
- },
61
- {
62
- type: 'string',
63
- label: 'email-id',
64
- name: 'email',
65
- property: 'email'
66
- },
67
- {
68
- type: 'string',
69
- label: 'password',
70
- name: 'password',
71
- property: 'password'
72
- }
73
- ]
74
- // help: 'scene/component/firebase'
75
- }
76
-
77
- const FIREBASE_IMAGE =
78
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAMAAAAKE/YAAAABiVBMVEVHcEz/01z/vkLztDj/xkr1szn9wEX7v0j5uD//11n1sjf/w0b9vUT/xUb/sS3poSb/rST/tTrxqSv/sjD/tjjsoyT/qx7/tTbpoST/ryn/00r/riX/tDT/tz7/rynpoibooCXpnSj/0UL/rSL/zzv/xE7/0UL/sjHuqyXuqybtqCfqpCb/00r/qhv/zjb/0UL/zjj/zTT/sS//ryf/uEH4skL/1lf/uUD/yir/zC//yyz/yy7/yy3/zDD1ggv1ggz2gw31gQr0gAn+pAz1fQv/0Sr+ogr0gAz/4UT9pg73lw73gAz9og3/zynvbQD/zSn4mg77oA36nQ38zVPudA33jg3wkxD0lA7ucQr1iAz8yVD2uSjwbwDzsyf/0y/7wir/4EH5vij/0C7wrif4kgD+yCvxjA7ubgj9xSjpgQr8yULydQD/qBT/pAn/pxL/pg//qRf/phH/pQ7/oQT/phD/qBb/qx3/pQ3/pAv/2ED/zDH/pA3/tz//ySf+pQ/+0lT/yyv/ySP/yinifeuoAAAAOHRSTlMAFFwZRQgrDiHhNFE8a7py7INK/nfS3o+WnXr+ZqGusIZZnNDJA7vR7fjlvq705o3Z89/GrcqI9AO1jy8AAApzSURBVHhe7NjdjtJQFIZhqYUZhWkgm0i04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uVBDbsz9zcdWdEc1ABn7m9CcvP90/q1t8H9Tc1tbF67szD9BfAOPmLZKdo94cz7t/XgXUSlJHzSmfAytL/hY9No7OfM/WXwZvykrRH7OHN/DuCZsRG7Hs5iwP7ZGJsdF/nImUx/C3AAHhvCh863/ZPcnyOYscHHzkjcn0MESXVC/bczUtOG4CTm+4d078z9uUj+MzZ32tyfu4QbUyQ7f+/fChzHvxYpkH6VSRYZuAx//+pPgVfEmftznuW6lbJpZFWkAfwfvCxN0jDyYRgzMzMzM1/dCbx3RzPDJwAAAABJRU5ErkJggg=='
79
-
80
- var idx = 0
81
-
82
- export default class Firebase extends DataSource(RectPath(Shape)) {
83
- private static _image: HTMLImageElement
84
- private _firebase_app: any
85
- private _firebase_auth: any
86
- private _firebase_ref: any
87
-
88
- static get image() {
89
- if (!Firebase._image) {
90
- Firebase._image = new Image()
91
- Firebase._image.src = FIREBASE_IMAGE
92
- }
93
-
94
- return Firebase._image
95
- }
96
-
97
- added() {
98
- if (!this.app.isViewMode || this._firebase_app) {
99
- return
100
- }
101
-
102
- try {
103
- this._initFirebase()
104
- } catch (err) {
105
- error(err)
106
- }
107
- }
108
-
109
- _onValue(snapshot: any) {
110
- this.data = snapshot.val()
111
- }
112
-
113
- _initFirebase() {
114
- var {
115
- apiKey,
116
- authDomain,
117
- databaseURL,
118
- projectId,
119
- storageBucket,
120
- messagingSenderId,
121
- childDataPath,
122
- email,
123
- password
124
- } = this.state
125
-
126
- var self = this
127
-
128
- this._firebase_app = initializeApp(
129
- { apiKey, authDomain, databaseURL, projectId, storageBucket, messagingSenderId },
130
- 'FBAPP-' + ++idx
131
- )
132
- this._firebase_auth = getAuth(this._firebase_app)
133
-
134
- onAuthStateChanged(this._firebase_auth, (firebaseUser: any) => {
135
- if (firebaseUser) {
136
- console.log('logged in', firebaseUser)
137
- const database = getDatabase(this._firebase_app)
138
- const parent = ref(database)
139
- self._firebase_ref = child(parent, childDataPath)
140
- onValue(self._firebase_ref, self._onValue.bind(self))
141
- } else {
142
- console.log('not logged in.')
143
- }
144
- })
145
-
146
- var promise = email
147
- ? signInWithEmailAndPassword(this._firebase_auth, email, password)
148
- : signInAnonymously(this._firebase_auth)
149
-
150
- promise.catch((e: Error) => console.log(e.message))
151
- }
152
-
153
- dispose() {
154
- if (this._firebase_app) {
155
- try {
156
- this._firebase_ref && this._firebase_ref.off('value', this._onValue, this)
157
- this._firebase_auth && signOut(this._firebase_auth)
158
- this._firebase_app && deleteApp(this._firebase_app)
159
-
160
- console.log('disposed - firebase')
161
- } catch (e) {
162
- console.error(e)
163
- }
164
- }
165
-
166
- delete this._firebase_auth
167
- delete this._firebase_ref
168
- delete this._firebase_app
169
-
170
- super.dispose()
171
- }
172
-
173
- render(context: CanvasRenderingContext2D) {
174
- var { left, top, width, height } = this.bounds
175
-
176
- context.beginPath()
177
- this.drawImage(context, Firebase.image, left, top, width, height)
178
- }
179
-
180
- get nature() {
181
- return NATURE
182
- }
183
- }
184
-
185
- Component.register('firebase', Firebase)
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- export { default as Firebase } from './firebase'
@@ -1,67 +0,0 @@
1
- <!doctype html>
2
- <!--
3
- @license
4
- Copyright © 2017 HatioLab Inc. All rights reserved.
5
- -->
6
- <html>
7
- <head>
8
- <meta charset="utf-8">
9
- <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
10
-
11
- <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
12
- <script src="../../web-component-tester/browser.js"></script>
13
-
14
- <!-- Step 1: import the element to test -->
15
- <link rel="import" href="../things-scene-firebase.html">
16
- </head>
17
- <body>
18
-
19
- <!-- You can use the document as a place to set up your fixtures. -->
20
- <test-fixture id="things-scene-firebase-fixture">
21
- <template>
22
- <things-scene-firebase>
23
- <h2>things-scene-firebase</h2>
24
- </things-scene-firebase>
25
- </template>
26
- </test-fixture>
27
-
28
- <script>
29
- suite('<things-scene-firebase>', function() {
30
-
31
- var myEl;
32
-
33
- setup(function() {
34
- myEl = fixture('things-scene-firebase-fixture');
35
- });
36
-
37
- test('defines the "author" property', function() {
38
- assert.equal(myEl.author.name, 'Dimitri Glazkov');
39
- assert.equal(myEl.author.image, 'http://addyosmani.com/blog/wp-content/uploads/2013/04/unicorn.jpg');
40
- });
41
-
42
- test('says hello', function() {
43
- assert.equal(myEl.sayHello(), 'things-scene-firebase says, Hello World!');
44
-
45
- var greetings = myEl.sayHello('greetings Earthlings');
46
- assert.equal(greetings, 'things-scene-firebase says, greetings Earthlings');
47
- });
48
-
49
- test('fires lasers', function(done) {
50
- myEl.addEventListener('things-scene-firebase-lasers', function(event) {
51
- assert.equal(event.detail.sound, 'Pew pew!');
52
- done();
53
- });
54
- myEl.fireLasers();
55
- });
56
-
57
- test('distributed children', function() {
58
- var els = myEl.getContentChildren();
59
- assert.equal(els.length, 1, 'one distributed node');
60
- assert.equal(els[0], myEl.querySelector('h2'), 'content distributed correctly');
61
- });
62
-
63
- });
64
- </script>
65
-
66
- </body>
67
- </html>
package/test/index.html DELETED
@@ -1,22 +0,0 @@
1
- <!DOCTYPE html>
2
- <!--
3
- @license
4
- Copyright © 2017 HatioLab Inc. All rights reserved.
5
- -->
6
- <html><head>
7
- <meta charset="utf-8">
8
- <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
9
-
10
- <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
11
- <script src="../../web-component-tester/browser.js"></script>
12
- </head>
13
- <body>
14
- <script>
15
- // Load and run all tests (.html, .js):
16
- WCT.loadSuites([
17
- 'basic-test.html',
18
- 'basic-test.html?dom=shadow'
19
- ]);
20
- </script>
21
-
22
- </body></html>
@@ -1,32 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import './util'
5
-
6
- import { expect } from 'chai'
7
-
8
- import '../../bower_components/things-scene-core/things-scene-min'
9
- import { Firebase } from '../../src/index'
10
-
11
- describe('Firebase', function () {
12
-
13
- var board;
14
-
15
- beforeEach(function () {
16
- board = scene.create({
17
- model: {
18
- components: [{
19
- id: 'firebase',
20
- type: 'firebase'
21
- }]
22
- }
23
- })
24
- });
25
-
26
- it('component should be found by its id.', function () {
27
-
28
- var component = board.findById('firebase')
29
-
30
- expect(!!component).not.to.equal(false);
31
- });
32
- });
package/test/unit/util.js DELETED
@@ -1,21 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- var noop = () => {}
5
-
6
- global.Canvas = require('canvas');
7
-
8
- Canvas.prototype.setAttribute = noop;
9
- Canvas.prototype.style = {};
10
-
11
- global.Image = Canvas.Image;
12
- global.screen = {
13
- width: 1280,
14
- height: 800
15
- };
16
-
17
- global.window = global;
18
-
19
- global.addEventListener = noop;
20
- global.location = {};
21
- global.getComputedStyle = noop;
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2018",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "noEmitOnError": true,
7
- "lib": ["es2019", "dom"],
8
- "strict": true,
9
- "esModuleInterop": false,
10
- "allowJs": true,
11
- "allowSyntheticDefaultImports": true,
12
- "experimentalDecorators": true,
13
- "importHelpers": true,
14
- "outDir": "dist",
15
- "sourceMap": true,
16
- "inlineSources": true,
17
- "rootDir": "src",
18
- "declaration": true,
19
- "incremental": true,
20
- "skipLibCheck": true,
21
- "types": []
22
- },
23
- "include": ["**/*.ts", "*.d.ts"]
24
- }
@@ -1 +0,0 @@
1
- {"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/tslib/tslib.d.ts","../../node_modules/@hatiolab/things-scene/things-scene.d.ts","../../node_modules/@firebase/component/dist/src/provider.d.ts","../../node_modules/@firebase/component/dist/src/component_container.d.ts","../../node_modules/@firebase/component/dist/src/types.d.ts","../../node_modules/@firebase/component/dist/src/component.d.ts","../../node_modules/@firebase/component/dist/index.d.ts","../../node_modules/@firebase/util/dist/util-public.d.ts","../../node_modules/@firebase/logger/dist/src/logger.d.ts","../../node_modules/@firebase/logger/dist/index.d.ts","../../node_modules/@firebase/app/dist/app-public.d.ts","../../node_modules/firebase/app/dist/app/index.d.ts","../../node_modules/@firebase/database/dist/public.d.ts","../../node_modules/firebase/database/dist/database/index.d.ts","../../node_modules/@firebase/auth/dist/auth-public.d.ts","../../node_modules/firebase/auth/dist/auth/index.d.ts","./src/firebase.ts","./src/index.ts"],"fileIdsList":[[44,45,47],[45,48],[40,41,42,43],[42],[40,42,43],[41,42,43],[41],[46],[48],[52],[50],[38,39,49,51,53],[38,54]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"ef4e4dc2fd14de20903f5010671dab9cf547c831dce4802306676c80649b990b","impliedFormat":1},{"version":"e94b01c6c9221682a1ffd8577103408642c5433923420e517d8d8c695c4875c0","impliedFormat":1},{"version":"466a15bf7238ebd3900d136db38eec3af69d0761c0286ab59952870eedd6e319","impliedFormat":1},{"version":"9113ebe8d776516d3a302ec431d28915c9398a75beaef1eb38cd66ae0bfeb014","impliedFormat":1},{"version":"1f4df460bfe98e20fae494ade49e50c98ed1997143c7eae7a00a1cd93bfd4307","impliedFormat":1},{"version":"e179bf25417780781dc994f657e724419e6dcbe5a136dbfa55efefe36bdb4b63","impliedFormat":1},{"version":"2a0fdc4e3ff0daab68692c115db4609206e029061fc2803a342973da34f57901","impliedFormat":1},{"version":"a0abcb32b7a9291276879912c9a3205fbd1d6930ae4f29e91fe30227e2762893","impliedFormat":1},{"version":"b67fb584ca2449669c113e75866d339ee4e6bc74a441efd00c1beac460412584","impliedFormat":1},{"version":"90e7ca3372483129ad265c604b2225e250a4739ed966c3859648332ae36ed4fa","impliedFormat":1},{"version":"0f79f9784797e5358bbed18b363b220eaed94de7c1ed2f193465ac232fe48eb1","impliedFormat":1},{"version":"002f8f7a43c8ffdada27365975af3f55909314f83cb2050098633e7625a23bfc","impliedFormat":1},{"version":"74811fe19eb02d382d9f7b4d35fc1253a976a5f017895065f069345dfb379bb2","impliedFormat":1},{"version":"ccd344713e6f39583ac472a097e8dd307998d1c27d43b0b0f4558db1569ee3fc","impliedFormat":1},{"version":"6187d97d074e4a66a0179ff2cdd845e1809b70ff5d7b857e0c686f52a86f62f7","impliedFormat":1},{"version":"615f791e6f78bde53794cd91f05d413f62fc24a5f943258f298110e568c156c0","signature":"9b5d2793aeaaa34d2257f7c411960a5ae61ed98be042478da2c9c2f25d8eebac","affectsGlobalScope":true},{"version":"90775e7d9ecf06209058940ee88539d3b6fa7fb73cb4a6e7c133993636e59323","signature":"c2fdffc89e2a4d1ee0f0772c080dd3abb805699a3f2817317d094d9e3bcddbb8"}],"root":[54,55],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"declaration":true,"esModuleInterop":false,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":99,"noEmitOnError":true,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":5},"referencedMap":[[48,1],[52,2],[44,3],[43,4],[41,5],[40,6],[42,7],[50,2],[47,8],[49,9],[53,10],[51,11],[54,12],[55,13]],"version":"5.7.2"}