@lanaqi/rsr 0.0.1 → 0.0.3

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/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__ from "react-router-dom";
2
- import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
3
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
- var common_AccessDecision = /*#__PURE__*/ function(AccessDecision) {
1
+ import { matchPath, useBlocker, useLocation, useNavigate } from "react-router";
2
+ import { createContext, use, useEffect, useState } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { c } from "react/compiler-runtime";
5
+ let common_AccessDecision = /*#__PURE__*/ function(AccessDecision) {
5
6
  AccessDecision["notResource"] = "notResource";
6
7
  AccessDecision["notAuthentication"] = "notAuthentication";
7
8
  AccessDecision["invalidAuthentication"] = "invalidAuthentication";
@@ -11,7 +12,7 @@ var common_AccessDecision = /*#__PURE__*/ function(AccessDecision) {
11
12
  AccessDecision["allowAccess"] = "allowAccess";
12
13
  return AccessDecision;
13
14
  }({});
14
- var common_AccessBehave = /*#__PURE__*/ function(AccessBehave) {
15
+ let common_AccessBehave = /*#__PURE__*/ function(AccessBehave) {
15
16
  AccessBehave["doNothing"] = "doNothing";
16
17
  AccessBehave["goNavigate"] = "goNavigate";
17
18
  AccessBehave["reDecision"] = "reDecision";
@@ -79,11 +80,11 @@ class SimpleUser {
79
80
  }
80
81
  }
81
82
  class SimpleResource {
82
- static PERMISSION_ANONYMOUS = '__anonymous__';
83
- static PERMISSION_AUTHENTICATED = '__authenticated__';
84
- static PERMISSION_AUTHORIZED = '__authorized__';
85
- static LABEL_SIGNATURED = '__signatured__';
86
- static LABEL_ALWAYS_SIGNATURE = '__always_signature__';
83
+ static PERMISSION_ANONYMOUS = '__aqi_rsr_anonymous';
84
+ static PERMISSION_AUTHENTICATED = '__aqi_rsr_authenticated';
85
+ static PERMISSION_AUTHORIZED = '__aqi_rsr_authorized';
86
+ static LABEL_SIGNATURED = '__aqi_rsr_signatured';
87
+ static LABEL_ALWAYS_SIGNATURE = '__aqi_rsr_always_signature';
87
88
  patterns;
88
89
  permissions;
89
90
  labels;
@@ -97,7 +98,7 @@ class SimpleResource {
97
98
  this.patterns = new Set(patterns);
98
99
  this.permissions = new Set(permissions);
99
100
  this.labels = new Set(labels);
100
- if (0 === this.patterns.size) throw new Error("\u8BBF\u95EE\u8D44\u6E90\u6A21\u5F0F\u96C6\u5408\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u68C0\u67E5\uFF01");
101
+ if (0 === this.patterns.size) throw new Error('访问资源模式集合不能为空,请检查!');
101
102
  if (0 === this.permissions.size) {
102
103
  this.anonymous = true;
103
104
  this.authenticated = false;
@@ -410,9 +411,9 @@ class HierarchyVoter extends CacheVoter {
410
411
  }
411
412
  }
412
413
  class SimpleStorer {
413
- static KEY_AUTHENTICATION = '__authentication__';
414
- static KEY_AUTHORIZATION = '__authorization__';
415
- static KEY_SIGNATURE = '__signature__';
414
+ static KEY_AUTHENTICATION = '__aqi_rsr_authentication';
415
+ static KEY_AUTHORIZATION = '__aqi_rsr_authorization';
416
+ static KEY_SIGNATURE = '__aqi_rsr_signature';
416
417
  aaaStorage;
417
418
  signStorage;
418
419
  authenticationKey;
@@ -521,11 +522,11 @@ class SimpleMatcher {
521
522
  ...pattern,
522
523
  path: basename + pattern.path
523
524
  };
524
- const pm = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__.matchPath)(matchPattern, path.pathname);
525
+ const pm = matchPath(matchPattern, path.pathname);
525
526
  if (pm) return true;
526
527
  }
527
528
  else for (const pattern of patterns){
528
- const pm = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__.matchPath)(pattern, path.pathname);
529
+ const pm = matchPath(pattern, path.pathname);
529
530
  if (pm) return true;
530
531
  }
531
532
  return false;
@@ -637,7 +638,7 @@ class BehaveHandler {
637
638
  return common_AccessBehave.goNavigate;
638
639
  }
639
640
  if (this._config.notAuthenticationFunc) return this._config.notAuthenticationFunc(context);
640
- throw new Error("\u6CA1\u6709\u8BA4\u8BC1\u7684\u884C\u4E3A\u662F\u5FC5\u987B\u914D\u7F6E\u7684\uFF0C\u8BF7\u68C0\u67E5\uFF01");
641
+ throw new Error('没有认证的行为是必须配置的,请检查!');
641
642
  }
642
643
  invalidAuthentication(context) {
643
644
  if (this._config.invalidAuthenticationPath) {
@@ -669,7 +670,7 @@ class BehaveHandler {
669
670
  return common_AccessBehave.goNavigate;
670
671
  }
671
672
  if (this._config.accessDeniedFunc) return this._config.accessDeniedFunc(context);
672
- throw new Error("\u62D2\u7EDD\u8BBF\u95EE\u7684\u884C\u4E3A\u662F\u5FC5\u987B\u914D\u7F6E\u7684\uFF0C\u8BF7\u68C0\u67E5\uFF01");
673
+ throw new Error('拒绝访问的行为是必须配置的,请检查!');
673
674
  }
674
675
  allowAccess(context) {
675
676
  if (this._config.allowAccessFunc) this._config.allowAccessFunc(context);
@@ -683,7 +684,7 @@ class BehaveHandler {
683
684
  this.accessDenied(context);
684
685
  break;
685
686
  case common_AccessDecision.notAuthentication:
686
- throw new Error("\u6CA1\u6709\u8BA4\u8BC1\u7684\u9519\u8BEF\u51B3\u7B56\uFF0C\u8BF7\u68C0\u67E5\uFF01");
687
+ throw new Error('没有认证的错误决策,请检查!');
687
688
  case common_AccessDecision.invalidAuthentication:
688
689
  this.notAuthentication(context);
689
690
  break;
@@ -692,7 +693,7 @@ class BehaveHandler {
692
693
  break;
693
694
  case common_AccessDecision.accessDenied:
694
695
  default:
695
- throw new Error("\u62D2\u7EDD\u8BBF\u95EE\u7684\u9519\u8BEF\u51B3\u7B56\uFF0C\u8BF7\u68C0\u67E5\uFF01");
696
+ throw new Error('拒绝访问的错误决策,请检查!');
696
697
  }
697
698
  }
698
699
  }
@@ -725,7 +726,7 @@ class MultiBlocker {
725
726
  this.handlers.add(handler);
726
727
  }
727
728
  unregister(handler) {
728
- this.handlers.delete(handler);
729
+ if (handler) this.handlers.delete(handler);
729
730
  }
730
731
  clear() {
731
732
  this.handlers.clear();
@@ -800,7 +801,7 @@ class SimpleGuarder {
800
801
  recorder.setAllowPath(blockPath);
801
802
  return common_AccessDecision.allowAccess;
802
803
  }
803
- if (authentication && authentication.isAuthenticated()) recorder.clearOriginPath();
804
+ if (authentication?.isAuthenticated()) recorder.clearOriginPath();
804
805
  else {
805
806
  recorder.setOriginPath(blockPath);
806
807
  return common_AccessDecision.notAuthentication;
@@ -1116,7 +1117,7 @@ class AccessNavigatorBuilder {
1116
1117
  return this;
1117
1118
  }
1118
1119
  build() {
1119
- if (!this._navigate) throw new Error("\u5BFC\u822A\u51FD\u6570\u662F\u5FC5\u987B\u8BBE\u7F6E\u7684\uFF0C\u8BF7\u68C0\u67E5\uFF01");
1120
+ if (!this._navigate) throw new Error('导航函数是必须设置的,请检查!');
1120
1121
  return new SimpleNavigator(this._navigate);
1121
1122
  }
1122
1123
  }
@@ -1205,7 +1206,7 @@ class AccessHandlerBuilder {
1205
1206
  return this;
1206
1207
  }
1207
1208
  build() {
1208
- if (!this._config) throw new Error("\u884C\u4E3A\u914D\u7F6E\u662F\u5FC5\u987B\u8BBE\u7F6E\uFF0C\u8BF7\u68C0\u67E5\uFF01");
1209
+ if (!this._config) throw new Error('行为配置是必须设置,请检查!');
1209
1210
  return new BehaveHandler(this._config);
1210
1211
  }
1211
1212
  }
@@ -1299,429 +1300,882 @@ class AccessGuarderBuilder {
1299
1300
  };
1300
1301
  }
1301
1302
  }
1302
- const SecurityContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(null);
1303
+ const SecurityContext = /*#__PURE__*/ createContext(null);
1303
1304
  const useSecurityContext = ()=>{
1304
- const sc = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(SecurityContext);
1305
- if (!sc) throw new Error("\u5B89\u5168\u4E0A\u4E0B\u6587\u4E3A\u7A7A\uFF0C\u5FC5\u987B\u4F7F\u7528\u5B89\u5168\u63D0\u4F9B\u8005\u5305\u88F9\u7EC4\u4EF6\u6765\u8BBE\u7F6E\u5B89\u5168\u4E0A\u4E0B\u6587");
1305
+ const sc = use(SecurityContext);
1306
+ if (!sc) throw new Error('安全上下文为空,必须使用安全提供者包裹组件来设置安全上下文');
1306
1307
  return sc;
1307
1308
  };
1308
- function SecurityProvider({ children, bundler }) {
1309
- const navigate = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__.useNavigate)();
1310
- const provide = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>bundler(new AccessGuarderBuilder().navigate(navigate)), [
1311
- bundler,
1312
- navigate
1313
- ]);
1314
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SecurityContext.Provider, {
1315
- value: provide,
1316
- children: children
1317
- });
1318
- }
1319
- function SecurityBlocker({ children }) {
1320
- const { context, manager, guarder } = useSecurityContext();
1321
- if (manager.isDisabled()) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
1322
- children: children
1323
- });
1324
- const blocker = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__.useBlocker)(({ currentLocation, nextLocation })=>currentLocation.pathname !== nextLocation.pathname);
1325
- const [guarded, setGuarded] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
1326
- const [nextPath, setNextPath] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)((0, __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__.useLocation)());
1327
- const [firstAccess, setFirstAccess] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(true);
1328
- const [firstHandle, setFirstHandle] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(true);
1329
- const [countSignature, setCountSignature] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(1);
1330
- const [handledDecision, setHandledDecision] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
1331
- const [beforeDecision, setBeforeDecision] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(void 0);
1332
- const [currentDecision, setCurrentDecision] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(void 0);
1333
- const [securityBlock, setSecurityBlock] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
1334
- const [executableBlocked, setExecutableBlocked] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(true);
1335
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
1336
- if ('blocked' === blocker.state && executableBlocked) {
1337
- let isProceed;
1338
- const recorder = context.getRecorder();
1339
- const stayPath = recorder.getAllowPath();
1340
- const blockPath = blocker.location;
1341
- let guardBlocked = false;
1342
- if (securityBlock) guardBlocked = guarder.guardBlock(blockPath);
1343
- if (guardBlocked) {
1344
- setHandledDecision(false);
1345
- setCurrentDecision(void 0);
1346
- isProceed = false;
1347
- } else {
1348
- if (!beforeDecision) guarder.guardBefore(blockPath);
1349
- const blockedDecision = guarder.guardDecision(blockPath);
1350
- setHandledDecision(true);
1351
- setCurrentDecision(blockedDecision);
1352
- isProceed = blockedDecision === common_AccessDecision.allowAccess;
1353
- }
1354
- setNextPath(blockPath);
1355
- setExecutableBlocked(false);
1356
- if (isProceed) {
1357
- const isDiff = !!stayPath && stayPath.pathname !== blockPath.pathname;
1358
- if (isDiff) guarder.permitBefore(stayPath, blockPath);
1359
- blocker.proceed();
1360
- if (isDiff) guarder.permitAfter(stayPath, blockPath);
1361
- } else blocker.reset();
1362
- } else if ('unblocked' === blocker.state) {
1363
- if (handledDecision && currentDecision) {
1364
- let navNext;
1365
- const behave = guarder.guardHandle(currentDecision, beforeDecision);
1366
- switch(behave){
1367
- case common_AccessBehave.reDecision:
1368
- setBeforeDecision(currentDecision);
1369
- setSecurityBlock(false);
1370
- navNext = true;
1371
- break;
1372
- case common_AccessBehave.goNavigate:
1373
- setBeforeDecision(void 0);
1374
- navNext = false;
1375
- setSecurityBlock(false);
1376
- break;
1377
- case common_AccessBehave.doNothing:
1378
- default:
1379
- setBeforeDecision(void 0);
1380
- navNext = false;
1381
- setSecurityBlock(true);
1382
- break;
1383
- }
1384
- if (firstHandle && currentDecision === common_AccessDecision.notSignature && behave === common_AccessBehave.reDecision) if (countSignature >= 3) {
1385
- setFirstHandle(false);
1386
- setBeforeDecision(common_AccessDecision.notSignature);
1387
- setHandledDecision(true);
1388
- setCurrentDecision(common_AccessDecision.accessDenied);
1309
+ function SecurityBlocker(t0) {
1310
+ const $ = c(14);
1311
+ const { children } = t0;
1312
+ const { context, guarder } = useSecurityContext();
1313
+ const blocker = useBlocker(_temp);
1314
+ const [guarded, setGuarded] = useState(false);
1315
+ const [nextPath, setNextPath] = useState(useLocation());
1316
+ const [firstAccess, setFirstAccess] = useState(true);
1317
+ const [firstHandle, setFirstHandle] = useState(true);
1318
+ const [countSignature, setCountSignature] = useState(1);
1319
+ const [handledDecision, setHandledDecision] = useState(false);
1320
+ const [beforeDecision, setBeforeDecision] = useState(void 0);
1321
+ const [currentDecision, setCurrentDecision] = useState(void 0);
1322
+ const [securityBlock, setSecurityBlock] = useState(false);
1323
+ const [executableBlocked, setExecutableBlocked] = useState(true);
1324
+ let t1;
1325
+ let t2;
1326
+ if ($[0] !== beforeDecision || $[1] !== blocker || $[2] !== context || $[3] !== countSignature || $[4] !== currentDecision || $[5] !== executableBlocked || $[6] !== firstAccess || $[7] !== firstHandle || $[8] !== guarder || $[9] !== handledDecision || $[10] !== nextPath || $[11] !== securityBlock) {
1327
+ t1 = ()=>{
1328
+ if ("blocked" === blocker.state && executableBlocked) {
1329
+ let isProceed;
1330
+ const recorder = context.getRecorder();
1331
+ const stayPath = recorder.getAllowPath();
1332
+ const blockPath = blocker.location;
1333
+ let guardBlocked = false;
1334
+ if (securityBlock) guardBlocked = guarder.guardBlock(blockPath);
1335
+ if (guardBlocked) {
1336
+ setHandledDecision(false);
1337
+ setCurrentDecision(void 0);
1338
+ isProceed = false;
1389
1339
  } else {
1390
- const signDecision = guarder.guardDecision(nextPath);
1340
+ if (!beforeDecision) guarder.guardBefore(blockPath);
1341
+ const blockedDecision = guarder.guardDecision(blockPath);
1391
1342
  setHandledDecision(true);
1392
- setBeforeDecision(void 0);
1393
- setCurrentDecision(signDecision);
1394
- setCountSignature(countSignature + 1);
1343
+ setCurrentDecision(blockedDecision);
1344
+ isProceed = blockedDecision === common_AccessDecision.allowAccess;
1395
1345
  }
1396
- else {
1397
- setFirstHandle(false);
1398
- setHandledDecision(false);
1399
- setCurrentDecision(void 0);
1400
- if (navNext) context.getNavigator().navigate(nextPath);
1346
+ setNextPath(blockPath);
1347
+ setExecutableBlocked(false);
1348
+ if (isProceed) {
1349
+ const isDiff = !!stayPath && stayPath.pathname !== blockPath.pathname;
1350
+ if (isDiff) guarder.permitBefore(stayPath, blockPath);
1351
+ blocker.proceed();
1352
+ if (isDiff) guarder.permitAfter(stayPath, blockPath);
1353
+ } else blocker.reset();
1354
+ } else if ("unblocked" === blocker.state) {
1355
+ if (handledDecision && currentDecision) {
1356
+ let navNext;
1357
+ const behave = guarder.guardHandle(currentDecision, beforeDecision);
1358
+ switch(behave){
1359
+ case common_AccessBehave.reDecision:
1360
+ setBeforeDecision(currentDecision);
1361
+ setSecurityBlock(false);
1362
+ navNext = true;
1363
+ break;
1364
+ case common_AccessBehave.goNavigate:
1365
+ setBeforeDecision(void 0);
1366
+ navNext = false;
1367
+ setSecurityBlock(false);
1368
+ break;
1369
+ case common_AccessBehave.doNothing:
1370
+ default:
1371
+ setBeforeDecision(void 0);
1372
+ navNext = false;
1373
+ setSecurityBlock(true);
1374
+ }
1375
+ if (firstHandle && currentDecision === common_AccessDecision.notSignature && behave === common_AccessBehave.reDecision) if (countSignature >= 3) {
1376
+ setFirstHandle(false);
1377
+ setBeforeDecision(common_AccessDecision.notSignature);
1378
+ setHandledDecision(true);
1379
+ setCurrentDecision(common_AccessDecision.accessDenied);
1380
+ } else {
1381
+ const signDecision = guarder.guardDecision(nextPath);
1382
+ setHandledDecision(true);
1383
+ setBeforeDecision(void 0);
1384
+ setCurrentDecision(signDecision);
1385
+ setCountSignature(countSignature + 1);
1386
+ }
1401
1387
  else {
1402
- guarder.guardAfter(nextPath, currentDecision);
1403
- setGuarded(true);
1388
+ setFirstHandle(false);
1389
+ setHandledDecision(false);
1390
+ setCurrentDecision(void 0);
1391
+ if (navNext) context.getNavigator().navigate(nextPath);
1392
+ else {
1393
+ guarder.guardAfter(nextPath, currentDecision);
1394
+ setGuarded(true);
1395
+ }
1404
1396
  }
1397
+ } else if (firstAccess) {
1398
+ guarder.guardBefore(nextPath);
1399
+ const firstDecision = guarder.guardDecision(nextPath);
1400
+ setFirstAccess(false);
1401
+ setHandledDecision(true);
1402
+ setCurrentDecision(firstDecision);
1405
1403
  }
1406
- } else if (firstAccess) {
1407
- guarder.guardBefore(nextPath);
1408
- const firstDecision = guarder.guardDecision(nextPath);
1409
- setFirstAccess(false);
1410
- setHandledDecision(true);
1411
- setCurrentDecision(firstDecision);
1404
+ if (!executableBlocked) setExecutableBlocked(true);
1412
1405
  }
1413
- if (!executableBlocked) setExecutableBlocked(true);
1414
- }
1415
- }, [
1416
- blocker,
1417
- context,
1418
- guarder,
1419
- nextPath,
1420
- firstAccess,
1421
- firstHandle,
1422
- countSignature,
1423
- handledDecision,
1424
- beforeDecision,
1425
- currentDecision,
1426
- securityBlock,
1427
- executableBlocked
1428
- ]);
1429
- if (!guarded) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {});
1430
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
1431
- children: children
1432
- });
1406
+ };
1407
+ t2 = [
1408
+ blocker,
1409
+ context,
1410
+ guarder,
1411
+ nextPath,
1412
+ firstAccess,
1413
+ firstHandle,
1414
+ countSignature,
1415
+ handledDecision,
1416
+ beforeDecision,
1417
+ currentDecision,
1418
+ securityBlock,
1419
+ executableBlocked
1420
+ ];
1421
+ $[0] = beforeDecision;
1422
+ $[1] = blocker;
1423
+ $[2] = context;
1424
+ $[3] = countSignature;
1425
+ $[4] = currentDecision;
1426
+ $[5] = executableBlocked;
1427
+ $[6] = firstAccess;
1428
+ $[7] = firstHandle;
1429
+ $[8] = guarder;
1430
+ $[9] = handledDecision;
1431
+ $[10] = nextPath;
1432
+ $[11] = securityBlock;
1433
+ $[12] = t1;
1434
+ $[13] = t2;
1435
+ } else {
1436
+ t1 = $[12];
1437
+ t2 = $[13];
1438
+ }
1439
+ useEffect(t1, t2);
1440
+ if (!guarded) return null;
1441
+ return children;
1433
1442
  }
