@atom.io/template-solid-lossless-numbers 0.0.31 → 0.0.33
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +17 -0
- package/LICENSE +201 -0
- package/dist/index.html +1 -1
- package/package.json +7 -6
- package/dist/assets/index-Ci-bXF4z.js +0 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
$ vite build
|
|
2
|
-
[36mvite v8.
|
|
2
|
+
[36mvite v8.2.0 [32mbuilding client environment for production...[36m[39m
|
|
3
3
|
[2K
|
|
4
4
|
rendering chunks...
|
|
5
5
|
computing gzip size...
|
|
6
|
-
dist/index.html 0.39 kB │ gzip: 0.
|
|
6
|
+
dist/index.html 0.39 kB │ gzip: 0.27 kB
|
|
7
7
|
dist/assets/index-DMbEQKRi.css 3.29 kB │ gzip: 1.11 kB
|
|
8
|
-
dist/assets/index-
|
|
8
|
+
dist/assets/index-CBzDQyiV.js 82.58 kB │ gzip: 24.13 kB
|
|
9
9
|
|
|
10
|
-
[32m✓ built in
|
|
10
|
+
[32m✓ built in 440ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.33
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 53686a9: License `atom.io` and `create-atom.io` under MPL 2.0, while licensing the
|
|
8
|
+
project templates under Apache License 2.0. Document MPL's consumer-friendly,
|
|
9
|
+
file-level copyleft boundaries.
|
|
10
|
+
- Updated dependencies [53686a9]
|
|
11
|
+
- atom.io@0.50.2
|
|
12
|
+
|
|
13
|
+
## 0.0.32
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [b14a9b6]
|
|
18
|
+
- atom.io@0.50.1
|
|
19
|
+
|
|
3
20
|
## 0.0.31
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/dist/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
content="width=device-width, initial-scale=1.0"
|
|
8
8
|
/>
|
|
9
9
|
<title>Rationality Playground</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-CBzDQyiV.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-DMbEQKRi.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atom.io/template-solid-lossless-numbers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
|
+
"license": "Apache-2.0",
|
|
4
5
|
"publishConfig": {
|
|
5
6
|
"access": "public"
|
|
6
7
|
},
|
|
@@ -13,14 +14,14 @@
|
|
|
13
14
|
"dependencies": {
|
|
14
15
|
"rationality": "0.1.0",
|
|
15
16
|
"solid-js": "1.9.14",
|
|
16
|
-
"atom.io": "0.50.
|
|
17
|
+
"atom.io": "0.50.2"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@types/node": "26.1.
|
|
20
|
-
"eslint": "10.
|
|
20
|
+
"@types/node": "26.1.2",
|
|
21
|
+
"eslint": "10.8.0",
|
|
21
22
|
"typescript": "7.0.2",
|
|
22
|
-
"vite": "8.
|
|
23
|
-
"vite-plugin-solid": "2.11.
|
|
23
|
+
"vite": "8.2.0",
|
|
24
|
+
"vite-plugin-solid": "2.11.14"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
27
|
"dev": "vite",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return t(this.context.count)},getNextContextId(){return t(this.context.count++)}};function t(t){let n=String(t),r=n.length-1;return e.context.id+(r?String.fromCharCode(96+r):``)+n}function n(t){e.context=t}var r=(e,t)=>e===t,i=Symbol(`solid-track`),a={equals:r},o=null,s=he,c=1,l=2,u={owned:null,cleanups:null,context:null,owner:null},d=null,f=null,p=null,m=null,h=null,g=0;function _(e,t){let n=p,r=d,i=e.length===0,a=t===void 0?r:t,o=i?u:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>S(()=>w(o)));d=o,p=null;try{return C(s,!0)}finally{p=n,d=r}}function v(e,t){t=t?Object.assign({},a,t):a;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[ce.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),le(n,e))]}function y(e,t,n){ue(fe(e,t,!1,c))}function b(e,t,n){s=ge;let r=fe(e,t,!1,c),i=se&&ae(se);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),h?h.push(r):ue(r)}function x(e,t,n){n=n?Object.assign({},a,n):a;let r=fe(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,ue(r),ce.bind(r)}function S(e){if(p===null)return e();let t=p;p=null;try{return e()}finally{p=t}}function ee(e){return d===null||(d.cleanups===null?d.cleanups=[e]:d.cleanups.push(e)),e}function te(){return d}var[ne,re]=v(!1);function ie(e,t){let n=Symbol(`context`);return{id:n,Provider:we(n),defaultValue:e}}function ae(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}function oe(e){let t=x(e),n=x(()=>Ce(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var se;function ce(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===c)ue(this);else{let e=m;m=null,C(()=>_e(this),!1),m=e}if(p){let e=this.observers;if(!e||e[e.length-1]!==p){let t=e?e.length:0;p.sources?(p.sources.push(this),p.sourceSlots.push(t)):(p.sources=[this],p.sourceSlots=[t]),e?(e.push(p),this.observerSlots.push(p.sources.length-1)):(this.observers=[p],this.observerSlots=[p.sources.length-1])}}return e&&f.sources.has(this)?this.tValue:this.value}function le(e,t,n){let r=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(f){let r=f.running;(r||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&C(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=f&&f.running;r&&f.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?m.push(n):h.push(n),n.observers&&ve(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function ue(e){if(!e.fn)return;w(e);let t=g;de(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{C(()=>{f&&(f.running=!0),p=d=e,de(e,e.tValue,t),p=d=null},!1)})}function de(e,t,n){let r,i=d,a=p;p=d=e;try{r=e.fn(t)}catch(t){return e.pure&&(f&&f.running?(e.tState=c,e.tOwned&&e.tOwned.forEach(w),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(w),e.owned=null)),e.updatedAt=n+1,Se(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?le(e,r,!0):f&&f.running&&e.pure?(f.sources.has(e)||(e.value=r),f.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function fe(e,t,n,r=c,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:d,context:d?d.context:null,pure:n};return f&&f.running&&(a.state=0,a.tState=r),d===null||d!==u&&(f&&f.running&&d.pure?d.tOwned?d.tOwned.push(a):d.tOwned=[a]:d.owned?d.owned.push(a):d.owned=[a]),a}function pe(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===l)return _e(e);if(e.suspense&&S(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<g);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(f.disposed.has(t))return}if((t?e.tState:e.state)===c)ue(e);else if((t?e.tState:e.state)===l){let t=m;m=null,C(()=>_e(e,n[0]),!1),m=t}}}function C(e,t){if(m)return e();let n=!1;t||(m=[]),h?n=!0:h=[],g++;try{let t=e();return me(n),t}catch(e){n||(h=null),m=null,Se(e)}}function me(e){if(m&&=(he(m),null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let e=f.sources,n=f.disposed;h.push.apply(h,f.effects),t=f.resolve;for(let e of h)`tState`in e&&(e.state=e.tState),delete e.tState;f=null,C(()=>{for(let e of n)w(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)w(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}re(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,h),h=null,re(!0);return}}let n=h;h=null,n.length&&C(()=>s(n),!1),t&&t()}function he(e){for(let t=0;t<e.length;t++)pe(e[t])}function ge(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:pe(e)}if(e.context){if(e.count){e.effects||=[],e.effects.push(...t.slice(0,i));return}n()}for(e.effects&&(e.done||!e.count)&&(t=[...e.effects,...t],i+=e.effects.length,delete e.effects),r=0;r<i;r++)pe(t[r])}function _e(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===c?i!==t&&(!i.updatedAt||i.updatedAt<g)&&pe(i):e===l&&_e(i,t)}}}function ve(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=l:r.state=l,r.pure?m.push(r):h.push(r),r.observers&&ve(r))}}function w(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)w(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)ye(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)w(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function ye(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)ye(e.owned[t])}function be(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function xe(e,t,n){try{for(let n of t)n(e)}catch(e){Se(e,n&&n.owner||null)}}function Se(e,t=d){let n=o&&t&&t.context&&t.context[o],r=be(e);if(!n)throw r;h?h.push({fn(){xe(r,n,t)},state:c}):xe(r,n,t)}function Ce(e){if(typeof e==`function`&&!e.length)return Ce(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Ce(e[n]);if(Array.isArray(r))if(r.length<32768)t.push.apply(t,r);else for(let e=0;e<r.length;e++)t.push(r[e]);else t.push(r)}return t}return e}function we(e,t){return function(t){let n;return y(()=>n=S(()=>(d.context={...d.context,[e]:t.value},oe(()=>t.children))),void 0),n}}var Te=Symbol(`fallback`);function Ee(e){for(let t=0;t<e.length;t++)e[t]()}function De(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return ee(()=>Ee(o)),()=>{let l=e()||[],u=l.length,d,f;return l[i],S(()=>{let e,t,i,m,h,g,v,y,b;if(u===0)s!==0&&(Ee(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[Te],a[0]=_(e=>(o[0]=e,n.fallback())),s=1);else if(s===0){for(a=Array(u),f=0;f<u;f++)r[f]=l[f],a[f]=_(p);s=u}else{for(i=Array(u),m=Array(u),c&&(h=Array(u)),g=0,v=Math.min(s,u);g<v&&r[g]===l[g];g++);for(v=s-1,y=u-1;v>=g&&y>=g&&r[v]===l[y];v--,y--)i[y]=a[v],m[y]=o[v],c&&(h[y]=c[v]);for(e=new Map,t=Array(y+1),f=y;f>=g;f--)b=l[f],d=e.get(b),t[f]=d===void 0?-1:d,e.set(b,f);for(d=g;d<=v;d++)b=r[d],f=e.get(b),f!==void 0&&f!==-1?(i[f]=a[d],m[f]=o[d],c&&(h[f]=c[d]),f=t[f],e.set(b,f)):o[d]();for(f=g;f<u;f++)f in i?(a[f]=i[f],o[f]=m[f],c&&(c[f]=h[f],c[f](f))):a[f]=_(p);a=a.slice(0,s=u),r=l.slice(0)}return a});function p(e){if(o[f]=e,c){let[e,n]=v(f);return c[f]=n,t(l[f],e)}return t(l[f])}}}function T(e,t){return S(()=>e(t||{}))}var Oe=e=>`Stale read from <${e}>.`;function ke(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return x(De(()=>e.each,e.children,t||void 0))}function Ae(e){let t=e.keyed,n=x(()=>e.when,void 0,void 0),r=t?n:x(n,void 0,{equals:(e,t)=>!e==!t});return x(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?S(()=>a(t?i:()=>{if(!S(r))throw Oe(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var je=e=>x(()=>e());function Me(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}var Ne=`_$DX_DELEGATE`;function Pe(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():D(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function E(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>S(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function Fe(e,t=window.document){let n=t[Ne]||(t[Ne]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,ze))}}function Ie(e,t,n){Re(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Le(e,t){Re(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function D(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Be(e,t,r,n);y(r=>Be(e,t(),r,n),r)}function Re(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function ze(t){if(e.registry&&e.events&&e.events.find(([e,n])=>n===t))return;let n=t.target,r=`$$${t.type}`,i=t.target,a=t.currentTarget,o=e=>Object.defineProperty(t,"target",{configurable:!0,value:e}),s=()=>{let e=n[r];if(e&&!n.disabled){let i=n[`${r}Data`];if(i===void 0?e.call(n,t):e.call(n,i,t),t.cancelBubble)return}return n.host&&typeof n.host!=`string`&&!n.host._$host&&n.contains(t.target)&&o(n.host),!0},c=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};if(Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}}),e.registry&&!e.done&&(e.done=_$HY.done=!0),t.composedPath){let e=t.composedPath();o(e[0]);for(let t=0;t<e.length-2&&(n=e[t],s());t++){if(n._$host){n=n._$host,c();break}if(n.parentNode===a)break}}else c();o(i)}function Be(e,t,n,r,i){let a=Re(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=O(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=O(e,n,r)}else if(o===`function`)return y(()=>{let i=t();for(;typeof i==`function`;)i=i();n=Be(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(Ve(o,t,n,i))return y(()=>n=Be(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=O(e,n,r),s)return n}else c?n.length===0?He(e,o,r):Me(e,n,o):(n&&O(e),He(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=O(e,n,r,t);O(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function Ve(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=Ve(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=Ve(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function He(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function O(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}function k(e){return JSON.parse(e)}var A=e=>JSON.stringify(e);Array.prototype,Boolean.prototype,Number.prototype,String.prototype;var j=class{Subscriber;subscribers=new Map;subscribe(e,t){return this.subscribers.set(e,t),()=>{this.unsubscribe(e)}}unsubscribe(e){this.subscribers.delete(e)}next(e){let t=this.subscribers.values();for(let n of t)n(e)}},Ue=class extends j{state;constructor(e){super(),this.state=e}next(e){this.state=e,super.next(e)}},We=``,Ge=``,Ke=``,qe=``;function M(e){if(e===null)return Ge;switch(typeof e){case`string`:return Ke+e;case`number`:return qe+e;case`boolean`:return We+ +e;case`object`:return JSON.stringify(e)}}function N(e){switch(e[0]){case Ke:return e.slice(1);case qe:return+e.slice(1);case We:return e.slice(1)===`1`;case Ge:return null;case`[`:return JSON.parse(e)}}function Je(e){let t={},n=0;for(let r of e)t[r]=n,t[n]=r,++n;return t}var Ye=Je([`add`,`delete`,`clear`]),Xe=class e extends Set{mode=`record`;subject=new j;constructor(t){super(t),t instanceof e}READONLY_VIEW=this;toJSON(){return[...this]}static fromJSON(t){return new e(t)}add(e){let t=super.add(e);return this.mode===`record`&&this.emit({type:`add`,value:e}),t}clear(){let e=this.mode===`record`?[...this]:null;super.clear(),e&&this.emit({type:`clear`,values:e})}delete(e){let t=super.delete(e);return this.mode===`record`&&this.emit({type:`delete`,value:e}),t}subscribe(e,t){return this.subject.subscribe(e,t)}emit(t){this.subject.next(e.packUpdate(t))}do(t){this.mode=`playback`;let n=e.unpackUpdate(t);switch(n.type){case`add`:this.add(n.value);break;case`delete`:this.delete(n.value);break;case`clear`:this.clear()}return this.mode=`record`,null}undo(t){let n=e.unpackUpdate(t);switch(this.mode=`playback`,n.type){case`add`:this.delete(n.value);break;case`delete`:this.add(n.value);break;case`clear`:{let e=n.values;for(let t of e)this.add(t)}}return this.mode=`record`,null}static packUpdate(e){let t=Ye[e.type]+``;return e.type===`clear`?t+e.values.map(M).join(``):t+M(e.value)}static unpackUpdate(e){let[t,n]=e.split(``),r=Ye[t];return r===`clear`?{type:`clear`,values:n.split(``).map(N)}:{type:r,value:N(n)}}},P=class extends Map{deleted=new Set;changed=new Set;source;appendedSource=new Set;sourceCleared=!1;constructor(e){super(),this.source=e}get(e){if(super.has(e))return super.get(e);if(!this.deleted.has(e)&&this.source.has(e))return this.source.get(e)}getOrInsert(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)}getOrInsertComputed(e,t){if(this.has(e))return this.get(e);let n=t(e);return this.set(e,n),n}set(e,t){let n=this.appendedSource.has(e)||this.sourceCleared&&this.deleted.has(e);return this.source.has(e)&&n?(this.deleted.delete(e),this.changed.delete(e),this.appendedSource.add(e)):this.source.has(e)&&(this.deleted.delete(e),this.appendedSource.delete(e),this.changed.add(e)),super.set(e,t)}hasOwn(e){return super.has(e)}has(e){return super.has(e)?!0:!this.deleted.has(e)&&this.source.has(e)}delete(e){return this.source.has(e)?(this.deleted.add(e),this.changed.delete(e),this.appendedSource.delete(e),super.delete(e),!0):super.delete(e)}clear(){this.deleted=new Set(this.source.keys()),this.appendedSource.clear(),this.changed.clear(),this.sourceCleared=!0,super.clear()}*[Symbol.iterator](){for(let[e,t]of this.source)this.deleted.has(e)||this.appendedSource.has(e)||(this.changed.has(e)?yield[e,super.get(e)]:yield[e,t]);for(let e of super[Symbol.iterator]())this.changed.has(e[0])||(yield e)}*entries(){yield*this[Symbol.iterator]()}*keys(){for(let e of this.source.keys())!this.deleted.has(e)&&!this.appendedSource.has(e)&&(yield e);for(let e of super.keys())this.changed.has(e)||(yield e)}*values(){for(let[,e]of this[Symbol.iterator]())yield e}forEach(e,t){for(let[n,r]of this[Symbol.iterator]())e.call(t,r,n,this)}get size(){return super.size+this.source.size-this.changed.size-this.deleted.size-this.appendedSource.size}};function*F(e){let t=e.keys();for(let e=t.next();!e.done;e=t.next())yield e.value}var Ze=class extends Set{deleted=new Set;source;appendedSource=new Set;sourceCleared=!1;constructor(e){super(),this.source=e}add(e){let t=this.appendedSource.has(e)||this.sourceCleared&&this.deleted.has(e);return this.source.has(e)&&t?(this.deleted.delete(e),this.appendedSource.add(e),super.add(e)):this.source.has(e)?(this.deleted.delete(e),this.appendedSource.delete(e),this):super.add(e)}hasOwn(e){return super.has(e)}has(e){return super.has(e)||!this.deleted.has(e)&&this.source.has(e)}delete(e){return this.source.has(e)?(this.deleted.add(e),this.appendedSource.delete(e),super.delete(e),!0):super.delete(e)}clear(){this.deleted=new Set(this.source),this.appendedSource.clear(),this.sourceCleared=!0,super.clear()}*[Symbol.iterator](){for(let e of this.source)!this.deleted.has(e)&&!this.appendedSource.has(e)&&(yield e);yield*super[Symbol.iterator]()}*keys(){yield*this[Symbol.iterator]()}*values(){yield*this[Symbol.iterator]()}*entries(){for(let e of this[Symbol.iterator]())yield[e,e]}forEach(e,t){for(let n of this[Symbol.iterator]())e.call(t,n,n,this)}union(e){let t=new Set(this);for(let n of F(e))t.add(n);return t}intersection(e){let t=new Set,n=e,r=this;if(this.size<=e.size)for(let e of this)n.has(e)&&t.add(e);else for(let n of F(e))r.has(n)&&t.add(n);return t}difference(e){let t=new Set,n=e;if(this.size<=e.size)for(let e of this)n.has(e)||t.add(e);else{for(let e of this)t.add(e);for(let n of F(e))t.delete(n)}return t}symmetricDifference(e){let t=new Set(this);for(let n of F(e))t.has(n)?t.delete(n):t.add(n);return t}isSubsetOf(e){if(this.size>e.size)return!1;for(let t of this)if(!e.has(t))return!1;return!0}isSupersetOf(e){if(this.size<e.size)return!1;for(let t of F(e))if(!this.has(t))return!1;return!0}isDisjointFrom(e){if(this.size<=e.size){for(let t of this)if(e.has(t))return!1}else for(let t of F(e))if(this.has(t))return!1;return!0}*iterateOwn(){yield*super[Symbol.iterator]()}get size(){return super.size+this.source.size-this.deleted.size-this.appendedSource.size}},Qe=class extends Promise{fate;resolve;reject;done=!1;constructor(e){let t,n;super((e,r)=>{t=e,n=r}),this.resolve=t,this.reject=n,this.use(e instanceof Promise?e:new Promise(e))}pass(e,t){e===this.fate&&(this.resolve(t),this.done=!0)}fail(e,t){e===this.fate&&(this.reject(t),this.done=!0)}use(e){if(this!==e)if(e instanceof Promise){let t=e;this.fate=t,t.then(e=>{this.pass(t,e)},e=>{this.fail(t,e)})}else this.resolve(e),this.fate=void 0}};function $e(e){return rr(G.STORE,e,void 0)}function et(e){return qn(G.STORE,e,void 0)}function tt(e){return on(G.STORE,e)}function nt(e,t){return Y(G.STORE,e,t)}function rt(...e){return J(G.STORE,...e)}var I={atom_family:`atom family`,atom:`atom`,continuity:`continuity`,key:`key`,mutable_atom_family:`atom family [m]`,mutable_atom:`atom [m]`,readonly_held_selector_family:`selector family [h]`,readonly_held_selector:`selector [h]`,readonly_pure_selector_family:`selector family`,readonly_pure_selector:`selector`,socket:`socket`,state:`state`,timeline:`timeline`,timeline_family:`timeline family`,transaction:`transaction`,unknown:`unknown`,user:`👤`,writable_held_selector_family:`selector family [wh]`,writable_held_selector:`selector [wh]`,writable_pure_selector_family:`selector family [w]`,writable_pure_selector:`selector [w]`},it=(e,t)=>(n,r,i,a,...o)=>{console[e](`${t?`${t} `:``}${n} ${I[r]} \`${i}\` ${a}`,...o)},at={error:it(`error`),info:it(`info`),warn:it(`warn`)},ot=class{logLevel;filter;logger;constructor(e,t,n=at){this.logLevel=e,this.filter=t,this.logger=n}error=(...e)=>{if(this.logLevel!==null){let t=this.filter?.(...e)??!0;t===!0?this.logger.error(...e):t&&this.logger.error(...t)}};info=(...e)=>{if(this.logLevel===`info`){let t=this.filter?.(...e)??!0;t===!0?this.logger.info(...e):t&&this.logger.info(...t)}};warn=(...e)=>{if(this.logLevel!==`error`&&this.logLevel!==null){let t=this.filter?.(...e)??!0;t===!0?this.logger.warn(...e):t&&this.logger.warn(...t)}}},st=class extends Error{constructor(e,t){super(`${I[e.type]} ${A(e.key)} not found in store "${t}".`)}};function ct(...e){Sn(G.STORE,...e)}function lt(e){return un(G.STORE,e)}function ut(...e){X(G.STORE,...e)}function dt(e){return $t(G.STORE,e)}function ft(e,t=mt()){return xt(G.STORE,e,t)}var pt=class extends Map{deleted=new Set;source;constructor(e){super(),this.source=e}get(e){if(super.has(e))return super.get(e);if(!this.deleted.has(e)&&this.source.has(e)){let t=new Ze(this.source.get(e));return super.set(e,t),t}}set(e,t){return this.deleted.delete(e),super.set(e,t)}has(e){return!this.deleted.has(e)&&(super.has(e)||this.source.has(e))}delete(e){return this.deleted.add(e),super.delete(e)}},L=class e{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(e,t)=>`${e}:${t}`;warn;getRelatedKeys(e){return this.relations.get(e)}addRelation(e,t){let n=this.relations.get(e),r=this.relations.get(t);n?n.add(t):(n=new Set([t]),this.relations.set(e,n)),r?r.add(e):(r=new Set([e]),this.relations.set(t,r))}deleteRelation(e,t){let n=this.relations.get(e);if(n){n.delete(t),n.size===0&&this.relations.delete(e);let r=this.relations.get(t);r&&(r.delete(e),r.size===0&&this.relations.delete(t))}}replaceRelationsUnsafely(e,t){this.relations.set(e,new Set(t));for(let n of t){let t=new Set().add(e);this.relations.set(n,t)}}replaceRelationsSafely(e,t){let n=this.relations.get(e),r=this.isAType?.(e)?e:void 0,i=r===void 0?e:void 0;if(n)for(let t of n){r??=t,i??=t;let n=this.relations.get(t);n&&(n.size===1?this.relations.delete(t):n.delete(e),this.contents.delete(this.makeContentKey(r,i)))}this.relations.set(e,new Set(t));for(let n of t){let t=this.relations.get(n);t?t.add(e):(t=new Set().add(e),this.relations.set(n,t))}}getContentInternal(e){return this.contents.get(e)}setContent(e,t){this.contents.set(e,t)}deleteContent(e){this.contents.delete(e)}constructor(e,t){if(this.a=e.between[0],this.b=e.between[1],this.cardinality=e.cardinality,this.isAType=t?.isAType??null,this.isBType=t?.isBType??null,this.isContent=t?.isContent??null,t?.makeContentKey&&(this.makeContentKey=t.makeContentKey),!t?.externalStore){let n=t?.source;n===void 0&&(this.relations=new Map(e.relations?.map(([e,t])=>[e,new Set(t)])),this.contents=new Map(e.contents)),n&&(this.relations=new pt(n.relations),this.contents=new P(n.contents))}if(t?.externalStore){let n=t.externalStore;this.has=(e,t)=>n.has(e,t),this.addRelation=(e,t)=>{n.addRelation(e,t)},this.deleteRelation=(e,t)=>{n.deleteRelation(e,t)},this.replaceRelationsSafely=(e,t)=>{n.replaceRelationsSafely(e,t)},this.replaceRelationsUnsafely=(e,t)=>{n.replaceRelationsUnsafely(e,t)},this.getRelatedKeys=(e=>n.getRelatedKeys(e)),n.getContent&&(this.getContentInternal=e=>n.getContent(e),this.setContent=(e,t)=>{n.setContent(e,t)},this.deleteContent=e=>{n.deleteContent(e)});for(let[t,n]of e.relations??[]){let e=this.isAType?.(t)?t:void 0,r=e===void 0?t:void 0;for(let t of n)e??=t,r??=t,this.addRelation(e,r)}for(let[t,n]of e.contents??[])this.setContent(t,n)}t?.warn&&(this.warn=t.warn)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([e,t])=>[e,[...t]]),contents:[...this.contents.entries()]}}set(...e){let t,n,r;switch(e.length){case 1:{let i=e[0];t=i[this.a],n=i[this.b],r=void 0;break}case 2:{let i=e[0];typeof i==`string`?[t,n]=e:(t=i[this.a],n=i[this.b],r=e[1]);break}default:t=e[0],n=e[1],r=e[2];break}switch(this.cardinality){case`1:1`:{let e=this.getRelatedKey(t);e&&e!==n&&this.delete(t,e)}case`1:n`:{let e=this.getRelatedKey(n);e&&e!==t&&this.delete(e,n)}break;case`n:n`:}if(r){let e=this.makeContentKey(t,n);this.setContent(e,r)}return this.addRelation(t,n),this}delete(e,t){t=typeof t==`string`?t:e[this.b];let n=typeof e==`string`?e:e[this.a];if(n===void 0&&typeof t==`string`){let e=this.getRelatedKeys(t);if(e)for(let n of e)this.delete(n,t)}else if(typeof n==`string`&&t===void 0){let e=this.getRelatedKeys(n);if(e)for(let t of e)this.delete(n,t)}else if(typeof n==`string`&&typeof t==`string`){this.deleteRelation(n,t);let e=this.makeContentKey(n,t);this.deleteContent(e)}return this}getRelatedKey(e){let t=this.getRelatedKeys(e);if(t){t.size>1&&this.warn?.(`${t.size} related keys were found for key "${e}": (${[...t].map(e=>`"${e}"`).join(`, `)}). Only one related key was expected.`);let n;for(let e of t){n=e;break}return n}}replaceRelations(e,t,n){let r=!Array.isArray(t),i=r?Object.keys(t):t;if(n?.reckless?this.replaceRelationsUnsafely(e,i):this.replaceRelationsSafely(e,i),r)for(let n of i){let r=this.makeContentKey(e,n),i=t[n];this.setContent(r,i)}return this}getContent(e,t){let n=this.makeContentKey(e,t);return this.getContentInternal(n)}getRelationEntries(e){let t=e[this.a],n=e[this.b];if(t!==void 0&&n===void 0){let e=this.getRelatedKeys(t);if(e)return[...e].map(e=>[e,this.getContent(t,e)])}if(t===void 0&&n!==void 0){let e=this.getRelatedKeys(n);if(e)return[...e].map(e=>[e,this.getContent(e,n)])}return[]}has(e,t){return t?this.getRelatedKeys(e)?.has(t)??!1:this.relations.has(e)}overlay(){let t={source:this,makeContentKey:this.makeContentKey};return this.isAType&&(t.isAType=this.isAType),this.isBType&&(t.isBType=this.isBType),this.isContent&&(t.isContent=this.isContent),this.warn&&(t.warn=this.warn),new e({between:[this.a,this.b],cardinality:this.cardinality},t)}incorporate(e){let{relations:t,contents:n}=e;for(let[e,n]of t)if(n instanceof Ze){let{source:e}=n;for(let t of n.iterateOwn())e.add(t)}else this.relations.set(e,n);for(let e of t.deleted)this.relations.delete(e);for(let[e,t]of n)this.contents.set(e,t);for(let e of n.deleted)this.contents.delete(e)}};function mt(e=Math.random){return e().toString(36).slice(2)}function R(e){let t=e;for(;t.child!==null;)t=t.child;return t}function ht(e){let t=e;for(;t.parent!==null;)t=t.parent;return t}var gt=/^\[object (?:Async|Generator|AsyncGenerator)?Function\]$/;function z(e){let t=Object.prototype.toString.call(e);return gt.test(t)}function _t(e,t){return z(e)?e(t):e}var vt=class e{_buffer;_index=0;constructor(e){let t;t=typeof e==`number`?e:e.length,this._buffer=Array.from({length:t})}get buffer(){return this._buffer}get index(){return this._index}add(e){this._buffer[this._index]=e,this._index=(this._index+1)%this._buffer.length}copy(){let t=new e([...this._buffer]);return t._index=this._index,t}};function B(e){let t={key:e.key,type:e.type};return`family`in e&&(t.family=e.family),t}function yt(e){return e.startsWith(`🔍 `)}function bt(e){e.logger.info(`🪂`,`transaction`,e.transactionMeta.update.token.key,`Aborting transaction`),e.parent.child=null}function xt(e,t,n){return(...r)=>K(e,t).run(r,n)}function St(e,t,n){let{token:r,update:{newValue:i,oldValue:a}}=t;X(e,r,n===`newValue`?i:a)}function Ct(e,t){return K(e,{key:t.family.key,type:`${t.type}_family`})}var wt={atom_family:`atom`,molecule_family:`molecule`,mutable_atom_family:`mutable_atom`,readonly_held_selector_family:`readonly_held_selector`,readonly_pure_selector_family:`readonly_pure_selector`,writable_held_selector_family:`writable_held_selector`,writable_pure_selector_family:`writable_pure_selector`},Tt=Symbol(`MUST_CREATE`),Et=Symbol(`DO_NOT_CREATE`);function Dt(e,t,n,r){let i=A(r),a=t.molecules.get(i);if(!a&&t.config.lifespan===`immortal`){let{type:e,key:r}=n;return t.logger.warn(`💣`,`key`,i,`was used to mint a counterfeit token for`,e,`"${r}"`),{counterfeit:!0,key:`${r}(${i})`,type:wt[e],family:{key:r,subKey:i}}}let o;if(e===Tt)t.logger.info(`👪`,n.type,n.key,`adds member`,typeof r==`string`?`\`${r}\``:r),o=n.create(r),a&&t.moleculeData.set(i,n.key);else{let{type:e,key:t}=n;return{key:`${t}(${i})`,type:wt[e],family:{key:t,subKey:i}}}return o}function Ot(e,...t){let n,r,i,a,o;if(t.length===1){if(o=t[0],`family`in o){let t=Ct(e,o);if(i=K(e,t),a=k(o.family.subKey),n=rn(e,t,a),`counterfeit`in o)return{token:o,family:i,subKey:a};n?o=n:(r=Dt(Tt,e,t,a),o=r)}}else i=K(e,t[0]),a=t[1],n=rn(e,i,a),n?o=n:(r=Dt(Tt,e,i,a),o=r);let s=`counterfeit`in o;if(r&&s===!1&&i){switch(o.type){case`readonly_pure_selector`:case`readonly_held_selector`:break;case`atom`:case`mutable_atom`:case`writable_pure_selector`:case`writable_held_selector`:break}let t={type:`atom_creation`,token:o,timestamp:Date.now()};`subject`in i&&i.subject.next(t);let n=R(e);if(o.family)if(Ht(n))switch(o.type){case`atom`:case`mutable_atom`:e.on.atomCreation.next(o);break;case`writable_pure_selector`:case`readonly_pure_selector`:case`writable_held_selector`:case`readonly_held_selector`:e.on.selectorCreation.next(o);break}else`subject`in i&&V(n)&&n.on.transactionApplying.state===null&&n.transactionMeta.update.subEvents.push(t)}return{token:o,family:i,subKey:a}}function kt(e){let{stack:t}=e;return t?`
|
|
2
|
-
`+t.split(`
|
|
3
|
-
`)?.slice(1)?.join(`
|
|
4
|
-
`):``}function At(e,t){return[e,t].sort().join(``)}function jt(e){if(typeof e!=`string`)return null;let[t,n]=e.split(`==`);if(!n)return null;let r=t.slice(4),[i,a]=n.split(`++`);return r&&i&&a?[r,i,a]:null}function Mt(e,t,n,r=`any`){let i=t,a=A(n),o=[],s=R(e);if(Array.isArray(i))for(let t of i){let n=A(t);s.molecules.get(n)?e.moleculeGraph.set(n,a,{source:n}):o.push(n)}else{let t=A(i);s.molecules.get(t)?e.moleculeGraph.set(t,a,{source:t}):o.push(t)}let c=new j;o.length===0&&s.molecules.set(a,{key:n,stringKey:a,dependsOn:r,subject:c});let l={type:`molecule_creation`,key:n,provenance:i,timestamp:Date.now()};V(s)&&s.transactionMeta.phase===`building`?s.transactionMeta.update.subEvents.push(l):s.on.moleculeCreation.next(l);for(let t of o){let r=e.disposalTraces.buffer.find(e=>e?.key===t);e.logger.error(`❌`,`key`,n,`allocation failed:`,`Could not allocate to ${t} in store "${e.config.name}".`,r?`\n ${t} was most recently disposed\n${r.trace}`:`No previous disposal trace for ${t} was found.`)}return n}function Nt(e,t){let n=A(t),r=e.molecules.get(n);if(!r){let r=e.disposalTraces.buffer.find(e=>e?.key===n);e.logger.error(`❌`,`key`,t,`deallocation failed:`,`Could not find allocation for ${n} in store "${e.config.name}".`,r?`\n This state was most recently deallocated\n${r.trace}`:`No previous disposal trace for ${n} was found.`);return}r.subject.next();let i=e.keyRefsInJoins.getRelatedKeys(n);if(i)for(let n of i){let r=e.joins.get(n);r&&r.relations.delete(t)}else{let n=jt(t);if(n){let[,t,r]=n,i=e.keyRefsInJoins.getRelatedKey(At(t,r));if(i){let n=e.joins.get(i);n&&n.relations.delete(t,r)}}}e.keyRefsInJoins.delete(n);let a=[],o=[],s=e.moleculeGraph.getRelationEntries({downstreamMoleculeKey:n});if(s)for(let[t,{source:r}]of s)r===n?Nt(e,k(t)):a.push(r);let c=e.moleculeData.getRelatedKeys(r.stringKey);if(c)for(let n of c){let r=e.families.get(n),i=J(e,r,t);o.push([r.key,i]),dn(e,r,t)}let l={type:`molecule_disposal`,key:r.key,values:o,provenance:a,timestamp:Date.now()};e.molecules.delete(n);let u=V(e)&&e.transactionMeta.phase===`building`;u&&e.transactionMeta.update.subEvents.push(l),e.moleculeGraph.delete(r.stringKey),e.keyRefsInJoins.delete(r.stringKey),e.moleculeData.delete(r.stringKey),u||e.on.moleculeDisposal.next(l),e.molecules.delete(r.stringKey);let d=kt(Error());e.disposalTraces.add({key:n,trace:d})}function Pt(e,t,n,r){let i=A(n),a=R(e),o=a.molecules.get(i);if(!o){let t=e.disposalTraces.buffer.find(e=>e?.key===i);return e.logger.error(`❌`,`key`,i,`claim failed:`,`Could not allocate to ${i} in store "${e.config.name}".`,t?`\n ${i} was most recently disposed\n${t.trace}`:`No previous disposal trace for ${i} was found.`),n}let s=A(t),c=a.molecules.get(s);if(!c){let t=e.disposalTraces.buffer.find(e=>e?.key===s);return e.logger.error(`❌`,`key`,n,`claim failed:`,`Could not allocate to ${s} in store "${e.config.name}".`,t?`\n ${s} was most recently disposed\n${t.trace}`:`No previous disposal trace for ${s} was found.`),n}let l=e.moleculeGraph.getRelationEntries({downstreamMoleculeKey:o.stringKey}).filter(([,{source:e}])=>e!==i).map(([e])=>k(e));r&&a.moleculeGraph.delete(i),a.moleculeGraph.set({upstreamMoleculeKey:c.stringKey,downstreamMoleculeKey:o.stringKey},{source:c.stringKey});let u={type:`molecule_transfer`,key:o.key,exclusive:!!r,from:l,to:[c.key],timestamp:Date.now()};return V(a)&&a.transactionMeta.phase===`building`&&a.transactionMeta.update.subEvents.push(u),n}function Ft(e,t,n){switch(n){case`newValue`:Lt(e,t);break;case`oldValue`:dn(e,t.token);break}}function It(e,t,n){switch(n){case`newValue`:dn(e,t.token);break;case`oldValue`:Lt(e,t);break}}function Lt(e,t){let{token:n}=t;`value`in t?X(e,n,t.value):Ot(e,n)}function Rt(e,t,n){switch(n){case`newValue`:Mt(e,t.provenance,t.key);break;case`oldValue`:Nt(e,t.key);break}}function zt(e,t,n){switch(n){case`newValue`:Nt(e,t.key);break;case`oldValue`:Mt(e,t.provenance.map(k),t.key);for(let[n,r]of t.values){let i=e.families.get(n);if(i){J(e,i,t.key);let a=`${n}(${A(t.key)})`;e.valueMap.set(a,r)}}break}}function Bt(e,t,n){switch(n){case`newValue`:for(let n of t.to)Pt(e,n,t.key,t.exclusive?`exclusive`:void 0);break;case`oldValue`:{let n=`exclusive`;for(let r of t.from)Pt(e,r,t.key,n),n=void 0}break}}function Vt(e,t,n){let r=n===`newValue`?t.subEvents:[...t.subEvents].reverse();for(let t of r)switch(t.type){case`atom_update`:St(e,t,n);break;case`atom_creation`:Ft(e,t,n);break;case`atom_disposal`:It(e,t,n);break;case`molecule_creation`:Rt(e,t,n);break;case`molecule_disposal`:zt(e,t,n);break;case`molecule_transfer`:Bt(e,t,n);break;case`transaction_outcome`:Vt(e,t,n);break}}function Ht(e){return`epoch`in e.transactionMeta}function V(e){return`phase`in e.transactionMeta}function Ut(e,t){return e.transactionMeta.actionContinuities.getRelatedKey(t)}function Wt(e,t){return e.transactionMeta.epoch.get(t)}function Gt(e,t){let n=Ut(e,t);if(n!==void 0)return Wt(e,n)}function Kt(e,t,n){let r=Ut(e,t);r!==void 0&&e.transactionMeta.epoch.set(r,n)}function qt(e,t){let n=R(e),{parent:r}=n;n.transactionMeta.phase=`applying`,n.transactionMeta.update.output=t,r.child=null,r.on.transactionApplying.next(n.transactionMeta);let{subEvents:i}=n.transactionMeta.update;e.logger.info(`🛄`,`transaction`,n.transactionMeta.update.token.key,`applying ${i.length} subEvents:`,i),Vt(r,n.transactionMeta.update,`newValue`),Ht(r)?(Kt(r,n.transactionMeta.update.token.key,n.transactionMeta.update.epoch),K(e,{key:n.transactionMeta.update.token.key,type:`transaction`})?.subject.next(n.transactionMeta.update),e.logger.info(`🛬`,`transaction`,n.transactionMeta.update.token.key,`applied`)):V(r)&&r.transactionMeta.update.subEvents.push(n.transactionMeta.update),r.on.transactionApplying.next(null)}function Jt(e){return{store:e}}function H(e){return e[0].toUpperCase()+e.slice(1)}function Yt(e,t){let n=e.joins.get(t.key);if(n===void 0){let r=G.STORE.joins.get(t.key);if(r===void 0)throw Error(`Join "${t.key}" not found in store "${e.config.name}"`);n=new Zt(ht(e),r.options),e.joins.set(t.key,n)}return n}function Xt(e,t,n){let r=Yt(e,t),i=R(e);if(V(i)){let{toolkit:e}=i.transactionMeta;r.transact(e,({relations:e})=>{n(e)})}else n(r.relations)}function U(e,t,n){let r=Yt(e,t),i;switch(t.cardinality){case`1:1`:{let a=`${t.a}KeyOf${H(t.b)}`,o=`${t.b}KeyOf${H(t.a)}`;i={get[a](){let t=r.states[a];return Y(e,t,n)},get[o](){let t=r.states[o];return Y(e,t,n)}};break}case`1:n`:{let a=`${t.a}KeyOf${H(t.b)}`,o=`${t.b}KeysOf${H(t.a)}`;i={get[a](){let t=r.states[a];return Y(e,t,n)},get[o](){let t=r.states[o];return Y(e,t,n)}};break}case`n:n`:{let a=`${t.a}KeysOf${H(t.b)}`,o=`${t.b}KeysOf${H(t.a)}`;i={get[a](){let t=r.states[a];return Y(e,t,n)},get[o](){let t=r.states[o];return Y(e,t,n)}}}}return i}function W(e,t,n){let r=Yt(e,t);return n===`split`?[r.relatedKeysAtoms,r.relatedKeysAtoms]:r.relatedKeysAtoms}var Zt=class{toolkit;options;relations;states;relatedKeysAtoms;transact(e,t){let n=this.toolkit;this.toolkit=e,t(this),this.toolkit=n}store;[Symbol.dispose](){}constructor(e,t){this.store=e,this.options=t,this.store.miscResources.set(`join:${t.key}`,this),this.toolkit={get:((...t)=>J(e,...t)),set:((...t)=>{X(e,...t)}),find:((...t)=>Y(e,...t)),json:t=>Z(e,t),relations:{edit:((...t)=>{Xt(e,...t)}),find:((...t)=>U(e,...t)),internal:((...t)=>W(e,...t))}};let n=t.between[0],r=t.between[1],i=Yn(e,{key:`${t.key}/relatedKeys`,class:Xe},[`join`,`relations`]);this.relatedKeysAtoms=i;let a=(t,n,r)=>{let{find:a,get:o,set:s}=t,c=a(i,n),l=o(c);for(let e of l)r.includes(e)||s(i,e,e=>(e.delete(n),e));s(c,t=>{t.clear();for(let c of r){let r=a(i,c),l=o(r),u=l.has(n);if(this.relations.cardinality===`1:n`){let t=[];for(let e of l){if(e===n)continue;let r;Dn(En,this.store,i,e,e=>(e.delete(c),r=e.size,e)),r===0&&t.push(e)}!u&&l.size>0&&s(r,e=>(e.clear(),e));for(let n of t)e.keyRefsInJoins.delete(At(c,n))}u||s(r,e=>(e.add(n),e)),t.add(c)}return t})},o=(e,t,n)=>{let{set:r}=e;r(i,t,e=>{for(let t of n)e.add(t);return e});for(let e of n)r(i,e,e=>(e.add(t),e));return!0},s=new L(t,{externalStore:{getRelatedKeys:e=>this.toolkit.get(i,e),addRelation:(e,n)=>{this.store.keyRefsInJoins.set(`"${e}"`,t.key),this.store.keyRefsInJoins.set(`"${n}"`,t.key),this.store.keyRefsInJoins.set(At(e,n),t.key),this.toolkit.set(i,e,e=>e.add(n)),this.toolkit.set(i,n,t=>t.add(e))},deleteRelation:(e,t)=>{this.toolkit.set(i,e,e=>(e.delete(t),e)),this.toolkit.set(i,t,t=>(t.delete(e),t));let n=At(e,t);this.store.keyRefsInJoins.delete(n)},replaceRelationsSafely:(e,t)=>{a(this.toolkit,e,t)},replaceRelationsUnsafely:(e,t)=>{o(this.toolkit,e,t)},has:(e,t)=>{let n=this.toolkit.get(i,e);return t?n.has(t):n.size>0}},isAType:t.isAType,isBType:t.isBType}),c=()=>an(e,{key:`${t.key}/singleRelatedKey`,get:e=>({get:t})=>{let n=t(i,e);for(let e of n)return e;return null}},[`join`,`keys`]),l=()=>an(e,{key:`${t.key}/multipleRelatedKeys`,get:t=>({get:n})=>n(Xn(i,e),t)},[`join`,`keys`]);switch(t.cardinality){case`1:1`:{let e=c(),t=`${n}KeyOf${H(r)}`,i=`${r}KeyOf${H(n)}`;this.relations=s,this.states={[t]:e,[i]:e};break}case`1:n`:{let e=c(),t=l(),i=`${n}KeyOf${H(r)}`,a=`${r}KeysOf${H(n)}`,o={[i]:e,[a]:t};this.relations=s,this.states=o;break}case`n:n`:{let e=l(),t=`${n}KeysOf${H(r)}`,i=`${r}KeysOf${H(n)}`;this.relations=s,this.states={[t]:e,[i]:e}}}}};function Qt(e,t,n,r){let i=R(e),a={parent:i,child:null,on:i.on,loggers:i.loggers,logger:i.logger,config:i.config,atoms:new P(i.atoms),atomsThatAreDefault:new Set(i.atomsThatAreDefault),families:new P(i.families),joins:new P(i.joins),operation:{open:!1},readonlySelectors:new P(i.readonlySelectors),timelineFamilies:new P(i.timelineFamilies),timelines:new P(i.timelines),timelineTopics:i.timelineTopics.overlay(),trackers:new Map,transactions:new P(i.transactions),selectorAtoms:i.selectorAtoms.overlay(),selectorGraph:i.selectorGraph.overlay(),writableSelectors:new P(i.writableSelectors),valueMap:new P(i.valueMap),defaults:i.defaults,disposalTraces:e.disposalTraces.copy(),molecules:new P(i.molecules),moleculeGraph:i.moleculeGraph.overlay(),moleculeData:i.moleculeData.overlay(),keyRefsInJoins:i.keyRefsInJoins.overlay(),miscResources:new P(i.miscResources)},o=Gt(e,t.key),s={phase:`building`,update:{type:`transaction_outcome`,token:t,id:r,epoch:o===void 0?NaN:o+1,timestamp:Date.now(),subEvents:[],params:n,output:void 0},toolkit:{get:((...e)=>J(c,...e)),set:((...e)=>{X(c,...e)}),reset:((...e)=>{Sn(c,...e)}),run:(e,t=mt())=>xt(c,e,t),find:((...t)=>Y(e,...t)),json:e=>Z(c,e),dispose:((...e)=>{dn(c,...e)}),env:()=>Jt(c),relations:{edit:((...e)=>{Xt(c,...e)}),find:((...e)=>U(c,...e)),internal:((...e)=>W(c,...e))}}},c=Object.assign(a,{transactionMeta:s});return i.child=c,e.logger.info(`🛫`,`transaction`,t.key,`building with params:`,n),c}function $t(e,t){let{key:n}=t,r=e.transactions.has(n),i={key:n,type:`transaction`,run:(r,a)=>{let o=Qt(e,B(i),r,a);try{let{toolkit:e}=o.transactionMeta,n=t.do(e,...r);return qt(o,n),n}catch(t){throw bt(o),e.logger.warn(`💥`,`transaction`,n,`caught:`,t),t}},install:e=>$t(e,t),subject:new j};R(e).transactions.set(n,i);let a=B(i);return r||e.on.transactionCreation.next(a),a}var en=class{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new L({between:[`selectorKey`,`atomKey`],cardinality:`n:n`});selectorGraph=new L({between:[`upstreamSelectorKey`,`downstreamSelectorKey`],cardinality:`n:n`},{makeContentKey:(...e)=>e.sort().join(`:`)});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new L({between:[`continuity`,`action`],cardinality:`1:n`})};timelines=new Map;timelineFamilies=new Map;timelineTopics=new L({between:[`timelineKey`,`topicKey`],cardinality:`1:n`});disposalTraces=new vt(100);molecules=new Map;moleculeGraph=new L({between:[`upstreamMoleculeKey`,`downstreamMoleculeKey`],cardinality:`n:n`},{makeContentKey:(...e)=>e.sort().join(`:`)});moleculeData=new L({between:[`moleculeKey`,`stateFamilyKey`],cardinality:`n:n`},{makeContentKey:(...e)=>e.sort().join(`:`)});keyRefsInJoins=new L({between:[`moleculeKey`,`joinKey`],cardinality:`n:n`},{makeContentKey:(...e)=>e.sort().join(`:`)});miscResources=new Map;on={atomCreation:new j,atomDisposal:new j,selectorCreation:new j,selectorDisposal:new j,timelineCreation:new j,timelineDisposal:new j,transactionCreation:new j,transactionApplying:new Ue(null),operationClose:new j,moleculeCreation:new j,moleculeDisposal:new j};operation={open:!1};config={name:`IMPLICIT_STORE`,lifespan:`ephemeral`,isProduction:!0};loggers=[new ot(`warn`,(e,t,n)=>!yt(n))];logger={error:(...e)=>{for(let t of this.loggers)t.error(...e)},info:(...e)=>{for(let t of this.loggers)t.info(...e)},warn:(...e)=>{for(let t of this.loggers)t.warn(...e)}};constructor(e,t=null){if(this.config={...t?.config,...e},t!==null){this.operation={...t?.operation},Ht(t)&&(this.transactionMeta={epoch:new Map(t?.transactionMeta.epoch),actionContinuities:new L(t?.transactionMeta.actionContinuities.toJSON())});for(let[,e]of t.families)e.internalRoles?.includes(`mutable`)||e.internalRoles?.includes(`join`)||e.install(this);let e=new Set;for(let[,n]of t.atoms)if(!e.has(n.key)&&(n.install(this),n.type===`mutable_atom`)){let r=Z(t,n),i=Zn(n);e.add(r.key),e.add(i.key)}for(let[,e]of t.readonlySelectors)e.install(this);for(let[,n]of t.writableSelectors)e.has(n.key)||n.install(this);for(let[,e]of t.transactions)e.install(this);for(let[,e]of t.timelineFamilies)e.install(this);for(let[,e]of t.timelines)e.install(this)}}},G={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new en({name:`IMPLICIT_STORE`,lifespan:`ephemeral`,isProduction:!0}),globalThis.ATOM_IO_IMPLICIT_STORE}};function K(e,t){let n,r=e;for(;r!==null;){switch(t.type){case`atom`:case`mutable_atom`:n=r.atoms.get(t.key);break;case`writable_pure_selector`:case`writable_held_selector`:n=r.writableSelectors.get(t.key);break;case`readonly_pure_selector`:case`readonly_held_selector`:n=r.readonlySelectors.get(t.key);break;case`atom_family`:case`mutable_atom_family`:case`writable_pure_selector_family`:case`readonly_pure_selector_family`:case`writable_held_selector_family`:case`readonly_held_selector_family`:n=r.families.get(t.key);break;case`timeline`:n=r.timelines.get(t.key);break;case`timeline_family`:n=r.timelineFamilies.get(t.key);break;case`transaction`:n=r.transactions.get(t.key);break}if(n)return n;r=r.child}throw new st(t,e.config.name)}function tn(e,t,n,r){let i=e.disposalTraces.buffer.find(e=>e?.key===A(r));switch(e.logger.error(`❌`,t.type,t.key,`gets a fallback value because key`,r,`is not allocated`,i?`This key was previously disposed:\n${i.trace}`:`(no previous disposal trace found)`),n.type){case`mutable_atom_family`:{if(e.defaults.has(n.key))return e.defaults.get(n.key);let t=new n.class;return e.defaults.set(n.key,t),t.READONLY_VIEW}case`atom_family`:{if(e.defaults.has(n.key))return e.defaults.get(n.key);let t=n.default,i=t(r);return e.defaults.set(n.key,i),i}case`readonly_pure_selector_family`:case`writable_pure_selector_family`:case`readonly_held_selector_family`:case`writable_held_selector_family`:{if(e.defaults.has(n.key))return e.defaults.get(n.key);let t=n.default(r);return e.defaults.set(n.key,t),t}}}function nn(e,t){let{type:n,key:r,catch:i}=t;switch(n){case`readonly_pure_selector`:case`writable_pure_selector`:{let a;e.logger.info(`🧮`,n,r,`computing value`);try{a=t.getFrom(e),a instanceof Promise&&(a=a.catch(t=>{if(e.logger.error(`💥`,n,r,`rejected:`,t),i){for(let e of i)if(t instanceof e)return t}throw t}))}catch(a){if(e.logger.error(`💥`,n,r,`rejected:`,a),i){for(let n of i)if(a instanceof n)return Q(e,t,a)}throw a}return Q(e,t,a)}case`atom`:{let a;if(z(t.default))try{a=t.default(),a instanceof Promise&&(a=a.catch(t=>{if(e.logger.error(`💥`,n,r,`rejected:`,t),i){for(let e of i)if(t instanceof e)return t}throw t}))}catch(o){if(e.logger.error(`💥`,n,r,`rejected:`,o),i){for(let n of i)if(o instanceof n)return a=Q(e,t,o),e.logger.info(`✨`,t.type,r,`computed default`,a),a}throw o}else a=t.default,e.logger.info(`✨`,t.type,r,`using static default`,a);return Q(e,t,a)}}}function q(e,t,n){if(e.valueMap.has(t.key))return $n(e,t,n);e.logger.info(`❔`,t.type,t.key,`value not found in cache`);let{key:r}=t;switch(t.type){case`readonly_held_selector`:case`writable_held_selector`:return e.logger.info(`🧮`,t.type,r,`computing value`),t.getFrom(e);case`writable_pure_selector`:case`readonly_pure_selector`:case`atom`:return nn(e,t);case`mutable_atom`:{let n=new t.class;return e.logger.info(`✨`,t.type,r,`created new instance`,n),Q(e,t,n)}}}function J(e,...t){let{token:n,family:r,subKey:i}=Ot(e,...t);return`counterfeit`in n&&r&&i?tn(e,n,r,i):q(e,K(e,n))}function rn(e,t,n){let r=A(n),i=`${t.key}(${r})`,a=R(e),o;switch(t.type){case`atom_family`:case`mutable_atom_family`:o=a.atoms.get(i);break;case`writable_held_selector_family`:case`writable_pure_selector_family`:o=a.writableSelectors.get(i);break;case`readonly_held_selector_family`:case`readonly_pure_selector_family`:o=a.readonlySelectors.get(i);break}return o&&B(o)}function Y(e,t,n){let r=K(e,t);return rn(e,t,n)||Dt(Et,e,r,n)}function an(e,t,n){let r=t.key,i=`readonly_pure_selector_family`,a={key:r,type:i},o=e.families.get(r);o&&e.config.isProduction===!0&&e.logger.error(`❗`,i,r,`Overwriting an existing ${I[o.type]} "${o.key}" in store "${e.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let s=n=>{let i=A(n),a={key:r,subKey:i},o=`${r}(${i})`,s=R(e),c={key:o,get:t.get(n)};return t.catch&&(c.catch=t.catch),Ln(s,c,a)},c={...a,create:s,internalRoles:n,install:e=>an(e,t),default:n=>t.get(n)({get:J.bind(null,e),find:Y.bind(null,e),json:t=>Z(e,t),relations:{find:U.bind(null,e),internal:W.bind(null,e)}})};return e.families.set(r,c),a}function on(e,t,n){let r={key:t.key,type:`atom_family`},i=e.families.get(t.key);i&&e.config.isProduction===!0&&e.logger.error(`❗`,`atom_family`,t.key,`Overwriting an existing ${I[i.type]} "${i.key}" in store "${e.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let a=new j,o=n=>{let r=A(n),i={key:t.key,subKey:r},a=`${t.key}(${r})`,o=R(e),s=t.default,c={key:a,default:z(s)?()=>s(n):s};return t.effects&&(c.effects=t.effects(n)),t.catch&&(c.catch=t.catch),rr(o,c,i)},s={...r,create:o,default:t.default,subject:a,install:e=>on(e,t),internalRoles:n};return e.families.set(t.key,s),z(t.default)===!1&&e.defaults.set(t.key,t.default),r}function sn(e,t,n){let r=t.key,i=`readonly_held_selector_family`,a={key:r,type:i},o=e.families.get(r);o&&e.config.isProduction===!0&&e.logger.error(`❗`,i,r,`Overwriting an existing ${I[o.type]} "${o.key}" in store "${e.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let s=n=>{let i=A(n),a={key:r,subKey:i},o=`${r}(${i})`;return In(R(e),{key:o,const:t.const(n),get:t.get(n)},a)},c={...a,create:s,internalRoles:n,install:e=>sn(e,t),default:t.const};return e.families.set(r,c),a}function cn(e,t,n){let r=t.key,i=`writable_held_selector_family`,a={key:r,type:i},o=e.families.get(r);o&&e.config.isProduction===!0&&e.logger.error(`❗`,i,r,`Overwriting an existing ${I[o.type]} "${o.key}" in store "${e.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let s=n=>{let i=A(n),a={key:r,subKey:i},o=`${r}(${i})`;return Rn(R(e),{key:o,const:t.const(n),get:t.get(n),set:t.set(n)},a)},c={...a,create:s,internalRoles:n,install:e=>cn(e,t),default:t.const};return e.families.set(r,c),a}function ln(e,t,n){let r=t.key,i=`writable_pure_selector_family`,a={key:r,type:i},o=e.families.get(r);o&&e.config.isProduction===!0&&e.logger.error(`❗`,i,r,`Overwriting an existing ${I[o.type]} "${o.key}" in store "${e.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let s=n=>{let i=A(n),a={key:r,subKey:i},o=`${r}(${i})`,s=R(e),c={key:o,get:t.get(n),set:t.set(n)};return t.catch&&(c.catch=t.catch),zn(s,c,a)},c={...a,create:s,internalRoles:n,install:e=>ln(e,t),default:n=>t.get(n)({get:((...t)=>J(e,...t)),find:((...t)=>Y(e,...t)),json:t=>Z(e,t),relations:{find:((...t)=>U(e,...t)),internal:((...t)=>W(e,...t))}})};return e.families.set(r,c),a}function un(e,t){let n=`set`in t,r=`const`in t;return r&&n?cn(e,t,void 0):r?sn(e,t,void 0):n?ln(e,t):an(e,t)}function dn(e,...t){let n;if(t.length===1)n=t[0];else{let r=t[0],i=t[1];n=Y(e,r,i)}try{K(e,n)}catch{e.logger.error(`❌`,n.type,n.key,`could not be disposed because it was not found in the store "${e.config.name}".`);return}switch(n.type){case`atom`:case`mutable_atom`:ar(e,n);break;case`writable_pure_selector`:case`readonly_pure_selector`:case`writable_held_selector`:case`readonly_held_selector`:Vn(e,n);break}}function fn(e,t){if(e.operation.open){let n=performance.now();return e.logger.info(`🚫`,t.type,t.key,`deferring setState at T-${n} until setState for "${e.operation.token.key}" is done`),n}return e.operation={open:!0,done:new Set,prev:new Map,timestamp:Date.now(),token:t,subEvents:[]},e.logger.info(`⭕`,t.type,t.key,`operation start in store "${e.config.name}"${V(e)?` ${e.transactionMeta.phase} "${e.transactionMeta.update.token.key}"`:``}`),e}function pn(e){e.operation.open&&e.logger.info(`🔴`,e.operation.token.type,e.operation.token.key,`operation done in store "${e.config.name}"`),e.operation={open:!1},e.on.operationClose.next(e.operation)}function mn(e,t){return e.operation.open?e.operation.done.has(t):(e.logger.error(`🐞`,`unknown`,t,`isDone called outside of an operation. This is probably a bug in AtomIO.`),!0)}function hn(e,t){if(!e.operation.open){e.logger.error(`🐞`,`unknown`,t,`markDone called outside of an operation. This is probably a bug in AtomIO.`);return}e.operation.done.add(t)}function gn(e,t,n,r,i){let{oldValue:a,newValue:o}=n,s=`oldValue`in n,c=B(t);if(r&&i){t.subject.next({newValue:o});let n=R(e);if(c.family)switch(c.type){case`atom`:case`mutable_atom`:let t={checkpoint:!0,type:`atom_creation`,token:c,timestamp:Date.now(),value:o};e.operation.subEvents.push(t),i.subject.next(t),Ht(n)?e.on.atomCreation.next(c):V(n)&&n.on.transactionApplying.state===null&&n.transactionMeta.update.subEvents.push(t);break;case`writable_pure_selector`:case`writable_held_selector`:e.on.selectorCreation.next(c);break}return}let{key:l,subject:u,type:d}=t,f;if(f=s?{oldValue:Qn(a)?a.READONLY_VIEW:a,newValue:Qn(o)?o.READONLY_VIEW:o}:{newValue:Qn(o)?o.READONLY_VIEW:o},Ht(e)){switch(d){case`mutable_atom`:e.logger.info(`📢`,d,l,`is now (`,o,`) subscribers:`,u.subscribers.keys());break;case`atom`:case`writable_pure_selector`:case`writable_held_selector`:e.logger.info(`📢`,d,l,`went (`,a,`->`,o,`) subscribers:`,u.subscribers.keys())}u.next(f)}if(V(e)&&(d===`mutable_atom`||d===`atom`)){if(e.on.transactionApplying.state===null){if(Qn(o))return;let{timestamp:t}=e.operation,n={type:`atom_update`,token:c,timestamp:t,update:f};e.transactionMeta.update.subEvents.push(n),e.logger.info(`📁`,`atom`,l,`stowed (`,a,`->`,o,`)`);return}if(ir(t,`tracker:signal`)){let t=l.slice(1),n=e.atoms.get(t);q(e,n,`mut`).do(f.newValue)===null&&tr(e,n)}}}var _n=Symbol(`UNSET`);function vn(e,t,n){let r,i;if(z(n)){let a=q(e,t,`mut`);r=a,i=n(a)}else r=e.valueMap.has(t.key)?$n(e,t,`mut`):t.type===`atom`&&!z(t.default)?t.default:_n,i=n;return e.logger.info(`⭐`,`atom`,t.key,`setting value`,i),i=Q(e,t,i),hn(e,t.key),tr(e,t),r===_n?{newValue:i}:{oldValue:r,newValue:i}}function yn(e,t){switch(t.type){case`mutable_atom`:return vn(e,t,new t.class);case`atom`:{let n;return n=z(t.default)?nn(e,t):t.default,vn(e,t,n)}}}function bn(e,t){let n;switch(t.type){case`atom`:case`mutable_atom`:n=yn(e,t);break;case`writable_held_selector`:{let r=Nn(e,t.key);for(let n of r.values())gn(e,t,yn(e,n),!1);let i=t.getFrom(e);n={oldValue:i,newValue:i}}break;case`writable_pure_selector`:{let r=nn(e,t),i=Nn(e,t.key);for(let n of i.values())gn(e,t,yn(e,n),!1);n={oldValue:r,newValue:nn(e,t)}}break}return n}function X(e,...t){Dn(Tn,e,...t)}var xn=Symbol(`RESET`);function Sn(e,...t){X(e,...t,xn)}function Cn(e,t,n){let r,i,a,{type:o,key:s}=t;switch(t.type){case`writable_pure_selector`:r=q(e,t,`mut`),i=_t(n,r),i=Q(e,t,i);break;case`writable_held_selector`:a=t.const,_t(n,a),r=a,i=a}return e.logger.info(`⭐`,o,s,`setting to`,i),hn(e,s),t.setSelf(i),{oldValue:r,newValue:i}}function wn(e,t,n){let r;switch(t.type){case`atom`:case`mutable_atom`:r=vn(e,t,n);break;case`writable_pure_selector`:case`writable_held_selector`:r=Cn(e,t,n);break}return r}var Tn=Symbol(`OWN_OP`),En=Symbol(`JOIN_OP`);function Dn(e,t,...n){let r,i,a,o,s,c;n.length===2?(a=n[0],c=n[1],`family`in a&&(o=Ct(t,a),s=k(a.family.subKey),r=rn(t,o,s),a=r||(i=Dt(Tt,t,o,s)))):(o=K(t,n[0]),s=n[1],c=n[2],r=rn(t,o,s),a=r||(i=Dt(Tt,t,o,s)));let l=c===xn?`reset`:`set`,u;if(e===Tn){let n=fn(t,a);if(typeof n==`number`){let r=n,i=t.on.operationClose.subscribe(`waiting to ${l} "${a.key}" at T-${r}`,function(){i(),t.logger.info(`🟢`,a.type,a.key,`resuming deferred`,l,`from T-${r}`),Dn(e,t,a,c)});return}u=n}else u=t;if(`counterfeit`in a&&`family`in a){let e=a.family.subKey,n=t.disposalTraces.buffer.find(t=>t?.key===e);t.logger.error(`❌`,a.type,a.key,`could not be`,l,`because key`,e,`is not allocated.`,n?`this key was previously disposed:${n.trace}`:`(no previous disposal trace found)`);return}let d=K(u,a),f;f=c===xn?bn(u,d):wn(u,d,c),gn(u,d,f,!!i,o),e===Tn&&pn(u)}var On=(e,t)=>R(e).atoms.has(t),kn=(e,t)=>R(e).writableSelectors.has(t),An=(e,t)=>R(e).readonlySelectors.has(t),jn=(e,t)=>On(e,t)||kn(e,t)||An(e,t);function Mn(e,t){return R(e).selectorGraph.getRelationEntries({downstreamSelectorKey:t}).filter(([e,{source:n}])=>n!==t).map(([e,{source:t}])=>t).filter(t=>jn(e,t))}function Nn(e,t,n=new Set){let r=Mn(e,t),i=new Map;for(;r.length>0;){let t=r.pop();if(!n.has(t))if(n.add(t),On(e,t)){let n=e.atoms.get(t);i.set(n.key,n)}else r.push(...Mn(e,t))}return i}function Pn(e,t,n,r,i){let a=R(e),{type:o,key:s}=r;if(o===`atom`||o===`mutable_atom`)a.selectorAtoms.set({selectorKey:n,atomKey:s}),e.logger.info(`🔍`,t,n,`discovers root atom "${s}"`);else{let r=Nn(e,s,i);e.logger.info(`🔍`,t,n,`discovers root atoms: [ ${[...r.values()].map(e=>`"${e.key}"`).join(`, `)} ]`);for(let{key:e}of r.values())a.selectorAtoms=a.selectorAtoms.set({selectorKey:n,atomKey:e})}i.add(s)}function Fn(e,t,n,r){return{get:(...i)=>{let a=R(e),{token:o,family:s,subKey:c}=Ot(e,...i),l;return l=`counterfeit`in o&&s&&c?tn(e,o,s,c):q(e,K(e,o)),e.logger.info(`🔌`,t,n,`registers dependency ( "${o.key}" =`,l,`)`),a.selectorGraph.set({upstreamSelectorKey:o.key,downstreamSelectorKey:n},{source:o.key}),Pn(e,t,n,o,r),l},set:((...t)=>{Dn(En,R(e),...t)}),find:((...t)=>Y(e,...t)),json:t=>Z(e,t),relations:{edit:((...t)=>{Xt(e,...t)}),find:((...t)=>U(e,...t)),internal:((...t)=>W(e,...t))}}}function In(e,t,n){let r=R(e),i=new j,a=new Set,{key:o,const:s}=t,c=`readonly_held_selector`;e.logger.info(`🔨`,c,o,`is being created`);let{get:l,find:u,json:d,relations:f}=Fn(r,c,o,a),p=n=>{let r=n.selectorGraph.getRelationEntries({downstreamSelectorKey:o});for(let[e,{source:t}]of r)t!==o&&n.selectorGraph.delete(e,o);return n.selectorAtoms.delete(o),t.get({get:l,find:u,json:d,relations:f},s),Q(n,m,s),e.logger.info(`✨`,c,o,`=`,s),a.clear(),s},m={...t,type:c,subject:i,getFrom:p,install:e=>In(e,t,n)};n&&(m.family=n),r.readonlySelectors.set(o,m);let h={key:o,type:c};return n&&(h.family=n),h}function Ln(e,t,n){let r=R(e),i=new j,a=new Set,o=t.key,s=`readonly_pure_selector`;e.logger.info(`🔨`,s,o,`is being created`);let{get:c,find:l,json:u,relations:d}=Fn(r,s,o,a),f=()=>{let n=R(e),r=n.selectorGraph.getRelationEntries({downstreamSelectorKey:o});for(let[e,{source:t}]of r)t!==o&&n.selectorGraph.delete(e,o);n.selectorAtoms.delete(o);let i=t.get({get:c,find:l,json:u,relations:d});return e.logger.info(`✨`,s,o,`=`,i),a.clear(),i},p={...t,type:s,subject:i,getFrom:f,install:e=>Ln(e,t,n)};n&&(p.family=n),r.readonlySelectors.set(o,p);let m={key:o,type:s};return n&&(m.family=n),m}function Rn(e,t,n){let r=R(e),i=new j,a=new Set,{key:o,const:s}=t,c=`writable_held_selector`;e.logger.info(`🔨`,c,o,`is being created`);let l=Fn(r,c,o,a),{find:u,get:d,json:f,relations:p}=l,m={find:u,get:d,json:f,relations:p},h=n=>{let r=n.selectorGraph.getRelationEntries({downstreamSelectorKey:o});for(let[e,{source:t}]of r)t!==o&&n.selectorGraph.delete(e,o);return n.selectorAtoms.delete(o),t.get(m,s),Q(n,_,s),e.logger.info(`✨`,c,o,`=`,s),a.clear(),s},g=()=>{t.set(l,s)},_={...t,type:c,subject:i,getFrom:h,setSelf:g,install:e=>Rn(e,t,n)};n&&(_.family=n),r.writableSelectors.set(o,_);let v={key:o,type:c};return n&&(v.family=n),v}function zn(e,t,n){let r=R(e),i=new j,a=new Set,o=t.key,s=`writable_pure_selector`;e.logger.info(`🔨`,s,o,`is being created`);let c=Fn(r,s,o,a),{find:l,get:u,json:d,relations:f}=c,p={find:l,get:u,json:d,relations:f},m=n=>{let r=n.selectorGraph.getRelationEntries({downstreamSelectorKey:o});for(let[e,{source:t}]of r)t!==o&&n.selectorGraph.delete(e,o);n.selectorAtoms.delete(o);let i=t.get(p);return e.logger.info(`✨`,s,o,`=`,i),a.clear(),i},h=e=>{t.set(c,e)},g={...t,type:s,subject:i,getFrom:m,setSelf:h,install:e=>zn(e,t,n)};n&&(g.family=n),r.writableSelectors.set(o,g);let _={key:o,type:s};return n&&(_.family=n),_}function Bn(e,t){let n=`set`in t,r=`const`in t;if(r&&n){let n=Rn(e,t,void 0);return e.on.selectorCreation.next(n),n}if(r){let n=In(e,t,void 0);return e.on.selectorCreation.next(n),n}if(n){let n=zn(e,t,void 0);return e.on.selectorCreation.next(n),n}let i=Ln(e,t,void 0);return e.on.selectorCreation.next(i),i}function Vn(e,t){let n=R(e),{key:r,type:i,family:a}=t;if(!a)e.logger.error(`❌`,i,r,`Standalone selectors cannot be disposed.`);else{switch(n.molecules.get(a.subKey)&&n.moleculeData.delete(a.subKey,a.key),t.type){case`writable_held_selector`:n.writableSelectors.delete(r),a.key;break;case`writable_pure_selector`:n.writableSelectors.delete(r),a.key;break;case`readonly_held_selector`:n.readonlySelectors.delete(r),a.key;break;case`readonly_pure_selector`:n.readonlySelectors.delete(r),a.key;break}if(n.valueMap.delete(r),n.selectorAtoms.delete(r),n.selectorGraph.delete(r),n.moleculeData.delete(a.key,a.subKey),e.logger.info(`🔥`,t.type,r,`deleted`),V(n)&&n.transactionMeta.phase===`building`)return;e.on.selectorDisposal.next(t)}}function Hn(e,t){let n=R(e);return n.operation.open?n.operation.prev.get(t.key):n.valueMap.get(t.key)}function Un(e,t,n){return n.subject.subscribe(`${t.type}:${t.key}`,r=>{e.logger.info(`📢`,t.type,t.key,`root`,n.key,`went`,r.oldValue,`->`,r.newValue);let i=Hn(e,t),a=q(e,t);e.logger.info(`✨`,t.type,t.key,`went`,i,`->`,a),t.subject.next({newValue:a,oldValue:i})})}function Wn(e,t,n,r){function i(n){e.operation.open&&a?.type===`atom`&&ir(a,`tracker:signal`)&&`*`+e.operation.token.key===t.key&&`inboundTracker`in r||r(n)}Ot(e,t);let a=K(e,t);e.logger.info(`👀`,a.type,a.key,`Adding subscription "${n}"`);let o=a.type===`writable_pure_selector`||a.type===`readonly_pure_selector`,s=new Map,c=i;if(o){q(e,a);for(let[t,n]of Nn(e,a.key))s.set(t,Un(e,a,n));c=function(t){let n=Nn(e,a.key);for(let[e,t]of s)n.get(e)?n.delete(e):(t(),s.delete(e));for(let[t,r]of n)s.set(t,Un(e,a,r));i(t)}}let l=a.subject.subscribe(n,c);return()=>{e.logger.info(`🙈`,a.type,a.key,`Removing subscription "${n}"`),l();for(let e of s.values())e()}}function Gn(e,t,n,r){let i=K(e,t);e.logger.info(`👀`,`timeline`,t.key,`Adding subscription "${n}"`);let a=i.subject.subscribe(n,r);return()=>{e.logger.info(`🙈`,`timeline`,t.key,`Removing subscription "${n}" from timeline`),a()}}var Kn=class{initializeSignalAtom(e,t){let n=`*${e.key}`;t.atoms.delete(n),t.valueMap.delete(n);let r=e.family?{key:`*${e.family.key}`,subKey:e.family.subKey}:void 0,i=rr(t,{key:n,default:null},r,[`tracker:signal`]);if(t.parent?.valueMap.has(n)){let e=t.parent.valueMap.get(n);t.valueMap.set(n,e)}return i}unsubscribeFromInnerValue;unsubscribeFromState;captureSignalsFromCore(e,t,n){let r=e.key,i=`tracker-from-core:${n.config.name}:${V(n)?n.transactionMeta.update.token.key:`main`}:${r}`,a=e=>{Dn(En,n,t,e)},o=J(n,e);this.unsubscribeFromInnerValue=o.subscribe(i,a),this.unsubscribeFromState=Wn(n,e,i,function(e){e.newValue!==e.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=e.newValue.subscribe(i,a))}.bind(this))}supplySignalsToCore(e,t,n){let r=e.key,i=`tracker-to-core:${n.config.name}:${V(n)?n.transactionMeta.update.token.key:`main`}:${r}`;Wn(n,t,i,Object.assign(function({newValue:r,oldValue:a}){let o=n.timelineTopics.getRelatedKey(t.key);if(o&&n.timelines.get(o)?.timeTraveling){let t=Gn(n,{key:o,type:`timeline`},i,function(i){t(),X(n,e,e=>(i.event===`redo`&&r?e.do(r):i.event===`undo`&&a&&e.undo(a),e))});return}X(n,e,e=>(e.do(r),e))},{inboundTracker:!0}))}mutableAtomToken;latestSignalToken;[Symbol.dispose];constructor(e,t){let n=R(t),r=this.initializeSignalAtom(e,n);this.mutableAtomToken=e,this.latestSignalToken=r,this.captureSignalsFromCore(e,r,n),this.supplySignalsToCore(e,r,n),n.trackers.set(e.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),n.trackers.delete(e.key)}}};function qn(e,t,n){e.logger.info(`🔨`,`atom`,t.key,`creating in store "${e.config.name}"`);let r=R(e),{key:i}=t,a=r.atoms.get(i),o=`mutable_atom`;if(a?.type===o&&e.config.isProduction===!0)return e.logger.error(`❌`,o,i,`Tried to create atom, but it already exists in the store.`),B(a);let s=new j,c={...t,type:o,install:e=>(e.logger.info(`🛠️`,`atom`,i,`installing in store "${e.config.name}"`),qn(e,t,n)),subject:s};n&&(c.family=n),r.atoms.set(c.key,c);let l=B(c);if(new Kn(l,e),n||Bn(e,{key:`${i}:JSON`,get:({get:e})=>e(l).toJSON(),set:({set:e},n)=>{e(l,t.class.fromJSON(n))}}),t.effects){let n=0,r=[];for(let i of t.effects){let t=i({resetSelf:()=>{Sn(e,l)},setSelf:t=>{X(e,l,t)},onSet:t=>Wn(e,l,`effect[${n}]`,t),token:l,store:ht(e)});t&&r.push(t),++n}c.cleanup=()=>{for(let e of r)e instanceof Promise?e.then(e=>e?.()):e()}}return e.on.atomCreation.next(l),l}var Jn=class{trackers=new Map;latestSignalAtoms;mutableAtoms;constructor(e,t){let n=on(t,{key:`*${e.key}`,default:null},[`mutable`,`updates`]);this.latestSignalAtoms=K(t,n),this.mutableAtoms=e,this.mutableAtoms.subject.subscribe(`store=${t.config.name}::tracker-atom-family`,e=>{let{type:n,token:r}=e;if(r.family){let e=k(r.family.subKey);switch(n){case`atom_creation`:this.trackers.set(e,new Kn(r,t));break;case`atom_disposal`:{let t=this.trackers.get(e);t&&(t[Symbol.dispose](),this.trackers.delete(e))}}}})}};function Yn(e,t,n){let r={key:t.key,type:`mutable_atom_family`},i=e.families.get(t.key);i&&e.config.isProduction===!0&&e.logger.error(`❗`,`mutable_atom_family`,t.key,`Overwriting an existing ${I[i.type]} "${i.key}" in store "${e.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let a=new j,o=n=>{let r=A(n),i={key:t.key,subKey:r},a=`${t.key}(${r})`,o=R(e),s={key:a,class:t.class};return t.effects&&(s.effects=t.effects(n)),qn(o,s,i)},s={...r,create:o,class:t.class,subject:a,install:e=>Yn(e,t),internalRoles:n};return e.families.set(t.key,s),ln(e,{key:`${t.key}:JSON`,get:e=>({get:t})=>t(r,e).toJSON(),set:e=>({set:n},i)=>{n(r,e,t.class.fromJSON(i))}},[`mutable`,`json`]),new Jn(s,e),r}function Xn(e,t){let n=R(t),r=`${e.key}:JSON`;return n.families.get(r)}var Z=(e,t)=>t.family?Y(e,K(R(e),{key:`${t.family.key}:JSON`,type:`writable_pure_selector_family`}),k(t.family.subKey)):{type:`writable_pure_selector`,key:`${t.key}:JSON`};function Zn(e){let t={type:`atom`,key:`*${e.key}`};return e.family&&(t.family={key:`*${e.family.key}`,subKey:e.family.subKey}),t}function Qn(e){return typeof e==`object`&&!!e&&`do`in e&&`undo`in e&&`subscribe`in e&&`READONLY_VIEW`in e&&`toJSON`in e}function Q(e,t,n){let{key:r,subject:i,type:a}=t,o=e.valueMap.get(r);if(o instanceof Qe&&!o.done){let t=o;return n instanceof Promise?(t.use(n),t):(e.valueMap.set(r,n),n)}if(n instanceof Promise){let o=new Qe(n);return e.valueMap.set(r,o),o.then(function(n){if(e.valueMap.get(r)===o){switch(fn(e,t),Q(e,t,n),a){case`atom`:tr(e,t);break;case`readonly_pure_selector`:case`writable_pure_selector`:nr(e,r);break}pn(e),i.next({newValue:n,oldValue:o})}}).catch(n=>{e.logger.error(`💥`,t.type,r,`rejected:`,n)}),o}return e.logger.info(`📝`,t.type,t.key,`writing to cache`,n),e.valueMap.set(r,n),n}function $n(e,t,n){e.logger.info(`📖`,t.type,t.key,`reading cached value`);let r=e.valueMap.get(t.key);if(n===`mut`&&t.type===`mutable_atom`&&V(e)){let n=t,{parent:i}=e;if(e.valueMap.hasOwn(n.key))return r;let a=i.valueMap.get(n.key);e.logger.info(`📃`,`atom`,n.key,`copying`);let o=a.toJSON(),s=n.class.fromJSON(o);e.valueMap.set(n.key,s),new Kn(n,i),r=s}return r}function er(e,t){let n=e.valueMap.get(t);if(n instanceof Qe){let r=e.readonlySelectors.get(t),i=e.writableSelectors.get(t),a=nn(e,r??i);n.use(a);return}e.operation.open&&e.operation.prev.set(t,n),e.valueMap.delete(t),e.logger.info(`🗑`,`state`,t,`evicted`)}function tr(e,t){let n=R(e),{key:r,type:i}=t,a=n.selectorAtoms.getRelatedKeys(r);if(n.logger.info(`🧹`,i,r,a?`evicting ${a.size} states downstream:`:`no downstream states`,a??`to evict`),a){n.operation.open&&n.logger.info(`🧹`,i,r,`[ ${[...n.operation.done].join(`, `)} ] already done`);for(let e of a)mn(n,e)||(er(n,e),hn(n,e))}}function nr(e,t){let n=R(e),r=n.selectorGraph.getRelationEntries({upstreamSelectorKey:t}).filter(([e,{source:n}])=>n===t);for(let[t]of r)mn(n,t)||(er(n,t),hn(n,t),nr(e,t))}function rr(e,t,n,r){let i=`atom`,{key:a}=t;e.logger.info(`🔨`,i,a,`is being created`);let o=R(e),s=o.atoms.get(a);if(s?.type===i&&e.config.isProduction===!0)return e.logger.error(`❌`,`atom`,a,`Tried to create atom, but it already exists in the store.`),B(s);let c=new j,l={...t,type:i,install:e=>(e.logger.info(`🛠️`,i,a,`installing in store "${e.config.name}"`),rr(e,t,n)),subject:c};n&&(l.family=n),r&&(l.internalRoles=r),o.atoms.set(a,l);let u=B(l);if(t.effects){let n=0,r=[];for(let i of t.effects){let t=i({resetSelf:()=>{Sn(e,u)},setSelf:t=>{X(e,u,t)},onSet:t=>Wn(e,u,`effect[${n}]`,t),token:u,store:ht(e)});t&&r.push(t),++n}l.cleanup=()=>{for(let e of r)e instanceof Promise?e.then(e=>e?.()):e()}}return e.on.atomCreation.next(u),u}function ir(e,t){return`internalRoles`in e&&e.internalRoles.includes(t)}function ar(e,t){let n=R(e),{key:r,family:i}=t,a=K(n,t);if(!i)e.logger.error(`❌`,`atom`,r,`Standalone atoms cannot be disposed.`);else{a.cleanup?.();let o=e.valueMap.has(a.key),s=K(e,Ct(e,t)).subject,c={type:`atom_disposal`,token:t,timestamp:Date.now()};o&&(c.value=e.valueMap.get(a.key)),s.next(c);let l=V(n);if(n.atoms.delete(r),n.valueMap.delete(r),n.selectorAtoms.delete(r),n.atomsThatAreDefault.delete(r),n.moleculeData.delete(i.key,i.subKey),e.timelineTopics.delete(r),t.type===`mutable_atom`&&(ar(e,Zn(t)),e.trackers.delete(r)),e.logger.info(`🔥`,`atom`,r,`deleted`),l&&n.transactionMeta.phase===`building`){let e=n.transactionMeta.update.subEvents.at(-1),t=e?.type===`molecule_disposal`&&e.values.some(([e])=>e===a.family?.key),r=ir(a,`tracker:signal`);!t&&!r&&n.transactionMeta.update.subEvents.push(c)}else e.on.atomDisposal.next(t)}}var or=ie(G.STORE);function sr({children:e,store:t=G.STORE}){return or.Provider({value:t,children:e})}function cr(e,...t){let n;if(t.length===2){let r=t[0],i=t[1];n=Y(e,r,i)}else n=t[0];return n}function lr(...e){let t=ae(or),n=cr(t,...e);return e=>{X(t,n,e)}}function ur(e,t){let[n,r]=v(t(),{equals:!1});return b(()=>{let n=()=>r(()=>t()),i=e(n);n(),ee(()=>{i()})}),()=>(n(),t())}function $(...e){let t=ae(or),n=cr(t,...e),r=mt();return ur(e=>Wn(t,n,`use-o:${r}`,e),()=>J(t,n))}var dr=Je([`set`,`truncate`,`extend`,`pop`,`push`,`shift`,`unshift`,`copyWithin`,`fill`,`splice`,`reverse`,`sort`]),fr=class e extends Array{mode=`record`;subject=new j;READONLY_VIEW=this;constructor(...e){return super(...e),new Proxy(this,{set:(e,t,n,r)=>{if(typeof t==`string`&&!Number.isNaN(Number.parseInt(t,10))){let r=Number(t),i;return this.mode===`record`&&(i=e[r]),e[r]=n,i?this.emit({type:`set`,index:r,next:n,prev:i}):this.mode===`record`&&this.emit({type:`set`,index:r,next:n}),!0}if(t===`length`){if(this.mode===`record`){let t=e.length;if(t===n)return!0;if(t>n){let t=e.slice(n);e.length=n,this.emit({type:`truncate`,length:n,items:t})}else e.length=n,this.emit({type:`extend`,next:n,prev:t})}else e.length=n;return!0}return Reflect.set(e,t,n,r)}})}toJSON(){return[...this]}static fromJSON(t){return new e(...t)}push(...e){let t;return this.mode===`record`?(this.mode=`playback`,t=super.push(...e),this.mode=`record`,this.emit({type:`push`,items:e})):t=super.push(...e),t}pop(){let e;return this.mode===`record`?(this.mode=`playback`,e=super.pop(),e===void 0?this.emit({type:`pop`}):this.emit({type:`pop`,value:e}),this.mode=`record`):e=super.pop(),e}shift(){let e;return this.mode===`record`?(this.mode=`playback`,e=super.shift(),e===void 0?this.emit({type:`shift`}):this.emit({type:`shift`,value:e}),this.mode=`record`):e=super.shift(),e}unshift(...e){let t;return this.mode===`record`?(this.mode=`playback`,t=super.unshift(...e),this.emit({type:`unshift`,items:e}),this.mode=`record`):t=super.unshift(...e),t}reverse(){return super.reverse(),this.mode===`record`&&this.emit({type:`reverse`}),this}fill(e,t,n){if(this.mode===`record`){this.mode=`playback`;let r=this.slice(t,n);super.fill(e,t,n),t===void 0?this.emit({type:`fill`,value:e,prev:r}):n===void 0?this.emit({type:`fill`,value:e,start:t,prev:r}):this.emit({type:`fill`,value:e,start:t,end:n,prev:r}),this.mode=`record`}else super.fill(e,t,n);return this}sort(e){if(this.mode===`record`){this.mode=`playback`;let t=[...this];super.sort(e);let n=[...this];this.emit({type:`sort`,next:n,prev:t}),this.mode=`record`}return this}splice(...e){let[t,n,...r]=e,i=this.mode;i===`record`&&(this.mode=`playback`);let a=super.splice(...e);return i===`record`&&(this.mode=`record`),n===void 0?this.emit({type:`splice`,start:t,items:r,deleted:a,deleteCount:a.length}):this.emit({type:`splice`,start:t,items:r,deleted:a,deleteCount:n}),a}copyWithin(e,t,n){let r=this.mode,i;return r===`record`&&(i=this.slice(e),this.mode=`playback`),super.copyWithin(e,t,n),r===`record`&&(this.mode=`record`),i&&(n===void 0?this.emit({type:`copyWithin`,prev:i,target:e,start:t}):this.emit({type:`copyWithin`,prev:i,target:e,start:t,end:n})),this}subscribe(e,t){return this.subject.subscribe(e,t)}emit(t){this.subject.next(e.packUpdate(t))}doStep(e){switch(e.type){case`copyWithin`:this.copyWithin(e.target,e.start,e.end);break;case`extend`:this.length=e.next;break;case`fill`:this.fill(e.value,e.start,e.end);break;case`pop`:this.pop();break;case`push`:this.push(...e.items);break;case`reverse`:this.reverse();break;case`shift`:this.shift();break;case`sort`:for(let t=0;t<e.next.length;t++)this[t]=e.next[t];this.length=e.next.length;break;case`splice`:this.splice(e.start,e.deleteCount,...e.items);break;case`truncate`:this.length=e.length;break;case`set`:this[e.index]=e.next;break;case`unshift`:this.unshift(...e.items);break}}do(t){this.mode=`playback`;let n=e.unpackUpdate(t);return this.doStep(n),this.mode=`record`,null}undoStep(e){switch(e.type){case`copyWithin`:for(let t=0;t<e.prev.length;t++)this[t+e.target]=e.prev[t];break;case`extend`:this.length=e.prev;break;case`fill`:{let t=e.start??0;for(let n=0;n<e.prev.length;n++)this[n+t]=e.prev[n]}break;case`pop`:e.value!==void 0&&this.push(e.value);break;case`push`:{let t=e.items.length-1;for(;t>=0;)this.pop(),--t}break;case`reverse`:this.reverse();break;case`shift`:e.value!==void 0&&this.unshift(e.value);break;case`sort`:for(let t=0;t<e.prev.length;t++)this[t]=e.prev[t];this.length=e.prev.length;break;case`set`:if(e.prev!==void 0)this[e.index]=e.prev;else{delete this[e.index];let t=this.findIndex((e,t)=>!Object.hasOwn(this,t));t!==-1&&(this.length=t)}break;case`splice`:this.splice(e.start,e.items.length,...e.deleted);break;case`truncate`:this.push(...e.items);break;case`unshift`:{let t=e.items.length-1;for(;t>=0;)this.shift(),--t}break}}undo(t){this.mode=`playback`;let n=e.unpackUpdate(t);return this.undoStep(n),this.mode=`record`,null}static packUpdate(e){let t=dr[e.type]+``;switch(e.type){case`set`:return t+=e.index+``+M(e.next),e.prev!==void 0&&(t+=``+M(e.prev)),t;case`truncate`:return t+e.length+``+e.items.map(M).join(``);case`extend`:return t+e.next+``+e.prev;case`pop`:case`shift`:return e.value!==void 0&&(t+=M(e.value)),t;case`push`:case`unshift`:return t+e.items.map(M).join(``);case`copyWithin`:return t+=e.target+``+e.start,e.end!==void 0&&(t+=``+e.end),t+=``+e.prev.map(M).join(``),t;case`fill`:return t+=M(e.value),e.start!==void 0&&(t+=``+e.start),e.end!==void 0&&(t+=``+e.end),t+=``+e.prev.map(M).join(``),t;case`splice`:return t+e.start+``+e.deleteCount+``+e.items.map(M).join(``)+``+e.deleted.map(M).join(``);case`reverse`:return t;case`sort`:return t+e.next.map(M).join(``)+``+e.prev.map(M).join(``)}}static unpackUpdate(e){let[t,n]=e.split(``),r=dr[t];switch(r){case`set`:{let[e,t,i]=n.split(``),a=+e,o=N(t);return i===void 0?{type:r,index:a,next:o}:{type:r,index:a,next:o,prev:N(i)}}case`truncate`:{let[e,...t]=n.split(``);return{type:r,length:+e,items:t.map(N)}}case`extend`:{let[e,t]=n.split(``);return{type:r,next:+e,prev:+t}}case`pop`:case`shift`:return n===``?{type:r}:{type:r,value:N(n)};case`push`:case`unshift`:return{type:r,items:n.split(``).map(N)};case`copyWithin`:{let[e,t]=n.split(``),i=t?t.split(``).map(N):[],[a,o,s]=e.split(``),c=+a,l=+o;return s===void 0?{type:r,target:c,start:l,prev:i}:{type:r,target:c,start:l,prev:i,end:+s}}case`fill`:{let[e,t]=n.split(``),i=t?t.split(``).map(N):[],[a,o,s]=e.split(``),c=N(a);if(o===void 0&&s===void 0)return{type:r,value:c,prev:i};let l=+o;return s===void 0?{type:r,value:c,prev:i,start:l}:{type:r,value:c,prev:i,start:l,end:+s}}case`splice`:{let[e,t,i,a]=n.split(``);return{type:r,start:+e,deleteCount:+t,items:i?i.split(``).map(N):[],deleted:a?a.split(``).map(N):[]}}case`reverse`:return{type:r};case`sort`:{let[e,t]=n.split(``);return{type:r,next:e?e.split(``).map(N):[],prev:t?t.split(``).map(N):[]}}}}},pr=class e{simplifyParams(...t){let n,r;if(t[0]instanceof e)[n,r]=t[0].simplify();else{if([n,r=1n]=t,r===0n)return{error:Error(),numerator:n};r<0n&&(n=-n,r=-r)}return[n,r]}constructor(e,t=1n){this.fractionalValues=new Map,e&&t&&this.add(e,t)}add(...e){if(typeof e[0]==`bigint`){let[t,n=1n]=e;if(n===0n)return console.error(`Attempted to add (${t} / ${n}) to a rational.`),this;n<0n&&(t=-t,n=-n);let r=t,i=this.fractionalValues.get(n);i&&(r=i+t),this.fractionalValues.set(n,r)}else for(let[t,n]of e[0].entries())this.add(n,t);return this}sub(...e){if(typeof e[0]==`bigint`){let[t,n=1n]=e;this.add(-t,n)}else for(let[t,n]of e[0].entries())this.add(-n,t);return this}mul(...e){let t=this.simplifyParams(...e);if(`error`in t)return t.error.message=`Attempted to multiply by (${t.numerator} / 0)`,console.error(t.error),this;let[n,r]=t,i=[...this.entries()];this.fractionalValues.clear();for(let[e,t]of i)this.fractionalValues.set(e*r,t*n);return this}div(...e){let t=this.simplifyParams(...e);if(`error`in t)return t.error.message=`Attempted to divide by (${t.numerator} / 0)`,console.error(t.error),this;let[n,r]=t;return this.mul(r,n),this}entries(){return this.fractionalValues.entries()}consolidate(){let e=new mr;for(let t of this.entries())for(let n of t)n!==0n&&n!==1n&&(e=e.and(n));let t=e.compute(),n=0n;for(let[e,r]of this.fractionalValues.entries())n+=r*t/e;return t<0n?[-n,-t]:[n,t]}simplify(){let[e,t]=this.consolidate();if(e===0n)return[0n,1n];let n=new mr(t).and(e).compute();return[n/t,n/e]}isGreaterThan(...e){let t=this.simplify(),n=this.simplifyParams(...e);return`error`in n?(n.error.message=`Attempted to compare (${n.numerator} / 0) to (${t[0]} / ${t[1]})`,console.error(n.error),!1):t[0]*n[1]>t[1]*n[0]}},mr=class{constructor(e){this.factors=new Map,e&&hr(e,this.factors)}and(e){let t=hr(e);for(let[e,n]of t){let t=this.factors.get(e);(!t||t<n)&&this.factors.set(e,n)}return this}compute(){let e=1n;for(let[t,n]of this.factors)e*=t**n;return e}};function hr(e,t=new Map){let n=2n;for(;n<=e;){if(e%n===0n){let r=t.get(n)??0n;t.set(n,r+1n),hr(e/n,t);break}n+=1n}return t.size===0&&t.set(e,1n),t}var gr={class:`_class_r58xi_1`},_r=E(`<app><header><h1>Rationality Playground</h1></header><main><new-rational><button type=button>Add`,!0,!1,!1),vr=E(`<rational-breakdown><fraction-list><infix-buttons><button type=button>−</button><button type=button>+</button><button type=button>÷</button><button type=button>×</button></infix-buttons></fraction-list><equals>=</equals><equals></equals><quotient><quotient-bits></quotient-bits><number>`,!0,!1,!1),yr=E(`<plus>+`),br=E(`<bit>`),xr=E(`<fraction><numerator></numerator><solidus></solidus><denominator>`),Sr=E(`<fieldset><input type=number placeholder=1><solidus></solidus><input type=number placeholder=1>`),Cr=()=>Math.random().toString(36).slice(2),wr=$e({key:`newRationalNumerator`,default:void 0}),Tr=$e({key:`newRationalDenominator`,default:void 0}),Er=tt({key:`newNumerator`,default:void 0}),Dr=tt({key:`newDenominator`,default:void 0}),Or=et({key:`rationalList`,class:fr}),kr=tt({key:`rational`,default:()=>new pr(0n,1n)}),Ar=lt({key:`simplified`,get:e=>({get:t})=>{let[n,r]=t(kr,e).simplify();return[n,r]}}),jr=lt({key:`float`,get:e=>({get:t})=>{let[n,r]=t(Ar,e);return Number(n)/Number(r)}}),Mr=lt({key:`numberBits`,get:e=>({get:t})=>{let[n,r]=t(Ar,e),i=Number(n)/Number(r),a=new ArrayBuffer(8);new DataView(a).setFloat64(0,i,!1);let o=new Uint8Array(a);return[...Array.from(o).map(e=>e.toString(2).padStart(8,`0`)).join(``)].map(e=>e===`1`?`1`:`0`)}}),Nr=lt({key:`isFloatPrecise`,get:e=>({get:t})=>{let[,n]=t(Ar,e);return n!==0n&&n>0n&&(n&n-1n)==0n}}),Pr=lt({key:`approximateValue`,get:e=>({get:t})=>{let n=t(jr,e);return Number.isFinite(n)?Number(n.toPrecision(5)).toString():n.toString()}}),Fr=dt({key:`combineIntoRational`,do:({get:e,set:t,reset:n},r,i)=>{let a=e(Er,r)??1n,o=e(Dr,r)??1n;t(kr,r,e(kr,r)[i](a,o)),n(Er,r),n(Dr,r)}});function Ir(){let e=$(Or);return(()=>{var t=_r(),n=t.firstChild.nextSibling,r=n.firstChild,i=r.firstChild;return D(n,T(ke,{get each(){return e()},children:e=>T(Lr,{key:e})}),r),r._$owner=te(),D(r,T(Br,{numeratorAtom:wr,denominatorAtom:Tr}),i),i.$$click=()=>{let e=`rat::${Cr()}`;ft(Fr)(e,`add`),ut(kr,e,new pr(rt(wr)??1n,rt(Tr)??1n)),ut(Or,t=>(t.push(e),t)),ct(wr),ct(Tr)},y(()=>Le(t,gr.class)),t})()}function Lr(e){let t=$(kr,e.key),n=$(Ar,e.key),r=$(jr,e.key),i=$(Nr,e.key),a=$(Pr,e.key),o=$(Mr,e.key);return(()=>{var s=vr(),c=s.firstChild,l=c.firstChild,u=l.firstChild,d=u.nextSibling,f=d.nextSibling,p=f.nextSibling,m=c.nextSibling.nextSibling,h=m.nextSibling.firstChild,g=h.nextSibling;return s._$owner=te(),c._$owner=te(),D(c,T(ke,{get each(){return[...t().entries()]},children:([e,t],n)=>[T(Ae,{get when(){return n()!==0},get children(){return yr()}}),T(Rr,{numerator:t,denominator:e})]}),l),l._$owner=te(),u.$$click=()=>{ft(Fr)(e.key,`sub`)},d.$$click=()=>{ft(Fr)(e.key,`add`)},f.$$click=()=>{ft(Fr)(e.key,`div`)},p.$$click=()=>{ft(Fr)(e.key,`mul`)},D(c,T(zr,{get key(){return e.key}}),null),D(s,T(Rr,{get numerator(){return n()[0]},get denominator(){return n()[1]}}),m),D(m,()=>i()?`=`:`≈`),h._$owner=te(),D(h,T(ke,{get each(){return o()},children:e=>(()=>{var t=br();return Ie(t,`data-css`,e===`1`?`one`:void 0),t})()})),D(g,(()=>{var e=je(()=>!!i());return()=>e()?r():a()})()),s})()}function Rr(e){return(()=>{var t=xr(),n=t.firstChild,r=n.nextSibling.nextSibling;return D(n,()=>Number(e.numerator)),D(r,()=>Number(e.denominator)),y(t=>{var i=e.numerator===1n?`one`:void 0,a=e.denominator===1n?`one`:void 0;return i!==t.e&&Ie(n,`data-css`,t.e=i),a!==t.t&&Ie(r,`data-css`,t.t=a),t},{e:void 0,t:void 0}),t})()}function zr({key:e}){return T(Br,{numeratorAtom:nt(Er,e),denominatorAtom:nt(Dr,e)})}function Br({numeratorAtom:e,denominatorAtom:t}){let n=$(e),r=lr(e),i=$(t),a=lr(t);return(()=>{var e=Sr(),t=e.firstChild,o=t.nextSibling.nextSibling;return t.$$input=e=>{r(BigInt(e.currentTarget.value))},o.$$input=e=>{a(BigInt(e.currentTarget.value))},y(()=>t.value=n()?.toString()),y(()=>o.value=i()?.toString()),e})()}Fe([`click`,`input`]),Pe(()=>T(sr,{get children(){return T(Ir,{})}}),document.getElementById(`app`));
|