Tema


SUBMITTED BY: Laranjo

DATE: June 9, 2023, 12:37 p.m.

UPDATED: May 27, 2024, 11:49 p.m.

FORMAT: Text only

SIZE: 100.2 kB

HITS: 852

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>DTunnel</title>
  8. </head>
  9. <style>
  10. * {
  11. font-family: 'roboto';
  12. margin: 0;
  13. padding: 0;
  14. box-sizing: border-box;
  15. -webkit-tap-highlight-color: transparent;
  16. }
  17. ::placeholder {
  18. color: #FFF;
  19. }
  20. body {
  21. height: 100vh;
  22. }
  23. @keyframes fade-in {
  24. from {
  25. opacity: 0;
  26. }
  27. to {
  28. opacity: 1;
  29. }
  30. }
  31. @keyframes fade-out {
  32. from {
  33. opacity: 1;
  34. }
  35. to {
  36. opacity: 0;
  37. }
  38. }
  39. @keyframes pulse {
  40. 0% {
  41. transform: scale(1);
  42. box-shadow: none;
  43. }
  44. 50% {
  45. transform: scale(1.2);
  46. box-shadow: 0 0 20px 5px #ffffff5d;
  47. }
  48. 100% {
  49. transform: scale(1);
  50. box-shadow: none;
  51. }
  52. }
  53. @keyframes spin {
  54. from {
  55. transform: rotate(0deg);
  56. }
  57. to {
  58. transform: rotate(360deg);
  59. }
  60. }
  61. </style>
  62. <body>
  63. <div id="root"></div>
  64. <script>
  65. const BACKGROUND_IMAGE = JSON.parse(window?.DtGetAppConfig?.execute('APP_BACKGROUND_IMAGE') ?? '{"value": "https://i.ibb.co/pjtTQC8/487f7b22f68312d2c1bbc93b1aea445b-1702526703602.jpg"}').value;
  66. const BACKGROUND_COLOR = BACKGROUND_IMAGE
  67. ? `url(${BACKGROUND_IMAGE}) center center / cover rgb(0, 0, 0)`
  68. : 'linear-gradient(45deg, #000000, #000000 25%, #000000 25%, #000000 50%, #000000 50%, #000000 75%, #000000 75%, #000000)'
  69. const INPUT_COLOR = '#36374959'
  70. const BUTTON_BACKGROUND_COLOR = '#36374959'
  71. const ICON_COLOR = '#FFFFFF'
  72. const TEXT_COLOR = '#FFFFFF'
  73. const TOOLS_BUTTON_BACKGROUND_COLOR = '#36374959'
  74. const VPN_BUTTON_BACKGROUND_COLOR = '#36374959'
  75. const VPN_STOPPED_COLOR = '#ff0000'
  76. const VPN_STARTING_COLOR = '#ffff00'
  77. const VPN_RUNNING_COLOR = '#00ff00'
  78. const CHECKUSER_TEXT_COLOR = '#FFFFFF'
  79. const LOGGER_TEXT_COLOR = '#FFFFFF'
  80. const DIALOG_HEADER_TITLE_COLOR = '#FFFFFF'
  81. const DIALOG_HEADER_CLOSE_BUTTON_COLOR = '#FFFFFF'
  82. const DIALOG_CONTENT_BACKGROUND_COLOR = '#36374959'
  83. const DIALOG_FOOTER_BUTTON_COLOR = '#36374959'
  84. const DIALOG_FOOTER_BUTTON_TEXT_COLOR = '#FFFFFF'
  85. const LINK_SUPPORT = 'https://wa.me/+5579991996384'
  86. const TERMS_URL = 'https://laranjo.gestorssh.com.br/views/home/criar_teste.php?id=ptu&byid=1&mainid=971963'
  87. const URL_RENOVAR = 'https://laranjo.gestorssh.com.br/index.php'
  88. const URL_TESTE = 'https://laranjo.gestorssh.com.br/views/home/criar_teste.php?id=zw6&byid=1&mainid=760653'
  89. const URL_MP3 = 'https://temp-mail.org/pt/'
  90. const URL_FILMES = 'https://tvonline.fan/'
  91. const URL_GPT = 'https://talkai.info/pt/chat/'
  92. const URL_TV = 'https://megatvonline.biz/'
  93. const URL_JOGOS = 'https://centerforyoung.org/?gad_source=1&gclid=Cj0KCQjw3ZayBhDRARIsAPWzx8o_53Q2gGhB8G1MN9dCiH9Orwfl0Lwker5A-hmP0gs45RObyd7jOxsaAqbbEALw_wcB'
  94. class Component {
  95. constructor(element) {
  96. this.element = element;
  97. }
  98. addEventListener(event, listener) {
  99. this.element.addEventListener(event, listener);
  100. }
  101. append(component) {
  102. if (component instanceof Component) {
  103. this.element.appendChild(component.element);
  104. } else {
  105. this.element.append(component);
  106. }
  107. }
  108. appendChild(component) {
  109. if (component instanceof Component) {
  110. this.element.appendChild(component.element);
  111. } else {
  112. this.element.appendChild(component);
  113. }
  114. }
  115. remove() {
  116. this.element.remove();
  117. }
  118. contains(component) {
  119. if (component instanceof Component) {
  120. return this.element.contains(component.element);
  121. } else {
  122. return this.element.contains(component);
  123. }
  124. }
  125. }
  126. class StyledComponent extends Component {
  127. constructor(element, styles = {}) {
  128. super(element);
  129. this.styles = styles;
  130. this.setStyles(styles);
  131. }
  132. setStyles(styles) {
  133. Object.keys(styles).forEach((key) => {
  134. if (this.element.style.hasOwnProperty(key)) {
  135. this.element.style[key] = styles[key];
  136. }
  137. });
  138. }
  139. }
  140. class Toast extends StyledComponent {
  141. constructor(element, styles = {}) {
  142. super(element, styles);
  143. }
  144. showToast(message, type, duration = 3000) {
  145. this.element.innerHTML = message;
  146. this.element.style.wordWrap = 'break-word';
  147. this.element.style.width = '90%';
  148. this.element.style.maxWidth = '400px';
  149. this.element.style.textAlign = 'center';
  150. this.element.style.display = 'block';
  151. this.element.style.position = 'fixed';
  152. this.element.style.bottom = '10%';
  153. this.element.style.left = '50%';
  154. this.element.style.transform = 'translateX(-50%)';
  155. this.element.style.opacity = '0';
  156. this.element.style.color = '#FFFFFF';
  157. switch (type) {
  158. case 'success':
  159. this.element.style.background = 'linear-gradient(135deg, #4CAF50, #009688)';
  160. break;
  161. case 'error':
  162. this.element.style.background = 'linear-gradient(135deg, #F44336, #FF5722)';
  163. break;
  164. case 'info':
  165. default:
  166. this.element.style.background = 'linear-gradient(135deg, #2196F3, #03A9F4)';
  167. break;
  168. }
  169. this.element.style.padding = '10px';
  170. this.element.style.borderRadius = '4px';
  171. this.element.style.opacity = '0';
  172. this.element.style.transition = 'opacity 0.3s ease-in-out';
  173. setTimeout(() => {
  174. this.element.style.opacity = '1';
  175. }, 100);
  176. setTimeout(() => this.hideToast(), duration);
  177. this.element.addEventListener('click', () => this.hideToast());
  178. }
  179. hideToast() {
  180. this.element.style.transition = 'opacity 0.3s ease-in-out';
  181. this.element.style.opacity = '0';
  182. setTimeout(() => {
  183. this.element.remove();
  184. }, 300);
  185. }
  186. static success(message, duration = 3000) {
  187. const toastElement = document.createElement('div');
  188. document.body.appendChild(toastElement);
  189. const toast = new Toast(toastElement);
  190. toast.showToast(message, 'success', duration);
  191. }
  192. static error(message, duration = 3000) {
  193. const toastElement = document.createElement('div');
  194. document.body.appendChild(toastElement);
  195. const toast = new Toast(toastElement);
  196. toast.showToast(message, 'error', duration);
  197. }
  198. static info(message, duration = 3000) {
  199. const toastElement = document.createElement('div');
  200. document.body.appendChild(toastElement);
  201. const toast = new Toast(toastElement);
  202. toast.showToast(message, 'info', duration);
  203. }
  204. }
  205. class AppComponent extends StyledComponent {
  206. constructor(element, styles = {}) {
  207. const defaultStyles = {
  208. width: '100%',
  209. height: '100%',
  210. background: '#404258',
  211. display: 'flex',
  212. flexDirection: 'column',
  213. justifyContent: 'center',
  214. alignItems: 'center',
  215. };
  216. super(element, { ...defaultStyles, ...styles });
  217. }
  218. }
  219. class CardComponent extends StyledComponent {
  220. constructor(styles = {}) {
  221. const defaultStyles = {
  222. display: 'flex',
  223. flexDirection: 'column',
  224. alignItems: 'center',
  225. justifyContent: 'center',
  226. width: '85%',
  227. maxWidth: '23rem',
  228. margin: '1.2rem',
  229. borderRadius: '5px',
  230. border: 'none',
  231. };
  232. super(document.createElement('div'), { ...defaultStyles, ...styles });
  233. }
  234. }
  235. class InputGroupComponent extends StyledComponent {
  236. constructor(styles = {}) {
  237. const defaultStyles = {
  238. display: 'flex',
  239. width: '100%',
  240. alignItems: 'center',
  241. background: '#363749',
  242. color: '#FFF',
  243. padding: '0.2rem',
  244. borderRadius: '5px',
  245. boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
  246. };
  247. super(document.createElement('div'), { ...defaultStyles, ...styles });
  248. }
  249. append(...components) {
  250. components.forEach((component) => super.append(component));
  251. }
  252. }
  253. class InputComponent extends StyledComponent {
  254. constructor(styles = {}) {
  255. const defaultStyles = {
  256. background: 'transparent',
  257. border: 'none',
  258. width: '100%',
  259. outline: 'none',
  260. color: TEXT_COLOR,
  261. fontSize: '15px',
  262. };
  263. super(document.createElement('input'), { ...defaultStyles, ...styles });
  264. }
  265. setEnabled(value) {
  266. this.element.disabled = !value;
  267. }
  268. }
  269. class InputText extends InputComponent {
  270. constructor(styles = {}) {
  271. super(styles);
  272. this.element.type = 'text';
  273. }
  274. get value() {
  275. return this.element.value;
  276. }
  277. setPlaceholder(text) {
  278. this.element.placeholder = text;
  279. }
  280. setOnInputListener(callback) {
  281. this.addEventListener('input', callback);
  282. }
  283. setValue(value) {
  284. this.element.value = value;
  285. }
  286. setOnInputListener(callback) {
  287. this.addEventListener('input', callback);
  288. }
  289. }
  290. class InputPassword extends InputText {
  291. constructor(styles = {}) {
  292. super(styles);
  293. this.element.type = 'password';
  294. }
  295. setShowing(value) {
  296. this.element.type = !value ? 'password' : 'text';
  297. }
  298. get isShowing() { return this.element.type != 'password' }
  299. }
  300. class SvgComponent extends StyledComponent {
  301. constructor(styles = {}, ...paths) {
  302. const defaultStyles = {
  303. fill: '#FFFFFF',
  304. padding: '5px',
  305. width: '2.2rem',
  306. height: '2.2rem',
  307. };
  308. super(document.createElementNS('http://www.w3.org/2000/svg', 'svg'), {
  309. ...defaultStyles,
  310. ...styles,
  311. });
  312. this.applyOptions();
  313. paths.forEach((p) => this.addPath(p));
  314. }
  315. applyOptions() {
  316. this.setFill(this.styles.fill || 'currentColor');
  317. this.setWidth(this.styles.width || '16');
  318. this.setHeight(this.styles.height || '16');
  319. this.setViewBox(this.styles.viewBox || '0 0 16 16');
  320. this.setXmlns(this.styles.xmlns || 'http://www.w3.org/2000/svg');
  321. }
  322. setFill(color) {
  323. this.element.setAttribute('fill', color);
  324. }
  325. setWidth(width) {
  326. this.element.setAttribute('width', width);
  327. }
  328. setHeight(height) {
  329. this.element.setAttribute('height', height);
  330. }
  331. setViewBox(viewBox) {
  332. this.element.setAttribute('viewBox', viewBox);
  333. }
  334. setXmlns(xmlns) {
  335. this.element.setAttribute('xmlns', xmlns);
  336. }
  337. addPath(...path) {
  338. path.forEach((item) => {
  339. const pathElement = document.createElementNS(
  340. 'http://www.w3.org/2000/svg',
  341. 'path'
  342. );
  343. pathElement.setAttribute('d', item);
  344. this.element.appendChild(pathElement);
  345. });
  346. }
  347. }
  348. class Spinner extends StyledComponent {
  349. constructor() {
  350. super(document.createElement('div'), {
  351. display: 'flex',
  352. width: '100%',
  353. alignItems: 'center',
  354. justifyContent: 'center',
  355. padding: '20px'
  356. });
  357. this.createSpinnerElements();
  358. }
  359. createSpinnerElements() {
  360. const spinnerElement = new StyledComponent(document.createElement('div'));
  361. spinnerElement.setStyles({
  362. borderTop: '4px solid transparent',
  363. borderRight: '4px solid #ccc',
  364. borderBottom: '4px solid #ccc',
  365. borderLeft: '4px solid #ccc',
  366. borderRadius: '50%',
  367. width: '45px',
  368. height: '45px',
  369. animation: 'spin 1s linear infinite',
  370. });
  371. this.append(spinnerElement)
  372. }
  373. }
  374. class IconComponent extends SvgComponent {
  375. constructor(styles = {}, ...iconPath) {
  376. super({
  377. cursor: 'pointer',
  378. background: TOOLS_BUTTON_BACKGROUND_COLOR,
  379. borderRadius: '20%',
  380. height: '45px',
  381. width: '45px',
  382. padding: '10px',
  383. boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
  384. fill: ICON_COLOR,
  385. ...styles,
  386. },
  387. ...iconPath,
  388. );
  389. }
  390. }
  391. class CalanderIconComponent extends IconComponent {
  392. constructor(styles = {}) {
  393. super(styles,
  394. 'M10.854 7.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 9.793l2.646-2.647a.5.5 0 0 1 .708 0z',
  395. 'M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4z'
  396. );
  397. }
  398. }
  399. class LoggerIconComponent extends IconComponent {
  400. constructor(styles = {}) {
  401. super(styles,
  402. 'M5 4a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm-.5 2.5A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zM5 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z',
  403. 'M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z'
  404. )
  405. }
  406. }
  407. class ArrowRepeatIconComponent extends IconComponent {
  408. constructor(styles = {}) {
  409. super(styles,
  410. 'M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z',
  411. 'M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z'
  412. );
  413. }
  414. }
  415. class MoreIconComponent extends IconComponent {
  416. constructor(styles = {}) {
  417. super(styles,
  418. 'M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z'
  419. );
  420. }
  421. }
  422. class BatteryIconComponent extends SvgComponent {
  423. constructor(styles = {}) {
  424. super(styles,
  425. 'M2 6h10v4H2V6z', 'M2 4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H2zm10 1a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h10zm4 3a1.5 1.5 0 0 1-1.5 1.5v-3A1.5 1.5 0 0 1 16 8z'
  426. );
  427. }
  428. }
  429. class HeadsetIconComponent extends SvgComponent {
  430. constructor(styles = {}) {
  431. super(styles,
  432. 'M8 1a5 5 0 0 0-5 5v1h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a6 6 0 1 1 12 0v6a2.5 2.5 0 0 1-2.5 2.5H9.366a1 1 0 0 1-.866.5h-1a1 1 0 1 1 0-2h1a1 1 0 0 1 .866.5H11.5A1.5 1.5 0 0 0 13 12h-1a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h1V6a5 5 0 0 0-5-5z'
  433. );
  434. }
  435. }
  436. class RenovarIconComponent extends SvgComponent {
  437. constructor(styles = {}) {
  438. super(styles,
  439. 'M11 15a4 4 0 1 0 0-8 4 4 0 0 0 0 8m5-4a5 5 0 1 1-10 0 5 5 0 0 1 10 0',
  440. 'M9.438 11.944c.047.596.518 1.06 1.363 1.116v.44h.375v-.443c.875-.061 1.386-.529 1.386-1.207 0-.618-.39-.936-1.09-1.1l-.296-.07v-1.2c.376.043.614.248.671.532h.658c-.047-.575-.54-1.024-1.329-1.073V8.5h-.375v.45c-.747.073-1.255.522-1.255 1.158 0 .562.378.92 1.007 1.066l.248.061v1.272c-.384-.058-.639-.27-.696-.563h-.668zm1.36-1.354c-.369-.085-.569-.26-.569-.522 0-.294.216-.514.572-.578v1.1h-.003zm.432.746c.449.104.655.272.655.569 0 .339-.257.571-.709.614v-1.195l.054.012z',
  441. 'M1 0a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h4.083c.058-.344.145-.678.258-1H3a2 2 0 0 0-2-2V3a2 2 0 0 0 2-2h10a2 2 0 0 0 2 2v3.528c.38.34.717.728 1 1.154V1a1 1 0 0 0-1-1z',
  442. 'M9.998 5.083 10 5a2 2 0 1 0-3.132 1.65 5.982 5.982 0 0 1 3.13-1.567z'
  443. );
  444. }
  445. }
  446. class testeIconComponent extends SvgComponent {
  447. constructor(styles = {}) {
  448. super(styles,
  449. 'M2.5 15a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1 0-1h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1zm2-13v1c0 .537.12 1.045.337 1.5h6.326c.216-.455.337-.963.337-1.5V2zm3 6.35c0 .701-.478 1.236-1.011 1.492A3.5 3.5 0 0 0 4.5 13s.866-1.299 3-1.48zm1 0v3.17c2.134.181 3 1.48 3 1.48a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351z'
  450. );
  451. }
  452. }
  453. class Mp3IconComponent extends SvgComponent {
  454. constructor(styles = {}) {
  455. super(styles,
  456. 'M6 13c0 1.105-1.12 2-2.5 2S1 14.105 1 13c0-1.104 1.12-2 2.5-2s2.5.896 2.5 2m9-2c0 1.105-1.12 2-2.5 2s-2.5-.895-2.5-2 1.12-2 2.5-2 2.5.895 2.5 2',
  457. 'M14 11V2h1v9zM6 3v10H5V3z',
  458. 'M5 2.905a1 1 0 0 1 .9-.995l8-.8a1 1 0 0 1 1.1.995V3L5 4z',
  459. );
  460. }
  461. }
  462. class TrashIconComponent extends SvgComponent {
  463. constructor(styles = {}) {
  464. super(styles,
  465. 'M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z',
  466. 'M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z'
  467. );
  468. }
  469. }
  470. class ReceptionIconComponent extends SvgComponent {
  471. constructor(styles = {}) {
  472. super(styles,
  473. 'M0 11.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-2zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-5zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-8zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-11z'
  474. );
  475. }
  476. }
  477. class InfoIconComponent extends SvgComponent {
  478. constructor(styles = {}) {
  479. super(styles,
  480. 'M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 0 1 1.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.007 2.007 0 0 1-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.007 2.007 0 0 1-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31.4 31.4 0 0 1 0 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.007 2.007 0 0 1 1.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A99.788 99.788 0 0 1 7.858 2h.193zM6.4 5.209v4.818l4.157-2.408L6.4 5.209z'
  481. );
  482. }
  483. }
  484. class ArrowDownIconComponent extends SvgComponent {
  485. constructor(style = {}) {
  486. super({
  487. fill: ICON_COLOR,
  488. ...style,
  489. },
  490. 'M1 3.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5zM8 6a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 .708-.708L7.5 12.293V6.5A.5.5 0 0 1 8 6z'
  491. );
  492. }
  493. }
  494. class NetworkIconComponent extends SvgComponent {
  495. constructor(style = {}) {
  496. super({
  497. fill: ICON_COLOR,
  498. ...style,
  499. },
  500. 'M4.5 5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zM3 4.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0z',
  501. 'M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v1a2 2 0 0 1-2 2H8.5v3a1.5 1.5 0 0 1 1.5 1.5h5.5a.5.5 0 0 1 0 1H10A1.5 1.5 0 0 1 8.5 14h-1A1.5 1.5 0 0 1 6 12.5H.5a.5.5 0 0 1 0-1H6A1.5 1.5 0 0 1 7.5 10V7H2a2 2 0 0 1-2-2V4zm1 0v1a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1zm6 7.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5z'
  502. );
  503. }
  504. }
  505. class RouterIconComponent extends SvgComponent {
  506. constructor(style = {}) {
  507. super({
  508. fill: ICON_COLOR,
  509. ...style,
  510. },
  511. 'M5.525 3.025a3.5 3.5 0 0 1 4.95 0 .5.5 0 1 0 .707-.707 4.5 4.5 0 0 0-6.364 0 .5.5 0 0 0 .707.707Z',
  512. 'M6.94 4.44a1.5 1.5 0 0 1 2.12 0 .5.5 0 0 0 .708-.708 2.5 2.5 0 0 0-3.536 0 .5.5 0 0 0 .707.707ZM2.5 11a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1Zm4.5-.5a.5.5 0 1 0 1 0 .5.5 0 0 0-1 0Zm2.5.5a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1Zm1.5-.5a.5.5 0 1 0 1 0 .5.5 0 0 0-1 0Zm2 0a.5.5 0 1 0 1 0 .5.5 0 0 0-1 0Z',
  513. 'M2.974 2.342a.5.5 0 1 0-.948.316L3.806 8H1.5A1.5 1.5 0 0 0 0 9.5v2A1.5 1.5 0 0 0 1.5 13H2a.5.5 0 0 0 .5.5h2A.5.5 0 0 0 5 13h6a.5.5 0 0 0 .5.5h2a.5.5 0 0 0 .5-.5h.5a1.5 1.5 0 0 0 1.5-1.5v-2A1.5 1.5 0 0 0 14.5 8h-2.306l1.78-5.342a.5.5 0 1 0-.948-.316L11.14 8H4.86L2.974 2.342ZM14.5 9a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-2a.5.5 0 0 1 .5-.5h13Z',
  514. 'M8.5 5.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0Z'
  515. );
  516. }
  517. }
  518. class PersonIconComponent extends SvgComponent {
  519. constructor(style = {}) {
  520. super({
  521. fill: ICON_COLOR,
  522. ...style,
  523. },
  524. 'M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z'
  525. );
  526. }
  527. }
  528. class LockIconComponent extends SvgComponent {
  529. constructor(style = {}) {
  530. super({
  531. fill: ICON_COLOR,
  532. ...style,
  533. },
  534. 'M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z'
  535. );
  536. }
  537. }
  538. class EyeIconComponent extends SvgComponent {
  539. constructor(style = {}) {
  540. super({
  541. fill: ICON_COLOR,
  542. ...style,
  543. },
  544. 'M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z',
  545. 'M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z',
  546. );
  547. }
  548. }
  549. class ArrowDownShortIconComponent extends SvgComponent {
  550. constructor(style = {}) {
  551. super({
  552. fill: ICON_COLOR,
  553. ...style,
  554. },
  555. 'M8 4a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L7.5 10.293V4.5A.5.5 0 0 1 8 4z'
  556. );
  557. }
  558. }
  559. class ArrowUpShortIconComponent extends SvgComponent {
  560. constructor(style = {}) {
  561. super({
  562. fill: ICON_COLOR,
  563. ...style,
  564. },
  565. 'M8 12a.5.5 0 0 0 .5-.5V5.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 5.707V11.5a.5.5 0 0 0 .5.5z'
  566. );
  567. }
  568. }
  569. ////////////NOVOS////////
  570. class FilmesIconComponent extends SvgComponent {
  571. constructor(styles = {}) {
  572. super(styles,
  573. 'M13.218 4.246L7.087 6.238a.502.502 0 0 1-.24.079L4.741 7H13.5a.5.5 0 0 1 .5.5v5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-5c0-.106.033-.205.09-.287l-.195-.602A2.5 2.5 0 0 1 3.5 3.461l6.657-2.163a2.5 2.5 0 0 1 3.15 1.605l.232.713a.5.5 0 0 1-.321.63Zm-3.744.165l1.285-2.226a1.508 1.508 0 0 0-.293.064l-1.245.404l-1.308 2.265l1.56-.507Zm2.295-1.979a.515.515 0 0 1-.02.037l-.854 1.48l1.538-.5l-.077-.237a1.494 1.494 0 0 0-.587-.78Zm-3.97.683l-1.56.507L4.93 5.887l1.56-.507L7.8 3.115ZM2.923 6.54l.587-.19l1.307-2.266l-1.008.328a1.5 1.5 0 0 0-.963 1.89l.077.238Z'
  574. );
  575. }
  576. }
  577. class TicketPerforatedIconComponent extends SvgComponent {
  578. constructor(styles = {}) {
  579. super(styles,
  580. 'M4 4.85v.9h1v-.9zm7 0v.9h1v-.9zm-7 1.8v.9h1v-.9zm7 0v.9h1v-.9zm-7 1.8v.9h1v-.9zm7 0v.9h1v-.9zm-7 1.8v.9h1v-.9zm7 0v.9h1v-.9z',
  581. 'M1.5 3A1.5 1.5 0 0 0 0 4.5V6a.5.5 0 0 0 .5.5 1.5 1.5 0 1 1 0 3 .5.5 0 0 0-.5.5v1.5A1.5 1.5 0 0 0 1.5 13h13a1.5 1.5 0 0 0 1.5-1.5V10a.5.5 0 0 0-.5-.5 1.5 1.5 0 0 1 0-3A.5.5 0 0 0 16 6V4.5A1.5 1.5 0 0 0 14.5 3zM1 4.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 .5.5v1.05a2.5 2.5 0 0 0 0 4.9v1.05a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-1.05a2.5 2.5 0 0 0 0-4.9z'
  582. );
  583. }
  584. }
  585. class RobotIconComponent extends SvgComponent {
  586. constructor(styles = {}) {
  587. super(styles,
  588. 'M6 12.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5M3 8.062C3 6.76 4.235 5.765 5.53 5.886a26.6 26.6 0 0 0 4.94 0C11.765 5.765 13 6.76 13 8.062v1.157a.93.93 0 0 1-.765.935c-.845.147-2.34.346-4.235.346s-3.39-.2-4.235-.346A.93.93 0 0 1 3 9.219zm4.542-.827a.25.25 0 0 0-.217.068l-.92.9a25 25 0 0 1-1.871-.183.25.25 0 0 0-.068.495c.55.076 1.232.149 2.02.193a.25.25 0 0 0 .189-.071l.754-.736.847 1.71a.25.25 0 0 0 .404.062l.932-.97a25 25 0 0 0 1.922-.188.25.25 0 0 0-.068-.495c-.538.074-1.207.145-1.98.189a.25.25 0 0 0-.166.076l-.754.785-.842-1.7a.25.25 0 0 0-.182-.135',
  589. 'M8.5 1.866a1 1 0 1 0-1 0V3h-2A4.5 4.5 0 0 0 1 7.5V8a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1v1a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1v-.5A4.5 4.5 0 0 0 10.5 3h-2zM14 7.5V13a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7.5A3.5 3.5 0 0 1 5.5 4h5A3.5 3.5 0 0 1 14 7.5'
  590. );
  591. }
  592. }
  593. class GptIconComponent extends SvgComponent {
  594. constructor(styles = {}) {
  595. super(styles,
  596. 'M6 13c0 1.105-1.12 2-2.5 2S1 14.105 1 13c0-1.104 1.12-2 2.5-2s2.5.896 2.5 2',
  597. 'M9 11c0 1.105-1.12 2-2.5 2S4 12.105 4 11c0-1.104 1.12-2 2.5-2s2.5.896 2.5 2',
  598. 'M14 11V2h1v9zM6 3v10H5V3',
  599. 'M5 2.905a1 1 0 0 1 .9-.9');
  600. }
  601. }
  602. class Gpt2IconComponent extends SvgComponent {
  603. constructor(styles = {}) {
  604. super(styles,
  605. 'M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z'
  606. );
  607. }
  608. }
  609. class JogosIconComponent extends SvgComponent {
  610. constructor(styles = {}) {
  611. super(styles,
  612. 'M11.5 6.027a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0m-1.5 1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1m2.5-.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0m-1.5 1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1m-6.5-3h1v1h1v1h-1v1h-1v-1h-1v-1h1z',
  613. 'M3.051 3.26a.5.5 0 0 1 .354-.613l1.932-.518a.5.5 0 0 1 .62.39c.655-.079 1.35-.117 2.043-.117.72 0 1.443.041 2.12.126a.5.5 0 0 1 .622-.399l1.932.518a.5.5 0 0 1 .306.729q.211.136.373.297c.408.408.78 1.05 1.095 1.772.32.733.599 1.591.805 2.466s.34 1.78.364 2.606c.024.816-.059 1.602-.328 2.21a1.42 1.42 0 0 1-1.445.83c-.636-.067-1.115-.394-1.513-.773-.245-.232-.496-.526-.739-.808-.126-.148-.25-.292-.368-.423-.728-.804-1.597-1.527-3.224-1.527s-2.496.723-3.224 1.527c-.119.131-.242.275-.368.423-.243.282-.494.575-.739.808-.398.38-.877.706-1.513.773a1.42 1.42 0 0 1-1.445-.83c-.27-.608-.352-1.395-.329-2.21.024-.826.16-1.73.365-2.606.206-.875.486-1.733.805-2.466.315-.722.687-1.364 1.094-1.772a2.3 2.3 0 0 1 .433-.335l-.028-.079zm2.036.412c-.877.185-1.469.443-1.733.708-.276.276-.587.783-.885 1.465a14 14 0 0 0-.748 2.295 12.4 12.4 0 0 0-.339 2.406c-.022.755.062 1.368.243 1.776a.42.42 0 0 0 .426.24c.327-.034.61-.199.929-.502.212-.202.4-.423.615-.674.133-.156.276-.323.44-.504C4.861 9.969 5.978 9.027 8 9.027s3.139.942 3.965 1.855c.164.181.307.348.44.504.214.251.403.472.615.674.318.303.601.468.929.503a.42.42 0 0 0 .426-.241c.18-.408.265-1.02.243-1.776a12.4 12.4 0 0 0-.339-2.406 14 14 0 0 0-.748-2.295c-.298-.682-.61-1.19-.885-1.465-.264-.265-.856-.523-1.733-.708-.85-.179-1.877-.27-2.913-.27s-2.063.091-2.913.27'
  614. );
  615. }
  616. }
  617. class TvIconComponent extends SvgComponent {
  618. constructor(styles = {}) {
  619. super(styles,
  620. 'M2.5 13.5A.5.5 0 0 1 3 13h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5M13.991 3l.024.001a1.5 1.5 0 0 1 .538.143.76.76 0 0 1 .302.254c.067.1.145.277.145.602v5.991l-.001.024a1.5 1.5 0 0 1-.143.538.76.76 0 0 1-.254.302c-.1.067-.277.145-.602.145H2.009l-.024-.001a1.5 1.5 0 0 1-.538-.143.76.76 0 0 1-.302-.254C1.078 10.502 1 10.325 1 10V4.009l.001-.024a1.5 1.5 0 0 1 .143-.538.76.76 0 0 1 .254-.302C1.498 3.078 1.675 3 2 3zM14 2H2C0 2 0 4 0 4v6c0 2 2 2 2 2h12c2 0 2-2 2-2V4c0-2-2-2-2-2'
  621. );
  622. }
  623. }
  624. class MenuIconComponent extends SvgComponent {
  625. constructor(styles = {}) {
  626. super(styles,
  627. 'M2 10h3a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1m9-9h3a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1m0 9a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1zm0-10a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zM2 9a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2zm7 2a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2zM0 2a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm5.354.854a.5.5 0 1 0-.708-.708L3 3.793l-.646-.647a.5.5 0 1 0-.708.708l1 1a.5.5 0 0 0 .708 0z'
  628. );
  629. }
  630. }
  631. class AjudaIconComponent extends SvgComponent {
  632. constructor(styles = {}) {
  633. super(styles,
  634. 'M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10s10-4.486 10-10S17.514 2 12 2zm1 16h-2v-2h2v2zm.976-4.885c-.196.158-.385.309-.535.459c-.408.407-.44.777-.441.793v.133h-2v-.167c0-.118.029-1.177 1.026-2.174c.195-.195.437-.393.691-.599c.734-.595 1.216-1.029 1.216-1.627a1.934 1.934 0 0 0-3.867.001h-2C8.066 7.765 9.831 6 12 6s3.934 1.765 3.934 3.934c0 1.597-1.179 2.55-1.958 3.181z'
  635. );
  636. }
  637. }
  638. class Menu2IconComponent extends SvgComponent {
  639. constructor(styles = {}) {
  640. super(styles,
  641. 'M18 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2Zm0 24H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V30a2 2 0 0 0-2-2ZM42 4H30a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2Z',
  642. 'M28 28h16m-8 8h8m-16 8h16'
  643. );
  644. }
  645. }
  646. class PowerIconComponent extends SvgComponent {
  647. constructor(style = {}) {
  648. super({
  649. cursor: 'pointer',
  650. height: '8.5rem',
  651. width: '8.5rem',
  652. background: VPN_BUTTON_BACKGROUND_COLOR,
  653. borderRadius: '100%',
  654. boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
  655. padding: '20px',
  656. animation: 'pulse 2.5s infinite',
  657. fill: ICON_COLOR,
  658. ...style,
  659. },
  660. 'M7.5 1v7h1V1h-1z',
  661. 'M3 8.812a4.999 4.999 0 0 1 2.578-4.375l-.485-.874A6 6 0 1 0 11 3.616l-.501.865A5 5 0 1 1 3 8.812z',
  662. );
  663. }
  664. }
  665. class DialogComponent extends StyledComponent {
  666. constructor(styles = {}) {
  667. super(document.createElement('div'), {
  668. position: 'absolute',
  669. top: '0',
  670. bottom: '0',
  671. left: '0',
  672. right: '0',
  673. height: '100vh',
  674. background: 'rgba(0, 0, 0, 0.5)',
  675. backdropFilter: 'blur(5px)',
  676. display: 'flex',
  677. alignItems: 'center',
  678. justifyContent: 'center',
  679. visibility: 'hidden',
  680. opacity: '0',
  681. ...styles,
  682. });
  683. this.element.addEventListener('click', (event) => {
  684. if (event.target === this.element) {
  685. this.close();
  686. }
  687. });
  688. this.onCloseEvent = null
  689. }
  690. setOnCloseEventListener(callback) {
  691. this.onCloseEvent = callback
  692. }
  693. setContent(content) {
  694. if (!(content instanceof DialogContentComponent)) {
  695. throw new TypeError('Content must be a DialogContentComponent');
  696. }
  697. if (!this.contains(content)) {
  698. this.append(content);
  699. }
  700. }
  701. show() {
  702. this.setStyles({
  703. opacity: '1',
  704. visibility: 'visible',
  705. display: 'flex',
  706. animation: 'fade-in 0.3s forwards',
  707. pointerEvents: 'auto',
  708. })
  709. if (!document.body.contains(this.element)) {
  710. document.body.append(this.element);
  711. }
  712. }
  713. close() {
  714. this.setStyles({
  715. opacity: '0',
  716. animation: 'fade-out 0.3s forwards',
  717. })
  718. setTimeout(() => {
  719. this.setStyles({
  720. display: 'none',
  721. pointerEvents: 'none',
  722. })
  723. if (this.onCloseEvent != null) {
  724. this.onCloseEvent()
  725. }
  726. }, 300);
  727. }
  728. remove() {
  729. if (document.body.contains(this.element)) {
  730. this.element.remove();
  731. }
  732. }
  733. }
  734. class DialogContentComponent extends StyledComponent {
  735. constructor(styles = {}) {
  736. super(document.createElement('div'), {
  737. display: 'flex',
  738. flexDirection: 'column',
  739. justifyContent: 'center',
  740. alignItems: 'center',
  741. background: DIALOG_CONTENT_BACKGROUND_COLOR,
  742. borderRadius: '5px',
  743. maxWidth: '30rem',
  744. width: '85%',
  745. ...styles,
  746. });
  747. this.lastHeader = null;
  748. this.lastBody = null;
  749. this.lastFooter = null;
  750. }
  751. setHeader(component) {
  752. this?.lastHeader?.remove()
  753. this.lastHeader = component
  754. this.append(component);
  755. }
  756. setBody(component) {
  757. this?.lastBody?.remove()
  758. this.lastBody = component
  759. this.append(component);
  760. }
  761. setFooter(component) {
  762. this?.lastFooter?.remove()
  763. this.lastFooter = component
  764. this.append(component);
  765. }
  766. }
  767. class DialogHeaderComponent extends StyledComponent {
  768. constructor(styles = {}) {
  769. super(document.createElement('div'), {
  770. display: 'flex',
  771. justifyContent: 'space-between',
  772. alignItems: 'center',
  773. width: '100%',
  774. padding: '5px',
  775. ...styles,
  776. });
  777. this.title = new StyledComponent(document.createElement('span'), {
  778. fontSize: '16px',
  779. color: DIALOG_HEADER_TITLE_COLOR,
  780. fontFamily: 'sans-serif',
  781. fontWeight: 'bold',
  782. padding: '5px',
  783. });
  784. this.closeButton = new SvgComponent({
  785. cursor: 'pointer',
  786. height: '35px',
  787. width: '35px',
  788. fill: DIALOG_HEADER_CLOSE_BUTTON_COLOR,
  789. },
  790. 'M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z'
  791. );
  792. this.initialize();
  793. }
  794. setTitleText(title) {
  795. this.title.element.innerText = title;
  796. }
  797. setCloseButtonClickListener(callback) {
  798. this.closeButton.addEventListener('click', callback);
  799. }
  800. initialize() {
  801. this.append(this.title);
  802. this.append(this.closeButton);
  803. }
  804. }
  805. class DialogBodyComponent extends StyledComponent {
  806. constructor(styles = {}) {
  807. super(document.createElement('div'), {
  808. display: 'flex',
  809. width: '100%',
  810. padding: '5px',
  811. ...styles,
  812. });
  813. }
  814. }
  815. class DialogFooterComponent extends StyledComponent {
  816. constructor(styles = {}) {
  817. super(document.createElement('div'), {
  818. display: 'flex',
  819. justifyContent: 'space-between',
  820. gap: '5px',
  821. alignItems: 'center',
  822. width: '100%',
  823. padding: '5px',
  824. ...styles,
  825. });
  826. }
  827. addButton(button) {
  828. if (!(button instanceof DialogFooterButtonComponent)) {
  829. throw new TypeError('Button must be a DialogFooterButtonComponent instance');
  830. }
  831. this.append(button);
  832. return this;
  833. }
  834. }
  835. class DialogFooterButtonComponent extends StyledComponent {
  836. constructor(text, onclick, styles = {}) {
  837. super(document.createElement('button'), {
  838. fontSize: '14px',
  839. fontWeight: 'bold',
  840. color: DIALOG_FOOTER_BUTTON_TEXT_COLOR,
  841. background: DIALOG_FOOTER_BUTTON_COLOR,
  842. border: 'none',
  843. borderRadius: '3px',
  844. padding: '10px',
  845. width: '100%',
  846. cursor: 'pointer',
  847. boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
  848. ...styles,
  849. });
  850. this.setText(text)
  851. this.setClickListener(onclick);
  852. }
  853. setText(text) {
  854. this.element.innerText = text;
  855. }
  856. setClickListener(callback) {
  857. this.addEventListener('click', callback);
  858. }
  859. }
  860. class DialogBuilder {
  861. constructor(styles = {}) {
  862. this.dialog = new DialogComponent(styles);
  863. this.header = new DialogHeaderComponent();
  864. this.content = new DialogContentComponent();
  865. this.footer = new DialogFooterComponent();
  866. this.footerButtons = [];
  867. this.content.setHeader(this.header);
  868. this.header.setCloseButtonClickListener(() => this.dialog.close());
  869. }
  870. static create(styles = {}) {
  871. return new DialogBuilder(styles);
  872. }
  873. setTitle(title) {
  874. this.header.setTitleText(title);
  875. return this;
  876. }
  877. setAutoRemove(autoRemove) {
  878. this.dialog.setOnCloseEventListener(() => {
  879. if (autoRemove) {
  880. this.dialog.remove();
  881. }
  882. });
  883. return this;
  884. }
  885. setBody(bodyComponent) {
  886. this.content.setBody(bodyComponent);
  887. return this;
  888. }
  889. addFooterButton(text, callback) {
  890. const button = new DialogFooterButtonComponent(text, callback);
  891. this.footerButtons.push(button);
  892. return this;
  893. }
  894. show() {
  895. this.dialog.setContent(this.content);
  896. if (this.footerButtons.length > 0) {
  897. this.content.setFooter(this.footer);
  898. this.footerButtons.forEach((button) => {
  899. this.footer.addButton(button);
  900. });
  901. }
  902. this.dialog.show();
  903. return this;
  904. }
  905. close() {
  906. this.dialog.close();
  907. }
  908. }
  909. class ConfigComponent extends StyledComponent {
  910. constructor(styles = {}) {
  911. super(document.createElement('div'), {
  912. display: 'flex',
  913. gap: '5px',
  914. alignItems: 'center',
  915. textAlign: 'left',
  916. marginTop: '5px',
  917. padding: '5px',
  918. background: 'rgba(255, 255, 255, 0.1)',
  919. width: '100%',
  920. borderRadius: '5px',
  921. ...styles
  922. });
  923. this.image = document.createElement('img');
  924. this.name = document.createElement('span');
  925. this.description = document.createElement('span');
  926. this.mode = document.createElement('span');
  927. this.initialize();
  928. }
  929. setImage(url) {
  930. this.image.src = url;
  931. }
  932. setName(name) {
  933. this.name.innerHTML = name;
  934. }
  935. setDescription(description) {
  936. this.description.innerHTML = description;
  937. }
  938. setMode(mode) {
  939. this.mode.innerHTML = mode;
  940. }
  941. initialize() {
  942. this.setImageStyles();
  943. this.setNameStyles();
  944. this.setDescriptionStyles();
  945. this.setModeStyles();
  946. const startArea = this.createStartArea();
  947. const endArea = this.createEndArea();
  948. this.appendElements(startArea, endArea);
  949. }
  950. setImageStyles() {
  951. this.image.style.width = '40px';
  952. this.image.style.height = '40px';
  953. }
  954. setNameStyles() {
  955. this.name.style.fontSize = '12px';
  956. this.name.style.fontFamily = 'sans-serif';
  957. this.name.style.color = '#FFFFFF';
  958. this.name.style.fontWeight = 'bold';
  959. }
  960. setDescriptionStyles() {
  961. this.description.style.fontSize = '10px';
  962. this.description.style.fontFamily = 'sans-serif';
  963. this.description.style.color = '#FFFFFF';
  964. this.description.style.fontWeight = 'bold';
  965. this.description.style.fontStyle = 'italic';
  966. }
  967. setModeStyles() {
  968. this.mode.style.fontSize = '10px';
  969. this.mode.style.fontFamily = 'sans-serif';
  970. this.mode.style.color = '#FFFFFF';
  971. this.mode.style.fontWeight = 'bold';
  972. this.mode.style.fontStyle = 'italic';
  973. this.mode.style.whiteSpace = 'nowrap';
  974. }
  975. createStartArea() {
  976. const startArea = document.createElement('div');
  977. startArea.style.display = 'flex';
  978. startArea.style.width = '100%';
  979. startArea.style.gap = '10px';
  980. startArea.style.flexDirection = 'column';
  981. startArea.appendChild(this.name);
  982. startArea.appendChild(this.description);
  983. return startArea;
  984. }
  985. createEndArea() {
  986. const endArea = document.createElement('div');
  987. endArea.style.display = 'flex';
  988. endArea.style.flexDirection = 'column';
  989. endArea.style.alignItems = 'end';
  990. endArea.style.alignSelf = 'end';
  991. endArea.style.width = '50%';
  992. endArea.appendChild(this.mode);
  993. return endArea;
  994. }
  995. appendElements(startArea, endArea) {
  996. this.appendChild(this.image);
  997. this.appendChild(startArea);
  998. this.appendChild(endArea);
  999. }
  1000. }
  1001. class CategoryComponent extends StyledComponent {
  1002. constructor(styles = {}, items = []) {
  1003. super(document.createElement('div'), {
  1004. display: 'flex',
  1005. justifyContent: 'center',
  1006. alignItems: 'center',
  1007. flexDirection: 'column',
  1008. textAlign: 'center',
  1009. padding: '2px',
  1010. width: '100%',
  1011. ...styles
  1012. });
  1013. this.items = items;
  1014. this.name = document.createElement('span');
  1015. this.setNameStyles();
  1016. this.initialize();
  1017. this.setItems(items);
  1018. }
  1019. setNameStyles() {
  1020. this.name.style.width = '100%';
  1021. this.name.style.borderRadius = '5px';
  1022. this.name.style.fontSize = '12px';
  1023. this.name.style.fontFamily = 'sans-serif';
  1024. this.name.style.color = '#FFFFFF';
  1025. this.name.style.background = 'rgba(255, 255, 255, 0.1)';
  1026. this.name.style.padding = '5px';
  1027. this.name.style.fontWeight = 'bold';
  1028. }
  1029. setName(value) {
  1030. this.name.innerHTML = value;
  1031. }
  1032. setItems(items) {
  1033. items.forEach(item => this.append(item));
  1034. }
  1035. initialize() {
  1036. this.appendChild(this.name);
  1037. }
  1038. }
  1039. class ConfigBodyComponent extends DialogBodyComponent {
  1040. constructor(items) {
  1041. super({
  1042. flexDirection: 'column',
  1043. gap: '5px',
  1044. maxHeight: '65vh',
  1045. overflowY: 'auto'
  1046. });
  1047. items.forEach(item => this.append(item));
  1048. }
  1049. }
  1050. class LoggerItemComponent extends StyledComponent {
  1051. constructor(styles = {}, message) {
  1052. super(document.createElement('span'), {
  1053. fontFamily: 'monospace',
  1054. width: '100%',
  1055. fontSize: '12px',
  1056. color: LOGGER_TEXT_COLOR,
  1057. ...styles,
  1058. });
  1059. this.element.innerHTML = message
  1060. }
  1061. }
  1062. class LoggerBodyComponent extends DialogBodyComponent {
  1063. constructor(styles = {}, items = []) {
  1064. super({
  1065. flexDirection: 'column',
  1066. maxHeight: '65vh',
  1067. overflowY: 'auto',
  1068. width: '100%',
  1069. ...styles,
  1070. });
  1071. this.setItems(items);
  1072. }
  1073. setItems(items) {
  1074. this.element.innerHTML = '';
  1075. items.forEach(item => this.append(item));
  1076. this.scrollDown();
  1077. }
  1078. scrollDown() {
  1079. this.element.scrollTop = this.element.scrollHeight;
  1080. }
  1081. }
  1082. class CheckUserBodyComponent extends DialogBodyComponent {
  1083. constructor(data = {}) {
  1084. super();
  1085. // Container principal
  1086. const mainContainer = new StyledComponent(document.createElement('div'), {
  1087. display: 'flex',
  1088. flexDirection: 'column',
  1089. height: '300px',
  1090. });
  1091. // Container do texto com rolagem
  1092. const textContainer = new StyledComponent(document.createElement('div'), {
  1093. display: 'flex',
  1094. flexDirection: 'column',
  1095. color: TEXT_COLOR,
  1096. fontFamily: 'sans-serif',
  1097. gap: '10px',
  1098. textAlign: 'center',
  1099. width: '100%',
  1100. padding: '10px',
  1101. maxHeight: '270px',
  1102. overflowY: 'auto',
  1103. });
  1104. textContainer.element.innerHTML =
  1105. `<b><span style="color: red">Informações básicas sobre o seu plano.</span></b>
  1106. <span></span>
  1107. <span style="color: ${CHECKUSER_TEXT_COLOR}">Seu plano vence no dia <b><span style="color: #4dff00">${data.expiration_date}</span></b> você ainda tem <b><span style="color: #4dff00">${data.expiration_days}</span></b> Dia(s) de acesso, seu limite máximo é de <b><span style="color: #4dff00">${data.limit_connections}</span></b> usuário(s) conectado(s), limite em uso: <b><span style="color: #4dff00">${data.count_connections}</span></b> de <b><span style="color: #4dff00">${data.limit_connections}</span></span></b>
  1108. <span></span>
  1109. <span>⚠️Se seu limite for excedido seu acesso será suspenso, caso isso aconteça você deverá entrar em contato com o adm para resolver.</span>
  1110. <span></span>
  1111. <span>Fique atento à validade do seu plano e renove sempre antes de vencer para evitar a interrupção do serviço, você pode renovar seu acesso clicando no botão abaixo ou clicando no ícone de <b>ferramentas.</b></span>
  1112. <span></span>
  1113. <span>Use seu usuário e senha vpn para entrar no painel</span>`;
  1114. const buttonContainer = new StyledComponent(document.createElement('div'), {
  1115. width: '100%',
  1116. textAlign: 'center',
  1117. marginTop: '10px',
  1118. paddingBottom: '1px'
  1119. });
  1120. // Botão "Renovar Acesso" com caixa
  1121. const renovarButtonContainer = new StyledComponent(document.createElement('div'), {
  1122. display: 'block',
  1123. width: '100%',
  1124. padding: '12px 0',
  1125. backgroundColor: '#36374959',
  1126. borderRadius: '5px'
  1127. });
  1128. const renovarButton = new StyledComponent(document.createElement('a'), {
  1129. style: {
  1130. display: 'flex',
  1131. alignItems: 'center',
  1132. justifyContent: 'center',
  1133. width: '100%',
  1134. height: '45px',
  1135. backgroundColor: '#4dff00',
  1136. color: 'white',
  1137. textDecoration: 'none',
  1138. borderRadius: '5px',
  1139. cursor: 'pointer',
  1140. transition: 'opacity 0.5s ease-in-out',
  1141. }
  1142. });
  1143. // Cria o elemento SVG
  1144. const svgIcon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  1145. svgIcon.setAttribute('fill', '#4dff00');
  1146. svgIcon.setAttribute('class', 'bi bi-arrow-repeat');
  1147. svgIcon.setAttribute('viewBox', '0 0 16 16');
  1148. // Adicione os paths do SVG aqui dentro do svgIcon
  1149. svgIcon.innerHTML = `
  1150. <path d="M11 15a4 4 0 1 0 0-8 4 4 0 0 0 0 8m5-4a5 5 0 1 1-10 0 5 5 0 0 1 10 0"></path>
  1151. <path d="M9.438 11.944c.047.596.518 1.06 1.363 1.116v.44h.375v-.443c.875-.061 1.386-.529 1.386-1.207 0-.618-.39-.936-1.09-1.1l-.296-.07v-1.2c.376.043.614.248.671.532h.658c-.047-.575-.54-1.024-1.329-1.073V8.5h-.375v.45c-.747.073-1.255.522-1.255 1.158 0 .562.378.92 1.007 1.066l.248.061v1.272c-.384-.058-.639-.27-.696-.563h-.668zm1.36-1.354c-.369-.085-.569-.26-.569-.522 0-.294.216-.514.572-.578v1.1h-.003zm.432.746c.449.104.655.272.655.569 0 .339-.257.571-.709.614v-1.195l.054.012z"></path>
  1152. <path d="M1 0a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h4.083c.058-.344.145-.678.258-1H3a2 2 0 0 0-2-2V3a2 2 0 0 0 2-2h10a2 2 0 0 0 2 2v3.528c.38.34.717.728 1 1.154V1a1 1 0 0 0-1-1z"></path>
  1153. <path d="M9.998 5.083 10 5a2 2 0 1 0-3.132 1.65 5.982 5.982 0 0 1 3.13-1.567z"></path>
  1154. `;
  1155. // Cria um span para o texto com a cor desejada
  1156. const textSpan = document.createElement('span');
  1157. textSpan.style.color = '#4dff00';
  1158. textSpan.style.fontWeight = 'bold'; // Adiciona negrito
  1159. textSpan.textContent = "RENOVAR ACESSO";
  1160. // Adiciona o SVG e o span do texto ao botão
  1161. renovarButton.element.appendChild(svgIcon);
  1162. renovarButton.element.appendChild(textSpan);
  1163. renovarButton.element.onclick = () => {
  1164. window?.DtStartWebViewActivity?.execute('https://laranjo.gestorssh.com.br/index.php');
  1165. };
  1166. renovarButton.element.classList.add('blink');
  1167. // Adiciona o botão ao container
  1168. renovarButtonContainer.append(renovarButton);
  1169. buttonContainer.append(renovarButtonContainer);
  1170. mainContainer.append(textContainer);
  1171. mainContainer.append(buttonContainer);
  1172. this.append(mainContainer);
  1173. }
  1174. }
  1175. // CSS
  1176. const style = document.createElement('style');
  1177. style.innerHTML = `
  1178. .blink {
  1179. animation: blinker 1.9s linear infinite;
  1180. }
  1181. @keyframes blinker {
  1182. 0%, 100% {
  1183. opacity: 1;
  1184. }
  1185. 50% {
  1186. opacity: 0.5;
  1187. }
  1188. }
  1189. /* Estilos para o SVG */
  1190. .bi-arrow-repeat {
  1191. width: 20px; /* Ajuste o tamanho aqui */
  1192. height: 20px; /* Ajuste o tamanho aqui */
  1193. margin-right: 10px; /* Ajuste o espaçamento aqui */
  1194. /* Propriedades para controlar a elevação */
  1195. position: relative; /* Permite o uso de top/bottom */
  1196. top: 6px; /* Ajuste a posição vertical aqui */
  1197. }
  1198. `;
  1199. document.head.appendChild(style);
  1200. class VpnStateComponent extends StyledComponent {
  1201. constructor(style = {}) {
  1202. super(document.createElement('span'), {
  1203. fontSize: '1.5rem',
  1204. fontFamily: 'sans-serif',
  1205. fontWeight: 'bold',
  1206. color: '#FFF',
  1207. marginTop: '2rem',
  1208. ...style,
  1209. })
  1210. this.setState('DISCONNECTED')
  1211. }
  1212. setState(state) {
  1213. this.element.innerHTML = state
  1214. }
  1215. }
  1216. class LocalIPComponent extends StyledComponent {
  1217. constructor(styles = {}) {
  1218. super(document.createElement('span'), {
  1219. position: 'absolute',
  1220. fontSize: '1rem',
  1221. fontFamily: 'Helvetica',
  1222. fontWeight: 'bold',
  1223. whiteSpace: 'nowrap',
  1224. color: TEXT_COLOR,
  1225. top: `${window?.DtGetStatusBarHeight?.execute() ?? '30'}px`,
  1226. left: '10px',
  1227. ...styles,
  1228. })
  1229. this.setIP(window?.DtGetLocalIP?.execute() ?? '127.0.0.1')
  1230. setInterval(() => {
  1231. this.setIP(window?.DtGetLocalIP?.execute() ?? '127.0.0.1')
  1232. }, 1000)
  1233. }
  1234. setIP(ip) {
  1235. this.element.innerHTML = `IP: ${ip}`
  1236. }
  1237. }
  1238. class NetworkStatsComponent extends StyledComponent {
  1239. constructor(styles = {}) {
  1240. super(document.createElement('div'), {
  1241. display: 'flex',
  1242. position: 'absolute',
  1243. gap: '5px',
  1244. top: `${(window?.DtGetStatusBarHeight?.execute() ?? 30) + 20}px`,
  1245. left: '-5px',
  1246. ...styles,
  1247. });
  1248. this.meterDownContainer = this.createMeterContainer();
  1249. this.meterDownText = this.createMeterText();
  1250. this.arrowDownShortIcon = new ArrowDownShortIconComponent();
  1251. this.meterDownContainer.append(this.arrowDownShortIcon);
  1252. this.meterDownContainer.append(this.meterDownText);
  1253. this.meterUpContainer = this.createMeterContainer();
  1254. this.meterUpText = this.createMeterText();
  1255. this.arrowUpShortIcon = new ArrowUpShortIconComponent();
  1256. this.meterUpContainer.append(this.arrowUpShortIcon);
  1257. this.meterUpContainer.append(this.meterUpText);
  1258. this.append(this.meterDownContainer);
  1259. this.append(this.meterUpContainer);
  1260. this.getNetworkDownloadFn = () => window?.DtGetNetworkDownloadBytes?.execute() ?? 0;
  1261. this.getNetworkUploadFn = () => window?.DtGetNetworkUploadBytes?.execute() ?? 0;
  1262. this.currentNetworkDownload = parseFloat(localStorage.getItem('networkDownload') ?? this.getNetworkDownloadFn());
  1263. this.currentNetworkUpload = parseFloat(localStorage.getItem('networkUpload') ?? this.getNetworkUploadFn());
  1264. localStorage.setItem('networkDownload', this.currentNetworkDownload);
  1265. localStorage.setItem('networkUpload', this.currentNetworkUpload);
  1266. this.showMeter();
  1267. setInterval(() => this.showMeter(), 1000);
  1268. }
  1269. createMeterContainer() {
  1270. return new StyledComponent(document.createElement('div'), {
  1271. display: 'flex',
  1272. alignItems: 'center',
  1273. });
  1274. }
  1275. createMeterText() {
  1276. return new StyledComponent(document.createElement('span'), {
  1277. fontSize: '1rem',
  1278. marginLeft: '-5px',
  1279. fontFamily: 'Helvetica',
  1280. fontWeight: 'bold',
  1281. whiteSpace: 'nowrap',
  1282. color: '#fff',
  1283. });
  1284. }
  1285. formatBytes(bytes) {
  1286. const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
  1287. if (bytes === 0) return '0 B';
  1288. const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
  1289. return (bytes / Math.pow(1024, i)).toPrecision(3) + ' ' + sizes[i];
  1290. }
  1291. showMeter() {
  1292. const newNetworkDownload = this.getNetworkDownloadFn();
  1293. const newNetworkUpload = this.getNetworkUploadFn();
  1294. this.meterDownText.element.innerHTML = this.formatBytes(newNetworkDownload - this.currentNetworkDownload);
  1295. this.meterUpText.element.innerHTML = this.formatBytes(newNetworkUpload - this.currentNetworkUpload);
  1296. }
  1297. }
  1298. class PingComponent extends StyledComponent {
  1299. constructor(styles = {}) {
  1300. super(document.createElement('span'), {
  1301. position: 'absolute',
  1302. fontSize: '1rem',
  1303. fontFamily: 'Helvetica',
  1304. fontWeight: 'bold',
  1305. whiteSpace: 'nowrap',
  1306. top: `${window?.DtGetStatusBarHeight?.execute() ?? '30'}px`,
  1307. right: '10px',
  1308. ...styles,
  1309. });
  1310. this.startPing();
  1311. }
  1312. async startPing() {
  1313. this.setPing(await this.ping());
  1314. setInterval(async () => this.setPing(await this.ping()), 1000);
  1315. }
  1316. setPing(ping) {
  1317. this.element.textContent = `PING: ${ping}ms`;
  1318. const pingValue = parseInt(ping, 10);
  1319. const color = this.getColorFromPing(pingValue);
  1320. this.setStyles({ color });
  1321. }
  1322. getColorFromPing(ping) {
  1323. const pingValue = parseInt(ping, 10);
  1324. const color = pingValue >= 0 && pingValue <= 50 ? '#00ff00' :
  1325. pingValue > 50 && pingValue <= 100 ? '#ffff00' :
  1326. '#ff0000';
  1327. return color;
  1328. }
  1329. async ping() {
  1330. const startTime = new Date().getTime();
  1331. const url = `https://cdn-icons-png.flaticon.com/512/7517/7517373.png?${startTime}`
  1332. try {
  1333. const data = await fetch(url)
  1334. return new Date().getTime() - startTime;
  1335. } catch (err) {
  1336. console.log(err);
  1337. return -1;
  1338. }
  1339. }
  1340. }
  1341. class IframeBodyComponent extends DialogBodyComponent {
  1342. constructor(styles = {}, url = null) {
  1343. super({
  1344. minHeight: '600px',
  1345. ...styles
  1346. })
  1347. this.iframeElement = new StyledComponent(document.createElement('iframe'), {
  1348. width: '100%',
  1349. border: 'none',
  1350. borderRadius: '5px',
  1351. display: 'none',
  1352. })
  1353. this.spinner = new Spinner()
  1354. this.iframeElement.addEventListener('load', () => {
  1355. this.iframeElement.setStyles({ display: 'block' })
  1356. this.spinner.setStyles({ display: 'none' })
  1357. })
  1358. this.setUrl(url)
  1359. this.applyOptions()
  1360. this.append(this.iframeElement)
  1361. this.append(this.spinner)
  1362. }
  1363. setUrl(url) {
  1364. this.iframeElement.element.src = url
  1365. }
  1366. setOnLoadListener(callback) {
  1367. this.iframeElement.addEventListener('load', callback)
  1368. }
  1369. applyOptions() {
  1370. this.iframeElement.element.setAttribute('allow', 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share')
  1371. this.iframeElement.element.setAttribute('allowfullscreen', '')
  1372. this.iframeElement.element.setAttribute('frameborder', '0')
  1373. }
  1374. }
  1375. class CleanAppMessageBodyComponent extends DialogBodyComponent {
  1376. constructor(styles = {}, url = null) {
  1377. super({
  1378. height: 'auto',
  1379. ...styles
  1380. })
  1381. this.spanComponent = new StyledComponent(document.createElement('span'), {
  1382. fontSize: '16px',
  1383. fontFamily: 'Helvetica',
  1384. fontWeight: 'bold',
  1385. color: TEXT_COLOR,
  1386. })
  1387. this.spanComponent.element.innerHTML = 'Você gostaria de limpar os dados do aplicativo? Por favor, esteja ciente de que essa ação resultará na remoção permanente de todas as informações armazenadas. Você tem certeza de que deseja prosseguir com essa operação?'
  1388. this.append(this.spanComponent)
  1389. }
  1390. }
  1391. class AssistirTvMessageBodyComponent extends DialogBodyComponent {
  1392. constructor(styles = {}, url = null) {
  1393. super({
  1394. height: 'auto',
  1395. ...styles
  1396. })
  1397. this.spanComponent = new StyledComponent(document.createElement('span'), {
  1398. fontSize: '16px',
  1399. fontFamily: 'Helvetica',
  1400. fontWeight: 'bold',
  1401. color: TEXT_COLOR,
  1402. })
  1403. this.spanComponent.element.innerHTML = 'Você será redirecionado(a) a um site de tv grátis com vários canais abertos e fechados, porém vai ter alguns anúncios, deseja continuar?'
  1404. this.append(this.spanComponent)
  1405. }
  1406. }
  1407. class AssistirFilmesMessageBodyComponent extends DialogBodyComponent {
  1408. constructor(styles = {}, url = null) {
  1409. super({
  1410. height: 'auto',
  1411. ...styles
  1412. })
  1413. this.spanComponent = new StyledComponent(document.createElement('span'), {
  1414. fontSize: '16px',
  1415. fontFamily: 'Helvetica',
  1416. fontWeight: 'bold',
  1417. color: TEXT_COLOR,
  1418. })
  1419. this.spanComponent.element.innerHTML = 'Você será redirecionado(a) a um site de filmes e séries grátis, porém vai ter alguns anúncios, deseja continuar?'
  1420. this.append(this.spanComponent)
  1421. }
  1422. }
  1423. class JogosMessageBodyComponent extends DialogBodyComponent {
  1424. constructor(styles = {}, url = null) {
  1425. super({
  1426. height: 'auto',
  1427. ...styles
  1428. })
  1429. this.spanComponent = new StyledComponent(document.createElement('span'), {
  1430. fontSize: '16px',
  1431. fontFamily: 'Helvetica',
  1432. fontWeight: 'bold',
  1433. color: TEXT_COLOR,
  1434. })
  1435. this.spanComponent.element.innerHTML = 'Você será redirecionado(a) a um site com varios jogos para navegadores para que você possa está se divertindo em seu tempo livre, deseja continuar?'
  1436. this.append(this.spanComponent)
  1437. }
  1438. }
  1439. class GPTMessageBodyComponent extends DialogBodyComponent {
  1440. constructor(styles = {}, url = null) {
  1441. super({
  1442. height: 'auto',
  1443. ...styles
  1444. })
  1445. this.spanComponent = new StyledComponent(document.createElement('span'), {
  1446. fontSize: '16px',
  1447. fontFamily: 'Helvetica',
  1448. fontWeight: 'bold',
  1449. color: TEXT_COLOR,
  1450. })
  1451. this.spanComponent.element.innerHTML = 'Você será redirecionado(a) a um site com o chat GPT, você poderá usar para estidos e etc, o aite é totalmente grátis e por isso vai ter alguns anúncios, deseja continuar?'
  1452. this.append(this.spanComponent)
  1453. }
  1454. }
  1455. class StyledButtonComponent extends StyledComponent {
  1456. constructor(text, icon, onclick, styles = {}) {
  1457. super(document.createElement('button'), {
  1458. width: '100%',
  1459. borderRadius: '5px',
  1460. padding: '10px',
  1461. border: 'none',
  1462. color: TEXT_COLOR,
  1463. background: BUTTON_BACKGROUND_COLOR,
  1464. boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
  1465. cursor: 'pointer',
  1466. display: 'flex',
  1467. alignItems: 'center',
  1468. ...styles
  1469. });
  1470. this.textComponent = new StyledComponent(document.createElement('span'), {
  1471. fontSize: '16px',
  1472. fontWeight: 'bold',
  1473. });
  1474. this.textComponent.element.innerHTML = text;
  1475. this.element.addEventListener('click', onclick)
  1476. this.append(icon ?? '')
  1477. this.append(this.textComponent);
  1478. }
  1479. }
  1480. class ApnSettingStyledButtonComponent extends StyledButtonComponent {
  1481. constructor() {
  1482. super(
  1483. 'APN',
  1484. new ReceptionIconComponent(),
  1485. () => window?.DtStartApnActivity?.execute()
  1486. )
  1487. }
  1488. }
  1489. class TermsStyledButtonComponent extends StyledButtonComponent {
  1490. constructor() {
  1491. super(
  1492. 'TUTORIAL',
  1493. new InfoIconComponent(),
  1494. () => window?.DtStartWebViewActivity?.execute(TERMS_URL)
  1495. )
  1496. }
  1497. }
  1498. class BatteryStyledButtonComponent extends StyledButtonComponent {
  1499. constructor() {
  1500. super(
  1501. 'BATERIA',
  1502. new BatteryIconComponent(),
  1503. () => window?.DtIgnoreBatteryOptimizations?.execute(),
  1504. )
  1505. }
  1506. }
  1507. class SupportStyledButtonComponent extends StyledButtonComponent {
  1508. constructor() {
  1509. super(
  1510. 'SUPORTE',
  1511. new HeadsetIconComponent(),
  1512. () => window?.DtStartWebViewActivity?.execute(LINK_SUPPORT)
  1513. );
  1514. }
  1515. }
  1516. class SpeedTestStyledButtonComponent extends StyledButtonComponent {
  1517. constructor() {
  1518. super(
  1519. 'RENOVAR',
  1520. new RenovarIconComponent(),
  1521. () => window?.DtStartWebViewActivity?.execute(URL_RENOVAR)
  1522. )
  1523. }
  1524. }
  1525. class testeStyledButtonComponent extends StyledButtonComponent {
  1526. static dialog = DialogBuilder.create({ zIndex: 1 })
  1527. .setTitle('GERAR TESTE')
  1528. .setBody(new IframeBodyComponent({}, URL_TESTE))
  1529. constructor() {
  1530. super(
  1531. 'GERAR TESTE',
  1532. new testeIconComponent(),
  1533. () => this.dialog.show(),
  1534. )
  1535. }
  1536. get dialog() {
  1537. return testeStyledButtonComponent.dialog;
  1538. }
  1539. }
  1540. class Mp3StyledButtonComponent extends StyledButtonComponent {
  1541. constructor() {
  1542. super(
  1543. 'MÚSICA$',
  1544. new Mp3IconComponent(),
  1545. () => window?.DtStartWebViewActivity?.execute(URL_MP3)
  1546. )
  1547. }
  1548. }
  1549. class filmesOnlineStyledButtonComponent extends StyledButtonComponent {
  1550. constructor() {
  1551. super(
  1552. 'BOTAO TESTE 1',
  1553. new Mp3IconComponent(),
  1554. () => window?.DtStartWebViewActivity?.execute(URL_FILMES)
  1555. )
  1556. }
  1557. }
  1558. class TVOnlineStyledButtonComponent extends StyledButtonComponent {
  1559. constructor() {
  1560. super(
  1561. 'BOTAO TESTE 2',
  1562. new Mp3IconComponent(),
  1563. () => window?.DtStartWebViewActivity?.execute(URL_TV)
  1564. )
  1565. }
  1566. }
  1567. class OpenAiStyledButtonComponent extends StyledButtonComponent {
  1568. constructor() {
  1569. super(
  1570. 'BOTAO TESTE 3',
  1571. new Mp3IconComponent(),
  1572. () => window?.DtStartWebViewActivity?.execute(URL_GPT)
  1573. )
  1574. }
  1575. }
  1576. class JogosStyledButtonComponent extends StyledButtonComponent {
  1577. constructor() {
  1578. super(
  1579. 'BOTAO TESTE 4',
  1580. new Mp3IconComponent(),
  1581. () => window?.DtStartWebViewActivity?.execute(URL_JOGOS)
  1582. )
  1583. }
  1584. }
  1585. class CleanAppStyledButtonComponent extends StyledButtonComponent {
  1586. constructor() {
  1587. super(
  1588. 'RESETAR APP',
  1589. new TrashIconComponent(),
  1590. () => {
  1591. const dialog = DialogBuilder.create()
  1592. .setTitle('LIMPAR DADOS')
  1593. .setAutoRemove(true)
  1594. .setBody(new CleanAppMessageBodyComponent())
  1595. .addFooterButton('NÃO', () => dialog.close())
  1596. .addFooterButton('SIM', () => window?.DtCleanApp?.execute())
  1597. .show();
  1598. })
  1599. }
  1600. }
  1601. class MsgTVStyledButtonComponent extends StyledButtonComponent {
  1602. constructor() {
  1603. super(
  1604. 'TV',
  1605. new TvIconComponent(),
  1606. () => {
  1607. const dialog = DialogBuilder.create()
  1608. .setTitle('ASSISTA TV GRÁTIS')
  1609. .setAutoRemove(true)
  1610. .setBody(new AssistirTvMessageBodyComponent())
  1611. .addFooterButton('SAIR', () => dialog.close())
  1612. .addFooterButton('CONTINUAR', () => {
  1613. window?.DtStartWebViewActivity?.execute(URL_TV);
  1614. })
  1615. .show();
  1616. });
  1617. }
  1618. }
  1619. class MsgFILMESStyledButtonComponent extends StyledButtonComponent {
  1620. constructor() {
  1621. super(
  1622. 'FILMES',
  1623. new FilmesIconComponent(),
  1624. () => {
  1625. const dialog = DialogBuilder.create()
  1626. .setTitle('ASSISTA FILMES GRÁTIS')
  1627. .setAutoRemove(true)
  1628. .setBody(new AssistirFilmesMessageBodyComponent())
  1629. .addFooterButton('SAIR', () => dialog.close())
  1630. .addFooterButton('CONTINUAR', () => {
  1631. window?.DtStartWebViewActivity?.execute(URL_FILMES);
  1632. })
  1633. .show();
  1634. });
  1635. }
  1636. }
  1637. class MsgJOGOSStyledButtonComponent extends StyledButtonComponent {
  1638. constructor() {
  1639. super(
  1640. 'JOGOS',
  1641. new JogosIconComponent(),
  1642. () => {
  1643. const dialog = DialogBuilder.create()
  1644. .setTitle('JOGOS PARA PASSAR O TEMPO')
  1645. .setAutoRemove(true)
  1646. .setBody(new JogosMessageBodyComponent())
  1647. .addFooterButton('SAIR', () => dialog.close())
  1648. .addFooterButton('CONTINUAR', () => {
  1649. window?.DtStartWebViewActivity?.execute(URL_JOGOS);
  1650. })
  1651. .show();
  1652. });
  1653. }
  1654. }
  1655. class MsgGPTStyledButtonComponent extends StyledButtonComponent {
  1656. constructor() {
  1657. super(
  1658. 'GPT',
  1659. new RobotIconComponent(),
  1660. () => {
  1661. const dialog = DialogBuilder.create()
  1662. .setTitle('CHAT GPT GRÁTIS')
  1663. .setAutoRemove(true)
  1664. .setBody(new GPTMessageBodyComponent())
  1665. .addFooterButton('SAIR', () => dialog.close())
  1666. .addFooterButton('CONTINUAR', () => {
  1667. window?.DtStartWebViewActivity?.execute(URL_GPT);
  1668. })
  1669. .show();
  1670. });
  1671. }
  1672. }
  1673. class HotSpotStyledButtonComponent extends StyledButtonComponent {
  1674. constructor() {
  1675. super(
  1676. 'ROTEAR VPN',
  1677. new RouterIconComponent(),
  1678. () => this.toggleHotSpot())
  1679. this.setStyles({ display: 'flex', justifyContent: 'center' });
  1680. }
  1681. startHotSpot() {
  1682. window?.DtStartHotSpotService?.execute();
  1683. Toast.success('Proxy iniciado!')
  1684. }
  1685. stopHotSpot() {
  1686. window?.DtStopHotSpotService?.execute();
  1687. Toast.success('Proxy parado!')
  1688. }
  1689. toggleHotSpot() {
  1690. const hotSpotStatus = window?.DtGetStatusHotSpotService?.execute() ?? 'STOPPED';
  1691. hotSpotStatus == 'RUNNING' ? this.stopHotSpot() : this.startHotSpot();
  1692. }
  1693. }
  1694. class MenuDialogBodyComponent extends DialogBodyComponent {
  1695. constructor() {
  1696. super({
  1697. display: 'flex',
  1698. flexDirection: 'column',
  1699. gap: '5px'
  1700. })
  1701. }
  1702. addRowButtons(...buttons) {
  1703. const element = new StyledComponent(document.createElement('div'), {
  1704. display: 'flex',
  1705. gap: '5px',
  1706. width: '100%'
  1707. });
  1708. buttons.forEach(button => element.append(button));
  1709. this.append(element);
  1710. return this;
  1711. }
  1712. }
  1713. class ConfigInputComponent extends InputGroupComponent {
  1714. constructor() {
  1715. super({ cursor: 'pointer', background: INPUT_COLOR });
  1716. this.configInput = new InputText({ cursor: 'pointer', fontFamily: 'roboto' });
  1717. this.configInput.setEnabled(false);
  1718. this.configInput.setPlaceholder('SELECIONE UM SERVIDOR');
  1719. this.configInput.setValue(JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{}').name ?? '');
  1720. this.append(new NetworkIconComponent(), this.configInput, new ArrowDownIconComponent());
  1721. this.configure()
  1722. this.addEventListener('click', () => {
  1723. const mock = '[{"sorter":6,"color":"#6D08041C","name":"CONFIG","id":1393,"items":[{"mode":"V2RAY - VLESS","sorter":4,"tlsVersion":"TLSv1.2","name":"CONFIG 01","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":11803,"status":"ACTIVE"},{"mode":"SSH_DIRECT","sorter":2,"tlsVersion":"TLSv1.2","name":"CONFIG 02","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":28627,"status":"ACTIVE"},{"mode":"OVPN_PROXY","sorter":23,"tlsVersion":"TLSv1.2","name":"CONFIG 03","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":30001,"status":"ACTIVE"}]},{"sorter":2,"color":"#6D08041C","name":"CONFIG 2","id":1846,"items":[{"mode":"SSH_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG 01","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":26295,"status":"ACTIVE"}]},{"sorter":4,"color":"#80000000","name":"CONFIG 3","id":3310,"items":[{"mode":"SSH_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG. TEST","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":29997,"status":"ACTIVE"},{"mode":"OVPN_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG. TEST 2","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":29998,"status":"ACTIVE"}]}]';
  1724. const items = JSON.parse(window?.DtGetConfigs?.execute() || mock);
  1725. items.sort((a, b) => a.sorter - b.sorter);
  1726. items.forEach((item) => item.items.sort((a, b) => a.sorter - b.sorter));
  1727. const dialog = DialogBuilder.create()
  1728. .setTitle('CONEXÕES')
  1729. .setAutoRemove(true)
  1730. .setBody(
  1731. new ConfigBodyComponent(
  1732. items.map((item) => {
  1733. const category = new CategoryComponent();
  1734. category.setName(item.name);
  1735. category.setItems(
  1736. item.items.map((item) => {
  1737. const config = new ConfigComponent();
  1738. config.setName(item.name);
  1739. config.setDescription(item.description ?? '');
  1740. config.setMode(item.mode);
  1741. config.setImage(item.icon);
  1742. config.addEventListener('click', () => {
  1743. window?.DtSetConfig?.execute(item.id);
  1744. dialog.close();
  1745. });
  1746. return config;
  1747. })
  1748. );
  1749. return category;
  1750. })
  1751. )
  1752. )
  1753. .show();
  1754. });
  1755. const originalClickListener = window.dtConfigClickListener;
  1756. window.dtConfigClickListener = () => {
  1757. if (originalClickListener) {
  1758. originalClickListener();
  1759. }
  1760. this.configure();
  1761. };
  1762. this.configure();
  1763. }
  1764. configure() {
  1765. const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{"auth":{"password": ""}, "mode": "v2ra"}')
  1766. this.configInput.setValue(config.name ?? '')
  1767. }
  1768. }
  1769. class UserPassInputComponent extends StyledComponent {
  1770. constructor() {
  1771. super(document.createElement('div'), {
  1772. display: 'flex',
  1773. marginTop: '5px',
  1774. width: '100%',
  1775. display: 'flex',
  1776. gap: '5px',
  1777. });
  1778. this.usernameGroupComponent = new InputGroupComponent({ background: INPUT_COLOR });
  1779. const personIconComponent = new PersonIconComponent();
  1780. this.usernameInput = new InputText();
  1781. this.usernameInput.setPlaceholder('Nome de usuário');
  1782. this.usernameInput.setValue(window?.DtUsername?.get() ?? '');
  1783. this.usernameInput.setOnInputListener(() => window?.DtUsername?.set(this.usernameInput.value));
  1784. this.usernameGroupComponent.append(personIconComponent, this.usernameInput);
  1785. this.append(this.usernameGroupComponent);
  1786. this.passwordGroupComponent = new InputGroupComponent({ background: INPUT_COLOR });
  1787. this.passwordInput = new InputPassword();
  1788. const eyeIconComponent = new EyeIconComponent();
  1789. eyeIconComponent.addEventListener('click', () => this.passwordInput.setShowing(!this.passwordInput.isShowing));
  1790. this.passwordInput.setPlaceholder('Senha');
  1791. this.passwordInput.setValue(window?.DtPassword?.get() ?? '');
  1792. this.passwordInput.setOnInputListener(() => { window?.DtPassword?.set(this.passwordInput.value) });
  1793. this.passwordGroupComponent.append(new LockIconComponent(), this.passwordInput, eyeIconComponent);
  1794. this.append(this.passwordGroupComponent);
  1795. this.v2rayUuidGroupComponent = new InputGroupComponent({ background: INPUT_COLOR });
  1796. this.v2rayUuidInput = new InputPassword();
  1797. this.v2rayUuidInput.setPlaceholder('V2Ray UUID');
  1798. this.v2rayUuidInput.setValue(window?.DtUuid?.get() ?? '');
  1799. this.v2rayUuidInput.setOnInputListener(() => window?.DtUuid?.set(this.v2rayUuidInput.value));
  1800. this.v2rayUuidGroupComponent.append(new LockIconComponent(), this.v2rayUuidInput);
  1801. this.append(this.v2rayUuidGroupComponent);
  1802. const originalClickListener = window.dtConfigClickListener;
  1803. window.dtConfigClickListener = () => {
  1804. if (originalClickListener) {
  1805. originalClickListener();
  1806. }
  1807. this.configure();
  1808. };
  1809. this.configure();
  1810. }
  1811. configure() {
  1812. const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{"auth":{"password": ""}, "mode": "v2ra"}')
  1813. const isV2ray = config?.mode?.toLowerCase()?.startsWith('v2ray');
  1814. this.usernameGroupComponent.setStyles({
  1815. display: isV2ray || config?.auth?.username ? 'none' : 'flex',
  1816. })
  1817. this.passwordGroupComponent.setStyles({
  1818. display: isV2ray || config?.auth?.password ? 'none' : 'flex',
  1819. })
  1820. this.v2rayUuidGroupComponent.setStyles({
  1821. display: !isV2ray || config?.auth?.v2ray_uuid ? 'none' : 'flex',
  1822. })
  1823. const isRunning = (window?.DtGetVpnState?.execute() ?? 'DISCONNECTED') != 'DISCONNECTED';
  1824. this.usernameInput.setEnabled(!isRunning)
  1825. this.passwordInput.setEnabled(!isRunning)
  1826. this.v2rayUuidInput.setEnabled(!isRunning)
  1827. }
  1828. }
  1829. class ButtonAndStateContainerComponent extends StyledComponent {
  1830. constructor(styles = {}) {
  1831. super(document.createElement('div'), {
  1832. display: 'flex',
  1833. flexDirection: 'column',
  1834. alignItems: 'center',
  1835. justifyContent: 'center',
  1836. width: '100%',
  1837. ...styles,
  1838. });
  1839. this.startOrStopButtonComponent = new PowerIconComponent();
  1840. this.startOrStopButtonComponent.addEventListener('click', () => {
  1841. if (window?.DtGetVpnState?.execute() !== 'DISCONNECTED') {
  1842. window?.DtExecuteVpnStop?.execute();
  1843. } else {
  1844. window?.DtExecuteVpnStart?.execute();
  1845. }
  1846. });
  1847. this.append(this.startOrStopButtonComponent);
  1848. this.vpnStateComponent = new VpnStateComponent();
  1849. this.append(this.vpnStateComponent);
  1850. window.dtVpnStateListener = state => this.configureState(state);
  1851. this.configureState(window?.DtGetVpnState?.execute() ?? 'DISCONNECTED');
  1852. }
  1853. configureState(state) {
  1854. const isRunning = state != 'DISCONNECTED';
  1855. this.vpnStateComponent.setState((window?.DtTranslateText?.execute('LBL_STATE_' + state) ?? 'UNKNOWN').toUpperCase())
  1856. if (state == 'DISCONNECTED') {
  1857. this.vpnStateComponent.setStyles({ color: VPN_STOPPED_COLOR })
  1858. this.startOrStopButtonComponent.setStyles({ fill: VPN_STOPPED_COLOR })
  1859. }
  1860. if (state != 'DISCONNECTED' && state != 'CONNECTED') {
  1861. this.vpnStateComponent.setStyles({ color: VPN_STARTING_COLOR })
  1862. this.startOrStopButtonComponent.setStyles({ fill: VPN_STARTING_COLOR })
  1863. }
  1864. if (state == 'CONNECTED') {
  1865. this.vpnStateComponent.setStyles({ color: VPN_RUNNING_COLOR })
  1866. this.startOrStopButtonComponent.setStyles({ fill: VPN_RUNNING_COLOR })
  1867. }
  1868. }
  1869. }
  1870. class CardToolsComponent extends CardComponent {
  1871. constructor() {
  1872. super({
  1873. margin: '20px 0',
  1874. width: '100%',
  1875. flexDirection: 'row',
  1876. justifyContent: 'space-between',
  1877. background: 'transparent',
  1878. boxShadow: 'none',
  1879. });
  1880. this.loggerBody = new LoggerBodyComponent({});
  1881. this.addArrowRepeatIcon();
  1882. this.addLoggerIcon();
  1883. this.addCalanderIcon();
  1884. this.addMoreButton();
  1885. window.dtOnNewLogListener = () => this.renderizeLogger();
  1886. this.renderizeLogger();
  1887. }
  1888. addCalanderIcon() {
  1889. const calanderIconComponent = new CalanderIconComponent();
  1890. calanderIconComponent.addEventListener('click', () =>
  1891. window?.DtStartCheckUser?.execute()
  1892. );
  1893. this.append(calanderIconComponent);
  1894. }
  1895. addLoggerIcon() {
  1896. const loggerIconComponent = new LoggerIconComponent();
  1897. loggerIconComponent.addEventListener('click', () => {
  1898. const loggerDialog = DialogBuilder.create()
  1899. .setTitle('REGISTRO')
  1900. .setBody(this.loggerBody)
  1901. .setAutoRemove(true)
  1902. .addFooterButton('LIMPAR', () => window?.DtClearLogs?.execute())
  1903. .addFooterButton('FECHAR', () => loggerDialog.close())
  1904. .show();
  1905. this.loggerBody.scrollDown();
  1906. });
  1907. this.append(loggerIconComponent);
  1908. }
  1909. addArrowRepeatIcon() {
  1910. const arrowRepeatIconComponent = new ArrowRepeatIconComponent();
  1911. arrowRepeatIconComponent.addEventListener('click', () =>
  1912. window?.DtStartAppUpdate?.execute()
  1913. );
  1914. this.append(arrowRepeatIconComponent);
  1915. }
  1916. addMoreButton() {
  1917. const moreButton = new MoreIconComponent();
  1918. moreButton.addEventListener('click', () => {
  1919. DialogBuilder.create()
  1920. .setTitle('FERRAMENTAS')
  1921. .setAutoRemove(true)
  1922. .setBody(
  1923. new MenuDialogBodyComponent()
  1924. .addRowButtons(
  1925. new ApnSettingStyledButtonComponent(),
  1926. new BatteryStyledButtonComponent(),
  1927. )
  1928. .addRowButtons(
  1929. new SpeedTestStyledButtonComponent(),
  1930. new testeStyledButtonComponent(),
  1931. )
  1932. .addRowButtons(
  1933. new TermsStyledButtonComponent(),
  1934. new Mp3StyledButtonComponent(),
  1935. )
  1936. .addRowButtons(
  1937. new CleanAppStyledButtonComponent(),
  1938. new SupportStyledButtonComponent(),
  1939. )
  1940. .addRowButtons(
  1941. new MsgJOGOSStyledButtonComponent(),
  1942. new MsgGPTStyledButtonComponent(),
  1943. )
  1944. .addRowButtons(
  1945. new MsgTVStyledButtonComponent(),
  1946. new MsgFILMESStyledButtonComponent(),
  1947. )
  1948. .addRowButtons(
  1949. new HotSpotStyledButtonComponent(),
  1950. )
  1951. )
  1952. .show();
  1953. });
  1954. this.append(moreButton);
  1955. }
  1956. renderizeLogger() {
  1957. const mock = Array.from({ length: 300 }, (_, i) => ({ TIME: `MESSAGE ${i}` }));
  1958. const data = JSON.parse(window?.DtGetLogs?.execute() ?? JSON.stringify(mock))
  1959. const items = data.map(log => {
  1960. const message = Object.keys(log)[0] + ' ' + log[Object.keys(log)]
  1961. return new LoggerItemComponent({}, message)
  1962. })
  1963. this.loggerBody.setItems(items)
  1964. }
  1965. }
  1966. class CheckUserDialog {
  1967. constructor() {
  1968. this.dialog = DialogBuilder.create()
  1969. .setAutoRemove(true)
  1970. .setTitle('CHECKUSER')
  1971. .setBody(new Spinner());
  1972. }
  1973. initialize() {
  1974. window.dtCheckUserStartedListener = () => this.checkUserStartedListener();
  1975. window.dtCheckUserModelListener = model => this.checkUserModelListener(model);
  1976. }
  1977. checkUserStartedListener() {
  1978. const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{}');
  1979. if (!config.url_check_user) return;
  1980. this.dialog.show();
  1981. }
  1982. checkUserModelListener(model) {
  1983. const data = JSON.parse(model ?? '{"username": "test"}');
  1984. const now = new Date();
  1985. const hour = now.getUTCHours();
  1986. let greeting;
  1987. if (hour >= 5 && hour < 12) {
  1988. greeting = Math.random() < 0.5 ? 'bom dia' : 'bom dia, hoje está um belo dia';
  1989. } else if (hour >= 12 && hour < 18) {
  1990. greeting = Math.random() < 0.5 ? 'boa tarde' : 'boa tarde, como está se sentindo?';
  1991. } else {
  1992. greeting = Math.random() < 0.5 ? 'boa noite' : 'boa noite, a noite hoje está linda!';
  1993. }
  1994. this.dialog
  1995. .setTitle(`🟢 Olá ${data.username}, ${greeting}`)
  1996. .setBody(new CheckUserBodyComponent(data));
  1997. }
  1998. }
  1999. const rootComponent = new AppComponent(document.querySelector('#root'), { background: BACKGROUND_COLOR });
  2000. window.onerror = e => {
  2001. rootComponent.element.style.color = '#FFFFFF';
  2002. rootComponent.element.style.fontSize = '18px';
  2003. rootComponent.element.innerHTML = e
  2004. return false;
  2005. };
  2006. const cardComponent = new CardComponent({ position: 'absolute', top: '15%' });
  2007. const configInput = new ConfigInputComponent();
  2008. cardComponent.append(configInput);
  2009. const userPassInputComponent = new UserPassInputComponent()
  2010. cardComponent.append(userPassInputComponent);
  2011. const cardToolsComponent = new CardToolsComponent();
  2012. cardComponent.append(cardToolsComponent);
  2013. const buttonAndStateContainer = new ButtonAndStateContainerComponent({ marginTop: '3rem' });
  2014. cardComponent.append(buttonAndStateContainer);
  2015. rootComponent.append(new LocalIPComponent());
  2016. rootComponent.append(new PingComponent());
  2017. rootComponent.append(new NetworkStatsComponent());
  2018. rootComponent.append(cardComponent);
  2019. const checkUserDialog = new CheckUserDialog();
  2020. checkUserDialog.initialize();
  2021. </script>
  2022. </body>
  2023. </html>

comments powered by Disqus