// Font
require('@assets/fonts/icons.font.js');

// create global $ and jQuery variables
$ = require('jquery');
global.$ = global.jQuery = $;

require('@static/js/jquery-ui.1.12.1.js');
require('@static/css/jquery-ui-1.8.16.custom.scss');

//require('@static/bootstrap/bootstrap.scss'); // todo presunuto do style.scss
require('@static/bootstrap/js/bootstrap.js');

require('@static/js/chosen.jquery.js');
require('@static/js/ajax-chosen.js');
require('@static/js/chosen.sortable.js');
require('@static/js/jquery.fs.stepper.min.js');
require('@static/js/bootstrap-filestyle.min.js');

// Custom functions -->
const functions = require('@static/js/functions.js');
// Expose exported to global
(function() {
   for (let key in functions) {
      if (functions.hasOwnProperty(key)) {
         window[key] = functions[key];
      }
   }
})();

require('@static/js/jquery.history.js');
require('@static/js/jquery.hotkeys.js');
const BigNumber = require('@static/js/bignumber.js');

window.BigNumber = BigNumber;

// Admin autocomplete -->
require('@static/js/wpj.template.js');
require('@static/js/wpj.domUtils.js');
require('@static/js/wpj.autocomplete.js');
require('@static/js/wpj.formUtils.js');
require('@static/js/wpj.windowUtils.js');
require('@static/js/wpj.clipboard.js');
require('@static/js/wpj.buttonLoading.js');

require('@static/js/wpj.translationsFigure.js');

/**
 * @typedef WidgetProps require('../../static/sections-autocomplete/index.tsx').WidgetProps
 *
 * @type {{ prepareRuntime: (runtimeElement?: HTMLElement) => HTMLElement; mountAutocomplete: (target: HTMLElement, options?: WidgetProps) => void }}
 */
wpj.SectionsAutocomplete = require('@static/sections-autocomplete/index.tsx');

wpj.llmModal = require('@static/llm-modal/index.tsx');
// Styles
require('@static/scss/style.scss');

const Favico = require('@static/js/favico.js');

window.FavicoInit = function() {
   var bgColor = '#1c6ee8';
   var currUrl = window.location.href;

   if (currUrl.indexOf('kupshop.local') >= 0) {
      bgColor = '#e9573f';
   }

   var favicon = new Favico({
      animation: 'popFade',
      bgColor: bgColor
   });

   favicon.badge('A');
};