1434
- const withSecurityBlocker = (Component, bundler)=>()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SecurityProvider, {
1443
+ function _temp(t0) {
1444
+ const { currentLocation, nextLocation } = t0;
1445
+ return currentLocation.pathname !== nextLocation.pathname;
1446
+ }
1447
+ function SecurityProvider(t0) {
1448
+ const $ = c(8);
1449
+ const { children, bundler } = t0;
1450
+ const navigate = useNavigate();
1451
+ let t1;
1452
+ if ($[0] !== bundler || $[1] !== navigate) {
1453
+ t1 = bundler(new AccessGuarderBuilder().navigate(navigate));
1454
+ $[0] = bundler;
1455
+ $[1] = navigate;
1456
+ $[2] = t1;
1457
+ } else t1 = $[2];
1458
+ const provide = t1;
1459
+ if (provide.manager.isDisabled()) return children;
1460
+ let t2;
1461
+ if ($[3] !== children) {
1462
+ t2 = /*#__PURE__*/ jsx(SecurityBlocker, {
1463
+ children: children
1464
+ });
1465
+ $[3] = children;
1466
+ $[4] = t2;
1467
+ } else t2 = $[4];
1468
+ let t3;
1469
+ if ($[5] !== provide || $[6] !== t2) {
1470
+ t3 = /*#__PURE__*/ jsx(SecurityContext, {
1471
+ value: provide,
1472
+ children: t2
1473
+ });
1474
+ $[5] = provide;
1475
+ $[6] = t2;
1476
+ $[7] = t3;
1477
+ } else t3 = $[7];
1478
+ return t3;
1479
+ }
1480
+ const withSecurityBlocker = (Component, bundler)=>()=>/*#__PURE__*/ jsx(SecurityProvider, {
1435
1481
  bundler: bundler,
1436
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SecurityBlocker, {
1437
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Component, {})
1438
- })
1482
+ children: /*#__PURE__*/ jsx(Component, {})
1439
1483
  });
