@feathery/react 2.14.0 → 2.15.1
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/cjs/Form/grid/Element/index.d.ts.map +1 -1
- package/cjs/Form/grid/index.d.ts.map +1 -1
- package/cjs/Form/index.d.ts.map +1 -1
- package/cjs/Form/logic.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/Actions.d.ts +10 -0
- package/cjs/elements/basic/TableElement/Actions.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/EmptyState.d.ts +6 -0
- package/cjs/elements/basic/TableElement/EmptyState.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/Pagination.d.ts +10 -0
- package/cjs/elements/basic/TableElement/Pagination.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/Search.d.ts +7 -0
- package/cjs/elements/basic/TableElement/Search.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/Sort.d.ts +12 -0
- package/cjs/elements/basic/TableElement/Sort.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/exampleData.d.ts +3 -0
- package/cjs/elements/basic/TableElement/exampleData.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/index.d.ts +3 -0
- package/cjs/elements/basic/TableElement/index.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/styles.d.ts +391 -0
- package/cjs/elements/basic/TableElement/styles.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/types.d.ts +10 -0
- package/cjs/elements/basic/TableElement/types.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/useTableData.d.ts +37 -0
- package/cjs/elements/basic/TableElement/useTableData.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/utils.d.ts +11 -0
- package/cjs/elements/basic/TableElement/utils.d.ts.map +1 -0
- package/cjs/elements/components/skeletons/ElementSkeleton.d.ts +8 -0
- package/cjs/elements/components/skeletons/ElementSkeleton.d.ts.map +1 -0
- package/cjs/elements/fields/AddressLine1Field/index.d.ts.map +1 -1
- package/cjs/elements/index.d.ts +1 -0
- package/cjs/elements/index.d.ts.map +1 -1
- package/cjs/{fthry_FormControl.BwXT0ep8.js → fthry_FormControl.DhxdiYw6.js} +1 -1
- package/cjs/{fthry_InlineTooltip.BdhCa_rK.js → fthry_InlineTooltip.BgAXRUIt.js} +2 -2
- package/cjs/{fthry_Overlay.CkaxO8d5.js → fthry_Overlay.D7IM1ywp.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.mg1fdRD0.js → fthry_PaymentMethodField.NEoloWMI.js} +4 -4
- package/cjs/{fthry_Placeholder.Jcsn0I77.js → fthry_Placeholder.D5C0aH2S.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.B1bZYLk8.js → fthry_ShowEyeIcon.CmLMyaN5.js} +1 -1
- package/cjs/{fthry_index.CNP-DZpU.js → fthry_index.BFpcCw2o.js} +1 -1
- package/cjs/{fthry_index.CIRAsV1y.js → fthry_index.BJYH_2P6.js} +1 -1
- package/cjs/{fthry_index.CdljdZZa.js → fthry_index.BK_jaGHn.js} +5 -5
- package/cjs/{fthry_index.DamIMdR9.js → fthry_index.Bb1R5GZK.js} +2 -2
- package/cjs/{fthry_index.Wk8VztlG.js → fthry_index.Bd1HfYvE.js} +5 -5
- package/cjs/{fthry_index.CrMPecva.js → fthry_index.BgeTdwT5.js} +2 -2
- package/cjs/{fthry_index.BlqRmYU3.js → fthry_index.Bq3nU0FH.js} +6 -6
- package/cjs/{fthry_index.BDYAeN41.js → fthry_index.BqS0kCfh.js} +1 -1
- package/cjs/{fthry_index.CH-jUzEB.js → fthry_index.By8RWuUY.js} +6 -6
- package/cjs/{fthry_index.CM61c38_.js → fthry_index.CbfDILWu.js} +4 -4
- package/cjs/{fthry_index.BWlL6Yer.js → fthry_index.CgMWWz7f.js} +1 -1
- package/cjs/{fthry_index.CFas_RaG.js → fthry_index.Ci8dMyBp.js} +1 -1
- package/cjs/fthry_index.CkmA933O.js +669 -0
- package/cjs/{fthry_index.BAjR2Rnl.js → fthry_index.CrFjXWLg.js} +3 -3
- package/cjs/{fthry_index.YHxFZskW.js → fthry_index.CzzIM_Es.js} +1895 -62
- package/cjs/{fthry_index.Cg6LX1gC.js → fthry_index.D4rjZ-iU.js} +4 -4
- package/cjs/{fthry_index.Brf3d6gi.js → fthry_index.DDjTLR_C.js} +6 -6
- package/cjs/{fthry_index.DAUqZ_Ax.js → fthry_index.DLnigFf3.js} +4 -4
- package/cjs/{fthry_index.6mEHhzfW.js → fthry_index.DXm31Dvn.js} +4 -4
- package/cjs/{fthry_index.LJEYPWI3.js → fthry_index.DzpGyyn4.js} +5 -5
- package/cjs/{fthry_index.Dl8vbJjd.js → fthry_index.E_vLB-7s.js} +8 -8
- package/cjs/{fthry_index.stdBLQZf.js → fthry_index.GeYRayLh.js} +1 -1
- package/cjs/{fthry_index.C1fh-rBQ.js → fthry_index.JRP5lBfp.js} +7 -6
- package/cjs/{fthry_index.D347YZZf.js → fthry_index.WDI9ExUl.js} +1 -1
- package/cjs/{fthry_input.Co8r9GsS.js → fthry_input.kxr0lkUP.js} +1 -1
- package/cjs/{fthry_script.Bq4U9W-W.js → fthry_script.CpqGoZRW.js} +1 -1
- package/cjs/{fthry_styles.v2wlusMk.js → fthry_styles.UURZE2St.js} +1 -1
- package/cjs/{fthry_useElementSize.H_jyVKqM.js → fthry_useElementSize.B7mqB2ri.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.PzKJwKNh.js → fthry_useSalesforceSync.DFHAEpBn.js} +1 -1
- package/cjs/{fthry_webfontloader.BEk-u0hO.js → fthry_webfontloader.COsYlNwD.js} +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +1 -1
- package/cjs/types/Form.d.ts +4 -1
- package/cjs/types/Form.d.ts.map +1 -1
- package/cjs/utils/eventQueue.d.ts +26 -0
- package/cjs/utils/eventQueue.d.ts.map +1 -0
- package/cjs/utils/featheryClient/index.d.ts +6 -0
- package/cjs/utils/featheryClient/index.d.ts.map +1 -1
- package/cjs/utils/formHelperFunctions.d.ts +1 -1
- package/cjs/utils/formHelperFunctions.d.ts.map +1 -1
- package/cjs/utils/hideAndRepeats.d.ts.map +1 -1
- package/dist/Form/grid/Element/index.d.ts.map +1 -1
- package/dist/Form/grid/index.d.ts.map +1 -1
- package/dist/Form/index.d.ts.map +1 -1
- package/dist/Form/logic.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/Actions.d.ts +10 -0
- package/dist/elements/basic/TableElement/Actions.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/EmptyState.d.ts +6 -0
- package/dist/elements/basic/TableElement/EmptyState.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/Pagination.d.ts +10 -0
- package/dist/elements/basic/TableElement/Pagination.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/Search.d.ts +7 -0
- package/dist/elements/basic/TableElement/Search.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/Sort.d.ts +12 -0
- package/dist/elements/basic/TableElement/Sort.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/exampleData.d.ts +3 -0
- package/dist/elements/basic/TableElement/exampleData.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/index.d.ts +3 -0
- package/dist/elements/basic/TableElement/index.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/styles.d.ts +391 -0
- package/dist/elements/basic/TableElement/styles.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/types.d.ts +10 -0
- package/dist/elements/basic/TableElement/types.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/useTableData.d.ts +37 -0
- package/dist/elements/basic/TableElement/useTableData.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/utils.d.ts +11 -0
- package/dist/elements/basic/TableElement/utils.d.ts.map +1 -0
- package/dist/elements/components/skeletons/ElementSkeleton.d.ts +8 -0
- package/dist/elements/components/skeletons/ElementSkeleton.d.ts.map +1 -0
- package/dist/elements/fields/AddressLine1Field/index.d.ts.map +1 -1
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.d.ts.map +1 -1
- package/dist/{fthry_FormControl.CrSvLSA7.js → fthry_FormControl.CikgGb3C.js} +1 -1
- package/dist/{fthry_InlineTooltip.xj-t-582.js → fthry_InlineTooltip.BpfxcSEn.js} +2 -2
- package/dist/{fthry_Overlay.CJFSLbLE.js → fthry_Overlay.CJVfag7c.js} +1 -1
- package/dist/{fthry_PaymentMethodField.PRJIHswh.js → fthry_PaymentMethodField.BpA_xhqt.js} +4 -4
- package/dist/{fthry_Placeholder.7M07CwTS.js → fthry_Placeholder.DwCFN6a9.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.n639xEWA.js → fthry_ShowEyeIcon.D6nQhesH.js} +1 -1
- package/dist/{fthry_index.DQhKI62v.js → fthry_index.B-oHlMGi.js} +2 -2
- package/dist/{fthry_index.DsHJmYgu.js → fthry_index.B7VWXvgC.js} +4 -4
- package/dist/{fthry_index.DQuVxHkp.js → fthry_index.B84L3MVC.js} +1 -1
- package/dist/fthry_index.BAhh3Pz6.js +667 -0
- package/dist/{fthry_index.DtttVU-B.js → fthry_index.BEZmvsoo.js} +7 -6
- package/dist/{fthry_index.D6sWBKuA.js → fthry_index.BSEfDQAc.js} +2 -2
- package/dist/{fthry_index.BdbDXIuj.js → fthry_index.BsEfTy-x.js} +8 -8
- package/dist/{fthry_index.sXNItbKY.js → fthry_index.BsNCOSBE.js} +5 -5
- package/dist/{fthry_index.CzHuSmWc.js → fthry_index.Bz07r-AM.js} +1 -1
- package/dist/{fthry_index.DgIPpVNk.js → fthry_index.BzrcCLzO.js} +4 -4
- package/dist/{fthry_index.Df-7wyL2.js → fthry_index.CJKGRCG-.js} +4 -4
- package/dist/{fthry_index.DMTSFPNS.js → fthry_index.D9AKkBzu.js} +1 -1
- package/dist/{fthry_index.DEU7NBKU.js → fthry_index.D9VjMJ_U.js} +1 -1
- package/dist/{fthry_index.Cfn3D1XZ.js → fthry_index.DH2fsNWG.js} +3 -3
- package/dist/{fthry_index.CxH24rcl.js → fthry_index.Dgmpm9wy.js} +6 -6
- package/dist/{fthry_index.g8xB96Yo.js → fthry_index.DhU16s57.js} +5 -5
- package/dist/{fthry_index.Dd5mpmpk.js → fthry_index.DoP7RwIP.js} +1 -1
- package/dist/{fthry_index.BpsK3TYO.js → fthry_index.Dy4nSWZa.js} +1 -1
- package/dist/{fthry_index.Be8xdrui.js → fthry_index.Fs86Fy9Y.js} +5 -5
- package/dist/{fthry_index.RwhYSoEm.js → fthry_index.NOuMR_hq.js} +6 -6
- package/dist/{fthry_index.CwsphGMI.js → fthry_index.OHN-Iv2R.js} +1 -1
- package/dist/{fthry_index.BE1aEx2n.js → fthry_index.m7CZv4YY.js} +4 -4
- package/dist/{fthry_index.BKbx2qxD.js → fthry_index.t4v0qqgv.js} +6 -6
- package/dist/{fthry_index.CdIRvNp8.js → fthry_index.y4j9reIZ.js} +1896 -63
- package/dist/{fthry_input.CD5doOgD.js → fthry_input.Cb2u4VEf.js} +1 -1
- package/dist/{fthry_script.B1ROwso4.js → fthry_script.C5O1ZNQQ.js} +1 -1
- package/dist/{fthry_styles.C-VyrwW3.js → fthry_styles.DGB23xLr.js} +1 -1
- package/dist/{fthry_useElementSize.1FdURPgQ.js → fthry_useElementSize.CBdpS9aW.js} +1 -1
- package/dist/{fthry_useSalesforceSync.wEr6a7_E.js → fthry_useSalesforceSync.Cae_lMG1.js} +1 -1
- package/dist/{fthry_webfontloader.ChgT0Ifr.js → fthry_webfontloader.DAANkO2-.js} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/Form.d.ts +4 -1
- package/dist/types/Form.d.ts.map +1 -1
- package/dist/utils/eventQueue.d.ts +26 -0
- package/dist/utils/eventQueue.d.ts.map +1 -0
- package/dist/utils/featheryClient/index.d.ts +6 -0
- package/dist/utils/featheryClient/index.d.ts.map +1 -1
- package/dist/utils/formHelperFunctions.d.ts +1 -1
- package/dist/utils/formHelperFunctions.d.ts.map +1 -1
- package/dist/utils/hideAndRepeats.d.ts.map +1 -1
- package/package.json +4 -3
- package/umd/{277.94ae8bf6190836d1dceb.js → 277.d9907ecd5dc2117c9171.js} +1 -1
- package/umd/{509.4236d4d76d2fa2ccd971.js → 509.341a4196aad912adb28d.js} +2 -2
- package/umd/{AddressField.3523efd23175117d47a5.js → AddressField.ec97334fe233830bc05b.js} +1 -1
- package/umd/SignatureField.56c69ad7ee1f7e0b5003.js +1 -0
- package/umd/TableElement.ef63774f461682dd3ac9.js +1 -0
- package/umd/index.js +1 -1
- package/cjs/elements/components/skeletons/FieldSkeleton.d.ts +0 -8
- package/cjs/elements/components/skeletons/FieldSkeleton.d.ts.map +0 -1
- package/dist/elements/components/skeletons/FieldSkeleton.d.ts +0 -8
- package/dist/elements/components/skeletons/FieldSkeleton.d.ts.map +0 -1
- package/umd/SignatureField.1b502b1edb19e4af3b64.js +0 -1
- /package/umd/{509.4236d4d76d2fa2ccd971.js.LICENSE.txt → 509.341a4196aad912adb28d.js.LICENSE.txt} +0 -0
|
@@ -634,7 +634,7 @@ function identifier (index) {
|
|
|
634
634
|
* @return {object[]}
|
|
635
635
|
*/
|
|
636
636
|
function compile (value) {
|
|
637
|
-
return dealloc(parse$
|
|
637
|
+
return dealloc(parse$2('', null, null, null, [''], value = alloc(value), 0, [0], value))
|
|
638
638
|
}
|
|
639
639
|
|
|
640
640
|
/**
|
|
@@ -649,7 +649,7 @@ function compile (value) {
|
|
|
649
649
|
* @param {string[]} declarations
|
|
650
650
|
* @return {object}
|
|
651
651
|
*/
|
|
652
|
-
function parse$
|
|
652
|
+
function parse$2 (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
|
653
653
|
var index = 0;
|
|
654
654
|
var offset = 0;
|
|
655
655
|
var length = pseudo;
|
|
@@ -718,15 +718,15 @@ function parse$1 (value, root, parent, rule, rules, rulesets, pseudo, points, de
|
|
|
718
718
|
|
|
719
719
|
if (character === 123)
|
|
720
720
|
if (offset === 0)
|
|
721
|
-
parse$
|
|
721
|
+
parse$2(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
722
722
|
else
|
|
723
723
|
switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
|
724
724
|
// d l m s
|
|
725
725
|
case 100: case 108: case 109: case 115:
|
|
726
|
-
parse$
|
|
726
|
+
parse$2(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
|
|
727
727
|
break
|
|
728
728
|
default:
|
|
729
|
-
parse$
|
|
729
|
+
parse$2(characters, reference, reference, reference, [''], children, 0, points, children);
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
|
|
@@ -16482,7 +16482,8 @@ var stepElementTypes = [
|
|
|
16482
16482
|
'servar_fields',
|
|
16483
16483
|
'progress_bars',
|
|
16484
16484
|
'images',
|
|
16485
|
-
'videos'
|
|
16485
|
+
'videos',
|
|
16486
|
+
'tables'
|
|
16486
16487
|
];
|
|
16487
16488
|
var getPositionKey = function (node) {
|
|
16488
16489
|
if (!node.position)
|
|
@@ -16540,7 +16541,9 @@ function getVisiblePositions(step, internalId) {
|
|
|
16540
16541
|
var typeIndex = elementTypes.indexOf('subgrids');
|
|
16541
16542
|
elementTypes.splice(typeIndex, 1);
|
|
16542
16543
|
elementTypes.forEach(function (elementType) {
|
|
16543
|
-
|
|
16544
|
+
var _a;
|
|
16545
|
+
// TODO (table): remove backwards compatibility
|
|
16546
|
+
(_a = step[elementType]) === null || _a === void 0 ? void 0 : _a.forEach(function (el) {
|
|
16544
16547
|
_collectHideFlags(step, el, visiblePositions, hiddenPositions, repeatKeys, internalId);
|
|
16545
16548
|
});
|
|
16546
16549
|
});
|
|
@@ -20121,7 +20124,7 @@ var Element$1 = function (_a) {
|
|
|
20121
20124
|
var _b, _c, _d, _e, _f, _g;
|
|
20122
20125
|
var el = _a.node, form = _a.form;
|
|
20123
20126
|
var type = el.type;
|
|
20124
|
-
var userProgress = form.userProgress, curDepth = form.curDepth, maxDepth = form.maxDepth, elementProps = form.elementProps, activeStep = form.activeStep, buttonLoaders = form.buttonLoaders, customClickSelectionState = form.customClickSelectionState, runElementActions = form.runElementActions, buttonOnClick = form.buttonOnClick, fieldOnChange = form.fieldOnChange, inlineErrors = form.inlineErrors, setInlineErrors = form.setInlineErrors, changeValue = form.changeValue, updateFieldValues = form.updateFieldValues, elementOnView = form.elementOnView, onViewElements = form.onViewElements, formSettings = form.formSettings, formRef = form.formRef, focusRef = form.focusRef, setCardElement = form.setCardElement, visiblePositions = form.visiblePositions, featheryContext = form.featheryContext;
|
|
20127
|
+
var userProgress = form.userProgress, curDepth = form.curDepth, maxDepth = form.maxDepth, elementProps = form.elementProps, activeStep = form.activeStep, buttonLoaders = form.buttonLoaders, customClickSelectionState = form.customClickSelectionState, runElementActions = form.runElementActions, buttonOnClick = form.buttonOnClick, tableOnClick = form.tableOnClick, fieldOnChange = form.fieldOnChange, inlineErrors = form.inlineErrors, setInlineErrors = form.setInlineErrors, changeValue = form.changeValue, updateFieldValues = form.updateFieldValues, elementOnView = form.elementOnView, onViewElements = form.onViewElements, formSettings = form.formSettings, formRef = form.formRef, focusRef = form.focusRef, setCardElement = form.setCardElement, visiblePositions = form.visiblePositions, featheryContext = form.featheryContext;
|
|
20125
20128
|
var readOnly = formSettings.readOnly || initState.collaboratorReview === 'readOnly';
|
|
20126
20129
|
var basicProps = {
|
|
20127
20130
|
componentOnly: false,
|
|
@@ -20140,6 +20143,8 @@ var Element$1 = function (_a) {
|
|
|
20140
20143
|
return jsx$1(Elements.ImageElement, __assign({}, basicProps));
|
|
20141
20144
|
else if (type === 'video')
|
|
20142
20145
|
return jsx$1(Elements.VideoElement, __assign({}, basicProps));
|
|
20146
|
+
else if (type === 'table')
|
|
20147
|
+
return (jsx$1(Elements.TableElement, __assign({}, basicProps, { onClick: function (payload) { return tableOnClick(el, payload); } })));
|
|
20143
20148
|
else if (type === 'text')
|
|
20144
20149
|
return (jsx$1(Elements.TextElement, __assign({ textSpanOnClick: function (textSpanStart, textSpanEnd) {
|
|
20145
20150
|
var _a;
|
|
@@ -21965,7 +21970,9 @@ var buildStepGrid = function (step, viewport, visiblePositions) {
|
|
|
21965
21970
|
};
|
|
21966
21971
|
var convertStepToViewport = function (step, viewport) {
|
|
21967
21972
|
stepElementTypes.forEach(function (type) {
|
|
21968
|
-
|
|
21973
|
+
// TODO (table): remove backwards compatibility
|
|
21974
|
+
var _a;
|
|
21975
|
+
(_a = step[type]) === null || _a === void 0 ? void 0 : _a.forEach(function (obj, i) {
|
|
21969
21976
|
step[type][i] =
|
|
21970
21977
|
type === 'subgrids'
|
|
21971
21978
|
? convertToViewport(obj, viewport, viewportProperties.subgrids)
|
|
@@ -21998,7 +22005,8 @@ var typeMap = {
|
|
|
21998
22005
|
texts: 'text',
|
|
21999
22006
|
buttons: 'button',
|
|
22000
22007
|
servar_fields: 'field',
|
|
22001
|
-
videos: 'video'
|
|
22008
|
+
videos: 'video',
|
|
22009
|
+
tables: 'table'
|
|
22002
22010
|
};
|
|
22003
22011
|
var buildGridMap = function (step) {
|
|
22004
22012
|
var map = {};
|
|
@@ -35602,10 +35610,1637 @@ Parser.acorn = {
|
|
|
35602
35610
|
//
|
|
35603
35611
|
// [estree]: https://github.com/estree/estree
|
|
35604
35612
|
|
|
35605
|
-
function parse(input, options) {
|
|
35613
|
+
function parse$1(input, options) {
|
|
35606
35614
|
return Parser.parse(input, options)
|
|
35607
35615
|
}
|
|
35608
35616
|
|
|
35617
|
+
var dummyValue = "✖";
|
|
35618
|
+
|
|
35619
|
+
function isDummy(node) { return node.name === dummyValue }
|
|
35620
|
+
|
|
35621
|
+
function noop() {}
|
|
35622
|
+
|
|
35623
|
+
var LooseParser = function LooseParser(input, options) {
|
|
35624
|
+
if ( options === void 0 ) options = {};
|
|
35625
|
+
|
|
35626
|
+
this.toks = this.constructor.BaseParser.tokenizer(input, options);
|
|
35627
|
+
this.options = this.toks.options;
|
|
35628
|
+
this.input = this.toks.input;
|
|
35629
|
+
this.tok = this.last = {type: types$1.eof, start: 0, end: 0};
|
|
35630
|
+
this.tok.validateRegExpFlags = noop;
|
|
35631
|
+
this.tok.validateRegExpPattern = noop;
|
|
35632
|
+
if (this.options.locations) {
|
|
35633
|
+
var here = this.toks.curPosition();
|
|
35634
|
+
this.tok.loc = new SourceLocation(this.toks, here, here);
|
|
35635
|
+
}
|
|
35636
|
+
this.ahead = []; // Tokens ahead
|
|
35637
|
+
this.context = []; // Indentation contexted
|
|
35638
|
+
this.curIndent = 0;
|
|
35639
|
+
this.curLineStart = 0;
|
|
35640
|
+
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
|
|
35641
|
+
this.inAsync = false;
|
|
35642
|
+
this.inGenerator = false;
|
|
35643
|
+
this.inFunction = false;
|
|
35644
|
+
};
|
|
35645
|
+
|
|
35646
|
+
LooseParser.prototype.startNode = function startNode () {
|
|
35647
|
+
return new Node(this.toks, this.tok.start, this.options.locations ? this.tok.loc.start : null)
|
|
35648
|
+
};
|
|
35649
|
+
|
|
35650
|
+
LooseParser.prototype.storeCurrentPos = function storeCurrentPos () {
|
|
35651
|
+
return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start
|
|
35652
|
+
};
|
|
35653
|
+
|
|
35654
|
+
LooseParser.prototype.startNodeAt = function startNodeAt (pos) {
|
|
35655
|
+
if (this.options.locations) {
|
|
35656
|
+
return new Node(this.toks, pos[0], pos[1])
|
|
35657
|
+
} else {
|
|
35658
|
+
return new Node(this.toks, pos)
|
|
35659
|
+
}
|
|
35660
|
+
};
|
|
35661
|
+
|
|
35662
|
+
LooseParser.prototype.finishNode = function finishNode (node, type) {
|
|
35663
|
+
node.type = type;
|
|
35664
|
+
node.end = this.last.end;
|
|
35665
|
+
if (this.options.locations)
|
|
35666
|
+
{ node.loc.end = this.last.loc.end; }
|
|
35667
|
+
if (this.options.ranges)
|
|
35668
|
+
{ node.range[1] = this.last.end; }
|
|
35669
|
+
return node
|
|
35670
|
+
};
|
|
35671
|
+
|
|
35672
|
+
LooseParser.prototype.dummyNode = function dummyNode (type) {
|
|
35673
|
+
var dummy = this.startNode();
|
|
35674
|
+
dummy.type = type;
|
|
35675
|
+
dummy.end = dummy.start;
|
|
35676
|
+
if (this.options.locations)
|
|
35677
|
+
{ dummy.loc.end = dummy.loc.start; }
|
|
35678
|
+
if (this.options.ranges)
|
|
35679
|
+
{ dummy.range[1] = dummy.start; }
|
|
35680
|
+
this.last = {type: types$1.name, start: dummy.start, end: dummy.start, loc: dummy.loc};
|
|
35681
|
+
return dummy
|
|
35682
|
+
};
|
|
35683
|
+
|
|
35684
|
+
LooseParser.prototype.dummyIdent = function dummyIdent () {
|
|
35685
|
+
var dummy = this.dummyNode("Identifier");
|
|
35686
|
+
dummy.name = dummyValue;
|
|
35687
|
+
return dummy
|
|
35688
|
+
};
|
|
35689
|
+
|
|
35690
|
+
LooseParser.prototype.dummyString = function dummyString () {
|
|
35691
|
+
var dummy = this.dummyNode("Literal");
|
|
35692
|
+
dummy.value = dummy.raw = dummyValue;
|
|
35693
|
+
return dummy
|
|
35694
|
+
};
|
|
35695
|
+
|
|
35696
|
+
LooseParser.prototype.eat = function eat (type) {
|
|
35697
|
+
if (this.tok.type === type) {
|
|
35698
|
+
this.next();
|
|
35699
|
+
return true
|
|
35700
|
+
} else {
|
|
35701
|
+
return false
|
|
35702
|
+
}
|
|
35703
|
+
};
|
|
35704
|
+
|
|
35705
|
+
LooseParser.prototype.isContextual = function isContextual (name) {
|
|
35706
|
+
return this.tok.type === types$1.name && this.tok.value === name
|
|
35707
|
+
};
|
|
35708
|
+
|
|
35709
|
+
LooseParser.prototype.eatContextual = function eatContextual (name) {
|
|
35710
|
+
return this.tok.value === name && this.eat(types$1.name)
|
|
35711
|
+
};
|
|
35712
|
+
|
|
35713
|
+
LooseParser.prototype.canInsertSemicolon = function canInsertSemicolon () {
|
|
35714
|
+
return this.tok.type === types$1.eof || this.tok.type === types$1.braceR ||
|
|
35715
|
+
lineBreak.test(this.input.slice(this.last.end, this.tok.start))
|
|
35716
|
+
};
|
|
35717
|
+
|
|
35718
|
+
LooseParser.prototype.semicolon = function semicolon () {
|
|
35719
|
+
return this.eat(types$1.semi)
|
|
35720
|
+
};
|
|
35721
|
+
|
|
35722
|
+
LooseParser.prototype.expect = function expect (type) {
|
|
35723
|
+
if (this.eat(type)) { return true }
|
|
35724
|
+
for (var i = 1; i <= 2; i++) {
|
|
35725
|
+
if (this.lookAhead(i).type === type) {
|
|
35726
|
+
for (var j = 0; j < i; j++) { this.next(); }
|
|
35727
|
+
return true
|
|
35728
|
+
}
|
|
35729
|
+
}
|
|
35730
|
+
};
|
|
35731
|
+
|
|
35732
|
+
LooseParser.prototype.pushCx = function pushCx () {
|
|
35733
|
+
this.context.push(this.curIndent);
|
|
35734
|
+
};
|
|
35735
|
+
|
|
35736
|
+
LooseParser.prototype.popCx = function popCx () {
|
|
35737
|
+
this.curIndent = this.context.pop();
|
|
35738
|
+
};
|
|
35739
|
+
|
|
35740
|
+
LooseParser.prototype.lineEnd = function lineEnd (pos) {
|
|
35741
|
+
while (pos < this.input.length && !isNewLine(this.input.charCodeAt(pos))) { ++pos; }
|
|
35742
|
+
return pos
|
|
35743
|
+
};
|
|
35744
|
+
|
|
35745
|
+
LooseParser.prototype.indentationAfter = function indentationAfter (pos) {
|
|
35746
|
+
for (var count = 0;; ++pos) {
|
|
35747
|
+
var ch = this.input.charCodeAt(pos);
|
|
35748
|
+
if (ch === 32) { ++count; }
|
|
35749
|
+
else if (ch === 9) { count += this.options.tabSize; }
|
|
35750
|
+
else { return count }
|
|
35751
|
+
}
|
|
35752
|
+
};
|
|
35753
|
+
|
|
35754
|
+
LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) {
|
|
35755
|
+
if (this.tok.type === closeTok || this.tok.type === types$1.eof) { return true }
|
|
35756
|
+
return line !== this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
|
|
35757
|
+
(!blockHeuristic || this.nextLineStart >= this.input.length ||
|
|
35758
|
+
this.indentationAfter(this.nextLineStart) < indent)
|
|
35759
|
+
};
|
|
35760
|
+
|
|
35761
|
+
LooseParser.prototype.tokenStartsLine = function tokenStartsLine () {
|
|
35762
|
+
for (var p = this.tok.start - 1; p >= this.curLineStart; --p) {
|
|
35763
|
+
var ch = this.input.charCodeAt(p);
|
|
35764
|
+
if (ch !== 9 && ch !== 32) { return false }
|
|
35765
|
+
}
|
|
35766
|
+
return true
|
|
35767
|
+
};
|
|
35768
|
+
|
|
35769
|
+
LooseParser.prototype.extend = function extend (name, f) {
|
|
35770
|
+
this[name] = f(this[name]);
|
|
35771
|
+
};
|
|
35772
|
+
|
|
35773
|
+
LooseParser.prototype.parse = function parse () {
|
|
35774
|
+
this.next();
|
|
35775
|
+
return this.parseTopLevel()
|
|
35776
|
+
};
|
|
35777
|
+
|
|
35778
|
+
LooseParser.extend = function extend () {
|
|
35779
|
+
var plugins = [], len = arguments.length;
|
|
35780
|
+
while ( len-- ) plugins[ len ] = arguments[ len ];
|
|
35781
|
+
|
|
35782
|
+
var cls = this;
|
|
35783
|
+
for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }
|
|
35784
|
+
return cls
|
|
35785
|
+
};
|
|
35786
|
+
|
|
35787
|
+
LooseParser.parse = function parse (input, options) {
|
|
35788
|
+
return new this(input, options).parse()
|
|
35789
|
+
};
|
|
35790
|
+
|
|
35791
|
+
// Allows plugins to extend the base parser / tokenizer used
|
|
35792
|
+
LooseParser.BaseParser = Parser;
|
|
35793
|
+
|
|
35794
|
+
var lp$2 = LooseParser.prototype;
|
|
35795
|
+
|
|
35796
|
+
function isSpace(ch) {
|
|
35797
|
+
return (ch < 14 && ch > 8) || ch === 32 || ch === 160 || isNewLine(ch)
|
|
35798
|
+
}
|
|
35799
|
+
|
|
35800
|
+
lp$2.next = function() {
|
|
35801
|
+
this.last = this.tok;
|
|
35802
|
+
if (this.ahead.length)
|
|
35803
|
+
{ this.tok = this.ahead.shift(); }
|
|
35804
|
+
else
|
|
35805
|
+
{ this.tok = this.readToken(); }
|
|
35806
|
+
|
|
35807
|
+
if (this.tok.start >= this.nextLineStart) {
|
|
35808
|
+
while (this.tok.start >= this.nextLineStart) {
|
|
35809
|
+
this.curLineStart = this.nextLineStart;
|
|
35810
|
+
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
|
|
35811
|
+
}
|
|
35812
|
+
this.curIndent = this.indentationAfter(this.curLineStart);
|
|
35813
|
+
}
|
|
35814
|
+
};
|
|
35815
|
+
|
|
35816
|
+
lp$2.readToken = function() {
|
|
35817
|
+
for (;;) {
|
|
35818
|
+
try {
|
|
35819
|
+
this.toks.next();
|
|
35820
|
+
if (this.toks.type === types$1.dot &&
|
|
35821
|
+
this.input.substr(this.toks.end, 1) === "." &&
|
|
35822
|
+
this.options.ecmaVersion >= 6) {
|
|
35823
|
+
this.toks.end++;
|
|
35824
|
+
this.toks.type = types$1.ellipsis;
|
|
35825
|
+
}
|
|
35826
|
+
return new Token(this.toks)
|
|
35827
|
+
} catch (e) {
|
|
35828
|
+
if (!(e instanceof SyntaxError)) { throw e }
|
|
35829
|
+
|
|
35830
|
+
// Try to skip some text, based on the error message, and then continue
|
|
35831
|
+
var msg = e.message, pos = e.raisedAt, replace = true;
|
|
35832
|
+
if (/unterminated/i.test(msg)) {
|
|
35833
|
+
pos = this.lineEnd(e.pos + 1);
|
|
35834
|
+
if (/string/.test(msg)) {
|
|
35835
|
+
replace = {start: e.pos, end: pos, type: types$1.string, value: this.input.slice(e.pos + 1, pos)};
|
|
35836
|
+
} else if (/regular expr/i.test(msg)) {
|
|
35837
|
+
var re = this.input.slice(e.pos, pos);
|
|
35838
|
+
try { re = new RegExp(re); } catch (e$1) { /* ignore compilation error due to new syntax */ }
|
|
35839
|
+
replace = {start: e.pos, end: pos, type: types$1.regexp, value: re};
|
|
35840
|
+
} else if (/template/.test(msg)) {
|
|
35841
|
+
replace = {
|
|
35842
|
+
start: e.pos,
|
|
35843
|
+
end: pos,
|
|
35844
|
+
type: types$1.template,
|
|
35845
|
+
value: this.input.slice(e.pos, pos)
|
|
35846
|
+
};
|
|
35847
|
+
} else {
|
|
35848
|
+
replace = false;
|
|
35849
|
+
}
|
|
35850
|
+
} else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix|numeric separator/i.test(msg)) {
|
|
35851
|
+
while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) { ++pos; }
|
|
35852
|
+
} else if (/character escape|expected hexadecimal/i.test(msg)) {
|
|
35853
|
+
while (pos < this.input.length) {
|
|
35854
|
+
var ch = this.input.charCodeAt(pos++);
|
|
35855
|
+
if (ch === 34 || ch === 39 || isNewLine(ch)) { break }
|
|
35856
|
+
}
|
|
35857
|
+
} else if (/unexpected character/i.test(msg)) {
|
|
35858
|
+
pos++;
|
|
35859
|
+
replace = false;
|
|
35860
|
+
} else if (/regular expression/i.test(msg)) {
|
|
35861
|
+
replace = true;
|
|
35862
|
+
} else {
|
|
35863
|
+
throw e
|
|
35864
|
+
}
|
|
35865
|
+
this.resetTo(pos);
|
|
35866
|
+
if (replace === true) { replace = {start: pos, end: pos, type: types$1.name, value: dummyValue}; }
|
|
35867
|
+
if (replace) {
|
|
35868
|
+
if (this.options.locations)
|
|
35869
|
+
{ replace.loc = new SourceLocation(
|
|
35870
|
+
this.toks,
|
|
35871
|
+
getLineInfo(this.input, replace.start),
|
|
35872
|
+
getLineInfo(this.input, replace.end)); }
|
|
35873
|
+
return replace
|
|
35874
|
+
}
|
|
35875
|
+
}
|
|
35876
|
+
}
|
|
35877
|
+
};
|
|
35878
|
+
|
|
35879
|
+
lp$2.resetTo = function(pos) {
|
|
35880
|
+
this.toks.pos = pos;
|
|
35881
|
+
this.toks.containsEsc = false;
|
|
35882
|
+
var ch = this.input.charAt(pos - 1);
|
|
35883
|
+
this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) ||
|
|
35884
|
+
/[enwfd]/.test(ch) &&
|
|
35885
|
+
/\b(case|else|return|throw|new|in|(instance|type)?of|delete|void)$/.test(this.input.slice(pos - 10, pos));
|
|
35886
|
+
|
|
35887
|
+
if (this.options.locations) {
|
|
35888
|
+
this.toks.curLine = 1;
|
|
35889
|
+
this.toks.lineStart = lineBreakG.lastIndex = 0;
|
|
35890
|
+
var match;
|
|
35891
|
+
while ((match = lineBreakG.exec(this.input)) && match.index < pos) {
|
|
35892
|
+
++this.toks.curLine;
|
|
35893
|
+
this.toks.lineStart = match.index + match[0].length;
|
|
35894
|
+
}
|
|
35895
|
+
}
|
|
35896
|
+
};
|
|
35897
|
+
|
|
35898
|
+
lp$2.lookAhead = function(n) {
|
|
35899
|
+
while (n > this.ahead.length)
|
|
35900
|
+
{ this.ahead.push(this.readToken()); }
|
|
35901
|
+
return this.ahead[n - 1]
|
|
35902
|
+
};
|
|
35903
|
+
|
|
35904
|
+
var lp$1 = LooseParser.prototype;
|
|
35905
|
+
|
|
35906
|
+
lp$1.parseTopLevel = function() {
|
|
35907
|
+
var node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0);
|
|
35908
|
+
node.body = [];
|
|
35909
|
+
while (this.tok.type !== types$1.eof) { node.body.push(this.parseStatement()); }
|
|
35910
|
+
this.toks.adaptDirectivePrologue(node.body);
|
|
35911
|
+
this.last = this.tok;
|
|
35912
|
+
node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
|
|
35913
|
+
return this.finishNode(node, "Program")
|
|
35914
|
+
};
|
|
35915
|
+
|
|
35916
|
+
lp$1.parseStatement = function() {
|
|
35917
|
+
var starttype = this.tok.type, node = this.startNode(), kind;
|
|
35918
|
+
|
|
35919
|
+
if (this.toks.isLet()) {
|
|
35920
|
+
starttype = types$1._var;
|
|
35921
|
+
kind = "let";
|
|
35922
|
+
}
|
|
35923
|
+
|
|
35924
|
+
switch (starttype) {
|
|
35925
|
+
case types$1._break: case types$1._continue:
|
|
35926
|
+
this.next();
|
|
35927
|
+
var isBreak = starttype === types$1._break;
|
|
35928
|
+
if (this.semicolon() || this.canInsertSemicolon()) {
|
|
35929
|
+
node.label = null;
|
|
35930
|
+
} else {
|
|
35931
|
+
node.label = this.tok.type === types$1.name ? this.parseIdent() : null;
|
|
35932
|
+
this.semicolon();
|
|
35933
|
+
}
|
|
35934
|
+
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
35935
|
+
|
|
35936
|
+
case types$1._debugger:
|
|
35937
|
+
this.next();
|
|
35938
|
+
this.semicolon();
|
|
35939
|
+
return this.finishNode(node, "DebuggerStatement")
|
|
35940
|
+
|
|
35941
|
+
case types$1._do:
|
|
35942
|
+
this.next();
|
|
35943
|
+
node.body = this.parseStatement();
|
|
35944
|
+
node.test = this.eat(types$1._while) ? this.parseParenExpression() : this.dummyIdent();
|
|
35945
|
+
this.semicolon();
|
|
35946
|
+
return this.finishNode(node, "DoWhileStatement")
|
|
35947
|
+
|
|
35948
|
+
case types$1._for:
|
|
35949
|
+
this.next(); // `for` keyword
|
|
35950
|
+
var isAwait = this.options.ecmaVersion >= 9 && this.eatContextual("await");
|
|
35951
|
+
|
|
35952
|
+
this.pushCx();
|
|
35953
|
+
this.expect(types$1.parenL);
|
|
35954
|
+
if (this.tok.type === types$1.semi) { return this.parseFor(node, null) }
|
|
35955
|
+
var isLet = this.toks.isLet();
|
|
35956
|
+
var isAwaitUsing = this.toks.isAwaitUsing(true);
|
|
35957
|
+
var isUsing = !isAwaitUsing && this.toks.isUsing(true);
|
|
35958
|
+
|
|
35959
|
+
if (isLet || this.tok.type === types$1._var || this.tok.type === types$1._const || isUsing || isAwaitUsing) {
|
|
35960
|
+
var kind$1 = isLet ? "let" : isUsing ? "using" : isAwaitUsing ? "await using" : this.tok.value;
|
|
35961
|
+
var init$1 = this.startNode();
|
|
35962
|
+
if (isUsing || isAwaitUsing) {
|
|
35963
|
+
if (isAwaitUsing) { this.next(); }
|
|
35964
|
+
this.parseVar(init$1, true, kind$1);
|
|
35965
|
+
} else {
|
|
35966
|
+
init$1 = this.parseVar(init$1, true, kind$1);
|
|
35967
|
+
}
|
|
35968
|
+
|
|
35969
|
+
if (init$1.declarations.length === 1 && (this.tok.type === types$1._in || this.isContextual("of"))) {
|
|
35970
|
+
if (this.options.ecmaVersion >= 9 && this.tok.type !== types$1._in) {
|
|
35971
|
+
node.await = isAwait;
|
|
35972
|
+
}
|
|
35973
|
+
return this.parseForIn(node, init$1)
|
|
35974
|
+
}
|
|
35975
|
+
return this.parseFor(node, init$1)
|
|
35976
|
+
}
|
|
35977
|
+
var init = this.parseExpression(true);
|
|
35978
|
+
if (this.tok.type === types$1._in || this.isContextual("of")) {
|
|
35979
|
+
if (this.options.ecmaVersion >= 9 && this.tok.type !== types$1._in) {
|
|
35980
|
+
node.await = isAwait;
|
|
35981
|
+
}
|
|
35982
|
+
return this.parseForIn(node, this.toAssignable(init))
|
|
35983
|
+
}
|
|
35984
|
+
return this.parseFor(node, init)
|
|
35985
|
+
|
|
35986
|
+
case types$1._function:
|
|
35987
|
+
this.next();
|
|
35988
|
+
return this.parseFunction(node, true)
|
|
35989
|
+
|
|
35990
|
+
case types$1._if:
|
|
35991
|
+
this.next();
|
|
35992
|
+
node.test = this.parseParenExpression();
|
|
35993
|
+
node.consequent = this.parseStatement();
|
|
35994
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement() : null;
|
|
35995
|
+
return this.finishNode(node, "IfStatement")
|
|
35996
|
+
|
|
35997
|
+
case types$1._return:
|
|
35998
|
+
this.next();
|
|
35999
|
+
if (this.eat(types$1.semi) || this.canInsertSemicolon()) { node.argument = null; }
|
|
36000
|
+
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
36001
|
+
return this.finishNode(node, "ReturnStatement")
|
|
36002
|
+
|
|
36003
|
+
case types$1._switch:
|
|
36004
|
+
var blockIndent = this.curIndent, line = this.curLineStart;
|
|
36005
|
+
this.next();
|
|
36006
|
+
node.discriminant = this.parseParenExpression();
|
|
36007
|
+
node.cases = [];
|
|
36008
|
+
this.pushCx();
|
|
36009
|
+
this.expect(types$1.braceL);
|
|
36010
|
+
|
|
36011
|
+
var cur;
|
|
36012
|
+
while (!this.closes(types$1.braceR, blockIndent, line, true)) {
|
|
36013
|
+
if (this.tok.type === types$1._case || this.tok.type === types$1._default) {
|
|
36014
|
+
var isCase = this.tok.type === types$1._case;
|
|
36015
|
+
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
36016
|
+
node.cases.push(cur = this.startNode());
|
|
36017
|
+
cur.consequent = [];
|
|
36018
|
+
this.next();
|
|
36019
|
+
if (isCase) { cur.test = this.parseExpression(); }
|
|
36020
|
+
else { cur.test = null; }
|
|
36021
|
+
this.expect(types$1.colon);
|
|
36022
|
+
} else {
|
|
36023
|
+
if (!cur) {
|
|
36024
|
+
node.cases.push(cur = this.startNode());
|
|
36025
|
+
cur.consequent = [];
|
|
36026
|
+
cur.test = null;
|
|
36027
|
+
}
|
|
36028
|
+
cur.consequent.push(this.parseStatement());
|
|
36029
|
+
}
|
|
36030
|
+
}
|
|
36031
|
+
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
36032
|
+
this.popCx();
|
|
36033
|
+
this.eat(types$1.braceR);
|
|
36034
|
+
return this.finishNode(node, "SwitchStatement")
|
|
36035
|
+
|
|
36036
|
+
case types$1._throw:
|
|
36037
|
+
this.next();
|
|
36038
|
+
node.argument = this.parseExpression();
|
|
36039
|
+
this.semicolon();
|
|
36040
|
+
return this.finishNode(node, "ThrowStatement")
|
|
36041
|
+
|
|
36042
|
+
case types$1._try:
|
|
36043
|
+
this.next();
|
|
36044
|
+
node.block = this.parseBlock();
|
|
36045
|
+
node.handler = null;
|
|
36046
|
+
if (this.tok.type === types$1._catch) {
|
|
36047
|
+
var clause = this.startNode();
|
|
36048
|
+
this.next();
|
|
36049
|
+
if (this.eat(types$1.parenL)) {
|
|
36050
|
+
clause.param = this.toAssignable(this.parseExprAtom(), true);
|
|
36051
|
+
this.expect(types$1.parenR);
|
|
36052
|
+
} else {
|
|
36053
|
+
clause.param = null;
|
|
36054
|
+
}
|
|
36055
|
+
clause.body = this.parseBlock();
|
|
36056
|
+
node.handler = this.finishNode(clause, "CatchClause");
|
|
36057
|
+
}
|
|
36058
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
36059
|
+
if (!node.handler && !node.finalizer) { return node.block }
|
|
36060
|
+
return this.finishNode(node, "TryStatement")
|
|
36061
|
+
|
|
36062
|
+
case types$1._var:
|
|
36063
|
+
case types$1._const:
|
|
36064
|
+
return this.parseVar(node, false, kind || this.tok.value)
|
|
36065
|
+
|
|
36066
|
+
case types$1._while:
|
|
36067
|
+
this.next();
|
|
36068
|
+
node.test = this.parseParenExpression();
|
|
36069
|
+
node.body = this.parseStatement();
|
|
36070
|
+
return this.finishNode(node, "WhileStatement")
|
|
36071
|
+
|
|
36072
|
+
case types$1._with:
|
|
36073
|
+
this.next();
|
|
36074
|
+
node.object = this.parseParenExpression();
|
|
36075
|
+
node.body = this.parseStatement();
|
|
36076
|
+
return this.finishNode(node, "WithStatement")
|
|
36077
|
+
|
|
36078
|
+
case types$1.braceL:
|
|
36079
|
+
return this.parseBlock()
|
|
36080
|
+
|
|
36081
|
+
case types$1.semi:
|
|
36082
|
+
this.next();
|
|
36083
|
+
return this.finishNode(node, "EmptyStatement")
|
|
36084
|
+
|
|
36085
|
+
case types$1._class:
|
|
36086
|
+
return this.parseClass(true)
|
|
36087
|
+
|
|
36088
|
+
case types$1._import:
|
|
36089
|
+
if (this.options.ecmaVersion > 10) {
|
|
36090
|
+
var nextType = this.lookAhead(1).type;
|
|
36091
|
+
if (nextType === types$1.parenL || nextType === types$1.dot) {
|
|
36092
|
+
node.expression = this.parseExpression();
|
|
36093
|
+
this.semicolon();
|
|
36094
|
+
return this.finishNode(node, "ExpressionStatement")
|
|
36095
|
+
}
|
|
36096
|
+
}
|
|
36097
|
+
|
|
36098
|
+
return this.parseImport()
|
|
36099
|
+
|
|
36100
|
+
case types$1._export:
|
|
36101
|
+
return this.parseExport()
|
|
36102
|
+
|
|
36103
|
+
default:
|
|
36104
|
+
if (this.toks.isAsyncFunction()) {
|
|
36105
|
+
this.next();
|
|
36106
|
+
this.next();
|
|
36107
|
+
return this.parseFunction(node, true, true)
|
|
36108
|
+
}
|
|
36109
|
+
|
|
36110
|
+
if (this.toks.isUsing(false)) {
|
|
36111
|
+
return this.parseVar(node, false, "using")
|
|
36112
|
+
}
|
|
36113
|
+
|
|
36114
|
+
if (this.toks.isAwaitUsing(false)) {
|
|
36115
|
+
this.next();
|
|
36116
|
+
return this.parseVar(node, false, "await using")
|
|
36117
|
+
}
|
|
36118
|
+
|
|
36119
|
+
var expr = this.parseExpression();
|
|
36120
|
+
if (isDummy(expr)) {
|
|
36121
|
+
this.next();
|
|
36122
|
+
if (this.tok.type === types$1.eof) { return this.finishNode(node, "EmptyStatement") }
|
|
36123
|
+
return this.parseStatement()
|
|
36124
|
+
} else if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
|
|
36125
|
+
node.body = this.parseStatement();
|
|
36126
|
+
node.label = expr;
|
|
36127
|
+
return this.finishNode(node, "LabeledStatement")
|
|
36128
|
+
} else {
|
|
36129
|
+
node.expression = expr;
|
|
36130
|
+
this.semicolon();
|
|
36131
|
+
return this.finishNode(node, "ExpressionStatement")
|
|
36132
|
+
}
|
|
36133
|
+
}
|
|
36134
|
+
};
|
|
36135
|
+
|
|
36136
|
+
lp$1.parseBlock = function() {
|
|
36137
|
+
var node = this.startNode();
|
|
36138
|
+
this.pushCx();
|
|
36139
|
+
this.expect(types$1.braceL);
|
|
36140
|
+
var blockIndent = this.curIndent, line = this.curLineStart;
|
|
36141
|
+
node.body = [];
|
|
36142
|
+
while (!this.closes(types$1.braceR, blockIndent, line, true))
|
|
36143
|
+
{ node.body.push(this.parseStatement()); }
|
|
36144
|
+
this.popCx();
|
|
36145
|
+
this.eat(types$1.braceR);
|
|
36146
|
+
return this.finishNode(node, "BlockStatement")
|
|
36147
|
+
};
|
|
36148
|
+
|
|
36149
|
+
lp$1.parseFor = function(node, init) {
|
|
36150
|
+
node.init = init;
|
|
36151
|
+
node.test = node.update = null;
|
|
36152
|
+
if (this.eat(types$1.semi) && this.tok.type !== types$1.semi) { node.test = this.parseExpression(); }
|
|
36153
|
+
if (this.eat(types$1.semi) && this.tok.type !== types$1.parenR) { node.update = this.parseExpression(); }
|
|
36154
|
+
this.popCx();
|
|
36155
|
+
this.expect(types$1.parenR);
|
|
36156
|
+
node.body = this.parseStatement();
|
|
36157
|
+
return this.finishNode(node, "ForStatement")
|
|
36158
|
+
};
|
|
36159
|
+
|
|
36160
|
+
lp$1.parseForIn = function(node, init) {
|
|
36161
|
+
var type = this.tok.type === types$1._in ? "ForInStatement" : "ForOfStatement";
|
|
36162
|
+
this.next();
|
|
36163
|
+
node.left = init;
|
|
36164
|
+
node.right = this.parseExpression();
|
|
36165
|
+
this.popCx();
|
|
36166
|
+
this.expect(types$1.parenR);
|
|
36167
|
+
node.body = this.parseStatement();
|
|
36168
|
+
return this.finishNode(node, type)
|
|
36169
|
+
};
|
|
36170
|
+
|
|
36171
|
+
lp$1.parseVar = function(node, noIn, kind) {
|
|
36172
|
+
node.kind = kind;
|
|
36173
|
+
this.next();
|
|
36174
|
+
node.declarations = [];
|
|
36175
|
+
do {
|
|
36176
|
+
var decl = this.startNode();
|
|
36177
|
+
decl.id = this.options.ecmaVersion >= 6 ? this.toAssignable(this.parseExprAtom(), true) : this.parseIdent();
|
|
36178
|
+
decl.init = this.eat(types$1.eq) ? this.parseMaybeAssign(noIn) : null;
|
|
36179
|
+
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
36180
|
+
} while (this.eat(types$1.comma))
|
|
36181
|
+
if (!node.declarations.length) {
|
|
36182
|
+
var decl$1 = this.startNode();
|
|
36183
|
+
decl$1.id = this.dummyIdent();
|
|
36184
|
+
node.declarations.push(this.finishNode(decl$1, "VariableDeclarator"));
|
|
36185
|
+
}
|
|
36186
|
+
if (!noIn) { this.semicolon(); }
|
|
36187
|
+
return this.finishNode(node, "VariableDeclaration")
|
|
36188
|
+
};
|
|
36189
|
+
|
|
36190
|
+
lp$1.parseClass = function(isStatement) {
|
|
36191
|
+
var node = this.startNode();
|
|
36192
|
+
this.next();
|
|
36193
|
+
if (this.tok.type === types$1.name) { node.id = this.parseIdent(); }
|
|
36194
|
+
else if (isStatement === true) { node.id = this.dummyIdent(); }
|
|
36195
|
+
else { node.id = null; }
|
|
36196
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExpression() : null;
|
|
36197
|
+
node.body = this.startNode();
|
|
36198
|
+
node.body.body = [];
|
|
36199
|
+
this.pushCx();
|
|
36200
|
+
var indent = this.curIndent + 1, line = this.curLineStart;
|
|
36201
|
+
this.eat(types$1.braceL);
|
|
36202
|
+
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; }
|
|
36203
|
+
while (!this.closes(types$1.braceR, indent, line)) {
|
|
36204
|
+
var element = this.parseClassElement();
|
|
36205
|
+
if (element) { node.body.body.push(element); }
|
|
36206
|
+
}
|
|
36207
|
+
this.popCx();
|
|
36208
|
+
if (!this.eat(types$1.braceR)) {
|
|
36209
|
+
// If there is no closing brace, make the node span to the start
|
|
36210
|
+
// of the next token (this is useful for Tern)
|
|
36211
|
+
this.last.end = this.tok.start;
|
|
36212
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
|
36213
|
+
}
|
|
36214
|
+
this.semicolon();
|
|
36215
|
+
this.finishNode(node.body, "ClassBody");
|
|
36216
|
+
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
36217
|
+
};
|
|
36218
|
+
|
|
36219
|
+
lp$1.parseClassElement = function() {
|
|
36220
|
+
if (this.eat(types$1.semi)) { return null }
|
|
36221
|
+
|
|
36222
|
+
var ref = this.options;
|
|
36223
|
+
var ecmaVersion = ref.ecmaVersion;
|
|
36224
|
+
var locations = ref.locations;
|
|
36225
|
+
var indent = this.curIndent;
|
|
36226
|
+
var line = this.curLineStart;
|
|
36227
|
+
var node = this.startNode();
|
|
36228
|
+
var keyName = "";
|
|
36229
|
+
var isGenerator = false;
|
|
36230
|
+
var isAsync = false;
|
|
36231
|
+
var kind = "method";
|
|
36232
|
+
var isStatic = false;
|
|
36233
|
+
|
|
36234
|
+
if (this.eatContextual("static")) {
|
|
36235
|
+
// Parse static init block
|
|
36236
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
36237
|
+
this.parseClassStaticBlock(node);
|
|
36238
|
+
return node
|
|
36239
|
+
}
|
|
36240
|
+
if (this.isClassElementNameStart() || this.toks.type === types$1.star) {
|
|
36241
|
+
isStatic = true;
|
|
36242
|
+
} else {
|
|
36243
|
+
keyName = "static";
|
|
36244
|
+
}
|
|
36245
|
+
}
|
|
36246
|
+
node.static = isStatic;
|
|
36247
|
+
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
36248
|
+
if ((this.isClassElementNameStart() || this.toks.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
36249
|
+
isAsync = true;
|
|
36250
|
+
} else {
|
|
36251
|
+
keyName = "async";
|
|
36252
|
+
}
|
|
36253
|
+
}
|
|
36254
|
+
if (!keyName) {
|
|
36255
|
+
isGenerator = this.eat(types$1.star);
|
|
36256
|
+
var lastValue = this.toks.value;
|
|
36257
|
+
if (this.eatContextual("get") || this.eatContextual("set")) {
|
|
36258
|
+
if (this.isClassElementNameStart()) {
|
|
36259
|
+
kind = lastValue;
|
|
36260
|
+
} else {
|
|
36261
|
+
keyName = lastValue;
|
|
36262
|
+
}
|
|
36263
|
+
}
|
|
36264
|
+
}
|
|
36265
|
+
|
|
36266
|
+
// Parse element name
|
|
36267
|
+
if (keyName) {
|
|
36268
|
+
// 'async', 'get', 'set', or 'static' were not a keyword contextually.
|
|
36269
|
+
// The last token is any of those. Make it the element name.
|
|
36270
|
+
node.computed = false;
|
|
36271
|
+
node.key = this.startNodeAt(locations ? [this.toks.lastTokStart, this.toks.lastTokStartLoc] : this.toks.lastTokStart);
|
|
36272
|
+
node.key.name = keyName;
|
|
36273
|
+
this.finishNode(node.key, "Identifier");
|
|
36274
|
+
} else {
|
|
36275
|
+
this.parseClassElementName(node);
|
|
36276
|
+
|
|
36277
|
+
// From https://github.com/acornjs/acorn/blob/7deba41118d6384a2c498c61176b3cf434f69590/acorn-loose/src/statement.js#L291
|
|
36278
|
+
// Skip broken stuff.
|
|
36279
|
+
if (isDummy(node.key)) {
|
|
36280
|
+
if (isDummy(this.parseMaybeAssign())) { this.next(); }
|
|
36281
|
+
this.eat(types$1.comma);
|
|
36282
|
+
return null
|
|
36283
|
+
}
|
|
36284
|
+
}
|
|
36285
|
+
|
|
36286
|
+
// Parse element value
|
|
36287
|
+
if (ecmaVersion < 13 || this.toks.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
36288
|
+
// Method
|
|
36289
|
+
var isConstructor =
|
|
36290
|
+
!node.computed &&
|
|
36291
|
+
!node.static &&
|
|
36292
|
+
!isGenerator &&
|
|
36293
|
+
!isAsync &&
|
|
36294
|
+
kind === "method" && (
|
|
36295
|
+
node.key.type === "Identifier" && node.key.name === "constructor" ||
|
|
36296
|
+
node.key.type === "Literal" && node.key.value === "constructor"
|
|
36297
|
+
);
|
|
36298
|
+
node.kind = isConstructor ? "constructor" : kind;
|
|
36299
|
+
node.value = this.parseMethod(isGenerator, isAsync);
|
|
36300
|
+
this.finishNode(node, "MethodDefinition");
|
|
36301
|
+
} else {
|
|
36302
|
+
// Field
|
|
36303
|
+
if (this.eat(types$1.eq)) {
|
|
36304
|
+
if (this.curLineStart !== line && this.curIndent <= indent && this.tokenStartsLine()) {
|
|
36305
|
+
// Estimated the next line is the next class element by indentations.
|
|
36306
|
+
node.value = null;
|
|
36307
|
+
} else {
|
|
36308
|
+
var oldInAsync = this.inAsync;
|
|
36309
|
+
var oldInGenerator = this.inGenerator;
|
|
36310
|
+
this.inAsync = false;
|
|
36311
|
+
this.inGenerator = false;
|
|
36312
|
+
node.value = this.parseMaybeAssign();
|
|
36313
|
+
this.inAsync = oldInAsync;
|
|
36314
|
+
this.inGenerator = oldInGenerator;
|
|
36315
|
+
}
|
|
36316
|
+
} else {
|
|
36317
|
+
node.value = null;
|
|
36318
|
+
}
|
|
36319
|
+
this.semicolon();
|
|
36320
|
+
this.finishNode(node, "PropertyDefinition");
|
|
36321
|
+
}
|
|
36322
|
+
|
|
36323
|
+
return node
|
|
36324
|
+
};
|
|
36325
|
+
|
|
36326
|
+
lp$1.parseClassStaticBlock = function(node) {
|
|
36327
|
+
var blockIndent = this.curIndent, line = this.curLineStart;
|
|
36328
|
+
node.body = [];
|
|
36329
|
+
this.pushCx();
|
|
36330
|
+
while (!this.closes(types$1.braceR, blockIndent, line, true))
|
|
36331
|
+
{ node.body.push(this.parseStatement()); }
|
|
36332
|
+
this.popCx();
|
|
36333
|
+
this.eat(types$1.braceR);
|
|
36334
|
+
|
|
36335
|
+
return this.finishNode(node, "StaticBlock")
|
|
36336
|
+
};
|
|
36337
|
+
|
|
36338
|
+
lp$1.isClassElementNameStart = function() {
|
|
36339
|
+
return this.toks.isClassElementNameStart()
|
|
36340
|
+
};
|
|
36341
|
+
|
|
36342
|
+
lp$1.parseClassElementName = function(element) {
|
|
36343
|
+
if (this.toks.type === types$1.privateId) {
|
|
36344
|
+
element.computed = false;
|
|
36345
|
+
element.key = this.parsePrivateIdent();
|
|
36346
|
+
} else {
|
|
36347
|
+
this.parsePropertyName(element);
|
|
36348
|
+
}
|
|
36349
|
+
};
|
|
36350
|
+
|
|
36351
|
+
lp$1.parseFunction = function(node, isStatement, isAsync) {
|
|
36352
|
+
var oldInAsync = this.inAsync, oldInGenerator = this.inGenerator, oldInFunction = this.inFunction;
|
|
36353
|
+
this.initFunction(node);
|
|
36354
|
+
if (this.options.ecmaVersion >= 6) {
|
|
36355
|
+
node.generator = this.eat(types$1.star);
|
|
36356
|
+
}
|
|
36357
|
+
if (this.options.ecmaVersion >= 8) {
|
|
36358
|
+
node.async = !!isAsync;
|
|
36359
|
+
}
|
|
36360
|
+
if (this.tok.type === types$1.name) { node.id = this.parseIdent(); }
|
|
36361
|
+
else if (isStatement === true) { node.id = this.dummyIdent(); }
|
|
36362
|
+
this.inAsync = node.async;
|
|
36363
|
+
this.inGenerator = node.generator;
|
|
36364
|
+
this.inFunction = true;
|
|
36365
|
+
node.params = this.parseFunctionParams();
|
|
36366
|
+
node.body = this.parseBlock();
|
|
36367
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
|
36368
|
+
this.inAsync = oldInAsync;
|
|
36369
|
+
this.inGenerator = oldInGenerator;
|
|
36370
|
+
this.inFunction = oldInFunction;
|
|
36371
|
+
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
|
|
36372
|
+
};
|
|
36373
|
+
|
|
36374
|
+
lp$1.parseExport = function() {
|
|
36375
|
+
var node = this.startNode();
|
|
36376
|
+
this.next();
|
|
36377
|
+
if (this.eat(types$1.star)) {
|
|
36378
|
+
if (this.options.ecmaVersion >= 11) {
|
|
36379
|
+
if (this.eatContextual("as")) {
|
|
36380
|
+
node.exported = this.parseExprAtom();
|
|
36381
|
+
} else {
|
|
36382
|
+
node.exported = null;
|
|
36383
|
+
}
|
|
36384
|
+
}
|
|
36385
|
+
node.source = this.eatContextual("from") ? this.parseExprAtom() : this.dummyString();
|
|
36386
|
+
if (this.options.ecmaVersion >= 16)
|
|
36387
|
+
{ node.attributes = this.parseWithClause(); }
|
|
36388
|
+
this.semicolon();
|
|
36389
|
+
return this.finishNode(node, "ExportAllDeclaration")
|
|
36390
|
+
}
|
|
36391
|
+
if (this.eat(types$1._default)) {
|
|
36392
|
+
// export default (function foo() {}) // This is FunctionExpression.
|
|
36393
|
+
var isAsync;
|
|
36394
|
+
if (this.tok.type === types$1._function || (isAsync = this.toks.isAsyncFunction())) {
|
|
36395
|
+
var fNode = this.startNode();
|
|
36396
|
+
this.next();
|
|
36397
|
+
if (isAsync) { this.next(); }
|
|
36398
|
+
node.declaration = this.parseFunction(fNode, "nullableID", isAsync);
|
|
36399
|
+
} else if (this.tok.type === types$1._class) {
|
|
36400
|
+
node.declaration = this.parseClass("nullableID");
|
|
36401
|
+
} else {
|
|
36402
|
+
node.declaration = this.parseMaybeAssign();
|
|
36403
|
+
this.semicolon();
|
|
36404
|
+
}
|
|
36405
|
+
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
36406
|
+
}
|
|
36407
|
+
if (this.tok.type.keyword || this.toks.isLet() || this.toks.isAsyncFunction()) {
|
|
36408
|
+
node.declaration = this.parseStatement();
|
|
36409
|
+
node.specifiers = [];
|
|
36410
|
+
node.source = null;
|
|
36411
|
+
} else {
|
|
36412
|
+
node.declaration = null;
|
|
36413
|
+
node.specifiers = this.parseExportSpecifierList();
|
|
36414
|
+
node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
|
|
36415
|
+
if (this.options.ecmaVersion >= 16)
|
|
36416
|
+
{ node.attributes = this.parseWithClause(); }
|
|
36417
|
+
this.semicolon();
|
|
36418
|
+
}
|
|
36419
|
+
return this.finishNode(node, "ExportNamedDeclaration")
|
|
36420
|
+
};
|
|
36421
|
+
|
|
36422
|
+
lp$1.parseImport = function() {
|
|
36423
|
+
var node = this.startNode();
|
|
36424
|
+
this.next();
|
|
36425
|
+
if (this.tok.type === types$1.string) {
|
|
36426
|
+
node.specifiers = [];
|
|
36427
|
+
node.source = this.parseExprAtom();
|
|
36428
|
+
} else {
|
|
36429
|
+
var elt;
|
|
36430
|
+
if (this.tok.type === types$1.name && this.tok.value !== "from") {
|
|
36431
|
+
elt = this.startNode();
|
|
36432
|
+
elt.local = this.parseIdent();
|
|
36433
|
+
this.finishNode(elt, "ImportDefaultSpecifier");
|
|
36434
|
+
this.eat(types$1.comma);
|
|
36435
|
+
}
|
|
36436
|
+
node.specifiers = this.parseImportSpecifiers();
|
|
36437
|
+
node.source = this.eatContextual("from") && this.tok.type === types$1.string ? this.parseExprAtom() : this.dummyString();
|
|
36438
|
+
if (elt) { node.specifiers.unshift(elt); }
|
|
36439
|
+
}
|
|
36440
|
+
if (this.options.ecmaVersion >= 16)
|
|
36441
|
+
{ node.attributes = this.parseWithClause(); }
|
|
36442
|
+
this.semicolon();
|
|
36443
|
+
return this.finishNode(node, "ImportDeclaration")
|
|
36444
|
+
};
|
|
36445
|
+
|
|
36446
|
+
lp$1.parseImportSpecifiers = function() {
|
|
36447
|
+
var elts = [];
|
|
36448
|
+
if (this.tok.type === types$1.star) {
|
|
36449
|
+
var elt = this.startNode();
|
|
36450
|
+
this.next();
|
|
36451
|
+
elt.local = this.eatContextual("as") ? this.parseIdent() : this.dummyIdent();
|
|
36452
|
+
elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"));
|
|
36453
|
+
} else {
|
|
36454
|
+
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart;
|
|
36455
|
+
this.pushCx();
|
|
36456
|
+
this.eat(types$1.braceL);
|
|
36457
|
+
if (this.curLineStart > continuedLine) { continuedLine = this.curLineStart; }
|
|
36458
|
+
while (!this.closes(types$1.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
|
36459
|
+
var elt$1 = this.startNode();
|
|
36460
|
+
if (this.eat(types$1.star)) {
|
|
36461
|
+
elt$1.local = this.eatContextual("as") ? this.parseModuleExportName() : this.dummyIdent();
|
|
36462
|
+
this.finishNode(elt$1, "ImportNamespaceSpecifier");
|
|
36463
|
+
} else {
|
|
36464
|
+
if (this.isContextual("from")) { break }
|
|
36465
|
+
elt$1.imported = this.parseModuleExportName();
|
|
36466
|
+
if (isDummy(elt$1.imported)) { break }
|
|
36467
|
+
elt$1.local = this.eatContextual("as") ? this.parseModuleExportName() : elt$1.imported;
|
|
36468
|
+
this.finishNode(elt$1, "ImportSpecifier");
|
|
36469
|
+
}
|
|
36470
|
+
elts.push(elt$1);
|
|
36471
|
+
this.eat(types$1.comma);
|
|
36472
|
+
}
|
|
36473
|
+
this.eat(types$1.braceR);
|
|
36474
|
+
this.popCx();
|
|
36475
|
+
}
|
|
36476
|
+
return elts
|
|
36477
|
+
};
|
|
36478
|
+
|
|
36479
|
+
lp$1.parseWithClause = function() {
|
|
36480
|
+
var nodes = [];
|
|
36481
|
+
if (!this.eat(types$1._with)) {
|
|
36482
|
+
return nodes
|
|
36483
|
+
}
|
|
36484
|
+
|
|
36485
|
+
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart;
|
|
36486
|
+
this.pushCx();
|
|
36487
|
+
this.eat(types$1.braceL);
|
|
36488
|
+
if (this.curLineStart > continuedLine) { continuedLine = this.curLineStart; }
|
|
36489
|
+
while (!this.closes(types$1.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
|
36490
|
+
var attr = this.startNode();
|
|
36491
|
+
attr.key = this.tok.type === types$1.string ? this.parseExprAtom() : this.parseIdent();
|
|
36492
|
+
if (this.eat(types$1.colon)) {
|
|
36493
|
+
if (this.tok.type === types$1.string)
|
|
36494
|
+
{ attr.value = this.parseExprAtom(); }
|
|
36495
|
+
else { attr.value = this.dummyString(); }
|
|
36496
|
+
} else {
|
|
36497
|
+
if (isDummy(attr.key)) { break }
|
|
36498
|
+
if (this.tok.type === types$1.string)
|
|
36499
|
+
{ attr.value = this.parseExprAtom(); }
|
|
36500
|
+
else { break }
|
|
36501
|
+
}
|
|
36502
|
+
nodes.push(this.finishNode(attr, "ImportAttribute"));
|
|
36503
|
+
this.eat(types$1.comma);
|
|
36504
|
+
}
|
|
36505
|
+
this.eat(types$1.braceR);
|
|
36506
|
+
this.popCx();
|
|
36507
|
+
return nodes
|
|
36508
|
+
};
|
|
36509
|
+
|
|
36510
|
+
lp$1.parseExportSpecifierList = function() {
|
|
36511
|
+
var elts = [];
|
|
36512
|
+
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart;
|
|
36513
|
+
this.pushCx();
|
|
36514
|
+
this.eat(types$1.braceL);
|
|
36515
|
+
if (this.curLineStart > continuedLine) { continuedLine = this.curLineStart; }
|
|
36516
|
+
while (!this.closes(types$1.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
|
36517
|
+
if (this.isContextual("from")) { break }
|
|
36518
|
+
var elt = this.startNode();
|
|
36519
|
+
elt.local = this.parseModuleExportName();
|
|
36520
|
+
if (isDummy(elt.local)) { break }
|
|
36521
|
+
elt.exported = this.eatContextual("as") ? this.parseModuleExportName() : elt.local;
|
|
36522
|
+
this.finishNode(elt, "ExportSpecifier");
|
|
36523
|
+
elts.push(elt);
|
|
36524
|
+
this.eat(types$1.comma);
|
|
36525
|
+
}
|
|
36526
|
+
this.eat(types$1.braceR);
|
|
36527
|
+
this.popCx();
|
|
36528
|
+
return elts
|
|
36529
|
+
};
|
|
36530
|
+
|
|
36531
|
+
lp$1.parseModuleExportName = function() {
|
|
36532
|
+
return this.options.ecmaVersion >= 13 && this.tok.type === types$1.string
|
|
36533
|
+
? this.parseExprAtom()
|
|
36534
|
+
: this.parseIdent()
|
|
36535
|
+
};
|
|
36536
|
+
|
|
36537
|
+
var lp = LooseParser.prototype;
|
|
36538
|
+
|
|
36539
|
+
lp.checkLVal = function(expr) {
|
|
36540
|
+
if (!expr) { return expr }
|
|
36541
|
+
switch (expr.type) {
|
|
36542
|
+
case "Identifier":
|
|
36543
|
+
case "MemberExpression":
|
|
36544
|
+
return expr
|
|
36545
|
+
|
|
36546
|
+
case "ParenthesizedExpression":
|
|
36547
|
+
expr.expression = this.checkLVal(expr.expression);
|
|
36548
|
+
return expr
|
|
36549
|
+
|
|
36550
|
+
default:
|
|
36551
|
+
return this.dummyIdent()
|
|
36552
|
+
}
|
|
36553
|
+
};
|
|
36554
|
+
|
|
36555
|
+
lp.parseExpression = function(noIn) {
|
|
36556
|
+
var start = this.storeCurrentPos();
|
|
36557
|
+
var expr = this.parseMaybeAssign(noIn);
|
|
36558
|
+
if (this.tok.type === types$1.comma) {
|
|
36559
|
+
var node = this.startNodeAt(start);
|
|
36560
|
+
node.expressions = [expr];
|
|
36561
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(noIn)); }
|
|
36562
|
+
return this.finishNode(node, "SequenceExpression")
|
|
36563
|
+
}
|
|
36564
|
+
return expr
|
|
36565
|
+
};
|
|
36566
|
+
|
|
36567
|
+
lp.parseParenExpression = function() {
|
|
36568
|
+
this.pushCx();
|
|
36569
|
+
this.expect(types$1.parenL);
|
|
36570
|
+
var val = this.parseExpression();
|
|
36571
|
+
this.popCx();
|
|
36572
|
+
this.expect(types$1.parenR);
|
|
36573
|
+
return val
|
|
36574
|
+
};
|
|
36575
|
+
|
|
36576
|
+
lp.parseMaybeAssign = function(noIn) {
|
|
36577
|
+
// `yield` should be an identifier reference if it's not in generator functions.
|
|
36578
|
+
if (this.inGenerator && this.toks.isContextual("yield")) {
|
|
36579
|
+
var node = this.startNode();
|
|
36580
|
+
this.next();
|
|
36581
|
+
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type !== types$1.star && !this.tok.type.startsExpr)) {
|
|
36582
|
+
node.delegate = false;
|
|
36583
|
+
node.argument = null;
|
|
36584
|
+
} else {
|
|
36585
|
+
node.delegate = this.eat(types$1.star);
|
|
36586
|
+
node.argument = this.parseMaybeAssign();
|
|
36587
|
+
}
|
|
36588
|
+
return this.finishNode(node, "YieldExpression")
|
|
36589
|
+
}
|
|
36590
|
+
|
|
36591
|
+
var start = this.storeCurrentPos();
|
|
36592
|
+
var left = this.parseMaybeConditional(noIn);
|
|
36593
|
+
if (this.tok.type.isAssign) {
|
|
36594
|
+
var node$1 = this.startNodeAt(start);
|
|
36595
|
+
node$1.operator = this.tok.value;
|
|
36596
|
+
node$1.left = this.tok.type === types$1.eq ? this.toAssignable(left) : this.checkLVal(left);
|
|
36597
|
+
this.next();
|
|
36598
|
+
node$1.right = this.parseMaybeAssign(noIn);
|
|
36599
|
+
return this.finishNode(node$1, "AssignmentExpression")
|
|
36600
|
+
}
|
|
36601
|
+
return left
|
|
36602
|
+
};
|
|
36603
|
+
|
|
36604
|
+
lp.parseMaybeConditional = function(noIn) {
|
|
36605
|
+
var start = this.storeCurrentPos();
|
|
36606
|
+
var expr = this.parseExprOps(noIn);
|
|
36607
|
+
if (this.eat(types$1.question)) {
|
|
36608
|
+
var node = this.startNodeAt(start);
|
|
36609
|
+
node.test = expr;
|
|
36610
|
+
node.consequent = this.parseMaybeAssign();
|
|
36611
|
+
node.alternate = this.expect(types$1.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent();
|
|
36612
|
+
return this.finishNode(node, "ConditionalExpression")
|
|
36613
|
+
}
|
|
36614
|
+
return expr
|
|
36615
|
+
};
|
|
36616
|
+
|
|
36617
|
+
lp.parseExprOps = function(noIn) {
|
|
36618
|
+
var start = this.storeCurrentPos();
|
|
36619
|
+
var indent = this.curIndent, line = this.curLineStart;
|
|
36620
|
+
return this.parseExprOp(this.parseMaybeUnary(false), start, -1, noIn, indent, line)
|
|
36621
|
+
};
|
|
36622
|
+
|
|
36623
|
+
lp.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
|
|
36624
|
+
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) { return left }
|
|
36625
|
+
var prec = this.tok.type.binop;
|
|
36626
|
+
if (prec != null && (!noIn || this.tok.type !== types$1._in)) {
|
|
36627
|
+
if (prec > minPrec) {
|
|
36628
|
+
var node = this.startNodeAt(start);
|
|
36629
|
+
node.left = left;
|
|
36630
|
+
node.operator = this.tok.value;
|
|
36631
|
+
this.next();
|
|
36632
|
+
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) {
|
|
36633
|
+
node.right = this.dummyIdent();
|
|
36634
|
+
} else {
|
|
36635
|
+
var rightStart = this.storeCurrentPos();
|
|
36636
|
+
node.right = this.parseExprOp(this.parseMaybeUnary(false), rightStart, prec, noIn, indent, line);
|
|
36637
|
+
}
|
|
36638
|
+
this.finishNode(node, /&&|\|\||\?\?/.test(node.operator) ? "LogicalExpression" : "BinaryExpression");
|
|
36639
|
+
return this.parseExprOp(node, start, minPrec, noIn, indent, line)
|
|
36640
|
+
}
|
|
36641
|
+
}
|
|
36642
|
+
return left
|
|
36643
|
+
};
|
|
36644
|
+
|
|
36645
|
+
lp.parseMaybeUnary = function(sawUnary) {
|
|
36646
|
+
var start = this.storeCurrentPos(), expr;
|
|
36647
|
+
if (this.options.ecmaVersion >= 8 && this.toks.isContextual("await") &&
|
|
36648
|
+
(this.inAsync || (this.toks.inModule && this.options.ecmaVersion >= 13) ||
|
|
36649
|
+
(!this.inFunction && this.options.allowAwaitOutsideFunction))) {
|
|
36650
|
+
expr = this.parseAwait();
|
|
36651
|
+
sawUnary = true;
|
|
36652
|
+
} else if (this.tok.type.prefix) {
|
|
36653
|
+
var node = this.startNode(), update = this.tok.type === types$1.incDec;
|
|
36654
|
+
if (!update) { sawUnary = true; }
|
|
36655
|
+
node.operator = this.tok.value;
|
|
36656
|
+
node.prefix = true;
|
|
36657
|
+
this.next();
|
|
36658
|
+
node.argument = this.parseMaybeUnary(true);
|
|
36659
|
+
if (update) { node.argument = this.checkLVal(node.argument); }
|
|
36660
|
+
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
36661
|
+
} else if (this.tok.type === types$1.ellipsis) {
|
|
36662
|
+
var node$1 = this.startNode();
|
|
36663
|
+
this.next();
|
|
36664
|
+
node$1.argument = this.parseMaybeUnary(sawUnary);
|
|
36665
|
+
expr = this.finishNode(node$1, "SpreadElement");
|
|
36666
|
+
} else if (!sawUnary && this.tok.type === types$1.privateId) {
|
|
36667
|
+
expr = this.parsePrivateIdent();
|
|
36668
|
+
} else {
|
|
36669
|
+
expr = this.parseExprSubscripts();
|
|
36670
|
+
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
|
|
36671
|
+
var node$2 = this.startNodeAt(start);
|
|
36672
|
+
node$2.operator = this.tok.value;
|
|
36673
|
+
node$2.prefix = false;
|
|
36674
|
+
node$2.argument = this.checkLVal(expr);
|
|
36675
|
+
this.next();
|
|
36676
|
+
expr = this.finishNode(node$2, "UpdateExpression");
|
|
36677
|
+
}
|
|
36678
|
+
}
|
|
36679
|
+
|
|
36680
|
+
if (!sawUnary && this.eat(types$1.starstar)) {
|
|
36681
|
+
var node$3 = this.startNodeAt(start);
|
|
36682
|
+
node$3.operator = "**";
|
|
36683
|
+
node$3.left = expr;
|
|
36684
|
+
node$3.right = this.parseMaybeUnary(false);
|
|
36685
|
+
return this.finishNode(node$3, "BinaryExpression")
|
|
36686
|
+
}
|
|
36687
|
+
|
|
36688
|
+
return expr
|
|
36689
|
+
};
|
|
36690
|
+
|
|
36691
|
+
lp.parseExprSubscripts = function() {
|
|
36692
|
+
var start = this.storeCurrentPos();
|
|
36693
|
+
return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart)
|
|
36694
|
+
};
|
|
36695
|
+
|
|
36696
|
+
lp.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
36697
|
+
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
36698
|
+
var optionalChained = false;
|
|
36699
|
+
for (;;) {
|
|
36700
|
+
if (this.curLineStart !== line && this.curIndent <= startIndent && this.tokenStartsLine()) {
|
|
36701
|
+
if (this.tok.type === types$1.dot && this.curIndent === startIndent)
|
|
36702
|
+
{ --startIndent; }
|
|
36703
|
+
else
|
|
36704
|
+
{ break }
|
|
36705
|
+
}
|
|
36706
|
+
|
|
36707
|
+
var maybeAsyncArrow = base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon();
|
|
36708
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
36709
|
+
if (optional) {
|
|
36710
|
+
optionalChained = true;
|
|
36711
|
+
}
|
|
36712
|
+
|
|
36713
|
+
if ((optional && this.tok.type !== types$1.parenL && this.tok.type !== types$1.bracketL && this.tok.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
36714
|
+
var node = this.startNodeAt(start);
|
|
36715
|
+
node.object = base;
|
|
36716
|
+
if (this.curLineStart !== line && this.curIndent <= startIndent && this.tokenStartsLine())
|
|
36717
|
+
{ node.property = this.dummyIdent(); }
|
|
36718
|
+
else
|
|
36719
|
+
{ node.property = this.parsePropertyAccessor() || this.dummyIdent(); }
|
|
36720
|
+
node.computed = false;
|
|
36721
|
+
if (optionalSupported) {
|
|
36722
|
+
node.optional = optional;
|
|
36723
|
+
}
|
|
36724
|
+
base = this.finishNode(node, "MemberExpression");
|
|
36725
|
+
} else if (this.tok.type === types$1.bracketL) {
|
|
36726
|
+
this.pushCx();
|
|
36727
|
+
this.next();
|
|
36728
|
+
var node$1 = this.startNodeAt(start);
|
|
36729
|
+
node$1.object = base;
|
|
36730
|
+
node$1.property = this.parseExpression();
|
|
36731
|
+
node$1.computed = true;
|
|
36732
|
+
if (optionalSupported) {
|
|
36733
|
+
node$1.optional = optional;
|
|
36734
|
+
}
|
|
36735
|
+
this.popCx();
|
|
36736
|
+
this.expect(types$1.bracketR);
|
|
36737
|
+
base = this.finishNode(node$1, "MemberExpression");
|
|
36738
|
+
} else if (!noCalls && this.tok.type === types$1.parenL) {
|
|
36739
|
+
var exprList = this.parseExprList(types$1.parenR);
|
|
36740
|
+
if (maybeAsyncArrow && this.eat(types$1.arrow))
|
|
36741
|
+
{ return this.parseArrowExpression(this.startNodeAt(start), exprList, true) }
|
|
36742
|
+
var node$2 = this.startNodeAt(start);
|
|
36743
|
+
node$2.callee = base;
|
|
36744
|
+
node$2.arguments = exprList;
|
|
36745
|
+
if (optionalSupported) {
|
|
36746
|
+
node$2.optional = optional;
|
|
36747
|
+
}
|
|
36748
|
+
base = this.finishNode(node$2, "CallExpression");
|
|
36749
|
+
} else if (this.tok.type === types$1.backQuote) {
|
|
36750
|
+
var node$3 = this.startNodeAt(start);
|
|
36751
|
+
node$3.tag = base;
|
|
36752
|
+
node$3.quasi = this.parseTemplate();
|
|
36753
|
+
base = this.finishNode(node$3, "TaggedTemplateExpression");
|
|
36754
|
+
} else {
|
|
36755
|
+
break
|
|
36756
|
+
}
|
|
36757
|
+
}
|
|
36758
|
+
|
|
36759
|
+
if (optionalChained) {
|
|
36760
|
+
var chainNode = this.startNodeAt(start);
|
|
36761
|
+
chainNode.expression = base;
|
|
36762
|
+
base = this.finishNode(chainNode, "ChainExpression");
|
|
36763
|
+
}
|
|
36764
|
+
return base
|
|
36765
|
+
};
|
|
36766
|
+
|
|
36767
|
+
lp.parseExprAtom = function() {
|
|
36768
|
+
var node;
|
|
36769
|
+
switch (this.tok.type) {
|
|
36770
|
+
case types$1._this:
|
|
36771
|
+
case types$1._super:
|
|
36772
|
+
var type = this.tok.type === types$1._this ? "ThisExpression" : "Super";
|
|
36773
|
+
node = this.startNode();
|
|
36774
|
+
this.next();
|
|
36775
|
+
return this.finishNode(node, type)
|
|
36776
|
+
|
|
36777
|
+
case types$1.name:
|
|
36778
|
+
var start = this.storeCurrentPos();
|
|
36779
|
+
var id = this.parseIdent();
|
|
36780
|
+
var isAsync = false;
|
|
36781
|
+
if (id.name === "async" && !this.canInsertSemicolon()) {
|
|
36782
|
+
if (this.eat(types$1._function)) {
|
|
36783
|
+
this.toks.overrideContext(types.f_expr);
|
|
36784
|
+
return this.parseFunction(this.startNodeAt(start), false, true)
|
|
36785
|
+
}
|
|
36786
|
+
if (this.tok.type === types$1.name) {
|
|
36787
|
+
id = this.parseIdent();
|
|
36788
|
+
isAsync = true;
|
|
36789
|
+
}
|
|
36790
|
+
}
|
|
36791
|
+
return this.eat(types$1.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id], isAsync) : id
|
|
36792
|
+
|
|
36793
|
+
case types$1.regexp:
|
|
36794
|
+
node = this.startNode();
|
|
36795
|
+
var val = this.tok.value;
|
|
36796
|
+
node.regex = {pattern: val.pattern, flags: val.flags};
|
|
36797
|
+
node.value = val.value;
|
|
36798
|
+
node.raw = this.input.slice(this.tok.start, this.tok.end);
|
|
36799
|
+
this.next();
|
|
36800
|
+
return this.finishNode(node, "Literal")
|
|
36801
|
+
|
|
36802
|
+
case types$1.num: case types$1.string:
|
|
36803
|
+
node = this.startNode();
|
|
36804
|
+
node.value = this.tok.value;
|
|
36805
|
+
node.raw = this.input.slice(this.tok.start, this.tok.end);
|
|
36806
|
+
if (this.tok.type === types$1.num && node.raw.charCodeAt(node.raw.length - 1) === 110)
|
|
36807
|
+
{ node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, ""); }
|
|
36808
|
+
this.next();
|
|
36809
|
+
return this.finishNode(node, "Literal")
|
|
36810
|
+
|
|
36811
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
36812
|
+
node = this.startNode();
|
|
36813
|
+
node.value = this.tok.type === types$1._null ? null : this.tok.type === types$1._true;
|
|
36814
|
+
node.raw = this.tok.type.keyword;
|
|
36815
|
+
this.next();
|
|
36816
|
+
return this.finishNode(node, "Literal")
|
|
36817
|
+
|
|
36818
|
+
case types$1.parenL:
|
|
36819
|
+
var parenStart = this.storeCurrentPos();
|
|
36820
|
+
this.next();
|
|
36821
|
+
var inner = this.parseExpression();
|
|
36822
|
+
this.expect(types$1.parenR);
|
|
36823
|
+
if (this.eat(types$1.arrow)) {
|
|
36824
|
+
// (a,)=>a // SequenceExpression makes dummy in the last hole. Drop the dummy.
|
|
36825
|
+
var params = inner.expressions || [inner];
|
|
36826
|
+
if (params.length && isDummy(params[params.length - 1]))
|
|
36827
|
+
{ params.pop(); }
|
|
36828
|
+
return this.parseArrowExpression(this.startNodeAt(parenStart), params)
|
|
36829
|
+
}
|
|
36830
|
+
if (this.options.preserveParens) {
|
|
36831
|
+
var par = this.startNodeAt(parenStart);
|
|
36832
|
+
par.expression = inner;
|
|
36833
|
+
inner = this.finishNode(par, "ParenthesizedExpression");
|
|
36834
|
+
}
|
|
36835
|
+
return inner
|
|
36836
|
+
|
|
36837
|
+
case types$1.bracketL:
|
|
36838
|
+
node = this.startNode();
|
|
36839
|
+
node.elements = this.parseExprList(types$1.bracketR, true);
|
|
36840
|
+
return this.finishNode(node, "ArrayExpression")
|
|
36841
|
+
|
|
36842
|
+
case types$1.braceL:
|
|
36843
|
+
this.toks.overrideContext(types.b_expr);
|
|
36844
|
+
return this.parseObj()
|
|
36845
|
+
|
|
36846
|
+
case types$1._class:
|
|
36847
|
+
return this.parseClass(false)
|
|
36848
|
+
|
|
36849
|
+
case types$1._function:
|
|
36850
|
+
node = this.startNode();
|
|
36851
|
+
this.next();
|
|
36852
|
+
return this.parseFunction(node, false)
|
|
36853
|
+
|
|
36854
|
+
case types$1._new:
|
|
36855
|
+
return this.parseNew()
|
|
36856
|
+
|
|
36857
|
+
case types$1.backQuote:
|
|
36858
|
+
return this.parseTemplate()
|
|
36859
|
+
|
|
36860
|
+
case types$1._import:
|
|
36861
|
+
if (this.options.ecmaVersion >= 11) {
|
|
36862
|
+
return this.parseExprImport()
|
|
36863
|
+
} else {
|
|
36864
|
+
return this.dummyIdent()
|
|
36865
|
+
}
|
|
36866
|
+
|
|
36867
|
+
default:
|
|
36868
|
+
return this.dummyIdent()
|
|
36869
|
+
}
|
|
36870
|
+
};
|
|
36871
|
+
|
|
36872
|
+
lp.parseExprImport = function() {
|
|
36873
|
+
var node = this.startNode();
|
|
36874
|
+
var meta = this.parseIdent(true);
|
|
36875
|
+
switch (this.tok.type) {
|
|
36876
|
+
case types$1.parenL:
|
|
36877
|
+
return this.parseDynamicImport(node)
|
|
36878
|
+
case types$1.dot:
|
|
36879
|
+
node.meta = meta;
|
|
36880
|
+
return this.parseImportMeta(node)
|
|
36881
|
+
default:
|
|
36882
|
+
node.name = "import";
|
|
36883
|
+
return this.finishNode(node, "Identifier")
|
|
36884
|
+
}
|
|
36885
|
+
};
|
|
36886
|
+
|
|
36887
|
+
lp.parseDynamicImport = function(node) {
|
|
36888
|
+
var list = this.parseExprList(types$1.parenR);
|
|
36889
|
+
node.source = list[0] || this.dummyString();
|
|
36890
|
+
node.options = list[1] || null;
|
|
36891
|
+
return this.finishNode(node, "ImportExpression")
|
|
36892
|
+
};
|
|
36893
|
+
|
|
36894
|
+
lp.parseImportMeta = function(node) {
|
|
36895
|
+
this.next(); // skip '.'
|
|
36896
|
+
node.property = this.parseIdent(true);
|
|
36897
|
+
return this.finishNode(node, "MetaProperty")
|
|
36898
|
+
};
|
|
36899
|
+
|
|
36900
|
+
lp.parseNew = function() {
|
|
36901
|
+
var node = this.startNode(), startIndent = this.curIndent, line = this.curLineStart;
|
|
36902
|
+
var meta = this.parseIdent(true);
|
|
36903
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
36904
|
+
node.meta = meta;
|
|
36905
|
+
node.property = this.parseIdent(true);
|
|
36906
|
+
return this.finishNode(node, "MetaProperty")
|
|
36907
|
+
}
|
|
36908
|
+
var start = this.storeCurrentPos();
|
|
36909
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
|
|
36910
|
+
if (this.tok.type === types$1.parenL) {
|
|
36911
|
+
node.arguments = this.parseExprList(types$1.parenR);
|
|
36912
|
+
} else {
|
|
36913
|
+
node.arguments = [];
|
|
36914
|
+
}
|
|
36915
|
+
return this.finishNode(node, "NewExpression")
|
|
36916
|
+
};
|
|
36917
|
+
|
|
36918
|
+
lp.parseTemplateElement = function() {
|
|
36919
|
+
var elem = this.startNode();
|
|
36920
|
+
|
|
36921
|
+
// The loose parser accepts invalid unicode escapes even in untagged templates.
|
|
36922
|
+
if (this.tok.type === types$1.invalidTemplate) {
|
|
36923
|
+
elem.value = {
|
|
36924
|
+
raw: this.tok.value,
|
|
36925
|
+
cooked: null
|
|
36926
|
+
};
|
|
36927
|
+
} else {
|
|
36928
|
+
elem.value = {
|
|
36929
|
+
raw: this.input.slice(this.tok.start, this.tok.end).replace(/\r\n?/g, "\n"),
|
|
36930
|
+
cooked: this.tok.value
|
|
36931
|
+
};
|
|
36932
|
+
}
|
|
36933
|
+
this.next();
|
|
36934
|
+
elem.tail = this.tok.type === types$1.backQuote;
|
|
36935
|
+
return this.finishNode(elem, "TemplateElement")
|
|
36936
|
+
};
|
|
36937
|
+
|
|
36938
|
+
lp.parseTemplate = function() {
|
|
36939
|
+
var node = this.startNode();
|
|
36940
|
+
this.next();
|
|
36941
|
+
node.expressions = [];
|
|
36942
|
+
var curElt = this.parseTemplateElement();
|
|
36943
|
+
node.quasis = [curElt];
|
|
36944
|
+
while (!curElt.tail) {
|
|
36945
|
+
this.next();
|
|
36946
|
+
node.expressions.push(this.parseExpression());
|
|
36947
|
+
if (this.expect(types$1.braceR)) {
|
|
36948
|
+
curElt = this.parseTemplateElement();
|
|
36949
|
+
} else {
|
|
36950
|
+
curElt = this.startNode();
|
|
36951
|
+
curElt.value = {cooked: "", raw: ""};
|
|
36952
|
+
curElt.tail = true;
|
|
36953
|
+
this.finishNode(curElt, "TemplateElement");
|
|
36954
|
+
}
|
|
36955
|
+
node.quasis.push(curElt);
|
|
36956
|
+
}
|
|
36957
|
+
this.expect(types$1.backQuote);
|
|
36958
|
+
return this.finishNode(node, "TemplateLiteral")
|
|
36959
|
+
};
|
|
36960
|
+
|
|
36961
|
+
lp.parseObj = function() {
|
|
36962
|
+
var node = this.startNode();
|
|
36963
|
+
node.properties = [];
|
|
36964
|
+
this.pushCx();
|
|
36965
|
+
var indent = this.curIndent + 1, line = this.curLineStart;
|
|
36966
|
+
this.eat(types$1.braceL);
|
|
36967
|
+
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; }
|
|
36968
|
+
while (!this.closes(types$1.braceR, indent, line)) {
|
|
36969
|
+
var prop = this.startNode(), isGenerator = (void 0), isAsync = (void 0), start = (void 0);
|
|
36970
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
36971
|
+
prop.argument = this.parseMaybeAssign();
|
|
36972
|
+
node.properties.push(this.finishNode(prop, "SpreadElement"));
|
|
36973
|
+
this.eat(types$1.comma);
|
|
36974
|
+
continue
|
|
36975
|
+
}
|
|
36976
|
+
if (this.options.ecmaVersion >= 6) {
|
|
36977
|
+
start = this.storeCurrentPos();
|
|
36978
|
+
prop.method = false;
|
|
36979
|
+
prop.shorthand = false;
|
|
36980
|
+
isGenerator = this.eat(types$1.star);
|
|
36981
|
+
}
|
|
36982
|
+
this.parsePropertyName(prop);
|
|
36983
|
+
if (this.toks.isAsyncProp(prop)) {
|
|
36984
|
+
isAsync = true;
|
|
36985
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
36986
|
+
this.parsePropertyName(prop);
|
|
36987
|
+
} else {
|
|
36988
|
+
isAsync = false;
|
|
36989
|
+
}
|
|
36990
|
+
if (isDummy(prop.key)) { if (isDummy(this.parseMaybeAssign())) { this.next(); } this.eat(types$1.comma); continue }
|
|
36991
|
+
if (this.eat(types$1.colon)) {
|
|
36992
|
+
prop.kind = "init";
|
|
36993
|
+
prop.value = this.parseMaybeAssign();
|
|
36994
|
+
} else if (this.options.ecmaVersion >= 6 && (this.tok.type === types$1.parenL || this.tok.type === types$1.braceL)) {
|
|
36995
|
+
prop.kind = "init";
|
|
36996
|
+
prop.method = true;
|
|
36997
|
+
prop.value = this.parseMethod(isGenerator, isAsync);
|
|
36998
|
+
} else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
|
|
36999
|
+
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
|
|
37000
|
+
(this.tok.type !== types$1.comma && this.tok.type !== types$1.braceR && this.tok.type !== types$1.eq)) {
|
|
37001
|
+
prop.kind = prop.key.name;
|
|
37002
|
+
this.parsePropertyName(prop);
|
|
37003
|
+
prop.value = this.parseMethod(false);
|
|
37004
|
+
} else {
|
|
37005
|
+
prop.kind = "init";
|
|
37006
|
+
if (this.options.ecmaVersion >= 6) {
|
|
37007
|
+
if (this.eat(types$1.eq)) {
|
|
37008
|
+
var assign = this.startNodeAt(start);
|
|
37009
|
+
assign.operator = "=";
|
|
37010
|
+
assign.left = prop.key;
|
|
37011
|
+
assign.right = this.parseMaybeAssign();
|
|
37012
|
+
prop.value = this.finishNode(assign, "AssignmentExpression");
|
|
37013
|
+
} else {
|
|
37014
|
+
prop.value = prop.key;
|
|
37015
|
+
}
|
|
37016
|
+
} else {
|
|
37017
|
+
prop.value = this.dummyIdent();
|
|
37018
|
+
}
|
|
37019
|
+
prop.shorthand = true;
|
|
37020
|
+
}
|
|
37021
|
+
node.properties.push(this.finishNode(prop, "Property"));
|
|
37022
|
+
this.eat(types$1.comma);
|
|
37023
|
+
}
|
|
37024
|
+
this.popCx();
|
|
37025
|
+
if (!this.eat(types$1.braceR)) {
|
|
37026
|
+
// If there is no closing brace, make the node span to the start
|
|
37027
|
+
// of the next token (this is useful for Tern)
|
|
37028
|
+
this.last.end = this.tok.start;
|
|
37029
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
|
37030
|
+
}
|
|
37031
|
+
return this.finishNode(node, "ObjectExpression")
|
|
37032
|
+
};
|
|
37033
|
+
|
|
37034
|
+
lp.parsePropertyName = function(prop) {
|
|
37035
|
+
if (this.options.ecmaVersion >= 6) {
|
|
37036
|
+
if (this.eat(types$1.bracketL)) {
|
|
37037
|
+
prop.computed = true;
|
|
37038
|
+
prop.key = this.parseExpression();
|
|
37039
|
+
this.expect(types$1.bracketR);
|
|
37040
|
+
return
|
|
37041
|
+
} else {
|
|
37042
|
+
prop.computed = false;
|
|
37043
|
+
}
|
|
37044
|
+
}
|
|
37045
|
+
var key = (this.tok.type === types$1.num || this.tok.type === types$1.string) ? this.parseExprAtom() : this.parseIdent();
|
|
37046
|
+
prop.key = key || this.dummyIdent();
|
|
37047
|
+
};
|
|
37048
|
+
|
|
37049
|
+
lp.parsePropertyAccessor = function() {
|
|
37050
|
+
if (this.tok.type === types$1.name || this.tok.type.keyword) { return this.parseIdent() }
|
|
37051
|
+
if (this.tok.type === types$1.privateId) { return this.parsePrivateIdent() }
|
|
37052
|
+
};
|
|
37053
|
+
|
|
37054
|
+
lp.parseIdent = function() {
|
|
37055
|
+
var name = this.tok.type === types$1.name ? this.tok.value : this.tok.type.keyword;
|
|
37056
|
+
if (!name) { return this.dummyIdent() }
|
|
37057
|
+
if (this.tok.type.keyword) { this.toks.type = types$1.name; }
|
|
37058
|
+
var node = this.startNode();
|
|
37059
|
+
this.next();
|
|
37060
|
+
node.name = name;
|
|
37061
|
+
return this.finishNode(node, "Identifier")
|
|
37062
|
+
};
|
|
37063
|
+
|
|
37064
|
+
lp.parsePrivateIdent = function() {
|
|
37065
|
+
var node = this.startNode();
|
|
37066
|
+
node.name = this.tok.value;
|
|
37067
|
+
this.next();
|
|
37068
|
+
return this.finishNode(node, "PrivateIdentifier")
|
|
37069
|
+
};
|
|
37070
|
+
|
|
37071
|
+
lp.initFunction = function(node) {
|
|
37072
|
+
node.id = null;
|
|
37073
|
+
node.params = [];
|
|
37074
|
+
if (this.options.ecmaVersion >= 6) {
|
|
37075
|
+
node.generator = false;
|
|
37076
|
+
node.expression = false;
|
|
37077
|
+
}
|
|
37078
|
+
if (this.options.ecmaVersion >= 8)
|
|
37079
|
+
{ node.async = false; }
|
|
37080
|
+
};
|
|
37081
|
+
|
|
37082
|
+
// Convert existing expression atom to assignable pattern
|
|
37083
|
+
// if possible.
|
|
37084
|
+
|
|
37085
|
+
lp.toAssignable = function(node, binding) {
|
|
37086
|
+
if (!node || node.type === "Identifier" || (node.type === "MemberExpression" && !binding)) ; else if (node.type === "ParenthesizedExpression") {
|
|
37087
|
+
this.toAssignable(node.expression, binding);
|
|
37088
|
+
} else if (this.options.ecmaVersion < 6) {
|
|
37089
|
+
return this.dummyIdent()
|
|
37090
|
+
} else if (node.type === "ObjectExpression") {
|
|
37091
|
+
node.type = "ObjectPattern";
|
|
37092
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
|
37093
|
+
{
|
|
37094
|
+
var prop = list[i];
|
|
37095
|
+
|
|
37096
|
+
this.toAssignable(prop, binding);
|
|
37097
|
+
}
|
|
37098
|
+
} else if (node.type === "ArrayExpression") {
|
|
37099
|
+
node.type = "ArrayPattern";
|
|
37100
|
+
this.toAssignableList(node.elements, binding);
|
|
37101
|
+
} else if (node.type === "Property") {
|
|
37102
|
+
this.toAssignable(node.value, binding);
|
|
37103
|
+
} else if (node.type === "SpreadElement") {
|
|
37104
|
+
node.type = "RestElement";
|
|
37105
|
+
this.toAssignable(node.argument, binding);
|
|
37106
|
+
} else if (node.type === "AssignmentExpression") {
|
|
37107
|
+
node.type = "AssignmentPattern";
|
|
37108
|
+
delete node.operator;
|
|
37109
|
+
} else {
|
|
37110
|
+
return this.dummyIdent()
|
|
37111
|
+
}
|
|
37112
|
+
return node
|
|
37113
|
+
};
|
|
37114
|
+
|
|
37115
|
+
lp.toAssignableList = function(exprList, binding) {
|
|
37116
|
+
for (var i = 0, list = exprList; i < list.length; i += 1)
|
|
37117
|
+
{
|
|
37118
|
+
var expr = list[i];
|
|
37119
|
+
|
|
37120
|
+
this.toAssignable(expr, binding);
|
|
37121
|
+
}
|
|
37122
|
+
return exprList
|
|
37123
|
+
};
|
|
37124
|
+
|
|
37125
|
+
lp.parseFunctionParams = function(params) {
|
|
37126
|
+
params = this.parseExprList(types$1.parenR);
|
|
37127
|
+
return this.toAssignableList(params, true)
|
|
37128
|
+
};
|
|
37129
|
+
|
|
37130
|
+
lp.parseMethod = function(isGenerator, isAsync) {
|
|
37131
|
+
var node = this.startNode(), oldInAsync = this.inAsync, oldInGenerator = this.inGenerator, oldInFunction = this.inFunction;
|
|
37132
|
+
this.initFunction(node);
|
|
37133
|
+
if (this.options.ecmaVersion >= 6)
|
|
37134
|
+
{ node.generator = !!isGenerator; }
|
|
37135
|
+
if (this.options.ecmaVersion >= 8)
|
|
37136
|
+
{ node.async = !!isAsync; }
|
|
37137
|
+
this.inAsync = node.async;
|
|
37138
|
+
this.inGenerator = node.generator;
|
|
37139
|
+
this.inFunction = true;
|
|
37140
|
+
node.params = this.parseFunctionParams();
|
|
37141
|
+
node.body = this.parseBlock();
|
|
37142
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
|
37143
|
+
this.inAsync = oldInAsync;
|
|
37144
|
+
this.inGenerator = oldInGenerator;
|
|
37145
|
+
this.inFunction = oldInFunction;
|
|
37146
|
+
return this.finishNode(node, "FunctionExpression")
|
|
37147
|
+
};
|
|
37148
|
+
|
|
37149
|
+
lp.parseArrowExpression = function(node, params, isAsync) {
|
|
37150
|
+
var oldInAsync = this.inAsync, oldInGenerator = this.inGenerator, oldInFunction = this.inFunction;
|
|
37151
|
+
this.initFunction(node);
|
|
37152
|
+
if (this.options.ecmaVersion >= 8)
|
|
37153
|
+
{ node.async = !!isAsync; }
|
|
37154
|
+
this.inAsync = node.async;
|
|
37155
|
+
this.inGenerator = false;
|
|
37156
|
+
this.inFunction = true;
|
|
37157
|
+
node.params = this.toAssignableList(params, true);
|
|
37158
|
+
node.expression = this.tok.type !== types$1.braceL;
|
|
37159
|
+
if (node.expression) {
|
|
37160
|
+
node.body = this.parseMaybeAssign();
|
|
37161
|
+
} else {
|
|
37162
|
+
node.body = this.parseBlock();
|
|
37163
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
|
37164
|
+
}
|
|
37165
|
+
this.inAsync = oldInAsync;
|
|
37166
|
+
this.inGenerator = oldInGenerator;
|
|
37167
|
+
this.inFunction = oldInFunction;
|
|
37168
|
+
return this.finishNode(node, "ArrowFunctionExpression")
|
|
37169
|
+
};
|
|
37170
|
+
|
|
37171
|
+
lp.parseExprList = function(close, allowEmpty) {
|
|
37172
|
+
this.pushCx();
|
|
37173
|
+
var indent = this.curIndent, line = this.curLineStart, elts = [];
|
|
37174
|
+
this.next(); // Opening bracket
|
|
37175
|
+
while (!this.closes(close, indent + 1, line)) {
|
|
37176
|
+
if (this.eat(types$1.comma)) {
|
|
37177
|
+
elts.push(allowEmpty ? null : this.dummyIdent());
|
|
37178
|
+
continue
|
|
37179
|
+
}
|
|
37180
|
+
var elt = this.parseMaybeAssign();
|
|
37181
|
+
if (isDummy(elt)) {
|
|
37182
|
+
if (this.closes(close, indent, line)) { break }
|
|
37183
|
+
this.next();
|
|
37184
|
+
} else {
|
|
37185
|
+
elts.push(elt);
|
|
37186
|
+
}
|
|
37187
|
+
this.eat(types$1.comma);
|
|
37188
|
+
}
|
|
37189
|
+
this.popCx();
|
|
37190
|
+
if (!this.eat(close)) {
|
|
37191
|
+
// If there is no closing brace, make the node span to the start
|
|
37192
|
+
// of the next token (this is useful for Tern)
|
|
37193
|
+
this.last.end = this.tok.start;
|
|
37194
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
|
37195
|
+
}
|
|
37196
|
+
return elts
|
|
37197
|
+
};
|
|
37198
|
+
|
|
37199
|
+
lp.parseAwait = function() {
|
|
37200
|
+
var node = this.startNode();
|
|
37201
|
+
this.next();
|
|
37202
|
+
node.argument = this.parseMaybeUnary();
|
|
37203
|
+
return this.finishNode(node, "AwaitExpression")
|
|
37204
|
+
};
|
|
37205
|
+
|
|
37206
|
+
// Acorn: Loose parser
|
|
37207
|
+
//
|
|
37208
|
+
// This module provides an alternative parser that exposes that same
|
|
37209
|
+
// interface as the main module's `parse` function, but will try to
|
|
37210
|
+
// parse anything as JavaScript, repairing syntax error the best it
|
|
37211
|
+
// can. There are circumstances in which it will raise an error and
|
|
37212
|
+
// give up, but they are very rare. The resulting AST will be a mostly
|
|
37213
|
+
// valid JavaScript AST (as per the [ESTree spec][estree], except
|
|
37214
|
+
// that:
|
|
37215
|
+
//
|
|
37216
|
+
// - Return outside functions is allowed
|
|
37217
|
+
//
|
|
37218
|
+
// - Label consistency (no conflicts, break only to existing labels)
|
|
37219
|
+
// is not enforced.
|
|
37220
|
+
//
|
|
37221
|
+
// - Bogus Identifier nodes with a name of `"✖"` are inserted whenever
|
|
37222
|
+
// the parser got too confused to return anything meaningful.
|
|
37223
|
+
//
|
|
37224
|
+
// [estree]: https://github.com/estree/estree
|
|
37225
|
+
//
|
|
37226
|
+
// The expected use for this is to *first* try `acorn.parse`, and only
|
|
37227
|
+
// if that fails switch to the loose parser. The loose parser might
|
|
37228
|
+
// parse badly indented code incorrectly, so **don't** use it as your
|
|
37229
|
+
// default parser.
|
|
37230
|
+
//
|
|
37231
|
+
// Quite a lot of acorn.js is duplicated here. The alternative was to
|
|
37232
|
+
// add a *lot* of extra cruft to that file, making it less readable
|
|
37233
|
+
// and slower. Copying and editing the code allowed me to make
|
|
37234
|
+
// invasive changes and simplifications without creating a complicated
|
|
37235
|
+
// tangle.
|
|
37236
|
+
|
|
37237
|
+
|
|
37238
|
+
defaultOptions.tabSize = 4;
|
|
37239
|
+
|
|
37240
|
+
function parse(input, options) {
|
|
37241
|
+
return LooseParser.parse(input, options)
|
|
37242
|
+
}
|
|
37243
|
+
|
|
35609
37244
|
// AST walker module for ESTree compatible trees
|
|
35610
37245
|
|
|
35611
37246
|
// A simple walk is one where you simply specify callbacks to be
|
|
@@ -35893,13 +37528,24 @@ base.MethodDefinition = base.PropertyDefinition = base.Property = function (node
|
|
|
35893
37528
|
function getAcornParsedNodes(input) {
|
|
35894
37529
|
var parsedNode = null;
|
|
35895
37530
|
try {
|
|
35896
|
-
parsedNode = parse(input, {
|
|
37531
|
+
parsedNode = parse$1(input, {
|
|
35897
37532
|
ecmaVersion: 'latest',
|
|
35898
37533
|
sourceType: 'module',
|
|
35899
37534
|
locations: true
|
|
35900
37535
|
});
|
|
35901
37536
|
}
|
|
35902
|
-
catch (_a) {
|
|
37537
|
+
catch (_a) {
|
|
37538
|
+
// attempt parse with more error-tolerant parser.
|
|
37539
|
+
// handles rules with both shared code and top-level
|
|
37540
|
+
// return, which is technically invalid syntax
|
|
37541
|
+
try {
|
|
37542
|
+
parsedNode = parse(input, {
|
|
37543
|
+
ecmaVersion: 'latest',
|
|
37544
|
+
locations: true
|
|
37545
|
+
});
|
|
37546
|
+
}
|
|
37547
|
+
catch (_b) { }
|
|
37548
|
+
}
|
|
35903
37549
|
return parsedNode;
|
|
35904
37550
|
}
|
|
35905
37551
|
function extractReferencedIdentifiers(bodyNode) {
|
|
@@ -36043,8 +37689,10 @@ function extractJsElements(code) {
|
|
|
36043
37689
|
var exportFunctions = [];
|
|
36044
37690
|
var exportVariables = [];
|
|
36045
37691
|
var parsedNodes = getAcornParsedNodes(code);
|
|
36046
|
-
if (!parsedNodes)
|
|
37692
|
+
if (!parsedNodes) {
|
|
37693
|
+
console.warn('Failed to parse logic rule code');
|
|
36047
37694
|
return { exportVariables: exportVariables, exportFunctions: exportFunctions };
|
|
37695
|
+
}
|
|
36048
37696
|
// Helper: turn a param node into its original text
|
|
36049
37697
|
var paramText = function (p) { return code.slice(p.start, p.end); };
|
|
36050
37698
|
// Helper: build function signature and body from FunctionExpression or ArrowFunctionExpression
|
|
@@ -38498,13 +40146,28 @@ function Form(_a) {
|
|
|
38498
40146
|
}
|
|
38499
40147
|
});
|
|
38500
40148
|
}); };
|
|
40149
|
+
var tableOnClick = function (table, payload) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
40150
|
+
return __generator(this, function (_a) {
|
|
40151
|
+
switch (_a.label) {
|
|
40152
|
+
case 0: return [4 /*yield*/, runElementActions({
|
|
40153
|
+
actions: [],
|
|
40154
|
+
element: table,
|
|
40155
|
+
elementType: 'table',
|
|
40156
|
+
triggerPayload: payload
|
|
40157
|
+
})];
|
|
40158
|
+
case 1:
|
|
40159
|
+
_a.sent();
|
|
40160
|
+
return [2 /*return*/];
|
|
40161
|
+
}
|
|
40162
|
+
});
|
|
40163
|
+
}); };
|
|
38501
40164
|
// Orchestrates all actions triggered by a button/element click.
|
|
38502
40165
|
// Runs validations and submission first (if submit=true), then executes click actions in order.
|
|
38503
40166
|
// Prevents race conditions by locking element during execution and tracking global button state.
|
|
38504
40167
|
// Some actions (Persona, Plaid, etc) require special handling: they pause execution and
|
|
38505
40168
|
// provide a callback for continuing to the next action once they complete.
|
|
38506
40169
|
var runElementActions = function (_a) {
|
|
38507
|
-
var actions = _a.actions, element = _a.element, elementType = _a.elementType, _b = _a.submit, submit = _b === void 0 ? false : _b, _c = _a.setElementError, setElementError = _c === void 0 ? function () { } : _c, _d = _a.onAsyncEnd, onAsyncEnd = _d === void 0 ? function () { } : _d, textSpanStart = _a.textSpanStart, textSpanEnd = _a.textSpanEnd;
|
|
40170
|
+
var actions = _a.actions, element = _a.element, elementType = _a.elementType, _b = _a.submit, submit = _b === void 0 ? false : _b, _c = _a.setElementError, setElementError = _c === void 0 ? function () { } : _c, _d = _a.onAsyncEnd, onAsyncEnd = _d === void 0 ? function () { } : _d, textSpanStart = _a.textSpanStart, textSpanEnd = _a.textSpanEnd, triggerPayload = _a.triggerPayload;
|
|
38508
40171
|
return __awaiter$2(_this, void 0, void 0, function () {
|
|
38509
40172
|
var id, metadata, trigger, submitPromise, pendingFileKeys, invalid, hasNext, submissionResult, error_3, _e, stepPromise, flowOnSuccess, actionTypes, runAction, i, hasExtractions, hasEnvelopeGeneration, _loop_1, state_1;
|
|
38510
40173
|
var _this = this;
|
|
@@ -38528,7 +40191,7 @@ function Form(_a) {
|
|
|
38528
40191
|
start: textSpanStart,
|
|
38529
40192
|
end: textSpanEnd
|
|
38530
40193
|
};
|
|
38531
|
-
trigger = __assign(__assign({}, lookUpTrigger(activeStep, elementType === 'container' ? element.key : element.id, elementType)), { repeatIndex: element.repeat });
|
|
40194
|
+
trigger = __assign(__assign({}, lookUpTrigger(activeStep, elementType === 'container' ? element.key : element.id, elementType, triggerPayload)), { repeatIndex: element.repeat });
|
|
38532
40195
|
submitPromise = Promise.resolve();
|
|
38533
40196
|
if (!(submit && !readOnly)) return [3 /*break*/, 7];
|
|
38534
40197
|
// Do not proceed until user has gone through required flows
|
|
@@ -38629,7 +40292,8 @@ function Form(_a) {
|
|
|
38629
40292
|
setElementError: setElementError,
|
|
38630
40293
|
onAsyncEnd: onAsyncEnd,
|
|
38631
40294
|
textSpanStart: textSpanStart,
|
|
38632
|
-
textSpanEnd: textSpanEnd
|
|
40295
|
+
textSpanEnd: textSpanEnd,
|
|
40296
|
+
triggerPayload: triggerPayload
|
|
38633
40297
|
})];
|
|
38634
40298
|
case 1:
|
|
38635
40299
|
running = _a.sent();
|
|
@@ -39404,6 +41068,7 @@ function Form(_a) {
|
|
|
39404
41068
|
customClickSelectionState: customClickSelectionState,
|
|
39405
41069
|
runElementActions: runElementActions,
|
|
39406
41070
|
buttonOnClick: buttonOnClick,
|
|
41071
|
+
tableOnClick: tableOnClick,
|
|
39407
41072
|
fieldOnChange: fieldOnChange,
|
|
39408
41073
|
buttonLoaders: buttonLoaders,
|
|
39409
41074
|
inlineErrors: inlineErrors,
|
|
@@ -42286,6 +43951,112 @@ function loadQRScanner() {
|
|
|
42286
43951
|
qrPromise = dynamicImport(QR_SCANNER_LIB_URL);
|
|
42287
43952
|
}
|
|
42288
43953
|
|
|
43954
|
+
/**
|
|
43955
|
+
* Event queue for holding events before user interaction
|
|
43956
|
+
*/
|
|
43957
|
+
var EventQueue = /** @class */ (function () {
|
|
43958
|
+
function EventQueue() {
|
|
43959
|
+
this.queue = [];
|
|
43960
|
+
this.isReplaying = false;
|
|
43961
|
+
}
|
|
43962
|
+
EventQueue.prototype.enqueue = function (eventData) {
|
|
43963
|
+
var _this = this;
|
|
43964
|
+
return new Promise(function (resolve, reject) {
|
|
43965
|
+
_this.queue.push({
|
|
43966
|
+
eventData: eventData,
|
|
43967
|
+
timestamp: Date.now(),
|
|
43968
|
+
resolve: resolve,
|
|
43969
|
+
reject: reject
|
|
43970
|
+
});
|
|
43971
|
+
});
|
|
43972
|
+
};
|
|
43973
|
+
EventQueue.prototype.getAll = function () {
|
|
43974
|
+
return this.queue;
|
|
43975
|
+
};
|
|
43976
|
+
EventQueue.prototype.clear = function () {
|
|
43977
|
+
this.queue = [];
|
|
43978
|
+
};
|
|
43979
|
+
EventQueue.prototype.isEmpty = function () {
|
|
43980
|
+
return this.queue.length === 0;
|
|
43981
|
+
};
|
|
43982
|
+
EventQueue.prototype.size = function () {
|
|
43983
|
+
return this.queue.length;
|
|
43984
|
+
};
|
|
43985
|
+
EventQueue.prototype.isReplayingEvents = function () {
|
|
43986
|
+
return this.isReplaying;
|
|
43987
|
+
};
|
|
43988
|
+
EventQueue.prototype.setReplayState = function (replaying) {
|
|
43989
|
+
this.isReplaying = replaying;
|
|
43990
|
+
};
|
|
43991
|
+
/**
|
|
43992
|
+
* Apply replay function to all queued events
|
|
43993
|
+
* @param replayFn Function to call for each event
|
|
43994
|
+
*/
|
|
43995
|
+
EventQueue.prototype.replayAll = function (replayFn) {
|
|
43996
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
43997
|
+
var eventsToReplay, eventsToReplay_1, eventsToReplay_1_1, queuedEvent, result, error_1, e_1_1;
|
|
43998
|
+
var e_1, _a;
|
|
43999
|
+
return __generator(this, function (_b) {
|
|
44000
|
+
switch (_b.label) {
|
|
44001
|
+
case 0:
|
|
44002
|
+
if (this.isEmpty())
|
|
44003
|
+
return [2 /*return*/];
|
|
44004
|
+
this.setReplayState(true);
|
|
44005
|
+
_b.label = 1;
|
|
44006
|
+
case 1:
|
|
44007
|
+
_b.trys.push([1, , 14, 15]);
|
|
44008
|
+
_b.label = 2;
|
|
44009
|
+
case 2:
|
|
44010
|
+
if (!!this.isEmpty()) return [3 /*break*/, 13];
|
|
44011
|
+
eventsToReplay = __spreadArray([], __read(this.queue), false);
|
|
44012
|
+
this.queue = [];
|
|
44013
|
+
_b.label = 3;
|
|
44014
|
+
case 3:
|
|
44015
|
+
_b.trys.push([3, 10, 11, 12]);
|
|
44016
|
+
eventsToReplay_1 = (e_1 = void 0, __values(eventsToReplay)), eventsToReplay_1_1 = eventsToReplay_1.next();
|
|
44017
|
+
_b.label = 4;
|
|
44018
|
+
case 4:
|
|
44019
|
+
if (!!eventsToReplay_1_1.done) return [3 /*break*/, 9];
|
|
44020
|
+
queuedEvent = eventsToReplay_1_1.value;
|
|
44021
|
+
_b.label = 5;
|
|
44022
|
+
case 5:
|
|
44023
|
+
_b.trys.push([5, 7, , 8]);
|
|
44024
|
+
return [4 /*yield*/, replayFn(queuedEvent.eventData)];
|
|
44025
|
+
case 6:
|
|
44026
|
+
result = _b.sent();
|
|
44027
|
+
queuedEvent.resolve(result);
|
|
44028
|
+
return [3 /*break*/, 8];
|
|
44029
|
+
case 7:
|
|
44030
|
+
error_1 = _b.sent();
|
|
44031
|
+
queuedEvent.reject(error_1);
|
|
44032
|
+
return [3 /*break*/, 8];
|
|
44033
|
+
case 8:
|
|
44034
|
+
eventsToReplay_1_1 = eventsToReplay_1.next();
|
|
44035
|
+
return [3 /*break*/, 4];
|
|
44036
|
+
case 9: return [3 /*break*/, 12];
|
|
44037
|
+
case 10:
|
|
44038
|
+
e_1_1 = _b.sent();
|
|
44039
|
+
e_1 = { error: e_1_1 };
|
|
44040
|
+
return [3 /*break*/, 12];
|
|
44041
|
+
case 11:
|
|
44042
|
+
try {
|
|
44043
|
+
if (eventsToReplay_1_1 && !eventsToReplay_1_1.done && (_a = eventsToReplay_1.return)) _a.call(eventsToReplay_1);
|
|
44044
|
+
}
|
|
44045
|
+
finally { if (e_1) throw e_1.error; }
|
|
44046
|
+
return [7 /*endfinally*/];
|
|
44047
|
+
case 12: return [3 /*break*/, 2];
|
|
44048
|
+
case 13: return [3 /*break*/, 15];
|
|
44049
|
+
case 14:
|
|
44050
|
+
this.setReplayState(false);
|
|
44051
|
+
return [7 /*endfinally*/];
|
|
44052
|
+
case 15: return [2 /*return*/];
|
|
44053
|
+
}
|
|
44054
|
+
});
|
|
44055
|
+
});
|
|
44056
|
+
};
|
|
44057
|
+
return EventQueue;
|
|
44058
|
+
}());
|
|
44059
|
+
|
|
42289
44060
|
var API_URL_OPTIONS = {
|
|
42290
44061
|
local: 'http://localhost:8006/api/',
|
|
42291
44062
|
staging: 'https://staging.feathery.io/api/',
|
|
@@ -42360,6 +44131,10 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
42360
44131
|
var _this = this;
|
|
42361
44132
|
var _a, _b;
|
|
42362
44133
|
_this = _super.call(this, formKey, ignoreNetworkErrors, draft, bypassCDN) || this;
|
|
44134
|
+
/**
|
|
44135
|
+
* Queue for events triggered before user interaction
|
|
44136
|
+
*/
|
|
44137
|
+
_this.userEventQueue = new EventQueue();
|
|
42363
44138
|
/**
|
|
42364
44139
|
* `beforeunload` event handler that flushes the pending submit custom changes
|
|
42365
44140
|
* when a user is attempting to exit the page.
|
|
@@ -42395,8 +44170,39 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
42395
44170
|
var _a, _b;
|
|
42396
44171
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
42397
44172
|
return __generator(this, function (_c) {
|
|
42398
|
-
|
|
42399
|
-
|
|
44173
|
+
switch (_c.label) {
|
|
44174
|
+
case 0:
|
|
44175
|
+
(_b = (_a = featheryWindow()).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, FEATHERY_INTERACTION_EVENT, this.handleInteraction);
|
|
44176
|
+
// replay queued events, then flush fields
|
|
44177
|
+
return [4 /*yield*/, this.replayQueuedEvents()];
|
|
44178
|
+
case 1:
|
|
44179
|
+
// replay queued events, then flush fields
|
|
44180
|
+
_c.sent();
|
|
44181
|
+
return [4 /*yield*/, this.submitCustom({}, { shouldFlush: true })];
|
|
44182
|
+
case 2:
|
|
44183
|
+
_c.sent();
|
|
44184
|
+
return [2 /*return*/];
|
|
44185
|
+
}
|
|
44186
|
+
});
|
|
44187
|
+
});
|
|
44188
|
+
};
|
|
44189
|
+
FeatheryClient.prototype.replayQueuedEvents = function () {
|
|
44190
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
44191
|
+
var _this = this;
|
|
44192
|
+
return __generator(this, function (_a) {
|
|
44193
|
+
switch (_a.label) {
|
|
44194
|
+
case 0:
|
|
44195
|
+
if (this.userEventQueue.isEmpty())
|
|
44196
|
+
return [2 /*return*/];
|
|
44197
|
+
return [4 /*yield*/, this.userEventQueue.replayAll(function (eventData) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
44198
|
+
return __generator(this, function (_a) {
|
|
44199
|
+
return [2 /*return*/, this._registerEventInternal(eventData)];
|
|
44200
|
+
});
|
|
44201
|
+
}); })];
|
|
44202
|
+
case 1:
|
|
44203
|
+
_a.sent();
|
|
44204
|
+
return [2 /*return*/];
|
|
44205
|
+
}
|
|
42400
44206
|
});
|
|
42401
44207
|
});
|
|
42402
44208
|
};
|
|
@@ -43087,15 +44893,24 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
43087
44893
|
});
|
|
43088
44894
|
};
|
|
43089
44895
|
FeatheryClient.prototype.registerEvent = function (eventData) {
|
|
44896
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
44897
|
+
return __generator(this, function (_a) {
|
|
44898
|
+
if (this.draft)
|
|
44899
|
+
return [2 /*return*/];
|
|
44900
|
+
if (!isInteractionDetected() || this.userEventQueue.isReplayingEvents()) {
|
|
44901
|
+
return [2 /*return*/, this.userEventQueue.enqueue(eventData)];
|
|
44902
|
+
}
|
|
44903
|
+
return [2 /*return*/, this._registerEventInternal(eventData)];
|
|
44904
|
+
});
|
|
44905
|
+
});
|
|
44906
|
+
};
|
|
44907
|
+
FeatheryClient.prototype._registerEventInternal = function (eventData) {
|
|
43090
44908
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
43091
44909
|
var _a, userId, collaboratorId, url, data, options, prom, stepKey, triggerEvent, eventPromise;
|
|
43092
44910
|
var _this = this;
|
|
43093
44911
|
return __generator(this, function (_b) {
|
|
43094
44912
|
switch (_b.label) {
|
|
43095
|
-
case 0:
|
|
43096
|
-
if (this.draft)
|
|
43097
|
-
return [2 /*return*/];
|
|
43098
|
-
return [4 /*yield*/, initFormsPromise];
|
|
44913
|
+
case 0: return [4 /*yield*/, initFormsPromise];
|
|
43099
44914
|
case 1:
|
|
43100
44915
|
_b.sent();
|
|
43101
44916
|
_a = initInfo(), userId = _a.userId, collaboratorId = _a.collaboratorId;
|
|
@@ -43607,9 +45422,9 @@ function init(sdkKey, options) {
|
|
|
43607
45422
|
if (runningInClient()) {
|
|
43608
45423
|
// Dynamically load libraries that must be client side
|
|
43609
45424
|
global.scriptjsLoadPromise = import(
|
|
43610
|
-
/* webpackChunkName: "scriptjs" */ './fthry_script.
|
|
45425
|
+
/* webpackChunkName: "scriptjs" */ './fthry_script.C5O1ZNQQ.js').then(function (n) { return n.s; });
|
|
43611
45426
|
global.webfontloaderPromise = import(
|
|
43612
|
-
/* webpackChunkName: "webfontloader" */ './fthry_webfontloader.
|
|
45427
|
+
/* webpackChunkName: "webfontloader" */ './fthry_webfontloader.DAANkO2-.js').then(function (n) { return n.w; });
|
|
43613
45428
|
// Client-side tracking logic
|
|
43614
45429
|
if (initState.userTracking === 'cookie') {
|
|
43615
45430
|
var cookieKey = "feathery-user-id-".concat(sdkKey);
|
|
@@ -43755,7 +45570,7 @@ function getFieldValues() {
|
|
|
43755
45570
|
return __assign({}, fieldValues);
|
|
43756
45571
|
}
|
|
43757
45572
|
function logFeatheryBadge() {
|
|
43758
|
-
console.log('%c Feathery %c v' + "2.
|
|
45573
|
+
console.log('%c Feathery %c v' + "2.15.1" + ' ', // replaced with real version during build
|
|
43759
45574
|
'background: #e2626e; color: white; padding: 2px 6px; border-radius: 3px 0 0 3px; font-weight: bold;', 'background: #fce7e9; color: #c5495a; padding: 2px 6px; border-radius: 0 3px 3px 0;');
|
|
43760
45575
|
}
|
|
43761
45576
|
|
|
@@ -43791,9 +45606,10 @@ var getABVariant = function (stepRes) {
|
|
|
43791
45606
|
return stepRes;
|
|
43792
45607
|
};
|
|
43793
45608
|
var getAllElements = function (step) {
|
|
43794
|
-
|
|
45609
|
+
var _a, _b;
|
|
45610
|
+
return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(step.progress_bars.map(function (e) { return [e, 'progress_bar']; })), false), __read(step.images.map(function (e) { return [e, 'image']; })), false), __read(step.videos.map(function (e) { return [e, 'video']; })), false), __read(((_b = (_a = step.tables) === null || _a === void 0 ? void 0 : _a.map(function (e) { return [e, 'table']; })) !== null && _b !== void 0 ? _b : [])), false), __read(step.texts.map(function (e) { return [e, 'text']; })), false), __read(step.buttons.map(function (e) { return [e, 'button']; })), false), __read(step.servar_fields.map(function (e) { return [e, 'field']; })), false), __read(step.subgrids.map(function (e) { return [e, 'subgrid']; })), false);
|
|
43795
45611
|
};
|
|
43796
|
-
var lookUpTrigger = function (step, elementID, type) {
|
|
45612
|
+
var lookUpTrigger = function (step, elementID, type, additionalPayload) {
|
|
43797
45613
|
var _a, _b;
|
|
43798
45614
|
var payload = {};
|
|
43799
45615
|
if (type === 'button') {
|
|
@@ -43813,7 +45629,12 @@ var lookUpTrigger = function (step, elementID, type) {
|
|
|
43813
45629
|
text: element.servar.name
|
|
43814
45630
|
};
|
|
43815
45631
|
}
|
|
43816
|
-
|
|
45632
|
+
else if (type === 'table') {
|
|
45633
|
+
// For tables, we don't look up additional properties from the step
|
|
45634
|
+
// All table-specific data is provided via additionalPayload
|
|
45635
|
+
payload = {};
|
|
45636
|
+
}
|
|
45637
|
+
return __assign(__assign({ id: elementID, type: type }, payload), additionalPayload);
|
|
43817
45638
|
};
|
|
43818
45639
|
/** Update the fieldValues cache with a backend session */
|
|
43819
45640
|
function updateSessionValues(session) {
|
|
@@ -45227,39 +47048,39 @@ breakpoint) {
|
|
|
45227
47048
|
return styles.getTarget('inner-container', undefined, viewport === 'mobile');
|
|
45228
47049
|
};
|
|
45229
47050
|
|
|
45230
|
-
var AddressLine1 = lazy(function () { return import(/* webpackChunkName: "AddressField" */ './fthry_index.
|
|
45231
|
-
var ButtonGroupField = lazy(function () { return import(/* webpackChunkName: "ButtonGroupField" */ './fthry_index.
|
|
45232
|
-
var CheckboxField = lazy(function () { return import(/* webpackChunkName: "CheckboxField" */ './fthry_index.
|
|
47051
|
+
var AddressLine1 = lazy(function () { return import(/* webpackChunkName: "AddressField" */ './fthry_index.BEZmvsoo.js'); });
|
|
47052
|
+
var ButtonGroupField = lazy(function () { return import(/* webpackChunkName: "ButtonGroupField" */ './fthry_index.m7CZv4YY.js'); });
|
|
47053
|
+
var CheckboxField = lazy(function () { return import(/* webpackChunkName: "CheckboxField" */ './fthry_index.Dy4nSWZa.js'); });
|
|
45233
47054
|
var CheckboxGroupField = lazy(function () {
|
|
45234
|
-
return import(/* webpackChunkName: "CheckboxGroupField" */ './fthry_index.
|
|
47055
|
+
return import(/* webpackChunkName: "CheckboxGroupField" */ './fthry_index.t4v0qqgv.js');
|
|
45235
47056
|
});
|
|
45236
|
-
var ColorPickerField = lazy(function () { return import(/* webpackChunkName: "ColorPickerField" */ './fthry_index.
|
|
45237
|
-
var CustomField = lazy(function () { return import(/* webpackChunkName: "CustomField" */ './fthry_index.
|
|
47057
|
+
var ColorPickerField = lazy(function () { return import(/* webpackChunkName: "ColorPickerField" */ './fthry_index.D9VjMJ_U.js'); });
|
|
47058
|
+
var CustomField = lazy(function () { return import(/* webpackChunkName: "CustomField" */ './fthry_index.Bz07r-AM.js'); });
|
|
45238
47059
|
var DateSelectorField = lazy(function () {
|
|
45239
|
-
return import(/* webpackChunkName: "DateSelectorField" */ './fthry_index.
|
|
47060
|
+
return import(/* webpackChunkName: "DateSelectorField" */ './fthry_index.NOuMR_hq.js');
|
|
45240
47061
|
});
|
|
45241
|
-
var DropdownField = lazy(function () { return import(/* webpackChunkName: "DropdownField" */ './fthry_index.
|
|
47062
|
+
var DropdownField = lazy(function () { return import(/* webpackChunkName: "DropdownField" */ './fthry_index.B7VWXvgC.js'); });
|
|
45242
47063
|
var DropdownMultiField = lazy(function () {
|
|
45243
|
-
return import(/* webpackChunkName: "DropdownMultiField" */ './fthry_index.
|
|
47064
|
+
return import(/* webpackChunkName: "DropdownMultiField" */ './fthry_index.DhU16s57.js');
|
|
45244
47065
|
});
|
|
45245
|
-
var FileUploadField = lazy(function () { return import(/* webpackChunkName: "FileUploadField" */ './fthry_index.
|
|
45246
|
-
var MatrixField = lazy(function () { return import(/* webpackChunkName: "MatrixField" */ './fthry_index.
|
|
45247
|
-
var PasswordField = lazy(function () { return import(/* webpackChunkName: "PasswordField" */ './fthry_index.
|
|
47066
|
+
var FileUploadField = lazy(function () { return import(/* webpackChunkName: "FileUploadField" */ './fthry_index.B84L3MVC.js'); });
|
|
47067
|
+
var MatrixField = lazy(function () { return import(/* webpackChunkName: "MatrixField" */ './fthry_index.DH2fsNWG.js'); });
|
|
47068
|
+
var PasswordField = lazy(function () { return import(/* webpackChunkName: "PasswordField" */ './fthry_index.Fs86Fy9Y.js'); });
|
|
45248
47069
|
var PaymentMethodField = lazy(function () {
|
|
45249
|
-
return import(/* webpackChunkName: "PaymentMethodField" */ './fthry_PaymentMethodField.
|
|
47070
|
+
return import(/* webpackChunkName: "PaymentMethodField" */ './fthry_PaymentMethodField.BpA_xhqt.js');
|
|
45250
47071
|
});
|
|
45251
|
-
var PhoneField = lazy(function () { return import(/* webpackChunkName: "PhoneField" */ './fthry_index.
|
|
45252
|
-
var PinInputField = lazy(function () { return import(/* webpackChunkName: "PinInputField" */ './fthry_index.
|
|
45253
|
-
var QRScanner = lazy(function () { return import(/* webpackChunkName: "QRScanner" */ './fthry_index.
|
|
47072
|
+
var PhoneField = lazy(function () { return import(/* webpackChunkName: "PhoneField" */ './fthry_index.BsNCOSBE.js'); });
|
|
47073
|
+
var PinInputField = lazy(function () { return import(/* webpackChunkName: "PinInputField" */ './fthry_index.D9AKkBzu.js'); });
|
|
47074
|
+
var QRScanner = lazy(function () { return import(/* webpackChunkName: "QRScanner" */ './fthry_index.B-oHlMGi.js'); });
|
|
45254
47075
|
var RadioButtonGroupField = lazy(function () {
|
|
45255
47076
|
return import(
|
|
45256
|
-
/* webpackChunkName: "RadioButtonGroupField" */ './fthry_index.
|
|
47077
|
+
/* webpackChunkName: "RadioButtonGroupField" */ './fthry_index.Dgmpm9wy.js');
|
|
45257
47078
|
});
|
|
45258
|
-
var RatingField = lazy(function () { return import(/* webpackChunkName: "RatingField" */ './fthry_index.
|
|
45259
|
-
var SignatureField = lazy(function () { return import(/* webpackChunkName: "SignatureField" */ './fthry_index.
|
|
45260
|
-
var SliderField = lazy(function () { return import(/* webpackChunkName: "SliderField" */ './fthry_index.
|
|
45261
|
-
var TextField = lazy(function () { return import(/* webpackChunkName: "TextField" */ './fthry_index.
|
|
45262
|
-
var TextArea = lazy(function () { return import(/* webpackChunkName: "TextArea" */ './fthry_index.
|
|
47079
|
+
var RatingField = lazy(function () { return import(/* webpackChunkName: "RatingField" */ './fthry_index.DoP7RwIP.js'); });
|
|
47080
|
+
var SignatureField = lazy(function () { return import(/* webpackChunkName: "SignatureField" */ './fthry_index.CJKGRCG-.js'); });
|
|
47081
|
+
var SliderField = lazy(function () { return import(/* webpackChunkName: "SliderField" */ './fthry_index.BSEfDQAc.js'); });
|
|
47082
|
+
var TextField = lazy(function () { return import(/* webpackChunkName: "TextField" */ './fthry_index.BsEfTy-x.js'); });
|
|
47083
|
+
var TextArea = lazy(function () { return import(/* webpackChunkName: "TextArea" */ './fthry_index.BzrcCLzO.js'); });
|
|
45263
47084
|
var Fields = {
|
|
45264
47085
|
AddressLine1: AddressLine1,
|
|
45265
47086
|
ButtonGroupField: ButtonGroupField,
|
|
@@ -45299,7 +47120,7 @@ var defaultBorderFields = [
|
|
|
45299
47120
|
'file_upload'
|
|
45300
47121
|
];
|
|
45301
47122
|
var DROPDOWN_Z_INDEX = 10;
|
|
45302
|
-
function applyFieldStyles
|
|
47123
|
+
function applyFieldStyles(field, styles) {
|
|
45303
47124
|
var type = field.servar.type;
|
|
45304
47125
|
styles.addTargets('fc', 'sub-fc', 'field', 'error', 'active', 'hover', 'disabled', 'tooltipIcon');
|
|
45305
47126
|
// For these fields, selector font colors
|
|
@@ -45634,7 +47455,7 @@ Object.entries(Fields).map(function (_a) {
|
|
|
45634
47455
|
whiteSpace: 'pre-wrap',
|
|
45635
47456
|
overflowWrap: 'anywhere'
|
|
45636
47457
|
} }, { children: servar.name }))) : null;
|
|
45637
|
-
var styles = useMemo(function () { return applyFieldStyles
|
|
47458
|
+
var styles = useMemo(function () { return applyFieldStyles(element, responsiveStyles); }, [element]);
|
|
45638
47459
|
return (jsx$1(Field, __assign({ element: element, fieldLabel: fieldLabel, responsiveStyles: styles }, props)));
|
|
45639
47460
|
});
|
|
45640
47461
|
});
|
|
@@ -46028,7 +47849,7 @@ function ProgressBarElement(_a) {
|
|
|
46028
47849
|
var element = _a.element, responsiveStyles = _a.responsiveStyles, progress = _a.progress, _d = _a.curDepth, curDepth = _d === void 0 ? 1 : _d, _e = _a.maxDepth, maxDepth = _e === void 0 ? 1 : _e, _f = _a.elementProps, elementProps = _f === void 0 ? {} : _f, children = _a.children;
|
|
46029
47850
|
var styles = useMemo(function () { return applyProgressBarStyles(responsiveStyles); }, [responsiveStyles]);
|
|
46030
47851
|
var userProgress, userSegments;
|
|
46031
|
-
if (progress) {
|
|
47852
|
+
if (![null, undefined].includes(progress)) {
|
|
46032
47853
|
if (typeof progress === 'number') {
|
|
46033
47854
|
userProgress = progress;
|
|
46034
47855
|
}
|
|
@@ -46061,7 +47882,8 @@ var shimmerFields = [
|
|
|
46061
47882
|
'select',
|
|
46062
47883
|
'button_group',
|
|
46063
47884
|
'slider',
|
|
46064
|
-
'rating'
|
|
47885
|
+
'rating',
|
|
47886
|
+
'table_element'
|
|
46065
47887
|
];
|
|
46066
47888
|
var shimmer = keyframes$1(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 100% {\n transform: translateX(100%);\n }\n"], ["\n 100% {\n transform: translateX(100%);\n }\n"])));
|
|
46067
47889
|
var shimmerStyles = {
|
|
@@ -46080,8 +47902,8 @@ var shimmerStyles = {
|
|
|
46080
47902
|
animation: "".concat(shimmer, " 5s infinite")
|
|
46081
47903
|
}
|
|
46082
47904
|
};
|
|
46083
|
-
function
|
|
46084
|
-
var type =
|
|
47905
|
+
function applyStyles(element, styles) {
|
|
47906
|
+
var type = element._type;
|
|
46085
47907
|
styles.addTargets('fc', 'sub-fc', 'field');
|
|
46086
47908
|
styles.applyFontStyles('fc', false, true);
|
|
46087
47909
|
switch (type) {
|
|
@@ -46153,11 +47975,11 @@ function applyFieldStyles(field, styles) {
|
|
|
46153
47975
|
}
|
|
46154
47976
|
return styles;
|
|
46155
47977
|
}
|
|
46156
|
-
function
|
|
47978
|
+
function ElementSkeleton(_a) {
|
|
46157
47979
|
var _b, _c, _d;
|
|
46158
47980
|
var responsiveStyles = _a.responsiveStyles, element = _a.element;
|
|
46159
|
-
var type = element.
|
|
46160
|
-
var styles = useMemo(function () { return
|
|
47981
|
+
var type = element._type;
|
|
47982
|
+
var styles = useMemo(function () { return applyStyles(element, responsiveStyles); }, [element, responsiveStyles]);
|
|
46161
47983
|
var renderPinInput = function () {
|
|
46162
47984
|
var maxLength = element.servar.max_length || 6;
|
|
46163
47985
|
var pinDivs = [];
|
|
@@ -46181,6 +48003,15 @@ function FieldSkeleton(_a) {
|
|
|
46181
48003
|
else if (type === 'qr_scanner') {
|
|
46182
48004
|
heightAdjust.height = '166px'; // hardcode qr scanner height
|
|
46183
48005
|
}
|
|
48006
|
+
if (!element.servar) {
|
|
48007
|
+
return (jsx$1("div", __assign({ css: {
|
|
48008
|
+
maxWidth: '100%',
|
|
48009
|
+
width: '100%',
|
|
48010
|
+
height: '100%',
|
|
48011
|
+
position: 'relative',
|
|
48012
|
+
boxSizing: 'border-box'
|
|
48013
|
+
} }, { children: jsx$1("div", { css: __assign(__assign({ width: '100%', boxSizing: 'border-box' }, heightAdjust), shimmerStyles) }) })));
|
|
48014
|
+
}
|
|
46184
48015
|
return (jsx$1("div", __assign({ css: __assign({ maxWidth: '100%', width: '100%', height: '100%', position: 'relative', boxSizing: 'border-box' }, styles.getTarget('fc')) }, { children: type === 'pin_input' ? (jsx$1("div", __assign({ css: {
|
|
46185
48016
|
display: 'flex',
|
|
46186
48017
|
alignItems: 'center',
|
|
@@ -46189,12 +48020,14 @@ function FieldSkeleton(_a) {
|
|
|
46189
48020
|
}
|
|
46190
48021
|
var templateObject_1;
|
|
46191
48022
|
|
|
48023
|
+
var TableElement = lazy(function () { return import(/* webpackChunkName: "TableElement" */ './fthry_index.BAhh3Pz6.js'); });
|
|
46192
48024
|
var Basic = {
|
|
46193
48025
|
ImageElement: ImageElement,
|
|
46194
48026
|
VideoElement: VideoElement,
|
|
46195
48027
|
TextElement: TextElement,
|
|
46196
48028
|
ButtonElement: ButtonElement,
|
|
46197
|
-
ProgressBarElement: ProgressBarElement
|
|
48029
|
+
ProgressBarElement: ProgressBarElement,
|
|
48030
|
+
TableElement: TableElement
|
|
46198
48031
|
};
|
|
46199
48032
|
var Elements = __assign(__assign({}, Basic), Fields);
|
|
46200
48033
|
Object.entries(Elements).map(function (_a) {
|
|
@@ -46205,7 +48038,7 @@ Object.entries(Elements).map(function (_a) {
|
|
|
46205
48038
|
var responsiveStyles = useMemo(function () {
|
|
46206
48039
|
return new ResponsiveStyles(element, ['container'], !componentOnly, formSettings === null || formSettings === void 0 ? void 0 : formSettings.mobileBreakpoint);
|
|
46207
48040
|
}, [element, componentOnly, formSettings]);
|
|
46208
|
-
var featheryElement = (jsx$1(Suspense, __assign({ fallback: jsx$1(
|
|
48041
|
+
var featheryElement = (jsx$1(Suspense, __assign({ fallback: jsx$1(ElementSkeleton, { element: element, responsiveStyles: responsiveStyles }) }, { children: jsx$1(Element, __assign({ element: element, responsiveStyles: responsiveStyles }, props)) })));
|
|
46209
48042
|
var e = onView ? (jsx$1(InView, __assign({ onChange: onView }, { children: featheryElement }))) : (featheryElement);
|
|
46210
48043
|
if (componentOnly) {
|
|
46211
48044
|
return (jsxs(Fragment, { children: [children, e] }));
|
|
@@ -46484,4 +48317,4 @@ var Feathery = {
|
|
|
46484
48317
|
renderAt: renderAt
|
|
46485
48318
|
};
|
|
46486
48319
|
|
|
46487
|
-
export {
|
|
48320
|
+
export { next as $, countryData as A, stringify$2 as B, rulesheet as C, DROPDOWN_Z_INDEX as D, ErrorInput as E, Fragment as F, Global as G, COMMENT as H, middleware as I, combine as J, match as K, serialize as L, copy as M, replace as N, MOZ as O, MS as P, KEYFRAMES as Q, RULESET as R, DECLARATION as S, dealloc as T, alloc as U, hash as V, WEBKIT as W, charat as X, strlen as Y, indexof as Z, __assign as _, jsxs as a, token as a0, from as a1, peek as a2, delimit as a3, slice as a4, position as a5, compile as a6, isEmptyArray as a7, toList as a8, useThumbnailData as a9, setFieldValues as aA, getFieldValues as aB, renderAt as aC, LoginForm as aD, useAuthClient as aE, Feathery as aF, StyledContainer as aG, downloadFile as aa, CloseIcon as ab, justRemove as ac, getStripe as ad, filterKeys as ae, ERROR_COLOR as af, authState as ag, firebaseSMSCountries as ah, phoneLibPromise as ai, isNum as aj, loadQRScanner as ak, throttle as al, qrPromise as am, devicePixelRatio as an, toBase64 as ao, MODAL_Z_INDEX as ap, dataURLToFile as aq, cls as ar, getFieldValue$1 as as, emailPatternStr as at, replaceTextVariables as au, ReactForm as av, Elements as aw, init as ax, updateUserId as ay, updateTheme as az, __read as b, fieldValues as c, __values as d, __spreadArray as e, featheryDoc as f, getDefaultExportFromCjs as g, hoverStylesGuard as h, iosScrollOnFocus as i, jsx$1 as j, __awaiter$2 as k, __generator as l, FeatheryClient as m, debounce as n, imgMaxSizeStyles as o, noTextSelectStyles as p, FORM_Z_INDEX as q, resetStyles as r, stringifyWithNull as s, featheryWindow as t, useBorder as u, css as v, __makeTemplateObject as w, isMobile as x, __rest$1 as y, formatDateString as z };
|