@oloy-tests/sdk 0.0.0-stage → 0.1.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Oloy, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,37 @@
1
- # Temporary Holding Version
1
+ # @oloy-tests/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Connect your app to oloy: a Node server such as Next.js, an app built with Vite for Cloudflare Workers, and its pages in the browser. Add the lines that fit your app; your app's page in oloy gives you each value.
4
+
5
+ 1. Install it: `npm install @oloy-tests/sdk`
6
+
7
+ 2. A Node server. In Next.js, in `instrumentation.ts` (in your project root, or in `src/` if your app lives there):
8
+
9
+ ```ts
10
+ import { oloy } from "@oloy-tests/sdk/next";
11
+ export const register = oloy();
12
+ ```
13
+
14
+ In any other Node server, at the top of its entry file:
15
+
16
+ ```ts
17
+ import { oloy } from "@oloy-tests/sdk/node";
18
+ await oloy()();
19
+ ```
20
+
21
+ Put your app's server key in your host's settings as `OLOY_KEY`, never in your code. It needs Node.js 22.14 or newer, and Next.js 16 or newer.
22
+
23
+ 3. An app built with Vite: in its Vite config, add the plugin last in its plugins, with your app's build key:
24
+
25
+ ```ts
26
+ import { oloyVite } from "@oloy-tests/sdk/vite";
27
+ // plugins: [/* your plugins */, oloyVite("<your app's build key>")]
28
+ ```
29
+
30
+ 4. In the browser: in `instrumentation-client.ts` in Next.js (next to `instrumentation.ts`), or in your app's client entry:
31
+
32
+ ```ts
33
+ import { oloy } from "@oloy-tests/sdk/client";
34
+ oloy("<your app's oloy address>");
35
+ ```
36
+
37
+ https://oloy.ai
@@ -0,0 +1,228 @@
1
+ Third-party notices for @oloy-tests/sdk
2
+
3
+ This package vendors the following software, each under the MIT License (bundled into dist/index.mjs). Every notice
4
+ below is reproduced as its authors published it.
5
+
6
+ ---- tuf-js (LICENSE-tuf-js) ----
7
+
8
+ MIT License
9
+
10
+ Copyright (c) 2022 GitHub and the TUF Contributors
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+
30
+ ---- @tufjs/canonical-json (LICENSE-tufjs-canonical-json) ----
31
+
32
+ MIT License
33
+
34
+ Copyright (c) 2022 GitHub and the TUF Contributors
35
+
36
+ Permission is hereby granted, free of charge, to any person obtaining a copy
37
+ of this software and associated documentation files (the "Software"), to deal
38
+ in the Software without restriction, including without limitation the rights
39
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
+ copies of the Software, and to permit persons to whom the Software is
41
+ furnished to do so, subject to the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be included in all
44
+ copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
+ SOFTWARE.
53
+
54
+ ---- @tufjs/models (LICENSE-tufjs-models) ----
55
+
56
+ MIT License
57
+
58
+ Copyright (c) 2022 GitHub and the TUF Contributors
59
+
60
+ Permission is hereby granted, free of charge, to any person obtaining a copy
61
+ of this software and associated documentation files (the "Software"), to deal
62
+ in the Software without restriction, including without limitation the rights
63
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
64
+ copies of the Software, and to permit persons to whom the Software is
65
+ furnished to do so, subject to the following conditions:
66
+
67
+ The above copyright notice and this permission notice shall be included in all
68
+ copies or substantial portions of the Software.
69
+
70
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
71
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
72
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
73
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
74
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
75
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
76
+ SOFTWARE.
77
+
78
+
79
+ The Workers half (workers/) vendors the following software, each under the MIT License (workers/quickjs.mjs, workers/quickjs-wasm.mjs,
80
+ workers/quickjs.wasm and workers/quickjs-core.mjs). Every notice below is reproduced as its authors published it.
81
+
82
+ ---- @jitl/quickjs-asmjs-mjs-release-sync (@jitl/quickjs-asmjs-mjs-release-sync/LICENSE) ----
83
+
84
+ quickjs-emscripten:
85
+ The MIT License
86
+
87
+ quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
88
+
89
+ Permission is hereby granted, free of charge, to any person obtaining a copy
90
+ of this software and associated documentation files (the "Software"), to deal
91
+ in the Software without restriction, including without limitation the rights
92
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
93
+ copies of the Software, and to permit persons to whom the Software is
94
+ furnished to do so, subject to the following conditions:
95
+
96
+ The above copyright notice and this permission notice shall be included in all
97
+ copies or substantial portions of the Software.
98
+
99
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
100
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
101
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
102
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
103
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
104
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
105
+ SOFTWARE.
106
+
107
+
108
+ quickjs:
109
+ QuickJS Javascript Engine
110
+
111
+ Copyright (c) 2017-2021 Fabrice Bellard
112
+ Copyright (c) 2017-2021 Charlie Gordon
113
+
114
+ Permission is hereby granted, free of charge, to any person obtaining a copy
115
+ of this software and associated documentation files (the "Software"), to deal
116
+ in the Software without restriction, including without limitation the rights
117
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
118
+ copies of the Software, and to permit persons to whom the Software is
119
+ furnished to do so, subject to the following conditions:
120
+
121
+ The above copyright notice and this permission notice shall be included in
122
+ all copies or substantial portions of the Software.
123
+
124
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
125
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
126
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
127
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
128
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
129
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
130
+ THE SOFTWARE.
131
+
132
+ ---- @jitl/quickjs-wasmfile-release-sync (@jitl/quickjs-wasmfile-release-sync/LICENSE) ----
133
+
134
+ quickjs-emscripten:
135
+ The MIT License
136
+
137
+ quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
138
+
139
+ Permission is hereby granted, free of charge, to any person obtaining a copy
140
+ of this software and associated documentation files (the "Software"), to deal
141
+ in the Software without restriction, including without limitation the rights
142
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
143
+ copies of the Software, and to permit persons to whom the Software is
144
+ furnished to do so, subject to the following conditions:
145
+
146
+ The above copyright notice and this permission notice shall be included in all
147
+ copies or substantial portions of the Software.
148
+
149
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
150
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
151
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
152
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
153
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
154
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
155
+ SOFTWARE.
156
+
157
+
158
+ quickjs:
159
+ QuickJS Javascript Engine
160
+
161
+ Copyright (c) 2017-2021 Fabrice Bellard
162
+ Copyright (c) 2017-2021 Charlie Gordon
163
+
164
+ Permission is hereby granted, free of charge, to any person obtaining a copy
165
+ of this software and associated documentation files (the "Software"), to deal
166
+ in the Software without restriction, including without limitation the rights
167
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
168
+ copies of the Software, and to permit persons to whom the Software is
169
+ furnished to do so, subject to the following conditions:
170
+
171
+ The above copyright notice and this permission notice shall be included in
172
+ all copies or substantial portions of the Software.
173
+
174
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
175
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
176
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
177
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
178
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
179
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
180
+ THE SOFTWARE.
181
+
182
+ ---- quickjs-emscripten-core (quickjs-emscripten-core/LICENSE) ----
183
+
184
+ The MIT License
185
+
186
+ quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
187
+
188
+ Permission is hereby granted, free of charge, to any person obtaining a copy
189
+ of this software and associated documentation files (the "Software"), to deal
190
+ in the Software without restriction, including without limitation the rights
191
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
192
+ copies of the Software, and to permit persons to whom the Software is
193
+ furnished to do so, subject to the following conditions:
194
+
195
+ The above copyright notice and this permission notice shall be included in all
196
+ copies or substantial portions of the Software.
197
+
198
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
199
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
200
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
201
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
202
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
203
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
204
+ SOFTWARE.
205
+
206
+ ---- @jitl/quickjs-ffi-types (@jitl/quickjs-ffi-types/LICENSE) ----
207
+
208
+ The MIT License
209
+
210
+ quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
211
+
212
+ Permission is hereby granted, free of charge, to any person obtaining a copy
213
+ of this software and associated documentation files (the "Software"), to deal
214
+ in the Software without restriction, including without limitation the rights
215
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
216
+ copies of the Software, and to permit persons to whom the Software is
217
+ furnished to do so, subject to the following conditions:
218
+
219
+ The above copyright notice and this permission notice shall be included in all
220
+ copies or substantial portions of the Software.
221
+
222
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
223
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
224
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
225
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
226
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
227
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
228
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ var h=e=>typeof e=="string",j=e=>typeof e=="number",w=e=>typeof e=="object"&&e!==null,P=Object.hasOwn,U=Object.values,X=Object.entries,N=globalThis.crypto?.subtle,K=e=>w(e)&&!Array.isArray(e),te=e=>w(e)&&U(e).every(h),ie=e=>Array.isArray(e)&&e.every(h),L=e=>{if(!h(e)||!/^(?:[0-9a-fA-F]{2})*$/.test(e))throw 0;return Uint8Array.from(e.match(/../g)??[],t=>Number.parseInt(t,16))},Y=e=>Array.from(new Uint8Array(e),t=>t.toString(16).padStart(2,"0")).join(""),ce=e=>{let t=atob(e);if(btoa(t)!==e)throw 0;return Uint8Array.from(t,n=>n.charCodeAt(0))},ae=e=>{let t=/^-----BEGIN PUBLIC KEY-----([^-]*)-----END PUBLIC KEY-----\s*$/.exec(e);if(!t)throw 0;return ce(t[1].replace(/\s+/g,""))},D=e=>{if(h(e))return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;if(e===null||typeof e=="boolean"||Number.isInteger(e))return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(t=>D(t))}]`;if(w(e))return`{${Object.keys(e).sort().map(t=>`${D(t)}:${D(e[t])}`)}}`;throw 0},tt=new TextEncoder,G=e=>tt.encode(e),rt=new TextDecoder("utf-8",{ignoreBOM:!0}),q=e=>rt.decode(e),ot="301306072a8648ce3d020106082a8648ce3d030107",nt=e=>{let t=[...L(ot),3,e.length+1,0,...e];return Uint8Array.from([48,t.length,...t])},Ee=e=>{let t=2,n=()=>{let o=e[t+1];if(e[t]!==2||!(o>=1&&o<=33))throw 0;let s=e.subarray(t+2,t+=2+o);if(s.length!==o||s[0]&128||o>1&&s[0]===0&&!(s[1]&128)||o>32&&s[0])throw 0;o===33&&(s=s.subarray(1));let i=new Uint8Array(32);return i.set(s,32-s.length),i};if(e[0]!==48||e[1]!==e.length-2)throw 0;let r=new Uint8Array(64);if(r.set(n()),r.set(n(),32),t!==e.length)throw 0;return r},ke=65472,fe=1/0,Te=e=>{fe=e},ee="Ed25519",Me={name:"ECDSA",namedCurve:"P-256"},Ne={name:"ECDSA",hash:"SHA-256"},st="-----BEGIN PUBLIC KEY-----",Pe=async(e,t,n)=>{try{let r=e.keytype,o=e.keyval.public;if(!o)return!1;let s=o.startsWith(st),i=r==="ed25519";if(!i&&r!=="ecdsa"&&r!=="ecdsa-sha2-nistp256"||i&&!(t.byteLength<=fe))return!1;let a=await N.importKey(s||!i?"spki":"raw",s?ae(o):i?L(o):nt(L(o)),i?ee:Me,!1,["verify"]),d=L(n);return await N.verify(i?ee:Ne,a,i?d:Ee(d),t)}catch{}return!1},Ie=(e,t)=>N.importKey("spki",e,t==="ed25519"?ee:Me,!1,["verify"]),Ce=(e,t,n,r)=>t==="ed25519"?r.byteLength<=fe?N.verify(ee,e,ce(n),r):Promise.resolve(!1):N.verify(Ne,e,Ee(ce(n)),r),W=e=>N.digest("SHA-256",e);var ct=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/,Re=/^(>=|<=|>|<|=)?((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))$/;function le(e){if(typeof e!="string")return null;let t=ct.exec(e);return t?[t[1],t[2],t[3]]:null}function de(e,t){let n=le(e),r=le(t);if(n===null||r===null)return null;for(let o=0;o<3;o+=1){if(n[o].length!==r[o].length)return n[o].length<r[o].length?-1:1;if(n[o]!==r[o])return n[o]<r[o]?-1:1}return 0}function it(e){return typeof e!="string"?!1:e.trim()==="*"?!0:e.split("||").every(t=>{let n=t.trim().split(/\s+/);return n.length>0&&n.every(r=>Re.test(r))})}function De(e,t){return le(e)===null||!it(t)?!1:t.trim()==="*"?!0:t.split("||").some(n=>n.trim().split(/\s+/).every(r=>{let[,o="=",s]=Re.exec(r),i=de(e,s);return o===">="?i>=0:o==="<="?i<=0:o===">"?i>0:o==="<"?i<0:i===0}))}var V=1,$e=[25,27,28],at=864e5,ft=36e5,lt=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/,dt=/^keys\/policy(?:\.[A-Za-z0-9_-]+)?\.pub$/,ut=8,ht=4096,Ke=e=>{if(!h(e)||!lt.test(e))return null;let t=Date.parse(e);return Number.isFinite(t)?t:null},ue=async(e,t,n)=>{let[r,o]=he(e,t),s=await n(r,t.length);if(s.length!==t.length||Y(await W(s))!==o)throw 0;return s},he=(e,t)=>{let n=t.hashes?.sha256;if(!h(n)||!/^[0-9a-f]{64}$/.test(n))throw 0;let r=e.lastIndexOf("/")+1;return[`tuf/targets/${e.slice(0,r)}${n}.${e.slice(r)}`,n]},Le=async(e,t)=>{let n=[];for(let[r,o]of X(e))if(!(!dt.test(r)||n.length>=ut))try{if(!(o.length<=ht))continue;let s=ae(q(await ue(r,o,t)));n.push({id:`policy-${Y(await W(s)).slice(0,16)}`,der:s})}catch{}return n},yt=(e,t)=>{let n=new Map;for(let[r,o]of X(e)){let s=o?.custom;h(s?.version)&&s.lang===t&&n.set(s.version,r)}return n},je=async(e,t,n,r,o,s="browser")=>{if(!K(e)||!K(e.core)||!K(e.sig))return 20;let{core:i,sig:a}=e;if(!h(i.app_id)||!h(i.version)||!h(i.path)||!Number.isSafeInteger(i.policy_version)||i.policy_version<1||i.lang!==s||!i.path.startsWith(`cores/${s}/`))return 20;let d=Date.now();if(!Number.isFinite(d))return 21;let u=a.alg,E;if(u==="ed25519"||u==="ecdsa-sha2-nistp256"){let m=n.find(I=>I.id===a.kid);if(m)try{E=await Ie(m.der,u)}catch{}}if(E===void 0)return 22;let _=Ke(i.issued_at),O=Ke(i.expires_at);if(_===null||O===null)return 21;if(_>d+ft)return 23;if(!(_<O&&O-_<=at))return 24;if(O<=d)return 25;let k=!1;try{k=await Ce(E,u,a.value,G(D(i)))}catch{}if(!k)return 26;if(i.kill===!0)return V;if(o)return 0;if(yt(t.r,s).get(i.version)!==i.path)return 27;if(t.floor!==null){let m=de(i.version,t.floor);if(m===null||m<0)return 28}return De(r,t.r[i.path].custom.loader_range)?0:29};var Ue='{"signatures":[],"signed":{"_type":"root","spec_version":"1.0.31","version":1,"expires":"2027-10-01T06:22:29Z","keys":{"5e72cd36eb6c72ef583e5aa2bae8ba0c4230299ea62179c0debbe97cc6e3c35e":{"keytype":"ed25519","scheme":"ed25519","keyval":{"public":"d265f568e6b5c924d16425a60ed6c87cd321df67f4bcbf16634867951efc40cd"}},"23ba0b0e83579e420082424906be015c77e3556cae7ef45f5787b2758e9cfce6":{"keytype":"ed25519","scheme":"ed25519","keyval":{"public":"b4e4de94b9d24cdb0e2f51d2f70cb5f846ff81aa09f8e1acb63230d6bfabca61"}},"7130f842739e35810125cf4a4f86205dfbe21ff5f46ed429d9b3764105d12e1c":{"keytype":"ed25519","scheme":"ed25519","keyval":{"public":"7bc82db1ca5150674283fdf56a907cded5b884a98d9acfb22b3b9df95cf7d1e1"}},"1dfb2c9c63830ddefed029ff58fd43a1bfde2ca717a2726e378ca1d43efd8861":{"keytype":"ed25519","scheme":"ed25519","keyval":{"public":"babe345312a01b4d8eeab3e947b665ed7e82eb2e237b584ea11f8d8f1ad261ff"}}},"roles":{"root":{"keyids":["5e72cd36eb6c72ef583e5aa2bae8ba0c4230299ea62179c0debbe97cc6e3c35e"],"threshold":1},"targets":{"keyids":["23ba0b0e83579e420082424906be015c77e3556cae7ef45f5787b2758e9cfce6"],"threshold":1},"snapshot":{"keyids":["7130f842739e35810125cf4a4f86205dfbe21ff5f46ed429d9b3764105d12e1c"],"threshold":1},"timestamp":{"keyids":["1dfb2c9c63830ddefed029ff58fd43a1bfde2ca717a2726e378ca1d43efd8861"],"threshold":1}},"consistent_snapshot":true}}';var $=10,z=11,Be=12,He=13,re=14,pt=256,mt=65536,bt=16384,gt=262144,wt=524288,Ye=["root","targets","snapshot","timestamp"],Fe=e=>j(e.version)&&e.version>0&&(e.length===void 0||j(e.length)&&e.length>=0)&&(e.hashes===void 0||te(e.hashes)),ye=(e,t)=>{try{let n=JSON.parse(e),r=n.signed,o=n.signatures;if(!w(r)||r._type!==t||!Array.isArray(o)||!o.every(w)||!h(r.spec_version)||!h(r.expires)||!j(r.version))throw 0;let s=(r.spec_version||"1.0.31").split(".");if(s.length<2||s.length>3||s.some(a=>isNaN(a))||s[0]!=="1")throw 0;if(t==="root"){if(typeof r.consistent_snapshot!="boolean")throw 0;let{keys:a,roles:d}=r;if(a!==void 0&&!(w(a)&&!Array.isArray(a)&&U(a).every(u=>h(u.keytype)&&h(u.scheme)&&te(u.keyval)))||d!==void 0&&!(w(d)&&U(d).every(u=>ie(u.keyids)&&j(u.threshold)&&new Set(u.keyids).size===u.keyids.length&&u.threshold>=1)&&Ye.every(u=>P(d,u))))throw 0}else if(t==="timestamp"){if(r.meta!==void 0&&!Fe(r.meta["snapshot.json"]))throw 0}else if(t==="snapshot"){if(r.meta!==void 0&&!(w(r.meta)&&!Array.isArray(r.meta)&&U(r.meta).every(Fe)))throw 0}else if(r.targets!==void 0&&!(w(r.targets)&&U(r.targets).every(a=>j(a.length)&&a.length>=0&&te(a.hashes)))||r.delegations!==void 0&&!w(r.delegations))throw 0;let i={};for(let a of o){if(!h(a.keyid)||!h(a.sig)||i[a.keyid])throw 0;i[a.keyid]=a.sig}return{o:r,i}}catch{throw re}},pe=async(e,t,n)=>{let{keys:r,roles:o}=n.o,{keyids:s,threshold:i}=o===void 0?{keyids:[],threshold:1}:o[t],a;try{a=G(D(e.o))}catch{throw Be}let d=0;for(let u of s)r!==void 0&&P(r,u)&&e.i[u]&&await Pe(r[u],a,e.i[u])&&(d+=1);if(d<i)throw Be},_t=async(e,t)=>{if(e.length!==void 0&&t.length!==e.length)throw He;for(let[n,r]of X(e.hashes??{}))if(n!=="sha256"||Y(await W(t))!==r)throw He},Ge=(e,t,n)=>{let r=w(e)&&e.v===1&&w(e.f)?e.f:null;return async(o,s,i)=>{if(r!==null&&!i){let a=P(r,o)&&h(r[o])?G(r[o]):null;if(a!==null&&a.length<=s)return n(),a;let d=/^tuf\/metadata\/(\d+)\.root\.json$/.exec(o);if(d!==null&&Number.isSafeInteger(e.end)&&Number(d[1])>e.end)throw n(),204}return t(o,s,i)}},At=(e,t)=>e.length?Math.min(e.length,t):t,qe=["snapshot","timestamp"],xt=e=>w(e)&&Ye.every(t=>Number.isSafeInteger(e[t])&&e[t]>=0)&&qe.every(t=>ie(e.keyids?.[t]))?e:null,Xe=(e,t)=>String([...e].sort())===String([...t].sort()),We=async(e,t,n)=>{let r=Date.now(),o=f=>r>=new Date(f.expires);if(!h(e))throw re;let s=ye(e,"root");for(let f=0;f<pt;f+=1){let y=s.o.version+1,b;try{b=await n(`tuf/metadata/${y}.root.json`,mt)}catch(A){if(A===404||A===204)break;throw A}let x=ye(q(b),"root");if(await pe(x,"root",s),x.o.version!==y)throw $;await pe(x,"root",x),s=x}let i=s.o.version,a=f=>s.o.roles===void 0?[]:s.o.roles[f].keyids,d=xt(t),u=0,E=0,_=0;if(d!==null){if(i<d.root)throw $;u=d.timestamp,E=d.snapshot,_=d.targets,i>d.root&&!(Xe(a("timestamp"),d.keyids.timestamp)&&Xe(a("snapshot"),d.keyids.snapshot))&&(u=E=_=0)}let O=async(f,y,b,x)=>{let A=await n(`tuf/metadata/${y?`${y.version}.`:""}${f}.json`,y?At(y,b):b,x);if(y)await _t(y,A);else if(o(s.o))throw z;let v=ye(q(A),f);return await pe(v,f,s),v},k=async(f,y,b,x)=>{let A=async v=>x(await O(f,y,b,v));try{return await A()}catch(v){if(y||v!==$&&v!==z||o(s.o))throw v;return A(!0)}},[m,I]=await k("timestamp",null,bt,f=>{let y=f.o.meta===void 0?{version:1}:f.o.meta["snapshot.json"];if(f.o.version<u||y.version<E)throw $;if(o(f.o))throw z;return[f,y]}),[J,H]=await k("snapshot",I,gt,f=>{let y=f.o.meta===void 0?{"targets.json":{version:1}}:f.o.meta,b=P(y,"targets.json")?y["targets.json"]:void 0;if(_>0){if(b===void 0)throw re;if(b.version<_)throw $}if(o(f.o))throw z;if(f.o.version!==I.version)throw $;if(b===void 0)throw re;return[f,b]}),C=await k("targets",H,wt,f=>{if(f.o.version!==H.version)throw $;if(o(f.o))throw z;return f}),T=C.o.custom?.min_core_version_browser;return{r:C.o.targets??{},floor:h(T)?T:null,u:{root:i,timestamp:m.o.version,snapshot:J.o.version,targets:C.o.version,keyids:Object.fromEntries(qe.map(f=>[f,a(f)]))}}};Te(ke);var Ve="oloy_b_tuf",vt=16,St=8,Ot=16777216,Et=16777216,kt=3e5,Tt=1e3,Mt=[["core_bytes",Ot,1024,33554432],["artifacts",St,0,64],["artifact_bytes",Et,0,33554432],["attached",vt,1,256]],ze=e=>{let t={};for(let[n,r,o,s]of Mt){let i=K(e)&&P(e,n)?e[n]:void 0;t[n]=Number.isSafeInteger(i)?Math.min(s,Math.max(o,i)):r}return t},Nt=864e5,Pt=Object.freeze(["q","b","state","run","bytes","check","e"]),B=()=>{},Je=(e,t)=>{let n;return Promise.race([e,new Promise((r,o)=>n=setTimeout(o,t,0))]).finally(()=>clearTimeout(n))},It=8,Ct=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},qt=async(e,t,n,r,o,s,i,a,d,u)=>{try{if(!N){o(t,"?");return}if(t??(t=await n()),t?.s!=="on")return;let E=s(),_=null;try{_=JSON.parse(localStorage.getItem(Ve))}catch{}let O=0,k=Ge(t.tuf,r,()=>O=1),m,I,J=c=>Je((async()=>{m=await We(Ue,_,c),Ct(Ve,JSON.stringify(_=m.u)),I=await Le(m.r,c)})(),d("get",10)*It),H=c=>{if(!O||c===0)throw c;return O=0,J(r)};await J(k).catch(H);let C=async(c,l)=>{let p=S=>S.s==="on"?je(S.d,m,I,u,l):V,g=await p(c);if($e.includes(g)){let S=await n(!0,!0);if(S)g=await p(c=S);else if(l)return[c,0,1]}return[c,g]},T;if([t,T]=await C(t),T===22&&O&&(await H(),[t,T]=await C(t)),T!==0){o(t,T===V?"off":"?");return}let f,y=ze(null),b,x=c=>{let l=c?.check_every_ms;f=Number.isSafeInteger(l)?Math.min(Nt,Math.max(Tt,l)):kt,y=ze(c),a(c,f)};x(t.d.core.limits);let A=t.d.core.path,v=m.r[A];if(!(v.length<=y.core_bytes))throw 0;let Z=[],M=!1,oe=null,me=0,be=0,F,ne=null,se=(c,l,p=E)=>{let[g,S]=he(c,l),Q=p+g,R=document.createElement("script");Q.startsWith(`${location.origin}/`)||(R.crossOrigin="anonymous"),R.referrerPolicy="no-referrer",R.integrity=`sha256-${btoa(String.fromCharCode(...L(S)))}`,l.custom?.exec==="module"&&(R.type="module");let Se=document.querySelector("script[nonce]")?.nonce;if(Se&&(R.nonce=Se),F===void 0){F=null;try{F=globalThis.trustedTypes?.createPolicy("oloy-b",{createScriptURL:Oe=>{if(Oe!==ne)throw 0;return Oe}})??null}catch{}}ne=Q;try{R.src=F?F.createScriptURL(Q):Q}finally{ne=null}return R},ge=c=>new Promise((l,p)=>{let g=setTimeout(()=>{p(1),c.remove()},d("get",10));c.onload=()=>(clearTimeout(g),l()),c.onerror=()=>(clearTimeout(g),p(0)),(document.head??document.documentElement).appendChild(c)}),we=(c,l,p=se(c,l))=>ge(p).catch(g=>{let S=i();if(g||!S||M)throw g;return ge(se(c,l,S))}),_e=()=>{let c=e.q;c.c=B;for(let[,,l]of c.l.splice(0))l()},Ze=()=>{e.stop(),e.q.c===null&&_e()},Ae=()=>{if(!M){M=!0;try{e.stop(),_e()}catch{}for(let[c,l]of Z.reverse())try{Promise.resolve(l.call(c)).catch(B)}catch{}Z.length=0}},xe=()=>{clearTimeout(b),M||(b=setTimeout(e.check,f))},ve=c=>{let l=!M&&h(c)&&P(m.r,c)?m.r[c]:null,p=l?.custom;if(l===null||me>=y.artifacts||be+l.length>y.artifact_bytes||K(p)&&h(p.version)&&p.lang!=="browser")throw 0;return me+=1,be+=l.length,l},Qe=se(A,v),{tuf:Rt,...et}=t;t=et,Object.freeze(Object.assign(e,{loader:u,prefix:E,caps:Pt,state:t,claim(c){try{let l=e.q;if(typeof c=="function"&&l.c===null){l.c=c;for(let[p,g,S]of l.l.splice(0))Promise.resolve().then(()=>c(p,g)).catch(B).then(S);return!0}}catch{}return!1},attach(c){try{let l=c.version,p=c.teardown;if(h(l)&&typeof p=="function"){if(!M&&Z.length<y.attached)return Z.push([c,p]),!0;Promise.resolve(p.call(c)).catch(B)}}catch{}return!1},async check(){M||await(oe??(oe=Je((async()=>{let c=await n(!0);if(c===null||M)return;let[l,p,g]=await C(c,!0);if(p===0)return g||l.s==="on"&&x(l.d.core.limits);Ae(),l.s==="on"&&p!==22&&o(l,p===V?"off":"?")})(),d("get",10)*2).catch(B).then(()=>{oe=null,xe()})))},bytes:c=>(async()=>ue(c,ve(c),r))(),run:c=>(async()=>we(c,ve(c)))()})),xe(),we(A,v,Qe).then(Ze,()=>(Ae(),o(t,"?"))).catch(B)}catch{o(t,"?")}};export{qt as go};
@@ -0,0 +1 @@
1
+ var it="/_oloy/b/v1/";var V=async(o,s,t,r=1e4,y)=>{let h,g,d,S;try{if(h=AbortSignal.timeout(r),y){let u=new AbortController;h.onabort=y.a=()=>u.abort(),h=u.signal}g=await fetch(t?`${o}${o.includes("?")?"&":"?"}r=${Math.random().toString(36).slice(2)}`:o,{credentials:"omit",redirect:"manual",priority:"low",referrerPolicy:"no-referrer",signal:h,...t&&{cache:"no-store"}}),d=g.status,S=g.body}catch{throw h?.aborted?2:1}if(d!==200){try{S?.cancel().catch(()=>{})}catch{}throw typeof d!="number"?1:g.type==="opaqueredirect"||d>=300&&d<400?3:d>=100&&d<=599?d:1}let D=[],P=0;try{let u=S.getReader();for(;;){let{done:$,value:p}=await u.read();if($)break;if(P+=p.byteLength,P>s)throw u.cancel().catch(()=>{}),4;D.push(p)}return new Uint8Array(await new Blob(D).arrayBuffer())}catch(u){throw u===4?4:h?.aborted?2:1}};var K="0.1.5";var H="oloy_b",Tt=60,lt=86400,wt=262144,bt=2097152,Et=1,At=60,U=[3,7],Q=2e3,ht=6e4,dt=3e5,Mt=1e3,St=864e5,z=Symbol.for("oloy.b.v1"),Ot=16,It=17,Dt=/^[^]{1,64}$/,Pt=/^[\w$]{1,32}(?:\.[\w$]{1,32}){0,3}$/,B=["pageshow","beforeunload","pagehide"],Rt=64,Lt=16384,xt=256,ut=8e3,Nt=6e5,pt=ut,I=Q,M=dt,J=(o,s,t,r)=>Number.isSafeInteger(o)?Math.min(r,Math.max(t,o)):s,vt=(o,s)=>{try{pt=J(o?.wait_ms,ut,0,Nt),I=J(o?.hedge_ms,Q,0,ht),M=s;let t=JSON.parse(sessionStorage.getItem(H));(t.h!==I||t.c!==M)&&sessionStorage.setItem(H,JSON.stringify({...t,h:I,c:M}))}catch{}},$t=/^\/app_[\w-]+$/,v=()=>{},F=o=>typeof o=="object"&&o!==null,at=(o,s,t,r)=>typeof o=="number"?Math.min(r,Math.max(t,o)):s,ft=o=>{let s=[];try{for(let t of Array.isArray(o)?o.slice(0,Ot):[])Array.isArray(t)&&t.length>0&&t.length<=It&&t.every((r,y)=>typeof r=="string"&&(y?Pt:Dt).test(r))&&!s.some(([r])=>r===t[0])&&s.push([...t])}catch{}return s},Ct=(o,s)=>{let t=o;for(let r of s.split("."))t=F(t)?t[r]:void 0;return typeof t=="string"?t.slice(0,1024):typeof t=="number"||typeof t=="boolean"?t:""},T=null,W=v;function Xt(o){try{let s=new URL(o),{protocol:t}=s;!T&&$t.test(s.href.slice(s.origin.length))&&t==="https:"&&(T=`${s.origin}/b/v1${s.pathname}/`)}catch{}W()}Xt.cmd=(o,...s)=>new Promise(t=>{try{let{c:r,l:y}=globalThis[z].q,h=setTimeout(t,pt),g=d=>(clearTimeout(h),t(d));r?Promise.resolve().then(()=>r(o,s)).catch(v).then(g):y.push([o,s,g])>xt&&y.shift()[2]()}catch{t()}});if(typeof document<"u")try{if(globalThis[z]===void 0){let o={c:null,l:[]},s=[],t=[],r=new Set,y=!1,h=0,g=!1,d=e=>{try{let{type:_}=e;_===B[0]?g=!1:B.includes(_)&&(g=!0);let L=t.find(([w])=>w===_);if(!L)return;let E=[Date.now(),_,...L.slice(1).map(w=>Ct(e,w))];for(h+=JSON.stringify(E).length,s.push(E);s.length>Rt||h>Lt;)h-=JSON.stringify(s.shift()).length}catch{}},S=e=>r.has(e)||(r.add(e),addEventListener(e,d,!0)),D=e=>{if(!y&&!t[0])for(let _ of e)t.push(_),S(_[0])},P=()=>{y=!0;for(let e of r)removeEventListener(e,d,!0);r.clear(),s.length=h=0},u=()=>{P(),o.c=v;for(let[,,e]of o.l.splice(0))e()},$={q:o,b:s,e:t,stop:P};Object.defineProperty(globalThis,z,{value:$});let p=location.origin+it,R=p,Z=()=>{try{let e=null;try{e=JSON.parse(sessionStorage.getItem(H))}catch{}F(e)&&["on","off","?"].includes(e.s)&&typeof e.t=="number"||(e=null);let _=e===null||!(Date.now()<e.t&&e.t-Date.now()<=lt*1e3),L=e===null?"now":e.w,E=e?.k;I=J(e?.h,Q,0,ht),M=J(e?.c,dt,Mt,St);let w=e?.f<=Date.now()?+e.f:void 0,C=e?.n<=Date.now()?+e.n:void 0,q=T&&Date.now()<w+M,gt=T&&Date.now()<C+M,tt,O=(n,c)=>at(E?.[n],c,Et,At)*1e3,yt=(n,c,i)=>at(n?.ttl?.[c],i,Tt,lt),et=(n,c)=>{let i=c==="on"?ft(n.e):[];if(c!=="on"?u():D(i),c==="?"&&g)return;let l=c==="?",a=n?n.start:L;try{sessionStorage.setItem(H,JSON.stringify({s:c,t:Date.now()+yt(n,l?"err":c,l?600:3600)*1e3,w:a==="now"?"now":"idle",k:E,e:i[0]&&i,h:I,c:M,f:w,n:C}))}catch{}},X=(n,c,i,l,a,m=n||tt===l?"state.json":"start.json")=>V(`${l+m}?v=${K}`,m==="state.json"?wt:bt,c,O("get",10),a).then(f=>(l===p&&(C=void 0),JSON.parse(new TextDecoder().decode(f)))).then(void 0,f=>(f===404&&(tt=l,l===p&&m==="state.json"&&(C=Date.now())),f===1||f===2||f===429?0:null)).then(f=>{if(a.x)return[];if(E=f?.t??E,!c&&f?.x<=Date.now())return X(n,1,i,l,a,m);let A=f?.s==="on"&&F(f.d)?"on":f?.s==="off"?"off":"?";return A==="?"&&f!==0&&m!=="state.json"?X(n,c,i,l,a,"state.json"):A==="?"&&i>0?new Promise(k=>setTimeout(k,O("retry",U[U.length-i]))).then(()=>a.x?[]:X(n,c,i-1,l,a)):[f,A]}),nt=(n,c)=>new Promise((i,l)=>{let a=[],m=0,f,A,k=()=>f||gt||A||(A=1,x(p,U.length)),x=(N,_t)=>{let j={};a.push(j),m+=1,X(n,c,_t,N,j).then(([rt,b])=>{if(!j.x){if(m-=1,!n&&b==="?"&&N===T&&k(),!n&&b==="?"&&q&&N===p)return x(T,0);if(!(b==="?"&&m)){f=1;for(let G of a)G!==j&&(G.x=1,G.a?.());n||(w=b!=="?"&&N===p?a[1]?Date.now():w:void 0),b!=="?"&&(R=N),n&&b==="?"||et(rt,b),i(b==="?"?null:rt)}}}).catch(l)};n?x(R,0):!T||q?(A=1,x(p,U.length)):(x(T,0),setTimeout(k,I))}),Y=(n,c)=>{let i=()=>Promise.resolve().then(c).catch(u);if(n)i();else{let l=!0,a=()=>l&&(l=!1,globalThis.requestIdleCallback?requestIdleCallback(i,{timeout:2e3}):setTimeout(i,1));document.readyState==="complete"?a():(addEventListener("load",a,{once:!0}),setTimeout(a,O("wait",10)))}},ot,st=()=>ot??(ot=Promise.race([import("./channel.js"),new Promise((n,c)=>setTimeout(c,O("get",10)))])),ct=n=>st().then(c=>c.go($,n,nt,(i,l,a)=>V(R+i,l,a,O("get",10)),et,()=>R,()=>R===p?T:p,vt,O,K));if(!_&&e.s!=="on")return u();for(let n of B)S(n);D(ft(e?.e)),_?Y(L==="now",()=>(st().catch(v),nt().then(n=>{n?.s==="on"&&Y(n.start==="now",()=>ct(n))}))):Y(e.w==="now",()=>ct(null))}catch{u()}};W=()=>{W=v;try{document.prerendering?document.addEventListener("prerenderingchange",Z,{once:!0}):Z()}catch{u()}}}}catch{}export{Xt as oloy};
@@ -0,0 +1,7 @@
1
+ /** Connects this page to oloy with the app's client DSN. Never throws. */
2
+ export declare function oloy(dsn: string): void;
3
+
4
+ export declare namespace oloy {
5
+ /** Hands `command` to oloy. Resolves its answer, or `undefined`; never rejects. */
6
+ function cmd(command: string, ...args: unknown[]): Promise<unknown>;
7
+ }
@@ -0,0 +1 @@
1
+ function e(){}e.cmd=()=>Promise.resolve(void 0);export{e as oloy};
package/dist/bare.mjs ADDED
File without changes
package/dist/host.mjs ADDED
@@ -0,0 +1 @@
1
+ var g=()=>globalThis[Symbol.for("@vercel/request-context")],A=()=>g()?.get?.(),P=()=>typeof g()?.get=="function",[O,v,k]="next/dist/server".split("/"),w="async-storage.external.js",R=new RegExp(`${w.split(".").join("\\.")}$`),D=/^-[0-9a-f]{16}$/,m=1e3,T=2*m,x="module_cache_absent",M="store_module_absent",I="storage_not_single",N="two_stores_held",C=t=>t===O||t.startsWith(O)&&D.test(t.slice(O.length));function _(t){for(let n=1;n<t.length-1;n+=1)if(t[n]===v&&C(t[n-1]))return t.slice(n+1);return null}function y(t){return typeof t!="string"||!R.test(t)?!1:_(t.split(/[\\/]/))!==null}function F(t){return _(t.split(/[\\/]/))?.[0]===k}function W(t){try{let n=t?.Module??t?.default?.Module??t?.default??null;return n!==null&&(typeof n=="function"||typeof n=="object")?n:null}catch{return null}}function L(t){let n=null;for(let r of Object.values(t??{}))if(typeof r?.getStore=="function"){if(n!==null&&n!==r)return null;n=r}return n}function q(t,n){let r=[],u=new Set,i=-1/0,d=null,c=()=>u.size>0||performance.now()-i>=m,l=()=>{i=performance.now();let o=t?._cache;if(o===null||typeof o!="object"){n(x);return}for(let e=r.length-1;e>=0;e-=1)o[r[e].path]!==r[e].f&&r.splice(e,1);for(let e of Object.keys(o)){let s=o[e];if(!y(e)||!s?.loaded||r.some(p=>p.f===s))continue;let a=L(s.exports);a===null&&n(I),r.push({path:e,f:s,v:a})}for(let e of u)(o[e]?.loaded||!(e in o))&&u.delete(e);r.length>0||!Object.keys(o).some(F)||(d??=i,i-d>=T&&n(M))},f=()=>{let o=null;for(let e of r){if(e.v===null)continue;let s=e.v.getStore(),a=s?.headers;if(!(a===null||typeof a!="object"||s===o)){if(o!==null)return n(N),null;o=s}}return o};return{mark(){try{if(r.length===0){if(!c())return null;l()}let o=f();if(o===null&&c()){let s=r.length;l(),r.length>s&&(o=f())}let e=o?.headers;return e!==null&&typeof e=="object"?{headers:e}:null}catch{return null}},loaded(o,e){y(e)&&u.add(e)}}}var z=/[\\/]compiled[\\/]next-server[\\/](?:app-page|app-route|pages-api|pages)(?:-[a-z]+)*\.runtime\.(?:prod|dev)\.js$/,H="compiled",G=6,j=Object.freeze({name:"prepare",req:Object.freeze([0]),res:Object.freeze([1]),via:"next_prepare",decides:!0}),S=Object.freeze({name:"handleResponse",req:Object.freeze([0,"req"]),res:Object.freeze([0,"req","socket","_httpMessage"]),via:"next_handle_response",decides:!0}),h=Object.freeze({name:"render",req:Object.freeze([0]),res:Object.freeze([1]),via:"next_pages",decides:!0}),b=(t,n)=>Object.hasOwn(t,n)&&typeof Object.getOwnPropertyDescriptor(t,n).value=="function";function E(t){return typeof t!="string"||!z.test(t)?!1:_(t.split(/[\\/]/))?.[0]===H}function U(t){let n=new WeakSet,r=new WeakSet,u=c=>{let l=[],f=!1;for(let o of Object.values(c??{})){if(typeof o!="function")continue;let e=Object.getOwnPropertyDescriptor(o,"prototype")?.value;if(e===null||typeof e!="object")continue;let s=e;for(let a=0;a<G&&s!==null&&s!==Object.prototype;a+=1){if(b(s,j.name)&&b(s,S.name)){f=!0,r.has(s)||(r.add(s),l.push(Object.freeze({holder:s,...j}),Object.freeze({holder:s,...S}))),a===1&&!r.has(e)&&b(e,h.name)&&Object.getOwnPropertyNames(e).every(p=>p==="constructor"||p===h.name)&&(r.add(e),l.push(Object.freeze({holder:e,...h})));break}s=Object.getPrototypeOf(s)}}return{found:l,base:f}},i=(c,l)=>{try{if(!E(l)||c===null||typeof c!="object"&&typeof c!="function"||n.has(c))return{found:[],missed:0};n.add(c);let{found:f,base:o}=u(c);return{found:f,missed:o?0:1}}catch{return{found:[],missed:0}}};return{scan:()=>{let c={found:[],missed:0};try{let l=t?._cache;if(l===null||typeof l!="object")return c;for(let f of Object.keys(l)){let o=l[f];if(!o?.loaded||!E(f))continue;let e=i(o.exports,f);c.found.push(...e.found),c.missed+=e.missed}}catch{}return c},at:i}}function $(t,n=()=>null){let r=!1,u=null,i=()=>{if(!(r||u===null))try{let e=n();if(typeof e?.note!="function")return;r=!0,e.note("next_store_unseen",u,!0)}catch{}},c=q(t,e=>{u===null&&(u=e),i()}),l=()=>(i(),c.mark()),f=U(t),o=Object.freeze({files:z,scan:f.scan,of:f.at});return Object.freeze({record:A,records:P,mark:l,loads:Object.freeze([Object.freeze([R,c.loaded])]),seams:o})}export{$ as hostOf,W as moduleOf};