@iebh/tera-fy 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,8 +1,23 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
3
+ ## [1.2.2](https://github.com/IEBH/TERA-fy/compare/v1.2.1...v1.2.2) (2024-04-11)
4
4
 
5
- ## [1.2.0](https://github.com/IEBH/TERA-fy/compare/v1.1.0...v1.2.0) (2024-04-11)
5
+ ## [1.2.1](https://github.com/IEBH/TERA-fy/compare/v1.2.0...v1.2.1) (2024-04-11)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Handle file meta data where created/modified/accessed dates are omitted for some reason ([1544723](https://github.com/IEBH/TERA-fy/commit/1544723ec6ce4478541a07baa0e44cb120f7e929))
11
+ * Handle nullish errors on RPC calls ([f873029](https://github.com/IEBH/TERA-fy/commit/f8730294e8a7dbf08602edf87ce2926695238592))
12
+
13
+
14
+
15
+ # [1.2.0](https://github.com/IEBH/TERA-fy/compare/v1.1.0...v1.2.0) (2024-04-11)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Wrong inherited argument when running setProjectLibrary() ([aaaca64](https://github.com/IEBH/TERA-fy/commit/aaaca641847aae9e7a72b4423282002e3b125e70))
6
21
 
7
22
 
8
23
  ### Features
@@ -12,11 +27,13 @@ All notable changes to this project will be documented in this file. See [commit
12
27
  * setProjectLibrary() can now prompt for a file path if none is specified ([62a5f03](https://github.com/IEBH/TERA-fy/commit/62a5f031c0b6ef9f8b72dfee335e4fa79fdffdfb))
13
28
 
14
29
 
15
- ### Bug Fixes
16
30
 
17
- * Wrong inherited argument when running setProjectLibrary() ([aaaca64](https://github.com/IEBH/TERA-fy/commit/aaaca641847aae9e7a72b4423282002e3b125e70))
31
+ # [1.1.0](https://github.com/IEBH/TERA-fy/compare/v1.0.24...v1.1.0) (2024-04-09)
32
+
33
+
34
+ ### Bug Fixes
18
35
 
19
- ## [1.1.0](https://github.com/IEBH/TERA-fy/compare/v1.0.24...v1.1.0) (2024-04-09)
36
+ * Yet more files added to prerelease step ([399c6f8](https://github.com/IEBH/TERA-fy/commit/399c6f8d6c5080238c079c12b16add7eebeb1d7e))
20
37
 
21
38
 
22
39
  ### Features
@@ -24,9 +41,6 @@ All notable changes to this project will be documented in this file. See [commit
24
41
  * File saving UI ([b2f8809](https://github.com/IEBH/TERA-fy/commit/b2f8809a960880b951072127d7492b31aa29b03a))
25
42
 
26
43
 
27
- ### Bug Fixes
28
-
29
- * Yet more files added to prerelease step ([399c6f8](https://github.com/IEBH/TERA-fy/commit/399c6f8d6c5080238c079c12b16add7eebeb1d7e))
30
44
 
31
45
  ## [1.0.24](https://github.com/IEBH/TERA-fy/compare/v1.0.23...v1.0.24) (2024-04-05)
32
46
 
@@ -35,271 +49,291 @@ All notable changes to this project will be documented in this file. See [commit
35
49
 
36
50
  * Yet another fix for setProjectState() throwing when trying to save + remove defunct {sync:Boolean} option ([4e320ec](https://github.com/IEBH/TERA-fy/commit/4e320ec8f171237387db7404a7209b4ca51898c8))
37
51
 
52
+
53
+
38
54
  ## [1.0.23](https://github.com/IEBH/TERA-fy/compare/v1.0.22...v1.0.23) (2024-04-04)
39
55
 
40
- ## <small>1.0.22 (2024-04-04)</small>
41
56
 
42
- * chore(release): 1.0.21 ([9da4c7d](https://github.com/IEBH/TERA-fy/commit/9da4c7d))
43
- * chore(release): 1.0.22 ([2ae789a](https://github.com/IEBH/TERA-fy/commit/2ae789a))
44
- * fix: Missing Promise chain response during setProjectState() ([1fb7f29](https://github.com/IEBH/TERA-fy/commit/1fb7f29))
45
57
 
58
+ ## [1.0.22](https://github.com/IEBH/TERA-fy/compare/v1.0.21...v1.0.22) (2024-04-04)
59
+
60
+
61
+ ### Bug Fixes
62
+
63
+ * Missing Promise chain response during setProjectState() ([1fb7f29](https://github.com/IEBH/TERA-fy/commit/1fb7f29d01103f2396f89dd31928dabb48150328))
64
+
65
+
66
+
67
+ ## [1.0.21](https://github.com/IEBH/TERA-fy/compare/v1.0.20...v1.0.21) (2024-04-03)
68
+
69
+
70
+ ### Bug Fixes
71
+
72
+ * Added projectFile class build to frontend scripts ([b21fe29](https://github.com/IEBH/TERA-fy/commit/b21fe29cdb20c67307e0c5cd6d4d73d945a33b8e))
73
+ * Missing dep ([9bf58e4](https://github.com/IEBH/TERA-fy/commit/9bf58e467a89886ca5c17c3209a503df2c7dba26))
74
+
75
+
76
+ ### Features
77
+
78
+ * More edits to <tera-file-select/> ([efc49f7](https://github.com/IEBH/TERA-fy/commit/efc49f7fc81d02081cfd4cb17fe6dfec9a12969b))
79
+ * Moved ProjectLibrary file into its own classdef + added more file setter methods ([6c8eac3](https://github.com/IEBH/TERA-fy/commit/6c8eac3c9c853f5f5cf367dea82062b236163f9f))
80
+ * Stash + retrieve login data from LocalStorage when using embed + popup window workaround method ([e9ec32c](https://github.com/IEBH/TERA-fy/commit/e9ec32c253c2cb3bd7c8312cd2ad61432b24542a))
81
+
82
+
83
+
84
+ ## [1.0.20](https://github.com/IEBH/TERA-fy/compare/v1.0.19...v1.0.20) (2024-04-02)
85
+
86
+
87
+ ### Bug Fixes
88
+
89
+ * Yet more $auth screw-around with window.opener magic ([d140da1](https://github.com/IEBH/TERA-fy/commit/d140da1d7760713b35ffca58a688c638f094869e))
90
+
91
+
92
+
93
+ ## [1.0.19](https://github.com/IEBH/TERA-fy/compare/v1.0.18...v1.0.19) (2024-04-02)
94
+
95
+
96
+ ### Features
46
97
 
98
+ * Start on <tera-library-select/> Vue component ([aa42855](https://github.com/IEBH/TERA-fy/commit/aa42855df0b4e32b0b3a08e4e86021faf3ac8ca6))
47
99
 
48
- ## <small>1.0.21 (2024-04-03)</small>
49
100
 
50
- * 1.0.21 ([7c78b7e](https://github.com/IEBH/TERA-fy/commit/7c78b7e))
51
- * docs: Rebuild ([080a0d2](https://github.com/IEBH/TERA-fy/commit/080a0d2))
52
- * feat: More edits to <tera-file-select/> ([efc49f7](https://github.com/IEBH/TERA-fy/commit/efc49f7))
53
- * feat: Moved ProjectLibrary file into its own classdef + added more file setter methods ([6c8eac3](https://github.com/IEBH/TERA-fy/commit/6c8eac3))
54
- * feat: Stash + retrieve login data from LocalStorage when using embed + popup window workaround metho ([e9ec32c](https://github.com/IEBH/TERA-fy/commit/e9ec32c))
55
- * refactor: Seperate Embed workaround code into its own function ([984c37a](https://github.com/IEBH/TERA-fy/commit/984c37a))
56
- * fix: Added projectFile class build to frontend scripts ([b21fe29](https://github.com/IEBH/TERA-fy/commit/b21fe29))
57
- * fix: Missing dep ([9bf58e4](https://github.com/IEBH/TERA-fy/commit/9bf58e4))
58
101
 
102
+ ## [1.0.18](https://github.com/IEBH/TERA-fy/compare/v1.0.17...v1.0.18) (2024-04-02)
59
103
 
60
104
 
61
- ## <small>1.0.20 (2024-04-02)</small>
105
+ ### Bug Fixes
62
106
 
63
- * 1.0.20 ([5c20b5c](https://github.com/IEBH/TERA-fy/commit/5c20b5c))
64
- * docs: Doc rebuild ([841f04f](https://github.com/IEBH/TERA-fy/commit/841f04f))
65
- * fix: Yet more $auth screw-around with window.opener magic ([d140da1](https://github.com/IEBH/TERA-fy/commit/d140da1))
107
+ * Auto call to requireProject() in Vue2 mode ([f592cfb](https://github.com/IEBH/TERA-fy/commit/f592cfbd0c2f9373b1fb95203684ebb3b2acf81b))
108
+ * Dont rely on server auth populating $auth.user.id ([73f8c85](https://github.com/IEBH/TERA-fy/commit/73f8c85c17d6e79184ecc5b9929739da33b57786))
109
+ * Logic error when setting project state ([7fcd826](https://github.com/IEBH/TERA-fy/commit/7fcd8265d2f15f28df99b0271396e9467ab91a20))
110
+ * Subclass _pathSet() when in Vue2 mode ([ea5537e](https://github.com/IEBH/TERA-fy/commit/ea5537e34d11170b3296d75861425a0db162f0ba))
66
111
 
67
112
 
113
+ ### Features
68
114
 
69
- ## <small>1.0.19 (2024-04-02)</small>
115
+ * Added method to try authenticating locally via a popup when in embedded mode ([7286958](https://github.com/IEBH/TERA-fy/commit/72869585c7f203f330815c9dba5f4b0f36a350e8))
116
+ * Added prototype window mode for client ([9241854](https://github.com/IEBH/TERA-fy/commit/92418548dfd213396acb082acf9dae08b441a374))
117
+ * Added subclassable {has,get,set}Path methods to client for state setting ([a4acedf](https://github.com/IEBH/TERA-fy/commit/a4acedf214af3cc612b2a1a1975070dc6ee87015))
118
+ * Button selection when using uiAlert() ([118223f](https://github.com/IEBH/TERA-fy/commit/118223fb3407b5c58c79aeeb37053b4fab9a6d0f))
119
+ * getUser({forceRetry:Boolean}) ([15b8efd](https://github.com/IEBH/TERA-fy/commit/15b8efd521486326652afb692dd816f10a30940b))
120
+ * uiSplat() + uiWindow() ([a72fc33](https://github.com/IEBH/TERA-fy/commit/a72fc33e05c64d4428ef4c747684504edc51bd09))
70
121
 
71
- * 1.0.19 ([0593adb](https://github.com/IEBH/TERA-fy/commit/0593adb))
72
- * docs: Docs rebuild ([0c39fa2](https://github.com/IEBH/TERA-fy/commit/0c39fa2))
73
- * feat: Start on <tera-library-select/> Vue component ([aa42855](https://github.com/IEBH/TERA-fy/commit/aa42855))
74
- * devops: Added sanity check for $auth sticking in a loop on the server ([23f197d](https://github.com/IEBH/TERA-fy/commit/23f197d))
75
- * devops: Disabled sourcemapping as its too much of a headfuck when its not mapping correctly ([f9f6b76](https://github.com/IEBH/TERA-fy/commit/f9f6b76))
76
122
 
77
123
 
124
+ ## [1.0.17](https://github.com/IEBH/TERA-fy/compare/v1.0.16...v1.0.17) (2024-03-14)
78
125
 
79
- ## <small>1.0.18 (2024-04-02)</small>
80
126
 
81
- * 1.0.18 ([fa9d2db](https://github.com/IEBH/TERA-fy/commit/fa9d2db))
82
- * docs: Misc comment / code cleanup ([b1e0e38](https://github.com/IEBH/TERA-fy/commit/b1e0e38))
83
- * docs: Rebuild all files + docs ([a73a69a](https://github.com/IEBH/TERA-fy/commit/a73a69a))
84
- * docs: Rebuild docs ([623c4e4](https://github.com/IEBH/TERA-fy/commit/623c4e4))
85
- * feat: Added method to try authenticating locally via a popup when in embedded mode ([7286958](https://github.com/IEBH/TERA-fy/commit/7286958))
86
- * feat: Added prototype window mode for client ([9241854](https://github.com/IEBH/TERA-fy/commit/9241854))
87
- * feat: Added subclassable {has,get,set}Path methods to client for state setting ([a4acedf](https://github.com/IEBH/TERA-fy/commit/a4acedf))
88
- * feat: Button selection when using uiAlert() ([118223f](https://github.com/IEBH/TERA-fy/commit/118223f))
89
- * feat: getUser({forceRetry:Boolean}) ([15b8efd](https://github.com/IEBH/TERA-fy/commit/15b8efd))
90
- * feat: uiSplat() + uiWindow() ([a72fc33](https://github.com/IEBH/TERA-fy/commit/a72fc33))
91
- * refactor: Juggle various {,peer,optional}depedencies config ([aee116a](https://github.com/IEBH/TERA-fy/commit/aee116a))
92
- * refactor: Promise Deferred util ([8e4f1a8](https://github.com/IEBH/TERA-fy/commit/8e4f1a8))
93
- * refactor: Stepped auth when calling requireUser() ([562798a](https://github.com/IEBH/TERA-fy/commit/562798a))
94
- * devops: Added `npm run watch` script to main to rebuild client libraries on change ([48fa42a](https://github.com/IEBH/TERA-fy/commit/48fa42a))
95
- * fix: Auto call to requireProject() in Vue2 mode ([f592cfb](https://github.com/IEBH/TERA-fy/commit/f592cfb))
96
- * fix: Dont rely on server auth populating $auth.user.id ([73f8c85](https://github.com/IEBH/TERA-fy/commit/73f8c85))
97
- * fix: Logic error when setting project state ([7fcd826](https://github.com/IEBH/TERA-fy/commit/7fcd826))
98
- * fix: Subclass _pathSet() when in Vue2 mode ([ea5537e](https://github.com/IEBH/TERA-fy/commit/ea5537e))
127
+ ### Bug Fixes
99
128
 
129
+ * Typo ([98fad09](https://github.com/IEBH/TERA-fy/commit/98fad09c2c875b2b6b7158afb5d77ae41ecb6e65))
100
130
 
101
131
 
102
- ## <small>1.0.17 (2024-03-14)</small>
132
+ ### Features
103
133
 
104
- * 1.0.17 ([51c98a7](https://github.com/IEBH/TERA-fy/commit/51c98a7))
105
- * refactor: getProjectLibrary() -> parseProjectLibrary() ([f477c9d](https://github.com/IEBH/TERA-fy/commit/f477c9d))
106
- * refactor: Split selectProjectLibrary() -> selectProjectFile() + selectProjectLibrary() + added stub ([1e3d517](https://github.com/IEBH/TERA-fy/commit/1e3d517))
107
- * fix: Typo ([98fad09](https://github.com/IEBH/TERA-fy/commit/98fad09))
108
- * docs: Added File Hints reference ([bfbeb24](https://github.com/IEBH/TERA-fy/commit/bfbeb24))
109
- * docs: Rebuild docs ([954d7b9](https://github.com/IEBH/TERA-fy/commit/954d7b9))
110
- * feat: Filled out stubs for {get,set,select}ProjectLibrary() ([0bdbfd9](https://github.com/IEBH/TERA-fy/commit/0bdbfd9))
134
+ * Filled out stubs for {get,set,select}ProjectLibrary() ([0bdbfd9](https://github.com/IEBH/TERA-fy/commit/0bdbfd943e2613d917be8c64e22893ab8fcb1b86))
111
135
 
112
136
 
113
137
 
114
- ## <small>1.0.16 (2024-03-06)</small>
138
+ ## [1.0.16](https://github.com/IEBH/TERA-fy/compare/v1.0.15...v1.0.16) (2024-03-06)
115
139
 
116
- * 1.0.16 ([dcd0fe0](https://github.com/IEBH/TERA-fy/commit/dcd0fe0))
117
- * feat: getLibraryFile() now supports multiple file transforms before handing contents to requester ([e413bd9](https://github.com/IEBH/TERA-fy/commit/e413bd9))
118
- * fix: Dont try to inject undef values when devmode is enabled but the site URL isnt a string ([47598b2](https://github.com/IEBH/TERA-fy/commit/47598b2))
119
140
 
141
+ ### Bug Fixes
120
142
 
143
+ * Dont try to inject undef values when devmode is enabled but the site URL isnt a string ([47598b2](https://github.com/IEBH/TERA-fy/commit/47598b25ad82e6e7cd9eb11fa304bce94595073f))
121
144
 
122
- ## <small>1.0.15 (2024-02-29)</small>
123
145
 
124
- * 1.0.15 ([9e4e450](https://github.com/IEBH/TERA-fy/commit/9e4e450))
125
- * docs: Rebuild docs ([83e9ddc](https://github.com/IEBH/TERA-fy/commit/83e9ddc))
126
- * feat: requireUser() + call to it from requireProject() ([d4eedfa](https://github.com/IEBH/TERA-fy/commit/d4eedfa))
127
- * feat: uiAlert() ([09da928](https://github.com/IEBH/TERA-fy/commit/09da928))
128
- * ux: Bypass requestFocus() actions when already operating as top-level TERA ([9e2515d](https://github.com/IEBH/TERA-fy/commit/9e2515d))
146
+ ### Features
129
147
 
148
+ * getLibraryFile() now supports multiple file transforms before handing contents to requester ([e413bd9](https://github.com/IEBH/TERA-fy/commit/e413bd9e91f3e152ecf334f96d276d6a89d6ea66))
130
149
 
131
150
 
132
- ## <small>1.0.14 (2024-02-27)</small>
133
151
 
134
- * 1.0.14 ([fd53cdc](https://github.com/IEBH/TERA-fy/commit/fd53cdc))
135
- * fix: yet more fixes to Live version of TERA-fy deployed to Live TERA ([f72fb8d](https://github.com/IEBH/TERA-fy/commit/f72fb8d))
152
+ ## [1.0.15](https://github.com/IEBH/TERA-fy/compare/v1.0.14...v1.0.15) (2024-02-29)
136
153
 
137
154
 
155
+ ### Features
138
156
 
139
- ## <small>1.0.13 (2024-02-27)</small>
157
+ * requireUser() + call to it from requireProject() ([d4eedfa](https://github.com/IEBH/TERA-fy/commit/d4eedfa97fb744298db9c8c04fcb79834c86ad4d))
158
+ * uiAlert() ([09da928](https://github.com/IEBH/TERA-fy/commit/09da9282beb00fc644bcde34a583b4b16f9f2854))
140
159
 
141
- * 1.0.13 ([be6b15f](https://github.com/IEBH/TERA-fy/commit/be6b15f))
142
- * task: Rebuild /dist ([09fa084](https://github.com/IEBH/TERA-fy/commit/09fa084))
143
- * feat: Added @vue/cli-service compatible version (ESM + ES2019 spec) ([56501c9](https://github.com/IEBH/TERA-fy/commit/56501c9))
144
- * feat: TERA-fy client can now opt-in to sandbox overrides in dev mode ([550ac9c](https://github.com/IEBH/TERA-fy/commit/550ac9c))
145
- * fix: Wrong DOM reference when searching for external iFrame from top-level TERA window ([51a0ab8](https://github.com/IEBH/TERA-fy/commit/51a0ab8))
146
- * fix: Wrong external referencing for Vue2 plugin ([ddd7068](https://github.com/IEBH/TERA-fy/commit/ddd7068))
147
- * ux: Provide each plugin with a copy of the TERA-fy client settings during init ([705ac7b](https://github.com/IEBH/TERA-fy/commit/705ac7b))
148
160
 
149
161
 
162
+ ## [1.0.14](https://github.com/IEBH/TERA-fy/compare/v1.0.13...v1.0.14) (2024-02-27)
150
163
 
151
- ## <small>1.0.12 (2024-02-22)</small>
152
164
 
153
- * 1.0.12 ([4b6a9a8](https://github.com/IEBH/TERA-fy/commit/4b6a9a8))
154
- * docs: Docs rebuild ([ac52784](https://github.com/IEBH/TERA-fy/commit/ac52784))
155
- * docs: Rebuild docs ([b95d407](https://github.com/IEBH/TERA-fy/commit/b95d407))
156
- * feat: Added setProjectStateDefaults() to make priming defaults easier ([55a6ce8](https://github.com/IEBH/TERA-fy/commit/55a6ce8))
157
- * test: Dropped the defunct terafy.subscribeProjectState demo ([01e585b](https://github.com/IEBH/TERA-fy/commit/01e585b))
158
- * refactor: Various misc cleanup ([7c19c26](https://github.com/IEBH/TERA-fy/commit/7c19c26))
159
- * fix: Tweaks to what is included in the NPM tarball ([e2cf7e0](https://github.com/IEBH/TERA-fy/commit/e2cf7e0))
165
+ ### Bug Fixes
160
166
 
167
+ * yet more fixes to Live version of TERA-fy deployed to Live TERA ([f72fb8d](https://github.com/IEBH/TERA-fy/commit/f72fb8de2329d63aa1cacc2e6c962f9370a2c75a))
161
168
 
162
169
 
163
- ## <small>1.0.11 (2024-02-21)</small>
164
170
 
165
- * 1.0.11 ([d5638b8](https://github.com/IEBH/TERA-fy/commit/d5638b8))
166
- * fix: Added @mfdc/supabase-reactive as a dep for the Vue plugins ([2f7900d](https://github.com/IEBH/TERA-fy/commit/2f7900d))
167
- * feat: Added events / EventEmitter pattern to accept flushed updates from server ([458ce79](https://github.com/IEBH/TERA-fy/commit/458ce79))
168
- * feat: Client can now tell server where its loaded from via setServerMode() ([b7c5fc0](https://github.com/IEBH/TERA-fy/commit/b7c5fc0))
169
- * feat: Updated Vue plugins (2+3) to handle remote project state changes ([0abf7b4](https://github.com/IEBH/TERA-fy/commit/0abf7b4))
170
- * docs: Updated function signatures between client & server ([dc1117a](https://github.com/IEBH/TERA-fy/commit/dc1117a))
171
- * refactor: Move horrible mixin() handler into its own utility library ([713e26b](https://github.com/IEBH/TERA-fy/commit/713e26b))
171
+ ## [1.0.13](https://github.com/IEBH/TERA-fy/compare/v1.0.12...v1.0.13) (2024-02-27)
172
172
 
173
173
 
174
+ ### Bug Fixes
174
175
 
175
- ## <small>1.0.10 (2024-02-18)</small>
176
+ * Wrong DOM reference when searching for external iFrame from top-level TERA window ([51a0ab8](https://github.com/IEBH/TERA-fy/commit/51a0ab8df52de8a4822dc62e3b3318187cd94dcb))
177
+ * Wrong external referencing for Vue2 plugin ([ddd7068](https://github.com/IEBH/TERA-fy/commit/ddd7068fb0e00fa6d203cf5d4650f4138595aaa6))
176
178
 
177
- * 1.0.10 ([bac8908](https://github.com/IEBH/TERA-fy/commit/bac8908))
178
- * docs: Added API docs for TERA-fy client ([ca34abf](https://github.com/IEBH/TERA-fy/commit/ca34abf))
179
- * docs: Added example invocation for Vue plugins ([5205235](https://github.com/IEBH/TERA-fy/commit/5205235))
180
- * docs: Added header area to playground + fixed TeraFy JS url ([2fdd565](https://github.com/IEBH/TERA-fy/commit/2fdd565))
181
- * docs: Added link to generated docs pages ([7670ff9](https://github.com/IEBH/TERA-fy/commit/7670ff9))
182
- * docs: Added stub functions to client so that JSDoc can pick them up ([371a18e](https://github.com/IEBH/TERA-fy/commit/371a18e))
183
- * docs: API doc build process + first generation build ([81c7ff4](https://github.com/IEBH/TERA-fy/commit/81c7ff4))
184
- * docs: Documentation compiler is now more specific about doc listing order ([6353f15](https://github.com/IEBH/TERA-fy/commit/6353f15))
185
- * docs: Dont allow project changing if there are no projects listed ([3aff5dc](https://github.com/IEBH/TERA-fy/commit/3aff5dc))
186
- * docs: More API adjustment options ([1cd8a1d](https://github.com/IEBH/TERA-fy/commit/1cd8a1d))
187
- * docs: More docs tidying ([1d2911f](https://github.com/IEBH/TERA-fy/commit/1d2911f))
188
- * docs: More links in README + small cleanup ([6729637](https://github.com/IEBH/TERA-fy/commit/6729637))
189
- * docs: Move playground into docs folder ([07d5d45](https://github.com/IEBH/TERA-fy/commit/07d5d45))
190
- * docs: Rebuild docs ([709241c](https://github.com/IEBH/TERA-fy/commit/709241c))
191
- * docs: Reformat links to TERA-Explorer ([8d2242a](https://github.com/IEBH/TERA-fy/commit/8d2242a))
192
- * docs: Various docs fixups ([4add13a](https://github.com/IEBH/TERA-fy/commit/4add13a))
193
- * docs: Yet more import nonsense with ESM files ([5c41b6b](https://github.com/IEBH/TERA-fy/commit/5c41b6b))
194
- * fix: Better reaction when there is no active user login ([48bd61f](https://github.com/IEBH/TERA-fy/commit/48bd61f))
195
- * fix: Debugging artefacts ([61d559b](https://github.com/IEBH/TERA-fy/commit/61d559b))
196
- * fix: Dont allow plugins to override the main init() function - instead call them after that function ([7db3ba0](https://github.com/IEBH/TERA-fy/commit/7db3ba0))
197
- * fix: Plugins init() functions are now called AFTER all other init functionaly has finished + they ar ([4757597](https://github.com/IEBH/TERA-fy/commit/4757597))
198
- * fix(plugins/vue2): Handle Vue2 giving us a broken diff on Observable write ([d72a143](https://github.com/IEBH/TERA-fy/commit/d72a143))
199
- * feat: createProjectStatePatch() to avoid having to do this manually in each plugin ([5414a22](https://github.com/IEBH/TERA-fy/commit/5414a22))
200
- * feat: init() can now accept an options object ([0ee55b7](https://github.com/IEBH/TERA-fy/commit/0ee55b7))
201
- * feat: Prototype project subscription process (untested) ([f13b957](https://github.com/IEBH/TERA-fy/commit/f13b957))
202
- * feat: Various project-state patch handling functionality now implemented ([8260808](https://github.com/IEBH/TERA-fy/commit/8260808))
203
- * feat(vue2): Largish refactor to support Vue2 + Vue3 plugins ([2abcecc](https://github.com/IEBH/TERA-fy/commit/2abcecc))
204
- * task: Rebuild ([19766d7](https://github.com/IEBH/TERA-fy/commit/19766d7))
205
- * task: Rebuild package-lock ([a83e654](https://github.com/IEBH/TERA-fy/commit/a83e654))
206
- * task: Update API playground to match API signatures ([d483ec3](https://github.com/IEBH/TERA-fy/commit/d483ec3))
207
- * refactor: Swap NPM:jsdoc -> NPM:documentation ([212ed1a](https://github.com/IEBH/TERA-fy/commit/212ed1a))
208
179
 
180
+ ### Features
209
181
 
182
+ * Added @vue/cli-service compatible version (ESM + ES2019 spec) ([56501c9](https://github.com/IEBH/TERA-fy/commit/56501c97d4f2f30d908d2d1db7d847495183bf99))
183
+ * TERA-fy client can now opt-in to sandbox overrides in dev mode ([550ac9c](https://github.com/IEBH/TERA-fy/commit/550ac9c953cdcf1b47c834dcd9b59de3235663d6))
210
184
 
211
- ## <small>1.0.9 (2023-11-09)</small>
212
185
 
213
- * 1.0.9 ([d06538c](https://github.com/IEBH/TERA-fy/commit/d06538c))
214
- * feat: getProjectLibrary() now working ([019dacd](https://github.com/IEBH/TERA-fy/commit/019dacd))
215
- * feat(getProjectFiles): Added getProjectFiles() ([b3804a5](https://github.com/IEBH/TERA-fy/commit/b3804a5))
216
186
 
187
+ ## [1.0.12](https://github.com/IEBH/TERA-fy/compare/v1.0.11...v1.0.12) (2024-02-22)
217
188
 
218
189
 
219
- ## <small>1.0.8 (2023-11-02)</small>
190
+ ### Bug Fixes
220
191
 
221
- * 1.0.8 ([b248a04](https://github.com/IEBH/TERA-fy/commit/b248a04))
222
- * fix(plugins/vue): Various load race conditions for the Vue loader ([aa9c77c](https://github.com/IEBH/TERA-fy/commit/aa9c77c))
223
- * feat: Tera-Fy can now communicate upwards (window.parent) or downwards (via iFrame) depending on its ([0c8d30d](https://github.com/IEBH/TERA-fy/commit/0c8d30d))
192
+ * Tweaks to what is included in the NPM tarball ([e2cf7e0](https://github.com/IEBH/TERA-fy/commit/e2cf7e0cf8c23c55cf7b02c209046e368efa88c5))
224
193
 
225
194
 
195
+ ### Features
226
196
 
227
- ## <small>1.0.7 (2023-11-02)</small>
197
+ * Added setProjectStateDefaults() to make priming defaults easier ([55a6ce8](https://github.com/IEBH/TERA-fy/commit/55a6ce8ecad1ed43a27bd41664ad031e1fc62997))
228
198
 
229
- * 1.0.7 ([f95e0d4](https://github.com/IEBH/TERA-fy/commit/f95e0d4))
230
- * refactor(plugins/vue): Move project list to $tera.list -> $tera.projects ([2b01e24](https://github.com/IEBH/TERA-fy/commit/2b01e24))
231
- * feat(plugins/vue): Better project + project list binding ([2d46189](https://github.com/IEBH/TERA-fy/commit/2d46189))
232
- * fix: Misc fixes ([2bd5e03](https://github.com/IEBH/TERA-fy/commit/2bd5e03))
233
199
 
234
200
 
201
+ ## [1.0.11](https://github.com/IEBH/TERA-fy/compare/v1.0.10...v1.0.11) (2024-02-21)
235
202
 
236
- ## <small>1.0.6 (2023-11-01)</small>
237
203
 
238
- * 1.0.6 ([eaf435a](https://github.com/IEBH/TERA-fy/commit/eaf435a))
239
- * fix: Better error tracking methods with CLIENT|SERVER.debug() + try barriers around sendRaw() ([b4062b3](https://github.com/IEBH/TERA-fy/commit/b4062b3))
240
- * fix: client.init() now returns its own instance in the promise payload so it can be awaited ([05d6611](https://github.com/IEBH/TERA-fy/commit/05d6611))
241
- * fix: Minor typo in package when generating docs ([626a7fc](https://github.com/IEBH/TERA-fy/commit/626a7fc))
242
- * fix: Placehoder in Vue plugin to load basic project skeleton ([f530e51](https://github.com/IEBH/TERA-fy/commit/f530e51))
243
- * refactor: Code tidy + injectComms() now waits o the frame responding ([14491d3](https://github.com/IEBH/TERA-fy/commit/14491d3))
244
- * docs: Added example to README ([40a564b](https://github.com/IEBH/TERA-fy/commit/40a564b))
204
+ ### Bug Fixes
245
205
 
206
+ * Added @mfdc/supabase-reactive as a dep for the Vue plugins ([2f7900d](https://github.com/IEBH/TERA-fy/commit/2f7900d86bc45c556b383756a0b1af30d35d43e5))
246
207
 
247
208
 
248
- ## <small>1.0.5 (2023-10-31)</small>
209
+ ### Features
249
210
 
250
- * 1.0.5 ([33ab63e](https://github.com/IEBH/TERA-fy/commit/33ab63e))
251
- * fix: Change default tera-tools endpoint to live site ([ca4a595](https://github.com/IEBH/TERA-fy/commit/ca4a595))
252
- * fix: Various fixes to the mixin infrastructure ([27ce126](https://github.com/IEBH/TERA-fy/commit/27ce126))
253
- * refactor: Moved plugins to a more logical location ([67821c5](https://github.com/IEBH/TERA-fy/commit/67821c5))
254
- * refactor: Reuse this.set() in constructor if handed options ([c02a51b](https://github.com/IEBH/TERA-fy/commit/c02a51b))
211
+ * Added events / EventEmitter pattern to accept flushed updates from server ([458ce79](https://github.com/IEBH/TERA-fy/commit/458ce799ad9acf68732489efed56da5a0917cd95))
212
+ * Client can now tell server where its loaded from via setServerMode() ([b7c5fc0](https://github.com/IEBH/TERA-fy/commit/b7c5fc0cb18df2c9d39a4f63a32dd93da28e89fa))
213
+ * Updated Vue plugins (2+3) to handle remote project state changes ([0abf7b4](https://github.com/IEBH/TERA-fy/commit/0abf7b44fff25530af6430856850c5743172df2e))
255
214
 
256
215
 
257
216
 
258
- ## <small>1.0.4 (2023-10-27)</small>
217
+ ## [1.0.10](https://github.com/IEBH/TERA-fy/compare/v1.0.9...v1.0.10) (2024-02-18)
259
218
 
260
- * 1.0.4 ([92f418b](https://github.com/IEBH/TERA-fy/commit/92f418b))
261
- * docs: Updated API docs ([ed2d934](https://github.com/IEBH/TERA-fy/commit/ed2d934))
262
- * refactor: getProjectStateSnapshot() -> getProjectState() ([5939df2](https://github.com/IEBH/TERA-fy/commit/5939df2))
263
- * refactor: Move API generation to a single file ([5039530](https://github.com/IEBH/TERA-fy/commit/5039530))
264
- * refactor: Moved NPM:just-diff back to peerDeps as its likely to be needed anyway ([37e1235](https://github.com/IEBH/TERA-fy/commit/37e1235))
265
- * feat: Added TeraFy.set() + minor fixes ([ccf2221](https://github.com/IEBH/TERA-fy/commit/ccf2221))
266
- * feat: Implemented prototype plugin structure ([4a35743](https://github.com/IEBH/TERA-fy/commit/4a35743))
267
- * task: rebuild ([e4fc5b8](https://github.com/IEBH/TERA-fy/commit/e4fc5b8))
268
- * devops: Ignore dist/ when tooling/grepping ([d303385](https://github.com/IEBH/TERA-fy/commit/d303385))
269
219
 
220
+ ### Bug Fixes
270
221
 
222
+ * Better reaction when there is no active user login ([48bd61f](https://github.com/IEBH/TERA-fy/commit/48bd61fe71509e6c68ea8fcba90f6f2297b721bf))
223
+ * Debugging artefacts ([61d559b](https://github.com/IEBH/TERA-fy/commit/61d559b62f1d9cbc1d12ff4b9f65b71af7d48429))
224
+ * Dont allow plugins to override the main init() function - instead call them after that function has done its work ([7db3ba0](https://github.com/IEBH/TERA-fy/commit/7db3ba09a13dc87b70df192f55585d2fc09a3931))
225
+ * Plugins init() functions are now called AFTER all other init functionaly has finished + they are called with the outer object context ([4757597](https://github.com/IEBH/TERA-fy/commit/4757597324873c953e4d93994776eff4030b985c))
226
+ * **plugins/vue2:** Handle Vue2 giving us a broken diff on Observable write ([d72a143](https://github.com/IEBH/TERA-fy/commit/d72a143cda01478d46a86a0bf9863cf9203b903a))
271
227
 
272
- ## <small>1.0.3 (2023-10-26)</small>
273
228
 
274
- * 1.0.3 ([391bb97](https://github.com/IEBH/TERA-fy/commit/391bb97))
275
- * fix: getProjectStateSnapshot() wasnt actually returning a result ([db1c572](https://github.com/IEBH/TERA-fy/commit/db1c572))
229
+ ### Features
276
230
 
231
+ * createProjectStatePatch() to avoid having to do this manually in each plugin ([5414a22](https://github.com/IEBH/TERA-fy/commit/5414a227bba8968108f0b6d65c766dc2a642acc9))
232
+ * init() can now accept an options object ([0ee55b7](https://github.com/IEBH/TERA-fy/commit/0ee55b77ff1178b73c4d749db509d06315da1afc))
233
+ * Prototype project subscription process (untested) ([f13b957](https://github.com/IEBH/TERA-fy/commit/f13b9578d9e725b3d4d886120d28365893da9bcb))
234
+ * Various project-state patch handling functionality now implemented ([8260808](https://github.com/IEBH/TERA-fy/commit/8260808f67c1c3149db487ce61edb4e75d9a3661))
235
+ * **vue2:** Largish refactor to support Vue2 + Vue3 plugins ([2abcecc](https://github.com/IEBH/TERA-fy/commit/2abcecc1c95e68a7680a13ae54bebcb70d61d930))
277
236
 
278
237
 
279
- ## <small>1.0.2 (2023-10-26)</small>
280
238
 
281
- * 1.0.2 ([1141bc4](https://github.com/IEBH/TERA-fy/commit/1141bc4))
282
- * task: Rebuild ([4d8dda2](https://github.com/IEBH/TERA-fy/commit/4d8dda2))
283
- * feat: Ping-pong RPC support with server<->client, added support for contexts to carry messages on se ([15b970d](https://github.com/IEBH/TERA-fy/commit/15b970d))
284
- * feat: setActiveProject() ([c24158a](https://github.com/IEBH/TERA-fy/commit/c24158a))
239
+ ## [1.0.9](https://github.com/IEBH/TERA-fy/compare/v1.0.8...v1.0.9) (2023-11-09)
285
240
 
286
241
 
242
+ ### Features
287
243
 
288
- ## <small>1.0.1 (2023-10-26)</small>
244
+ * **getProjectFiles:** Added getProjectFiles() ([b3804a5](https://github.com/IEBH/TERA-fy/commit/b3804a5433610943cc46b1e5fba68558bbed77b9))
245
+ * getProjectLibrary() now working ([019dacd](https://github.com/IEBH/TERA-fy/commit/019dacd1c677564e66688acf0b6bea2d39dca5e3))
246
+
247
+
248
+
249
+ ## [1.0.8](https://github.com/IEBH/TERA-fy/compare/v1.0.7...v1.0.8) (2023-11-02)
250
+
251
+
252
+ ### Bug Fixes
253
+
254
+ * **plugins/vue:** Various load race conditions for the Vue loader ([aa9c77c](https://github.com/IEBH/TERA-fy/commit/aa9c77cb896d5cba70a59295796b10d6b27cb52e))
255
+
256
+
257
+ ### Features
258
+
259
+ * Tera-Fy can now communicate upwards (window.parent) or downwards (via iFrame) depending on its active context ([0c8d30d](https://github.com/IEBH/TERA-fy/commit/0c8d30dcf6398578a535a04e70ff2c481683ff46))
260
+
261
+
262
+
263
+ ## [1.0.7](https://github.com/IEBH/TERA-fy/compare/v1.0.6...v1.0.7) (2023-11-02)
264
+
265
+
266
+ ### Bug Fixes
267
+
268
+ * Misc fixes ([2bd5e03](https://github.com/IEBH/TERA-fy/commit/2bd5e035dd861e7baa8203d3dc5fb206b78aefbc))
269
+
270
+
271
+ ### Features
272
+
273
+ * **plugins/vue:** Better project + project list binding ([2d46189](https://github.com/IEBH/TERA-fy/commit/2d4618956cf8c7201a8e39f8bf0dc33513f726a5))
274
+
275
+
276
+
277
+ ## [1.0.6](https://github.com/IEBH/TERA-fy/compare/v1.0.5...v1.0.6) (2023-11-01)
278
+
279
+
280
+ ### Bug Fixes
281
+
282
+ * Better error tracking methods with CLIENT|SERVER.debug() + try barriers around sendRaw() ([b4062b3](https://github.com/IEBH/TERA-fy/commit/b4062b30075403708427b1c58d308d34777997e9))
283
+ * client.init() now returns its own instance in the promise payload so it can be awaited ([05d6611](https://github.com/IEBH/TERA-fy/commit/05d66117bf7578f076472bc4d59be1df10e85cb3))
284
+ * Minor typo in package when generating docs ([626a7fc](https://github.com/IEBH/TERA-fy/commit/626a7fc6f3867f95dd7efa4cf1ca6875ae25c1f6))
285
+ * Placehoder in Vue plugin to load basic project skeleton ([f530e51](https://github.com/IEBH/TERA-fy/commit/f530e5116e1a51652038df3a81a1e629d84755f7))
286
+
287
+
288
+
289
+ ## [1.0.5](https://github.com/IEBH/TERA-fy/compare/v1.0.4...v1.0.5) (2023-10-31)
290
+
291
+
292
+ ### Bug Fixes
293
+
294
+ * Change default tera-tools endpoint to live site ([ca4a595](https://github.com/IEBH/TERA-fy/commit/ca4a59548751f1afdb1a6309868de73b2dda81d6))
295
+ * Various fixes to the mixin infrastructure ([27ce126](https://github.com/IEBH/TERA-fy/commit/27ce126225f3b5faa06700efa9e6c87b38da33ef))
296
+
297
+
298
+
299
+ ## [1.0.4](https://github.com/IEBH/TERA-fy/compare/v1.0.3...v1.0.4) (2023-10-27)
300
+
301
+
302
+ ### Features
303
+
304
+ * Added TeraFy.set() + minor fixes ([ccf2221](https://github.com/IEBH/TERA-fy/commit/ccf222160aeb23b98c619f75da31099026df8544))
305
+ * Implemented prototype plugin structure ([4a35743](https://github.com/IEBH/TERA-fy/commit/4a357434606e0491b3626eacfbd3ff2307a341f0))
306
+
307
+
308
+
309
+ ## [1.0.3](https://github.com/IEBH/TERA-fy/compare/v1.0.2...v1.0.3) (2023-10-26)
310
+
311
+
312
+ ### Bug Fixes
313
+
314
+ * getProjectStateSnapshot() wasnt actually returning a result ([db1c572](https://github.com/IEBH/TERA-fy/commit/db1c572116c73f8dfdff8ace23f486afb9b8953c))
315
+
316
+
317
+
318
+ ## [1.0.2](https://github.com/IEBH/TERA-fy/compare/v1.0.1...v1.0.2) (2023-10-26)
319
+
320
+
321
+ ### Features
322
+
323
+ * Ping-pong RPC support with server<->client, added support for contexts to carry messages on server side ([15b970d](https://github.com/IEBH/TERA-fy/commit/15b970d0fa187c935f0dd7c2aba2d630e9e59b98))
324
+ * setActiveProject() ([c24158a](https://github.com/IEBH/TERA-fy/commit/c24158acca0cb7fc9e50b817e60a0644bbadf16e))
325
+
326
+
327
+
328
+ ## [1.0.1](https://github.com/IEBH/TERA-fy/compare/74610c8b8347cb9e5e9b198d2caa0e9b1c6259f4...v1.0.1) (2023-10-26)
329
+
330
+
331
+ ### Bug Fixes
332
+
333
+ * Comms now working ([74610c8](https://github.com/IEBH/TERA-fy/commit/74610c8b8347cb9e5e9b198d2caa0e9b1c6259f4))
334
+ * Misc fixes ([8826eb4](https://github.com/IEBH/TERA-fy/commit/8826eb4f134ed921becdeb6fdc48a9d5b1cb716e))
335
+
336
+
337
+ ### Features
289
338
 
290
- * 1.0.1 ([637c256](https://github.com/IEBH/TERA-fy/commit/637c256))
291
- * feat: DevMode toggling + better stylesheet handling + toggleFullscreen() ([cc96e76](https://github.com/IEBH/TERA-fy/commit/cc96e76))
292
- * docs: Added LICENSE file ([5fa0933](https://github.com/IEBH/TERA-fy/commit/5fa0933))
293
- * docs: Basic README ([749d8d6](https://github.com/IEBH/TERA-fy/commit/749d8d6))
294
- * docs: Misc package.json fix ([c5b4ae4](https://github.com/IEBH/TERA-fy/commit/c5b4ae4))
295
- * task: Added dist + docs auto-gen ([af4b6c1](https://github.com/IEBH/TERA-fy/commit/af4b6c1))
296
- * task: Basic proof-of-concept ([835e175](https://github.com/IEBH/TERA-fy/commit/835e175))
297
- * task: Cleanup package*.json ([9c3732c](https://github.com/IEBH/TERA-fy/commit/9c3732c))
298
- * task: iFrame example (non-functional) ([d0b3b36](https://github.com/IEBH/TERA-fy/commit/d0b3b36))
299
- * task: Initial commit + hello world demo ([b9559b5](https://github.com/IEBH/TERA-fy/commit/b9559b5))
300
- * task: Proof-of-concept using iFrame + postMessage ([47c9af8](https://github.com/IEBH/TERA-fy/commit/47c9af8))
301
- * task: Prototype app ([69b14c2](https://github.com/IEBH/TERA-fy/commit/69b14c2))
302
- * task: Various cleanups now the solution has settled ([52fcc61](https://github.com/IEBH/TERA-fy/commit/52fcc61))
303
- * fix: Comms now working ([74610c8](https://github.com/IEBH/TERA-fy/commit/74610c8))
304
- * fix: Misc fixes ([8826eb4](https://github.com/IEBH/TERA-fy/commit/8826eb4))
305
- * refactor: File rename ([79ab1cc](https://github.com/IEBH/TERA-fy/commit/79ab1cc))
339
+ * DevMode toggling + better stylesheet handling + toggleFullscreen() ([cc96e76](https://github.com/IEBH/TERA-fy/commit/cc96e7659e02bee4410a07f319d34a1acdb001ec))
@@ -1,4 +1,4 @@
1
- var Er=Object.defineProperty;var Cr=(t,e,r)=>e in t?Er(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var h=(t,e,r)=>(Cr(t,typeof e!="symbol"?e+"":e,r),r);function Ut(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(s){return s});function o({obj1:s,obj2:l,basePath:c,basePathForRemoves:x,diffs:v}){var T=Object.keys(s),w=T.length,b=Object.keys(l),P=b.length,y,i=s.length-l.length;if(Rr(s,l)){for(var m=0;m<w;m++){var f=Array.isArray(s)?Number(T[m]):T[m];f in l||(y=x.concat(f),v.remove.push({op:"remove",path:r(y)}))}for(var m=0;m<P;m++){var f=Array.isArray(l)?Number(b[m]):b[m];p({key:f,obj1:s,obj2:l,path:c.concat(f),pathForRemoves:c.concat(f),diffs:v})}}else{for(var m=0;m<i;m++)y=x.concat(m),v.remove.push({op:"remove",path:r(y)});for(var S=s.slice(i),m=0;m<P;m++)p({key:m,obj1:S,obj2:l,path:c.concat(m),pathForRemoves:c.concat(m+i),diffs:v})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function p({key:s,obj1:l,obj2:c,path:x,pathForRemoves:v,diffs:T}){var w=l[s],b=c[s];if(!(s in l)&&s in c){var P=b;T.add.push({op:"add",path:r(x),value:P})}else w!==b&&(Object(w)!==w||Object(b)!==b||Mr(w,b)||!Object.keys(w).length&&!Object.keys(b).length&&String(w)!=String(b)?n(x,T,b):o({obj1:l[s],obj2:c[s],basePath:x,basePathForRemoves:v,diffs:T}))}function n(s,l,c){l.replace.push({op:"replace",path:r(s),value:c})}}function Gt(t){return[""].concat(t).join("/")}function Mr(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function Rr(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,p=0;p<e.length&&String(t[p])===String(e[p]);p++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var Br=typeof global=="object"&&global&&global.Object===Object&&global,ot=Br;var Lr=typeof self=="object"&&self&&self.Object===Object&&self,Fr=ot||Lr||Function("return this")(),g=Fr;var Nr=g.Symbol,_=Nr;var Kt=Object.prototype,Dr=Kt.hasOwnProperty,kr=Kt.toString,tt=_?_.toStringTag:void 0;function Ur(t){var e=Dr.call(t,tt),r=t[tt];try{t[tt]=void 0;var o=!0}catch{}var a=kr.call(t);return o&&(e?t[tt]=r:delete t[tt]),a}var Wt=Ur;var Gr=Object.prototype,Kr=Gr.toString;function Wr(t){return Kr.call(t)}var zt=Wr;var zr="[object Null]",Vr="[object Undefined]",Vt=_?_.toStringTag:void 0;function qr(t){return t==null?t===void 0?Vr:zr:Vt&&Vt in Object(t)?Wt(t):zt(t)}var I=qr;function Hr(t){return t!=null&&typeof t=="object"}var A=Hr;var $r=Array.isArray,U=$r;function Yr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var O=Yr;var Zr="[object AsyncFunction]",Jr="[object Function]",Xr="[object GeneratorFunction]",Qr="[object Proxy]";function to(t){if(!O(t))return!1;var e=I(t);return e==Jr||e==Xr||e==Zr||e==Qr}var at=to;var eo=g["__core-js_shared__"],st=eo;var qt=function(){var t=/[^.]+$/.exec(st&&st.keys&&st.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function ro(t){return!!qt&&qt in t}var Ht=ro;var oo=Function.prototype,ao=oo.toString;function so(t){if(t!=null){try{return ao.call(t)}catch{}try{return t+""}catch{}}return""}var E=so;var io=/[\\^$.*+?()[\]{}|]/g,fo=/^\[object .+?Constructor\]$/,no=Function.prototype,po=Object.prototype,lo=no.toString,mo=po.hasOwnProperty,uo=RegExp("^"+lo.call(mo).replace(io,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function co(t){if(!O(t)||Ht(t))return!1;var e=at(t)?uo:fo;return e.test(E(t))}var $t=co;function ho(t,e){return t==null?void 0:t[e]}var Yt=ho;function xo(t,e){var r=Yt(t,e);return $t(r)?r:void 0}var j=xo;var go=j(g,"WeakMap"),it=go;var Zt=Object.create,bo=function(){function t(){}return function(e){if(!O(e))return{};if(Zt)return Zt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Jt=bo;function yo(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Xt=yo;var vo=function(){try{var t=j(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Ot=vo;function wo(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Qt=wo;var jo=9007199254740991,To=/^(?:0|[1-9]\d*)$/;function Ao(t,e){var r=typeof t;return e=e==null?jo:e,!!e&&(r=="number"||r!="symbol"&&To.test(t))&&t>-1&&t%1==0&&t<e}var te=Ao;function Oo(t,e,r){e=="__proto__"&&Ot?Ot(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var ft=Oo;function Po(t,e){return t===e||t!==t&&e!==e}var nt=Po;var So=Object.prototype,_o=So.hasOwnProperty;function Io(t,e,r){var o=t[e];(!(_o.call(t,e)&&nt(o,r))||r===void 0&&!(e in t))&&ft(t,e,r)}var pt=Io;function Eo(t,e,r,o){var a=!r;r||(r={});for(var p=-1,n=e.length;++p<n;){var s=e[p],l=o?o(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),a?ft(r,s,l):pt(r,s,l)}return r}var R=Eo;var Co=9007199254740991;function Mo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Co}var lt=Mo;function Ro(t){return t!=null&&lt(t.length)&&!at(t)}var mt=Ro;var Bo=Object.prototype;function Lo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Bo;return t===r}var G=Lo;function Fo(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ee=Fo;var No="[object Arguments]";function Do(t){return A(t)&&I(t)==No}var Pt=Do;var re=Object.prototype,ko=re.hasOwnProperty,Uo=re.propertyIsEnumerable,Go=Pt(function(){return arguments}())?Pt:function(t){return A(t)&&ko.call(t,"callee")&&!Uo.call(t,"callee")},oe=Go;function Ko(){return!1}var ae=Ko;var fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,se=fe&&typeof module=="object"&&module&&!module.nodeType&&module,Wo=se&&se.exports===fe,ie=Wo?g.Buffer:void 0,zo=ie?ie.isBuffer:void 0,Vo=zo||ae,ut=Vo;var qo="[object Arguments]",Ho="[object Array]",$o="[object Boolean]",Yo="[object Date]",Zo="[object Error]",Jo="[object Function]",Xo="[object Map]",Qo="[object Number]",ta="[object Object]",ea="[object RegExp]",ra="[object Set]",oa="[object String]",aa="[object WeakMap]",sa="[object ArrayBuffer]",ia="[object DataView]",fa="[object Float32Array]",na="[object Float64Array]",pa="[object Int8Array]",la="[object Int16Array]",ma="[object Int32Array]",ua="[object Uint8Array]",da="[object Uint8ClampedArray]",ca="[object Uint16Array]",ha="[object Uint32Array]",d={};d[fa]=d[na]=d[pa]=d[la]=d[ma]=d[ua]=d[da]=d[ca]=d[ha]=!0;d[qo]=d[Ho]=d[sa]=d[$o]=d[ia]=d[Yo]=d[Zo]=d[Jo]=d[Xo]=d[Qo]=d[ta]=d[ea]=d[ra]=d[oa]=d[aa]=!1;function xa(t){return A(t)&&lt(t.length)&&!!d[I(t)]}var ne=xa;function ga(t){return function(e){return t(e)}}var K=ga;var pe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,et=pe&&typeof module=="object"&&module&&!module.nodeType&&module,ba=et&&et.exports===pe,St=ba&&ot.process,ya=function(){try{var t=et&&et.require&&et.require("util").types;return t||St&&St.binding&&St.binding("util")}catch{}}(),C=ya;var le=C&&C.isTypedArray,va=le?K(le):ne,me=va;var wa=Object.prototype,ja=wa.hasOwnProperty;function Ta(t,e){var r=U(t),o=!r&&oe(t),a=!r&&!o&&ut(t),p=!r&&!o&&!a&&me(t),n=r||o||a||p,s=n?ee(t.length,String):[],l=s.length;for(var c in t)(e||ja.call(t,c))&&!(n&&(c=="length"||a&&(c=="offset"||c=="parent")||p&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||te(c,l)))&&s.push(c);return s}var dt=Ta;function Aa(t,e){return function(r){return t(e(r))}}var ct=Aa;var Oa=ct(Object.keys,Object),ue=Oa;var Pa=Object.prototype,Sa=Pa.hasOwnProperty;function _a(t){if(!G(t))return ue(t);var e=[];for(var r in Object(t))Sa.call(t,r)&&r!="constructor"&&e.push(r);return e}var de=_a;function Ia(t){return mt(t)?dt(t):de(t)}var W=Ia;function Ea(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var ce=Ea;var Ca=Object.prototype,Ma=Ca.hasOwnProperty;function Ra(t){if(!O(t))return ce(t);var e=G(t),r=[];for(var o in t)o=="constructor"&&(e||!Ma.call(t,o))||r.push(o);return r}var he=Ra;function Ba(t){return mt(t)?dt(t,!0):he(t)}var z=Ba;var La=j(Object,"create"),M=La;function Fa(){this.__data__=M?M(null):{},this.size=0}var xe=Fa;function Na(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ge=Na;var Da="__lodash_hash_undefined__",ka=Object.prototype,Ua=ka.hasOwnProperty;function Ga(t){var e=this.__data__;if(M){var r=e[t];return r===Da?void 0:r}return Ua.call(e,t)?e[t]:void 0}var be=Ga;var Ka=Object.prototype,Wa=Ka.hasOwnProperty;function za(t){var e=this.__data__;return M?e[t]!==void 0:Wa.call(e,t)}var ye=za;var Va="__lodash_hash_undefined__";function qa(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?Va:e,this}var ve=qa;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=xe;V.prototype.delete=ge;V.prototype.get=be;V.prototype.has=ye;V.prototype.set=ve;var _t=V;function Ha(){this.__data__=[],this.size=0}var we=Ha;function $a(t,e){for(var r=t.length;r--;)if(nt(t[r][0],e))return r;return-1}var B=$a;var Ya=Array.prototype,Za=Ya.splice;function Ja(t){var e=this.__data__,r=B(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Za.call(e,r,1),--this.size,!0}var je=Ja;function Xa(t){var e=this.__data__,r=B(e,t);return r<0?void 0:e[r][1]}var Te=Xa;function Qa(t){return B(this.__data__,t)>-1}var Ae=Qa;function ts(t,e){var r=this.__data__,o=B(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Oe=ts;function q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}q.prototype.clear=we;q.prototype.delete=je;q.prototype.get=Te;q.prototype.has=Ae;q.prototype.set=Oe;var L=q;var es=j(g,"Map"),F=es;function rs(){this.size=0,this.__data__={hash:new _t,map:new(F||L),string:new _t}}var Pe=rs;function os(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Se=os;function as(t,e){var r=t.__data__;return Se(e)?r[typeof e=="string"?"string":"hash"]:r.map}var N=as;function ss(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e}var _e=ss;function is(t){return N(this,t).get(t)}var Ie=is;function fs(t){return N(this,t).has(t)}var Ee=fs;function ns(t,e){var r=N(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ce=ns;function H(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}H.prototype.clear=Pe;H.prototype.delete=_e;H.prototype.get=Ie;H.prototype.has=Ee;H.prototype.set=Ce;var Me=H;function ps(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var ht=ps;var ls=ct(Object.getPrototypeOf,Object),xt=ls;function ms(){this.__data__=new L,this.size=0}var Re=ms;function us(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Be=us;function ds(t){return this.__data__.get(t)}var Le=ds;function cs(t){return this.__data__.has(t)}var Fe=cs;var hs=200;function xs(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!F||o.length<hs-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new Me(o)}return r.set(t,e),this.size=r.size,this}var Ne=xs;function $(t){var e=this.__data__=new L(t);this.size=e.size}$.prototype.clear=Re;$.prototype.delete=Be;$.prototype.get=Le;$.prototype.has=Fe;$.prototype.set=Ne;var De=$;function gs(t,e){return t&&R(e,W(e),t)}var ke=gs;function bs(t,e){return t&&R(e,z(e),t)}var Ue=bs;var ze=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ge=ze&&typeof module=="object"&&module&&!module.nodeType&&module,ys=Ge&&Ge.exports===ze,Ke=ys?g.Buffer:void 0,We=Ke?Ke.allocUnsafe:void 0;function vs(t,e){if(e)return t.slice();var r=t.length,o=We?We(r):new t.constructor(r);return t.copy(o),o}var Ve=vs;function ws(t,e){for(var r=-1,o=t==null?0:t.length,a=0,p=[];++r<o;){var n=t[r];e(n,r,t)&&(p[a++]=n)}return p}var qe=ws;function js(){return[]}var gt=js;var Ts=Object.prototype,As=Ts.propertyIsEnumerable,He=Object.getOwnPropertySymbols,Os=He?function(t){return t==null?[]:(t=Object(t),qe(He(t),function(e){return As.call(t,e)}))}:gt,Y=Os;function Ps(t,e){return R(t,Y(t),e)}var $e=Ps;var Ss=Object.getOwnPropertySymbols,_s=Ss?function(t){for(var e=[];t;)ht(e,Y(t)),t=xt(t);return e}:gt,bt=_s;function Is(t,e){return R(t,bt(t),e)}var Ye=Is;function Es(t,e,r){var o=e(t);return U(t)?o:ht(o,r(t))}var yt=Es;function Cs(t){return yt(t,W,Y)}var Ze=Cs;function Ms(t){return yt(t,z,bt)}var Je=Ms;var Rs=j(g,"DataView"),vt=Rs;var Bs=j(g,"Promise"),wt=Bs;var Ls=j(g,"Set"),jt=Ls;var Xe="[object Map]",Fs="[object Object]",Qe="[object Promise]",tr="[object Set]",er="[object WeakMap]",rr="[object DataView]",Ns=E(vt),Ds=E(F),ks=E(wt),Us=E(jt),Gs=E(it),D=I;(vt&&D(new vt(new ArrayBuffer(1)))!=rr||F&&D(new F)!=Xe||wt&&D(wt.resolve())!=Qe||jt&&D(new jt)!=tr||it&&D(new it)!=er)&&(D=function(t){var e=I(t),r=e==Fs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Ns:return rr;case Ds:return Xe;case ks:return Qe;case Us:return tr;case Gs:return er}return e});var Z=D;var Ks=Object.prototype,Ws=Ks.hasOwnProperty;function zs(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Ws.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var or=zs;var Vs=g.Uint8Array,It=Vs;function qs(t){var e=new t.constructor(t.byteLength);return new It(e).set(new It(t)),e}var J=qs;function Hs(t,e){var r=e?J(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var ar=Hs;var $s=/\w*$/;function Ys(t){var e=new t.constructor(t.source,$s.exec(t));return e.lastIndex=t.lastIndex,e}var sr=Ys;var ir=_?_.prototype:void 0,fr=ir?ir.valueOf:void 0;function Zs(t){return fr?Object(fr.call(t)):{}}var nr=Zs;function Js(t,e){var r=e?J(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var pr=Js;var Xs="[object Boolean]",Qs="[object Date]",ti="[object Map]",ei="[object Number]",ri="[object RegExp]",oi="[object Set]",ai="[object String]",si="[object Symbol]",ii="[object ArrayBuffer]",fi="[object DataView]",ni="[object Float32Array]",pi="[object Float64Array]",li="[object Int8Array]",mi="[object Int16Array]",ui="[object Int32Array]",di="[object Uint8Array]",ci="[object Uint8ClampedArray]",hi="[object Uint16Array]",xi="[object Uint32Array]";function gi(t,e,r){var o=t.constructor;switch(e){case ii:return J(t);case Xs:case Qs:return new o(+t);case fi:return ar(t,r);case ni:case pi:case li:case mi:case ui:case di:case ci:case hi:case xi:return pr(t,r);case ti:return new o;case ei:case ai:return new o(t);case ri:return sr(t);case oi:return new o;case si:return nr(t)}}var lr=gi;function bi(t){return typeof t.constructor=="function"&&!G(t)?Jt(xt(t)):{}}var mr=bi;var yi="[object Map]";function vi(t){return A(t)&&Z(t)==yi}var ur=vi;var dr=C&&C.isMap,wi=dr?K(dr):ur,cr=wi;var ji="[object Set]";function Ti(t){return A(t)&&Z(t)==ji}var hr=Ti;var xr=C&&C.isSet,Ai=xr?K(xr):hr,gr=Ai;var Oi=1,Pi=2,Si=4,br="[object Arguments]",_i="[object Array]",Ii="[object Boolean]",Ei="[object Date]",Ci="[object Error]",yr="[object Function]",Mi="[object GeneratorFunction]",Ri="[object Map]",Bi="[object Number]",vr="[object Object]",Li="[object RegExp]",Fi="[object Set]",Ni="[object String]",Di="[object Symbol]",ki="[object WeakMap]",Ui="[object ArrayBuffer]",Gi="[object DataView]",Ki="[object Float32Array]",Wi="[object Float64Array]",zi="[object Int8Array]",Vi="[object Int16Array]",qi="[object Int32Array]",Hi="[object Uint8Array]",$i="[object Uint8ClampedArray]",Yi="[object Uint16Array]",Zi="[object Uint32Array]",u={};u[br]=u[_i]=u[Ui]=u[Gi]=u[Ii]=u[Ei]=u[Ki]=u[Wi]=u[zi]=u[Vi]=u[qi]=u[Ri]=u[Bi]=u[vr]=u[Li]=u[Fi]=u[Ni]=u[Di]=u[Hi]=u[$i]=u[Yi]=u[Zi]=!0;u[Ci]=u[yr]=u[ki]=!1;function Tt(t,e,r,o,a,p){var n,s=e&Oi,l=e&Pi,c=e&Si;if(r&&(n=a?r(t,o,a,p):r(t)),n!==void 0)return n;if(!O(t))return t;var x=U(t);if(x){if(n=or(t),!s)return Xt(t,n)}else{var v=Z(t),T=v==yr||v==Mi;if(ut(t))return Ve(t,s);if(v==vr||v==br||T&&!a){if(n=l||T?{}:mr(t),!s)return l?Ye(t,Ue(n,t)):$e(t,ke(n,t))}else{if(!u[v])return a?t:{};n=lr(t,v,s)}}p||(p=new De);var w=p.get(t);if(w)return w;p.set(t,n),gr(t)?t.forEach(function(y){n.add(Tt(y,e,r,y,t,p))}):cr(t)&&t.forEach(function(y,i){n.set(i,Tt(y,e,r,i,t,p))});var b=c?l?Je:Ze:l?z:W,P=x?void 0:b(t);return Qt(P||t,function(y,i){P&&(i=y,y=t[i]),pt(n,i,Tt(y,e,r,i,t,p))}),n}var wr=Tt;var Ji=1,Xi=4;function Qi(t){return wr(t,Ji|Xi)}var Et=Qi;function jr(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var Ct=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var tf="array",ef="bit",Tr="bits",rf="byte",Ar="bytes",X="",of="exponent",af="function",Or="iec",sf="Invalid number",ff="Invalid rounding method",Mt="jedec",nf="object",Pr=".",pf="round",lf="s",mf="si",uf="kbit",df="kB",cf=" ",hf="string",xf="0",Rt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function Sr(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:p=X,localeOptions:n={},separator:s=X,spacer:l=cf,symbols:c={},standard:x=X,output:v=hf,fullform:T=!1,fullforms:w=[],exponent:b=-1,roundingMethod:P=pf,precision:y=0}={}){let i=b,m=Number(t),f=[],S=0,At=X;x===mf?(o=10,x=Mt):x===Or||x===Mt?o=2:o===2?x=Or:(o=10,x=Mt);let rt=o===10?1e3:1024,_r=T===!0,Lt=m<0,Ft=Math[P];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(sf);if(typeof Ft!==af)throw new TypeError(ff);if(Lt&&(m=-m),(i===-1||isNaN(i))&&(i=Math.floor(Math.log(m)/Math.log(rt)),i<0&&(i=0)),i>8&&(y>0&&(y+=8-i),i=8),v===of)return i;if(m===0)f[0]=0,At=f[1]=Rt.symbol[x][e?Tr:Ar][i];else{S=m/(o===2?Math.pow(2,i*10):Math.pow(1e3,i)),e&&(S=S*8,S>=rt&&i<8&&(S=S/rt,i++));let Q=Math.pow(10,i>0?a:0);f[0]=Ft(S*Q)/Q,f[0]===rt&&i<8&&b===-1&&(f[0]=1,i++),At=f[1]=o===10&&i===1?e?uf:df:Rt.symbol[x][e?Tr:Ar][i]}if(Lt&&(f[0]=-f[0]),y>0&&(f[0]=f[0].toPrecision(y)),f[1]=c[f[1]]||f[1],p===!0?f[0]=f[0].toLocaleString():p.length>0?f[0]=f[0].toLocaleString(p,n):s.length>0&&(f[0]=f[0].toString().replace(Pr,s)),r&&Number.isInteger(f[0])===!1&&a>0){let Q=s||Pr,Nt=f[0].toString().split(Q),Dt=Nt[1]||X,kt=Dt.length,Ir=a-kt;f[0]=`${Nt[0]}${Q}${Dt.padEnd(kt+Ir,xf)}`}return _r&&(f[1]=w[i]?w[i]:Rt.fullform[x][i]+(e?ef:rf)+(f[0]===1?X:lf)),v===tf?f:v===nf?{value:f[0],symbol:f[1],exponent:i,unit:At}:f.join(l)}var k=class{constructor(e){h(this,"tera");h(this,"id");h(this,"name");h(this,"path");h(this,"parsedName");h(this,"created");h(this,"createdFormatted");h(this,"modified");h(this,"modifiedFormatted");h(this,"accessed");h(this,"accessedFormatted");h(this,"size");h(this,"sizeFormatted");h(this,"mime");if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e),this.sizeFormatted=Sr(this.size||0,{spacer:""}),this.createdFormatted=this.created.toLocaleDateString(),this.modifiedFormatted=this.modified.toLocaleDateString(),this.accessedFormatted=this.accessed.toLocaleDateString()}getContents(){return this.tera.getProjectFile(this.path)}setContents(e){return this.tera.setProjectFile(this.path,e)}getRefs(){return this.tera.getProjectLibrary(this.path)}setRefs(e){return this.tera.setProjectLibrary(this.path,e)}};var Bt=class{constructor(e){h(this,"settings",{devMode:!0,mode:"detect",modeTimeout:300,modeFallback:"child",siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3});h(this,"events",jr());h(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});h(this,"methods",["handshake","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","saveProjectState","replaceProjectState","applyProjectStatePatch","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","uiAlert","uiSplat","uiWindow"]);h(this,"plugins",[]);h(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Ct();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Ct(),...Et(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR","Message compose client->server:",o),this.debug("ERROR","Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return;let r=e.data;if(!(!r.TERA||!r.id))if(this.debug("Recieved",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id])r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response);else{if((r==null?void 0:r.action)=="rpc")return Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o.toString()})});if((r==null?void 0:r.action)=="event")return Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o});r!=null&&r.id?this.debug(`Ignoring message ID ${r.id} - was meant for someone else?`):this.debug("Unexpected incoming TERA-FY CLIENT message",{message:r})}}createProjectStatePatch(e,r){let o=Ut(r,e,Gt);return this.debug("INFO","Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.detectMode()).then(o=>this.settings.mode=o).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings))))}detectMode(){return this.settings.mode!="detect"?this.settings.mode:window.self===window.parent?this.settings.modeFallback:Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){return new Promise(e=>{switch(this.settings.mode){case"child":this.debug("Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),document.body.append(this.dom.el),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("Embed frame ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe);break;case"parent":this.debug("Using TERA window parent"),e();break;case"popup":this.debug("Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),(()=>{let r=0,o,a=()=>{this.debug("Trying handshake",++r),clearTimeout(o),o=setTimeout(a,this.settings.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(o),this.debug("Popup window accepted handshake"),e()})};a()})();break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
1
+ var Er=Object.defineProperty;var Cr=(t,e,r)=>e in t?Er(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var h=(t,e,r)=>(Cr(t,typeof e!="symbol"?e+"":e,r),r);function Ut(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(s){return s});function o({obj1:s,obj2:l,basePath:c,basePathForRemoves:x,diffs:v}){var T=Object.keys(s),w=T.length,b=Object.keys(l),P=b.length,y,i=s.length-l.length;if(Rr(s,l)){for(var m=0;m<w;m++){var f=Array.isArray(s)?Number(T[m]):T[m];f in l||(y=x.concat(f),v.remove.push({op:"remove",path:r(y)}))}for(var m=0;m<P;m++){var f=Array.isArray(l)?Number(b[m]):b[m];p({key:f,obj1:s,obj2:l,path:c.concat(f),pathForRemoves:c.concat(f),diffs:v})}}else{for(var m=0;m<i;m++)y=x.concat(m),v.remove.push({op:"remove",path:r(y)});for(var S=s.slice(i),m=0;m<P;m++)p({key:m,obj1:S,obj2:l,path:c.concat(m),pathForRemoves:c.concat(m+i),diffs:v})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function p({key:s,obj1:l,obj2:c,path:x,pathForRemoves:v,diffs:T}){var w=l[s],b=c[s];if(!(s in l)&&s in c){var P=b;T.add.push({op:"add",path:r(x),value:P})}else w!==b&&(Object(w)!==w||Object(b)!==b||Mr(w,b)||!Object.keys(w).length&&!Object.keys(b).length&&String(w)!=String(b)?n(x,T,b):o({obj1:l[s],obj2:c[s],basePath:x,basePathForRemoves:v,diffs:T}))}function n(s,l,c){l.replace.push({op:"replace",path:r(s),value:c})}}function Gt(t){return[""].concat(t).join("/")}function Mr(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function Rr(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,p=0;p<e.length&&String(t[p])===String(e[p]);p++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var Br=typeof global=="object"&&global&&global.Object===Object&&global,ot=Br;var Lr=typeof self=="object"&&self&&self.Object===Object&&self,Fr=ot||Lr||Function("return this")(),g=Fr;var Nr=g.Symbol,_=Nr;var Kt=Object.prototype,Dr=Kt.hasOwnProperty,kr=Kt.toString,tt=_?_.toStringTag:void 0;function Ur(t){var e=Dr.call(t,tt),r=t[tt];try{t[tt]=void 0;var o=!0}catch{}var a=kr.call(t);return o&&(e?t[tt]=r:delete t[tt]),a}var Wt=Ur;var Gr=Object.prototype,Kr=Gr.toString;function Wr(t){return Kr.call(t)}var zt=Wr;var zr="[object Null]",Vr="[object Undefined]",Vt=_?_.toStringTag:void 0;function qr(t){return t==null?t===void 0?Vr:zr:Vt&&Vt in Object(t)?Wt(t):zt(t)}var I=qr;function Hr(t){return t!=null&&typeof t=="object"}var A=Hr;var $r=Array.isArray,U=$r;function Yr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var O=Yr;var Zr="[object AsyncFunction]",Jr="[object Function]",Xr="[object GeneratorFunction]",Qr="[object Proxy]";function to(t){if(!O(t))return!1;var e=I(t);return e==Jr||e==Xr||e==Zr||e==Qr}var at=to;var eo=g["__core-js_shared__"],st=eo;var qt=function(){var t=/[^.]+$/.exec(st&&st.keys&&st.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function ro(t){return!!qt&&qt in t}var Ht=ro;var oo=Function.prototype,ao=oo.toString;function so(t){if(t!=null){try{return ao.call(t)}catch{}try{return t+""}catch{}}return""}var E=so;var io=/[\\^$.*+?()[\]{}|]/g,fo=/^\[object .+?Constructor\]$/,no=Function.prototype,po=Object.prototype,lo=no.toString,mo=po.hasOwnProperty,uo=RegExp("^"+lo.call(mo).replace(io,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function co(t){if(!O(t)||Ht(t))return!1;var e=at(t)?uo:fo;return e.test(E(t))}var $t=co;function ho(t,e){return t==null?void 0:t[e]}var Yt=ho;function xo(t,e){var r=Yt(t,e);return $t(r)?r:void 0}var j=xo;var go=j(g,"WeakMap"),it=go;var Zt=Object.create,bo=function(){function t(){}return function(e){if(!O(e))return{};if(Zt)return Zt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Jt=bo;function yo(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Xt=yo;var vo=function(){try{var t=j(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Ot=vo;function wo(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Qt=wo;var jo=9007199254740991,To=/^(?:0|[1-9]\d*)$/;function Ao(t,e){var r=typeof t;return e=e==null?jo:e,!!e&&(r=="number"||r!="symbol"&&To.test(t))&&t>-1&&t%1==0&&t<e}var te=Ao;function Oo(t,e,r){e=="__proto__"&&Ot?Ot(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var ft=Oo;function Po(t,e){return t===e||t!==t&&e!==e}var nt=Po;var So=Object.prototype,_o=So.hasOwnProperty;function Io(t,e,r){var o=t[e];(!(_o.call(t,e)&&nt(o,r))||r===void 0&&!(e in t))&&ft(t,e,r)}var pt=Io;function Eo(t,e,r,o){var a=!r;r||(r={});for(var p=-1,n=e.length;++p<n;){var s=e[p],l=o?o(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),a?ft(r,s,l):pt(r,s,l)}return r}var R=Eo;var Co=9007199254740991;function Mo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Co}var lt=Mo;function Ro(t){return t!=null&&lt(t.length)&&!at(t)}var mt=Ro;var Bo=Object.prototype;function Lo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Bo;return t===r}var G=Lo;function Fo(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ee=Fo;var No="[object Arguments]";function Do(t){return A(t)&&I(t)==No}var Pt=Do;var re=Object.prototype,ko=re.hasOwnProperty,Uo=re.propertyIsEnumerable,Go=Pt(function(){return arguments}())?Pt:function(t){return A(t)&&ko.call(t,"callee")&&!Uo.call(t,"callee")},oe=Go;function Ko(){return!1}var ae=Ko;var fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,se=fe&&typeof module=="object"&&module&&!module.nodeType&&module,Wo=se&&se.exports===fe,ie=Wo?g.Buffer:void 0,zo=ie?ie.isBuffer:void 0,Vo=zo||ae,ut=Vo;var qo="[object Arguments]",Ho="[object Array]",$o="[object Boolean]",Yo="[object Date]",Zo="[object Error]",Jo="[object Function]",Xo="[object Map]",Qo="[object Number]",ta="[object Object]",ea="[object RegExp]",ra="[object Set]",oa="[object String]",aa="[object WeakMap]",sa="[object ArrayBuffer]",ia="[object DataView]",fa="[object Float32Array]",na="[object Float64Array]",pa="[object Int8Array]",la="[object Int16Array]",ma="[object Int32Array]",ua="[object Uint8Array]",da="[object Uint8ClampedArray]",ca="[object Uint16Array]",ha="[object Uint32Array]",d={};d[fa]=d[na]=d[pa]=d[la]=d[ma]=d[ua]=d[da]=d[ca]=d[ha]=!0;d[qo]=d[Ho]=d[sa]=d[$o]=d[ia]=d[Yo]=d[Zo]=d[Jo]=d[Xo]=d[Qo]=d[ta]=d[ea]=d[ra]=d[oa]=d[aa]=!1;function xa(t){return A(t)&&lt(t.length)&&!!d[I(t)]}var ne=xa;function ga(t){return function(e){return t(e)}}var K=ga;var pe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,et=pe&&typeof module=="object"&&module&&!module.nodeType&&module,ba=et&&et.exports===pe,St=ba&&ot.process,ya=function(){try{var t=et&&et.require&&et.require("util").types;return t||St&&St.binding&&St.binding("util")}catch{}}(),C=ya;var le=C&&C.isTypedArray,va=le?K(le):ne,me=va;var wa=Object.prototype,ja=wa.hasOwnProperty;function Ta(t,e){var r=U(t),o=!r&&oe(t),a=!r&&!o&&ut(t),p=!r&&!o&&!a&&me(t),n=r||o||a||p,s=n?ee(t.length,String):[],l=s.length;for(var c in t)(e||ja.call(t,c))&&!(n&&(c=="length"||a&&(c=="offset"||c=="parent")||p&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||te(c,l)))&&s.push(c);return s}var dt=Ta;function Aa(t,e){return function(r){return t(e(r))}}var ct=Aa;var Oa=ct(Object.keys,Object),ue=Oa;var Pa=Object.prototype,Sa=Pa.hasOwnProperty;function _a(t){if(!G(t))return ue(t);var e=[];for(var r in Object(t))Sa.call(t,r)&&r!="constructor"&&e.push(r);return e}var de=_a;function Ia(t){return mt(t)?dt(t):de(t)}var W=Ia;function Ea(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var ce=Ea;var Ca=Object.prototype,Ma=Ca.hasOwnProperty;function Ra(t){if(!O(t))return ce(t);var e=G(t),r=[];for(var o in t)o=="constructor"&&(e||!Ma.call(t,o))||r.push(o);return r}var he=Ra;function Ba(t){return mt(t)?dt(t,!0):he(t)}var z=Ba;var La=j(Object,"create"),M=La;function Fa(){this.__data__=M?M(null):{},this.size=0}var xe=Fa;function Na(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ge=Na;var Da="__lodash_hash_undefined__",ka=Object.prototype,Ua=ka.hasOwnProperty;function Ga(t){var e=this.__data__;if(M){var r=e[t];return r===Da?void 0:r}return Ua.call(e,t)?e[t]:void 0}var be=Ga;var Ka=Object.prototype,Wa=Ka.hasOwnProperty;function za(t){var e=this.__data__;return M?e[t]!==void 0:Wa.call(e,t)}var ye=za;var Va="__lodash_hash_undefined__";function qa(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?Va:e,this}var ve=qa;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=xe;V.prototype.delete=ge;V.prototype.get=be;V.prototype.has=ye;V.prototype.set=ve;var _t=V;function Ha(){this.__data__=[],this.size=0}var we=Ha;function $a(t,e){for(var r=t.length;r--;)if(nt(t[r][0],e))return r;return-1}var B=$a;var Ya=Array.prototype,Za=Ya.splice;function Ja(t){var e=this.__data__,r=B(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Za.call(e,r,1),--this.size,!0}var je=Ja;function Xa(t){var e=this.__data__,r=B(e,t);return r<0?void 0:e[r][1]}var Te=Xa;function Qa(t){return B(this.__data__,t)>-1}var Ae=Qa;function ts(t,e){var r=this.__data__,o=B(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Oe=ts;function q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}q.prototype.clear=we;q.prototype.delete=je;q.prototype.get=Te;q.prototype.has=Ae;q.prototype.set=Oe;var L=q;var es=j(g,"Map"),F=es;function rs(){this.size=0,this.__data__={hash:new _t,map:new(F||L),string:new _t}}var Pe=rs;function os(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Se=os;function as(t,e){var r=t.__data__;return Se(e)?r[typeof e=="string"?"string":"hash"]:r.map}var N=as;function ss(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e}var _e=ss;function is(t){return N(this,t).get(t)}var Ie=is;function fs(t){return N(this,t).has(t)}var Ee=fs;function ns(t,e){var r=N(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ce=ns;function H(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}H.prototype.clear=Pe;H.prototype.delete=_e;H.prototype.get=Ie;H.prototype.has=Ee;H.prototype.set=Ce;var Me=H;function ps(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var ht=ps;var ls=ct(Object.getPrototypeOf,Object),xt=ls;function ms(){this.__data__=new L,this.size=0}var Re=ms;function us(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Be=us;function ds(t){return this.__data__.get(t)}var Le=ds;function cs(t){return this.__data__.has(t)}var Fe=cs;var hs=200;function xs(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!F||o.length<hs-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new Me(o)}return r.set(t,e),this.size=r.size,this}var Ne=xs;function $(t){var e=this.__data__=new L(t);this.size=e.size}$.prototype.clear=Re;$.prototype.delete=Be;$.prototype.get=Le;$.prototype.has=Fe;$.prototype.set=Ne;var De=$;function gs(t,e){return t&&R(e,W(e),t)}var ke=gs;function bs(t,e){return t&&R(e,z(e),t)}var Ue=bs;var ze=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ge=ze&&typeof module=="object"&&module&&!module.nodeType&&module,ys=Ge&&Ge.exports===ze,Ke=ys?g.Buffer:void 0,We=Ke?Ke.allocUnsafe:void 0;function vs(t,e){if(e)return t.slice();var r=t.length,o=We?We(r):new t.constructor(r);return t.copy(o),o}var Ve=vs;function ws(t,e){for(var r=-1,o=t==null?0:t.length,a=0,p=[];++r<o;){var n=t[r];e(n,r,t)&&(p[a++]=n)}return p}var qe=ws;function js(){return[]}var gt=js;var Ts=Object.prototype,As=Ts.propertyIsEnumerable,He=Object.getOwnPropertySymbols,Os=He?function(t){return t==null?[]:(t=Object(t),qe(He(t),function(e){return As.call(t,e)}))}:gt,Y=Os;function Ps(t,e){return R(t,Y(t),e)}var $e=Ps;var Ss=Object.getOwnPropertySymbols,_s=Ss?function(t){for(var e=[];t;)ht(e,Y(t)),t=xt(t);return e}:gt,bt=_s;function Is(t,e){return R(t,bt(t),e)}var Ye=Is;function Es(t,e,r){var o=e(t);return U(t)?o:ht(o,r(t))}var yt=Es;function Cs(t){return yt(t,W,Y)}var Ze=Cs;function Ms(t){return yt(t,z,bt)}var Je=Ms;var Rs=j(g,"DataView"),vt=Rs;var Bs=j(g,"Promise"),wt=Bs;var Ls=j(g,"Set"),jt=Ls;var Xe="[object Map]",Fs="[object Object]",Qe="[object Promise]",tr="[object Set]",er="[object WeakMap]",rr="[object DataView]",Ns=E(vt),Ds=E(F),ks=E(wt),Us=E(jt),Gs=E(it),D=I;(vt&&D(new vt(new ArrayBuffer(1)))!=rr||F&&D(new F)!=Xe||wt&&D(wt.resolve())!=Qe||jt&&D(new jt)!=tr||it&&D(new it)!=er)&&(D=function(t){var e=I(t),r=e==Fs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Ns:return rr;case Ds:return Xe;case ks:return Qe;case Us:return tr;case Gs:return er}return e});var Z=D;var Ks=Object.prototype,Ws=Ks.hasOwnProperty;function zs(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Ws.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var or=zs;var Vs=g.Uint8Array,It=Vs;function qs(t){var e=new t.constructor(t.byteLength);return new It(e).set(new It(t)),e}var J=qs;function Hs(t,e){var r=e?J(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var ar=Hs;var $s=/\w*$/;function Ys(t){var e=new t.constructor(t.source,$s.exec(t));return e.lastIndex=t.lastIndex,e}var sr=Ys;var ir=_?_.prototype:void 0,fr=ir?ir.valueOf:void 0;function Zs(t){return fr?Object(fr.call(t)):{}}var nr=Zs;function Js(t,e){var r=e?J(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var pr=Js;var Xs="[object Boolean]",Qs="[object Date]",ti="[object Map]",ei="[object Number]",ri="[object RegExp]",oi="[object Set]",ai="[object String]",si="[object Symbol]",ii="[object ArrayBuffer]",fi="[object DataView]",ni="[object Float32Array]",pi="[object Float64Array]",li="[object Int8Array]",mi="[object Int16Array]",ui="[object Int32Array]",di="[object Uint8Array]",ci="[object Uint8ClampedArray]",hi="[object Uint16Array]",xi="[object Uint32Array]";function gi(t,e,r){var o=t.constructor;switch(e){case ii:return J(t);case Xs:case Qs:return new o(+t);case fi:return ar(t,r);case ni:case pi:case li:case mi:case ui:case di:case ci:case hi:case xi:return pr(t,r);case ti:return new o;case ei:case ai:return new o(t);case ri:return sr(t);case oi:return new o;case si:return nr(t)}}var lr=gi;function bi(t){return typeof t.constructor=="function"&&!G(t)?Jt(xt(t)):{}}var mr=bi;var yi="[object Map]";function vi(t){return A(t)&&Z(t)==yi}var ur=vi;var dr=C&&C.isMap,wi=dr?K(dr):ur,cr=wi;var ji="[object Set]";function Ti(t){return A(t)&&Z(t)==ji}var hr=Ti;var xr=C&&C.isSet,Ai=xr?K(xr):hr,gr=Ai;var Oi=1,Pi=2,Si=4,br="[object Arguments]",_i="[object Array]",Ii="[object Boolean]",Ei="[object Date]",Ci="[object Error]",yr="[object Function]",Mi="[object GeneratorFunction]",Ri="[object Map]",Bi="[object Number]",vr="[object Object]",Li="[object RegExp]",Fi="[object Set]",Ni="[object String]",Di="[object Symbol]",ki="[object WeakMap]",Ui="[object ArrayBuffer]",Gi="[object DataView]",Ki="[object Float32Array]",Wi="[object Float64Array]",zi="[object Int8Array]",Vi="[object Int16Array]",qi="[object Int32Array]",Hi="[object Uint8Array]",$i="[object Uint8ClampedArray]",Yi="[object Uint16Array]",Zi="[object Uint32Array]",u={};u[br]=u[_i]=u[Ui]=u[Gi]=u[Ii]=u[Ei]=u[Ki]=u[Wi]=u[zi]=u[Vi]=u[qi]=u[Ri]=u[Bi]=u[vr]=u[Li]=u[Fi]=u[Ni]=u[Di]=u[Hi]=u[$i]=u[Yi]=u[Zi]=!0;u[Ci]=u[yr]=u[ki]=!1;function Tt(t,e,r,o,a,p){var n,s=e&Oi,l=e&Pi,c=e&Si;if(r&&(n=a?r(t,o,a,p):r(t)),n!==void 0)return n;if(!O(t))return t;var x=U(t);if(x){if(n=or(t),!s)return Xt(t,n)}else{var v=Z(t),T=v==yr||v==Mi;if(ut(t))return Ve(t,s);if(v==vr||v==br||T&&!a){if(n=l||T?{}:mr(t),!s)return l?Ye(t,Ue(n,t)):$e(t,ke(n,t))}else{if(!u[v])return a?t:{};n=lr(t,v,s)}}p||(p=new De);var w=p.get(t);if(w)return w;p.set(t,n),gr(t)?t.forEach(function(y){n.add(Tt(y,e,r,y,t,p))}):cr(t)&&t.forEach(function(y,i){n.set(i,Tt(y,e,r,i,t,p))});var b=c?l?Je:Ze:l?z:W,P=x?void 0:b(t);return Qt(P||t,function(y,i){P&&(i=y,y=t[i]),pt(n,i,Tt(y,e,r,i,t,p))}),n}var wr=Tt;var Ji=1,Xi=4;function Qi(t){return wr(t,Ji|Xi)}var Et=Qi;function jr(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var Ct=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var tf="array",ef="bit",Tr="bits",rf="byte",Ar="bytes",X="",of="exponent",af="function",Or="iec",sf="Invalid number",ff="Invalid rounding method",Mt="jedec",nf="object",Pr=".",pf="round",lf="s",mf="si",uf="kbit",df="kB",cf=" ",hf="string",xf="0",Rt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function Sr(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:p=X,localeOptions:n={},separator:s=X,spacer:l=cf,symbols:c={},standard:x=X,output:v=hf,fullform:T=!1,fullforms:w=[],exponent:b=-1,roundingMethod:P=pf,precision:y=0}={}){let i=b,m=Number(t),f=[],S=0,At=X;x===mf?(o=10,x=Mt):x===Or||x===Mt?o=2:o===2?x=Or:(o=10,x=Mt);let rt=o===10?1e3:1024,_r=T===!0,Lt=m<0,Ft=Math[P];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(sf);if(typeof Ft!==af)throw new TypeError(ff);if(Lt&&(m=-m),(i===-1||isNaN(i))&&(i=Math.floor(Math.log(m)/Math.log(rt)),i<0&&(i=0)),i>8&&(y>0&&(y+=8-i),i=8),v===of)return i;if(m===0)f[0]=0,At=f[1]=Rt.symbol[x][e?Tr:Ar][i];else{S=m/(o===2?Math.pow(2,i*10):Math.pow(1e3,i)),e&&(S=S*8,S>=rt&&i<8&&(S=S/rt,i++));let Q=Math.pow(10,i>0?a:0);f[0]=Ft(S*Q)/Q,f[0]===rt&&i<8&&b===-1&&(f[0]=1,i++),At=f[1]=o===10&&i===1?e?uf:df:Rt.symbol[x][e?Tr:Ar][i]}if(Lt&&(f[0]=-f[0]),y>0&&(f[0]=f[0].toPrecision(y)),f[1]=c[f[1]]||f[1],p===!0?f[0]=f[0].toLocaleString():p.length>0?f[0]=f[0].toLocaleString(p,n):s.length>0&&(f[0]=f[0].toString().replace(Pr,s)),r&&Number.isInteger(f[0])===!1&&a>0){let Q=s||Pr,Nt=f[0].toString().split(Q),Dt=Nt[1]||X,kt=Dt.length,Ir=a-kt;f[0]=`${Nt[0]}${Q}${Dt.padEnd(kt+Ir,xf)}`}return _r&&(f[1]=w[i]?w[i]:Rt.fullform[x][i]+(e?ef:rf)+(f[0]===1?X:lf)),v===tf?f:v===nf?{value:f[0],symbol:f[1],exponent:i,unit:At}:f.join(l)}var k=class{constructor(e){h(this,"tera");h(this,"id");h(this,"name");h(this,"path");h(this,"parsedName");h(this,"created");h(this,"createdFormatted");h(this,"modified");h(this,"modifiedFormatted");h(this,"accessed");h(this,"accessedFormatted");h(this,"size");h(this,"sizeFormatted");h(this,"mime");if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e),this.sizeFormatted=Sr(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(){return this.tera.getProjectFile(this.path)}setContents(e){return this.tera.setProjectFile(this.path,e)}getRefs(){return this.tera.getProjectLibrary(this.path)}setRefs(e){return this.tera.setProjectLibrary(this.path,e)}};var Bt=class{constructor(e){h(this,"settings",{devMode:!0,mode:"detect",modeTimeout:300,modeFallback:"child",siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3});h(this,"events",jr());h(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});h(this,"methods",["handshake","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","saveProjectState","replaceProjectState","applyProjectStatePatch","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","uiAlert","uiSplat","uiWindow"]);h(this,"plugins",[]);h(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Ct();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Ct(),...Et(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR","Message compose client->server:",o),this.debug("ERROR","Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return;let r=e.data;if(!(!r.TERA||!r.id))if(this.debug("Recieved",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id])r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response);else{if((r==null?void 0:r.action)=="rpc")return Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})});if((r==null?void 0:r.action)=="event")return Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o});r!=null&&r.id?this.debug(`Ignoring message ID ${r.id} - was meant for someone else?`):this.debug("Unexpected incoming TERA-FY CLIENT message",{message:r})}}createProjectStatePatch(e,r){let o=Ut(r,e,Gt);return this.debug("INFO","Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.detectMode()).then(o=>this.settings.mode=o).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings))))}detectMode(){return this.settings.mode!="detect"?this.settings.mode:window.self===window.parent?this.settings.modeFallback:Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){return new Promise(e=>{switch(this.settings.mode){case"child":this.debug("Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),document.body.append(this.dom.el),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("Embed frame ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe);break;case"parent":this.debug("Using TERA window parent"),e();break;case"popup":this.debug("Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),(()=>{let r=0,o,a=()=>{this.debug("Trying handshake",++r),clearTimeout(o),o=setTimeout(a,this.settings.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(o),this.debug("Popup window accepted handshake"),e()})};a()})();break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
2
2
  `),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){let r="log";typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),!(["INFO","LOG"].includes(r)&&!this.settings.devMode)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r){return typeof e=="string"?this.settings[e]=r:Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r){return!this.settings.devMode||r===void 0?this:this.set(e,r)}use(e,r){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){return this.settings.devMode=e==="toggle"?!this.settings.devMode:e,this.dom.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new k({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new k({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new k({tera:this,...r}))}};export{Bt as default};
3
3
  /*! Bundled license information:
4
4
 
package/dist/terafy.js CHANGED
@@ -1,4 +1,4 @@
1
- function kt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(s){return s});function o({obj1:s,obj2:l,basePath:c,basePathForRemoves:h,diffs:y}){var j=Object.keys(s),v=j.length,g=Object.keys(l),O=g.length,b,i=s.length-l.length;if(Er(s,l)){for(var m=0;m<v;m++){var f=Array.isArray(s)?Number(j[m]):j[m];f in l||(b=h.concat(f),y.remove.push({op:"remove",path:r(b)}))}for(var m=0;m<O;m++){var f=Array.isArray(l)?Number(g[m]):g[m];p({key:f,obj1:s,obj2:l,path:c.concat(f),pathForRemoves:c.concat(f),diffs:y})}}else{for(var m=0;m<i;m++)b=h.concat(m),y.remove.push({op:"remove",path:r(b)});for(var P=s.slice(i),m=0;m<O;m++)p({key:m,obj1:P,obj2:l,path:c.concat(m),pathForRemoves:c.concat(m+i),diffs:y})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function p({key:s,obj1:l,obj2:c,path:h,pathForRemoves:y,diffs:j}){var v=l[s],g=c[s];if(!(s in l)&&s in c){var O=g;j.add.push({op:"add",path:r(h),value:O})}else v!==g&&(Object(v)!==v||Object(g)!==g||Ir(v,g)||!Object.keys(v).length&&!Object.keys(g).length&&String(v)!=String(g)?n(h,j,g):o({obj1:l[s],obj2:c[s],basePath:h,basePathForRemoves:y,diffs:j}))}function n(s,l,c){l.replace.push({op:"replace",path:r(s),value:c})}}function Ut(t){return[""].concat(t).join("/")}function Ir(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function Er(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,p=0;p<e.length&&String(t[p])===String(e[p]);p++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var Cr=typeof global=="object"&&global&&global.Object===Object&&global,rt=Cr;var Mr=typeof self=="object"&&self&&self.Object===Object&&self,Rr=rt||Mr||Function("return this")(),x=Rr;var Br=x.Symbol,S=Br;var Gt=Object.prototype,Lr=Gt.hasOwnProperty,Fr=Gt.toString,Q=S?S.toStringTag:void 0;function Nr(t){var e=Lr.call(t,Q),r=t[Q];try{t[Q]=void 0;var o=!0}catch{}var a=Fr.call(t);return o&&(e?t[Q]=r:delete t[Q]),a}var Kt=Nr;var Dr=Object.prototype,kr=Dr.toString;function Ur(t){return kr.call(t)}var Wt=Ur;var Gr="[object Null]",Kr="[object Undefined]",zt=S?S.toStringTag:void 0;function Wr(t){return t==null?t===void 0?Kr:Gr:zt&&zt in Object(t)?Kt(t):Wt(t)}var _=Wr;function zr(t){return t!=null&&typeof t=="object"}var T=zr;var Vr=Array.isArray,k=Vr;function qr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var A=qr;var Hr="[object AsyncFunction]",$r="[object Function]",Yr="[object GeneratorFunction]",Zr="[object Proxy]";function Jr(t){if(!A(t))return!1;var e=_(t);return e==$r||e==Yr||e==Hr||e==Zr}var ot=Jr;var Xr=x["__core-js_shared__"],at=Xr;var Vt=function(){var t=/[^.]+$/.exec(at&&at.keys&&at.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Qr(t){return!!Vt&&Vt in t}var qt=Qr;var to=Function.prototype,eo=to.toString;function ro(t){if(t!=null){try{return eo.call(t)}catch{}try{return t+""}catch{}}return""}var I=ro;var oo=/[\\^$.*+?()[\]{}|]/g,ao=/^\[object .+?Constructor\]$/,so=Function.prototype,io=Object.prototype,fo=so.toString,no=io.hasOwnProperty,po=RegExp("^"+fo.call(no).replace(oo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function lo(t){if(!A(t)||qt(t))return!1;var e=ot(t)?po:ao;return e.test(I(t))}var Ht=lo;function mo(t,e){return t?.[e]}var $t=mo;function uo(t,e){var r=$t(t,e);return Ht(r)?r:void 0}var w=uo;var co=w(x,"WeakMap"),st=co;var Yt=Object.create,ho=function(){function t(){}return function(e){if(!A(e))return{};if(Yt)return Yt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Zt=ho;function xo(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Jt=xo;var go=function(){try{var t=w(Object,"defineProperty");return t({},"",{}),t}catch{}}(),At=go;function bo(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Xt=bo;var yo=9007199254740991,vo=/^(?:0|[1-9]\d*)$/;function wo(t,e){var r=typeof t;return e=e??yo,!!e&&(r=="number"||r!="symbol"&&vo.test(t))&&t>-1&&t%1==0&&t<e}var Qt=wo;function jo(t,e,r){e=="__proto__"&&At?At(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var it=jo;function To(t,e){return t===e||t!==t&&e!==e}var ft=To;var Ao=Object.prototype,Oo=Ao.hasOwnProperty;function Po(t,e,r){var o=t[e];(!(Oo.call(t,e)&&ft(o,r))||r===void 0&&!(e in t))&&it(t,e,r)}var nt=Po;function So(t,e,r,o){var a=!r;r||(r={});for(var p=-1,n=e.length;++p<n;){var s=e[p],l=o?o(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),a?it(r,s,l):nt(r,s,l)}return r}var M=So;var _o=9007199254740991;function Io(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=_o}var pt=Io;function Eo(t){return t!=null&&pt(t.length)&&!ot(t)}var lt=Eo;var Co=Object.prototype;function Mo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Co;return t===r}var U=Mo;function Ro(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var te=Ro;var Bo="[object Arguments]";function Lo(t){return T(t)&&_(t)==Bo}var Ot=Lo;var ee=Object.prototype,Fo=ee.hasOwnProperty,No=ee.propertyIsEnumerable,Do=Ot(function(){return arguments}())?Ot:function(t){return T(t)&&Fo.call(t,"callee")&&!No.call(t,"callee")},re=Do;function ko(){return!1}var oe=ko;var ie=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ae=ie&&typeof module=="object"&&module&&!module.nodeType&&module,Uo=ae&&ae.exports===ie,se=Uo?x.Buffer:void 0,Go=se?se.isBuffer:void 0,Ko=Go||oe,mt=Ko;var Wo="[object Arguments]",zo="[object Array]",Vo="[object Boolean]",qo="[object Date]",Ho="[object Error]",$o="[object Function]",Yo="[object Map]",Zo="[object Number]",Jo="[object Object]",Xo="[object RegExp]",Qo="[object Set]",ta="[object String]",ea="[object WeakMap]",ra="[object ArrayBuffer]",oa="[object DataView]",aa="[object Float32Array]",sa="[object Float64Array]",ia="[object Int8Array]",fa="[object Int16Array]",na="[object Int32Array]",pa="[object Uint8Array]",la="[object Uint8ClampedArray]",ma="[object Uint16Array]",ua="[object Uint32Array]",d={};d[aa]=d[sa]=d[ia]=d[fa]=d[na]=d[pa]=d[la]=d[ma]=d[ua]=!0;d[Wo]=d[zo]=d[ra]=d[Vo]=d[oa]=d[qo]=d[Ho]=d[$o]=d[Yo]=d[Zo]=d[Jo]=d[Xo]=d[Qo]=d[ta]=d[ea]=!1;function da(t){return T(t)&&pt(t.length)&&!!d[_(t)]}var fe=da;function ca(t){return function(e){return t(e)}}var G=ca;var ne=typeof exports=="object"&&exports&&!exports.nodeType&&exports,tt=ne&&typeof module=="object"&&module&&!module.nodeType&&module,ha=tt&&tt.exports===ne,Pt=ha&&rt.process,xa=function(){try{var t=tt&&tt.require&&tt.require("util").types;return t||Pt&&Pt.binding&&Pt.binding("util")}catch{}}(),E=xa;var pe=E&&E.isTypedArray,ga=pe?G(pe):fe,le=ga;var ba=Object.prototype,ya=ba.hasOwnProperty;function va(t,e){var r=k(t),o=!r&&re(t),a=!r&&!o&&mt(t),p=!r&&!o&&!a&&le(t),n=r||o||a||p,s=n?te(t.length,String):[],l=s.length;for(var c in t)(e||ya.call(t,c))&&!(n&&(c=="length"||a&&(c=="offset"||c=="parent")||p&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Qt(c,l)))&&s.push(c);return s}var ut=va;function wa(t,e){return function(r){return t(e(r))}}var dt=wa;var ja=dt(Object.keys,Object),me=ja;var Ta=Object.prototype,Aa=Ta.hasOwnProperty;function Oa(t){if(!U(t))return me(t);var e=[];for(var r in Object(t))Aa.call(t,r)&&r!="constructor"&&e.push(r);return e}var ue=Oa;function Pa(t){return lt(t)?ut(t):ue(t)}var K=Pa;function Sa(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var de=Sa;var _a=Object.prototype,Ia=_a.hasOwnProperty;function Ea(t){if(!A(t))return de(t);var e=U(t),r=[];for(var o in t)o=="constructor"&&(e||!Ia.call(t,o))||r.push(o);return r}var ce=Ea;function Ca(t){return lt(t)?ut(t,!0):ce(t)}var W=Ca;var Ma=w(Object,"create"),C=Ma;function Ra(){this.__data__=C?C(null):{},this.size=0}var he=Ra;function Ba(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var xe=Ba;var La="__lodash_hash_undefined__",Fa=Object.prototype,Na=Fa.hasOwnProperty;function Da(t){var e=this.__data__;if(C){var r=e[t];return r===La?void 0:r}return Na.call(e,t)?e[t]:void 0}var ge=Da;var ka=Object.prototype,Ua=ka.hasOwnProperty;function Ga(t){var e=this.__data__;return C?e[t]!==void 0:Ua.call(e,t)}var be=Ga;var Ka="__lodash_hash_undefined__";function Wa(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=C&&e===void 0?Ka:e,this}var ye=Wa;function z(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}z.prototype.clear=he;z.prototype.delete=xe;z.prototype.get=ge;z.prototype.has=be;z.prototype.set=ye;var St=z;function za(){this.__data__=[],this.size=0}var ve=za;function Va(t,e){for(var r=t.length;r--;)if(ft(t[r][0],e))return r;return-1}var R=Va;var qa=Array.prototype,Ha=qa.splice;function $a(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Ha.call(e,r,1),--this.size,!0}var we=$a;function Ya(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var je=Ya;function Za(t){return R(this.__data__,t)>-1}var Te=Za;function Ja(t,e){var r=this.__data__,o=R(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ae=Ja;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=ve;V.prototype.delete=we;V.prototype.get=je;V.prototype.has=Te;V.prototype.set=Ae;var B=V;var Xa=w(x,"Map"),L=Xa;function Qa(){this.size=0,this.__data__={hash:new St,map:new(L||B),string:new St}}var Oe=Qa;function ts(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Pe=ts;function es(t,e){var r=t.__data__;return Pe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var F=es;function rs(t){var e=F(this,t).delete(t);return this.size-=e?1:0,e}var Se=rs;function os(t){return F(this,t).get(t)}var _e=os;function as(t){return F(this,t).has(t)}var Ie=as;function ss(t,e){var r=F(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ee=ss;function q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}q.prototype.clear=Oe;q.prototype.delete=Se;q.prototype.get=_e;q.prototype.has=Ie;q.prototype.set=Ee;var Ce=q;function is(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var ct=is;var fs=dt(Object.getPrototypeOf,Object),ht=fs;function ns(){this.__data__=new B,this.size=0}var Me=ns;function ps(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Re=ps;function ls(t){return this.__data__.get(t)}var Be=ls;function ms(t){return this.__data__.has(t)}var Le=ms;var us=200;function ds(t,e){var r=this.__data__;if(r instanceof B){var o=r.__data__;if(!L||o.length<us-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ce(o)}return r.set(t,e),this.size=r.size,this}var Fe=ds;function H(t){var e=this.__data__=new B(t);this.size=e.size}H.prototype.clear=Me;H.prototype.delete=Re;H.prototype.get=Be;H.prototype.has=Le;H.prototype.set=Fe;var Ne=H;function cs(t,e){return t&&M(e,K(e),t)}var De=cs;function hs(t,e){return t&&M(e,W(e),t)}var ke=hs;var We=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ue=We&&typeof module=="object"&&module&&!module.nodeType&&module,xs=Ue&&Ue.exports===We,Ge=xs?x.Buffer:void 0,Ke=Ge?Ge.allocUnsafe:void 0;function gs(t,e){if(e)return t.slice();var r=t.length,o=Ke?Ke(r):new t.constructor(r);return t.copy(o),o}var ze=gs;function bs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,p=[];++r<o;){var n=t[r];e(n,r,t)&&(p[a++]=n)}return p}var Ve=bs;function ys(){return[]}var xt=ys;var vs=Object.prototype,ws=vs.propertyIsEnumerable,qe=Object.getOwnPropertySymbols,js=qe?function(t){return t==null?[]:(t=Object(t),Ve(qe(t),function(e){return ws.call(t,e)}))}:xt,$=js;function Ts(t,e){return M(t,$(t),e)}var He=Ts;var As=Object.getOwnPropertySymbols,Os=As?function(t){for(var e=[];t;)ct(e,$(t)),t=ht(t);return e}:xt,gt=Os;function Ps(t,e){return M(t,gt(t),e)}var $e=Ps;function Ss(t,e,r){var o=e(t);return k(t)?o:ct(o,r(t))}var bt=Ss;function _s(t){return bt(t,K,$)}var Ye=_s;function Is(t){return bt(t,W,gt)}var Ze=Is;var Es=w(x,"DataView"),yt=Es;var Cs=w(x,"Promise"),vt=Cs;var Ms=w(x,"Set"),wt=Ms;var Je="[object Map]",Rs="[object Object]",Xe="[object Promise]",Qe="[object Set]",tr="[object WeakMap]",er="[object DataView]",Bs=I(yt),Ls=I(L),Fs=I(vt),Ns=I(wt),Ds=I(st),N=_;(yt&&N(new yt(new ArrayBuffer(1)))!=er||L&&N(new L)!=Je||vt&&N(vt.resolve())!=Xe||wt&&N(new wt)!=Qe||st&&N(new st)!=tr)&&(N=function(t){var e=_(t),r=e==Rs?t.constructor:void 0,o=r?I(r):"";if(o)switch(o){case Bs:return er;case Ls:return Je;case Fs:return Xe;case Ns:return Qe;case Ds:return tr}return e});var Y=N;var ks=Object.prototype,Us=ks.hasOwnProperty;function Gs(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Us.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var rr=Gs;var Ks=x.Uint8Array,_t=Ks;function Ws(t){var e=new t.constructor(t.byteLength);return new _t(e).set(new _t(t)),e}var Z=Ws;function zs(t,e){var r=e?Z(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var or=zs;var Vs=/\w*$/;function qs(t){var e=new t.constructor(t.source,Vs.exec(t));return e.lastIndex=t.lastIndex,e}var ar=qs;var sr=S?S.prototype:void 0,ir=sr?sr.valueOf:void 0;function Hs(t){return ir?Object(ir.call(t)):{}}var fr=Hs;function $s(t,e){var r=e?Z(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var nr=$s;var Ys="[object Boolean]",Zs="[object Date]",Js="[object Map]",Xs="[object Number]",Qs="[object RegExp]",ti="[object Set]",ei="[object String]",ri="[object Symbol]",oi="[object ArrayBuffer]",ai="[object DataView]",si="[object Float32Array]",ii="[object Float64Array]",fi="[object Int8Array]",ni="[object Int16Array]",pi="[object Int32Array]",li="[object Uint8Array]",mi="[object Uint8ClampedArray]",ui="[object Uint16Array]",di="[object Uint32Array]";function ci(t,e,r){var o=t.constructor;switch(e){case oi:return Z(t);case Ys:case Zs:return new o(+t);case ai:return or(t,r);case si:case ii:case fi:case ni:case pi:case li:case mi:case ui:case di:return nr(t,r);case Js:return new o;case Xs:case ei:return new o(t);case Qs:return ar(t);case ti:return new o;case ri:return fr(t)}}var pr=ci;function hi(t){return typeof t.constructor=="function"&&!U(t)?Zt(ht(t)):{}}var lr=hi;var xi="[object Map]";function gi(t){return T(t)&&Y(t)==xi}var mr=gi;var ur=E&&E.isMap,bi=ur?G(ur):mr,dr=bi;var yi="[object Set]";function vi(t){return T(t)&&Y(t)==yi}var cr=vi;var hr=E&&E.isSet,wi=hr?G(hr):cr,xr=wi;var ji=1,Ti=2,Ai=4,gr="[object Arguments]",Oi="[object Array]",Pi="[object Boolean]",Si="[object Date]",_i="[object Error]",br="[object Function]",Ii="[object GeneratorFunction]",Ei="[object Map]",Ci="[object Number]",yr="[object Object]",Mi="[object RegExp]",Ri="[object Set]",Bi="[object String]",Li="[object Symbol]",Fi="[object WeakMap]",Ni="[object ArrayBuffer]",Di="[object DataView]",ki="[object Float32Array]",Ui="[object Float64Array]",Gi="[object Int8Array]",Ki="[object Int16Array]",Wi="[object Int32Array]",zi="[object Uint8Array]",Vi="[object Uint8ClampedArray]",qi="[object Uint16Array]",Hi="[object Uint32Array]",u={};u[gr]=u[Oi]=u[Ni]=u[Di]=u[Pi]=u[Si]=u[ki]=u[Ui]=u[Gi]=u[Ki]=u[Wi]=u[Ei]=u[Ci]=u[yr]=u[Mi]=u[Ri]=u[Bi]=u[Li]=u[zi]=u[Vi]=u[qi]=u[Hi]=!0;u[_i]=u[br]=u[Fi]=!1;function jt(t,e,r,o,a,p){var n,s=e&ji,l=e&Ti,c=e&Ai;if(r&&(n=a?r(t,o,a,p):r(t)),n!==void 0)return n;if(!A(t))return t;var h=k(t);if(h){if(n=rr(t),!s)return Jt(t,n)}else{var y=Y(t),j=y==br||y==Ii;if(mt(t))return ze(t,s);if(y==yr||y==gr||j&&!a){if(n=l||j?{}:lr(t),!s)return l?$e(t,ke(n,t)):He(t,De(n,t))}else{if(!u[y])return a?t:{};n=pr(t,y,s)}}p||(p=new Ne);var v=p.get(t);if(v)return v;p.set(t,n),xr(t)?t.forEach(function(b){n.add(jt(b,e,r,b,t,p))}):dr(t)&&t.forEach(function(b,i){n.set(i,jt(b,e,r,i,t,p))});var g=c?l?Ze:Ye:l?W:K,O=h?void 0:g(t);return Xt(O||t,function(b,i){O&&(i=b,b=t[i]),nt(n,i,jt(b,e,r,i,t,p))}),n}var vr=jt;var $i=1,Yi=4;function Zi(t){return vr(t,$i|Yi)}var It=Zi;function wr(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var Et=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var Ji="array",Xi="bit",jr="bits",Qi="byte",Tr="bytes",J="",tf="exponent",ef="function",Ar="iec",rf="Invalid number",of="Invalid rounding method",Ct="jedec",af="object",Or=".",sf="round",ff="s",nf="si",pf="kbit",lf="kB",mf=" ",uf="string",df="0",Mt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function Pr(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:p=J,localeOptions:n={},separator:s=J,spacer:l=mf,symbols:c={},standard:h=J,output:y=uf,fullform:j=!1,fullforms:v=[],exponent:g=-1,roundingMethod:O=sf,precision:b=0}={}){let i=g,m=Number(t),f=[],P=0,Tt=J;h===nf?(o=10,h=Ct):h===Ar||h===Ct?o=2:o===2?h=Ar:(o=10,h=Ct);let et=o===10?1e3:1024,Sr=j===!0,Bt=m<0,Lt=Math[O];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(rf);if(typeof Lt!==ef)throw new TypeError(of);if(Bt&&(m=-m),(i===-1||isNaN(i))&&(i=Math.floor(Math.log(m)/Math.log(et)),i<0&&(i=0)),i>8&&(b>0&&(b+=8-i),i=8),y===tf)return i;if(m===0)f[0]=0,Tt=f[1]=Mt.symbol[h][e?jr:Tr][i];else{P=m/(o===2?Math.pow(2,i*10):Math.pow(1e3,i)),e&&(P=P*8,P>=et&&i<8&&(P=P/et,i++));let X=Math.pow(10,i>0?a:0);f[0]=Lt(P*X)/X,f[0]===et&&i<8&&g===-1&&(f[0]=1,i++),Tt=f[1]=o===10&&i===1?e?pf:lf:Mt.symbol[h][e?jr:Tr][i]}if(Bt&&(f[0]=-f[0]),b>0&&(f[0]=f[0].toPrecision(b)),f[1]=c[f[1]]||f[1],p===!0?f[0]=f[0].toLocaleString():p.length>0?f[0]=f[0].toLocaleString(p,n):s.length>0&&(f[0]=f[0].toString().replace(Or,s)),r&&Number.isInteger(f[0])===!1&&a>0){let X=s||Or,Ft=f[0].toString().split(X),Nt=Ft[1]||J,Dt=Nt.length,_r=a-Dt;f[0]=`${Ft[0]}${X}${Nt.padEnd(Dt+_r,df)}`}return Sr&&(f[1]=v[i]?v[i]:Mt.fullform[h][i]+(e?Xi:Qi)+(f[0]===1?J:ff)),y===Ji?f:y===af?{value:f[0],symbol:f[1],exponent:i,unit:Tt}:f.join(l)}var D=class{tera;id;name;path;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e),this.sizeFormatted=Pr(this.size||0,{spacer:""}),this.createdFormatted=this.created.toLocaleDateString(),this.modifiedFormatted=this.modified.toLocaleDateString(),this.accessedFormatted=this.accessed.toLocaleDateString()}getContents(){return this.tera.getProjectFile(this.path)}setContents(e){return this.tera.setProjectFile(this.path,e)}getRefs(){return this.tera.getProjectLibrary(this.path)}setRefs(e){return this.tera.setProjectLibrary(this.path,e)}};var Rt=class{settings={devMode:!0,mode:"detect",modeTimeout:300,modeFallback:"child",siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3};events=wr();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","saveProjectState","replaceProjectState","applyProjectStatePatch","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","uiAlert","uiSplat","uiWindow"];plugins=[];send(e){let r=Et();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Et(),...It(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR","Message compose client->server:",o),this.debug("ERROR","Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return;let r=e.data;if(!(!r.TERA||!r.id))if(this.debug("Recieved",r),r?.action=="response"&&this.acceptPostboxes[r.id])r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response);else{if(r?.action=="rpc")return Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o.toString()})});if(r?.action=="event")return Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o});r?.id?this.debug(`Ignoring message ID ${r.id} - was meant for someone else?`):this.debug("Unexpected incoming TERA-FY CLIENT message",{message:r})}}acceptPostboxes={};createProjectStatePatch(e,r){let o=kt(r,e,Ut);return this.debug("INFO","Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}constructor(e){e&&this.set(e)}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.detectMode()).then(o=>this.settings.mode=o).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings))))}detectMode(){return this.settings.mode!="detect"?this.settings.mode:window.self===window.parent?this.settings.modeFallback:Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){return new Promise(e=>{switch(this.settings.mode){case"child":this.debug("Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),document.body.append(this.dom.el),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("Embed frame ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe);break;case"parent":this.debug("Using TERA window parent"),e();break;case"popup":this.debug("Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),(()=>{let r=0,o,a=()=>{this.debug("Trying handshake",++r),clearTimeout(o),o=setTimeout(a,this.settings.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(o),this.debug("Popup window accepted handshake"),e()})};a()})();break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
1
+ function kt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(s){return s});function o({obj1:s,obj2:l,basePath:c,basePathForRemoves:h,diffs:y}){var j=Object.keys(s),v=j.length,g=Object.keys(l),O=g.length,b,i=s.length-l.length;if(Er(s,l)){for(var m=0;m<v;m++){var f=Array.isArray(s)?Number(j[m]):j[m];f in l||(b=h.concat(f),y.remove.push({op:"remove",path:r(b)}))}for(var m=0;m<O;m++){var f=Array.isArray(l)?Number(g[m]):g[m];p({key:f,obj1:s,obj2:l,path:c.concat(f),pathForRemoves:c.concat(f),diffs:y})}}else{for(var m=0;m<i;m++)b=h.concat(m),y.remove.push({op:"remove",path:r(b)});for(var P=s.slice(i),m=0;m<O;m++)p({key:m,obj1:P,obj2:l,path:c.concat(m),pathForRemoves:c.concat(m+i),diffs:y})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function p({key:s,obj1:l,obj2:c,path:h,pathForRemoves:y,diffs:j}){var v=l[s],g=c[s];if(!(s in l)&&s in c){var O=g;j.add.push({op:"add",path:r(h),value:O})}else v!==g&&(Object(v)!==v||Object(g)!==g||Ir(v,g)||!Object.keys(v).length&&!Object.keys(g).length&&String(v)!=String(g)?n(h,j,g):o({obj1:l[s],obj2:c[s],basePath:h,basePathForRemoves:y,diffs:j}))}function n(s,l,c){l.replace.push({op:"replace",path:r(s),value:c})}}function Ut(t){return[""].concat(t).join("/")}function Ir(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function Er(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,p=0;p<e.length&&String(t[p])===String(e[p]);p++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var Cr=typeof global=="object"&&global&&global.Object===Object&&global,rt=Cr;var Mr=typeof self=="object"&&self&&self.Object===Object&&self,Rr=rt||Mr||Function("return this")(),x=Rr;var Br=x.Symbol,S=Br;var Gt=Object.prototype,Lr=Gt.hasOwnProperty,Fr=Gt.toString,Q=S?S.toStringTag:void 0;function Nr(t){var e=Lr.call(t,Q),r=t[Q];try{t[Q]=void 0;var o=!0}catch{}var a=Fr.call(t);return o&&(e?t[Q]=r:delete t[Q]),a}var Kt=Nr;var Dr=Object.prototype,kr=Dr.toString;function Ur(t){return kr.call(t)}var Wt=Ur;var Gr="[object Null]",Kr="[object Undefined]",zt=S?S.toStringTag:void 0;function Wr(t){return t==null?t===void 0?Kr:Gr:zt&&zt in Object(t)?Kt(t):Wt(t)}var _=Wr;function zr(t){return t!=null&&typeof t=="object"}var T=zr;var Vr=Array.isArray,k=Vr;function qr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var A=qr;var Hr="[object AsyncFunction]",$r="[object Function]",Yr="[object GeneratorFunction]",Zr="[object Proxy]";function Jr(t){if(!A(t))return!1;var e=_(t);return e==$r||e==Yr||e==Hr||e==Zr}var ot=Jr;var Xr=x["__core-js_shared__"],at=Xr;var Vt=function(){var t=/[^.]+$/.exec(at&&at.keys&&at.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Qr(t){return!!Vt&&Vt in t}var qt=Qr;var to=Function.prototype,eo=to.toString;function ro(t){if(t!=null){try{return eo.call(t)}catch{}try{return t+""}catch{}}return""}var I=ro;var oo=/[\\^$.*+?()[\]{}|]/g,ao=/^\[object .+?Constructor\]$/,so=Function.prototype,io=Object.prototype,fo=so.toString,no=io.hasOwnProperty,po=RegExp("^"+fo.call(no).replace(oo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function lo(t){if(!A(t)||qt(t))return!1;var e=ot(t)?po:ao;return e.test(I(t))}var Ht=lo;function mo(t,e){return t?.[e]}var $t=mo;function uo(t,e){var r=$t(t,e);return Ht(r)?r:void 0}var w=uo;var co=w(x,"WeakMap"),st=co;var Yt=Object.create,ho=function(){function t(){}return function(e){if(!A(e))return{};if(Yt)return Yt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Zt=ho;function xo(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Jt=xo;var go=function(){try{var t=w(Object,"defineProperty");return t({},"",{}),t}catch{}}(),At=go;function bo(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Xt=bo;var yo=9007199254740991,vo=/^(?:0|[1-9]\d*)$/;function wo(t,e){var r=typeof t;return e=e??yo,!!e&&(r=="number"||r!="symbol"&&vo.test(t))&&t>-1&&t%1==0&&t<e}var Qt=wo;function jo(t,e,r){e=="__proto__"&&At?At(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var it=jo;function To(t,e){return t===e||t!==t&&e!==e}var ft=To;var Ao=Object.prototype,Oo=Ao.hasOwnProperty;function Po(t,e,r){var o=t[e];(!(Oo.call(t,e)&&ft(o,r))||r===void 0&&!(e in t))&&it(t,e,r)}var nt=Po;function So(t,e,r,o){var a=!r;r||(r={});for(var p=-1,n=e.length;++p<n;){var s=e[p],l=o?o(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),a?it(r,s,l):nt(r,s,l)}return r}var M=So;var _o=9007199254740991;function Io(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=_o}var pt=Io;function Eo(t){return t!=null&&pt(t.length)&&!ot(t)}var lt=Eo;var Co=Object.prototype;function Mo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Co;return t===r}var U=Mo;function Ro(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var te=Ro;var Bo="[object Arguments]";function Lo(t){return T(t)&&_(t)==Bo}var Ot=Lo;var ee=Object.prototype,Fo=ee.hasOwnProperty,No=ee.propertyIsEnumerable,Do=Ot(function(){return arguments}())?Ot:function(t){return T(t)&&Fo.call(t,"callee")&&!No.call(t,"callee")},re=Do;function ko(){return!1}var oe=ko;var ie=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ae=ie&&typeof module=="object"&&module&&!module.nodeType&&module,Uo=ae&&ae.exports===ie,se=Uo?x.Buffer:void 0,Go=se?se.isBuffer:void 0,Ko=Go||oe,mt=Ko;var Wo="[object Arguments]",zo="[object Array]",Vo="[object Boolean]",qo="[object Date]",Ho="[object Error]",$o="[object Function]",Yo="[object Map]",Zo="[object Number]",Jo="[object Object]",Xo="[object RegExp]",Qo="[object Set]",ta="[object String]",ea="[object WeakMap]",ra="[object ArrayBuffer]",oa="[object DataView]",aa="[object Float32Array]",sa="[object Float64Array]",ia="[object Int8Array]",fa="[object Int16Array]",na="[object Int32Array]",pa="[object Uint8Array]",la="[object Uint8ClampedArray]",ma="[object Uint16Array]",ua="[object Uint32Array]",d={};d[aa]=d[sa]=d[ia]=d[fa]=d[na]=d[pa]=d[la]=d[ma]=d[ua]=!0;d[Wo]=d[zo]=d[ra]=d[Vo]=d[oa]=d[qo]=d[Ho]=d[$o]=d[Yo]=d[Zo]=d[Jo]=d[Xo]=d[Qo]=d[ta]=d[ea]=!1;function da(t){return T(t)&&pt(t.length)&&!!d[_(t)]}var fe=da;function ca(t){return function(e){return t(e)}}var G=ca;var ne=typeof exports=="object"&&exports&&!exports.nodeType&&exports,tt=ne&&typeof module=="object"&&module&&!module.nodeType&&module,ha=tt&&tt.exports===ne,Pt=ha&&rt.process,xa=function(){try{var t=tt&&tt.require&&tt.require("util").types;return t||Pt&&Pt.binding&&Pt.binding("util")}catch{}}(),E=xa;var pe=E&&E.isTypedArray,ga=pe?G(pe):fe,le=ga;var ba=Object.prototype,ya=ba.hasOwnProperty;function va(t,e){var r=k(t),o=!r&&re(t),a=!r&&!o&&mt(t),p=!r&&!o&&!a&&le(t),n=r||o||a||p,s=n?te(t.length,String):[],l=s.length;for(var c in t)(e||ya.call(t,c))&&!(n&&(c=="length"||a&&(c=="offset"||c=="parent")||p&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Qt(c,l)))&&s.push(c);return s}var ut=va;function wa(t,e){return function(r){return t(e(r))}}var dt=wa;var ja=dt(Object.keys,Object),me=ja;var Ta=Object.prototype,Aa=Ta.hasOwnProperty;function Oa(t){if(!U(t))return me(t);var e=[];for(var r in Object(t))Aa.call(t,r)&&r!="constructor"&&e.push(r);return e}var ue=Oa;function Pa(t){return lt(t)?ut(t):ue(t)}var K=Pa;function Sa(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var de=Sa;var _a=Object.prototype,Ia=_a.hasOwnProperty;function Ea(t){if(!A(t))return de(t);var e=U(t),r=[];for(var o in t)o=="constructor"&&(e||!Ia.call(t,o))||r.push(o);return r}var ce=Ea;function Ca(t){return lt(t)?ut(t,!0):ce(t)}var W=Ca;var Ma=w(Object,"create"),C=Ma;function Ra(){this.__data__=C?C(null):{},this.size=0}var he=Ra;function Ba(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var xe=Ba;var La="__lodash_hash_undefined__",Fa=Object.prototype,Na=Fa.hasOwnProperty;function Da(t){var e=this.__data__;if(C){var r=e[t];return r===La?void 0:r}return Na.call(e,t)?e[t]:void 0}var ge=Da;var ka=Object.prototype,Ua=ka.hasOwnProperty;function Ga(t){var e=this.__data__;return C?e[t]!==void 0:Ua.call(e,t)}var be=Ga;var Ka="__lodash_hash_undefined__";function Wa(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=C&&e===void 0?Ka:e,this}var ye=Wa;function z(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}z.prototype.clear=he;z.prototype.delete=xe;z.prototype.get=ge;z.prototype.has=be;z.prototype.set=ye;var St=z;function za(){this.__data__=[],this.size=0}var ve=za;function Va(t,e){for(var r=t.length;r--;)if(ft(t[r][0],e))return r;return-1}var R=Va;var qa=Array.prototype,Ha=qa.splice;function $a(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Ha.call(e,r,1),--this.size,!0}var we=$a;function Ya(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var je=Ya;function Za(t){return R(this.__data__,t)>-1}var Te=Za;function Ja(t,e){var r=this.__data__,o=R(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ae=Ja;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=ve;V.prototype.delete=we;V.prototype.get=je;V.prototype.has=Te;V.prototype.set=Ae;var B=V;var Xa=w(x,"Map"),L=Xa;function Qa(){this.size=0,this.__data__={hash:new St,map:new(L||B),string:new St}}var Oe=Qa;function ts(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Pe=ts;function es(t,e){var r=t.__data__;return Pe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var F=es;function rs(t){var e=F(this,t).delete(t);return this.size-=e?1:0,e}var Se=rs;function os(t){return F(this,t).get(t)}var _e=os;function as(t){return F(this,t).has(t)}var Ie=as;function ss(t,e){var r=F(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ee=ss;function q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}q.prototype.clear=Oe;q.prototype.delete=Se;q.prototype.get=_e;q.prototype.has=Ie;q.prototype.set=Ee;var Ce=q;function is(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var ct=is;var fs=dt(Object.getPrototypeOf,Object),ht=fs;function ns(){this.__data__=new B,this.size=0}var Me=ns;function ps(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Re=ps;function ls(t){return this.__data__.get(t)}var Be=ls;function ms(t){return this.__data__.has(t)}var Le=ms;var us=200;function ds(t,e){var r=this.__data__;if(r instanceof B){var o=r.__data__;if(!L||o.length<us-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ce(o)}return r.set(t,e),this.size=r.size,this}var Fe=ds;function H(t){var e=this.__data__=new B(t);this.size=e.size}H.prototype.clear=Me;H.prototype.delete=Re;H.prototype.get=Be;H.prototype.has=Le;H.prototype.set=Fe;var Ne=H;function cs(t,e){return t&&M(e,K(e),t)}var De=cs;function hs(t,e){return t&&M(e,W(e),t)}var ke=hs;var We=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ue=We&&typeof module=="object"&&module&&!module.nodeType&&module,xs=Ue&&Ue.exports===We,Ge=xs?x.Buffer:void 0,Ke=Ge?Ge.allocUnsafe:void 0;function gs(t,e){if(e)return t.slice();var r=t.length,o=Ke?Ke(r):new t.constructor(r);return t.copy(o),o}var ze=gs;function bs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,p=[];++r<o;){var n=t[r];e(n,r,t)&&(p[a++]=n)}return p}var Ve=bs;function ys(){return[]}var xt=ys;var vs=Object.prototype,ws=vs.propertyIsEnumerable,qe=Object.getOwnPropertySymbols,js=qe?function(t){return t==null?[]:(t=Object(t),Ve(qe(t),function(e){return ws.call(t,e)}))}:xt,$=js;function Ts(t,e){return M(t,$(t),e)}var He=Ts;var As=Object.getOwnPropertySymbols,Os=As?function(t){for(var e=[];t;)ct(e,$(t)),t=ht(t);return e}:xt,gt=Os;function Ps(t,e){return M(t,gt(t),e)}var $e=Ps;function Ss(t,e,r){var o=e(t);return k(t)?o:ct(o,r(t))}var bt=Ss;function _s(t){return bt(t,K,$)}var Ye=_s;function Is(t){return bt(t,W,gt)}var Ze=Is;var Es=w(x,"DataView"),yt=Es;var Cs=w(x,"Promise"),vt=Cs;var Ms=w(x,"Set"),wt=Ms;var Je="[object Map]",Rs="[object Object]",Xe="[object Promise]",Qe="[object Set]",tr="[object WeakMap]",er="[object DataView]",Bs=I(yt),Ls=I(L),Fs=I(vt),Ns=I(wt),Ds=I(st),N=_;(yt&&N(new yt(new ArrayBuffer(1)))!=er||L&&N(new L)!=Je||vt&&N(vt.resolve())!=Xe||wt&&N(new wt)!=Qe||st&&N(new st)!=tr)&&(N=function(t){var e=_(t),r=e==Rs?t.constructor:void 0,o=r?I(r):"";if(o)switch(o){case Bs:return er;case Ls:return Je;case Fs:return Xe;case Ns:return Qe;case Ds:return tr}return e});var Y=N;var ks=Object.prototype,Us=ks.hasOwnProperty;function Gs(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Us.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var rr=Gs;var Ks=x.Uint8Array,_t=Ks;function Ws(t){var e=new t.constructor(t.byteLength);return new _t(e).set(new _t(t)),e}var Z=Ws;function zs(t,e){var r=e?Z(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var or=zs;var Vs=/\w*$/;function qs(t){var e=new t.constructor(t.source,Vs.exec(t));return e.lastIndex=t.lastIndex,e}var ar=qs;var sr=S?S.prototype:void 0,ir=sr?sr.valueOf:void 0;function Hs(t){return ir?Object(ir.call(t)):{}}var fr=Hs;function $s(t,e){var r=e?Z(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var nr=$s;var Ys="[object Boolean]",Zs="[object Date]",Js="[object Map]",Xs="[object Number]",Qs="[object RegExp]",ti="[object Set]",ei="[object String]",ri="[object Symbol]",oi="[object ArrayBuffer]",ai="[object DataView]",si="[object Float32Array]",ii="[object Float64Array]",fi="[object Int8Array]",ni="[object Int16Array]",pi="[object Int32Array]",li="[object Uint8Array]",mi="[object Uint8ClampedArray]",ui="[object Uint16Array]",di="[object Uint32Array]";function ci(t,e,r){var o=t.constructor;switch(e){case oi:return Z(t);case Ys:case Zs:return new o(+t);case ai:return or(t,r);case si:case ii:case fi:case ni:case pi:case li:case mi:case ui:case di:return nr(t,r);case Js:return new o;case Xs:case ei:return new o(t);case Qs:return ar(t);case ti:return new o;case ri:return fr(t)}}var pr=ci;function hi(t){return typeof t.constructor=="function"&&!U(t)?Zt(ht(t)):{}}var lr=hi;var xi="[object Map]";function gi(t){return T(t)&&Y(t)==xi}var mr=gi;var ur=E&&E.isMap,bi=ur?G(ur):mr,dr=bi;var yi="[object Set]";function vi(t){return T(t)&&Y(t)==yi}var cr=vi;var hr=E&&E.isSet,wi=hr?G(hr):cr,xr=wi;var ji=1,Ti=2,Ai=4,gr="[object Arguments]",Oi="[object Array]",Pi="[object Boolean]",Si="[object Date]",_i="[object Error]",br="[object Function]",Ii="[object GeneratorFunction]",Ei="[object Map]",Ci="[object Number]",yr="[object Object]",Mi="[object RegExp]",Ri="[object Set]",Bi="[object String]",Li="[object Symbol]",Fi="[object WeakMap]",Ni="[object ArrayBuffer]",Di="[object DataView]",ki="[object Float32Array]",Ui="[object Float64Array]",Gi="[object Int8Array]",Ki="[object Int16Array]",Wi="[object Int32Array]",zi="[object Uint8Array]",Vi="[object Uint8ClampedArray]",qi="[object Uint16Array]",Hi="[object Uint32Array]",u={};u[gr]=u[Oi]=u[Ni]=u[Di]=u[Pi]=u[Si]=u[ki]=u[Ui]=u[Gi]=u[Ki]=u[Wi]=u[Ei]=u[Ci]=u[yr]=u[Mi]=u[Ri]=u[Bi]=u[Li]=u[zi]=u[Vi]=u[qi]=u[Hi]=!0;u[_i]=u[br]=u[Fi]=!1;function jt(t,e,r,o,a,p){var n,s=e&ji,l=e&Ti,c=e&Ai;if(r&&(n=a?r(t,o,a,p):r(t)),n!==void 0)return n;if(!A(t))return t;var h=k(t);if(h){if(n=rr(t),!s)return Jt(t,n)}else{var y=Y(t),j=y==br||y==Ii;if(mt(t))return ze(t,s);if(y==yr||y==gr||j&&!a){if(n=l||j?{}:lr(t),!s)return l?$e(t,ke(n,t)):He(t,De(n,t))}else{if(!u[y])return a?t:{};n=pr(t,y,s)}}p||(p=new Ne);var v=p.get(t);if(v)return v;p.set(t,n),xr(t)?t.forEach(function(b){n.add(jt(b,e,r,b,t,p))}):dr(t)&&t.forEach(function(b,i){n.set(i,jt(b,e,r,i,t,p))});var g=c?l?Ze:Ye:l?W:K,O=h?void 0:g(t);return Xt(O||t,function(b,i){O&&(i=b,b=t[i]),nt(n,i,jt(b,e,r,i,t,p))}),n}var vr=jt;var $i=1,Yi=4;function Zi(t){return vr(t,$i|Yi)}var It=Zi;function wr(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var Et=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var Ji="array",Xi="bit",jr="bits",Qi="byte",Tr="bytes",J="",tf="exponent",ef="function",Ar="iec",rf="Invalid number",of="Invalid rounding method",Ct="jedec",af="object",Or=".",sf="round",ff="s",nf="si",pf="kbit",lf="kB",mf=" ",uf="string",df="0",Mt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function Pr(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:p=J,localeOptions:n={},separator:s=J,spacer:l=mf,symbols:c={},standard:h=J,output:y=uf,fullform:j=!1,fullforms:v=[],exponent:g=-1,roundingMethod:O=sf,precision:b=0}={}){let i=g,m=Number(t),f=[],P=0,Tt=J;h===nf?(o=10,h=Ct):h===Ar||h===Ct?o=2:o===2?h=Ar:(o=10,h=Ct);let et=o===10?1e3:1024,Sr=j===!0,Bt=m<0,Lt=Math[O];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(rf);if(typeof Lt!==ef)throw new TypeError(of);if(Bt&&(m=-m),(i===-1||isNaN(i))&&(i=Math.floor(Math.log(m)/Math.log(et)),i<0&&(i=0)),i>8&&(b>0&&(b+=8-i),i=8),y===tf)return i;if(m===0)f[0]=0,Tt=f[1]=Mt.symbol[h][e?jr:Tr][i];else{P=m/(o===2?Math.pow(2,i*10):Math.pow(1e3,i)),e&&(P=P*8,P>=et&&i<8&&(P=P/et,i++));let X=Math.pow(10,i>0?a:0);f[0]=Lt(P*X)/X,f[0]===et&&i<8&&g===-1&&(f[0]=1,i++),Tt=f[1]=o===10&&i===1?e?pf:lf:Mt.symbol[h][e?jr:Tr][i]}if(Bt&&(f[0]=-f[0]),b>0&&(f[0]=f[0].toPrecision(b)),f[1]=c[f[1]]||f[1],p===!0?f[0]=f[0].toLocaleString():p.length>0?f[0]=f[0].toLocaleString(p,n):s.length>0&&(f[0]=f[0].toString().replace(Or,s)),r&&Number.isInteger(f[0])===!1&&a>0){let X=s||Or,Ft=f[0].toString().split(X),Nt=Ft[1]||J,Dt=Nt.length,_r=a-Dt;f[0]=`${Ft[0]}${X}${Nt.padEnd(Dt+_r,df)}`}return Sr&&(f[1]=v[i]?v[i]:Mt.fullform[h][i]+(e?Xi:Qi)+(f[0]===1?J:ff)),y===Ji?f:y===af?{value:f[0],symbol:f[1],exponent:i,unit:Tt}:f.join(l)}var D=class{tera;id;name;path;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e),this.sizeFormatted=Pr(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(){return this.tera.getProjectFile(this.path)}setContents(e){return this.tera.setProjectFile(this.path,e)}getRefs(){return this.tera.getProjectLibrary(this.path)}setRefs(e){return this.tera.setProjectLibrary(this.path,e)}};var Rt=class{settings={devMode:!0,mode:"detect",modeTimeout:300,modeFallback:"child",siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3};events=wr();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","saveProjectState","replaceProjectState","applyProjectStatePatch","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","uiAlert","uiSplat","uiWindow"];plugins=[];send(e){let r=Et();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Et(),...It(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR","Message compose client->server:",o),this.debug("ERROR","Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return;let r=e.data;if(!(!r.TERA||!r.id))if(this.debug("Recieved",r),r?.action=="response"&&this.acceptPostboxes[r.id])r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response);else{if(r?.action=="rpc")return Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})});if(r?.action=="event")return Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o});r?.id?this.debug(`Ignoring message ID ${r.id} - was meant for someone else?`):this.debug("Unexpected incoming TERA-FY CLIENT message",{message:r})}}acceptPostboxes={};createProjectStatePatch(e,r){let o=kt(r,e,Ut);return this.debug("INFO","Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}constructor(e){e&&this.set(e)}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.detectMode()).then(o=>this.settings.mode=o).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings))))}detectMode(){return this.settings.mode!="detect"?this.settings.mode:window.self===window.parent?this.settings.modeFallback:Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){return new Promise(e=>{switch(this.settings.mode){case"child":this.debug("Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),document.body.append(this.dom.el),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("Embed frame ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe);break;case"parent":this.debug("Using TERA window parent"),e();break;case"popup":this.debug("Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),(()=>{let r=0,o,a=()=>{this.debug("Trying handshake",++r),clearTimeout(o),o=setTimeout(a,this.settings.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(o),this.debug("Popup window accepted handshake"),e()})};a()})();break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
2
2
  `),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){let r="log";typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),!(["INFO","LOG"].includes(r)&&!this.settings.devMode)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r){return typeof e=="string"?this.settings[e]=r:Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r){return!this.settings.devMode||r===void 0?this:this.set(e,r)}use(e,r){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){return this.settings.devMode=e==="toggle"?!this.settings.devMode:e,this.dom.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new D({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new D({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new D({tera:this,...r}))}};export{Rt as default};
3
3
  /*! Bundled license information:
4
4
 
@@ -120,9 +120,9 @@ export default class ProjectFile {
120
120
 
121
121
  // Set all `*Formatted` fields
122
122
  this.sizeFormatted = filesize(this.size || 0, {spacer: ''});
123
- this.createdFormatted = this.created.toLocaleDateString();
124
- this.modifiedFormatted = this.modified.toLocaleDateString();
125
- this.accessedFormatted = this.accessed.toLocaleDateString();
123
+ this.createdFormatted = this.created ? this.created.toLocaleDateString() : 'Unknown created date';
124
+ this.modifiedFormatted = this.modified ? this.modified.toLocaleDateString() : 'Unknown modified date';
125
+ this.accessedFormatted = this.accessed ? this.accessed.toLocaleDateString() : 'Unknown access date';
126
126
  }
127
127
 
128
128
 
@@ -238,7 +238,7 @@ export default class TeraFy {
238
238
  id: message.id,
239
239
  action: 'response',
240
240
  isError: true,
241
- response: e.toString(),
241
+ response: e ? e.toString() : e,
242
242
  });
243
243
  })
244
244
  } else if (message?.action == 'event') {
@@ -279,7 +279,7 @@ export default class TeraFyServer {
279
279
  id: message.id,
280
280
  action: 'response',
281
281
  isError: true,
282
- response: e.toString(),
282
+ response: e ? e.toString() : e,
283
283
  });
284
284
  })
285
285
  }
@@ -682,7 +682,7 @@ export default class TeraFyServer {
682
682
 
683
683
  // }}}
684
684
 
685
- // Project State - getProjectState(), setProjectState(), saveProjectState(), replaceProjectState(), applyProjectStatePatch() {{{
685
+ // Project State - getProjectState(), setProjectState(), saveProjectStateDefaults(), replaceProjectState(), applyProjectStatePatch() {{{
686
686
 
687
687
  /**
688
688
  * Return the current, full snapshot state of the active project
@@ -790,16 +790,16 @@ export default class TeraFyServer {
790
790
  * @param {*} value The value to set
791
791
  * @param {Object} [options] Additional options to mutate behaviour, see setProjectState() for the full list of supported options
792
792
  *
793
- * @returns {Promise<Boolean>} A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
793
+ * @returns {Promise<*>} A promise which resolves to the eventual input value
794
794
  */
795
795
  setProjectStateDefaults(path, value, options) {
796
796
  if (!app.service('$projects').active) throw new Error('No active project');
797
797
 
798
798
  if (!this._pathHas(app.service('$projects').active, path)) {
799
799
  return this.setProjectState(path, value, options)
800
- .then(()=> true)
800
+ .then(()=> value)
801
801
  } else {
802
- return Promise.resolve(false);
802
+ return Promise.resolve(value);
803
803
  }
804
804
  }
805
805
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iebh/tera-fy",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "TERA website worker",
5
5
  "scripts": {
6
6
  "dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify --serve --servedir=.",
@@ -11,7 +11,7 @@
11
11
  "build:docs:api": "documentation build lib/terafy.client.js lib/projectFile.js --format html --config documentation.yml --output docs/",
12
12
  "build:docs:markdown": "documentation build lib/terafy.client.js lib/projectFile.js --format md --markdown-toc --output api.md",
13
13
  "lint": "eslint .",
14
- "release": "commit-and-tag-version",
14
+ "release": "release-it",
15
15
  "watch": "nodemon --watch lib --exec npm run build"
16
16
  },
17
17
  "type": "module",
@@ -66,15 +66,16 @@
66
66
  "node": ">=18"
67
67
  },
68
68
  "dependencies": {
69
- "commit-and-tag-version": "^12.2.0",
70
69
  "filesize": "^10.1.1",
71
70
  "just-diff": "^6.0.2",
72
71
  "lodash-es": "^4.17.21",
73
72
  "mitt": "^3.0.1",
74
- "nanoid": "^5.0.2"
73
+ "nanoid": "^5.0.2",
74
+ "release-it": "^17.1.1"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@momsfriendlydevco/eslint-config": "^1.0.7",
78
+ "@release-it/conventional-changelog": "^8.0.1",
78
79
  "concurrently": "^8.2.2",
79
80
  "documentation": "^14.0.2",
80
81
  "esbuild": "^0.19.5"
@@ -84,12 +85,6 @@
84
85
  "just-diff-apply": "^5.5.0",
85
86
  "vue": "^3.3.7"
86
87
  },
87
- "commit-and-tag-version": {
88
- "scripts": {
89
- "prerelease": "npm run build && git add api.md docs dist",
90
- "postcommit": "npm publish"
91
- }
92
- },
93
88
  "eslintConfig": {
94
89
  "extends": "@momsfriendlydevco",
95
90
  "env": {
@@ -100,5 +95,29 @@
100
95
  "ecmaVersion": 13,
101
96
  "sourceType": "module"
102
97
  }
98
+ },
99
+ "release-it": {
100
+ "git": {
101
+ "addUntrackedFiles": false,
102
+ "commit": true,
103
+ "commitMessage": "chore: release v${version}",
104
+ "push": true,
105
+ "requireCleanWorkingDir": false,
106
+ "tag": true
107
+ },
108
+ "hooks": {
109
+ "before:init": "git reset HEAD -- api.md docs/ dist/",
110
+ "after:bump": "npm run build && git add api.md docs/ dist/"
111
+ },
112
+ "plugins": {
113
+ "@release-it/conventional-changelog": {
114
+ "preset": "angular",
115
+ "infile": "CHANGELOG.md",
116
+ "header": "# Changelog"
117
+ }
118
+ },
119
+ "npm": {
120
+ "publish": true
121
+ }
103
122
  }
104
123
  }