UNPKG

goobs-frontend

Version:

A comprehensive React-based libary for building modern web applications

1,330 lines 2.52 MB
'use client'; import { n as Fd, r as Xa, t as x } from "./rolldown-runtime-DkpYurw3.js"; import Ue, { createContext as ro, forwardRef as Ke, isValidElement as ps, memo as Ud, useCallback as H, useContext as ao, useEffect as he, useId as ca, useImperativeHandle as gs, useMemo as xe, useRef as _e, useState as $ } from "react"; import { Fragment as rt, jsx as o, jsxs as v } from "react/jsx-runtime"; import no, { createPortal as di } from "react-dom"; var zd = "_button_s5151_11", Hd = "_selected_s5151_78", Gd = "_iconAbove_s5151_95", Vd = "_iconWrapper_s5151_106", Yd = "_buttonGroup_s5151_227", Tn = { button: zd, selected: Hd, iconAbove: Gd, iconWrapper: Vd, buttonGroup: Yd }; function wt(e) { if (!(typeof window > "u")) try { window.__diag?.push?.(e); } catch { } } var qd = ({ value: e, exclusive: r, onChange: a, children: t, styles: n }) => { const i = n?.theme || "sacred", s = Ue.Children.map(t, (c) => { if (Ue.isValidElement(c)) { const l = (c.props.value || "") === e; return Ue.cloneElement(c, { ...c.props, styles: { ...c.props.styles, ...n, theme: i }, onClick: (d) => { r && a(d, c.props.value || ""), c.props.onClick && c.props.onClick(d); }, selected: l }); } return c; }); return /* @__PURE__ */ o("div", { className: Tn.buttonGroup, "data-theme": i, children: s }); }; function $d(e) { return e ? e === "destructive" ? { backgroundColor: "rgba(220, 53, 69, 0.15)", borderColor: "rgba(220, 53, 69, 0.5)", color: "#FF6B6B", hoverBackgroundColor: "rgba(220, 53, 69, 0.25)" } : e === "secondary" ? { backgroundColor: "rgba(255, 255, 255, 0.05)", borderColor: "rgba(255, 255, 255, 0.2)", color: "rgba(255, 255, 255, 0.85)", hoverBackgroundColor: "rgba(255, 255, 255, 0.1)" } : { backgroundColor: "rgba(255, 215, 0, 0.15)", borderColor: "rgba(255, 215, 0, 0.5)", color: "#FFD700", hoverBackgroundColor: "rgba(255, 215, 0, 0.25)" } : {}; } var nt = Ke(({ text: e, icon: r, styles: a, onClick: t, selected: n, action: i, subject: s, variant: c, ...l }, d) => { const u = xe(() => { const { sacredtheme: C, ...E } = l; return E; }, [l]); a = c ? { ...$d(c), ...a } : a; const _ = a?.disabled || u.disabled, p = a?.iconLocation || "left", g = a?.theme || "sacred", S = H((C) => { _ || (wt({ type: "action.invoke", action: i ?? "click", ...s !== void 0 && { subject: s } }), t && t(C)); }, [ _, t, i, s ]), f = a?.outline === !0 ? "1px solid currentcolor" : a?.outline === !1 ? "none" : a?.outline || void 0, m = {}; a?.width && (m.width = a.width), a?.minWidth && (m.minWidth = a.minWidth), a?.maxWidth && (m.maxWidth = a.maxWidth), a?.height && (m.height = a.height), a?.minHeight && (m.minHeight = a.minHeight), a?.padding && (m.padding = a.padding), a?.margin && (m.margin = a.margin), a?.marginTop && (m.marginTop = a.marginTop), a?.marginBottom && (m.marginBottom = a.marginBottom), a?.marginLeft && (m.marginLeft = a.marginLeft), a?.marginRight && (m.marginRight = a.marginRight), a?.fontSize && (m.fontSize = a.fontSize), a?.fontWeight && (m.fontWeight = a.fontWeight), a?.fontFamily && (m.fontFamily = a.fontFamily), a?.letterSpacing && (m.letterSpacing = a.letterSpacing), a?.textTransform && (m.textTransform = a.textTransform), a?.whiteSpace && (m.whiteSpace = a.whiteSpace), a?.color && (m.color = a.color), a?.backgroundColor && (m.backgroundColor = a.backgroundColor), a?.background && (m.background = a.background), a?.border && (m.border = a.border), a?.borderWidth && (m.borderWidth = a.borderWidth), a?.borderColor && (m.borderColor = a.borderColor), a?.borderRadius && (m.borderRadius = a.borderRadius), a?.borderRightWidth && (m.borderRightWidth = a.borderRightWidth), a?.borderRightStyle && (m.borderRightStyle = a.borderRightStyle), a?.borderRightColor && (m.borderRightColor = a.borderRightColor), a?.boxShadow && (m.boxShadow = a.boxShadow), a?.textShadow && (m.textShadow = a.textShadow), f && (m.outline = f), a?.hoverBackgroundColor && (m["--btn-hover-bg"] = a.hoverBackgroundColor), a?.hoverBorderColor && (m["--btn-hover-border"] = a.hoverBorderColor), a?.hoverBoxShadow && (m["--btn-hover-shadow"] = a.hoverBoxShadow), a?.hoverTransform && (m["--btn-hover-transform"] = a.hoverTransform), a?.flex && (m.flex = a.flex), a?.opacity !== void 0 && (m.opacity = a.opacity), a?.cursor && (m.cursor = a.cursor), a?.display && (m.display = a.display), a?.position && (m.position = a.position), a?.textAlign && (m.textAlign = a.textAlign), a?.verticalAlign && (m.verticalAlign = a.verticalAlign), a?.alignSelf && (m.alignSelf = a.alignSelf), a?.alignItems && (m.alignItems = a.alignItems), a?.justifyContent && (m.justifyContent = a.justifyContent), a?.flexDirection && (m.flexDirection = a.flexDirection), a?.flexShrink !== void 0 && (m.flexShrink = a.flexShrink), a?.flexGrow !== void 0 && (m.flexGrow = a.flexGrow), a?.flexBasis !== void 0 && (m.flexBasis = a.flexBasis), a?.flexWrap && (m.flexWrap = a.flexWrap), a?.gap !== void 0 && (m.gap = a.gap), a?.rowGap !== void 0 && (m.rowGap = a.rowGap), a?.columnGap !== void 0 && (m.columnGap = a.columnGap), a?.transition && (m.transition = a.transition), a?.transform && (m.transform = a.transform), a?.zIndex !== void 0 && (m.zIndex = a.zIndex), a?.top !== void 0 && (m.top = a.top), a?.right !== void 0 && (m.right = a.right), a?.bottom !== void 0 && (m.bottom = a.bottom), a?.left !== void 0 && (m.left = a.left), a?.overflow && (m.overflow = a.overflow), a?.overflowX && (m.overflowX = a.overflowX), a?.overflowY && (m.overflowY = a.overflowY), a?.textOverflow && (m.textOverflow = a.textOverflow), a?.lineHeight !== void 0 && (m.lineHeight = a.lineHeight), a?.borderStyle && (m.borderStyle = a.borderStyle), a?.borderTop && (m.borderTop = a.borderTop), a?.borderBottom && (m.borderBottom = a.borderBottom), a?.borderLeft && (m.borderLeft = a.borderLeft), a?.borderRight && (m.borderRight = a.borderRight), a?.pointerEvents && (m.pointerEvents = a.pointerEvents), a?.userSelect && (m.userSelect = a.userSelect), a?.visibility && (m.visibility = a.visibility), a?.textDecoration && (m.textDecoration = a.textDecoration), a?.textIndent !== void 0 && (m.textIndent = a.textIndent), a?.wordBreak && (m.wordBreak = a.wordBreak), a?.wordSpacing !== void 0 && (m.wordSpacing = a.wordSpacing), a?.fontStyle && (m.fontStyle = a.fontStyle); const h = [Tn.button]; p === "above" && h.push(Tn.iconAbove), n && h.push(Tn.selected); const b = xe(() => r ? /* @__PURE__ */ o("span", { className: Tn.iconWrapper, children: r }) : null, [r]); return /* @__PURE__ */ v("button", { ref: d, className: h.join(" "), "data-component": "Button", "data-theme": g, "data-action": i, "data-subject": s, "data-variant": c, style: m, disabled: _, onClick: S, ...u, children: [ p === "above" && b, p === "left" && b, e && /* @__PURE__ */ o("span", { children: e }), p === "right" && b ] }); }); nt.displayName = "Button"; var Wd = "_spinner_r9khf_8", Kd = "_saveButtonSpin_r9khf_1", Qd = { spinner: Wd, saveButtonSpin: Kd }, Zd = () => /* @__PURE__ */ o("span", { className: Qd.spinner, "aria-hidden": "true", "data-save-spinner": "true" }), Xd = ({ valid: e, pending: r, onSave: a, label: t = "Save", pendingLabel: n = "Saving…", subject: i, styles: s, ...c }) => { const l = !e || r, d = { ...s, disabled: l }; return /* @__PURE__ */ o(nt, { action: "save", variant: "primary", text: r ? n : t, ...r && { icon: /* @__PURE__ */ o(Zd, {}) }, disabled: l, onClick: a, styles: d, "data-save-button": "true", ...r && { "data-save-pending": "true" }, ...i !== void 0 && { subject: i }, ...c }); }; Xd.displayName = "SaveButton"; var io = Ke(({ size: e = "medium", color: r = "default", children: a, styles: t, ...n }, i) => { const s = { xsmall: { width: "20px", height: "20px", padding: "2px" }, small: { width: "32px", height: "32px", padding: "4px" }, medium: { width: "40px", height: "40px", padding: "8px" }, large: { width: "48px", height: "48px", padding: "12px" } }, c = t?.theme === "dark", l = t?.theme === "sacred" ? { primary: { backgroundColor: "transparent", color: "#FFD700" }, secondary: { backgroundColor: "transparent", color: "#FFD700" }, success: { backgroundColor: "transparent", color: "#10B981" }, error: { backgroundColor: "transparent", color: "#EF4444" }, info: { backgroundColor: "transparent", color: "#3B82F6" }, warning: { backgroundColor: "transparent", color: "#F59E0B" }, default: { backgroundColor: "transparent", color: "#FFD700" } } : { primary: { backgroundColor: "#1976d2", color: "white" }, secondary: { backgroundColor: "#9c27b0", color: "white" }, success: { backgroundColor: "#2e7d32", color: "white" }, error: { backgroundColor: "#d32f2f", color: "white" }, info: { backgroundColor: "#0288d1", color: "white" }, warning: { backgroundColor: "#ed6c02", color: "white" }, default: { backgroundColor: "transparent", color: c ? "var(--goobs-dark-text)" : "inherit" } }, d = r === "default" && t?.theme !== "sacred", u = c ? "var(--goobs-dark-border)" : "rgba(0, 0, 0, 0.12)"; return /* @__PURE__ */ o(nt, { ref: i, icon: a, styles: { ...s[e], ...l[r], borderRadius: "50%", border: d ? `1px solid ${u}` : "none", display: "flex", alignItems: "center", justifyContent: "center", minWidth: "auto", ...t, ...t?.theme === "sacred" && { outline: !1, border: "none", borderWidth: "0", borderStyle: "none", borderColor: "transparent", boxShadow: "none", backgroundColor: "transparent", hoverBackgroundColor: "rgba(255, 215, 0, 0.1)" } }, ...n, "data-component": "IconButton" }); }); io.displayName = "IconButton"; var jd = "_root_1vij0_42", Jd = "_outlined_1vij0_96", eu = "_cinzelH1_1vij0_141", tu = "_cinzelH2_1vij0_144", ru = "_cinzelH3_1vij0_147", au = "_cinzelH4_1vij0_150", nu = "_cinzelH5_1vij0_153", iu = "_cinzelH6_1vij0_156", ou = "_cinzelBase_1vij0_159", su = "_merriHelper_1vij0_164", cu = "_h1_1vij0_169", lu = "_h2_1vij0_172", du = "_h3_1vij0_175", uu = "_h4_1vij0_178", _u = "_h5_1vij0_181", mu = "_h6_1vij0_14", pu = "_body2_1vij0_189", Ut = { root: jd, outlined: Jd, cinzelH1: eu, cinzelH2: tu, cinzelH3: ru, cinzelH4: au, cinzelH5: nu, cinzelH6: iu, cinzelBase: ou, merriHelper: su, h1: cu, h2: lu, h3: du, h4: uu, h5: _u, h6: mu, body2: pu }; function gu(e) { const r = e.toLowerCase(); return r.includes("cinzel") ? r.includes("h1") ? { className: Ut.cinzelH1 ?? "", fontWeight: 700, fontFamily: '"Cinzel", serif' } : r.includes("h2") ? { className: Ut.cinzelH2 ?? "", fontWeight: 700, fontFamily: '"Cinzel", serif' } : r.includes("h3") ? { className: Ut.cinzelH3 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("h4") ? { className: Ut.cinzelH4 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("h5") ? { className: Ut.cinzelH5 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("h6") ? { className: Ut.cinzelH6 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : { className: Ut.cinzelBase ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("merri") ? r.includes("helper") || r.includes("footer") ? { className: Ut.merriHelper ?? "", fontWeight: 400, fontFamily: '"Merriweather", serif', merriColorNonSacred: "rgba(255, 255, 255, 0.6)", merriColorSacred: "rgba(255, 215, 0, 0.7)" } : r.includes("h1") ? { className: Ut.h1 ?? "", fontWeight: 700, fontFamily: '"Merriweather", serif' } : r.includes("h2") ? { className: Ut.h2 ?? "", fontWeight: 700, fontFamily: '"Merriweather", serif' } : r.includes("h3") ? { className: Ut.h3 ?? "", fontWeight: 700, fontFamily: '"Merriweather", serif' } : r.includes("h4") ? { className: Ut.h4 ?? "", fontWeight: 700, fontFamily: '"Merriweather", serif' } : r.includes("h5") ? { className: Ut.h5 ?? "", fontWeight: 700, fontFamily: '"Merriweather", serif' } : r.includes("h6") ? { className: Ut.h6 ?? "", fontWeight: 700, fontFamily: '"Merriweather", serif' } : { className: "", fontWeight: 400, fontFamily: '"Merriweather", serif' } : r.includes("h1") ? { className: Ut.h1 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("h2") ? { className: Ut.h2 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("h3") ? { className: Ut.h3 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("h4") ? { className: Ut.h4 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("h5") ? { className: Ut.h5 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("h6") ? { className: Ut.h6 ?? "", fontWeight: 600, fontFamily: '"Cinzel", serif' } : r.includes("body2") || r.includes("small") ? { className: Ut.body2 ?? "", fontWeight: 400 } : { className: "", fontWeight: 400 }; } var zt = ({ text: e, children: r, variant: a = "body1", color: t, fontSize: n, fontFamily: i, fontWeight: s, textAlign: c = "left", marginBottom: l, marginTop: d, width: u, outline: _, gutterBottom: p, styles: g }) => { const S = g?.theme === "sacred", f = g?.variant || a, m = g?.fontSize || n, h = g?.fontFamily || i || '"Crimson Text", serif', b = g?.fontWeight || s, C = g?.textAlign || c, E = g?.marginBottom || l || "0", N = g?.marginTop || d || "0", w = g?.marginLeft || "0", T = g?.marginRight || "0", O = g?.margin, A = g?.padding, D = g?.gutterBottom ?? p ?? !1, L = g?.outline ?? _, k = L === !0, M = typeof L == "string" ? L : void 0, B = String(f).toLowerCase().includes("h"), q = gu(String(f)), V = S ? q.merriColorSacred : q.merriColorNonSacred, U = g?.color || t, Z = V ?? U, z = q.fontFamily || (B ? '"Cinzel", serif' : h), W = b || q.fontWeight, F = {}, y = (K, X) => { X !== void 0 && X !== "" && (F[K] = X); }; y("--typography-color", Z), y("--typography-font-family", z), y("--typography-font-weight", W), y("--typography-font-size", m), y("--typography-text-align", C), y("--typography-line-height", g?.lineHeight), y("--typography-letter-spacing", g?.letterSpacing), y("--typography-text-shadow", g?.textShadow), y("--typography-font-style", g?.fontStyle), y("--typography-text-transform", g?.textTransform), y("--typography-white-space", g?.whiteSpace), y("--typography-opacity", g?.opacity), y("--typography-max-width", g?.maxWidth), y("--typography-min-width", g?.minWidth), y("--typography-background-color", g?.backgroundColor), y("--typography-border-left", g?.borderLeft), y("--typography-flex", g?.flex), y("--typography-align-self", g?.alignSelf), y("--typography-width", g?.width || u), y("--typography-outline", M), y("--typography-border-radius", g?.borderRadius), y("--typography-overflow", g?.overflow), y("--typography-text-overflow", g?.textOverflow), O ? F.margin = O : (F.marginTop = N, F.marginBottom = D ? "0.35em" : E, F.marginLeft = w, F.marginRight = T), A ? F.padding = A : (g?.paddingLeft !== void 0 && (F.paddingLeft = g.paddingLeft), g?.paddingRight !== void 0 && (F.paddingRight = g.paddingRight), g?.paddingTop !== void 0 && (F.paddingTop = g.paddingTop), g?.paddingBottom !== void 0 && (F.paddingBottom = g.paddingBottom)); const P = [ Ut.root, q.className, k ? Ut.outlined : "" ].filter(Boolean).join(" "), Y = e || r; return /* @__PURE__ */ o("span", { className: P, "data-component": "Typography", "data-theme": g?.theme, style: F, children: Y }); }, hu = "_wrapper_yy6cr_23", bu = "_svg_yy6cr_37", R = { wrapper: hu, svg: bu }, hs = ({ styles: e, style: r = {}, ...a }) => { const t = e?.theme || "light", n = { ...e?.padding && { padding: e.padding }, ...e?.margin && { margin: e.margin } }, i = { ...e?.color && { color: e.color }, ...e?.backgroundColor && { backgroundColor: e.backgroundColor }, ...e?.borderRadius && { borderRadius: e.borderRadius }, ...e?.filter && { filter: e.filter }, ...e?.transform && { transform: e.transform }, ...e?.boxShadow && { boxShadow: e.boxShadow }, ...e?.size && { width: e.size, height: e.size }, ...r }; return /* @__PURE__ */ o("div", { className: R.wrapper, "data-theme": t, "data-disabled": e?.disabled ? "true" : void 0, style: n, children: /* @__PURE__ */ v("svg", { className: R.svg, xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor", style: i, ...a, children: [/* @__PURE__ */ o("path", { d: "M0 0h24v24H0V0z", fill: "none" }), /* @__PURE__ */ o("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z" })] }) }); }, oo = Ue.createContext(null); function ui() { const e = Ue.useContext(oo); if (!e) throw new Error("useFormContext must be used inside <Form>. Wrap the consuming component in <Form>...</Form>."); return e; } function Oa() { return Ue.useContext(oo); } function ot({ name: e, value: r, onChange: a, onBlur: t, adapter: n }) { const i = Oa(), s = !!(i && e && r === void 0), c = H((u) => { !i || !e || (i.engine.setValue(e, n ? n.payloadToStore(u) : u), a?.(u)); }, [ i, e, n, a ]), l = H(() => { !i || !e || (i.engine.setTouched(e, !0), t?.()); }, [ i, e, t ]); if (!s || !i || !e) return { value: r, onChange: a, onBlur: t }; const d = i.engine.getValue(e); return { value: n ? n.valueFromStore(d) : d, onChange: c, onBlur: l }; } var fu = "_root_11tsf_21", Su = "_mainContent_11tsf_219", vu = "_inputsRow_11tsf_227", Eu = "_inputGroup_11tsf_233", Cu = "_input_11tsf_227", Tu = "_statusIndicator_11tsf_278", Nu = "_buttonContainer_11tsf_293", wu = "_successContainer_11tsf_305", Ru = "_successMessage_11tsf_330", Iu = "_bottomGlyphContainer_11tsf_350", Ou = "_bottomGlyph_11tsf_350", vr = { root: fu, mainContent: Su, inputsRow: vu, inputGroup: Eu, input: Cu, statusIndicator: Tu, buttonContainer: Nu, successContainer: wu, successMessage: Ru, bottomGlyphContainer: Iu, bottomGlyph: Ou, "cci-sacred-pulse": "_cci-sacred-pulse_11tsf_1" }, xu = () => null, Au = () => /* @__PURE__ */ o("div", { className: vr.bottomGlyphContainer, children: Array.from({ length: 3 }).map((e, r) => /* @__PURE__ */ o("span", { className: vr.bottomGlyph, children: "." }, r)) }), bs = ({ codeLength: e = 6, isValid: r, onChange: a, value: t, name: n, dataFieldName: i, "aria-label": s, "aria-required": c, "aria-invalid": l, codeSent: d = !1, onVerify: u, onSendResend: _, onDisableVerification: p, verifyButtonProps: g = {}, sendResendButtonProps: S = {}, disableVerificationButtonProps: f = {}, showActionButtons: m = !1, showSendResendButton: h = !0, successMessage: b = "Verification Successful", showSuccessState: C = !1, styles: E }) => { const N = Oa(), { value: w, onChange: T, onBlur: O } = ot({ name: n, value: t, onChange: a }), A = T !== void 0 && w !== void 0, D = w ?? "", [L, k] = $(D), M = _e(Array.from({ length: e }, () => null)), B = _e(!1), q = A || a !== void 0, V = q ? D : L, U = E?.theme ?? "light", Z = U === "sacred", z = E?.disabled, W = { ...E?.width !== void 0 && { width: E.width }, ...E?.maxWidth !== void 0 && { maxWidth: E.maxWidth }, ...E?.minWidth !== void 0 && { minWidth: E.minWidth }, ...E?.height !== void 0 && { height: E.height }, ...E?.maxHeight !== void 0 && { maxHeight: E.maxHeight }, ...E?.minHeight !== void 0 && { minHeight: E.minHeight }, ...E?.margin !== void 0 && { margin: E.margin }, ...E?.marginTop !== void 0 && { marginTop: E.marginTop }, ...E?.marginBottom !== void 0 && { marginBottom: E.marginBottom }, ...E?.marginLeft !== void 0 && { marginLeft: E.marginLeft }, ...E?.marginRight !== void 0 && { marginRight: E.marginRight }, ...E?.padding !== void 0 && { padding: E.padding }, ...E?.backgroundColor !== void 0 && { background: E.backgroundColor }, ...E?.backgroundImage !== void 0 && { backgroundImage: E.backgroundImage }, ...E?.borderColor !== void 0 && { borderColor: E.borderColor }, ...E?.borderWidth !== void 0 && { borderWidth: E.borderWidth }, ...E?.borderRadius !== void 0 && { borderRadius: E.borderRadius }, ...E?.boxShadow !== void 0 && { boxShadow: E.boxShadow }, ...E?.gap !== void 0 && { "--cci-gap": E.gap }, ...E?.inputGap !== void 0 && { "--cci-input-gap": E.inputGap } }; he(() => { if (!B.current) { const J = setTimeout(() => { M.current[0] && !M.current[0].value && (M.current[0].focus(), B.current = !0); }, 100); return () => clearTimeout(J); } }, []); const F = H((J) => { if (A) { T?.(J); return; } q || k(J), a?.(J); }, [ A, T, q, a ]), y = H((J, ne) => { const fe = J.target.value; if (!/^\d*$/.test(fe)) return; const se = V.padEnd(e, "").split(""); fe.length > 1 ? fe.split("").forEach((Ie, be) => { ne + be < e && (se[ne + be] = Ie); }) : se[ne] = fe.charAt(fe.length - 1); const Se = se.join("").trimEnd(); F(Se), fe && ne < e - 1 && M.current[ne + 1]?.focus(); }, [ V, e, F ]), P = H((J, ne) => { const fe = () => { if (ne > 0) { J.preventDefault(), M.current[ne - 1]?.focus(); const Se = V.split(""); Se[ne - 1] = ""; const Ie = Se.join("").trimEnd(); F(Ie); } }, se = () => { const Se = V.split(""); Se[ne] = ""; const Ie = Se.join("").trimEnd(); F(Ie); }; switch (J.key) { case "Backspace": J.currentTarget.value === "" ? fe() : se(); break; case "Delete": se(); break; case "ArrowLeft": ne > 0 && (J.preventDefault(), M.current[ne - 1]?.focus()); break; case "ArrowRight": ne < e - 1 && (J.preventDefault(), M.current[ne + 1]?.focus()); break; case "Enter": ne === e - 1 && V.length >= e && u && (J.preventDefault(), u()); break; default: if (/^\d$/.test(J.key)) { J.preventDefault(); const Se = V.padEnd(e, "").split(""); Se[ne] = J.key; const Ie = Se.join("").trimEnd(); F(Ie), ne < e - 1 && M.current[ne + 1]?.focus(); } } }, [ V, e, F, u ]), Y = H((J, ne) => { J.preventDefault(); const fe = (J.clipboardData.getData("text") || "").replace(/\D/g, "").slice(0, e - ne); if (fe) { const se = V.padEnd(e, "").split(""); for (let be = 0; be < fe.length; be++) ne + be < e && (se[ne + be] = fe.charAt(be)); const Se = se.join("").trimEnd(); F(Se); const Ie = Math.min(ne + fe.length, e - 1); M.current[Ie || 0]?.focus(); } }, [ V, e, F ]), K = V.padEnd(e, "").split(""), X = V.length >= e, re = i ?? n, te = V.length > 0, ee = N && n ? N.engine.getError(n) : void 0, oe = { "data-component": "ConfirmationCodeInput", ...re && { "data-field-name": re }, "data-filled": te ? "true" : void 0, ...ee && { "data-error": "true" } }; return C ? /* @__PURE__ */ v("div", { className: vr.successContainer, "data-theme": U, ...oe, children: [ /* @__PURE__ */ o(hs, { style: { fontSize: "var(--cci-success-icon-size)", color: "var(--cci-success-icon-color)", filter: "var(--cci-success-icon-filter)" } }), /* @__PURE__ */ o("h3", { className: vr.successMessage, children: b }), /* @__PURE__ */ o("div", { className: vr.buttonContainer, children: /* @__PURE__ */ o(nt, { text: "Disable Verification", styles: { theme: E?.theme || "light", width: "100%", height: "40px" }, ...f, onClick: () => { p(); } }) }) ] }) : /* @__PURE__ */ v("div", { className: vr.root, "data-theme": U, ...z && { "data-disabled": "true" }, ...oe, style: W, role: "group", "aria-label": s || "Confirmation Code", children: [ Z && /* @__PURE__ */ o(xu, {}), /* @__PURE__ */ v("div", { className: vr.mainContent, children: [/* @__PURE__ */ v("div", { className: vr.inputsRow, children: [/* @__PURE__ */ o("div", { className: vr.inputGroup, children: Array.from({ length: e }).map((J, ne) => /* @__PURE__ */ o("input", { ref: (fe) => { M.current[ne] = fe; }, type: "text", inputMode: "numeric", pattern: "[0-9]*", maxLength: 1, value: K[ne] || "", onChange: (fe) => y(fe, ne), onKeyDown: (fe) => P(fe, ne), onPaste: (fe) => Y(fe, ne), onBlur: () => O?.(), "aria-label": `${s || "Confirmation Code"} digit ${ne + 1}`, "aria-required": c, "aria-invalid": l, disabled: z, className: vr.input }, ne)) }), /* @__PURE__ */ o("div", { className: vr.statusIndicator, "data-valid": r ? "true" : "false", role: "status", "aria-label": r ? "Code is valid" : "Code is invalid" })] }), m && /* @__PURE__ */ v("div", { className: vr.buttonContainer, children: [h && /* @__PURE__ */ o(nt, { text: d ? "Resend Code" : "Send Code", styles: { theme: E?.theme || "light", width: "180px", height: "44px" }, ...S, onClick: () => _ && void _() }), /* @__PURE__ */ o(nt, { text: "Verify", styles: { theme: E?.theme || "light", width: "180px", height: "44px" }, ...g, onClick: () => u && void u(), disabled: !X })] })] }), Z && /* @__PURE__ */ o(Au, {}) ] }); }, Du = "_formControl_1878j_4", Mu = "_formLabel_1878j_129", ku = "_optionLabel_1878j_151", Lu = "_input_1878j_167", Pu = "_radioSpan_1878j_174", yu = "_radioOuter_1878j_186", Bu = "_radioInner_1878j_52", Fu = "_text_1878j_265", ra = { formControl: Du, formLabel: Mu, optionLabel: ku, input: Lu, radioSpan: Pu, radioOuter: yu, radioInner: Bu, text: Fu }, Uu = (e) => { if (!e) return {}; const r = {}; return e.labelColor && (r["--rg-label-color-override"] = e.labelColor), e.labelFontSize && (r["--rg-label-font-size-override"] = e.labelFontSize), e.labelFontWeight !== void 0 && (r["--rg-label-font-weight-override"] = String(e.labelFontWeight)), e.labelFontFamily && (r["--rg-label-font-family-override"] = e.labelFontFamily), e.marginBottom && (r["--rg-label-margin-bottom"] = e.marginBottom), e.padding && (r["--rg-option-padding-override"] = e.padding), e.radioSize && (r["--rg-radio-size-override"] = e.radioSize), e.radioOuterBorderWidth && (r["--rg-radio-border-width-override"] = e.radioOuterBorderWidth), e.radioOuterBorderColor && (r["--rg-radio-border-color-override"] = e.radioOuterBorderColor), e.radioHoverBorderColor && (r["--rg-radio-hover-border-color-override"] = e.radioHoverBorderColor), e.radioHoverBackgroundColor && (r["--rg-radio-hover-bg-override"] = e.radioHoverBackgroundColor), e.radioInnerColor && (r["--rg-radio-inner-color-override"] = e.radioInnerColor), e.textColor && (r["--rg-text-color-override"] = e.textColor), e.textFontSize && (r["--rg-text-font-size-override"] = e.textFontSize), e.textFontFamily && (r["--rg-text-font-family-override"] = e.textFontFamily), e.textHoverColor && (r["--rg-text-hover-color-override"] = e.textHoverColor), e.transitionDuration && (r["--rg-transition"] = `all ${e.transitionDuration} ${e.transitionEasing || "cubic-bezier(0.4, 0, 0.2, 1)"}`), r; }, zu = ({ label: e, options: r, value: a, defaultValue: t, name: n, labelText: i, dataFieldName: s, onChange: c, styles: l }) => { const [d, u] = $(t), { value: _, onChange: p } = ot({ name: n, value: a }), g = a ?? (_ !== void 0 ? _ : d), S = l?.theme || "light", f = Uu(l), m = (h) => { u(h.target.value), p?.(h.target.value), c && c(h); }; return /* @__PURE__ */ v("div", { className: ra.formControl, "data-component": "RadioGroup", "data-field-name": s ?? n, "data-filled": g !== void 0 && g !== "", "data-inner-dot": l?.radioInnerColor ? "true" : void 0, "data-theme": S, style: f, children: [/* @__PURE__ */ o("label", { id: `${n}-label`, className: ra.formLabel, children: i || e }), /* @__PURE__ */ o("div", { role: "radiogroup", "aria-labelledby": `${n}-label`, children: r.map((h, b) => { const C = g === h.label; return /* @__PURE__ */ v("label", { className: ra.optionLabel, children: [ /* @__PURE__ */ o("input", { type: "radio", name: n, value: h.label, checked: C, className: ra.input, onChange: m }), /* @__PURE__ */ v("span", { className: ra.radioSpan, children: [/* @__PURE__ */ o("span", { className: ra.radioOuter }), /* @__PURE__ */ o("span", { className: ra.radioInner })] }), /* @__PURE__ */ o("span", { className: ra.text, "data-has-color": h.color ? "true" : void 0, style: h.color ? { "--rg-option-color": h.color } : void 0, children: h.label }) ] }, b); }) })] }); }, Hu = "_backdrop_hazww_30", Gu = "_dialog_hazww_58", Vu = "_content_hazww_15", Li = { backdrop: Hu, dialog: Gu, content: Vu }, Yu = () => { const [e, r] = $("desktop"); return he(() => { const a = () => { window.innerWidth < 640 ? r("mobile") : window.innerWidth < 1024 ? r("tablet") : r("desktop"); }; return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a); }, []), e; }, qu = ({ open: e, onClose: r, children: a, styles: t, customDialogStyles: n, dataDialogPaper: i, dataDialog: s, dataSubject: c, ariaLabelledBy: l, ariaDescribedBy: d, ariaLabel: u }) => { const _ = _e(null), p = _e(null), g = Yu(), S = t?.theme === "sacred" ? "sacred" : "light", f = _e(r); he(() => { f.current = r; }, [r]), he(() => { if (!e) return; const T = document.activeElement, O = _.current, A = () => O ? Array.from(O.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter((k) => k.offsetParent !== null) : [], D = A()[0]; D ? D.focus() : O?.focus(); const L = (k) => { if (k.key === "Escape") { f.current(); return; } if (k.key !== "Tab") return; const M = A(); if (M.length === 0) { k.preventDefault(), O?.focus(); return; } const B = M[0], q = M[M.length - 1]; if (!B || !q) return; const V = document.activeElement; k.shiftKey && V === B ? (k.preventDefault(), q.focus()) : !k.shiftKey && V === q && (k.preventDefault(), B.focus()); }; return document.addEventListener("keydown", L), () => { document.removeEventListener("keydown", L), T?.focus?.(); }; }, [e]); const m = _e(!1); if (he(() => { const T = s || c || "dialog"; e && !m.current ? (m.current = !0, wt({ type: "dialog.opened", id: T })) : !e && m.current && (m.current = !1, wt({ type: "dialog.closed", id: T, action: "dismiss" })); }, [ e, s, c ]), he(() => { if (!e) { document.body.style.overflow = ""; return; } document.body.style.overflow = "hidden"; const T = (D) => { const L = p.current ?? _.current?.querySelector("div"); if (L && L.scrollHeight > L.clientHeight) { const k = L.scrollTop < L.scrollHeight - L.clientHeight, M = L.scrollTop > 0; (D.deltaY > 0 && k || D.deltaY < 0 && M) && (L.scrollTop += D.deltaY, D.preventDefault()); } }, O = _.current?.parentElement, A = _.current; return O && O.addEventListener("wheel", T, { passive: !1 }), A && A.addEventListener("wheel", T, { passive: !1 }), () => { document.body.style.overflow = "", O && O.removeEventListener("wheel", T), A && A.removeEventListener("wheel", T); }; }, [e]), !e) return null; const h = () => g === "mobile" ? "95vw" : g === "tablet" ? "80vw" : t?.maxWidth || "600px", b = () => g === "mobile" ? "90vh" : t?.maxHeight || "80vh", C = t?.border ? t.border : t?.borderColor ? `2px solid ${t.borderColor}` : void 0, E = { "--dialog-align": t?.topOffset ? "flex-start" : "center", "--dialog-pad-top": t?.topOffset || "16px", ...t?.backdropBackgroundColor && { "--dialog-backdrop-bg": t.backdropBackgroundColor }, ...t?.backdropFilter && { "--dialog-backdrop-filter": t.backdropFilter } }, N = { "--dialog-max-width": t?.fullWidth ? "100%" : h(), "--dialog-width": t?.fullWidth ? "100%" : t?.width || "100%", "--dialog-max-height": b(), "--dialog-height": t?.height || "auto", ...t?.minHeight && { "--dialog-min-height": t.minHeight }, ...t?.backgroundColor && { "--dialog-bg": t.backgroundColor }, ...C && { "--dialog-border": C }, ...t?.borderRadius && { "--dialog-radius": t.borderRadius }, ...t?.boxShadow && { "--dialog-shadow": t.boxShadow }, ...n }, w = t?.padding ? { "--dialog-content-padding": t.padding } : void 0; return /* @__PURE__ */ o("div", { className: Li.backdrop, "data-theme": S, style: E, onClick: r, "data-dialog-backdrop": "true", children: /* @__PURE__ */ o("div", { ref: _, className: Li.dialog, "data-component": "Dialog", "data-state": "open", "data-theme": S, style: N, onClick: (T) => T.stopPropagation(), role: "dialog", "aria-modal": "true", tabIndex: -1, "aria-labelledby": l, "aria-describedby": d, "aria-label": l ? void 0 : u, "data-dialog-paper": i ? "true" : void 0, "data-dialog": s, "data-subject": c, children: /* @__PURE__ */ o("div", { ref: p, className: Li.content, "data-theme": S, ...w && { style: w }, children: a }) }) }); }, $u = /* @__PURE__ */ x(((e, r) => { function a(G) { return G instanceof Map ? G.clear = G.delete = G.set = function() { throw new Error("map is read-only"); } : G instanceof Set && (G.add = G.clear = G.delete = function() { throw new Error("set is read-only"); }), Object.freeze(G), Object.getOwnPropertyNames(G).forEach((de) => { const Re = G[de], $e = typeof Re; ($e === "object" || $e === "function") && !Object.isFrozen(Re) && a(Re); }), G; } var t = class { constructor(G) { G.data === void 0 && (G.data = {}), this.data = G.data, this.isMatchIgnored = !1; } ignoreMatch() { this.isMatchIgnored = !0; } }; function n(G) { return G.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;"); } function i(G, ...de) { const Re = /* @__PURE__ */ Object.create(null); for (const $e in G) Re[$e] = G[$e]; return de.forEach(function($e) { for (const vt in $e) Re[vt] = $e[vt]; }), Re; } var s = "</span>", c = (G) => !!G.scope, l = (G, { prefix: de }) => { if (G.startsWith("language:")) return G.replace("language:", "language-"); if (G.includes(".")) { const Re = G.split("."); return [`${de}${Re.shift()}`, ...Re.map(($e, vt) => `${$e}${"_".repeat(vt + 1)}`)].join(" "); } return `${de}${G}`; }, d = class { constructor(G, de) { this.buffer = "", this.classPrefix = de.classPrefix, G.walk(this); } addText(G) { this.buffer += n(G); } openNode(G) { if (!c(G)) return; const de = l(G.scope, { prefix: this.classPrefix }); this.span(de); } closeNode(G) { c(G) && (this.buffer += s); } value() { return this.buffer; } span(G) { this.buffer += `<span class="${G}">`; } }, u = (G = {}) => { const de = { children: [] }; return Object.assign(de, G), de; }, _ = class fs { constructor() { this.rootNode = u(), this.stack = [this.rootNode]; } get top() { return this.stack[this.stack.length - 1]; } get root() { return this.rootNode; } add(de) { this.top.children.push(de); } openNode(de) { const Re = u({ scope: de }); this.add(Re), this.stack.push(Re); } closeNode() { if (this.stack.length > 1) return this.stack.pop(); } closeAllNodes() { for (; this.closeNode(); ) ; } toJSON() { return JSON.stringify(this.rootNode, null, 4); } walk(de) { return this.constructor._walk(de, this.rootNode); } static _walk(de, Re) { return typeof Re == "string" ? de.addText(Re) : Re.children && (de.openNode(Re), Re.children.forEach(($e) => this._walk(de, $e)), de.closeNode(Re)), de; } static _collapse(de) { typeof de != "string" && de.children && (de.children.every((Re) => typeof Re == "string") ? de.children = [de.children.join("")] : de.children.forEach((Re) => { fs._collapse(Re); })); } }, p = class extends _ { constructor(G) { super(), this.options = G; } addText(G) { G !== "" && this.add(G); } startScope(G) { this.openNode(G); } endScope() { this.closeNode(); } __addSublanguage(G, de) { const Re = G.root; de && (Re.scope = `language:${de}`), this.add(Re); } toHTML() { return new d(this, this.options).value(); } finalize() { return this.closeAllNodes(), !0; } }; function g(G) { return G ? typeof G == "string" ? G : G.source : null; } function S(G) { return h("(?=", G, ")"); } function f(G) { return h("(?:", G, ")*"); } function m(G) { return h("(?:", G, ")?"); } function h(...G) { return G.map((de) => g(de)).join(""); } function b(G) { const de = G[G.length - 1]; return typeof de == "object" && de.constructor === Object ? (G.splice(G.length - 1, 1), de) : {}; } function C(...G) { return "(" + (b(G).capture ? "" : "?:") + G.map((de) => g(de)).join("|") + ")"; } function E(G) { return new RegExp(G.toString() + "|").exec("").length - 1; } function N(G, de) { const Re = G && G.exec(de); return Re && Re.index === 0; } var w = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./; function T(G, { joinWith: de }) { let Re = 0; return G.map(($e) => { Re += 1; const vt = Re; let At = g($e), ke = ""; for (; At.length > 0; ) { const Ee = w.exec(At); if (!Ee) { ke += At; break; } ke += At.substring(0, Ee.index), At = At.substring(Ee.index + Ee[0].length), Ee[0][0] === "\\" && Ee[1] ? ke += "\\" + String(Number(Ee[1]) + vt) : (ke += Ee[0], Ee[0] === "(" && Re++); } return ke; }).map(($e) => `(${$e})`).join(de); } var O = /\b\B/, A = "[a-zA-Z]\\w*", D = "[a-zA-Z_]\\w*", L = "\\b\\d+(\\.\\d+)?", k = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", M = "\\b(0b[01]+)", B = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", q = (G = {}) => { const de = /^#![ ]*\//; return G.binary && (G.begin = h(de, /.*\b/, G.binary, /\b.*/)), i({ scope: "meta", begin: de, end: /$/, relevance: 0, "on:begin": (Re, $e) => { Re.index !== 0 && $e.ignoreMatch(); } }, G); }, V = { begin: "\\\\[\\s\\S]", relevance: 0 }, U = { scope: "string", begin: "'", end: "'", illegal: "\\n", contains: [V] }, Z = { scope: "string", begin: '"', end: '"', illegal: "\\n", contains: [V] }, z = { begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ }, W = function(G, de, Re = {}) { const $e = i({ scope: "comment", begin: G, end: de, contains: [] }, Re); $e.contains.push({ scope: "doctag", begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/, excludeBegin: !0, relevance: 0 }); const vt = C("I", "a", "is", "so", "us", "to", "at", "if", "in", "it", "on", /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, /[A-Za-z]+[-][a-z]+/, /[A-Za-z][a-z]{2,}/); return $e.contains.push({ begin: h(/[ ]+/, "(", vt, /[.]?[:]?([.][ ]|[ ])/, "){3}") }), $e; }, F = W("//", "$"), y = W("/\\*", "\\*/"), P = W("#", "$"), Y = { scope: "number", begin: L, relevance: 0 }, K = { scope: "number", begin: k, relevance: 0 }, X = { scope: "number", begin: M, relevance: 0 }, re = { scope: "regexp", begin: /\/(?=[^/\n]*\/)/, end: /\/[gimuy]*/, contains: [V, { begin: /\[/, end: /\]/, relevance: 0, contains: [V] }] }, te = { scope: "title", begin: A, relevance: 0 }, ee = { scope: "title", begin: D, relevance: 0 }, oe = { begin: "\\.\\s*[a-zA-Z_]\\w*", relevance: 0 }, J = function(G) { return Object.assign(G, { "on:begin": (de, Re) => { Re.data._beginMatch = de[1]; }, "on:end": (de, Re) => { Re.data._beginMatch !== de[1] && Re.ignoreMatch(); } }); }, ne = /* @__PURE__ */ Object.freeze({ __proto__: null, APOS_STRING_MODE: U, BACKSLASH_ESCAPE: V, BINARY_NUMBER_MODE: X, BINARY_NUMBER_RE: M, COMMENT: W, C_BLOCK_COMMENT_MODE: y, C_LINE_COMMENT_MODE: F, C_NUMBER_MODE: K, C_NUMBER_RE: k, END_SAME_AS_BEGIN: J, HASH_COMMENT_MODE: P, IDENT_RE: A, MATCH_NOTHING_RE: O, METHOD_GUARD: oe, NUMBER_MODE: Y, NUMBER_RE: L, PHRASAL_WORDS_MODE: z, QUOTE_STRING_MODE: Z, REGEXP_MODE: re, RE_STARTERS_RE: B, SHEBANG: q, TITLE_MODE: te, UNDERSCORE_IDENT_RE: D, UNDERSCORE_TITLE_MODE: ee }); function fe(G, de) { G.input[G.index - 1] === "." && de.ignoreMatch(); } function se(G, de) { G.className !== void 0 && (G.scope = G.className, delete G.className); } function Se(G, de) { de && G.beginKeywords && (G.begin = "\\b(" + G.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", G.__beforeBegin = fe, G.keywords = G.keywords || G.beginKeywords, delete G.beginKeywords, G.relevance === void 0 && (G.relevance = 0)); } function Ie(G, de) { Array.isArray(G.illegal) && (G.illegal = C(...G.illegal)); } function be(G, de) { if (G.match) { if (G.begin || G.end) throw new Error("begin & end are not supported with match"); G.begin = G.match, delete G.match; } } function ze(G, de) { G.relevance === void 0 && (G.relevance = 1); } var le = (G, de) => { if (!G.beforeMatch) return; if (G.starts) throw new Error("beforeMatch cannot be used with starts"); const Re = Object.assign({}, G); Object.keys(G).forEach(($e) => { delete G[$e]; }), G.keywords = Re.keywords, G.begin = h(Re.beforeMatch, S(Re.begin)), G.starts = { relevance: 0, contains: [Object.assign(Re, { endsParent: !0 })] }, G.relevance = 0, delete Re.beforeMatch; }, Me = [ "of", "and", "for", "in", "not", "or", "if", "then", "parent", "list", "value" ], De = "keyword"; function Ze(G, de, Re = De) { const $e = /* @__PURE__ */ Object.create(null); return typeof G == "string" ? vt(Re, G.split(" ")) : Array.isArray(G) ? vt(Re, G) : Object.keys(G).forEach(function(At) { Object.assign($e, Ze(G[At], de, At)); }), $e; function vt(At, ke) { de && (ke = ke.map((Ee) => Ee.toLowerCase())), ke.forEach(function(Ee) { const Ge = Ee.split("|"); $e[Ge[0]] = [At, Ye(Ge[0], Ge[1])]; }); } } function Ye(G, de) { return de ? Number(de) : st(G) ? 0 : 1; } function st(G) { return Me.includes(G.toLowerCase()); } var qe = {}, ce = (G) => { console.error(G); }, j = (G, ...de) => { console.log(`WARN: ${G}`, ...de); }, ae = (G, de) => { qe[`${G}/${de}`] || (console.log(`Deprecated as of ${G}. ${de}`), qe[`${G}/${de}`] = !0); }, me = /* @__PURE__ */ new Error(); function He(G, de, { key: Re }) { let $e = 0; const vt = G[Re], At = {}, ke = {}; for (let Ee = 1; Ee <= de.length; Ee++) ke[Ee + $e] = vt[Ee], At[Ee + $e] = !0, $e += E(de[Ee - 1]); G[Re] = ke, G[Re]._emit = At, G[Re]._multi = !0; } function Ae(G) { if (Array.isArray(G.begin)) { if (G.skip || G.excludeBegin || G.returnBegin) throw ce("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), me; if (typeof G.beginScope != "object" || G.beginScope === null) throw ce("beginScope must be object"), me; He(G, G.begin, { key: "beginScope" }), G.begin = T(G.begin, { joinWith: "" }); } } function Te(G) { if (Array.isArray(G.end)) { if (G.skip || G.excludeEnd || G.returnEnd) throw ce("skip, excludeEnd, returnEnd not compatible with endScope: {}"), me; if (typeof G.endScope != "object" || G.endScope === null) throw ce("endScope must be object"), me; He(G, G.end, { key: "endScope" }), G.end = T(G.end, { joinWith: "" }); } } function dt(G) { G.scope && typeof G.scope == "object" && G.scope !== null && (G.beginScope = G.scope, delete G.scope); } function at(G) { dt(G), typeof G.beginScope == "string" && (G.beginScope = { _wrap: G.beginScope }), typeof G.endScope == "string" && (G.endScope = { _wrap: G.endScope }), Ae(G), Te(G); } function yt(G) { function de(ke, Ee) { return new RegExp(g(ke), "m" + (G.case_insensitive ? "i" : "") + (G.unicodeRegex ? "u" : "") + (Ee ? "g" : "")); } class Re { constructor() { this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0; } addRule(Ee, Ge) { Ge.position = this.position++, this.matchIndexes[this.matchAt] = Ge, this.regexes.push([Ge, Ee]), this.matchAt += E(Ee) + 1; } compile() { this.regexes.length === 0 && (this.exec = () => null); const Ee = this.regexes.map((Ge) => Ge[1]); this.matcherRe = de(T(Ee, { joinWith: "|" }), !0), this.lastIndex = 0; } exec(Ee) { this.matcherRe.lastIndex = this.lastIndex; const Ge = this.matcherRe.exec(Ee); if (!Ge) return null; const Bt = Ge.findIndex((Mr, ea) => ea > 0 && Mr !== void 0), Mt = this.matchIndexes[Bt]; return Ge.splice(0, Bt), Object.assign(Ge, Mt); } } class $e { constructor() { this.rules = [], this.multiRegexes = [], this.count = 0, this.lastIndex = 0, this.regexIndex = 0; } getMatcher(Ee) { if (this.multiRegexes[Ee]) return this.multiRegexes[Ee]; const Ge = new Re(); return this.rules.slice(Ee).forEach(([Bt, Mt]) => Ge.addRule(Bt, Mt)), Ge.compile(), this.multiRegexes[Ee] = Ge, Ge; } resumingScanAtSamePosition() { return this.regexIndex !== 0; } considerAll() { this.regexIndex = 0; } addRule(Ee, Ge) { this.rules.push([Ee, Ge]), Ge.type === "begin" && this.count++; } exec(Ee) { const Ge = this.getMatcher(this.regexIndex); Ge.lastIndex = this.lastIndex; let Bt = Ge.exec(Ee); if (this.resumingScanAtSamePosition() && !(Bt && Bt.index === this.lastIndex)) { const Mt = this.getMatcher(0); Mt.lastIndex = this.lastIndex + 1, Bt = Mt.exec(Ee); } return Bt && (this.regexIndex += Bt.position + 1, this.regexIndex === this.count && this.considerAll()), Bt; } } function vt(ke) { const Ee = new $e(); return ke.contains.forEach((Ge) => Ee.addRule(Ge.begin, { rule: Ge, type: "begin" })), ke.terminatorEnd && Ee.addRule(ke.terminatorEnd, { type: "end" }), ke.illegal && Ee.addRule(ke.illegal, { type: "illegal" }), Ee; } function At(ke, Ee) { const Ge = ke; if (ke.isCompiled) return Ge; [ se, be, at, le ].forEach((Mt) => Mt(ke, Ee)), G.compilerExtensions.forEach((Mt) => Mt(ke, Ee)), k