UNPKG

react-pp-bundle

Version:

Polaris组件库扩展包

1,505 lines (1,503 loc) 246 kB
import te, { useRef as Et, useState as xe, useEffect as Fe, useMemo as Z, createContext as SP, useContext as FP, useCallback as $P, useLayoutEffect as IP } from "react"; import { Text as N, Button as et, Card as wt, BlockStack as Se, InlineStack as fe, Popover as AP, ActionList as RP, Tooltip as EP, RadioButton as wP, RangeSlider as jP, Box as DP, Badge as gt, Layout as ht, LegacyCard as ie, TextContainer as Re, SkeletonDisplayText as Ee, SkeletonBodyText as oe } from "@shopify/polaris"; import { cloneDeep as Qe } from "lodash-es"; import Je from "axios"; var bT = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function CP(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } var bt = { exports: {} }, we = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Jt; function LP() { if (Jt) return we; Jt = 1; var n = te, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, a = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(s, l, c) { var d, f = {}, T = null, P = null; c !== void 0 && (T = "" + c), l.key !== void 0 && (T = "" + l.key), l.ref !== void 0 && (P = l.ref); for (d in l) r.call(l, d) && !i.hasOwnProperty(d) && (f[d] = l[d]); if (s && s.defaultProps) for (d in l = s.defaultProps, l) f[d] === void 0 && (f[d] = l[d]); return { $$typeof: e, type: s, key: T, ref: P, props: f, _owner: a.current }; } return we.Fragment = t, we.jsx = o, we.jsxs = o, we; } var je = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Zt; function NP() { return Zt || (Zt = 1, process.env.NODE_ENV !== "production" && function() { var n = te, e = Symbol.for("react.element"), t = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), s = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), v = Symbol.iterator, k = "@@iterator"; function O(u) { if (u === null || typeof u != "object") return null; var h = v && u[v] || u[k]; return typeof h == "function" ? h : null; } var m = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function b(u) { { for (var h = arguments.length, y = new Array(h > 1 ? h - 1 : 0), x = 1; x < h; x++) y[x - 1] = arguments[x]; C("error", u, y); } } function C(u, h, y) { { var x = m.ReactDebugCurrentFrame, D = x.getStackAddendum(); D !== "" && (h += "%s", y = y.concat([D])); var L = y.map(function(E) { return String(E); }); L.unshift("Warning: " + h), Function.prototype.apply.call(console[u], console, L); } } var A = !1, w = !1, j = !1, X = !1, F = !1, $; $ = Symbol.for("react.module.reference"); function I(u) { return !!(typeof u == "string" || typeof u == "function" || u === r || u === i || F || u === a || u === c || u === d || X || u === P || A || w || j || typeof u == "object" && u !== null && (u.$$typeof === T || u.$$typeof === f || u.$$typeof === o || u.$$typeof === s || u.$$typeof === l || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. u.$$typeof === $ || u.getModuleId !== void 0)); } function q(u, h, y) { var x = u.displayName; if (x) return x; var D = h.displayName || h.name || ""; return D !== "" ? y + "(" + D + ")" : y; } function ee(u) { return u.displayName || "Context"; } function M(u) { if (u == null) return null; if (typeof u.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof u == "function") return u.displayName || u.name || null; if (typeof u == "string") return u; switch (u) { case r: return "Fragment"; case t: return "Portal"; case i: return "Profiler"; case a: return "StrictMode"; case c: return "Suspense"; case d: return "SuspenseList"; } if (typeof u == "object") switch (u.$$typeof) { case s: var h = u; return ee(h) + ".Consumer"; case o: var y = u; return ee(y._context) + ".Provider"; case l: return q(u, u.render, "ForwardRef"); case f: var x = u.displayName || null; return x !== null ? x : M(u.type) || "Memo"; case T: { var D = u, L = D._payload, E = D._init; try { return M(E(L)); } catch { return null; } } } return null; } var B = Object.assign, le = 0, Q, G, ce, he, Ie, W, ne; function ue() { } ue.__reactDisabledLog = !0; function Ye() { { if (le === 0) { Q = console.log, G = console.info, ce = console.warn, he = console.error, Ie = console.group, W = console.groupCollapsed, ne = console.groupEnd; var u = { configurable: !0, enumerable: !0, value: ue, writable: !0 }; Object.defineProperties(console, { info: u, log: u, warn: u, error: u, group: u, groupCollapsed: u, groupEnd: u }); } le++; } } function He() { { if (le--, le === 0) { var u = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: B({}, u, { value: Q }), info: B({}, u, { value: G }), warn: B({}, u, { value: ce }), error: B({}, u, { value: he }), group: B({}, u, { value: Ie }), groupCollapsed: B({}, u, { value: W }), groupEnd: B({}, u, { value: ne }) }); } le < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var ot = m.ReactCurrentDispatcher, st; function Ue(u, h, y) { { if (st === void 0) try { throw Error(); } catch (D) { var x = D.stack.trim().match(/\n( *(at )?)/); st = x && x[1] || ""; } return ` ` + st + u; } } var lt = !1, We; { var tP = typeof WeakMap == "function" ? WeakMap : Map; We = new tP(); } function Lt(u, h) { if (!u || lt) return ""; { var y = We.get(u); if (y !== void 0) return y; } var x; lt = !0; var D = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var L; L = ot.current, ot.current = null, Ye(); try { if (h) { var E = function() { throw Error(); }; if (Object.defineProperty(E.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(E, []); } catch (K) { x = K; } Reflect.construct(u, [], E); } else { try { E.call(); } catch (K) { x = K; } u.call(E.prototype); } } else { try { throw Error(); } catch (K) { x = K; } u(); } } catch (K) { if (K && x && typeof K.stack == "string") { for (var R = K.stack.split(` `), V = x.stack.split(` `), z = R.length - 1, Y = V.length - 1; z >= 1 && Y >= 0 && R[z] !== V[Y]; ) Y--; for (; z >= 1 && Y >= 0; z--, Y--) if (R[z] !== V[Y]) { if (z !== 1 || Y !== 1) do if (z--, Y--, Y < 0 || R[z] !== V[Y]) { var J = ` ` + R[z].replace(" at new ", " at "); return u.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", u.displayName)), typeof u == "function" && We.set(u, J), J; } while (z >= 1 && Y >= 0); break; } } } finally { lt = !1, ot.current = L, He(), Error.prepareStackTrace = D; } var _e = u ? u.displayName || u.name : "", Pe = _e ? Ue(_e) : ""; return typeof u == "function" && We.set(u, Pe), Pe; } function nP(u, h, y) { return Lt(u, !1); } function rP(u) { var h = u.prototype; return !!(h && h.isReactComponent); } function Ve(u, h, y) { if (u == null) return ""; if (typeof u == "function") return Lt(u, rP(u)); if (typeof u == "string") return Ue(u); switch (u) { case c: return Ue("Suspense"); case d: return Ue("SuspenseList"); } if (typeof u == "object") switch (u.$$typeof) { case l: return nP(u.render); case f: return Ve(u.type, h, y); case T: { var x = u, D = x._payload, L = x._init; try { return Ve(L(D), h, y); } catch { } } } return ""; } var Ae = Object.prototype.hasOwnProperty, Nt = {}, Mt = m.ReactDebugCurrentFrame; function Ke(u) { if (u) { var h = u._owner, y = Ve(u.type, u._source, h ? h.type : null); Mt.setExtraStackFrame(y); } else Mt.setExtraStackFrame(null); } function aP(u, h, y, x, D) { { var L = Function.call.bind(Ae); for (var E in u) if (L(u, E)) { var R = void 0; try { if (typeof u[E] != "function") { var V = Error((x || "React class") + ": " + y + " type `" + E + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof u[E] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw V.name = "Invariant Violation", V; } R = u[E](h, E, x, y, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (z) { R = z; } R && !(R instanceof Error) && (Ke(D), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", x || "React class", y, E, typeof R), Ke(null)), R instanceof Error && !(R.message in Nt) && (Nt[R.message] = !0, Ke(D), b("Failed %s type: %s", y, R.message), Ke(null)); } } } var iP = Array.isArray; function ct(u) { return iP(u); } function oP(u) { { var h = typeof Symbol == "function" && Symbol.toStringTag, y = h && u[Symbol.toStringTag] || u.constructor.name || "Object"; return y; } } function sP(u) { try { return Xt(u), !1; } catch { return !0; } } function Xt(u) { return "" + u; } function qt(u) { if (sP(u)) return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", oP(u)), Xt(u); } var Bt = m.ReactCurrentOwner, lP = { key: !0, ref: !0, __self: !0, __source: !0 }, zt, Yt; function cP(u) { if (Ae.call(u, "ref")) { var h = Object.getOwnPropertyDescriptor(u, "ref").get; if (h && h.isReactWarning) return !1; } return u.ref !== void 0; } function uP(u) { if (Ae.call(u, "key")) { var h = Object.getOwnPropertyDescriptor(u, "key").get; if (h && h.isReactWarning) return !1; } return u.key !== void 0; } function dP(u, h) { typeof u.ref == "string" && Bt.current; } function fP(u, h) { { var y = function() { zt || (zt = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h)); }; y.isReactWarning = !0, Object.defineProperty(u, "key", { get: y, configurable: !0 }); } } function pP(u, h) { { var y = function() { Yt || (Yt = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h)); }; y.isReactWarning = !0, Object.defineProperty(u, "ref", { get: y, configurable: !0 }); } } var gP = function(u, h, y, x, D, L, E) { var R = { // This tag allows us to uniquely identify this as a React Element $$typeof: e, // Built-in properties that belong on the element type: u, key: h, ref: y, props: E, // Record the component responsible for creating this element. _owner: L }; return R._store = {}, Object.defineProperty(R._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(R, "_self", { configurable: !1, enumerable: !1, writable: !1, value: x }), Object.defineProperty(R, "_source", { configurable: !1, enumerable: !1, writable: !1, value: D }), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R; }; function hP(u, h, y, x, D) { { var L, E = {}, R = null, V = null; y !== void 0 && (qt(y), R = "" + y), uP(h) && (qt(h.key), R = "" + h.key), cP(h) && (V = h.ref, dP(h, D)); for (L in h) Ae.call(h, L) && !lP.hasOwnProperty(L) && (E[L] = h[L]); if (u && u.defaultProps) { var z = u.defaultProps; for (L in z) E[L] === void 0 && (E[L] = z[L]); } if (R || V) { var Y = typeof u == "function" ? u.displayName || u.name || "Unknown" : u; R && fP(E, Y), V && pP(E, Y); } return gP(u, R, V, D, x, Bt.current, E); } } var ut = m.ReactCurrentOwner, Ht = m.ReactDebugCurrentFrame; function ye(u) { if (u) { var h = u._owner, y = Ve(u.type, u._source, h ? h.type : null); Ht.setExtraStackFrame(y); } else Ht.setExtraStackFrame(null); } var dt; dt = !1; function ft(u) { return typeof u == "object" && u !== null && u.$$typeof === e; } function Ut() { { if (ut.current) { var u = M(ut.current.type); if (u) return ` Check the render method of \`` + u + "`."; } return ""; } } function PP(u) { return ""; } var Wt = {}; function vP(u) { { var h = Ut(); if (!h) { var y = typeof u == "string" ? u : u.displayName || u.name; y && (h = ` Check the top-level render call using <` + y + ">."); } return h; } } function Vt(u, h) { { if (!u._store || u._store.validated || u.key != null) return; u._store.validated = !0; var y = vP(h); if (Wt[y]) return; Wt[y] = !0; var x = ""; u && u._owner && u._owner !== ut.current && (x = " It was passed a child from " + M(u._owner.type) + "."), ye(u), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', y, x), ye(null); } } function Kt(u, h) { { if (typeof u != "object") return; if (ct(u)) for (var y = 0; y < u.length; y++) { var x = u[y]; ft(x) && Vt(x, h); } else if (ft(u)) u._store && (u._store.validated = !0); else if (u) { var D = O(u); if (typeof D == "function" && D !== u.entries) for (var L = D.call(u), E; !(E = L.next()).done; ) ft(E.value) && Vt(E.value, h); } } } function mP(u) { { var h = u.type; if (h == null || typeof h == "string") return; var y; if (typeof h == "function") y = h.propTypes; else if (typeof h == "object" && (h.$$typeof === l || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. h.$$typeof === f)) y = h.propTypes; else return; if (y) { var x = M(h); aP(y, u.props, "prop", x, u); } else if (h.PropTypes !== void 0 && !dt) { dt = !0; var D = M(h); b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", D || "Unknown"); } typeof h.getDefaultProps == "function" && !h.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function TP(u) { { for (var h = Object.keys(u.props), y = 0; y < h.length; y++) { var x = h[y]; if (x !== "children" && x !== "key") { ye(u), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", x), ye(null); break; } } u.ref !== null && (ye(u), b("Invalid attribute `ref` supplied to `React.Fragment`."), ye(null)); } } var Qt = {}; function Gt(u, h, y, x, D, L) { { var E = I(u); if (!E) { var R = ""; (u === void 0 || typeof u == "object" && u !== null && Object.keys(u).length === 0) && (R += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var V = PP(); V ? R += V : R += Ut(); var z; u === null ? z = "null" : ct(u) ? z = "array" : u !== void 0 && u.$$typeof === e ? (z = "<" + (M(u.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : z = typeof u, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", z, R); } var Y = hP(u, h, y, D, L); if (Y == null) return Y; if (E) { var J = h.children; if (J !== void 0) if (x) if (ct(J)) { for (var _e = 0; _e < J.length; _e++) Kt(J[_e], u); Object.freeze && Object.freeze(J); } else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else Kt(J, u); } if (Ae.call(h, "key")) { var Pe = M(u), K = Object.keys(h).filter(function(xP) { return xP !== "key"; }), pt = K.length > 0 ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Qt[Pe + pt]) { var OP = K.length > 0 ? "{" + K.join(": ..., ") + ": ...}" : "{}"; b(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, pt, Pe, OP, Pe), Qt[Pe + pt] = !0; } } return u === r ? TP(Y) : mP(Y), Y; } } function yP(u, h, y) { return Gt(u, h, y, !0); } function _P(u, h, y) { return Gt(u, h, y, !1); } var bP = _P, kP = yP; je.Fragment = r, je.jsx = bP, je.jsxs = kP; }()), je; } process.env.NODE_ENV === "production" ? bt.exports = LP() : bt.exports = NP(); var p = bt.exports, wn = { exports: {} }; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ (function(n) { (function() { var e = {}.hasOwnProperty; function t() { for (var i = "", o = 0; o < arguments.length; o++) { var s = arguments[o]; s && (i = a(i, r(s))); } return i; } function r(i) { if (typeof i == "string" || typeof i == "number") return i; if (typeof i != "object") return ""; if (Array.isArray(i)) return t.apply(null, i); if (i.toString !== Object.prototype.toString && !i.toString.toString().includes("[native code]")) return i.toString(); var o = ""; for (var s in i) e.call(i, s) && i[s] && (o = a(o, s)); return o; } function a(i, o) { return o ? i ? i + " " + o : i + o : i; } n.exports ? (t.default = t, n.exports = t) : window.classNames = t; })(); })(wn); var MP = wn.exports; const Le = /* @__PURE__ */ CP(MP), XP = "_radiosBoxBorderWrapper_1vmjb_14", qP = "_radiosBox_1vmjb_14", BP = "_radioBox_1vmjb_34", zP = "_radio_1vmjb_14", YP = "_radioActive_1vmjb_67", HP = "_radioActiveBgBox_1vmjb_72", UP = "_radioActiveBg_1vmjb_72", ve = { radiosBoxBorderWrapper: XP, radiosBox: qP, radioBox: BP, radio: zP, radioActive: YP, radioActiveBgBox: HP, radioActiveBg: UP }, WP = (n) => { const { className: e, options: t, value: r, onChange: a } = n, i = Et([]), [o, s] = xe(0); Fe(() => { if (i.current = new Array(t.length).fill(null).map((c, d) => i.current[d] || null), t.length) { let c = null; t.forEach((d, f) => { d.value === r && (c = i.current[f]); }), c && s(c.clientWidth); } }, [t]); const l = Z(() => { var d; const c = t.findIndex((f) => f.value === r); if (c !== -1) { let f = 0; for (let T = 0; T < c; T++) f += ((d = i.current[T]) == null ? void 0 : d.clientWidth) ?? 0, f !== 0 && (f += 6); return f; } return 0; }, [r, t, i.current]); return /* @__PURE__ */ p.jsx("div", { className: Le(ve.radiosBoxBorderWrapper, e), children: /* @__PURE__ */ p.jsxs("div", { className: ve.radiosBox, children: [ /* @__PURE__ */ p.jsx("div", { className: ve.radioActiveBgBox, children: !!o && /* @__PURE__ */ p.jsx( "div", { className: ve.radioActiveBg, style: { width: `${o}px`, transform: `translateX(${l}px)` } } ) }), t.map((c, d) => /* @__PURE__ */ p.jsx( "div", { className: ve.radioBox, ref: (f) => i.current[d] = f, onClick: () => a(c.value), children: /* @__PURE__ */ p.jsx( "div", { className: Le({ [ve.radio]: !0, [ve.radioActive]: r === c.value }), children: /* @__PURE__ */ p.jsx(N, { as: "span", variant: "bodyMd", fontWeight: "medium", children: c.label }) } ) }, c.value )) ] }) }); }, jn = (n) => function(t) { return /* @__PURE__ */ p.jsx("div", { style: n, children: /* @__PURE__ */ p.jsx(WP, { ...t }) }); }, kT = jn({ "--pb-toggle-text-color-active": "#FFFFFF", "--pb-toggle-box-bg": "linear-gradient(90deg, #68A5FE 0%, #0067FF 100%)", "--pb-toggle-bg-active": "linear-gradient(90deg, #68A5FE 0%, #68A5FE 0.01%, #0067FF 48.96%, #0067FF 100%)" }), VP = jn({ "--pb-toggle-box-bg": "linear-gradient(90deg, #B1EDFA 0%, #4DFF9E 100%)", "--pb-toggle-bg-active": "linear-gradient(90deg, #B1F5FA 0%, #B0F5FA 0.01%, #4DFF9E 48.96%, #4DFF9E 100%)" }); var Dn = function(e) { return /* @__PURE__ */ te.createElement("svg", Object.assign({ viewBox: "0 0 20 20" }, e), /* @__PURE__ */ te.createElement("path", { d: "M11.75 4.5a.75.75 0 0 0 0 1.5h1.19l-2.72 2.72a.75.75 0 1 0 1.06 1.06l2.72-2.72v1.19a.75.75 0 0 0 1.5 0v-3a.75.75 0 0 0-.75-.75h-3Z" }), /* @__PURE__ */ te.createElement("path", { d: "M15 11.25a.75.75 0 0 0-1.5 0v1c0 .69-.56 1.25-1.25 1.25h-4.5c-.69 0-1.25-.56-1.25-1.25v-4.5c0-.69.56-1.25 1.25-1.25h1a.75.75 0 0 0 0-1.5h-1a2.75 2.75 0 0 0-2.75 2.75v4.5a2.75 2.75 0 0 0 2.75 2.75h4.5a2.75 2.75 0 0 0 2.75-2.75v-1Z" })); }; Dn.displayName = "ExternalSmallIcon"; var Cn = function(e) { return /* @__PURE__ */ te.createElement("svg", Object.assign({ viewBox: "0 0 20 20" }, e), /* @__PURE__ */ te.createElement("path", { d: "M6 10a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" }), /* @__PURE__ */ te.createElement("path", { d: "M11.5 10a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" }), /* @__PURE__ */ te.createElement("path", { d: "M17 10a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" })); }; Cn.displayName = "MenuHorizontalIcon"; var Ln = function(e) { return /* @__PURE__ */ te.createElement("svg", Object.assign({ viewBox: "0 0 20 20" }, e), /* @__PURE__ */ te.createElement("path", { d: "M13.97 15.03a.75.75 0 1 0 1.06-1.06l-3.97-3.97 3.97-3.97a.75.75 0 0 0-1.06-1.06l-3.97 3.97-3.97-3.97a.75.75 0 0 0-1.06 1.06l3.97 3.97-3.97 3.97a.75.75 0 1 0 1.06 1.06l3.97-3.97 3.97 3.97Z" })); }; Ln.displayName = "XIcon"; const KP = (n) => { const { onClose: e, period: t } = n, a = { 1: "https://return-cdn.parcelpanel.com/public/pp_bundle/month_discount.png", 2: "https://return-cdn.parcelpanel.com/public/pp_bundle/year_discount.png" }[t] ?? "https://return-cdn.parcelpanel.com/public/pp_bundle/month_discount.png"; return /* @__PURE__ */ p.jsxs("div", { className: "pb-w-full pb-relative pb-mb-4 pb-mt-5 sm:pb-rounded-xl pb-overflow-hidden", children: [ /* @__PURE__ */ p.jsx("div", { className: "pb-absolute md:pb-top-4 md:pb-right-4 pb-top-1 pb-right-1", children: /* @__PURE__ */ p.jsx(et, { icon: Ln, variant: "plain", onClick: e }) }), /* @__PURE__ */ p.jsx("img", { className: "pb-w-full pb-flex", src: a, alt: "" }) ] }); }; var re = /* @__PURE__ */ ((n) => (n[n.Month = 1] = "Month", n[n.Year = 2] = "Year", n))(re || {}), _ = /* @__PURE__ */ ((n) => (n[n.Essential = 2] = "Essential", n[n.Professional = 3] = "Professional", n[n.Enterprise = 4] = "Enterprise", n))(_ || {}), g = /* @__PURE__ */ ((n) => (n[n.Tracking = 1] = "Tracking", n[n.Returns = 2] = "Returns", n[n.Protection = 3] = "Protection", n))(g || {}), Ze = /* @__PURE__ */ ((n) => (n[n.Trial = 1] = "Trial", n[n.Normal = 2] = "Normal", n))(Ze || {}); const QP = (n, e, t, r) => { var i, o, s, l; const a = [t, { code: e, ...r || {} }]; if ((o = (i = n == null ? void 0 : n.services) == null ? void 0 : i.logger) != null && o.forward) return n.services.logger.forward(a, "warn", "react-i18next::", !0); me(a[0]) && (a[0] = `react-i18next:: ${a[0]}`), (l = (s = n == null ? void 0 : n.services) == null ? void 0 : s.logger) != null && l.warn ? n.services.logger.warn(...a) : console != null && console.warn && console.warn(...a); }, en = {}, kt = (n, e, t, r) => { me(t) && en[t] || (me(t) && (en[t] = /* @__PURE__ */ new Date()), QP(n, e, t, r)); }, Nn = (n, e) => () => { if (n.isInitialized) e(); else { const t = () => { setTimeout(() => { n.off("initialized", t); }, 0), e(); }; n.on("initialized", t); } }, Ot = (n, e, t) => { n.loadNamespaces(e, Nn(n, t)); }, tn = (n, e, t, r) => { if (me(t) && (t = [t]), n.options.preload && n.options.preload.indexOf(e) > -1) return Ot(n, t, r); t.forEach((a) => { n.options.ns.indexOf(a) < 0 && n.options.ns.push(a); }), n.loadLanguages(e, Nn(n, r)); }, GP = (n, e, t = {}) => !e.languages || !e.languages.length ? (kt(e, "NO_LANGUAGES", "i18n.languages were undefined or empty", { languages: e.languages }), !0) : e.hasLoadedNamespace(n, { lng: t.lng, precheck: (r, a) => { var i; if (((i = t.bindI18n) == null ? void 0 : i.indexOf("languageChanging")) > -1 && r.services.backendConnector.backend && r.isLanguageChangingTo && !a(r.isLanguageChangingTo, n)) return !1; } }), me = (n) => typeof n == "string", JP = (n) => typeof n == "object" && n !== null, ZP = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, ev = { "&amp;": "&", "&#38;": "&", "&lt;": "<", "&#60;": "<", "&gt;": ">", "&#62;": ">", "&apos;": "'", "&#39;": "'", "&quot;": '"', "&#34;": '"', "&nbsp;": " ", "&#160;": " ", "&copy;": "©", "&#169;": "©", "&reg;": "®", "&#174;": "®", "&hellip;": "…", "&#8230;": "…", "&#x2F;": "/", "&#47;": "/" }, tv = (n) => ev[n], nv = (n) => n.replace(ZP, tv); let xt = { bindI18n: "languageChanged", bindI18nStore: "", transEmptyNodeValue: "", transSupportBasicHtmlNodes: !0, transWrapTextNodes: "", transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"], useSuspense: !0, unescape: nv }; const rv = (n = {}) => { xt = { ...xt, ...n }; }, av = () => xt; let Mn; const iv = (n) => { Mn = n; }, ov = () => Mn, sv = { type: "3rdParty", init(n) { rv(n.options.react), iv(n); } }, lv = SP(); class cv { constructor() { this.usedNamespaces = {}; } addUsedNamespaces(e) { e.forEach((t) => { this.usedNamespaces[t] || (this.usedNamespaces[t] = !0); }); } getUsedNamespaces() { return Object.keys(this.usedNamespaces); } } const uv = (n, e) => { const t = Et(); return Fe(() => { t.current = n; }, [n, e]), t.current; }, Xn = (n, e, t, r) => n.getFixedT(e, t, r), dv = (n, e, t, r) => $P(Xn(n, e, t, r), [n, e, t, r]), qe = (n, e = {}) => { var A, w, j, X; const { i18n: t } = e, { i18n: r, defaultNS: a } = FP(lv) || {}, i = t || r || ov(); if (i && !i.reportNamespaces && (i.reportNamespaces = new cv()), !i) { kt(i, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next"); const F = (I, q) => me(q) ? q : JP(q) && me(q.defaultValue) ? q.defaultValue : Array.isArray(I) ? I[I.length - 1] : I, $ = [F, {}, !1]; return $.t = F, $.i18n = {}, $.ready = !1, $; } (A = i.options.react) != null && A.wait && kt(i, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour."); const o = { ...av(), ...i.options.react, ...e }, { useSuspense: s, keyPrefix: l } = o; let c = a || ((w = i.options) == null ? void 0 : w.defaultNS); c = me(c) ? [c] : c || ["translation"], (X = (j = i.reportNamespaces).addUsedNamespaces) == null || X.call(j, c); const d = (i.isInitialized || i.initializedStoreOnce) && c.every((F) => GP(F, i, o)), f = dv(i, e.lng || null, o.nsMode === "fallback" ? c : c[0], l), T = () => f, P = () => Xn(i, e.lng || null, o.nsMode === "fallback" ? c : c[0], l), [v, k] = xe(T); let O = c.join(); e.lng && (O = `${e.lng}${O}`); const m = uv(O), b = Et(!0); Fe(() => { const { bindI18n: F, bindI18nStore: $ } = o; b.current = !0, !d && !s && (e.lng ? tn(i, e.lng, c, () => { b.current && k(P); }) : Ot(i, c, () => { b.current && k(P); })), d && m && m !== O && b.current && k(P); const I = () => { b.current && k(P); }; return F && (i == null || i.on(F, I)), $ && (i == null || i.store.on($, I)), () => { b.current = !1, i && (F == null || F.split(" ").forEach((q) => i.off(q, I))), $ && i && $.split(" ").forEach((q) => i.store.off(q, I)); }; }, [i, O]), Fe(() => { b.current && d && k(T); }, [i, l, d]); const C = [v, i, d]; if (C.t = v, C.i18n = i, C.ready = d, d || !d && !s) return C; throw new Promise((F) => { e.lng ? tn(i, e.lng, c, () => F()) : Ot(i, c, () => F()); }); }, qn = (n) => { const e = { [re.Year]: { [g.Tracking]: { [_.Essential]: [], [_.Professional]: [], [_.Enterprise]: [] }, [g.Returns]: { [_.Essential]: [], [_.Professional]: [], [_.Enterprise]: [] } }, [re.Month]: { [g.Tracking]: { [_.Essential]: [], [_.Professional]: [], [_.Enterprise]: [] }, [g.Returns]: { [_.Essential]: [], [_.Professional]: [], [_.Enterprise]: [] } } }; return n.pkg_list.forEach((t) => { [g.Tracking, g.Returns].forEach((r) => { t.app_id === r && t.plans.forEach((a) => { e[re.Year][r][a.kind] = a.price_year, e[re.Month][r][a.kind] = a.price_month; }); }); }), e; }, Be = (n, e) => qn(n)[e], ze = (n, e) => { const t = Be(n, e); return { [g.Tracking]: [ ...t[g.Tracking][_.Essential], ...t[g.Tracking][_.Professional], ...t[g.Tracking][_.Enterprise] ], [g.Returns]: [ ...t[g.Returns][_.Essential], ...t[g.Returns][_.Professional], ...t[g.Returns][_.Enterprise] ] }; }, fv = (n, e, t) => { const r = ze(n, e), a = Be(n, e); return { [g.Tracking]: r[g.Tracking], [g.Returns]: a[g.Returns][t] }; }; function Pt(n, e, t, r) { const a = t[g.Tracking][r]; return ze(n, e)[g.Tracking][a]; } function vt(n, e, t, r) { const a = t[g.Returns][r]; return Be(n, e)[g.Returns][r][a]; } const Bn = (n, e, t) => ({ [g.Tracking]: { [_.Essential]: Pt( n, e, t, _.Essential ), [_.Professional]: Pt( n, e, t, _.Professional ), [_.Enterprise]: Pt( n, e, t, _.Enterprise ) }, [g.Returns]: { [_.Essential]: vt( n, e, t, _.Essential ), [_.Professional]: vt( n, e, t, _.Professional ), [_.Enterprise]: vt( n, e, t, _.Enterprise ) } }), pv = (n, e, t, r) => { const a = Bn(n, e, r); return { [g.Tracking]: a[g.Tracking][t[g.Tracking].kind], [g.Returns]: a[g.Returns][t[g.Returns].kind] }; }, jt = (n) => ({ [g.Tracking]: n.user_pkg.app.find( (e) => e.app_id === g.Tracking ), [g.Returns]: n.user_pkg.app.find( (e) => e.app_id === g.Returns ) }), gv = (n) => { const e = jt(n), t = ze(n, n.user_pkg.subscribe_period ?? n.user_pkg.default_plan_period); return { [g.Tracking]: t[g.Tracking].find( (r) => { var a; return r.app_plan_id === ((a = e[g.Tracking]) == null ? void 0 : a.subscribe_app_plan_id); } ), [g.Returns]: t[g.Returns].find( (r) => { var a; return r.app_plan_id === ((a = e[g.Returns]) == null ? void 0 : a.subscribe_app_plan_id); } ) }; }, hv = (n, e, t, r, a) => { const i = jt(n), o = Be(n, e), s = e === re.Month ? "default_month_plan_id" : "default_year_plan_id", l = ze(n, e), c = { [g.Tracking]: { [_.Essential]: 0, [_.Professional]: o[g.Tracking][_.Essential].length, [_.Enterprise]: o[g.Tracking][_.Essential].length + o[g.Tracking][_.Professional].length }, [g.Returns]: { [_.Essential]: 0, [_.Professional]: 0, [_.Enterprise]: 0 } }, d = { [g.Tracking]: { step: c[g.Tracking][_.Professional], kind: _.Professional }, [g.Returns]: { step: c[g.Returns][_.Professional], kind: _.Professional } }; function f() { var m; if (t === g.Tracking) { if (a) return a; if (r) { const b = l[g.Tracking].find( (C) => C.kind === r ); if (b) return b.app_plan_id; } } return ((m = i[g.Tracking]) == null ? void 0 : m[s]) ?? 0; } const T = f(), P = l[g.Tracking].find( (m) => +m.app_plan_id == +T ); if (P != null && P.kind) { const m = l[g.Tracking].findIndex( (b) => +b.app_plan_id == +T ); m > -1 && (c[g.Tracking][P.kind] = m, d[g.Tracking].kind = P.kind, d[g.Tracking].step = m); } function v() { var m; if (t === g.Returns) { if (a) return a; if (r) { const b = l[g.Returns].find( (C) => C.kind === r ); if (b) return b.app_plan_id; } } return ((m = i[g.Returns]) == null ? void 0 : m[s]) ?? 0; } const k = v(), O = l[g.Returns].find( (m) => +m.app_plan_id == +k ); if (O != null && O.kind) { const m = o[g.Returns][O.kind].findIndex( (b) => +b.app_plan_id == +k ); m > -1 && (c[g.Returns][O.kind] = m, d[g.Returns].kind = O.kind, d[g.Returns].step = m); } return { defaultInfo: d, defaultSteps: c }; }, Pv = (n) => { const e = qn(n.data), t = Be(n.data, n.period), r = ze(n.data, n.period), a = fv(n.data, n.period, n.info[g.Returns].kind), i = Bn(n.data, n.period, n.steps), o = pv(n.data, n.period, n.info, n.steps), s = jt(n.data), l = gv(n.data); return { combinedData: e, pkgList: t, priceList: r, rangList: a, pkgPriceInfo: i, currentPriceInfo: o, appInfo: s, subscribePriceInfo: l }; }; function pe(n) { if (n == null || n === "") return "0"; const e = Number(n); return isNaN(e) ? String(n) : e.toLocaleString("en-US"); } const mt = (n) => { const { title: e, price: t, originPrice: r, justShowOriginPrice: a = !1 } = n, { t: i } = qe(); return /* @__PURE__ */ p.jsx("div", { className: "pb-page-charge-card", children: /* @__PURE__ */ p.jsx(wt, { padding: "300", roundedAbove: "xs", background: "bg-surface-secondary", children: /* @__PURE__ */ p.jsxs(Se, { gap: "300", children: [ /* @__PURE__ */ p.jsx(N, { variant: "headingMd", as: "h2", children: e }), a ? /* @__PURE__ */ p.jsxs("div", { children: [ /* @__PURE__ */ p.jsxs(N, { as: "span", variant: "headingLg", children: [ "$", pe(r) ] }), /* @__PURE__ */ p.jsxs( N, { as: "span", variant: "bodyMd", tone: "subdued", fontWeight: "medium", children: [ "/", i("month") ] } ) ] }) : /* @__PURE__ */ p.jsxs(fe, { gap: "200", blockAlign: "end", children: [ /* @__PURE__ */ p.jsxs( N, { as: "span", variant: "headingLg", tone: "subdued", textDecorationLine: "line-through", children: [ "$", pe(r) ] } ), /* @__PURE__ */ p.jsx("div", { className: "pb-bg-[#A4E8F2] pb-rounded-lg pb-px-2", children: /* @__PURE__ */ p.jsxs(N, { as: "span", variant: "headingLg", children: [ "$", pe(t), /* @__PURE__ */ p.jsxs( N, { as: "span", variant: "bodyMd", fontWeight: "medium", tone: "subdued", children: [ "/", i("month") ] } ) ] }) }) ] }) ] }) }) }); }, St = { [_.Essential]: "Essential", [_.Professional]: "Professional", [_.Enterprise]: "Enterprise" }, zn = window.PB_URL || "https://cw3-mid-api.parcelpanel.com", vv = (n) => { const { onAction: e, currentPriceInfo: t, btnLoading: r, data: a, appInfo: i, btnDisabled: o, period: s } = n, [l, c] = xe(!1), { t: d } = qe(), f = { [Ze.Trial]: { text: "50% off + 10% off", tooltip: d("FiftyOffYourFirstMonthThen_10OffFor") }, [Ze.Normal]: { text: "10% off", tooltip: d("TenOffForLife") } }, T = s === re.Year ? Ze.Normal : a.user_pkg.discount_kind, P = Z(() => i[g.Tracking] && i[g.Tracking].subscribe_app_plan_id > 1 && i[g.Returns] && i[g.Returns].subscribe_app_plan_id > 1, [i]), v = Z(() => i[g.Tracking] && i[g.Tracking].next_plan_id > 0 && i[g.Returns] && i[g.Returns].next_plan_id > 0, [i]), k = Z(() => { var w, j; return ((w = i[g.Tracking]) == null ? void 0 : w.next_plan_id) === 1 && ((j = i[g.Returns]) == null ? void 0 : j.next_plan_id) === 1; }, [i, t]), O = Z(() => { var w, j; return t[g.Tracking].app_plan_id == ((w = i[g.Tracking]) == null ? void 0 : w.subscribe_app_plan_id) && t[g.Returns].app_plan_id == ((j = i[g.Returns]) == null ? void 0 : j.subscribe_app_plan_id); }, [i, t]), m = Z(() => { var w, j; return t[g.Tracking].app_plan_id == ((w = i[g.Tracking]) == null ? void 0 : w.next_plan_id) && t[g.Returns].app_plan_id == ((j = i[g.Returns]) == null ? void 0 : j.next_plan_id); }, [i, t]), b = Z(() => m ? d("NextPlan") : O ? d("CurrentPlan") : a.user_pkg.trial_days_left > 0 ? d("StartXDayFreeTrial", { x: a.user_pkg.trial_days_left }) : d("ChooseThisPlan"), [a.user_pkg.trial_days_left, O, m, d]), C = Z(() => O || m ? t[g.Tracking].origin_price + t[g.Returns].origin_price : t[g.Tracking].actual_price + t[g.Returns].actual_price, [t, O, m]), A = Z(() => { if (P || v) { let w = function() { return v ? k ? j.slice(0, 1) : j : P ? j.slice(1) : []; }; const j = [ { content: d("ResumePlan"), onAction: () => { c(!1), e == null || e("resumePlan"); } }, { content: d("CancelPlan"), destructive: !0, onAction: () => { c(!1), e == null || e("cancelPlan"); } } ], X = w(); return X.length === 0 ? null : /* @__PURE__ */ p.jsx( AP, { active: l, activator: /* @__PURE__ */ p.jsx( et, { onClick: () => { c(!l); }, size: "large", icon: Cn } ), onClose: () => c(!1), preferredAlignment: "left", children: /* @__PURE__ */ p.jsx(RP, { actionRole: "menuitem", items: X }) } ); } return null; }, [l, v, P, k, e, d]); return /* @__PURE__ */ p.jsx(wt, { children: /* @__PURE__ */ p.jsxs(Se, { gap: "400", children: [ /* @__PURE__ */ p.jsxs(Se, { gap: "100", children: [ /* @__PURE__ */ p.jsx(N, { variant: "headingMd", as: "h2", children: "ParcelWILL Bundle" }), /* @__PURE__ */ p.jsxs(N, { as: "p", variant: "bodyMd", tone: "subdued", children: [ d("TakeTheFirstStepInDeliveringTheBe"), " " ] }) ] }), /* @__PURE__ */ p.jsx( mt, { title: `Tracking - ${St[t[g.Tracking].kind]}`, price: t[g.Tracking].actual_price, originPrice: t[g.Tracking].origin_price, justShowOriginPrice: O } ), /* @__PURE__ */ p.jsx( mt, { title: `Returns - ${St[t[g.Returns].kind]}`, price: t[g.Returns].actual_price, originPrice: t[g.Returns].origin_price, justShowOriginPrice: O } ), /* @__PURE__ */ p.jsx( mt, { title: "Protection - Free", price: 0, originPrice: 0, justShowOriginPrice: !0 } ), !O && /* @__PURE__ */ p.jsxs(fe, { gap: "200", align: "space-between", children: [ /* @__PURE__ */ p.jsxs(N, { as: "span", variant: "bodyMd", fontWeight: "medium", tone: "subdued", children: [ d("Discount"), " " ] }), /* @__PURE__ */ p.jsx(EP, { content: f[T].tooltip, hasUnderline: !0, children: /* @__PURE__ */ p.jsx( N, { as: "span", variant: "bodyMd", fontWeight: "medium", tone: "success", children: /* @__PURE__ */ p.jsx("span", { children: f[T].text }) } ) }) ] }), /* @__PURE__ */ p.jsxs(fe, { gap: "200", blockAlign: "center", align: "space-between", children: [ /* @__PURE__ */ p.jsxs(N, { as: "span", variant: "headingLg", tone: "subdued", children: [ d("Total"), " " ] }), /* @__PURE__ */ p.jsxs(N, { as: "span", variant: "headingXl", children: [ "$", pe(C), /* @__PURE__ */ p.jsxs(N, { as: "span", variant: "bodyMd", tone: "subdued", fontWeight: "medium", children: [ "/", d("month") ] }) ] }) ] }), /* @__PURE__ */ p.jsxs( fe, { gap: "200", blockAlign: "end", wrap: !1, align: "space-between", children: [ /* @__PURE__ */ p.jsx( et, { variant: "primary", fullWidth: !0, size: "large", onClick: async () => { await (e == null ? void 0 : e("choosePlan")); }, loading: r, disabled: r || O || m || o, children: b } ), A ] } ) ] }) }); }, nn = ({ title: n, price: e, isHot: t, checked: r, disabled: a, onClick: i }) => { const { t: o } = qe(); return /* @__PURE__ */ p.jsx( "div", { className: Le("pb-w-full pb-cursor-pointer pb-page-plan-card", { "pb-pointer-events-none": a }), onClick: () => { a || i == null || i(); }, children: /* @__PURE__ */ p.jsxs( "div", { className: "pb-p-3", style: { border: r ? "1px solid var(--p-color-border-focus, #f9f9f9)" : "1px solid #dedede", borderRadius: "var(--p-border-radius-base, 8px)" }, children: [ /* @__PURE__ */ p.jsxs( fe, { gap: "200", blockAlign: "start", align: "space-between", wrap: !1, children: [ /* @__PURE__ */ p.jsx( wP, { label: /* @__PURE__ */ p.jsx(N, { as: "h4", variant: "headingMd", children: n }), checked: r, disabled: a, onChange: i } ), t && /* @__PURE__ */ p.jsx("div", { className: "pb-text-white pb-bg-[#F36A5A] pb-py-[2px] pb-px-2 pb-h-5 pb-rounded-lg pb-inline-flex", children: /* @__PURE__ */ p.jsx(N, { as: "span", variant: "bodySm", fontWeight: "medium", children: "Hot" }) }) ] } ), /* @__PURE__ */ p.jsxs("div", { className: "pb-ml-6 pb-mt-3", children: [ /* @__PURE__ */ p.jsxs(N, { as: "span", variant: "headingLg", children: [ "$", pe(e) ] }), /* @__PURE__ */ p.jsxs(N, { as: "span", variant: "bodyMd", tone: "subdued", children: [ "/", o("month") ] }) ] }) ] } ) } ); }, mv = (n) => { var P, v, k, O; const { t: e } = qe(), { info: t, setInfo: r, rangList: a, steps: i, setSteps: o, pkgPriceInfo: s, currentPriceInfo: l, installInfo: c, period: d } = n, f = [ { appId: g.Tracking, icon: "https://return-cdn.parcelpanel.com/public/ParcelWILLLogo.png", title: "ParcelWILL Tracking", desc: e("DeliverEngagingBrandOrderTrackingEx"), plans: [ _.Essential, _.Professional, _.Enterprise ], quotaText: d === re.Year ? e("quotaYear") : e("quotaMonth"), avgText: e("AvgXPerOrder", { replace: { x: `$${((P = l[g.Tracking]) == null ? void 0 : P.avg_price_per_order) ?? 0}` } }), additionalText: e("XPerAdditionalQuota", { replace: { x: `$${((v = l[g.Tracking]) == null ? void 0 : v.one_price) ?? 0}` } }) }, { appId: g.Returns, icon: "https://return-cdn.parcelpanel.com/public/ParcelWILLLogo.png", title: "ParcelWILL Returns", desc: e("DeliverHassleFreeReturnAndEnticing"), plans: [ _.Essential, _.Professional, _.Enterprise ], quotaText: d === re.Year ? e("returnsYear") : e("returnsMonth"), avgText: e("AvgXPerReturn", { replace: { x: `$${((k = l[g.Returns]) == null ? void 0 : k.avg_price_per_order) ?? 0}` } }), additionalText: e("XPerAdditionalReturn", { replace: { x: `$${((O = l[g.Returns]) == null ? void 0 : O.one_price) ?? 0}` } }) }, { appId: g.Protection, icon: "https://return-cdn.parcelpanel.com/public/ParcelWILLLogo.png", title: "ParcelWILL Protection", desc: