@thoughtbot/superglue 2.0.0-alpha.1 → 2.0.0-alpha.11

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 (34) hide show
  1. package/dist/action_creators.d.mts +1 -1
  2. package/dist/action_creators.development.mjs +13 -0
  3. package/dist/action_creators.development.mjs.map +1 -0
  4. package/dist/action_creators.js +7 -0
  5. package/dist/action_creators.mjs +1 -1
  6. package/dist/chunk-AEIBTV6M.development.mjs +2860 -0
  7. package/dist/chunk-AEIBTV6M.development.mjs.map +1 -0
  8. package/dist/{chunk-YS477OKK.mjs → chunk-ILWYFGLA.mjs} +315 -36
  9. package/dist/chunk-ILWYFGLA.mjs.map +1 -0
  10. package/dist/cjs/action_creators.cjs +305 -7
  11. package/dist/cjs/action_creators.cjs.map +1 -1
  12. package/dist/cjs/action_creators.development.cjs +2791 -0
  13. package/dist/cjs/action_creators.development.cjs.map +1 -0
  14. package/dist/cjs/superglue.cjs +385 -5770
  15. package/dist/cjs/superglue.cjs.map +1 -1
  16. package/dist/cjs/superglue.development.cjs +3215 -0
  17. package/dist/cjs/superglue.development.cjs.map +1 -0
  18. package/dist/{index-MyfFLe4E.d.mts → index-DwEjetER.d.mts} +28 -18
  19. package/dist/index.js +7 -0
  20. package/dist/superglue.d.mts +16 -25
  21. package/dist/superglue.development.mjs +417 -0
  22. package/dist/superglue.development.mjs.map +1 -0
  23. package/dist/superglue.mjs +79 -5748
  24. package/dist/superglue.mjs.map +1 -1
  25. package/npm/action_creators.js +7 -0
  26. package/npm/index.js +7 -0
  27. package/package.json +37 -12
  28. package/scripts/copy-wrappers.js +37 -0
  29. package/thoughtbot-superglue-2.0.0-alpha.11.tgz +0 -0
  30. package/tsconfig.json +1 -0
  31. package/tsup.config.ts +57 -1
  32. package/typedoc.json +1 -0
  33. package/dist/chunk-YS477OKK.mjs.map +0 -1
  34. package/thoughtbot-superglue-2.0.0-alpha.1.tgz +0 -0
@@ -1,4 +1,4 @@
1
- import { Action, ThunkDispatch, EnhancedStore, Tuple, StoreEnhancer, ThunkAction } from '@reduxjs/toolkit';
1
+ import { Action, EnhancedStore, Tuple, StoreEnhancer, ThunkDispatch, ThunkAction } from '@reduxjs/toolkit';
2
2
  import { History } from 'history';
3
3
 
4
4
  type FetchArgs = [string, BasicRequestInit];
@@ -42,8 +42,8 @@ interface RemoteProps extends BaseProps {
42
42
  pageKey?: PageKey;
43
43
  force?: boolean;
44
44
  }
