Flow Youtube Chat

Youtubeのチャットをニコニコ風に画面上へ流すスクリプトです(再アップ,絵文字バグ修正済み)

目前为 2021-03-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Flow Youtube Chat
  3. // @version 1.14.16
  4. // @description Youtubeのチャットをニコニコ風に画面上へ流すスクリプトです(再アップ,絵文字バグ修正済み)
  5. // @match https://www.youtube.com/*
  6. // @namespace FlowYoutubeChatScript
  7. // @run-at document-end
  8. // @grant GM.setValue
  9. // @grant GM.getValue
  10. // @grant GM.deleteValue
  11. // @grant GM.listValues
  12. // @noframes
  13. // @license AGPL-3.0-or-later
  14. // @require https://cdn.jsdelivr.net/npm/sweetalert2@10.10.1/dist/sweetalert2.all.min.js#sha384-OCBhaEdUu7BFgaeRVey2PDeHof2MSQRFe/e6S8Q3XrmSV7wrKpLmhPj8FOldGiaF
  15. // @require https://unpkg.com/loglevel@1.7.0/dist/loglevel.min.js#sha384-7gGuWfek8Ql6j/uNDFrS0BCe4x2ZihD4B68w9Eu580OVHJBV+bl3rZmEWC7q5/Gj
  16. // @require https://unpkg.com/rxjs@7.0.0-beta.10/dist/bundles/rxjs.umd.min.js#sha384-+BwV2u+ZJFwj586/3PlpsZdYS1U/+hT/zpjYSznHH4XzUJqgshDzZITJ+zGeWl//
  17. // @require https://unpkg.com/mithril@2.0.4/mithril.min.js#sha384-vo9crXih40MlEv6JWHqS7SsPiFp+76csaWQFOF2UU0/xI58Jm/ZvK/1UtpaicJT9
  18. // @require https://cdn.jsdelivr.net/npm/check-types@11.1.2/src/check-types.min.js#sha384-KGnImnhVjA5llfqKEbjBiY+1Mp6oa+NvW/TEY1XTPAKWNgrAwa3Qvn//MXL07wBM
  19. // ==/UserScript==
  20.  
  21. /* jshint esversion: 6 */
  22.  
  23. ;(() => {
  24. var __webpack_modules__ = {
  25. 238: module => {
  26. function monadic(fn, cache, serializer, arg) {
  27. var value,
  28. cacheKey =
  29. null == (value = arg) ||
  30. "number" == typeof value ||
  31. "boolean" == typeof value
  32. ? arg
  33. : serializer(arg),
  34. computedValue = cache.get(cacheKey)
  35. return (
  36. void 0 === computedValue &&
  37. ((computedValue = fn.call(this, arg)),
  38. cache.set(cacheKey, computedValue)),
  39. computedValue
  40. )
  41. }
  42. function variadic(fn, cache, serializer) {
  43. var args = Array.prototype.slice.call(arguments, 3),
  44. cacheKey = serializer(args),
  45. computedValue = cache.get(cacheKey)
  46. return (
  47. void 0 === computedValue &&
  48. ((computedValue = fn.apply(this, args)),
  49. cache.set(cacheKey, computedValue)),
  50. computedValue
  51. )
  52. }
  53. function assemble(fn, context, strategy, cache, serialize) {
  54. return strategy.bind(context, fn, cache, serialize)
  55. }
  56. function strategyDefault(fn, options) {
  57. return assemble(
  58. fn,
  59. this,
  60. 1 === fn.length ? monadic : variadic,
  61. options.cache.create(),
  62. options.serializer
  63. )
  64. }
  65. function serializerDefault() {
  66. return JSON.stringify(arguments)
  67. }
  68. function ObjectWithoutPrototypeCache() {
  69. this.cache = Object.create(null)
  70. }
  71. ;(ObjectWithoutPrototypeCache.prototype.has = function (key) {
  72. return key in this.cache
  73. }),
  74. (ObjectWithoutPrototypeCache.prototype.get = function (key) {
  75. return this.cache[key]
  76. }),
  77. (ObjectWithoutPrototypeCache.prototype.set = function (key, value) {
  78. this.cache[key] = value
  79. })
  80. var cacheDefault = {
  81. create: function () {
  82. return new ObjectWithoutPrototypeCache()
  83. },
  84. }
  85. ;(module.exports = function (fn, options) {
  86. var cache = options && options.cache ? options.cache : cacheDefault,
  87. serializer =
  88. options && options.serializer
  89. ? options.serializer
  90. : serializerDefault
  91. return (options && options.strategy
  92. ? options.strategy
  93. : strategyDefault)(fn, { cache, serializer })
  94. }),
  95. (module.exports.strategies = {
  96. variadic: function (fn, options) {
  97. return assemble(
  98. fn,
  99. this,
  100. variadic,
  101. options.cache.create(),
  102. options.serializer
  103. )
  104. },
  105. monadic: function (fn, options) {
  106. return assemble(
  107. fn,
  108. this,
  109. monadic,
  110. options.cache.create(),
  111. options.serializer
  112. )
  113. },
  114. })
  115. },
  116. },
  117. __webpack_module_cache__ = {}
  118. function __webpack_require__(moduleId) {
  119. if (__webpack_module_cache__[moduleId])
  120. return __webpack_module_cache__[moduleId].exports
  121. var module = (__webpack_module_cache__[moduleId] = { exports: {} })
  122. return (
  123. __webpack_modules__[moduleId](
  124. module,
  125. module.exports,
  126. __webpack_require__
  127. ),
  128. module.exports
  129. )
  130. }
  131. ;(__webpack_require__.n = module => {
  132. var getter =
  133. module && module.__esModule ? () => module.default : () => module
  134. return __webpack_require__.d(getter, { a: getter }), getter
  135. }),
  136. (__webpack_require__.d = (exports, definition) => {
  137. for (var key in definition)
  138. __webpack_require__.o(definition, key) &&
  139. !__webpack_require__.o(exports, key) &&
  140. Object.defineProperty(exports, key, {
  141. enumerable: !0,
  142. get: definition[key],
  143. })
  144. }),
  145. (__webpack_require__.o = (obj, prop) =>
  146. Object.prototype.hasOwnProperty.call(obj, prop)),
  147. (() => {
  148. "use strict"
  149. const external_log_namespaceObject = log
  150. var external_log_default = __webpack_require__.n(
  151. external_log_namespaceObject
  152. )
  153. const lib = observer => value => {
  154. observer.next(value)
  155. }
  156. function function_identity(a) {
  157. return a
  158. }
  159. function constant(a) {
  160. return function () {
  161. return a
  162. }
  163. }
  164. function function_pipe(
  165. a,
  166. ab,
  167. bc,
  168. cd,
  169. de,
  170. ef,
  171. fg,
  172. gh,
  173. hi,
  174. ij,
  175. jk,
  176. kl,
  177. lm,
  178. mn,
  179. no,
  180. op,
  181. pq,
  182. qr,
  183. rs,
  184. st
  185. ) {
  186. switch (arguments.length) {
  187. case 1:
  188. return a
  189. case 2:
  190. return ab(a)
  191. case 3:
  192. return bc(ab(a))
  193. case 4:
  194. return cd(bc(ab(a)))
  195. case 5:
  196. return de(cd(bc(ab(a))))
  197. case 6:
  198. return ef(de(cd(bc(ab(a)))))
  199. case 7:
  200. return fg(ef(de(cd(bc(ab(a))))))
  201. case 8:
  202. return gh(fg(ef(de(cd(bc(ab(a)))))))
  203. case 9:
  204. return hi(gh(fg(ef(de(cd(bc(ab(a))))))))
  205. case 10:
  206. return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))
  207. case 11:
  208. return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))
  209. case 12:
  210. return kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))
  211. case 13:
  212. return lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))
  213. case 14:
  214. return mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))
  215. case 15:
  216. return no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  217. case 16:
  218. return op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  219. case 17:
  220. return pq(
  221. op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  222. )
  223. case 18:
  224. return qr(
  225. pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))))
  226. )
  227. case 19:
  228. return rs(
  229. qr(
  230. pq(
  231. op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  232. )
  233. )
  234. )
  235. case 20:
  236. return st(
  237. rs(
  238. qr(
  239. pq(
  240. op(
  241. no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  242. )
  243. )
  244. )
  245. )
  246. )
  247. }
  248. }
  249. var eqStrict = {
  250. equals: function (a, b) {
  251. return a === b
  252. },
  253. }
  254. function flap(F) {
  255. return function (a) {
  256. return function (fab) {
  257. return F.map(fab, function (f) {
  258. return f(a)
  259. })
  260. }
  261. }
  262. }
  263. var _map = function (ma, f) {
  264. return function () {
  265. return f(ma())
  266. }
  267. },
  268. of = constant,
  269. Functor = { URI: "IO", map: _map },
  270. sequenceArray =
  271. (flap(Functor),
  272. (function (f) {
  273. return (function (f) {
  274. return function (as) {
  275. return function () {
  276. return as.map(function (a, i) {
  277. return f(i, a)()
  278. })
  279. }
  280. }
  281. })(function (_, a) {
  282. return f(a)
  283. })
  284. })(function_identity)),
  285. separated = function (left, right) {
  286. return { left, right }
  287. },
  288. es6_Separated_map = function (f) {
  289. return function (fa) {
  290. return separated(left(fa), f(right(fa)))
  291. }
  292. },
  293. left =
  294. (flap({
  295. URI: "Separated",
  296. map: function (fa, f) {
  297. return function_pipe(fa, es6_Separated_map(f))
  298. },
  299. }),
  300. function (s) {
  301. return s.left
  302. }),
  303. right = function (s) {
  304. return s.right
  305. },
  306. isSome = function (fa) {
  307. return "Some" === fa._tag
  308. },
  309. isNone = function (fa) {
  310. return "None" === fa._tag
  311. },
  312. none = { _tag: "None" },
  313. some = function (a) {
  314. return { _tag: "Some", value: a }
  315. },
  316. fromNullable = function (a) {
  317. return null == a ? none : some(a)
  318. }
  319. var matchW = function (onNone, onSome) {
  320. return function (ma) {
  321. return isNone(ma) ? onNone() : onSome(ma.value)
  322. }
  323. },
  324. match = matchW,
  325. getOrElse = function (onNone) {
  326. return function (ma) {
  327. return isNone(ma) ? onNone() : ma.value
  328. }
  329. },
  330. chainNullableK = function (f) {
  331. return function (ma) {
  332. return isNone(ma) ? none : fromNullable(f(ma.value))
  333. }
  334. },
  335. es6_Option_map = function (f) {
  336. return function (fa) {
  337. return isNone(fa) ? none : some(f(fa.value))
  338. }
  339. },
  340. alt = function (that) {
  341. return function (fa) {
  342. return isNone(fa) ? that() : fa
  343. }
  344. },
  345. filter = function (predicate) {
  346. return function (fa) {
  347. return isNone(fa) ? none : predicate(fa.value) ? fa : none
  348. }
  349. }
  350. function getEq(E) {
  351. return {
  352. equals: function (x, y) {
  353. return (
  354. x === y ||
  355. (isNone(x) ? isNone(y) : !isNone(y) && E.equals(x.value, y.value))
  356. )
  357. },
  358. }
  359. }
  360. var head = ReadonlyNonEmptyArray_head
  361. var NonEmptyArray_map = function (fa, f) {
  362. return function_pipe(fa, es6_NonEmptyArray_map(f))
  363. },
  364. es6_NonEmptyArray_map = function (f) {
  365. return mapWithIndex(function (_, a) {
  366. return f(a)
  367. })
  368. },
  369. mapWithIndex = function (f) {
  370. return function (as) {
  371. for (var out = [f(0, head(as))], i = 1; i < as.length; i++)
  372. out.push(f(i, as[i]))
  373. return out
  374. }
  375. },
  376. NonEmptyArray_Functor = { URI: "NonEmptyArray", map: NonEmptyArray_map }
  377. flap(NonEmptyArray_Functor)
  378. var a
  379. a = void 0
  380. var ReadonlyNonEmptyArray_empty = [],
  381. ReadonlyNonEmptyArray_append = function (end) {
  382. return function (init) {
  383. return ReadonlyNonEmptyArray_concat(init, [end])
  384. }
  385. }
  386. function ReadonlyNonEmptyArray_concat(first, second) {
  387. return first.concat(second)
  388. }
  389. var ReadonlyNonEmptyArray_map = function (fa, f) {
  390. return function_pipe(fa, es6_ReadonlyNonEmptyArray_map(f))
  391. },
  392. es6_ReadonlyNonEmptyArray_map = function (f) {
  393. return es6_ReadonlyNonEmptyArray_mapWithIndex(function (_, a) {
  394. return f(a)
  395. })
  396. },
  397. es6_ReadonlyNonEmptyArray_mapWithIndex = function (f) {
  398. return function (as) {
  399. for (
  400. var out = [f(0, ReadonlyNonEmptyArray_head(as))], i = 1;
  401. i < as.length;
  402. i++
  403. )
  404. out.push(f(i, as[i]))
  405. return out
  406. }
  407. },
  408. ReadonlyNonEmptyArray_extract = function (as) {
  409. return as[0]
  410. },
  411. ReadonlyNonEmptyArray_Functor = {
  412. URI: "ReadonlyNonEmptyArray",
  413. map: ReadonlyNonEmptyArray_map,
  414. },
  415. ReadonlyNonEmptyArray_head =
  416. (flap(ReadonlyNonEmptyArray_Functor), ReadonlyNonEmptyArray_extract)
  417. var ReadonlyArray_append = ReadonlyNonEmptyArray_append,
  418. isEmpty = function (as) {
  419. return 0 === as.length
  420. }
  421. var ReadonlyArray_map = function (fa, f) {
  422. return function_pipe(fa, es6_ReadonlyArray_map(f))
  423. },
  424. es6_ReadonlyArray_chain = function (f) {
  425. return function (ma) {
  426. return function_pipe(
  427. ma,
  428. (function (f) {
  429. return function (as) {
  430. for (var out = [], i = 0; i < as.length; i++)
  431. out.push.apply(out, f(i, as[i]))
  432. return out
  433. }
  434. })(function (_, a) {
  435. return f(a)
  436. })
  437. )
  438. }
  439. },
  440. es6_ReadonlyArray_map = function (f) {
  441. return function (fa) {
  442. return fa.map(function (a) {
  443. return f(a)
  444. })
  445. }
  446. },
  447. es6_ReadonlyArray_filter = function (predicate) {
  448. return function (fa) {
  449. return fa.filter(predicate)
  450. }
  451. },
  452. ReadonlyArray_Functor = {
  453. URI: "ReadonlyArray",
  454. map: ReadonlyArray_map,
  455. },
  456. ReadonlyArray_empty =
  457. (flap(ReadonlyArray_Functor), ReadonlyNonEmptyArray_empty)
  458. const external_m_namespaceObject = m
  459. var external_m_default = __webpack_require__.n(external_m_namespaceObject)
  460. const external_rxjs_namespaceObject = rxjs,
  461. external_rxjs_operators_namespaceObject = rxjs.operators,
  462. package_namespaceObject_i8 = "1.14.16",
  463. indirectConfig = async (gmKey, defaultVal, toItem, toGm) => {
  464. const val = await GM.getValue(gmKey)
  465. return {
  466. gmKey,
  467. val: void 0 !== val ? toItem(val) : defaultVal,
  468. defaultVal,
  469. toGm,
  470. }
  471. },
  472. simpleConfig = async (gmKey, defaultVal) => {
  473. var _a
  474. return {
  475. gmKey,
  476. val:
  477. null !== (_a = await GM.getValue(gmKey)) && void 0 !== _a
  478. ? _a
  479. : defaultVal,
  480. defaultVal,
  481. toGm: x => x,
  482. }
  483. },
  484. lineConfigArgs = [
  485. [],
  486. x => x.split(/\r\n|\n/).filter(s => "" !== s),
  487. x => x.join("\n"),
  488. ],
  489. chatApp = () =>
  490. function_pipe(
  491. fromNullable(document.querySelector("#chatframe")),
  492. filter(x => {
  493. var _a
  494. const state =
  495. null === (_a = x.contentDocument) || void 0 === _a
  496. ? void 0
  497. : _a.readyState
  498. return "loading" === state || "complete" === state
  499. }),
  500. chainNullableK(x => x.contentDocument),
  501. alt(() => some(document)),
  502. chainNullableK(x => x.querySelector("yt-live-chat-app"))
  503. ),
  504. mountComponent = x => {
  505. ;(x.root.style.display = "contents"),
  506. external_m_default().mount(x.root, x.comp)
  507. },
  508. external_Swal_namespaceObject = Swal
  509. var external_Swal_default = __webpack_require__.n(
  510. external_Swal_namespaceObject
  511. )
  512. const createBanButton = (chat, id, getConfig, setConfig) => {
  513. var _a
  514. if (chat.children.namedItem("card")) return
  515. const button = document.createElement("button")
  516. button.classList.add(
  517. "style-scope",
  518. "yt-icon-button",
  519. "fyc_button",
  520. "fyc_ngbutton"
  521. ),
  522. (button.style.padding = "0px"),
  523. (button.style.width = "20px"),
  524. (button.style.height = "20px"),
  525. (button.style.fill = "#fff"),
  526. button.setAttribute("aria-label", "NGに入れる(Ban this user)"),
  527. (button.innerHTML =
  528. '<div style="width: 100%; height: 75%;fill: var(--yt-spec-text-secondary);"><svg class="style-scope yt-icon" width="100%" height="100%" version="1.1" viewBox="0 0 512 512" x="0px" y="0px"><path d="m437.02 74.977c-99.984-99.969-262.06-99.969-362.05 0-99.969 99.984-99.969 262.06 0 362.05 99.969 99.969 262.08 99.969 362.05 0s99.969-262.08 0-362.05zm-299.81 62.234c54.391-54.391 137.02-63.453 201.02-27.531l-228.55 228.55c-35.922-64-26.86-146.62 27.531-201.02zm237.59 237.58c-54.391 54.391-137.03 63.469-201.03 27.547l228.56-228.56c35.921 64 26.843 146.64-27.532 201.02z" fill-rule="evenodd"></path></svg></div>'),
  529. (button.onclick = () => {
  530. const users = getConfig.bannedUsers()
  531. users.includes(id) ||
  532. (setConfig.bannedUsers([...users, id]),
  533. external_m_default().redraw(),
  534. external_Swal_default()
  535. .mixin({
  536. toast: !0,
  537. position: "bottom-left",
  538. timer: 2500,
  539. timerProgressBar: !0,
  540. showConfirmButton: !1,
  541. didOpen: toast => {
  542. toast.addEventListener(
  543. "mouseenter",
  544. external_Swal_default().stopTimer
  545. ),
  546. toast.addEventListener(
  547. "mouseleave",
  548. external_Swal_default().resumeTimer
  549. )
  550. },
  551. })
  552. .fire({ title: `Added Banned User: ${id}`, icon: "success" })),
  553. (chat.style.display = "none")
  554. }),
  555. null === (_a = chat.querySelector("#content #message")) ||
  556. void 0 === _a ||
  557. _a.append(button)
  558. }
  559. var src = __webpack_require__(238),
  560. src_default = __webpack_require__.n(src)
  561. const getChatLane = (
  562. flowChat,
  563. progress,
  564. flowChats,
  565. mainState,
  566. getConfig
  567. ) => {
  568. const chatIndex = flowChats.indexOf(flowChat),
  569. playerWidth = mainState.playerRect.width,
  570. playerX = mainState.playerRect.x,
  571. chatRect = flowChat.element.getBoundingClientRect(),
  572. chatWidth = chatRect.width,
  573. chatHeight = chatRect.height,
  574. chatX = progress ? chatRect.x - playerX : playerWidth,
  575. movingChats =
  576. ((as = flowChats
  577. .slice(0, chatIndex >= 0 ? chatIndex : void 0)
  578. .filter(chat => !chat.animationEnded)
  579. .sort((a, b) => a.lane - b.lane)),
  580. isEmpty(as) ? ReadonlyArray_empty : as.slice())
  581. var as
  582. const tooCloseTo = src_default()(i => {
  583. const otherRect = movingChats[i].element.getBoundingClientRect(),
  584. otherWidth = otherRect.width,
  585. otherX = otherRect.x - playerX,
  586. gap =
  587. (chatHeight * otherWidth * chatWidth) ** 0.333 *
  588. getConfig.minSpacing()
  589. return (
  590. (playerWidth - otherX) / (playerWidth + otherWidth) - progress <
  591. (chatWidth + gap) / (playerWidth + chatWidth) ||
  592. otherX + otherWidth + gap > chatX
  593. )
  594. }),
  595. occupyInfo = [
  596. ...movingChats.map((x, i) => ({
  597. tooClose: () => tooCloseTo(i),
  598. lane: x.lane,
  599. })),
  600. { tooClose: () => !0, lane: getConfig.laneCount() },
  601. ],
  602. index = occupyInfo.findIndex(x => x.lane >= flowChat.lane),
  603. rightFreeLane = occupyInfo
  604. .slice(index)
  605. .findIndex(x => x.tooClose()),
  606. leftFreeLane = function_pipe(
  607. occupyInfo.slice(0, index),
  608. ((predicate = x => x.tooClose()),
  609. function (as) {
  610. for (var i = as.length - 1; i >= 0; i--)
  611. if (predicate(as[i])) return some(i)
  612. return none
  613. }),
  614. getOrElse(() => -1)
  615. )
  616. var predicate
  617. let formerLaneInterval = 0
  618. leftFreeLane < flowChat.lane &&
  619. flowChat.lane < rightFreeLane &&
  620. (formerLaneInterval = Math.min(
  621. Math.max(
  622. formerLaneInterval,
  623. Math.min(
  624. flowChat.lane - leftFreeLane,
  625. rightFreeLane - flowChat.lane
  626. )
  627. ),
  628. 1
  629. ))
  630. let maxInterval = 0,
  631. maxIntervalLane = 0,
  632. lastLane = -1
  633. for (let i = 0; i < occupyInfo.length; i += 1)
  634. if (occupyInfo[i].tooClose()) {
  635. const nextLane = occupyInfo[i].lane,
  636. interLane = Math.min(
  637. Math.max((lastLane + nextLane) / 2, 0),
  638. getConfig.laneCount() - 1
  639. ),
  640. newInterval = Math.min(
  641. interLane - lastLane,
  642. nextLane - interLane,
  643. 1
  644. )
  645. if (
  646. newInterval - maxInterval > 0.001 &&
  647. ((maxIntervalLane = Math.max(lastLane + newInterval, 0)),
  648. (maxInterval = newInterval),
  649. maxInterval > 0.999)
  650. )
  651. break
  652. lastLane = nextLane
  653. }
  654. return {
  655. lane:
  656. Math.abs(formerLaneInterval - maxInterval) < 0.001
  657. ? flowChat.lane
  658. : maxIntervalLane,
  659. interval: maxInterval,
  660. }
  661. },
  662. setChatPlayState = (flowChat, mainState, getConfig) => {
  663. !flowChat.animationEnded &&
  664. flowChat.animation &&
  665. (mainState.chatPlaying
  666. ? flowChat.animation.play()
  667. : flowChat.animation.pause(),
  668. (flowChat.animation.playbackRate = getConfig.flowSpeed() / 15))
  669. },
  670. setChatAnimation = (flowChat, flowChats, mainState, getConfig) => {
  671. var _a, _b, _c
  672. if (flowChat.animationEnded) return !1
  673. const time =
  674. null !==
  675. (_b =
  676. null === (_a = flowChat.animation) || void 0 === _a
  677. ? void 0
  678. : _a.currentTime) && void 0 !== _b
  679. ? _b
  680. : void 0,
  681. progress = void 0 !== time ? time / flowChat.animationDuration : 0,
  682. { lane, interval } = getChatLane(
  683. flowChat,
  684. progress,
  685. flowChats,
  686. mainState,
  687. getConfig
  688. )
  689. if (getConfig.noOverlap() && interval < 0.999)
  690. return (
  691. null === (_c = flowChat.animation) ||
  692. void 0 === _c ||
  693. _c.finish(),
  694. (flowChat.animation = void 0),
  695. !1
  696. )
  697. flowChat.lane = lane
  698. const laneY = ((lane, mainState, getConfig) => {
  699. const laneCount = getConfig.laneCount(),
  700. laneR = lane % (2 * laneCount - 1),
  701. playerHeight = mainState.playerRect.height
  702. return (
  703. Math.round(
  704. 100 *
  705. (laneR < laneCount
  706. ? (playerHeight * (laneR % laneCount)) / laneCount + 4
  707. : playerHeight *
  708. ((laneR % laneCount) / laneCount + 1 / (2 * laneCount)))
  709. ) / 100
  710. )
  711. })(flowChat.lane, mainState, getConfig)
  712. flowChat.animation && flowChat.animation.cancel(),
  713. (flowChat.animationDuration = 6400),
  714. (flowChat.animation = flowChat.element.animate(
  715. [
  716. {
  717. transform: `translate(${mainState.playerRect.width}px, ${laneY}px)`,
  718. },
  719. {
  720. transform: `translate(${-flowChat.element.getBoundingClientRect()
  721. .width}px, ${laneY}px)`,
  722. },
  723. ],
  724. { duration: 6400, easing: getConfig.timingFunction() }
  725. )),
  726. (flowChat.animation.onfinish = () => {
  727. flowChat.animationEnded = !0
  728. })
  729. const newTime = void 0 !== time ? 6400 * progress : 0
  730. return (
  731. (flowChat.animation.currentTime = newTime),
  732. setChatPlayState(flowChat, mainState, getConfig),
  733. !0
  734. )
  735. },
  736. setChatStyle = (flowChat, mainState, getConfig) => {
  737. const fontSize = ((mainState, getConfig) =>
  738. Math.round(
  739. Math.max(getConfig.fontSize() - 0.2, 0.01) *
  740. (mainState.playerRect.height / getConfig.laneCount()) *
  741. 100
  742. ) / 100)(mainState, getConfig),
  743. { style } = flowChat.element
  744. ;(style.visibility = getConfig.displayChats() ? "visible" : "hidden"),
  745. (style.color =
  746. "owner" === flowChat.authorType
  747. ? getConfig.ownerColor()
  748. : "moderator" === flowChat.authorType
  749. ? getConfig.moderatorColor()
  750. : "member" === flowChat.authorType
  751. ? getConfig.memberColor()
  752. : getConfig.color()),
  753. (style.fontSize = `${fontSize}px`),
  754. (style.fontWeight = getConfig.fontWeight().toString()),
  755. (style.fontFamily = getConfig.font()),
  756. (style.opacity = getConfig.chatOpacity().toString())
  757. const offset = getConfig.shadowFontWeight()
  758. ;(style.textShadow = `-${offset}px -${offset}px #0009, ${offset}px -${offset}px #0009, -${offset}px ${offset}px #0009, ${offset}px ${offset}px #0009`),
  759. (style.transform = `translate(${mainState.playerRect.width}px, -${
  760. 2 * fontSize
  761. }px)`)
  762. },
  763. assert_lib = check.assert,
  764. tapNonNull = x => (assert_lib(null != x), x),
  765. textStyle = { fontFamily: "inherit" },
  766. parseMessage = (lengthBefore, message, getConfig) => {
  767. var _a
  768. const eleWin =
  769. null !== (_a = message.ownerDocument.defaultView) && void 0 !== _a
  770. ? _a
  771. : window,
  772. maxChatLength = getConfig.maxChatLength(),
  773. vnodes = []
  774. let semantic = "",
  775. length = lengthBefore
  776. return (
  777. Array.from(message.childNodes).some(node => {
  778. var _a, _b
  779. if (
  780. !getConfig.textOnly() &&
  781. node instanceof eleWin.HTMLImageElement
  782. ) {
  783. const { src, alt } = node
  784. vnodes.push(
  785. external_m_default()("img", {
  786. style: { height: "1em", width: "1em" },
  787. src,
  788. alt,
  789. })
  790. ),
  791. (semantic += `<img alt="${alt}">`),
  792. (length += 1)
  793. } else if (node instanceof eleWin.HTMLAnchorElement) {
  794. const { href } = node,
  795. text =
  796. null !== (_a = node.textContent) && void 0 !== _a ? _a : "",
  797. beginning = text.slice(0, maxChatLength)
  798. vnodes.push(
  799. external_m_default()(
  800. "span",
  801. {
  802. style: {
  803. fontSize: "smaller",
  804. textDecoration: "underline",
  805. ...textStyle,
  806. },
  807. },
  808. beginning
  809. )
  810. ),
  811. (semantic += `<a href="${href}">${text}</a>`),
  812. (length += beginning.length)
  813. } else {
  814. const text =
  815. null !== (_b = node.textContent) && void 0 !== _b ? _b : "",
  816. beginning = text.slice(0, maxChatLength)
  817. vnodes.push(external_m_default().fragment({}, beginning)),
  818. (semantic += text),
  819. (length += beginning.length)
  820. }
  821. return length >= maxChatLength
  822. }),
  823. { vnodes, semantic, length }
  824. )
  825. },
  826. onChatFieldMutate = (
  827. chatScrn,
  828. flowChats,
  829. mainState,
  830. getConfig,
  831. setConfig,
  832. mainLog
  833. ) => mutations => {
  834. function_pipe(
  835. mutations,
  836. es6_ReadonlyArray_chain(e => Array.from(e.addedNodes)),
  837. es6_ReadonlyArray_filter(x => x.children.length > 0)
  838. ).forEach(chat => {
  839. var _a
  840. const chatData = ((chat, getConfig) => {
  841. let semantic = "",
  842. length = 0
  843. const vnodes = []
  844. let authorID
  845. const authorType = chat.querySelector(".owner")
  846. ? "owner"
  847. : chat.querySelector(".moderator")
  848. ? "moderator"
  849. : chat.querySelector(".member")
  850. ? "member"
  851. : "normal"
  852. return (
  853. Array.from(chat.children).forEach(child => {
  854. var _a, _b, _c, _d
  855. const childID = child.id,
  856. message = child.querySelector("#message"),
  857. authorName = child.querySelector("#author-name")
  858. if ("content" === childID) {
  859. if (
  860. (chat.querySelector(".moderator") &&
  861. getConfig.displayModName() &&
  862. vnodes.push(
  863. external_m_default()(
  864. "span",
  865. { style: { fontSize: "smaller", ...textStyle } },
  866. `${
  867. null !==
  868. (_a =
  869. null == authorName
  870. ? void 0
  871. : authorName.innerText) && void 0 !== _a
  872. ? _a
  873. : ""
  874. }: `
  875. )
  876. ),
  877. message)
  878. ) {
  879. const result = parseMessage(length, message, getConfig)
  880. vnodes.push(...result.vnodes),
  881. (semantic += result.semantic),
  882. (length += result.length)
  883. }
  884. } else if ("author-photo" === childID) {
  885. const matches = (null !==
  886. (_c =
  887. null === (_b = child.lastElementChild) ||
  888. void 0 === _b
  889. ? void 0
  890. : _b.getAttribute("src")) && void 0 !== _c
  891. ? _c
  892. : ""
  893. ).match(/ytc\/(.*)=/)
  894. authorID =
  895. null == matches ? void 0 : matches[matches.length - 1]
  896. } else if ("card" === childID) {
  897. const normalChat = child.matches(
  898. [
  899. ".style-scope",
  900. ".yt-live-chat-paid-message-renderer",
  901. ].join("")
  902. ),
  903. stickerChat = child.matches(
  904. [
  905. ".style-scope",
  906. ".yt-live-chat-paid-sticker-renderer",
  907. ].join("")
  908. )
  909. if (normalChat || stickerChat) {
  910. const paidAmount = tapNonNull(
  911. child.querySelector("#purchase-amount") ||
  912. child.querySelector("#purchase-amount-chip")
  913. )
  914. authorID = void 0
  915. const headerColor = normalChat
  916. ? window
  917. .getComputedStyle(
  918. tapNonNull(child.querySelector("#header"))
  919. )
  920. .getPropertyValue("background-color")
  921. : window
  922. .getComputedStyle(chat)
  923. .getPropertyValue(
  924. "--yt-live-chat-paid-sticker-chip-background-color"
  925. ),
  926. paidColor = normalChat
  927. ? window
  928. .getComputedStyle(
  929. tapNonNull(child.querySelector("#content"))
  930. )
  931. .getPropertyValue("background-color")
  932. : window
  933. .getComputedStyle(chat)
  934. .getPropertyValue(
  935. "--yt-live-chat-paid-sticker-background-color"
  936. )
  937. if (
  938. (getConfig.displaySuperChatAuthor() &&
  939. vnodes.push(
  940. external_m_default()(
  941. "span",
  942. {
  943. style: {
  944. color: headerColor,
  945. fontSize: "smaller",
  946. ...textStyle,
  947. },
  948. },
  949. `${
  950. null !==
  951. (_d =
  952. null == authorName
  953. ? void 0
  954. : authorName.innerText) && void 0 !== _d
  955. ? _d
  956. : ""
  957. }: `
  958. )
  959. ),
  960. normalChat && message)
  961. ) {
  962. const result = parseMessage(
  963. length,
  964. message,
  965. getConfig
  966. )
  967. vnodes.push(
  968. external_m_default()(
  969. "span",
  970. { style: { color: headerColor, ...textStyle } },
  971. result.vnodes
  972. )
  973. ),
  974. (semantic += result.semantic),
  975. (length += result.length)
  976. }
  977. ;(length += paidAmount.innerText.length),
  978. vnodes.push(
  979. external_m_default()(
  980. "span",
  981. {
  982. style: {
  983. color: paidColor,
  984. fontSize: "smaller",
  985. ...textStyle,
  986. },
  987. },
  988. external_m_default()(
  989. "strong",
  990. { style: { ...textStyle } },
  991. paidAmount.innerText
  992. )
  993. )
  994. )
  995. }
  996. }
  997. }),
  998. { vnodes, semantic, authorType, authorID }
  999. )
  1000. })(chat, getConfig),
  1001. semanticTextContent =
  1002. null !==
  1003. (_a = new DOMParser().parseFromString(
  1004. `<span>${chatData.semantic}<span>`,
  1005. "text/html"
  1006. ).body.textContent) && void 0 !== _a
  1007. ? _a
  1008. : ""
  1009. ;((content, getConfig, mainLog) =>
  1010. getConfig
  1011. .bannedWords()
  1012. .some(
  1013. word =>
  1014. !!content.includes(word) &&
  1015. (mainLog(`Banned Word: "${word}" in "${content}"`), !0)
  1016. ))(semanticTextContent, getConfig, mainLog) ||
  1017. ((content, getConfig, mainLog) =>
  1018. getConfig.bannedWordRegexs().some(word => {
  1019. const result = content.match(RegExp(word, "u"))
  1020. return (
  1021. !!result &&
  1022. (mainLog(
  1023. `Banned Word: "${result.toString()}" in "${content}"`
  1024. ),
  1025. !0)
  1026. )
  1027. }))(semanticTextContent, getConfig, mainLog) ||
  1028. (void 0 !== chatData.authorID &&
  1029. ((authorID, getConfig, mainLog) =>
  1030. getConfig
  1031. .bannedUsers()
  1032. .some(
  1033. user =>
  1034. !(
  1035. authorID !== user ||
  1036. (mainLog(`Banned User: "${authorID}"`), 0)
  1037. )
  1038. ))(chatData.authorID, getConfig, mainLog))
  1039. ? (chat.style.display = "none")
  1040. : (getConfig.createChats() &&
  1041. ((chatData, flowChats, chatScrn, mainState, getConfig) => {
  1042. var _a
  1043. let element
  1044. const offScreenChatIndex = flowChats.findIndex(
  1045. chat =>
  1046. chat.animationEnded ||
  1047. flowChats.length >= getConfig.maxChatCount()
  1048. )
  1049. if (-1 !== offScreenChatIndex) {
  1050. element = flowChats[offScreenChatIndex].element
  1051. const [oldChat] = flowChats.splice(offScreenChatIndex, 1)
  1052. null === (_a = oldChat.animation) ||
  1053. void 0 === _a ||
  1054. _a.cancel()
  1055. } else
  1056. external_log_default().debug("CreateFlowChat"),
  1057. (element = document.createElement("span")),
  1058. chatScrn.append(element)
  1059. element.classList.add("fyc_chat")
  1060. const flowChat = {
  1061. element,
  1062. lane: -1,
  1063. animation: void 0,
  1064. animationDuration: 0,
  1065. animationEnded: !1,
  1066. authorType: chatData.authorType,
  1067. }
  1068. external_m_default().render(element, chatData.vnodes),
  1069. setChatStyle(flowChat, mainState, getConfig),
  1070. setChatAnimation(
  1071. flowChat,
  1072. flowChats,
  1073. mainState,
  1074. getConfig
  1075. )
  1076. ? flowChats.push(flowChat)
  1077. : flowChat.element.remove()
  1078. })(chatData, flowChats, chatScrn, mainState, getConfig),
  1079. getConfig.createBanButton() &&
  1080. void 0 !== chatData.authorID &&
  1081. !chat.querySelector(".owner") &&
  1082. createBanButton(
  1083. chat,
  1084. chatData.authorID,
  1085. getConfig,
  1086. setConfig
  1087. ),
  1088. getConfig.simplifyChatField() &&
  1089. (chat => {
  1090. if (
  1091. chat.querySelector(
  1092. ".style-scope.yt-live-chat-paid-message-renderer"
  1093. ) ||
  1094. chat.querySelector(".owner")
  1095. )
  1096. return
  1097. chat.style.borderBottom =
  1098. "1px solid var(--yt-spec-text-secondary)"
  1099. const authorPhoto = chat.querySelector("#author-photo")
  1100. authorPhoto && (authorPhoto.style.display = "none")
  1101. const authorChip = chat.querySelector(
  1102. "yt-live-chat-author-chip.style-scope.yt-live-chat-text-message-renderer"
  1103. )
  1104. authorChip && (authorChip.style.display = "none")
  1105. })(chat))
  1106. })
  1107. },
  1108. removeOldChats = (flowChats, maxChatCount) => {
  1109. flowChats.sort((a, b) =>
  1110. a.animationEnded === b.animationEnded
  1111. ? 0
  1112. : a.animationEnded
  1113. ? -1
  1114. : 1
  1115. ),
  1116. flowChats
  1117. .splice(0, Math.max(0, flowChats.length - maxChatCount))
  1118. .forEach(x => {
  1119. external_log_default().debug("RemoveChat"), x.element.remove()
  1120. })
  1121. },
  1122. settingPanel_option = (value, label) =>
  1123. external_m_default()("option", { value }, label),
  1124. settingRow = (label, content) =>
  1125. external_m_default()("div", [
  1126. external_m_default()("span", label),
  1127. external_m_default()("div", content),
  1128. ]),
  1129. textColorRow = (color, textStyle, oninput) =>
  1130. external_m_default()("div", [
  1131. external_m_default()("input", {
  1132. style: { width: "36px", verticalAlign: "middle" },
  1133. type: "color",
  1134. value: color,
  1135. oninput,
  1136. }),
  1137. external_m_default()("input", {
  1138. style: { verticalAlign: "middle", width: "5.5em" },
  1139. type: "text",
  1140. maxlength: 20,
  1141. value: color,
  1142. oninput,
  1143. }),
  1144. external_m_default()(
  1145. "span",
  1146. { style: { ...textStyle, color } },
  1147. "Aa1あア亜"
  1148. ),
  1149. ]),
  1150. rangeRow = (min, max, step, value, oninput) =>
  1151. external_m_default()("div", [
  1152. external_m_default()("input", {
  1153. style: { width: "150px", verticalAlign: "middle" },
  1154. type: "range",
  1155. min,
  1156. max,
  1157. step,
  1158. value,
  1159. oninput,
  1160. }),
  1161. external_m_default()("input", {
  1162. style: {
  1163. width: "30px",
  1164. backgroundColor: "transparent",
  1165. color: "inherit",
  1166. borderWidth: "1px",
  1167. verticalAlign: "middle",
  1168. },
  1169. inputmode: "decimal",
  1170. value,
  1171. onchange: oninput,
  1172. }),
  1173. ]),
  1174. checkboxRow = (label, checked, onchange) =>
  1175. external_m_default()(
  1176. "div",
  1177. external_m_default()("label", [
  1178. label,
  1179. external_m_default()("input", {
  1180. type: "checkbox",
  1181. checked,
  1182. onchange,
  1183. }),
  1184. ])
  1185. ),
  1186. getInputValue = e => {
  1187. const target = e.currentTarget
  1188. if (
  1189. target instanceof HTMLSelectElement ||
  1190. target instanceof HTMLTextAreaElement ||
  1191. target instanceof HTMLInputElement
  1192. )
  1193. return target.value
  1194. throw Error(
  1195. "Event target isn't an Input or TextArea or Input element"
  1196. )
  1197. },
  1198. getInputChecked = e => {
  1199. return ((constructor = HTMLInputElement),
  1200. (x = e.currentTarget),
  1201. assert_lib(x instanceof constructor),
  1202. x).checked
  1203. var constructor, x
  1204. },
  1205. langOptions = [
  1206. ["FYC_EN", "English"],
  1207. ["FYC_JA", "日本語"],
  1208. ],
  1209. fontOptions = [
  1210. ["", "Default", "デフォルト"],
  1211. ["arial", "Arial", "Arial"],
  1212. ["arial black", "Arial Black", "Arial Black"],
  1213. ["arial narrow", "Arial Narrow", "Arial Narrow"],
  1214. ["Century", "Century", "Century"],
  1215. ["Comic Sans MS", "Comic Sans MS", "Comic Sans MS"],
  1216. ["Courier", "Courier", "Courier"],
  1217. ["cursive", "cursive", "cursive"],
  1218. ["fantasy", "fantasy", "fantasy"],
  1219. ["Impact", "Impact", "Impact"],
  1220. ["Meiryo", "Meiryo", "メイリオ"],
  1221. ["Meiryo UI", "Meiryo UI", "メイリオ UI"],
  1222. ["monospace", "monospace", "monospace"],
  1223. ["Monotype Corsiva", "Monotype Corsiva", "Monotype Corsiva"],
  1224. ["MS PGothic", "MS PGothic", "MS Pゴシック"],
  1225. ["MS Gothic", "MS Gothic", "MS ゴシック"],
  1226. ["MS Sans Serif", "MS Sans Serif", "MS Sans Serif"],
  1227. ["MS Serif", "MS Serif", "MS Serif"],
  1228. ["MS UI Gothic", "MS UI Gothic", "MS UI Gothic"],
  1229. ["sans-serif", "Sans-serif", "Sans-serif"],
  1230. ["serif", "Serif", "Serif"],
  1231. ["Times New Roman", "Times New Roman", "Times New Roman"],
  1232. ["Yu Gothic", "Yu Gothic", "遊ゴシック"],
  1233. ["YuGothic", "YuGothic", "游ゴシック体"],
  1234. ],
  1235. settingPanel = (flowChats, mainState, state, getConfig, setConfig) => {
  1236. var _a, _b
  1237. const panelState = {
  1238. bannedWordRegexs: getConfig.bannedWordRegexs(),
  1239. bannedWordRegexsValid: !0,
  1240. bannedWordRegexsError: "",
  1241. currentTab: 0,
  1242. timingStepCount: parseInt(
  1243. null !==
  1244. (_b =
  1245. null ===
  1246. (_a = getConfig
  1247. .timingFunction()
  1248. .match(/^steps\((\d+),.+/)) || void 0 === _a
  1249. ? void 0
  1250. : _a[1]) && void 0 !== _b
  1251. ? _b
  1252. : "150",
  1253. 10
  1254. ),
  1255. },
  1256. stepTiming = stepCount => `steps(${stepCount}, jump-end)`,
  1257. useStepTiming = () =>
  1258. Boolean(getConfig.timingFunction().match(/^steps\(.+/)),
  1259. panelBoxStyle = width => ({
  1260. flex: `0 0 ${width}px`,
  1261. margin: "2px",
  1262. }),
  1263. textAreaStyle = {
  1264. resize: "horizontal",
  1265. boxSizing: "border-box",
  1266. width: "100%",
  1267. },
  1268. textRecord = {
  1269. font: ["Font", "フォント"],
  1270. color: ["Color(Normal)", "色(通常)"],
  1271. ownerColor: ["Color(Owner)", "色(オーナー)"],
  1272. moderatorColor: ["Color(Moderator)", "色(モデレーター)"],
  1273. memberColor: ["Color(Member)", "色(メンバー)"],
  1274. feedback: ["Feedback", "バグ報告と要望"],
  1275. eventLog: ["Event log", "イベントログ"],
  1276. giveFeedback: [
  1277. "Give your feedbacks here(Please attach the event log if they're bug related)",
  1278. "バグ報告、要望はこちら(バグの場合は、イベントログを添付してください)",
  1279. ],
  1280. chatOpacity: ["Opacity", "不透明度"],
  1281. fontSize: ["Size", "サイズ"],
  1282. fontWeight: ["Weight", "太さ"],
  1283. shadowFontWeight: ["Weight(Shadow)", "太さ(影)"],
  1284. flowSpeed: ["Speed", "速度"],
  1285. maxChatCount: ["Max number of chats", "最大表示数"],
  1286. maxChatLength: ["Max number of characters", "最大文字数"],
  1287. laneCount: ["Number of rows", "行数"],
  1288. bannedWords: ["Banned Words", "NGワード"],
  1289. bannedWordRegexs: ["Banned Words(Regex)", "NGワード(正規表現)"],
  1290. bannedUsers: ["Banned Users", "NGユーザー"],
  1291. simplifyChatField: ["Simplify", "簡略化する"],
  1292. createBanButton: ["Show ban button", "NGボタンを表示する"],
  1293. displayModName: [
  1294. "Show moderator's name",
  1295. "モデレータの名前を表示する",
  1296. ],
  1297. displaySuperChatAuthor: [
  1298. "Show super chat author",
  1299. "スパチャの作成者を表示する",
  1300. ],
  1301. createChats: ["Display flowing chats", "チャットを流す"],
  1302. textOnly: [
  1303. "Text only(ignore emojis)",
  1304. "文字のみ(絵文字を無視する)",
  1305. ],
  1306. error: ["Error", "エラー"],
  1307. video: ["Video", "画面"],
  1308. chatField: ["Chat Window", "チャット欄"],
  1309. useStepTiming: ["Move chat in steps", "チャットを段階的に動かす"],
  1310. timingStepCount: ["└Step Count", "└段階数"],
  1311. chatFilter: ["Chat Filter", "チャットフィルター"],
  1312. flowChat: ["Flow Chat", "チャット流れ"],
  1313. clearFlowChats: [
  1314. "Clear Flowing Chats",
  1315. "流れるチャットをクリアする",
  1316. ],
  1317. flowNewChatIf: [
  1318. "A new chat will appear if all of the followings are met:",
  1319. "新しいチャットは以下のすべてを満たす場合に流れます:",
  1320. ],
  1321. noOverlap: ["└Chats won't overlap", "└他のチャットと重ならない"],
  1322. minSpacing: ["Min spacing between chats", "チャットの最小間隔"],
  1323. fieldScale: ["Scale", "拡大率"],
  1324. },
  1325. getLang = key => {
  1326. const lang = getConfig.lang()
  1327. return textRecord[key]["FYC_EN" === lang ? 0 : 1]
  1328. },
  1329. ss = {
  1330. lang: new external_rxjs_namespaceObject.Subject(),
  1331. font: new external_rxjs_namespaceObject.Subject(),
  1332. color: new external_rxjs_namespaceObject.Subject(),
  1333. ownerColor: new external_rxjs_namespaceObject.Subject(),
  1334. moderatorColor: new external_rxjs_namespaceObject.Subject(),
  1335. memberColor: new external_rxjs_namespaceObject.Subject(),
  1336. num: {
  1337. chatOpacity: new external_rxjs_namespaceObject.Subject(),
  1338. fontSize: new external_rxjs_namespaceObject.Subject(),
  1339. fontWeight: new external_rxjs_namespaceObject.Subject(),
  1340. shadowFontWeight: new external_rxjs_namespaceObject.Subject(),
  1341. flowSpeed: new external_rxjs_namespaceObject.Subject(),
  1342. minSpacing: new external_rxjs_namespaceObject.Subject(),
  1343. fieldScale: new external_rxjs_namespaceObject.Subject(),
  1344. },
  1345. int: {
  1346. maxChatCount: new external_rxjs_namespaceObject.Subject(),
  1347. maxChatLength: new external_rxjs_namespaceObject.Subject(),
  1348. laneCount: new external_rxjs_namespaceObject.Subject(),
  1349. },
  1350. bannedWords: new external_rxjs_namespaceObject.Subject(),
  1351. bannedWordRegexs: new external_rxjs_namespaceObject.Subject(),
  1352. bannedUsers: new external_rxjs_namespaceObject.Subject(),
  1353. createChats: new external_rxjs_namespaceObject.Subject(),
  1354. textOnly: new external_rxjs_namespaceObject.Subject(),
  1355. displayModName: new external_rxjs_namespaceObject.Subject(),
  1356. displaySuperChatAuthor: new external_rxjs_namespaceObject.Subject(),
  1357. noOverlap: new external_rxjs_namespaceObject.Subject(),
  1358. simplifyChatField: new external_rxjs_namespaceObject.Subject(),
  1359. createBanButton: new external_rxjs_namespaceObject.Subject(),
  1360. useStepTiming: new external_rxjs_namespaceObject.Subject(),
  1361. timingStepCount: new external_rxjs_namespaceObject.Subject(),
  1362. clearFlowChats: new external_rxjs_namespaceObject.Subject(),
  1363. tabChange: new external_rxjs_namespaceObject.Subject(),
  1364. },
  1365. checkboxNode = label =>
  1366. checkboxRow(getLang(label), getConfig[label](), lib(ss[label])),
  1367. textColorNode = label =>
  1368. settingRow(getLang(label), [
  1369. textColorRow(
  1370. getConfig[label](),
  1371. {
  1372. fontFamily: getConfig.font(),
  1373. fontWeight: getConfig.fontWeight().toString(),
  1374. },
  1375. lib(ss[label])
  1376. ),
  1377. ]),
  1378. rangeNode = (label, streams, min, max, step) =>
  1379. settingRow(getLang(label), [
  1380. rangeRow(
  1381. min,
  1382. max,
  1383. step,
  1384. getConfig[label](),
  1385. lib(streams[label])
  1386. ),
  1387. ]),
  1388. updateStringMacro = key => {
  1389. return (
  1390. (stream = ss[key]),
  1391. (configKey = key),
  1392. stream.pipe(
  1393. (0, external_rxjs_operators_namespaceObject.map)(
  1394. getInputValue
  1395. ),
  1396. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1397. setConfig[configKey](x)
  1398. })
  1399. )
  1400. )
  1401. var stream, configKey
  1402. },
  1403. updateNumberMacro = key => {
  1404. return (
  1405. (stream = ss.num[key]),
  1406. (configKey = key),
  1407. stream.pipe(
  1408. (0, external_rxjs_operators_namespaceObject.map)(
  1409. getInputValue
  1410. ),
  1411. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1412. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1413. setConfig[configKey](x)
  1414. })
  1415. )
  1416. )
  1417. var stream, configKey
  1418. },
  1419. updateIntMacro = key => {
  1420. return (
  1421. (stream = ss.int[key]),
  1422. (configKey = key),
  1423. stream.pipe(
  1424. (0, external_rxjs_operators_namespaceObject.map)(
  1425. getInputValue
  1426. ),
  1427. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1428. parseInt(x, 10)
  1429. ),
  1430. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1431. setConfig[configKey](x)
  1432. })
  1433. )
  1434. )
  1435. var stream, configKey
  1436. },
  1437. updateBoolMacro = key => {
  1438. return (
  1439. (stream = ss[key]),
  1440. (configKey = key),
  1441. stream.pipe(
  1442. (0, external_rxjs_operators_namespaceObject.map)(
  1443. getInputChecked
  1444. ),
  1445. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1446. setConfig[configKey](x)
  1447. })
  1448. )
  1449. )
  1450. var stream, configKey
  1451. }
  1452. return (
  1453. (0, external_rxjs_namespaceObject.merge)(
  1454. (0, external_rxjs_namespaceObject.merge)(
  1455. (0, external_rxjs_namespaceObject.merge)(
  1456. updateStringMacro("font"),
  1457. updateNumberMacro("fontSize"),
  1458. updateNumberMacro("fontWeight"),
  1459. updateIntMacro("laneCount"),
  1460. updateNumberMacro("minSpacing")
  1461. ).pipe(
  1462. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1463. setStyle: !0,
  1464. setAnimation: !0,
  1465. })
  1466. ),
  1467. (0, external_rxjs_namespaceObject.merge)(
  1468. updateStringMacro("color"),
  1469. updateStringMacro("ownerColor"),
  1470. updateStringMacro("moderatorColor"),
  1471. updateStringMacro("memberColor"),
  1472. updateNumberMacro("chatOpacity"),
  1473. updateNumberMacro("shadowFontWeight")
  1474. ).pipe(
  1475. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1476. setStyle: !0,
  1477. })
  1478. ),
  1479. (0, external_rxjs_namespaceObject.merge)(
  1480. updateNumberMacro("flowSpeed")
  1481. ).pipe(
  1482. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1483. setPlayState: !0,
  1484. })
  1485. ),
  1486. (0, external_rxjs_namespaceObject.merge)(
  1487. updateIntMacro("maxChatCount").pipe(
  1488. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  1489. removeOldChats(flowChats, x)
  1490. )
  1491. ),
  1492. updateBoolMacro("noOverlap"),
  1493. ss.useStepTiming.pipe(
  1494. (0, external_rxjs_operators_namespaceObject.map)(
  1495. getInputChecked
  1496. ),
  1497. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1498. setConfig.timingFunction(
  1499. x ? stepTiming(panelState.timingStepCount) : "linear"
  1500. )
  1501. })
  1502. ),
  1503. ss.timingStepCount.pipe(
  1504. (0, external_rxjs_operators_namespaceObject.map)(
  1505. getInputValue
  1506. ),
  1507. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1508. parseInt(x, 10)
  1509. ),
  1510. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1511. ;(panelState.timingStepCount = x),
  1512. setConfig.timingFunction(stepTiming(x))
  1513. })
  1514. )
  1515. ).pipe(
  1516. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1517. setAnimation: !0,
  1518. })
  1519. )
  1520. ).pipe(
  1521. (0, external_rxjs_operators_namespaceObject.throttleTime)(
  1522. 180,
  1523. void 0,
  1524. { leading: !0, trailing: !0 }
  1525. ),
  1526. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1527. flowChats
  1528. .filter(chat => !chat.animationEnded)
  1529. .forEach(chat => {
  1530. const config = {
  1531. setStyle: !1,
  1532. setAnimation: !1,
  1533. setPlayState: !1,
  1534. ...x,
  1535. }
  1536. config.setStyle &&
  1537. setChatStyle(chat, mainState, getConfig),
  1538. config.setAnimation
  1539. ? setChatAnimation(
  1540. chat,
  1541. flowChats,
  1542. mainState,
  1543. getConfig
  1544. )
  1545. : config.setPlayState &&
  1546. setChatPlayState(chat, mainState, getConfig)
  1547. })
  1548. })
  1549. ),
  1550. updateStringMacro("lang"),
  1551. ss.tabChange.pipe(
  1552. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1553. panelState.currentTab = x
  1554. })
  1555. ),
  1556. updateIntMacro("maxChatLength"),
  1557. updateBoolMacro("simplifyChatField"),
  1558. updateBoolMacro("createBanButton"),
  1559. updateBoolMacro("createChats"),
  1560. updateBoolMacro("displayModName"),
  1561. updateBoolMacro("displaySuperChatAuthor"),
  1562. updateBoolMacro("textOnly"),
  1563. updateNumberMacro("fieldScale"),
  1564. ss.bannedWords.pipe(
  1565. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1566. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1567. x.split(/\r\n|\n/).filter(word => "" !== word)
  1568. ),
  1569. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1570. setConfig.bannedWords(x)
  1571. })
  1572. ),
  1573. ss.bannedWordRegexs.pipe(
  1574. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1575. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1576. x.split(/\r\n|\n/).filter(regex => "" !== regex)
  1577. ),
  1578. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1579. panelState.bannedWordRegexs = x
  1580. let valid = !0
  1581. ;(panelState.bannedWordRegexsError = ""),
  1582. panelState.bannedWordRegexs.forEach(regex => {
  1583. try {
  1584. RegExp(regex, "u")
  1585. } catch (error) {
  1586. ;(panelState.bannedWordRegexsError += `${error} in ${regex};`),
  1587. (valid = !1)
  1588. }
  1589. }),
  1590. valid && setConfig.bannedWordRegexs(x),
  1591. (panelState.bannedWordRegexsValid = valid)
  1592. })
  1593. ),
  1594. ss.bannedUsers.pipe(
  1595. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1596. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1597. x.split(/\r\n|\n/).filter(user => "" !== user)
  1598. ),
  1599. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1600. setConfig.bannedUsers(x)
  1601. })
  1602. ),
  1603. ss.clearFlowChats.pipe(
  1604. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  1605. removeOldChats(flowChats, 0)
  1606. )
  1607. )
  1608. ).subscribe(),
  1609. {
  1610. view: () => {
  1611. return external_m_default()(
  1612. "div",
  1613. {
  1614. className: "fyc_panel",
  1615. style: {
  1616. visibility: state.showPanel ? "visible" : "hidden",
  1617. backgroundColor: "rgba(30,30,30,0.9)",
  1618. zIndex: 5,
  1619. position: "absolute",
  1620. bottom: "40px",
  1621. right: "0px",
  1622. color: "#fff",
  1623. fontSize: "14px",
  1624. width: "660px",
  1625. border: "solid 1px #666",
  1626. fontFamily: "MS PGothic",
  1627. lineHeight: "1.2",
  1628. },
  1629. },
  1630. [
  1631. external_m_default()(
  1632. "div",
  1633. { style: { float: "right", margin: "3px 3px 0 0" } },
  1634. [
  1635. "🌐",
  1636. external_m_default()(
  1637. "select",
  1638. {
  1639. selectedIndex: langOptions.findIndex(
  1640. x => x[0] === getConfig.lang()
  1641. ),
  1642. onchange: lib(ss.lang),
  1643. },
  1644. langOptions.map(x => settingPanel_option(...x))
  1645. ),
  1646. ]
  1647. ),
  1648. ((style = {
  1649. container: { height: "364px" },
  1650. label: { padding: "6px" },
  1651. labelFocus: { background: "#666" },
  1652. tab: { display: "flex", padding: "6px" },
  1653. }),
  1654. (labels = [
  1655. getLang("flowChat"),
  1656. getLang("chatFilter"),
  1657. getLang("chatField"),
  1658. getLang("feedback"),
  1659. ]),
  1660. (tabs = [
  1661. [
  1662. external_m_default()(
  1663. "div",
  1664. { style: panelBoxStyle(212) },
  1665. [
  1666. settingRow(getLang("font"), [
  1667. external_m_default()(
  1668. "select",
  1669. {
  1670. style: { width: "60%" },
  1671. selectedIndex: fontOptions.findIndex(
  1672. x => x[0] === getConfig.font()
  1673. ),
  1674. onchange: lib(ss.font),
  1675. },
  1676. fontOptions.map(x =>
  1677. settingPanel_option(
  1678. x[0],
  1679. "FYC_JA" === getConfig.lang() ? x[2] : x[1]
  1680. )
  1681. )
  1682. ),
  1683. ]),
  1684. textColorNode("color"),
  1685. textColorNode("ownerColor"),
  1686. textColorNode("moderatorColor"),
  1687. textColorNode("memberColor"),
  1688. ]
  1689. ),
  1690. external_m_default()(
  1691. "div",
  1692. { style: panelBoxStyle(212) },
  1693. [
  1694. rangeNode("chatOpacity", ss.num, 0, 1, 0.05),
  1695. rangeNode("fontSize", ss.num, 0.3, 2, 0.05),
  1696. rangeNode("fontWeight", ss.num, 10, 1e3, 10),
  1697. rangeNode("shadowFontWeight", ss.num, 0, 3, 0.1),
  1698. rangeNode("flowSpeed", ss.num, 1, 50, 1),
  1699. rangeNode("maxChatCount", ss.int, 5, 200, 5),
  1700. rangeNode("maxChatLength", ss.int, 5, 200, 5),
  1701. rangeNode("laneCount", ss.int, 1, 25, 1),
  1702. ]
  1703. ),
  1704. external_m_default()(
  1705. "div",
  1706. { style: panelBoxStyle(212) },
  1707. [
  1708. rangeNode("minSpacing", ss.num, 0, 2.5, 0.1),
  1709. checkboxRow(
  1710. getLang("useStepTiming"),
  1711. useStepTiming(),
  1712. lib(ss.useStepTiming)
  1713. ),
  1714. external_m_default()(
  1715. "div",
  1716. {
  1717. style: {
  1718. ...(useStepTiming()
  1719. ? {}
  1720. : { opacity: "0.5" }),
  1721. },
  1722. },
  1723. settingRow(getLang("timingStepCount"), [
  1724. rangeRow(
  1725. 1,
  1726. 400,
  1727. 1,
  1728. panelState.timingStepCount,
  1729. lib(ss.timingStepCount)
  1730. ),
  1731. ])
  1732. ),
  1733. checkboxNode("createChats"),
  1734. checkboxNode("displayModName"),
  1735. checkboxNode("displaySuperChatAuthor"),
  1736. checkboxNode("textOnly"),
  1737. external_m_default()(
  1738. "span",
  1739. getLang("flowNewChatIf")
  1740. ),
  1741. checkboxNode("noOverlap"),
  1742. external_m_default()(
  1743. "button",
  1744. {
  1745. type: "button",
  1746. onclick: lib(ss.clearFlowChats),
  1747. },
  1748. getLang("clearFlowChats")
  1749. ),
  1750. ]
  1751. ),
  1752. ],
  1753. [
  1754. external_m_default()(
  1755. "div",
  1756. { style: panelBoxStyle(212) },
  1757. [
  1758. settingRow(getLang("bannedWords"), [
  1759. external_m_default()(
  1760. "textarea",
  1761. {
  1762. rows: 18,
  1763. style: textAreaStyle,
  1764. onchange: lib(ss.bannedWords),
  1765. },
  1766. getConfig.bannedWords().join("\n")
  1767. ),
  1768. ]),
  1769. ]
  1770. ),
  1771. external_m_default()(
  1772. "div",
  1773. { style: panelBoxStyle(212) },
  1774. [
  1775. settingRow(getLang("bannedWordRegexs"), [
  1776. external_m_default()(
  1777. "span",
  1778. panelState.bannedWordRegexsValid
  1779. ? ""
  1780. : `${getLang("error")}: ${
  1781. panelState.bannedWordRegexsError
  1782. }`
  1783. ),
  1784. external_m_default()(
  1785. "textarea",
  1786. {
  1787. rows: 18,
  1788. style: textAreaStyle,
  1789. onchange: lib(ss.bannedWordRegexs),
  1790. },
  1791. panelState.bannedWordRegexs.join("\n")
  1792. ),
  1793. ]),
  1794. ]
  1795. ),
  1796. external_m_default()(
  1797. "div",
  1798. { style: panelBoxStyle(212) },
  1799. [
  1800. settingRow(getLang("bannedUsers"), [
  1801. external_m_default()(
  1802. "textarea",
  1803. {
  1804. rows: 18,
  1805. style: textAreaStyle,
  1806. onchange: lib(ss.bannedUsers),
  1807. },
  1808. getConfig.bannedUsers().join("\n")
  1809. ),
  1810. ]),
  1811. ]
  1812. ),
  1813. ],
  1814. [
  1815. external_m_default()(
  1816. "div",
  1817. { style: panelBoxStyle(644) },
  1818. [
  1819. rangeNode("fieldScale", ss.num, 0.7, 1.5, 0.05),
  1820. checkboxNode("simplifyChatField"),
  1821. checkboxNode("createBanButton"),
  1822. ]
  1823. ),
  1824. ],
  1825. [
  1826. external_m_default()(
  1827. "div",
  1828. { style: panelBoxStyle(644) },
  1829. [
  1830. external_m_default()(
  1831. "div",
  1832. { style: { float: "right" } },
  1833. external_m_default()(
  1834. "a",
  1835. {
  1836. style: { color: "#f0f" },
  1837. href:
  1838. "https://greasyfork.org/en/scripts/411442-flow-youtube-chat/feedback",
  1839. target: "_blank",
  1840. },
  1841. getLang("giveFeedback")
  1842. )
  1843. ),
  1844. settingRow(getLang("eventLog"), [
  1845. external_m_default()(
  1846. "textarea",
  1847. {
  1848. rows: 18,
  1849. style: textAreaStyle,
  1850. readOnly: !0,
  1851. onclick: () => {},
  1852. },
  1853. mainState.log
  1854. ),
  1855. ]),
  1856. ]
  1857. ),
  1858. ],
  1859. ]),
  1860. (currentTab = panelState.currentTab),
  1861. (ontabSelect = lib(ss.tabChange)),
  1862. external_m_default()("div", [
  1863. external_m_default()(
  1864. "div",
  1865. ...labels.map((x, i) =>
  1866. external_m_default()(
  1867. "span",
  1868. {
  1869. style: {
  1870. ...style.label,
  1871. ...(currentTab === i ? style.labelFocus : {}),
  1872. display: "inline-block",
  1873. },
  1874. onclick: () => ontabSelect(i),
  1875. },
  1876. x
  1877. )
  1878. )
  1879. ),
  1880. external_m_default()(
  1881. "div",
  1882. {
  1883. style: {
  1884. ...style.container,
  1885. overflow: "hidden auto",
  1886. },
  1887. },
  1888. ...tabs.map((x, i) => {
  1889. var _a
  1890. return external_m_default()(
  1891. "div",
  1892. {
  1893. style: {
  1894. ...style.tab,
  1895. display:
  1896. i === currentTab
  1897. ? null !== (_a = style.tab.display) &&
  1898. void 0 !== _a
  1899. ? _a
  1900. : "block"
  1901. : "none",
  1902. },
  1903. },
  1904. x
  1905. )
  1906. })
  1907. ),
  1908. ])),
  1909. ]
  1910. )
  1911. var style, labels, tabs, currentTab, ontabSelect
  1912. },
  1913. }
  1914. )
  1915. },
  1916. settingComponent = (flowChats, mainState, getConfig, setConfig) => {
  1917. const state = { showPanel: !1 },
  1918. panel = settingPanel(
  1919. flowChats,
  1920. mainState,
  1921. state,
  1922. getConfig,
  1923. setConfig
  1924. ),
  1925. toggleButton = ((state, getConfig) => {
  1926. const click$ = new external_rxjs_namespaceObject.Subject()
  1927. return (
  1928. click$
  1929. .pipe(
  1930. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  1931. state.showPanel = !state.showPanel
  1932. })
  1933. )
  1934. .subscribe(),
  1935. {
  1936. view: () =>
  1937. external_m_default()(
  1938. "button",
  1939. {
  1940. className: "fyc_button",
  1941. style: {
  1942. background: "rgba(0,0,0,0)",
  1943. marginLeft: "10px",
  1944. whiteSpace: "nowrap",
  1945. },
  1946. onclick: lib(click$),
  1947. },
  1948. [
  1949. external_m_default()(
  1950. "svg",
  1951. {
  1952. preserveAspectRatio: "xMidYMid meet",
  1953. viewBox: "0 0 640 640",
  1954. width: "15",
  1955. height: "15",
  1956. style: { position: "relative", top: "1px" },
  1957. },
  1958. [
  1959. external_m_default()(
  1960. "defs",
  1961. external_m_default()("path", {
  1962. id: "d1TbzTC1zI",
  1963. d:
  1964. "m135.38 58.17 0.64 0.05 0.63 0.07 0.65 0.1 0.65 0.13 0.66 0.14 0.66 0.17 0.67 0.18 0.67 0.21 0.68 0.23 0.69 0.25 0.68 0.26 0.69 0.29 0.7 0.3 0.69 0.32 0.7 0.33 0.71 0.35 0.7 0.37 0.71 0.38 0.71 0.39 0.7 0.41 0.72 0.42 0.71 0.43 0.71 0.45 45.87 26.91 0.9-0.5 8.92-4.47 9.12-4.12 0.92-0.38v142.27l-2.42 2.55-3.53 4.01-3.38 4.15-3.22 4.28-3.06 4.41-2.9 4.53-2.73 4.65-2.55 4.76-2.37 4.87-2.19 4.97-2 5.07-1.82 5.17-1.61 5.26-1.41 5.35-1.21 5.43-1 5.51-0.78 5.57-0.57 5.65-0.34 5.71-0.12 5.77 0.12 5.78 0.34 5.71 0.57 5.64 0.78 5.58 1 5.51 1.21 5.43 1.41 5.34 1.61 5.27 1.82 5.16 2 5.08 2.19 4.97 2.37 4.87 2.55 4.76 2.73 4.65 2.9 4.53 3.06 4.41 3.22 4.28 3.38 4.14 3.53 4.02 3.68 3.87 3.82 3.73 3.96 3.57 4.09 3.43 4.23 3.26 4.34 3.1 4.47 2.94 4.59 2.76 4.7 2.59 4.8 2.4 4.91 2.22 5.01 2.03 5.1 1.84 5.19 1.63 5.28 1.44 5.36 1.22 5.43 1.01 5.51 0.8 5.57 0.57 5.63 0.35 5.7 0.11 5.69-0.11 5.64-0.35 5.57-0.57 5.51-0.8 5.43-1.01 5.36-1.22 5.28-1.44 5.19-1.63 5.1-1.84 5.01-2.03 4.91-2.22 4.8-2.4 4.7-2.59 4.59-2.76 4.46-2.94 4.35-3.1 4.23-3.26 4.09-3.43 3.96-3.57 3.82-3.73 3.68-3.87 3.53-4.02 3.38-4.14 3.22-4.28 3.06-4.41 2.9-4.53 2.72-4.65 2.56-4.76 2.37-4.87 2.19-4.97 2-5.08 1.81-5.16 1.62-5.27 1.41-5.34 1.21-5.43 1-5.51 0.78-5.58 0.57-5.64 0.34-5.71 0.12-5.78-0.12-5.77-0.06-1.06h33.29l140.27 63.64-0.02 0.01-0.48 0.4-0.51 0.38-0.52 0.37-0.55 0.36-0.57 0.36-0.58 0.34-0.6 0.34-0.63 0.33-0.63 0.32-0.66 0.31-0.67 0.31-0.69 0.3-0.7 0.29-0.71 0.3-0.73 0.28-0.74 0.28-1.52 0.56-0.78 0.27-0.78 0.28-1.6 0.54-0.82 0.26-51.23 13.84-1.32 4.34-3.37 9.6-3.71 9.43-4.07 9.24-4.41 9.04-0.5 0.91 26.56 46.48 0.44 0.72 0.84 1.44 0.4 0.72 0.39 0.72 0.38 0.72 0.36 0.71 0.34 0.71 0.33 0.71 0.32 0.71 0.3 0.7 0.28 0.7 0.26 0.7 0.24 0.69 0.23 0.69 0.2 0.68 0.19 0.67 0.16 0.68 0.14 0.66 0.12 0.66 0.1 0.66 0.08 0.65 0.05 0.64 0.02 0.63 0.01 0.62-0.03 0.62-0.05 0.61-0.08 0.6-0.1 0.59-0.13 0.59-0.16 0.57-0.2 0.57-0.22 0.55-0.25 0.54-0.28 0.54-0.31 0.52-0.35 0.51-0.37 0.5-0.41 0.48-0.45 0.48-66.99 67.88-0.47 0.45-0.47 0.41-0.49 0.38-0.49 0.34-0.51 0.31-0.51 0.27-0.53 0.24-0.53 0.21-0.54 0.18-0.55 0.14-0.56 0.12-0.56 0.09-0.58 0.06-0.58 0.03-0.59 0.01-0.6-0.02-0.61-0.04-0.62-0.07-0.62-0.09-0.63-0.12-0.64-0.13-0.65-0.16-0.65-0.17-0.66-0.2-0.67-0.21-0.68-0.23-0.68-0.25-0.69-0.26-0.69-0.28-0.71-0.3-0.7-0.3-0.72-0.32-0.72-0.33-0.73-0.34-0.73-0.36-0.74-0.36-0.75-0.37-0.75-0.38-1.52-0.78-45.87-26.91-0.9 0.5-8.92 4.47-9.12 4.12-9.3 3.77-9.47 3.41-4.29 1.34-13.65 51.91-0.27 0.83-0.26 0.81-0.27 0.81-0.27 0.8-0.54 1.56-0.28 0.76-0.28 0.75-0.28 0.74-0.29 0.73-0.29 0.71-0.3 0.69-0.3 0.68-0.31 0.67-0.32 0.64-0.32 0.63-0.33 0.61-0.34 0.6-0.35 0.57-0.36 0.55-0.36 0.54-0.38 0.51-0.39 0.49-0.4 0.46-0.41 0.45-0.42 0.42-0.44 0.39-0.45 0.37-0.46 0.34-0.48 0.32-0.49 0.29-0.5 0.26-0.52 0.24-0.54 0.2-0.56 0.18-0.57 0.14-0.59 0.12-0.6 0.08-0.63 0.05-0.64 0.01h-94.74l-0.64-0.01-0.64-0.05-0.61-0.08-0.6-0.12-0.59-0.14-0.57-0.18-0.55-0.2-0.54-0.24-0.53-0.26-0.52-0.29-0.5-0.32-0.49-0.34-0.47-0.37-0.46-0.39-0.45-0.42-0.43-0.45-0.43-0.46-0.41-0.49-0.4-0.51-0.38-0.54-0.38-0.55-0.36-0.57-0.36-0.6-0.34-0.61-0.33-0.63-0.32-0.64-0.31-0.67-0.3-0.68-0.29-0.69-0.28-0.71-0.27-0.73-0.26-0.74-0.25-0.75-0.25-0.76-0.46-1.56-0.21-0.8-0.42-1.62-0.19-0.83-13.65-51.91-4.29-1.34-9.47-3.41-9.3-3.77-9.12-4.12-8.92-4.47-1.08-0.59-45.69 26.81-1.42 0.88-0.72 0.42-0.7 0.4-0.71 0.4-0.71 0.38-0.7 0.37-0.71 0.35-0.7 0.33-0.69 0.32-0.7 0.3-0.69 0.29-0.68 0.26-0.69 0.25-0.68 0.23-0.67 0.2-0.67 0.19-0.66 0.17-0.66 0.14-0.65 0.12-0.65 0.1-0.63 0.08-0.64 0.05-0.62 0.03h-0.62l-0.61-0.03-0.6-0.05-0.59-0.08-0.59-0.1-0.57-0.14-0.57-0.16-0.56-0.19-0.54-0.23-0.54-0.25-0.52-0.28-0.52-0.32-0.5-0.35-0.49-0.38-0.48-0.42-0.47-0.45-66.99-67.88-0.45-0.48-0.4-0.48-0.37-0.49-0.34-0.5-0.3-0.52-0.27-0.52-0.24-0.53-0.21-0.54-0.17-0.54-0.15-0.56-0.11-0.57-0.09-0.57-0.06-0.58-0.03-0.6-0.01-0.6 0.02-0.6 0.04-0.62 0.07-0.62 0.09-0.64 0.11-0.64 0.14-0.64 0.15-0.66 0.17-0.66 0.19-0.67 0.44-1.36 0.25-0.69 0.26-0.7 0.27-0.71 0.29-0.71 0.3-0.72 0.32-0.72 0.33-0.73 0.33-0.74 0.35-0.74 0.36-0.75 0.74-1.52 0.38-0.77 0.39-0.77 26.5-46.38-0.44-0.82-4.41-9.04-4.07-9.24-3.72-9.43-3.36-9.6-1.33-4.34-51.22-13.84-0.82-0.26-1.6-0.54-0.78-0.28-0.78-0.27-1.52-0.56-0.74-0.28-0.73-0.28-0.71-0.3-0.7-0.29-0.69-0.3-0.67-0.31-0.66-0.31-0.64-0.32-0.62-0.33-0.6-0.34-0.58-0.34-0.57-0.36-0.55-0.36-0.52-0.37-0.51-0.38-0.48-0.4-0.46-0.4-0.44-0.42-0.41-0.43-0.39-0.44-0.37-0.45-0.33-0.47-0.32-0.48-0.28-0.5-0.26-0.51-0.23-0.53-0.21-0.55-0.17-0.56-0.14-0.58-0.11-0.6-0.08-0.61-0.05-0.63-0.02-0.66v-96l0.02-0.65 0.05-0.64 0.08-0.62 0.11-0.61 0.14-0.59 0.17-0.58 0.21-0.57 0.23-0.54 0.26-0.54 0.28-0.52 0.32-0.51 0.33-0.49 0.37-0.48 0.39-0.47 0.41-0.45 0.44-0.45 0.46-0.42 0.48-0.42 0.51-0.4 0.52-0.4 0.55-0.38 0.57-0.37 0.58-0.35 0.6-0.35 0.62-0.34 0.64-0.32 0.66-0.32 0.67-0.3 0.69-0.29 0.7-0.29 0.71-0.27 0.73-0.27 0.74-0.25 0.76-0.25 0.76-0.24 1.56-0.44 0.8-0.22 0.8-0.2 0.82-0.2 51.22-13.83 1.33-4.35 3.36-9.6 3.72-9.42 4.07-9.24 4.41-9.04 0.5-0.91-26.56-46.48-0.77-1.54-0.74-1.52-0.36-0.75-0.35-0.74-0.33-0.74-0.33-0.73-0.32-0.73-0.3-0.71-0.29-0.72-0.27-0.7-0.26-0.7-0.25-0.69-0.44-1.36-0.19-0.67-0.17-0.66-0.15-0.66-0.14-0.65-0.11-0.64-0.09-0.63-0.07-0.62-0.04-0.62-0.02-0.61 0.01-0.6 0.03-0.59 0.06-0.58 0.09-0.58 0.11-0.56 0.15-0.56 0.17-0.55 0.21-0.54 0.24-0.53 0.27-0.52 0.3-0.51 0.34-0.5 0.37-0.49 0.4-0.49 0.45-0.47 66.99-67.88 0.47-0.45 0.48-0.42 0.49-0.38 0.5-0.35 0.52-0.32 0.52-0.28 0.54-0.26 0.54-0.22 0.56-0.19 0.57-0.17 0.57-0.13 0.59-0.11 0.59-0.08 0.6-0.05 0.61-0.02h0.62l0.62 0.03zm441.37-56.16 2.78 0.28 2.75 0.4 2.71 0.49 2.67 0.61 2.63 0.7 2.59 0.81 2.54 0.9 2.5 1 2.45 1.09 2.39 1.18 2.35 1.28 2.28 1.36 2.23 1.44 2.17 1.53 2.11 1.6 2.04 1.69 1.97 1.76 1.91 1.83 1.83 1.91 1.76 1.97 1.69 2.05 1.61 2.1 1.52 2.17 1.45 2.23 1.36 2.29 1.27 2.34 1.18 2.4 1.1 2.44 0.99 2.5 0.91 2.55 0.8 2.58 0.71 2.64 0.6 2.67 0.5 2.71 0.39 2.74 0.28 2.78 0.17 2.81 0.06 2.84v137.8l-0.06 2.84-0.17 2.81-0.28 2.78-0.39 2.75-0.5 2.71-0.6 2.67-0.71 2.63-0.8 2.59-0.91 2.54-0.99 2.5-1.1 2.45-1.18 2.39-1.27 2.35-1.36 2.28-1.45 2.23-1.52 2.17-1.61 2.11-1.69 2.04-1.76 1.97-1.83 1.91-1.91 1.83-1.97 1.76-2.04 1.69-2.11 1.61-2.17 1.52-2.23 1.45-2.28 1.36-2.35 1.27-0.98 0.49 21.81 70.8-141.75-63.6h-155.05l-2.84-0.06-2.81-0.17-2.78-0.28-2.74-0.39-2.71-0.5-2.67-0.6-2.64-0.71-2.58-0.8-2.55-0.91-2.5-1-2.44-1.09-2.4-1.18-2.34-1.27-2.29-1.36-2.23-1.45-2.17-1.52-2.1-1.61-2.05-1.69-1.97-1.76-1.91-1.83-1.83-1.91-1.76-1.97-1.68-2.04-1.61-2.11-1.53-2.17-1.44-2.23-1.36-2.28-1.27-2.35-1.19-2.39-1.09-2.45-1-2.5-0.9-2.54-0.81-2.59-0.7-2.63-0.61-2.67-0.49-2.71-0.39-2.75-0.29-2.78-0.17-2.81-0.06-2.84v-137.8l0.06-2.84 0.17-2.81 0.29-2.78 0.39-2.74 0.49-2.71 0.61-2.67 0.7-2.64 0.81-2.58 0.9-2.55 1-2.5 1.09-2.44 1.19-2.4 1.27-2.34 1.36-2.29 1.44-2.23 1.53-2.17 1.61-2.1 1.68-2.05 1.76-1.97 1.83-1.91 1.91-1.83 1.97-1.76 2.05-1.69 2.1-1.6 2.17-1.53 2.23-1.44 2.29-1.36 2.34-1.28 2.4-1.18 2.44-1.09 2.5-1 2.55-0.9 2.58-0.81 2.64-0.7 2.67-0.61 2.71-0.49 2.74-0.4 2.78-0.28 2.81-0.17 2.84-0.06h244.31l2.84 0.06 2.81 0.17z",
  1965. })
  1966. ),
  1967. external_m_default()("use", {
  1968. "xlink:href": "#d1TbzTC1zI",
  1969. opacity: "1",
  1970. fill: "var(--iron-icon-fill-color, currentcolor)",
  1971. "fill-opacity": "1",
  1972. }),
  1973. ]
  1974. ),
  1975. external_m_default()(
  1976. "span",
  1977. {
  1978. style: {
  1979. position: "relative",
  1980. top: "-2px",
  1981. marginLeft: "8px,",
  1982. },
  1983. },
  1984. "FYC_JA" === getConfig.lang() ? "設定" : "Settings"
  1985. ),
  1986. ]
  1987. ),
  1988. }
  1989. )
  1990. })(state, getConfig)
  1991. return {
  1992. view: () => [
  1993. external_m_default()(panel),
  1994. external_m_default()(toggleButton),
  1995. ],
  1996. }
  1997. },
  1998. initialize = async (mainState, mainLog) => {
  1999. const consoleLog = (a, ...b) => {
  2000. mainLog(a, ...b),
  2001. external_log_default().info(`【FYC ${a}`),
  2002. b.length > 0 && external_log_default().info(...b)
  2003. }
  2004. mainLog("Version", package_namespaceObject_i8),
  2005. mainLog("User Agent", window.navigator.userAgent)
  2006. const userConfig = await (async () => ({
  2007. lang: await simpleConfig("FYC_LANG", "FYC_EN"),
  2008. font: await simpleConfig("FYC_FONT", "MS PGothic"),
  2009. chatOpacity: await simpleConfig("FYC_OPACITY", 0.8),
  2010. color: await simpleConfig("FYC_COLOR", "#ffffff"),
  2011. ownerColor: await simpleConfig("FYC_COLOR_OWNER", "#ffd600"),
  2012. moderatorColor: await simpleConfig(
  2013. "FYC_COLOR_MODERATOR",
  2014. "#a74fff"
  2015. ),
  2016. memberColor: await simpleConfig("FYC_COLOR_MEMBER", "#9fffff"),
  2017. fontSize: await simpleConfig("FYC_SIZE", 1),
  2018. fontWeight: await simpleConfig("FYC_WEIGHT", 730),
  2019. shadowFontWeight: await simpleConfig("FYC_WEIGHT_SHADOW", 1),
  2020. maxChatCount: await simpleConfig("FYC_LIMIT", 40),
  2021. flowSpeed: await simpleConfig("FYC_SPEED", 18),
  2022. maxChatLength: await simpleConfig("FYC_MAX", 100),
  2023. laneCount: await simpleConfig("FYC_LANE_DIV", 12),
  2024. bannedWords: await indirectConfig(
  2025. "FYC_NG_WORDS",
  2026. ...lineConfigArgs
  2027. ),
  2028. bannedWordRegexs: await indirectConfig(
  2029. "FYC_NG_REG_WORDS",
  2030. ...lineConfigArgs
  2031. ),
  2032. bannedUsers: await indirectConfig(
  2033. "FYC_NG_USERS",
  2034. ...lineConfigArgs
  2035. ),
  2036. createChats: await simpleConfig("FYC_TOGGLE_CREATE_COMMENTS", !0),
  2037. noOverlap: await simpleConfig("FYC_NO_OVERLAP", !0),
  2038. createBanButton: await simpleConfig("FYC_NG_BUTTON", !0),
  2039. simplifyChatField: await simpleConfig("FYC_SIMPLE_CHAT_FIELD", !1),
  2040. displayModName: await simpleConfig(
  2041. "FYC_DISPLAY_MODERATOR_NAME",
  2042. !0
  2043. ),
  2044. displaySuperChatAuthor: await simpleConfig(
  2045. "FYC_DISPLAY_SUPER_CHAT_AUTHOR",
  2046. !0
  2047. ),
  2048. textOnly: await simpleConfig("FYC_TEXT_ONLY", !1),
  2049. timingFunction: await simpleConfig("FYC_TIMING_FUNCTION", "linear"),
  2050. displayChats: await simpleConfig("FYC_DISPLAY_COMMENTS", !0),
  2051. minSpacing: await simpleConfig("FYC_MIN_SPACING", 0.5),
  2052. fieldScale: await simpleConfig("FYC_FIELD_SCALE", 1),
  2053. }))()
  2054. mainLog("UserConfig", JSON.stringify(userConfig))
  2055. const configKeys = Object.keys(userConfig),
  2056. getConfig = function_pipe(
  2057. configKeys,
  2058. es6_ReadonlyArray_map(x => [x, () => userConfig[x].val]),
  2059. Object.fromEntries
  2060. ),
  2061. configStream = function_pipe(
  2062. configKeys,
  2063. es6_ReadonlyArray_map(x => [
  2064. x,
  2065. new external_rxjs_namespaceObject.Subject(),
  2066. ]),
  2067. Object.fromEntries
  2068. ),
  2069. channel = new BroadcastChannel("fyc-0615654655528523"),
  2070. setConfigPlain = function_pipe(
  2071. configKeys,
  2072. es6_ReadonlyArray_map(x => [
  2073. x,
  2074. async val => {
  2075. ;(userConfig[x].val = val), configStream[x].next(val)
  2076. },
  2077. ]),
  2078. Object.fromEntries
  2079. ),
  2080. setConfig = function_pipe(
  2081. configKeys,
  2082. es6_ReadonlyArray_map(x => [
  2083. x,
  2084. async val => {
  2085. setConfigPlain[x](val)
  2086. const item = userConfig[x]
  2087. channel.postMessage([x, val]),
  2088. await GM.setValue(item.gmKey, item.toGm(val))
  2089. },
  2090. ]),
  2091. Object.fromEntries
  2092. ),
  2093. reinitSubject = new external_rxjs_namespaceObject.Subject(),
  2094. reinitialize = lib(reinitSubject),
  2095. chatScrn = (() => {
  2096. const element = document.createElement("div")
  2097. return (
  2098. (element.style.pointerEvents = "none"),
  2099. (element.style.zIndex = "30"),
  2100. element
  2101. )
  2102. })(),
  2103. css = (() => {
  2104. const element = document.createElement("style")
  2105. return (
  2106. (element.innerHTML =
  2107. ".fyc_chat {\n line-height: 1;\n z-index: 30;\n position: absolute;\n user-select: none;\n white-space: nowrap;\n will-change: transform;\n }\n .fyc_chat > img {\n vertical-align: text-top;\n }\n .fyc_button {\n display: inline-block;\n border-style: none;\n z-index: 4;\n font-weight: 500;\n color: var(--yt-spec-text-secondary);\n }"),
  2108. element
  2109. )
  2110. })(),
  2111. flowChats = [],
  2112. observePair = con => {
  2113. const subject = new external_rxjs_namespaceObject.Subject()
  2114. return { subject, observer: new con(lib(subject)) }
  2115. },
  2116. documentMutationPair = observePair(MutationObserver),
  2117. chatFieldMutationPair = observePair(MutationObserver),
  2118. playerResizePair = observePair(ResizeObserver),
  2119. simpleWrap = comp => ({
  2120. comp,
  2121. root: document.createElement("span"),
  2122. }),
  2123. wrappedToggleChatBtn = simpleWrap(
  2124. ((flowChats, getConfig, setConfig) => {
  2125. const click$ = new external_rxjs_namespaceObject.Subject()
  2126. click$
  2127. .pipe(
  2128. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2129. const newDisplay = !getConfig.displayChats()
  2130. flowChats.forEach(x => {
  2131. x.element.style.visibility = newDisplay
  2132. ? "visible"
  2133. : "hidden"
  2134. }),
  2135. setConfig.displayChats(newDisplay)
  2136. })
  2137. )
  2138. .subscribe()
  2139. const label = () =>
  2140. "チャット" + (getConfig.displayChats() ? "非表示" : "表示")
  2141. return {
  2142. view: () =>
  2143. external_m_default()(
  2144. "button",
  2145. {
  2146. className: ["ytp-button"].join(" "),
  2147. style: {
  2148. background: "none",
  2149. border: "none",
  2150. cursor: "pointer",
  2151. float: "left",
  2152. fontSize: "1em",
  2153. height: "4em",
  2154. outline: "none",
  2155. overflow: "visible",
  2156. padding: "0 0 0em",
  2157. position: "relative",
  2158. width: "3em",
  2159. },
  2160. type: "button",
  2161. "aria-label": label(),
  2162. title: label(),
  2163. onclick: lib(click$),
  2164. },
  2165. [
  2166. external_m_default()(
  2167. "svg",
  2168. { style: { width: "100%" }, viewBox: "0 0 36 36" },
  2169. [
  2170. external_m_default()("path", {
  2171. className: ["chat-button-path"].join(" "),
  2172. d:
  2173. "m11 12h17q1 0 1 1v9q0 1-1 1h-1v2l-4-2h-12q-1 0-1-1v-9q0-1 1-1z",
  2174. fill: "#fff",
  2175. "fill-opacity": getConfig.displayChats()
  2176. ? "1"
  2177. : "0",
  2178. stroke: "#fff",
  2179. "stroke-width": "2",
  2180. }),
  2181. ]
  2182. ),
  2183. ]
  2184. ),
  2185. }
  2186. })(flowChats, getConfig, setConfig)
  2187. ),
  2188. wrappedSetting = simpleWrap(
  2189. settingComponent(flowChats, mainState, getConfig, setConfig)
  2190. ),
  2191. livePage = {
  2192. toggleChatBtnParent: () =>
  2193. fromNullable(document.querySelector(".ytp-right-controls")),
  2194. settingNextElement: () =>
  2195. fromNullable(
  2196. document.querySelector(
  2197. "#menu-container .dropdown-trigger.ytd-menu-renderer"
  2198. )
  2199. ),
  2200. player: () =>
  2201. fromNullable(document.querySelector("#movie_player")),
  2202. video: () =>
  2203. fromNullable(
  2204. document.querySelector("video.video-stream.html5-main-video")
  2205. ),
  2206. chatField: () =>
  2207. function_pipe(
  2208. chatApp(),
  2209. chainNullableK(x =>
  2210. x.querySelector("#items.yt-live-chat-item-list-renderer")
  2211. )
  2212. ),
  2213. chatScroller: () =>
  2214. function_pipe(
  2215. chatApp(),
  2216. chainNullableK(x =>
  2217. x.querySelector(
  2218. "#item-scroller.yt-live-chat-item-list-renderer"
  2219. )
  2220. )
  2221. ),
  2222. offlineSlate: () =>
  2223. fromNullable(document.querySelector(".ytp-offline-slate")),
  2224. },
  2225. liveElementKeys = Object.keys(livePage),
  2226. live = function_pipe(
  2227. liveElementKeys,
  2228. es6_ReadonlyArray_map(x => {
  2229. return [x, ((key = x), { ele: none, read: livePage[key] })]
  2230. var key
  2231. }),
  2232. Object.fromEntries
  2233. ),
  2234. eq = getEq(eqStrict).equals
  2235. reinitSubject
  2236. .pipe(
  2237. (0, external_rxjs_operators_namespaceObject.observeOn)(
  2238. external_rxjs_namespaceObject.asyncScheduler
  2239. ),
  2240. (0, external_rxjs_operators_namespaceObject.delay)(300),
  2241. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2242. (0, external_rxjs_namespaceObject.interval)(500).pipe(
  2243. (0, external_rxjs_operators_namespaceObject.filter)(() => {
  2244. return function_pipe(
  2245. liveElementKeys,
  2246. es6_ReadonlyArray_map(key => {
  2247. return function_pipe(
  2248. live[key].read(),
  2249. ((predicate = newEle => !eq(live[key].ele, newEle)),
  2250. function (a) {
  2251. return predicate(a) ? some(a) : none
  2252. }),
  2253. es6_Option_map(x => () => (
  2254. (live[key].ele = x),
  2255. consoleLog(`${key} changed`),
  2256. !0
  2257. )),
  2258. getOrElse(() => of(!1))
  2259. )
  2260. var predicate
  2261. }),
  2262. sequenceArray,
  2263. (function (f) {
  2264. return function (fa) {
  2265. return _map(fa, f)
  2266. }
  2267. })(
  2268. ((predicate = Boolean),
  2269. function (as) {
  2270. return as.some(predicate)
  2271. })
  2272. )
  2273. )()
  2274. var predicate
  2275. }),
  2276. (0, external_rxjs_operators_namespaceObject.startWith)(0)
  2277. )
  2278. ),
  2279. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2280. consoleLog("Loading..."),
  2281. removeOldChats(flowChats, 0),
  2282. documentMutationPair.observer.disconnect(),
  2283. documentMutationPair.observer.observe(document, {
  2284. childList: !0,
  2285. subtree: !0,
  2286. }),
  2287. chatFieldMutationPair.observer.disconnect(),
  2288. playerResizePair.observer.disconnect(),
  2289. document.head.append(css),
  2290. function_pipe(
  2291. [
  2292. function_pipe(
  2293. live.chatField.ele,
  2294. es6_Option_map(x => () => {
  2295. var chatField
  2296. ;((chatField = x),
  2297. () =>
  2298. function_pipe(
  2299. fromNullable(chatField.parentElement),
  2300. es6_Option_map(x => () => {
  2301. x.style.overflow = "unset"
  2302. })
  2303. ))(),
  2304. chatFieldMutationPair.observer.observe(x, {
  2305. childList: !0,
  2306. })
  2307. })
  2308. ),
  2309. function_pipe(
  2310. live.player.ele,
  2311. es6_Option_map(x => () => {
  2312. playerResizePair.observer.observe(x),
  2313. x.insertAdjacentElement("afterbegin", chatScrn)
  2314. })
  2315. ),
  2316. function_pipe(
  2317. live.toggleChatBtnParent.ele,
  2318. es6_Option_map(x => () => {
  2319. x.append(wrappedToggleChatBtn.root),
  2320. mountComponent(wrappedToggleChatBtn)
  2321. })
  2322. ),
  2323. function_pipe(
  2324. live.settingNextElement.ele,
  2325. es6_Option_map(x => () => {
  2326. x.insertAdjacentElement(
  2327. "beforebegin",
  2328. wrappedSetting.root
  2329. ),
  2330. mountComponent(wrappedSetting)
  2331. })
  2332. ),
  2333. ],
  2334. es6_ReadonlyArray_map(getOrElse(() => () => {})),
  2335. ReadonlyArray_append(
  2336. function_pipe(
  2337. live.video.ele,
  2338. filter(x => !x.paused),
  2339. alt(() => live.offlineSlate.ele),
  2340. isSome,
  2341. x => () => {
  2342. mainState.chatPlaying = x
  2343. }
  2344. )
  2345. ),
  2346. sequenceArray
  2347. )()
  2348. }),
  2349. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2350. (0, external_rxjs_namespaceObject.merge)(
  2351. (0, external_rxjs_namespaceObject.fromEvent)(
  2352. channel,
  2353. "message"
  2354. ).pipe(
  2355. (0, external_rxjs_operators_namespaceObject.pluck)("data"),
  2356. (0, external_rxjs_operators_namespaceObject.tap)(
  2357. ([key, val]) => {
  2358. ;[
  2359. "bannedWords",
  2360. "bannedWordRegexs",
  2361. "bannedUsers",
  2362. "simplifyChatField",
  2363. "createBanButton",
  2364. "fieldScale",
  2365. ].includes(key) &&
  2366. (setConfigPlain[key](val),
  2367. external_m_default().redraw())
  2368. }
  2369. )
  2370. ),
  2371. ...function_pipe(
  2372. configKeys,
  2373. es6_ReadonlyArray_map(key =>
  2374. configStream[key].pipe(
  2375. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  2376. mainLog(`Config ${key} changed`, x)
  2377. )
  2378. )
  2379. )
  2380. ),
  2381. configStream.fieldScale.pipe(
  2382. (0, external_rxjs_operators_namespaceObject.startWith)(
  2383. getConfig.fieldScale()
  2384. ),
  2385. (0, external_rxjs_operators_namespaceObject.tap)(scale =>
  2386. function_pipe(
  2387. live.chatField.ele,
  2388. match(
  2389. () => () => {},
  2390. field => () => {
  2391. function_pipe(
  2392. fromNullable(field.parentElement),
  2393. match(
  2394. () => () => {},
  2395. x => () => {
  2396. ;(x.style.transformOrigin =
  2397. (scale >= 1 ? "top" : "bottom") + " left"),
  2398. (x.style.transform = `scale(${scale})`),
  2399. (x.style.width = 100 / scale + "%"),
  2400. (x.style.height = `${field.offsetHeight}px`)
  2401. }
  2402. )
  2403. )(),
  2404. function_pipe(
  2405. live.chatScroller.ele,
  2406. match(
  2407. () => () => {},
  2408. scroller => () => {
  2409. scroller.scrollTop = scroller.scrollHeight
  2410. }
  2411. )
  2412. )()
  2413. }
  2414. )
  2415. )()
  2416. )
  2417. ),
  2418. function_pipe(
  2419. live.video.ele,
  2420. match(
  2421. () => external_rxjs_namespaceObject.EMPTY,
  2422. x => {
  2423. return ((video = x),
  2424. (0, external_rxjs_namespaceObject.merge)(
  2425. (0, external_rxjs_namespaceObject.fromEvent)(
  2426. video,
  2427. "playing"
  2428. ).pipe(
  2429. (0, external_rxjs_operators_namespaceObject.mapTo)(
  2430. !0
  2431. )
  2432. ),
  2433. (0, external_rxjs_namespaceObject.fromEvent)(
  2434. video,
  2435. "waiting"
  2436. ).pipe(
  2437. (0, external_rxjs_operators_namespaceObject.mapTo)(
  2438. !1
  2439. )
  2440. ),
  2441. (0, external_rxjs_namespaceObject.fromEvent)(
  2442. video,
  2443. "pause"
  2444. ).pipe(
  2445. (0, external_rxjs_operators_namespaceObject.mapTo)(
  2446. !1
  2447. )
  2448. )
  2449. )).pipe(
  2450. (0, external_rxjs_operators_namespaceObject.map)(
  2451. playing => playing || isSome(live.offlineSlate.ele)
  2452. ),
  2453. (0, external_rxjs_operators_namespaceObject.tap)(
  2454. chatPlaying => {
  2455. ;(mainState.chatPlaying = chatPlaying),
  2456. flowChats.forEach(chat => {
  2457. setChatPlayState(chat, mainState, getConfig)
  2458. })
  2459. }
  2460. )
  2461. )
  2462. var video
  2463. }
  2464. )
  2465. ),
  2466. chatFieldMutationPair.subject.pipe(
  2467. (0, external_rxjs_operators_namespaceObject.tap)(
  2468. onChatFieldMutate(
  2469. chatScrn,
  2470. flowChats,
  2471. mainState,
  2472. getConfig,
  2473. setConfig,
  2474. mainLog
  2475. )
  2476. )
  2477. ),
  2478. documentMutationPair.subject.pipe(
  2479. (0, external_rxjs_operators_namespaceObject.map)(
  2480. () => window.location.href
  2481. ),
  2482. (0,
  2483. external_rxjs_operators_namespaceObject.distinctUntilChanged)(),
  2484. (0, external_rxjs_operators_namespaceObject.skip)(1),
  2485. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  2486. consoleLog("URL Changed", x),
  2487. removeOldChats(flowChats, 0),
  2488. consoleLog("Wait for 1700ms...")
  2489. }),
  2490. (0, external_rxjs_operators_namespaceObject.delay)(1700),
  2491. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2492. reinitialize()
  2493. )
  2494. ),
  2495. playerResizePair.subject.pipe(
  2496. (0,
  2497. external_rxjs_operators_namespaceObject.throttleTime)(
  2498. 500,
  2499. void 0,
  2500. { leading: !0, trailing: !0 }
  2501. ),
  2502. (0, external_rxjs_operators_namespaceObject.startWith)([]),
  2503. (0, external_rxjs_operators_namespaceObject.map)(
  2504. () => live.player.ele
  2505. ),
  2506. (0, external_rxjs_operators_namespaceObject.map)(
  2507. es6_Option_map(x => x.getBoundingClientRect())
  2508. ),
  2509. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  2510. ((rect, flowChats, mainState, getConfig, mainLog) =>
  2511. function_pipe(
  2512. rect,
  2513. match(
  2514. () => () => {},
  2515. x => () => {
  2516. mainLog("Resize detected"),
  2517. (mainState.playerRect = x),
  2518. flowChats.forEach(chat => {
  2519. setChatStyle(chat, mainState, getConfig),
  2520. setChatAnimation(
  2521. chat,
  2522. flowChats,
  2523. mainState,
  2524. getConfig
  2525. )
  2526. })
  2527. }
  2528. )
  2529. )())(x, flowChats, mainState, getConfig, mainLog)
  2530. )
  2531. )
  2532. )
  2533. ),
  2534. (0, external_rxjs_operators_namespaceObject.retryWhen)(
  2535. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  2536. consoleLog("Errored", x)
  2537. )
  2538. )
  2539. )
  2540. .subscribe(),
  2541. reinitialize()
  2542. }
  2543. ;(async () => {
  2544. external_log_namespaceObject.setLevel("info")
  2545. const mainState = {
  2546. chatPlaying: !0,
  2547. playerRect: new DOMRect(24, 80, 839, 472),
  2548. log: "",
  2549. },
  2550. mainLog = (mainState => (a, ...b) => {
  2551. ;(mainState.log += `${a}${b.length > 0 ? ": " : ""}${b.join(
  2552. ", "
  2553. )}\n`),
  2554. mainState.log.length > 22e3 &&
  2555. (mainState.log = `${mainState.log.slice(0, 6e3)}\n`)
  2556. })(mainState)
  2557. try {
  2558. await initialize(mainState, mainLog)
  2559. } catch (error) {
  2560. mainLog("Errored", error)
  2561. }
  2562. })()
  2563. })()
  2564. })()