@orderly.network/hooks 1.2.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/configProvider.d.ts +7 -1
- package/esm/configProvider.d.ts.map +1 -1
- package/esm/configProvider.js +44 -18
- package/esm/configProvider.js.map +1 -0
- package/esm/dataProvider.js +24 -19
- package/esm/dataProvider.js.map +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -1
- package/esm/index.js.map +1 -0
- package/esm/middleware/signatureMiddleware.js +9 -8
- package/esm/middleware/signatureMiddleware.js.map +1 -0
- package/esm/orderly/orderbook.service.js +39 -28
- package/esm/orderly/orderbook.service.js.map +1 -0
- package/esm/orderly/orderlyHooks.d.ts +3 -0
- package/esm/orderly/orderlyHooks.d.ts.map +1 -1
- package/esm/orderly/orderlyHooks.js +2 -0
- package/esm/orderly/orderlyHooks.js.map +1 -0
- package/esm/orderly/useAccountInfo.js +3 -1
- package/esm/orderly/useAccountInfo.js.map +1 -0
- package/esm/orderly/useChain.js +16 -9
- package/esm/orderly/useChain.js.map +1 -0
- package/esm/orderly/useChains.d.ts +11 -12
- package/esm/orderly/useChains.d.ts.map +1 -1
- package/esm/orderly/useChains.js +68 -46
- package/esm/orderly/useChains.js.map +1 -0
- package/esm/orderly/useCollateral.d.ts +3 -4
- package/esm/orderly/useCollateral.d.ts.map +1 -1
- package/esm/orderly/useCollateral.js +53 -20
- package/esm/orderly/useCollateral.js.map +1 -0
- package/esm/orderly/useDeposit.js +123 -125
- package/esm/orderly/useDeposit.js.map +1 -0
- package/esm/orderly/useFundingRate.js +14 -13
- package/esm/orderly/useFundingRate.js.map +1 -0
- package/esm/orderly/useFundingRates.js +6 -4
- package/esm/orderly/useFundingRates.js.map +1 -0
- package/esm/orderly/useHoldingStream.js +19 -15
- package/esm/orderly/useHoldingStream.js.map +1 -0
- package/esm/orderly/useIndexPrice.js +7 -5
- package/esm/orderly/useIndexPrice.js.map +1 -0
- package/esm/orderly/useLeverage.js +9 -12
- package/esm/orderly/useLeverage.js.map +1 -0
- package/esm/orderly/useMarginRatio.js +27 -13
- package/esm/orderly/useMarginRatio.js.map +1 -0
- package/esm/orderly/useMarkPrice.js +13 -7
- package/esm/orderly/useMarkPrice.js.map +1 -0
- package/esm/orderly/useMarkPricesStream.d.ts +1 -1
- package/esm/orderly/useMarkPricesStream.d.ts.map +1 -1
- package/esm/orderly/useMarkPricesStream.js +9 -8
- package/esm/orderly/useMarkPricesStream.js.map +1 -0
- package/esm/orderly/useMarketTradeStream.js +33 -18
- package/esm/orderly/useMarketTradeStream.js.map +1 -0
- package/esm/orderly/useMarkets.js +144 -81
- package/esm/orderly/useMarkets.js.map +1 -0
- package/esm/orderly/useMarketsStream.js +23 -28
- package/esm/orderly/useMarketsStream.js.map +1 -0
- package/esm/orderly/useMaxQty.d.ts +6 -0
- package/esm/orderly/useMaxQty.d.ts.map +1 -1
- package/esm/orderly/useMaxQty.js +26 -18
- package/esm/orderly/useMaxQty.js.map +1 -0
- package/esm/orderly/useOpenInterest.js +7 -5
- package/esm/orderly/useOpenInterest.js.map +1 -0
- package/esm/orderly/useOrderEntry.js +182 -160
- package/esm/orderly/useOrderEntry.js.map +1 -0
- package/esm/orderly/useOrderStream.js +85 -66
- package/esm/orderly/useOrderStream.js.map +1 -0
- package/esm/orderly/useOrderbookStream.d.ts +2 -3
- package/esm/orderly/useOrderbookStream.d.ts.map +1 -1
- package/esm/orderly/useOrderbookStream.js +173 -103
- package/esm/orderly/useOrderbookStream.js.map +1 -0
- package/esm/orderly/usePositionStream.js +82 -62
- package/esm/orderly/usePositionStream.js.map +1 -0
- package/esm/orderly/usePrivateDataObserver.js +55 -48
- package/esm/orderly/usePrivateDataObserver.js.map +1 -0
- package/esm/orderly/useSettleSubscription.js +8 -6
- package/esm/orderly/useSettleSubscription.js.map +1 -0
- package/esm/orderly/useSymbolPriceRange.js +14 -8
- package/esm/orderly/useSymbolPriceRange.js.map +1 -0
- package/esm/orderly/useSymbolsInfo.js +7 -5
- package/esm/orderly/useSymbolsInfo.js.map +1 -0
- package/esm/orderly/useTickerStream.d.ts +5 -1
- package/esm/orderly/useTickerStream.d.ts.map +1 -1
- package/esm/orderly/useTickerStream.js +26 -29
- package/esm/orderly/useTickerStream.js.map +1 -0
- package/esm/orderly/useWalletSubscription.js +8 -6
- package/esm/orderly/useWalletSubscription.js.map +1 -0
- package/esm/orderly/useWithdraw.js +19 -11
- package/esm/orderly/useWithdraw.js.map +1 -0
- package/esm/orderlyContext.d.ts +8 -1
- package/esm/orderlyContext.d.ts.map +1 -1
- package/esm/orderlyContext.js +2 -1
- package/esm/orderlyContext.js.map +1 -0
- package/esm/services/dataCenter.js +10 -8
- package/esm/services/dataCenter.js.map +1 -0
- package/esm/services/painter/backgroundPaint.js +11 -14
- package/esm/services/painter/backgroundPaint.js.map +1 -0
- package/esm/services/painter/basePaint.js +5 -1
- package/esm/services/painter/basePaint.js.map +1 -0
- package/esm/services/painter/dataPaint.js +53 -50
- package/esm/services/painter/dataPaint.js.map +1 -0
- package/esm/services/painter/layout.config.js +15 -13
- package/esm/services/painter/layout.config.js.map +1 -0
- package/esm/services/painter/painter.js +14 -13
- package/esm/services/painter/painter.js.map +1 -0
- package/esm/services/painter/resource.js +6 -4
- package/esm/services/painter/resource.js.map +1 -0
- package/esm/statusProvider.js +10 -3
- package/esm/statusProvider.js.map +1 -0
- package/esm/unuse/apiPrefixMiddleware.js +18 -16
- package/esm/unuse/apiPrefixMiddleware.js.map +1 -0
- package/esm/unuse/fn.js +3 -1
- package/esm/unuse/fn.js.map +1 -0
- package/esm/unuse/useBalance.js +6 -4
- package/esm/unuse/useBalance.js.map +1 -0
- package/esm/unuse/useFetures.js +26 -18
- package/esm/unuse/useFetures.js.map +1 -0
- package/esm/unuse/useRunOnce.js +10 -7
- package/esm/unuse/useRunOnce.js.map +1 -0
- package/esm/unuse/useSyncEnd.js +5 -4
- package/esm/unuse/useSyncEnd.js.map +1 -0
- package/esm/unuse/useTokenInfo.js +7 -5
- package/esm/unuse/useTokenInfo.js.map +1 -0
- package/esm/unuse/useUnsettlementPnL.js +7 -3
- package/esm/unuse/useUnsettlementPnL.js.map +1 -0
- package/esm/useAccount.js +18 -21
- package/esm/useAccount.js.map +1 -0
- package/esm/useAccountInstance.js +6 -7
- package/esm/useAccountInstance.js.map +1 -0
- package/esm/useBoolean.js +14 -5
- package/esm/useBoolean.js.map +1 -0
- package/esm/useConfig.js +3 -1
- package/esm/useConfig.js.map +1 -0
- package/esm/useEventEmitter.js +4 -2
- package/esm/useEventEmitter.js.map +1 -0
- package/esm/useLazyQuery.js +6 -7
- package/esm/useLazyQuery.js.map +1 -0
- package/esm/useLocalStorage.js +30 -20
- package/esm/useLocalStorage.js.map +1 -0
- package/esm/useMediaQuery.js +11 -9
- package/esm/useMediaQuery.js.map +1 -0
- package/esm/useMutation.js +26 -37
- package/esm/useMutation.js.map +1 -0
- package/esm/useObserve.js +4 -4
- package/esm/useObserve.js.map +1 -0
- package/esm/useParamsCheck.js +8 -10
- package/esm/useParamsCheck.js.map +1 -0
- package/esm/usePoster.js +56 -45
- package/esm/usePoster.js.map +1 -0
- package/esm/usePreloadData.js +9 -5
- package/esm/usePreloadData.js.map +1 -0
- package/esm/usePrivateInfiniteQuery.js +15 -9
- package/esm/usePrivateInfiniteQuery.js.map +1 -0
- package/esm/usePrivateQuery.js +15 -8
- package/esm/usePrivateQuery.js.map +1 -0
- package/esm/useQuery.js +6 -5
- package/esm/useQuery.js.map +1 -0
- package/esm/useSessionStorage.js +28 -19
- package/esm/useSessionStorage.js.map +1 -0
- package/esm/useWS.js +15 -13
- package/esm/useWS.js.map +1 -0
- package/esm/useWsStatus.js +12 -12
- package/esm/useWsStatus.js.map +1 -0
- package/esm/utils/createGetter.js +8 -8
- package/esm/utils/createGetter.js.map +1 -0
- package/esm/utils/createOrder.d.ts +1 -0
- package/esm/utils/createOrder.d.ts.map +1 -1
- package/esm/utils/createOrder.js +59 -43
- package/esm/utils/createOrder.js.map +1 -0
- package/esm/utils/dev.js +6 -4
- package/esm/utils/dev.js.map +1 -0
- package/esm/utils/fetcher.js +3 -1
- package/esm/utils/fetcher.js.map +1 -0
- package/esm/utils/json.js +3 -2
- package/esm/utils/json.js.map +1 -0
- package/esm/utils/orderEntryHelper.js +92 -63
- package/esm/utils/orderEntryHelper.js.map +1 -0
- package/esm/utils/parseHolding.js +10 -6
- package/esm/utils/parseHolding.js.map +1 -0
- package/esm/utils/swr.js +114 -104
- package/esm/utils/swr.js.map +1 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +4 -3
- package/esm/version.js.map +1 -0
- package/esm/walletConnectorContext.js +4 -2
- package/esm/walletConnectorContext.js.map +1 -0
- package/lib/configProvider.d.ts +7 -1
- package/lib/configProvider.d.ts.map +1 -1
- package/lib/configProvider.js +108 -56
- package/lib/configProvider.js.map +1 -0
- package/lib/dataProvider.js +50 -29
- package/lib/dataProvider.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +191 -88
- package/lib/index.js.map +1 -0
- package/lib/middleware/signatureMiddleware.js +22 -15
- package/lib/middleware/signatureMiddleware.js.map +1 -0
- package/lib/orderly/orderbook.service.js +59 -33
- package/lib/orderly/orderbook.service.js.map +1 -0
- package/lib/orderly/orderlyHooks.d.ts +3 -0
- package/lib/orderly/orderlyHooks.d.ts.map +1 -1
- package/lib/orderly/orderlyHooks.js +124 -57
- package/lib/orderly/orderlyHooks.js.map +1 -0
- package/lib/orderly/useAccountInfo.js +14 -6
- package/lib/orderly/useAccountInfo.js.map +1 -0
- package/lib/orderly/useChain.js +30 -17
- package/lib/orderly/useChain.js.map +1 -0
- package/lib/orderly/useChains.d.ts +11 -12
- package/lib/orderly/useChains.d.ts.map +1 -1
- package/lib/orderly/useChains.js +100 -59
- package/lib/orderly/useChains.js.map +1 -0
- package/lib/orderly/useCollateral.d.ts +3 -4
- package/lib/orderly/useCollateral.d.ts.map +1 -1
- package/lib/orderly/useCollateral.js +81 -42
- package/lib/orderly/useCollateral.js.map +1 -0
- package/lib/orderly/useDeposit.js +154 -150
- package/lib/orderly/useDeposit.js.map +1 -0
- package/lib/orderly/useFundingRate.js +29 -22
- package/lib/orderly/useFundingRate.js.map +1 -0
- package/lib/orderly/useFundingRates.js +19 -11
- package/lib/orderly/useFundingRates.js.map +1 -0
- package/lib/orderly/useHoldingStream.js +39 -27
- package/lib/orderly/useHoldingStream.js.map +1 -0
- package/lib/orderly/useIndexPrice.js +24 -14
- package/lib/orderly/useIndexPrice.js.map +1 -0
- package/lib/orderly/useLeverage.js +27 -24
- package/lib/orderly/useLeverage.js.map +1 -0
- package/lib/orderly/useMarginRatio.js +49 -29
- package/lib/orderly/useMarginRatio.js.map +1 -0
- package/lib/orderly/useMarkPrice.js +26 -15
- package/lib/orderly/useMarkPrice.js.map +1 -0
- package/lib/orderly/useMarkPricesStream.d.ts +1 -1
- package/lib/orderly/useMarkPricesStream.d.ts.map +1 -1
- package/lib/orderly/useMarkPricesStream.js +26 -17
- package/lib/orderly/useMarkPricesStream.js.map +1 -0
- package/lib/orderly/useMarketTradeStream.js +47 -26
- package/lib/orderly/useMarketTradeStream.js.map +1 -0
- package/lib/orderly/useMarkets.js +172 -95
- package/lib/orderly/useMarkets.js.map +1 -0
- package/lib/orderly/useMarketsStream.js +44 -41
- package/lib/orderly/useMarketsStream.js.map +1 -0
- package/lib/orderly/useMaxQty.d.ts +6 -0
- package/lib/orderly/useMaxQty.d.ts.map +1 -1
- package/lib/orderly/useMaxQty.js +52 -43
- package/lib/orderly/useMaxQty.js.map +1 -0
- package/lib/orderly/useOpenInterest.js +24 -14
- package/lib/orderly/useOpenInterest.js.map +1 -0
- package/lib/orderly/useOrderEntry.js +238 -210
- package/lib/orderly/useOrderEntry.js.map +1 -0
- package/lib/orderly/useOrderStream.js +111 -84
- package/lib/orderly/useOrderStream.js.map +1 -0
- package/lib/orderly/useOrderbookStream.d.ts +2 -3
- package/lib/orderly/useOrderbookStream.d.ts.map +1 -1
- package/lib/orderly/useOrderbookStream.js +227 -148
- package/lib/orderly/useOrderbookStream.js.map +1 -0
- package/lib/orderly/usePositionStream.js +134 -100
- package/lib/orderly/usePositionStream.js.map +1 -0
- package/lib/orderly/usePrivateDataObserver.js +76 -63
- package/lib/orderly/usePrivateDataObserver.js.map +1 -0
- package/lib/orderly/useSettleSubscription.js +25 -15
- package/lib/orderly/useSettleSubscription.js.map +1 -0
- package/lib/orderly/useSymbolPriceRange.js +29 -23
- package/lib/orderly/useSymbolPriceRange.js.map +1 -0
- package/lib/orderly/useSymbolsInfo.js +23 -15
- package/lib/orderly/useSymbolsInfo.js.map +1 -0
- package/lib/orderly/useTickerStream.d.ts +5 -1
- package/lib/orderly/useTickerStream.d.ts.map +1 -1
- package/lib/orderly/useTickerStream.js +51 -48
- package/lib/orderly/useTickerStream.js.map +1 -0
- package/lib/orderly/useWalletSubscription.js +25 -15
- package/lib/orderly/useWalletSubscription.js.map +1 -0
- package/lib/orderly/useWithdraw.js +36 -22
- package/lib/orderly/useWithdraw.js.map +1 -0
- package/lib/orderlyContext.d.ts +8 -1
- package/lib/orderlyContext.d.ts.map +1 -1
- package/lib/orderlyContext.js +22 -6
- package/lib/orderlyContext.js.map +1 -0
- package/lib/services/dataCenter.js +15 -11
- package/lib/services/dataCenter.js.map +1 -0
- package/lib/services/painter/backgroundPaint.js +21 -18
- package/lib/services/painter/backgroundPaint.js.map +1 -0
- package/lib/services/painter/basePaint.js +14 -4
- package/lib/services/painter/basePaint.js.map +1 -0
- package/lib/services/painter/dataPaint.js +67 -58
- package/lib/services/painter/dataPaint.js.map +1 -0
- package/lib/services/painter/layout.config.js +25 -16
- package/lib/services/painter/layout.config.js.map +1 -0
- package/lib/services/painter/painter.js +27 -20
- package/lib/services/painter/painter.js.map +1 -0
- package/lib/services/painter/resource.js +15 -7
- package/lib/services/painter/resource.js.map +1 -0
- package/lib/statusProvider.js +31 -10
- package/lib/statusProvider.js.map +1 -0
- package/lib/unuse/apiPrefixMiddleware.js +30 -22
- package/lib/unuse/apiPrefixMiddleware.js.map +1 -0
- package/lib/unuse/fn.js +14 -5
- package/lib/unuse/fn.js.map +1 -0
- package/lib/unuse/useBalance.js +23 -13
- package/lib/unuse/useBalance.js.map +1 -0
- package/lib/unuse/useFetures.js +41 -28
- package/lib/unuse/useFetures.js.map +1 -0
- package/lib/unuse/useRunOnce.js +61 -11
- package/lib/unuse/useRunOnce.js.map +1 -0
- package/lib/unuse/useSyncEnd.js +17 -10
- package/lib/unuse/useSyncEnd.js.map +1 -0
- package/lib/unuse/useTokenInfo.js +20 -12
- package/lib/unuse/useTokenInfo.js.map +1 -0
- package/lib/unuse/useUnsettlementPnL.js +21 -11
- package/lib/unuse/useUnsettlementPnL.js.map +1 -0
- package/lib/useAccount.js +32 -29
- package/lib/useAccount.js.map +1 -0
- package/lib/useAccountInstance.js +27 -20
- package/lib/useAccountInstance.js.map +1 -0
- package/lib/useBoolean.js +25 -10
- package/lib/useBoolean.js.map +1 -0
- package/lib/useConfig.js +15 -7
- package/lib/useConfig.js.map +1 -0
- package/lib/useEventEmitter.js +23 -13
- package/lib/useEventEmitter.js.map +1 -0
- package/lib/useLazyQuery.js +25 -23
- package/lib/useLazyQuery.js.map +1 -0
- package/lib/useLocalStorage.js +44 -28
- package/lib/useLocalStorage.js.map +1 -0
- package/lib/useMediaQuery.js +22 -14
- package/lib/useMediaQuery.js.map +1 -0
- package/lib/useMutation.js +47 -52
- package/lib/useMutation.js.map +1 -0
- package/lib/useObserve.js +22 -8
- package/lib/useObserve.js.map +1 -0
- package/lib/useParamsCheck.js +18 -14
- package/lib/useParamsCheck.js.map +1 -0
- package/lib/usePoster.js +80 -74
- package/lib/usePoster.js.map +1 -0
- package/lib/usePreloadData.js +21 -11
- package/lib/usePreloadData.js.map +1 -0
- package/lib/usePrivateInfiniteQuery.js +36 -22
- package/lib/usePrivateInfiniteQuery.js.map +1 -0
- package/lib/usePrivateQuery.js +35 -25
- package/lib/usePrivateQuery.js.map +1 -0
- package/lib/useQuery.js +24 -20
- package/lib/useQuery.js.map +1 -0
- package/lib/useSessionStorage.js +41 -26
- package/lib/useSessionStorage.js.map +1 -0
- package/lib/useWS.js +42 -32
- package/lib/useWS.js.map +1 -0
- package/lib/useWsStatus.js +34 -20
- package/lib/useWsStatus.js.map +1 -0
- package/lib/utils/createGetter.js +19 -14
- package/lib/utils/createGetter.js.map +1 -0
- package/lib/utils/createOrder.d.ts +1 -0
- package/lib/utils/createOrder.d.ts.map +1 -1
- package/lib/utils/createOrder.js +133 -82
- package/lib/utils/createOrder.js.map +1 -0
- package/lib/utils/dev.js +13 -9
- package/lib/utils/dev.js.map +1 -0
- package/lib/utils/fetcher.js +13 -5
- package/lib/utils/fetcher.js.map +1 -0
- package/lib/utils/json.js +12 -5
- package/lib/utils/json.js.map +1 -0
- package/lib/utils/orderEntryHelper.js +125 -82
- package/lib/utils/orderEntryHelper.js.map +1 -0
- package/lib/utils/parseHolding.js +19 -9
- package/lib/utils/parseHolding.js.map +1 -0
- package/lib/utils/swr.js +134 -111
- package/lib/utils/swr.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +13 -4
- package/lib/version.js.map +1 -0
- package/lib/walletConnectorContext.js +23 -7
- package/lib/walletConnectorContext.js.map +1 -0
- package/package.json +17 -9
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useAccountInstance", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useAccountInstance;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _useconstant = /*#__PURE__*/ _interop_require_default(require("use-constant"));
|
|
12
|
+
const _core = require("@orderly.network/core");
|
|
13
|
+
const _react = require("react");
|
|
14
|
+
const _orderlyContext = require("./orderlyContext");
|
|
15
|
+
function _interop_require_default(obj) {
|
|
16
|
+
return obj && obj.__esModule ? obj : {
|
|
17
|
+
default: obj
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const useAccountInstance = ()=>{
|
|
21
|
+
const { configStore, keyStore, getWalletAdapter } = (0, _react.useContext)(_orderlyContext.OrderlyContext);
|
|
22
|
+
if (!configStore) throw new Error("configStore is not defined, please use OrderlyProvider");
|
|
15
23
|
if (!keyStore) {
|
|
16
24
|
throw new Error("keyStore is not defined, please use OrderlyProvider and provide keyStore");
|
|
17
25
|
}
|
|
18
|
-
const account = (0,
|
|
19
|
-
let account =
|
|
26
|
+
const account = (0, _useconstant.default)(()=>{
|
|
27
|
+
let account = _core.SimpleDI.get("account");
|
|
20
28
|
if (!account) {
|
|
21
|
-
account = new
|
|
22
|
-
|
|
23
|
-
);
|
|
24
|
-
core_1.SimpleDI.registerByName("account", account);
|
|
29
|
+
account = new _core.Account(configStore, keyStore, getWalletAdapter);
|
|
30
|
+
_core.SimpleDI.registerByName("account", account);
|
|
25
31
|
}
|
|
26
32
|
return account;
|
|
27
33
|
});
|
|
28
34
|
return account;
|
|
29
35
|
};
|
|
30
|
-
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=useAccountInstance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useAccountInstance.ts"],"sourcesContent":["import useConstant from \"use-constant\";\nimport { Account, SimpleDI } from \"@orderly.network/core\";\nimport { useContext } from \"react\";\nimport { OrderlyContext } from \"./orderlyContext\";\n\nexport const useAccountInstance = (): Account => {\n const { configStore, keyStore, getWalletAdapter } =\n useContext(OrderlyContext);\n\n if (!configStore)\n throw new Error(\"configStore is not defined, please use OrderlyProvider\");\n\n if (!keyStore) {\n throw new Error(\n \"keyStore is not defined, please use OrderlyProvider and provide keyStore\"\n );\n }\n\n const account = useConstant(() => {\n let account = SimpleDI.get<Account>(\"account\");\n\n if (!account) {\n account = new Account(\n configStore,\n keyStore,\n\n getWalletAdapter\n // walletAdapter\n );\n\n SimpleDI.registerByName(\"account\", account);\n }\n return account;\n });\n\n return account;\n};\n"],"names":["useAccountInstance","configStore","keyStore","getWalletAdapter","useContext","OrderlyContext","Error","account","useConstant","SimpleDI","get","Account","registerByName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAKaA;;;eAAAA;;;oEALW;sBACU;uBACP;gCACI;;;;;;AAExB,MAAMA,qBAAqB;IAChC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAC/CC,IAAAA,iBAAU,EAACC,8BAAc;IAE3B,IAAI,CAACJ,aACH,MAAM,IAAIK,MAAM;IAElB,IAAI,CAACJ,UAAU;QACb,MAAM,IAAII,MACR;IAEJ;IAEA,MAAMC,UAAUC,IAAAA,oBAAW,EAAC;QAC1B,IAAID,UAAUE,cAAQ,CAACC,GAAG,CAAU;QAEpC,IAAI,CAACH,SAAS;YACZA,UAAU,IAAII,aAAO,CACnBV,aACAC,UAEAC;YAIFM,cAAQ,CAACG,cAAc,CAAC,WAAWL;QACrC;QACA,OAAOA;IACT;IAEA,OAAOA;AACT"}
|
package/lib/useBoolean.js
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useBoolean", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useBoolean;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const useBoolean = (initialValue = false)=>{
|
|
13
|
+
const [value, setValue] = (0, _react.useState)(initialValue);
|
|
14
|
+
const setTrue = (0, _react.useCallback)(()=>setValue(true), []);
|
|
15
|
+
const setFalse = (0, _react.useCallback)(()=>setValue(false), []);
|
|
16
|
+
const toggle = (0, _react.useCallback)(()=>setValue((v)=>!v), []);
|
|
17
|
+
return [
|
|
18
|
+
value,
|
|
19
|
+
{
|
|
20
|
+
setTrue,
|
|
21
|
+
setFalse,
|
|
22
|
+
toggle
|
|
23
|
+
}
|
|
24
|
+
];
|
|
11
25
|
};
|
|
12
|
-
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=useBoolean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useBoolean.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\n\nexport const useBoolean = (\n initialValue = false\n): [\n boolean,\n {\n setTrue: () => void;\n setFalse: () => void;\n toggle: () => void;\n }\n] => {\n const [value, setValue] = useState(initialValue);\n const setTrue = useCallback(() => setValue(true), []);\n const setFalse = useCallback(() => setValue(false), []);\n const toggle = useCallback(() => setValue((v) => !v), []);\n return [value, { setTrue, setFalse, toggle }];\n};\n"],"names":["useBoolean","initialValue","value","setValue","useState","setTrue","useCallback","setFalse","toggle","v"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAEaA;;;eAAAA;;;uBAFyB;AAE/B,MAAMA,aAAa,CACxBC,eAAe,KAAK;IASpB,MAAM,CAACC,OAAOC,SAAS,GAAGC,IAAAA,eAAQ,EAACH;IACnC,MAAMI,UAAUC,IAAAA,kBAAW,EAAC,IAAMH,SAAS,OAAO,EAAE;IACpD,MAAMI,WAAWD,IAAAA,kBAAW,EAAC,IAAMH,SAAS,QAAQ,EAAE;IACtD,MAAMK,SAASF,IAAAA,kBAAW,EAAC,IAAMH,SAAS,CAACM,IAAM,CAACA,IAAI,EAAE;IACxD,OAAO;QAACP;QAAO;YAAEG;YAASE;YAAUC;QAAO;KAAE;AAC/C"}
|
package/lib/useConfig.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useConfig", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useConfig;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const _orderlyContext = require("./orderlyContext");
|
|
13
|
+
const useConfig = (key, defaultValue)=>{
|
|
14
|
+
const { configStore } = (0, _react.useContext)(_orderlyContext.OrderlyContext);
|
|
8
15
|
if (typeof key !== "undefined") {
|
|
9
16
|
if (typeof defaultValue !== "undefined") {
|
|
10
17
|
return configStore.getOr(key, defaultValue);
|
|
@@ -13,4 +20,5 @@ const useConfig = (key, defaultValue) => {
|
|
|
13
20
|
}
|
|
14
21
|
return configStore;
|
|
15
22
|
};
|
|
16
|
-
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=useConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useConfig.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { OrderlyContext } from \"./orderlyContext\";\nimport { ConfigStore, type ConfigKey } from \"@orderly.network/core\";\n\nexport const useConfig = <T>(\n key?: ConfigKey,\n defaultValue?: T\n): T | ConfigStore => {\n const { configStore } = useContext(OrderlyContext);\n\n if (typeof key !== \"undefined\") {\n if (typeof defaultValue !== \"undefined\") {\n return configStore.getOr(key, defaultValue);\n }\n return configStore.get(key);\n }\n\n return configStore;\n};\n"],"names":["useConfig","key","defaultValue","configStore","useContext","OrderlyContext","getOr","get"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAIaA;;;eAAAA;;;uBAJc;gCACI;AAGxB,MAAMA,YAAY,CACvBC,KACAC;IAEA,MAAM,EAAEC,WAAW,EAAE,GAAGC,IAAAA,iBAAU,EAACC,8BAAc;IAEjD,IAAI,OAAOJ,QAAQ,aAAa;QAC9B,IAAI,OAAOC,iBAAiB,aAAa;YACvC,OAAOC,YAAYG,KAAK,CAACL,KAAKC;QAChC;QACA,OAAOC,YAAYI,GAAG,CAACN;IACzB;IAEA,OAAOE;AACT"}
|
package/lib/useEventEmitter.js
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useEventEmitter", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useEventEmitter;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _useconstant = /*#__PURE__*/ _interop_require_default(require("use-constant"));
|
|
12
|
+
const _core = require("@orderly.network/core");
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const useEventEmitter = ()=>{
|
|
19
|
+
return (0, _useconstant.default)(()=>{
|
|
20
|
+
let ee = _core.SimpleDI.get("EE");
|
|
12
21
|
if (!ee) {
|
|
13
|
-
ee = new
|
|
14
|
-
|
|
22
|
+
ee = new _core.EventEmitter();
|
|
23
|
+
_core.SimpleDI.registerByName("EE", ee);
|
|
15
24
|
}
|
|
16
25
|
return ee;
|
|
17
26
|
});
|
|
18
27
|
};
|
|
19
|
-
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=useEventEmitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useEventEmitter.ts"],"sourcesContent":["import useConstant from \"use-constant\";\nimport { EventEmitter, SimpleDI } from \"@orderly.network/core\";\n\nexport const useEventEmitter = () => {\n return useConstant(() => {\n let ee = SimpleDI.get<EventEmitter>(\"EE\");\n\n if (!ee) {\n ee = new EventEmitter();\n\n SimpleDI.registerByName(\"EE\", ee);\n }\n return ee;\n });\n};\n"],"names":["useEventEmitter","useConstant","ee","SimpleDI","get","EventEmitter","registerByName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGaA;;;eAAAA;;;oEAHW;sBACe;;;;;;AAEhC,MAAMA,kBAAkB;IAC7B,OAAOC,IAAAA,oBAAW,EAAC;QACjB,IAAIC,KAAKC,cAAQ,CAACC,GAAG,CAAe;QAEpC,IAAI,CAACF,IAAI;YACPA,KAAK,IAAIG,kBAAY;YAErBF,cAAQ,CAACG,cAAc,CAAC,MAAMJ;QAChC;QACA,OAAOA;IACT;AACF"}
|
package/lib/useLazyQuery.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useLazyQuery", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useLazyQuery;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _fetcher = require("./utils/fetcher");
|
|
12
|
+
const _mutation = /*#__PURE__*/ _interop_require_default(require("swr/mutation"));
|
|
13
|
+
const _useConfig = require("./useConfig");
|
|
14
|
+
function _interop_require_default(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const useLazyQuery = (query, options)=>{
|
|
20
|
+
const apiBaseUrl = (0, _useConfig.useConfig)("apiBaseUrl");
|
|
18
21
|
const { formatter, init, ...swrOptions } = options || {};
|
|
19
22
|
// check the query is public api
|
|
20
23
|
// if (typeof query === "string" && !query.startsWith("/v1/public")) {
|
|
@@ -24,19 +27,18 @@ const useLazyQuery = (query, options) => {
|
|
|
24
27
|
throw new Error("please add OrderlyConfigProvider to your app");
|
|
25
28
|
}
|
|
26
29
|
// @ts-ignore
|
|
27
|
-
return (0,
|
|
30
|
+
return (0, _mutation.default)(query, (url, options)=>{
|
|
28
31
|
url = url.startsWith("http") ? url : `${apiBaseUrl}${url}`;
|
|
29
32
|
if (options?.arg) {
|
|
30
33
|
// const searchParams = new URLSearchParams(init.arg);
|
|
31
34
|
// url = `${url}?${encodeURIComponent(searchParams.toString())}`;
|
|
32
|
-
const queryString = Object.entries(options.arg)
|
|
33
|
-
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
34
|
-
.join("&");
|
|
35
|
+
const queryString = Object.entries(options.arg).map(([key, value])=>`${key}=${encodeURIComponent(value)}`).join("&");
|
|
35
36
|
url = `${url}?${queryString}`;
|
|
36
37
|
}
|
|
37
|
-
return (0,
|
|
38
|
-
formatter
|
|
38
|
+
return (0, _fetcher.fetcher)(url, init, {
|
|
39
|
+
formatter
|
|
39
40
|
});
|
|
40
41
|
}, swrOptions);
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=useLazyQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useLazyQuery.ts"],"sourcesContent":["import useSWR from \"swr\";\nimport { fetcher } from \"./utils/fetcher\";\nimport useSWRMutation, {\n type SWRMutationConfiguration,\n SWRMutationResponse,\n} from \"swr/mutation\";\nimport { useConfig } from \"./useConfig\";\n\n/**\n * useQuery\n * @description for public api\n * @param query\n * @param options\n */\nexport const useLazyQuery = <T, R = any>(\n query: Parameters<typeof useSWR>[\"0\"],\n options?: SWRMutationConfiguration<any, any> & {\n formatter?: (data: any) => R;\n init?: RequestInit;\n }\n): SWRMutationResponse => {\n const apiBaseUrl = useConfig(\"apiBaseUrl\");\n const { formatter, init, ...swrOptions } = options || {};\n // check the query is public api\n // if (typeof query === \"string\" && !query.startsWith(\"/v1/public\")) {\n // throw new Error(\"useQuery is only for public api\");\n // }\n\n if (typeof apiBaseUrl === \"undefined\") {\n throw new Error(\"please add OrderlyConfigProvider to your app\");\n }\n\n // @ts-ignore\n return useSWRMutation(\n query,\n (url: string, options: any) => {\n url = url.startsWith(\"http\") ? url : `${apiBaseUrl}${url}`;\n if (options?.arg) {\n // const searchParams = new URLSearchParams(init.arg);\n // url = `${url}?${encodeURIComponent(searchParams.toString())}`;\n const queryString = Object.entries(options.arg)\n .map(\n ([key, value]) => `${key}=${encodeURIComponent(value as string)}`\n )\n .join(\"&\");\n url = `${url}?${queryString}`;\n }\n return fetcher(url, init, {\n formatter,\n });\n },\n swrOptions\n );\n};\n"],"names":["useLazyQuery","query","options","apiBaseUrl","useConfig","formatter","init","swrOptions","Error","useSWRMutation","url","startsWith","arg","queryString","Object","entries","map","key","value","encodeURIComponent","join","fetcher"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcaA;;;eAAAA;;;yBAbW;iEAIjB;2BACmB;;;;;;AAQnB,MAAMA,eAAe,CAC1BC,OACAC;IAKA,MAAMC,aAAaC,IAAAA,oBAAS,EAAC;IAC7B,MAAM,EAAEC,SAAS,EAAEC,IAAI,EAAE,GAAGC,YAAY,GAAGL,WAAW,CAAC;IACvD,gCAAgC;IAChC,sEAAsE;IACtE,wDAAwD;IACxD,IAAI;IAEJ,IAAI,OAAOC,eAAe,aAAa;QACrC,MAAM,IAAIK,MAAM;IAClB;IAEA,aAAa;IACb,OAAOC,IAAAA,iBAAc,EACnBR,OACA,CAACS,KAAaR;QACZQ,MAAMA,IAAIC,UAAU,CAAC,UAAUD,MAAM,CAAC,EAAEP,WAAW,EAAEO,IAAI,CAAC;QAC1D,IAAIR,SAASU,KAAK;YAChB,sDAAsD;YACtD,iEAAiE;YACjE,MAAMC,cAAcC,OAAOC,OAAO,CAACb,QAAQU,GAAG,EAC3CI,GAAG,CACF,CAAC,CAACC,KAAKC,MAAM,GAAK,CAAC,EAAED,IAAI,CAAC,EAAEE,mBAAmBD,OAAiB,CAAC,EAElEE,IAAI,CAAC;YACRV,MAAM,CAAC,EAAEA,IAAI,CAAC,EAAEG,YAAY,CAAC;QAC/B;QACA,OAAOQ,IAAAA,gBAAO,EAACX,KAAKJ,MAAM;YACxBD;QACF;IACF,GACAE;AAEJ"}
|
package/lib/useLocalStorage.js
CHANGED
|
@@ -1,35 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLocalStorage = void 0;
|
|
4
1
|
// https://usehooks-ts.com/react-hook/use-local-storage
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useLocalStorage", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return useLocalStorage;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const _react = require("react");
|
|
13
|
+
const _json = require("./utils/json");
|
|
7
14
|
function useLocalStorage(key, initialValue) {
|
|
8
15
|
// Get from local storage then
|
|
9
16
|
// parse stored json or return initialValue
|
|
10
|
-
const readValue = (0,
|
|
17
|
+
const readValue = (0, _react.useCallback)(()=>{
|
|
11
18
|
// Prevent build error "window is undefined" but keeps working
|
|
12
19
|
if (typeof window === "undefined") {
|
|
13
20
|
return initialValue;
|
|
14
21
|
}
|
|
15
22
|
try {
|
|
16
23
|
const item = window.localStorage.getItem(key);
|
|
17
|
-
return item ? (0,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
console.warn(`Error reading localStorage key “${key}”:`, error);
|
|
24
|
+
return item ? (0, _json.parseJSON)(item) : initialValue;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
;
|
|
21
27
|
return initialValue;
|
|
22
28
|
}
|
|
23
|
-
}, [
|
|
29
|
+
}, [
|
|
30
|
+
initialValue,
|
|
31
|
+
key
|
|
32
|
+
]);
|
|
24
33
|
// State to store our value
|
|
25
34
|
// Pass initial state function to useState so logic is only executed once
|
|
26
|
-
const [storedValue, setStoredValue] = (0,
|
|
35
|
+
const [storedValue, setStoredValue] = (0, _react.useState)(readValue);
|
|
27
36
|
// Return a wrapped version of useState's setter function that ...
|
|
28
37
|
// ... persists the new value to localStorage.
|
|
29
|
-
const setValue = (0,
|
|
38
|
+
const setValue = (0, _react.useCallback)((value)=>{
|
|
30
39
|
// Prevent build error "window is undefined" but keeps working
|
|
31
40
|
if (typeof window === "undefined") {
|
|
32
|
-
|
|
41
|
+
;
|
|
33
42
|
}
|
|
34
43
|
try {
|
|
35
44
|
// Allow value to be a function so we have the same API as useState
|
|
@@ -39,15 +48,16 @@ function useLocalStorage(key, initialValue) {
|
|
|
39
48
|
// dispath event
|
|
40
49
|
window.dispatchEvent(new Event("storage"));
|
|
41
50
|
// Save state
|
|
42
|
-
setStoredValue(()
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
console.warn(`Error setting localStorage key “${key}”:`, error);
|
|
51
|
+
setStoredValue(()=>newValue);
|
|
52
|
+
// We dispatch a custom event so every useLocalStorage hook are notified
|
|
53
|
+
// window.dispatchEvent(new Event('local-storage'))
|
|
54
|
+
} catch (error) {
|
|
55
|
+
;
|
|
48
56
|
}
|
|
49
|
-
}, [
|
|
50
|
-
|
|
57
|
+
}, [
|
|
58
|
+
storedValue
|
|
59
|
+
]);
|
|
60
|
+
(0, _react.useEffect)(()=>{
|
|
51
61
|
setStoredValue(readValue());
|
|
52
62
|
}, []);
|
|
53
63
|
// const handleStorageChange = useCallback(
|
|
@@ -59,18 +69,24 @@ function useLocalStorage(key, initialValue) {
|
|
|
59
69
|
// },
|
|
60
70
|
// [key, readValue],
|
|
61
71
|
// )
|
|
62
|
-
(0,
|
|
63
|
-
const handleStorageChange = (event)
|
|
72
|
+
(0, _react.useEffect)(()=>{
|
|
73
|
+
const handleStorageChange = (event)=>{
|
|
64
74
|
if (event?.key && event.key !== key) {
|
|
65
75
|
return;
|
|
66
76
|
}
|
|
67
77
|
setStoredValue(readValue());
|
|
68
78
|
};
|
|
69
79
|
window.addEventListener("storage", handleStorageChange);
|
|
70
|
-
return ()
|
|
80
|
+
return ()=>{
|
|
71
81
|
window.removeEventListener("storage", handleStorageChange);
|
|
72
82
|
};
|
|
73
|
-
}, [
|
|
74
|
-
|
|
83
|
+
}, [
|
|
84
|
+
key
|
|
85
|
+
]);
|
|
86
|
+
return [
|
|
87
|
+
storedValue,
|
|
88
|
+
setValue
|
|
89
|
+
];
|
|
75
90
|
}
|
|
76
|
-
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=useLocalStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useLocalStorage.ts"],"sourcesContent":["// https://usehooks-ts.com/react-hook/use-local-storage\nimport { useCallback, useEffect, useState } from \"react\";\nimport { parseJSON } from \"./utils/json\";\n\nexport function useLocalStorage<T>(\n key: string,\n initialValue: T\n): [any, (value: T) => void] {\n // Get from local storage then\n // parse stored json or return initialValue\n const readValue = useCallback((): T => {\n // Prevent build error \"window is undefined\" but keeps working\n if (typeof window === \"undefined\") {\n return initialValue;\n }\n\n try {\n const item = window.localStorage.getItem(key);\n return item ? (parseJSON(item) as T) : initialValue;\n } catch (error) {\n console.warn(`Error reading localStorage key “${key}”:`, error);\n return initialValue;\n }\n }, [initialValue, key]);\n\n // State to store our value\n // Pass initial state function to useState so logic is only executed once\n const [storedValue, setStoredValue] = useState<T>(readValue);\n\n // Return a wrapped version of useState's setter function that ...\n // ... persists the new value to localStorage.\n const setValue: React.Dispatch<T> = useCallback(\n (value: T) => {\n // Prevent build error \"window is undefined\" but keeps working\n if (typeof window === \"undefined\") {\n console.warn(\n `Tried setting localStorage key “${key}” even though environment is not a client`\n );\n }\n\n try {\n // Allow value to be a function so we have the same API as useState\n const newValue = value instanceof Function ? value(storedValue) : value;\n\n // Save to local storage\n window.localStorage.setItem(key, JSON.stringify(newValue));\n // dispath event\n window.dispatchEvent(new Event(\"storage\"));\n\n // Save state\n setStoredValue(() => newValue);\n\n // We dispatch a custom event so every useLocalStorage hook are notified\n // window.dispatchEvent(new Event('local-storage'))\n } catch (error) {\n console.warn(`Error setting localStorage key “${key}”:`, error);\n }\n },\n [storedValue]\n );\n\n useEffect(() => {\n setStoredValue(readValue());\n }, []);\n\n // const handleStorageChange = useCallback(\n // (event: StorageEvent | CustomEvent) => {\n // if ((event as StorageEvent)?.key && (event as StorageEvent).key !== key) {\n // return\n // }\n // setStoredValue(readValue())\n // },\n // [key, readValue],\n // )\n\n useEffect(() => {\n const handleStorageChange = (event: StorageEvent | CustomEvent) => {\n if ((event as StorageEvent)?.key && (event as StorageEvent).key !== key) {\n return;\n }\n setStoredValue(readValue());\n };\n\n window.addEventListener(\"storage\", handleStorageChange);\n\n return () => {\n window.removeEventListener(\"storage\", handleStorageChange);\n };\n }, [key]);\n\n return [storedValue, setValue];\n}\n"],"names":["useLocalStorage","key","initialValue","readValue","useCallback","window","item","localStorage","getItem","parseJSON","error","storedValue","setStoredValue","useState","setValue","value","newValue","Function","setItem","JSON","stringify","dispatchEvent","Event","useEffect","handleStorageChange","event","addEventListener","removeEventListener"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,uDAAuD;;;;;+BAIvCA;;;eAAAA;;;uBAHiC;sBACvB;AAEnB,SAASA,gBACdC,GAAW,EACXC,YAAe;IAEf,8BAA8B;IAC9B,2CAA2C;IAC3C,MAAMC,YAAYC,IAAAA,kBAAW,EAAC;QAC5B,8DAA8D;QAC9D,IAAI,OAAOC,WAAW,aAAa;YACjC,OAAOH;QACT;QAEA,IAAI;YACF,MAAMI,OAAOD,OAAOE,YAAY,CAACC,OAAO,CAACP;YACzC,OAAOK,OAAQG,IAAAA,eAAS,EAACH,QAAcJ;QACzC,EAAE,OAAOQ,OAAO;;YAEd,OAAOR;QACT;IACF,GAAG;QAACA;QAAcD;KAAI;IAEtB,2BAA2B;IAC3B,yEAAyE;IACzE,MAAM,CAACU,aAAaC,eAAe,GAAGC,IAAAA,eAAQ,EAAIV;IAElD,kEAAkE;IAClE,8CAA8C;IAC9C,MAAMW,WAA8BV,IAAAA,kBAAW,EAC7C,CAACW;QACC,8DAA8D;QAC9D,IAAI,OAAOV,WAAW,aAAa;;QAInC;QAEA,IAAI;YACF,mEAAmE;YACnE,MAAMW,WAAWD,iBAAiBE,WAAWF,MAAMJ,eAAeI;YAElE,wBAAwB;YACxBV,OAAOE,YAAY,CAACW,OAAO,CAACjB,KAAKkB,KAAKC,SAAS,CAACJ;YAChD,gBAAgB;YAChBX,OAAOgB,aAAa,CAAC,IAAIC,MAAM;YAE/B,aAAa;YACbV,eAAe,IAAMI;QAErB,wEAAwE;QACxE,mDAAmD;QACrD,EAAE,OAAON,OAAO;;QAEhB;IACF,GACA;QAACC;KAAY;IAGfY,IAAAA,gBAAS,EAAC;QACRX,eAAeT;IACjB,GAAG,EAAE;IAEL,2CAA2C;IAC3C,6CAA6C;IAC7C,iFAAiF;IACjF,eAAe;IACf,QAAQ;IACR,kCAAkC;IAClC,OAAO;IACP,sBAAsB;IACtB,IAAI;IAEJoB,IAAAA,gBAAS,EAAC;QACR,MAAMC,sBAAsB,CAACC;YAC3B,IAAI,AAACA,OAAwBxB,OAAO,AAACwB,MAAuBxB,GAAG,KAAKA,KAAK;gBACvE;YACF;YACAW,eAAeT;QACjB;QAEAE,OAAOqB,gBAAgB,CAAC,WAAWF;QAEnC,OAAO;YACLnB,OAAOsB,mBAAmB,CAAC,WAAWH;QACxC;IACF,GAAG;QAACvB;KAAI;IAER,OAAO;QAACU;QAAaG;KAAS;AAChC"}
|
package/lib/useMediaQuery.js
CHANGED
|
@@ -1,40 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useMediaQuery", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useMediaQuery;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _react = require("react");
|
|
5
12
|
function useMediaQuery(query) {
|
|
6
|
-
const getMatches = (query)
|
|
13
|
+
const getMatches = (query)=>{
|
|
7
14
|
// Prevents SSR issues
|
|
8
15
|
if (typeof window !== "undefined") {
|
|
9
16
|
return window.matchMedia(query).matches;
|
|
10
17
|
}
|
|
11
18
|
return false;
|
|
12
19
|
};
|
|
13
|
-
const [matches, setMatches] = (0,
|
|
20
|
+
const [matches, setMatches] = (0, _react.useState)(getMatches(query));
|
|
14
21
|
function handleChange() {
|
|
15
22
|
setMatches(getMatches(query));
|
|
16
23
|
}
|
|
17
|
-
(0,
|
|
24
|
+
(0, _react.useEffect)(()=>{
|
|
18
25
|
const matchMedia = window.matchMedia(query);
|
|
19
26
|
// Triggered at the first client-side load and if query changes
|
|
20
27
|
handleChange();
|
|
21
28
|
// Listen matchMedia
|
|
22
29
|
if (matchMedia.addListener) {
|
|
23
30
|
matchMedia.addListener(handleChange);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
31
|
+
} else {
|
|
26
32
|
matchMedia.addEventListener("change", handleChange);
|
|
27
33
|
}
|
|
28
|
-
return ()
|
|
34
|
+
return ()=>{
|
|
29
35
|
if (matchMedia.removeListener) {
|
|
30
36
|
matchMedia.removeListener(handleChange);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
37
|
+
} else {
|
|
33
38
|
matchMedia.removeEventListener("change", handleChange);
|
|
34
39
|
}
|
|
35
40
|
};
|
|
36
|
-
|
|
37
|
-
}, [
|
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
}, [
|
|
43
|
+
query
|
|
44
|
+
]);
|
|
38
45
|
return matches;
|
|
39
46
|
}
|
|
40
|
-
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=useMediaQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useMediaQuery.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (query: string): boolean => {\n // Prevents SSR issues\n if (typeof window !== \"undefined\") {\n return window.matchMedia(query).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n function handleChange() {\n setMatches(getMatches(query));\n }\n\n useEffect(() => {\n const matchMedia = window.matchMedia(query);\n\n // Triggered at the first client-side load and if query changes\n handleChange();\n\n // Listen matchMedia\n if (matchMedia.addListener) {\n matchMedia.addListener(handleChange);\n } else {\n matchMedia.addEventListener(\"change\", handleChange);\n }\n\n return () => {\n if (matchMedia.removeListener) {\n matchMedia.removeListener(handleChange);\n } else {\n matchMedia.removeEventListener(\"change\", handleChange);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [query]);\n\n return matches;\n}\n"],"names":["useMediaQuery","query","getMatches","window","matchMedia","matches","setMatches","useState","handleChange","useEffect","addListener","addEventListener","removeListener","removeEventListener"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;uBAFoB;AAE7B,SAASA,cAAcC,KAAa;IACzC,MAAMC,aAAa,CAACD;QAClB,sBAAsB;QACtB,IAAI,OAAOE,WAAW,aAAa;YACjC,OAAOA,OAAOC,UAAU,CAACH,OAAOI,OAAO;QACzC;QACA,OAAO;IACT;IAEA,MAAM,CAACA,SAASC,WAAW,GAAGC,IAAAA,eAAQ,EAAUL,WAAWD;IAE3D,SAASO;QACPF,WAAWJ,WAAWD;IACxB;IAEAQ,IAAAA,gBAAS,EAAC;QACR,MAAML,aAAaD,OAAOC,UAAU,CAACH;QAErC,+DAA+D;QAC/DO;QAEA,oBAAoB;QACpB,IAAIJ,WAAWM,WAAW,EAAE;YAC1BN,WAAWM,WAAW,CAACF;QACzB,OAAO;YACLJ,WAAWO,gBAAgB,CAAC,UAAUH;QACxC;QAEA,OAAO;YACL,IAAIJ,WAAWQ,cAAc,EAAE;gBAC7BR,WAAWQ,cAAc,CAACJ;YAC5B,OAAO;gBACLJ,WAAWS,mBAAmB,CAAC,UAAUL;YAC3C;QACF;IACA,uDAAuD;IACzD,GAAG;QAACP;KAAM;IAEV,OAAOI;AACT"}
|
package/lib/useMutation.js
CHANGED
|
@@ -1,69 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useMutation", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useMutation;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _mutation = /*#__PURE__*/ _interop_require_default(require("swr/mutation"));
|
|
12
|
+
const _net = require("@orderly.network/net");
|
|
13
|
+
const _useAccountInstance = require("./useAccountInstance");
|
|
14
|
+
const _useConfig = require("./useConfig");
|
|
15
|
+
function _interop_require_default(obj) {
|
|
16
|
+
return obj && obj.__esModule ? obj : {
|
|
17
|
+
default: obj
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const fetcher = (url, options)=>{
|
|
12
21
|
const init = {
|
|
13
22
|
method: options.arg.method,
|
|
14
23
|
headers: {
|
|
15
|
-
...options.arg.signature
|
|
16
|
-
}
|
|
24
|
+
...options.arg.signature
|
|
25
|
+
}
|
|
17
26
|
};
|
|
18
27
|
if (options.arg.data) {
|
|
19
28
|
init.body = JSON.stringify(options.arg.data);
|
|
20
29
|
}
|
|
21
|
-
if (typeof options.arg.params === "object" &&
|
|
22
|
-
Object.keys(options.arg.params).length) {
|
|
30
|
+
if (typeof options.arg.params === "object" && Object.keys(options.arg.params).length) {
|
|
23
31
|
let search = new URLSearchParams(options.arg.params);
|
|
24
32
|
url = `${url}?${search.toString()}`;
|
|
25
33
|
}
|
|
26
|
-
return (0,
|
|
34
|
+
return (0, _net.mutate)(url, init);
|
|
27
35
|
};
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
method = "POST",
|
|
41
|
-
/**
|
|
42
|
-
* The configuration object for the mutation.
|
|
43
|
-
* @see [useSWRMutation](https://swr.vercel.app/docs/mutation#api)
|
|
44
|
-
*
|
|
45
|
-
* @link https://swr.vercel.app/docs/mutation#api
|
|
46
|
-
*/
|
|
47
|
-
options) => {
|
|
48
|
-
const apiBaseUrl = (0, useConfig_1.useConfig)("apiBaseUrl");
|
|
36
|
+
const useMutation = (/**
|
|
37
|
+
* The URL to send the request to. If the URL does not start with "http",
|
|
38
|
+
* it will be prefixed with the API base URL.
|
|
39
|
+
*/ url, /**
|
|
40
|
+
* The HTTP method to use for the request. Defaults to "POST".
|
|
41
|
+
*/ method = "POST", /**
|
|
42
|
+
* The configuration object for the mutation.
|
|
43
|
+
* @see [useSWRMutation](https://swr.vercel.app/docs/mutation#api)
|
|
44
|
+
*
|
|
45
|
+
* @link https://swr.vercel.app/docs/mutation#api
|
|
46
|
+
*/ options)=>{
|
|
47
|
+
const apiBaseUrl = (0, _useConfig.useConfig)("apiBaseUrl");
|
|
49
48
|
let fullUrl = url;
|
|
50
49
|
if (!url.startsWith("http")) {
|
|
51
50
|
fullUrl = `${apiBaseUrl}${url}`;
|
|
52
51
|
}
|
|
53
|
-
const account = (0,
|
|
52
|
+
const account = (0, _useAccountInstance.useAccountInstance)();
|
|
54
53
|
const signer = account.signer;
|
|
55
|
-
const { trigger, data, error, reset, isMutating } = (0,
|
|
56
|
-
// method === "POST" ? fetcher : deleteFetcher,
|
|
54
|
+
const { trigger, data, error, reset, isMutating } = (0, _mutation.default)(fullUrl, // method === "POST" ? fetcher : deleteFetcher,
|
|
57
55
|
fetcher, options);
|
|
58
|
-
const mutation = async (
|
|
59
|
-
/**
|
|
56
|
+
const mutation = async (/**
|
|
60
57
|
* The data to send with the request.
|
|
61
|
-
*/
|
|
62
|
-
data,
|
|
63
|
-
/**
|
|
58
|
+
*/ data, /**
|
|
64
59
|
* The query parameters to send with the request.
|
|
65
|
-
*/
|
|
66
|
-
params, options) => {
|
|
60
|
+
*/ params, options)=>{
|
|
67
61
|
let newUrl = url;
|
|
68
62
|
if (typeof params === "object" && Object.keys(params).length) {
|
|
69
63
|
let search = new URLSearchParams(params);
|
|
@@ -72,7 +66,7 @@ options) => {
|
|
|
72
66
|
const payload = {
|
|
73
67
|
method,
|
|
74
68
|
url: newUrl,
|
|
75
|
-
data
|
|
69
|
+
data
|
|
76
70
|
};
|
|
77
71
|
const signature = await signer.sign(payload);
|
|
78
72
|
return trigger({
|
|
@@ -81,8 +75,8 @@ options) => {
|
|
|
81
75
|
method,
|
|
82
76
|
signature: {
|
|
83
77
|
...signature,
|
|
84
|
-
"orderly-account-id": account.accountId
|
|
85
|
-
}
|
|
78
|
+
"orderly-account-id": account.accountId
|
|
79
|
+
}
|
|
86
80
|
}, options);
|
|
87
81
|
};
|
|
88
82
|
return [
|
|
@@ -91,8 +85,9 @@ options) => {
|
|
|
91
85
|
data,
|
|
92
86
|
error,
|
|
93
87
|
reset,
|
|
94
|
-
isMutating
|
|
95
|
-
}
|
|
88
|
+
isMutating
|
|
89
|
+
}
|
|
96
90
|
];
|
|
97
91
|
};
|
|
98
|
-
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=useMutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useMutation.ts"],"sourcesContent":["import useSWRMutation, {\n TriggerWithOptionsArgs,\n type SWRMutationConfiguration,\n TriggerWithoutArgs,\n} from \"swr/mutation\";\nimport { mutate } from \"@orderly.network/net\";\nimport {\n type MessageFactor,\n type SignedMessagePayload,\n} from \"@orderly.network/core\";\nimport { useAccountInstance } from \"./useAccountInstance\";\nimport { useConfig } from \"./useConfig\";\n\ntype HTTP_METHOD = \"POST\" | \"PUT\" | \"DELETE\";\n\nconst fetcher = (\n url: string,\n options: {\n arg: {\n data?: any;\n params?: any;\n method: HTTP_METHOD;\n signature: SignedMessagePayload;\n };\n }\n) => {\n const init: RequestInit = {\n method: options.arg.method,\n headers: {\n ...options.arg.signature,\n },\n };\n\n if (options.arg.data) {\n init.body = JSON.stringify(options.arg.data);\n }\n\n if (\n typeof options.arg.params === \"object\" &&\n Object.keys(options.arg.params).length\n ) {\n let search = new URLSearchParams(options.arg.params);\n url = `${url}?${search.toString()}`;\n }\n\n return mutate(url, init);\n};\n\n/**\n * This hook is used to execute API requests for data mutation, such as POST, DELETE, PUT, etc.\n */\nexport const useMutation = <T, E>(\n /**\n * The URL to send the request to. If the URL does not start with \"http\",\n * it will be prefixed with the API base URL.\n */\n url: string,\n /**\n * The HTTP method to use for the request. Defaults to \"POST\".\n */\n method: HTTP_METHOD = \"POST\",\n /**\n * The configuration object for the mutation.\n * @see [useSWRMutation](https://swr.vercel.app/docs/mutation#api)\n *\n * @link https://swr.vercel.app/docs/mutation#api\n */\n options?: SWRMutationConfiguration<T, E>\n) => {\n const apiBaseUrl = useConfig(\"apiBaseUrl\");\n\n let fullUrl = url;\n if (!url.startsWith(\"http\")) {\n fullUrl = `${apiBaseUrl}${url}`;\n }\n\n const account = useAccountInstance();\n const signer = account.signer;\n const { trigger, data, error, reset, isMutating } = useSWRMutation(\n fullUrl,\n // method === \"POST\" ? fetcher : deleteFetcher,\n fetcher,\n options\n );\n\n const mutation = async (\n /**\n * The data to send with the request.\n */\n data: Record<string, any> | null,\n /**\n * The query parameters to send with the request.\n */\n params?: Record<string, any>,\n options?: SWRMutationConfiguration<T, E>\n ): Promise<any> => {\n let newUrl = url;\n if (typeof params === \"object\" && Object.keys(params).length) {\n let search = new URLSearchParams(params);\n newUrl = `${url}?${search.toString()}`;\n }\n\n const payload: MessageFactor = {\n method,\n url: newUrl,\n data,\n };\n\n const signature = await signer.sign(payload);\n\n return trigger(\n {\n data,\n params,\n method,\n signature: {\n ...signature,\n \"orderly-account-id\": account.accountId,\n },\n },\n options\n );\n };\n\n return [\n mutation,\n {\n data,\n error,\n reset,\n isMutating,\n },\n ] as const;\n};\n"],"names":["useMutation","fetcher","url","options","init","method","arg","headers","signature","data","body","JSON","stringify","params","Object","keys","length","search","URLSearchParams","toString","mutate","apiBaseUrl","useConfig","fullUrl","startsWith","account","useAccountInstance","signer","trigger","error","reset","isMutating","useSWRMutation","mutation","newUrl","payload","sign","accountId"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAmDaA;;;eAAAA;;;iEA/CN;qBACgB;oCAKY;2BACT;;;;;;AAI1B,MAAMC,UAAU,CACdC,KACAC;IASA,MAAMC,OAAoB;QACxBC,QAAQF,QAAQG,GAAG,CAACD,MAAM;QAC1BE,SAAS;YACP,GAAGJ,QAAQG,GAAG,CAACE,SAAS;QAC1B;IACF;IAEA,IAAIL,QAAQG,GAAG,CAACG,IAAI,EAAE;QACpBL,KAAKM,IAAI,GAAGC,KAAKC,SAAS,CAACT,QAAQG,GAAG,CAACG,IAAI;IAC7C;IAEA,IACE,OAAON,QAAQG,GAAG,CAACO,MAAM,KAAK,YAC9BC,OAAOC,IAAI,CAACZ,QAAQG,GAAG,CAACO,MAAM,EAAEG,MAAM,EACtC;QACA,IAAIC,SAAS,IAAIC,gBAAgBf,QAAQG,GAAG,CAACO,MAAM;QACnDX,MAAM,CAAC,EAAEA,IAAI,CAAC,EAAEe,OAAOE,QAAQ,GAAG,CAAC;IACrC;IAEA,OAAOC,IAAAA,WAAM,EAAClB,KAAKE;AACrB;AAKO,MAAMJ,cAAc,CACzB;;;GAGC,GACDE,KACA;;GAEC,GACDG,SAAsB,MAAM,EAC5B;;;;;GAKC,GACDF;IAEA,MAAMkB,aAAaC,IAAAA,oBAAS,EAAC;IAE7B,IAAIC,UAAUrB;IACd,IAAI,CAACA,IAAIsB,UAAU,CAAC,SAAS;QAC3BD,UAAU,CAAC,EAAEF,WAAW,EAAEnB,IAAI,CAAC;IACjC;IAEA,MAAMuB,UAAUC,IAAAA,sCAAkB;IAClC,MAAMC,SAASF,QAAQE,MAAM;IAC7B,MAAM,EAAEC,OAAO,EAAEnB,IAAI,EAAEoB,KAAK,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGC,IAAAA,iBAAc,EAChET,SACA,+CAA+C;IAC/CtB,SACAE;IAGF,MAAM8B,WAAW,OACf;;KAEC,GACDxB,MACA;;KAEC,GACDI,QACAV;QAEA,IAAI+B,SAAShC;QACb,IAAI,OAAOW,WAAW,YAAYC,OAAOC,IAAI,CAACF,QAAQG,MAAM,EAAE;YAC5D,IAAIC,SAAS,IAAIC,gBAAgBL;YACjCqB,SAAS,CAAC,EAAEhC,IAAI,CAAC,EAAEe,OAAOE,QAAQ,GAAG,CAAC;QACxC;QAEA,MAAMgB,UAAyB;YAC7B9B;YACAH,KAAKgC;YACLzB;QACF;QAEA,MAAMD,YAAY,MAAMmB,OAAOS,IAAI,CAACD;QAEpC,OAAOP,QACL;YACEnB;YACAI;YACAR;YACAG,WAAW;gBACT,GAAGA,SAAS;gBACZ,sBAAsBiB,QAAQY,SAAS;YACzC;QACF,GACAlC;IAEJ;IAEA,OAAO;QACL8B;QACA;YACExB;YACAoB;YACAC;YACAC;QACF;KACD;AACH"}
|