@goosetools/goose-tools 0.0.0-stage → 0.1.0

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.
Files changed (54) hide show
  1. package/README.md +98 -2
  2. package/bin/goose-tools.js +61 -0
  3. package/lib/check/src/agent.js +90 -0
  4. package/lib/check/src/analyze.js +311 -0
  5. package/lib/check/src/client.js +136 -0
  6. package/lib/check/src/copy.js +355 -0
  7. package/lib/check/src/fixes.js +153 -0
  8. package/lib/check/src/frame.js +92 -0
  9. package/lib/check/src/guard.js +441 -0
  10. package/lib/check/src/index.js +18 -0
  11. package/lib/check/src/mcp-http.js +169 -0
  12. package/lib/check/src/mcp.js +153 -0
  13. package/lib/check/src/scan.js +55 -0
  14. package/lib/check/src/stack.js +61 -0
  15. package/lib/check/src/tlds.js +3 -0
  16. package/lib/check/src/view.js +130 -0
  17. package/lib/check/src/worker.js +257 -0
  18. package/lib/engine/src/bots.js +146 -0
  19. package/lib/engine/src/directives.js +131 -0
  20. package/lib/engine/src/exposure.js +70 -0
  21. package/lib/engine/src/frontend.js +157 -0
  22. package/lib/engine/src/headers.js +76 -0
  23. package/lib/engine/src/hidden-text.js +425 -0
  24. package/lib/engine/src/html.js +794 -0
  25. package/lib/engine/src/index.js +20 -0
  26. package/lib/engine/src/php.js +316 -0
  27. package/lib/engine/src/policies.js +234 -0
  28. package/lib/engine/src/reach.js +199 -0
  29. package/lib/engine/src/robots.js +275 -0
  30. package/lib/engine/src/secrets.js +142 -0
  31. package/lib/engine/src/signals.js +144 -0
  32. package/lib/rules/data/bots.json.js +1 -0
  33. package/lib/rules/data/exposure.json.js +1 -0
  34. package/lib/rules/data/frontend.json.js +1 -0
  35. package/lib/rules/data/headers.json.js +1 -0
  36. package/lib/rules/data/secrets.json.js +1 -0
  37. package/lib/ui/LICENSE-Inter.txt +93 -0
  38. package/lib/ui/assets.js +5 -0
  39. package/package.json +37 -4
  40. package/src/local.js +61 -0
  41. package/src/mcp.js +61 -0
  42. package/src/setup.js +395 -0
  43. package/src/site/auth.js +287 -0
  44. package/src/site/beacon.js +462 -0
  45. package/src/site/collect.js +484 -0
  46. package/src/site/handler.js +405 -0
  47. package/src/site/index.js +88 -0
  48. package/src/site/limits.js +48 -0
  49. package/src/site/pages.js +75 -0
  50. package/src/site/qr.js +318 -0
  51. package/src/site/reports.js +1117 -0
  52. package/src/site/source.js +68 -0
  53. package/src/site/store-pg.js +225 -0
  54. package/src/site/store.js +249 -0