1440
1484
  const useObtainAuthentication = ()=>{
1485
+ const $ = c(7);
1441
1486
  const { context } = useSecurityContext();
1442
- const storer = context.getStorer();
1443
- const recorder = context.getRecorder();
1444
- return ()=>{
1445
- let authentication = recorder.getAccessAuthentication();
1446
- if (!authentication) {
1447
- authentication = storer.loadAuthentication(recorder);
1448
- if (authentication) recorder.setAccessAuthentication(authentication);
1449
- }
1450
- return authentication;
1451
- };
1487
+ let t0;
1488
+ if ($[0] !== context) {
1489
+ t0 = context.getStorer();
1490
+ $[0] = context;
1491
+ $[1] = t0;
1492
+ } else t0 = $[1];
1493
+ const storer = t0;
1494
+ let t1;
1495
+ if ($[2] !== context) {
1496
+ t1 = context.getRecorder();
1497
+ $[2] = context;
1498
+ $[3] = t1;
1499
+ } else t1 = $[3];
1500
+ const recorder = t1;
1501
+ let t2;
1502
+ if ($[4] !== recorder || $[5] !== storer) {
1503
+ t2 = ()=>{
1504
+ let authentication = recorder.getAccessAuthentication();
1505
+ if (!authentication) {
1506
+ authentication = storer.loadAuthentication(recorder);
1507
+ if (authentication) recorder.setAccessAuthentication(authentication);
1508
+ }
1509
+ return authentication;
1510
+ };
1511
+ $[4] = recorder;
1512
+ $[5] = storer;
1513
+ $[6] = t2;
1514
+ } else t2 = $[6];
1515
+ return t2;
1452
1516
  };
