A Twitter (X), Tiktok funkcióinak fejlesztései

A script javítja a Twitter (X) és TikTok szolgáltatásokat olyan funkciók javításával, mint a dátumformátum, képek és videók letöltése, és még sok más a Twitter (X) számára, valamint videók letöltése a TikTok számára. Folyamatosan karbantartva és frissítve lesz, így bizalommal használhatod.

// ==UserScript==
// @name        Twitter(X), Tiktok feature improvements
// @name:ar     تحسينات ميزات تويتر (إكس)، تيك توك
// @name:bg     Подобрения на функциите на Twitter (X), Tiktok
// @name:ckb    پیشەسازی تایبەتمەندیەکانەوەی تویتەر (X)، تیكتۆك
// @name:cs     Vylepšení funkcí Twitter (X), Tiktok
// @name:da     Forbedringer af funktioner på Twitter (X), Tiktok
// @name:de     Verbesserungen der Funktionen von Twitter (X), Tiktok
// @name:el     Βελτιώσεις λειτουργιών του Twitter (X), Tiktok
// @name:en     Twitter(X), Tiktok feature improvements
// @name:eo     Plibonigoj de funkcioj de Twitter (X), Tiktok
// @name:es     Mejoras en las funciones de Twitter (X), Tiktok
// @name:es-419 Mejoras en las funciones de Twitter (X), Tiktok
// @name:fi     Twitterin (X) ja TikTokin ominaisuuspäivitykset
// @name:fr     Améliorations des fonctionnalités de Twitter (X), Tiktok
// @name:fr-CA  Améliorations des fonctionnalités de Twitter (X), Tiktok
// @name:he     שיפורים בתכונות של טוויטר (X), טיק טוק
// @name:hr     Poboljšanja značajki Twittera (X), Tiktok
// @name:hu     A Twitter (X), Tiktok funkcióinak fejlesztései
// @name:id     Peningkatan fitur Twitter (X), Tiktok
// @name:it     Miglioramenti delle funzionalità di Twitter (X), Tiktok
// @name:ja     Twitter(X)、Tiktokの機能改善
// @name:ka     Twitter(X), Tiktok ფუნქციის გაუმჯობესებები
// @name:ko     Twitter(X), Tiktok 기능 개선
// @name:nb     Forbedringer av funksjoner på Twitter (X), Tiktok
// @name:nl     Verbeteringen van de functies van Twitter (X), Tiktok
// @name:pl     Ulepszenia funkcji Twittera (X), Tiktok
// @name:pt-BR  Melhorias nas funcionalidades do Twitter (X), Tiktok
// @name:ro     Îmbunătățiri ale funcțiilor Twitter (X), Tiktok
// @name:ru     Улучшения функций Twitter (X), Tiktok
// @name:sk     Vylepšenia funkcií Twitter (X), Tiktok
// @name:sr     Poboljšanja funkcija Twitter (X), Tiktok
// @name:sv     Förbättringar av funktioner på Twitter (X), Tiktok
// @name:th     การปรับปรุงฟีเจอร์ Twitter (X), Tiktok
// @name:tr     Twitter (X), Tiktok özellik iyileştirmeleri
// @name:uk     Поліпшення функцій Twitter (X), Tiktok
// @name:ug     Twitter (X), Tiktok ئورۇنلارنىڭ يۇقىرى سۈپەت ئۆزگىرىشى
// @name:vi     Cải tiến tính năng Twitter (X), Tiktok
// @description        The script enhances Twitter (X) and TikTok by improving features such as date format, image and video downloads, and more for Twitter (X), and video downloads for TikTok. It will be continuously maintained and updated, so you can use it with confidence.
// @description:ar     يعمل السكربت على تحسين تويتر (X) وتيك توك عن طريق تحسين ميزات مثل تنسيق التاريخ، تحميل الصور والفيديوهات، والمزيد لتويتر (X)، وتحميل الفيديوهات لتيك توك. سيتم صيانته وتحديثه باستمرار، حتى تتمكن من استخدامه بثقة.
// @description:bg     Скриптът подобрява Twitter (X) и TikTok чрез подобряване на функции като формат на дата, изтегляне на изображения и видеоклипове и други за Twitter (X) и изтегляне на видеоклипове за TikTok. Той ще се поддържа и обновява непрекъснато, така че можете да го използвате с увереност.
// @description:ckb    اسکریپتەکە تەنها تایبەتمەندیەکانەی تیوتر (X) و تیکتۆکەکان پەسەند دەکات وەکوو فۆرماتی ڕووداو، داگرتنی وێنە و ڤیدیۆ و زۆرتر بۆ تیوتر (X) و داگرتنی ڤیدیۆ بۆ تیکتۆک. ئەم پڕۆگرامە بە شێوەیەکی پەیوەندیدار و نوێ دەبێت، بۆیە دەتوانیت بە بەرەوپێش کارەکە بە بەرەوپێش بەکاربەریت.
// @description:cs     Skript zlepšuje Twitter (X) a TikTok vylepšením funkcí jako je formát data, stahování obrázků a videí a další pro Twitter (X), a stahování videí pro TikTok. Bude neustále udržováno a aktualizováno, takže ho můžete používat s důvěrou.
// @description:da     Scriptet forbedrer Twitter (X) og TikTok ved at forbedre funktioner som datoformat, billede- og video-downloads og mere for Twitter (X), samt video-downloads for TikTok. Det vil løbende blive vedligeholdt og opdateret, så du kan bruge det med tillid.
// @description:de     Das Skript verbessert Twitter (X) und TikTok, indem es Funktionen wie das Datumsformat, das Herunterladen von Bildern und Videos und mehr für Twitter (X) sowie das Herunterladen von Videos für TikTok verbessert. Es wird kontinuierlich gewartet und aktualisiert, damit Sie es mit Vertrauen verwenden können.
// @description:el     Το σενάριο βελτιώνει το Twitter (X) και το TikTok, βελτιώνοντας δυνατότητες όπως η μορφή ημερομηνίας, η λήψη εικόνας και βίντεο και άλλα για το Twitter (X) και η λήψη βίντεο για το TikTok. Θα συντηρείται και θα ενημερώνεται συνεχώς, ώστε να το χρησιμοποιείτε με εμπιστοσύνη.
// @description:en     The script enhances Twitter (X) and TikTok by improving features such as date format, image and video downloads, and more for Twitter (X), and video downloads for TikTok. It will be continuously maintained and updated, so you can use it with confidence.
// @description:eo     La skripto plibonigas Twitter (X) kaj TikTok per plibonigo de funkcioj kiel dato-formato, bildaj kaj videodownloads, kaj pli por Twitter (X), kaj videodownloads por TikTok. Ĝi estos konstante subtenata kaj ĝisdatigita, tiel ke vi povas uzi ĝin kun konfido.
// @description:es     El script mejora Twitter (X) y TikTok al mejorar características como el formato de fecha, descargas de imágenes y videos, y más para Twitter (X), y descargas de videos para TikTok. Será mantenido y actualizado de manera continua, por lo que puedes usarlo con confianza.
// @description:es-419 El script mejora Twitter (X) y TikTok mejorando características como el formato de fecha, descargas de imágenes y videos, y más para Twitter (X), y descargas de videos para TikTok. Se mantendrá y actualizará continuamente, por lo que puedes usarlo con confianza.
// @description:fi     Skripti parantaa Twitter (X):ää ja TikTokia parantamalla ominaisuuksia, kuten päivämäärämuotoa, kuvien ja videoiden latauksia ja enemmän Twitter (X):lle sekä videoiden latausta TikTokille. Sitä ylläpidetään ja päivitetään jatkuvasti, joten voit käyttää sitä luottavaisin mielin.
// @description:fr     Le script améliore Twitter (X) et TikTok en améliorant des fonctionnalités telles que le format de la date, le téléchargement d'images et de vidéos, et plus encore pour Twitter (X), et le téléchargement de vidéos pour TikTok. Il sera continuellement maintenu et mis à jour, vous pouvez donc l'utiliser en toute confiance.
// @description:fr-CA  Le script améliore Twitter (X) et TikTok en améliorant des fonctionnalités telles que le format de la date, les téléchargements d'images et de vidéos, et plus encore pour Twitter (X), ainsi que les téléchargements de vidéos pour TikTok. Il sera maintenu et mis à jour en continu, afin que vous puissiez l'utiliser en toute confiance.
// @description:he     הסקריפט משדרג את טוויטר (X) ואת טיקטוק על ידי שיפור תכונות כמו פורמט תאריך, הורדת תמונות ווידאו, ועוד עבור טוויטר (X), והורדות וידאו עבור טיקטוק. הוא יתוחזק ויתעדכן באופן רציף, כך שתוכל להשתמש בו בביטחון.
// @description:hr     Skript poboljšava Twitter (X) i TikTok poboljšanjem funkcija kao što su format datuma, preuzimanje slika i videa i drugo za Twitter (X) te preuzimanje videa za TikTok. Bit će kontinuirano održavan i ažuriran, tako da ga možete koristiti s povjerenjem.
// @description:hu     A script javítja a Twitter (X) és TikTok szolgáltatásokat olyan funkciók javításával, mint a dátumformátum, képek és videók letöltése, és még sok más a Twitter (X) számára, valamint videók letöltése a TikTok számára. Folyamatosan karbantartva és frissítve lesz, így bizalommal használhatod.
// @description:id     Skrip ini meningkatkan Twitter (X) dan TikTok dengan memperbaiki fitur seperti format tanggal, unduhan gambar dan video, dan lebih banyak lagi untuk Twitter (X), serta unduhan video untuk TikTok. Skrip ini akan terus dipelihara dan diperbarui, sehingga Anda dapat menggunakannya dengan percaya diri.
// @description:it     Lo script migliora Twitter (X) e TikTok migliorando funzionalità come il formato della data, il download di immagini e video e altro per Twitter (X), e il download di video per TikTok. Sarà continuamente mantenuto e aggiornato, quindi puoi usarlo con fiducia.
// @description:ja     このスクリプトは、Twitter (X) と TikTok の機能を改善し、Twitter (X) では日付形式、画像や動画のダウンロード、その他の機能を改善し、TikTok では動画のダウンロード機能を向上させます。継続的にメンテナンスされ、更新されるため、安心して使用できます。
// @description:ka     სკრიპტი აუმჯობესებს Twitter (X) და TikTok-ს, აძლიერებს ისეთ მახასიათებლებს, როგორიცაა თარიღის ფორმატი, სურათების და ვიდეოების ჩამოტვირთვა და სხვა Twitter (X)-სთვის, ხოლო TikTok-სთვის ვიდეოების ჩამოტვირთვა. ის მუდმივად განახლდება და განახლდება, ასე რომ შეგიძლიათ გამოიყენოთ იგი ნდობით.
// @description:ko     이 스크립트는 Twitter (X)와 TikTok을 향상시켜 날짜 형식, 이미지 및 비디오 다운로드 기능 등을 개선하고, TikTok에 대한 비디오 다운로드도 지원합니다. 지속적으로 유지 관리되고 업데이트되므로 안심하고 사용할 수 있습니다.
// @description:nb     Skriptet forbedrer Twitter (X) og TikTok ved å forbedre funksjoner som datoformat, nedlasting av bilder og videoer og mer for Twitter (X), samt videonedlastinger for TikTok. Det vil kontinuerlig vedlikeholdes og oppdateres, slik at du kan bruke det med tillit.
// @description:nl     Het script verbetert Twitter (X) en TikTok door functies zoals datumformaat, beeld- en video-downloads en meer voor Twitter (X) te verbeteren, en videodownloads voor TikTok. Het zal continu worden onderhouden en bijgewerkt, zodat je het met vertrouwen kunt gebruiken.
// @description:pl     Skrypt ulepsza Twitter (X) i TikTok, poprawiając funkcje takie jak format daty, pobieranie obrazów i wideo i inne dla Twitter (X) oraz pobieranie wideo dla TikTok. Będzie ciągle utrzymywany i aktualizowany, dzięki czemu możesz go używać z pewnością.
// @description:pt-BR  O script aprimora o Twitter (X) e o TikTok melhorando recursos como o formato de data, downloads de imagens e vídeos e mais para o Twitter (X), e downloads de vídeos para o TikTok. Ele será mantido e atualizado continuamente, para que você possa usá-lo com confiança.
// @description:ro     Scriptul îmbunătățește Twitter (X) și TikTok prin îmbunătățirea funcțiilor precum formatul datei, descărcarea imaginilor și videoclipurilor și altele pentru Twitter (X) și descărcarea videoclipurilor pentru TikTok. Va fi menținut și actualizat continuu, astfel încât să-l puteți utiliza cu încredere.
// @description:ru     Скрипт улучшает Twitter (X) и TikTok, улучшая такие функции, как формат даты, загрузка изображений и видео и многое другое для Twitter (X), а также загрузку видео для TikTok. Он будет постоянно поддерживаться и обновляться, чтобы вы могли использовать его с уверенностью.
// @description:sk     Skript vylepšuje Twitter (X) a TikTok zlepšením funkcií, ako je formát dátumu, sťahovanie obrázkov a videí a ďalšie pre Twitter (X) a sťahovanie videí pre TikTok. Bude neustále udržiavaný a aktualizovaný, takže ho môžete používať s dôverou.
// @description:sr     Skript unapređuje Twitter (X) i TikTok poboljšanjem funkcija kao što su format datuma, preuzimanje slika i video klipova i drugih za Twitter (X) i preuzimanje video klipova za TikTok. Biće stalno održavan i ažuriran, tako da ga možete koristiti sa poverenjem.
// @description:sv     Skriptet förbättrar Twitter (X) och TikTok genom att förbättra funktioner som datumformat, bild- och videonedladdningar och mer för Twitter (X), samt videonedladdningar för TikTok. Det kommer kontinuerligt att underhållas och uppdateras, så att du kan använda det med förtroende.
// @description:th     สคริปต์นี้ช่วยปรับปรุง Twitter (X) และ TikTok โดยการปรับปรุงฟีเจอร์ต่าง ๆ เช่น รูปแบบวันที่ การดาวน์โหลดภาพและวิดีโอ และอื่น ๆ สำหรับ Twitter (X) และการดาวน์โหลดวิดีโอสำหรับ TikTok จะได้รับการบำรุงรักษาและอัปเดตอย่างต่อเนื่อง ดังนั้นคุณสามารถใช้งานได้อย่างมั่นใจ
// @description:tr     Bu script, Twitter (X) ve TikTok'u tarih formatı, resim ve video indirmeleri gibi özellikleri geliştirerek ve TikTok için video indirmelerini iyileştirerek geliştirir. Sürekli olarak bakım yapılacak ve güncellenmiş olacak, böylece güvenle kullanabilirsiniz.
// @description:uk     Скрипт покращує Twitter (X) та TikTok, вдосконалюючи функції, такі як формат дати, завантаження зображень та відео, а також інші для Twitter (X) та завантаження відео для TikTok. Він буде постійно підтримуватись і оновлюватись, тому ви можете використовувати його з упевненістю.
// @description:ug     بۇ سكىرپت تويتر (X) ۋە TikTokنىڭ مۇنەۋۋەرلىكتىكى خۇسۇسىيەتلەرنى يۇقىرى سەۋىيەگە كۆتۈرۈپ، تويتر (X) ئۈچۈن ۋاقىت تەرتىپى، رەسىم ۋە ۋىدېئو چۈشۈرۈش قاتارلىق خۇسۇسىيەتلەرنى ۋە TikTok ئۈچۈن ۋىدېئو چۈشۈرۈشنى يېڭىلايدۇ. بۇنىڭغا داۋاملىق تەسىر قىلىپ يېڭىلاندۇرۇلۇپ تۇرىدىغان بولىدۇ، شۇڭا ئۇنى ئىشلىتىشكە ئىشەنچىلىك بەلگىلىسىڭىز بولىدۇ.
// @description:vi     Script này cải thiện Twitter (X) và TikTok bằng cách cải thiện các tính năng như định dạng ngày, tải xuống hình ảnh và video, và nhiều hơn nữa cho Twitter (X), và tải xuống video cho TikTok. Nó sẽ được duy trì và cập nhật liên tục, vì vậy bạn có thể sử dụng nó với sự tự tin.
// @namespace   enochLiu_self_script
// @version     1.0.1
// @author      EnochLiu, PeterParker
// @icon        data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAl5JREFUaEPtWVtuAzEIdO7jO7Q5WZOTNYfwfVpZ8kZ+AAOGVRQpkfq1Xe8MzAC2L+nNf5c3x58+BF6dwWcGcs7fKaX6Z/09SikP60vc/+ecb9yzUsrybJBQe/nHCqaUEiJF8P0rFajlwznnPyuBlNKdio5lnaaAX+Yddn2KQJURt5CEaZvELvgKhkw9k8qq83vHoBKd5UamGWVCyDoMCqtdhsQAMOdcMzUY3+oHao1GuBaHKyIvmg8BZFIPo3aA8oJnJdR9gPLDAJDJFCQhVBxV5A+MsPxpAGrk1kthp1xyUoIE6otKEio/RIKHEpqiJgLU+MFTLl0Z6DwxNzm1H84Ab8qAQUp1Xpn7Q+0f3IgCDS+VUpUHFAacM7HIjQFhqjjUGmYCLRPQsIqZyg3eLKEpE7MfBkCg2oSA9xIgtd5PpQKJrZkpTEJdVdKQgHJD806oiefFNF2Y8IOr8vQYtkxMkNjxQwiJKAKnDX1IXiEEDE0u3A+RBLjmNW+CRLmhiM/PQwig04x+l6aZbC0k3AQQ+AZGPfRZwLsamaB7DgMkYd1Puwig8bixWKbSqVO7/bAlIQT+AKk4FICdHElqlwB3erc0J9SFvaY2E7AehWgAasaRqC0lV+vF8VhJYssP6gx4z3HO8oOKQNRRCOEHzSZIHPoggSjwhnmJqkzsBgidjUpH7VvjcLQfpNPpcPBoJ9dVmi/iuosMmERAXetRs6GeK04tqNcWEtwFx1a5tBAB3VxaavADdcV0OnggJRSHoXJRBMhrTu8lHodq83r3ebULyygKx6uffwh8MuCMwD9nR9JAVVitigAAAABJRU5ErkJggg==
// @include     https://x.com/*
// @include     https://twitter.com/*
// @include     https://mobile.x.com/*
// @include     https://www.tiktok.com/**
// @include     /^https:\/\/((ko|fr|es|ja|pt|it|th|ar|tr|de|he|nl|pl|www|best)+\.)?aliexpress\.(ru|us|com)\/*/
// @include     /^https:\/\/(www\.)?lazada\.(co\.id|vn|com\.my|co\.th|sg|com\.ph)/.*/
// @include     /^https:\/\/(.*\.)?shopee\..*/?.*/
// @include     /^https:\/\/([a-z]{2,3})\.banggood\.com/*/
// @include     /^https:\/\/(.*\.)?amazon\..*/?.*/
// @include     /^https:\/\/(.*\.)?ebay\..*/?.*/
// @include     /^https:\/\/(.*\.)?bestbuy\..*/?.*/
// @include     /^https:\/\/(.*\.)?airbaltic\..*/?.*/
// @include     /^https:\/\/(.*\.)?edureka\..*/?.*/
// @include     /^https:\/\/(.*\.)?ranavat\..*/?.*/
// @include     /^https:\/\/(.*\.)?alibaba\..*/?.*/
// @include     /^https:\/\/(.*\.)?wish\..*/?.*/
// @include     /^https:\/\/(.*\.)?ticketmaster\..*/?.*/
// @include     /^https:\/\/(.*\.)?wilson\..*/?.*/
// @include     /^https:\/\/(.*\.)?wilsonsleather\..*/?.*/
// @include     /^https:\/\/(.*\.)?pictarine\..*/?.*/
// @include     /^https:\/\/(.*\.)?suiteness\..*/?.*/
// @include     /^https:\/\/(.*\.)?treatwell\..*/?.*/
// @include     /^https:\/\/(.*\.)?trip\..*/?.*/
// @include     /^https:\/\/(.*\.)?samsung\..*/?.*/
// @include     /^https:\/\/(.*\.)?daraz\..*/?.*/
// @include     /^https:\/\/(.*\.)?wildberries\..*/?.*/
// @include     /^https:\/\/(.*\.)?whopee\..*/?.*/
// @include     /^https:\/\/(.*\.)?walmart\..*/?.*/
// @include     /^https:\/\/(.*\.)?temu\..*/?.*/
// @include     /^https:\/\/(.*\.)?noon\..*/?.*/
// @include     /^https:\/\/(.*\.)?ozon\..*/?.*/
// @include     /^https:\/\/(.*\.)?allegro\..*/?.*/
// @include     /^https:\/\/(.*\.)?rakuten\..*/?.*/
// @include     /^https:\/\/(.*\.)?zalando\..*/?.*/
// @include     /^https:\/\/(.*\.)?shein\..*/?.*/
// @include     *://www.jtm.pub/mid/merge**
// @exclude     *://accounts.youtube.com/*
// @exclude     *://www.youtube.com/live_chat_replay*
// @exclude     *://www.youtube.com/persist_identity*
// @exclude     *://x.com/i/flow/*
// @connect     tikdownloader.io
// @connect     oversea.mimixiaoke.com
// @license     MIT
// @run-at      document-idle
// @antifeature referral-link
// @noframes
// @grant       GM_registerMenuCommand
// @grant       GM_openInTab
// @grant       GM.openInTab
// @grant       GM_addStyle
// @grant       GM_setValue
// @grant       GM_getValue
// @grant       GM_xmlhttpRequest
// @grant       GM_download
// @grant       GM_setClipboard
// ==/UserScript==
(function () {
  'use strict';

  
  /*!
  * Copyright (c) 2024 - 2025, EnochLiu, PeterParker. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  * copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  *
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */


  const ScriptConst = {
    "lang": (navigator.language || navigator.userLanguage).slice(0, 2).toLowerCase(),
    "isDev": false,
    "isDebug": true,
    "currentHost": window.location.host,
    "currentUrl": window.location.href
  };
  const PlatformConst = {
    "aliexpress": "aliexpress",
    "amazon": "amazon",
    "shopee": "shopee",
    "lazada": "lazada",
    "ebay": "ebay",
    "bestbuy": "bestbuy",
    "banggood": "banggood",
    "wish": "wish",
    "airbaltic": "airbaltic",
    "edureka": "edureka",
    "ranavat": "ranavat",
    "alibaba": "alibaba",
    "ticketmaster": "ticketmaster",
    "wilson": "wilson",
    "wilsonsleather": "wilsonsleather",
    "pictarine": "pictarine",
    "suiteness": "suiteness",
    "trip": "trip",
    "treatwell": "treatwell",
    "samsung": "samsung",
    "x": "x",
    "youtube": "youtube",
    "tiktok": "tiktok",
    "cobalt": "cobalt",
    "temu": "temu",
    "walmart": "walmart",
    "wildberries": "wildberries",
    "zalando": "zalando",
    "noon": "noon",
    "daraz": "daraz",
    "ozon": "ozon",
    "allegro": "allegro",
    "rakuten": "rakuten",
    "shein": "shein"
  };

  var __async$k = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const Logger = {
    log: function(level = "info", ...messages) {
      {
        if (level.toLowerCase() === "info") {
          console.info(...messages);
        } else if (level.toLowerCase() === "error") {
          console.error(...messages);
        } else {
          console.log(...messages);
        }
      }
    }
  };
  const Tools = {
    decryptStr: function(str) {
      if (!str)
        return str;
      let result = atob(str);
      return result.split("").reverse().join("");
    },
    encryptStr: function(str) {
      if (!str)
        return str;
      let result = str.split("").reverse().join("");
      return btoa(result);
    },
    getEcommercePlatform: function() {
      let platform = null;
      const currentHost = window.location.host;
      if (/amazon\./.test(currentHost)) {
        platform = PlatformConst.amazon;
      } else if (/ebay\./.test(currentHost)) {
        platform = PlatformConst.ebay;
      } else if (/lazada\./.test(currentHost)) {
        platform = PlatformConst.lazada;
      } else if (/aliexpress./.test(currentHost)) {
        platform = PlatformConst.aliexpress;
      } else if (/bestbuy\./.test(currentHost)) {
        platform = PlatformConst.bestbuy;
      } else if (/banggood\./.test(currentHost)) {
        platform = PlatformConst.banggood;
      } else if (/wish\./.test(currentHost)) {
        platform = PlatformConst.wish;
      } else if (/airbaltic\./.test(currentHost)) {
        platform = PlatformConst.airbaltic;
      } else if (/edureka\./.test(currentHost)) {
        platform = PlatformConst.edureka;
      } else if (/ranavat\./.test(currentHost)) {
        platform = PlatformConst.ranavat;
      } else if (/alibaba\./.test(currentHost)) {
        platform = PlatformConst.alibaba;
      } else if (/ticketmaster\./.test(currentHost)) {
        platform = PlatformConst.ticketmaster;
      } else if (/wilson\./.test(currentHost)) {
        platform = PlatformConst.wilson;
      } else if (/wilsonsleather\./.test(currentHost)) {
        platform = PlatformConst.wilsonsleather;
      } else if (/pictarine\./.test(currentHost)) {
        platform = PlatformConst.pictarine;
      } else if (/suiteness\./.test(currentHost)) {
        platform = PlatformConst.suiteness;
      } else if (/trip\./.test(currentHost)) {
        platform = PlatformConst.trip;
      } else if (/treatwell\./.test(currentHost)) {
        platform = PlatformConst.treatwell;
      } else if (/samsung\./.test(currentHost)) {
        platform = PlatformConst.samsung;
      } else if (/temu\./.test(currentHost)) {
        platform = PlatformConst.temu;
      } else if (/walmart\./.test(currentHost)) {
        platform = PlatformConst.walmart;
      } else if (/shopee\./.test(currentHost)) {
        platform = PlatformConst.shopee;
      } else if (/wildberries\./.test(currentHost)) {
        platform = PlatformConst.wildberries;
      } else if (/zalando\./.test(currentHost)) {
        platform = PlatformConst.zalando;
      } else if (/noon\./.test(currentHost)) {
        platform = PlatformConst.noon;
      } else if (/daraz\./.test(currentHost)) {
        platform = PlatformConst.daraz;
      } else if (/ozon\./.test(currentHost)) {
        platform = PlatformConst.ozon;
      } else if (/allegro\./.test(currentHost)) {
        platform = PlatformConst.allegro;
      } else if (/rakuten\./.test(currentHost)) {
        platform = PlatformConst.rakuten;
      } else if (/shein\./.test(currentHost)) {
        platform = PlatformConst.shein;
      }
      return platform;
    },
    getOtherPlatform: function() {
      let platform = null;
      const currentHost = window.location.host;
      if (/twitter|x\.com$/.test(currentHost)) {
        platform = PlatformConst.x;
      } else if (/youtube\.com$/.test(currentHost)) {
        platform = PlatformConst.youtube;
      } else if (/www\.tiktok\.com/.test(currentHost)) {
        platform = PlatformConst.tiktok;
      } else if (/cobalt\.tools/.test(currentHost)) {
        platform = PlatformConst.cobalt;
      }
      return platform;
    },
    getAllMatchPlatform: function() {
      var _a;
      return (_a = this.getEcommercePlatform()) != null ? _a : this.getOtherPlatform();
    },
    removeAnchorsByNode: function(node) {
      const tagName = node.tagName;
      if (!tagName)
        return;
      const exist = ["A", "IMG", "DIV", "SPAN", "LABEL", "TABLE", "TR", "TD", "CANVAS"].some((name) => name === tagName);
      if (exist) {
        node.removeAttribute("data-spm-anchor-id");
        for (let i = 0; i < node.childNodes.length; i++) {
          this.removeAnchorsByNode(node.childNodes[i]);
        }
      }
    },
    removeAnchorsBySeletor: function() {
      document.querySelectorAll("*[data-re-mark-tag='aliexpress']").forEach((element) => {
        this.removeAnchorsByNode(element);
      });
    },
    openInTab: function(url, options = { "active": true, "insert": true, "setParent": true }) {
      if (typeof GM_openInTab === "function") {
        GM_openInTab(url, options);
      } else {
        GM.openInTab(url, options);
      }
    },
    request: function(method, url, param, headers = { "Content-Type": "application/json;charset=UTF-8" }, timeout = 20 * 1e3) {
      if (!url) {
        return Promise.reject({ "code": "exception", "result": null });
      }
      return new Promise((resolve, reject) => {
        const config = {
          method: method.toUpperCase(),
          url,
          timeout,
          onload: function(response) {
            if (response.status >= 200 && response.status < 300) {
              resolve({ "code": "success", "result": response.responseText });
            } else {
              reject({ "code": "error", "result": response.statusText });
            }
          },
          ontimeout: function(error) {
            reject({ "code": "error", "result": error });
          },
          onerror: function(error) {
            reject({ "code": "error", "result": error });
          }
        };
        if (config.method === "POST") {
          config.headers = headers != null ? headers : { "Content-Type": "application/json" };
          if (JSON.stringify(config.headers).indexOf("application/json") != -1) {
            config.data = JSON.stringify(param);
          } else {
            config.data = param;
          }
        } else if (config.method === "GET") {
          config.headers = headers != null ? headers : { "Content-Type": "application/json" };
          config.data = param;
        }
        GM_xmlhttpRequest(config);
      });
    },
    crossRequest: function(method = "GET", url, param = {}, headers = { "Content-Type": "application/json;charset=UTF-8" }, timeout = 20 * 1e3) {
      if (!url) {
        return Promise.reject({ "code": "exception", "result": null });
      }
      const config = { method: method.toUpperCase(), headers };
      const controller = new AbortController();
      const signal = controller.signal;
      config.signal = signal;
      if (config.method === "POST") {
        config.headers = headers != null ? headers : { "Content-Type": "application/json" };
        config.body = JSON.stringify(param);
      }
      const timeoutId = setTimeout(() => controller.abort(), timeout);
      return fetch(url, config).then((response) => response.ok ? response.text() : Promise.reject(response.statusText)).then((result) => {
        clearTimeout(timeoutId);
        return { "code": "success", "result": result };
      }).catch((error) => {
        clearTimeout(timeoutId);
        if (error.name === "AbortError") {
          return { "code": "error", "result": "Request timeout" };
        }
        return { "code": "error", "result": error };
      });
    },
    getParamterBySuffix: function(url = window.location.href, suffix = "html") {
      if (url.indexOf("?") != -1) {
        url = url.split("?")[0];
      }
      if (url.indexOf("#") != -1) {
        url = url.split("#")[0];
      }
      let regex = new RegExp("\\/([^\\/]*?)\\." + suffix);
      if (/lazada/.test(url)) {
        regex = new RegExp("-i(\\d+)(?:-s(\\d+))?\\.html");
      } else if (/www\.ebay/.test(url)) {
        regex = new RegExp("\\/itm\\/(\\d+)");
      }
      const match = url.match(regex);
      return match ? match[1] : null;
    },
    getParamterBySearch: function(paramsString = window.location.href, tag) {
      if (paramsString.indexOf("?") != -1) {
        paramsString = paramsString.split("?")[1];
      }
      const params = new URLSearchParams(paramsString);
      return params.get(tag);
    },
    waitForElementByInterval: function(selector, target = document.body, allowEmpty = true, delay = 10, maxDelay = 10 * 1e3) {
      return new Promise((resolve, reject) => {
        let totalDelay = 0;
        let element = target.querySelector(selector);
        let result = allowEmpty ? !!element : !!element && !!element.innerHTML;
        if (result) {
          resolve(element);
        }
        const elementInterval = setInterval(() => {
          if (totalDelay >= maxDelay) {
            clearInterval(elementInterval);
            resolve(null);
          }
          element = target.querySelector(selector);
          result = allowEmpty ? !!element : !!element && !!element.innerHTML;
          if (result) {
            clearInterval(elementInterval);
            resolve(element);
          } else {
            totalDelay += delay;
          }
        }, delay);
      });
    },
    randomNumber: function() {
      return Math.ceil(Math.random() * 1e8);
    },
    elementInContainer: function(container, element) {
      return container.contains(element);
    },
    mustGetElement: function(handler) {
      return __async$k(this, null, function* () {
        const getElements = (handler2) => __async$k(this, null, function* () {
          const promiseArray = [];
          const handlers = handler2.split("@");
          for (let i = 0; i < handlers.length; i++) {
            const eleName = handlers[i];
            if (!eleName) {
              continue;
            }
            if (eleName == "body") {
              promiseArray.push(
                new Promise((resolve, reject) => {
                  resolve(document.body);
                })
              );
            } else if (eleName == "html") {
              promiseArray.push(
                new Promise((resolve, reject) => {
                  resolve(document.html);
                })
              );
            } else {
              promiseArray.push(this.waitForElementByInterval(eleName, document.body, true, 10, 1500));
            }
          }
          let element2 = yield Promise.race(promiseArray);
          return element2;
        });
        let element = yield getElements(handler);
        return new Promise((resolve, reject) => {
          if (element) {
            resolve(element);
            return;
          }
          const waitInterval = setInterval(() => {
            element = getElements(handler);
            if (element) {
              clearInterval(waitInterval);
              resolve(element);
              return;
            }
          }, 2e3);
        });
      });
    },
    loopTask: function(callback, delay = 1500) {
      callback();
      setInterval(() => {
        callback();
      }, delay);
    },
    distinguishRemoveAndTry: function(distinguish, callback) {
      const distinguishElements = distinguish.map((name) => document.querySelector("*[name='" + name + "']"));
      const validateRs = distinguishElements.some((ele) => ele === null || ele === void 0);
      if (validateRs) {
        distinguishElements.reverse().forEach((element) => {
          if (element) {
            element.remove();
          }
        });
        callback();
      }
    },
    getDomain: function(url) {
      try {
        const hostname = new URL(url).hostname;
        const parts = hostname.split(".");
        if (parts.length > 2) {
          return `${parts[parts.length - 2]}.${parts[parts.length - 1]}`;
        }
        return hostname;
      } catch (error) {
        console.error("Invalid URL:", error);
        return null;
      }
    },
    getCommonMarketplace: function(url = window.location.href) {
      try {
        const domainParts = new URL(url).hostname.split(".");
        const countryCode = domainParts[domainParts.length - 1];
        return countryCode;
      } catch (error) {
        console.log(error);
      }
      return null;
    }
  };

  const Toast = {
    show: function(params) {
      let time = params.time;
      let background = params.background;
      let color = params.color;
      let position = params.position;
      let defaultMarginValue = 50;
      if (time == void 0 || time == "") {
        time = 1500;
      }
      if (position == void 0 || position == "") {
        position = "center-bottom";
      }
      const style = document.createElement("style");
      style.textContent = `@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-moz-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-o-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-ms-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}.toast-style-kk998y{position:fixed;background:rgba(0,0,0,0.7);color:#fff;font-size:14px;line-height:1;padding:10px;border-radius:3px;left:50%;transform:translateX(-50%);-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);-o-transform:translateX(-50%);-ms-transform:translateX(-50%);z-index:999999999999999999999999999;white-space:nowrap}.fadeOut{animation:fadeOut .5s}.fadeIn{animation:fadeIn .5s}`;
      const el = document.createElement("div");
      if (background != void 0 && background != "") {
        el.style.backgroundColor = background;
      }
      if (color != void 0 && color != "") {
        el.style.color = color;
      }
      el.setAttribute("class", "toast-style-kk998y");
      el.innerText = params.message;
      el.style.zIndex = 999999999;
      if (position === "center-bottom") {
        el.style.bottom = defaultMarginValue + "px";
      } else {
        el.style.top = defaultMarginValue + "px";
      }
      document.body.appendChild(el);
      document.head.appendChild(style);
      el.classList.add("fadeIn");
      setTimeout(function() {
        el.classList.remove("fadeIn");
        el.classList.add("fadeOut");
        el.addEventListener("animationend", function() {
          document.body.removeChild(el);
          document.head.removeChild(style);
        });
        el.addEventListener("webkitAnimationEnd", function() {
          document.body.removeChild(el);
          document.head.removeChild(style);
        });
      }, time);
    }
  };

  var _a;
  const language = {
    "zh": {
      "dateFormat": {
        "week": ["日", "一", "二", "三", "四", "五", "六"]
      },
      "download": {
        "download": "下载",
        "completed": "下载完成",
        "tip": "点击下载视频",
        "preparing": "正在准备下载(如果失败,请手动操作)"
      },
      "menuCommand": {
        "settings": "设置",
        "titleDateFormat": "时间格式设置:",
        "buttonClose": "关闭"
      }
    },
    "en": {
      "dateFormat": {
        "week": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
      },
      "download": {
        "download": "Download",
        "completed": "Download Completed",
        "tip": "Click to download video",
        "preparing": "Preparing to download (if failed, please do it manually)"
      },
      "menuCommand": {
        "settings": "Settings",
        "titleDateFormat": "Time format settings:",
        "buttonClose": "Close"
      }
    },
    "ja": {
      "dateFormat": {
        "week": ["日", "月", "火", "水", "木", "金", "土"]
      },
      "download": {
        "download": "ダウンロード",
        "completed": "ダウンロード完了",
        "tip": "クリックしてビデオをダウンロード",
        "preparing": "ダウンロードの準備中(失敗する場合は手動で行ってください)"
      },
      "menuCommand": {
        "settings": "設定",
        "titleDateFormat": "時刻形式の設定:",
        "buttonClose": "閉鎖"
      }
    },
    "fr": {
      "dateFormat": {
        "week": ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"]
      },
      "download": {
        "download": "télécharger",
        "completed": "éléchargement terminé",
        "tip": "Cliquez pour télécharger la vidéo",
        "preparing": "Préparation du téléchargement (en cas d'échec, veuillez le faire manuellement)"
      },
      "menuCommand": {
        "settings": "installation",
        "titleDateFormat": "Paramètres du format de l'heure :",
        "buttonClose": "fermeture"
      }
    },
    "de": {
      "dateFormat": {
        "week": ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"]
      },
      "download": {
        "download": "herunterladen",
        "completed": "Download abgeschlossen",
        "tip": "Klicken Sie hier, um das Video herunterzuladen",
        "preparing": "Vorbereitung für den Download (falls der Download fehlschlägt, führen Sie ihn bitte manuell durch)"
      },
      "menuCommand": {
        "settings": "aufstellen",
        "titleDateFormat": "Einstellungen für das Zeitformat:",
        "buttonClose": "Schließung"
      }
    },
    "it": {
      "dateFormat": {
        "week": ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"]
      },
      "download": {
        "download": "scaricamento",
        "completed": "Download completato",
        "tip": "Fare clic per scaricare il video",
        "preparing": "Preparazione per il download (se fallisce, eseguilo manualmente)"
      },
      "menuCommand": {
        "settings": "impostare",
        "titleDateFormat": "Impostazioni del formato dell'ora:",
        "buttonClose": "chiusura"
      }
    },
    "ko": {
      "dateFormat": {
        "week": ["일", "월", "화", "수", "목", "금", "토"]
      },
      "download": {
        "download": "다운로드",
        "completed": "다운로드 완료",
        "tip": "비디오를 다운로드하려면 클릭하세요",
        "preparing": "다운로드 준비 중 (실패할 경우 수동으로 진행해주세요)"
      },
      "menuCommand": {
        "settings": "설정",
        "titleDateFormat": "시간 형식 설정:",
        "buttonClose": "폐쇄"
      }
    },
    "ru": {
      "dateFormat": {
        "week": ["ВС", "ПН", "ВТ", "СР", "ЧТ", "ПТ", "СБ"]
      },
      "download": {
        "download": "скачать",
        "completed": "Загрузка завершена",
        "tip": "Нажмите, чтобы скачать видео",
        "preparing": "Подготовка к загрузке (если не получается, сделайте это вручную)"
      },
      "menuCommand": {
        "settings": "настраивать",
        "titleDateFormat": "Настройки формата времени:",
        "buttonClose": "закрытие"
      }
    },
    "pt": {
      "dateFormat": {
        "week": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"]
      },
      "download": {
        "download": "descargar",
        "completed": "Descarga completa",
        "tip": "Clique para baixar o vídeo",
        "preparing": "Preparação para download (se falhar, faça-o manualmente)"
      },
      "menuCommand": {
        "settings": "configuración",
        "titleDateFormat": "Configuración de formato de hora:",
        "buttonClose": "cierre"
      }
    },
    "es": {
      "dateFormat": {
        "week": ["DOM", "LUN", "MAR", "MIER", "JUE", "VIE", "SÁB"]
      },
      "download": {
        "download": "descargar",
        "completed": "Descarga completa",
        "tip": "Haga clic para descargar el vídeo",
        "preparing": "Preparándose para la descarga (si falla, hágalo manualmente)"
      },
      "menuCommand": {
        "settings": "configuración",
        "titleDateFormat": "Configuración de formato de hora:",
        "buttonClose": "cierre"
      }
    },
    "th": {
      "dateFormat": {
        "week": ["วันอาทิตย์", "วันจันทร์", "วันอังคาร", "วันพุธ", " วันพฤหัสบดี", "วันศุกร์ ", "วันเสาร์ "]
      },
      "download": {
        "download": "ดาวน์โหลด",
        "completed": "ดาวน์โหลดเสร็จสมบูรณ์",
        "tip": "คลิกเพื่อดาวน์โหลดวิดีโอ",
        "preparing": "กำลังเตรียมการดาวน์โหลด (หากล้มเหลว กรุณาดำเนินการด้วยตนเอง)"
      },
      "menuCommand": {
        "settings": "ตั้งค่า",
        "titleDateFormat": "การตั้งค่ารูปแบบเวลา:",
        "buttonClose": "ปิด"
      }
    },
    "tr": {
      "dateFormat": {
        "week": ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
      },
      "download": {
        "download": "indirmek",
        "completed": "İndirme tamamlandı",
        "tip": "Videoyu indirmek için tıklayın",
        "preparing": "İndirmeye hazırlanıyor (başarısız olursa lütfen manuel olarak yapın)"
      },
      "menuCommand": {
        "settings": "kurmak",
        "titleDateFormat": "Saat formatı ayarları:",
        "buttonClose": "kapatma"
      }
    },
    "nl": {
      "dateFormat": {
        "week": ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
      },
      "download": {
        "download": "downloaden",
        "completed": "Downloaden voltooid",
        "tip": "Klik om video te downloaden",
        "preparing": "Voorbereiden voor downloaden (als dit mislukt, doe dit dan handmatig)"
      },
      "menuCommand": {
        "settings": "opgezet",
        "titleDateFormat": "Instellingen tijdformaat:",
        "buttonClose": "sluiting"
      }
    }
  };
  const Commonlanguage = (_a = language[ScriptConst["lang"]]) != null ? _a : language["en"];

  var __async$j = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const FMT = 7;
  let fmt = GM_getValue("fmt", FMT);
  const XSettingsDialog = {
    number: Math.ceil(Math.random() * 1e8),
    formats: [
      { "format": "Do nothing", "example": "N/A" },
      { "format": "dd.MM.yy HH:mm", "example": "22.10.24 03:12" },
      { "format": "dd.MM.yy HH:mm:ss", "example": "22.10.24 03:12:56" },
      { "format": "dd.MM.yy(W) HH:mm", "example": "22.10.24(Mon) 03:12" },
      { "format": "dd.MM.yy(W) HH:mm:ss", "example": "22.10.24(Mon) 03:12:56" },
      { "format": "yy/MM/dd HH:mm", "example": "24/10/22 03:12" },
      { "format": "yy/MM/dd HH:mm:ss", "example": "24/10/22 03:12:56" },
      { "format": "yy/MM/dd(W) HH:mm", "example": "24/10/22(Mon) 03:12" },
      { "format": "yy/MM/dd(W) HH:mm:ss [ye/mo/da(we) ho:mi:se]", "example": "24/10/22(Mon) 03:12:56 [ye/mo/da(we) ho:mi:se]" },
      { "format": "yy-MM/dd HH:mm", "example": "24-10/22 03:12" },
      { "format": "yy-MM/dd HH:mm'ss", "example": "24-10/22 03:12'56" },
      { "format": "yy-MM/dd(W) HH:mm", "example": "24-10/22(Mon) 03:12" },
      { "format": "yy-MM/dd(W) HH:mm'ss", "example": "24-10/22(Mon) 03:12'56" },
      { "format": "MM/dd/yy HH:mm", "example": "10/22/24 03:12" },
      { "format": "MM/dd/yy HH:mm:ss", "example": "10/22/24 03:12:56" },
      { "format": "W, MM/dd/yy HH:mm", "example": "Mon, 10/22/24 03:12" },
      { "format": "W, MM/dd/yy HH:mm:ss", "example": "Mon, 10/22/24 03:12:56" },
      { "format": "M59-MM-dd HH:mm", "example": "M59-10-22 03:12" },
      { "format": "M59-MM-dd HH:mm:ss", "example": "M59-10-22 03:12:56" },
      { "format": "M59-MM-dd(W) HH:mm", "example": "M59-10-22(Mon) 03:12" },
      { "format": "M59-MM-dd(W) HH:mm:ss", "example": "M59-10-22(Mon) 03:12:56" }
    ],
    make: function() {
      let dialog = document.createElement("div");
      dialog.className = "dialog_u_" + this.number;
      dialog.style.all = "initial";
      dialog.style.backgroundColor = "rgb(255, 255, 255)";
      dialog.style.border = "1px solid #ccc";
      dialog.style.borderRadius = "2px";
      dialog.style.display = "none";
      dialog.style.fontFamily = "monospace";
      dialog.style.fontSize = "12px";
      dialog.style.width = "480px";
      dialog.style.paddingLeft = "5px";
      dialog.style.paddingRight = "5px";
      dialog.style.paddingTop = "5px";
      dialog.style.paddingBottom = "5px";
      dialog.style.position = "fixed";
      dialog.style.right = "8px";
      dialog.style.top = "8px";
      dialog.style.zIndex = "2147483647";
      dialog.style.overflow = "auto";
      let formatsHtml = `<table style="width:100%;border: 1px solid #c0bfbf;border-collapse: collapse;">`;
      for (var i = 1; i <= this.formats.length; i++) {
        if (i % 2 != 0) {
          formatsHtml += `<tr style="width:100%;border: 1px solid #c0bfbf;">`;
        }
        formatsHtml += `<td width="50" style="border: 1px solid #c0bfbf;padding: 5px 0px;" title="` + this.formats[i - 1].example + `"><input type="radio" name="fmt" value="` + (i - 1) + `" class="top_r" />` + ("【" + i + "】" + this.formats[i - 1].format) + `</td>`;
        if (i % 2 == 0) {
          formatsHtml += `</tr>`;
        }
      }
      formatsHtml += `</table>`;
      let html = `
        <div style="font-size:15px;font-weight:bold;margin-bottom:5px;">` + Commonlanguage.menuCommand.titleDateFormat + `</div>
        <div>` + formatsHtml + `</div>
        <div style="margin-top:15px;text-align:center;">
          <button name="closex">` + Commonlanguage.menuCommand.buttonClose + `</button>
        </div>
      `;
      dialog.innerHTML = html;
      return dialog;
    },
    addEvent: function(dialog) {
      dialog.querySelector("button[name='closex']").addEventListener("click", function(event) {
        for (let e of dialog.querySelectorAll('input[name="fmt"]')) {
          if (e.checked) {
            fmt = e.value;
            break;
          }
        }
        GM_setValue("fmt", fmt);
        dialog.style.display = "none";
      }, false);
    },
    init: function() {
      let dialog = this.make();
      this.addEvent(dialog);
      document.body.appendChild(dialog);
      GM_registerMenuCommand(Commonlanguage.menuCommand.settings, function() {
        if (dialog.style.display == "none") {
          dialog.querySelector('input[name="fmt"][value="' + fmt + '"]').checked = true;
          dialog.style.display = "block";
        }
      });
    }
  };
  const XDateFormat = {
    df: function(date, f) {
      var _a;
      const WEEK = Commonlanguage.dateFormat.week;
      const YE = date.getFullYear().toString().slice(-2);
      const YM = date.getFullYear() - 1911;
      const MO = ("0" + (date.getMonth() + 1)).slice(-2);
      const DA = ("0" + date.getDate()).slice(-2);
      const WE = WEEK[date.getDay()];
      const HO = ("0" + date.getHours()).slice(-2);
      const MI = ("0" + date.getMinutes()).slice(-2);
      const SE = ("0" + date.getSeconds()).slice(-2);
      const F = [
        DA + "." + MO + "." + YE + " " + HO + ":" + MI,
        DA + "." + MO + "." + YE + " " + HO + ":" + MI + ":" + SE,
        DA + "." + MO + "." + YE + "(" + WE + ") " + HO + ":" + MI,
        DA + "." + MO + "." + YE + "(" + WE + ") " + HO + ":" + MI + ":" + SE,
        YE + "/" + MO + "/" + DA + " " + HO + ":" + MI,
        YE + "/" + MO + "/" + DA + " " + HO + ":" + MI + ":" + SE,
        YE + "/" + MO + "/" + DA + "(" + WE + ") " + HO + ":" + MI,
        YE + "/" + MO + "/" + DA + "(" + WE + ") " + HO + ":" + MI + ":" + SE,
        YE + "-" + MO + "/" + DA + " " + HO + ":" + MI,
        YE + "-" + MO + "/" + DA + " " + HO + ":" + MI + "'" + SE,
        YE + "-" + MO + "/" + DA + "(" + WE + ") " + HO + ":" + MI,
        YE + "-" + MO + "/" + DA + "(" + WE + ") " + HO + ":" + MI + "'" + SE,
        MO + "/" + DA + "/" + YE + " " + HO + ":" + MI,
        MO + "/" + DA + "/" + YE + " " + HO + ":" + MI + ":" + SE,
        WE + ", " + MO + "/" + DA + "/" + YE + " " + HO + ":" + MI,
        WE + ", " + MO + "/" + DA + "/" + YE + " " + HO + ":" + MI + ":" + SE,
        "M" + YM + "-" + MO + "-" + DA + " " + HO + ":" + MI,
        "M" + YM + "-" + MO + "-" + DA + " " + HO + ":" + MI + ":" + SE,
        "M" + YM + "-" + MO + "-" + DA + "(" + WE + ") " + HO + ":" + MI,
        "M" + YM + "-" + MO + "-" + DA + "(" + WE + ") " + HO + ":" + MI + ":" + SE
      ];
      return (_a = F[f]) != null ? _a : F[0];
    },
    repldatetime: function() {
      const MYNAME = "peter_parker_x1190";
      const SEL = 'main div[data-testid="primaryColumn"] section article time[datetime*=":"]';
      const SEL_2 = 'div[aria-labelledby="modal-header"] div[data-testid^="User-Name"] time[datetime]';
      const SEL_3 = 'div[aria-labelledby="modal-header"] div[aria-label] time[datetime]';
      const SEL_4 = 'main section[aria-labelledby="detail-header"] article div[data-testid^="User-Name"] time[datetime]';
      const SEL_5 = 'main section div[data-testid="conversation"] div[aria-label] time[datetime]';
      document.querySelectorAll(SEL + ", " + SEL_2 + ", " + SEL_3 + ", " + SEL_4 + ", " + SEL_5).forEach((e) => {
        if (fmt != 0) {
          const SEL_ADD = "span.us-" + MYNAME;
          let d = e.getAttribute("datetime");
          let df = this.df(new Date(d), fmt - 1);
          let pe = e.parentNode;
          let old = pe.querySelectorAll(SEL_ADD);
          if (!old.length) {
            let span = document.createElement("span");
            span.className = "us-" + MYNAME;
            span.setAttribute("datetime", d);
            span.setAttribute("local-datetime", df);
            span.textContent = df;
            span.style = e.style;
            e.style.setProperty("display", "none");
            pe.appendChild(span);
          } else if (old[0].getAttribute("local-datetime") != df) {
            old[0].setAttribute("local-datetime", df);
            old[0].textContent = df;
            old[0].style = e.style;
          }
        }
      });
    }
  };
  const XOrigimg = () => {
    const SEL_D = 'div[style*="background-image:"]';
    const SEL_I = "img";
    let elms = document.querySelectorAll(SEL_D + ", " + SEL_I);
    for (let e of elms) {
      let regex = /^(.+pbs\.twimg\.com\/[^?]+\?format=\w+)(&|&amp;)(name=)(\w+)([")]*)$/;
      if (/div/i.test(e.tagName)) {
        let r2 = regex.exec(e.style.backgroundImage);
        if (r2 && r2[4] != "orig") {
          e.style.backgroundImage = r2[1] + r2[2] + r2[3] + "orig" + r2[5];
          continue;
        }
        continue;
      }
      let r = regex.exec(e.getAttribute("src"));
      if (r && r[4] != "orig") {
        e.setAttribute("src", r[1] + r[2] + r[3] + "orig" + r[5]);
        continue;
      }
    }
  };
  const XHidepromo = () => {
    var _a, _b;
    const SEL = 'path[d^="M19.498 3h-15c-1.381 0-2.5 1.12-2.5 2.5v13c0 1.38 1.119 2.5"]';
    const SEL_2 = 'main div[data-testid="sidebarColumn"] section div[data-testid="trend"] div.r-14gqq1x span.css-1qaijid.r-bcqeeo.r-qvutc0';
    const SEL_3 = 'main div[data-testid="primaryColumn"] section article span.css-1jxf684.r-bcqeeo.r-qvutc0.r-poiln3';
    const SEL_4 = 'main div[data-testid="primaryColumn"] section span.css-901oao.css-16my406.r-bcqeeo.r-qvutc0';
    let elms = document.querySelectorAll(SEL);
    let elms_2 = document.querySelectorAll(SEL_2);
    let elms_3 = document.querySelectorAll(SEL_3);
    let elms_4 = document.querySelectorAll(SEL_4);
    const PROMO = {
      "ja": "によるプロモーション$",
      "ko": " 님이 프로모션함$",
      "zh": "^由 .+ 推广$",
      "ru": "^Реклама от ",
      "de": "^Gesponsert von ",
      "it": "^Sponsorizzato da ",
      "fr": "^Sponsorisé par ",
      "pt": "^Promovido por ",
      "en": "^Promoted by "
    };
    const PROMO_L = (_a = PROMO[ScriptConst.lang]) != null ? _a : PROMO["en"];
    const PROMO_2 = {
      "ja": "プロモポスト",
      "ko": "Promoted Post",
      "zh": "推广帖",
      "ru": "Promoted Post",
      "de": "Gesponserter Post",
      "it": "Promoted Post",
      "fr": "Promoted Post",
      "pt": "Post promovido",
      "en": "Promoted Post"
    };
    const PROMO_L_2 = (_b = PROMO_2[ScriptConst.lang]) != null ? _b : PROMO_2["en"];
    for (let e of elms) {
      let xpe = e.closest('div[data-testid="cellInnerDiv"]');
      if (!xpe)
        xpe = e.closest("div.css-175oi2r.r-1adg3ll.r-1ny4l3l");
      if (!xpe)
        xpe = e.closest('div.css-175oi2r.r-1ny4l3l[data-testid="UserCell"]');
      if (xpe)
        xpe.style.setProperty("display", "none");
    }
    for (let e of elms_2) {
      const REGEX = new RegExp(PROMO_L, "i");
      if (!REGEX.test(e.textContent))
        continue;
      let xpe = e.closest("div.css-175oi2r.r-1adg3ll.r-1ny4l3l");
      xpe.style.setProperty("display", "none");
    }
    for (let e of elms_3) {
      if (e.textContent != "Ad")
        continue;
      let xpe = e.closest('div[data-testid="cellInnerDiv"]');
      xpe.style.setProperty("display", "none");
    }
    for (let e of elms_4) {
      if (e.textContent != PROMO_2["en"] && e.textContent != PROMO_L_2)
        continue;
      let xpe = e.closest('div[data-testid="cellInnerDiv"]');
      xpe.style.setProperty("display", "none");
    }
  };
  const XDownload = {
    history: [],
    show_sensitive: true,
    filename: "twitter_{user-name}(@{user-id})_{date-time}_{status-id}_{file-type}",
    css: `
    .tmd-down {margin-left: 12px; order: 99;}
    .tmd-down:hover > div > div > div > div {color: rgba(29, 161, 242, 1.0);}
    .tmd-down:hover > div > div > div > div > div {background-color: rgba(29, 161, 242, 0.1);}
    .tmd-down:active > div > div > div > div > div {background-color: rgba(29, 161, 242, 0.2);}
    .tmd-down:hover svg {color: rgba(29, 161, 242, 1.0);}
    .tmd-down:hover div:first-child:not(:last-child) {background-color: rgba(29, 161, 242, 0.1);}
    .tmd-down:active div:first-child:not(:last-child) {background-color: rgba(29, 161, 242, 0.2);}
    .tmd-down.tmd-media {position: absolute; right: 0;}
    .tmd-down.tmd-media > div {display: flex; border-radius: 99px; margin: 2px;}
    .tmd-down.tmd-media > div > div {display: flex; margin: 6px; color: #fff;}
    .tmd-down.tmd-media:hover > div {background-color: rgba(255,255,255, 0.6);}
    .tmd-down.tmd-media:hover > div > div {color: rgba(29, 161, 242, 1.0);}
    .tmd-down.tmd-media:not(:hover) > div > div {filter: drop-shadow(0 0 1px #000);}
    .tmd-down g {display: none;}
    .tmd-down.download g.download, .tmd-down.completed g.completed, .tmd-down.loading g.loading,.tmd-down.failed g.failed {display: unset;}
    .tmd-down.loading svg {animation: spin 1s linear infinite;}
    @keyframes spin {0% {transform: rotate(0deg);} 100% {transform: rotate(360deg);}}
    .tmd-btn {display: inline-block; background-color: #1DA1F2; color: #FFFFFF; padding: 0 20px; border-radius: 99px;}
    .tmd-tag {display: inline-block; background-color: #FFFFFF; color: #1DA1F2; padding: 0 10px; border-radius: 10px; border: 1px solid #1DA1F2;  font-weight: bold; margin: 5px;}
    .tmd-btn:hover {background-color: rgba(29, 161, 242, 0.9);}
    .tmd-tag:hover {background-color: rgba(29, 161, 242, 0.1);}
    .tmd-notifier {display: none; position: fixed; left: 16px; bottom: 16px; color: #000; background: #fff; border: 1px solid #ccc; border-radius: 8px; padding: 4px;}
    .tmd-notifier.running {display: flex; align-items: center;}
    .tmd-notifier label {display: inline-flex; align-items: center; margin: 0 8px;}
    .tmd-notifier label:before {content: " "; width: 32px; height: 16px; background-position: center; background-repeat: no-repeat;}
    .tmd-notifier label:nth-child(1):before {background-image:url("data:image/svg+xml;charset=utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22><path d=%22M3,14 v5 q0,2 2,2 h14 q2,0 2,-2 v-5 M7,10 l4,4 q1,1 2,0 l4,-4 M12,3 v11%22 fill=%22none%22 stroke=%22%23666%22 stroke-width=%222%22 stroke-linecap=%22round%22 /></svg>");}
    .tmd-notifier label:nth-child(2):before {background-image:url("data:image/svg+xml;charset=utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22><path d=%22M12,2 a1,1 0 0 1 0,20 a1,1 0 0 1 0,-20 M12,5 v7 h6%22 fill=%22none%22 stroke=%22%23999%22 stroke-width=%222%22 stroke-linejoin=%22round%22 stroke-linecap=%22round%22 /></svg>");}
    .tmd-notifier label:nth-child(3):before {background-image:url("data:image/svg+xml;charset=utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22><path d=%22M12,0 a2,2 0 0 0 0,24 a2,2 0 0 0 0,-24%22 fill=%22%23f66%22 stroke=%22none%22 /><path d=%22M14.5,5 a1,1 0 0 0 -5,0 l0.5,9 a1,1 0 0 0 4,0 z M12,17 a2,2 0 0 0 0,5 a2,2 0 0 0 0,-5%22 fill=%22%23fff%22 stroke=%22none%22 /></svg>");}
    .tmd-down.tmd-img {position: absolute; right: 0; bottom: 0; display: none !important;}
    .tmd-down.tmd-img > div {display: flex; border-radius: 99px; margin: 2px; background-color: rgba(255,255,255, 0.6);}
    .tmd-down.tmd-img > div > div {display: flex; margin: 6px; color: #fff !important;}
    .tmd-down.tmd-img:not(:hover) > div > div {filter: drop-shadow(0 0 1px #000);}
    .tmd-down.tmd-img:hover > div > div {color: rgba(29, 161, 242, 1.0);}
    :hover > .tmd-down.tmd-img, .tmd-img.loading, .tmd-img.completed, .tmd-img.failed {display: block !important;}
    .tweet-detail-action-item {width: 20% !important;}
    `,
    css_ss: `
    /* show sensitive in media tab */
    li[role="listitem"]>div>div>div>div:not(:last-child) {filter: none;}
    li[role="listitem"]>div>div>div>div+div:last-child {display: none;}
    `,
    svg: `
    <g class="download"><path d="M3,14 v5 q0,2 2,2 h14 q2,0 2,-2 v-5 M7,10 l4,4 q1,1 2,0 l4,-4 M12,3 v11" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></g>
    <g class="completed"><path d="M3,14 v5 q0,2 2,2 h14 q2,0 2,-2 v-5 M7,10 l3,4 q1,1 2,0 l8,-11" fill="none" stroke="#1DA1F2" stroke-width="2" stroke-linecap="round" /></g>
    <g class="loading"><circle cx="12" cy="12" r="10" fill="none" stroke="#1DA1F2" stroke-width="4" opacity="0.4" /><path d="M12,2 a10,10 0 0 1 10,10" fill="none" stroke="#1DA1F2" stroke-width="4" stroke-linecap="round" /></g>
    <g class="failed"><circle cx="12" cy="12" r="11" fill="#f33" stroke="currentColor" stroke-width="2" opacity="0.8" /><path d="M14,5 a1,1 0 0 0 -4,0 l0.5,9.5 a1.5,1.5 0 0 0 3,0 z M12,17 a2,2 0 0 0 0,4 a2,2 0 0 0 0,-4" fill="#fff" stroke="none" /></g>
    `,
    isTweetdeck: function() {
      return ScriptConst.currentHost.indexOf("tweetdeck") >= 0;
    },
    getCookie: function() {
      const cookieString = document.cookie;
      const cookiePairs = cookieString.split(";");
      const cookiesObject = {};
      for (const pair of cookiePairs) {
        const [key, value] = pair.split("=");
        cookiesObject[key.trim()] = value.trim();
      }
      return cookiesObject;
    },
    formatDate: function(i, o, tz) {
      let d = new Date(i);
      if (tz) {
        d.setMinutes(d.getMinutes() - d.getTimezoneOffset());
      }
      let m = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
      let v = {
        YYYY: d.getUTCFullYear().toString(),
        YY: d.getUTCFullYear().toString(),
        MM: d.getUTCMonth() + 1,
        MMM: m[d.getUTCMonth()],
        DD: d.getUTCDate(),
        hh: d.getUTCHours(),
        mm: d.getUTCMinutes(),
        ss: d.getUTCSeconds(),
        h2: d.getUTCHours() % 12,
        ap: d.getUTCHours() < 12 ? "AM" : "PM"
      };
      return o.replace(/(YY(YY)?|MMM?|DD|hh|mm|ss|h2|ap)/g, (n) => ("0" + v[n]).substr(-n.length));
    },
    detect: function(node) {
      let article = node.tagName == "ARTICLE" && node || node.tagName == "DIV" && (node.querySelector("article") || node.closest("article"));
      if (article) {
        this.addButtonTo(article);
      }
      let listitems = node.tagName == "LI" && node.getAttribute("role") == "listitem" && [node] || node.tagName == "DIV" && node.querySelectorAll('li[role="listitem"]');
      if (listitems) {
        this.addButtonToMedia(listitems);
      }
    },
    addButtonTo: function(article) {
      if (article.dataset.detected) {
        return;
      }
      article.dataset.detected = "true";
      const media_selector = [
        'a[href*="/photo/1"]',
        'div[role="progressbar"]',
        'button[data-testid="playButton"]',
        'a[href="/settings/content_you_see"]',
        "div.media-image-container",
        "div.media-preview-container",
        'div[aria-labelledby]>div:first-child>div[role="button"][tabindex="0"]'
      ];
      const media = article.querySelector(media_selector.join(","));
      if (media) {
        let status_id2 = article.querySelector('a[href*="/status/"]').href.split("/status/").pop().split("/").shift();
        let btn_group = article.querySelector('div[role="group"]:last-of-type, ul.tweet-actions, ul.tweet-detail-actions');
        let btn_share = Array.from(btn_group.querySelectorAll(":scope>div>div, li.tweet-action-item>a, li.tweet-detail-action-item>a")).pop().parentNode;
        let btn_down = btn_share.cloneNode(true);
        btn_down.querySelector("button").removeAttribute("disabled");
        if (this.isTweetdeck()) {
          btn_down.firstElementChild.innerHTML = '<svg viewBox="0 0 24 24" style="width: 18px; height: 18px;">' + this.svg + "</svg>";
          btn_down.firstElementChild.removeAttribute("rel");
          btn_down.classList.replace("pull-left", "pull-right");
        } else {
          btn_down.querySelector("svg").innerHTML = this.svg;
        }
        let is_exist = this.history.indexOf(status_id2) >= 0;
        this.status(btn_down, "tmd-down");
        this.status(btn_down, is_exist ? "completed" : "download", is_exist ? Commonlanguage.download.completed : Commonlanguage.download.download);
        btn_group.insertBefore(btn_down, btn_share.nextSibling);
        btn_down.onclick = () => {
          this.click(btn_down, status_id2, is_exist);
        };
        if (this.show_sensitive) {
          let btn_show = article.querySelector('div[aria-labelledby] div[role="button"][tabindex="0"]:not([data-testid]) > div[dir] > span > span');
          if (btn_show) {
            btn_show.click();
          }
        }
      }
      const imgs = article.querySelectorAll('a[href*="/photo/"]');
      if (imgs.length > 1) {
        let status_id2 = article.querySelector('a[href*="/status/"]').href.split("/status/").pop().split("/").shift();
        let btn_group = article.querySelector('div[role="group"]:last-of-type');
        Array.from(btn_group.querySelectorAll(":scope>div>div")).pop().parentNode;
        imgs.forEach((img) => {
          let index = img.href.split("/status/").pop().split("/").pop();
          let is_exist = this.history.indexOf(status_id2) >= 0;
          let btn_down = document.createElement("div");
          btn_down.innerHTML = '<div><div><svg viewBox="0 0 24 24" style="width: 18px; height: 18px;">' + this.svg + "</svg></div></div>";
          btn_down.classList.add("tmd-down", "tmd-img");
          this.status(btn_down, "download");
          img.parentNode.appendChild(btn_down);
          btn_down.onclick = (e) => {
            e.preventDefault();
            this.click(btn_down, status_id2, is_exist, index);
          };
        });
      }
    },
    addButtonToMedia: function(listitems) {
      listitems.forEach((li) => {
        if (li.dataset.detected)
          return;
        li.dataset.detected = "true";
        let is_exist = false;
        try {
          let status_id2 = li.querySelector('a[href*="/status/"]').href.split("/status/").pop().split("/").shift();
          is_exist = this.history.indexOf(status_id2) >= 0;
        } catch (e) {
          Logger.log("error", "get status_id error:", e);
        }
        let btn_down = document.createElement("div");
        btn_down.innerHTML = '<div><div><svg viewBox="0 0 24 24" style="width: 18px; height: 18px;">' + this.svg + "</svg></div></div>";
        btn_down.classList.add("tmd-down", "tmd-media");
        this.status(btn_down, is_exist ? "completed" : "download", is_exist ? Commonlanguage.download.completed : Commonlanguage.download.download);
        li.appendChild(btn_down);
        btn_down.onclick = () => {
          this.click(btn_down, status_id, is_exist);
        };
      });
    },
    status: function(btn, css, title, style) {
      if (css) {
        btn.classList.remove("download", "completed", "loading", "failed");
        btn.classList.add(css);
      }
      if (title)
        btn.title = title;
      if (style)
        btn.style.cssText = style;
    },
    fetchJson: function(status_id2) {
      return __async$j(this, null, function* () {
        const base_url = `https://${ScriptConst.currentHost}/i/api/graphql/NmCeCgkVlsRGS1cAwqtgmw/TweetDetail`;
        const variables = {
          "focalTweetId": status_id2,
          "with_rux_injections": false,
          "includePromotedContent": true,
          "withCommunity": true,
          "withQuickPromoteEligibilityTweetFields": true,
          "withBirdwatchNotes": true,
          "withVoice": true,
          "withV2Timeline": true
        };
        const features = {
          "rweb_lists_timeline_redesign_enabled": true,
          "responsive_web_graphql_exclude_directive_enabled": true,
          "verified_phone_label_enabled": false,
          "creator_subscriptions_tweet_preview_api_enabled": true,
          "responsive_web_graphql_timeline_navigation_enabled": true,
          "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false,
          "tweetypie_unmention_optimization_enabled": true,
          "responsive_web_edit_tweet_api_enabled": true,
          "graphql_is_translatable_rweb_tweet_is_translatable_enabled": true,
          "view_counts_everywhere_api_enabled": true,
          "longform_notetweets_consumption_enabled": true,
          "responsive_web_twitter_article_tweet_consumption_enabled": false,
          "tweet_awards_web_tipping_enabled": false,
          "freedom_of_speech_not_reach_fetch_enabled": true,
          "standardized_nudges_misinfo": true,
          "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true,
          "longform_notetweets_rich_text_read_enabled": true,
          "longform_notetweets_inline_media_enabled": true,
          "responsive_web_media_download_video_enabled": false,
          "responsive_web_enhance_cards_enabled": false
        };
        const url = encodeURI(`${base_url}?variables=${JSON.stringify(variables)}&features=${JSON.stringify(features)}`);
        const cookies = this.getCookie();
        const headers = {
          "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
          "x-twitter-active-user": "yes",
          "x-twitter-client-language": cookies.lang,
          "x-csrf-token": cookies.ct0
        };
        if (cookies.ct0.length == 32)
          headers["x-guest-token"] = cookies.gt;
        let tweet_detail = yield fetch(url, { headers }).then((result) => result.json());
        let tweet_entrie = tweet_detail.data.threaded_conversation_with_injections_v2.instructions[0].entries.find((n) => n.entryId == `tweet-${status_id2}`);
        let tweet_result = tweet_entrie.content.itemContent.tweet_results.result;
        return tweet_result.tweet || tweet_result;
      });
    },
    click: function(btn, status_id2, is_exist, index) {
      return __async$j(this, null, function* () {
        if (btn.classList.contains("loading"))
          return;
        this.status(btn, "loading");
        let save_history = yield GM_getValue("save_history", true);
        let json = yield this.fetchJson(status_id2);
        let tweet = json.legacy;
        let user = json.core.user_results.result.legacy;
        let invalid_chars = {
          "\\": "\",
          "/": "/",
          "|": "|",
          "<": "<",
          ">": ">",
          ":": ":",
          "*": "*",
          "?": "?",
          '"': """,
          "​": "",
          "‌": "",
          "‍": "",
          "⁠": "",
          "\uFEFF": "",
          "🔞": ""
        };
        let datetime = this.filename.match(/{date-time(-local)?:[^{}]+}/) ? this.filename.match(/{date-time(?:-local)?:([^{}]+)}/)[1].replace(/[\\/ | <>*?:"]/g, (v) => invalid_chars[v]) : "YYYYMMDD-hhmmss";
        let info = {};
        info["status-id"] = status_id2;
        info["user-name"] = user.name.replace(/([\\/|*?:"] | [\u200b - \u200d\u2060\ufeff] | 🔞) /g, (v) => invalid_chars[v]);
        info["user-id"] = user.screen_name;
        info["date-time"] = this.formatDate(tweet.created_at, datetime);
        info["date-time-local"] = this.formatDate(tweet.created_at, datetime, true);
        info["full-text"] = tweet.full_text.split("\n").join(" ").replace(/\s*https:\/\/t\.co\/\w+/g, "").replace(/[\\/ | <>*?:"]|[\u200b-\u200d\u2060\ufeff]/g, (v) => invalid_chars[v]);
        let medias = tweet.extended_entities && tweet.extended_entities.media;
        if (!medias || medias.length == 0) {
          try {
            medias = JSON.parse(json.card.legacy.binding_values[0].value.string_value).media_entities;
            medias = Object.values(medias);
          } catch (e) {
          }
        }
        if (!medias || medias.length == 0) {
          this.status(btn, "failed", "MEDIA_NOT_FOUND");
          return;
        }
        if (index) {
          medias = [medias[index - 1]];
        }
        if (medias.length > 0) {
          let tasks = medias.length;
          let tasks_result = [];
          medias.forEach((media, i) => {
            info.url = media.type == "photo" ? media.media_url_https + ":orig" : media.video_info.variants.filter((n) => n.content_type == "video/mp4").sort((a, b) => b.bitrate - a.bitrate)[0].url;
            info.file = info.url.split("/").pop().split(/[:?]/).shift();
            info["file-name"] = info.file.split(".").shift();
            info["file-ext"] = info.file.split(".").pop();
            info["file-type"] = media.type.replace("animated_", "");
            info.out = (this.filename.replace(/\.?{file-ext}/, "") + ((medias.length > 1 || index) && !this.filename.match("{file-name}") ? "-" + (index ? index - 1 : i) : "") + ".{file-ext}").replace(/{([^{}:]+)(:[^{}]+)?}/g, (match, name) => info[name]);
            this.downloader.add({
              url: info.url,
              name: info.out,
              onload: () => {
                tasks -= 1;
                tasks_result.push((medias.length > 1 || index ? (index ? index : i + 1) + ": " : "") + Commonlanguage.download.completed);
                this.status(btn, null, tasks_result.sort().join("\n"));
                if (tasks === 0) {
                  this.status(btn, "completed", Commonlanguage.download.completed);
                  if (save_history && !is_exist) {
                    this.history.push(status_id2);
                  }
                }
              },
              onerror: (result) => {
                tasks = -1;
                tasks_result.push((medias.length > 1 ? i + 1 + ": " : "") + result.details.current);
                this.status(btn, "failed", tasks_result.sort().join("\n"));
              }
            });
          });
        } else {
          this.status(btn, "failed", "MEDIA_NOT_FOUND");
        }
      });
    },
    downloader: function() {
      let tasks = [], thread = 0, max_thread = 2, retry = 0, max_retry = 2, failed = 0, notifier, has_failed = false;
      return {
        add: function(task) {
          tasks.push(task);
          if (thread < max_thread) {
            thread += 1;
            this.next();
          } else {
            this.update();
          }
        },
        next: function() {
          return __async$j(this, null, function* () {
            let task = tasks.shift();
            yield this.start(task);
            if (tasks.length > 0 && thread <= max_thread) {
              this.next();
            } else {
              thread -= 1;
            }
            this.update();
          });
        },
        start: function(task) {
          this.update();
          return new Promise((resolve) => {
            GM_download({
              url: task.url,
              name: task.name,
              onload: (result) => {
                task.onload();
                resolve();
              },
              onerror: (result) => {
                this.retry(task, result);
                resolve();
              },
              ontimeout: (result) => {
                this.retry(task, result);
                resolve();
              }
            });
          });
        },
        retry: function(task, result) {
          retry += 1;
          if (retry == 3)
            max_thread = 1;
          if (task.retry && task.retry >= max_retry || result.details && result.details.current == "USER_CANCELED") {
            task.onerror(result);
            failed += 1;
          } else {
            if (max_thread == 1)
              task.retry = (task.retry || 0) + 1;
            this.add(task);
          }
        },
        update: function() {
          if (!notifier) {
            notifier = document.createElement("div");
            notifier.title = "Twitter Media Downloader";
            notifier.classList.add("tmd-notifier");
            notifier.innerHTML = "<label>0</label>|<label>0</label>";
            document.body.appendChild(notifier);
          }
          if (failed > 0 && !has_failed) {
            has_failed = true;
            notifier.innerHTML += "|";
            let clear = document.createElement("label");
            notifier.appendChild(clear);
            clear.onclick = () => {
              notifier.innerHTML = "<label>0</label>|<label>0</label>";
              failed = 0;
              has_failed = false;
              this.update();
            };
          }
          notifier.firstChild.innerText = thread;
          notifier.firstChild.nextElementSibling.innerText = tasks.length;
          if (failed > 0) {
            notifier.lastChild.innerText = failed;
          }
          if (thread > 0 || tasks.length > 0 || failed > 0) {
            notifier.classList.add("running");
          } else {
            notifier.classList.remove("running");
          }
        }
      };
    }(),
    init: function() {
      document.head.insertAdjacentHTML("beforeend", "<style>" + this.css + (this.show_sensitive ? this.css_ss : "") + "</style>");
    }
  };
  const X = {
    XSettingsDialog,
    XDateFormat,
    XOrigimg,
    XHidepromo,
    XDownload
  };

  var __async$i = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const Tiktok = {
    extractHref: function(html) {
      const regex = /<a\s+(?:[^>]*?\s+)?href=(['"])(.*?)\1/gi;
      const hrefs = [];
      let match;
      while ((match = regex.exec(html)) !== null) {
        hrefs.push(match[2]);
      }
      return hrefs.filter((href) => href.indexOf("snapcdn.app") != -1);
    },
    download: function(url, element) {
      return __async$i(this, null, function* () {
        Toast.show({ "message": Commonlanguage.download.preparing, "background": "#000" });
        element.classList.add("download-loadding");
        const param = new URLSearchParams({
          lang: "en",
          q: url
        }).toString();
        const data = yield Tools.request("POST", "https://tikdownloader.io/api/ajaxSearch", param, { "Content-Type": "application/x-www-form-urlencoded" });
        if (data.code === "success") {
          const result = JSON.parse(data.result);
          if (result.status == "ok" && result.hasOwnProperty("data")) {
            const data2 = result.data;
            const downloadUrls = this.extractHref(data2);
            if (downloadUrls.length >= 2) {
              Tools.openInTab(downloadUrls.at(-2));
            }
          }
        }
        element.classList.remove("download-loadding");
      });
    },
    appendHtml: function() {
      if (!document.querySelector("#tiktok-download-990i")) {
        const container = document.querySelector("#main-content-video_detail") || document.body;
        if (!container) {
          return;
        }
        const matchedDiv = document.querySelector("*[class*='-DivRightControlsWrapper'], *[class*='-DivMiniPlayerContainer']");
        if (matchedDiv) {
          let cloneNode = null;
          let isDetail = matchedDiv.children.length != 1;
          if (isDetail) {
            cloneNode = matchedDiv.children[0].cloneNode(true);
          } else {
            cloneNode = matchedDiv.cloneNode(true);
          }
          cloneNode.id = "tiktok-download-990i";
          cloneNode.querySelector("div").innerHTML = `<svg t="1724300009050" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5307" width="35" height="35"><path d="M298.666667 554.666667v85.333333H256v128h512v-128h-42.666667v-85.333333h128v213.333333a85.333333 85.333333 0 0 1-78.933333 85.077333L768 853.333333H256a85.333333 85.333333 0 0 1-85.12-78.933333L170.666667 768v-213.333333h128z" fill="#ffffff" p-id="5308"></path><path d="M512 627.498667l219.477333-219.477334h-120.704L512 506.88 413.141333 408.021333H292.522667L512 627.498667z" fill="#ffffff" p-id="5309"></path><path d="M554.666667 528V167.978667h-85.333334v360.021333h85.333334z" fill="#ffffff" p-id="5310"></path></svg>`;
          if (isDetail) {
            matchedDiv.insertBefore(cloneNode, matchedDiv.children[0]);
          } else {
            cloneNode.style.right = 166 + "px";
            matchedDiv.parentNode.insertBefore(cloneNode, matchedDiv);
          }
          cloneNode.title = Commonlanguage.download.tip;
          cloneNode.addEventListener("click", () => {
            Tiktok.download(window.location.href, cloneNode);
          });
        }
      }
    },
    start: function() {
      return __async$i(this, null, function* () {
        if (!/www\.tiktok\.com/.test(window.location.host)) {
          return;
        }
        GM_addStyle(`
      @keyframes scriptspin {0% {transform: rotate(0deg);} 100% {transform: rotate(360deg);}}
      .download-loadding{
        animation: scriptspin 1s linear infinite;
      }
    `);
        setInterval(() => {
          this.appendHtml();
        }, 1e3);
      });
    }
  };

  var css_248z$4 = ".peter99032j-xyz-panel-wrapper{box-sizing:border-box;position:fixed;z-index:2147483646}.peter99032j-xyz-panel-wrapper svg.icon-svg path{fill:var(--color-modeal-header-icon)}.peter99032j-xyz-panel-wrapper svg.icon-svg:hover path{fill:var(--color-modeal-header-icon-hover)}.peter99032j-xyz-panel-wrapper>.peter99032j-xyz-panel-aside-main{background-color:#fff;border:1px solid #ebebeb;border-radius:5px;bottom:70px;box-shadow:2px 2px 5px #b6bdc5;display:none;height:400px;overflow-x:hidden;overflow-y:auto;position:absolute;right:0;width:400px}.peter99032j-xyz-panel-wrapper>.peter99032j-xyz-panel-aside-main>.panel-aside-main_____inner{display:flex;flex-direction:column;height:100%;width:100%}.peter99032j-xyz-panel-aside-main .panel-aside-main_____header{align-items:center;background-color:var(--color-modeal-header-background);border-bottom:1px solid #ebe6e6;box-sizing:border-box;display:flex;height:var(--size-height-modeal-header);justify-content:space-between;padding:0 var(--size-padding-horizontal-modeal-header)}.peter99032j-xyz-panel-aside-main .panel-aside-main_____header>.logo_____header{align-items:center;display:flex;justify-content:center}.peter99032j-xyz-panel-aside-main .panel-aside-main_____header>.logo_____header>svg{height:var(--size-height-modeal-icon);width:var(--size-height-modeal-icon)}.peter99032j-xyz-panel-aside-main .panel-aside-main_____header>.title_____header{flex:1;font-size:var(--size-font-modeal-header-title);font-weight:700;padding-left:10px}.peter99032j-xyz-panel-aside-main .panel-aside-main_____header .btns_____header{display:flex;flex-direction:row}.peter99032j-xyz-panel-aside-main .panel-aside-main_____header .btns_____header ._____close,.peter99032j-xyz-panel-aside-main .panel-aside-main_____header .btns_____header ._____setting{align-items:center;cursor:pointer;display:flex;justify-content:center;width:var(--size-height-modeal-operat-icon)}.peter99032j-xyz-panel-aside-main .panel-aside-main_____content{background-color:var(--color-modeal-content-background);flex:1;overflow:auto}.peter99032j-xyz-panel-aside-main .panel-aside-main_____item{margin:5px 0;padding:5px}.peter99032j-xyz-panel-aside-main .panel-aside-main_____item .item_____title{color:#b6b6b6;font-size:13px;font-weight:500;padding:5px 0;text-align:center}.peter99032j-xyz-panel-aside-main .panel-aside-main_____item .item_____container{display:flex;flex-flow:wrap;flex-direction:row;justify-content:flex-start}.peter99032j-xyz-panel-aside-main .histories-box-review_item{margin:5px 0;overflow:hidden;width:33.3333%}.peter99032j-xyz-panel-aside-main .histories-box-review_item>a{background-color:#fff!important;border:1px solid #ccc!important;border-radius:5px!important;box-sizing:initial!important;display:block!important;margin:0 auto!important;position:relative!important;width:110px!important}.peter99032j-xyz-panel-aside-main .histories-box-review_item>a>.review___shadow{border:2px solid red;border-radius:5px;bottom:0;display:none;left:0;position:absolute;right:0;text-align:center;top:0;z-index:99}.peter99032j-xyz-panel-aside-main .histories-box-review_item>a>.review___shadow .delete_____btn{background-color:red;border-radius:3px;color:#fff;font-size:13px;height:15px;line-height:10px;position:absolute;right:0;text-align:center;top:0;width:15px}.peter99032j-xyz-panel-aside-main .histories-box-review_item>a>.review___img{border-radius:5px 5px 0 0;height:110px;overflow:hidden;width:110px}.peter99032j-xyz-panel-aside-main .histories-box-review_item>a>.review___img>img{width:100%}.peter99032j-xyz-panel-aside-main .histories-box-review_item>a>.review___text{color:#000!important;font-size:13px!important;overflow:hidden!important;padding:5px!important;text-align:center!important;text-decoration:underline!important;text-overflow:ellipsis!important;white-space:nowrap!important}.peter99032j-xyz-panel-wrapper>.peter99032j-xyz-panel-aside-body{background-color:#fafafa;border-radius:5px;box-shadow:1px 1px 2px #b6bdc5;direction:ltr!important;display:flex;height:60px;overflow:hidden}.peter99032j-xyz-panel-wrapper>.peter99032j-xyz-panel-aside-body>div{align-items:center;display:flex;justify-content:center}.peter99032j-xyz-panel-aside-body .goods_____expand{cursor:pointer;width:20px!important}.peter99032j-xyz-panel-aside-body .goods_____expand svg{transition:transform .3s}.peter99032j-xyz-panel-aside-body .goods_____review{flex-direction:row;transition:all .5s ease-in-out;width:auto}.peter99032j-xyz-panel-aside-body .goods-review_____item{border-radius:4px;cursor:pointer;height:45px;line-height:45px;margin:0 5px;overflow:hidden;position:relative;width:45px}.peter99032j-xyz-panel-aside-body .goods-review_____item>a{display:block;height:100%;width:100%}.peter99032j-xyz-panel-aside-body .goods-review_____item>a>.review___shadow{background-color:#3d9ba433;bottom:0;display:none;left:0;position:absolute;right:0;text-align:center;top:0;z-index:99}.peter99032j-xyz-panel-aside-body .goods-review_____item>a>.review___shadow img{width:15px}.peter99032j-xyz-panel-aside-body .goods-review_____item img{width:100%}.peter99032j-xyz-panel-aside-body .history-box_____expand{cursor:pointer;flex-direction:column;margin:0 10px;text-align:center}.peter99032j-xyz-panel-aside-body .history-box_____expand svg{height:33px;width:33px}.peter99032j-xyz-panel-aside-body .history-box_____expand label{font-size:12px;font-weight:700}.peter99032j-xyz-panel-aside-body .wrapper_____drag-handle{box-shadow:0 3px 3px -2px #0003,0 3px 4px 0 #00000024,0 1px 8px 0 #0000001f;cursor:move;width:20px!important}";

  const CLASSNAME_ID_SUFFIX = "_" + Math.ceil(Math.random() * 1e8);
  const StorageKeys = {
    activatePositionTop: "inspect_activate_position_top",
    history: {
      goodsHistory: "goooods_history_key",
      offset: "goooods_wrapper_key",
      maximumRecordsKey: "goooods_max_records_key"
    },
    langue: {
      custom: "custom_langue_key",
      objects: "langue_data_objects_key"
    }
  };
  const DefaultVaule = {
    lang: ScriptConst.lang,
    history: {
      historyStorage: { "aliexpress": [], "amazon": [], "shein": [], "shopee": [], "lazada": [], "ebay": [], "bestbuy": [], "banggood": [], "wish": [] },
      offsetWrapper: { right: 10, bottom: 10 },
      records: { min: 10, max: 500, default: 100 },
      toolbarGoodsNum: 4
    }
  };
  const getRequestUrl = () => {
    const baseUrl = "https://oversea.mimixiaoke.com";
    return {
      detectCoupon: { method: "POST", url: baseUrl + "/api/detect/coupon" },
      detectInfo: { method: "POST", url: baseUrl + "/api/detect/info" },
      getLangue: { method: "POST", url: baseUrl + "/api/load/lang" }
    };
  };

  var css_248z$3 = ":root{--color-modeal-header-background:#fff;--color-modeal-content-background:#f9f9f9;--color-modeal-header-icon:#bfbfbf;--color-modeal-header-icon-hover:#6a7a9b;--size-padding-horizontal-modeal-header:10px;--size-height-modeal-icon:50px;--size-height-modeal-operat-icon:30px;--size-height-modeal-header:55px;--size-font-modeal-header-title:18px}[data-extension-direction=rtl]{direction:rtl!important}";

  const StyleUtil = {
    addStyle: function(css) {
      GM_addStyle(css);
    },
    init: function() {
      this.addStyle(css_248z$3);
    }
  };

  const StorageUtil = {
    getValue: function(key, defaultValue) {
      return GM_getValue(key, defaultValue);
    },
    setValue: function(key, value) {
      GM_setValue(key, value);
    }
  };

  const ElementUtil = {
    createElement: function(tag, options = {}) {
      const element = document.createElement(tag);
      if (options.text) {
        element.textContent = options.text;
      }
      if (options.html) {
        element.innerHTML = options.html;
      }
      if (options.style) {
        Object.assign(element.style, options.style);
      }
      if (options.className) {
        element.className = options.className;
      }
      if (options.attributes) {
        for (let [key, value] of Object.entries(options.attributes)) {
          element.setAttribute(key, value);
        }
      }
      if (options.childrens) {
        options.childrens.forEach((child) => {
          element.appendChild(child);
        });
      }
      return element;
    },
    randomClassName: function(classnames, staticClassnames = "") {
      return (classnames.split(" ").map((name) => {
        return !!name ? name + CLASSNAME_ID_SUFFIX : " ";
      }).join(" ") + " " + staticClassnames).trim();
    },
    addSuffixToCss: function(cssText) {
      const updatedCssText = cssText.replace(/([^{}]+)(\s*{)/g, (match, selector, brace) => {
        const updatedSelector = selector.replace(/(\.|#)([^\s,>{:.]+)(?=[:\s,>{]|$)/g, (match2, prefix, name) => {
          return `${prefix}${name}${CLASSNAME_ID_SUFFIX}`;
        });
        return `${updatedSelector}${brace}`;
      });
      return updatedCssText;
    },
    addSuffixToHtml: function(htmlString) {
      const updatedHtml = htmlString.replace(/id="(.*?)"/g, (match, p1) => `id="${p1}${CLASSNAME_ID_SUFFIX}"`).replace(/class="(.*?)"/g, (match, p1) => {
        const classes = p1.split(" ").map((cls) => cls + CLASSNAME_ID_SUFFIX).join(" ");
        return `class="${classes}"`;
      });
      return updatedHtml;
    },
    removeClassByPrefix: function(element, prefix) {
      const classes = Array.from(element.classList);
      classes.forEach((className) => {
        if (className.startsWith(prefix)) {
          element.classList.remove(className);
        }
      });
    },
    addSuffixForIdClassName: function(String) {
      return String + CLASSNAME_ID_SUFFIX;
    }
  };

  const ClipboardUtil = {
    setValue: function(text, type = "text/plain") {
      GM_setClipboard(text, type);
    }
  };

  const InspectUtil = {
    generateOuterContainer: function(dir = "ltr") {
      const outerDIV = document.createElement("div");
      outerDIV.id = "multi-modal-container" + CLASSNAME_ID_SUFFIX;
      outerDIV.setAttribute("data-extension-direction", dir);
      document.body.append(
        ElementUtil.createElement("div", {
          attributes: {
            "id": "script-coupon-modals-df" + CLASSNAME_ID_SUFFIX,
            "style": "z-index:2147483647!important;display:block;"
          },
          childrens: [
            ElementUtil.createElement("div", {
              attributes: {
                "id": "inspect-coupon-modals-container" + CLASSNAME_ID_SUFFIX,
                "style": `
                color: initial; font: initial; font-palette: initial; font-synthesis: initial; forced-color-adjust: initial; text-orientation: initial; text-rendering: initial; -webkit-font-smoothing: initial; -webkit-locale: initial; -webkit-text-orientation: initial; -webkit-writing-mode: initial; writing-mode: initial; zoom: initial; accent-color: initial; place-content: initial; place-items: initial; place-self: initial; alignment-baseline: initial; animation: initial; app-region: initial; appearance: initial; aspect-ratio: initial; backdrop-filter: initial; backface-visibility: initial; background: initial; background-blend-mode: initial; baseline-shift: initial; block-size: initial; border-block: initial; border: initial; border-radius: initial; border-collapse: initial; border-end-end-radius: initial; border-end-start-radius: initial; border-inline: initial; border-start-end-radius: initial; border-start-start-radius: initial; inset: initial; box-shadow: initial; box-sizing: initial; break-after: initial; break-before: initial; break-inside: initial; buffered-rendering: initial; caption-side: initial; caret-color: initial; clear: initial; clip: initial; clip-path: initial; clip-rule: initial; color-interpolation: initial; color-interpolation-filters: initial; color-rendering: initial; color-scheme: initial; columns: initial; column-fill: initial; gap: initial; column-rule: initial; column-span: initial; contain: initial; contain-intrinsic-block-size: initial; contain-intrinsic-size: initial; contain-intrinsic-inline-size: initial; container: initial; content: initial; content-visibility: initial; counter-increment: initial; counter-reset: initial; counter-set: initial; cursor: initial; cx: initial; cy: initial; d: initial; display: initial; dominant-baseline: initial; empty-cells: initial; fill: initial; fill-opacity: initial; fill-rule: initial; filter: initial; flex: initial; flex-flow: initial; float: initial; flood-color: initial; flood-opacity: initial; grid: initial; grid-area: initial; height: initial; hyphens: initial; image-orientation: initial; image-rendering: initial; inline-size: initial; inset-block: initial; inset-inline: initial; isolation: initial; letter-spacing: initial; lighting-color: initial; line-break: initial; list-style: initial; margin-block: initial; margin: initial; margin-inline: initial; marker: initial; mask-type: initial; max-block-size: initial; max-height: initial; max-inline-size: initial; max-width: initial; min-block-size: initial; min-height: initial; min-inline-size: initial; min-width: initial; mix-blend-mode: initial; object-fit: initial; object-position: initial; object-view-box: initial; offset: initial; opacity: initial; order: initial; orphans: initial; outline: initial; outline-offset: initial; overflow-anchor: initial; overflow-clip-margin: initial; overflow-wrap: initial; overflow: initial; overscroll-behavior-block: initial; overscroll-behavior-inline: initial; overscroll-behavior: initial; padding-block: initial; padding: initial; padding-inline: initial; page: initial; page-orientation: initial; paint-order: initial; perspective: initial; perspective-origin: initial; pointer-events: initial; position: initial; quotes: initial; r: initial; resize: initial; rotate: initial; ruby-position: initial; rx: initial; ry: initial; scale: initial; scroll-behavior: initial; scroll-margin-block: initial; scroll-margin: initial; scroll-margin-inline: initial; scroll-padding-block: initial; scroll-padding: initial; scroll-padding-inline: initial; scroll-snap-align: initial; scroll-snap-stop: initial; scroll-snap-type: initial; scrollbar-gutter: initial; shape-image-threshold: initial; shape-margin: initial; shape-outside: initial; shape-rendering: initial; size: initial; speak: initial; stop-color: initial; stop-opacity: initial; stroke: initial; stroke-dasharray: initial; stroke-dashoffset: initial; stroke-linecap: initial; stroke-linejoin: initial; stroke-miterlimit: initial; stroke-opacity: initial; stroke-width: initial; tab-size: initial; table-layout: initial; text-align: initial; text-align-last: initial; text-anchor: initial; text-combine-upright: initial; text-decoration: initial; text-decoration-skip-ink: initial; text-emphasis: initial; text-emphasis-position: initial; text-indent: initial; text-overflow: initial; text-shadow: initial; text-size-adjust: initial; text-transform: initial; text-underline-offset: initial; text-underline-position: initial; touch-action: initial; transform: initial; transform-box: initial; transform-origin: initial; transform-style: initial; transition: initial; translate: initial; user-select: initial; vector-effect: initial; vertical-align: initial; visibility: initial; border-spacing: initial; -webkit-box-align: initial; -webkit-box-decoration-break: initial; -webkit-box-direction: initial; -webkit-box-flex: initial; -webkit-box-ordinal-group: initial; -webkit-box-orient: initial; -webkit-box-pack: initial; -webkit-box-reflect: initial; hyphenate-character: initial; -webkit-line-break: initial; -webkit-line-clamp: initial; -webkit-mask-box-image: initial; mask: initial; -webkit-print-color-adjust: initial; -webkit-rtl-ordering: initial; -webkit-ruby-position: initial; -webkit-tap-highlight-color: initial; -webkit-text-combine: initial; -webkit-text-decorations-in-effect: initial; -webkit-text-fill-color: initial; -webkit-text-security: initial; -webkit-text-stroke: initial; -webkit-user-drag: initial; -webkit-user-modify: initial; white-space: initial; widows: initial; width: initial; will-change: initial; word-break: initial; word-spacing: initial; x: initial; y: initial; z-index: 2147483647;
              `
              },
              childrens: [
                outerDIV
              ]
            })
          ]
        })
      );
      return outerDIV;
    },
    openUrl: function(options) {
      const { active, affLink, close, pause, delay, position, target } = options;
      if (!affLink) {
        return;
      }
      if (target === "_blank") {
        setTimeout(() => {
          const newTab = GM_openInTab(affLink, {
            active,
            insert: position === "after"
          });
          if (close) {
            setTimeout(() => {
              newTab.close();
            }, pause);
          }
        }, delay);
      } else if (target === "_self") {
        setTimeout(() => {
          window.location.href = affLink;
        }, delay);
      } else if (target === "_replace") {
        setTimeout(() => {
          window.location.replace(affLink);
        }, delay);
      }
    },
    customOpenUrl: function(element, json, operate = "clickToJump") {
      for (let i = 0; i < json.length; i++) {
        const item = json[0];
        const options = {
          "affLink": Tools.decryptStr(item.affLink),
          "close": item.close,
          "pause": item.pause,
          "delay": item.delay,
          "target": item.target,
          "active": item.active,
          "position": item.position
        };
        let code = item.code, msg = item.msg;
        if (code) {
          ClipboardUtil.setValue(Tools.decryptStr(code));
          element.innerText = msg;
        }
        Logger.log("info", "data content======>", options);
        this.openUrl(options);
      }
    },
    bindCustomEvent: function(element) {
      if (!element) {
        return;
      }
      element.addEventListener("click", () => {
        try {
          const dataContent = element.getAttribute("data-content");
          const operate = element.getAttribute("name");
          const json = JSON.parse(dataContent);
          this.customOpenUrl(element, json, operate);
        } catch (e) {
          console.log(e);
        }
      });
    },
    getPlatform: function() {
      return Tools.getEcommercePlatform();
    },
    getModalTitle: function() {
      const platform = this.getPlatform();
      const capitalized = platform.charAt(0).toUpperCase() + platform.slice(1);
      return capitalized;
    }
  };

  var __async$h = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const LangueUtil = {
    updateDelay: 15 * 60 * 1e3,
    _locations: {
      "en": { languageDefault: "Default" },
      "es": { languageDefault: "Predeterminado" },
      "ar": { languageDefault: "افتراضي" },
      "fr": { languageDefault: "Par défaut" },
      "pt": { languageDefault: "Padrão" },
      "ru": { languageDefault: "По умолчанию" },
      "ja": { languageDefault: "デフォルト" },
      "de": { languageDefault: "Standard" },
      "ko": { languageDefault: "기본" },
      "it": { languageDefault: "Predefinito" },
      "id": { languageDefault: "Default" },
      "tr": { languageDefault: "Varsayılan" },
      "pl": { languageDefault: "Domyślnie" },
      "uk": { languageDefault: "Типово" },
      "nl": { languageDefault: "Standaard" },
      "vi": { languageDefault: "Mặc định" },
      "ms": { languageDefault: "Lalai" },
      "th": { languageDefault: "ค่าเริ่มต้น" },
      "mx": { languageDefault: "Predeterminado" },
      "cl": { languageDefault: "Predeterminado" }
    },
    getLanguages: function() {
      var _a, _b;
      const languages = [
        { code: "en", name: "English", dir: "ltr" },
        { code: "es", name: "Español", dir: "ltr" },
        { code: "ar", name: "العربية", dir: "rtl" },
        { code: "fr", name: "Français", dir: "ltr" },
        { code: "pt", name: "Português", dir: "ltr" },
        { code: "ru", name: "Русский", dir: "ltr" },
        { code: "ja", name: "日本語", dir: "ltr" },
        { code: "de", name: "Deutsch", dir: "ltr" },
        { code: "ko", name: "한국어", dir: "ltr" },
        { code: "it", name: "Italiano", dir: "ltr" },
        { code: "id", name: "Bahasa Indonesia", dir: "ltr" },
        { code: "tr", name: "Türkçe", dir: "ltr" },
        { code: "pl", name: "Polski", dir: "ltr" },
        { code: "uk", name: "Українська", dir: "ltr" },
        { code: "nl", name: "Nederlands", dir: "ltr" },
        { code: "vi", name: "Tiếng Việt", dir: "ltr" },
        { code: "ms", name: "Bahasa Melayu", dir: "ltr" },
        { code: "th", name: "ไทย", dir: "ltr" },
        { code: "mx", name: "Mexican Spanish", dir: "ltr" },
        { code: "cl", name: "Chilean Spanish", dir: "ltr" }
      ];
      const language = (_a = languages.find((lang) => lang.code === DefaultVaule.lang)) != null ? _a : languages[0];
      const defaultLanguage = Object.assign({}, language);
      defaultLanguage.code = "default";
      defaultLanguage.name = (_b = this._locations[DefaultVaule.lang]["languageDefault"]) != null ? _b : "Default";
      languages.unshift(defaultLanguage);
      return languages;
    },
    defaultLangueObjects: {
      "extension.structure.setting_modal_title": "Settings",
      "extension.structure.setting_modal_langue_title": "Language",
      "extension.structure.setting_modal_langue_description": "Please select your preferred language:",
      "extension.structure.setting_modal_history_title": "Browsing History Count:",
      "extension.structure.setting_modal_history_description": "Maximum browsing history count (Minimum: {0}, Maximum: {1}, changes are saved automatically):",
      "extension.structure.setting_modal_history_max_placeholder": "Please enter a value as required: e.g., 30",
      "extension.structure.setting_modal_clear_title": "Clear Cache:",
      "extension.structure.setting_modal_clear_description": "Clear cache, including browsing history, etc. Note: Once cleared, it cannot be recovered.",
      "extension.structure.setting_modal_clear_btn": "Click to Clear",
      "extension.structure.setting_modal_clear_confirm": "Do you want to clear all browsing history? Once cleared, it cannot be recovered.",
      "extension.structure.history_box_title": "Browsing History",
      "extension.structure.history_bar_hint": "History",
      "extension.structure.history_box_hit_today": "—— Today ——",
      "extension.structure.history_box_hit_yesterday": "—— Yesterday ——",
      "extension.structure.couponList_modal_retry": "Retry",
      "extension.structure.couponList_modal_copid": "Copied",
      "extension.structure.auto_detect_modal_description": "Finding great deals...",
      "extension.structure.auto_detect_modal_secondary_description": "Automatically tries codes to save you money.",
      "extension.structure.auto_detect_alert_error": "Sorry, we couldn’t find any valid codes.",
      "extension.structure.auto_detect_alert_success": "Congratulations! The code has been applied automatically!"
    },
    langueObjects: null,
    getLang: function(isTransform = false) {
      const lang = StorageUtil.getValue(StorageKeys.langue.custom, "default");
      if (isTransform) {
        return lang === "default" ? DefaultVaule.lang : lang;
      }
      return lang;
    },
    setLang: function(lang) {
      StorageUtil.setValue(StorageKeys.langue.custom, lang);
    },
    getSelectedLanguage: function(selectedLang) {
      if (!selectedLang) {
        selectedLang = this.getLang(true);
      }
      let selectedLanguage = this.getLanguages().find((lang) => lang.code === selectedLang);
      if (!selectedLanguage) {
        selectedLanguage = this.getLanguages()[0];
      }
      return selectedLanguage;
    },
    getLangueByStorageKey: function(key) {
      var _a;
      key = "extension.structure." + key;
      let langueObjects = this.langueObjects;
      if (!langueObjects) {
        langueObjects = this.defaultLangueObjects;
      }
      return (_a = langueObjects[key]) != null ? _a : this.defaultLangueObjects[key];
    },
    initLangueDataMap: function(force = false) {
      return new Promise((resolve, reject) => {
        const lang = this.getLang(true);
        const now = new Date().getTime();
        const langueObjects = StorageUtil.getValue(StorageKeys.langue.objects, { "data": this.defaultLangueObjects, "time": now, "lang": "default" });
        if (now - langueObjects.time >= this.updateDelay || now === langueObjects.time || langueObjects.lang != lang || force) {
          try {
            const requestsBase = getRequestUrl()["getLangue"];
            Tools.request(requestsBase.method, requestsBase.url, { "lang": lang }, { "Content-Type": "application/json;charset=UTF-8" }, 5 * 1e3).then((serverLangueJson) => {
              if (serverLangueJson.code === "success") {
                const serverLangueObjects = JSON.parse(serverLangueJson.result);
                StorageUtil.setValue(StorageKeys.langue.objects, { "data": serverLangueObjects, "time": new Date().getTime(), "lang": lang });
                this.langueObjects = serverLangueObjects;
                Logger.log("info", "get server langue success=======>", this.langueObjects);
              } else {
                Logger.log("info", "get server langue error=======>", this.langueObjects);
                this.langueObjects = this.defaultLangueObjects;
              }
            }).catch((error) => {
              this.langueObjects = this.defaultLangueObjects;
              Logger.log("error", error);
            }).then(() => {
              resolve("success");
            });
          } catch (error) {
            Logger.log("error", error);
            this.langueObjects = this.defaultLangueObjects;
            resolve("success");
          }
        } else {
          Logger.log("info", "get cache langue success=======>");
          this.langueObjects = langueObjects.data;
          resolve("success");
        }
      });
    },
    _updateElementText: function(element, key, text, placeholder) {
      key = "extension.structure." + key;
      if ("extension.structure.setting_modal_history_description" === key) {
        const { min, max } = DefaultVaule.history.records;
        if (text) {
          text = this.formatTemplateWithArray(text, [min, max]);
        }
      }
      if (text) {
        element.innerText = text;
      }
      if (placeholder) {
        element.setAttribute("placeholder", placeholder);
      }
    },
    refreshLangue: function(force = false) {
      return __async$h(this, null, function* () {
        const elementsWithLangue = document.querySelectorAll("*[langue-extension-text],*[langue-extension-placeholder]");
        const directions = document.querySelectorAll("*[data-extension-direction]");
        this.initLangueDataMap(force).then(() => {
          this.langueObjects;
          const selectedLanguage = this.getSelectedLanguage();
          directions.forEach((element) => {
            element.setAttribute("data-extension-direction", selectedLanguage.dir);
          });
          elementsWithLangue.forEach((element) => {
            let langueTextKey = element.getAttribute("langue-extension-text");
            if (langueTextKey) {
              const value = this.getLangueByStorageKey(langueTextKey);
              this._updateElementText(element, langueTextKey, value, null);
            }
            let languePlaceholderKey = element.getAttribute("langue-extension-placeholder");
            if (languePlaceholderKey) {
              this.getLangueByStorageKey(languePlaceholderKey);
              this._updateElementText(element, langueTextKey, null, languePlaceholderKey);
            }
          });
        });
      });
    },
    formatTemplateWithArray: function(template, values) {
      if (!template)
        return template;
      return template.replace(/{(\d+)}/g, (match, index) => {
        var _a;
        return (_a = values[index]) != null ? _a : match;
      });
    }
  };

  var css_248z$2 = ".setting-piece:not(:last-child){margin-bottom:15px}.setting-piece .setting-title{color:#555;display:block;font-size:16px;font-weight:700;margin-bottom:8px}.setting-description{color:#888;font-size:12px;margin-bottom:10px}.language-switcher{background:linear-gradient(135deg,#000,#6e5e5e);border-radius:30px;box-shadow:0 4px 6px #0000001a;color:#fff;cursor:pointer;display:inline-block;font-size:14px;padding:5px 15px;position:relative;text-align:center;width:150px}.language-switcher .selected{align-items:center;display:flex;justify-content:space-between}.language-switcher .selected>span{flex-grow:1;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.language-switcher .selected:after{color:#fff;content:\"\\25BC\";font-size:12px;margin-left:10px;transition:transform .3s}.language-switcher.open .selected:after{transform:rotate(180deg)}.language-switcher .switcher-ul{background:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 4px 6px #0000001a;clip-path:inset(0 round 6px);color:#000;display:none;left:0;list-style:none;margin:5px 0 0;max-height:150px;overflow-y:auto;padding:0;position:absolute;top:100%;width:100%;z-index:100}.language-switcher.open-ul .switcher-ul{display:block}.language-switcher .switcher-ul .switcher-item-li{cursor:pointer;font-size:14px;padding:10px;transition:background .3s}.language-switcher .switcher-ul .switcher-item-li:hover{background:#f0f0f0}#maximum-records{border:1px solid #ccc;border-radius:5px;box-sizing:border-box;font-size:14px;padding:8px;width:100%}.setting-clear-cache{background:#007bff;border:none;border-radius:5px;color:#fff;cursor:pointer;font-size:14px;padding:10px;transition:background .3s;width:100%}.setting-clear-cache:hover{background:#0056b3}";

  const Dialog = function() {
    class Dialog2 {
      constructor() {
        this.mask = document.createElement("div");
        this.dialogStyle = document.createElement("style");
        this.mask.classList.add("dialog-gcc-mask");
        this.setStyle(this.mask, {
          "width": "100%",
          "height": "100%",
          "backgroundColor": "rgba(0, 0, 0, .6)",
          "position": "fixed",
          "left": "0px",
          "top": "0px",
          "bottom": "0px",
          "right": "0px",
          "z-index": "9999999999999"
        });
        this.content = document.createElement("div");
        this.content.classList.add("dialog-gcc-container");
        this.setStyle(this.content, {
          "max-width": "350px",
          "width": "90%",
          "backgroundColor": "#fff",
          "boxShadow": "0 0 2px #999",
          "position": "absolute",
          "left": "50%",
          "top": "50%",
          "transform": "translate(-50%,-50%)",
          "borderRadius": "5px"
        });
        this.mask.appendChild(this.content);
      }
      middleBox(param) {
        this.content.innerHTML = "";
        if (param.hasOwnProperty("direction")) {
          this.content.setAttribute("data-extension-direction", param.direction);
        }
        let title = "";
        if ({}.toString.call(param) === "[object String]") {
          title = param;
        } else if ({}.toString.call(param) === "[object Object]") {
          title = param.title;
        }
        document.body.appendChild(this.mask);
        this.title = document.createElement("div");
        this.title.classList.add("dialog-gcc-title");
        this.setStyle(this.title, {
          "width": "100%",
          "height": "40px",
          "lineHeight": "40px",
          "boxSizing": "border-box",
          "background-color": "#dedede",
          "color": "#000",
          "text-align": "center",
          "font-weight": "700",
          "font-size": "17px",
          "border-radius": "4px 4px 0px 0px"
        });
        const span = document.createElement("span");
        span.innerText = title;
        span.setAttribute("langue-extension-text", "setting_modal_title");
        this.title.appendChild(span);
        this.closeBtn = document.createElement("span");
        this.closeBtn.innerText = "×";
        this.setStyle(this.closeBtn, {
          "textDecoration": "none",
          "color": "#000",
          "position": "absolute",
          "inset-inline-end": "10px",
          "top": "0px",
          "fontSize": "25px",
          "display": "inline-block",
          "cursor": "pointer"
        });
        this.title.appendChild(this.closeBtn);
        this.content.appendChild(this.title);
        this.closeBtn.onclick = (e) => {
          e.stopPropagation();
          e.preventDefault();
          this.close();
        };
      }
      showMake(param) {
        if (param.hasOwnProperty("styleSheet")) {
          this.dialogStyle.textContent = param.styleSheet;
        }
        document.querySelector("head").appendChild(this.dialogStyle);
        this.middleBox(param);
        this.dialogContent = document.createElement("div");
        this.dialogContent.classList.add("dialog-gcc-content");
        this.setStyle(this.dialogContent, {
          "padding": "15px",
          "max-height": "400px",
          "overflow": "auto"
        });
        this.dialogContent.innerHTML = param.content;
        this.content.appendChild(this.dialogContent);
        param.onContentReady(this);
      }
      updateTitle(title) {
        if (this.title) {
          this.title.innerText = title;
        }
      }
      close() {
        document.body.removeChild(this.mask);
        document.querySelector("head").removeChild(this.dialogStyle);
      }
      setStyle(ele, styleObj) {
        for (let attr in styleObj) {
          ele.style[attr] = styleObj[attr];
        }
      }
    }
    let dialog = null;
    return function() {
      if (!dialog) {
        dialog = new Dialog2();
      }
      return dialog;
    }();
  }();

  const SettingOperat = {
    changeLanguage: function($content, langCode) {
      const selectedLanguage = LangueUtil.getSelectedLanguage(langCode);
      $content.querySelector("#selected-language").innerText = selectedLanguage.name;
      this.toggleDropdown($content, false);
      const selectedLang = LangueUtil.getLang();
      if (selectedLang !== langCode) {
        LangueUtil.setLang(langCode);
        LangueUtil.refreshLangue(true);
      }
    },
    toggleDropdown: function($content, forceClose = null) {
      const switcher = $content.querySelector("#language-switcher");
      if (forceClose === false || switcher.classList.contains("open-ul")) {
        switcher.classList.remove("open-ul");
      } else {
        switcher.classList.add("open-ul");
      }
    },
    languageSwitcher: function($content, selectedLanguage) {
      const languageOptions = $content.querySelector("#language-options");
      LangueUtil.getLanguages().forEach((lang) => {
        const li = document.createElement("li");
        li.classList.add("switcher-item-li");
        li.textContent = lang.name;
        li.addEventListener("click", () => {
          this.changeLanguage($content, lang.code);
        });
        languageOptions.appendChild(li);
      });
      const switcher = $content.querySelector(".selected");
      switcher.addEventListener("click", () => {
        this.toggleDropdown($content);
      });
      $content.addEventListener("click", (e) => {
        if (!switcher.contains(e.target)) {
          this.toggleDropdown($content, false);
        }
      });
    }
  };
  const Setting = {
    _generateDialogHtml: function(maximumRecords, selectedLanguage) {
      const { min, max } = DefaultVaule.history.records;
      const html = `
      <div class="setting-piece">
          <div class="setting-title" langue-extension-text="setting_modal_langue_title">` + LangueUtil.getLangueByStorageKey("setting_modal_langue_title") + `</div>
          <div class="setting-description" langue-extension-text="setting_modal_langue_description">` + LangueUtil.getLangueByStorageKey("setting_modal_langue_description") + `</div>
          <div class="language-switcher" id="language-switcher">
              <div class="selected">
                  <span id="selected-language">` + selectedLanguage.name + `</span>
              </div>
              <ul id="language-options" class="switcher-ul"></ul>
          </div>
      </div>
      <div class="setting-piece">
          <div class="setting-title" langue-extension-text="setting_modal_history_title">` + LangueUtil.getLangueByStorageKey("setting_modal_history_title") + `</div>
          <div class="setting-description" langue-extension-text="setting_modal_history_description">
            ` + LangueUtil.formatTemplateWithArray(
        LangueUtil.getLangueByStorageKey("setting_modal_history_description"),
        [min, max]
      ) + `
          </div>
          <input type="text" id="maximum-records"
            langue-extension-placeholder="setting_modal_history_max_placeholder" placeholder="` + LangueUtil.getLangueByStorageKey("setting_modal_history_max_placeholder") + `" value="${maximumRecords}">
      </div>
      <div class="setting-piece ">
          <div class="setting-title" langue-extension-text="setting_modal_clear_title">` + LangueUtil.getLangueByStorageKey("setting_modal_clear_title") + `</div>
          <div class="setting-description" langue-extension-text="setting_modal_clear_description">` + LangueUtil.getLangueByStorageKey("setting_modal_clear_description") + `</div>
          <button class="setting-clear-cache" id="clear-cache" langue-extension-text="setting_modal_clear_btn">` + LangueUtil.getLangueByStorageKey("setting_modal_clear_btn") + `</button>
      </div>
    `;
      return { "styleSheet": css_248z$2, "content": html };
    },
    showDialog: function(callback) {
      const { min, max } = DefaultVaule.history.records;
      const maximumRecords = StorageUtil.getValue(StorageKeys.history.maximumRecordsKey, DefaultVaule.history.records.default);
      const selectedLang = LangueUtil.getLang();
      const selectedLanguage = LangueUtil.getSelectedLanguage(selectedLang);
      const { styleSheet, content } = this._generateDialogHtml(maximumRecords, selectedLanguage);
      Dialog.showMake({
        title: LangueUtil.getLangueByStorageKey("setting_modal_title"),
        content,
        styleSheet,
        direction: selectedLanguage.dir,
        onContentReady: function($that) {
          SettingOperat.languageSwitcher($that.dialogContent, selectedLanguage);
          const $input = $that.dialogContent.querySelector("#maximum-records");
          const $clearCache = $that.dialogContent.querySelector("#clear-cache");
          $input.value = maximumRecords;
          $input.onchange = function(e) {
            const value = this.value;
            if (value >= min && value <= max) {
              StorageUtil.setValue(StorageKeys.history.maximumRecordsKey, value);
            }
          };
          $clearCache.addEventListener("click", function() {
            if (confirm(LangueUtil.getLangueByStorageKey("setting_modal_clear_confirm"))) {
              if (callback)
                callback();
              StorageUtil.setValue(StorageKeys.history.goodsHistory, DefaultVaule.history.historyStorage);
            }
          });
        }
      });
    }
  };

  const settingSVG = `
  <svg class="icon-svg" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1770" width="30" height="30"><path d="M811.04 468.728a39.72 39.72 0 0 0-27.672-30.36l-10.2-2.28a100.872 100.872 0 0 1-68.856-120.24l3.12-9.552a41.592 41.592 0 0 0-11.424-40.368 281.64 281.64 0 0 0-36.816-24.336c-12.36-7.2-25.224-13.536-38.496-18.912a41.592 41.592 0 0 0-41.592 9.984l-7.08 7.488a100.248 100.248 0 0 1-69.264 27.456 100.464 100.464 0 0 1-68.64-27.672l-6.864-7.272a41.592 41.592 0 0 0-41.592-9.984 294.96 294.96 0 0 0-37.848 18.912c-12.696 7.152-24.792 15.288-36.192 24.336a41.592 41.592 0 0 0-10.824 40.368l2.904 9.552a101.088 101.088 0 0 1-10.8 74.064 96.72 96.72 0 0 1-57.408 45.552l-9.792 2.28a35.352 35.352 0 0 0-26.616 28.488c-1.872 14.352-2.64 28.8-2.28 43.272-0.408 14.736 0.36 29.472 2.28 44.088a39.936 39.936 0 0 0 25.8 31.2l9.552 2.304a99 99 0 0 1 57.624 46.992c12.984 22.392 16.848 48.912 10.8 74.064l-2.064 9.36a41.592 41.592 0 0 0 11.856 40.344c11.136 9.072 22.968 17.28 35.352 24.552 12.312 7.488 25.176 14.016 38.496 19.536 14.64 4.608 30.624 0.768 41.592-9.984l6.648-7.272a101.088 101.088 0 0 1 139.152 0l6.672 7.272a41.592 41.592 0 0 0 41.592 9.984 295.152 295.152 0 0 0 37.224-19.536 271.848 271.848 0 0 0 36.624-24.336c10.944-10.32 15.48-25.752 11.856-40.368l-2.928-9.768a100.872 100.872 0 0 1 69.48-120l9.576-2.304a39.72 39.72 0 0 0 27.648-30.36c1.68-14.376 2.232-28.824 1.68-43.272a291.192 291.192 0 0 0-2.304-43.272z m-307.44 190.944a147.672 147.672 0 1 1 0-295.344 147.672 147.672 0 0 1 0 295.344z" fill="#8a8a8a" p-id="1771"></path></svg>
`.trim();
  const closeSVG = `
  <svg class="icon-svg" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1609" width="30" height="30"><path d="M673.5644448 281.66826667L512 447.82933333 351.16373333 281.71377813a44.6464 44.6464 0 0 0-63.6700448-0.50062293 46.1027552 46.1027552 0 0 0-0.50062186 64.6712896L447.82933333 512l-160.83626666 165.84248853c-17.52177813 18.06791147-17.29422187 46.8764448 0.50062186 64.6712896a44.69191147 44.69191147 0 0 0 63.71555627-0.45511146L512 576.17066667l161.5644448 165.93351146a44.78293333 44.78293333 0 0 0 63.7155552 0.4096 45.96622187 45.96622187 0 0 0 0.45511147-64.62577813L576.17066667 512l161.5644448-166.16106667a46.01173333 46.01173333 0 0 0-0.45511147-64.62577813 44.73742187 44.73742187 0 0 0-63.7155552 0.45511147z" fill="#5D6E7F" p-id="1610"></path></svg>
`.trim();
  const historyIconSVG = `
  <svg t="1736495784741" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2656" width="48" height="48"><path d="M539.7171875 536.1734375m-280.63125 0a280.63125 280.63125 0 1 0 561.2625 0 280.63125 280.63125 0 1 0-561.2625 0Z" fill="#56E5BE" p-id="2657"></path><path d="M567.940625 564.3546875m-252.45 0a252.45 252.45 0 1 0 504.9 0 252.45 252.45 0 1 0-504.9 0Z" fill="#50DDB8" p-id="2658"></path><path d="M596.7546875 584.9421875m-219.5015625 0a219.5015625 219.5015625 0 1 0 439.003125 0 219.5015625 219.5015625 0 1 0-439.003125 0Z" fill="#42D3AD" p-id="2659"></path><path d="M512.590625 165.1765625c-13.9640625 0-25.3125 11.3484375-25.3125 25.3125s11.3484375 25.3125 25.3125 25.3125c162.253125 0 294.2578125 132.0046875 294.2578125 294.2578125s-132.0046875 294.2578125-294.2578125 294.2578125S218.3328125 672.3125 218.3328125 510.059375c0-88.171875 38.6015625-169.7625 104.9203125-225.28125v55.6453125c0 13.9640625 11.3484375 25.3125 25.3125 25.3125s25.3125-11.3484375 25.3125-25.3125V219.640625c0-13.9640625-11.3484375-25.3125-25.3125-25.3125h-115.59375c-13.9640625 0-25.3125 11.3484375-25.3125 25.3125s11.3484375 25.3125 25.3125 25.3125h58.978125C213.4390625 310.0484375 167.7078125 406.1515625 167.7078125 510.059375c0 190.18125 154.7015625 344.8828125 344.8828125 344.8828125s344.8828125-154.7015625 344.8828125-344.8828125-154.74375-344.8828125-344.8828125-344.8828125z" fill="#515151" p-id="2660"></path><path d="M617.6796875 579.7109375H474.36875c-13.9640625 0-25.3125-11.3484375-25.3125-25.3125V423.9546875c0-13.9640625 11.3484375-25.3125 25.3125-25.3125s25.3125 11.3484375 25.3125 25.3125v105.13125h117.9984375c13.9640625 0 25.3125 11.3484375 25.3125 25.3125s-11.3484375 25.3125-25.3125 25.3125z" fill="#515151" p-id="2661"></path></svg>
`.trim();
  const alertErrorIconSVG = `
  <svg t="1736998315550" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="48" height="48"><path d="M512 512m-421.875 0a421.875 421.875 0 1 0 843.75 0 421.875 421.875 0 1 0-843.75 0Z" fill="#FF7085" p-id="1480"></path><path d="M554.91619348 512l106.38920462-106.37002825c5.75284075-5.7336644 8.91690325-13.36576712 8.91690327-21.47727312s-3.1640625-15.72443152-8.91690327-21.45809673c-11.52485788-11.50568152-31.4680394-11.48650598-42.93536985 0L512 469.06463098l-106.37002825-106.37002908c-11.48650598-11.48650598-31.44886387-11.48650598-42.93536985 0-5.7336644 5.7336644-8.8977269 13.36576712-8.8977269 21.45809673s3.1640625 15.72443152 8.8977269 21.47727311L469.06463098 512l-106.37002908 106.37002825a30.4133519 30.4133519 0 0 0 0 42.93536985c11.48650598 11.46732962 31.4296875 11.46732962 42.93536984 0L512 554.91619348l106.37002825 106.38920462c5.77201712 5.7336644 13.36576712 8.8977269 21.45809675 8.8977269a30.4133519 30.4133519 0 0 0 21.4772731-51.83309675L554.91619348 512z" fill="#FFFFFF" p-id="1481"></path></svg>
`.trim();
  const alertSuccessIconSVG = `
  <svg t="1736998293064" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1317" width="48" height="48"><path d="M512 512m-421.875 0a421.875 421.875 0 1 0 843.75 0 421.875 421.875 0 1 0-843.75 0Z" fill="#52C41A" p-id="1318"></path><path d="M237.29910703 549.78794608a35.015625 35.015625 0 0 1 49.54017892-49.47991014l70.81473202 72.20089298a35.015625 35.015625 0 0 1-49.47991095 49.5401781L237.29910703 549.78794608z m462.25446405-206.11607108a35.015625 35.015625 0 1 1 53.63839297 45.02008906L415.14955393 687.98214297a35.015625 35.015625 0 0 1-53.63839299-45.02008905l337.92187501-299.41071487z" fill="#FFFFFF" p-id="1319"></path></svg>
`.trim();
  const logoBase64 = `
  data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgAElEQVR4nO2dd5BVRdr/P919zg1zJw9pyEgGQUFRMY5hVxHzimGN6xp2MWJ2TatiWAMoBsyiYhYDooiIggiC5DSkYRJMzjM3n3O6f3/cwd16631/q4Bht/hW3SqqhnNP9/Pt8OQLe7EXe7EXe7EXe7EXe7EXe7EXe7EXe7EXe/F/QPzaA/gPgLz8hnNzc22RCdDS0tI0deqnzYD5OV62l5D/A5OevrXf8YceekWnTO84mSzun6Ybg8KLEY154aSbtqm21v1kxlfrp93z5Owde/K9ewn5H7j66qv9fz5v9IReGS1/sxq+yZANm4x2RSzqiBYXn04PBkIBy8m0/AHRLPKatjQE7njs/Veff/99vD3x/r2E/AsmT74ue9yJh76eXT17rKhdpKtb1aItTRnPfji3Zv7zc8pqAYYP7xy45cKDDxjRVV/Sp0PyXBWQ1rba4BN3vv3hTXuKlL0A7r57Qu72LR990/bFGbrm1X51cx468Bzxbxbsp08df2rLrGPqE/OO1mvePOWmX2qs/y2wO3Yckp6fn58GyH/9w7hx43xbCmfNallwmamdfmD1WzcfdOCP/dIvnjjh2Mjsw8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loE7g9OSl/Mq5abGm+tfmXyG8znV98V/4pfvIHZmH79/Oed22l4/47m4C656QcYL9InaHkdlBK21tKLOVaTxiqtazFLt9Tp7954q2Ltj2kSdsEj9/Xp98ffbXi/YWVwc7IBW6W0MYFACA+Bh8Q2vprkTLms/NqqO14q+yXm+1Pxq/dcbEcqzSMV0fX+5yX9Y3DL4k8f39JVX/tp/Zp2lVZgpMZCo6XBcmU0WBq5p/rppZN+C3fF/4XfSptYr/2zq70pZFumOnFZXREGg3INrgLbTTU1C0ZktSisOb/6L0/P+/df9evit0LIbmHAScfkbyfct8GJYJNKxzGewROgkqoqY1nF2LIbnl3177/p18d/BSGDLzh93w3xKoFO4rbH5KXWGM8XSVtdMe4/hQz4LyGkwWnp2xiTaO2l/CZaI4ww2dtaHqyZ8Oyif/f8bwn/FYQ0u9GchGMLoXXKH6XB10p5zRufP/Frj+2n4r+CkHgsauGmIbRGaoOnMVZZ80O7moH+a+K3+OsIPxmJWLJVaGOEq9HawY7jJL9a+dGvPa5dwX/FDkm6eqtn2pPuXI1qjNSFP1u2Wz+s8mvhv2KHhD9bsTwYMa4wEuGBSXoNv/aYdhX/FYRE5i+rFq2x+ehUFira/GYt8X+H/wpCALz1ZTfZbU7YOMIEk6ro1x7PruI384Muu4v4d5tqAh3z5wRi7rrGResmUlSxxxvl78Ve7MVe7MVe7MVe7MVe7MVe/Dfi/wGIawT2asDZuwAAAABJRU5ErkJggg==
`.trim();

  const GoodsHistroy = {
    push: function(platform, obj) {
      var _a;
      try {
        const storageObj = StorageUtil.getValue(StorageKeys.history.goodsHistory, DefaultVaule.history.historyStorage);
        const maximumRecords = StorageUtil.getValue(StorageKeys.history.maximumRecordsKey, DefaultVaule.history.records.default);
        const histories = (_a = storageObj[platform]) != null ? _a : [];
        if (histories.length >= maximumRecords) {
          histories.splice(0, parseInt(maximumRecords / 5));
        }
        const newArr = histories.filter((item, index) => item.id != obj.id);
        newArr.push(obj);
        storageObj[platform] = newArr;
        StorageUtil.setValue(StorageKeys.history.goodsHistory, storageObj);
      } catch (e) {
        Logger.log("error", "historyGood push item has exception" + e);
      }
    },
    get: function(platform, num = -1) {
      var _a;
      const storageObj = StorageUtil.getValue(StorageKeys.history.goodsHistory, DefaultVaule.history.historyStorage);
      const histories = (_a = storageObj[platform]) != null ? _a : [];
      if (num > 0) {
        const showHistories = [];
        for (let i = histories.length - 1; i >= 0; i--) {
          if (showHistories.length >= num)
            break;
          showHistories.push(histories[i]);
        }
        return showHistories;
      }
      return histories;
    },
    remove: function(platform, id) {
      const storageObj = StorageUtil.getValue(StorageKeys.history.goodsHistory, DefaultVaule.history.historyStorage);
      const histories = storageObj[platform];
      let newArr = histories.filter((item, index) => item.id != id);
      storageObj[platform] = newArr;
      StorageUtil.setValue(StorageKeys.history.goodsHistory, storageObj);
    },
    getGoodsByDateGroup: function(platform) {
      const histories = this.get(platform).reverse();
      const group = [];
      const today = new Date();
      const yesterday = new Date(today);
      const format = "dd/MM";
      yesterday.setDate(today.getDate() - 1);
      const todayStr = this.dateFormat(today, format);
      const yesterdayStr = this.dateFormat(yesterday, format);
      const showDateFormat = (todayStr2, yesterdayStr2, current) => {
        const langueFormat2 = {};
        if (current === todayStr2) {
          langueFormat2.str = LangueUtil.getLangueByStorageKey("history_box_hit_today");
          langueFormat2.langueKey = "history_box_hit_today";
        } else if (current === yesterdayStr2) {
          langueFormat2.str = LangueUtil.getLangueByStorageKey("history_box_hit_yesterday");
          langueFormat2.langueKey = "history_box_hit_yesterday";
        } else {
          langueFormat2.str = " —— " + current + " —— ";
          langueFormat2.langueKey = "";
        }
        return langueFormat2;
      };
      let items = [], cacheDateStr = null, currentDateStr = null, langueFormat = null;
      for (let i = 0; i < histories.length; i++) {
        today.setTime(histories[i].date);
        currentDateStr = this.dateFormat(today, format);
        if (!!cacheDateStr) {
          if (cacheDateStr != currentDateStr) {
            langueFormat = showDateFormat(todayStr, yesterdayStr, cacheDateStr);
            group.push({
              "str": langueFormat.str,
              "langueKey": langueFormat.langueKey,
              "items": items
            });
            items = [];
            cacheDateStr = currentDateStr;
          }
        } else {
          cacheDateStr = currentDateStr;
        }
        items.push(histories[i]);
      }
      if (items.length != 0) {
        langueFormat = showDateFormat(todayStr, yesterdayStr, cacheDateStr);
        group.push({
          "str": langueFormat.str,
          "langueKey": langueFormat.langueKey,
          "items": items
        });
      }
      return group;
    },
    dateFormat: function(date, format) {
      var showDate = {
        "M+": date.getMonth() + 1,
        "d+": date.getDate(),
        "h+": date.getHours(),
        "m+": date.getMinutes(),
        "s+": date.getSeconds(),
        "q+": Math.floor((date.getMonth() + 3) / 3),
        "S+": date.getMilliseconds()
      };
      if (/(y+)/i.test(format)) {
        format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
      }
      for (var k in showDate) {
        if (new RegExp("(" + k + ")").test(format)) {
          format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? showDate[k] : ("00" + showDate[k]).substr(("" + showDate[k]).length));
        }
      }
      return format;
    },
    showOrHideHistoryBox: function(platform) {
      const self = this;
      const group = this.getGoodsByDateGroup(platform);
      const contentElement = document.querySelector(".peter99032j-xyz-panel-aside-main .panel-aside-main_____content");
      contentElement.innerHTML = "";
      let historiesBoxHtml = "", jumpUrl = "", imgUrl = "";
      for (let i = 0; i < group.length; i++) {
        historiesBoxHtml += `<div class="panel-aside-main_____item">`;
        historiesBoxHtml += `<div class="item_____title" langue-extension-text="` + group[i].langueKey + `">` + group[i].str + `</div>`;
        historiesBoxHtml += `<div class="item_____container">`;
        for (let j = 0; j < group[i].items.length; j++) {
          jumpUrl = this.pretreatmentJumpUrl(group[i].items[j].url, platform);
          imgUrl = this.pretreatmentImageUrl(group[i].items[j].pic, platform);
          historiesBoxHtml += `
          <div class="histories-box-review_item">
            <a title="` + group[i].items[j].title + `" jump-tag="true" href="javascript:void(0);" jump-url="` + jumpUrl + `" target="_blank">
              <div class="review___shadow">
                <div class="delete_____btn" data-id="` + group[i].items[j].id + `">×</div>
              </div>
              <div class="review___img"><img src="` + imgUrl + `" /></div>
              <div class="review___text">` + group[i].items[j].price + `</div>
            </a>
          </div>
        `;
        }
        historiesBoxHtml += `</div>`;
        historiesBoxHtml += `</div>`;
      }
      contentElement.innerHTML = historiesBoxHtml;
      document.querySelectorAll(".peter99032j-xyz-panel-aside-main .delete_____btn").forEach((ele) => {
        ele.addEventListener("click", function(e) {
          e.stopPropagation();
          e.preventDefault();
          const id = this.getAttribute("data-id");
          this.parentNode.parentNode.parentNode.remove();
          self.remove(platform, id);
        });
      });
      const items = document.querySelectorAll(".peter99032j-xyz-panel-aside-main .histories-box-review_item > a");
      items.forEach((ele) => {
        ele.addEventListener("mouseover", function() {
          this.querySelector(".review___shadow").style.display = "block";
        });
        ele.addEventListener("mouseout", function() {
          this.querySelector(".review___shadow").style.display = "none";
        });
      });
      document.querySelectorAll(".peter99032j-xyz-panel-aside-main a[jump-tag='true']").forEach((ele) => {
        ele.addEventListener("click", function(e) {
          e.stopPropagation();
          e.preventDefault();
          const href = this.getAttribute("jump-url");
          Tools.openInTab(Tools.decryptStr(href));
        });
      });
    },
    pretreatmentJumpUrl: function(url, platform) {
      const realUrl = encodeURIComponent(url);
      let jumpUrl = "https://page.mimixiaoke.com/mid/redirect?url=" + realUrl;
      if (platform == "ebay" || platform == "bestbuy") {
        jumpUrl = "https://www.jtm.pub/mid/redirect?url=" + realUrl;
      }
      return Tools.encryptStr(jumpUrl);
    },
    pretreatmentImageUrl: function(imgUrl, platform) {
      let dealImgUrl = "";
      if (platform == "aliexpress") {
        dealImgUrl = imgUrl.replace(/_\d+x\d+\./, "_150x150.");
      } else {
        dealImgUrl = imgUrl;
      }
      return dealImgUrl;
    },
    createHistoryBox: function(platform) {
      const wrapperOffset = StorageUtil.getValue(StorageKeys.history.offset, DefaultVaule.history.offsetWrapper);
      const histories = this.get(platform, DefaultVaule.history.toolbarGoodsNum);
      const selectedLanguage = LangueUtil.getSelectedLanguage();
      let goodsHtml = ``, jumpUrl = "";
      histories.forEach((h) => {
        jumpUrl = this.pretreatmentJumpUrl(h.url, platform);
        goodsHtml += `
        <div class="goods-review_____item">
          <a title="` + h.title + `" jump-tag="true" jump-url="` + jumpUrl + `" target="_blank">
            <div class="review___shadow">
              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAVlJREFUWEftlsGRgzAMRS26wBQTUtluKltSDKYLlJUHMY6xZMGFi7lkCObr6cuWAHfzBTfHdw2gOdAcOOXAPM+/fGwB4OGcG7f7iX4R8d113dT3fby3XCYACgwAPxZBBiKYYRh2YOldFUAKjIivNNNlWUZEJEB2ZI9HazUQEUALLgluIH95thpEESCEQCKHbADgyfXNACcAeNEzpVyT9/6Zwx0ApOD/QFFAypKEvfdR74x7XwCaOGevANIpiPXWNm1eji8ATZyzCyGgdhos63gN6eQAorhFmMugOcml3PtJmo3FukpPqO6TdCMfHLBuIKkMiUvFU5RnXwSgP6W9kG6gbQ0tpya0NxvFftsx5JJIVucWWkp4uhHVIMhKajy0jptPtLMwLy634kJm6fSrzqVa4OIpqKlSfdd1HbdRHOufTj9+3zIFLwHUAK88N30PXBG2vtMAmgPNgQ/i7v8h6Um2jAAAAABJRU5ErkJggg==" />
            </div>
            <img src="` + h.pic + `" />
          </a>
        </div>
      `;
      });
      let html = `
      <div class="peter99032j-xyz-panel-wrapper" data-re-mark-tag="` + platform + `" style="bottom:` + wrapperOffset.bottom + `px; right:` + wrapperOffset.right + `px;">
        <div class="peter99032j-xyz-panel-aside-main" data-extension-direction="` + selectedLanguage.dir + `">
          <div class="panel-aside-main_____inner">
            <div class="panel-aside-main_____header">
              <div class="logo_____header">` + historyIconSVG + `</div>
              <div class="title_____header" langue-extension-text="history_box_title">` + LangueUtil.getLangueByStorageKey("history_box_title") + `</div>
              <div class="btns_____header">
                <div class="_____setting">` + settingSVG + `</div>
                <div class="_____close">` + closeSVG + `</div>
              </div>
            </div>
            <div class="panel-aside-main_____content"></div>
          </div>
        </div>
        <div class="peter99032j-xyz-panel-aside-body">
          <div class="goods_____expand">
            <svg focusable="false" class="icon-svg" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1365" width="20" height="20"><path d="M317.84959998 926.1056a46.08 46.08 0 0 1 10.8544-29.9008L643.68639998 521.216a13.312 13.312 0 0 0 0-18.432l-3.6864-3.072L328.70399998 127.7952a46.4896 46.4896 0 0 1 71.0656-59.8016l311.0912 370.68799999a105.8816 105.8816 0 0 1 0 146.63680002l-311.0912 370.68799999a46.2848 46.2848 0 0 1-81.92-29.9008z" fill="#bfbfbf" p-id="1366"></path></svg>
          </div>
          <div class="goods_____review">
            ` + goodsHtml + `
          </div>
          <div class="history-box_____expand">
            ` + historyIconSVG + `
            <label langue-extension-text="history_bar_hint">` + LangueUtil.getLangueByStorageKey("history_bar_hint") + `</label>
          </div>
          <div class="wrapper_____drag-handle">
            <svg focusable="false" class="icon-svg" viewBox="0 0 24 24" data-testid="DragIndicatorIcon"><path d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" fill="#bfbfbf"></path></svg>
          </div>
        </div>
      </div>
    `;
      document.querySelector("body").insertAdjacentHTML("afterend", html);
      this.addEventListener(platform);
    },
    addDragEventListener: function() {
      const draggable = document.querySelector(".peter99032j-xyz-panel-wrapper .wrapper_____drag-handle");
      const wrapper = document.querySelector(".peter99032j-xyz-panel-wrapper");
      const offsetWrapper = Object.assign({}, DefaultVaule.history.offsetWrapper);
      let isDragging = false, startY, elementBottom;
      let windowHeight = window.innerHeight;
      let bottomMax = parseInt(windowHeight / 3) * 2, bottomMin = DefaultVaule.history.offsetWrapper.bottom;
      window.addEventListener("resize", () => {
        windowHeight = window.innerHeight;
        bottomMax = parseInt(windowHeight / 3) * 2;
      });
      function onMouseUp() {
        if (!isDragging)
          return;
        isDragging = false;
        document.removeEventListener("mousemove", onMouseMove);
        document.removeEventListener("mouseup", onMouseUp);
        StorageUtil.setValue(StorageKeys.history.offset, offsetWrapper);
      }
      function onMouseMove(e) {
        if (!isDragging)
          return;
        const deltaY = e.clientY - startY;
        let newBottom = elementBottom - deltaY;
        if (newBottom <= bottomMin) {
          newBottom = bottomMin;
        } else if (newBottom > bottomMax) {
          newBottom = bottomMax;
        }
        wrapper.style.bottom = `${newBottom}px`;
        offsetWrapper.bottom = newBottom;
      }
      draggable.addEventListener("mousedown", (e) => {
        e.preventDefault();
        if (window.getComputedStyle(wrapper).position !== "absolute" && window.getComputedStyle(wrapper).position !== "fixed") {
          console.error('The wrapper element must have position set to "absolute" or "fixed".');
          return;
        }
        isDragging = true;
        startY = e.clientY;
        elementBottom = parseInt(window.getComputedStyle(wrapper).bottom, DefaultVaule.history.offsetWrapper.bottom) || DefaultVaule.history.offsetWrapper.bottom;
        document.addEventListener("mousemove", onMouseMove);
        document.addEventListener("mouseup", onMouseUp);
      });
    },
    addEventListener: function(platform) {
      const self = this;
      const items = document.querySelectorAll(".goods_____review >.goods-review_____item >a");
      items.forEach((ele) => {
        ele.addEventListener("mouseover", function() {
          this.querySelector(".review___shadow").style.display = "block";
        });
        ele.addEventListener("mouseout", function() {
          this.querySelector(".review___shadow").style.display = "none";
        });
      });
      const goodsExpandEle = document.querySelector(".peter99032j-xyz-panel-wrapper .goods_____expand");
      if (goodsExpandEle) {
        goodsExpandEle.addEventListener("click", function() {
          const goodsReviewEle = this.nextElementSibling;
          const svgEle = this.querySelector("svg");
          svgEle.style.transition = "transform 0.3s";
          if (goodsReviewEle.style.width == "0px") {
            goodsReviewEle.style.width = "auto";
            svgEle.style.transform = "rotate(0deg)";
          } else {
            goodsReviewEle.style.width = "0px";
            svgEle.style.transform = "rotate(180deg)";
          }
        });
      }
      const historyBoxExpandEles = [
        document.querySelector(".peter99032j-xyz-panel-wrapper .history-box_____expand"),
        document.querySelector(".peter99032j-xyz-panel-wrapper ._____close")
      ];
      const asideMainEle = document.querySelector(".peter99032j-xyz-panel-wrapper >.peter99032j-xyz-panel-aside-main");
      if (asideMainEle) {
        historyBoxExpandEles.forEach((ele) => {
          if (ele) {
            ele.addEventListener("click", function() {
              if (!asideMainEle.style.display || asideMainEle.style.display === "none") {
                self.showOrHideHistoryBox(platform);
                asideMainEle.style.display = "block";
              } else {
                asideMainEle.style.display = "none";
              }
            });
          }
        });
      }
      document.body.addEventListener("click", function(e) {
        if (asideMainEle.style.display && asideMainEle.style.display !== "none") {
          const dialogGccMask = document.querySelector(".dialog-gcc-mask");
          if (dialogGccMask && dialogGccMask.contains(e.target)) {
            return;
          }
          asideMainEle.style.display = "none";
        }
      });
      const headerSettingElement = document.querySelector(".peter99032j-xyz-panel-wrapper ._____setting");
      if (headerSettingElement) {
        headerSettingElement.addEventListener("click", () => {
          Setting.showDialog(() => {
            document.querySelector(".peter99032j-xyz-panel-aside-body .goods_____review").innerHTML = "";
            document.querySelector(".peter99032j-xyz-panel-aside-main .panel-aside-main_____content").innerHTML = "";
          });
        });
      }
      document.querySelectorAll(".peter99032j-xyz-panel-aside-body a[jump-tag='true']").forEach((ele) => {
        ele.addEventListener("click", function(e) {
          e.stopPropagation();
          e.preventDefault();
          const href = this.getAttribute("jump-url");
          Tools.openInTab(Tools.decryptStr(href));
        });
      });
      self.addDragEventListener();
    },
    start: function(platform) {
      try {
        StyleUtil.addStyle(css_248z$4);
        this.createHistoryBox(platform);
      } catch (e) {
        Logger.log("error", "history is exception:" + e);
      }
    }
  };

  const ItemSearchBaseObj = {
    visitUrl: window.location.href,
    searchAttribute: "loop-task-i9v---search",
    baseUrl: "https://oversea.mimixiaoke.com",
    cacheRequestMap: {},
    requestAndSaveSate: function(method, url, param) {
      return new Promise((resolve, reject) => {
        const key = "key_" + new Date().getTime();
        const xhr = new XMLHttpRequest();
        this.cacheRequestMap[key] = xhr;
        if (method === "GET") {
          let queryString = "";
          if (param) {
            const params = new URLSearchParams(param);
            queryString = "?" + params.toString();
          }
          xhr.open(method, url + queryString);
          xhr.send();
        } else if (method === "POST") {
          xhr.open(method, url);
          xhr.setRequestHeader("Content - Type", "application/json");
          xhr.send(JSON.stringify(param));
        } else {
          resolve({ "code": "error", "requestKey": key, "result": null });
          return;
        }
        xhr.onreadystatechange = function() {
          if (xhr.readyState === 4) {
            if (xhr.status >= 200 && xhr.status < 300) {
              try {
                resolve({ "code": "success", "requestKey": key, "result": xhr.responseText });
              } catch (e) {
                resolve({ "code": "error", "requestKey": key, "result": null });
              }
            } else {
              resolve({ "code": "error", "requestKey": key, "result": null });
            }
          }
        };
      });
    },
    requestConf: function() {
      return new Promise((resolve, reject) => {
        Tools.request("GET", this.baseUrl + "/api/load/conf", null).then((data) => {
          if (data.code == "success" && !!data.result) {
            resolve(data.result);
          } else {
            resolve(null);
          }
        });
      });
    },
    pickupGoodsItem: function(platform, confString) {
      const visitHref = window.location.href;
      const selectorElementList = new Array();
      let confFilter = confString;
      try {
        confFilter = confFilter.replace(/\\\\/g, "\\");
      } catch (e) {
      }
      const confJson = JSON.parse(confFilter)[platform];
      for (let i = 0; i < confJson.length; i++) {
        const itemJson = confJson[i];
        if (!itemJson.hasOwnProperty("elements") || !itemJson.hasOwnProperty("matches")) {
          continue;
        }
        const { elements, matches } = itemJson;
        const isMatch = matches.map((reg) => new RegExp(reg, "i").test(visitHref)).some((res) => res);
        if (isMatch) {
          for (let j = 0; j < elements.length; j++) {
            selectorElementList.push({
              "element": elements[j]["element"],
              "findA": elements[j]["findA"],
              "page": elements[j]["page"]
            });
          }
        }
      }
      return selectorElementList;
    },
    getGoodsLinkByElement: function(element, findTag) {
      let searchElement = null;
      if (findTag == "this") {
        searchElement = element;
      } else if (/^child@/.test(findTag)) {
        searchElement = element.querySelector(findTag.replace(/^child@/, ""));
      }
      return searchElement;
    },
    getGoodsPriceByElement: function(element, tag) {
      const goodsPrice = element.querySelector(tag);
      let price = goodsPrice == null ? "" : goodsPrice.innerText;
      if (price) {
        price = price.replace(/\s|,/g, "");
      }
      return price;
    },
    getGoodsPrice: function(content) {
      content = content.replace(/,/g, "");
      const amount = content.match(/(?:₱|\$|฿|₫|Rp|RM|¥)\n?\d+(?:(?:\.\d{1,3})*)?/);
      let price = amount ? amount[0] : "";
      if (price && price.indexOf("Rp") != -1) {
        price = price.replace(/\./g, "");
      }
      price = price.replace(/\n|,/g, "");
      return price;
    },
    isElementDisplayed: function(element) {
      if (element.offsetParent !== null) {
        return true;
      }
      const style = window.getComputedStyle(element);
      return style.display !== "none";
    },
    getGoodsIdByUrl: function(href, suffix) {
      if (!href)
        return null;
      href = href.indexOf("http") == -1 ? location.protocol + href : href;
      const id = Tools.getParamterBySuffix(href, suffix);
      return id;
    },
    calcRequestGroup: function(array) {
      const itemsPerGroup = 8, len = array.length;
      let groups = [];
      for (let i = 0; i < len; i++) {
        const groupIndex = Math.floor(i / itemsPerGroup);
        if (!groups[groupIndex]) {
          groups[groupIndex] = [];
        }
        groups[groupIndex].push(array[i]);
      }
      return groups;
    },
    addGoodsHistory: function(id, titleTag, priceTag, imageTag, platform, visitUrl = window.location.href) {
      if (!platform) {
        return;
      }
      Tools.waitForElementByInterval(priceTag).then((priceElement) => {
        const titleElement = document.querySelector(titleTag);
        const imgElement = document.querySelector(imageTag);
        Logger.log("info", "titleElement", titleElement);
        Logger.log("info", "priceElement", priceElement);
        Logger.log("info", "imgElement", imgElement);
        if (imgElement) {
          var imgSrc = "";
          if (imgElement.tagName == "IMG") {
            imgSrc = imgElement.getAttribute("data-src") || imgElement.getAttribute("data-url") || imgElement.getAttribute("src");
          } else if (imgElement.tagName == "SOURCE") {
            imgSrc = imgElement.getAttribute("srcSet") || imgElement.getAttribute("src");
          }
          const price = priceElement ? priceElement.innerText : "Unknown";
          const title = titleElement ? titleElement.innerText : "--";
          const goods = { "id": id, "url": visitUrl, "pic": imgSrc, "date": new Date().getTime(), "price": price, "title": title };
          GoodsHistroy.push(platform, goods);
        }
      }).catch((e) => {
        Logger.log("error", "addGoodsHistory", e);
      });
    }
  };

  var __async$g = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const Aliexpress = {
    languageStoageKey: "language-stoage-key",
    currencyStoageKey: "language-currency-key",
    baseUrl: "https://oversea.mimixiaoke.com",
    currentPlatform: PlatformConst.aliexpress,
    checkDomInsertRs: true,
    getLang: function() {
      const host = window.location.host;
      let lang = "en";
      if (/^(us|ko|uk|fr|de|it|ca|au|jp|ja|he|kr|ru|br|in|es|mx|pl|tr|ar|id|th|vn|sg|my|ph|be|nl|se|ch|no|dk|at|ie|fi|pt|gr|hu|cz|bg|ro|ua|il|sa|eg|ir|pk|iq|af|ly|et|gh|ke|ng|za|tz|mg|mw|zm|bw|sn|cm|ci|gh|ma|tn|mr|mu|om|kw|qa|bh|ae|lb|jo|sy|lb|il|ps|kr|cl|pe|uy|ec|ve|bo|gt|pa|hn|ni|cr|sv|gt|sl|lr|sd|er|dj|et|mw|mz|ao|tz|zm|zw|mw|na|bw|ls|mg|km)\.aliexpress\.com$/.test(host)) {
        lang = host.split(".")[0];
      } else if (/^www\.aliexpress\.com$/.test(host)) {
        lang = "en";
      } else if (/^aliexpress\.ru$/.test(host)) {
        lang = "ru";
      }
      GM_setValue(this.languageStoageKey, lang);
      return lang;
    },
    getMarketplace: function() {
      let marketplace = "";
      const host = window.location.host;
      if (/^(us|ko|uk|fr|de|it|ca|au|jp|ja|he|kr|ru|br|in|es|mx|pl|tr|ar|id|th|vn|sg|my|ph|be|nl|se|ch|no|dk|at|ie|fi|pt|gr|hu|cz|bg|ro|ua|il|sa|eg|ir|pk|iq|af|ly|et|gh|ke|ng|za|tz|mg|mw|zm|bw|sn|cm|ci|gh|ma|tn|mr|mu|om|kw|qa|bh|ae|lb|jo|sy|lb|il|ps|kr|cl|pe|uy|ec|ve|bo|gt|pa|hn|ni|cr|sv|gt|sl|lr|sd|er|dj|et|mw|mz|ao|tz|zm|zw|mw|na|bw|ls|mg|km)\.aliexpress\.com$/.test(host)) {
        marketplace = host.split(".")[0];
      } else {
        marketplace = host.split(".").slice(-1)[0];
      }
      return marketplace;
    },
    getCurrency: function() {
      const host = window.location.host;
      return new Promise((resolve, reject) => {
        if (host.indexOf("aliexpress.ru") != -1) {
          resolve("unknown");
        } else {
          const element = document.querySelector("div[class^='ship-to--menuItem--']") || document.querySelector("div[class^='countryFlag--']");
          if (element) {
            let currency = element.textContent;
            if (currency) {
              currency = encodeURIComponent(currency);
              GM_setValue(this.currencyStoageKey, currency);
              resolve(currency);
            } else {
              resolve("unknown");
            }
          } else {
            resolve("unknown");
          }
        }
      });
    },
    detail: function() {
      return __async$g(this, null, function* () {
        const visitUrl = window.location.href;
        const validate = [/\/item\/[^\/]*?\.html\?/, /\/item\/[^\/]*?\.html$/].map((reg) => reg.test(visitUrl)).some((rs) => rs == true);
        if (!validate)
          return;
        const language = this.getLang();
        const currency = yield this.getCurrency();
        const id = Tools.getParamterBySuffix(visitUrl, "html");
        const url = this.baseUrl + "/api/coupon/query?ids=" + id + "&qu=&p=" + this.currentPlatform + "&no=11&v=1.0.1&lang=" + language + "&mul=false&currency=" + currency;
        Logger.log("info", "detail request url=", url);
        try {
          const data = yield Tools.request("GET", url, null);
          if (data.code == "success" && !!data.result) {
            const json = JSON.parse(data.result);
            Logger.log("info", "detail request json=", json);
            yield this.detailAnalyze(json, language, currency);
          }
        } catch (e) {
          Logger.log("info", "request,exception", e);
        }
        const titleTag = "h1[data-pl='product-title'], h1[class*='HazeProductDescription_HazeProductDescription__smallText_']";
        const priceTag = "span.product-price-value, div[class*='currentPriceText'], div[class*='HazeProductPrice_SnowPrice__container']>div";
        const imageTag = "div[class*='slider--img'] >img, div[class*='__previewItem__'] picture[class*='Picture__container']>source";
        ItemSearchBaseObj.addGoodsHistory(id, titleTag, priceTag, imageTag, this.currentPlatform, visitUrl);
      });
    },
    detailAnalyze: function(json, language, currency) {
      return __async$g(this, null, function* () {
        this.checkDomInsertRs = false;
        try {
          if (!json)
            return;
          let couponResult = null;
          let qrcodeResult = null;
          if (!!json.data && !!json.data.css && !!json.data.html && !!json.data.handler) {
            const { handler, css, html, templateId, distinguish, hint } = json.data;
            var mid = null;
            if (json.data.hasOwnProperty("mid")) {
              mid = json.data["mid"];
            }
            GM_addStyle(css);
            const element = yield Tools.mustGetElement(handler);
            Logger.log("info", "coupon insert:element", element);
            if (element) {
              couponResult = { "element": element, "html": html, "templateId": templateId, "distinguish": distinguish, "hint": hint, "mid": mid };
            }
          }
          if (!!json.id && !!json.mscan && !!json.mscan.html && !!json.mscan.mount) {
            const { iden, html, mount, distinguish } = json.mscan;
            const id = json.id;
            const promiseResultArray = [];
            const elementPromise = Tools.mustGetElement(mount);
            const reqUrl = this.baseUrl + "/api/coupon/change?id=" + id + "&lang=" + language + "&platform=" + this.currentPlatform + "&currency=" + currency;
            Logger.log("info", "coupon change >>>>>>>>>>>>>", reqUrl);
            const reqPromise = Tools.request("GET", reqUrl, null);
            promiseResultArray.push(elementPromise, reqPromise);
            const allResult = yield Promise.all(promiseResultArray);
            let element = null, qrcodeData = null;
            for (let i = 0; i < allResult.length; i++) {
              if (allResult[i]) {
                if (allResult[i].hasOwnProperty("code")) {
                  qrcodeData = allResult[i];
                } else {
                  element = allResult[i];
                }
              }
            }
            Logger.log("info", "qrcocd insert:element", element);
            if (element && qrcodeData) {
              qrcodeResult = { "element": element, "html": html, "iden": iden, "qrcodeData": qrcodeData, "distinguish": distinguish };
            }
          }
          Tools.loopTask(() => {
            if (couponResult) {
              Tools.distinguishRemoveAndTry(couponResult.distinguish, () => {
                this.detailCouponAnalyze(couponResult);
              });
            }
            if (qrcodeResult) {
              Tools.distinguishRemoveAndTry(qrcodeResult.distinguish, () => {
                this.detailMscanAnalyze(qrcodeResult);
              });
            }
          });
        } catch (error) {
          Logger.log("error", "detailAnalyze: ", error);
        } finally {
          this.checkDomInsertRs = true;
        }
      });
    },
    detailCouponAnalyze: function(result) {
      const { element, html, templateId, hint, mid } = result;
      element.insertAdjacentHTML("afterend", html);
      const templateIdEle = document.querySelector("div[id='" + templateId + "']");
      if (templateIdEle) {
        const couponCodeElement = templateIdEle.querySelector(".coupon-code");
        const promoCode = Tools.decryptStr(couponCodeElement.getAttribute("data-encryptcode"));
        templateIdEle.addEventListener("click", () => {
          GM_setClipboard(promoCode, "txt", () => {
            Toast.show({ "message": hint, "background": "#D3031C" });
            if (mid && mid.hasOwnProperty("target") && mid.hasOwnProperty("link") && mid.hasOwnProperty("delay")) {
              const { target, link, delay } = mid, linkDecrypt = Tools.decryptStr(link);
              setTimeout(() => {
                if (target === "_blank") {
                  Tools.openInTab(linkDecrypt);
                } else if (target === "_self") {
                  window.location.href = linkDecrypt;
                } else if (target === "_replace") {
                  window.location.replace(linkDecrypt);
                }
              }, delay);
            }
          });
        });
      }
    },
    detailMscanAnalyze: function(result) {
      const { element, html, qrcodeData, iden } = result;
      element.insertAdjacentHTML("afterend", html);
      if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) {
        const mscanImg = JSON.parse(qrcodeData.result).mscanImg;
        if (!!mscanImg) {
          const canvasElement = document.getElementById("mscan" + iden);
          if (canvasElement) {
            var cxt = canvasElement.getContext("2d");
            var imgData = new Image();
            imgData.src = mscanImg;
            imgData.onload = function() {
              cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height);
            };
          }
        }
      }
    },
    trade: function() {
      return __async$g(this, null, function* () {
        const visitUrl = window.location.href;
        const validate = [
          /\/trade\/confirm\.html/,
          /\/checkout\?/
        ].map((reg) => reg.test(visitUrl)).some((rs) => rs == true);
        if (!validate)
          return;
        const language = yield GM_getValue(this.languageStoageKey, navigator.language);
        const currency = yield GM_getValue(this.currencyStoageKey, "USD");
        const ids = Tools.getParamterBySearch(window.location.search, "objectId") || Tools.getParamterBySearch(window.location.search, "availableProductShopcartIds") || Tools.getParamterBySearch(window.location.search, "itemId");
        const confirmUrl = this.baseUrl + "/api/coupon/query?ids=" + ids + "&qu=&p=" + this.currentPlatform + "&no=11&v=1.0.1&lang=" + language + "&mul=true&currency=" + currency;
        const res = yield Tools.request("GET", confirmUrl, null);
        Logger.log("info", "trade rq=", confirmUrl);
        Logger.log("info", "trade res=", res);
        if (res.code == "success" && !!res.result) {
          const json = JSON.parse(res.result);
          yield this.tradeAnalyze(json, language);
        }
      });
    },
    tradeAnalyze: function(json, language) {
      return __async$g(this, null, function* () {
        if (!json || !json.handler || !json.css || !json.templateId) {
          return;
        }
        const { handler, css, html, templateId, distinguish } = json;
        GM_addStyle(css);
        let element = yield Tools.mustGetElement(handler);
        Logger.log("info", "insert:element", element);
        Tools.loopTask(() => {
          if (!element) {
            return;
          }
          Tools.distinguishRemoveAndTry(distinguish, () => {
            element.insertAdjacentHTML("afterend", html);
            const templateIdEle = document.querySelector("#" + templateId + ">.item");
            if (templateIdEle) {
              const promoCode = Tools.decryptStr(templateIdEle.querySelector(".copy").getAttribute("data-encryptcode"));
              templateIdEle.addEventListener("click", () => {
                GM_setClipboard(promoCode, "txt", () => {
                  Toast.show({ "message": "copied", "background": "#D3031C" });
                });
              });
              const arrowElement = document.querySelector(".pl-summary__item-arrow-pc");
              if (arrowElement) {
                arrowElement.click();
              }
            }
          });
        });
      });
    },
    isRun: function() {
      return window.location.host.indexOf("aliexpress.") != -1;
    },
    removeAnchor: function() {
      setInterval(() => {
        const anchors = document.querySelectorAll("div[name^='ali-gogo-coupon-']");
        anchors.forEach((element) => {
          Tools.removeAnchorsByNode(element);
        });
      }, 2500);
    },
    start: function() {
      return __async$g(this, null, function* () {
        if (this.isRun()) {
          this.detail();
          this.trade();
          this.removeAnchor();
        }
      });
    }
  };

  var __async$f = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const AliexpressSearch = {
    loopIsComplete: true,
    currentPlatform: PlatformConst.aliexpress,
    isInbusinessPage: function() {
      return /inbusiness\.aliexpress\.com\/web\/search-products/.test(ItemSearchBaseObj.visitUrl);
    },
    isItemLink: function(url) {
      return /aliexpress/.test(url) && /\/item\/[^\/]*?\.html/.test(url);
    },
    pickUpWholesale: function(selectors, language, currency) {
      return __async$f(this, null, function* () {
        const items = [];
        try {
          selectors.forEach((elementObj) => {
            if (elementObj.element) {
              const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])");
              Logger.log("info", "search coupon elements======>", elements.length);
              const findA = elementObj.findA;
              elements.forEach((element) => {
                if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                  const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA);
                  let id = null;
                  if (this.isItemLink(goodsLink)) {
                    id = ItemSearchBaseObj.getGoodsIdByUrl(goodsLink.getAttribute("href"));
                  }
                  if (id) {
                    items.push({
                      "id": id,
                      "platform": this.currentPlatform,
                      "handler": element,
                      "findA": findA,
                      "from": "wholesale"
                    });
                  }
                }
              });
            }
          });
          if (items.length > 0) {
            yield this.search(items, language, currency);
          }
        } catch (e) {
          Logger.log("error", "pickUpWholesale: ", e);
        }
      });
    },
    pickUpInbusiness: function(language, currency) {
      return __async$f(this, null, function* () {
        const validate = this.isInbusinessPage();
        if (!validate)
          return;
        try {
          const iceContainerElement = document.querySelector("#ice-container");
          const loadMoreElement = yield Tools.waitForElementByInterval("#loadMore", iceContainerElement);
          if (loadMoreElement) {
            const array = new Array();
            const containerElement = loadMoreElement.previousElementSibling;
            if (containerElement && containerElement.tagName === "DIV") {
              const childNodes = containerElement.childNodes;
              childNodes.forEach((child) => {
                if (child.tagName === "A" && ItemSearchBaseObj.isElementDisplayed(child) && !child.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                  const id = ItemSearchBaseObj.getGoodsIdByUrl(child.getAttribute("href"));
                  if (id) {
                    array.push({
                      "id": id,
                      "platform": this.currentPlatform,
                      "handler": child,
                      "from": "inbusiness"
                    });
                  }
                }
              });
            }
            yield this.search(array, language, currency);
          }
        } catch (e) {
          Logger.log("error", "pickUpInbusiness: ", e);
        }
      });
    },
    search: function(array, language, currency) {
      const groups = ItemSearchBaseObj.calcRequestGroup(array);
      const len = groups.length;
      return new Promise((resolve, reject) => {
        if (len <= 0) {
          resolve("complete");
          return;
        }
        const promises = [];
        for (let i = 0; i < groups.length; i++) {
          promises.push(this.createItemHtml(groups[i], language, currency));
        }
        Promise.all(promises).then((data) => {
          resolve("complete");
        });
      });
    },
    createItemHtml: function(group, language, currency) {
      return new Promise((resolve, reject) => {
        try {
          if (Array.isArray(group) && group.length === 0) {
            resolve("exception");
            return;
          }
          let reqId = "";
          const platform = group[0].platform;
          for (var i = 0; i < group.length; i++) {
            if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
              continue;
            }
            reqId += group[i].id + ",";
          }
          if (reqId.endsWith(",")) {
            reqId = reqId.slice(0, -1);
          }
          Logger.log("info", "request start >>>>>>>>>>>>>", group);
          const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&lang=" + language + "&no=11&v=1.0.1&currency=" + currency;
          Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl);
          ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => {
            Logger.log("info", "request finish >>>>>>>>>>>>>");
            delete ItemSearchBaseObj.cacheRequestMap[data.requestKey];
            if (data.code != "success" || !data.result) {
              resolve("exception");
              return;
            }
            const json = JSON.parse(data.result);
            Logger.log("info", "json", json);
            let isBroken = false;
            for (let key in json) {
              const { encryptLink, tip } = json[key];
              const item = group.find((obj) => obj.id === key);
              if (!item) {
                continue;
              }
              let handler = null, findA = null;
              if (item.hasOwnProperty("handler") && item.hasOwnProperty("findA")) {
                handler = item.handler;
                findA = item.findA;
              }
              if (!handler || !findA) {
                continue;
              }
              let decryptUrl = null;
              if (encryptLink) {
                try {
                  const decryptLink = atob(encryptLink);
                  decryptUrl = decryptLink.split("").reverse().join("");
                } catch (e) {
                }
              }
              const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA);
              const currentId = elementA ? ItemSearchBaseObj.getGoodsIdByUrl(elementA.getAttribute("href")) : "";
              if (currentId != key) {
                group.forEach((gItem) => {
                  const ele = gItem.handler;
                  ele.removeAttribute(ItemSearchBaseObj.searchAttribute);
                  const tipElement = ele.querySelector("div[name^='ali-gogo-coupon-']");
                  if (tipElement) {
                    tipElement.remove();
                  }
                });
                Logger.log("info", "exception currentGoodsId != request id");
                isBroken = true;
                break;
              } else {
                if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                  handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true");
                  if (tip) {
                    handler.style.position = "relative";
                    handler.insertAdjacentHTML("beforeend", tip);
                    Logger.log("info", "exist coupon >>>>>>>>>>>>>", key);
                  }
                  if (decryptUrl) {
                    this.relativeJ(handler, decryptUrl);
                    Logger.log("info", "good job >>>>>>>>>>>>>", key);
                  }
                }
              }
            }
            resolve(isBroken ? "broken" : "complete");
          });
        } catch (e) {
          Logger.log("error", "createItemHtml: ", e);
          resolve("exception");
        }
      });
    },
    relativeJ: function(handler, decryptUrl) {
      const clickTipAttribute = "tip-vjd1jd89fcv-i";
      let elements = null;
      if (handler.tagName == "A") {
        elements = [handler];
      } else {
        elements = handler.querySelectorAll("a");
      }
      elements.forEach((elementA) => {
        const href = elementA.getAttribute("href");
        if (this.isItemLink(href)) {
          if (elementA.getAttribute(clickTipAttribute)) {
            return;
          }
          elementA.setAttribute(clickTipAttribute, "true");
          elementA.addEventListener("click", function(e) {
            let isPreventDefault = true;
            const target = e.target;
            const tagName = target.tagName.toUpperCase();
            if (tagName == "A") {
              const href2 = target.getAttribute("href");
              if (!this.isItemLink(href2)) {
                isPreventDefault = false;
              }
            }
            if (isPreventDefault) {
              Array.from(target.classList).forEach((className) => {
                const iscontains = ["icon", "-btn-"].map((name) => className.indexOf(name) != -1).some((result) => result);
                if (iscontains) {
                  isPreventDefault = false;
                }
              });
            }
            if (isPreventDefault) {
              e.preventDefault();
              e.stopPropagation();
              Tools.openInTab(decryptUrl);
            }
          });
        }
      });
    },
    isRun: function() {
      let run = false;
      if (window.location.host.indexOf("aliexpress.") != -1) {
        run = !/\/(item|trade|checkout)\//.test(window.location.pathname);
      }
      return run;
    },
    start: function() {
      return __async$f(this, null, function* () {
        if (!this.isRun())
          return;
        let removeTagIsComplete = true;
        const language = Aliexpress.getLang();
        const currency = yield Aliexpress.getCurrency();
        const confString = yield ItemSearchBaseObj.requestConf();
        Logger.log("info", "conf ======>", confString);
        if (!confString) {
          return;
        }
        const selectors = ItemSearchBaseObj.pickupGoodsItem(this.currentPlatform, confString);
        Logger.log("info", "search coupon selectors======>", selectors);
        setInterval(() => __async$f(this, null, function* () {
          if (removeTagIsComplete && this.loopIsComplete) {
            this.loopIsComplete = false;
            yield this.pickUpInbusiness(language, currency);
            yield this.pickUpWholesale(selectors, language, currency);
            this.loopIsComplete = true;
          }
        }), 1700);
        if (selectors.length != 0 && window.location.pathname != "/") {
          let oldUrl = window.location.href;
          setInterval(() => {
            if (oldUrl != window.location.href && removeTagIsComplete) {
              removeTagIsComplete = false;
              Object.keys(ItemSearchBaseObj.cacheRequestMap).forEach((key) => {
                ItemSearchBaseObj.cacheRequestMap[key].abort();
              });
              ItemSearchBaseObj.cacheRequestMap = {};
              document.querySelectorAll("*[" + ItemSearchBaseObj.searchAttribute + "='true']").forEach((element) => {
                const tipElement = element.querySelector("*[name^='ali-gogo-coupon-']");
                if (tipElement) {
                  tipElement.remove();
                }
              });
              oldUrl = window.location.href;
            }
            removeTagIsComplete = true;
          }, 777);
          const promises = [];
          selectors.forEach((selector) => {
            let dselector = selector.element;
            if (selector.findA != "this") {
              dselector = dselector + " a";
            }
            promises.push(Tools.waitForElementByInterval(dselector, document.body, true, 50, 2e4));
          });
          const observerElement = yield Promise.race(promises);
          Logger.log("info", "observerElement", observerElement);
          if (observerElement) {
            const observer = new MutationObserver((mutationsList) => {
              if (mutationsList.length == 1) {
                const mutation = mutationsList[0];
                if (mutation.type === "attributes" && mutation.attributeName === "href") {
                  if (removeTagIsComplete) {
                    removeTagIsComplete = false;
                    document.querySelectorAll("*[" + ItemSearchBaseObj.searchAttribute + "='true']").forEach((element) => {
                      element.removeAttribute(ItemSearchBaseObj.searchAttribute);
                      const tipElement = element.querySelector("*[name^='ali-gogo-coupon-']");
                      if (tipElement) {
                        tipElement.remove();
                      }
                    });
                    removeTagIsComplete = true;
                  }
                  Logger.log("info", "cutpage", "lodding complete~");
                }
              }
            });
            observer.observe(observerElement, { attributes: true });
          }
        }
      });
    }
  };

  var __async$e = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const Ebay = {
    baseUrl: "https://oversea.mimixiaoke.com",
    currentPlatform: PlatformConst.ebay,
    getGoodsId: function(url) {
      const regex = /https?:\/\/www\.ebay\.[a-z.]+\/itm\/(\d+)/;
      const match = url.match(regex);
      return match ? match[1] : null;
    },
    isDetail: function() {
      const visitUrl = window.location.href;
      return [/https?:\/\/www\.ebay\.[a-z.]+\/itm\/\d+/].map((rs) => rs.test(visitUrl)).some((rs) => rs);
    },
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    },
    detail: function() {
      return __async$e(this, null, function* () {
        const validate = this.isDetail();
        if (!validate)
          return;
        const visitUrl = window.location.href;
        const id = this.getGoodsId(visitUrl);
        const varG = Tools.getParamterBySearch(window.location.href, "var");
        if (!id) {
          return;
        }
        const marketplace = this.getMarketplace(visitUrl);
        var idsG = id;
        if (!!varG) {
          idsG += "@" + varG;
        }
        const url = this.baseUrl + "/api/coupon/query?ids=" + idsG + "&qu=&p=" + this.currentPlatform + "&no=11&v=1.0.1&marketplace=" + marketplace + "&mul=false";
        Logger.log("info", "detail request url=", url);
        try {
          const data = yield Tools.request("GET", url, null);
          if (data.code == "success" && !!data.result) {
            const json = JSON.parse(data.result);
            Logger.log("info", "detail request json=", json);
            yield this.detailAnalyze(json, marketplace);
          }
        } catch (e) {
          Logger.log("info", "request,exception", e);
        }
        const titleTag = ".x-item-title__mainTitle";
        const priceTag = ".x-price-primary >span";
        const imageTag = ".ux-image-grid-item >img, .ux-image-carousel-item >img";
        ItemSearchBaseObj.addGoodsHistory(id, titleTag, priceTag, imageTag, this.currentPlatform, visitUrl);
      });
    },
    detailAnalyze: function(json, marketplace) {
      return __async$e(this, null, function* () {
        let couponResult = null;
        let qrcodeResult = null;
        if (!!json.data && !!json.data.css && !!json.data.html && !!json.data.handler) {
          const { handler, css, html, templateId, distinguish, hint } = json.data;
          var mid = null;
          if (json.data.hasOwnProperty("mid")) {
            mid = json.data["mid"];
          }
          GM_addStyle(css);
          const element = yield Tools.mustGetElement(handler);
          Logger.log("info", "coupon insert:element", element);
          if (element) {
            couponResult = { "element": element, "html": html, "templateId": templateId, "distinguish": distinguish, "hint": hint, "mid": mid };
          }
        }
        if (!!json.id && !!json.mscan && !!json.mscan.html && !!json.mscan.mount) {
          const { iden, html, mount, distinguish } = json.mscan;
          const id = json.id;
          const promiseResultArray = [];
          const elementPromise = Tools.mustGetElement(mount);
          const reqUrl = this.baseUrl + "/api/coupon/change?id=" + id + "&marketplace=" + marketplace + "&platform=" + this.currentPlatform;
          const reqPromise = Tools.request("GET", reqUrl, null);
          promiseResultArray.push(elementPromise, reqPromise);
          const allResult = yield Promise.all(promiseResultArray);
          let element = null, qrcodeData = null;
          for (let i = 0; i < allResult.length; i++) {
            if (allResult[i]) {
              if (allResult[i].hasOwnProperty("code")) {
                qrcodeData = allResult[i];
              } else {
                element = allResult[i];
              }
            }
          }
          Logger.log("info", "qrcocd insert:element", element);
          if (element && qrcodeData) {
            qrcodeResult = { "element": element, "html": html, "iden": iden, "qrcodeData": qrcodeData, "distinguish": distinguish };
          }
        }
        Tools.loopTask(() => {
          if (couponResult) {
            Tools.distinguishRemoveAndTry(couponResult.distinguish, () => {
              this.detailCouponAnalyze(couponResult);
            });
          }
          if (qrcodeResult) {
            Tools.distinguishRemoveAndTry(qrcodeResult.distinguish, () => {
              this.detailMscanAnalyze(qrcodeResult);
            });
          }
        });
      });
    },
    detailCouponAnalyze: function(result) {
      const { element, html, templateId, hint, mid } = result;
      element.insertAdjacentHTML("afterend", html);
      const templateIdEle = document.querySelector("div[id='" + templateId + "']");
      if (templateIdEle) {
        const couponCodeElement = templateIdEle.querySelector(".coupon-code");
        const promoCode = Tools.decryptStr(couponCodeElement.getAttribute("data-encryptcode"));
        templateIdEle.addEventListener("click", () => {
          GM_setClipboard(promoCode, "txt", () => {
            Toast.show({ "message": hint, "background": "#D3031C" });
            if (mid && mid.hasOwnProperty("target") && mid.hasOwnProperty("link") && mid.hasOwnProperty("delay")) {
              const { target, link, delay } = mid, linkDecrypt = Tools.decryptStr(link);
              setTimeout(() => {
                if (target === "_blank") {
                  Tools.openInTab(linkDecrypt);
                } else if (target === "_self") {
                  window.location.href = linkDecrypt;
                } else if (target === "_replace") {
                  window.location.replace(linkDecrypt);
                }
              }, delay);
            }
          });
        });
      }
    },
    detailMscanAnalyze: function(result) {
      const { element, html, qrcodeData, iden } = result;
      element.insertAdjacentHTML("afterend", html);
      if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) {
        const mscanImg = JSON.parse(qrcodeData.result).mscanImg;
        if (!!mscanImg) {
          const canvasElement = document.getElementById("mscan" + iden);
          if (canvasElement) {
            var cxt = canvasElement.getContext("2d");
            var imgData = new Image();
            imgData.src = mscanImg;
            imgData.onload = function() {
              cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height);
            };
          }
        }
      }
    },
    start: function() {
      return __async$e(this, null, function* () {
        this.detail();
      });
    }
  };

  var __async$d = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const EbaySearch = {
    loopIsComplete: true,
    currentPlatform: PlatformConst.ebay,
    isRun: function() {
      let run = false;
      if (window.location.host.indexOf("ebay.") != -1) {
        run = !/\/(item|itm|trade|checkout|rxo)\//.test(window.location.pathname);
      }
      return run;
    },
    isItemLink: function(url) {
      return /ebay/.test(url) && /\/itm\/[^\/]*?/.test(url);
    },
    pickUpItems: function(selectors, marketplace) {
      return __async$d(this, null, function* () {
        const items = [];
        try {
          selectors.forEach((elementObj) => {
            if (elementObj.element) {
              const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])");
              Logger.log("info", "search coupon elements======>", elements);
              const findA = elementObj.findA;
              elements.forEach((element) => {
                if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                  const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA);
                  const priceQuery = [
                    "*[class*='detail'] >*[class*='price']",
                    "*[class*='merch-price'] >span"
                  ].join(",");
                  const price = ItemSearchBaseObj.getGoodsPriceByElement(element, priceQuery);
                  let id = null, varG = null;
                  if (this.isItemLink(goodsLink)) {
                    const goodsLinkHref = goodsLink.getAttribute("href");
                    id = ItemSearchBaseObj.getGoodsIdByUrl(goodsLinkHref);
                    varG = Tools.getParamterBySearch(goodsLinkHref, "var");
                  }
                  if (id) {
                    items.push({
                      "id": id,
                      "varG": varG,
                      "price": price,
                      "platform": this.currentPlatform,
                      "handler": element,
                      "findA": findA,
                      "from": "search"
                    });
                  }
                }
              });
            }
          });
          Logger.log("info", items);
          if (items.length > 0) {
            yield this.search(items, marketplace);
          }
        } catch (e) {
          Logger.log("error", "pickUpItems: ", e);
        }
      });
    },
    search: function(array, marketplace) {
      return __async$d(this, null, function* () {
        const groups = ItemSearchBaseObj.calcRequestGroup(array);
        const len = groups.length;
        return new Promise((resolve, reject) => {
          if (len <= 0) {
            resolve("complete");
            return;
          }
          const promises = [];
          for (let i = 0; i < groups.length; i++) {
            promises.push(this.createItemHtml(groups[i], marketplace));
          }
          Promise.all(promises).then((data) => {
            resolve("complete");
          });
        });
      });
    },
    createItemHtml: function(group, marketplace) {
      return new Promise((resolve, reject) => {
        try {
          if (Array.isArray(group) && group.length === 0) {
            resolve("exception");
            return;
          }
          let reqId = "";
          const platform = group[0].platform;
          for (var i = 0; i < group.length; i++) {
            if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
              continue;
            }
            reqId += group[i].id;
            if (!!group[i].varG) {
              reqId += "@" + group[i].varG;
            }
            reqId += ":" + group[i].price + ",";
          }
          if (reqId.endsWith(",")) {
            reqId = reqId.slice(0, -1);
          }
          Logger.log("info", "request start >>>>>>>>>>>>>", group);
          const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&marketplace=" + marketplace + "&no=11&v=1.0.1";
          Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl);
          ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => {
            Logger.log("info", "request finish >>>>>>>>>>>>>", data);
            delete ItemSearchBaseObj.cacheRequestMap[data.requestKey];
            if (data.code != "success" || !data.result) {
              resolve("exception");
              return;
            }
            const json = JSON.parse(data.result);
            for (let key in json) {
              const { encryptLink, tip } = json[key];
              const item = group.find((obj) => obj.id === key);
              if (!item) {
                continue;
              }
              let handler = null, findA = null;
              if (item.hasOwnProperty("handler") && item.hasOwnProperty("findA")) {
                handler = item.handler;
                findA = item.findA;
              }
              if (!handler || !findA) {
                continue;
              }
              let decryptUrl = null;
              if (encryptLink) {
                try {
                  const decryptLink = atob(encryptLink);
                  decryptUrl = decryptLink.split("").reverse().join("");
                } catch (e) {
                }
              }
              const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA);
              if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true");
                if (tip) {
                  handler.style.position = "relative";
                  handler.insertAdjacentHTML("beforeend", tip);
                  Logger.log("info", "exist coupon >>>>>>>>>>>>>", key);
                }
                if (decryptUrl) {
                  this.relativeJ(handler, decryptUrl);
                  Logger.log("info", "good job >>>>>>>>>>>>>", key);
                }
              }
            }
            resolve("complete");
          });
        } catch (e) {
          Logger.log("error", "createItemHtml: ", e);
          resolve("exception");
        }
      });
    },
    relativeJ: function(handler, decryptUrl) {
      const clickTipAttribute = "tip-vjd1jd89fcv-i", self = this;
      let elements = null;
      if (handler.tagName == "A") {
        elements = [handler];
      } else {
        elements = handler.querySelectorAll("a");
      }
      elements.forEach((elementA) => {
        const href = elementA.getAttribute("href");
        if (self.isItemLink(href)) {
          if (elementA.getAttribute(clickTipAttribute)) {
            return;
          }
          elementA.setAttribute(clickTipAttribute, "true");
          elementA.addEventListener("click", function(e) {
            let isPreventDefault = true;
            const target = e.target;
            const tagName = target.tagName.toUpperCase();
            if (tagName == "A") {
              const href2 = target.getAttribute("href");
              if (!self.isItemLink(href2)) {
                isPreventDefault = false;
              }
            }
            if (isPreventDefault) {
              Array.from(target.classList).forEach((className) => {
                const iscontains = ["btn", "icon"].map((name) => className.indexOf(name) != -1).some((result) => result);
                if (iscontains) {
                  isPreventDefault = false;
                }
              });
            }
            if (isPreventDefault) {
              e.preventDefault();
              e.stopPropagation();
              Tools.openInTab(decryptUrl);
            }
          });
        }
      });
    },
    start: function() {
      return __async$d(this, null, function* () {
        if (!this.isRun())
          return;
        const marketplace = Ebay.getMarketplace(window.location.href);
        const confString = yield ItemSearchBaseObj.requestConf();
        Logger.log("info", "conf ======>", confString);
        if (!confString) {
          return;
        }
        const selectors = ItemSearchBaseObj.pickupGoodsItem(this.currentPlatform, confString);
        Logger.log("info", "search coupon selectors======>", selectors);
        setInterval(() => __async$d(this, null, function* () {
          if (this.loopIsComplete) {
            this.loopIsComplete = false;
            yield this.pickUpItems(selectors, marketplace);
            this.loopIsComplete = true;
          }
        }), 1700);
      });
    }
  };

  var __async$c = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const Lazada = {
    baseUrl: "https://oversea.mimixiaoke.com",
    visitUrl: window.location.href,
    currentPlatform: PlatformConst.lazada,
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    },
    isRun: function() {
      return /.*\.lazada\..*\/products\/.*-i\d+.*\.html/.test(this.visitUrl);
    },
    detailMyMscanAnalyze: function(result) {
      return __async$c(this, null, function* () {
        const { id, iden, marketplace, platform, mount, html, cmd } = result;
        if (!mount || !html) {
          return;
        }
        if (cmd && cmd.do && cmd.ele) {
          const cmdElement = yield Tools.waitForElementByInterval(cmd.ele);
          if (cmdElement) {
            if (cmd.do == "empty") {
              cmdElement.innerHTML = "";
            }
          }
        }
        const element = yield Tools.mustGetElement(mount);
        if (!element) {
          return;
        }
        element.insertAdjacentHTML("beforeend", html);
        const reqImageUrl = this.baseUrl + "/api/coupon/change?id={id}&marketplace={marketplace}&platform={platform}".replace("{id}", id).replace("{marketplace}", marketplace).replace("{platform}", platform);
        const qrcodeData = yield Tools.request("GET", reqImageUrl, null);
        if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) {
          let mscanImg = JSON.parse(qrcodeData.result).mscanImg;
          if (!!mscanImg) {
            var canvasElement = document.getElementById("mscan" + iden);
            if (!!canvasElement) {
              var cxt = canvasElement.getContext("2d");
              var imgData = new Image();
              imgData.src = mscanImg;
              imgData.onload = function() {
                cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height);
              };
            }
          }
        }
      });
    },
    detail: function() {
      return __async$c(this, null, function* () {
        const marketplace = this.getMarketplace();
        const ids = Tools.getParamterBySuffix(this.visitUrl);
        if (!ids) {
          return;
        }
        const reqUrl = this.baseUrl + "/api/coupon/query?ids=" + ids + "&qu=&p=" + this.currentPlatform + "&no=11&v=1.0.1&marketplace=" + marketplace + "&mul=false";
        Logger.log("info", ">>>>>>", reqUrl);
        try {
          const data = yield Tools.request("GET", reqUrl, null);
          if (!!data && data.code === "success" && !!data.result) {
            const json = JSON.parse(data.result);
            if (json && json.mscan) {
              const { distinguish, iden, html, cmd, mount } = json.mscan;
              const mscanResult = {
                "id": json.id,
                "iden": iden,
                "marketplace": marketplace,
                "platform": this.currentPlatform,
                "mount": mount,
                "html": html,
                "cmd": cmd
              };
              Tools.loopTask(() => {
                Tools.distinguishRemoveAndTry(distinguish, () => {
                  this.detailMyMscanAnalyze(mscanResult);
                });
              });
            }
          }
        } catch (e) {
          Logger.log("info", "request,exception", e);
        }
        const titleTag = ".pdp-mod-product-badge-title";
        const priceTag = ".pdp-product-price >span";
        const imageTag = ".gallery-preview-panel__content >img:last-child";
        ItemSearchBaseObj.addGoodsHistory(ids, titleTag, priceTag, imageTag, this.currentPlatform, this.visitUrl);
      });
    },
    start: function() {
      return __async$c(this, null, function* () {
        if (this.isRun()) {
          this.detail();
        }
      });
    }
  };

  var __async$b = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const LazadaSearch = {
    loopIsComplete: true,
    currentPlatform: PlatformConst.lazada,
    isRun: function() {
      let run = false;
      if (window.location.host.indexOf("lazada.") != -1) {
        run = !this.isItemLink(window.location.href) && !/\/(\/shipping\\?)\//.test(window.location.pathname);
      }
      return run;
    },
    isItemLink: function(url) {
      return /.*\.lazada\..*\/products\/.*-i\d+.*\.html/.test(url);
    },
    pickUpItems: function(selectors, marketplace) {
      return __async$b(this, null, function* () {
        const items = [];
        try {
          selectors.forEach((elementObj) => {
            if (elementObj.element) {
              const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])");
              Logger.log("info", "search coupon elements======>", elements);
              const findA = elementObj.findA;
              elements.forEach((element) => {
                if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                  const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA);
                  const price = ItemSearchBaseObj.getGoodsPrice(element.innerText);
                  let id = null;
                  if (this.isItemLink(goodsLink)) {
                    id = ItemSearchBaseObj.getGoodsIdByUrl(goodsLink.getAttribute("href"));
                  }
                  if (id) {
                    items.push({
                      "id": id,
                      "price": price,
                      "platform": this.currentPlatform,
                      "handler": element,
                      "findA": findA,
                      "from": "search"
                    });
                  }
                }
              });
            }
          });
          Logger.log("info", items);
          if (items.length > 0) {
            yield this.search(items, marketplace);
          }
        } catch (e) {
          Logger.log("error", "pickUpItems: ", e);
        }
      });
    },
    search: function(array, marketplace) {
      return __async$b(this, null, function* () {
        const groups = ItemSearchBaseObj.calcRequestGroup(array);
        const len = groups.length;
        return new Promise((resolve, reject) => {
          if (len <= 0) {
            resolve("complete");
            return;
          }
          const promises = [];
          for (let i = 0; i < groups.length; i++) {
            promises.push(this.createItemHtml(groups[i], marketplace));
          }
          Promise.all(promises).then((data) => {
            resolve("complete");
          });
        });
      });
    },
    createItemHtml: function(group, marketplace) {
      return new Promise((resolve, reject) => {
        try {
          if (Array.isArray(group) && group.length === 0) {
            resolve("exception");
            return;
          }
          let reqId = "";
          const platform = group[0].platform;
          for (var i = 0; i < group.length; i++) {
            if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
              continue;
            }
            reqId += group[i].id + ":" + group[i].price + ",";
          }
          if (reqId.endsWith(",")) {
            reqId = reqId.slice(0, -1);
          }
          Logger.log("info", "request start >>>>>>>>>>>>>", group);
          const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&marketplace=" + marketplace + "&no=11&v=1.0.1";
          Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl);
          ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => {
            Logger.log("info", "request finish >>>>>>>>>>>>>", data);
            delete ItemSearchBaseObj.cacheRequestMap[data.requestKey];
            if (data.code != "success" || !data.result) {
              resolve("exception");
              return;
            }
            const json = JSON.parse(data.result);
            for (let key in json) {
              const { encryptLink, tip } = json[key];
              const { handler, findA } = group.find((obj) => obj.id === key);
              let decryptUrl = null;
              if (encryptLink) {
                try {
                  const decryptLink = atob(encryptLink);
                  decryptUrl = decryptLink.split("").reverse().join("");
                } catch (e) {
                }
              }
              const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA);
              if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true");
                if (tip) {
                  handler.style.position = "relative";
                  handler.insertAdjacentHTML("beforeend", tip);
                  Logger.log("info", "exist coupon >>>>>>>>>>>>>", key);
                }
                if (decryptUrl) {
                  this.relativeJ(handler, decryptUrl);
                  Logger.log("info", "good job >>>>>>>>>>>>>", key);
                }
              }
            }
            resolve("complete");
          });
        } catch (e) {
          Logger.log("error", "createItemHtml: ", e);
          resolve("exception");
        }
      });
    },
    relativeJ: function(handler, decryptUrl) {
      let selectorA = null;
      if (handler.tagName == "A") {
        selectorA = [handler];
      } else {
        selectorA = handler.querySelectorAll("a");
      }
      selectorA.forEach((element_a) => {
        if (this.isItemLink(element_a.getAttribute("href"))) {
          element_a.addEventListener("click", function(e) {
            e.preventDefault();
            e.stopPropagation();
            Tools.openInTab(decryptUrl);
          });
        }
      });
    },
    start: function() {
      return __async$b(this, null, function* () {
        if (!this.isRun())
          return;
        const marketplace = Lazada.getMarketplace(window.location.href);
        const confString = yield ItemSearchBaseObj.requestConf();
        Logger.log("info", "conf ======>", confString);
        Logger.log("info", "marketplace ======>", marketplace);
        if (!confString) {
          return;
        }
        const selectors = ItemSearchBaseObj.pickupGoodsItem(this.currentPlatform, confString);
        Logger.log("info", "search coupon selectors======>", selectors);
        setInterval(() => __async$b(this, null, function* () {
          if (this.loopIsComplete) {
            this.loopIsComplete = false;
            yield this.pickUpItems(selectors, marketplace);
            this.loopIsComplete = true;
          }
        }), 1700);
      });
    }
  };

  var __async$a = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const Bestbuy = {
    baseUrl: "https://oversea.mimixiaoke.com",
    currentPlatform: PlatformConst.bestbuy,
    isDetail: function() {
      const visitUrl = window.location.href;
      return [/www\.bestbuy\.com\/site\/.*\/\d+\.p/].map((rs) => rs.test(visitUrl)).some((rs) => rs);
    },
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    },
    detail: function() {
      return __async$a(this, null, function* () {
        const validate = this.isDetail();
        if (!validate)
          return;
        const visitUrl = window.location.href;
        const id = ItemSearchBaseObj.getGoodsIdByUrl(visitUrl, "p");
        if (!id) {
          return;
        }
        const marketplace = this.getMarketplace(visitUrl);
        const url = this.baseUrl + "/api/coupon/query?ids=" + id + "&qu=&p=" + this.currentPlatform + "&no=11&v=1.0.1&marketplace=" + marketplace + "&mul=false";
        Logger.log("info", "detail request url=", url);
        try {
          const data = yield Tools.request("GET", url, null);
          if (data.code == "success" && !!data.result) {
            const json = JSON.parse(data.result);
            Logger.log("info", "detail request json=", json);
            yield this.detailAnalyze(json, marketplace);
          }
        } catch (e) {
          Logger.log("info", "request,exception", e);
        }
        const titleTag = ".sku-title";
        const priceTag = ".priceView-customer-price >span";
        const imageTag = ".thumbnail-list img";
        ItemSearchBaseObj.addGoodsHistory(id, titleTag, priceTag, imageTag, this.currentPlatform, visitUrl);
      });
    },
    detailAnalyze: function(json, marketplace) {
      return __async$a(this, null, function* () {
        let couponResult = null;
        let qrcodeResult = null;
        if (!!json.data && !!json.data.css && !!json.data.html && !!json.data.handler) {
          const { handler, css, html, templateId, distinguish } = json.data;
          GM_addStyle(css);
          const element = yield Tools.mustGetElement(handler);
          Logger.log("info", "coupon insert:element", element);
          if (element) {
            couponResult = { "element": element, "html": html, "templateId": templateId, "distinguish": distinguish };
          }
        }
        if (!!json.id && !!json.mscan && !!json.mscan.html && !!json.mscan.mount) {
          const { iden, html, mount, distinguish } = json.mscan;
          const id = json.id;
          const promiseResultArray = [];
          const elementPromise = Tools.mustGetElement(mount);
          const reqUrl = this.baseUrl + "/api/coupon/change?id=" + id + "&marketplace=" + marketplace + "&platform=" + this.currentPlatform;
          const reqPromise = Tools.request("GET", reqUrl, null);
          promiseResultArray.push(elementPromise, reqPromise);
          const allResult = yield Promise.all(promiseResultArray);
          let element = null, qrcodeData = null;
          for (let i = 0; i < allResult.length; i++) {
            if (allResult[i]) {
              if (allResult[i].hasOwnProperty("code")) {
                qrcodeData = allResult[i];
              } else {
                element = allResult[i];
              }
            }
          }
          Logger.log("info", "qrcocd insert:element", element);
          if (element && qrcodeData) {
            qrcodeResult = { "element": element, "html": html, "iden": iden, "qrcodeData": qrcodeData, "distinguish": distinguish };
          }
        }
        Tools.loopTask(() => {
          if (couponResult) {
            Tools.distinguishRemoveAndTry(couponResult.distinguish, () => {
              this.detailCouponAnalyze(couponResult);
            });
          }
          if (qrcodeResult) {
            Tools.distinguishRemoveAndTry(qrcodeResult.distinguish, () => {
              this.detailMscanAnalyze(qrcodeResult);
            });
          }
        });
      });
    },
    detailCouponAnalyze: function(result) {
      const { element, html, templateId } = result;
      element.insertAdjacentHTML("afterend", html);
      const templateIdEle = document.querySelector("div[id='" + templateId + "']");
      if (templateIdEle) {
        const couponCodeElement = templateIdEle.querySelector(".coupon-code");
        const promoCode = Tools.decryptStr(couponCodeElement.getAttribute("data-encryptcode"));
        templateIdEle.addEventListener("click", () => {
          GM_setClipboard(promoCode, "txt", () => {
            Toast.show({ "message": "copied", "background": "#D3031C" });
          });
        });
      }
    },
    detailMscanAnalyze: function(result) {
      const { element, html, qrcodeData, iden } = result;
      element.insertAdjacentHTML("afterend", html);
      if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) {
        const mscanImg = JSON.parse(qrcodeData.result).mscanImg;
        if (!!mscanImg) {
          const canvasElement = document.getElementById("mscan" + iden);
          if (canvasElement) {
            var cxt = canvasElement.getContext("2d");
            var imgData = new Image();
            imgData.src = mscanImg;
            imgData.onload = function() {
              cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height);
            };
          }
        }
      }
    },
    start: function() {
      return __async$a(this, null, function* () {
        this.detail();
      });
    }
  };

  var __async$9 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const BestbuySearch = {
    loopIsComplete: true,
    currentPlatform: PlatformConst.bestbuy,
    isRun: function() {
      return /https:\/\/www\.bestbuy\.com\/site\/searchpage\.jsp/.test(window.location.href);
    },
    isItemLink: function(url) {
      return /\/site\/.*\/\d+\.p/.test(url);
    },
    pickUpItems: function(selectors, marketplace) {
      return __async$9(this, null, function* () {
        const items = [];
        try {
          selectors.forEach((elementObj) => {
            if (elementObj.element) {
              const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])");
              Logger.log("info", "search coupon elements======>", elements);
              const findA = elementObj.findA;
              elements.forEach((element) => {
                if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                  const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA);
                  const priceQuery = [
                    "div[id*='pricing-price-']"
                  ].join(",");
                  const price = ItemSearchBaseObj.getGoodsPrice(
                    ItemSearchBaseObj.getGoodsPriceByElement(element, priceQuery)
                  );
                  let id = null;
                  if (this.isItemLink(goodsLink)) {
                    id = ItemSearchBaseObj.getGoodsIdByUrl(goodsLink.getAttribute("href"), "p");
                  }
                  if (id) {
                    items.push({
                      "id": id,
                      "price": price,
                      "platform": this.currentPlatform,
                      "handler": element,
                      "findA": findA,
                      "from": "search"
                    });
                  }
                }
              });
            }
          });
          Logger.log("info", items);
          if (items.length > 0) {
            yield this.search(items, marketplace);
          }
        } catch (e) {
          Logger.log("error", "pickUpItems: ", e);
        }
      });
    },
    search: function(array, marketplace) {
      return __async$9(this, null, function* () {
        const groups = ItemSearchBaseObj.calcRequestGroup(array);
        const len = groups.length;
        return new Promise((resolve, reject) => {
          if (len <= 0) {
            resolve("complete");
            return;
          }
          const promises = [];
          for (let i = 0; i < groups.length; i++) {
            promises.push(this.createItemHtml(groups[i], marketplace));
          }
          Promise.all(promises).then((data) => {
            resolve("complete");
          });
        });
      });
    },
    createItemHtml: function(group, marketplace) {
      return new Promise((resolve, reject) => {
        try {
          if (Array.isArray(group) && group.length === 0) {
            resolve("exception");
            return;
          }
          let reqId = "";
          const platform = group[0].platform;
          for (var i = 0; i < group.length; i++) {
            if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
              continue;
            }
            reqId += group[i].id + ":" + group[i].price + ",";
          }
          if (reqId.endsWith(",")) {
            reqId = reqId.slice(0, -1);
          }
          Logger.log("info", "request start >>>>>>>>>>>>>", group);
          const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&marketplace=" + marketplace + "&no=11&v=1.0.1";
          Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl);
          ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => {
            Logger.log("info", "request finish >>>>>>>>>>>>>", data);
            delete ItemSearchBaseObj.cacheRequestMap[data.requestKey];
            if (data.code != "success" || !data.result) {
              resolve("exception");
              return;
            }
            const json = JSON.parse(data.result);
            for (let key in json) {
              const { encryptLink, tip } = json[key];
              const item = group.find((obj) => obj.id === key);
              if (!item) {
                continue;
              }
              let handler = null, findA = null;
              if (item.hasOwnProperty("handler") && item.hasOwnProperty("findA")) {
                handler = item.handler;
                findA = item.findA;
              }
              if (!handler || !findA) {
                continue;
              }
              let decryptUrl = null;
              if (encryptLink) {
                try {
                  const decryptLink = atob(encryptLink);
                  decryptUrl = decryptLink.split("").reverse().join("");
                } catch (e) {
                }
              }
              const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA);
              if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true");
                if (tip) {
                  handler.style.position = "relative";
                  handler.insertAdjacentHTML("beforeend", tip);
                  Logger.log("info", "exist coupon >>>>>>>>>>>>>", key);
                }
                if (decryptUrl) {
                  this.relativeJ(handler, decryptUrl);
                  Logger.log("info", "good job >>>>>>>>>>>>>", key);
                }
              }
            }
            resolve("complete");
          });
        } catch (e) {
          Logger.log("error", "createItemHtml: ", e);
          resolve("exception");
        }
      });
    },
    relativeJ: function(handler, decryptUrl) {
      const clickTipAttribute = "tip-vjd1jd89fcv-i", self = this;
      let elements = null;
      if (handler.tagName == "A") {
        elements = [handler];
      } else {
        elements = handler.querySelectorAll("a");
      }
      elements.forEach((elementA) => {
        const href = elementA.getAttribute("href");
        if (self.isItemLink(href)) {
          if (elementA.getAttribute(clickTipAttribute)) {
            return;
          }
          elementA.setAttribute(clickTipAttribute, "true");
          elementA.addEventListener("click", function(e) {
            let isPreventDefault = true;
            const target = e.target;
            const tagName = target.tagName.toUpperCase();
            if (tagName == "A") {
              const href2 = target.getAttribute("href");
              if (!self.isItemLink(href2)) {
                isPreventDefault = false;
              }
            }
            if (isPreventDefault) {
              Array.from(target.classList).forEach((className) => {
                const iscontains = ["btn", "icon"].map((name) => className.indexOf(name) != -1).some((result) => result);
                if (iscontains) {
                  isPreventDefault = false;
                }
              });
            }
            if (isPreventDefault) {
              e.preventDefault();
              e.stopPropagation();
              Tools.openInTab(decryptUrl);
            }
          });
        }
      });
    },
    start: function() {
      return __async$9(this, null, function* () {
        if (!this.isRun())
          return;
        const marketplace = Bestbuy.getMarketplace(window.location.href);
        const confString = yield ItemSearchBaseObj.requestConf();
        Logger.log("info", "conf ======>", confString);
        if (!confString) {
          return;
        }
        const selectors = ItemSearchBaseObj.pickupGoodsItem(this.currentPlatform, confString);
        Logger.log("info", "search coupon selectors======>", selectors);
        setInterval(() => __async$9(this, null, function* () {
          if (this.loopIsComplete) {
            this.loopIsComplete = false;
            yield this.pickUpItems(selectors, marketplace);
            this.loopIsComplete = true;
          }
        }), 1700);
      });
    }
  };

  var __async$8 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const Banggood = {
    baseUrl: "https://oversea.mimixiaoke.com",
    currentPlatform: PlatformConst.banggood,
    getGoodsId: function(url) {
      if (url.indexOf("?") != -1) {
        url = url.split("?")[0];
      }
      if (url.indexOf("#") != -1) {
        url = url.split("#")[0];
      }
      let regex = new RegExp("-p-(\\d+)\\.html");
      const match = url.match(regex);
      return match ? match[1] : null;
    },
    isDetail: function(url) {
      return /.*\.banggood\.com\/.*-p-\d+\.html/.test(url);
    },
    getLang: function() {
      return document.querySelector("html").getAttribute("lang") || "";
    },
    getCurrency: function() {
      const element = document.querySelector(".shipto-state");
      if (element) {
        return encodeURIComponent(element.textContent);
      }
      return "";
    },
    getMarketplace: function(url = window.location.href) {
      const marketplace = [
        /https?:\/\/www\.banggood\.com\/([a-z]{2,3})\//,
        /https?:\/\/([a-z]{2,3})\.banggood\.com/
      ].map((rs) => {
        var match = url.match(rs);
        if (match) {
          return match[1];
        }
        return null;
      }).find((rs) => rs != null);
      return marketplace ? marketplace : "com";
    },
    detail: function() {
      return __async$8(this, null, function* () {
        const visitUrl = window.location.href;
        const validate = this.isDetail(visitUrl);
        if (!validate)
          return;
        const id = this.getGoodsId(visitUrl);
        if (!id) {
          return;
        }
        const marketplace = this.getMarketplace(visitUrl);
        const currency = this.getCurrency();
        const lang = this.getLang();
        const url = this.baseUrl + "/api/coupon/query?ids=" + id + "&qu=&p=" + this.currentPlatform + "&no=11&v=1.0.1&marketplace=" + marketplace + "&mul=false&currency=" + currency + "&lang=" + lang;
        Logger.log("info", "detail request url=", url);
        try {
          const data = yield Tools.request("GET", url, null);
          if (data.code == "success" && !!data.result) {
            const json = JSON.parse(data.result);
            Logger.log("info", "detail request json=", json);
            yield this.detailAnalyze(json, marketplace);
          }
        } catch (e) {
          Logger.log("info", "request,exception", e);
        }
        const titleTag = ".product-title-text";
        const priceTag = ".newbie-price";
        const imageTag = "a.p-img >img";
        ItemSearchBaseObj.addGoodsHistory(id, titleTag, priceTag, imageTag, this.currentPlatform, visitUrl);
      });
    },
    detailAnalyze: function(json, marketplace) {
      return __async$8(this, null, function* () {
        let couponResult = null;
        let qrcodeResult = null;
        if (!!json.data && !!json.data.css && !!json.data.html && !!json.data.handler) {
          const { handler, css, html, templateId, distinguish, hint } = json.data;
          var mid = null;
          if (json.data.hasOwnProperty("mid")) {
            mid = json.data["mid"];
          }
          GM_addStyle(css);
          const element = yield Tools.mustGetElement(handler);
          Logger.log("info", "coupon insert:element", element);
          if (element) {
            couponResult = { "element": element, "html": html, "templateId": templateId, "distinguish": distinguish, "hint": hint, "mid": mid };
          }
        }
        if (!!json.id && !!json.mscan && !!json.mscan.html && !!json.mscan.mount) {
          const { iden, html, mount, distinguish } = json.mscan;
          const id = json.id;
          const promiseResultArray = [];
          const elementPromise = Tools.mustGetElement(mount);
          const reqUrl = this.baseUrl + "/api/coupon/change?id=" + id + "&marketplace=" + marketplace + "&platform=" + this.currentPlatform;
          const reqPromise = Tools.request("GET", reqUrl, null);
          promiseResultArray.push(elementPromise, reqPromise);
          const allResult = yield Promise.all(promiseResultArray);
          let element = null, qrcodeData = null;
          for (let i = 0; i < allResult.length; i++) {
            if (allResult[i]) {
              if (allResult[i].hasOwnProperty("code")) {
                qrcodeData = allResult[i];
              } else {
                element = allResult[i];
              }
            }
          }
          Logger.log("info", "qrcocd insert:element", element);
          if (element && qrcodeData) {
            qrcodeResult = { "element": element, "html": html, "iden": iden, "qrcodeData": qrcodeData, "distinguish": distinguish };
          }
        }
        Tools.loopTask(() => {
          if (couponResult) {
            Tools.distinguishRemoveAndTry(couponResult.distinguish, () => {
              this.detailCouponAnalyze(couponResult);
            });
          }
          if (qrcodeResult) {
            Tools.distinguishRemoveAndTry(qrcodeResult.distinguish, () => {
              this.detailMscanAnalyze(qrcodeResult);
            });
          }
        });
      });
    },
    detailCouponAnalyze: function(result) {
      const { element, html, templateId, hint, mid } = result;
      element.insertAdjacentHTML("afterend", html);
      const templateIdEle = document.querySelector("div[id='" + templateId + "']");
      if (templateIdEle) {
        const couponCodeElement = templateIdEle.querySelector(".coupon-code");
        const promoCode = Tools.decryptStr(couponCodeElement.getAttribute("data-encryptcode"));
        templateIdEle.addEventListener("click", () => {
          GM_setClipboard(promoCode, "txt", () => {
            Toast.show({ "message": hint, "background": "#D3031C" });
            if (mid && mid.hasOwnProperty("target") && mid.hasOwnProperty("link") && mid.hasOwnProperty("delay")) {
              const { target, link, delay } = mid, linkDecrypt = Tools.decryptStr(link);
              setTimeout(() => {
                if (target === "_blank") {
                  Tools.openInTab(linkDecrypt);
                } else if (target === "_self") {
                  window.location.href = linkDecrypt;
                } else if (target === "_replace") {
                  window.location.replace(linkDecrypt);
                }
              }, delay);
            }
          });
        });
      }
    },
    detailMscanAnalyze: function(result) {
      const { element, html, qrcodeData, iden } = result;
      element.insertAdjacentHTML("afterend", html);
      if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) {
        const mscanImg = JSON.parse(qrcodeData.result).mscanImg;
        if (!!mscanImg) {
          const canvasElement = document.getElementById("mscan" + iden);
          if (canvasElement) {
            var cxt = canvasElement.getContext("2d");
            var imgData = new Image();
            imgData.src = mscanImg;
            imgData.onload = function() {
              cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height);
            };
          }
        }
      }
    },
    start: function() {
      return __async$8(this, null, function* () {
        this.detail();
      });
    }
  };

  var __async$7 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const BanggoodSearch = {
    loopIsComplete: true,
    currentPlatform: PlatformConst.banggood,
    isRun: function() {
      return !Banggood.isDetail(window.location.href);
    },
    pickUpItems: function(selectors, marketplace, lang, currency) {
      return __async$7(this, null, function* () {
        const items = [];
        try {
          selectors.forEach((elementObj) => {
            if (elementObj.element) {
              const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])");
              Logger.log("info", "search coupon elements======>", elements);
              const findA = elementObj.findA;
              elements.forEach((element) => {
                if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                  const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA);
                  const priceQuery = ["span.price"].join(",");
                  const price = ItemSearchBaseObj.getGoodsPriceByElement(element, priceQuery);
                  let id = null;
                  if (Banggood.isDetail(goodsLink)) {
                    const goodsLinkHref = goodsLink.getAttribute("href");
                    id = Banggood.getGoodsId(goodsLinkHref);
                  }
                  if (id) {
                    items.push({
                      "id": id,
                      "price": price,
                      "platform": this.currentPlatform,
                      "handler": element,
                      "findA": findA,
                      "from": "search"
                    });
                  }
                }
              });
            }
          });
          Logger.log("info", items);
          if (items.length > 0) {
            yield this.search(items, marketplace, lang, currency);
          }
        } catch (e) {
          Logger.log("error", "pickUpItems: ", e);
        }
      });
    },
    search: function(array, marketplace, lang, currency) {
      return __async$7(this, null, function* () {
        const groups = ItemSearchBaseObj.calcRequestGroup(array);
        const len = groups.length;
        return new Promise((resolve, reject) => {
          if (len <= 0) {
            resolve("complete");
            return;
          }
          const promises = [];
          for (let i = 0; i < groups.length; i++) {
            promises.push(this.createItemHtml(groups[i], marketplace, lang, currency));
          }
          Promise.all(promises).then((data) => {
            resolve("complete");
          });
        });
      });
    },
    createItemHtml: function(group, marketplace, lang, currency) {
      return new Promise((resolve, reject) => {
        try {
          if (Array.isArray(group) && group.length === 0) {
            resolve("exception");
            return;
          }
          let reqId = "";
          const platform = group[0].platform;
          for (var i = 0; i < group.length; i++) {
            if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
              continue;
            }
            reqId += group[i].id + ":" + group[i].price + ",";
          }
          if (reqId.endsWith(",")) {
            reqId = reqId.slice(0, -1);
          }
          Logger.log("info", "request start >>>>>>>>>>>>>", group);
          const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&marketplace=" + marketplace + "&no=11&v=1.0.1&currency=" + currency + "&lang=" + lang;
          Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl);
          ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => {
            Logger.log("info", "request finish >>>>>>>>>>>>>", data);
            delete ItemSearchBaseObj.cacheRequestMap[data.requestKey];
            if (data.code != "success" || !data.result) {
              resolve("exception");
              return;
            }
            const json = JSON.parse(data.result);
            for (let key in json) {
              const { encryptLink, tip } = json[key];
              const item = group.find((obj) => obj.id === key);
              if (!item) {
                continue;
              }
              let handler = null, findA = null;
              if (item.hasOwnProperty("handler") && item.hasOwnProperty("findA")) {
                handler = item.handler;
                findA = item.findA;
              }
              if (!handler || !findA) {
                continue;
              }
              let decryptUrl = null;
              if (encryptLink) {
                try {
                  const decryptLink = atob(encryptLink);
                  decryptUrl = decryptLink.split("").reverse().join("");
                } catch (e) {
                }
              }
              const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA);
              if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) {
                handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true");
                if (tip) {
                  handler.style.position = "relative";
                  handler.insertAdjacentHTML("beforeend", tip);
                  Logger.log("info", "exist coupon >>>>>>>>>>>>>", key);
                }
                if (decryptUrl) {
                  this.relativeJ(handler, decryptUrl);
                  Logger.log("info", "good job >>>>>>>>>>>>>", key);
                }
              }
            }
            resolve("complete");
          });
        } catch (e) {
          Logger.log("error", "createItemHtml: ", e);
          resolve("exception");
        }
      });
    },
    relativeJ: function(handler, decryptUrl) {
      const clickTipAttribute = "tip-vjd1jd89fcv-i";
      let elements = null;
      if (handler.tagName == "A") {
        elements = [handler];
      } else {
        elements = handler.querySelectorAll("a");
      }
      elements.forEach((elementA) => {
        const href = elementA.getAttribute("href");
        if (Banggood.isDetail(href)) {
          if (elementA.getAttribute(clickTipAttribute)) {
            return;
          }
          elementA.setAttribute(clickTipAttribute, "true");
          elementA.addEventListener("click", function(e) {
            let isPreventDefault = true;
            const target = e.target;
            const tagName = target.tagName.toUpperCase();
            if (tagName == "A") {
              const href2 = target.getAttribute("href");
              if (!Banggood.isDetail(href2)) {
                isPreventDefault = false;
              }
            }
            if (isPreventDefault) {
              e.preventDefault();
              e.stopPropagation();
              Tools.openInTab(decryptUrl);
            }
          });
        }
      });
    },
    start: function() {
      return __async$7(this, null, function* () {
        if (!this.isRun())
          return;
        const marketplace = Banggood.getMarketplace(window.location.href);
        const lang = Banggood.getLang();
        const confString = yield ItemSearchBaseObj.requestConf();
        Logger.log("info", "conf ======>", confString);
        if (!confString) {
          return;
        }
        const selectors = ItemSearchBaseObj.pickupGoodsItem(this.currentPlatform, confString);
        Logger.log("info", "search coupon selectors======>", selectors);
        setInterval(() => __async$7(this, null, function* () {
          if (this.loopIsComplete) {
            this.loopIsComplete = false;
            const currency = Banggood.getCurrency();
            yield this.pickUpItems(selectors, marketplace, lang, currency);
            this.loopIsComplete = true;
          }
        }), 1700);
      });
    }
  };

  const Wish = {
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    }
  };

  const Airbaltic = {
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    }
  };

  const Edureka = {
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    }
  };

  const Ranavat = {
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    }
  };

  const Temu = {
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    }
  };

  const Amazon = {
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    }
  };

  const Shopee = {
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    }
  };

  const Shein = {
    getMarketplace: function(url = window.location.href) {
      return Tools.getCommonMarketplace(url);
    }
  };

  const PlatformModules = {
    GoodsHistroy,
    Aliexpress: {
      Aliexpress,
      AliexpressSearch
    },
    Ebay: {
      Ebay,
      EbaySearch
    },
    Lazada: {
      Lazada,
      LazadaSearch
    },
    Bestbuy: {
      Bestbuy,
      BestbuySearch
    },
    Banggood: {
      Banggood,
      BanggoodSearch
    },
    Wish: {
      Wish
    },
    Airbaltic: {
      Airbaltic
    },
    Edureka: {
      Edureka
    },
    Ranavat: {
      Ranavat
    },
    Amazon: {
      Amazon
    },
    Temu: {
      Temu
    },
    Shopee: {
      Shopee
    },
    Shein: {
      Shein
    }
  };

  var css_248z$1 = ".mask-container{align-items:center;background-color:#0003;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;transition:opacity .3s ease,visibility .3s ease;width:100%;z-index:2147483647}.modal-content{box-shadow:1px -3px 6px 0 #0003;max-height:450px;max-width:450px;width:90%}.coupon-list-widget-conent,.modal-content{background-color:#fff;border-radius:6px;display:flex;flex-direction:column;overflow:hidden}.coupon-list-widget-conent{border:1px solid #ebebeb;box-shadow:1px 1px 2px #b6bdc5;height:500px;max-height:85%;position:fixed;right:10px;top:10px;width:350px;z-index:2147483646}.coupon-list-widget-conent .modal-header,.modal-content .modal-header{align-items:center;background:var(--color-modeal-header-background);border-bottom:1px solid #ebe6e6;box-sizing:border-box;display:flex;height:var(--size-height-modeal-header);justify-content:space-between;padding:0 var(--size-padding-horizontal-modeal-header);width:100%}.modal-header .logo>img{width:50px}.coupon-list-widget-conent .logo,.modal-header .logo{align-items:center;display:flex;justify-content:center}.coupon-list-widget-conent .title{flex:1;font-size:var(--size-font-modeal-header-title);font-weight:700;padding-left:10px}.modal-header .btns{display:flex;flex-direction:row}.modal-header .btns .close,.modal-header .btns .setting{align-items:center;cursor:pointer;display:flex;justify-content:center;width:var(--size-height-modeal-operat-icon)}.modal-header svg.icon-svg path{fill:var(--color-modeal-header-icon)}.modal-header svg.icon-svg:hover path{fill:var(--color-modeal-header-icon-hover)}.coupon-list-widget-conent .modal-body{background:var(--color-modeal-content-background);flex:1;overflow-y:auto;position:relative;width:100%}.deal-description-warpper{margin:20px auto;text-align:center}.deal-description-warpper>.title{color:#000;font-size:18px;font-weight:800;margin-bottom:5px}.deal-description-warpper>.sub-title{color:#9f9f9f;font-size:14px}.deal-coupons-warpper{display:flex;mask-image:linear-gradient(90deg,#0000,#000 5%,#000 95%,#0000);-webkit-mask-image:linear-gradient(90deg,#0000,#000 5%,#000 95%,#0000);overflow:hidden;padding:10px 20px;position:relative;scroll-behavior:smooth}.deal-coupons-warpper .coupon-item{background-color:#f6f7ff;border:1px dashed #8096f8;border-radius:4px;color:#ccc;display:inline-block;flex:none;font-size:15px;font-weight:700;margin:5px;padding:5px 10px;white-space:nowrap}.deal-coupons-warpper .coupon-item-active{color:#005cf6!important}.deal-coupons-warpper .coupon-item-lose{text-decoration:line-through!important;text-decoration-thickness:2px!important}.deal-progress-warpper{margin-top:20px}.deal-progress-warpper .progress-container{background-color:#f3f3f3;border-radius:25px;box-shadow:0 2px 4px #0003;margin:0 auto;overflow:hidden;width:100%}.deal-progress-warpper .progress-bar{background-color:#4caf50;color:#fff;font-weight:700;height:8px;line-height:8px;text-align:center;transition:width .5s ease-in-out;width:50%}.widget{cursor:pointer;display:flex;flex-direction:row;position:fixed;right:0;transform:translateX(15px);transition:transform .3s ease;z-index:2147483646}.widget:hover{transform:translateX(0)}.slide-in{animation:slide-in .5s forwards;-webkit-animation:slide-in .5s forwards}.slide-out{animation:slide-out .5s forwards;-webkit-animation:slide-out .5s forwards}.widget .content{border-radius:10px 0 0 10px;direction:ltr!important;display:flex;flex-direction:row}.widget .content .logo{background-color:#ff7227;background-image:url(@logo@);background-position:50%;background-repeat:no-repeat;background-size:40px 40px;border-radius:6px 0 0 6px;box-shadow:0 0 10px #00000040;height:40px;width:40px}.widget .content .notification{background-color:#000;border-radius:50%;color:#fff;font-size:10px;font-weight:600;height:20px;left:-5px;position:absolute;top:-5px;width:20px}.widget .content .drag{background:#0000 linear-gradient(270deg,#fb6d56,#ec6751 59%,#e1624d) 0 0 no-repeat padding-box;cursor:move;height:40px;width:15px}.widget .content .drag img{width:6px!important}.all-center{align-items:center;display:flex;justify-content:center}.pulse-reveal{animation:pulse-reveal 2s ease;animation-iteration-count:10}";

  var css_248z = ".request-state{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.loading{perspective:200px;position:relative;width:50px}.loading:after,.loading:before{animation:scriptJumping .5s infinite alternate;background:#0000;content:\"\";height:20px;position:absolute;width:20px}.loading:before{left:0}.loading:after{animation-delay:.15s;right:0}@keyframes scriptJumping{0%{box-shadow:0 0 0 #0000;transform:scale(1) translateY(0) rotateX(0deg)}to{background:#000;box-shadow:0 25px 40px #000;transform:scale(1.2) translateY(-25px) rotateX(45deg)}}.loading-error-image{text-align:center}.loading-error-image,.loading-error-retry{align-items:center;display:flex;justify-content:center}.loading-error-retry{border:4px solid #ccc;border-radius:50px;cursor:pointer;height:40px;margin:20px auto;width:140px}";

  var __async$6 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const RequestUtil = {
    getDetectCouponParams: function() {
      return __async$6(this, null, function* () {
        const {
          Aliexpress,
          Ebay,
          Lazada,
          Bestbuy,
          Banggood,
          Airbaltic,
          Edureka,
          Ranavat,
          Wish,
          Temu,
          Amazon,
          Shopee,
          Shein
        } = PlatformModules;
        let platform = InspectUtil.getPlatform(), marketplace = "", currency = "";
        let lang = StorageUtil.getValue(StorageKeys.langue.custom, "default");
        if (lang === "default") {
          lang = DefaultVaule.lang;
        }
        switch (platform) {
          case PlatformConst.aliexpress:
            marketplace = Aliexpress.Aliexpress.getMarketplace();
            currency = yield Aliexpress.Aliexpress.getCurrency();
            break;
          case PlatformConst.ebay:
            marketplace = Ebay.Ebay.getMarketplace();
            break;
          case PlatformConst.lazada:
            marketplace = Lazada.Lazada.getMarketplace();
            break;
          case PlatformConst.bestbuy:
            marketplace = Bestbuy.Bestbuy.getMarketplace();
            break;
          case PlatformConst.banggood:
            marketplace = Banggood.Banggood.getMarketplace();
            currency = Banggood.Banggood.getCurrency();
            break;
          case PlatformConst.airbaltic:
            marketplace = Airbaltic.Airbaltic.getMarketplace();
            break;
          case PlatformConst.edureka:
            marketplace = Edureka.Edureka.getMarketplace();
            break;
          case PlatformConst.ranavat:
            marketplace = Ranavat.Ranavat.getMarketplace();
            break;
          case PlatformConst.wish:
            marketplace = Wish.Wish.getMarketplace();
            break;
          case PlatformConst.amazon:
            marketplace = Amazon.Amazon.getMarketplace();
            break;
          case PlatformConst.temu:
            marketplace = Temu.Temu.getMarketplace();
            break;
          case PlatformConst.shopee:
            marketplace = Shopee.Shopee.getMarketplace();
            break;
          case PlatformConst.shein:
            marketplace = Shein.Shein.getMarketplace();
            break;
        }
        const params = {
          platform,
          no: "11",
          version: "1.0.1",
          title: document.title,
          url: window.location.href,
          lang,
          marketplace,
          currency
        };
        Logger.log("info", "detect coupon params===========>", JSON.stringify(params));
        return params;
      });
    },
    request: function(method, url, params) {
      return Tools.request(method, url, params);
    },
    getDetectCouponResult: function() {
      return __async$6(this, null, function* () {
        const params = yield this.getDetectCouponParams();
        const { method, url } = getRequestUrl()["detectCoupon"];
        return this.request(method, url, params);
      });
    },
    getDetectInfoResult: function() {
      return __async$6(this, null, function* () {
        const params = yield this.getDetectCouponParams();
        const { method, url } = getRequestUrl()["detectInfo"];
        return this.request(method, url, params);
      });
    }
  };

  const Activate = {
    generate: function(couponTotal, badgeData, dragData, interfaceData) {
      const badgeCss = Object.entries(badgeData).map(([key, value]) => `${key.replace("_", "-")}:${value}`).join(";");
      const dragCss = Object.entries(dragData).map(([key, value]) => `${key.replace("_", "-")}:${value}`).join(";");
      const interfaceCss = Object.entries(interfaceData).map(([key, value]) => `${key.replace("_", "-")}:${value}`).join(";");
      const drag = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("drag all-center"),
        attributes: {
          "style": dragCss
        },
        childrens: [
          ElementUtil.createElement("img", {
            attributes: {
              src: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='17'%20viewBox='0%200%2010%2017'%3e%3cg%20id='drag_icon'%20data-name='drag%20icon'%20transform='translate(-756.458%20-5682.563)'%3e%3ccircle%20id='Ellipse_277'%20data-name='Ellipse%20277'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(756.458%205682.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_280'%20data-name='Ellipse%20280'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(763.458%205682.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_281'%20data-name='Ellipse%20281'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(756.458%205689.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_283'%20data-name='Ellipse%20283'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(756.458%205696.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_282'%20data-name='Ellipse%20282'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(763.458%205689.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_284'%20data-name='Ellipse%20284'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(763.458%205696.563)'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e",
              draggable: false
            }
          })
        ]
      });
      const logoChildrens = [];
      if (couponTotal != 0) {
        const logoNotification = ElementUtil.createElement("div", {
          className: ElementUtil.randomClassName("notification all-center pulse-reveal"),
          text: couponTotal,
          attributes: {
            "style": badgeCss
          }
        });
        logoChildrens.push(logoNotification);
      }
      const logo = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("logo"),
        childrens: logoChildrens,
        attributes: {
          "style": interfaceCss
        }
      });
      const content = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("content"),
        childrens: [logo, drag]
      });
      const widget = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("widget slide-in"),
        attributes: {
          "style": "top:" + this.getActivateTop() + "px"
        },
        childrens: [content]
      });
      logo.addEventListener("mouseenter", () => {
        widget.classList.remove("slide-in" + CLASSNAME_ID_SUFFIX);
        widget.classList.add("slide-out" + CLASSNAME_ID_SUFFIX);
      });
      logo.addEventListener("mouseleave", () => {
        widget.classList.remove("slide-out" + CLASSNAME_ID_SUFFIX);
        widget.classList.add("slide-in" + CLASSNAME_ID_SUFFIX);
      });
      this.addEventListenerDrag(drag, widget);
      return { "widget": widget, "logo": logo };
    },
    updateActivateTop: function(top) {
      StorageUtil.setValue(StorageKeys.activatePositionTop, top);
    },
    getActivateTop: function() {
      let top = StorageUtil.getValue(StorageKeys.activatePositionTop, 100);
      if (top >= window.innerHeight - 50) {
        top = window.innerHeight - 50;
      }
      return top;
    },
    addEventListenerDrag: function(drag, widget) {
      let isDragging = false, startY, elementY;
      let windowHeight = window.innerHeight;
      const self = this;
      function onMouseMove(e) {
        if (!isDragging)
          return;
        const deltaY = e.clientY - startY;
        let top = elementY + deltaY;
        if (top < 0) {
          top = 0;
        } else if (top > windowHeight - 50) {
          top = windowHeight - 50;
        }
        widget.style.top = `${top}px`;
        self.updateActivateTop(top);
      }
      function onMouseUp() {
        if (!isDragging)
          return;
        isDragging = false;
        document.removeEventListener("mousemove", onMouseMove);
        document.removeEventListener("mouseup", onMouseUp);
      }
      drag.addEventListener("mousedown", (e) => {
        e.preventDefault();
        isDragging = true;
        startY = e.clientY;
        elementY = parseInt(widget.style.top, 10) || 0;
        document.addEventListener("mousemove", onMouseMove);
        document.addEventListener("mouseup", onMouseUp);
      });
    }
  };

  const Mask = {
    generate: function() {
      const mask = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("mask-container")
      });
      return mask;
    }
  };

  class AutoDetectBase {
    constructor() {
      this.BUTTON_CLICK_PASUE_MS = 700;
      this.VALIDATE_DELAY_MAX_MS = 10 * 1e3;
      this.VALIDATE_LOOP_DELAY_MS = 1500;
      this.VALIDATE_END_PASUE_MS = 300;
      this.HookType = {
        "react": "react",
        "default": "default"
      };
    }
    reactHook(element, value, useSetter = true) {
      var _a;
      const inputEvent = new InputEvent("input", {
        view: unsafeWindow,
        bubbles: true,
        cancelable: true
      });
      const changeEvent = new InputEvent("change", {
        view: unsafeWindow,
        bubbles: true,
        cancelable: true
      });
      const keyupEvent = new InputEvent("keyup", {
        view: unsafeWindow,
        bubbles: true,
        cancelable: true
      });
      element.setAttribute("readonly", "readonly");
      setTimeout(() => {
        element.removeAttribute("readonly");
      }, 200);
      const valueSetter = (_a = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")) == null ? void 0 : _a.set;
      if (valueSetter && useSetter) {
        valueSetter.call(element, value);
      } else {
        element.value = value;
      }
      element.dispatchEvent(inputEvent);
      element.dispatchEvent(changeEvent);
      element.dispatchEvent(keyupEvent);
    }
    unusedHook(element, value) {
      element.value = value;
    }
    validate(supportData) {
      const submitButton = document.querySelector(supportData.submitButtonSelector);
      const couponInput = document.querySelector(supportData.couponInputSelector);
      const validateData = { "couponInput": null, "submitButton": null };
      if (couponInput) {
        validateData.couponInput = couponInput;
        validateData.submitButton = submitButton;
      }
      return validateData;
    }
    clickValidateButton(supportData, couponInput, submitButton, code, hookType) {
      if (!couponInput) {
        return new Promise((resolve) => {
          resolve(false);
        });
      }
      if (hookType === this.HookType.react) {
        this.reactHook(couponInput, code);
      } else if (hookType === this.HookType.default) {
        this.unusedHook(couponInput, code);
      }
      if (!submitButton) {
        submitButton = document.querySelector(supportData.submitButtonSelector);
        if (!submitButton) {
          return new Promise((resolve) => {
            resolve(false);
          });
        }
      }
      return new Promise((resolve) => {
        const clickPromise = new Promise((resolveCheck) => {
          setTimeout(() => {
            submitButton.click();
            resolveCheck(true);
          }, this.BUTTON_CLICK_PASUE_MS);
        });
        clickPromise.then((result) => {
          resolve(result);
        });
      });
    }
  }

  var __async$5 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  class AliexpressAutoDetect extends AutoDetectBase {
    start(supportData, code) {
      const { couponInput, submitButton } = this.validate(supportData);
      return new Promise((resolve) => __async$5(this, null, function* () {
        const clickResult = yield this.clickValidateButton(supportData, couponInput, submitButton, code, this.HookType.react);
        if (!clickResult) {
          resolve(clickResult);
          return;
        }
        let errors = null, existingCode = null, inputCode = null;
        let checkResult = false, current = 0;
        const checkInterval = setInterval(() => {
          errors = document.querySelector(supportData.applyErrorSelector);
          if (supportData.existingCodeSelector) {
            existingCode = document.querySelector(supportData.existingCodeSelector);
          }
          inputCode = document.querySelector(supportData.couponInputSelector);
          if (errors || existingCode || !inputCode || current >= this.VALIDATE_DELAY_MAX_MS) {
            clearInterval(checkInterval);
            checkResult = !!existingCode || !inputCode;
            setTimeout(() => {
              resolve(checkResult);
            }, this.VALIDATE_END_PASUE_MS);
          }
          current += this.VALIDATE_LOOP_DELAY_MS;
        }, this.VALIDATE_LOOP_DELAY_MS);
      }));
    }
  }

  var __async$4 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  class WishAutoDetect extends AutoDetectBase {
    start(supportData, code) {
      const { couponInput, submitButton } = this.validate(supportData);
      return new Promise((resolve) => __async$4(this, null, function* () {
        const clickResult = yield this.clickValidateButton(supportData, couponInput, submitButton, code, this.HookType.react);
        if (!clickResult) {
          resolve(clickResult);
          return;
        }
        let errors = null, existingCode = null;
        let checkResult = false, current = 0;
        const checkInterval = setInterval(() => {
          errors = document.querySelector(supportData.applyErrorSelector);
          if (supportData.existingCodeSelector) {
            existingCode = document.querySelector(supportData.existingCodeSelector);
          }
          if (errors || existingCode || current >= this.VALIDATE_DELAY_MAX_MS) {
            clearInterval(checkInterval);
            checkResult = !!existingCode;
            setTimeout(() => {
              resolve(checkResult);
            }, this.VALIDATE_END_PASUE_MS);
          }
          current += this.VALIDATE_LOOP_DELAY_MS;
        }, this.VALIDATE_LOOP_DELAY_MS);
      }));
    }
  }

  var __async$3 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  class EbayAutoDetect extends AutoDetectBase {
    start(supportData, code) {
      const { couponInput, submitButton } = this.validate(supportData);
      return new Promise((resolve) => __async$3(this, null, function* () {
        const clickResult = yield this.clickValidateButton(supportData, couponInput, submitButton, code, this.HookType.react);
        if (!clickResult) {
          resolve(clickResult);
          return;
        }
        let errors = null, existingCode = null;
        let checkResult = false, current = 0;
        const checkInterval = setInterval(() => {
          errors = document.querySelector(supportData.applyErrorSelector);
          if (supportData.existingCodeSelector) {
            existingCode = document.querySelector(supportData.existingCodeSelector);
          }
          if (errors || existingCode || current >= this.VALIDATE_DELAY_MAX_MS) {
            clearInterval(checkInterval);
            checkResult = !!existingCode;
            setTimeout(() => {
              resolve(checkResult);
            }, this.VALIDATE_END_PASUE_MS);
          }
          current += this.VALIDATE_LOOP_DELAY_MS;
        }, this.VALIDATE_LOOP_DELAY_MS);
      }));
    }
  }

  var __async$2 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const DetectHelper = {
    _tryClickExpand: function(supportData) {
      const { couponInputSelector, expandCodeBoxSelectors } = supportData;
      const couponInput = document.querySelector(couponInputSelector);
      if (couponInput) {
        return new Promise((resolve) => {
          resolve(true);
        });
      }
      if (!expandCodeBoxSelectors || expandCodeBoxSelectors.length == 0) {
        return new Promise((resolve) => {
          resolve(false);
        });
      }
      return new Promise((resolve) => __async$2(this, null, function* () {
        let result = false;
        for (let i = 0; i < expandCodeBoxSelectors.length; i++) {
          const elements = document.querySelectorAll(expandCodeBoxSelectors[i]);
          for (let j = 0; j < elements.length; j++) {
            let element = elements[j];
            Logger.log("info", "expand element##############", element);
            element.click();
            result = yield new Promise((resolveInner) => {
              setTimeout(() => {
                let hasCouponInput = document.querySelector(couponInputSelector);
                resolveInner(!!hasCouponInput);
              }, 400);
            });
            if (result) {
              break;
            }
          }
          if (result) {
            break;
          }
        }
        resolve(result);
      }));
    },
    isPrepared: function(supportData) {
      return new Promise((resolve) => {
        Logger.log("info", "##############", "step 1: Verify that the container exists");
        Tools.waitForElementByInterval(supportData.promoContainerSelector, document.body, true, 50, 5 * 1e3).then((promoContainerElement) => {
          if (promoContainerElement) {
            Logger.log("info", "##############", "step 2: Verify whether the code input box needs to be expanded");
            this._tryClickExpand(supportData).then((result) => {
              Logger.log("info", "##############", "step 3: Expanded result", result);
              resolve(result);
            });
          } else {
            resolve(false);
          }
        }).catch(() => {
          resolve(false);
        });
      });
    }
  };
  const AutoDetectUtil = {
    validate: function(platform, supportData) {
      return __async$2(this, null, function* () {
        Logger.log("info", "platform=========>", platform);
        Logger.log("info", "supportData=========>", supportData);
        const preparedData = {
          "result": false
        };
        if (!!platform && !!supportData) {
          const isPrepared = yield DetectHelper.isPrepared(supportData);
          preparedData.result = isPrepared;
        }
        Logger.log("info", "validate data=========>", preparedData);
        return preparedData;
      });
    },
    tryCode: function(platform, supportData, code) {
      let promise = null;
      try {
        if (platform === PlatformConst.aliexpress) {
          promise = new AliexpressAutoDetect().start(supportData, code);
        } else if (platform === PlatformConst.wish) {
          promise = new WishAutoDetect().start(supportData, code);
        } else if (platform === PlatformConst.ebay) {
          promise = new EbayAutoDetect().start(supportData, code);
        }
      } catch (e) {
        console.log("auto try code,", e);
      }
      return promise;
    }
  };

  const CustomAlert = {
    show: function(params) {
      const style = document.createElement("style");
      style.textContent = `
      .custom-alert-container {
        position: fixed;
        top: 30px;
        right: 50px;
        z-index: 99999999;
        width: 250px;
      }
      .custom-alert-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        background-color: #FFF;
        border: 1px solid #ecebeb;
        border-radius: 5px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 10px;
        opacity: 1;
        animation: fadein 0.5s;
      }
      .custom-alert-icon {
        margin-bottom: 10px;
      }
      .custom-alert-message {
        font-size: 15px;
        color: #333;
        text-align: center;
      }
      @keyframes customFadein {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
      }

      @keyframes customFadeout {
        from { opacity: 1; }
        to { opacity: 0; }
      }
    `;
      const container = document.createElement("div");
      container.className = "custom-alert-container";
      const alertContent = document.createElement("div");
      alertContent.className = `custom-alert-content`;
      container.appendChild(alertContent);
      if (params.icon) {
        const icon = document.createElement("div");
        icon.className = "custom-alert-icon";
        icon.innerHTML = params.icon;
        alertContent.appendChild(icon);
      }
      const text = document.createElement("div");
      text.className = "custom-alert-message";
      text.textContent = params.message;
      alertContent.appendChild(text);
      document.body.appendChild(container);
      document.head.appendChild(style);
      setTimeout(() => {
        alertContent.style.animation = "customFadeout 0.5s";
        alertContent.addEventListener("animationend", () => {
          container.remove();
          style.remove();
        });
      }, params.delay);
    }
  };

  var __async$1 = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const ProgressModal = {
    checkIsStop: false,
    _start: function() {
      this.checkIsStop = false;
      document.body.style.overflow = "hidden";
    },
    _end: function() {
      document.body.style.overflow = "auto";
      this.checkIsStop = true;
    },
    initProgress: function(progressBar) {
      progressBar.style.width = "0%";
    },
    updateProgressValue: function(progressBar, value) {
      progressBar.style.width = value * 100 + "%";
    },
    activeCouponItem: function(couponItem) {
      couponItem.classList.add(ElementUtil.randomClassName("coupon-item-active"));
    },
    inactiveCouponItem: function(couponItem) {
      ElementUtil.removeClassByPrefix(couponItem, "coupon-item-active");
      couponItem.classList.add(ElementUtil.randomClassName("coupon-item-lose"));
    },
    closeModal: function(mask) {
      mask.remove();
      this._end();
    },
    addCloseEventListener: function(mask, modal) {
      modal.querySelector("div[class^='close']").addEventListener("click", (e) => {
        this.closeModal(mask);
      });
    },
    showCouponItems: function(mask, modal, platform, coupons, supportData) {
      return __async$1(this, null, function* () {
        const couponsWarpper = modal.querySelector("div[class^='deal-coupons-warpper']");
        const progressBar = modal.querySelector("div[class^='progress-bar']");
        const couponElements = coupons.map((coupon) => {
          return {
            "element": ElementUtil.createElement("div", {
              className: ElementUtil.randomClassName("coupon-item"),
              text: coupon
            }),
            "code": coupon
          };
        });
        couponElements.forEach((item, index2) => {
          couponsWarpper.append(item.element);
        });
        let total = coupons.length;
        const alertHiddenDelay = 2500;
        this.initProgress(progressBar);
        const validateData = yield AutoDetectUtil.validate(platform, supportData);
        if (!validateData || !validateData.result) {
          this.closeModal(mask);
          CustomAlert.show({
            "icon": alertErrorIconSVG,
            "message": LangueUtil.getLangueByStorageKey("auto_detect_alert_error"),
            "delay": alertHiddenDelay
          });
          return;
        }
        const results = [];
        for (let index2 = 0; index2 < total; index2++) {
          if (this.checkIsStop) {
            break;
          }
          const { element, code } = couponElements[index2];
          if (index2 != 0) {
            this.inactiveCouponItem(couponElements[index2 - 1].element);
          }
          this.activeCouponItem(element);
          this.couponScrollToCenter(couponsWarpper, element);
          this.updateProgressValue(progressBar, (index2 + 1) / total);
          let result = yield AutoDetectUtil.tryCode(platform, supportData, code);
          results.push({ "code": code, "result": result });
          if (result) {
            break;
          }
        }
        this.closeModal(mask);
        const successCodeObj = results.find((item) => item.result === true);
        if (successCodeObj) {
          CustomAlert.show({
            "icon": alertSuccessIconSVG,
            "message": LangueUtil.getLangueByStorageKey("auto_detect_alert_success"),
            "delay": alertHiddenDelay
          });
        } else {
          CustomAlert.show({
            "icon": alertErrorIconSVG,
            "message": LangueUtil.getLangueByStorageKey("auto_detect_alert_error"),
            "delay": alertHiddenDelay
          });
        }
      });
    },
    couponScrollToCenter: function(couponsWarpper, element) {
      const couponsWarpperRect = couponsWarpper.getBoundingClientRect();
      const elementRect = element.getBoundingClientRect();
      const scrollLeft = couponsWarpper.scrollLeft + (elementRect.left + elementRect.width / 2) - (couponsWarpperRect.left + couponsWarpperRect.width / 2);
      couponsWarpper.scrollTo({
        left: scrollLeft,
        behavior: "smooth"
      });
    },
    generate: function(outerDIV, platform, coupons, supportData) {
      this._start();
      const modalHtml = `
      <div class="modal-header">
        <div class="logo">
          <img src="` + logoBase64 + `" />
        </div>
        <div class="title"></div>
        <div class="btns">
          <div class="close">` + closeSVG + `</div>
        </div>
      </div>
      <div class="modal-body">
        <div class="deal-pic-warpper"></div>
        <div class="deal-description-warpper">
          <div class="title" langue-extension-text="auto_detect_modal_description">` + LangueUtil.getLangueByStorageKey("auto_detect_modal_description") + `</div>
          <div class="sub-title" langue-extension-text="auto_detect_modal_secondary_description">` + LangueUtil.getLangueByStorageKey("auto_detect_modal_secondary_description") + `</div>
        </div>
        <div class="deal-coupons-warpper"></div>
        <div class="deal-progress-warpper">
          <div class="progress-container">
            <div class="progress-bar"></div>
          </div>
        </div>
      </div>
    `;
      const mask = Mask.generate();
      const modal = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("modal-content"),
        html: ElementUtil.addSuffixToHtml(modalHtml)
      });
      mask.append(modal);
      outerDIV.append(mask);
      this.showCouponItems(mask, modal, platform, coupons, supportData);
      this.addCloseEventListener(mask, modal);
    }
  };

  const CouponListModal = {
    _outerDIV: null,
    addCloseEventListener: function(button, modal) {
      button.addEventListener("click", (e) => {
        modal.remove();
      });
    },
    addShowSettingEventListener: function(button, modal) {
      button.addEventListener("click", (e) => {
        modal.remove();
        Setting.showDialog();
      });
    },
    addApplyCouponsEventListener: function(button, modal) {
      if (!button) {
        return;
      }
      button.addEventListener("click", () => {
        modal.remove();
        const dataContent = button.getAttribute("data-content");
        if (dataContent) {
          const dataContentJson = JSON.parse(dataContent)[0];
          if (dataContentJson.hasOwnProperty("codes") && dataContentJson.hasOwnProperty("platform") && dataContentJson.hasOwnProperty("check")) {
            ProgressModal.generate(this._outerDIV, dataContentJson.platform, dataContentJson.codes, dataContentJson.check);
          }
        }
      });
    },
    generateRequest: function(modalBody) {
      const requestState = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("request-state")
      });
      modalBody.append(requestState);
      return requestState;
    },
    generateRequestLoadding: function() {
      return ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("loading")
      });
    },
    generateRequestLoaddingError: function(callback) {
      const retry = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("loading-error-retry"),
        text: LangueUtil.getLangueByStorageKey("couponList_modal_retry"),
        attributes: {
          "langue-extension-text": "couponList_modal_retry"
        }
      });
      retry.addEventListener("click", () => {
        callback();
      });
      const error = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("loading-error"),
        childrens: [
          ElementUtil.createElement("div", {
            className: ElementUtil.randomClassName("loading-error-image"),
            html: `
            <svg t="1735570722474" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7538" width="64" height="64"><path d="M143.1552 722.0224s-2.56-1.536-7.7824-4.096l4.096-7.2704c4.608 2.56 7.2704 4.096 7.2704 4.096l-3.584 7.2704z m-22.7328-12.9024c-4.608-2.56-9.3184-6.2464-14.4384-9.3184l4.608-7.2704c5.12 3.584 9.8304 6.7584 13.9264 9.3184l-4.096 7.2704z m-28.3648-19.6608c-4.608-3.072-8.8064-6.7584-13.4144-10.8544l5.632-6.7584c4.608 3.584 8.8064 7.2704 13.4144 10.3424l-5.632 7.2704z m-26.8288-22.2208c-4.096-4.096-8.2944-7.7824-12.3904-12.3904l6.2464-5.632c4.096 4.096 7.7824 8.2944 11.8784 11.8784l-5.7344 6.144z m-23.7568-25.2928c-3.584-4.608-7.2704-9.3184-10.3424-13.9264l7.2704-4.608c3.072 4.608 6.2464 8.8064 9.8304 13.4144l-6.7584 5.12z m-19.6608-29.3888c-2.56-5.7344-5.12-10.8544-6.7584-16.4864l8.2944-2.56c1.536 5.12 3.584 10.3424 6.2464 14.9504l-7.7824 4.096z m-10.8544-33.5872c-0.512-4.096-1.024-8.2944-1.024-12.3904v-5.632l8.2944 0.512v5.12c0 3.584 0.512 7.2704 1.024 10.8544l-8.2944 1.536z m10.8544-33.0752l-8.2944-2.56c1.536-5.7344 3.584-11.3664 6.7584-16.4864l7.7824 3.584c-3.1744 5.12-5.2224 10.24-6.2464 15.4624z m815.616-19.6608h-16.9984v-8.2944h16.4864l0.512 8.2944z m17.1008-0.512v-8.2944c5.7344 0 11.3664 0 16.9984-0.512l0.512 8.2944c-5.632 0.512-11.3664 0.512-17.5104 0.512z m-51.2 0c-5.632 0-11.3664-0.512-16.9984-0.512l0.512-8.2944c5.632 0 11.3664 0.512 16.9984 0.512l-0.512 8.2944z m85.8112-1.024l-0.512-8.2944c5.632-0.512 11.3664-0.512 16.9984-1.024l0.512 8.2944c-5.12 0.512-11.3664 0.512-16.9984 1.024z m-120.32-0.512c-5.7344-0.512-11.3664-0.512-16.9984-1.024l0.512-8.2944c5.7344 0.512 11.3664 0.512 17.1008 1.024l-0.6144 8.2944z m-34.0992-2.048c-5.632-0.512-11.3664-1.024-16.9984-1.024l0.512-8.2944c5.632 0.512 11.3664 1.024 16.9984 1.024l-0.512 8.2944z m189.0304-0.512l-1.024-8.2944c5.7344-0.512 11.3664-1.536 16.4864-2.56l1.536 8.2944c-5.632 1.024-11.3664 2.048-16.9984 2.56z m-223.1296-2.048l-17.1008-1.536 1.024-8.2944 16.9984 1.536-0.9216 8.2944z m-663.8592-1.024l-5.7344-6.2464c3.584-3.584 8.8064-7.2704 14.4384-10.3424l4.608 7.2704c-5.5296 3.072-9.6256 6.144-13.312 9.3184z m629.248-2.1504l-16.9984-1.536 1.024-8.2944 16.9984 1.536-1.024 8.2944z m291.84-0.512l-2.048-8.2944c5.7344-1.536 11.3664-2.56 15.9744-4.096l2.56 8.2944c-4.608 1.536-10.3424 3.072-16.4864 4.096z m-325.9392-3.072c-5.7344-0.512-11.3664-1.536-17.1008-2.048l1.024-8.2944c5.632 0.512 11.3664 1.536 16.9984 2.048l-0.9216 8.2944z m-34.0992-4.096c-5.632-0.512-11.3664-1.536-16.9984-2.048l1.024-8.2944c5.7344 0.512 11.3664 1.536 17.1008 2.048l-1.1264 8.2944z m393.1136-4.1984l-4.096-7.7824c5.12-2.56 9.3184-5.7344 12.3904-9.3184l6.2464 5.7344c-3.1744 4.7104-7.8848 8.2944-14.5408 11.3664z m-426.7008-0.512c-5.632-1.024-11.3664-1.536-16.9984-2.56l1.024-8.2944c5.632 1.024 11.3664 1.536 16.9984 2.56l-1.024 8.2944z m-499.5072-3.072l-3.584-7.7824c5.12-2.56 10.3424-4.608 15.9744-6.7584l3.072 7.7824c-5.7344 2.6624-10.8544 4.7104-15.4624 6.7584z m465.408-2.048c-5.7344-1.024-11.3664-1.536-17.1008-2.56l1.536-8.2944c5.632 1.024 11.3664 2.048 16.9984 2.56l-1.4336 8.2944z m-34.0992-5.7344l-16.9984-3.072 1.536-8.2944 17.1008 3.072-1.6384 8.2944z m-399.872-4.608l-3.072-8.2944c5.12-2.048 10.8544-3.584 16.4864-5.12l2.56 8.2944c-5.632 1.536-10.752 3.072-15.9744 5.12z m366.2848-1.024l-16.9984-3.072 1.536-8.2944 16.9984 3.072-1.536 8.2944z m-33.5872-6.7584c-5.7344-1.024-11.3664-2.048-17.1008-3.584l1.536-8.2944c5.632 1.024 11.3664 2.048 16.4864 3.584l-0.9216 8.2944zM128.7168 478.208l-2.048-8.2944c5.12-1.536 10.8544-3.072 16.4864-4.608l2.048 8.2944c-5.632 1.536-11.264 3.072-16.4864 4.608z m875.6224-2.56v-1.024c-0.512-4.096-2.048-8.2944-5.12-12.3904l6.7584-5.12c3.584 5.12 6.2464 10.8544 6.7584 16.4864v1.536l-8.3968 0.512zM395.264 474.112c-5.7344-1.024-11.3664-2.56-16.4864-3.584l2.048-8.2944c5.632 1.024 10.8544 2.56 16.4864 3.584l-2.048 8.2944z m-233.984-4.1984l-1.536-8.2944c5.632-1.536 10.8544-2.56 16.4864-4.096l2.048 8.2944c-5.632 1.536-11.264 2.56-16.9984 4.096z m200.3968-3.584c-5.632-1.536-11.3664-2.56-16.4864-4.096l2.048-8.2944c5.632 1.536 10.8544 2.56 16.4864 4.096l-2.048 8.2944z m-166.8096-4.096l-1.536-8.2944c5.7344-1.024 11.3664-2.048 17.1008-3.584l1.536 8.2944c-6.2464 1.4336-11.4688 2.56-17.1008 3.584z m133.2224-4.1984c-5.632-1.536-11.3664-3.072-16.4864-4.096l2.048-8.2944c5.7344 1.536 10.8544 3.072 16.4864 4.096l-2.048 8.2944z m-99.6352-2.56l-1.536-8.2944 16.9984-3.072 1.536 8.2944c-6.144 1.024-11.8784 2.048-16.9984 3.072z m759.296-3.584c-4.096-2.56-8.8064-5.12-14.4384-7.7824l3.584-7.7824c5.7344 2.56 11.3664 5.7344 15.4624 8.2944l-4.608 7.2704z m-725.7088-2.56l-1.536-8.2944c5.632-1.024 11.3664-2.048 16.9984-2.56l1.024 6.2464 2.56-8.2944c4.608 1.536 9.3184 2.56 14.4384 4.096l-1.024-4.608c5.632-1.024 11.3664-1.536 16.9984-2.56l1.024 8.2944c-5.7344 1.024-10.8544 1.536-15.9744 2.56l-1.536 5.12c-5.632-1.536-10.8544-3.072-16.4864-4.608l0.512 2.048c-5.632 0.9216-11.3664 1.9456-16.9984 2.56z m0-9.8304c-5.7344-1.536-10.8544-3.584-16.4864-5.12l2.56-8.2944c5.12 1.536 10.8544 3.584 15.9744 5.12l-2.048 8.2944z m67.6864-0.512l-1.024-8.2944c5.7344-1.024 11.3664-1.536 16.9984-2.048l1.024 8.2944c-5.632 0.4096-11.3664 1.536-16.9984 2.048z m628.1216-1.024c-5.12-1.536-10.3424-3.072-15.9744-4.608l2.048-8.2944c5.632 1.536 11.3664 3.072 16.4864 5.12l-2.56 7.7824z m-594.6368-3.1744l-1.024-8.2944c5.632-0.512 11.3664-1.536 16.9984-2.048l1.024 8.2944c-5.632 0.512-11.264 1.024-16.9984 2.048z m34.0992-4.096l-1.024-8.2944c5.7344-0.512 11.3664-1.024 17.1008-2.048l1.024 8.2944c-5.7344 1.024-11.3664 1.536-17.1008 2.048z m527.9744-1.536c-5.12-1.024-10.8544-2.048-16.4864-3.072l1.536-8.2944 16.9984 3.072-2.048 8.2944z m-695.808 0c-5.632-2.048-10.8544-3.584-15.9744-5.632l3.072-7.7824c5.12 2.048 10.3424 3.584 15.9744 5.632l-3.072 7.7824z m201.9328-2.048l-1.024-8.2944 16.9984-1.536 1.024 8.2944-16.9984 1.536z m34.0992-3.1744l-1.024-8.8064 16.9984-1.536 0.512 8.2944c-5.12 1.024-10.752 1.536-16.4864 2.048z m426.1888-0.512c-5.7344-1.024-10.8544-1.536-16.9984-2.048l1.024-8.2944c5.7344 0.512 11.3664 1.536 17.1008 2.048l-1.1264 8.2944zM499.6096 420.864l-0.512-8.2944c5.7344-0.512 11.3664-1.024 16.9984-1.024l0.512 8.2944c-5.632 0.512-11.264 1.024-16.9984 1.024z m358.5024-1.536l-16.9984-1.536 0.512-8.2944 16.9984 1.536-0.512 8.2944z m-324.4032-0.512l-0.512-8.2944c5.632-0.512 11.3664-0.512 16.9984-1.024l0.512 8.2944c-5.632 0-11.264 0.512-16.9984 1.024z m-336.7936-1.536c-5.632-2.56-10.8544-4.608-15.9744-6.7584l3.072-7.7824c5.12 2.048 10.3424 4.096 15.4624 6.7584l-2.56 7.7824z m370.8928-0.512l-0.512-8.2944c5.7344-0.512 11.3664-0.512 17.1008-1.024l0.512 8.2944c-5.7344 0.512-11.3664 0.512-17.1008 1.024z m256.2048-0.512c-5.7344-0.512-11.3664-0.512-17.1008-1.024l0.512-8.2944c5.7344 0.512 11.3664 0.512 16.9984 1.024l-0.4096 8.2944zM601.9072 414.72l-0.512-8.2944c5.632 0 11.3664-0.512 16.9984-0.512l0.512 8.2944c-5.632 0.512-11.264 0.512-16.9984 0.512z m188.0064-0.6144c-5.632 0-11.3664-0.512-16.9984-0.512l0.512-8.2944c5.632 0 11.3664 0.512 16.9984 0.512l-0.512 8.2944z m-153.9072-0.512v-8.2944c5.7344 0 11.3664-0.512 17.1008-0.512v8.2944c-5.7344 0-11.3664 0.512-17.1008 0.512z m119.808-0.512c-5.632 0-11.3664 0-16.9984-0.512v-8.2944c5.7344 0 11.3664 0 16.9984 0.512v8.2944z m-85.1968-0.512v-8.2944h16.9984v8.2944h-16.9984z m51.0976 0h-17.1008v-8.2944h17.1008v8.2944z m-556.3392-9.216c-5.12-2.56-10.8544-5.12-15.4624-7.7824l4.096-7.7824c4.608 2.56 9.8304 5.12 14.9504 7.7824l-3.584 7.7824z m-30.9248-16.0768c-5.12-3.072-10.3424-6.2464-14.4384-9.3184l5.12-6.7584c4.096 3.072 8.8064 6.2464 13.9264 9.3184l-4.608 6.7584zM105.984 366.592c-4.608-4.096-8.8064-8.8064-11.8784-12.9024l6.7584-5.12c3.072 4.096 6.7584 7.7824 10.8544 11.8784l-5.7344 6.144z m-20.1728-28.8768c-1.024-3.584-1.536-6.7584-1.536-10.3424 0-3.072 0.512-5.632 1.024-8.8064l8.2944 2.048c-0.512 2.048-0.512 4.096-0.512 6.7584 0 2.56 0.512 5.12 1.024 7.7824l-8.2944 2.56zM100.864 306.176l-7.2704-4.608c3.072-5.12 6.7584-9.8304 10.3424-14.4384l6.7584 5.12c-3.6864 5.12-7.2704 9.3184-9.8304 13.9264z m768.1024-16.4864c-5.632-0.512-11.3664-0.512-16.9984-1.024l0.512-8.2944c5.632 0.512 11.3664 1.024 16.9984 1.024l-0.512 8.2944z m-34.6112-2.6624l-17.1008-1.536 1.024-8.2944 16.9984 1.536-0.9216 8.2944z m-34.0992-4.096c-5.632-0.512-11.3664-1.536-16.9984-2.048l1.024-8.2944c5.632 0.512 11.3664 1.536 16.9984 2.048l-1.024 8.2944z m-678.7072-2.56l-6.2464-6.2464c4.096-4.096 8.2944-8.2944 12.9024-11.8784l5.12 6.7584c-4.096 4.096-8.192 7.7824-11.776 11.3664z m645.12-2.048c-5.632-1.024-11.3664-1.536-16.9984-2.56l1.024-8.2944c5.632 1.024 11.3664 1.536 16.9984 2.56l-1.024 8.2944z m-34.0992-4.7104l-17.1008-2.56 1.536-8.2944 16.9984 2.56-1.4336 8.2944z m-34.0992-5.632l-16.9984-2.56 1.536-8.2944 17.1008 2.56-1.6384 8.2944z m-33.4848-5.7344l-16.9984-3.072 1.536-8.2944 16.9984 3.072-1.536 8.2944z m-517.632-2.56l-4.608-7.2704c4.608-3.072 9.8304-6.2464 14.9504-8.8064l4.096 7.7824c-5.12 2.6624-9.8304 5.2224-14.4384 8.2944z m484.0448-3.072l-17.1008-3.072 1.536-8.2944 16.9984 3.072-1.4336 8.2944z m-34.0992-6.2464l-16.9984-3.072 1.536-8.2944 17.1008 3.072-1.6384 8.2944z m-33.5872-5.632l-16.9984-2.56 1.536-8.2944 16.9984 2.56-1.536 8.2944z m-386.9696-0.512l-3.072-7.7824c5.12-2.048 10.8544-4.096 15.9744-6.2464l2.56 8.2944c-5.12 1.536-10.24 3.6864-15.4624 5.7344z m352.8704-4.7104c-5.7344-1.024-11.3664-1.536-17.1008-2.56l1.024-8.2944c5.7344 1.024 11.3664 1.536 16.9984 2.56l-0.9216 8.2944z m-33.5872-5.12c-5.632-1.024-11.3664-1.536-16.9984-2.56l1.024-8.2944c5.7344 0.512 11.3664 1.536 17.1008 2.56l-1.1264 8.2944z m-287.232-1.024l-2.048-8.2944c5.632-1.536 11.3664-3.072 16.9984-4.096l1.536 8.2944c-5.632 1.024-11.264 2.56-16.4864 4.096z m253.6448-3.584c-5.632-0.512-11.3664-1.536-16.9984-2.048l1.024-8.2944c5.632 0.512 11.3664 1.536 16.9984 2.048l-1.024 8.2944z m-220.5696-3.6864l-1.536-8.2944c5.7344-1.024 11.3664-1.536 17.1008-2.56l1.024 8.2944c-5.7344 0.512-11.4688 1.536-16.5888 2.56z m186.4704 0l-17.1008-1.536 1.024-8.2944 16.9984 1.536-0.9216 8.2944z m-34.0992-3.072c-5.632-0.512-11.3664-1.024-16.9984-1.024l0.512-8.2944c5.632 0.512 11.3664 0.512 16.9984 1.024l-0.512 8.2944z m-118.784-1.024l-0.512-8.2944c5.632-0.512 11.3664-1.024 16.9984-1.024l0.512 8.2944c-6.144 0-11.8784 0.512-16.9984 1.024z m84.6848-1.024c-5.632 0-11.3664-0.512-16.9984-0.512v-8.2944c5.7344 0 11.3664 0.512 16.9984 0.512v8.2944z m-51.0976-1.024v-8.2944h16.9984v8.2944h-16.9984z m585.728 70.7584h-8.8064l0.512-8.2944h8.2944v8.2944z m0 0" fill="#CCE1FF" p-id="7539"></path><path d="M677.376 592.384l-324.4032 1.024c-3.072 0-6.2464-2.56-6.2464-6.2464v-7.7824c0-3.072 2.56-6.2464 6.2464-6.2464l324.4032-1.024c3.072 0 6.2464 2.56 6.2464 6.2464v7.7824c-0.6144 3.6864-3.1744 6.2464-6.2464 6.2464z m0 0" fill="#E6EFFF" p-id="7540"></path><path d="M863.8464 323.2768c-38.1952-42.9056-92.4672-99.7376-144.0768-160.6656l-287.232 1.024-2.048 39.7312 36.1472 25.2928-34.0992 8.2944 34.0992 30.0032-27.3408 4.608-21.1968 53.248-19.1488-25.2928-36.1472-19.1488 23.2448-27.8528-47.104-21.1968 30.0032-21.1968-25.2928-45.9776-124.5184 0.512c-23.2448 0-41.8816 19.1488-41.8816 42.3936l1.536 389.5296c0 23.2448 19.1488 41.8816 42.3936 41.8816l602.3168-1.536c23.2448 0 41.8816-19.1488 41.8816-42.3936l-1.536-271.2576z m0 0" fill="#FFFFFF" p-id="7541"></path><path d="M220.16 640.9216c-11.8784 0-23.2448-4.608-32.0512-13.4144-8.8064-8.8064-13.4144-20.1728-13.4144-32.0512l-1.536-389.5296c0-11.8784 4.608-23.2448 12.9024-32.0512 8.8064-8.8064 20.1728-13.4144 32.0512-13.4144l126.5664-0.512 27.8528 50.0736-27.8528 19.6608 45.4656 20.6848-23.7568 27.8528 33.5872 18.1248 15.9744 21.1968 19.6608-49.5616 22.7328-3.584-33.5872-29.4912 33.0752-8.2944-32.0512-22.7328 2.048-44.9536 291.84-1.024 1.024 1.024c34.0992 40.2432 69.2224 78.5408 100.2496 112.64 15.9744 16.9984 30.5152 33.0752 43.4176 47.5136l1.024 1.024v1.024l1.024 270.6432c0 24.7808-20.1728 45.4656-44.9536 45.4656L220.16 640.9216z m121.4464-474.2144l-122.9824 0.512c-10.3424 0-20.1728 4.096-27.3408 11.3664-7.2704 7.2704-11.3664 17.1008-11.3664 27.3408l1.536 389.5296c0 10.3424 4.096 20.1728 11.3664 27.3408 7.2704 7.2704 16.9984 11.3664 27.3408 11.3664l602.3168-1.536c21.7088 0 38.7072-17.6128 38.7072-39.2192l-1.024-269.1072c-12.9024-14.4384-27.3408-30.0032-42.3936-47.0016-31.0272-33.5872-65.6384-71.7824-99.7376-111.616l-282.5216 0.512-1.536 35.1232 40.2432 28.3648-35.1232 9.3184 34.6112 30.5152-32.5632 5.12-22.7328 56.832-22.1184-29.9008-39.2192-20.6848 23.2448-27.3408-48.0256-21.7088 32.0512-22.7328-22.7328-42.3936z m0 0" fill="#A2ADC2" p-id="7542"></path><path d="M860.672 318.0544c-1.024 7.7824-7.7824 12.9024-14.9504 12.3904l-137.9328-14.4384c-7.7824-1.024-12.9024-7.7824-12.3904-14.9504l11.3664-125.0304c1.024-7.7824 7.7824-12.9024 14.9504-12.3904l138.9568 154.4192z m0 0" fill="#FFEED4" p-id="7543"></path><path d="M847.2576 333.6192h-1.536l-137.9328-13.9264c-4.608-0.512-8.2944-2.56-11.3664-6.2464-2.56-3.584-4.096-7.7824-3.584-12.3904l11.3664-125.0304c1.024-9.3184 9.3184-15.9744 18.6368-14.9504h1.024l1.024 1.024 139.4688 154.9312v1.536c-1.024 8.8064-8.8064 15.0528-17.1008 15.0528zM720.6912 167.2192c-5.12 0-9.8304 4.096-10.3424 9.3184l-11.3664 125.0304c-0.512 2.56 0.512 5.7344 2.048 7.7824s4.096 3.584 7.2704 3.584l137.9328 14.4384c2.56 0.512 5.7344-0.512 7.7824-2.048s3.072-3.584 3.584-5.7344L720.6912 167.2192z m0 0" fill="#A2ADC2" p-id="7544"></path><path d="M828.7232 864.0512h-629.76c-15.4624 0-28.3648-12.9024-28.3648-28.3648l-42.3936-271.6672c0-15.4624 12.9024-28.3648 28.3648-28.3648h720.0768c15.4624 0 28.3648 12.9024 28.3648 28.3648L857.088 835.6864c-0.512 15.4624-12.9024 28.3648-28.3648 28.3648z m0 0" fill="#FFEED4" p-id="7545"></path><path d="M828.7232 867.2256h-629.76c-17.6128 0-31.5392-13.9264-31.5392-31.5392l-42.3936-271.1552c0-18.1248 13.9264-32.0512 31.5392-32.0512h720.0768c17.5104 0 31.5392 13.9264 31.5392 31.5392L860.16 836.1984c0 16.9984-14.4384 31.0272-31.4368 31.0272zM156.672 538.624c-13.9264 0-25.2928 11.3664-25.2928 25.2928l42.3936 271.1552c0 14.4384 11.3664 25.8048 25.2928 25.8048h629.1456c13.9264 0 25.2928-11.3664 25.2928-25.2928l48.0256-272.2816c0-13.4144-11.3664-24.7808-25.2928-24.7808H156.672z m0 0" fill="#A2ADC2" p-id="7546"></path><path d="M411.3408 671.9488c0 3.584 1.536 7.7824 4.096 10.3424s6.7584 4.096 10.3424 4.096 7.7824-1.536 10.3424-4.096 4.096-6.7584 4.096-10.3424-1.536-7.7824-4.096-10.3424-6.7584-4.096-10.3424-4.096-7.7824 1.536-10.3424 4.096c-2.56 3.072-4.096 6.656-4.096 10.3424z m170.9056 0c0 3.584 1.536 7.7824 4.096 10.3424s6.7584 4.096 10.3424 4.096 7.7824-1.536 10.3424-4.096 4.096-6.7584 4.096-10.3424-1.536-7.7824-4.096-10.3424-6.7584-4.096-10.3424-4.096-7.7824 1.536-10.3424 4.096c-2.4576 3.072-4.096 6.656-4.096 10.3424z m0 0M561.152 757.6576c5.12 0 9.3184-3.072 8.2944-6.7584-4.608-18.1248-27.8528-32.0512-55.808-32.0512-27.8528 0-51.0976 13.9264-55.808 32.0512-1.024 3.584 3.072 6.7584 8.2944 6.7584 4.096 0 7.7824-2.048 8.2944-4.608 3.072-12.9024 19.6608-22.2208 39.2192-22.2208 19.6608 0 35.6352 9.8304 39.2192 22.2208 0.512 2.56 4.096 4.608 8.2944 4.608z m0 0" fill="#A2ADC2" p-id="7547"></path><path d="M33.1776 498.8928c0 71.8848 58.2656 130.1504 130.1504 130.1504 71.8848 0 130.1504-58.2656 130.1504-130.1504s-58.2656-130.1504-130.1504-130.1504c-71.8848 0-130.1504 58.2656-130.1504 130.1504z m0 0" fill="#FFFFFF" p-id="7548"></path><path d="M163.328 632.1152c-73.3184 0-133.3248-59.904-133.3248-133.3248S90.0096 365.568 163.328 365.568s133.3248 59.904 133.3248 133.3248-60.0064 133.2224-133.3248 133.2224z m0-260.3008c-69.7344 0-127.0784 56.832-127.0784 127.0784 0 69.7344 56.832 127.0784 127.0784 127.0784s127.0784-56.832 127.0784-127.0784c0-69.7344-56.832-127.0784-127.0784-127.0784z m0 0" fill="#A2ADC2" p-id="7549"></path><path d="M173.6704 572.2112c-2.56 2.56-6.2464 4.608-9.8304 4.608s-7.2704-1.536-9.8304-4.096-4.096-6.7584-4.096-10.3424 1.536-7.7824 4.096-10.3424 6.2464-4.608 9.8304-4.608 7.2704 1.536 9.8304 4.096 4.096 6.7584 4.096 10.3424-1.536 7.7824-4.096 10.3424z m5.2224-116.736l-6.2464 71.7824c0 5.7344-4.608 9.8304-9.8304 9.8304-5.12 0-9.8304-4.096-10.3424-9.8304l-9.3184-71.7824c-0.512-1.536-0.512-2.56-0.512-4.096 0-10.3424 7.7824-19.1488 18.1248-19.1488s18.6368 8.2944 18.6368 18.6368c0 2.048-0.512 3.584-0.512 4.608z m0 0M643.7888 601.1904c-2.56 0-4.608 2.048-4.608 4.096v32.5632c0 2.56 2.048 4.096 4.608 4.096s4.608-2.048 4.608-4.096v-32.5632c0-2.048-2.048-4.096-4.608-4.096z m19.0464 0c-2.56 0-4.608 2.048-4.608 4.096v32.5632c0 2.56 2.048 4.096 4.608 4.096s4.608-2.048 4.608-4.096v-32.5632c0.1024-2.048-1.9456-4.096-4.608-4.096z m21.1968 0c-2.56 0-4.608 2.048-4.608 4.096v32.5632c0 2.56 2.048 4.096 4.608 4.096s4.608-2.048 4.608-4.096v-32.5632c0.1024-2.048-2.048-4.096-4.608-4.096z m0 0" fill="#A2ADC2" p-id="7550"></path></svg>
          `
          }),
          retry
        ]
      });
      return error;
    },
    setCouponsHtml: function(modal) {
      const modalBody = modal.querySelector("div[name='modalBody']");
      const self = this;
      const generateRequest = this.generateRequest(modalBody);
      const generateRequestLoadding = this.generateRequestLoadding();
      const generateRequestLoaddingError = this.generateRequestLoaddingError(() => {
        generateRequest.remove();
        this.setCouponsHtml(modal);
      });
      generateRequest.append(generateRequestLoadding);
      RequestUtil.getDetectCouponResult().then((reqData) => {
        if (reqData.code !== "success") {
          generateRequestLoadding.remove();
          generateRequest.append(generateRequestLoaddingError);
          return;
        }
        generateRequest.remove();
        const { data, structure } = JSON.parse(reqData.result);
        if (structure.hasOwnProperty("css") && structure.hasOwnProperty("html")) {
          const { css, html } = structure;
          StyleUtil.addStyle(css);
          modalBody.innerHTML = html;
          [".discount-base", ".cgg-store-item", ".showmore-btn"].flatMap((selector) => Array.from(document.querySelectorAll(selector))).forEach((button, index) => {
            InspectUtil.bindCustomEvent(button);
          });
          const tabs = modalBody.querySelectorAll("a[data-toggle='tab']");
          const tabPanes = modalBody.querySelectorAll(".tab-pane");
          tabs.forEach((element) => {
            element.addEventListener("click", function(e) {
              e.preventDefault();
              e.stopPropagation();
              tabs.forEach((tab) => tab.classList.remove("active"));
              e.target.classList.add("active");
              tabPanes.forEach((tab) => tab.classList.remove("fade-in", "active"));
              const toggle = modalBody.querySelector(e.target.getAttribute("data-href") || e.target.getAttribute("href"));
              toggle.classList.add("fade-in", "active");
            });
          });
          const items = modalBody.querySelectorAll(".cgg-store-item");
          items.forEach((item) => {
            item.addEventListener("mouseenter", (e) => {
              e.target.querySelector("span").classList.add("underline-show");
            });
            item.addEventListener("mouseleave", (e) => {
              e.target.querySelector("span").classList.remove("underline-show");
            });
          });
          const activateButton = modalBody.querySelector("*[name='activateButton']");
          self.addApplyCouponsEventListener(activateButton, modal);
        }
      }).catch((error) => {
        generateRequestLoadding.remove();
        generateRequest.append(generateRequestLoaddingError);
      });
    },
    generate: function(outerDIV, title, modalPosition) {
      this._outerDIV = outerDIV;
      const contentHtml = `
      <div class="modal-header">
        <div class="logo">
          <img src="` + logoBase64 + `" />
        </div>
        <div class="title">` + title + `</div>
        <div class="btns">
          <div class="setting">` + settingSVG + `</div>
          <div class="close">` + closeSVG + `</div>
        </div>
      </div>
      <div class="modal-body" name="modalBody">

      </div>
    `;
      let modelCss = Object.entries(modalPosition).map(([key, value]) => `${key.replace("_", "-")}:${value}`).join(";");
      const modal = ElementUtil.createElement("div", {
        className: ElementUtil.randomClassName("coupon-list-widget-conent"),
        html: ElementUtil.addSuffixToHtml(contentHtml),
        attributes: {
          "style": modelCss
        }
      });
      outerDIV.append(modal);
      const close = modal.querySelector("div[class^='close_']");
      const setting = modal.querySelector("div[class^='setting_']");
      this.addCloseEventListener(close, modal);
      this.addShowSettingEventListener(setting, modal);
      this.setCouponsHtml(modal);
      return modal;
    }
  };

  var __async = (__this, __arguments, generator) => {
    return new Promise((resolve, reject) => {
      var fulfilled = (value) => {
        try {
          step(generator.next(value));
        } catch (e) {
          reject(e);
        }
      };
      var rejected = (value) => {
        try {
          step(generator.throw(value));
        } catch (e) {
          reject(e);
        }
      };
      var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
      step((generator = generator.apply(__this, __arguments)).next());
    });
  };
  const InspectCouponsHTML = {
    addStyle: function() {
      const css = ElementUtil.addSuffixToCss(css_248z$1 + css_248z);
      StyleUtil.addStyle(css.replace(/@logo@/g, logoBase64));
    },
    outerDIV: null,
    start: function() {
      return __async(this, null, function* () {
        let infoJson = null;
        try {
          const info = yield RequestUtil.getDetectInfoResult();
          Logger.log("info", "detect info=========>", info);
          if (info.code === "success") {
            infoJson = JSON.parse(info.result);
          }
        } catch (e) {
          console.log("req exception", e);
        }
        Logger.log("info", "detect info json=========>", infoJson);
        if (!infoJson)
          return;
        if (!infoJson["show"]) {
          return;
        }
        const couponTotal = infoJson["coupon_total"];
        const modalPosition = infoJson["modal"];
        const iconJson = infoJson["icon"];
        const badgeData = iconJson["badge"];
        const dragData = iconJson["drag"];
        const interfaceData = iconJson["interface"];
        const cggJson = infoJson["cgg"];
        const autoOpen = cggJson["auto_open"];
        const modalTitle = cggJson["current_platform"];
        const selectedLanguage = LangueUtil.getSelectedLanguage();
        this.addStyle();
        const outerDIV = InspectUtil.generateOuterContainer(selectedLanguage.dir);
        outerDIV.setAttribute("data-re-mark-tag", InspectUtil.getPlatform());
        this.outerDIV = outerDIV;
        const { widget, logo } = Activate.generate(couponTotal, badgeData, dragData, interfaceData);
        outerDIV.append(widget);
        logo.addEventListener("click", (e) => {
          CouponListModal.generate(outerDIV, modalTitle, modalPosition);
        });
        if (autoOpen) {
          CouponListModal.generate(outerDIV, modalTitle, modalPosition);
        }
      });
    }
  };

  const MidListener = {
    start: function() {
      if ((window.location.host !== "www.jtm.pub" || window.location.href.indexOf("www.jtm.pub/mid/merge") == -1) && !ScriptConst.isDev) {
        return;
      }
      const autoRedirect = document.querySelector(".auto-redirect");
      if (autoRedirect) {
        const dataContent = autoRedirect.getAttribute("data-content");
        InspectUtil.customOpenUrl(dataContent);
      }
    }
  };

  var __defProp$1 = Object.defineProperty;
  var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
  var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
  var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __spreadValues$1 = (a, b) => {
    for (var prop in b || (b = {}))
      if (__hasOwnProp$1.call(b, prop))
        __defNormalProp$1(a, prop, b[prop]);
    if (__getOwnPropSymbols$1)
      for (var prop of __getOwnPropSymbols$1(b)) {
        if (__propIsEnum$1.call(b, prop))
          __defNormalProp$1(a, prop, b[prop]);
      }
    return a;
  };
  const supportModules = {
    InspectCouponsHTML,
    MidListener
  };
  const AllModules$1 = __spreadValues$1(__spreadValues$1({}, PlatformModules), supportModules);

  var __defProp = Object.defineProperty;
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __spreadValues = (a, b) => {
    for (var prop in b || (b = {}))
      if (__hasOwnProp.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    if (__getOwnPropSymbols)
      for (var prop of __getOwnPropSymbols(b)) {
        if (__propIsEnum.call(b, prop))
          __defNormalProp(a, prop, b[prop]);
      }
    return a;
  };
  const otherModules = {
    X,
    Tiktok
  };
  const AllModules = __spreadValues(__spreadValues({}, otherModules), AllModules$1);

  const Init = {
    x: function() {
      AllModules.X.XDownload.init();
      AllModules.X.XSettingsDialog.init();
      const observer = new MutationObserver((ms) => ms.forEach((m) => {
        m.addedNodes.forEach((node) => {
          AllModules.X.XDownload.detect(node);
          AllModules.X.XDateFormat.repldatetime();
          AllModules.X.XOrigimg();
          AllModules.X.XHidepromo();
        });
      }));
      observer.observe(document.body, {
        childList: true,
        subtree: true
      });
    },
    tiktok: function() {
      AllModules.Tiktok.start();
    },
    aliexpress: function() {
      AllModules.Aliexpress.Aliexpress.start();
      AllModules.Aliexpress.AliexpressSearch.start();
      AllModules.GoodsHistroy.start(PlatformConst.aliexpress);
    },
    ebay: function() {
      AllModules.Ebay.Ebay.start();
      AllModules.Ebay.EbaySearch.start();
      AllModules.GoodsHistroy.start(PlatformConst.ebay);
    },
    lazada: function() {
      AllModules.Lazada.Lazada.start();
      AllModules.Lazada.LazadaSearch.start();
      AllModules.GoodsHistroy.start(PlatformConst.lazada);
    },
    bestbuy: function() {
      AllModules.Bestbuy.Bestbuy.start();
      AllModules.Bestbuy.BestbuySearch.start();
      AllModules.GoodsHistroy.start(PlatformConst.bestbuy);
    },
    banggood: function() {
      AllModules.Banggood.Banggood.start();
      AllModules.Banggood.BanggoodSearch.start();
      AllModules.GoodsHistroy.start(PlatformConst.banggood);
    },
    unknown: function() {
      Logger.log("error", "Hoooo,This method was not found");
    },
    start: function() {
      const platform = Tools.getEcommercePlatform();
      if (platform) {
        LangueUtil.initLangueDataMap().then(() => {
          Logger.log("info", "init langue ==========>", "complete!");
          StyleUtil.init();
          AllModules.InspectCouponsHTML.start();
          try {
            if (typeof this[platform] === "function") {
              this[platform]();
            } else {
              console.log("error", "Hoooo,This method was not found");
            }
          } catch (e) {
            console.log("error", "Hoooo,catch", e);
          }
          AllModules.MidListener.start();
        });
        if (platform == PlatformConst.aliexpress) {
          setInterval(() => {
            Tools.removeAnchorsBySeletor();
          }, 2500);
        }
      }
      const otherPlatform = Tools.getOtherPlatform();
      if (otherPlatform) {
        try {
          this[otherPlatform]();
        } catch (e) {
          console.log("error", "Hoooo,catch", e);
        }
      }
    }
  };
  Init.start();

}());