PageSourceSearch

https://charluv.com/assets/Profile-CqGflEZ0.js

js charluv.com collected 2026-10-02 01:25:40 UTC 19,901 bytes, 431 lines download raw bytes

1import { _ as _objectWithoutPropertiesLoose, k as useContext, I as IconContext, s as setAttribute, l as spread, i as insert, t as template, f as createSignal, c as createComponent, F as For, e as createRenderEffect, n as classList, d as Show, T as TextInput, B as Button, X, h as memo, M as Modal, p as charsApi, q as toastStore, j as delegateEvents, r as useParams, u as useNavigate, m as matchStore, v as createMemo, o as onMount, w as createEffect, x as BOT_REPLACE, y as SELF_REPLACE, g as getAssetUrl, b as userStore, L as Loading, z as settingStore } from "./index-BhA_zdKR.js";
2/* empty css                 */
3import { R as REPORT_REASONS } from "./publish-Bzi-vdg0.js";
4const _tmpl$$2 = template(`<svg><line x1="40" y1="216.00452" x2="40" y2="48.00452" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></line></svg>`, 4, true), _tmpl$2$2 = template(`<svg><path d="M39.99951,168.00452c64-48,112,48,176,0v-120c-64,48-112-48-176,0" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"></path></svg>`, 4, true), _tmpl$3$2 = template(`<svg><path d="M39.99951,168.00452c64-48,112,48,176,0v-120c-64,48-112-48-176,0Z" opacity="0.2"></path></svg>`, 4, true), _tmpl$4$1 = template(`<svg><line x1="40" y1="216.00452" x2="40" y2="48.00452" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></line></svg>`, 4, true), _tmpl$5$1 = template(`<svg><path d="M39.99951,168.00452c64-48,112,48,176,0v-120c-64,48-112-48-176,0" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>`, 4, true), _tmpl$6$1 = template(`<svg><path d="M219.57764,40.84924a7.99605,7.99605,0,0,0-8.37793.75489c-28.29981,21.22558-52.28223,10.94726-80.04883-.95313-28.24414-12.10449-60.25488-25.81934-95.95117.95313-.04737.0354-.08838.07568-.13428.11181-.11084.08692-.21777.17676-.32373.26929-.09912.08667-.19727.17407-.291.26465-.0874.08423-.17138.17138-.25488.25952-.1001.10547-.19873.21142-.292.32129-.0708.08349-.1377.16968-.20508.25586-.09277.11865-.18457.23779-.26953.36084-.06348.09082-.12158.18457-.18115.27807-.07715.12232-.1543.24439-.22461.37036-.06006.10694-.11475.217-.16992.32715-.05811.1167-.11719.23291-.16944.35181-.05566.126-.105.25513-.15429.38428-.04151.10913-.0835.218-.12012.32861-.04541.137-.084.27661-.12207.417-.03028.11084-.06055.22119-.08594.33325-.03027.13526-.05518.27271-.07861.41065-.02149.12524-.042.25024-.05762.37646-.01514.12427-.02588.24927-.03564.37525-.01075.14575-.01856.2915-.022.43774-.001.05615-.0083.11035-.0083.16651v168a8,8,0,0,0,16,0V172.13879c26.92334-18.16259,50.13623-8.22973,76.84863,3.21924,16.26368,6.96973,33.7754,14.47559,52.52247,14.47461,13.80859,0,28.2871-4.07226,43.42871-15.42773a8.00094,8.00094,0,0,0,3.20019-6.40039v-120A8.00023,8.00023,0,0,0,219.57764,40.84924Z"></path></svg>`, 4, true), _tmpl$7$1 = template(`<svg><line x1="40" y1="216.00452" x2="40" y2="48.00452" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></line></svg>`, 4, true), _tmpl$8$1 = template(`<svg><path d="M39.99951,168.00452c64-48,112,48,176,0v-120c-64,48-112-48-176,0" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"></path></svg>`, 4, true), _tmpl$9$1 = template(`<svg><line x1="40" y1="216.00452" x2="40" y2="48.00452" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></line></svg>`, 4, true), _tmpl$10$1 = template(`<svg><path d="M39.99951,168.00452c64-48,112,48,176,0v-120c-64,48-112-48-176,0" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"></path></svg>`, 4, true), _tmpl$11$1 = template(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"></rect></svg>`, 4);
5var renderPathFor = function renderPathFor2(weight, color) {
6  switch (weight) {
7    case "bold":
8      return [(function() {
9        var _el$ = _tmpl$$2.cloneNode(true);
10        setAttribute(_el$, "stroke", color);
11        return _el$;
12      })(), (function() {
13        var _el$2 = _tmpl$2$2.cloneNode(true);
14        setAttribute(_el$2, "stroke", color);
15        return _el$2;
16      })()];
17    case "duotone":
18      return [_tmpl$3$2.cloneNode(true), (function() {
19        var _el$4 = _tmpl$4$1.cloneNode(true);
20        setAttribute(_el$4, "stroke", color);
21        return _el$4;
22      })(), (function() {
23        var _el$5 = _tmpl$5$1.cloneNode(true);
24        setAttribute(_el$5, "stroke", color);
25        return _el$5;
26      })()];
27    case "fill":
28      return _tmpl$6$1.cloneNode(true);
29    case "light":
30      return [(function() {
31        var _el$7 = _tmpl$7$1.cloneNode(true);
32        setAttribute(_el$7, "stroke", color);
33        return _el$7;
34      })(), (function() {
35        var _el$8 = _tmpl$8$1.cloneNode(true);
36        setAttribute(_el$8, "stroke", color);
37        return _el$8;
38      })()];
39    case "thin":
40      return [(function() {
41        var _el$9 = _tmpl$9$1.cloneNode(true);
42        setAttribute(_el$9, "stroke", color);
43        return _el$9;
44      })(), (function() {
45        var _el$10 = _tmpl$10$1.cloneNode(true);
46        setAttribute(_el$10, "stroke", color);
47        return _el$10;
48      })()];
49    case "regular":
50      return [(function() {
51        var _el$11 = _tmpl$4$1.cloneNode(true);
52        setAttribute(_el$11, "stroke", color);
53        return _el$11;
54      })(), (function() {
55        var _el$12 = _tmpl$5$1.cloneNode(true);
56        setAttribute(_el$12, "stroke", color);
57        return _el$12;
58      })()];
59    default:
60      console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".');
61      return null;
62  }
63};
64var Flag = function Flag2(props, ref) {
65  var color = props.color, size = props.size, weight = props.weight, mirrored = props.mirrored, children = props.children, restProps = _objectWithoutPropertiesLoose(props, ["color", "size", "weight", "mirrored", "children"]);
66  var _useContext = useContext(IconContext), contextColor = _useContext.color, contextSize = _useContext.size, contextWeight = _useContext.weight, contextMirrored = _useContext.mirrored, restContext = _objectWithoutPropertiesLoose(_useContext, ["color", "size", "weight", "mirrored"]);
67  return (function() {
68    var _el$13 = _tmpl$11$1.cloneNode(true), _el$14 = _el$13.firstChild;
69    var _ref$ = ref;
70    typeof _ref$ === "function" ? _ref$(_el$13) : ref = _el$13;
71    setAttribute(_el$13, "width", size != null ? size : contextSize);
72    setAttribute(_el$13, "height", size != null ? size : contextSize);
73    setAttribute(_el$13, "fill", color != null ? color : contextColor);
74    setAttribute(_el$13, "transform", mirrored || contextMirrored ? "scale(-1, 1)" : void 0);
75    spread(_el$13, restContext, true, true);
76    spread(_el$13, restProps, true, true);
77    insert(_el$13, children, _el$14);
78    insert(_el$13, function() {
79      return renderPathFor(weight != null ? weight : contextWeight, color != null ? color : contextColor);
80    }, null);
81    return _el$13;
82  })();
83};
84var _tmpl$$1 = /* @__PURE__ */ template(`<div class="flex flex-col gap-3 text-sm"><p class=text-600>Tell us what's wrong with this character. Reports are anonymous.</p><div class="flex flex-wrap gap-2">`), _tmpl$2$1 = /* @__PURE__ */ template(`<span class="flex items-center gap-2"> Report `), _tmpl$3$1 = /* @__PURE__ */ template(`<button class="rounded-full border px-3 py-1.5 text-sm">`);
85const ReportModal = (props) => {
86  const [reason, setReason] = createSignal("");
87  const [note, setNote] = createSignal("");
88  const [sending, setSending] = createSignal(false);
89  const submit = async () => {
90    if (!reason()) return;
91    setSending(true);
92    const res = await charsApi.reportCharacter(props.charId, reason(), note(
92).trim() || void 0);
93    setSending(false);
94    if (res.error) {
95      toastStore.error(`Could not submit report: ${res.error}`);
96      return;
97    }
98    toastStore.success("Thanks — our moderators will take a look.");
99    setReason("");
100    setNote("");
101    props.close();
102  };
103  return createComponent(Modal, {
104    get show() {
105      return props.show;
106    },
107    get close() {
108      return props.close;
109    },
110    maxWidth: "half",
111    get title() {
112      return (() => {
113        var _el$4 = _tmpl$2$1(), _el$5 = _el$4.firstChild;
114        insert(_el$4, createComponent(Flag, {
115          size: 18
116        }), _el$5);
117        insert(_el$4, () => props.name || "character", null);
118        return _el$4;
119      })();
120    },
121    get footer() {
122      return [createComponent(Button, {
123        schema: "secondary",
124        get onClick() {
125          return props.close;
126        },
127        get children() {
128          return [createComponent(X, {}), " Cancel"];
129        }
130      }), createComponent(Button, {
131        schema: "red",
132        onClick: submit,
133        get disabled() {
134          return !reason() || sending();
135        },
136        get children() {
137          return [createComponent(Flag, {}), " ", memo(() => sending() ? "Sending…" : "Submit report")];
138        }
139      })];
140    },
141    get children() {
142      var _el$ = _tmpl$$1(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
143      insert(_el$3, createComponent(For, {
144        each: REPORT_REASONS,
145        children: (r) => (() => {
146          var _el$6 = _tmpl$3$1();
147          _el$6.$$click = () => setReason(r.value);
148          insert(_el$6, () => r.label);
149          createRenderEffect((_$p) => classList(_el$6, {
150            "border-[var(--hl-500)] bg-[var(--hl-900)]": reason() === r.value,
151            "border-[var(--bg-700)]": reason() !== r.value
152          }, _$p));
153          return _el$6;
154        })()
155      }));
156      insert(_el$, createComponent(Show, {
157        get when() {
158          return reason();
159        },
160        get children() {
161          return createComponent(TextInput, {
162            fieldName: "note",
163            isMultiline: true,
164            placeholder: "Anything else we should know? (optional)",
165            get value() {
166              return note();
167            },
168            onChange: (e) => setNote(e.currentTarget.value)
169          });
170        }
171      }), null);
172      return _el$;
173    }
174  });
175};
176delegateEvents(["click"]);
177var _tmpl$ = /* @__PURE__ */ template(`<button type=button class=dpf-main-btn><img class=dpf-main>`), _tmpl$2 = /* @__PURE__ */ template(`<span class=dpf-title-age>, `), _tmpl$3 = /* @__PURE__ */ template(`<p class=dpf-creator>Created by `), _tmpl$4 = /* @__PURE__ */ template(`<div class=dpf-field><label>About</label><p class=dpf-desc>`), _tmpl$5 = /* @__PURE__ */ template(`<dl class=dpf-facets>`), _tmpl$6 = /* @__PURE__ */ template(`<div class=dpf-thumbs>`), _tmpl$7 = /* @__PURE__ */ template(`<button class="dpf-btn danger"> Report`), _tmpl$8 = /* @__PURE__ */ template(`<div class=dpf-layout><div class=dpf-detail><h1 class=dpf-title></h1><div class=dpf-field></div><div class=dpf-actions><button class="dpf-btn primary">Match &amp; Start Chat</button><button class="dpf-btn ghost">Back`), _tmpl$9 = /* @__PURE__ */ template(`<div class=dpf-root>`), _tmpl$0 = /* @__PURE__ */ template(`<div class=dpf-loading>`), _tmpl$1 = /* @__PURE__ */ template(`<div class=dpf-ph aria-hidden=true>`), _tmpl$10 = /* @__PURE__ */ template(`<div class=dpf-facet><dt></dt><dd>`), _tmpl$11 = /* @__PURE__ */ template(`<button type=button class=dpf-thumb><img alt loading=lazy>`, true, false, false);
178const attr = (char, key) => {
179  const attrs = char?.persona?.attributes;
180  const val = attrs?.[key];
181  if (!val?.length) return void 0;
182  return val.join(", ");
183};
184const FACETS = [{
185  key: "sexuality",
186  label: "Sexuality"
187}, {
188  key: "likes",
189  label: "Likes"
190}, {
191  key: "country",
192  label: "Country"
193}, {
194  key: "zodiac",
195  label: "Zodiac"
196}, {
197  key: "job",
198  label: "Job"
199}];
200const Profile = () => {
201  const params = useParams();
202  const navigate = useNavigate();
203  const state = matchStore();
204  const [name, setName] = createSignal("");
205  const [showReport, setShowReport] = createSignal(false);
206  const char = createMemo(() => {
207    const fromList = state.discover.list.find((c) => c._id === params.id);
208    if (fromList) return fromList;
209    const selected = state.discover.selected;
210    if (selected && selected._id === params.id) return selected;
211    return void 0;
212  });
213  onMount(() => {
214    if (!char()) {
215      matchStore.getDiscoverChar(params.id);
216    }
217  });
218  createEffect(() => {
219    const c = char();
220    if (c && !name()) setName(c.name || "");
221  });
222  const age = createMemo(() => {
223    const c = char();
224    const exact = attr(c, "age");
225    if (exact && /\d/.test(exact)) return exact;
226    return c?.ageRange || exact;
227  });
228  const ageShort = createMemo(() => age()?.match(/\d+/)?.[0] || "");
229  const description = createMemo(() => {
230    const c = char();
231    const raw = c?.description || attr(c, "description") || "";
232    return raw.replace(BOT_REPLACE, name() || c?.name || "").replace(SELF_REPLACE, "you");
233  });
234  const shots = createMemo(() => {
235    const c = char();
236    if (!c) return [];
237    return Array.from(new Set([c.avatar, ...c.gallery ?? []].filter(Boolean)));
238  });
239  const [main, setMain] = createSignal();
240  createEffect(() => {
241    const s = shots();
242    if (s.length && (!main() || !s.includes(main()))) setMain(s[0]);
243  });
244  const initial = () => char()?.name?.[0]?.toUpperCase() || "?";
245  const openImage = (url) => settingStore.showImage(getAssetUrl(url));
246  const onMatch = () => {
247    const c = char();
248    if (!c) return;
249    if (!userStore().loggedIn) {
250      navigate(`/register?return=/discover/${c._id}`);
251      return;
252    }
253    matchStore.createMatch(c, navigate, name().trim() || c.name);
254  };
255  return (() => {
256    var _el$ = _tmpl$9();
257    insert(_el$, createComponent(Show, {
258      get when() {
259        return char();
260      },
261      get fallback() {
262        return (() => {
263          var _el$20 = _tmpl$0();
264          insert(_el$20, createComponent(Loading, {}));
265          return _el$20;
266        })();
267      },
268      get children() {
269        return [(() => {
270          var _el$2 = _tmpl$8(), _el$5 = _el$2.firstChild, _el$6 = _el$5.firstChild, _el$1 = _el$6.nextSibling, _el$15 = _el$1.nextSibling, _el$16 = _el$15.firstChild, _el$17 = _el$16.nextSibling;
271          insert(_el$2, createComponent(Show, {
272            get when() {
273              return main();
274            },
275            get fallback() {
276              return (() => {
277                var _el$21 = _tmpl$1();
278                insert(_el$21, initial);
279                return _el$21;
280              })();
281            },
282            get children() {
283              var _el$3 = _tmpl$(), _el$4 = _el$3.firstChild;
284              _el$3.$$click = () => openImage(main());
285              createRenderEffect((_p$) => {
286                var _v$ = `View photo of ${char().name} fullscreen`, _v$2 = getAssetUrl(main()), _v$3 = `Photo of ${char().name}`;
287                _v$ !== _p$.e && setAttribute(_el$3, "aria-label", _p$.e = _v$);
288                _v$2 !== _p$.t && setAttribute(_el$4, "src", _p$.t = _v$2);
289                _v$3 !== _p$.a && setAttribute(_el$4, "alt", _p$.a = _v$3);
290                return _p$;
291              }, {
292                e: void 0,
293                t: void 0,
294                a: void 0
295              });
296              return _el$3;
297            }
298          }), _el$5);
299          insert(_el$6, () => name() || char().name, null);
300          insert(_el$6, createComponent(Show, {
301            get when() {
302              return ageShort();
303            },
304            get children() {
305              var _el$7 = _tmpl$2();
306              _el$7.firstChild;
307              insert(_el$7, ageShort, null);
308              return _el$7;
309            }
310          }), null);
311          insert(_el$5, createComponent(Show, {
312            get when() {
313              return char().creatorName;
314            },
315            get children() {
316              var _el$9 = _tmpl$3();
317              _el$9.firstChild;
318              insert(_el$9, () => char().creatorName, null);
319              return _el$9;
320            }
321          }), _el$1);
322          insert(_el$1, createComponent(TextInput, {
323            fieldName: "matchName",
324            label: "Name (you can rename them before matching)",
325            get value() {
326              return name();
327            },
328            onInputText: setName
329          }));
330          insert(_el$5, createComponent(Show, {
331            get when() {
332              return description();
333            },
334            get children() {
335              var _el$10 = _tmpl$4(), _el$11 = _el$10.firstChild, _el$12 = _el$11.nextSibling;
336              insert(_el$12, description);
337              return _el$10;
338            }
339          }), _el$15);
340          insert(_el$5, createComponent(Show, {
341            get when() {
342              return FACETS.some((f) => attr(char(), f.key));
343            },
344            get children() {
345              var _el$13 = _tmpl$5();
346              insert(_el$13, createComponent(For, {
347                each: FACETS,
348                children: (facet) => createComponent(Show, {
349                  get when() {
350                    return attr(char(), facet.key);
351                  },
352                  get children() {
353                    var _el$22 = _tmpl$10(), _el$23 = _el$22.firstChild, _el$24 = _el$23.nextSibling;
354                    insert(_el$23, () => facet.label);
355                    insert(_el$24, () => attr(char(), facet.key));
356                    return _el$22;
357                  }
358                })
359              }));
360              return _el$13;
361            }
362          }), _el$15);
363          insert(_el$5, createComponent(Show, {
364            get when() {
365              return shots().length > 1;
366            },
367            get children() {
368              var _el$14 = _tmpl$6();
369              insert(_el$14, createComponent(For, {
370                get each() {
371                  return shots();
372                },
373                children: (url, i) => (() => {
374                  var _el$25 = _tmpl$11(), _el$26 = _el$25.firstChild;
375                  _el$25.$$click = () => setMain(url);
376                  createRenderEffect((_p$) => {
377                    var _v$4 = !!(main() === url), _v$5 = main() === url, _v$6 = `Show photo ${i() + 1}`, _v$7 = getAssetUrl(url);
378                    _v$4 !== _p$.e && _el$25.classList.toggle("active", _p$.e = _v$4);
379                    _v$5 !== _p$.t && setAttribute(_el$25, "aria-pressed", _p$.t = _v$5);
380                    _v$6 !== _p$.a && setAttribute(_el$25, "aria-label", _p$.a = _v$6);
381                    _v$7 !== _p$.o && setAttribute(_el$26, "src", _p$.o = _v$7);
382                    return _p$;
383                  }, {
384                    e: void 0,
385                    t: void 0,
386                    a: void 0,
387                    o: void 0
388                  });
389                  return _el$25;
390                })()
391              }));
392              return _el$14;
393            }
394          }), _el$15);
395          _el$16.$$click = onMatch;
396          _el$17.$$click = () => navigate("/discover");
397          insert(_el$15, createComponent(Show, {
398            get when() {
399              return memo(() => !!userStore().loggedIn)() && char().userId !== userStore().user?._id;
400            },
401            get children() {
402              var _el$18 = _tmpl$7(), _el$19 = _el$18.firstChild;
403              _el$18.$$click = () => setShowReport(true);
404              insert(_el$18, createComponent(Flag, {
405                size: 15
406              }), _el$19);
407              return _el$18;
408            }
409          }), null);
410          return _el$2;
411        })(), createComponent(ReportModal, {
412          get show() {
413            return showReport();
414          },
415          close: () => setShowReport(false),
416          get charId() {
417            return char()._id;
418          },
419          get name() {
420            return char().name;
421          }
422        })];
423      }
424    }));
425    return _el$;
426  })();
427};
428delegateEvents(["click"]);
429export {
430  Profile as default
431};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.