1453
1517
  const useObtainAuthorization = ()=>{
1518
+ const $ = c(8);
1454
1519
  const obtainAuthentication = useObtainAuthentication();
1455
1520
  const { context } = useSecurityContext();
1456
- const storer = context.getStorer();
1457
- const recorder = context.getRecorder();
1458
- return ()=>{
1459
- let authorization = recorder.getAccessAuthorization();
1460
- if (!authorization) {
1461
- const authentication = obtainAuthentication();
1462
- authorization = storer.loadAuthorization(recorder, authentication);
1463
- if (authorization) recorder.setAccessAuthorization(authorization);
1464
- }
1465
- return authorization;
1466
- };
1521
+ let t0;
1522
+ if ($[0] !== context) {
1523
+ t0 = context.getStorer();
1524
+ $[0] = context;
1525
+ $[1] = t0;
1526
+ } else t0 = $[1];
1527
+ const storer = t0;
1528
+ let t1;
1529
+ if ($[2] !== context) {
1530
+ t1 = context.getRecorder();
1531
+ $[2] = context;
1532
+ $[3] = t1;
1533
+ } else t1 = $[3];
1534
+ const recorder = t1;
1535
+ let t2;
1536
+ if ($[4] !== obtainAuthentication || $[5] !== recorder || $[6] !== storer) {
1537
+ t2 = ()=>{
1538
+ let authorization = recorder.getAccessAuthorization();
1539
+ if (!authorization) {
1540
+ const authentication = obtainAuthentication();
1541
+ authorization = storer.loadAuthorization(recorder, authentication);
1542
+ if (authorization) recorder.setAccessAuthorization(authorization);
1543
+ }
1544
+ return authorization;
1545
+ };
1546
+ $[4] = obtainAuthentication;
1547
+ $[5] = recorder;
1548
+ $[6] = storer;
1549
+ $[7] = t2;
1550
+ } else t2 = $[7];
1551
+ return t2;
1467
1552
  };
1468
1553
  const useDeleteAuthentication = ()=>{
1554
+ const $ = c(8);
1469
1555
  const { context } = useSecurityContext();
1470
- const storer = context.getStorer();
1471
- const recorder = context.getRecorder();
1472
- return ()=>{
1473
- storer.deleteAuthentication(recorder);
1474
- storer.deleteAuthorization(recorder);
1475
- recorder.clearAccessAuthentication();
1476
- recorder.clearAccessAuthorization();
1477
- const parent = context.getParent();
1478
- if (parent) {
1479
- const p_recorder = parent.getRecorder();
1480
- const p_storer = parent.getStorer();
1481
- p_storer.deleteAuthentication(p_recorder);
1482
- p_storer.deleteAuthorization(p_recorder);
1483
- p_recorder.clearAccessAuthentication();
1484
- p_recorder.clearAccessAuthorization();
1485
- }
1486
- };
1556
+ let t0;
1557
+ if ($[0] !== context) {
1558
+ t0 = context.getStorer();
1559
+ $[0] = context;
1560
+ $[1] = t0;
1561
+ } else t0 = $[1];
1562
+ const storer = t0;
1563
+ let t1;
1564
+ if ($[2] !== context) {
1565
+ t1 = context.getRecorder();
1566
+ $[2] = context;
1567
+ $[3] = t1;
1568
+ } else t1 = $[3];
1569
+ const recorder = t1;
1570
+ let t2;
1571
+ if ($[4] !== context || $[5] !== recorder || $[6] !== storer) {
1572
+ t2 = ()=>{
1573
+ storer.deleteAuthentication(recorder);
1574
+ storer.deleteAuthorization(recorder);
1575
+ recorder.clearAccessAuthentication();
1576
+ recorder.clearAccessAuthorization();
1577
+ const parent = context.getParent();
1578
+ if (parent) {
1579
+ const p_recorder = parent.getRecorder();
1580
+ const p_storer = parent.getStorer();
1581
+ p_storer.deleteAuthentication(p_recorder);
1582
+ p_storer.deleteAuthorization(p_recorder);
1583
+ p_recorder.clearAccessAuthentication();
1584
+ p_recorder.clearAccessAuthorization();
1585
+ }
1586
+ };
1587
+ $[4] = context;
1588
+ $[5] = recorder;
1589
+ $[6] = storer;
1590
+ $[7] = t2;
1591
+ } else t2 = $[7];
1592
+ return t2;
1487
1593
  };
1488
1594
  const useDeleteAuthorization = ()=>{
1595
+ const $ = c(8);
1489
1596
  const { context } = useSecurityContext();
1490
- const storer = context.getStorer();
1491
- const recorder = context.getRecorder();
1492
- return ()=>{
1493
- storer.deleteAuthorization(recorder);
1494
- recorder.clearAccessAuthorization();
1495
- const parent = context.getParent();
1496
- if (parent) {
1497
- const p_recorder = parent.getRecorder();
1498
- const p_storer = parent.getStorer();
1499
- p_storer.deleteAuthorization(p_recorder);
1500
- p_recorder.clearAccessAuthorization();
1501
- }
1502
- };
1597
+ let t0;
1598
+ if ($[0] !== context) {
1599
+ t0 = context.getStorer();
1600
+ $[0] = context;
1601
+ $[1] = t0;
1602
+ } else t0 = $[1];
1603
+ const storer = t0;
1604
+ let t1;
1605
+ if ($[2] !== context) {
1606
+ t1 = context.getRecorder();
1607
+ $[2] = context;
1608
+ $[3] = t1;
1609
+ } else t1 = $[3];
1610
+ const recorder = t1;
1611
+ let t2;
1612
+ if ($[4] !== context || $[5] !== recorder || $[6] !== storer) {
1613
+ t2 = ()=>{
1614
+ storer.deleteAuthorization(recorder);
1615
+ recorder.clearAccessAuthorization();
1616
+ const parent = context.getParent();
1617
+ if (parent) {
1618
+ const p_recorder = parent.getRecorder();
1619
+ const p_storer = parent.getStorer();
1620
+ p_storer.deleteAuthorization(p_recorder);
1621
+ p_recorder.clearAccessAuthorization();
1622
+ }
1623
+ };
1624
+ $[4] = context;
1625
+ $[5] = recorder;
1626
+ $[6] = storer;
1627
+ $[7] = t2;
1628
+ } else t2 = $[7];
1629
+ return t2;
1503
1630
  };