@@ -0,0 +1,462 @@
1
+ // The page script, served by the package at /_gt/s.js (same origin as the site) and posting to /_gt/e.
2
+ //
3
+ // One script for what the WordPress plugin does with two: visitor insights (goose-tools/assets/insights.js) and
4
+ // Speed check (goose-tools/assets/speed.js). It sends one beacon per page view, when the page is first hidden, with
5
+ // both scripts' fields:
6
+ // - insights.js: p (path), r (path of the page on this site that linked here) or h (host of another site),
7
+ // s (utm_source, at most 64 characters), d (screen class m, t or d from the viewport width);
8
+ // - speed.js: l (LCP, ms), e (LCP element type), i (INP, ms), c (CLS, thousandths), t (TTFB, ms), and k (page kind,
9
+ // from an optional data-kind attribute on the script tag; the server picks one when it is missing);
10
+ // - attribution (spec/standalone-deep-dives.md, with the speed fields): a (1 when the browser names scripts, Chrome and
11
+ // Edge), s[] (the 6 scripts with the most time in long frames, "<ms> <address>"), x[] (the 3 with the most time in
12
+ // the tap or click that set INP), f[] (the 6 files or hosts that took the most time before LCP), q[] (the 6 data
13
+ // call addresses with the most time, "<ms> <calls> <address>"). The Pro plugin's speed-attribution.js names scripts
14
+ // the same way. Addresses: a path on this site, //host elsewhere (//host/path for data calls), 'inline' for
15
+ // code in the page itself, 'html' for waiting on the page's HTML. Never a query string or hash. Data call paths have
16
+ // each part with a digit (other than a version such as v1 or v2.1), an @ or over 16 characters replaced by :id.
17
+ // Hosts the server would refuse (IPv6, underscores, a trailing dot, over 100 characters) are left out. When the
18
+ // beacon would pass 4,000 characters, the last attribution entries are left out, so the view itself always fits.
19
+ //
20
+ // Differences from the plugin's scripts, because the package runs on sites that are not WordPress:
21
+ // - The view is sent when the page is first hidden (spec/standalone.md section 4), not when it is shown as
22
+ // insights.js does. A view counts only if the page was shown at some point, as insights.js waits for that.
23
+ // - In-page navigation (history.pushState, history.replaceState, popstate) to another path ends the view: it is sent,
24
+ // and a new view starts with the previous path as its same-site referrer, as a link would give. A change of query
25
+ // string or hash only is not a new page: routers call replaceState for those, and on load.
26
+ // - Speed fields are sent only for the first view of a page load. LCP and TTFB are defined for a document load only,
27
+ // so a view after in-page navigation has none, and INP and CLS are kept with that first view as speed.js does.
28
+ // - Speed fields are left out when the page did not answer 200 (the plugin measures only pages that answered 200,
29
+ // Speed\Kinds::recordable()), where the browser reports the status (responseStatus).
30
+ // - No WordPress pieces: no signed-in body class (the server drops the owner's own views by the dashboard's session
31
+ // cookie name instead, see collect.js), no multisite ID (b), no extension hooks (f, goosesecSpeedExtra).
32
+ //
33
+ // Kept from the plugin's scripts: automated browsers (navigator.webdriver) are skipped; a prerendered or background
34
+ // page counts only once it is shown; a page restored from the back-forward cache is a new view. Never read or sent:
35
+ // cookies, storage, identifiers, form contents, element text, query strings other than utm_source, the user agent.
36
+ //
37
+ // Global Privacy Control (navigator.globalPrivacyControl): this script stores nothing on the device, with or without
38
+ // it. It sends counts only, with no identifier, so there is nothing to opt out of on the device.
39
+ //
40
+ // Fails open: the whole script and every handler it adds are wrapped, so a missing API or an error never reaches the
41
+ // page. Wrapped history methods call the page's own method first and return its result unchanged.
42
+
43
+ export const BEACON_JS = `/*
44
+ * Goose Tools: one count per page view, sent when the page is first hidden, with its speed on the first view of a
45
+ * page load. Specs: LCP https://w3c.github.io/largest-contentful-paint/ ; INP https://w3c.github.io/event-timing/ and
46
+ * https://web.dev/articles/inp (longest interaction, one ignored per 50) ; CLS https://wicg.github.io/layout-instability/
47
+ * and https://web.dev/articles/cls (largest session window: gaps under 1 s, at most 5 s) ; TTFB
48
+ * https://w3c.github.io/navigation-timing/ . Never reads or sends cookies, storage, identifiers, form contents, element
49
+ * text, query strings other than utm_source, or the user agent. Stores nothing on the device.
50
+ */
51
+ try {
52
+ ( function ( w, d, n ) {
53
+ var U = w.URLSearchParams;
54
+ var loc = w.location;
55
+ if ( n.webdriver || ! U || ! loc ) {
56
+ return;
57
+ }
58
+ var E = '/_gt/e';
59
+ var perf = w.performance;
60
+ var P = w.PerformanceObserver;
61
+ var me = d.currentScript;
62
+ var kind = ( me && me.dataset && me.dataset.kind ) || '';
63
+ var nav = perf && perf.getEntriesByType ? perf.getEntriesByType( 'navigation' )[ 0 ] : null;
64
+ var act = ( nav && nav.activationStart ) || 0;
65
+ var late = ! d.prerendering && d.visibilityState === 'hidden'; // Opened in the background: LCP would count time nobody saw.
66
+ var bad = nav && typeof nav.responseStatus === 'number' && nav.responseStatus > 0 && nav.responseStatus !== 200;
67
+ var lcp, cls = -1, win = 0, first = 0, last = 0, ints = {}, view;
68
+ var page = loc.origin + loc.pathname, frames = [], files = [], named = false, seen = {};
69
+
70
+ function safe( fn ) {
71
+ return function ( e ) {
72
+ try {
73
+ fn( e );
74
+ } catch ( x ) {}
75
+ };
76
+ }
77
+ function on( t, type, fn, o ) {
78
+ if ( t && t.addEventListener ) {
79
+ t.addEventListener( type, safe( fn ), o );
80
+ }
81
+ }
82
+ function visible() {
83
+ return ! d.prerendering && d.visibilityState !== 'hidden';
84
+ }
85
+ function tag() {
86
+ var s = new U( loc.search ).get( 'utm_source' );
87
+ return s ? s.slice( 0, 64 ) : '';
88
+ }
89
+ // A view: its path, referrer (r, a path of this site, or h, another site's host), tag, and whether it was shown.
90
+ function begin( r, h, s, hard ) {
91
+ view = { p: loc.pathname, r: r, h: h, s: s, hard: hard, shown: visible(), sent: 0 };
92
+ }
93
+ function landed( hard ) {
94
+ var r = '', h = '', u;
95
+ try {
96
+ if ( d.referrer ) {
97
+ u = new URL( d.referrer );
98
+ if ( u.host === loc.host ) {
99
+ r = u.pathname;
100
+ } else if ( u.hostname ) {
101
+ h = u.hostname;
102
+ }
103
+ }
104
+ } catch ( e ) {}
105
+ begin( r, h, tag(), hard );
106
+ }
107
+
108
+ function observe( type, fn, more ) {
109
+ if ( ! P || ! P.supportedEntryTypes || P.supportedEntryTypes.indexOf( type ) < 0 ) {
110
+ return false;
111
+ }
112
+ try {
113
+ var o = { type: type, buffered: true }, k;
114
+ for ( k in more ) {
115
+ o[ k ] = more[ k ];
116
+ }
117
+ new P( safe( function ( list ) {
118
+ list.getEntries().forEach( fn );
119
+ } ) ).observe( o );
120
+ return true;
121
+ } catch ( e ) {
122
+ return false;
123
+ }
124
+ }
125
+ function event( e ) {
126
+ var x = e.interactionId && ( ints[ e.interactionId ] = ints[ e.interactionId ] || { s: e.startTime, d: 0 } );
127
+ if ( x && e.duration > x.d ) {
128
+ x.d = e.duration;
129
+ x.s = e.startTime;
130
+ }
131
+ }
132
+ if ( perf && ! bad ) {
133
+ observe( 'largest-contentful-paint', function ( e ) {
134
+ lcp = e;
135
+ } );
136
+ if ( observe( 'layout-shift', function ( e ) {
137
+ if ( e.hadRecentInput ) {
138
+ return;
139
+ }
140
+ if ( win && e.startTime - last < 1000 && e.startTime - first < 5000 ) {
141
+ win += e.value;
142
+ } else {
143
+ win = e.value;
144
+ first = e.startTime;
145
+ }
146
+ last = e.startTime;
147
+ cls = Math.max( cls, win );
148
+ } ) ) {
149
+ cls = Math.max( cls, 0 );
150
+ }
151
+ observe( 'event', event, { durationThreshold: 16 } );
152
+ observe( 'first-input', event );
153
+ named = observe( 'long-animation-frame', function ( f ) {
154
+ if ( frames.length < 500 ) {
155
+ frames.push( f );
156
+ }
157
+ } );
158
+ observe( 'resource', function ( r ) {
159
+ if ( files.length < 500 ) {
160
+ files.push( r );
161
+ }
162
+ } );
163
+ }
164
+
165
+ // An address as sent: a path on this site, //host/path elsewhere (//host with only), 'inline' for the page itself.
166
+ // '' for anything else, and for the script's own files under /_gt/. clean: a data call, whose path parts with a
167
+ // digit (other than a version), an @ or over 16 characters become :id (they can carry user IDs or tokens).
168
+ function addr( s, only, clean ) {
169
+ var m = s + '|' + ( only ? 1 : 0 ) + ( clean ? 1 : 0 );
170
+ if ( ! seen.hasOwnProperty( m ) ) {
171
+ seen[ m ] = address( s, only, clean );
172
+ }
173
+ return seen[ m ];
174
+ }
175
+ function address( s, only, clean ) {
176
+ try {
177
+ var u = new URL( s ), p;
178
+ if ( u.protocol !== 'https:' && u.protocol !== 'http:' ) {
179
+ return '';
180
+ }
181
+ if ( u.origin + u.pathname === page && ! clean ) {
182
+ return 'inline';
183
+ }
184
+ p = u.pathname.replace( /^[/]+/, '/' );
185
+ if ( clean ) {
186
+ p = p.split( '/' ).map( function ( x ) {
187
+ return x.length > 16 || /@|%40/i.test( x ) || ( /[0-9]/.test( x ) && ! /^v[0-9]+([.][0-9]+)*$/.test( x ) ) ? ':id' : x;
188
+ } ).join( '/' );
189
+ }
190
+ if ( u.host === loc.host ) {
191
+ return p.indexOf( '/_gt/' ) === 0 ? '' : p.slice( 0, 120 );
192
+ }
193
+ if ( u.hostname.length > 100 || ! /^[a-z0-9]([a-z0-9-]*[a-z0-9])?([.][a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/.test( u.hostname ) ) {
194
+ return '';
195
+ }
196
+ return ( '//' + u.hostname + ( only ? '' : p ) ).slice( 0, 120 );
197
+ } catch ( e ) {
198
+ return '';
199
+ }
200
+ }
201
+ // The entries with the most time, as "<ms> <address>" (or "<ms> <calls> <address>").
202
+ function best( t, max ) {
203
+ var out = [], k;
204
+ for ( k in t ) {
205
+ if ( t[ k ][ 0 ] >= 0.5 ) {
206
+ out.push( [ Math.min( Math.round( t[ k ][ 0 ] ), 60000 ) ].concat( t[ k ][ 1 ] ? [ Math.min( t[ k ][ 1 ], 10000 ) ] : [] ).concat( [ k ] ) );
207
+ }
208
+ }
209
+ return out.sort( function ( a, b ) {
210
+ return b[ 0 ] - a[ 0 ];
211
+ } ).slice( 0, max ).map( function ( a ) {
212
+ return a.join( ' ' );
213
+ } );
214
+ }
215
+ // The scripts that ran longest in these frames (scripts over 5 ms, as speed-attribution.js).
216
+ function tops( list, max ) {
217
+ var t = {}, k;
218
+ list.forEach( function ( f ) {
219
+ ( f.scripts || [] ).forEach( function ( s ) {
220
+ k = s.duration > 5 && addr( s.sourceURL, true );
221
+ if ( k ) {
222
+ t[ k ] = t[ k ] || [ 0 ];
223
+ t[ k ][ 0 ] += s.duration;
224
+ }
225
+ } );
226
+ } );
227
+ for ( k in t ) {
228
+ if ( t[ k ][ 0 ] <= 5.5 ) {
229
+ delete t[ k ];
230
+ }
231
+ }
232
+ return best( t, max );
233
+ }
234
+ // Time before LCP, split moment by moment: a running script takes the moment; else the files downloading share
235
+ // it equally; else the page's HTML has it; else nothing is named (the browser drawing the page). Files and calls elsewhere
236
+ // count by host. Data calls on this site count by their cleaned path, as in calls().
237
+ function before( end ) {
238
+ var items = [], cuts = [ act, end ], t = {}, i, j, a, b, mid, run, dl, html, x;
239
+ frames.forEach( function ( f ) {
240
+ ( f.scripts || [] ).forEach( function ( s ) {
241
+ var k = addr( s.sourceURL, true );
242
+ if ( k && s.startTime < end && s.startTime + s.duration > act ) {
243
+ items.push( [ s.startTime, s.startTime + s.duration, k, 0 ] );
244
+ }
245
+ } );
246
+ } );
247
+ files.forEach( function ( r ) {
248
+ var call = r.initiatorType === 'fetch' || r.initiatorType === 'xmlhttprequest', k = addr( r.name, true, call );
249
+ if ( k && k !== 'inline' && r.startTime < end && r.responseEnd > act ) {
250
+ items.push( [ r.startTime, r.responseEnd, k, 1 ] );
251
+ }
252
+ } );
253
+ if ( nav && nav.responseEnd > act ) {
254
+ items.push( [ 0, nav.responseEnd, 'html', 2 ] );
255
+ }
256
+ items = items.slice( 0, 400 );
257
+ items.forEach( function ( y ) {
258
+ cuts.push( y[ 0 ], y[ 1 ] );
259
+ } );
260
+ cuts = cuts.filter( function ( c ) {
261
+ return c >= act && c <= end;
262
+ } ).sort( function ( p, q ) {
263
+ return p - q;
264
+ } );
265
+ for ( i = 1; i < cuts.length; i++ ) {
266
+ a = cuts[ i - 1 ];
267
+ b = cuts[ i ];
268
+ if ( b <= a ) {
269
+ continue;
270
+ }
271
+ mid = ( a + b ) / 2;
272
+ run = [];
273
+ dl = [];
274
+ html = 0;
275
+ for ( j = 0; j < items.length; j++ ) {
276
+ x = items[ j ];
277
+ if ( x[ 0 ] <= mid && x[ 1 ] > mid ) {
278
+ if ( x[ 3 ] === 0 ) {
279
+ run.push( x[ 2 ] );
280
+ } else if ( x[ 3 ] === 1 ) {
281
+ dl.push( x[ 2 ] );
282
+ } else {
283
+ html = 1;
284
+ }
285
+ }
286
+ }
287
+ run = run.length ? run : dl.length ? dl : html ? [ 'html' ] : [];
288
+ for ( j = 0; j < run.length; j++ ) {
289
+ t[ run[ j ] ] = t[ run[ j ] ] || [ 0 ];
290
+ t[ run[ j ] ][ 0 ] += ( b - a ) / run.length;
291
+ }
292
+ }
293
+ return best( t, 6 );
294
+ }
295
+ // Data calls (fetch and XMLHttpRequest), added up by cleaned address.
296
+ function calls() {
297
+ var t = {};
298
+ files.forEach( function ( r ) {
299
+ var k = ( r.initiatorType === 'fetch' || r.initiatorType === 'xmlhttprequest' ) && addr( r.name, false, true );
300
+ if ( k ) {
301
+ t[ k ] = t[ k ] || [ 0, 0 ];
302
+ t[ k ][ 0 ] += r.duration;
303
+ t[ k ][ 1 ]++;
304
+ }
305
+ } );
306
+ return best( t, 6 );
307
+ }
308
+ // The attribution fields, all or none.
309
+ function attribution( f, x, l ) {
310
+ var add = [ [ 'a', named ? '1' : '0' ] ];
311
+ try {
312
+ if ( named ) {
313
+ tops( frames, 6 ).forEach( function ( v ) {
314
+ add.push( [ 's[]', v ] );
315
+ } );
316
+ if ( x ) {
317
+ tops( frames.filter( function ( fr ) {
318
+ return fr.startTime < x.s + x.d && fr.startTime + fr.duration > x.s;
319
+ } ), 3 ).forEach( function ( v ) {
320
+ add.push( [ 'x[]', v ] );
321
+ } );
322
+ }
323
+ }
324
+ if ( l ) {
325
+ before( lcp.startTime ).forEach( function ( v ) {
326
+ add.push( [ 'f[]', v ] );
327
+ } );
328
+ }
329
+ calls().forEach( function ( v ) {
330
+ add.push( [ 'q[]', v ] );
331
+ } );
332
+ } catch ( e ) {
333
+ return;
334
+ }
335
+ // The view must always fit the server's limit (4,096 bytes): leave out the last entries until it does.
336
+ while ( add.length > 1 && ( f.toString() + '&' + new U( add ).toString() ).length > 4000 ) {
337
+ add.pop();
338
+ }
339
+ add.forEach( function ( v ) {
340
+ f.append( v[ 0 ], v[ 1 ] );
341
+ } );
342
+ }
343
+
344
+ // The speed fields of the first view of a page load (speed.js).
345
+ function speed( f ) {
346
+ var all = [], k, x, el, any = 0, l = 0;
347
+ if ( bad ) {
348
+ return;
349
+ }
350
+ if ( lcp && ! late ) {
351
+ f.set( 'l', String( Math.round( Math.max( lcp.startTime - act, 0 ) ) ) );
352
+ l = 1;
353
+ el = lcp.element && lcp.element.tagName;
354
+ f.set( 'e', lcp.url ? ( el === 'VIDEO' ? 'video' : 'img' ) : 'text' );
355
+ any = 1;
356
+ }
357
+ for ( k in ints ) {
358
+ all.push( ints[ k ] );
359
+ }
360
+ if ( all.length ) {
361
+ all.sort( function ( a, b ) {
362
+ return b.d - a.d;
363
+ } );
364
+ x = all[ Math.min( all.length - 1, Math.floor( ( perf.interactionCount || all.length ) / 50 ) ) ];
365
+ f.set( 'i', String( Math.round( x.d ) ) );
366
+ any = 1;
367
+ }
368
+ if ( cls >= 0 ) {
369
+ f.set( 'c', String( Math.round( cls * 1000 ) ) );
370
+ any = 1;
371
+ }
372
+ if ( nav && nav.responseStart > 0 ) {
373
+ f.set( 't', String( Math.round( Math.max( nav.responseStart - act, 0 ) ) ) );
374
+ any = 1;
375
+ }
376
+ if ( any && kind ) {
377
+ f.set( 'k', String( kind ) );
378
+ }
379
+ if ( any ) {
380
+ attribution( f, x, l );
381
+ }
382
+ }
383
+
384
+ function send() {
385
+ var v = view, f, x;
386
+ if ( ! v || v.sent || ! v.shown ) {
387
+ return;
388
+ }
389
+ v.sent = 1;
390
+ f = new U();
391
+ x = w.innerWidth || ( d.documentElement && d.documentElement.clientWidth ) || 0;
392
+ f.set( 'p', v.p );
393
+ if ( v.r ) {
394
+ f.set( 'r', v.r );
395
+ } else if ( v.h ) {
396
+ f.set( 'h', v.h );
397
+ }
398
+ if ( v.s ) {
399
+ f.set( 's', v.s );
400
+ }
401
+ f.set( 'd', x < 768 ? 'm' : x < 1024 ? 't' : 'd' );
402
+ if ( v.hard ) {
403
+ speed( f );
404
+ }
405
+ if ( ! ( n.sendBeacon && n.sendBeacon( E, f ) ) && w.fetch ) {
406
+ w.fetch( E, { method: 'POST', body: f, keepalive: true } ).catch( function () {} );
407
+ }
408
+ }
409
+
410
+ // In-page navigation to another path: send this view, start the next one. A view nobody saw (a redirect in a
411
+ // background tab) passes its referrer and tag on, so the visit keeps its source.
412
+ function moved() {
413
+ var v = view;
414
+ if ( ! v || loc.pathname === v.p ) {
415
+ return;
416
+ }
417
+ if ( ! v.sent && ! v.shown ) {
418
+ begin( v.r, v.h, v.s, false );
419
+ return;
420
+ }
421
+ send();
422
+ begin( v.p, '', tag(), false );
423
+ }
424
+
425
+ landed( true );
426
+ on( d, 'visibilitychange', function () {
427
+ if ( d.visibilityState === 'hidden' ) {
428
+ send();
429
+ } else if ( view ) {
430
+ view.shown = true;
431
+ }
432
+ } );
433
+ if ( d.prerendering ) {
434
+ on( d, 'prerenderingchange', function () {
435
+ if ( view ) {
436
+ view.shown = true;
437
+ }
438
+ }, { once: true } );
439
+ }
440
+ on( w, 'pagehide', send );
441
+ // A page restored from the back-forward cache is viewed again, as it would be when loaded anew.
442
+ on( w, 'pageshow', function ( e ) {
443
+ if ( e && e.persisted ) {
444
+ landed( false );
445
+ }
446
+ } );
447
+ var hist = w.history;
448
+ [ 'pushState', 'replaceState' ].forEach( function ( m ) {
449
+ var own = hist && hist[ m ];
450
+ if ( typeof own !== 'function' ) {
451
+ return;
452
+ }
453
+ hist[ m ] = function () {
454
+ var r = own.apply( this, arguments );
455
+ safe( moved )();
456
+ return r;
457
+ };
458
+ } );
459
+ on( w, 'popstate', moved );
460
+ } )( window, document, navigator );
461
+ } catch ( e ) {}
462
+ `;