(() => {
      // fetch('https://trustmate.io/widget/api/cf83f909-0a9e-4c62-83e5-6251816c2e64/html?product=84059') - TODO: remove after platform multihornet fix - !!!frontend do not remove 
  
  const UI = {
    last: (where, what) => {where?.append(what)},
    first: (where, what) => {where?.insertBefore(what, where.firstChild)},
    after: (where, what) => {where?.parentNode.insertBefore(what, where.nextSibling)},
    before: (where, what) => {where?.parentNode.insertBefore(what, where)},
    replace: (where, what) => {where?.replaceWith(what)}
  };

  const RELOADS_LIMIT = 10;
  let reloadsCount = 0;

  function loadWidgetHtml() {
    const tag = document.getElementById('cf83f909-0a9e-4c62-83e5-6251816c2e64');

    if (tag) {
      widgetConfig = {
        target: tag.dataset.t,
        action: tag.dataset.a,
        observe: tag.dataset.o
      };

      if (widgetConfig.target && widgetConfig.action) {
        if (!Object.hasOwn(UI, widgetConfig.action)) {
          console.error(`TrustMate: action '${widgetConfig.action}' is wrong`);
          return;
        }

        const target = document.querySelector(widgetConfig.target);

        if (!target) {
          console.error(`TrustMate: target '${widgetConfig.target}' not found`);
          return;
        }

        UI[widgetConfig.action](target, tag);
      }

      tag.innerHTML = `<style>
 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');
 @keyframes spin{0%{transform:translateX(-50%) rotate(0deg)}100%{transform:translateX(-50%) rotate(360deg)}}@keyframes spin{0%{transform:translateX(-50%) rotate(0deg)}100%{transform:translateX(-50%) rotate(360deg)}}@keyframes spin{0%{transform:translateX(-50%) rotate(0deg)}100%{transform:translateX(-50%) rotate(360deg)}}.tm-dark-mode .tm-omnibus-modal__button{background:rgba(0,0,0,0)}.tm-dark-mode .tm-hydra__empty-box{color:#fff}.tm-light-mode .tm-omnibus-modal__button{background:rgba(0,0,0,0)}.tm-light-mode .tm-hydra__empty-box{color:color-primary-new}.tm-hydra{box-sizing:border-box;clear:both;color:#1d1d1b;line-height:1.5;margin:0;padding:0;word-break:initial;display:block !important;font-family:"Open Sans",Sans-Serif;font-size:10px;display:flex;gap:16px;flex-direction:column;font-size:10px;font-family:"Inter",sans-serif}.tm-hydra *,.tm-hydra *::after,.tm-hydra *::before{box-sizing:border-box;margin:0;padding:0;color:inherit;font-size:inherit;font-family:"Inter",sans-serif !important;line-height:inherit;text-transform:none}.tm-hydra label{font-weight:400}.tm-hydra a{background:none;color:inherit;font-weight:400;text-decoration:none}.tm-hydra a:hover,.tm-hydra a:focus{color:inherit;text-decoration:none}.tm-hydra a:focus{outline:initial}.tm-hydra .tm-lazy-background{background-color:#f0f8ff}@media(max-width: 768px){.tm-hydra .hide-on-mobile{display:none !important}}.tm-hydra .tm-no-reviews{background-color:#fff;border-radius:.8em;color:#000;display:flex;flex-direction:column;gap:2.4em;height:fit-content;justify-content:center;margin:0 auto;padding:10%;text-align:center;width:fit-content}.tm-hydra .tm-no-reviews__text{font-size:2em;font-weight:700}.tm-hydra .tm-score-box{color:#000;display:flex;height:100%}.tm-hydra .tm-score-box__recomeded-reviews{display:flex;flex-direction:column;justify-content:space-around;text-align:center;margin:1.6em 0}.tm-hydra .tm-score-box__no-reviews{font-size:2em;font-weight:700}.tm-hydra .tm-score-box__recomended-products{font-size:1.3em;font-weight:400}.tm-hydra .tm-score-box__grade{align-items:center;background-color:#fff;border-radius:16px;color:#1d1d1b;display:flex;flex-direction:column;font-size:.9em;gap:8px;justify-content:center;padding:6% 10%;width:100%}.tm-hydra .tm-score-box__stars{align-items:center;display:flex;gap:.4em}.tm-hydra .tm-score-box__star{display:flex}.tm-hydra .tm-score-box__star img{height:3.2em;width:auto;max-width:unset}.tm-hydra .tm-score-box__star .trustmate-star__icon{position:relative;height:1.9em;content:url("data:image/svg+xml;utf8,<svg width='100%' height='100%' viewBox='0 0 35 40' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M34.6637 11.889C31.5072 12.9634 26.9789 14.8724 22.2597 18.3307C20.04 19.96 18.2109 21.616 14.0466 25.9534C10.7658 29.3762 6.39737 34.0866 1.38072 39.9734C1.42956 35.081 2.0866 27.6226 5.1987 19.1831C8.5239 10.1798 13.2609 3.79578 16.5594 0C17.0478 2.17092 17.8202 4.74584 19.0766 7.52053C19.8846 9.3141 20.7592 10.8857 21.6071 12.2353C19.1698 13.3762 15.8047 15.2897 12.4484 18.4462C9.74476 20.9856 7.88461 23.5516 6.63266 25.5805C8.6704 23.1032 12.1954 19.4539 17.5361 16.515C24.5816 12.6393 31.1787 11.9822 34.6682 11.889H34.6637Z' fill='url(%23paint0_linear_122_1139)'/><path d='M28.7503 19.1298C27.1432 21.6426 26.0644 24.0133 25.3363 25.9756C26.1798 27.6981 27.05 29.7758 27.7781 32.1864C28.6526 35.0988 29.0966 37.7403 29.3186 39.9334C27.0677 38.0999 24.4129 36.1554 21.3408 34.2552C18.4329 32.4484 15.6626 31.0011 13.1499 29.8335C13.9712 28.7813 15.1343 27.3474 16.5994 25.7092C18.4151 23.6759 20.8613 20.9367 24.1155 18.3352C26.3885 16.5194 29.8513 14.1309 34.6549 12.0976L34.6238 12.1243C32.8702 13.7491 30.7303 16.0532 28.7592 19.1298H28.7503Z' fill='url(%23paint1_linear_122_1139)'/><path d='M6.35294 14.0643C5.51831 14.0466 4.34628 13.9356 3.00999 13.505C1.69145 13.0788 0.683685 12.4927 0 12.0222C0.0355161 13.4828 0.195339 15.2408 0.617092 17.1897C1.15427 19.6448 1.94895 21.6737 2.69034 23.2142C3.09878 21.7136 3.63596 20.0532 4.35516 18.2819C4.99445 16.7103 5.67813 15.303 6.3485 14.0643H6.35294Z' fill='url(%23paint2_linear_122_1139)'/><defs><linearGradient id='paint0_linear_122_1139' x1='-4.32798' y1='33.8316' x2='27.5032' y2='4.1867' gradientUnits='userSpaceOnUse'><stop stop-color='%23FFA727'/><stop offset='0.05' stop-color='%23FE9F20'/><stop offset='0.2' stop-color='%23FD8D0E'/><stop offset='0.36' stop-color='%23FC8103'/><stop offset='0.53' stop-color='%23FC7E00'/><stop offset='1' stop-color='%23FF4800'/></linearGradient><linearGradient id='paint1_linear_122_1139' x1='19.0632' y1='36.174' x2='39.4215' y2='17.2162' gradientUnits='userSpaceOnUse'><stop stop-color='%23FFA727'/><stop offset='0.05' stop-color='%23FE9F20'/><stop offset='0.2' stop-color='%23FD8D0E'/><stop offset='0.36' stop-color='%23FC8103'/><stop offset='0.53' stop-color='%23FC7E00'/><stop offset='1' stop-color='%23FF4800'/></linearGradient><linearGradient id='paint2_linear_122_1139' x1='2.99011' y1='11.7112' x2='4.1884' y2='23.0595' gradientUnits='userSpaceOnUse'><stop stop-color='%23FFA727'/><stop offset='0.05' stop-color='%23FE9F20'/><stop offset='0.2' stop-color='%23FD8D0E'/><stop offset='0.36' stop-color='%23FC8103'/><stop offset='0.53' stop-color='%23FC7E00'/><stop offset='1' stop-color='%23FF4800'/></linearGradient></defs></svg>");height:3.2em}.tm-hydra .tm-score-box__star--dimmed{opacity:.3}.tm-hydra .tm-score-box__star--first-half{position:absolute;overflow:hidden}.tm-hydra .tm-score-box__star--second-half{width:100%}.tm-hydra .tm-score-box__half-star{position:relative}.tm-hydra .tm-score-box__reviews{text-align:center}.tm-hydra .tm-score-box__value{font-size:6.6em;font-weight:600}.tm-hydra .tm-score-box__reviews-count{font-size:1.6em;font-weight:500}.tm-hydra .tm-score-box__verified{font-size:1.34em;text-align:center}.tm-hydra .tm-score-box__logo img{max-height:2.8em;height:auto;width:auto;max-width:100%}.tm-hydra .tm-abuse-report{width:10px;height:12px;top:2px;cursor:pointer;background-color:#fff;position:absolute;left:calc(100% + 2px);background-repeat:no-repeat;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='auto' height='12' viewBox='0 0 60 60' fill='%23000000'><g><path d='M30,16c4.411,0,8-3.589,8-8s-3.589-8-8-8s-8,3.589-8,8S25.589,16,30,16z'/><path d='M30,44c-4.411,0-8,3.589-8,8s3.589,8,8,8s8-3.589,8-8S34.411,44,30,44z'/><path d='M30,22c-4.411,0-8,3.589-8,8s3.589,8,8,8s8-3.589,8-8S34.411,22,30,22z'/></g></svg>")}.tm-hydra .tm-abuse-report--qa{top:8px;left:calc(100% + 10px)}.tm-hydra .tm-abuse-report>div{position:relative;width:0;height:0}.tm-hydra .tm-abuse-report__text{display:none;position:absolute;width:max-content;min-height:16px;height:max-content;text-decoration:none;color:#1d1d1b;cursor:pointer;padding:3px 5px;background:#fff;position:absolute;box-shadow:2px 2px 5px rgba(0,0,0,0.1019607843);right:-8px;top:20px;z-index:2;border-radius:4px}.tm-hydra .tm-omnibus-modal__button{height:min-content;background:rgba(0,0,0,0)}.tm-hydra__empty-box{width:100%;min-height:100px;max-height:600px;position:absolute;left:50%;color:inherit;transform:translateX(-50%);display:flex;align-items:center;justify-content:center}.tm-hydra__empty-box p{font-size:1.8em;font-weight:500;text-align:center}.tm-hydra__empty-box--hide{display:none}.tm-hydra__r1{align-items:stretch;display:flex;gap:1.6em;height:auto;justify-content:center;margin:0 auto;max-width:1400px;width:100%}.tm-hydra__r1--mobile{flex-flow:row wrap;font-size:.7em}.tm-hydra__r1--mobile>div{width:calc(50% - .8em)}.tm-hydra__r1--tablet{font-size:.8em}.tm-hydra__module{align-items:stretch;display:flex;justify-content:center;max-width:400px;width:100%}.tm-hydra__module--mobile-trait{order:1;min-width:100%}.tm-hydra__module--size-2{max-width:800px}.tm-hydra__module--size-3{max-width:1200px;margin:0 auto}.tm-hydra__module--mobile-photos{order:1;min-width:100%}.tm-hydra__main{height:auto;max-width:1400px;margin:0 auto;width:100%;transition:filter .4s ease-in-out}.tm-hydra__main--blur{filter:blur(6px)}.tm-hydra-button{border-radius:9.6px;font-size:1em;border:none;font-size:1.2em;font-weight:600;display:flex;align-items:center;line-height:1.2;text-align:center;justify-content:center;gap:1.2em;padding:1em 2.4em;color:#fff;background:linear-gradient(180deg, #ff8730 0%, #ff6b00 100%);width:fit-content}.tm-hydra-button .tm-loader{border:.8em solid #ff6b00;border-top:.8em solid rgba(0,0,0,0);border-radius:50%;z-index:100;width:12em;height:12em;position:absolute;left:50%;z-index:999;transform:translate(-50% 10%);animation:spin 2s linear infinite}.tm-hydra-button .tm-loader--small{width:1.6em;display:none;height:1.6em;left:unset;transform:unset;margin-left:1.2em;position:relative;border:.4em solid #fff;border-top:.4em solid rgba(0,0,0,0)}.tm-hydra-button--ghost{border:1px solid #ff6b00;background:none;color:#ff6b00}.tm-hydra-button--sm{font-size:1em;padding:1em 1.8em}.tm-hydra-button--lg{font-size:1.4em}.tm-hydra-button--hide{opacity:0}.tm-hydra-button--hide:hover{opacity:1}.tm-hydra-button:hover{cursor:pointer;background:#ff6b00}.tm-hydra-avatar{background-position:50% 50%;background-repeat:no-repeat;background-size:contain;font-size:1.8em;height:40px;width:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;background-color:#000;color:#fff}.tm-hydra-avatar--secondary{background-color:#ff8730}
 
</style><div
 class="tm-hydra tm-widget tm-light-mode"
 style="display: none;"
 data-url="https://trustmate.io/"
 data-rating-image=tm-new-star
 data-tm-qa-tab=""
 data-tm-reviews-tab="1"
 data-tm-expert-tab=""
 data-tm-widget-token="cf83f909-0a9e-4c62-83e5-6251816c2e64"
 data-tm-filters-enabled="1"
 data-tm-enable-lazy-loading-image="1"
 data-tm-enable-lazy-loading-script="1"
><div class="tm-no-reviews"><span class="tm-no-reviews__text">
 Il prodotto non ha recensioni
 </span><a href="#" style="cursor: default;" ><img loading="lazy" width="140" height="27" src="https://trustmate.io/images/logo-trustmate-2022.svg" alt="TrustMate logo"><a /></div></div>`;

      if (widgetConfig.target && widgetConfig.action && widgetConfig.observe) {
        const observeTag = document.querySelector(widgetConfig.observe);
        if (observeTag) {
          const widgetObserver = new MutationObserver((mutations, observer) => {
            const tag = document.getElementById('cf83f909-0a9e-4c62-83e5-6251816c2e64');
            if (tag) return;
            observer.disconnect();
            if (reloadsCount >= RELOADS_LIMIT) {
              console.error('TrustMate: widget cf83f909-0a9e-4c62-83e5-6251816c2e64 reload limit reached');
              return;
            }
            ++reloadsCount;
            const newTag = document.createElement('div');
            newTag.id = 'cf83f909-0a9e-4c62-83e5-6251816c2e64';
            newTag.dataset.a = widgetConfig.action;
            newTag.dataset.t = widgetConfig.target;
            newTag.dataset.o = widgetConfig.observe;
            const target = document.querySelector(widgetConfig.target);
            if (!target) {
              console.error(`TrustMate: target '${widgetConfig.target}' not found after last html change`);
              return;
            }
            UI[widgetConfig.action](target, newTag);
            loadWidgetScript();
          });
          widgetObserver.observe(observeTag, {childList: true, subtree: true});
        }
      }
    } else {
      console.error('TrustMate: No tag for cf83f909-0a9e-4c62-83e5-6251816c2e64');
    }
  }

  function waitForWindow() {
    let index = 0;
    const intervalWindowId = setInterval(function() {
      if (typeof window !== 'undefined') {
        clearInterval(intervalWindowId);
        loadWidgetScript();
      }
      index += 1;
      if (index > 50) {
        clearInterval(intervalWindowId);
      }
    }, 50);
  }

  function loadWidgetScript() {
    if (10097 < 10) return;

    function scriptExists(url) {
      return document.querySelectorAll(`script[src="${url}"]`).length > 0;
    }

    if(scriptExists('https\u003A\/\/trustmate.io\/build\/js\/widget\/hydra.4fc26233.js')) {
      function removeJs(src) {
        document.querySelector(`script[src="${src}"]`).remove();
      }

      removeJs('https\u003A\/\/trustmate.io\/build\/js\/widget\/hydra.4fc26233.js');
    }

    const widgetScript = document.createElement('script');
    widgetScript.src = 'https\u003A\/\/trustmate.io\/build\/js\/widget\/hydra.4fc26233.js';
    widgetScript.defer = true;
    widgetScript.onload = () => {
      loadWidgetHtml();
    };
    document.body.appendChild(widgetScript);
  }

  if (typeof window === 'undefined') {
    waitForWindow();
  } else {
    loadWidgetScript();
  }
})();