1504
- const useSaveAuthentication = (navigate = false, redirect = '/')=>{
1631
+ const useSaveAuthentication = (t0)=>{
1632
+ const $ = c(11);
1633
+ const redirect = void 0 === t0 ? "" : t0;
1505
1634
  const { context } = useSecurityContext();
1506
- const recorder = context.getRecorder();
1507
- const storer = context.getStorer();
1508
- const navigator = context.getNavigator();
1509
- return (datasheet)=>{
1510
- storer.saveAuthentication(recorder, datasheet);
1511
- recorder.clearAccessAuthentication();
1512
- recorder.clearAccessAuthorization();
1513
- if (navigate) {
1514
- const path = recorder.getOriginPath();
1515
- if (path) navigator.navigate(path);
1516
- else navigator.navigate(redirect);
1517
- }
1518
- };
1635
+ let t1;
1636
+ if ($[0] !== context) {
1637
+ t1 = context.getRecorder();
1638
+ $[0] = context;
1639
+ $[1] = t1;
1640
+ } else t1 = $[1];
1641
+ const recorder = t1;
1642
+ let t2;
1643
+ if ($[2] !== context) {
1644
+ t2 = context.getStorer();
1645
+ $[2] = context;
1646
+ $[3] = t2;
1647
+ } else t2 = $[3];
1648
+ const storer = t2;
1649
+ let t3;
1650
+ if ($[4] !== context) {
1651
+ t3 = context.getNavigator();
1652
+ $[4] = context;
1653
+ $[5] = t3;
1654
+ } else t3 = $[5];
1655
+ const navigator = t3;
1656
+ let t4;
1657
+ if ($[6] !== navigator || $[7] !== recorder || $[8] !== redirect || $[9] !== storer) {
1658
+ t4 = (datasheet)=>{
1659
+ storer.saveAuthentication(recorder, datasheet);
1660
+ recorder.clearAccessAuthentication();
1661
+ recorder.clearAccessAuthorization();
1662
+ if ("" !== redirect) {
1663
+ const path = recorder.getOriginPath();
1664
+ if (path) navigator.navigate(path);
1665
+ else navigator.navigate(redirect);
1666
+ }
1667
+ };
1668
+ $[6] = navigator;
1669
+ $[7] = recorder;
1670
+ $[8] = redirect;
1671
+ $[9] = storer;
1672
+ $[10] = t4;
1673
+ } else t4 = $[10];
1674
+ return t4;
1519
1675
  };
1520
- const useSaveAuthorization = (navigate = false, redirect = '/')=>{
1676
+ const useSaveAuthorization = (t0)=>{
1677
+ const $ = c(11);
1678
+ const redirect = void 0 === t0 ? "" : t0;
1521
1679
  const { context } = useSecurityContext();
1522
- const recorder = context.getRecorder();
1523
- const storer = context.getStorer();
1524
- const navigator = context.getNavigator();
1525
- return (datasheet)=>{
1526
- storer.saveAuthorization(recorder, datasheet);
1527
- recorder.clearAccessAuthorization();
1528
- if (navigate) {
1529
- const path = recorder.getOriginPath();
1530
- if (path) navigator.navigate(path);
1531
- else navigator.navigate(redirect);
1532
- }
1533
- };
1680
+ let t1;
1681
+ if ($[0] !== context) {
1682
+ t1 = context.getRecorder();
1683
+ $[0] = context;
1684
+ $[1] = t1;
1685
+ } else t1 = $[1];
1686
+ const recorder = t1;
1687
+ let t2;
1688
+ if ($[2] !== context) {
1689
+ t2 = context.getStorer();
1690
+ $[2] = context;
1691
+ $[3] = t2;
1692
+ } else t2 = $[3];
1693
+ const storer = t2;
1694
+ let t3;
1695
+ if ($[4] !== context) {
1696
+ t3 = context.getNavigator();
1697
+ $[4] = context;
1698
+ $[5] = t3;
1699
+ } else t3 = $[5];
1700
+ const navigator = t3;
1701
+ let t4;
1702
+ if ($[6] !== navigator || $[7] !== recorder || $[8] !== redirect || $[9] !== storer) {
1703
+ t4 = (datasheet)=>{
1704
+ storer.saveAuthorization(recorder, datasheet);
1705
+ recorder.clearAccessAuthorization();
1706
+ if ("" !== redirect) {
1707
+ const path = recorder.getOriginPath();
1708
+ if (path) navigator.navigate(path);
1709
+ else navigator.navigate(redirect);
1710
+ }
1711
+ };
1712
+ $[6] = navigator;
1713
+ $[7] = recorder;
1714
+ $[8] = redirect;
1715
+ $[9] = storer;
1716
+ $[10] = t4;
1717
+ } else t4 = $[10];
1718
+ return t4;
1534
1719
  };
1535
1720
  const useHavePermission = ()=>{
1721
+ const $ = c(5);
1536
1722
  const obtainAuthorization = useObtainAuthorization();
1537
1723
  const { context } = useSecurityContext();
1538
- const voter = context.getVoter();
1539
- return (term)=>{
1540
- let have = false;
1541
- const authorization = obtainAuthorization();
1542
- if (authorization) {
1543
- let permissions;
1544
- permissions = Array.isArray(term) ? term : [
1545
- term
1546
- ];
1547
- have = voter.vote(new Set(permissions), authorization.getPermissions());
1548
- }
1549
- return have;
1550
- };
1724
+ let t0;
1725
+ if ($[0] !== context) {
1726
+ t0 = context.getVoter();
1727
+ $[0] = context;
1728
+ $[1] = t0;
1729
+ } else t0 = $[1];
1730
+ const voter = t0;
1731
+ let t1;
1732
+ if ($[2] !== obtainAuthorization || $[3] !== voter) {
1733
+ t1 = (term)=>{
1734
+ let have = false;
1735
+ const authorization = obtainAuthorization();
1736
+ if (authorization) {
1737
+ let permissions;
1738
+ permissions = Array.isArray(term) ? term : [
1739
+ term
1740
+ ];
1741
+ have = voter.vote(new Set(permissions), authorization.getPermissions());
1742
+ }
1743
+ return have;
1744
+ };
1745
+ $[2] = obtainAuthorization;
1746
+ $[3] = voter;
1747
+ $[4] = t1;
1748
+ } else t1 = $[4];
1749
+ return t1;
1551
1750
  };
1552
- const useSaveSignature = (navigate = true, redirect = '/')=>{
1751
+ const useSaveSignature = (t0)=>{
1752
+ const $ = c(11);
1753
+ const redirect = void 0 === t0 ? "/" : t0;
1553
1754
  const { context } = useSecurityContext();
1554
- const recorder = context.getRecorder();
1555
- const storer = context.getStorer();
1556
- const navigator = context.getNavigator();
1557
- return (path)=>{
1558
- let target;
1559
- target = path ? path : recorder.getOriginPath();
1560
- if (target) storer.saveSignature(recorder, target);
1561
- if (navigate) if (target) navigator.navigate(target);
1562
- else navigator.navigate(redirect);
1563
- };
1755
+ let t1;
1756
+ if ($[0] !== context) {
1757
+ t1 = context.getRecorder();
1758
+ $[0] = context;
1759
+ $[1] = t1;
1760
+ } else t1 = $[1];
1761
+ const recorder = t1;
1762
+ let t2;
1763
+ if ($[2] !== context) {
1764
+ t2 = context.getStorer();
1765
+ $[2] = context;
1766
+ $[3] = t2;
1767
+ } else t2 = $[3];
1768
+ const storer = t2;
1769
+ let t3;
1770
+ if ($[4] !== context) {
1771
+ t3 = context.getNavigator();
1772
+ $[4] = context;
1773
+ $[5] = t3;
1774
+ } else t3 = $[5];
1775
+ const navigator = t3;
1776
+ let t4;
1777
+ if ($[6] !== navigator || $[7] !== recorder || $[8] !== redirect || $[9] !== storer) {
1778
+ t4 = (path)=>{
1779
+ let target;
1780
+ target = path ? path : recorder.getOriginPath();
1781
+ if (target) storer.saveSignature(recorder, target);
1782
+ if ("" !== redirect) if (target) navigator.navigate(target);
1783
+ else navigator.navigate(redirect);
1784
+ };
1785
+ $[6] = navigator;
1786
+ $[7] = recorder;
1787
+ $[8] = redirect;
1788
+ $[9] = storer;
1789
+ $[10] = t4;
1790
+ } else t4 = $[10];
1791
+ return t4;
1564
1792
  };
1565
1793
  const useDeleteSignature = ()=>{
1794
+ const $ = c(7);
1566
1795
  const { context } = useSecurityContext();
1567
- const recorder = context.getRecorder();
1568
- const storer = context.getStorer();
1569
- return ()=>{
1570
- storer.deleteSignature(recorder);
1571
- };
1796
+ let t0;
1797
+ if ($[0] !== context) {
1798
+ t0 = context.getRecorder();
1799
+ $[0] = context;
1800
+ $[1] = t0;
1801
+ } else t0 = $[1];
1802
+ const recorder = t0;
1803
+ let t1;
1804
+ if ($[2] !== context) {
1805
+ t1 = context.getStorer();
1806
+ $[2] = context;
1807
+ $[3] = t1;
1808
+ } else t1 = $[3];
1809
+ const storer = t1;
1810
+ let t2;
1811
+ if ($[4] !== recorder || $[5] !== storer) {
1812
+ t2 = ()=>{
1813
+ storer.deleteSignature(recorder);
1814
+ };
1815
+ $[4] = recorder;
1816
+ $[5] = storer;
1817
+ $[6] = t2;
1818
+ } else t2 = $[6];
1819
+ return t2;
1572
1820
  };
1573
1821
  const useRemoveSignature = ()=>{
1822
+ const $ = c(7);
1574
1823
  const { context } = useSecurityContext();
1575
- const recorder = context.getRecorder();
1576
- const storer = context.getStorer();
1577
- return (path)=>{
1578
- if ('string' == typeof path) storer.removeSignature(recorder, {
1579
- pathname: path,
1580
- search: '',
1581
- hash: ''
1582
- });
1583
- else storer.removeSignature(recorder, path);
1584
- };
1824
+ let t0;
1825
+ if ($[0] !== context) {
1826
+ t0 = context.getRecorder();
1827
+ $[0] = context;
1828
+ $[1] = t0;
1829
+ } else t0 = $[1];
1830
+ const recorder = t0;
1831
+ let t1;
1832
+ if ($[2] !== context) {
1833
+ t1 = context.getStorer();
1834
+ $[2] = context;
1835
+ $[3] = t1;
1836
+ } else t1 = $[3];
1837
+ const storer = t1;
1838
+ let t2;
1839
+ if ($[4] !== recorder || $[5] !== storer) {
1840
+ t2 = (path)=>{
1841
+ if ("string" == typeof path) storer.removeSignature(recorder, {
1842
+ pathname: path,
1843
+ search: "",
1844
+ hash: ""
1845
+ });
1846
+ else storer.removeSignature(recorder, path);
1847
+ };
1848
+ $[4] = recorder;
1849
+ $[5] = storer;
1850
+ $[6] = t2;
1851
+ } else t2 = $[6];
1852
+ return t2;
1585
1853
  };
1586
1854
  const usePurgeSignature = ()=>{
1855
+ const $ = c(9);
1587
1856
  const { context } = useSecurityContext();
1588
- const recorder = context.getRecorder();
1589
- const storer = context.getStorer();
1590
- const path = recorder.getCurrentPath();
1591
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>()=>{
1592
- if (path) storer.removeSignature(recorder, path);
1593
- }, [
1594
- recorder,
1595
- storer,
1596
- path
1597
- ]);
1857
+ let recorder;
1858
+ let storer;
1859
+ let t0;
1860
+ if ($[0] !== context) {
1861
+ recorder = context.getRecorder();
1862
+ storer = context.getStorer();
1863
+ t0 = recorder.getCurrentPath();
1864
+ $[0] = context;
1865
+ $[1] = recorder;
1866
+ $[2] = storer;
1867
+ $[3] = t0;
1868
+ } else {
1869
+ recorder = $[1];
1870
+ storer = $[2];
1871
+ t0 = $[3];
1872
+ }
1873
+ const path = t0;
1874
+ let t1;
1875
+ let t2;
1876
+ if ($[4] !== path || $[5] !== recorder || $[6] !== storer) {
1877
+ t1 = ()=>()=>{
1878
+ if (path) storer.removeSignature(recorder, path);
1879
+ };
1880
+ t2 = [
1881
+ recorder,
1882
+ storer,
1883
+ path
1884
+ ];
1885
+ $[4] = path;
1886
+ $[5] = recorder;
1887
+ $[6] = storer;
1888
+ $[7] = t1;
1889
+ $[8] = t2;
1890
+ } else {
1891
+ t1 = $[7];
1892
+ t2 = $[8];
1893
+ }
1894
+ useEffect(t1, t2);
1598
1895
  };
1599
- const useLogout = (navigate = true, redirect = '/')=>{
1896
+ const useLogout = (t0, t1)=>{
1897
+ const $ = c(13);
1898
+ const cRedirect = void 0 === t0 ? "/" : t0;
1899
+ const pRedirect = void 0 === t1 ? "/" : t1;
1600
1900
  const { context } = useSecurityContext();
1601
- const recorder = context.getRecorder();
1602
- const storer = context.getStorer();
1603
- const navigator = context.getNavigator();
1604
- return ()=>{
1605
- storer.deleteAuthentication(recorder);
1606
- storer.deleteAuthorization(recorder);
1607
- storer.deleteSignature(recorder);
1608
- recorder.clearAccessAuthentication();
1609
- recorder.clearAccessAuthorization();
1610
- if (navigate) navigator.navigate(redirect);
1611
- const parent = context.getParent();
1612
- if (parent) {
1613
- const p_recorder = parent.getRecorder();
1614
- const p_storer = parent.getStorer();
1615
- const p_navigator = parent.getNavigator();
1616
- p_storer.deleteAuthentication(p_recorder);
1617
- p_storer.deleteAuthorization(p_recorder);
1618
- p_storer.deleteSignature(p_recorder);
1619
- p_recorder.clearAccessAuthentication();
1620
- p_recorder.clearAccessAuthorization();
1621
- if (navigate) p_navigator.navigate(redirect);
1622
- }
1623
- };
1901
+ let t2;
1902
+ if ($[0] !== context) {
1903
+ t2 = context.getRecorder();
1904
+ $[0] = context;
1905
+ $[1] = t2;
1906
+ } else t2 = $[1];
1907
+ const recorder = t2;
1908
+ let t3;
1909
+ if ($[2] !== context) {
1910
+ t3 = context.getStorer();
1911
+ $[2] = context;
1912
+ $[3] = t3;
1913
+ } else t3 = $[3];
1914
+ const storer = t3;
1915
+ let t4;
1916
+ if ($[4] !== context) {
1917
+ t4 = context.getNavigator();
1918
+ $[4] = context;
1919
+ $[5] = t4;
1920
+ } else t4 = $[5];
1921
+ const navigator = t4;
1922
+ let t5;
1923
+ if ($[6] !== cRedirect || $[7] !== context || $[8] !== navigator || $[9] !== pRedirect || $[10] !== recorder || $[11] !== storer) {
1924
+ t5 = ()=>{
1925
+ storer.deleteAuthentication(recorder);
1926
+ storer.deleteAuthorization(recorder);
1927
+ storer.deleteSignature(recorder);
1928
+ recorder.clearAccessAuthentication();
1929
+ recorder.clearAccessAuthorization();
1930
+ if ("" !== cRedirect) navigator.navigate(cRedirect);
1931
+ const parent = context.getParent();
1932
+ if (parent) {
1933
+ const p_recorder = parent.getRecorder();
1934
+ const p_storer = parent.getStorer();
1935
+ const p_navigator = parent.getNavigator();
1936
+ p_storer.deleteAuthentication(p_recorder);
1937
+ p_storer.deleteAuthorization(p_recorder);
1938
+ p_storer.deleteSignature(p_recorder);
1939
+ p_recorder.clearAccessAuthentication();
1940
+ p_recorder.clearAccessAuthorization();
1941
+ if ("" !== pRedirect) p_navigator.navigate(pRedirect);
1942
+ }
1943
+ };
1944
+ $[6] = cRedirect;
1945
+ $[7] = context;
1946
+ $[8] = navigator;
1947
+ $[9] = pRedirect;
1948
+ $[10] = recorder;
1949
+ $[11] = storer;
1950
+ $[12] = t5;
1951
+ } else t5 = $[12];
1952
+ return t5;
1624
1953
  };
1625
- const useLogin = (logined = false, navigate = true, redirect = '/')=>{
1954
+ const useLogin = (t0, t1)=>{
1955
+ const $ = c(21);
1956
+ const cRedirect = void 0 === t0 ? "/" : t0;
1957
+ const pRedirect = void 0 === t1 ? "/" : t1;
1626
1958
  const { context } = useSecurityContext();
1627
- const recorder = context.getRecorder();
1628
- const storer = context.getStorer();
1629
- const navigator = context.getNavigator();
1630
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
1631
- const isAuthentication = recorder.existAccessAuthentication() || !!storer.loadAuthentication(recorder);
1632
- if (logined && isAuthentication) navigator.navigate(redirect);
1633
- }, [
1634
- logined,
1635
- redirect,
1636
- recorder,
1637
- storer,
1638
- navigator
1639
- ]);
1640
- return (datasheet)=>{
1641
- storer.saveAuthentication(recorder, datasheet);
1642
- recorder.clearAccessAuthentication();
1643
- recorder.clearAccessAuthorization();
1644
- if (navigate) {
1645
- const path = recorder.getOriginPath();
1646
- if (path) navigator.navigate(path);
1647
- else navigator.navigate(redirect);
1648
- }
1649
- };
1959
+ let t2;
1960
+ if ($[0] !== context) {
1961
+ t2 = context.getRecorder();
1962
+ $[0] = context;
1963
+ $[1] = t2;
1964
+ } else t2 = $[1];
1965
+ const recorder = t2;
1966
+ let t3;
1967
+ if ($[2] !== context) {
1968
+ t3 = context.getStorer();
1969
+ $[2] = context;
1970
+ $[3] = t3;
1971
+ } else t3 = $[3];
1972
+ const storer = t3;
1973
+ let t4;
1974
+ if ($[4] !== context) {
1975
+ t4 = context.getNavigator();
1976
+ $[4] = context;
1977
+ $[5] = t4;
1978
+ } else t4 = $[5];
1979
+ const navigator = t4;
1980
+ let t5;
1981
+ let t6;
1982
+ if ($[6] !== cRedirect || $[7] !== context || $[8] !== navigator || $[9] !== pRedirect || $[10] !== recorder || $[11] !== storer) {
1983
+ t5 = ()=>{
1984
+ const isAuthentication = recorder.existAccessAuthentication() || !!storer.loadAuthentication(recorder);
1985
+ if (isAuthentication) {
1986
+ const e_parent = context.getParent();
1987
+ if (e_parent && "" !== pRedirect) {
1988
+ const p_navigator = e_parent.getNavigator();
1989
+ p_navigator.navigate(pRedirect);
1990
+ } else if ("" !== cRedirect) {
1991
+ const path = recorder.getOriginPath();
1992
+ if (path) navigator.navigate(path);
1993
+ else navigator.navigate(cRedirect);
1994
+ }
1995
+ }
1996
+ };
1997
+ t6 = [
1998
+ cRedirect,
1999
+ recorder,
2000
+ storer,
2001
+ navigator,
2002
+ context,
2003
+ pRedirect
2004
+ ];
2005
+ $[6] = cRedirect;
2006
+ $[7] = context;
2007
+ $[8] = navigator;
2008
+ $[9] = pRedirect;
2009
+ $[10] = recorder;
2010
+ $[11] = storer;
2011
+ $[12] = t5;
2012
+ $[13] = t6;
2013
+ } else {
2014
+ t5 = $[12];
2015
+ t6 = $[13];
2016
+ }
2017
+ useEffect(t5, t6);
2018
+ let t7;
2019
+ if ($[14] !== cRedirect || $[15] !== context || $[16] !== navigator || $[17] !== pRedirect || $[18] !== recorder || $[19] !== storer) {
2020
+ t7 = (datasheet)=>{
2021
+ storer.saveAuthentication(recorder, datasheet);
2022
+ recorder.clearAccessAuthentication();
2023
+ recorder.clearAccessAuthorization();
2024
+ const r_parent = context.getParent();
2025
+ if (r_parent && "" !== pRedirect) {
2026
+ const p_navigator_0 = r_parent.getNavigator();
2027
+ p_navigator_0.navigate(pRedirect);
2028
+ } else if ("" !== cRedirect) {
2029
+ const path_0 = recorder.getOriginPath();
2030
+ if (path_0) navigator.navigate(path_0);
2031
+ else navigator.navigate(cRedirect);
2032
+ }
2033
+ };
2034
+ $[14] = cRedirect;
2035
+ $[15] = context;
2036
+ $[16] = navigator;
2037
+ $[17] = pRedirect;
2038
+ $[18] = recorder;
2039
+ $[19] = storer;
2040
+ $[20] = t7;
2041
+ } else t7 = $[20];
2042
+ return t7;
1650
2043
  };
1651
2044
  const useCustomBlocker = (handler)=>{
2045
+ const $ = c(6);
1652
2046
  const { manager } = useSecurityContext();
1653
- const blocker = manager.getBlocker();
1654
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
1655
- blocker.register(handler);
1656
- return ()=>{
1657
- blocker.unregister(handler);
2047
+ let t0;
2048
+ if ($[0] !== manager) {
2049
+ t0 = manager.getBlocker();
2050
+ $[0] = manager;
2051
+ $[1] = t0;
2052
+ } else t0 = $[1];
2053
+ const blocker = t0;
2054
+ let t1;
2055
+ let t2;
2056
+ if ($[2] !== blocker || $[3] !== handler) {
2057
+ t1 = ()=>{
2058
+ blocker.register(handler);
2059
+ return ()=>{
2060
+ blocker.unregister(handler);
2061
+ };
1658
2062
  };
1659
- }, [
1660
- blocker,
1661
- handler
1662
- ]);
2063
+ t2 = [
2064
+ blocker,
2065
+ handler
2066
+ ];
2067
+ $[2] = blocker;
2068
+ $[3] = handler;
2069
+ $[4] = t1;
2070
+ $[5] = t2;
2071
+ } else {
2072
+ t1 = $[4];
2073
+ t2 = $[5];
2074
+ }
2075
+ useEffect(t1, t2);
1663
2076
  };
1664
- const useSecurityBlocker = (recover = true)=>{
2077
+ const useSecurityBlocker = (t0)=>{
2078
+ const $ = c(17);
2079
+ const recover = void 0 === t0 ? true : t0;
1665
2080
  const { context, manager } = useSecurityContext();
1666
- const blocker = manager.getBlocker();
1667
- const [path, setPath] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)();
1668
- const [jump, setJump] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
1669
- const [blocked, setBlocked] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
1670
- const proceed = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
1671
- if (path) {
1672
- setJump(true);
1673
- if (recover) {
1674
- setPath(void 0);
1675
- setBlocked(false);
2081
+ const [path, setPath] = useState();
2082
+ const [jump, setJump] = useState(false);
2083
+ const [blocked, setBlocked] = useState(false);
2084
+ let t1;
2085
+ if ($[0] !== context || $[1] !== path || $[2] !== recover) {
2086
+ t1 = ()=>{
2087
+ if (path) {
2088
+ setJump(true);
2089
+ if (recover) {
2090
+ setPath(void 0);
2091
+ setBlocked(false);
2092
+ }
2093
+ context.getNavigator().navigate(path);
1676
2094
  }
1677
- context.getNavigator().navigate(path);
1678
- }
1679
- }, [
1680
- context,
1681
- path,
1682
- recover
1683
- ]);
1684
- const reset = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
1685
- setPath(void 0);
1686
- setJump(false);
1687
- setBlocked(false);
1688
- }, []);
1689
- const handler = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((context, currentPath, currentResource)=>{
1690
- setJump(false);
1691
- if (jump) return false;
1692
- setPath(currentPath);
1693
- setBlocked(true);
1694
- return true;
1695
- }, [
1696
- jump
1697
- ]);
1698
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
1699
- blocker.register(handler);
1700
- return ()=>{
1701
- blocker.unregister(handler);
1702
2095
  };
1703
- }, [
1704
- blocker,
1705
- handler
1706
- ]);
1707
- return {
1708
- blocked,
1709
- proceed,
1710
- reset,
1711
- path
1712
- };
2096
+ $[0] = context;
2097
+ $[1] = path;
2098
+ $[2] = recover;
2099
+ $[3] = t1;
2100
+ } else t1 = $[3];
2101
+ const proceed = t1;
2102
+ let t2;
2103
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2104
+ t2 = ()=>{
2105
+ setPath(void 0);
2106
+ setJump(false);
2107
+ setBlocked(false);
2108
+ };
2109
+ $[4] = t2;
2110
+ } else t2 = $[4];
2111
+ const reset = t2;
2112
+ let t3;
2113
+ if ($[5] !== jump) {
2114
+ t3 = (context_0, currentPath, currentResource)=>{
2115
+ setJump(false);
2116
+ if (jump) return false;
2117
+ setPath(currentPath);
2118
+ setBlocked(true);
2119
+ return true;
2120
+ };
2121
+ $[5] = jump;
2122
+ $[6] = t3;
2123
+ } else t3 = $[6];
2124
+ const handler = t3;
2125
+ let t4;
2126
+ if ($[7] !== manager) {
2127
+ t4 = manager.getBlocker();
2128
+ $[7] = manager;
2129
+ $[8] = t4;
2130
+ } else t4 = $[8];
2131
+ const blocker = t4;
2132
+ let t5;
2133
+ let t6;
2134
+ if ($[9] !== blocker || $[10] !== handler) {
2135
+ t5 = ()=>{
2136
+ blocker.register(handler);
2137
+ return ()=>{
2138
+ blocker.unregister(handler);
2139
+ };
2140
+ };
2141
+ t6 = [
2142
+ blocker,
2143
+ handler
2144
+ ];
2145
+ $[9] = blocker;
2146
+ $[10] = handler;
2147
+ $[11] = t5;
2148
+ $[12] = t6;
2149
+ } else {
2150
+ t5 = $[11];
2151
+ t6 = $[12];
2152
+ }
2153
+ useEffect(t5, t6);
2154
+ let t7;
2155
+ if ($[13] !== blocked || $[14] !== path || $[15] !== proceed) {
2156
+ t7 = {
2157
+ blocked,
2158
+ proceed,
2159
+ reset,
2160
+ path
2161
+ };
2162
+ $[13] = blocked;
2163
+ $[14] = path;
2164
+ $[15] = proceed;
2165
+ $[16] = t7;
2166
+ } else t7 = $[16];
2167
+ return t7;
1713
2168
  };