45
- interface BeforeSave {
46
- <T extends PageResponse>(prevPage: SaveResponse, receivedPage: T): T;
45
+ interface BeforeSave<T = JSONMappable> {
46
+ <U extends SaveResponse<T> | GraftResponse<T>>(prevPage: Page<T>, receivedPage: U): U;
47
47
  }
48
48
  interface ApplicationRemote {
49
49
  (input: string | PageKey, options?: RemoteProps & {
@@ -69,6 +69,15 @@ declare const rootReducer: {
69
69
  fragments: typeof fragmentReducer;
70
70
  };
71
71
 
72
+ type FragmentProxy = {
73
+ __fragment: true;
74
+ };
75
+ type FragmentRefOrId = FragmentRef | string;
76
+ declare function useContent<T = JSONMappable>(): T;
77
+ declare function useContent<T = JSONMappable>(fragmentRef: FragmentRefOrId): T;
78
+ declare function unproxy<T>(proxy: T): Unproxy<T>;
79
+
80
+ type ReceiveType<T> = unknown;
72
81
  type PageKey = string;
73
82
  type RestoreStrategy = 'fromCacheOnly' | 'revisitOnly' | 'fromCacheAndRevisitInBackground';
74
83
  type NavigationAction = 'push' | 'replace' | 'none';
@@ -82,15 +91,13 @@ type JSONObject = {
82
91
  type JSONMappable = JSONValue[] | JSONObject;
83
92
  type JSONKeyable = JSONObject[] | JSONObject;
84
93
  type JSONValue = JSONPrimitive | JSONMappable;
85
- type Fragment<T> = {
94
+ type Fragment<T, Present = false> = Present extends true ? T & {
86
95
  __id: string;
87
- } & {
88
- __fragmentType?: T;
89
- };
90
- type Unproxied<T> = T extends Fragment<unknown> ? {
96
+ } : (T & {
91
97
  __id: string;
92
- } : T extends (infer U)[] ? Unproxied<U>[] : T extends object ? {
93
- [K in keyof T]: Unproxied<T[K]>;
98
+ }) | undefined;
99
+ type Unproxy<T> = T extends FragmentProxy ? FragmentRef : T extends Fragment<unknown, unknown> ? FragmentRef : T extends (infer U)[] ? Unproxy<U>[] : T extends object ? {
100
+ [K in keyof T]: Unproxy<T[K]>;
94
101
  } : T;
95
102
  interface ParsedResponse {
96
103
  rsp: Response;
@@ -108,7 +115,7 @@ type SaveResponse<T = JSONMappable> = {
108
115
  componentIdentifier: ComponentIdentifier;
109
116
  assets: string[];
110
117
  csrfToken?: string;
111
- fragments: FragmentRef[];
118
+ fragments: FragmentPath[];
112
119
  defers: Defer[];
113
120
  slices: JSONObject;
114
121
  action: 'savePage';
@@ -123,34 +130,37 @@ type GraftResponse<T = JSONMappable> = {
123
130
  componentIdentifier: ComponentIdentifier;
124
131
  assets: string[];
125
132
  csrfToken?: string;
126
- fragments: FragmentRef[];
133
+ fragments: FragmentPath[];
127
134
  defers: Defer[];
128
135
  slices: JSONObject;
129
136
  action: 'graft';
130
137
  renderedAt: number;
131
- restoreStrategy: RestoreStrategy;
132
138
  path: Keypath;
133
139
  fragmentContext?: string;
134
140
  };
135
- type StreamMutateMessage = {
141
+ type StreamMessage = {
136
142
  data: JSONMappable;
137
143
  fragmentIds: string[];
138
144
  handler: 'append' | 'prepend' | 'save';
139
145
  options: Record<string, string>;
140
146
  };
141
147
  type StreamResponse = {
142
- data: StreamMutateMessage[];
143
- fragments: FragmentRef[];
148
+ data: StreamMessage[];
149
+ fragments: FragmentPath[];
144
150
  assets: string[];
145
151
  csrfToken?: string;
146
152
  action: 'handleStreamResponse';
147
153
  renderedAt: number;
154
+ slices: JSONObject;
148
155
  };
149
156
  type PageResponse = GraftResponse | SaveResponse | StreamResponse;
150
- type FragmentRef = {
157
+ type FragmentPath = {
151
158
  id: string;
152
159
  path: Keypath;
153
160
  };
161
+ type FragmentRef = {
162
+ __id: string;
163
+ };
154
164
  type AllPages<T = JSONMappable> = Record<PageKey, Page<T>>;
155
165
  type AllFragments = Record<string, JSONMappable>;
156
166
  interface SuperglueState {
@@ -268,4 +278,4 @@ declare const visit: VisitCreator;
268
278
 
269
279
  declare function saveAndProcessPage(pageKey: string, page: PageResponse): SaveAndProcessPageThunk;
270
280
 
271
- export { type Visit as $, type ApplicationRemote as A, type VisitCreator as B, type ComponentIdentifier as C, type Defer as D, type RemoteCreator as E, type FetchArgs as F, type GraftResponse as G, type Handlers as H, type Dispatch as I, type JSONMappable as J, type Keypath as K, type UJSHandlers as L, type Meta as M, type NavigationContextProps as N, type HistoryState as O, type PageKey as P, type SaveAndProcessPageThunk as Q, type RestoreStrategy as R, type SuperglueStore as S, type MetaThunk as T, type Unproxied as U, type VisitMeta as V, type VisitMetaThunk as W, type DefermentThunk as X, type BasicRequestInit as Y, type BuildStore as Z, type BuildVisitAndRemote as _, type JSONValue as a, type VisitProps as a0, type Remote as a1, type RemoteProps as a2, type BeforeSave as a3, type GraftingSuccessAction as a4, type GraftingErrorAction as a5, MismatchedComponentError as a6, remote as a7, visit as a8, type NavigationProviderProps as b, type NavigateTo as c, type SaveResponse as d, type SuperglueState as e, type SetupProps as f, type ApplicationVisit as g, type ApplicationProps as h, superglueReducer as i, type NavigationAction as j, type JSONPrimitive as k, type JSONObject as l, type JSONKeyable as m, type Fragment as n, type ParsedResponse as o, pageReducer as p, type Page as q, rootReducer as r, saveAndProcessPage as s, type StreamMutateMessage as t, type StreamResponse as u, type PageResponse as v, type FragmentRef as w, type AllPages as x, type AllFragments as y, type RootState as z };
281
+ export { type DefermentThunk as $, type ApplicationRemote as A, type FragmentRef as B, type ComponentIdentifier as C, type Defer as D, type AllPages as E, type FetchArgs as F, type GraftResponse as G, type Handlers as H, type AllFragments as I, type JSONMappable as J, type Keypath as K, type RootState as L, type Meta as M, type NavigationProviderProps as N, type VisitCreator as O, type PageKey as P, type RemoteCreator as Q, type ReceiveType as R, type SuperglueStore as S, type Dispatch as T, type Unproxy as U, type VisitMeta as V, type UJSHandlers as W, type HistoryState as X, type SaveAndProcessPageThunk as Y, type MetaThunk as Z, type VisitMetaThunk as _, type JSONValue as a, type BasicRequestInit as a0, type BuildStore as a1, type BuildVisitAndRemote as a2, type Visit as a3, type VisitProps as a4, type Remote as a5, type RemoteProps as a6, type BeforeSave as a7, type GraftingSuccessAction as a8, type GraftingErrorAction as a9, useContent as aa, MismatchedComponentError as ab, remote as ac, visit as ad, type NavigateTo as b, type NavigationContextProps as c, type SaveResponse as d, type PageResponse as e, type Fragment as f, type FragmentProxy as g, type SuperglueState as h, type ApplicationProps as i, type SetupProps as j, type ApplicationVisit as k, superglueReducer as l, type RestoreStrategy as m, type NavigationAction as n, type JSONPrimitive as o, pageReducer as p, type JSONObject as q, rootReducer as r, saveAndProcessPage as s, type JSONKeyable as t, unproxy as u, type ParsedResponse as v, type Page as w, type StreamMessage as x, type StreamResponse as y, type FragmentPath as z };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./cjs/superglue.cjs')
5
+ } else {
6
+ module.exports = require('./cjs/superglue.development.cjs')
7
+ }
@@ -1,8 +1,8 @@
1
1
  import * as history from 'history';
2
- import { J as JSONMappable, K as Keypath, a as JSONValue, P as PageKey, A as ApplicationRemote, S as SuperglueStore, N as NavigationContextProps, b as NavigationProviderProps, c as NavigateTo, d as SaveResponse, F as FetchArgs, U as Unproxied, e as SuperglueState, f as SetupProps, g as ApplicationVisit, H as Handlers, h as ApplicationProps } from './index-MyfFLe4E.mjs';
3
- export { y as AllFragments, x as AllPages, Y as BasicRequestInit, a3 as BeforeSave, Z as BuildStore, _ as BuildVisitAndRemote, C as ComponentIdentifier, D as Defer, X as DefermentThunk, I as Dispatch, n as Fragment, w as FragmentRef, G as GraftResponse, a5 as GraftingErrorAction, a4 as GraftingSuccessAction, O as HistoryState, m as JSONKeyable, l as JSONObject, k as JSONPrimitive, M as Meta, T as MetaThunk, j as NavigationAction, q as Page, v as PageResponse, o as ParsedResponse, a1 as Remote, E as RemoteCreator, a2 as RemoteProps, R as RestoreStrategy, z as RootState, Q as SaveAndProcessPageThunk, t as StreamMutateMessage, u as StreamResponse, L as UJSHandlers, $ as Visit, B as VisitCreator, V as VisitMeta, W as VisitMetaThunk, a0 as VisitProps, p as pageReducer, r as rootReducer, s as saveAndProcessPage, i as superglueReducer } from './index-MyfFLe4E.mjs';
2
+ import { J as JSONMappable, K as Keypath, a as JSONValue, P as PageKey, A as ApplicationRemote, S as SuperglueStore, N as NavigationProviderProps, b as NavigateTo, c as NavigationContextProps, F as FetchArgs, d as SaveResponse, e as PageResponse, f as Fragment, U as Unproxy, g as FragmentProxy, h as SuperglueState, i as ApplicationProps, j as SetupProps, k as ApplicationVisit, H as Handlers } from './index-DwEjetER.mjs';
3
+ export { I as AllFragments, E as AllPages, a0 as BasicRequestInit, a7 as BeforeSave, a1 as BuildStore, a2 as BuildVisitAndRemote, C as ComponentIdentifier, D as Defer, $ as DefermentThunk, T as Dispatch, z as FragmentPath, B as FragmentRef, G as GraftResponse, a9 as GraftingErrorAction, a8 as GraftingSuccessAction, X as HistoryState, t as JSONKeyable, q as JSONObject, o as JSONPrimitive, M as Meta, Z as MetaThunk, n as NavigationAction, w as Page, v as ParsedResponse, R as ReceiveType, a5 as Remote, Q as RemoteCreator, a6 as RemoteProps, m as RestoreStrategy, L as RootState, Y as SaveAndProcessPageThunk, x as StreamMessage, y as StreamResponse, W as UJSHandlers, a3 as Visit, O as VisitCreator, V as VisitMeta, _ as VisitMetaThunk, a4 as VisitProps, p as pageReducer, r as rootReducer, s as saveAndProcessPage, l as superglueReducer, u as unproxy, aa as useContent } from './index-DwEjetER.mjs';
4
4
  import React from 'react';
5
- import { Subscription, Consumer, ChannelNameWithParams } from '@rails/actioncable';
5
+ import { ChannelNameWithParams, Subscription } from '@rails/actioncable';
6
6
  import { DebouncedFunc } from 'lodash';
7
7
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
8
8
 
@@ -31,7 +31,7 @@ declare class StreamActions {
31
31
  }
32
32
  declare function useStreamSource(channel: StreamSourceProps): {
33
33
  connected: boolean;
34
- subscription: Subscription<Consumer> | null;
34
+ subscription: Subscription | null;
35
35
  };
36
36
 
37
37
  declare const NavigationContext: React.Context<NavigationContextProps>;
@@ -66,28 +66,19 @@ declare const beforeRemote: _reduxjs_toolkit.ActionCreatorWithPayload<{
66
66
  currentPageKey: PageKey;
67
67
  fetchArgs: FetchArgs;
68
68
  }, string>;
69
+ declare const receiveResponse: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[{
70
+ pageKey: string;
71
+ response: PageResponse;
72
+ }], {
73
+ pageKey: string;
74
+ response: PageResponse;
75
+ }, "@@superglue/RECEIVE_RESPONSE", never, never>;
69
76
 
70
- type ProxiedContent<T> = T & {
71
- readonly [K in keyof T]: T[K] extends {
72
- __id: string;
73
- } ? unknown : T[K] extends (infer U)[] ? ProxiedContent<U>[] : T[K] extends object ? ProxiedContent<T[K]> : T[K];
77
+ type Unpack<T> = T extends Fragment<infer U, unknown> ? U : T extends FragmentProxy ? T : never;
78
+ declare function useSetFragment(): {
79
+ <T extends Fragment<unknown, unknown>>(fragmentRef: T, updater: (draft: Unproxy<Unpack<T>>) => void): void;
80
+ <T = unknown>(fragmentId: string, updater: (draft: T) => void): void;
74
81
  };
75
- type FragmentRef = {
76
- __id: string;
77
- } | string;
78
- declare function useContent<T = JSONMappable>(): ProxiedContent<T>;
79
- declare function useContent<T = JSONMappable>(fragmentRef: FragmentRef): ProxiedContent<T>;
80
- declare function useContent<T = JSONMappable>(fragmentRef: FragmentRef, options: {
81
- optional: false;
82
- }): ProxiedContent<T>;
83
- declare function useContent<T = JSONMappable>(fragmentRef: FragmentRef, options: {
84
- optional: true;
85
- }): ProxiedContent<T> | undefined;
86
- declare function unproxy<T>(proxy: T): Unproxied<T>;
87
-
88
- declare function useSetFragment(): (fragmentRef: {
89
- __id: string;
90
- } | string, updater: (draft: unknown) => void) => void;
91
82
 
92
83
  declare function useSuperglue(): SuperglueState;
93
84
 
@@ -102,4 +93,4 @@ declare const setup: ({ initialPage, baseUrl, path, store, buildVisitAndRemote,
102
93
  };
103
94
  declare function Application({ initialPage, baseUrl, path, store, buildVisitAndRemote, history, mapping, ...rest }: ApplicationProps): React.JSX.Element;
104
95
 
105
- export { Application, ApplicationProps, ApplicationRemote, ApplicationVisit, FetchArgs, GRAFTING_ERROR, GRAFTING_SUCCESS, Handlers, JSONMappable, JSONValue, Keypath, NavigateTo, NavigationContext, NavigationContextProps, NavigationProvider, NavigationProviderProps, PageKey, SaveResponse, SetupProps, SuperglueState, SuperglueStore, Unproxied, beforeFetch, beforeRemote, beforeVisit, copyPage, getIn, prepareStore, removePage, saveResponse, setup, unproxy, urlToPageKey, useContent, useSetFragment, useStreamSource, useSuperglue };
96
+ export { Application, ApplicationProps, ApplicationRemote, ApplicationVisit, FetchArgs, Fragment, GRAFTING_ERROR, GRAFTING_SUCCESS, Handlers, JSONMappable, JSONValue, Keypath, NavigateTo, NavigationContext, NavigationContextProps, NavigationProvider, NavigationProviderProps, PageKey, PageResponse, SaveResponse, SetupProps, SuperglueState, SuperglueStore, Unproxy, beforeFetch, beforeRemote, beforeVisit, copyPage, getIn, prepareStore, receiveResponse, removePage, saveResponse, setup, urlToPageKey, useSetFragment, useStreamSource, useSuperglue };
@@ -0,0 +1,417 @@
1
+ import {
2
+ CableContext,
3
+ GRAFTING_ERROR,
4
+ GRAFTING_SUCCESS,
5
+ StreamActions,
6
+ __ΩAllFragments,
7
+ __ΩAllPages,
8
+ __ΩApplicationProps,
9
+ __ΩApplicationRemote,
10
+ __ΩApplicationVisit,
11
+ __ΩBasicRequestInit,
12
+ __ΩBeforeSave,
13
+ __ΩBuildStore,
14
+ __ΩBuildVisitAndRemote,
15
+ __ΩComponentIdentifier,
16
+ __ΩDefer,
17
+ __ΩDefermentThunk,
18
+ __ΩDispatch,
19
+ __ΩFetchArgs,
20
+ __ΩFragment,
21
+ __ΩFragmentPath,
22
+ __ΩFragmentRef,
23
+ __ΩGraftResponse,
24
+ __ΩGraftingErrorAction,
25
+ __ΩGraftingSuccessAction,
26
+ __ΩHandlers,
27
+ __ΩHistoryState,
28
+ __ΩJSONKeyable,
29
+ __ΩJSONMappable,
30
+ __ΩJSONObject,
31
+ __ΩJSONPrimitive,
32
+ __ΩJSONValue,
33
+ __ΩKeypath,
34
+ __ΩMeta,
35
+ __ΩMetaThunk,
36
+ __ΩNavigateTo,
37
+ __ΩNavigationAction,
38
+ __ΩNavigationContextProps,
39
+ __ΩNavigationProviderProps,
40
+ __ΩPage,
41
+ __ΩPageKey,
42
+ __ΩPageResponse,
43
+ __ΩParsedResponse,
44
+ __ΩReceiveType,
45
+ __ΩRemote,
46
+ __ΩRemoteCreator,
47
+ __ΩRemoteProps,
48
+ __ΩRestoreStrategy,
49
+ __ΩRootState,
50
+ __ΩSaveAndProcessPageThunk,
51
+ __ΩSaveResponse,
52
+ __ΩSetupProps,
53
+ __ΩStreamMessage,
54
+ __ΩStreamResponse,
55
+ __ΩSuperglueState,
56
+ __ΩSuperglueStore,
57
+ __ΩUJSHandlers,
58
+ __ΩUnproxy,
59
+ __ΩVisit,
60
+ __ΩVisitCreator,
61
+ __ΩVisitMeta,
62
+ __ΩVisitMetaThunk,
63
+ __ΩVisitProps,
64
+ argsForHistory,
65
+ beforeFetch,
66
+ beforeRemote,
67
+ beforeVisit,
68
+ config,
69
+ copyPage,
70
+ getIn,
71
+ historyChange,
72
+ pageReducer,
73
+ receiveResponse,
74
+ removePage,
75
+ rootReducer,
76
+ saveAndProcessPage,
77
+ saveResponse,
78
+ setActivePage,
79
+ setCSRFToken,
80
+ superglueReducer,
81
+ ujsHandlers,
82
+ unproxy,
83
+ urlToPageKey,
84
+ useContent,
85
+ useSetFragment,
86
+ useStreamSource,
87
+ useSuperglue
88
+ } from "./chunk-AEIBTV6M.development.mjs";
89
+
90
+ // lib/index.tsx
91
+ import React2, { useRef, useMemo } from "react";
92
+ import { Provider } from "react-redux";
93
+ import { createConsumer } from "@rails/actioncable";
94
+ import { createBrowserHistory, createMemoryHistory } from "history";
95
+
96
+ // lib/components/Navigation.tsx
97
+ import React, { createContext, useEffect, useLayoutEffect, forwardRef, useImperativeHandle } from "react";
98
+ import { useDispatch, useSelector, useStore } from "react-redux";
99
+ function __assignType(fn, args) {
100
+ fn.__type = args;
101
+ return fn;
102
+ }
103
+ var NavigationContext = (createContext.\u03A9 = [[() => __\u03A9NavigationContextProps, "n!"]], createContext({}));
104
+ var hasWindow = typeof window !== "undefined";
105
+ var setWindowScroll = __assignType((posX, posY) => {
106
+ hasWindow && window.scrollTo(posX, posY);
107
+ }, ["posX", "posY", "", `P'2!'2"$/#`]);
108
+ var notFound = __assignType((identifier) => {
109
+ let reminder = "";
110
+ if (!identifier) {
111
+ reminder = "Did you forget to add `json.componentIdentifier` in your application.json.props layout?";
112
+ }
113
+ const error = new Error(`Superglue Nav component was looking for ${identifier} but could not find it in your mapping. ${reminder}`);
114
+ throw error;
115
+ }, ["identifier", "", 'PP&-J2!!/"']);
116
+ var NavigationProvider = forwardRef(__assignType(function NavigationProvider2({ history, visit, remote, mapping }, ref) {
117
+ const dispatch = useDispatch();
118
+ const pages = (useSelector.\u03A9 = [[() => __\u03A9RootState, "n!"], [() => __\u03A9AllPages, "n!"]], useSelector(__assignType((state) => state.pages, ["state", "", 'P"2!"/"'])));
119
+ const superglue = (useSelector.\u03A9 = [[() => __\u03A9RootState, "n!"], [() => __\u03A9SuperglueState, "n!"]], useSelector(__assignType((state) => state.superglue, ["state", "", 'P"2!"/"'])));
120
+ const currentPageKey = (useSelector.\u03A9 = [[() => __\u03A9RootState, "n!"], ["&"]], useSelector(__assignType((state) => state.superglue.currentPageKey, ["state", "", 'P"2!"/"'])));
121
+ const store = (useStore.\u03A9 = [[() => __\u03A9RootState, "n!"]], useStore());
122
+ useEffect(() => {
123
+ return history.listen(onHistoryChange);
124
+ }, []);
125
+ useLayoutEffect(() => {
126
+ const state = history.location.state;
127
+ if (state && "superglue" in state) {
128
+ const { posX, posY } = state;
129
+ setWindowScroll(posX, posY);
130
+ }
131
+ }, [currentPageKey]);
132
+ useImperativeHandle(ref, () => {
133
+ return {
134
+ navigateTo
135
+ };
136
+ }, []);
137
+ const onHistoryChange = __assignType(({ location, action }) => {
138
+ const state = location.state;
139
+ if (action !== "POP") {
140
+ return;
141
+ }
142
+ if (!state && location.hash !== "") {
143
+ const nextPageKey = urlToPageKey(location.pathname + location.search);
144
+ const containsKey = !!pages[nextPageKey];
145
+ if (containsKey) {
146
+ history.replace({
147
+ pathname: location.pathname,
148
+ search: location.search,
149
+ hash: location.hash
150
+ }, {
151
+ superglue: true,
152
+ posY: window.pageYOffset,
153
+ posX: window.pageXOffset
154
+ });
155
+ }
156
+ }
157
+ if (state && "superglue" in state) {
158
+ const pageKey = urlToPageKey(location.pathname + location.search);
159
+ const prevPageKey = store.getState().superglue.currentPageKey;
160
+ const containsKey = !!pages[pageKey];
161
+ if (containsKey) {
162
+ const { restoreStrategy } = pages[pageKey];
163
+ switch (restoreStrategy) {
164
+ case "fromCacheOnly":
165
+ dispatch(setActivePage({ pageKey }));
166
+ break;
167
+ case "fromCacheAndRevisitInBackground":
168
+ dispatch(setActivePage({ pageKey }));
169
+ visit(pageKey, { revisit: true });
170
+ break;
171
+ case "revisitOnly":
172
+ default:
173
+ visit(pageKey, { revisit: true }).then(() => {
174
+ const noNav = prevPageKey === store.getState().superglue.currentPageKey;
175
+ if (noNav) {
176
+ dispatch(setActivePage({ pageKey }));
177
+ }
178
+ });
179
+ }
180
+ } else {
181
+ visit(pageKey, { revisit: true }).then(() => {
182
+ const noNav = prevPageKey === store.getState().superglue.currentPageKey;
183
+ if (noNav) {
184
+ dispatch(setActivePage({ pageKey }));
185
+ }
186
+ });
187
+ }
188
+ }
189
+ }, ["Update", "param0", "", 'P"w!2"$/#']);
190
+ const navigateTo = __assignType((path, { action } = {
191
+ action: "push"
192
+ }) => {
193
+ if (action === "none") {
194
+ return false;
195
+ }
196
+ const nextPageKey = urlToPageKey(path);
197
+ const hasPage = Object.prototype.hasOwnProperty.call(store.getState().pages, nextPageKey);
198
+ if (hasPage) {
199
+ const location = history.location;
200
+ const state = location.state;
201
+ const historyArgs = [
202
+ path,
203
+ {
204
+ superglue: true,
205
+ posY: 0,
206
+ posX: 0
207
+ }
208
+ ];
209
+ if (action === "push") {
210
+ if (hasWindow) {
211
+ history.replace({
212
+ pathname: location.pathname,
213
+ search: location.search,
214
+ hash: location.hash
215
+ }, {
216
+ ...state,
217
+ posY: window.scrollY,
218
+ posX: window.scrollX
219
+ });
220
+ }
221
+ history.push(...historyArgs);
222
+ dispatch(setActivePage({ pageKey: nextPageKey }));
223
+ }
224
+ if (action === "replace") {
225
+ history.replace(...historyArgs);
226
+ if (currentPageKey !== nextPageKey) {
227
+ dispatch(setActivePage({ pageKey: nextPageKey }));
228
+ dispatch(removePage({ pageKey: currentPageKey }));
229
+ }
230
+ }
231
+ return true;
232
+ } else {
233
+ console.warn(`\`navigateTo\` was called , but could not find
234
+ the pageKey in the store. This may happen when the wrong
235
+ content_location was set in your non-get controller action.
236
+ No navigation will take place`);
237
+ return false;
238
+ }
239
+ }, ["path", "param1", "", 'P"2!"2""/#']);
240
+ const { search } = superglue;
241
+ const { componentIdentifier } = pages[currentPageKey];
242
+ const Component = mapping[componentIdentifier];
243
+ if (Component) {
244
+ return /* @__PURE__ */ React.createElement(NavigationContext.Provider, { value: { pageKey: currentPageKey, search, navigateTo, visit, remote } }, /* @__PURE__ */ React.createElement(Component, null));
245
+ } else {
246
+ notFound(componentIdentifier);
247
+ }
248
+ }, [() => __\u03A9NavigationProviderProps, "param0", "ref", "NavigationProvider", 'Pn!2"!2#"/$']));
249
+
250
+ // lib/index.tsx
251
+ function __assignType2(fn, args) {
252
+ fn.__type = args;
253
+ return fn;
254
+ }
255
+ function getConfig(name) {
256
+ if (typeof document !== "undefined") {
257
+ const element = document.head.querySelector(`meta[name='action-cable-${name}']`);
258
+ if (element) {
259
+ return element.getAttribute("content") || "/cable";
260
+ } else {
261
+ return "/cable";
262
+ }
263
+ } else {
264
+ return "/cable";
265
+ }
266
+ }
267
+ getConfig.__type = ["name", "getConfig", 'P&2!"/"'];
268
+ var cable = createConsumer(getConfig("url"));
269
+ var hasWindow2 = typeof window !== "undefined";
270
+ var createHistory = () => {
271
+ if (hasWindow2) {
272
+ return createBrowserHistory({});
273
+ } else {
274
+ return createMemoryHistory({});
275
+ }
276
+ };
277
+ var prepareStore = __assignType2(
278
+ (store, initialPage, path) => {
279
+ const initialPageKey = urlToPageKey(path);
280
+ const { csrfToken } = initialPage;
281
+ store.dispatch(historyChange({
282
+ pageKey: initialPageKey
283
+ }));
284
+ store.dispatch(receiveResponse({ pageKey: initialPageKey, response: initialPage }));
285
+ store.dispatch(saveAndProcessPage(initialPageKey, initialPage));
286
+ store.dispatch(setCSRFToken({ csrfToken }));
287
+ },
288
+ [() => __\u03A9SuperglueStore, "store", () => __\u03A9SaveResponse, "initialPage", "path", "", 'Pn!2"n#2$&2%"/&']
289
+ );
290
+ var setup = __assignType2(({ initialPage, baseUrl, path, store, buildVisitAndRemote, history, navigatorRef }) => {
291
+ config.baseUrl = baseUrl;
292
+ const { visit, remote } = buildVisitAndRemote(navigatorRef, store);
293
+ const initialPageKey = urlToPageKey(path);
294
+ const nextHistory = history || createHistory();
295
+ nextHistory.replace(...argsForHistory(path));
296
+ prepareStore(store, initialPage, path);
297
+ const handlers = ujsHandlers({
298
+ visit,
299
+ remote,
300
+ ujsAttributePrefix: "data-sg",
301
+ store
302
+ });
303
+ const streamActions = new StreamActions({ remote, store });
304
+ return {
305
+ visit,
306
+ remote,
307
+ nextHistory,
308
+ initialPageKey,
309
+ ujs: handlers,
310
+ streamActions
311
+ };
312
+ }, [() => __\u03A9SetupProps, "param0", "", 'Pn!2""/#']);
313
+ if (process.env.NODE_ENV !== "production") {
314
+ console.info("%cSuperglue Development Mode: Remember to build for production before deploying.", "font-weight:bold");
315
+ }
316
+ function Application({ initialPage, baseUrl, path, store, buildVisitAndRemote, history, mapping, ...rest }) {
317
+ const navigatorRef = (useRef.\u03A9 = [[() => __\u03A9NavigateTo, "navigateTo", 'PPn!4"M,J']], useRef(null));
318
+ const { visit, remote, nextHistory, initialPageKey, ujs, streamActions } = useMemo(() => {
319
+ return setup({
320
+ initialPage,
321
+ baseUrl,
322
+ path,
323
+ store,
324
+ buildVisitAndRemote,
325
+ history,
326
+ navigatorRef
327
+ });
328
+ }, []);
329
+ return /* @__PURE__ */ React2.createElement("div", { onClick: ujs.onClick, onSubmit: ujs.onSubmit, ...rest }, /* @__PURE__ */ React2.createElement(Provider, { store }, /* @__PURE__ */ React2.createElement(CableContext.Provider, { value: { streamActions, cable } }, /* @__PURE__ */ React2.createElement(NavigationProvider, { ref: navigatorRef, visit, remote, mapping, history: nextHistory, initialPageKey }))));
330
+ }
331
+ Application.__type = [() => __\u03A9ApplicationProps, "param0", "Application", 'Pn!2""/#'];
332
+ export {
333
+ Application,
334
+ GRAFTING_ERROR,
335
+ GRAFTING_SUCCESS,
336
+ NavigationContext,
337
+ NavigationProvider,
338
+ __\u03A9AllFragments,
339
+ __\u03A9AllPages,
340
+ __\u03A9ApplicationProps,
341
+ __\u03A9ApplicationRemote,
342
+ __\u03A9ApplicationVisit,
343
+ __\u03A9BasicRequestInit,
344
+ __\u03A9BeforeSave,
345
+ __\u03A9BuildStore,
346
+ __\u03A9BuildVisitAndRemote,
347
+ __\u03A9ComponentIdentifier,
348
+ __\u03A9Defer,
349
+ __\u03A9DefermentThunk,
350
+ __\u03A9Dispatch,
351
+ __\u03A9FetchArgs,
352
+ __\u03A9Fragment,
353
+ __\u03A9FragmentPath,
354
+ __\u03A9FragmentRef,
355
+ __\u03A9GraftResponse,
356
+ __\u03A9GraftingErrorAction,
357
+ __\u03A9GraftingSuccessAction,
358
+ __\u03A9Handlers,
359
+ __\u03A9HistoryState,
360
+ __\u03A9JSONKeyable,
361
+ __\u03A9JSONMappable,
362
+ __\u03A9JSONObject,
363
+ __\u03A9JSONPrimitive,
364
+ __\u03A9JSONValue,
365
+ __\u03A9Keypath,
366
+ __\u03A9Meta,
367
+ __\u03A9MetaThunk,
368
+ __\u03A9NavigateTo,
369
+ __\u03A9NavigationAction,
370
+ __\u03A9NavigationContextProps,
371
+ __\u03A9NavigationProviderProps,
372
+ __\u03A9Page,
373
+ __\u03A9PageKey,
374
+ __\u03A9PageResponse,
375
+ __\u03A9ParsedResponse,
376
+ __\u03A9ReceiveType,
377
+ __\u03A9Remote,
378
+ __\u03A9RemoteCreator,
379
+ __\u03A9RemoteProps,
380
+ __\u03A9RestoreStrategy,
381
+ __\u03A9RootState,
382
+ __\u03A9SaveAndProcessPageThunk,
383
+ __\u03A9SaveResponse,
384
+ __\u03A9SetupProps,
385
+ __\u03A9StreamMessage,
386
+ __\u03A9StreamResponse,
387
+ __\u03A9SuperglueState,
388
+ __\u03A9SuperglueStore,
389
+ __\u03A9UJSHandlers,
390
+ __\u03A9Unproxy,
391
+ __\u03A9Visit,
392
+ __\u03A9VisitCreator,
393
+ __\u03A9VisitMeta,
394
+ __\u03A9VisitMetaThunk,
395
+ __\u03A9VisitProps,
396
+ beforeFetch,
397
+ beforeRemote,
398
+ beforeVisit,
399
+ copyPage,
400
+ getIn,
401
+ pageReducer,
402
+ prepareStore,
403
+ receiveResponse,
404
+ removePage,
405
+ rootReducer,
406
+ saveAndProcessPage,
407
+ saveResponse,
408
+ setup,
409
+ superglueReducer,
410
+ unproxy,
411
+ urlToPageKey,
412
+ useContent,
413
+ useSetFragment,
414
+ useStreamSource,
415
+ useSuperglue
416
+ };
417
+ //# sourceMappingURL=superglue.development.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../lib/index.tsx","../lib/components/Navigation.tsx"],"sourcesContent":["function __assignType(fn, args) {\n fn.__type = args;\n return fn;\n}\nimport React, { useRef, useMemo } from 'react';\nimport { config } from './config';\nimport { urlToPageKey, ujsHandlers, argsForHistory } from './utils';\nimport { saveAndProcessPage } from './action_creators';\nimport { historyChange, setCSRFToken, receiveResponse } from './actions';\nimport { Provider } from 'react-redux';\nimport { CableContext, StreamActions } from './hooks/useStreamSource';\nimport { createConsumer } from '@rails/actioncable';\nimport { createBrowserHistory, createMemoryHistory } from 'history';\nimport { NavigationProvider } from './components/Navigation';\nexport { NavigationProvider, NavigationContext } from './components/Navigation';\nexport { saveAndProcessPage } from './action_creators';\nexport { beforeFetch, beforeVisit, beforeRemote, copyPage, removePage, saveResponse, receiveResponse, GRAFTING_ERROR, GRAFTING_SUCCESS, } from './actions';\nexport * from './types';\n/*@ts-ignore*/\nimport { __ΩSuperglueStore, __ΩSaveResponse, __ΩSetupProps, __ΩNavigateTo, __ΩApplicationProps } from './types';\nimport { SaveResponse, ApplicationProps, NavigateTo, SuperglueStore, SetupProps, } from './types';\nexport { superglueReducer, pageReducer, rootReducer } from './reducers';\nexport { getIn } from './utils/immutability';\nexport { urlToPageKey };\nexport * from './hooks';\nexport { unproxy } from './hooks/useContent';\nfunction getConfig(name: string) {\n if (typeof document !== 'undefined') {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`);\n if (element) {\n return element.getAttribute('content') || '/cable';\n }\n else {\n return '/cable';\n }\n }\n else {\n return '/cable';\n }\n}\ngetConfig.__type = ['name', 'getConfig', 'P&2!\"/\"'];\nconst cable = createConsumer(getConfig('url'));\nconst hasWindow = typeof window !== 'undefined';\nconst createHistory = () => {\n if (hasWindow) {\n // This is used for client side rendering\n return createBrowserHistory({});\n }\n else {\n // This is used for server side rendering\n return createMemoryHistory({});\n }\n};\nexport const prepareStore = __assignType((store: SuperglueStore, initialPage: SaveResponse, path: string) => {\n const initialPageKey = urlToPageKey(path);\n const { csrfToken } = initialPage;\n store.dispatch(historyChange({\n pageKey: initialPageKey,\n }));\n store.dispatch(receiveResponse({ pageKey: initialPageKey, response: initialPage }));\n store.dispatch(saveAndProcessPage(initialPageKey, initialPage));\n store.dispatch(setCSRFToken({ csrfToken }));\n}\n/**\n * This is the setup function that the Application calls. Use this function if\n * you like to build your own Application component.\n */\n, [() => __ΩSuperglueStore, 'store', () => __ΩSaveResponse, 'initialPage', 'path', '', 'Pn!2\"n#2$&2%\"/&']);\n/**\n * This is the setup function that the Application calls. Use this function if\n * you like to build your own Application component.\n */\nexport const setup = __assignType(({ initialPage, baseUrl, path, store, buildVisitAndRemote, history, navigatorRef, }: SetupProps) => {\n config.baseUrl = baseUrl;\n const { visit, remote } = buildVisitAndRemote(navigatorRef, store);\n const initialPageKey = urlToPageKey(path);\n const nextHistory = history || createHistory();\n nextHistory.replace(...argsForHistory(path));\n prepareStore(store, initialPage, path);\n const handlers = ujsHandlers({\n visit,\n remote,\n ujsAttributePrefix: 'data-sg',\n store,\n });\n const streamActions = new StreamActions({ remote, store });\n return {\n visit,\n remote,\n nextHistory,\n initialPageKey,\n ujs: handlers,\n streamActions,\n };\n}, [() => __ΩSetupProps, 'param0', '', 'Pn!2\"\"/#']);\nif (process.env.NODE_ENV !== 'production') {\n console.info('%cSuperglue Development Mode: ' +\n 'Remember to build for production before deploying.', 'font-weight:bold');\n}\n/**\n * The entry point to your superglue application. It sets up the redux Provider,\n * redux state and the Navigation component.\n *\n * This is a simple component, you can override this by copying the source code and\n * use the exported methods used by this component (`start` and `ujsHandler`).\n */\nfunction Application({ initialPage, baseUrl, path, store, buildVisitAndRemote, history, mapping, ...rest }: ApplicationProps) {\n const navigatorRef = (useRef.Ω = [[() => __ΩNavigateTo, 'navigateTo', 'PPn!4\"M,J']], useRef<{\n navigateTo: NavigateTo;\n } | null>(null));\n const { visit, remote, nextHistory, initialPageKey, ujs, streamActions } = useMemo(() => {\n return setup({\n initialPage,\n baseUrl,\n path,\n store,\n buildVisitAndRemote,\n history,\n navigatorRef,\n });\n }, []);\n // The Nav component is pretty bare and can be inherited from for custom\n // behavior or replaced with your own.\n return (<div onClick={ujs.onClick} onSubmit={ujs.onSubmit} {...rest}>\n <Provider store={store}>\n <CableContext.Provider value={{ streamActions, cable }}>\n <NavigationProvider ref={navigatorRef} visit={visit} remote={remote} mapping={mapping} history={nextHistory} initialPageKey={initialPageKey}/>\n </CableContext.Provider>\n </Provider>\n </div>);\n}\nApplication.__type = [() => __ΩApplicationProps, 'param0', 'Application', 'Pn!2\"\"/#'];\nexport { Application };\n","function __assignType(fn, args) {\n fn.__type = args;\n return fn;\n}\nimport React, { createContext, useEffect, useLayoutEffect, forwardRef, useImperativeHandle, ForwardedRef, } from 'react';\nimport { urlToPageKey } from '../utils';\nimport { removePage, setActivePage } from '../actions';\n/*@ts-ignore*/\nimport { __ΩNavigationContextProps, __ΩRootState, __ΩAllPages, __ΩSuperglueState, __ΩNavigationProviderProps } from '../types';\nimport { HistoryState, RootState, NavigateTo, NavigationContextProps, NavigationProviderProps, AllPages, SuperglueState, } from '../types';\nimport { Update } from 'history';\nimport { useDispatch, useSelector, useStore } from 'react-redux';\nconst NavigationContext = (createContext.Ω = [[() => __ΩNavigationContextProps, 'n!']], createContext<NavigationContextProps>({} as NavigationContextProps));\nconst hasWindow = typeof window !== 'undefined';\nconst setWindowScroll = __assignType((posX: number, posY: number): void => {\n hasWindow && window.scrollTo(posX, posY);\n}, ['posX', 'posY', '', 'P\\'2!\\'2\"$/#']);\nconst notFound = __assignType((identifier: string | undefined): never => {\n let reminder = '';\n if (!identifier) {\n reminder =\n 'Did you forget to add `json.componentIdentifier` in your application.json.props layout?';\n }\n const error = new Error(`Superglue Nav component was looking for ${identifier} but could not find it in your mapping. ${reminder}`);\n throw error;\n}, ['identifier', '', 'PP&-J2!!/\"']);\nconst NavigationProvider = forwardRef(__assignType(function NavigationProvider({ history, visit, remote, mapping }: NavigationProviderProps, ref: ForwardedRef<{\n navigateTo: NavigateTo | null;\n}>) {\n const dispatch = useDispatch();\n const pages = (useSelector.Ω = [[() => __ΩRootState, 'n!'], [() => __ΩAllPages, 'n!']], useSelector<RootState, AllPages>(__assignType((state) => state.pages, ['state', '', 'P\"2!\"/\"'])));\n const superglue = (useSelector.Ω = [[() => __ΩRootState, 'n!'], [() => __ΩSuperglueState, 'n!']], useSelector<RootState, SuperglueState>(__assignType((state) => state.superglue, ['state', '', 'P\"2!\"/\"'])));\n const currentPageKey = (useSelector.Ω = [[() => __ΩRootState, 'n!'], ['&']], useSelector<RootState, string>(__assignType((state) => state.superglue.currentPageKey, ['state', '', 'P\"2!\"/\"'])));\n const store = (useStore.Ω = [[() => __ΩRootState, 'n!']], useStore<RootState>());\n useEffect(() => {\n return history.listen(onHistoryChange);\n }, []);\n useLayoutEffect(() => {\n const state = history.location.state as HistoryState;\n if (state && 'superglue' in state) {\n const { posX, posY } = state;\n setWindowScroll(posX, posY);\n }\n }, [currentPageKey]);\n useImperativeHandle(ref, () => {\n return {\n navigateTo,\n };\n }, []);\n const onHistoryChange = __assignType(({ location, action }: Update): void => {\n const state = location.state as HistoryState;\n if (action !== 'POP') {\n return;\n }\n if (!state && location.hash !== '') {\n const nextPageKey = urlToPageKey(location.pathname + location.search);\n const containsKey = !!pages[nextPageKey];\n if (containsKey) {\n history.replace({\n pathname: location.pathname,\n search: location.search,\n hash: location.hash,\n }, {\n superglue: true,\n posY: window.pageYOffset,\n posX: window.pageXOffset,\n });\n }\n }\n if (state && 'superglue' in state) {\n const pageKey = urlToPageKey(location.pathname + location.search);\n const prevPageKey = store.getState().superglue.currentPageKey;\n const containsKey = !!pages[pageKey];\n if (containsKey) {\n const { restoreStrategy } = pages[pageKey];\n switch (restoreStrategy) {\n case 'fromCacheOnly':\n dispatch(setActivePage({ pageKey }));\n break;\n case 'fromCacheAndRevisitInBackground':\n dispatch(setActivePage({ pageKey }));\n visit(pageKey, { revisit: true });\n break;\n case 'revisitOnly':\n default:\n visit(pageKey, { revisit: true }).then(() => {\n const noNav = prevPageKey === store.getState().superglue.currentPageKey;\n if (noNav) {\n // When \"POP'ed\", revisiting (using revisit: true) a page can result in\n // a redirect, or a render of the same page.\n //\n // When its a redirect, calculateNavAction will correctly set the\n // navigationAction to `replace` this is the noop scenario.\n //\n // When its the same page, navigationAction is set to `none` and\n // no navigation took place. In that case, we have to set the\n // activePage otherwise the user is stuck on the original page.\n dispatch(setActivePage({ pageKey }));\n }\n });\n }\n }\n else {\n visit(pageKey, { revisit: true }).then(() => {\n const noNav = prevPageKey === store.getState().superglue.currentPageKey;\n if (noNav) {\n dispatch(setActivePage({ pageKey }));\n }\n });\n }\n }\n }, ['Update', 'param0', '', 'P\"w!2\"$/#']);\n const navigateTo: NavigateTo = __assignType((path, { action } = {\n action: 'push',\n }) => {\n if (action === 'none') {\n return false;\n }\n const nextPageKey = urlToPageKey(path);\n const hasPage = Object.prototype.hasOwnProperty.call(store.getState().pages, nextPageKey);\n if (hasPage) {\n const location = history.location;\n const state = location.state as HistoryState;\n const historyArgs = [\n path,\n {\n superglue: true,\n posY: 0,\n posX: 0,\n },\n ] as const;\n if (action === 'push') {\n if (hasWindow) {\n history.replace({\n pathname: location.pathname,\n search: location.search,\n hash: location.hash,\n }, {\n ...state,\n posY: window.scrollY,\n posX: window.scrollX,\n });\n }\n history.push(...historyArgs);\n dispatch(setActivePage({ pageKey: nextPageKey }));\n }\n if (action === 'replace') {\n history.replace(...historyArgs);\n if (currentPageKey !== nextPageKey) {\n dispatch(setActivePage({ pageKey: nextPageKey }));\n dispatch(removePage({ pageKey: currentPageKey }));\n }\n }\n return true;\n }\n else {\n console.warn(`\\`navigateTo\\` was called , but could not find\n the pageKey in the store. This may happen when the wrong\n content_location was set in your non-get controller action.\n No navigation will take place`);\n return false;\n }\n }, ['path', 'param1', '', 'P\"2!\"2\"\"/#']);\n const { search } = superglue;\n const { componentIdentifier } = pages[currentPageKey];\n const Component = mapping[componentIdentifier];\n if (Component) {\n return (<NavigationContext.Provider value={{ pageKey: currentPageKey, search, navigateTo, visit, remote }}>\n <Component />\n </NavigationContext.Provider>);\n }\n else {\n notFound(componentIdentifier);\n }\n}, [() => __ΩNavigationProviderProps, 'param0', 'ref', 'NavigationProvider', 'Pn!2\"!2#\"/$']));\nexport { NavigationContext, NavigationProvider };\n"],"mappings":";;;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