Files
rion-ricing-mod/.config/BetterDiscord/plugins/ViewProfilePicture.plugin.js

875 lines
25 KiB
JavaScript

/**
* @name ViewProfilePicture
* @description Adds a button to the user popout and profile that allows you to view the Avatar and banner.
* @version 1.3.2
* @author Skamt
* @website https://github.com/Skamt/BDAddons/tree/main/ViewProfilePicture
* @source https://raw.githubusercontent.com/Skamt/BDAddons/main/ViewProfilePicture/ViewProfilePicture.plugin.js
*/
// config:@Config
var Config_default = {
"info": {
"name": "ViewProfilePicture",
"version": "1.3.2",
"description": "Adds a button to the user popout and profile that allows you to view the Avatar and banner.",
"source": "https://raw.githubusercontent.com/Skamt/BDAddons/main/ViewProfilePicture/ViewProfilePicture.plugin.js",
"github": "https://github.com/Skamt/BDAddons/tree/main/ViewProfilePicture",
"authors": [{
"name": "Skamt"
}]
},
"settings": {
"showOnHover": false,
"bannerColor": false
}
};
// common/Api.js
var Api = new BdApi(Config_default.info.name);
var UI = /* @__PURE__ */ (() => Api.UI)();
var DOM = /* @__PURE__ */ (() => Api.DOM)();
var Data = /* @__PURE__ */ (() => Api.Data)();
var React = /* @__PURE__ */ (() => Api.React)();
var Patcher = /* @__PURE__ */ (() => Api.Patcher)();
var Logger = /* @__PURE__ */ (() => Api.Logger)();
var Webpack = /* @__PURE__ */ (() => Api.Webpack)();
var findInTree = /* @__PURE__ */ (() => Api.Utils.findInTree)();
// common/Utils/Logger.js
Logger.patchError = (patchId) => {
console.error(`%c[${Config_default.info.name}] %cCould not find module for %c[${patchId}]`, "color: #3a71c1;font-weight: bold;", "", "color: red;font-weight: bold;");
};
var Logger_default = Logger;
// common/Utils/EventEmitter.js
var EventEmitter_default = class {
constructor() {
this.listeners = {};
}
isInValid(event, handler) {
return typeof event !== "string" || typeof handler !== "function";
}
once(event, handler) {
if (this.isInValid(event, handler)) return;
if (!this.listeners[event]) this.listeners[event] = /* @__PURE__ */ new Set();
const wrapper = () => {
handler();
this.off(event, wrapper);
};
this.listeners[event].add(wrapper);
}
on(event, handler) {
if (this.isInValid(event, handler)) return;
if (!this.listeners[event]) this.listeners[event] = /* @__PURE__ */ new Set();
this.listeners[event].add(handler);
return () => this.off(event, handler);
}
off(event, handler) {
if (this.isInValid(event, handler)) return;
if (!this.listeners[event]) return;
this.listeners[event].delete(handler);
if (this.listeners[event].size !== 0) return;
delete this.listeners[event];
}
emit(event, ...payload) {
if (!this.listeners[event]) return;
for (const listener of this.listeners[event]) {
try {
listener.apply(null, payload);
} catch (err) {
Logger_default.error(`Could not run listener for ${event}`, err);
}
}
}
};
// common/Utils/Plugin.js
var Events = {
START: "START",
STOP: "STOP"
};
var Plugin_default = new class extends EventEmitter_default {
start() {
this.emit(Events.START);
}
stop() {
this.emit(Events.STOP);
}
}();
// common/Utils/StylesLoader.js
var styleLoader = {
_styles: [],
push(styles) {
this._styles.push(styles);
}
};
Plugin_default.on(Events.START, () => {
DOM.addStyle(styleLoader._styles.join("\n"));
});
Plugin_default.on(Events.STOP, () => {
DOM.removeStyle();
});
var StylesLoader_default = styleLoader;
// src/ViewProfilePicture/styles.css
StylesLoader_default.push(`/* View Profile Button */
.VPP-Button {
background: rgb(1 0 1 / 54%);
cursor: pointer;
display: flex;
border-radius: 50%;
color: #fff;
width: 32px;
height: 32px;
justify-content: center;
align-items: center;
}
.VPP-float {
position: absolute;
top: 12px;
right: 12px;
z-index: 987;
}
.VPP-Button svg {
height: 18px;
width: 18px;
}
/* Bigger icon on profile */
.VPP-settings svg,
.VPP-profile svg {
height: 24px;
width: 24px;
}
.VPP-Button:hover {
background: rgb(1 0 1 / 64%);
}
/* div replacement if No banner */
.VPP-NoBanner {
width: 70vw;
height: 50vh;
position: relative;
}
/* Carousel Modal */
.VPP-carousel-modal {
background: #0000;
width: 100vw;
height: 100vh;
box-shadow: none !important;
}
.VPP-carousel {
position: static;
margin: auto;
}
.VPP-carousel > div[role="button"] {
margin: 0 15px;
background: var(--background-surface-high);
color: var(--interactive-normal);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.VPP-carousel > div[role="button"]:hover {
background: var(--background-surface-highest);
color: var(--interactive-hover);
}
/* Copy color button */
.VPP-copy-color-container {
position: absolute;
top: 100%;
display: flex;
cursor: pointer;
gap: 5px;
}
.VPP-copy-color-label,
.VPP-copy-color {
font-size: 14px;
font-weight: 500;
color: #fff;
line-height: 30px;
transition: opacity 0.15s ease;
opacity: 0.5;
text-transform: uppercase;
}
.VPP-copy-color:hover {
opacity: 1;
text-decoration: underline;
}
.VPP-separator {
line-height: 30px;
opacity: 0.5;
color: #fff;
}
.VPP-copy-color-label {
text-transform: capitalize;
}
.VPP-hover {
opacity: 0;
}
.VPP-container:hover .VPP-hover {
opacity: 1;
}
.VPP-colorFormat-options {
display: flex;
}
.VPP-colorFormat-options > div {
flex: 1;
}
`);
// common/Utils/index.js
function fit({ width, height, gap = 0.8 }) {
const ratio = Math.min(innerWidth / width, innerHeight / height);
width = Math.round(width * ratio);
height = Math.round(height * ratio);
return {
width,
height,
maxHeight: height * gap,
maxWidth: width * gap
};
}
function concateClassNames(...args) {
return args.filter(Boolean).join(" ");
}
var promiseHandler = (promise) => promise.then((data) => [void 0, data]).catch((err) => [err]);
function copy(data) {
DiscordNative.clipboard.copy(data);
}
var nop = () => {};
function getImageDimensions(url) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve({
width: img.width,
height: img.height
});
img.onerror = reject;
img.src = url;
});
}
// common/React.jsx
var useState = /* @__PURE__ */ (() => React.useState)();
var useMemo = /* @__PURE__ */ (() => React.useMemo)();
var React_default = /* @__PURE__ */ (() => React)();
// common/Components/ErrorBoundary/index.jsx
var ErrorBoundary = class extends React_default.Component {
state = { hasError: false, error: null, info: null };
componentDidCatch(error, info) {
this.setState({ error, info, hasError: true });
const errorMessage = `
${error?.message || ""}${(info?.componentStack || "").split("\n").slice(0, 20).join("\n")}`;
console.error(`%c[${Config_default?.info?.name || "Unknown Plugin"}] %cthrew an exception at %c[${this.props.id}]
`, "color: #3a71c1;font-weight: bold;", "", "color: red;font-weight: bold;", errorMessage);
}
renderErrorBoundary() {
return /* @__PURE__ */ React_default.createElement("div", { style: { background: "#292c2c", padding: "20px", borderRadius: "10px" } }, /* @__PURE__ */ React_default.createElement("b", { style: { color: "#e0e1e5" } }, "An error has occured while rendering ", /* @__PURE__ */ React_default.createElement("span", { style: { color: "orange" } }, this.props.id)));
}
renderFallback() {
if (React_default.isValidElement(this.props.fallback)) {
if (this.props.passMetaProps)
this.props.fallback.props = {
id: this.props.id,
plugin: Config_default?.info?.name || "Unknown Plugin",
...this.props.fallback.props
};
return this.props.fallback;
}
return /* @__PURE__ */ React_default.createElement(
this.props.fallback, {
id: this.props.id,
plugin: Config_default?.info?.name || "Unknown Plugin"
}
);
}
render() {
if (!this.state.hasError) return this.props.children;
return this.props.fallback ? this.renderFallback() : this.renderErrorBoundary();
}
};
// common/Components/icons/ErrorIcon/index.jsx
var ErrorIcon_default = (props) => /* @__PURE__ */ React.createElement("div", { ...props }, /* @__PURE__ */ React.createElement(
"svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "red",
width: "18",
height: "18"
},
/* @__PURE__ */
React.createElement(
"path", {
d: "M0 0h24v24H0z",
fill: "none"
}
),
/* @__PURE__ */
React.createElement("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" })
));
// common/Webpack.js
var getModule = /* @__PURE__ */ (() => Webpack.getModule)();
var Filters = /* @__PURE__ */ (() => Webpack.Filters)();
var getMangled = /* @__PURE__ */ (() => Webpack.getMangled)();
var getStore = /* @__PURE__ */ (() => Webpack.getStore)();
function reactRefMemoFilter(type, ...args) {
const filter = Filters.byStrings(...args);
return (target) => target[type] && filter(target[type]);
}
function getModuleAndKey(filter, options) {
let module2;
const target = getModule((entry, m) => filter(entry) ? module2 = m : false, options);
module2 = module2?.exports;
if (!module2) return;
const key = Object.keys(module2).find((k) => module2[k] === target);
if (!key) return;
return { module: module2, key };
}
// common/DiscordModules/zustand.js
var { zustand } = getMangled(Filters.bySource("useSyncExternalStoreWithSelector", "useDebugValue", "subscribe"), {
_: Filters.byStrings("subscribe"),
zustand: () => true
});
var subscribeWithSelector = getModule(Filters.byStrings("equalityFn", "fireImmediately"), { searchExports: true });
function create(initialState) {
const Store = zustand(initialState);
Object.defineProperty(Store, "state", {
configurable: false,
get: () => Store.getState()
});
return Store;
}
// common/Utils/Settings.js
var SettingsStore = create(subscribeWithSelector(() => Object.assign(Config_default.settings, Data.load("settings") || {})));
((state) => {
const selectors = {};
const actions = {};
for (const [key, value] of Object.entries(state)) {
actions[`set${key}`] = (newValue) => SettingsStore.setState({
[key]: newValue });
selectors[key] = (state2) => state2[key];
}
Object.defineProperty(SettingsStore, "selectors", { value: Object.assign(selectors) });
Object.assign(SettingsStore, actions);
})(SettingsStore.getInitialState());
SettingsStore.subscribe(
(state) => state,
() => Data.save("settings", SettingsStore.state)
);
Object.assign(SettingsStore, {
useSetting: (key) => {
const val = SettingsStore((state) => state[key]);
return [val, SettingsStore[`set${key}`]];
}
});
var Settings_default = SettingsStore;
// common/Utils/Modals/styles.css
StylesLoader_default.push(`.transparent-background.transparent-background{
background: transparent;
border:unset;
}`);
// common/Utils/Modals/index.jsx
var ModalActions = /* @__PURE__ */ getMangled("onCloseRequest:null!=", {
openModal: /* @__PURE__ */ Filters.byStrings("onCloseRequest:null!="),
closeModal: /* @__PURE__ */ Filters.byStrings(".setState", ".getState()["),
ModalStore: /* @__PURE__ */ Filters.byKeys("getState")
});
var Modals = /* @__PURE__ */ getMangled( /* @__PURE__ */ Filters.bySource("root", "headerIdIsManaged"), {
ModalRoot: /* @__PURE__ */ Filters.byStrings("rootWithShadow"),
ModalFooter: /* @__PURE__ */ Filters.byStrings(".footer"),
ModalContent: /* @__PURE__ */ Filters.byStrings(".content"),
ModalHeader: /* @__PURE__ */ Filters.byStrings(".header", "separator"),
Animations: (a) => a.SUBTLE,
Sizes: (a) => a.DYNAMIC,
ModalCloseButton: Filters.byStrings(".close]:")
});
var openModal = (children, tag, { className, ...modalRootProps } = {}) => {
const id = `${tag ? `${tag}-` : ""}modal`;
return ModalActions.openModal((props) => {
return /* @__PURE__ */ React.createElement(
ErrorBoundary, {
id,
plugin: Config_default.info.name
},
/* @__PURE__ */
React.createElement(
Modals.ModalRoot, {
onClick: props.onClose,
transitionState: props.transitionState,
className: concateClassNames("transparent-background", className),
size: Modals.Sizes.DYNAMIC,
...modalRootProps
},
React.cloneElement(children, { ...props })
)
);
});
};
// MODULES-AUTO-LOADER:@Modules/Tooltip
var Tooltip_default = getModule(Filters.byPrototypeKeys("renderTooltip"), { searchExports: true });
// common/Components/Tooltip/index.jsx
var Tooltip_default2 = ({ note, position, children }) => {
return /* @__PURE__ */ React.createElement(
Tooltip_default, {
text: note,
position: position || "top"
},
(props) => React.cloneElement(children, {
...props,
...children.props
})
);
};
// common/Components/icons/ImageIcon/index.jsx
function ImageIcon(props) {
return /* @__PURE__ */ React.createElement(
"svg", {
fill: "currentColor",
width: "24",
height: "24",
viewBox: "-50 -50 484 484",
...props
},
/* @__PURE__ */
React.createElement("path", { d: "M341.333,0H42.667C19.093,0,0,19.093,0,42.667v298.667C0,364.907,19.093,384,42.667,384h298.667 C364.907,384,384,364.907,384,341.333V42.667C384,19.093,364.907,0,341.333,0z M42.667,320l74.667-96l53.333,64.107L245.333,192l96,128H42.667z" })
);
}
// common/Utils/ImageModal/styles.css
StylesLoader_default.push(`.downloadLink {
color: white !important;
font-size: 14px;
font-weight: 500;
/* line-height: 18px;*/
text-decoration: none;
transition: opacity.15s ease;
opacity: 0.5;
}
.imageModalwrapper {
display: flex;
flex-direction: column;
}
.imageModalOptions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 4px;
}
`);
// MODULES-AUTO-LOADER:@Stores/AccessibilityStore
var AccessibilityStore_default = getStore("AccessibilityStore");
// common/Utils/ImageModal/index.jsx
var RenderLinkComponent = getModule((m) => m.type?.toString?.().includes("MASKED_LINK"), { searchExports: false });
var ImageModal = getModule(reactRefMemoFilter("type", "renderLinkComponent"), { searchExports: true });
function h(e, t) {
let n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
true === n || AccessibilityStore_default.useReducedMotion ? e.set(t) : e.start(t);
}
var useSomeScalingHook = getModule(Filters.byStrings("reducedMotion.enabled", "useSpring", "respect-motion-settings"), { searchExports: true });
var context = getModule((a) => a?._currentValue?.scale, { searchExports: true });
var ImageComponent = ({ url, ...rest }) => {
const [x, P] = useState(false);
const [M, w] = useSomeScalingHook(() => ({
scale: AccessibilityStore_default.useReducedMotion ? 1 : 0.9,
x: 0,
y: 0,
config: {
friction: 30,
tension: 300
}
}));
const contextVal = useMemo(
() => ({
scale: M.scale,
x: M.x,
y: M.y,
setScale(e, t) {
h(M.scale, e, null == t ? void 0 : t.immediate);
},
setOffset(e, t, n) {
h(M.x, e, null == n ? void 0 : n.immediate), h(M.y, t, null == n ? void 0 : n.immediate);
},
zoomed: x,
setZoomed(e) {
P(e), h(M.scale, e ? 2.5 : 1), e || (h(M.x, 0), h(M.y, 0));
}
}),
[x, M]
);
return /* @__PURE__ */ React_default.createElement(context.Provider, { value: contextVal }, /* @__PURE__ */ React_default.createElement("div", { className: "imageModalwrapper" }, /* @__PURE__ */ React_default.createElement(
ImageModal, {
maxWidth: rest.maxWidth,
maxHeight: rest.maxHeight,
media: {
...rest,
type: "IMAGE",
url,
proxyUrl: url
}
}
), !x && /* @__PURE__ */ React_default.createElement("div", { className: "imageModalOptions" }, /* @__PURE__ */ React_default.createElement(
RenderLinkComponent, {
className: "downloadLink",
href: url
},
"Open in Browser"
))));
};
// MODULES-AUTO-LOADER:@Modules/Color
var Color_default = getModule(Filters.byKeys("Color", "hex", "hsl"), { searchExports: false });
// MODULES-AUTO-LOADER:@Stores/ThemeStore
var ThemeStore_default = getStore("ThemeStore");
// common/Utils/Toast.js
function showToast(content, type) {
UI.showToast(`[${Config_default.info.name}] ${content}`, { timeout: 5e3, type });
}
var Toast_default = {
success(content) {
showToast(content, "success");
},
info(content) {
showToast(content, "info");
},
warning(content) {
showToast(content, "warning");
},
error(content) {
showToast(content, "error");
}
};
// src/ViewProfilePicture/components/ColorModalComponent.jsx
var DesignSystem = getModule((a) => a?.unsafe_rawColors?.PRIMARY_800?.resolve);
function resolveColor() {
if (!DesignSystem?.unsafe_rawColors?.PRIMARY_800) return "#111214";
return DesignSystem.unsafe_rawColors?.PRIMARY_800.resolve({
theme: ThemeStore_default.theme,
saturation: AccessibilityStore_default.saturation
}).hex();
}
function copyColor(type, color) {
let c2 = color;
try {
switch (type) {
case "hex":
c2 = Color_default(color).hex();
break;
case "rgba":
c2 = Color_default(color).css("rgba");
break;
case "hsla":
c2 = Color_default(color).css("hsla");
break;
}
} finally {
copy(c2);
Toast_default.success(`${c2} Copied!`);
}
}
function SimpleColorModal({ color }) {
return /* @__PURE__ */ React_default.createElement(
"div", {
onClick: (e) => e.stopPropagation(),
className: "VPP-NoBanner",
style: { backgroundColor: Color_default(color).css() }
},
/* @__PURE__ */
React_default.createElement("div", { className: "VPP-copy-color-container" }, /* @__PURE__ */ React_default.createElement("span", { className: "VPP-copy-color-label" }, "Copy Color:"), ["hex", false, "rgba", false, "hsla"].map(
(name) => name ? /* @__PURE__ */ React_default.createElement(
"a", {
className: "VPP-copy-color",
onClick: (e) => {
e.stopPropagation();
copyColor(name, color);
}
},
name
) : /* @__PURE__ */ React_default.createElement("span", { className: "VPP-separator" }, "|")
))
);
}
var {
module: { ZP: palletHook }
} = getModuleAndKey(Filters.byStrings("toHexString", "toHsl", "palette"), { searchExports: true }) || {};
function ColorModal({ displayProfile, user }) {
const color = palletHook(user.getAvatarURL(displayProfile.guildId, 80));
return /* @__PURE__ */ React_default.createElement(SimpleColorModal, { color: color || resolveColor() });
}
var ColorModalComponent_default = {
SimpleColorModal,
ColorModal
};
// MODULES-AUTO-LOADER:@Modules/ModalCarousel
var ModalCarousel_default = getModule(Filters.byPrototypeKeys("navigateTo", "preloadImage"), { searchExports: false });
// src/ViewProfilePicture/components/ModalCarousel.jsx
var ModalCarousel_default2 = class extends ModalCarousel_default {
preloadNextImages() {}
};
// MODULES-AUTO-LOADER:@Modules/Spinner
var Spinner_default = getModule((a) => a?.Type?.CHASING_DOTS, { searchExports: true });
// src/ViewProfilePicture/components/ViewProfilePictureButtonComponent.jsx
function Banner({ url, src }) {
const [loaded, setLoaded] = React_default.useState(false);
const dimsRef = React_default.useRef();
React_default.useEffect(() => {
(async () => {
const [err, dims] = await promiseHandler(getImageDimensions(src));
dimsRef.current = fit(err ? {} : dims);
setLoaded(true);
})();
}, []);
if (!loaded) return /* @__PURE__ */ React_default.createElement(Spinner_default, { type: Spinner_default.Type.SPINNING_CIRCLE });
return /* @__PURE__ */ React_default.createElement(
ImageComponent, {
url,
...dimsRef.current
}
);
}
var ViewProfilePictureButtonComponent_default = ({ className, user, displayProfile }) => {
const showOnHover = Settings_default(Settings_default.selectors.showOnHover);
const handler = () => {
const avatarURL = user.getAvatarURL(displayProfile.guildId, 4096, true);
const bannerURL = displayProfile.getBannerURL({ canAnimate: true, size: 4096 });
const color = displayProfile.accentColor || displayProfile.primaryColor;
const items = [
/* @__PURE__ */
React_default.createElement(
ImageComponent, {
url: avatarURL,
...fit({ width: 4096, height: 4096 })
}
),
bannerURL && /* @__PURE__ */ React_default.createElement(
Banner, {
url: bannerURL,
src: displayProfile.getBannerURL({ canAnimate: true, size: 20 })
}
),
(!bannerURL || Settings_default.getState().bannerColor) && (color ? /* @__PURE__ */ React_default.createElement(ColorModalComponent_default.SimpleColorModal, { color }) : /* @__PURE__ */ React_default.createElement(
ColorModalComponent_default.ColorModal, {
user,
displayProfile
}
))
].filter(Boolean).map((item) => ({ component: item }));
openModal(
/* @__PURE__ */
React_default.createElement(
ModalCarousel_default2, {
startWith: 0,
className: "VPP-carousel",
items
}
),
"VPP-carousel", { className: "VPP-carousel-modal" }
);
};
return /* @__PURE__ */ React_default.createElement(Tooltip_default2, { note: "View profile picture" }, /* @__PURE__ */ React_default.createElement(
"div", {
onClick: handler,
className: concateClassNames(className, showOnHover && "VPP-hover")
},
/* @__PURE__ */
React_default.createElement(ImageIcon, null)
));
};
// src/ViewProfilePicture/patches/patchVPPButton.jsx
var UserProfileModalforwardRef = getModule(Filters.byKeys("Overlay", "render"));
var typeFilter = Filters.byStrings("div", "wrapper", "children");
Plugin_default.on(Events.START, () => {
if (!UserProfileModalforwardRef) return Logger_default.patchError("patchVPPButton");
const unpatch = Patcher.after(UserProfileModalforwardRef, "render", (_, [props], ret) => {
const target = findInTree(ret, (a) => typeFilter(a?.type), { walkable: ["props", "children"] }) || findInTree(ret, (a) => a?.type === "header" || a?.props?.className?.startsWith("profileHeader"), { walkable: ["props", "children"] });
if (!target) return;
ret.props.className = `${ret.props.className} VPP-container`;
target.props.children.unshift(
/* @__PURE__ */
React.createElement(
ErrorBoundary, {
id: "ViewProfilePictureButtonComponent",
plugin: Config_default.info.name,
fallback: /* @__PURE__ */ React.createElement(ErrorIcon_default, { className: "VPP-Button" })
},
/* @__PURE__ */
React.createElement(
ViewProfilePictureButtonComponent_default, {
className: concateClassNames("VPP-Button", !typeFilter(target?.type) && "VPP-float"),
user: props.user,
displayProfile: props.displayProfile
}
)
)
);
});
Plugin_default.once(Events.STOP, unpatch);
});
// MODULES-AUTO-LOADER:@Modules/FormSwitch
var FormSwitch_default = getModule(Filters.byStrings("note", "tooltipNote"), { searchExports: true });
// common/Components/Switch/index.jsx
var Switch_default = getModule(Filters.byStrings('"data-toggleable-component":"switch"', 'layout:"horizontal"'), { searchExports: true }) || function SwitchComponentFallback(props) {
return /* @__PURE__ */ React.createElement("div", { style: { color: "#fff" } }, props.children, /* @__PURE__ */ React.createElement(
"input", {
type: "checkbox",
checked: props.value,
onChange: (e) => props.onChange(e.target.checked)
}
));
};
// common/Components/SettingSwtich/index.jsx
function SettingSwtich({ settingKey, note, onChange = nop, description, ...rest }) {
const [val, set] = Settings_default.useSetting(settingKey);
return /* @__PURE__ */ React.createElement(
Switch_default, {
...rest,
checked: val,
label: description || settingKey,
description: note,
onChange: (e) => {
set(e);
onChange(e);
}
}
);
}
// common/Components/FieldSet/styles.css
StylesLoader_default.push(`.fieldset-container {
display: flex;
flex-direction: column;
gap: 16px;
}
.fieldset-label {
margin-bottom: 12px;
}
.fieldset-description {
margin-bottom: 12px;
}
.fieldset-label + .fieldset-description{
margin-top:-8px;
margin-bottom: 0;
}
.fieldset-content {
display: flex;
flex-direction: column;
width: 100%;
justify-content: flex-start;
}
`);
// MODULES-AUTO-LOADER:@Modules/Heading
var Heading_default = getModule((a) => a?.render?.toString().includes("data-excessive-heading-level"), { searchExports: true });
// common/Utils/css.js
var classNameFactory = (prefix = "", connector = "-") => (...args) => {
const classNames = /* @__PURE__ */ new Set();
for (const arg of args) {
if (arg && typeof arg === "string") classNames.add(arg);
else if (Array.isArray(arg)) arg.forEach((name) => classNames.add(name));
else if (arg && typeof arg === "object") Object.entries(arg).forEach(([name, value]) => value && classNames.add(name));
}
return Array.from(classNames, (name) => `${prefix}${connector}${name}`).join(" ");
};
// common/Components/FieldSet/index.jsx
var c = classNameFactory("fieldset");
function FieldSet({ label, description, children, contentGap = 16 }) {
return /* @__PURE__ */ React_default.createElement("fieldset", { className: c("container") }, label && /* @__PURE__ */ React_default.createElement(
Heading_default, {
className: c("label"),
tag: "legend",
variant: "text-lg/medium"
},
label
), description && /* @__PURE__ */ React_default.createElement(
Heading_default, {
className: c("description"),
variant: "text-sm/normal",
color: "text-secondary"
},
description
), /* @__PURE__ */ React_default.createElement("div", { className: c("content"), style: { gap: contentGap } }, children));
}
// src/ViewProfilePicture/components/SettingComponent.jsx
function SettingComponent() {
return /* @__PURE__ */ React_default.createElement(FieldSet, { contentGap: 8 }, [{
settingKey: "showOnHover",
note: "By default hide ViewProfilePicture button and show on hover.",
description: "Show on hover"
},
{
settingKey: "bannerColor",
note: "Always include banner color in carousel, even if a banner is present.",
description: "Include banner color."
}
].map(SettingSwtich));
}
// src/ViewProfilePicture/index.jsx
Plugin_default.getSettingsPanel = () => /* @__PURE__ */ React_default.createElement(SettingComponent, null);
module.exports = () => Plugin_default;