1714
- function HavePermission({ children, term }) {
2169
+ function HavePermission(t0) {
2170
+ const { children, term } = t0;
1715
2171
  const havePermission = useHavePermission();
1716
2172
  const have = havePermission(term);
1717
- if (!have) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {});
1718
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
1719
- children: children
1720
- });
2173
+ if (!have) return null;
2174
+ return children;
1721
2175
  }
1722
- const withHavePermission = (Component, term)=>()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HavePermission, {
2176
+ const withHavePermission = (Component, term)=>()=>/*#__PURE__*/ jsx(HavePermission, {
1723
2177
  term: term,
1724
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Component, {})
2178
+ children: /*#__PURE__*/ jsx(Component, {})
1725
2179
  });
1726
2180
  class MicroAppAddon extends AbstractAddon {
1727
2181
  static HIERARCHY_JOIN_IGNORE = 'ignore';
@@ -1739,8 +2193,8 @@ class MicroAppAddon extends AbstractAddon {
1739
2193
  guardBefore(context, manager, currentPath, currentResource) {
1740
2194
  if (this.microJoin) return;
1741
2195
  if (window.__MICRO_APP_BASE_APPLICATION__) {
1742
- window.__RSR_MICRO_APP_PARENT_CONTEXT__ = context;
1743
- window.__RSR_MICRO_APP_PARENT_MANAGER__ = manager;
2196
+ window.__AQI_RSR_MICRO_APP_PARENT_CONTEXT__ = context;
2197
+ window.__AQI_RSR_MICRO_APP_PARENT_MANAGER__ = manager;
1744
2198
  }
1745
2199
  if (window.__MICRO_APP_ENVIRONMENT__) {
1746
2200
  if (this.basenameJoin) {
@@ -1750,7 +2204,7 @@ class MicroAppAddon extends AbstractAddon {
1750
2204
  matcher.setBasename(baseRoute);
1751
2205
  }
1752
2206
  }
1753
- const c_parent = window.rawWindow?.__RSR_MICRO_APP_PARENT_CONTEXT__;
2207
+ const c_parent = window.rawWindow?.__AQI_RSR_MICRO_APP_PARENT_CONTEXT__;
1754
2208
  if (c_parent) {
1755
2209
  if (!context.getParent()) context.setParent(c_parent);
1756
2210
  if (this.hierarchyJoin !== MicroAppAddon.HIERARCHY_JOIN_IGNORE) {
@@ -1763,7 +2217,7 @@ class MicroAppAddon extends AbstractAddon {
1763
2217
  }
1764
2218
  }
1765
2219
  }
1766
- const m_parent = window.rawWindow?.__RSR_MICRO_APP_PARENT_MANAGER__;
2220
+ const m_parent = window.rawWindow?.__AQI_RSR_MICRO_APP_PARENT_MANAGER__;
1767
2221
  if (m_parent) {
1768
2222
  if (!manager.getParent()) manager.setParent(m_parent);
1769
2223
  }
@@ -1772,4 +2226,4 @@ class MicroAppAddon extends AbstractAddon {
1772
2226
  }
1773
2227
  }
1774
2228
  const microAppAddon = (basenameJoin = true, hierarchyJoin = MicroAppAddon.HIERARCHY_JOIN_IGNORE)=>new MicroAppAddon(basenameJoin, hierarchyJoin);
1775
- export { AbstractAddon, common_AccessBehave as AccessBehave, AccessBlockerBuilder, AccessContextBuilder, common_AccessDecision as AccessDecision, AccessGuarderBuilder, AccessHandlerBuilder, AccessManagerBuilder, AccessMatcherBuilder, AccessNavigatorBuilder, AccessRecorderBuilder, AccessResourceBuilder, AccessStorerBuilder, AccessVoterBuilder, BehaveHandler, CacheVoter, HavePermission, HierarchyVoter, MicroAppAddon, MultiBlocker, OriginRelationResolver, SecurityBlocker, SecurityContext, SecurityProvider, SimpleAuthentication, SimpleAuthorization, SimpleContext, SimpleGuarder, SimpleManager, SimpleMatcher, SimpleNavigator, SimpleRecorder, SimpleResource, SimpleStorer, SimpleUser, SimpleVoter, SingleBlocker, microAppAddon, useCustomBlocker, useDeleteAuthentication, useDeleteAuthorization, useDeleteSignature, useHavePermission, useLogin, useLogout, useObtainAuthentication, useObtainAuthorization, usePurgeSignature, useRemoveSignature, useSaveAuthentication, useSaveAuthorization, useSaveSignature, useSecurityBlocker, useSecurityContext, withHavePermission, withSecurityBlocker };
2229
+ export { AbstractAddon, AccessBlockerBuilder, AccessContextBuilder, AccessGuarderBuilder, AccessHandlerBuilder, AccessManagerBuilder, AccessMatcherBuilder, AccessNavigatorBuilder, AccessRecorderBuilder, AccessResourceBuilder, AccessStorerBuilder, AccessVoterBuilder, BehaveHandler, CacheVoter, HavePermission, HierarchyVoter, MicroAppAddon, MultiBlocker, OriginRelationResolver, SecurityBlocker, SecurityContext, SecurityProvider, SimpleAuthentication, SimpleAuthorization, SimpleContext, SimpleGuarder, SimpleManager, SimpleMatcher, SimpleNavigator, SimpleRecorder, SimpleResource, SimpleStorer, SimpleUser, SimpleVoter, SingleBlocker, common_AccessBehave as AccessBehave, common_AccessDecision as AccessDecision, microAppAddon, useCustomBlocker, useDeleteAuthentication, useDeleteAuthorization, useDeleteSignature, useHavePermission, useLogin, useLogout, useObtainAuthentication, useObtainAuthorization, usePurgeSignature, useRemoveSignature, useSaveAuthentication, useSaveAuthorization, useSaveSignature, useSecurityBlocker, useSecurityContext, withHavePermission, withSecurityBlocker };