@topvisor/ui 1.0.8 → 1.0.9-fix-css
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.chunks/datepicker-Cs3C14z5.amd.js +248 -0
- package/.chunks/datepicker-Cs3C14z5.amd.js.map +1 -0
- package/.chunks/datepicker-LNkS97nF.es.js +290 -0
- package/.chunks/datepicker-LNkS97nF.es.js.map +1 -0
- package/.chunks/forms-BydHEF-k.es.js +1928 -0
- package/.chunks/forms-BydHEF-k.es.js.map +1 -0
- package/.chunks/forms-Cq5zFLsO.amd.js +3 -0
- package/.chunks/forms-Cq5zFLsO.amd.js.map +1 -0
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-B0xTxYZR.amd.js +2 -0
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-B0xTxYZR.amd.js.map +1 -0
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-DinMn3Ud.es.js +174 -0
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-DinMn3Ud.es.js.map +1 -0
- package/.chunks/menu.vue_vue_type_style_index_0_lang-BT-PgdJ5.amd.js +2 -0
- package/.chunks/menu.vue_vue_type_style_index_0_lang-BT-PgdJ5.amd.js.map +1 -0
- package/.chunks/menu.vue_vue_type_style_index_0_lang-C585WUlJ.es.js +109 -0
- package/.chunks/menu.vue_vue_type_style_index_0_lang-C585WUlJ.es.js.map +1 -0
- package/.chunks/{popup-D-G2sXks.es.js → popup-B7AaTfNZ.es.js} +494 -493
- package/.chunks/popup-B7AaTfNZ.es.js.map +1 -0
- package/.chunks/popup-D22VHVHf.amd.js +448 -0
- package/.chunks/popup-D22VHVHf.amd.js.map +1 -0
- package/.chunks/store-CX_6ZXhO.es.js.map +1 -1
- package/.chunks/store-esTid5oI.amd.js.map +1 -1
- package/README.md +86 -86
- package/assets/charts.css +1 -0
- package/assets/core.css +1 -1
- package/assets/forms.css +1 -1
- package/assets/project.css +1 -1
- package/assets/tabsView.css +1 -1
- package/assets/themes/dark.css +1 -1
- package/assets/themes/light.css +1 -1
- package/charts/charts.amd.js +2 -0
- package/charts/charts.amd.js.map +1 -0
- package/charts/charts.d.ts +2 -0
- package/charts/charts.js +120 -0
- package/charts/charts.js.map +1 -0
- package/components/charts/charts.d.ts +3 -0
- package/components/charts/miniChart/miniChart.d.ts +80 -0
- package/components/charts/miniChart/miniChart.vue.d.ts +15 -0
- package/components/charts/miniChart/stories/dummy.d.ts +13 -0
- package/components/charts/miniChart/utils/consts.d.ts +8 -0
- package/components/formsExt/selector2/selector2.vue.d.ts +16 -20
- package/components/popup/alert/alert.vue.d.ts +8 -7
- package/components/popup/confirm/confirm.d.ts +1 -1
- package/components/popup/confirm/confirm.vue.d.ts +8 -7
- package/components/popup/lib/popup.d.ts +1 -1
- package/components/popup/popup/popup.d.ts +8 -4
- package/components/popup/popup/popup.vue.d.ts +8 -8
- package/components/popup/prompt/prompt.d.ts +1 -1
- package/components/popup/prompt/prompt.vue.d.ts +8 -7
- package/components/project/project.d.ts +9 -0
- package/components/project/tagSelector/popupListItem/tagPopupListItem.vue.d.ts +18 -0
- package/components/project/tagSelector/popupListItem/types.d.ts +33 -0
- package/components/project/tagSelector/popupOpener/popupOpener.vue.d.ts +26 -0
- package/components/project/tagSelector/popupOpener/types.d.ts +62 -0
- package/components/project/tagSelector/tagIcon/tagIcon.vue.d.ts +4 -0
- package/components/project/tagSelector/tagIcon/types.d.ts +21 -0
- package/components/project/tagSelector/tagSelector.vue.d.ts +37 -0
- package/components/project/tagSelector/tagsDefaults.d.ts +3 -0
- package/components/project/tagSelector/types.d.ts +138 -0
- package/components/project/tagSelector/utils/el.d.ts +19 -0
- package/components/project/tagSelector/utils/utils.d.ts +14 -0
- package/core/app.amd.js +1 -1
- package/core/app.amd.js.map +1 -1
- package/core/app.js +52 -45
- package/core/app.js.map +1 -1
- package/core/core/core.d.ts +4 -0
- package/core/directives/data.d.ts +10 -0
- package/core/utils/route.d.ts +1 -1
- package/forms/forms.amd.js +1 -1
- package/forms/forms.js +5 -5
- package/forms/helpers.amd.js.map +1 -1
- package/forms/helpers.js.map +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.amd.js.map +1 -1
- package/formsExt/formsExt.js +121 -166
- package/formsExt/formsExt.js.map +1 -1
- package/icomoon/Read Me.txt +7 -7
- package/icomoon/Topvisor icons.json +5845 -5845
- package/icomoon/demo-files/demo.css +161 -161
- package/icomoon/demo-files/demo.js +30 -30
- package/icomoon/demo.html +3379 -3379
- package/icomoon/fonts/Topvisor-2.svg +263 -263
- package/icomoon/style.css +740 -740
- package/package.json +37 -37
- package/popup/popup.amd.js +1 -1
- package/popup/popup.amd.js.map +1 -1
- package/popup/popup.js +103 -108
- package/popup/popup.js.map +1 -1
- package/popup/worker.amd.js +1 -1
- package/popup/worker.amd.js.map +1 -1
- package/popup/worker.js +2 -2
- package/popup/worker.js.map +1 -1
- package/project/project.amd.js +1 -1
- package/project/project.amd.js.map +1 -1
- package/project/project.js +814 -262
- package/project/project.js.map +1 -1
- package/require/css.amd.js +12 -12
- package/tabs/tabs.amd.js +1 -1
- package/tabs/tabs.amd.js.map +1 -1
- package/tabs/tabs.js +41 -59
- package/tabs/tabs.js.map +1 -1
- package/tabsView/tabsView.amd.js +1 -1
- package/tabsView/tabsView.amd.js.map +1 -1
- package/tabsView/tabsView.js +144 -183
- package/tabsView/tabsView.js.map +1 -1
- package/utils/check.amd.js +1 -1
- package/utils/check.amd.js.map +1 -1
- package/utils/check.js +1 -1
- package/utils/check.js.map +1 -1
- package/utils/clipboard.amd.js.map +1 -1
- package/utils/clipboard.js.map +1 -1
- package/utils/date.amd.js +1 -1
- package/utils/date.js +1 -1
- package/utils/device.amd.js +1 -1
- package/utils/device.js +1 -1
- package/utils/dom.amd.js.map +1 -1
- package/utils/dom.js.map +1 -1
- package/utils/image.amd.js.map +1 -1
- package/utils/image.js.map +1 -1
- package/utils/keyboard.amd.js.map +1 -1
- package/utils/keyboard.js.map +1 -1
- package/utils/lodash.amd.js +1 -1
- package/utils/lodash.js +5 -5
- package/utils/number.amd.js.map +1 -1
- package/utils/number.js.map +1 -1
- package/utils/price.amd.js +1 -1
- package/utils/price.amd.js.map +1 -1
- package/utils/price.js +1 -1
- package/utils/price.js.map +1 -1
- package/utils/route.amd.js +1 -1
- package/utils/route.amd.js.map +1 -1
- package/utils/route.js +15 -15
- package/utils/route.js.map +1 -1
- package/utils/scroll.amd.js.map +1 -1
- package/utils/scroll.js.map +1 -1
- package/utils/searchers.amd.js.map +1 -1
- package/utils/searchers.js.map +1 -1
- package/utils/string.amd.js +1 -1
- package/utils/string.amd.js.map +1 -1
- package/utils/string.js +1 -1
- package/utils/string.js.map +1 -1
- package/utils/system.amd.js.map +1 -1
- package/utils/system.js.map +1 -1
- package/utils/url.amd.js.map +1 -1
- package/utils/url.js.map +1 -1
- package/web-types.json +89 -72
- package/.chunks/datepicker-CRfiJCmp.amd.js +0 -248
- package/.chunks/datepicker-CRfiJCmp.amd.js.map +0 -1
- package/.chunks/datepicker-CugKFVIH.es.js +0 -290
- package/.chunks/datepicker-CugKFVIH.es.js.map +0 -1
- package/.chunks/forms-CHiMZ8vg.es.js +0 -2015
- package/.chunks/forms-CHiMZ8vg.es.js.map +0 -1
- package/.chunks/forms-CjYoXTEQ.amd.js +0 -3
- package/.chunks/forms-CjYoXTEQ.amd.js.map +0 -1
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-Bb7B8CTJ.es.js +0 -174
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-Bb7B8CTJ.es.js.map +0 -1
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-CEF3WDJ_.amd.js +0 -2
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-CEF3WDJ_.amd.js.map +0 -1
- package/.chunks/menu-CHeV29rC.es.js +0 -118
- package/.chunks/menu-CHeV29rC.es.js.map +0 -1
- package/.chunks/menu-D1lnYuWU.amd.js +0 -2
- package/.chunks/menu-D1lnYuWU.amd.js.map +0 -1
- package/.chunks/popup-C4Tne4qA.amd.js +0 -447
- package/.chunks/popup-C4Tne4qA.amd.js.map +0 -1
- package/.chunks/popup-D-G2sXks.es.js.map +0 -1
- package/.chunks/utils-BOlUthaH.es.js +0 -91
- package/.chunks/utils-BOlUthaH.es.js.map +0 -1
- package/.chunks/utils-x88W55mf.amd.js +0 -2
- package/.chunks/utils-x88W55mf.amd.js.map +0 -1
- package/components/project/utils.d.ts +0 -1
- package/core/core.amd.js +0 -2
- package/core/core.amd.js.map +0 -1
- package/core/core.d.ts +0 -4
- package/core/core.js +0 -6
- package/core/core.js.map +0 -1
- package/project/utils.amd.js +0 -2
- package/project/utils.amd.js.map +0 -1
- package/project/utils.d.ts +0 -2
- package/project/utils.js +0 -6
- package/project/utils.js.map +0 -1
- package/test/themes/themes/dark-positions.amd.js +0 -2
- package/test/themes/themes/dark-positions.amd.js.map +0 -1
- package/test/themes/themes/dark-positions.d.ts +0 -1
- package/test/themes/themes/dark-positions.js +0 -2
- package/test/themes/themes/dark-positions.js.map +0 -1
- package/test/themes/themes/dark.amd.js +0 -2
- package/test/themes/themes/dark.amd.js.map +0 -1
- package/test/themes/themes/dark.d.ts +0 -1
- package/test/themes/themes/dark.js +0 -4
- package/test/themes/themes/dark.js.map +0 -1
- package/test/themes/themes/light-positions.amd.js +0 -2
- package/test/themes/themes/light-positions.amd.js.map +0 -1
- package/test/themes/themes/light-positions.d.ts +0 -1
- package/test/themes/themes/light-positions.js +0 -2
- package/test/themes/themes/light-positions.js.map +0 -1
- package/test/themes/themes/light.amd.js +0 -2
- package/test/themes/themes/light.amd.js.map +0 -1
- package/test/themes/themes/light.d.ts +0 -1
- package/test/themes/themes/light.js +0 -4
- package/test/themes/themes/light.js.map +0 -1
package/popup/worker.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.amd.js","sources":["../../src/components/popup/lib/worker.ts"],"sourcesContent":["/**\r\n * PopupWorker управлеяет работой Popup\r\n *\r\n * Должен грузить Popup только в отложенном режиме\r\n */\r\n\r\nimport Core from '@/core/core/core';\r\nimport DOM from '@/core/utils/dom';\r\nimport { genHasScroll } from '@/core/utils/scroll';\r\nimport type { Popup, PopupOptions } from '@/components/popup/lib/popup';\r\nimport type { OpenerProps } from '@/components/popup/popup/popup';\r\n\r\nexport type Options = {\r\n\t/**\r\n\t * Глобальное событие, которое будет вызвано перед открытием TopPopup\r\n\t */\r\n\tdecoratorBeforeOpen?: (TopPopupInstance: Popup) => void,\r\n\r\n\t/**\r\n\t * Глобальное событие, которое будет вызвано после открытия TopPopup\r\n\t */\r\n\tdecoratorAfterOpen?: (TopPopupInstance: Popup) => void;\r\n\r\n\t/**\r\n\t * Определитель того, что клик вне Popup нужно игнорировать\r\n\t * @returns {boolean} - если true, то click не приведет к закрытию Popup\r\n\t */\r\n\tdecoratorIsIgnoreOuterClick?: (e: MouseEvent) => boolean\r\n}\r\n\r\nclass Worker {\r\n\r\n\t/**\r\n\t * Глобальное выключение закрытия меню, используется при различных оверлеях\r\n\t */\r\n\tstatic noClose = false;\r\n\r\n\t/**\r\n\t * Для взаимодействия с vue\r\n\t */\r\n\tstatic vueConnectors = new Map();\r\n\r\n\tstatic options: Options = {};\r\n\r\n\t/**\r\n\t * Вернуть объект компонента popup, привязанный к элементу\r\n\t */\r\n\tstatic getPopup(elPopup: HTMLElement): Popup {\r\n\t\treturn DOM.storage(elPopup, 'TopPopup') as Popup;\r\n\t}\r\n\r\n\t/**\r\n\t * Вернуть все элементы с Popup\r\n\t */\r\n\tstatic getAll(): HTMLElement[] {\r\n\t\treturn DOM.querySelectorAllArray(document, '.top-popup-wrapper');\r\n\t}\r\n\r\n\t/**\r\n\t * Вернуть все элементы с открытыми Popup\r\n\t */\r\n\tstatic getAllVisible(): HTMLElement[] {\r\n\t\treturn DOM.querySelectorAllVisible(document, '.top-popup-wrapper');\r\n\t}\r\n\r\n\t/**\r\n\t * Открть Popup от указанного elOpener\r\n\t * @param {HTMLElement} elOpener - элемент, который должен вызвать открытие Popup\r\n\t */\r\n\tstatic async openByOpener(elOpener: HTMLElement): Promise<Popup | undefined> {\r\n\t\tif (!(elOpener instanceof HTMLElement)) return;\r\n\r\n\t\tconst options: PopupOptions = {};\r\n\r\n\t\toptions.popup = elOpener.dataset.topPopup;\r\n\r\n\t\toptions.id = elOpener.dataset.topPopupId;\r\n\r\n\t\t/**\r\n\t\t * @deprecated topPopupP - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupP) {\r\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupP);\r\n\t\t}\r\n\r\n\t\tif (elOpener.dataset.topPopupPos) {\r\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupPos);\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * @deprecated '1' - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupNotch) {\r\n\t\t\toptions.notch = elOpener.dataset.topPopupNotch === 'true' || elOpener.dataset.topPopupNotch === '1';\r\n\t\t}\r\n\r\n\t\tif (elOpener.dataset.topPopupClass) {\r\n\t\t\toptions.class = elOpener.dataset.topPopupClass;\r\n\t\t}\r\n\r\n\t\tif (elOpener.dataset.topPopupPosBy) {\r\n\t\t\toptions.posBy = elOpener.dataset.topPopupPosBy as PopupOptions['posBy'];\r\n\t\t}\r\n\r\n\t\tif (elOpener.dataset.topPopupFront) {\r\n\t\t\toptions.frontSelector = elOpener.dataset.topPopupFront;\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * @deprecated '1' - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupInvertX) {\r\n\t\t\toptions.invertX = elOpener.dataset.topPopupInvertX === 'true' || elOpener.dataset.topPopupInvertX === '1';\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * @deprecated '1' - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupOpenByHover) {\r\n\t\t\toptions.openByHover = elOpener.dataset.topPopupOpenByHover === 'true' || elOpener.dataset.topPopupOpenByHover === '1';\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * @deprecated '1' - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupUseOriginal) {\r\n\t\t\toptions.useOriginal = elOpener.dataset.topPopupUseOriginal === 'true' || elOpener.dataset.topPopupUseOriginal === '1';\r\n\t\t}\r\n\r\n\t\treturn await Worker.open(elOpener, options);\r\n\t}\r\n\r\n\t/**\r\n\t * Создать и открыть Popup\r\n\t * @param elOpener - элемент, вызвавший открытие Popup\r\n\t * @param options - опции Popup\r\n\t */\r\n\tprivate static async open(elOpener: HTMLElement, options: PopupOptions): Promise<Popup> {\r\n\t\tif (elOpener instanceof HTMLElement) elOpener.dataset.topPopupOpened = 'opened';\r\n\r\n\t\tconst { default: Popup } = await import('./popup');\r\n\r\n\t\tif (Core.$) {\r\n\t\t\tconst $elOpener = Core.$(elOpener);\r\n\r\n\t\t\t// deprecated, используется aftershow.top-menu-popup\r\n\t\t\tif ($elOpener.data('aftershow')) {\r\n\t\t\t\tlet afterShow = $elOpener.data('aftershow');\r\n\t\t\t\tif (typeof (afterShow) == 'string') {\r\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\r\n\t\t\t\t\t// @deprecated\r\n\t\t\t\t\tafterShow = eval(afterShow.replace(/\\W/g, ''));\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$elOpener.one('aftershow.top-menu-popup', afterShow);\r\n\t\t\t}\r\n\r\n\t\t\t// deprecated, используется afterclose.top-menu-popup\r\n\t\t\tif ($elOpener.data('afterclose')) {\r\n\t\t\t\tlet afterclose = $elOpener.data('afterclose');\r\n\t\t\t\tif (typeof (afterclose) == 'string') {\r\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\r\n\t\t\t\t\t// @deprecated\r\n\t\t\t\t\tafterclose = eval(afterclose.replace(/\\W/g, ''));\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$elOpener.one('afterclose.top-menu-popup', afterclose);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\toptions.isFullScreen = Core.state.isMobile;\r\n\r\n\t\treturn new Popup(elOpener, options);\r\n\t}\r\n\r\n\tstatic close(elPopup: HTMLElement): void {\r\n\t\tconst popup = Worker.getPopup(elPopup);\r\n\t\tif (popup) {\r\n\t\t\tpopup.close();\r\n\t\t}\r\n\t}\r\n\r\n\tstatic recalcPosition(elPopup: HTMLElement): void {\r\n\t\tconst popup = Worker.getPopup(elPopup);\r\n\t\tif (popup && popup.elPopupBody instanceof HTMLElement) {\r\n\t\t\tpopup.recalcPosition();\r\n\r\n\t\t\t// контроль за состоянием тени скролла\r\n\t\t\t// вызывать после имзенения высоты скролла popup.elPopupBody\r\n\t\t\tgenHasScroll(popup.elPopupBody);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Скролл к активному элементу списка\r\n\t */\r\n\tstatic scrollToActive(elPopup: HTMLElement): void {\r\n\t\tconst elItemActive = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li > .top-active');\r\n\t\tif (!elItemActive) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst elUl = elPopup.querySelector('ul.top-popup_content');\r\n\t\tconst elsLi = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li');\r\n\r\n\t\telPopup.classList.add('top-popup-wrapper-no_animate');\r\n\t\tsetTimeout(() => elPopup.classList.remove('top-popup-wrapper-no_animate'), 100);\r\n\r\n\t\tlet top = 100;\r\n\t\tfor (const elLi of elsLi) {\r\n\t\t\tif (elLi.querySelector(':scope > .top-active')) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tif (elLi instanceof HTMLElement) top += elLi.offsetHeight;\r\n\t\t}\r\n\r\n\t\tif (elUl instanceof HTMLElement) {\r\n\t\t\tconst heightWrapper = elUl.offsetHeight;\r\n\t\t\tif (top > heightWrapper) {\r\n\t\t\t\telUl.scrollTop = top - heightWrapper;\r\n\t\t\t} else {\r\n\t\t\t\telUl.scrollTop = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tstatic decoratorBeforeOpen(popup: Popup): void {\r\n\t\tif (this.options.decoratorBeforeOpen) {\r\n\t\t\tthis.options.decoratorBeforeOpen(popup);\r\n\t\t}\r\n\t};\r\n\r\n\tstatic decoratorAfterOpen(popup: Popup): void {\r\n\t\tif (this.options.decoratorAfterOpen) {\r\n\t\t\tthis.options.decoratorAfterOpen(popup);\r\n\t\t}\r\n\t};\r\n\r\n\tstatic decoratorIsIgnoreOuterClick(e: MouseEvent): boolean {\r\n\t\tif (this.options.decoratorIsIgnoreOuterClick) {\r\n\t\t\treturn this.options.decoratorIsIgnoreOuterClick(e);\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/**\r\n\t * Зарегистрировать Vue компонент\r\n\t *\r\n\t * Каждый экземляр Popup регистрируется в словаре vueConnectors для последующего доступа из js\r\n\t */\r\n\tstatic regVueComponent(id: string, vueConnector: any): void {\r\n\t\tif (Worker.vueConnectors.get(id)) {\r\n\t\t\tthrow 'Vue component Popup use duplicated id: ' + id;\r\n\t\t}\r\n\r\n\t\tWorker.vueConnectors.set(id, vueConnector);\r\n\t}\r\n\r\n\t/**\r\n\t * Снять с регистрации Vue компонент\r\n\t */\r\n\tstatic unregVueComponent(id: string): void {\r\n\t\tWorker.vueConnectors.delete(id);\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировтаь элемент для открытия popup\r\n\t */\r\n\tstatic genElPopupOpener(tagName: string, props: OpenerProps, ...elsChildrens: HTMLElement[] | string[]): HTMLElement {\r\n\t\tconst el = DOM.genEl(tagName, {}, ...elsChildrens);\r\n\r\n\t\tel.dataset.topPopup = '#' + props.id;\r\n\r\n\t\tfor (let name in props) {\r\n\t\t\tconst attrName = 'topPopup' + name.charAt(0).toUpperCase() + name.slice(1);\r\n\r\n\t\t\tel.dataset[attrName] = props[name];\r\n\t\t}\r\n\r\n\t\treturn el;\r\n\t}\r\n\r\n}\r\n\r\nexport default Worker;\r\n"],"names":["elPopup","elOpener2","options2","popup","top","elLi","elsLi","elUl","heightWrapper","e","id","vueConnector","el","tagName","elsChildrens","name","props"],"mappings":"+MA8BA,MAAA,MAAA,CAAa,OAAA,QAAA,GAKK,OAAA,cAAA,IAAA,IAKc,OAAA,QAAA,CAAA,EAEJ,OAAA,SAAAA,EAAA,qPAqB3B,aAAA,aAAAC,EAAA,CAOC,GAAA,EAAAA,aAAA,aAAA,OAEA,MAAAC,EAAA,CAAA,8DASAD,EAAA,QAAA,YACCC,EAAA,EAAA,SAAAD,EAAA,QAAA,SAAA,GAGDA,EAAA,QAAA,cACCC,EAAA,EAAA,SAAAD,EAAA,QAAA,WAAA,GAMDA,EAAA,QAAA,gBACCC,EAAA,MAAAD,EAAA,QAAA,gBAAA,QAAAA,EAAA,QAAA,gBAAA,KAGDA,EAAA,QAAA,iDAIAA,EAAA,QAAA,iDAIAA,EAAA,QAAA,yDAOAA,EAAA,QAAA,kBACCC,EAAA,QAAAD,EAAA,QAAA,kBAAA,QAAAA,EAAA,QAAA,kBAAA,KAMDA,EAAA,QAAA,sBACCC,EAAA,YAAAD,EAAA,QAAA,sBAAA,QAAAA,EAAA,QAAA,sBAAA,KAMDA,EAAA,QAAA,sBACCC,EAAA,YAAAD,EAAA,QAAA,sBAAA,QAAAA,EAAA,QAAA,sBAAA,4BAIF,aAAA,KAAA,SAAA,QAAA,CAQC,oBAAA,cAAA,SAAA,QAAA,eAAA,wGAIA,GAAA,MAAA,KAAA,EAAA,wCAIC,GAAA,UAAA,KAAA,WAAA,EAAA,2CAEC,OAAA,WAAA,WAGC,UAAA,KAAA,UAAA,QAAA,MAAA,EAAA,CAAA,uDAOF,GAAA,UAAA,KAAA,YAAA,EAAA,6CAEC,OAAA,YAAA,WAGC,WAAA,KAAA,WAAA,QAAA,MAAA,EAAA,CAAA,4IAUJ,OAAA,MAAAD,EAAA,+BAKEG,EAAA,MAAA,EAEF,OAAA,eAAAH,EAAA,sEAKEG,EAAA,eAAA,EAIA,aAAA,aAAAA,EAAA,WAAA,GAEF,OAAA,eAAAH,EAAA,yFAQE,kLAOD,WAAA,IAAAA,EAAA,UAAA,OAAA,8BAAA,EAAA,GAAA,EAEA,IAAAI,EAAA,IACA,UAAAC,KAAAC,EAAA,CACC,GAAAD,EAAA,cAAA,sBAAA,EACC,oDAMF,GAAAE,aAAA,YAAA,CACC,MAAAC,EAAAD,EAAA,aACAH,EAAAI,EACCD,EAAA,UAAAH,EAAAI,EAEAD,EAAA,UAAA,GAGH,OAAA,oBAAAJ,EAAA,CAGC,KAAA,QAAA,yDAGD,OAAA,mBAAAA,EAAA,CAGC,KAAA,QAAA,uDAGD,OAAA,4BAAAM,EAAA,CAGC,OAAA,KAAA,QAAA,2EAKD,OAAA,gBAAAC,EAAAC,EAAA,gCASE,KAAA,0CAAAD,gCAIF,OAAA,kBAAAA,EAAA,kEAaC,MAAAE,EAAA,UAAA,QAAA,MAAAC,EAAA,CAAA,EAAA,GAAAC,CAAA,8BAIA,QAAAC,KAAAC,EAAA,oFASF"}
|
|
1
|
+
{"version":3,"file":"worker.amd.js","sources":["../../src/components/popup/lib/worker.ts"],"sourcesContent":["/**\n * PopupWorker управлеяет работой Popup\n *\n * Должен грузить Popup только в отложенном режиме\n */\n\nimport Core from '@/core/core/core';\nimport DOM from '@/core/utils/dom';\nimport { genHasScroll } from '@/core/utils/scroll';\nimport type { Popup, PopupOptions } from '@/components/popup/lib/popup';\nimport type { OpenerProps } from '@/components/popup/popup/popup';\n\nexport type Options = {\n\t/**\n\t * Глобальное событие, которое будет вызвано перед открытием TopPopup\n\t */\n\tdecoratorBeforeOpen?: (TopPopupInstance: Popup) => void,\n\n\t/**\n\t * Глобальное событие, которое будет вызвано после открытия TopPopup\n\t */\n\tdecoratorAfterOpen?: (TopPopupInstance: Popup) => void;\n\n\t/**\n\t * Определитель того, что клик вне Popup нужно игнорировать\n\t * @returns {boolean} - если true, то click не приведет к закрытию Popup\n\t */\n\tdecoratorIsIgnoreOuterClick?: (e: MouseEvent) => boolean\n}\n\nclass Worker {\n\n\t/**\n\t * Глобальное выключение закрытия меню, используется при различных оверлеях\n\t */\n\tstatic noClose = false;\n\n\t/**\n\t * Для взаимодействия с vue\n\t */\n\tstatic vueConnectors = new Map();\n\n\tstatic options: Options = {};\n\n\t/**\n\t * Вернуть объект компонента popup, привязанный к элементу\n\t */\n\tstatic getPopup(elPopup: HTMLElement): Popup {\n\t\treturn DOM.storage(elPopup, 'TopPopup') as Popup;\n\t}\n\n\t/**\n\t * Вернуть все элементы с Popup\n\t */\n\tstatic getAll(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllArray(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Вернуть все элементы с открытыми Popup\n\t */\n\tstatic getAllVisible(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllVisible(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Открть Popup от указанного elOpener\n\t * @param {HTMLElement} elOpener - элемент, который должен вызвать открытие Popup\n\t */\n\tstatic async openByOpener(elOpener: HTMLElement): Promise<Popup | undefined> {\n\t\tif (!(elOpener instanceof HTMLElement)) return;\n\n\t\tconst options: PopupOptions = {};\n\n\t\toptions.popup = elOpener.dataset.topPopup;\n\n\t\toptions.id = elOpener.dataset.topPopupId;\n\n\t\t/**\n\t\t * @deprecated topPopupP - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupP) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupP);\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPos) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupPos);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupNotch) {\n\t\t\toptions.notch = elOpener.dataset.topPopupNotch === 'true' || elOpener.dataset.topPopupNotch === '1';\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupClass) {\n\t\t\toptions.class = elOpener.dataset.topPopupClass;\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPosBy) {\n\t\t\toptions.posBy = elOpener.dataset.topPopupPosBy as PopupOptions['posBy'];\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupFront) {\n\t\t\toptions.frontSelector = elOpener.dataset.topPopupFront;\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupInvertX) {\n\t\t\toptions.invertX = elOpener.dataset.topPopupInvertX === 'true' || elOpener.dataset.topPopupInvertX === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupOpenByHover) {\n\t\t\toptions.openByHover = elOpener.dataset.topPopupOpenByHover === 'true' || elOpener.dataset.topPopupOpenByHover === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupUseOriginal) {\n\t\t\toptions.useOriginal = elOpener.dataset.topPopupUseOriginal === 'true' || elOpener.dataset.topPopupUseOriginal === '1';\n\t\t}\n\n\t\treturn await Worker.open(elOpener, options);\n\t}\n\n\t/**\n\t * Создать и открыть Popup\n\t * @param elOpener - элемент, вызвавший открытие Popup\n\t * @param options - опции Popup\n\t */\n\tprivate static async open(elOpener: HTMLElement, options: PopupOptions): Promise<Popup> {\n\t\tif (elOpener instanceof HTMLElement) elOpener.dataset.topPopupOpened = 'opened';\n\n\t\tconst { default: Popup } = await import('./popup');\n\n\t\tif (Core.$) {\n\t\t\tconst $elOpener = Core.$(elOpener);\n\n\t\t\t// deprecated, используется aftershow.top-menu-popup\n\t\t\tif ($elOpener.data('aftershow')) {\n\t\t\t\tlet afterShow = $elOpener.data('aftershow');\n\t\t\t\tif (typeof (afterShow) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterShow = eval(afterShow.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('aftershow.top-menu-popup', afterShow);\n\t\t\t}\n\n\t\t\t// deprecated, используется afterclose.top-menu-popup\n\t\t\tif ($elOpener.data('afterclose')) {\n\t\t\t\tlet afterclose = $elOpener.data('afterclose');\n\t\t\t\tif (typeof (afterclose) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterclose = eval(afterclose.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('afterclose.top-menu-popup', afterclose);\n\t\t\t}\n\t\t}\n\n\t\toptions.isFullScreen = Core.state.isMobile;\n\n\t\treturn new Popup(elOpener, options);\n\t}\n\n\tstatic close(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup) {\n\t\t\tpopup.close();\n\t\t}\n\t}\n\n\tstatic recalcPosition(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup && popup.elPopupBody instanceof HTMLElement) {\n\t\t\tpopup.recalcPosition();\n\n\t\t\t// контроль за состоянием тени скролла\n\t\t\t// вызывать после имзенения высоты скролла popup.elPopupBody\n\t\t\tgenHasScroll(popup.elPopupBody);\n\t\t}\n\t}\n\n\t/**\n\t * Скролл к активному элементу списка\n\t */\n\tstatic scrollToActive(elPopup: HTMLElement): void {\n\t\tconst elItemActive = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li > .top-active');\n\t\tif (!elItemActive) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elUl = elPopup.querySelector('ul.top-popup_content');\n\t\tconst elsLi = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li');\n\n\t\telPopup.classList.add('top-popup-wrapper-no_animate');\n\t\tsetTimeout(() => elPopup.classList.remove('top-popup-wrapper-no_animate'), 100);\n\n\t\tlet top = 100;\n\t\tfor (const elLi of elsLi) {\n\t\t\tif (elLi.querySelector(':scope > .top-active')) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (elLi instanceof HTMLElement) top += elLi.offsetHeight;\n\t\t}\n\n\t\tif (elUl instanceof HTMLElement) {\n\t\t\tconst heightWrapper = elUl.offsetHeight;\n\t\t\tif (top > heightWrapper) {\n\t\t\t\telUl.scrollTop = top - heightWrapper;\n\t\t\t} else {\n\t\t\t\telUl.scrollTop = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic decoratorBeforeOpen(popup: Popup): void {\n\t\tif (this.options.decoratorBeforeOpen) {\n\t\t\tthis.options.decoratorBeforeOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorAfterOpen(popup: Popup): void {\n\t\tif (this.options.decoratorAfterOpen) {\n\t\t\tthis.options.decoratorAfterOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorIsIgnoreOuterClick(e: MouseEvent): boolean {\n\t\tif (this.options.decoratorIsIgnoreOuterClick) {\n\t\t\treturn this.options.decoratorIsIgnoreOuterClick(e);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Зарегистрировать Vue компонент\n\t *\n\t * Каждый экземляр Popup регистрируется в словаре vueConnectors для последующего доступа из js\n\t */\n\tstatic regVueComponent(id: string, vueConnector: any): void {\n\t\tif (Worker.vueConnectors.get(id)) {\n\t\t\tthrow 'Vue component Popup use duplicated id: ' + id;\n\t\t}\n\n\t\tWorker.vueConnectors.set(id, vueConnector);\n\t}\n\n\t/**\n\t * Снять с регистрации Vue компонент\n\t */\n\tstatic unregVueComponent(id: string): void {\n\t\tWorker.vueConnectors.delete(id);\n\t}\n\n\t/**\n\t * Сгенерировтаь элемент для открытия popup\n\t */\n\tstatic genElPopupOpener(tagName: string, props: OpenerProps, ...elsChildrens: HTMLElement[] | string[]): HTMLElement {\n\t\tconst el = DOM.genEl(tagName, {}, ...elsChildrens);\n\n\t\tel.dataset.topPopup = '#' + props.id;\n\n\t\t// if (props.pos === undefined) props.pos = '3';\n\t\t// if (props.notch === undefined) props.notch = true;\n\t\t// if (props.posBy === undefined) props.posBy = 'fixed';\n\n\t\tfor (let name in props) {\n\t\t\tconst attrName = 'topPopup' + name.charAt(0).toUpperCase() + name.slice(1);\n\n\t\t\tel.dataset[attrName] = props[name];\n\t\t}\n\n\t\treturn el;\n\t}\n\n}\n\nexport default Worker;\n"],"names":["elPopup","elOpener2","options2","popup","top","elLi","elsLi","elUl","heightWrapper","e","id","vueConnector","el","tagName","elsChildrens","name","props"],"mappings":"+MA8BA,MAAA,MAAA,CAAa,OAAA,QAAA,GAKK,OAAA,cAAA,IAAA,IAKc,OAAA,QAAA,CAAA,EAEJ,OAAA,SAAAA,EAAA,qPAqB3B,aAAA,aAAAC,EAAA,CAOC,GAAA,EAAAA,aAAA,aAAA,OAEA,MAAAC,EAAA,CAAA,8DASAD,EAAA,QAAA,YACCC,EAAA,EAAA,SAAAD,EAAA,QAAA,SAAA,GAGDA,EAAA,QAAA,cACCC,EAAA,EAAA,SAAAD,EAAA,QAAA,WAAA,GAMDA,EAAA,QAAA,gBACCC,EAAA,MAAAD,EAAA,QAAA,gBAAA,QAAAA,EAAA,QAAA,gBAAA,KAGDA,EAAA,QAAA,iDAIAA,EAAA,QAAA,iDAIAA,EAAA,QAAA,yDAOAA,EAAA,QAAA,kBACCC,EAAA,QAAAD,EAAA,QAAA,kBAAA,QAAAA,EAAA,QAAA,kBAAA,KAMDA,EAAA,QAAA,sBACCC,EAAA,YAAAD,EAAA,QAAA,sBAAA,QAAAA,EAAA,QAAA,sBAAA,KAMDA,EAAA,QAAA,sBACCC,EAAA,YAAAD,EAAA,QAAA,sBAAA,QAAAA,EAAA,QAAA,sBAAA,4BAIF,aAAA,KAAA,SAAA,QAAA,CAQC,oBAAA,cAAA,SAAA,QAAA,eAAA,wGAIA,GAAA,MAAA,KAAA,EAAA,wCAIC,GAAA,UAAA,KAAA,WAAA,EAAA,2CAEC,OAAA,WAAA,WAGC,UAAA,KAAA,UAAA,QAAA,MAAA,EAAA,CAAA,uDAOF,GAAA,UAAA,KAAA,YAAA,EAAA,6CAEC,OAAA,YAAA,WAGC,WAAA,KAAA,WAAA,QAAA,MAAA,EAAA,CAAA,4IAUJ,OAAA,MAAAD,EAAA,+BAKEG,EAAA,MAAA,EAEF,OAAA,eAAAH,EAAA,sEAKEG,EAAA,eAAA,EAIA,aAAA,aAAAA,EAAA,WAAA,GAEF,OAAA,eAAAH,EAAA,yFAQE,kLAOD,WAAA,IAAAA,EAAA,UAAA,OAAA,8BAAA,EAAA,GAAA,EAEA,IAAAI,EAAA,IACA,UAAAC,KAAAC,EAAA,CACC,GAAAD,EAAA,cAAA,sBAAA,EACC,oDAMF,GAAAE,aAAA,YAAA,CACC,MAAAC,EAAAD,EAAA,aACAH,EAAAI,EACCD,EAAA,UAAAH,EAAAI,EAEAD,EAAA,UAAA,GAGH,OAAA,oBAAAJ,EAAA,CAGC,KAAA,QAAA,yDAGD,OAAA,mBAAAA,EAAA,CAGC,KAAA,QAAA,uDAGD,OAAA,4BAAAM,EAAA,CAGC,OAAA,KAAA,QAAA,2EAKD,OAAA,gBAAAC,EAAAC,EAAA,gCASE,KAAA,0CAAAD,gCAIF,OAAA,kBAAAA,EAAA,kEAaC,MAAAE,EAAA,UAAA,QAAA,MAAAC,EAAA,CAAA,EAAA,GAAAC,CAAA,8BAQA,QAAAC,KAAAC,EAAA,oFASF"}
|
package/popup/worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Core } from "../.chunks/forms-
|
|
1
|
+
import { C as Core } from "../.chunks/forms-BydHEF-k.es.js";
|
|
2
2
|
import DOM from "../utils/dom.js";
|
|
3
3
|
import { genHasScroll } from "../utils/scroll.js";
|
|
4
4
|
class Worker {
|
|
@@ -45,7 +45,7 @@ class Worker {
|
|
|
45
45
|
*/
|
|
46
46
|
static async open(elOpener, options) {
|
|
47
47
|
elOpener instanceof HTMLElement && (elOpener.dataset.topPopupOpened = "opened");
|
|
48
|
-
const { default: Popup } = await import("../.chunks/popup-
|
|
48
|
+
const { default: Popup } = await import("../.chunks/popup-B7AaTfNZ.es.js");
|
|
49
49
|
if (Core.$) {
|
|
50
50
|
const $elOpener = Core.$(elOpener);
|
|
51
51
|
if ($elOpener.data("aftershow")) {
|
package/popup/worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sources":["../../src/components/popup/lib/worker.ts"],"sourcesContent":["/**\r\n * PopupWorker управлеяет работой Popup\r\n *\r\n * Должен грузить Popup только в отложенном режиме\r\n */\r\n\r\nimport Core from '@/core/core/core';\r\nimport DOM from '@/core/utils/dom';\r\nimport { genHasScroll } from '@/core/utils/scroll';\r\nimport type { Popup, PopupOptions } from '@/components/popup/lib/popup';\r\nimport type { OpenerProps } from '@/components/popup/popup/popup';\r\n\r\nexport type Options = {\r\n\t/**\r\n\t * Глобальное событие, которое будет вызвано перед открытием TopPopup\r\n\t */\r\n\tdecoratorBeforeOpen?: (TopPopupInstance: Popup) => void,\r\n\r\n\t/**\r\n\t * Глобальное событие, которое будет вызвано после открытия TopPopup\r\n\t */\r\n\tdecoratorAfterOpen?: (TopPopupInstance: Popup) => void;\r\n\r\n\t/**\r\n\t * Определитель того, что клик вне Popup нужно игнорировать\r\n\t * @returns {boolean} - если true, то click не приведет к закрытию Popup\r\n\t */\r\n\tdecoratorIsIgnoreOuterClick?: (e: MouseEvent) => boolean\r\n}\r\n\r\nclass Worker {\r\n\r\n\t/**\r\n\t * Глобальное выключение закрытия меню, используется при различных оверлеях\r\n\t */\r\n\tstatic noClose = false;\r\n\r\n\t/**\r\n\t * Для взаимодействия с vue\r\n\t */\r\n\tstatic vueConnectors = new Map();\r\n\r\n\tstatic options: Options = {};\r\n\r\n\t/**\r\n\t * Вернуть объект компонента popup, привязанный к элементу\r\n\t */\r\n\tstatic getPopup(elPopup: HTMLElement): Popup {\r\n\t\treturn DOM.storage(elPopup, 'TopPopup') as Popup;\r\n\t}\r\n\r\n\t/**\r\n\t * Вернуть все элементы с Popup\r\n\t */\r\n\tstatic getAll(): HTMLElement[] {\r\n\t\treturn DOM.querySelectorAllArray(document, '.top-popup-wrapper');\r\n\t}\r\n\r\n\t/**\r\n\t * Вернуть все элементы с открытыми Popup\r\n\t */\r\n\tstatic getAllVisible(): HTMLElement[] {\r\n\t\treturn DOM.querySelectorAllVisible(document, '.top-popup-wrapper');\r\n\t}\r\n\r\n\t/**\r\n\t * Открть Popup от указанного elOpener\r\n\t * @param {HTMLElement} elOpener - элемент, который должен вызвать открытие Popup\r\n\t */\r\n\tstatic async openByOpener(elOpener: HTMLElement): Promise<Popup | undefined> {\r\n\t\tif (!(elOpener instanceof HTMLElement)) return;\r\n\r\n\t\tconst options: PopupOptions = {};\r\n\r\n\t\toptions.popup = elOpener.dataset.topPopup;\r\n\r\n\t\toptions.id = elOpener.dataset.topPopupId;\r\n\r\n\t\t/**\r\n\t\t * @deprecated topPopupP - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupP) {\r\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupP);\r\n\t\t}\r\n\r\n\t\tif (elOpener.dataset.topPopupPos) {\r\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupPos);\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * @deprecated '1' - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupNotch) {\r\n\t\t\toptions.notch = elOpener.dataset.topPopupNotch === 'true' || elOpener.dataset.topPopupNotch === '1';\r\n\t\t}\r\n\r\n\t\tif (elOpener.dataset.topPopupClass) {\r\n\t\t\toptions.class = elOpener.dataset.topPopupClass;\r\n\t\t}\r\n\r\n\t\tif (elOpener.dataset.topPopupPosBy) {\r\n\t\t\toptions.posBy = elOpener.dataset.topPopupPosBy as PopupOptions['posBy'];\r\n\t\t}\r\n\r\n\t\tif (elOpener.dataset.topPopupFront) {\r\n\t\t\toptions.frontSelector = elOpener.dataset.topPopupFront;\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * @deprecated '1' - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupInvertX) {\r\n\t\t\toptions.invertX = elOpener.dataset.topPopupInvertX === 'true' || elOpener.dataset.topPopupInvertX === '1';\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * @deprecated '1' - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupOpenByHover) {\r\n\t\t\toptions.openByHover = elOpener.dataset.topPopupOpenByHover === 'true' || elOpener.dataset.topPopupOpenByHover === '1';\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * @deprecated '1' - добавлено для обратной совместимости\r\n\t\t */\r\n\t\tif (elOpener.dataset.topPopupUseOriginal) {\r\n\t\t\toptions.useOriginal = elOpener.dataset.topPopupUseOriginal === 'true' || elOpener.dataset.topPopupUseOriginal === '1';\r\n\t\t}\r\n\r\n\t\treturn await Worker.open(elOpener, options);\r\n\t}\r\n\r\n\t/**\r\n\t * Создать и открыть Popup\r\n\t * @param elOpener - элемент, вызвавший открытие Popup\r\n\t * @param options - опции Popup\r\n\t */\r\n\tprivate static async open(elOpener: HTMLElement, options: PopupOptions): Promise<Popup> {\r\n\t\tif (elOpener instanceof HTMLElement) elOpener.dataset.topPopupOpened = 'opened';\r\n\r\n\t\tconst { default: Popup } = await import('./popup');\r\n\r\n\t\tif (Core.$) {\r\n\t\t\tconst $elOpener = Core.$(elOpener);\r\n\r\n\t\t\t// deprecated, используется aftershow.top-menu-popup\r\n\t\t\tif ($elOpener.data('aftershow')) {\r\n\t\t\t\tlet afterShow = $elOpener.data('aftershow');\r\n\t\t\t\tif (typeof (afterShow) == 'string') {\r\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\r\n\t\t\t\t\t// @deprecated\r\n\t\t\t\t\tafterShow = eval(afterShow.replace(/\\W/g, ''));\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$elOpener.one('aftershow.top-menu-popup', afterShow);\r\n\t\t\t}\r\n\r\n\t\t\t// deprecated, используется afterclose.top-menu-popup\r\n\t\t\tif ($elOpener.data('afterclose')) {\r\n\t\t\t\tlet afterclose = $elOpener.data('afterclose');\r\n\t\t\t\tif (typeof (afterclose) == 'string') {\r\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\r\n\t\t\t\t\t// @deprecated\r\n\t\t\t\t\tafterclose = eval(afterclose.replace(/\\W/g, ''));\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$elOpener.one('afterclose.top-menu-popup', afterclose);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\toptions.isFullScreen = Core.state.isMobile;\r\n\r\n\t\treturn new Popup(elOpener, options);\r\n\t}\r\n\r\n\tstatic close(elPopup: HTMLElement): void {\r\n\t\tconst popup = Worker.getPopup(elPopup);\r\n\t\tif (popup) {\r\n\t\t\tpopup.close();\r\n\t\t}\r\n\t}\r\n\r\n\tstatic recalcPosition(elPopup: HTMLElement): void {\r\n\t\tconst popup = Worker.getPopup(elPopup);\r\n\t\tif (popup && popup.elPopupBody instanceof HTMLElement) {\r\n\t\t\tpopup.recalcPosition();\r\n\r\n\t\t\t// контроль за состоянием тени скролла\r\n\t\t\t// вызывать после имзенения высоты скролла popup.elPopupBody\r\n\t\t\tgenHasScroll(popup.elPopupBody);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Скролл к активному элементу списка\r\n\t */\r\n\tstatic scrollToActive(elPopup: HTMLElement): void {\r\n\t\tconst elItemActive = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li > .top-active');\r\n\t\tif (!elItemActive) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst elUl = elPopup.querySelector('ul.top-popup_content');\r\n\t\tconst elsLi = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li');\r\n\r\n\t\telPopup.classList.add('top-popup-wrapper-no_animate');\r\n\t\tsetTimeout(() => elPopup.classList.remove('top-popup-wrapper-no_animate'), 100);\r\n\r\n\t\tlet top = 100;\r\n\t\tfor (const elLi of elsLi) {\r\n\t\t\tif (elLi.querySelector(':scope > .top-active')) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tif (elLi instanceof HTMLElement) top += elLi.offsetHeight;\r\n\t\t}\r\n\r\n\t\tif (elUl instanceof HTMLElement) {\r\n\t\t\tconst heightWrapper = elUl.offsetHeight;\r\n\t\t\tif (top > heightWrapper) {\r\n\t\t\t\telUl.scrollTop = top - heightWrapper;\r\n\t\t\t} else {\r\n\t\t\t\telUl.scrollTop = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tstatic decoratorBeforeOpen(popup: Popup): void {\r\n\t\tif (this.options.decoratorBeforeOpen) {\r\n\t\t\tthis.options.decoratorBeforeOpen(popup);\r\n\t\t}\r\n\t};\r\n\r\n\tstatic decoratorAfterOpen(popup: Popup): void {\r\n\t\tif (this.options.decoratorAfterOpen) {\r\n\t\t\tthis.options.decoratorAfterOpen(popup);\r\n\t\t}\r\n\t};\r\n\r\n\tstatic decoratorIsIgnoreOuterClick(e: MouseEvent): boolean {\r\n\t\tif (this.options.decoratorIsIgnoreOuterClick) {\r\n\t\t\treturn this.options.decoratorIsIgnoreOuterClick(e);\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/**\r\n\t * Зарегистрировать Vue компонент\r\n\t *\r\n\t * Каждый экземляр Popup регистрируется в словаре vueConnectors для последующего доступа из js\r\n\t */\r\n\tstatic regVueComponent(id: string, vueConnector: any): void {\r\n\t\tif (Worker.vueConnectors.get(id)) {\r\n\t\t\tthrow 'Vue component Popup use duplicated id: ' + id;\r\n\t\t}\r\n\r\n\t\tWorker.vueConnectors.set(id, vueConnector);\r\n\t}\r\n\r\n\t/**\r\n\t * Снять с регистрации Vue компонент\r\n\t */\r\n\tstatic unregVueComponent(id: string): void {\r\n\t\tWorker.vueConnectors.delete(id);\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировтаь элемент для открытия popup\r\n\t */\r\n\tstatic genElPopupOpener(tagName: string, props: OpenerProps, ...elsChildrens: HTMLElement[] | string[]): HTMLElement {\r\n\t\tconst el = DOM.genEl(tagName, {}, ...elsChildrens);\r\n\r\n\t\tel.dataset.topPopup = '#' + props.id;\r\n\r\n\t\tfor (let name in props) {\r\n\t\t\tconst attrName = 'topPopup' + name.charAt(0).toUpperCase() + name.slice(1);\r\n\r\n\t\t\tel.dataset[attrName] = props[name];\r\n\t\t}\r\n\r\n\t\treturn el;\r\n\t}\r\n\r\n}\r\n\r\nexport default Worker;\r\n"],"names":["elPopup","elOpener","options","popup","elUl","elsLi","top","elLi","heightWrapper","e","id","vueConnector","tagName","props","elsChildrens","el","name","attrName"],"mappings":";;;AA8BA,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA,EAKZ,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA,EAKjB,OAAO,gBAAgB,oBAAI;EAE3B,OAAO,UAAmB,CAAA;AAAA;AAAA;AAAA;AAAA,EAK1B,OAAO,SAASA,GAA6B;AACrC,WAAA,IAAI,QAAQA,GAAS,UAAU;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,SAAwB;AACvB,WAAA,IAAI,sBAAsB,UAAU,oBAAoB;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,gBAA+B;AAC9B,WAAA,IAAI,wBAAwB,UAAU,oBAAoB;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,aAAaC,GAAmD;AACxE,QAAA,EAAEA,aAAoB,aAAc;AAExC,UAAMC,IAAwB,CAAA;AAE9BA,WAAAA,EAAQ,QAAQD,EAAS,QAAQ,UAEjCC,EAAQ,KAAKD,EAAS,QAAQ,YAK1BA,EAAS,QAAQ,cACpBC,EAAQ,IAAI,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AA,QAAQ,mBAAmBA,CAAK;AAAA,EAEvC;AAAA,EAEA,OAAO,4BAA4BM,GAAwB;AACtD,WAAA,KAAK,QAAQ,8BACT,KAAK,QAAQ,4BAA4BA,CAAC,IAG3C;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,gBAAgBC,GAAYC,GAAyB;AAC3D,QAAI,OAAO,cAAc,IAAID,CAAE;AAC9B,YAAM,4CAA4CA;AAG5C,WAAA,cAAc,IAAIA,GAAIC,CAAY;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,kBAAkBD,GAAkB;AACnC,WAAA,cAAc,OAAOA,CAAE;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,iBAAiBE,GAAiBC,MAAuBC,GAAqD;AACpH,UAAMC,IAAK,IAAI,MAAMH,GAAS,CAAC,GAAG,GAAGE,CAAY;AAE9C,IAAAC,EAAA,QAAQ,WAAW,MAAMF,EAAM;AAElC,aAASG,KAAQH,GAAO;AACjB,YAAAI,IAAW,aAAaD,EAAK,OAAO,CAAC,EAAE,gBAAgBA,EAAK,MAAM,CAAC;AAEzE,MAAAD,EAAG,QAAQE,CAAQ,IAAIJ,EAAMG,CAAI;AAAA,IAClC;AAEO,WAAAD;AAAA,EACR;AAED;"}
|
|
1
|
+
{"version":3,"file":"worker.js","sources":["../../src/components/popup/lib/worker.ts"],"sourcesContent":["/**\n * PopupWorker управлеяет работой Popup\n *\n * Должен грузить Popup только в отложенном режиме\n */\n\nimport Core from '@/core/core/core';\nimport DOM from '@/core/utils/dom';\nimport { genHasScroll } from '@/core/utils/scroll';\nimport type { Popup, PopupOptions } from '@/components/popup/lib/popup';\nimport type { OpenerProps } from '@/components/popup/popup/popup';\n\nexport type Options = {\n\t/**\n\t * Глобальное событие, которое будет вызвано перед открытием TopPopup\n\t */\n\tdecoratorBeforeOpen?: (TopPopupInstance: Popup) => void,\n\n\t/**\n\t * Глобальное событие, которое будет вызвано после открытия TopPopup\n\t */\n\tdecoratorAfterOpen?: (TopPopupInstance: Popup) => void;\n\n\t/**\n\t * Определитель того, что клик вне Popup нужно игнорировать\n\t * @returns {boolean} - если true, то click не приведет к закрытию Popup\n\t */\n\tdecoratorIsIgnoreOuterClick?: (e: MouseEvent) => boolean\n}\n\nclass Worker {\n\n\t/**\n\t * Глобальное выключение закрытия меню, используется при различных оверлеях\n\t */\n\tstatic noClose = false;\n\n\t/**\n\t * Для взаимодействия с vue\n\t */\n\tstatic vueConnectors = new Map();\n\n\tstatic options: Options = {};\n\n\t/**\n\t * Вернуть объект компонента popup, привязанный к элементу\n\t */\n\tstatic getPopup(elPopup: HTMLElement): Popup {\n\t\treturn DOM.storage(elPopup, 'TopPopup') as Popup;\n\t}\n\n\t/**\n\t * Вернуть все элементы с Popup\n\t */\n\tstatic getAll(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllArray(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Вернуть все элементы с открытыми Popup\n\t */\n\tstatic getAllVisible(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllVisible(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Открть Popup от указанного elOpener\n\t * @param {HTMLElement} elOpener - элемент, который должен вызвать открытие Popup\n\t */\n\tstatic async openByOpener(elOpener: HTMLElement): Promise<Popup | undefined> {\n\t\tif (!(elOpener instanceof HTMLElement)) return;\n\n\t\tconst options: PopupOptions = {};\n\n\t\toptions.popup = elOpener.dataset.topPopup;\n\n\t\toptions.id = elOpener.dataset.topPopupId;\n\n\t\t/**\n\t\t * @deprecated topPopupP - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupP) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupP);\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPos) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupPos);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupNotch) {\n\t\t\toptions.notch = elOpener.dataset.topPopupNotch === 'true' || elOpener.dataset.topPopupNotch === '1';\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupClass) {\n\t\t\toptions.class = elOpener.dataset.topPopupClass;\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPosBy) {\n\t\t\toptions.posBy = elOpener.dataset.topPopupPosBy as PopupOptions['posBy'];\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupFront) {\n\t\t\toptions.frontSelector = elOpener.dataset.topPopupFront;\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupInvertX) {\n\t\t\toptions.invertX = elOpener.dataset.topPopupInvertX === 'true' || elOpener.dataset.topPopupInvertX === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupOpenByHover) {\n\t\t\toptions.openByHover = elOpener.dataset.topPopupOpenByHover === 'true' || elOpener.dataset.topPopupOpenByHover === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupUseOriginal) {\n\t\t\toptions.useOriginal = elOpener.dataset.topPopupUseOriginal === 'true' || elOpener.dataset.topPopupUseOriginal === '1';\n\t\t}\n\n\t\treturn await Worker.open(elOpener, options);\n\t}\n\n\t/**\n\t * Создать и открыть Popup\n\t * @param elOpener - элемент, вызвавший открытие Popup\n\t * @param options - опции Popup\n\t */\n\tprivate static async open(elOpener: HTMLElement, options: PopupOptions): Promise<Popup> {\n\t\tif (elOpener instanceof HTMLElement) elOpener.dataset.topPopupOpened = 'opened';\n\n\t\tconst { default: Popup } = await import('./popup');\n\n\t\tif (Core.$) {\n\t\t\tconst $elOpener = Core.$(elOpener);\n\n\t\t\t// deprecated, используется aftershow.top-menu-popup\n\t\t\tif ($elOpener.data('aftershow')) {\n\t\t\t\tlet afterShow = $elOpener.data('aftershow');\n\t\t\t\tif (typeof (afterShow) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterShow = eval(afterShow.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('aftershow.top-menu-popup', afterShow);\n\t\t\t}\n\n\t\t\t// deprecated, используется afterclose.top-menu-popup\n\t\t\tif ($elOpener.data('afterclose')) {\n\t\t\t\tlet afterclose = $elOpener.data('afterclose');\n\t\t\t\tif (typeof (afterclose) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterclose = eval(afterclose.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('afterclose.top-menu-popup', afterclose);\n\t\t\t}\n\t\t}\n\n\t\toptions.isFullScreen = Core.state.isMobile;\n\n\t\treturn new Popup(elOpener, options);\n\t}\n\n\tstatic close(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup) {\n\t\t\tpopup.close();\n\t\t}\n\t}\n\n\tstatic recalcPosition(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup && popup.elPopupBody instanceof HTMLElement) {\n\t\t\tpopup.recalcPosition();\n\n\t\t\t// контроль за состоянием тени скролла\n\t\t\t// вызывать после имзенения высоты скролла popup.elPopupBody\n\t\t\tgenHasScroll(popup.elPopupBody);\n\t\t}\n\t}\n\n\t/**\n\t * Скролл к активному элементу списка\n\t */\n\tstatic scrollToActive(elPopup: HTMLElement): void {\n\t\tconst elItemActive = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li > .top-active');\n\t\tif (!elItemActive) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elUl = elPopup.querySelector('ul.top-popup_content');\n\t\tconst elsLi = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li');\n\n\t\telPopup.classList.add('top-popup-wrapper-no_animate');\n\t\tsetTimeout(() => elPopup.classList.remove('top-popup-wrapper-no_animate'), 100);\n\n\t\tlet top = 100;\n\t\tfor (const elLi of elsLi) {\n\t\t\tif (elLi.querySelector(':scope > .top-active')) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (elLi instanceof HTMLElement) top += elLi.offsetHeight;\n\t\t}\n\n\t\tif (elUl instanceof HTMLElement) {\n\t\t\tconst heightWrapper = elUl.offsetHeight;\n\t\t\tif (top > heightWrapper) {\n\t\t\t\telUl.scrollTop = top - heightWrapper;\n\t\t\t} else {\n\t\t\t\telUl.scrollTop = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic decoratorBeforeOpen(popup: Popup): void {\n\t\tif (this.options.decoratorBeforeOpen) {\n\t\t\tthis.options.decoratorBeforeOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorAfterOpen(popup: Popup): void {\n\t\tif (this.options.decoratorAfterOpen) {\n\t\t\tthis.options.decoratorAfterOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorIsIgnoreOuterClick(e: MouseEvent): boolean {\n\t\tif (this.options.decoratorIsIgnoreOuterClick) {\n\t\t\treturn this.options.decoratorIsIgnoreOuterClick(e);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Зарегистрировать Vue компонент\n\t *\n\t * Каждый экземляр Popup регистрируется в словаре vueConnectors для последующего доступа из js\n\t */\n\tstatic regVueComponent(id: string, vueConnector: any): void {\n\t\tif (Worker.vueConnectors.get(id)) {\n\t\t\tthrow 'Vue component Popup use duplicated id: ' + id;\n\t\t}\n\n\t\tWorker.vueConnectors.set(id, vueConnector);\n\t}\n\n\t/**\n\t * Снять с регистрации Vue компонент\n\t */\n\tstatic unregVueComponent(id: string): void {\n\t\tWorker.vueConnectors.delete(id);\n\t}\n\n\t/**\n\t * Сгенерировтаь элемент для открытия popup\n\t */\n\tstatic genElPopupOpener(tagName: string, props: OpenerProps, ...elsChildrens: HTMLElement[] | string[]): HTMLElement {\n\t\tconst el = DOM.genEl(tagName, {}, ...elsChildrens);\n\n\t\tel.dataset.topPopup = '#' + props.id;\n\n\t\t// if (props.pos === undefined) props.pos = '3';\n\t\t// if (props.notch === undefined) props.notch = true;\n\t\t// if (props.posBy === undefined) props.posBy = 'fixed';\n\n\t\tfor (let name in props) {\n\t\t\tconst attrName = 'topPopup' + name.charAt(0).toUpperCase() + name.slice(1);\n\n\t\t\tel.dataset[attrName] = props[name];\n\t\t}\n\n\t\treturn el;\n\t}\n\n}\n\nexport default Worker;\n"],"names":["elPopup","elOpener","options","popup","elUl","elsLi","top","elLi","heightWrapper","e","id","vueConnector","tagName","props","elsChildrens","el","name","attrName"],"mappings":";;;AA8BA,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA,EAKZ,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA,EAKjB,OAAO,gBAAgB,oBAAI;EAE3B,OAAO,UAAmB,CAAA;AAAA;AAAA;AAAA;AAAA,EAK1B,OAAO,SAASA,GAA6B;AACrC,WAAA,IAAI,QAAQA,GAAS,UAAU;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,SAAwB;AACvB,WAAA,IAAI,sBAAsB,UAAU,oBAAoB;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,gBAA+B;AAC9B,WAAA,IAAI,wBAAwB,UAAU,oBAAoB;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,aAAaC,GAAmD;AACxE,QAAA,EAAEA,aAAoB,aAAc;AAExC,UAAMC,IAAwB,CAAA;AAE9BA,WAAAA,EAAQ,QAAQD,EAAS,QAAQ,UAEjCC,EAAQ,KAAKD,EAAS,QAAQ,YAK1BA,EAAS,QAAQ,cACpBC,EAAQ,IAAI,SAASD,EAAS,QAAQ,SAAS,IAG5CA,EAAS,QAAQ,gBACpBC,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O,4BAA4BM,GAAwB;AACtD,WAAA,KAAK,QAAQ,8BACT,KAAK,QAAQ,4BAA4BA,CAAC,IAG3C;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,gBAAgBC,GAAYC,GAAyB;AAC3D,QAAI,OAAO,cAAc,IAAID,CAAE;AAC9B,YAAM,4CAA4CA;AAG5C,WAAA,cAAc,IAAIA,GAAIC,CAAY;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,kBAAkBD,GAAkB;AACnC,WAAA,cAAc,OAAOA,CAAE;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,iBAAiBE,GAAiBC,MAAuBC,GAAqD;AACpH,UAAMC,IAAK,IAAI,MAAMH,GAAS,CAAC,GAAG,GAAGE,CAAY;AAE9C,IAAAC,EAAA,QAAQ,WAAW,MAAMF,EAAM;AAMlC,aAASG,KAAQH,GAAO;AACjB,YAAAI,IAAW,aAAaD,EAAK,OAAO,CAAC,EAAE,gBAAgBA,EAAK,MAAM,CAAC;AAEzE,MAAAD,EAAG,QAAQE,CAAQ,IAAIJ,EAAMG,CAAI;AAAA,IAClC;AAEO,WAAAD;AAAA,EACR;AAED;"}
|
package/project/project.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-CjYoXTEQ.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-CEF3WDJ_.amd","../.chunks/menu-D1lnYuWU.amd","../.chunks/utils-x88W55mf.amd","../utils/searchers.amd","../require/css.amd!../assets/project.css"],function(H,K,e,V,M,b,v,w){"use strict";if(typeof e>"u")var e=window.Vue;const q={class:"top-selectorCompetitors"},E={class:"top-ellipsis1"},T=e.defineComponent({__name:"selectorCompetitors",props:e.mergeModels({modelValue:{},items:{},showSelectAllItem:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const s=o,m=e.useModel(o,"modelValue"),t=e.computed(()=>{if(s.showSelectAllItem)return{icon:"",title:V.useI18n().Common.Select_all,value:"all",content:""}});return(n,u)=>(e.openBlock(),e.createElementBlock("div",q,[e.unref(V.Core).state.isMobile?(e.openBlock(),e.createBlock(M.Popup,{key:0},{opener:e.withCtx(()=>[e.createVNode(V.TopButton,{class:"top-selectorCompetitors_opener",color:"theme",icon:"",icon2:""},{default:e.withCtx(()=>{var l;return[e.createTextVNode(e.toDisplayString((l=n.items.find(r=>{var c;return r.value===((c=m.value)==null?void 0:c[0])}))==null?void 0:l.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,(l,r)=>{var c;return e.openBlock(),e.createBlock(M._sfc_main$1,{class:e.normalizeClass({"top-active":(c=m.value)==null?void 0:c.includes(l.value)}),"data-top-icon":l.icon,title:l.title,onClick:()=>m.value=[l.value]},{default:e.withCtx(()=>[e.createElementVNode("span",E,e.toDisplayString(l.content),1)]),_:2},1032,["class","data-top-icon","title","onClick"])}),256))]),_:1})):(e.openBlock(),e.createBlock(b.Menu,{key:1,modelValue:m.value,"onUpdate:modelValue":u[0]||(u[0]=l=>m.value=l),items:n.items,isMultiple:!0,styling:"bar",canBeEmptyMultiple:!1,selectAllItem:t.value},null,8,["modelValue","items","selectAllItem"]))]))}}),F={$style:{"top-selectorCompetitors_opener":"top-selectorCompetitors_opener","top-button":"top-button"}},O=V._export_sfc(T,[["__cssModules",F]]),$=(o,s)=>{const m=V.useI18n(),t=e.ref(s.value.keys().next().value??v.dummyIndex),n=e.computed(()=>{const u=new Map;if(s.value.forEach(l=>{let r={value:l.key,title:l.name};o.addSearcherIcon&&(r.icon=w.getSearcherGIcon(l.key)),u.set(l.key,r)}),o.addCompare&&!u.has(v.dummyIndex)){const l={value:"",title:"--------------------",disabled:!0};u.set(l.value,l);const r={value:-1,title:m.Common.Compare};u.set(r.value,r)}return u});return{searcherKey:t,optionBySearcherKey:n}},L=(o,s)=>{var u,l,r;const m=V.useI18n(),t=e.ref(v.dummyIndex);o.modelValue.length===1&&(t.value=o.modelValue[0]),t.value===v.dummyIndex&&(o.forFrequency?t.value=((l=(u=s.value)==null?void 0:u.regionByIndex.values().next().value)==null?void 0:l.key)??v.dummyIndex:t.value=((r=s.value)==null?void 0:r.regionByIndex.keys().next().value)??v.dummyIndex);const n=e.computed(()=>{var g;const c=new Map;return(g=s.value.regionByIndex)==null||g.forEach(i=>{let a=i.name;if(o.forFrequency){const k={value:i.key,title:a};c.has(i.key)||c.set(i.key,k);return}i.device&&(a+=" ("+m.Common["Device_"+i.device]+")");const x=w.getLangLabel(s.value.key||0,i.lang??"");x&&(a+=" / "+x);const f={value:i.index,title:a,icon:i.device?w.getDeviceGIcon(i.device):void 0};c.set(i.index,f)}),c});return e.watch(n,(c,g)=>{var f;if(o.onlySearcher||t.value!==void 0&&c.get(t.value))return;let i=c.keys().next().value;if(t.value===v.dummyIndex||i===v.dummyIndex){t.value=i;return}let a=((f=g==null?void 0:g.get(t.value))==null?void 0:f.title)||"",x=-1;for(const[k,y]of c.entries()){const h=y.title;if(typeof h!="string"||typeof k=="string")break;if(h===a){i=k;break}const I=new RegExp(` \\((${m.Common.Device_1}|${m.Common.Device_2})\\)`);let p=a,B=3;h.indexOf(p)===-1&&(p=a.replace(/^[^a-zа-я]/i,"").replace(I,""),B--),h.indexOf(p)===-1&&(p=a.replace(/ \/.*/,""),B--),h.indexOf(p)===-1&&(p=a.replace(/ \/.*/,""),p=p.replace(/^[^a-zа-я]/i,"").replace(I,""),B--),h.indexOf(p)!==-1&&(B<=x||(x=B,i=k))}t.value=i}),{regionIndex:t,optionByRegionIndex:n}},D=(o,s,m)=>{const t=e.ref([]),n=()=>{if(o.onlySearcher&&s.value){t.value=Array.from(s.value.keys());return}let l=[];if(o.modelValue.length>1)l=[...o.modelValue];else try{l=JSON.parse(localStorage.getItem("ui:project:regionSelector"+o.projectId+":regionsIndexes"))??[]}catch{}l.length&&(l=l.filter(r=>m.value.has(r))),l.length||(l=Array.from(m.value)),t.value=[...l]},u=()=>{t.value.length?localStorage.setItem("ui:project:regionSelector:"+o.projectId+":regionsIndexes",JSON.stringify(t.value)):localStorage.removeItem("ui:project:regionSelector:"+o.projectId+":regionsIndexes")};return e.watch(t,()=>{u()}),o.addCompare&&n(),{regionsIndexes:t}},J=o=>{const s=e.computed(()=>v.genSearcherByKey(o.forFrequency,o.autoRegion,o.searchers)),m=e.computed(()=>s.value.get(n.searcherKey.value)||v.searcherUndefined),t=e.computed(()=>{const a=new Set;return s.value.forEach(x=>{var f;(f=x.regions)==null||f.forEach(k=>{k.index!==-1&&k.index!==v.dummyIndex&&a.add(k.index)})}),a}),n=$(o,s),u=L(o,m),l=D(o,s,t);e.watch(s,()=>{var x,f,k,y,h;if(n.searcherKey.value===-1){l.regionsIndexes.value=l.regionsIndexes.value.filter(I=>t.value.has(I));return}let a=s.value.keys().next().value;s.value.forEach(I=>{var p,B,d;if(u.regionIndex.value&&((p=I.regionByIndex)!=null&&p.has(u.regionIndex.value))&&(a=I.key),!o.onlySearcher){let S;a!==void 0&&(S=(B=s.value.get(a))==null?void 0:B.regionByIndex);const C=(d=s.value.get(I.key))==null?void 0:d.regionByIndex;S!=null&&S.has(v.dummyIndex)&&!(C!=null&&C.has(v.dummyIndex))&&(a=I.key)}}),o.addCompare&&!n.optionBySearcherKey.value.has(v.dummyIndex)&&!u.regionIndex.value&&(x=l.regionsIndexes.value)!=null&&x.length&&(a=-1),o.onlySearcher&&u.regionIndex.value!==v.dummyIndex&&(a=u.regionIndex.value),a!==void 0&&(n.searcherKey.value=a),u.regionIndex.value!==void 0&&!((k=(f=m.value)==null?void 0:f.regionByIndex)!=null&&k.has(u.regionIndex.value))&&(u.regionIndex.value=(h=(y=m.value)==null?void 0:y.regions)==null?void 0:h.keys().next().value)},{immediate:!0});const r=()=>{if(!(n.searcherKey.value===-1||n.searcherKey.value===v.dummyIndex))return n.searcherKey.value},c=()=>{if(o.onlySearcher||u.regionIndex.value===v.dummyIndex)return;let a=u.regionIndex.value;if(o.forFrequency){const x=u.regionIndex.value,f=v.findRegion(o.forFrequency,{searcher_key:r(),key:x},o.searchers);a=f==null?void 0:f.index}return a},g=()=>{const a=r();if(a!==void 0)return s.value.get(a)};return{selectSearcher:n,selectRegion:u,compare:l,searcherByKey:s,allRegionsIndexes:t,getSearcher:g,getRegion:()=>{var x,f;const a=c();if(a!==void 0)return(f=(x=g())==null?void 0:x.regionByIndex)==null?void 0:f.get(a)}}},A=e.defineComponent({__name:"selectorRegion",props:e.mergeModels({projectId:{},searchers:{default:()=>[]},modelValue:{},modelValueSingle:{},addCompare:{type:Boolean},forFrequency:{type:Boolean},autoRegion:{type:Boolean},onlySearcher:{type:Boolean},addChanger:{type:Boolean,default:!0},addSearcherIcon:{type:Boolean,default:!0},addRegionIcon:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{},modelValueSingle:{},modelValueSingleModifiers:{}}),emits:e.mergeModels(["compareRegions"],["update:modelValue","update:modelValueSingle"]),setup(o,{expose:s,emit:m}){const t=o,n=e.useModel(o,"modelValue"),u=e.useModel(o,"modelValueSingle"),l=m,{selectSearcher:r,selectRegion:c,compare:g,searcherByKey:i,allRegionsIndexes:a,getSearcher:x,getRegion:f}=J(t),k=()=>{var y;if(window.fieldTemplates&&((y=window.fieldTemplates)!=null&&y.openSelectorRegions)){window.fieldTemplates.openSelectorRegions(i.value,g.regionsIndexes.value,h=>g.regionsIndexes.value=h);return}l("compareRegions",i.value)};return e.watch([c.regionIndex,r.searcherKey,g.regionsIndexes],()=>{if(r.searcherKey.value===-1&&g.regionsIndexes.value.length){if(JSON.stringify(n.value)===JSON.stringify(g.regionsIndexes.value))return;n.value=[...g.regionsIndexes.value]}else n.value=[t.onlySearcher?r.searcherKey.value:c.regionIndex.value];a.value.size||(r.searcherKey.value=v.dummyIndex)}),u.value&&e.watch(u,()=>{n.value=[u.value]},{immediate:!0}),e.watch(n,()=>{var y,h,I,p,B;if(n.value[0]&&(u.value=n.value[0]),t.onlySearcher){if(!n.value.length||n.value.length===1&&!i.value.has(n.value[0])){let d=i.value.keys().next().value;d!==void 0&&(n.value=[d]);return}if(n.value.length>1&&JSON.stringify(n.value)!==JSON.stringify(g.regionsIndexes.value)){n.value=[...g.regionsIndexes.value];return}}else{let d=[...new Set(n.value)],S=(h=(y=i.value.values().next().value)==null?void 0:y.regionByIndex)==null?void 0:h.keys().next().value;if(t.forFrequency&&(S=(B=(p=(I=i.value.values().next().value)==null?void 0:I.regionByIndex)==null?void 0:p.values().next().value)==null?void 0:B.key),!d.length)S!==void 0&&d.push(S);else if(d.length===1){let C=a.value;t.forFrequency&&(C=new Set,i.value.forEach(N=>{N.regionByIndex.forEach(R=>{R.index!==-1&&R.index!==v.dummyIndex&&C.add(R.key)})})),!C.has(d[0])&&d[0]!==-2&&(d=[],S!==void 0&&d.push(S))}else d=d.filter(C=>a.value.has(C)),!d.length&&S!==void 0&&d.push(S);if(JSON.stringify(n.value)!==JSON.stringify(d)){n.value=d;return}}if(!(n.value.length===1&&n.value[0]===(t.onlySearcher?r.searcherKey.value:c.regionIndex.value)))if(t.onlySearcher){if(n.value.length===1){r.searcherKey.value=n.value[0];return}r.searcherKey.value=-1;return}else if(n.value.length===1&&r.searcherKey.value!==-1){c.regionIndex.value=n.value[0];let d;for(const S of i.value.values()){for(const C of S.regionByIndex.values())if((t.forFrequency?C.key:C.index)===c.regionIndex.value){d=S.key;break}if(d!==void 0)break}d!==void 0&&(r.searcherKey.value=d)}else r.searcherKey.value=-1,g.regionsIndexes.value=[...n.value]},{immediate:!0}),s({getSearcher:x,getRegion:f}),(y,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-selectorRegion":!0,"top-selectorRegion-onlySearcher":y.onlySearcher})},[e.createVNode(V.Select,{options:e.unref(r).optionBySearcherKey.value,modelValue:e.unref(r).searcherKey.value,"onUpdate:modelValue":h[0]||(h[0]=I=>e.unref(r).searcherKey.value=I),name:"searcher_key",addChanger:y.addChanger},null,8,["options","modelValue","addChanger"]),!y.onlySearcher&&e.unref(r).searcherKey.value!==-1?(e.openBlock(),e.createBlock(V.Select,{key:0,class:"top-select-region",options:e.unref(c).optionByRegionIndex.value,modelValue:e.unref(c).regionIndex.value,"onUpdate:modelValue":h[1]||(h[1]=I=>e.unref(c).regionIndex.value=I),name:y.forFrequency?"region_key":"region_index",addChanger:y.addChanger,"data-top-icon":y.addRegionIcon?"":void 0},null,8,["options","modelValue","name","addChanger","data-top-icon"])):e.createCommentVNode("",!0),y.addCompare&&!y.onlySearcher&&e.unref(r).searcherKey.value===-1?(e.openBlock(),e.createBlock(V.TopButton,{key:1,name:"compare",onClick:k,"data-count-compare-regions-indexes":e.unref(g).regionsIndexes.value.length},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.$i18n.Common.Selected_regions),1)]),_:1},8,["data-count-compare-regions-indexes"])):e.createCommentVNode("",!0)],2))}}),z={$style:{"top-select-searcher_key":"top-select-searcher_key","top-selectorRegion":"top-selectorRegion","top-select":"top-select","top-select_select":"top-select_select","top-error":"top-error","top-select-region":"top-select-region","top-selectorRegion-onlySearcher":"top-selectorRegion-onlySearcher"}},U=V._export_sfc(A,[["__cssModules",z]]),G=O,P=U;K.TopSelectorCompetitors=G,K.TopSelectorRegion=P,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
define(["require","exports","vue","../.chunks/forms-Cq5zFLsO.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-B0xTxYZR.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-BT-PgdJ5.amd","../utils/searchers.amd","../utils/dom.amd","../popup/worker.amd","../require/css.amd!../assets/project.css"],function(Ve,V,e,k,E,Z,F,_,ee){"use strict";if(typeof e>"u")var e=window.Vue;const te={class:"top-selectorCompetitors"},ne={class:"top-ellipsis1"},oe=e.defineComponent({__name:"selectorCompetitors",props:e.mergeModels({modelValue:{},items:{},showSelectAllItem:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const l=t,d=e.useModel(t,"modelValue"),n=e.computed(()=>{if(l.showSelectAllItem)return{icon:"",title:k.useI18n().Common.Select_all,value:"all",content:""}});return(i,a)=>(e.openBlock(),e.createElementBlock("div",te,[e.unref(k.Core).state.isMobile?(e.openBlock(),e.createBlock(E._sfc_main,{key:0},{opener:e.withCtx(()=>[e.createVNode(k._sfc_main,{class:"top-selectorCompetitors_opener",color:"theme",icon:"",icon2:""},{default:e.withCtx(()=>{var r;return[e.createTextVNode(e.toDisplayString((r=i.items.find(c=>{var m;return c.value===((m=d.value)==null?void 0:m[0])}))==null?void 0:r.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.items,(r,c)=>{var m;return e.openBlock(),e.createBlock(E._sfc_main$2,{class:e.normalizeClass({"top-active":(m=d.value)==null?void 0:m.includes(r.value)}),"data-top-icon":r.icon,title:r.title,onClick:()=>d.value=[r.value]},{default:e.withCtx(()=>[e.createElementVNode("span",ne,e.toDisplayString(r.content),1)]),_:2},1032,["class","data-top-icon","title","onClick"])}),256))]),_:1})):(e.openBlock(),e.createBlock(Z._sfc_main,{key:1,modelValue:d.value,"onUpdate:modelValue":a[0]||(a[0]=r=>d.value=r),items:i.items,isMultiple:!0,styling:"bar",canBeEmptyMultiple:!1,selectAllItem:n.value},null,8,["modelValue","items","selectAllItem"]))]))}}),S=-2,le={0:"Yandex",1:"Google",2:"go.Mail",4:"YouTube",5:"Bing",6:"Yahoo",7:"Seznam",8:"AppStore",9:"GoogleStore",20:"Yandex.com",21:"Yandex.com.tr"},L={key:S,name:"--",index:S},j={key:S,name:"--",regions:[L],regionByIndex:new Map([[S,L]])},A={key:S,name:"Autoselect",index:S},P={key:S,name:"Autoselect",regions:[A],regionByIndex:new Map([[S,A]])},J={countryCode:"00",depth:1,device:0,key:-1,index:-1,lang:"ru",name:"Without region"},ae=()=>(A.name=k.useI18n().Common.Autoselect,A),re=()=>(ae(),P.name=k.useI18n().Common.Autoselect,console.log(P),P),ie=()=>(J.name=k.useI18n().Keywords.Without_region,J),U=(t=!1,l=!1,d=[])=>{let n;return t?n=de(d):n=G(d),l&&n.set(S,re()),n.size||n.set(S,j),n},G=(t,l=!0,d=[],n=!1)=>{const i=new Map;return t.forEach(a=>{if(!a.enabled||n&&typeof a.key=="number"&&a.key>1)return;const r={...a};r.regionByIndex=new Map,a.regions&&a.regions.forEach(c=>{if(l&&!c.enabled)return;const m={...c};r.regionByIndex&&r.regionByIndex.set(m.index,m)}),!r.regionByIndex.size&&!d.length&&r.regionByIndex.set(L.index,L),typeof r.key=="number"&&i.set(r.key,r)}),d.forEach(a=>{if(i.has(a))return;const r={key:a,name:le[a],regions:[],regionByIndex:new Map};i.set(r.key,r)}),i},de=t=>{const l=G(t,!1,[0,1],!0);if(l.has(2)){const d=l.get(2);d&&(d.regionByIndex=new Map)}return l.forEach(d=>{if(!d.regionByIndex)return;const n={...ie()};d.regionByIndex.set(n.index,n)}),l},Y=(t,l,d=[])=>{const n=U(t,!1,d);let i;return n.forEach(a=>{if(!(l.searcher_key!==void 0&&l.searcher_key!=a.key)&&a.regions&&(a.regions.forEach(r=>{if(!i&&!(l.key!==void 0&&l.key!=r.key)&&!(l.index!==void 0&&l.index!=r.index)&&!(!t&&(l.lang!==void 0&&l.lang!=r.lang||l.device!==void 0&&l.device!=r.device)))return r.searcher_key=a.key,i=r,!1}),i))return!1}),i},se=(t,l)=>{const d=k.useI18n(),n=e.ref(l.value.keys().next().value??S),i=e.computed(()=>{const a=new Map;if(l.value.forEach(r=>{let c={value:r.key,title:r.name};t.addSearcherIcon&&(c.icon=F.getSearcherGIcon(r.key)),a.set(r.key,c)}),t.addCompare&&!a.has(S)){const r={value:"",title:"--------------------",disabled:!0};a.set(r.value,r);const c={value:-1,title:d.Common.Compare};a.set(c.value,c)}return a});return{searcherKey:n,optionBySearcherKey:i}},ue=(t,l)=>{var a,r,c;const d=k.useI18n(),n=e.ref(S);t.modelValue.length===1&&(n.value=t.modelValue[0]),n.value===S&&(t.forFrequency?n.value=((r=(a=l.value)==null?void 0:a.regionByIndex.values().next().value)==null?void 0:r.key)??S:n.value=((c=l.value)==null?void 0:c.regionByIndex.keys().next().value)??S);const i=e.computed(()=>{var f;const m=new Map;return(f=l.value.regionByIndex)==null||f.forEach(v=>{let o=v.name;if(t.forFrequency){const B={value:v.key,title:o};m.has(v.key)||m.set(v.key,B);return}v.device&&(o+=" ("+d.Common["Device_"+v.device]+")");const y=F.getLangLabel(l.value.key||0,v.lang??"");y&&(o+=" / "+y);const I={value:v.index,title:o,icon:v.device?F.getDeviceGIcon(v.device):void 0};m.set(v.index,I)}),m});return e.watch(i,(m,f)=>{var I;if(t.onlySearcher||n.value!==void 0&&m.get(n.value))return;let v=m.keys().next().value;if(n.value===S||v===S){n.value=v;return}let o=((I=f==null?void 0:f.get(n.value))==null?void 0:I.title)||"",y=-1;for(const[B,x]of m.entries()){const h=x.title;if(typeof h!="string"||typeof B=="string")break;if(h===o){v=B;break}const T=new RegExp(` \\((${d.Common.Device_1}|${d.Common.Device_2})\\)`);let C=o,u=3;h.indexOf(C)===-1&&(C=o.replace(/^[^a-zа-я]/i,"").replace(T,""),u--),h.indexOf(C)===-1&&(C=o.replace(/ \/.*/,""),u--),h.indexOf(C)===-1&&(C=o.replace(/ \/.*/,""),C=C.replace(/^[^a-zа-я]/i,"").replace(T,""),u--),h.indexOf(C)!==-1&&(u<=y||(y=u,v=B))}n.value=v}),{regionIndex:n,optionByRegionIndex:i}},ce=(t,l,d)=>{const n=e.ref([]),i=()=>{if(t.onlySearcher&&l.value){n.value=Array.from(l.value.keys());return}let r=[];if(t.modelValue.length>1)r=[...t.modelValue];else try{r=JSON.parse(localStorage.getItem("ui:project:regionSelector"+t.projectId+":regionsIndexes"))??[]}catch{}r.length&&(r=r.filter(c=>d.value.has(c))),r.length||(r=Array.from(d.value)),n.value=[...r]},a=()=>{n.value.length?localStorage.setItem("ui:project:regionSelector:"+t.projectId+":regionsIndexes",JSON.stringify(n.value)):localStorage.removeItem("ui:project:regionSelector:"+t.projectId+":regionsIndexes")};return e.watch(n,()=>{a()}),t.addCompare&&i(),{regionsIndexes:n}},ge=t=>{const l=e.computed(()=>U(t.forFrequency,t.autoRegion,t.searchers)),d=e.computed(()=>l.value.get(i.searcherKey.value)||j),n=e.computed(()=>{const o=new Set;return l.value.forEach(y=>{var I;(I=y.regions)==null||I.forEach(B=>{B.index!==-1&&B.index!==S&&o.add(B.index)})}),o}),i=se(t,l),a=ue(t,d),r=ce(t,l,n);e.watch(l,()=>{var y,I,B,x;if(t.onlySearcher?r.regionsIndexes.value=Array.from(l.value.keys()):r.regionsIndexes.value=r.regionsIndexes.value.filter(h=>n.value.has(h)),i.searcherKey.value===-1)return;let o=l.value.keys().next().value;l.value.forEach(h=>{var T,C,u;if(t.onlySearcher&&h.key===i.searcherKey.value){o=i.searcherKey.value;return}if(a.regionIndex.value&&((T=h.regionByIndex)!=null&&T.has(a.regionIndex.value))&&(o=h.key),!t.onlySearcher){let s;o!==void 0&&(s=(C=l.value.get(o))==null?void 0:C.regionByIndex);const g=(u=l.value.get(h.key))==null?void 0:u.regionByIndex;s!=null&&s.has(S)&&!(g!=null&&g.has(S))&&(o=h.key)}}),o!==void 0&&(i.searcherKey.value=o),a.regionIndex.value!==void 0&&!((I=(y=d.value)==null?void 0:y.regionByIndex)!=null&&I.has(a.regionIndex.value))&&(a.regionIndex.value=(x=(B=d.value)==null?void 0:B.regions)==null?void 0:x.keys().next().value)},{immediate:!0});const c=()=>{if(!(i.searcherKey.value===-1||i.searcherKey.value===S))return i.searcherKey.value},m=()=>{if(t.onlySearcher||a.regionIndex.value===S)return;let o=a.regionIndex.value;if(t.forFrequency){const y=a.regionIndex.value,I=Y(t.forFrequency,{searcher_key:c(),key:y},t.searchers);o=I==null?void 0:I.index}return o},f=()=>{const o=c();if(o!==void 0)return l.value.get(o)};return{selectSearcher:i,selectRegion:a,compare:r,searcherByKey:l,allRegionsIndexes:n,getSearcher:f,getRegion:()=>{var y,I;const o=m();if(o!==void 0)return(I=(y=f())==null?void 0:y.regionByIndex)==null?void 0:I.get(o)}}},me=e.defineComponent({__name:"selectorRegion",props:e.mergeModels({projectId:{},searchers:{default:()=>[]},modelValue:{},modelValueSingle:{},addCompare:{type:Boolean},forFrequency:{type:Boolean},autoRegion:{type:Boolean},onlySearcher:{type:Boolean},addChanger:{type:Boolean,default:!0},addSearcherIcon:{type:Boolean,default:!0},addRegionIcon:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{},modelValueSingle:{},modelValueSingleModifiers:{}}),emits:e.mergeModels(["compareRegions"],["update:modelValue","update:modelValueSingle"]),setup(t,{expose:l,emit:d}){const n=t,i=e.useModel(t,"modelValue"),a=e.useModel(t,"modelValueSingle"),r=d,{selectSearcher:c,selectRegion:m,compare:f,searcherByKey:v,allRegionsIndexes:o,getSearcher:y,getRegion:I}=ge(n),B=()=>{var x;if(window.fieldTemplates&&((x=window.fieldTemplates)!=null&&x.openSelectorRegions)){window.fieldTemplates.openSelectorRegions(v.value,f.regionsIndexes.value,h=>f.regionsIndexes.value=h);return}r("compareRegions",v.value)};return e.watch([m.regionIndex,c.searcherKey,f.regionsIndexes],()=>{if(c.searcherKey.value===-1&&f.regionsIndexes.value.length){if(JSON.stringify(i.value)===JSON.stringify(f.regionsIndexes.value))return;i.value=[...f.regionsIndexes.value]}else i.value=[n.onlySearcher?c.searcherKey.value:m.regionIndex.value];!n.onlySearcher&&!o.value.size&&(c.searcherKey.value=S)}),a.value&&e.watch(a,()=>{i.value=[a.value]},{immediate:!0}),e.watch(i,()=>{var x,h,T,C,u;if(i.value[0]&&(a.value=i.value[0]),n.onlySearcher){if(!i.value.length||i.value.length===1&&!v.value.has(i.value[0])){let s=v.value.keys().next().value;s!==void 0&&(i.value=[s]);return}if(i.value.length>1&&JSON.stringify(i.value)!==JSON.stringify(f.regionsIndexes.value)){i.value=[...f.regionsIndexes.value];return}}else{let s=[...new Set(i.value)],g=(h=(x=v.value.values().next().value)==null?void 0:x.regionByIndex)==null?void 0:h.keys().next().value;if(n.forFrequency&&(g=(u=(C=(T=v.value.values().next().value)==null?void 0:T.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:u.key),!s.length)g!==void 0&&s.push(g);else if(s.length===1){let p=o.value;n.forFrequency&&(p=new Set,v.value.forEach(w=>{w.regionByIndex.forEach(M=>{M.index!==-1&&M.index!==S&&p.add(M.key)})})),!p.has(s[0])&&s[0]!==-2&&(s=[],g!==void 0&&s.push(g))}else s=s.filter(p=>o.value.has(p)),!s.length&&g!==void 0&&s.push(g);if(JSON.stringify(i.value)!==JSON.stringify(s)){i.value=s;return}}if(!(i.value.length===1&&i.value[0]===(n.onlySearcher?c.searcherKey.value:m.regionIndex.value)))if(n.onlySearcher){if(i.value.length===1){c.searcherKey.value=i.value[0];return}c.searcherKey.value=-1;return}else if(i.value.length===1&&c.searcherKey.value!==-1){m.regionIndex.value=i.value[0];let s;for(const g of v.value.values()){for(const p of g.regionByIndex.values())if((n.forFrequency?p.key:p.index)===m.regionIndex.value){s=g.key;break}if(s!==void 0)break}s!==void 0&&(c.searcherKey.value=s)}else c.searcherKey.value=-1,f.regionsIndexes.value=[...i.value]},{immediate:!0}),l({getSearcher:y,getRegion:I}),(x,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-selectorRegion":!0,"top-selectorRegion-onlySearcher":x.onlySearcher})},[e.createVNode(k._sfc_main$4,{options:e.unref(c).optionBySearcherKey.value,modelValue:e.unref(c).searcherKey.value,"onUpdate:modelValue":h[0]||(h[0]=T=>e.unref(c).searcherKey.value=T),name:"searcher_key",addChanger:x.addChanger},null,8,["options","modelValue","addChanger"]),!x.onlySearcher&&e.unref(c).searcherKey.value!==-1?(e.openBlock(),e.createBlock(k._sfc_main$4,{key:0,class:"top-select-region",options:e.unref(m).optionByRegionIndex.value,modelValue:e.unref(m).regionIndex.value,"onUpdate:modelValue":h[1]||(h[1]=T=>e.unref(m).regionIndex.value=T),name:x.forFrequency?"region_key":"region_index",addChanger:x.addChanger,"data-top-icon":x.addRegionIcon?"":void 0},null,8,["options","modelValue","name","addChanger","data-top-icon"])):e.createCommentVNode("",!0),x.addCompare&&!x.onlySearcher&&e.unref(c).searcherKey.value===-1?(e.openBlock(),e.createBlock(k._sfc_main,{key:1,name:"compare",onClick:B,"data-count-compare-regions-indexes":e.unref(f).regionsIndexes.value.length},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.$i18n.Common.Selected_regions),1)]),_:1},8,["data-count-compare-regions-indexes"])):e.createCommentVNode("",!0)],2))}}),fe=[{id:"1",name:"Without Tag",color_id:"1"},{id:"2",name:"Red",color_id:"2"},{id:"3",name:"Orange",color_id:"3"},{id:"4",name:"Yellow",color_id:"4"},{id:"5",name:"Blue",color_id:"5"},{id:"6",name:"Purple",color_id:"6"},{id:"7",name:"Green",color_id:"7"},{id:"8",name:"Magenta",color_id:"8"},{id:"9",name:"Dark blue",color_id:"9"},{id:"10",name:"Turquoise",color_id:"10"}],W=t=>"-"+t,K=t=>t[0]==="-"?t.substring(1):t,O=(t,l)=>{t=K(t);const d=l.find(n=>n.id===t);if(d)return d},ve=["data-tag_id","data-tag_color_id","title"],R=e.defineComponent({__name:"tagIcon",props:{id:{},colorId:{},name:{},state:{}},setup(t){return(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-tagSelector_tagIcon":!0,"top-tagSelector-active":!!l.state,"top-tagSelector-excluded":l.state==="excluded"}),"data-tag_id":l.id,"data-tag_color_id":l.colorId,title:l.name},null,10,ve))}}),pe=["contenteditable","onKeydown"],H=e.defineComponent({__name:"tagPopupListItem",props:e.mergeModels({editable:{type:Boolean},disabled:{type:Boolean},canExclude:{type:Boolean},id:{},colorId:{},name:{},state:{}},{name:{required:!0},nameModifiers:{}}),emits:e.mergeModels(["update:name","unselect","exclude","select"],["update:name"]),setup(t,{emit:l}){const d=t,n=l,i=e.useModel(t,"name"),a=e.ref(null),r=e.ref(!1),c=async()=>{var o;r.value=!0,await e.nextTick(),(o=a.value)==null||o.focus()},m=()=>{var y;const o=(y=a.value)==null?void 0:y.innerText;if(!o)return f();a.value&&(a.value.innerText=o),r.value=!1,n("update:name",o)},f=async()=>{a.value&&(a.value.innerText=d.name),r.value=!1},v=o=>{if(r.value||d.disabled)return;let y="selected";d.canExclude&&(o.ctrlKey||o.metaKey)&&(y="excluded"),d.state==y&&(y=""),y===""&&n("unselect"),y==="selected"&&n("select"),y==="excluded"&&n("exclude")};return(o,y)=>(e.openBlock(),e.createBlock(E._sfc_main$2,{class:e.normalizeClass({"top-tagSelector_tagListItem":!0,"top-tagSelector_tagListItem-inEdit":r.value,"top-tagSelector_tagListItem-disabled":o.disabled,"top-tagSelector_tagListItem-canExclude":o.canExclude,"top-tagSelector-active":!!o.state,"top-tagSelector-excluded":o.state==="excluded"}),onClick:e.withModifiers(v,["stop"])},{default:e.withCtx(()=>[e.createVNode(R,{id:o.id,name:i.value,colorId:o.colorId,state:o.state},null,8,["id","name","colorId","state"]),e.createElementVNode("span",{ref_key:"elName",ref:a,class:"top-tagSelector_tagListItemName",contenteditable:r.value?"plaintext-only":!1,onKeydown:[e.withKeys(e.withModifiers(m,["stop"]),["enter"]),e.withKeys(e.withModifiers(f,["stop"]),["esc"])]},e.toDisplayString(i.value),41,pe),o.editable?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[r.value?(e.openBlock(),e.createElementBlock("span",{key:1,"data-top-icon":"",class:"top-tagSelector_edit",onClick:e.withModifiers(m,["stop"])})):(e.openBlock(),e.createElementBlock("span",{key:0,"data-top-icon":"",class:"top-tagSelector_edit",onClick:c}))],64)):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),ye={key:1},Q=e.defineComponent({inheritAttrs:!1,__name:"popupOpener",props:e.mergeModels({modelValue:{},id:{},tags:{},mode:{},targetId:{},filters:{},useTopButton:{type:Boolean},payload:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const l=t,d=e.useModel(t,"modelValue"),n=l.useTopButton?k._sfc_main:"div",i=l.useTopButton?"html":"default",a={model:d,mode:l.mode,targetId:l.targetId,filters:l.filters,payload:l.payload};return(r,c)=>{const m=e.resolveDirective("top-data");return e.openBlock(),e.createBlock(E._sfc_main$1,{id:r.id},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(n)),e.mergeProps({class:{"top-tagSelector":!0,"top-tagSelector-filter":l.mode==="filter","top-tagSelector-setter_single":l.mode==="setter"&&!r.filters,"top-tagSelector-setter_several":l.mode==="setter"&&r.filters,"top-tagSelector-selectedOne":!d.value.length||d.value.length===1,"top-tagSelector-toTwoLine":d.value.length>5},color:"theme",styling:""},r.$attrs),{[e.unref(i)]:e.withCtx(()=>[!d.value.length&&r.mode==="filter"?(e.openBlock(),e.createBlock(R,{key:0,id:"all",colorId:"",name:r.$i18n.Common.All_tags??"",state:""},null,8,["name"])):e.createCommentVNode("",!0),r.mode==="setter"&&r.filters?(e.openBlock(),e.createElementBlock("div",ye,[e.renderSlot(r.$slots,"default")])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(d.value,f=>{var v,o;return e.openBlock(),e.createBlock(R,{id:e.unref(K)(f),colorId:((v=e.unref(O)(f,r.tags))==null?void 0:v.color_id)??"",name:((o=e.unref(O)(f,r.tags))==null?void 0:o.name)??"",state:e.unref(K)(f)===f?"selected":"excluded"},null,8,["id","colorId","name","state"])}),256))]),_:2},1040,["class"])),[[m,a,"topTagSelectorTarget"]])]),_:3},8,["id"])}}}),he=e.defineComponent({__name:"tagSelector",props:e.mergeModels({modelValue:{},tags:{},tagsEditable:{type:Boolean},tagsMax:{default:10},id:{},singleMode:{type:Boolean},requiredForSetter:{type:Boolean,default:!0},maxTagsForSetter:{},emitDelay:{default:500}},{modelValue:{required:!0},modelModifiers:{},tags:{default:e.reactive(fe)},tagsModifiers:{}}),emits:e.mergeModels(["selector","setter","tagsChanged"],["update:modelValue","update:tags"]),setup(t,{emit:l}){const d=k.useI18n(),n=t,i=e.useModel(t,"modelValue"),a=e.useModel(t,"tags"),r=l,c=k.debounce((u,s)=>{r(u,s)},n.emitDelay);n.singleMode&&!i.value.length&&(i.value=[a.value[0].id]);const m=n.id??"top-popup-id-"+Math.random(),f=e.ref("add"),v=()=>{var g;const u=" "+((g=d.Common.Tags)==null?void 0:g.toLowerCase()),s=new Map;return s.set("add",{value:"add",title:d.Common.Add+u}),s.set("replace",{value:"replace",title:d.Common.Replace+u}),s.set("delete",{value:"delete",title:d.Common.Delete+u}),s};let o=e.shallowRef({model:i,mode:"filter",targetId:void 0,filters:void 0,payload:void 0});e.watch(i,()=>{c("selector",i.value)});const y=e.computed(()=>{if(o.value.mode==="setter"&&n.maxTagsForSetter&&!o.value.filters)return o.value.model.value.length>=n.maxTagsForSetter}),I=u=>{if(u!=="all"){if(o.value.model.value.includes(u))return"selected";if(o.value.model.value.includes(W(u)))return"excluded"}return u==="all"&&!o.value.model.value.length?"selected":""},B=(u,s)=>{const g=W(u);let p=o.value.model.value.filter(w=>w!==u&&w!==g);s==="select"&&p.push(u),s==="exclude"&&p.push(g),o.value.mode==="setter"&&o.value.targetId!==void 0&&n.requiredForSetter&&(p.length||p.push("1"),p.length===2&&o.value.model.value.length===1&&o.value.model.value[0]==="1"&&(p=p.filter(w=>w!=="1"))),n.singleMode&&!o.value.filters&&(p.length||(p=o.value.model.value),p.length>1&&(p=[p[p.length-1]])),p.sort((w,M)=>{if(!n.tags)return 0;const q=n.tags.findIndex(b=>b.id===w),N=n.tags.findIndex(b=>b.id===M);return q-N}),o.value.model.value=p,o.value.mode==="setter"&&o.value.targetId!==void 0&&c("setter",{tagsIds:p,targetId:o.value.targetId,payload:o.value.payload})},x=e.computed(()=>{let u="top-tagSelector_popup";return o.value.mode==="filter"&&(u+=" top-tagSelector_popup-filter"),o.value.mode==="setter"&&(u+=" top-tagSelector_popup-setter"),u}),h=()=>{const u=prompt("","New tag");if(!u||u==="New tag")return;const s=a.value.length+1;a.value.push({id:String(s),name:u,color_id:String((s-1)%10+1)}),r("tagsChanged",a.value)},T=u=>{var s;if(o.value=_.storage(u.elPopupOpener,"topTagSelectorTarget"),!o.value)throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");if(o.value.filters&&(f.value="add",o.value.model.value=[]),!((s=k.Core.$)!=null&&s.ui.sortable)){console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");return}!k.Core.state.isMobile&&!k.Core.state.isMobileUA&&a.value&&$(u.elPopup).sortable({items:'li:has([data-tag_id]:not([data-tag_id="all"]))',cancel:'[contenteditable="plaintext-only"]',distance:10,stop:function(g,p){if(!a.value)return;const w=$(p.item).parent().find("[data-tag_id]"),M=[];w.each((q,N)=>{if(!a.value)return;const b=$(N).attr("data-tag_id");M.push(b)}),a.value.sort((q,N)=>{const b=M.findIndex(z=>z===q.id),we=M.findIndex(z=>z===N.id);return b-we}),c("tagsChanged",a.value)}})},C=u=>{var s;(s=k.Core.$)!=null&&s.ui.sortable&&$(u.elPopup).data("ui-sortable")&&$(u.elPopup).sortable("destroy")};return(u,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Q,{class:"top-select_arrow",modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=g=>i.value=g),id:e.unref(m),tags:a.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(m),class:e.normalizeClass(x.value),onOpen:s[4]||(s[4]=g=>T(g)),onClose:s[5]||(s[5]=g=>C(g)),"transition-duration":50},e.createSlots({contentList:e.withCtx(()=>[e.unref(o).mode==="filter"&&!u.singleMode?(e.openBlock(),e.createBlock(H,{key:0,id:"all",colorId:"",name:u.$i18n.Common.All_tags??"",state:e.unref(o).model.value.length?"":"selected",onSelect:s[3]||(s[3]=g=>e.unref(o).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,g=>(e.openBlock(),e.createBlock(H,{key:g.id,id:g.id,colorId:g.color_id,name:g.name,state:I(g.id),canExclude:e.unref(o).mode==="filter"&&!u.singleMode,editable:u.tagsEditable,disabled:y.value&&I(g.id)==="",onUnselect:p=>B(g.id,"unselect"),onSelect:p=>B(g.id,"select"),onExclude:p=>B(g.id,"exclude"),"onUpdate:name":p=>{g.name=p,e.unref(c)("tagsChanged",a.value)}},null,8,["id","colorId","name","state","canExclude","editable","disabled","onUnselect","onSelect","onExclude","onUpdate:name"]))),128)),u.tagsEditable&&a.value.length<u.tagsMax&&a.value.length<20?(e.openBlock(),e.createBlock(E._sfc_main$2,{key:1,"data-top-icon":"",onClick:e.withModifiers(h,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Add),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.unref(o).mode==="setter"&&e.unref(o).filters?{name:"header",fn:e.withCtx(()=>[e.createVNode(k._sfc_main$4,{modelValue:f.value,"onUpdate:modelValue":s[1]||(s[1]=g=>f.value=g),options:v()},null,8,["modelValue","options"])]),key:"0"}:void 0,e.unref(o).mode==="setter"&&e.unref(o).filters?{name:"footer",fn:e.withCtx(()=>[e.createVNode(k._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(k._sfc_main,{onClick:s[2]||(s[2]=g=>e.unref(c)("setter",{tagsIds:e.unref(o).model.value,filters:e.unref(o).filters,filtersAction:f.value,payload:e.unref(o).payload}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value==="add"?u.$i18n.Common.Add:"")+" "+e.toDisplayString(f.value==="replace"?u.$i18n.Common.Replace:"")+" "+e.toDisplayString(f.value==="delete"?u.$i18n.Common.Remove:""),1)]),_:1})]),key:"1"}:void 0]),1032,["id","class"])],64))}}),Se=(t,l,d)=>{l||(l={id:t.id}),l.id=t.id;const n=ee.TopPopupWorker.genElPopupOpener("div",l);return n.classList.add("top-tagSelector"),t.useTopButton&&n.classList.add("top-button","top-color_theme"),t.mode==="filter"&&n.classList.add("top-tagSelector-filter"),t.mode==="setter"&&!t.filters&&n.classList.add("top-tagSelector-setter_single"),t.mode==="setter"&&t.filters&&n.classList.add("top-tagSelector-setter_several"),n.onclick=i=>{i.preventDefault(),i.stopPropagation(),n.onclick=null;const a=e.ref(t.modelValue),r={model:a,mode:t.mode,targetId:t.targetId,filters:t.filters,payload:t.payload};_.storage(n,"topTagSelectorTarget",r),delete n.dataset.topPopupDisabled,e.isRef(t.modelValue)||e.watch(a,()=>{t.modelValue=a.value,D(n,t,d)}),n.click()},e.isRef(t.modelValue)?e.watch(t.modelValue,()=>D(n,t,d)):_.storage(n,"topTagSelectorRender",i=>{t.modelValue=i;const a=_.storage(n,"topTagSelectorTarget");a&&(a.model.value=i),D(n,t,d)}),D(n,t,d),n},ke=(t,l)=>{var d;(d=_.storage(t,"topTagSelectorRender"))==null||d(l)},D=(t,l,d)=>{var i;const n=e.unref(l.modelValue);if(t.classList.toggle("top-tagSelector-selectedOne",!n.length||n.length===1),t.classList.toggle("top-tagSelector-toTwoLine",n.length>5),l.mode==="setter"&&l.filters){t.innerHTML=`<div>${d}</div>`;return}if(t.innerHTML="",!n.length&&l.mode==="filter"){const a=X({id:"all",colorId:"",name:((i=k.useI18n().Common)==null?void 0:i.All_tags)??"",state:""});t.append(a)}n.forEach(a=>{var c,m;const r=X({id:K(a),colorId:((c=O(a,l.tags))==null?void 0:c.color_id)??"",name:((m=O(a,l.tags))==null?void 0:m.name)??"",state:K(a)===a?"selected":"excluded"});t.append(r)})},X=t=>{const l=document.createElement("div");return l.classList.add("top-tagSelector_tagIcon"),l.classList.toggle("top-tagSelector-active",!!t.state),l.classList.toggle("top-tagSelector-excluded",t.state==="excluded"),l.dataset.tag_id=t.id,l.dataset.tag_color_id=t.colorId,l.title=t.name,l},Ie=oe,xe=me,Be=he,Ce=Q,Te=R;V.TopSelectorCompetitors=Ie,V.TopSelectorRegion=xe,V.TopTagSelector=Be,V.TopTagSelectorPopupOpener=Ce,V.TopTagSelectorTagIcon=Te,V.findRegion=Y,V.genElTopTagSelectorPopupOpener=Se,V.genSearcherByKey=U,V.renderElTopTagSelectorPopupOpener=ke,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=project.amd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.amd.js","sources":["../../src/components/project/selectorCompetitors/selectorCompetitors.vue","../../src/components/project/selectorRegion/composables/selectSearcher.ts","../../src/components/project/selectorRegion/composables/selectRegion.ts","../../src/components/project/selectorRegion/composables/compare.ts","../../src/components/project/selectorRegion/composables/selectorRegion.ts","../../src/components/project/selectorRegion/selectorRegion.vue","../../src/components/project/project.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport { computed } from 'vue';\r\nimport type { Props } from './selectorCompetitors';\r\nimport Core from '@/core/core/core';\r\nimport Button from '@/components/forms/button/button.vue';\r\nimport Popup from '@/components/popup/popup/popup.vue';\r\nimport ListItem from '@/components/popup/popup/listItem.vue';\r\nimport Menu from '@/components/formsExt/menu/menu.vue';\r\nimport { useI18n } from '@/core/plugins/i18n';\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n\tshowSelectAllItem: true,\r\n});\r\nconst model = defineModel<Props['modelValue']>();\r\n\r\nconst selectAllItem = computed(() => {\r\n\tif (props.showSelectAllItem) {\r\n\t\treturn {\r\n\t\t\ticon: '',\r\n\t\t\ttitle: useI18n().Common.Select_all,\r\n\t\t\tvalue: 'all',\r\n\t\t\tcontent: '',\r\n\t\t};\r\n\t}\r\n});\r\n</script>\r\n\r\n<template>\r\n\t<div class=\"top-selectorCompetitors\">\r\n\t\t<Popup v-if=\"Core.state.isMobile\">\r\n\t\t\t<template #opener>\r\n\t\t\t\t<Button\r\n\t\t\t\t\tclass=\"top-selectorCompetitors_opener\"\r\n\t\t\t\t\tcolor=\"theme\"\r\n\t\t\t\t\ticon=\"\"\r\n\t\t\t\t\ticon2=\"\"\r\n\t\t\t\t>\r\n\t\t\t\t\t{{ items.find((item) => item.value === model?.[0])?.content }}\r\n\t\t\t\t</Button>\r\n\t\t\t</template>\r\n\r\n\t\t\t<template #contentList>\r\n\t\t\t\t<ListItem\r\n\t\t\t\t\tv-for=\"(item, index) in items\"\r\n\t\t\t\t\t:class=\"{\r\n\t\t\t\t\t\t'top-active': model?.includes(item.value)\r\n\t\t\t\t\t}\"\r\n\t\t\t\t\t:data-top-icon=\"item.icon\"\r\n\t\t\t\t\t:title=\"item.title\"\r\n\t\t\t\t\t@click=\"() => model = [item.value]\"\r\n\t\t\t\t>\r\n\t\t\t\t\t<span class=\"top-ellipsis1\">\r\n\t\t\t\t\t\t{{ item.content }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</ListItem>\r\n\t\t\t</template>\r\n\t\t</Popup>\r\n\r\n\t\t<Menu\r\n\t\t\tv-else\r\n\t\t\tv-model=\"model\"\r\n\t\t\t:items=\"items\"\r\n\t\t\t:isMultiple=\"true\"\r\n\t\t\tstyling=\"bar\"\r\n\t\t\t:canBeEmptyMultiple=\"false\"\r\n\t\t\t:selectAllItem=\"selectAllItem\"\r\n\t\t/>\r\n\t</div>\r\n</template>\r\n\r\n<style module>\r\n.top-selectorCompetitors_opener.top-button {\r\n\twidth: 100%;\r\n}\r\n</style>\r\n","import { computed, type ComputedRef, ref } from 'vue';\r\nimport { useI18n } from '@/core/plugins/i18n';\r\nimport type { Props, SearcherByKey } from '../selectorRegion';\r\nimport type { Option, Options } from '@/components/forms/select/select';\r\nimport { dummyIndex } from '../utils/consts';\r\nimport { getSearcherGIcon } from '@/core/utils/searchers';\r\n\r\n/**\r\n * Создание и управление реактивными переменными для выбора ПС\r\n *\r\n * @param props - входные props компонента\r\n * @param mapSearchers - Map ПС (реактивная)\r\n */\r\nexport const useSelectSearcher = (\r\n\tprops: Props,\r\n\tmapSearchers: ComputedRef<SearcherByKey>,\r\n) => {\r\n\tconst i18n = useI18n();\r\n\r\n\t/**\r\n\t * Ключ выбранной поисковой системы\r\n\t */\r\n\tconst searcherKey = ref(mapSearchers.value.keys().next().value ?? dummyIndex);\r\n\r\n\t/**\r\n\t * Коллекция опций для выбора ПС\r\n\t */\r\n\tconst optionBySearcherKey = computed(() => {\r\n\t\tconst res: Options = new Map();\r\n\t\tmapSearchers.value.forEach((searcher) => {\r\n\t\t\tlet option: Option = {\r\n\t\t\t\tvalue: searcher.key,\r\n\t\t\t\ttitle: searcher.name,\r\n\t\t\t};\r\n\r\n\t\t\tif (props.addSearcherIcon) option.icon = getSearcherGIcon(searcher.key);\r\n\r\n\t\t\tres.set(searcher.key, option);\r\n\t\t});\r\n\r\n\t\t// добавить режим сравнения, если есть хотя бы одна ПС\r\n\t\tif (props.addCompare && !res.has(dummyIndex)) {\r\n\t\t\tconst dummyOption: Option = {\r\n\t\t\t\tvalue: '',\r\n\t\t\t\ttitle: '--------------------',\r\n\t\t\t\tdisabled: true,\r\n\t\t\t};\r\n\t\t\tres.set(dummyOption.value, dummyOption);\r\n\r\n\t\t\tconst compareOption: Option = {\r\n\t\t\t\tvalue: -1,\r\n\t\t\t\ttitle: i18n.Common.Compare!,\r\n\t\t\t};\r\n\t\t\tres.set(compareOption.value, compareOption);\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t});\r\n\r\n\treturn {\r\n\t\tsearcherKey,\r\n\t\toptionBySearcherKey,\r\n\t};\r\n};\r\n","import { computed, type ComputedRef, ref, watch } from 'vue';\r\nimport { useI18n } from '@/core/plugins/i18n';\r\nimport { getDeviceGIcon, getLangLabel } from '@/core/utils/searchers';\r\nimport type { Option } from '@/components/forms/select/select';\r\nimport { dummyIndex } from '../utils/consts';\r\nimport type { Props, Region, SearcherIndexed } from '../selectorRegion';\r\n\r\n/**\r\n * Создание и управление реактивными переменными для выбора региона\r\n *\r\n * @param props - входные props компонента\r\n * @param activeSearcherIndexed - объект активной поисковой системы (реактивная)\r\n * @param regionsIndexes - входные индексы регионов/ПС\r\n */\r\nexport const useSelectRegion = (props: Props, activeSearcherIndexed: ComputedRef<SearcherIndexed>) => {\r\n\tconst i18n = useI18n();\r\n\r\n\t/**\r\n\t * Индекс выбранного региона\r\n\t */\r\n\tconst regionIndex = ref(dummyIndex);\r\n\r\n\tif (props.modelValue.length === 1) {\r\n\t\tregionIndex.value = props.modelValue[0];\r\n\t}\r\n\r\n\tif (regionIndex.value === dummyIndex) {\r\n\t\tif (props.forFrequency) {\r\n\t\t\t// в качетсве ключа используется region.key, а не region.index\r\n\t\t\tregionIndex.value = activeSearcherIndexed.value?.regionByIndex.values().next().value?.key ?? dummyIndex;\r\n\t\t} else {\r\n\t\t\tregionIndex.value = activeSearcherIndexed.value?.regionByIndex.keys().next().value ?? dummyIndex;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Коллекция опций для выбора региона\r\n\t */\r\n\tconst optionByRegionIndex = computed(() => {\r\n\t\tconst options = new Map<number, Option>();\r\n\r\n\t\tactiveSearcherIndexed.value.regionByIndex?.forEach((region) => {\r\n\t\t\tlet regionLabel = region.name;\r\n\r\n\t\t\t// на частоту в текущей версии устройство и язык не влияют\r\n\t\t\t// обратите внимание, в качетсве ключа используется region.key, а не region.index\r\n\t\t\tif (props.forFrequency) {\r\n\t\t\t\tconst option: Option = {\r\n\t\t\t\t\tvalue: region.key,\r\n\t\t\t\t\ttitle: regionLabel,\r\n\t\t\t\t};\r\n\t\t\t\tif (!options.has(region.key)) options.set(region.key, option);\r\n\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (region.device) {\r\n\t\t\t\tregionLabel += ' (' + i18n.Common['Device_' + region.device] + ')';\r\n\t\t\t}\r\n\r\n\t\t\tconst langLabel = getLangLabel(activeSearcherIndexed.value.key || 0, region.lang ?? '');\r\n\t\t\tif (langLabel) regionLabel += ' / ' + langLabel;\r\n\r\n\t\t\tconst option: Option = {\r\n\t\t\t\tvalue: region.index,\r\n\t\t\t\ttitle: regionLabel,\r\n\t\t\t\ticon: region.device ? getDeviceGIcon(region.device) : undefined,\r\n\t\t\t};\r\n\r\n\t\t\toptions.set(region.index, option);\r\n\t\t});\r\n\r\n\t\treturn options;\r\n\t});\r\n\r\n\t/**\r\n\t * Выбор максимально похожего региона в новой коллекции регионов\r\n\t */\r\n\twatch(optionByRegionIndex, (optionByRegionIndex, oldOptionByRegionIndex) => {\r\n\t\tif (props.onlySearcher || regionIndex.value !== undefined && optionByRegionIndex.get(regionIndex.value)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet newRegionIndex = optionByRegionIndex.keys().next().value as Region['index'];\r\n\t\tif (regionIndex.value === dummyIndex || newRegionIndex === dummyIndex) {\r\n\t\t\tregionIndex.value = newRegionIndex;\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet regionName = (oldOptionByRegionIndex?.get(regionIndex.value) as Option)?.title || '';\r\n\t\tlet regionMatchLevel = -1;\r\n\t\tfor (const [index, option] of optionByRegionIndex.entries()) {\r\n\t\t\tconst title = (option as Option).title;\r\n\r\n\t\t\tif (typeof title !== 'string' || typeof index === 'string') {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// полное совпадение\r\n\t\t\tif (title === regionName) {\r\n\t\t\t\tnewRegionIndex = index;\r\n\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tconst regexpDevice = new RegExp(` \\\\((${i18n.Common['Device_1']}|${i18n.Common['Device_2']})\\\\)`);\r\n\t\t\tlet regionNameCompare = regionName;\r\n\t\t\tlet regionMatchLevelI = 3;\r\n\r\n\t\t\t// без устройства\r\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\r\n\t\t\t\tregionNameCompare = regionName.replace(/^[^a-zа-я]/i, '').replace(regexpDevice, '');\r\n\r\n\t\t\t\tregionMatchLevelI--;\r\n\t\t\t}\r\n\r\n\t\t\t// без языка\r\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\r\n\t\t\t\tregionNameCompare = regionName.replace(/ \\/.*/, '');\r\n\r\n\t\t\t\tregionMatchLevelI--;\r\n\t\t\t}\r\n\r\n\t\t\t// без устройства и без языка\r\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\r\n\t\t\t\tregionNameCompare = regionName.replace(/ \\/.*/, '');\r\n\t\t\t\tregionNameCompare = regionNameCompare.replace(/^[^a-zа-я]/i, '').replace(regexpDevice, '');\r\n\r\n\t\t\t\tregionMatchLevelI--;\r\n\t\t\t}\r\n\r\n\t\t\tif (title.indexOf(regionNameCompare) === -1) continue;\r\n\t\t\tif (regionMatchLevelI <= regionMatchLevel) continue;\r\n\r\n\t\t\tregionMatchLevel = regionMatchLevelI;\r\n\t\t\tnewRegionIndex = index;\r\n\t\t}\r\n\r\n\t\tregionIndex.value = newRegionIndex;\r\n\t});\r\n\r\n\treturn {\r\n\t\tregionIndex,\r\n\t\toptionByRegionIndex,\r\n\t};\r\n};\r\n","import { type ComputedRef, ref, watch } from 'vue';\r\nimport type { Props, SearcherByKey } from '../selectorRegion';\r\n\r\n/**\r\n * Создание и управление реактивными переменными для сравнения\r\n *\r\n * @param props - входные props компонента\r\n * @param searcherByKey - Map ПС (реактивная)\r\n * @param allRegionsIndexes - Все доступные индексы регионов (реактивная)\r\n */\r\nexport const useCompare = (props: Props, searcherByKey: ComputedRef<SearcherByKey>, allRegionsIndexes: ComputedRef<Set<number>>) => {\r\n\t/**\r\n\t * Индексы регионов/ПС в сравнение\r\n\t */\r\n\tconst regionsIndexes = ref([] as number[]);\r\n\r\n\t/**\r\n\t * Загрузка индексов регионов для сравнения\r\n\t *\r\n\t * Если в modelValue передано несколько регионов, они будут установлены как выбранные для сравнения\r\n\t */\r\n\tconst compareLoad = () => {\r\n\t\tif (props.onlySearcher && searcherByKey.value) {\r\n\t\t\tregionsIndexes.value = Array.from(searcherByKey.value.keys());\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet regionsIndexesSaved: Props['modelValue'] = [];\r\n\r\n\t\tif (props.modelValue.length > 1) {\r\n\t\t\tregionsIndexesSaved = [...props.modelValue];\r\n\t\t} else {\r\n\t\t\ttry {\r\n\t\t\t\t// загрузить индексы регионов, если они были сохранены\r\n\t\t\t\tregionsIndexesSaved = JSON.parse(\r\n\t\t\t\t\tlocalStorage.getItem('ui:project:regionSelector' + props.projectId + ':regionsIndexes') as string,\r\n\t\t\t\t) ?? [];\r\n\t\t\t} catch (e) {\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// убрать из сравнения регионы, которых нет в props.searchers\r\n\t\tif (regionsIndexesSaved.length) {\r\n\t\t\tregionsIndexesSaved = regionsIndexesSaved.filter((regionIndex) => {\r\n\t\t\t\treturn allRegionsIndexes.value.has(regionIndex);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// если не сохранено ни одного региона, выбрать все регионы проекта\r\n\t\tif (!regionsIndexesSaved.length) {\r\n\t\t\tregionsIndexesSaved = Array.from(allRegionsIndexes.value);\r\n\t\t}\r\n\r\n\t\tregionsIndexes.value = [...regionsIndexesSaved];\r\n\t};\r\n\r\n\t/**\r\n\t * Сохранение выбранных регионов\r\n\t */\r\n\tconst compareSave = () => {\r\n\t\tif (regionsIndexes.value.length) {\r\n\t\t\tlocalStorage.setItem('ui:project:regionSelector:' + props.projectId + ':regionsIndexes', JSON.stringify(regionsIndexes.value));\r\n\t\t} else {\r\n\t\t\tlocalStorage.removeItem('ui:project:regionSelector:' + props.projectId + ':regionsIndexes');\r\n\t\t}\r\n\t};\r\n\r\n\twatch(regionsIndexes, () => {\r\n\t\tcompareSave();\r\n\t});\r\n\r\n\tif (props.addCompare) {\r\n\t\t// if (props.compareRegionsIndexes?.length) {\r\n\t\t// \tcompareRegionsIndexes.value = [...props.compareRegionsIndexes];\r\n\t\t// } else {\r\n\t\t// \tcompareLoad();\r\n\t\t// }\r\n\r\n\t\tcompareLoad();\r\n\t}\r\n\r\n\treturn {\r\n\t\tregionsIndexes,\r\n\t};\r\n};\r\n","import { computed, watch } from 'vue';\r\nimport { findRegion, genSearcherByKey } from '../utils/utils';\r\nimport { dummyIndex, searcherUndefined } from '../utils/consts';\r\nimport type { Props, Region, SearcherIndexed } from '../selectorRegion';\r\nimport { useSelectSearcher } from './selectSearcher';\r\nimport { useSelectRegion } from './selectRegion';\r\nimport { useCompare } from './compare';\r\n\r\n/**\r\n * Создание и управления рективными переменными компонента\r\n *\r\n * @param props - входные props компонента\r\n */\r\nexport const useSelectorRegion = (props: Props) => {\r\n\tconst searcherByKey = computed(() => {\r\n\t\treturn genSearcherByKey(props.forFrequency, props.autoRegion, props.searchers);\r\n\t});\r\n\r\n\tconst activeSearcherIndexed = computed(() => {\r\n\t\treturn searcherByKey.value.get(selectSearcher.searcherKey.value) || searcherUndefined;\r\n\t});\r\n\r\n\t/**\r\n\t * Все индексы регионов из mapSearchers\r\n\t */\r\n\tconst allRegionsIndexes = computed(() => {\r\n\t\tconst regionsIndexes = new Set<number>();\r\n\r\n\t\tsearcherByKey.value.forEach((searcher) => {\r\n\t\t\tsearcher.regions?.forEach((region) => {\r\n\t\t\t\tif (region.index === -1) return;\r\n\t\t\t\tif (region.index === dummyIndex) return;\r\n\r\n\t\t\t\tregionsIndexes.add(region.index);\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\treturn regionsIndexes;\r\n\t});\r\n\r\n\tconst selectSearcher = useSelectSearcher(props, searcherByKey);\r\n\tconst selectRegion = useSelectRegion(props, activeSearcherIndexed);\r\n\tconst compare = useCompare(props, searcherByKey, allRegionsIndexes);\r\n\r\n\t// контроль за внешним изменением списка ПС\r\n\twatch(searcherByKey, () => {\r\n\t\t// возможные значения для сравнения регионов\r\n\t\tif (selectSearcher.searcherKey.value === -1) {\r\n\t\t\tcompare.regionsIndexes.value = compare.regionsIndexes.value.filter(regionIndex => {\r\n\t\t\t\treturn allRegionsIndexes.value.has(regionIndex);\r\n\t\t\t});\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet newSearcherKey = searcherByKey.value.keys().next().value;\r\n\r\n\t\tsearcherByKey.value.forEach((searcher) => {\r\n\t\t\t// определить выбранную ПС\r\n\t\t\tif (\r\n\t\t\t\tselectRegion.regionIndex.value &&\r\n\t\t\t\tsearcher.regionByIndex?.has(selectRegion.regionIndex.value)\r\n\t\t\t) {\r\n\t\t\t\tnewSearcherKey = searcher.key;\r\n\t\t\t}\r\n\r\n\t\t\t// выбрать первую ПС с выбранным регионом\r\n\t\t\tif (!props.onlySearcher) {\r\n\t\t\t\tlet regionsNewSearcher: SearcherIndexed['regionByIndex'] | undefined;\r\n\r\n\t\t\t\tif (newSearcherKey !== undefined) {\r\n\t\t\t\t\tregionsNewSearcher = searcherByKey.value.get(newSearcherKey)?.regionByIndex;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst regionsCurrentSearcher = searcherByKey.value.get(searcher.key)?.regionByIndex;\r\n\t\t\t\tif (\r\n\t\t\t\t\tregionsNewSearcher?.has(dummyIndex) &&\r\n\t\t\t\t\t!regionsCurrentSearcher?.has(dummyIndex)\r\n\t\t\t\t) {\r\n\t\t\t\t\tnewSearcherKey = searcher.key;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif (props.addCompare && !selectSearcher.optionBySearcherKey.value.has(dummyIndex)) {\r\n\t\t\tif (!selectRegion.regionIndex.value && compare.regionsIndexes.value?.length) newSearcherKey = -1;\r\n\t\t}\r\n\r\n\t\tif (props.onlySearcher && selectRegion.regionIndex.value !== dummyIndex) newSearcherKey = selectRegion.regionIndex.value;\r\n\r\n\t\tif (newSearcherKey !== undefined) {\r\n\t\t\tselectSearcher.searcherKey.value = newSearcherKey;\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tselectRegion.regionIndex.value !== undefined &&\r\n\t\t\t!(activeSearcherIndexed.value?.regionByIndex)?.has(selectRegion.regionIndex.value)\r\n\t\t) {\r\n\t\t\tselectRegion.regionIndex.value = activeSearcherIndexed.value?.regions?.keys().next().value as number;\r\n\t\t}\r\n\t}, { immediate: true });\r\n\r\n\tconst getSearcherKey = () => {\r\n\t\tif (selectSearcher.searcherKey.value === -1 || selectSearcher.searcherKey.value === dummyIndex) return;\r\n\r\n\t\treturn selectSearcher.searcherKey.value;\r\n\t};\r\n\r\n\tconst getRegionIndex = () => {\r\n\t\tif (props.onlySearcher) return;\r\n\r\n\t\tif (selectRegion.regionIndex.value === dummyIndex) return;\r\n\r\n\t\tlet res: Region['index'] | undefined = selectRegion.regionIndex.value;\r\n\r\n\t\t// в качестве ключа используется region.key\r\n\t\tif (props.forFrequency) {\r\n\t\t\tconst regionKey = selectRegion.regionIndex.value;\r\n\t\t\tconst region = findRegion(props.forFrequency, { searcher_key: getSearcherKey(), key: regionKey } as Region, props.searchers);\r\n\r\n\t\t\tres = region?.index;\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t};\r\n\r\n\t/**\r\n\t * Получить выбранную ПС\r\n\t */\r\n\tconst getSearcher = () => {\r\n\t\tconst searcherKey = getSearcherKey();\r\n\t\tif (searcherKey === undefined) return;\r\n\r\n\t\treturn searcherByKey.value.get(searcherKey);\r\n\t};\r\n\r\n\t/**\r\n\t * Получить выбранный регион\r\n\t */\r\n\tconst getRegion = () => {\r\n\t\tconst regionIndex = getRegionIndex();\r\n\t\tif (regionIndex === undefined) return;\r\n\r\n\t\treturn getSearcher()?.regionByIndex?.get(regionIndex);\r\n\t};\r\n\r\n\treturn {\r\n\t\tselectSearcher,\r\n\t\tselectRegion,\r\n\t\tcompare,\r\n\r\n\t\tsearcherByKey,\r\n\t\tallRegionsIndexes,\r\n\r\n\t\tgetSearcher,\r\n\t\tgetRegion,\r\n\t};\r\n};\r\n","<script setup lang=\"ts\">\r\nimport { watch } from 'vue';\r\nimport type { Emits, Props, Region } from './selectorRegion';\r\nimport Select from '@/components/forms/select/select.vue';\r\nimport Button from '@/components/forms/button/button.vue';\r\nimport { useSelectorRegion } from './composables/selectorRegion';\r\nimport { dummyIndex } from './utils/consts';\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n\tsearchers: () => [],\r\n\t// compareRegionsIndexes: () => [],\r\n\taddSearcherIcon: true,\r\n\taddRegionIcon: true,\r\n\taddChanger: true,\r\n});\r\n\r\nconst model = defineModel<Props['modelValue']>({ required: true });\r\nconst modelSingle = defineModel<Props['modelValueSingle']>('modelValueSingle');\r\n\r\nconst emit = defineEmits<Emits>();\r\n\r\nconst {\r\n\tselectSearcher,\r\n\tselectRegion,\r\n\tcompare,\r\n\r\n\tsearcherByKey,\r\n\tallRegionsIndexes,\r\n\r\n\tgetSearcher,\r\n\tgetRegion,\r\n} = useSelectorRegion(props);\r\n\r\nconst onClickCompare = () => {\r\n\t// ### TODO: сделать выбор регионов через UI (сейчас в UI выбор региона не работает)\r\n\tif (window['fieldTemplates'] && window['fieldTemplates']?.openSelectorRegions) {\r\n\t\twindow['fieldTemplates'].openSelectorRegions(\r\n\t\t\tsearcherByKey.value,\r\n\t\t\tcompare.regionsIndexes.value,\r\n\t\t\t(regionsIndexes: Region['index'][]) => compare.regionsIndexes.value = regionsIndexes,\r\n\t\t);\r\n\t\treturn;\r\n\t}\r\n\r\n\temit('compareRegions', searcherByKey.value);\r\n};\r\n\r\nwatch([selectRegion.regionIndex, selectSearcher.searcherKey, compare.regionsIndexes], () => {\r\n\tif (selectSearcher.searcherKey.value === -1 && compare.regionsIndexes.value.length) {\r\n\t\tif (JSON.stringify(model.value) === JSON.stringify(compare.regionsIndexes.value)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tmodel.value = [...compare.regionsIndexes.value];\r\n\t} else {\r\n\t\tmodel.value = [props.onlySearcher ? selectSearcher.searcherKey.value : selectRegion.regionIndex.value];\r\n\t}\r\n\r\n\t// регионов нет\r\n\tif (!allRegionsIndexes.value.size) {\r\n\t\tselectSearcher.searcherKey.value = dummyIndex;\r\n\t}\r\n});\r\n\r\nif (modelSingle.value) {\r\n\twatch(modelSingle, () => {\r\n\t\tmodel.value = [modelSingle.value!];\r\n\t}, { immediate: true });\r\n}\r\n\r\nwatch(model, () => {\r\n\tif (model.value[0]) {\r\n\t\tmodelSingle.value = model.value[0];\r\n\t}\r\n\r\n\t// проверка входных данных v-model на корректность\r\n\tif (props.onlySearcher) {\r\n\t\tif (\r\n\t\t\t!model.value.length ||\r\n\t\t\tmodel.value.length === 1 && !searcherByKey.value.has(model.value[0])\r\n\t\t) {\r\n\t\t\tlet defaultKey: number | undefined = searcherByKey.value.keys().next().value;\r\n\r\n\t\t\tif (defaultKey !== undefined) {\r\n\t\t\t\tmodel.value = [defaultKey];\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tmodel.value.length > 1 &&\r\n\t\t\tJSON.stringify(model.value) !== JSON.stringify(compare.regionsIndexes.value)\r\n\t\t) {\r\n\t\t\tmodel.value = [...compare.regionsIndexes.value];\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\t} else {\r\n\t\tlet newModel = [...new Set(model.value)];\r\n\r\n\t\tlet defaultIndex = searcherByKey.value.values().next().value?.regionByIndex?.keys().next().value;\r\n\t\tif (props.forFrequency) {\r\n\t\t\tdefaultIndex = searcherByKey.value.values().next().value?.regionByIndex?.values().next().value?.key;\r\n\t\t}\r\n\r\n\t\tif (!newModel.length) {\r\n\t\t\tif (defaultIndex !== undefined) {\r\n\t\t\t\tnewModel.push(defaultIndex);\r\n\t\t\t}\r\n\t\t} else if (newModel.length === 1) {\r\n\t\t\tlet all = allRegionsIndexes.value;\r\n\r\n\t\t\tif (props.forFrequency) {\r\n\t\t\t\tall = new Set();\r\n\t\t\t\tsearcherByKey.value.forEach((searcher) => {\r\n\t\t\t\t\tsearcher.regionByIndex.forEach((region) => {\r\n\t\t\t\t\t\tif (region.index === -1) return;\r\n\t\t\t\t\t\tif (region.index === dummyIndex) return;\r\n\r\n\t\t\t\t\t\tall.add(region.key);\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tif (!all.has(newModel[0]) && newModel[0] !== -2) {\r\n\t\t\t\tnewModel = [];\r\n\t\t\t\tif (defaultIndex !== undefined) {\r\n\t\t\t\t\tnewModel.push(defaultIndex);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tnewModel = newModel.filter(index => allRegionsIndexes.value.has(index));\r\n\t\t\tif (!newModel.length && defaultIndex !== undefined) {\r\n\t\t\t\tnewModel.push(defaultIndex);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (JSON.stringify(model.value) !== JSON.stringify(newModel)) {\r\n\t\t\tmodel.value = newModel;\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\t// входные данные v-model совпадают с внутренними значениями\r\n\tif (\r\n\t\tmodel.value.length === 1 &&\r\n\t\tmodel.value[0] === (props.onlySearcher ? selectSearcher.searcherKey.value : selectRegion.regionIndex.value)\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// if (\r\n\t// \tmodel.value.length > 1 &&\r\n\t// \tselectorSearcher.searcherKey.value === -1 &&\r\n\t// \tJSON.stringify(model.value) === JSON.stringify(selectorCompare.regionsIndexes.value)\r\n\t// ) {\r\n\t// \treturn;\r\n\t// }\r\n\r\n\t// обновление regionIndex, searcherKey, selectorCompare.regionsIndexes\r\n\tif (props.onlySearcher) {\r\n\t\t// if (!model.value.length) {\r\n\t\t// \tselectorSearcher.searcherKey.value = dummyIndex;\r\n\t\t//\r\n\t\t// \treturn;\r\n\t\t// }\r\n\r\n\t\tif (model.value.length === 1) {\r\n\t\t\tselectSearcher.searcherKey.value = model.value[0];\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tselectSearcher.searcherKey.value = -1;\r\n\r\n\t\treturn;\r\n\t} else {\r\n\t\t// if (!model.value.length) {\r\n\t\t// \tselectorSearcher.searcherKey.value = dummyIndex;\r\n\t\t// \tselectorRegion.regionIndex.value = dummyIndex;\r\n\t\t//\r\n\t\t// \treturn;\r\n\t\t// }\r\n\r\n\t\tif (model.value.length === 1 && selectSearcher.searcherKey.value !== -1) {\r\n\t\t\tselectRegion.regionIndex.value = model.value[0];\r\n\r\n\t\t\tlet newSearherKey: number | undefined;\r\n\t\t\tfor (const searcher of searcherByKey.value.values()) {\r\n\t\t\t\tfor (const region of searcher.regionByIndex.values()) {\r\n\t\t\t\t\tconst currentRegionIndex = props.forFrequency ? region.key : region.index;\r\n\t\t\t\t\tif (currentRegionIndex === selectRegion.regionIndex.value) {\r\n\t\t\t\t\t\tnewSearherKey = searcher.key;\r\n\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (newSearherKey !== undefined) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (newSearherKey !== undefined) {\r\n\t\t\t\tselectSearcher.searcherKey.value = newSearherKey;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tselectSearcher.searcherKey.value = -1;\r\n\t\t\tcompare.regionsIndexes.value = [...model.value];\r\n\t\t}\r\n\t}\r\n}, { immediate: true });\r\n\r\ndefineExpose({\r\n\tgetSearcher,\r\n\tgetRegion,\r\n});\r\n</script>\r\n\r\n<template>\r\n\t<div\r\n\t\t:class=\"{\r\n\t\t\t'top-selectorRegion': true,\r\n\t\t\t'top-selectorRegion-onlySearcher': onlySearcher,\r\n\t\t}\"\r\n\t>\r\n\t\t<Select\r\n\t\t\t:options=\"selectSearcher.optionBySearcherKey.value\"\r\n\t\t\tv-model=\"selectSearcher.searcherKey.value\"\r\n\t\t\tname=\"searcher_key\"\r\n\t\t\t:addChanger=\"addChanger\"\r\n\t\t/>\r\n\r\n\t\t<Select\r\n\t\t\tv-if=\"!onlySearcher && selectSearcher.searcherKey.value !== -1\"\r\n\t\t\tclass=\"top-select-region\"\r\n\t\t\t:options=\"selectRegion.optionByRegionIndex.value\"\r\n\t\t\tv-model=\"selectRegion.regionIndex.value\"\r\n\t\t\t:name=\"forFrequency ? 'region_key' : 'region_index'\"\r\n\t\t\t:addChanger=\"addChanger\"\r\n\t\t\t:data-top-icon=\"addRegionIcon ? '' : undefined\"\r\n\t\t/>\r\n\r\n\t\t<Button\r\n\t\t\tv-if=\"addCompare && !onlySearcher && selectSearcher.searcherKey.value === -1\"\r\n\t\t\tname=\"compare\"\r\n\t\t\t@click=\"onClickCompare\"\r\n\t\t\t:data-count-compare-regions-indexes=\"compare.regionsIndexes.value.length\"\r\n\t\t>\r\n\t\t\t{{ $i18n.Common.Selected_regions }}\r\n\t\t</Button>\r\n\t</div>\r\n</template>\r\n\r\n<style module>\r\n@import \"./styles/searcherColors.css\";\r\n\r\n.top-selectorRegion {\r\n\twidth: 320px;\r\n\tdisplay: inline-flex;\r\n\tvertical-align: middle;\r\n}\r\n\r\n.top-selectorRegion > .top-select {\r\n\tflex-grow: 1;\r\n}\r\n\r\n.top-selectorRegion > .top-select:focus-within {\r\n\tz-index: 4;\r\n}\r\n\r\n.top-selectorRegion > .top-select > .top-select_select:hover,\r\n.top-selectorRegion > .top-select > .top-select_select.top-error {\r\n\tz-index: 1;\r\n}\r\n\r\n.top-selectorRegion > .top-select-searcher_key {\r\n\twidth: 120px;\r\n\tmax-width: 140px;\r\n\tmargin-right: -1px;\r\n}\r\n\r\n.top-selectorRegion > .top-select-region > select {\r\n\tborder-top-left-radius: 0;\r\n\tborder-bottom-left-radius: 0;\r\n}\r\n\r\n.top-selectorRegion > .top-select-region {\r\n\t--top-icon-size: 20px;\r\n\t--top-icon-color: var(--color-text-primary-1);\r\n\r\n\t--top-icon2-size: 20px;\r\n\t--top-icon2-color: var(--color-text-primary-1);\r\n}\r\n\r\n.top-selectorRegion > .top-select-region[data-top-icon][data-top-icon2] {\r\n\t--top-icon2-size: 16px;\r\n}\r\n\r\n.top-selectorRegion > .top-select-region[data-top-icon][data-top-icon2]:after {\r\n\ttext-indent: -4px;\r\n}\r\n\r\n.top-selectorRegion > [name=\"compare\"] {\r\n\tborder-top-left-radius: 0;\r\n\tborder-bottom-left-radius: 0;\r\n\tflex-grow: 1;\r\n}\r\n\r\n.top-selectorRegion > [name=\"compare\"]:after {\r\n\tcontent: \"(\" attr(data-count-compare-regions-indexes) \")\";\r\n\tmargin: 0 0 0 6px;\r\n}\r\n\r\n.top-selectorRegion:not(.top-selectorRegion-onlySearcher) > .top-select-searcher_key > select {\r\n\tborder-top-right-radius: 0;\r\n\tborder-bottom-right-radius: 0;\r\n\tmargin-right: 0;\r\n}\r\n\r\n.top-selectorRegion:not(.top-selectorRegion-onlySearcher) > .top-select-searcher_key[data-value=\"-1\"] > select {\r\n\tborder-right: none;\r\n}\r\n\r\n.top-selectorRegion-onlySearcher {\r\n\twidth: 120px;\r\n}\r\n</style>\r\n","import type { ComponentCustomProps } from 'vue';\r\n\r\nimport SelectorCompetitors from './selectorCompetitors/selectorCompetitors.vue';\r\nimport SelectorRegion from './selectorRegion/selectorRegion.vue';\r\n\r\nexport const TopSelectorCompetitors = SelectorCompetitors as typeof SelectorCompetitors & ComponentCustomProps;\r\nexport const TopSelectorRegion = SelectorRegion as typeof SelectorRegion & ComponentCustomProps;\r\n"],"names":["props","__props","selectAllItem","vue","forms","useSelectSearcher","mapSearchers","i18n","searcherKey","project_utils","optionBySearcherKey","res","searcher","option","utils_searchers","useSelectRegion","activeSearcherIndexed","regionIndex","_c","optionByRegionIndex","options","regionLabel","region","langLabel","newRegionIndex","optionByRegionIndex2","regionName","_a","oldOptionByRegionIndex","regionMatchLevel","index","title","regexpDevice","regionNameCompare","regionMatchLevelI","regionsIndexes","searcherByKey","regionsIndexesSaved","useSelectorRegion","selectSearcher","allRegionsIndexes","compare","newSearcherKey","selectRegion","regionsNewSearcher","_b","regionsCurrentSearcher","_e","_d","getSearcherKey","getSearcher","getRegionIndex","emit","__emit","getRegion","model","modelSingle","defaultKey","newModel","defaultIndex","all","newSearherKey","__expose","TopSelectorCompetitors","SelectorCompetitors","TopSelectorRegion","SelectorRegion"],"mappings":"4mBAUA,MAAAA,EAAAC,+BAKAC,EAAAC,EAAA,SAAA,IAAA,CACC,GAAAH,EAAA,kBACC,MAAA,UACO,MAAAI,EAAA,QAAA,EAAA,OAAA,iCAGG,CAEX,CAAA,0yCCVYC,EAAA,CAAAL,EAAAM,IAAA,CAIZ,MAAAC,EAAAH,EAAA,QAAA,EAKAI,EAAAL,EAAA,IAAAG,EAAA,MAAA,KAAA,EAAA,KAAA,EAAA,OAAAG,EAAA,UAAA,EAKAC,EAAAP,EAAA,SAAA,IAAA,CACC,MAAAQ,EAAA,IAAA,IAaA,8BAXsB,MAAAC,EAAA,IACJ,MAAAA,EAAA,IACA,EAGjBZ,EAAA,kBAAAa,EAAA,KAAAC,EAAA,iBAAAF,EAAA,GAAA,iBAE4B,CAAA,EAI7BZ,EAAA,YAAA,CAAAW,EAAA,IAAAF,EAAA,UAAA,EAAA,2DAIY,qCAKH,MAAAF,EAAA,OAAA,OACY,2BAKd,CAAA,EAGR,MAAA,CAAO,YAAAC,EACN,oBAAAE,CACA,GC/CWK,EAAA,CAAAf,EAAAgB,IAAA,WACZ,MAAAT,EAAAH,EAAA,QAAA,EAKAa,EAAAd,EAAA,IAAAM,EAAA,UAAA,qDAMAQ,EAAA,QAAAR,EAAA,aACCT,EAAA,2HAICiB,EAAA,QAAAC,EAAAF,EAAA,QAAA,YAAAE,EAAA,cAAA,OAAA,OAAA,QAAAT,EAAA,YAOF,MAAAU,EAAAhB,EAAA,SAAA,IAAA,OACC,MAAAiB,EAAA,IAAA,yDAGC,IAAAC,EAAAC,EAAA,KAIA,GAAAtB,EAAA,aAAA,UACwB,MAAAsB,EAAA,WAEf,+BAIR,OAGDA,EAAA,SACCD,GAAA,KAAAd,EAAA,OAAA,UAAAe,EAAA,MAAA,EAAA,KAGD,MAAAC,EAAAT,EAAA,aAAAE,EAA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6BAGApB,EAAA,eAAA,MAAA,CAAA,GAAAc,EAAA,KAAA,CAEF,EAAA,CAAA,UAAA,EAAA,CAAA,EAGDO,EAAA,CAAa,YAAAZ,EACZ,UAAAI,CACA,CAAA,snDCpNMS,EAAAC,EACAC,EAAAC"}
|
|
1
|
+
{"version":3,"file":"project.amd.js","sources":["../../src/components/project/selectorCompetitors/selectorCompetitors.vue","../../src/components/project/selectorRegion/utils/consts.ts","../../src/components/project/selectorRegion/utils/utils.ts","../../src/components/project/selectorRegion/composables/selectSearcher.ts","../../src/components/project/selectorRegion/composables/selectRegion.ts","../../src/components/project/selectorRegion/composables/compare.ts","../../src/components/project/selectorRegion/composables/selectorRegion.ts","../../src/components/project/selectorRegion/selectorRegion.vue","../../src/components/project/tagSelector/tagsDefaults.ts","../../src/components/project/tagSelector/utils/utils.ts","../../src/components/project/tagSelector/popupListItem/tagPopupListItem.vue","../../src/components/project/tagSelector/popupOpener/popupOpener.vue","../../src/components/project/tagSelector/tagSelector.vue","../../src/components/project/tagSelector/utils/el.ts","../../src/components/project/project.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { Props } from './selectorCompetitors';\nimport Core from '@/core/core/core';\nimport Button from '@/components/forms/button/button.vue';\nimport Popup from '@/components/popup/popup/popup.vue';\nimport ListItem from '@/components/popup/popup/listItem.vue';\nimport Menu from '@/components/formsExt/menu/menu.vue';\nimport { useI18n } from '@/core/plugins/i18n';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowSelectAllItem: true,\n});\nconst model = defineModel<Props['modelValue']>();\n\nconst selectAllItem = computed(() => {\n\tif (props.showSelectAllItem) {\n\t\treturn {\n\t\t\ticon: '',\n\t\t\ttitle: useI18n().Common.Select_all,\n\t\t\tvalue: 'all',\n\t\t\tcontent: '',\n\t\t};\n\t}\n});\n</script>\n\n<template>\n\t<div class=\"top-selectorCompetitors\">\n\t\t<Popup v-if=\"Core.state.isMobile\">\n\t\t\t<template #opener>\n\t\t\t\t<Button\n\t\t\t\t\tclass=\"top-selectorCompetitors_opener\"\n\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\ticon=\"\"\n\t\t\t\t\ticon2=\"\"\n\t\t\t\t>\n\t\t\t\t\t{{ items.find((item) => item.value === model?.[0])?.content }}\n\t\t\t\t</Button>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<ListItem\n\t\t\t\t\tv-for=\"(item, index) in items\"\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'top-active': model?.includes(item.value)\n\t\t\t\t\t}\"\n\t\t\t\t\t:data-top-icon=\"item.icon\"\n\t\t\t\t\t:title=\"item.title\"\n\t\t\t\t\t@click=\"() => model = [item.value]\"\n\t\t\t\t>\n\t\t\t\t\t<span class=\"top-ellipsis1\">\n\t\t\t\t\t\t{{ item.content }}\n\t\t\t\t\t</span>\n\t\t\t\t</ListItem>\n\t\t\t</template>\n\t\t</Popup>\n\n\t\t<Menu\n\t\t\tv-else\n\t\t\tv-model=\"model\"\n\t\t\t:items=\"items\"\n\t\t\t:isMultiple=\"true\"\n\t\t\tstyling=\"bar\"\n\t\t\t:canBeEmptyMultiple=\"false\"\n\t\t\t:selectAllItem=\"selectAllItem\"\n\t\t/>\n\t</div>\n</template>\n\n<style>\n.top-selectorCompetitors_opener.top-button {\n\twidth: 100%;\n}\n</style>\n","import type { Region, SearcherIndexed } from '../selectorRegion';\nimport { useI18n } from '@/core/plugins/i18n';\n\nexport const dummyIndex = -2;\n\nexport const searchersNames = {\n\t0: 'Yandex',\n\t1: 'Google',\n\t2: 'go.Mail',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t6: 'Yahoo',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GoogleStore',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n};\n\nexport const regionUndefined: Region = {\n\tkey: dummyIndex,\n\tname: '--',\n\tindex: dummyIndex,\n};\n\nexport const searcherUndefined: SearcherIndexed = {\n\tkey: dummyIndex,\n\tname: '--',\n\tregions: [regionUndefined],\n\tregionByIndex: new Map([[dummyIndex, regionUndefined]]),\n};\n\nconst regionAuto: Region = {\n\tkey: dummyIndex,\n\tname: 'Autoselect',\n\tindex: dummyIndex,\n};\n\nconst searcherAuto: SearcherIndexed = {\n\tkey: dummyIndex,\n\tname: 'Autoselect',\n\tregions: [regionAuto],\n\tregionByIndex: new Map([[dummyIndex, regionAuto]]),\n};\n\nconst regionGlobal: Region = {\n\tcountryCode: '00',\n\tdepth: 1,\n\tdevice: 0,\n\tkey: -1,\n\tindex: -1,\n\tlang: 'ru',\n\tname: 'Without region',\n};\n\nexport const getRegionAuto = () => {\n\tregionAuto.name = useI18n().Common.Autoselect!;\n\n\treturn regionAuto;\n};\n\nexport const getSearcherAuto = () => {\n\tgetRegionAuto();\n\n\tsearcherAuto.name = useI18n().Common.Autoselect!;\n\tconsole.log(searcherAuto);\n\n\treturn searcherAuto;\n};\n\nexport const getRegionGlobal = () => {\n\tregionGlobal.name = useI18n().Keywords.Without_region!;\n\n\treturn regionGlobal;\n};\n","import type { Region, Searcher, SearcherByKey, SearcherIndexed } from '../selectorRegion';\nimport { dummyIndex, getRegionGlobal, getSearcherAuto, regionUndefined, searchersNames, searcherUndefined } from './consts';\n\n/**\n * Генерация Map ПС с Map регионов из массива searchers\n * - ключ для ПС - searcherKey\n * - ключ для региона - regionIndex\n *\n * Если поисковиков в списке нет, в список будет добавлен searcherUndefined\n *\n * Если регионов в списке нет, в список будет добавлен regionUndefined\n *\n * @param forFrequency - получить массив для просмотра частоты (или ставок)\n * @param autoRegion - добавить элемент с ключем -2, который в API заменяется на нужный ключ в зависимости от контекста\n * @param searchers - поисковики с регионами проекта, см.: get/projects_2/projects, show_searchers_and_regions = 1\n */\nexport const genSearcherByKey = (\n\tforFrequency: boolean = false,\n\tautoRegion: boolean = false,\n\tsearchers: Searcher[] = [],\n) => {\n\tlet searcherByKey: SearcherByKey;\n\n\tif (forFrequency) {\n\t\tsearcherByKey = genSearchersMapVolume(searchers);\n\t} else {\n\t\tsearcherByKey = genSearchersMapCommon(searchers);\n\t}\n\n\tif (autoRegion) searcherByKey.set(dummyIndex, getSearcherAuto());\n\tif (!searcherByKey.size) searcherByKey.set(dummyIndex, searcherUndefined);\n\n\treturn searcherByKey;\n};\n\n/**\n * Список ПС с регионами\n *\n * @param searchers\n * @param onlyEnabledRegions\n * @param forceSearchersKeys - ключи ПС, которые нееобходимо вывести в любом случае\n * @param forFrequency - для частоты будут выводиться только Яндекс, Google и Mail\n */\nconst genSearchersMapCommon = (\n\tsearchers: Searcher[],\n\tonlyEnabledRegions: boolean = true,\n\tforceSearchersKeys: Searcher['key'][] = [],\n\tforFrequency: boolean = false,\n) => {\n\tconst searcherByKey: Map<Searcher['key'], SearcherIndexed> = new Map();\n\n\t// настроенные ПС\n\tsearchers.forEach((searcher) => {\n\t\tif (!searcher.enabled) return;\n\t\tif (forFrequency && typeof searcher.key === 'number' && searcher.key > 1) return;\n\n\t\tconst searcherI = { ...searcher } as SearcherIndexed;\n\t\tsearcherI.regionByIndex = new Map();\n\n\t\tif (searcher.regions) {\n\t\t\tsearcher.regions.forEach((region: Region) => {\n\t\t\t\tif (onlyEnabledRegions && !region.enabled) return;\n\n\t\t\t\tconst regionI = { ...region };\n\t\t\t\tif (searcherI.regionByIndex) searcherI.regionByIndex.set(regionI.index, regionI);\n\t\t\t});\n\t\t}\n\n\t\tif (!searcherI.regionByIndex.size && !forceSearchersKeys.length) {\n\t\t\tsearcherI.regionByIndex.set(regionUndefined.index, regionUndefined);\n\t\t}\n\n\t\tif (typeof searcherI.key === 'number') searcherByKey.set(searcherI.key, searcherI);\n\t});\n\n\t// дополнительные ПС\n\tforceSearchersKeys.forEach((searcherKey) => {\n\t\tif (searcherByKey.has(searcherKey)) return;\n\n\t\tconst searcherI: SearcherIndexed = {\n\t\t\tkey: searcherKey,\n\t\t\tname: searchersNames[searcherKey],\n\t\t\tregions: [],\n\t\t\tregionByIndex: new Map(),\n\t\t};\n\n\t\tsearcherByKey.set(searcherI.key, searcherI);\n\t});\n\n\treturn searcherByKey;\n};\n\n/**\n * Список ПС с регионами для проверки частоты (Яндекс, Google, Mail если добавлен в проект)\n *\n * @param searchers\n */\nconst genSearchersMapVolume = (searchers: Searcher[]) => {\n\tconst serarcherByKey = genSearchersMapCommon(searchers, false, [0, 1], true);\n\n\t// в Mail нет регионов\n\tif (serarcherByKey.has(2)) {\n\t\tconst searcherMail = serarcherByKey.get(2);\n\t\tif (searcherMail) searcherMail.regionByIndex = new Map();\n\t}\n\n\t// добавление глобального региона\n\tserarcherByKey.forEach((searcher) => {\n\t\tif (!searcher.regionByIndex) return;\n\n\t\tconst region = { ...getRegionGlobal() };\n\t\tsearcher.regionByIndex.set(region.index, region);\n\t});\n\n\treturn serarcherByKey;\n};\n\n/**\n * Поиск региона по заданному критерию из списка поисковиков проекта\n *\n * @param forFrequency - поиск региона для просмотра частоты или ставок\n * @param searchRegion - объект с параметрами региона, который следует найти\n * @param searchers\n */\nexport const findRegion = (forFrequency: boolean, searchRegion: Region, searchers: Searcher[] = []) => {\n\tconst searcherByKey = genSearcherByKey(forFrequency, false, searchers);\n\n\tlet findedRegion: Region | undefined;\n\n\t// поиск ПС\n\tsearcherByKey.forEach((searcher) => {\n\t\tif (searchRegion.searcher_key !== undefined && searchRegion.searcher_key != searcher.key) return;\n\t\tif (!searcher.regions) return;\n\n\t\t// поиск региона\n\t\tsearcher.regions.forEach((region) => {\n\t\t\tif (findedRegion) return;\n\n\t\t\tif (searchRegion.key !== undefined && searchRegion.key != region.key) return;\n\t\t\tif (searchRegion.index !== undefined && searchRegion.index != region.index) return;\n\n\t\t\tif (!forFrequency) {\n\t\t\t\tif (searchRegion.lang !== undefined && searchRegion.lang != region.lang) return;\n\t\t\t\tif (searchRegion.device !== undefined && searchRegion.device != region.device) return;\n\t\t\t}\n\n\t\t\tregion.searcher_key = searcher.key;\n\t\t\tfindedRegion = region;\n\n\t\t\treturn false;\n\t\t});\n\n\t\tif (findedRegion) return false;\n\t});\n\n\treturn findedRegion;\n};\n","import { computed, type ComputedRef, ref } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport type { Props, SearcherByKey } from '../selectorRegion';\nimport type { Option, Options } from '@/components/forms/select/select';\nimport { dummyIndex } from '../utils/consts';\nimport { getSearcherGIcon } from '@/core/utils/searchers';\n\n/**\n * Создание и управление реактивными переменными для выбора ПС\n *\n * @param props - входные props компонента\n * @param mapSearchers - Map ПС (реактивная)\n */\nexport const useSelectSearcher = (\n\tprops: Props,\n\tmapSearchers: ComputedRef<SearcherByKey>,\n) => {\n\tconst i18n = useI18n();\n\n\t/**\n\t * Ключ выбранной поисковой системы\n\t */\n\tconst searcherKey = ref(mapSearchers.value.keys().next().value ?? dummyIndex);\n\n\t/**\n\t * Коллекция опций для выбора ПС\n\t */\n\tconst optionBySearcherKey = computed(() => {\n\t\tconst res: Options = new Map();\n\t\tmapSearchers.value.forEach((searcher) => {\n\t\t\tlet option: Option = {\n\t\t\t\tvalue: searcher.key,\n\t\t\t\ttitle: searcher.name,\n\t\t\t};\n\n\t\t\tif (props.addSearcherIcon) option.icon = getSearcherGIcon(searcher.key);\n\n\t\t\tres.set(searcher.key, option);\n\t\t});\n\n\t\t// добавить режим сравнения, если есть хотя бы одна ПС\n\t\tif (props.addCompare && !res.has(dummyIndex)) {\n\t\t\tconst dummyOption: Option = {\n\t\t\t\tvalue: '',\n\t\t\t\ttitle: '--------------------',\n\t\t\t\tdisabled: true,\n\t\t\t};\n\t\t\tres.set(dummyOption.value, dummyOption);\n\n\t\t\tconst compareOption: Option = {\n\t\t\t\tvalue: -1,\n\t\t\t\ttitle: i18n.Common.Compare!,\n\t\t\t};\n\t\t\tres.set(compareOption.value, compareOption);\n\t\t}\n\n\t\treturn res;\n\t});\n\n\treturn {\n\t\tsearcherKey,\n\t\toptionBySearcherKey,\n\t};\n};\n","import { computed, type ComputedRef, ref, watch } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { getDeviceGIcon, getLangLabel } from '@/core/utils/searchers';\nimport type { Option } from '@/components/forms/select/select';\nimport { dummyIndex } from '../utils/consts';\nimport type { Props, Region, SearcherIndexed } from '../selectorRegion';\n\n/**\n * Создание и управление реактивными переменными для выбора региона\n *\n * @param props - входные props компонента\n * @param activeSearcherIndexed - объект активной поисковой системы (реактивная)\n * @param regionsIndexes - входные индексы регионов/ПС\n */\nexport const useSelectRegion = (props: Props, activeSearcherIndexed: ComputedRef<SearcherIndexed>) => {\n\tconst i18n = useI18n();\n\n\t/**\n\t * Индекс выбранного региона\n\t */\n\tconst regionIndex = ref(dummyIndex);\n\n\tif (props.modelValue.length === 1) {\n\t\tregionIndex.value = props.modelValue[0];\n\t}\n\n\tif (regionIndex.value === dummyIndex) {\n\t\tif (props.forFrequency) {\n\t\t\t// в качетсве ключа используется region.key, а не region.index\n\t\t\tregionIndex.value = activeSearcherIndexed.value?.regionByIndex.values().next().value?.key ?? dummyIndex;\n\t\t} else {\n\t\t\tregionIndex.value = activeSearcherIndexed.value?.regionByIndex.keys().next().value ?? dummyIndex;\n\t\t}\n\t}\n\n\t/**\n\t * Коллекция опций для выбора региона\n\t */\n\tconst optionByRegionIndex = computed(() => {\n\t\tconst options = new Map<number, Option>();\n\n\t\tactiveSearcherIndexed.value.regionByIndex?.forEach((region) => {\n\t\t\tlet regionLabel = region.name;\n\n\t\t\t// на частоту в текущей версии устройство и язык не влияют\n\t\t\t// обратите внимание, в качетсве ключа используется region.key, а не region.index\n\t\t\tif (props.forFrequency) {\n\t\t\t\tconst option: Option = {\n\t\t\t\t\tvalue: region.key,\n\t\t\t\t\ttitle: regionLabel,\n\t\t\t\t};\n\t\t\t\tif (!options.has(region.key)) options.set(region.key, option);\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (region.device) {\n\t\t\t\tregionLabel += ' (' + i18n.Common['Device_' + region.device] + ')';\n\t\t\t}\n\n\t\t\tconst langLabel = getLangLabel(activeSearcherIndexed.value.key || 0, region.lang ?? '');\n\t\t\tif (langLabel) regionLabel += ' / ' + langLabel;\n\n\t\t\tconst option: Option = {\n\t\t\t\tvalue: region.index,\n\t\t\t\ttitle: regionLabel,\n\t\t\t\ticon: region.device ? getDeviceGIcon(region.device) : undefined,\n\t\t\t};\n\n\t\t\toptions.set(region.index, option);\n\t\t});\n\n\t\treturn options;\n\t});\n\n\t/**\n\t * Выбор максимально похожего региона в новой коллекции регионов\n\t */\n\twatch(optionByRegionIndex, (optionByRegionIndex, oldOptionByRegionIndex) => {\n\t\tif (props.onlySearcher || regionIndex.value !== undefined && optionByRegionIndex.get(regionIndex.value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet newRegionIndex = optionByRegionIndex.keys().next().value as Region['index'];\n\t\tif (regionIndex.value === dummyIndex || newRegionIndex === dummyIndex) {\n\t\t\tregionIndex.value = newRegionIndex;\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet regionName = (oldOptionByRegionIndex?.get(regionIndex.value) as Option)?.title || '';\n\t\tlet regionMatchLevel = -1;\n\t\tfor (const [index, option] of optionByRegionIndex.entries()) {\n\t\t\tconst title = (option as Option).title;\n\n\t\t\tif (typeof title !== 'string' || typeof index === 'string') {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// полное совпадение\n\t\t\tif (title === regionName) {\n\t\t\t\tnewRegionIndex = index;\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst regexpDevice = new RegExp(` \\\\((${i18n.Common['Device_1']}|${i18n.Common['Device_2']})\\\\)`);\n\t\t\tlet regionNameCompare = regionName;\n\t\t\tlet regionMatchLevelI = 3;\n\n\t\t\t// без устройства\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/^[^a-zа-я]/i, '').replace(regexpDevice, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\t// без языка\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/ \\/.*/, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\t// без устройства и без языка\n\t\t\tif (title.indexOf(regionNameCompare) === -1) {\n\t\t\t\tregionNameCompare = regionName.replace(/ \\/.*/, '');\n\t\t\t\tregionNameCompare = regionNameCompare.replace(/^[^a-zа-я]/i, '').replace(regexpDevice, '');\n\n\t\t\t\tregionMatchLevelI--;\n\t\t\t}\n\n\t\t\tif (title.indexOf(regionNameCompare) === -1) continue;\n\t\t\tif (regionMatchLevelI <= regionMatchLevel) continue;\n\n\t\t\tregionMatchLevel = regionMatchLevelI;\n\t\t\tnewRegionIndex = index;\n\t\t}\n\n\t\tregionIndex.value = newRegionIndex;\n\t});\n\n\treturn {\n\t\tregionIndex,\n\t\toptionByRegionIndex,\n\t};\n};\n","import { type ComputedRef, ref, watch } from 'vue';\nimport type { Props, SearcherByKey } from '../selectorRegion';\n\n/**\n * Создание и управление реактивными переменными для сравнения\n *\n * @param props - входные props компонента\n * @param searcherByKey - Map ПС (реактивная)\n * @param allRegionsIndexes - Все доступные индексы регионов (реактивная)\n */\nexport const useCompare = (props: Props, searcherByKey: ComputedRef<SearcherByKey>, allRegionsIndexes: ComputedRef<Set<number>>) => {\n\t/**\n\t * Индексы регионов/ПС в сравнение\n\t */\n\tconst regionsIndexes = ref([] as number[]);\n\n\t/**\n\t * Загрузка индексов регионов для сравнения\n\t *\n\t * Если в modelValue передано несколько регионов, они будут установлены как выбранные для сравнения\n\t */\n\tconst compareLoad = () => {\n\t\tif (props.onlySearcher && searcherByKey.value) {\n\t\t\tregionsIndexes.value = Array.from(searcherByKey.value.keys());\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet regionsIndexesSaved: Props['modelValue'] = [];\n\n\t\tif (props.modelValue.length > 1) {\n\t\t\tregionsIndexesSaved = [...props.modelValue];\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t// загрузить индексы регионов, если они были сохранены\n\t\t\t\tregionsIndexesSaved = JSON.parse(\n\t\t\t\t\tlocalStorage.getItem('ui:project:regionSelector' + props.projectId + ':regionsIndexes') as string,\n\t\t\t\t) ?? [];\n\t\t\t} catch (e) {\n\n\t\t\t}\n\t\t}\n\n\t\t// убрать из сравнения регионы, которых нет в props.searchers\n\t\tif (regionsIndexesSaved.length) {\n\t\t\tregionsIndexesSaved = regionsIndexesSaved.filter((regionIndex) => {\n\t\t\t\treturn allRegionsIndexes.value.has(regionIndex);\n\t\t\t});\n\t\t}\n\n\t\t// если не сохранено ни одного региона, выбрать все регионы проекта\n\t\tif (!regionsIndexesSaved.length) {\n\t\t\tregionsIndexesSaved = Array.from(allRegionsIndexes.value);\n\t\t}\n\n\t\tregionsIndexes.value = [...regionsIndexesSaved];\n\t};\n\n\t/**\n\t * Сохранение выбранных регионов\n\t */\n\tconst compareSave = () => {\n\t\tif (regionsIndexes.value.length) {\n\t\t\tlocalStorage.setItem('ui:project:regionSelector:' + props.projectId + ':regionsIndexes', JSON.stringify(regionsIndexes.value));\n\t\t} else {\n\t\t\tlocalStorage.removeItem('ui:project:regionSelector:' + props.projectId + ':regionsIndexes');\n\t\t}\n\t};\n\n\twatch(regionsIndexes, () => {\n\t\tcompareSave();\n\t});\n\n\tif (props.addCompare) {\n\t\t// if (props.compareRegionsIndexes?.length) {\n\t\t// \tcompareRegionsIndexes.value = [...props.compareRegionsIndexes];\n\t\t// } else {\n\t\t// \tcompareLoad();\n\t\t// }\n\n\t\tcompareLoad();\n\t}\n\n\treturn {\n\t\tregionsIndexes,\n\t};\n};\n","import { computed, watch } from 'vue';\nimport { findRegion, genSearcherByKey } from '../utils/utils';\nimport { dummyIndex, searcherUndefined } from '../utils/consts';\nimport type { Props, Region, SearcherIndexed } from '../selectorRegion';\nimport { useSelectSearcher } from './selectSearcher';\nimport { useSelectRegion } from './selectRegion';\nimport { useCompare } from './compare';\n\n/**\n * Создание и управления рективными переменными компонента\n *\n * @param props - входные props компонента\n */\nexport const useSelectorRegion = (props: Props) => {\n\tconst searcherByKey = computed(() => {\n\t\treturn genSearcherByKey(props.forFrequency, props.autoRegion, props.searchers);\n\t});\n\n\tconst activeSearcherIndexed = computed(() => {\n\t\treturn searcherByKey.value.get(selectSearcher.searcherKey.value) || searcherUndefined;\n\t});\n\n\t/**\n\t * Все индексы регионов из mapSearchers\n\t */\n\tconst allRegionsIndexes = computed(() => {\n\t\tconst regionsIndexes = new Set<number>();\n\n\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\tsearcher.regions?.forEach((region) => {\n\t\t\t\tif (region.index === -1) return;\n\t\t\t\tif (region.index === dummyIndex) return;\n\n\t\t\t\tregionsIndexes.add(region.index);\n\t\t\t});\n\t\t});\n\n\t\treturn regionsIndexes;\n\t});\n\n\tconst selectSearcher = useSelectSearcher(props, searcherByKey);\n\tconst selectRegion = useSelectRegion(props, activeSearcherIndexed);\n\tconst compare = useCompare(props, searcherByKey, allRegionsIndexes);\n\n\t// контроль за внешним изменением списка ПС\n\twatch(searcherByKey, () => {\n\t\t// возможные значения для сравнения регионов/пс\n\t\tif (props.onlySearcher) {\n\t\t\tcompare.regionsIndexes.value = Array.from(searcherByKey.value.keys());\n\t\t} else {\n\t\t\tcompare.regionsIndexes.value = compare.regionsIndexes.value.filter(regionIndex => {\n\t\t\t\treturn allRegionsIndexes.value.has(regionIndex);\n\t\t\t});\n\t\t}\n\n\t\tif (selectSearcher.searcherKey.value === -1) return;\n\n\t\tlet newSearcherKey = searcherByKey.value.keys().next().value;\n\n\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\t// определить выбранную ПС\n\t\t\tif (props.onlySearcher && searcher.key === selectSearcher.searcherKey.value) {\n\t\t\t\tnewSearcherKey = selectSearcher.searcherKey.value;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tselectRegion.regionIndex.value &&\n\t\t\t\tsearcher.regionByIndex?.has(selectRegion.regionIndex.value)\n\t\t\t) {\n\t\t\t\tnewSearcherKey = searcher.key;\n\t\t\t}\n\n\t\t\t// выбрать первую ПС с выбранным регионом\n\t\t\tif (!props.onlySearcher) {\n\t\t\t\tlet regionsNewSearcher: SearcherIndexed['regionByIndex'] | undefined;\n\n\t\t\t\tif (newSearcherKey !== undefined) {\n\t\t\t\t\tregionsNewSearcher = searcherByKey.value.get(newSearcherKey)?.regionByIndex;\n\t\t\t\t}\n\n\t\t\t\tconst regionsCurrentSearcher = searcherByKey.value.get(searcher.key)?.regionByIndex;\n\t\t\t\tif (\n\t\t\t\t\tregionsNewSearcher?.has(dummyIndex) &&\n\t\t\t\t\t!regionsCurrentSearcher?.has(dummyIndex)\n\t\t\t\t) {\n\t\t\t\t\tnewSearcherKey = searcher.key;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// if (props.addCompare && !selectSearcher.optionBySearcherKey.value.has(dummyIndex)) {\n\t\t// \tif (!selectRegion.regionIndex.value && compare.regionsIndexes.value?.length) newSearcherKey = -1;\n\t\t// }\n\n\t\t// if (props.onlySearcher && selectRegion.regionIndex.value !== dummyIndex) newSearcherKey = selectRegion.regionIndex.value;\n\n\t\tif (newSearcherKey !== undefined) {\n\t\t\tselectSearcher.searcherKey.value = newSearcherKey;\n\t\t}\n\n\t\tif (\n\t\t\tselectRegion.regionIndex.value !== undefined &&\n\t\t\t!(activeSearcherIndexed.value?.regionByIndex)?.has(selectRegion.regionIndex.value)\n\t\t) {\n\t\t\tselectRegion.regionIndex.value = activeSearcherIndexed.value?.regions?.keys().next().value as number;\n\t\t}\n\t}, { immediate: true });\n\n\tconst getSearcherKey = () => {\n\t\tif (selectSearcher.searcherKey.value === -1 || selectSearcher.searcherKey.value === dummyIndex) return;\n\n\t\treturn selectSearcher.searcherKey.value;\n\t};\n\n\tconst getRegionIndex = () => {\n\t\tif (props.onlySearcher) return;\n\n\t\tif (selectRegion.regionIndex.value === dummyIndex) return;\n\n\t\tlet res: Region['index'] | undefined = selectRegion.regionIndex.value;\n\n\t\t// в качестве ключа используется region.key\n\t\tif (props.forFrequency) {\n\t\t\tconst regionKey = selectRegion.regionIndex.value;\n\t\t\tconst region = findRegion(props.forFrequency, { searcher_key: getSearcherKey(), key: regionKey } as Region, props.searchers);\n\n\t\t\tres = region?.index;\n\t\t}\n\n\t\treturn res;\n\t};\n\n\t/**\n\t * Получить выбранную ПС\n\t */\n\tconst getSearcher = () => {\n\t\tconst searcherKey = getSearcherKey();\n\t\tif (searcherKey === undefined) return;\n\n\t\treturn searcherByKey.value.get(searcherKey);\n\t};\n\n\t/**\n\t * Получить выбранный регион\n\t */\n\tconst getRegion = () => {\n\t\tconst regionIndex = getRegionIndex();\n\t\tif (regionIndex === undefined) return;\n\n\t\treturn getSearcher()?.regionByIndex?.get(regionIndex);\n\t};\n\n\treturn {\n\t\tselectSearcher,\n\t\tselectRegion,\n\t\tcompare,\n\n\t\tsearcherByKey,\n\t\tallRegionsIndexes,\n\n\t\tgetSearcher,\n\t\tgetRegion,\n\t};\n};\n","<script setup lang=\"ts\">\nimport { watch } from 'vue';\nimport type { Emits, Props, Region } from './selectorRegion';\nimport Select from '@/components/forms/select/select.vue';\nimport Button from '@/components/forms/button/button.vue';\nimport { useSelectorRegion } from './composables/selectorRegion';\nimport { dummyIndex } from './utils/consts';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsearchers: () => [],\n\t// compareRegionsIndexes: () => [],\n\taddSearcherIcon: true,\n\taddRegionIcon: true,\n\taddChanger: true,\n});\n\nconst model = defineModel<Props['modelValue']>({ required: true });\nconst modelSingle = defineModel<Props['modelValueSingle']>('modelValueSingle');\n\nconst emit = defineEmits<Emits>();\n\nconst {\n\tselectSearcher,\n\tselectRegion,\n\tcompare,\n\n\tsearcherByKey,\n\tallRegionsIndexes,\n\n\tgetSearcher,\n\tgetRegion,\n} = useSelectorRegion(props);\n\nconst onClickCompare = () => {\n\t// ### TODO: сделать выбор регионов через UI (сейчас в UI выбор региона не работает)\n\tif (window['fieldTemplates'] && window['fieldTemplates']?.openSelectorRegions) {\n\t\twindow['fieldTemplates'].openSelectorRegions(\n\t\t\tsearcherByKey.value,\n\t\t\tcompare.regionsIndexes.value,\n\t\t\t(regionsIndexes: Region['index'][]) => compare.regionsIndexes.value = regionsIndexes,\n\t\t);\n\t\treturn;\n\t}\n\n\temit('compareRegions', searcherByKey.value);\n};\n\nwatch([selectRegion.regionIndex, selectSearcher.searcherKey, compare.regionsIndexes], () => {\n\tif (selectSearcher.searcherKey.value === -1 && compare.regionsIndexes.value.length) {\n\t\tif (JSON.stringify(model.value) === JSON.stringify(compare.regionsIndexes.value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tmodel.value = [...compare.regionsIndexes.value];\n\t} else {\n\t\tmodel.value = [props.onlySearcher ? selectSearcher.searcherKey.value : selectRegion.regionIndex.value];\n\t}\n\n\t// регионов нет\n\tif (!props.onlySearcher && !allRegionsIndexes.value.size) {\n\t\tselectSearcher.searcherKey.value = dummyIndex;\n\t}\n});\n\nif (modelSingle.value) {\n\twatch(modelSingle, () => {\n\t\tmodel.value = [modelSingle.value!];\n\t}, { immediate: true });\n}\n\nwatch(model, () => {\n\tif (model.value[0]) {\n\t\tmodelSingle.value = model.value[0];\n\t}\n\n\t// проверка входных данных v-model на корректность\n\tif (props.onlySearcher) {\n\t\tif (\n\t\t\t!model.value.length ||\n\t\t\tmodel.value.length === 1 && !searcherByKey.value.has(model.value[0])\n\t\t) {\n\t\t\tlet defaultKey: number | undefined = searcherByKey.value.keys().next().value;\n\n\t\t\tif (defaultKey !== undefined) {\n\t\t\t\tmodel.value = [defaultKey];\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tmodel.value.length > 1 &&\n\t\t\tJSON.stringify(model.value) !== JSON.stringify(compare.regionsIndexes.value)\n\t\t) {\n\t\t\tmodel.value = [...compare.regionsIndexes.value];\n\n\t\t\treturn;\n\t\t}\n\t} else {\n\t\tlet newModel = [...new Set(model.value)];\n\n\t\tlet defaultIndex = searcherByKey.value.values().next().value?.regionByIndex?.keys().next().value;\n\t\tif (props.forFrequency) {\n\t\t\tdefaultIndex = searcherByKey.value.values().next().value?.regionByIndex?.values().next().value?.key;\n\t\t}\n\n\t\tif (!newModel.length) {\n\t\t\tif (defaultIndex !== undefined) {\n\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t}\n\t\t} else if (newModel.length === 1) {\n\t\t\tlet all = allRegionsIndexes.value;\n\n\t\t\tif (props.forFrequency) {\n\t\t\t\tall = new Set();\n\t\t\t\tsearcherByKey.value.forEach((searcher) => {\n\t\t\t\t\tsearcher.regionByIndex.forEach((region) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\t\t\t\t\t\tif (region.index === dummyIndex) return;\n\n\t\t\t\t\t\tall.add(region.key);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!all.has(newModel[0]) && newModel[0] !== -2) {\n\t\t\t\tnewModel = [];\n\t\t\t\tif (defaultIndex !== undefined) {\n\t\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tnewModel = newModel.filter(index => allRegionsIndexes.value.has(index));\n\t\t\tif (!newModel.length && defaultIndex !== undefined) {\n\t\t\t\tnewModel.push(defaultIndex);\n\t\t\t}\n\t\t}\n\n\t\tif (JSON.stringify(model.value) !== JSON.stringify(newModel)) {\n\t\t\tmodel.value = newModel;\n\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// входные данные v-model совпадают с внутренними значениями\n\tif (\n\t\tmodel.value.length === 1 &&\n\t\tmodel.value[0] === (props.onlySearcher ? selectSearcher.searcherKey.value : selectRegion.regionIndex.value)\n\t) {\n\t\treturn;\n\t}\n\n\t// if (\n\t// \tmodel.value.length > 1 &&\n\t// \tselectorSearcher.searcherKey.value === -1 &&\n\t// \tJSON.stringify(model.value) === JSON.stringify(selectorCompare.regionsIndexes.value)\n\t// ) {\n\t// \treturn;\n\t// }\n\n\t// обновление regionIndex, searcherKey, selectorCompare.regionsIndexes\n\tif (props.onlySearcher) {\n\t\t// if (!model.value.length) {\n\t\t// \tselectorSearcher.searcherKey.value = dummyIndex;\n\t\t//\n\t\t// \treturn;\n\t\t// }\n\n\t\tif (model.value.length === 1) {\n\t\t\tselectSearcher.searcherKey.value = model.value[0];\n\n\t\t\treturn;\n\t\t}\n\n\t\tselectSearcher.searcherKey.value = -1;\n\n\t\treturn;\n\t} else {\n\t\t// if (!model.value.length) {\n\t\t// \tselectorSearcher.searcherKey.value = dummyIndex;\n\t\t// \tselectorRegion.regionIndex.value = dummyIndex;\n\t\t//\n\t\t// \treturn;\n\t\t// }\n\n\t\tif (model.value.length === 1 && selectSearcher.searcherKey.value !== -1) {\n\t\t\tselectRegion.regionIndex.value = model.value[0];\n\n\t\t\tlet newSearherKey: number | undefined;\n\t\t\tfor (const searcher of searcherByKey.value.values()) {\n\t\t\t\tfor (const region of searcher.regionByIndex.values()) {\n\t\t\t\t\tconst currentRegionIndex = props.forFrequency ? region.key : region.index;\n\t\t\t\t\tif (currentRegionIndex === selectRegion.regionIndex.value) {\n\t\t\t\t\t\tnewSearherKey = searcher.key;\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (newSearherKey !== undefined) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newSearherKey !== undefined) {\n\t\t\t\tselectSearcher.searcherKey.value = newSearherKey;\n\t\t\t}\n\t\t} else {\n\t\t\tselectSearcher.searcherKey.value = -1;\n\t\t\tcompare.regionsIndexes.value = [...model.value];\n\t\t}\n\t}\n}, { immediate: true });\n\ndefineExpose({\n\tgetSearcher,\n\tgetRegion,\n});\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-selectorRegion': true,\n\t\t\t'top-selectorRegion-onlySearcher': onlySearcher,\n\t\t}\"\n\t>\n\t\t<Select\n\t\t\t:options=\"selectSearcher.optionBySearcherKey.value\"\n\t\t\tv-model=\"selectSearcher.searcherKey.value\"\n\t\t\tname=\"searcher_key\"\n\t\t\t:addChanger=\"addChanger\"\n\t\t/>\n\n\t\t<Select\n\t\t\tv-if=\"!onlySearcher && selectSearcher.searcherKey.value !== -1\"\n\t\t\tclass=\"top-select-region\"\n\t\t\t:options=\"selectRegion.optionByRegionIndex.value\"\n\t\t\tv-model=\"selectRegion.regionIndex.value\"\n\t\t\t:name=\"forFrequency ? 'region_key' : 'region_index'\"\n\t\t\t:addChanger=\"addChanger\"\n\t\t\t:data-top-icon=\"addRegionIcon ? '' : undefined\"\n\t\t/>\n\n\t\t<Button\n\t\t\tv-if=\"addCompare && !onlySearcher && selectSearcher.searcherKey.value === -1\"\n\t\t\tname=\"compare\"\n\t\t\t@click=\"onClickCompare\"\n\t\t\t:data-count-compare-regions-indexes=\"compare.regionsIndexes.value.length\"\n\t\t>\n\t\t\t{{ $i18n.Common.Selected_regions }}\n\t\t</Button>\n\t</div>\n</template>\n\n<style>\n@import \"./styles/searcherColors.css\";\n\n.top-selectorRegion {\n\twidth: 320px;\n\tdisplay: inline-flex;\n\tvertical-align: middle;\n}\n\n.top-selectorRegion > .top-select {\n\tflex-grow: 1;\n}\n\n.top-selectorRegion > .top-select:focus-within {\n\tz-index: 4;\n}\n\n.top-selectorRegion > .top-select > .top-select_select:hover,\n.top-selectorRegion > .top-select > .top-select_select.top-error {\n\tz-index: 1;\n}\n\n.top-selectorRegion > .top-select-searcher_key {\n\twidth: 120px;\n\tmax-width: 140px;\n\tmargin-right: -1px;\n}\n\n.top-selectorRegion > .top-select-region > select {\n\tborder-top-left-radius: 0;\n\tborder-bottom-left-radius: 0;\n}\n\n.top-selectorRegion > .top-select-region {\n\t--top-icon-size: 20px;\n\t--top-icon-color: var(--color-text-primary-1);\n\n\t--top-icon2-size: 20px;\n\t--top-icon2-color: var(--color-text-primary-1);\n}\n\n.top-selectorRegion > .top-select-region[data-top-icon][data-top-icon2] {\n\t--top-icon2-size: 16px;\n}\n\n.top-selectorRegion > .top-select-region[data-top-icon][data-top-icon2]:after {\n\ttext-indent: -4px;\n}\n\n.top-selectorRegion > [name=\"compare\"] {\n\tborder-top-left-radius: 0;\n\tborder-bottom-left-radius: 0;\n\tflex-grow: 1;\n}\n\n.top-selectorRegion > [name=\"compare\"]:after {\n\tcontent: \"(\" attr(data-count-compare-regions-indexes) \")\";\n\tmargin: 0 0 0 6px;\n}\n\n.top-selectorRegion:not(.top-selectorRegion-onlySearcher) > .top-select-searcher_key > select {\n\tborder-top-right-radius: 0;\n\tborder-bottom-right-radius: 0;\n\tmargin-right: 0;\n}\n\n.top-selectorRegion:not(.top-selectorRegion-onlySearcher) > .top-select-searcher_key[data-value=\"-1\"] > select {\n\tborder-right: none;\n}\n\n.top-selectorRegion-onlySearcher {\n\twidth: 120px;\n}\n</style>\n","import type { Tag } from './types';\n\nexport default [\n\t{\n\t\tid: '1',\n\t\tname: 'Without Tag',\n\t\tcolor_id: '1',\n\t},\n\t{\n\t\tid: '2',\n\t\tname: 'Red',\n\t\tcolor_id: '2',\n\t},\n\t{\n\t\tid: '3',\n\t\tname: 'Orange',\n\t\tcolor_id: '3',\n\t},\n\t{\n\t\tid: '4',\n\t\tname: 'Yellow',\n\t\tcolor_id: '4',\n\t},\n\t{\n\t\tid: '5',\n\t\tname: 'Blue',\n\t\tcolor_id: '5',\n\t},\n\t{\n\t\tid: '6',\n\t\tname: 'Purple',\n\t\tcolor_id: '6',\n\t},\n\t{\n\t\tid: '7',\n\t\tname: 'Green',\n\t\tcolor_id: '7',\n\t},\n\t{\n\t\tid: '8',\n\t\tname: 'Magenta',\n\t\tcolor_id: '8',\n\t},\n\t{\n\t\tid: '9',\n\t\tname: 'Dark blue',\n\t\tcolor_id: '9',\n\t},\n\t{\n\t\tid: '10',\n\t\tname: 'Turquoise',\n\t\tcolor_id: '10',\n\t},\n] as Tag[];\n","import type { Props as TagSelectorOpenerProps, TagSelectorTarget } from '../popupOpener/types';\nimport type { Tag, TagIdExclude } from '../types';\n\n/**\n * Полуичить значение исключения тега tagId\n */\nexport const genTagIdExcluded = (tagId: Tag['id']): TagIdExclude => {\n\treturn '-' + tagId as TagIdExclude;\n};\n\n/**\n * Вернуть чистый tagId без exclude флага\n */\nexport const genTagIdClear = (tagId: Tag['id'] | TagIdExclude) => {\n\tif (tagId[0] === '-') return tagId.substring(1) as Tag['id'];\n\n\treturn tagId as Tag['id'];\n};\n\n/**\n * Получить инфомрацию о теге по его id\n */\nexport const getTagById = (tagId: Tag['id'] | TagIdExclude, tags: TagSelectorOpenerProps['tags']) => {\n\ttagId = genTagIdClear(tagId);\n\n\tconst tag = tags.find(tag => tag.id === tagId);\n\tif (!tag) return;\n\n\treturn tag;\n};\n","<script setup lang=\"ts\">\nimport { nextTick, ref } from 'vue';\nimport type { Emits, Props } from './types';\nimport TopTagIcon from '../tagIcon/tagIcon.vue';\nimport TopPopupListItem from '@/components/popup/popup/listItem.vue';\n\nconst props = defineProps<Props>();\nconst emit = defineEmits<Emits>();\n\nconst name = defineModel<Props['name']>('name', {\n\trequired: true,\n});\n\nconst elName = ref<HTMLElement | null>(null);\n\n/**\n * Включен режим редактирвоания\n */\nconst inEdit = ref(false);\n\n/**\n * Включить режим редактирование\n */\nconst turnToEdit = async () => {\n\tinEdit.value = true;\n\n\tawait nextTick();\n\n\telName.value?.focus();\n};\n\n/**\n * Применить редактирование\n */\nconst editCommit = () => {\n\tconst name = elName.value?.innerText;\n\tif (!name) return editCancel();\n\n\tif (elName.value) elName.value.innerText = name;\n\n\tinEdit.value = false;\n\n\temit('update:name', name);\n};\n\n/**\n * Отменить редактирование\n */\nconst editCancel = async () => {\n\tif (elName.value) elName.value.innerText = props.name;\n\n\tinEdit.value = false;\n};\n\n/**\n * Применить выбор\n */\nconst changeSelect = (e: MouseEvent) => {\n\t// в режиме редактирования выбор не применяется\n\tif (inEdit.value) return;\n\n\t// тег запрещено выбирать\n\tif (props.disabled) return;\n\n\tlet toState: Props['state'] = 'selected';\n\n\tif (props.canExclude) {\n\t\tif (e.ctrlKey || e.metaKey) {\n\t\t\ttoState = 'excluded';\n\t\t}\n\t}\n\n\tif (props.state == toState) {\n\t\ttoState = '';\n\t}\n\n\tif (toState === '') emit('unselect');\n\tif (toState === 'selected') emit('select');\n\tif (toState === 'excluded') emit('exclude');\n};\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\t:class=\"{\n\t\t\t'top-tagSelector_tagListItem': true,\n\t\t\t'top-tagSelector_tagListItem-inEdit': inEdit,\n\t\t\t'top-tagSelector_tagListItem-disabled': disabled,\n\t\t\t'top-tagSelector_tagListItem-canExclude': canExclude,\n\t\t\t'top-tagSelector-active': !!state,\n\t\t\t'top-tagSelector-excluded': state === 'excluded'\n\t\t}\"\n\t\t@click.stop=\"changeSelect\"\n\t>\n\t\t<TopTagIcon\n\t\t\t:id\n\t\t\t:name\n\t\t\t:colorId\n\t\t\t:state\n\t\t/>\n\n\t\t<span\n\t\t\tref=\"elName\"\n\t\t\tclass=\"top-tagSelector_tagListItemName\"\n\t\t\t:contenteditable=\"inEdit ? 'plaintext-only' : false\"\n\t\t\t@keydown.enter.stop=\"editCommit\"\n\t\t\t@keydown.esc.stop=\"editCancel\"\n\t\t>\n\t\t\t{{ name }}\n\t\t</span>\n\n\t\t<template v-if=\"editable\">\n\t\t\t<span\n\t\t\t\tv-if=\"!inEdit\"\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\tclass=\"top-tagSelector_edit\"\n\t\t\t\t@click=\"turnToEdit\"\n\t\t\t></span>\n\n\t\t\t<span\n\t\t\t\tv-else\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\tclass=\"top-tagSelector_edit\"\n\t\t\t\t@click.stop=\"editCommit\"\n\t\t\t></span>\n\t\t</template>\n\t</TopPopupListItem>\n</template>\n\n<style>\n.top-tagSelector_tagListItem.top-popup_listItem {\n\tpadding-top: var(--top-padding-2) !important;\n\tpadding-bottom: var(--top-padding-2) !important;\n\tgap: 10px;\n}\n\n.top-tagSelector_tagListItemName {\n\tborder-radius: var(--top-radius-1);\n\twidth: 120px;\n\tpadding: 4px 2px;\n\tmargin: -4px -2px;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\tflex-grow: 1;\n}\n\n/* редактирование */\n.top-tagSelector_edit {\n\t--top-icon-size: 18px;\n\t--top-icon-color: var(--color-text-3);\n\n\twidth: 20px;\n\tflex-grow: 0;\n}\n\n.top-tagSelector_edit:before {\n\tline-height: 0;\n}\n\n.top-tagSelector_edit { opacity: 0; }\n.top-tagSelector_edit:hover {\n\t--top-icon-color: var(--color-text-primary);\n}\n\n.top-tagSelector_tagListItem:hover .top-tagSelector_edit,\n.top-tagSelector_tagListItem-inEdit .top-tagSelector_edit {\n\tcursor: pointer;\n\topacity: 1;\n}\n\n.top-tagSelector_tagListItem-inEdit {\n\tbackground: var(--color-layout-front-3) !important;\n\toutline: 1px dashed var(--color-line-2);\n\toutline-offset: -1px;\n}\n\n.top-tagSelector_tagListItem-inEdit .top-tagSelector_tagListItemName {\n\tcursor: text;\n\tbackground: var(--color-layout-front-1);\n}\n\n/* disabled */\n.top-tagSelector_tagListItem-disabled {\n\tcursor: not-allowed !important;\n\topacity: 0.85;\n}\n.top-tagSelector_tagListItem-disabled:hover {\n\tbackground: inherit;\n}\n.top-tagSelector_tagListItem-disabled [data-tag_id] {\n\topacity: 0.6;\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Props, TagSelectorTarget } from './types';\nimport TopPopupOpener from '../../../popup/popup/opener.vue';\nimport TopButton from '@/components/forms/button/button.vue';\nimport { genTagIdClear, getTagById } from '../utils/utils';\nimport TopTagIcon from '../tagIcon/tagIcon.vue';\n\ndefineOptions({\n\tinheritAttrs: false,\n});\n\nconst props = defineProps<Props>();\n\nconst model = defineModel<Props['modelValue']>({\n\trequired: true,\n});\n\nconst component = props.useTopButton ? TopButton : 'div';\nconst componentSlotName = props.useTopButton ? 'html' : 'default';\n\nconst topTagSelectorTarget: TagSelectorTarget = {\n\tmodel,\n\tmode: props.mode,\n\ttargetId: props.targetId,\n\tfilters: props.filters,\n\tpayload: props.payload,\n};\n</script>\n\n<template>\n\t<TopPopupOpener :id>\n\t\t<component\n\t\t\t:is=\"component\"\n\t\t\t:class=\"{\n\t\t\t\t'top-tagSelector': true,\n\t\t\t\t'top-tagSelector-filter': props.mode === 'filter',\n\t\t\t\t'top-tagSelector-setter_single': props.mode === 'setter' && !filters,\n\t\t\t\t'top-tagSelector-setter_several': props.mode === 'setter' && filters,\n\t\t\t\t'top-tagSelector-selectedOne': !model.length || model.length === 1,\n\t\t\t\t'top-tagSelector-toTwoLine': model.length > 5,\n\t\t\t}\"\n\t\t\tcolor=\"theme\"\n\t\t\tstyling=\"\"\n\t\t\tv-top-data:topTagSelectorTarget=\"topTagSelectorTarget\"\n\t\t\t:=$attrs\n\t\t>\n\t\t\t<template #[componentSlotName]>\n\t\t\t\t<TopTagIcon\n\t\t\t\t\tv-if=\"!model.length && mode === 'filter'\"\n\t\t\t\t\tid=\"all\"\n\t\t\t\t\tcolorId=\"\"\n\t\t\t\t\t:name=\"$i18n.Common.All_tags ?? ''\"\n\t\t\t\t\tstate=\"\"\n\t\t\t\t/>\n\n\t\t\t\t<!-- Массовое редактирование -->\n\t\t\t\t<div v-if=\"mode === 'setter' && filters\">\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<!-- Список тегов -->\n\t\t\t\t<TopTagIcon\n\t\t\t\t\tv-else\n\t\t\t\t\tv-for=\"tagId in model\"\n\t\t\t\t\t:id=\"genTagIdClear(tagId)\"\n\t\t\t\t\t:colorId=\"getTagById(tagId, tags)?.color_id ?? ''\"\n\t\t\t\t\t:name=\"getTagById(tagId, tags)?.name ?? ''\"\n\t\t\t\t\t:state=\"genTagIdClear(tagId) === tagId ? 'selected' : 'excluded'\"\n\t\t\t\t/>\n\t\t\t</template>\n\t\t</component>\n\t</TopPopupOpener>\n</template>\n\n<style>\n.top-tagSelector {\n\tcursor: pointer;\n\tmin-width: 0;\n\twhite-space: nowrap;\n\tjustify-content: left;\n}\n\n.top-tagSelector.top-button {\n\twidth: 112px;\n\tvertical-align: middle;\n}\n\n.top-tagSelector.top-button.top-select_arrow {\n\twidth: calc(112px + 20px);\n}\n\n.top-tagSelector-filter {\n\tgap: var(--top-gap-1);\n}\n\n/* все теги в фильтре */\n.top-tagSelector-filter [data-tag_id=\"all\"] {\n\tmargin-left: 0;\n}\n.top-tagSelector-filter [data-tag_id=\"all\"]:before {\n\tborder: none;\n\tmargin-left: 3px;\n\topacity: 0.5;\n}\n\n/* фильтр по одному тегу */\n.top-tagSelector-filter.top-tagSelector-selectedOne [data-tag_id]:after {\n\tcontent: attr(title);\n\tmargin-left: 20px;\n\tmin-width: 74px;\n\ttext-align: left;\n\tline-height: 1.2;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n}\n\n.top-tagSelector-filter.top-tagSelector-selectedOne [data-tag_id=\"all\"]:after {\n\tmargin-left: 0;\n}\n\n/* фильтр по многим тегам */\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine {\n\tflex-wrap: wrap;\n\talign-content: center;\n}\n\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine [data-tag_id] {\n\t--top-tag-selector-size: 8px;\n}\n\n.top-button.top-tagSelector-filter.top-tagSelector-toTwoLine [data-tag_id]:nth-child(5) {\n\tmargin-right: 5px;\n}\n\n/* установка тегов */\n.top-tagSelector-setter_single {\n\tposition: relative;\n\tdisplay: flex !important; flex-direction: column; flex-wrap: wrap; align-items: stretch !important;\n}\n\n.top-tagSelector-setter_single [data-tag_id] {\n\twidth: auto; min-height: 20%; min-width: 50%;\n\tflex: 1 1 auto;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, reactive, ref, shallowRef, watch } from 'vue';\n\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { storage } from '@/core/utils/dom';\nimport { debounce } from '@/core/utils/lodash';\n\nimport type { Option } from '@/components/forms/select/select';\nimport TopSelect from '@/components/forms/select/select.vue';\n\nimport TopButton from '@/components/forms/button/button.vue';\n\nimport type { PopupEvent } from '@/components/popup/popup/popup';\nimport TopPopup from '../../popup/popup/popup.vue';\nimport TopPopupListItem from '../../popup/popup/listItem.vue';\n\nimport type { Emits, FiltersAction, Props, Tag } from './types';\nimport tagsDefaults from './tagsDefaults';\nimport { genTagIdExcluded } from './utils/utils';\n\nimport type { Props as TagListItemProps } from './popupListItem/types';\nimport TopTagListItem from './popupListItem/tagPopupListItem.vue';\n\nimport type { TagSelectorTarget } from './popupOpener/types';\nimport TopTagSelectorPopupOpener from './popupOpener/popupOpener.vue';\n\nconst i18n = useI18n();\n\nconst props = withDefaults(defineProps<Props>(), {\n\ttagsMax: 10,\n\trequiredForSetter: true,\n\temitDelay: 500,\n});\n\n/**\n * Выбранные теги кнопки в этом компоненте\n *\n * Редактирвоание ведется только через `editTarget.model`\n */\nconst model = defineModel<Props['modelValue']>({\n\trequired: true,\n});\n\n/**\n * Список тегов\n */\nconst tags = defineModel<Tag[]>('tags', {\n\tdefault: reactive(tagsDefaults),\n});\n\nconst emit = defineEmits<Emits>();\n\nconst emitDebounce: typeof emit = debounce((name, e) => {\n\temit(name, e);\n}, props.emitDelay);\n\n// требуется сразу указать один тег\nif (props.singleMode && !model.value.length) {\n\tmodel.value = [tags.value[0].id];\n}\n\nconst id = props.id ?? 'top-popup-id-' + Math.random() + '';\n\nconst filtersAction = ref<FiltersAction>('add');\n\n/**\n * Сгенерировать опции для выбора дейсвтия массого редактирования\n */\nconst genFiltersActionOptions = () => {\n\tconst tagsText = ' ' + i18n.Common.Tags?.toLowerCase();\n\n\tconst res = new Map<FiltersAction, Option>();\n\tres.set('add', { value: 'add', title: i18n.Common.Add + tagsText });\n\tres.set('replace', { value: 'replace', title: i18n.Common.Replace + tagsText });\n\tres.set('delete', { value: 'delete', title: i18n.Common.Delete + tagsText });\n\n\treturn res;\n};\n\n/**\n * Целевой объект редактирвоания тегов\n *\n * Определяется кнопкой, которая открыла popup выбора тегов\n */\nlet target = shallowRef<TagSelectorTarget>({\n\tmodel,\n\tmode: 'filter',\n\ttargetId: undefined,\n\tfilters: undefined,\n\tpayload: undefined,\n});\n\nwatch(model, () => {\n\temitDebounce('selector', model.value);\n});\n\n/**\n * Можно ли выбрать еще теги\n */\nconst disabled = computed(() => {\n\tif (target.value.mode !== 'setter') return;\n\n\tif (!props.maxTagsForSetter) return;\n\n\t// массовая смена тегов, количество тегов в результате узнать невозможно\n\tif (target.value.filters) return;\n\n\treturn target.value.model.value.length >= props.maxTagsForSetter;\n});\n\nconst genTargetTagState = (tagId: Tag['id'] | 'all'): TagListItemProps['state'] => {\n\tif (tagId !== 'all') {\n\t\tif (target.value.model.value.includes(tagId)) return 'selected';\n\n\t\tif (target.value.model.value.includes(genTagIdExcluded(tagId))) return 'excluded';\n\t}\n\n\t// Все теги, ни один из тегов не выбран\n\tif (tagId === 'all' && !target.value.model.value.length) return 'selected';\n\n\treturn '';\n};\n\nconst updateTargetModel = (tagId: Tag['id'], action: 'unselect' | 'select' | 'exclude') => {\n\tconst tagIdExcluded = genTagIdExcluded(tagId);\n\n\tlet tagsIds = target.value.model.value.filter(modelTagId => modelTagId !== tagId && modelTagId !== tagIdExcluded);\n\n\tif (action === 'select') tagsIds.push(tagId);\n\tif (action === 'exclude') tagsIds.push(tagIdExcluded);\n\n\t// режим редактирвоания тегов одного объекта с требованием указать хотя бы один тег\n\tif (target.value.mode === 'setter' && target.value.targetId !== undefined && props.requiredForSetter) {\n\t\t// нельзя снимать выделение со всех тегов\n\t\tif (!tagsIds.length) {\n\t\t\ttagsIds.push('1');\n\t\t}\n\n\t\t// при первом выборе сразу снять тег \"Без тега\"\n\t\tif (tagsIds.length === 2 && target.value.model.value.length === 1 && target.value.model.value[0] === '1') {\n\t\t\ttagsIds = tagsIds.filter((tagId) => tagId !== '1');\n\t\t}\n\t}\n\n\t// режим выбора одного тега\n\tif (props.singleMode && !target.value.filters) {\n\t\t// нужно указать хотя бы один тег\n\t\tif (!tagsIds.length) {\n\t\t\ttagsIds = target.value.model.value;\n\t\t}\n\n\t\tif (tagsIds.length > 1) {\n\t\t\ttagsIds = [tagsIds[tagsIds.length - 1]];\n\t\t}\n\t}\n\n\t// всегда выводить теги в порядке, указанном в настройках tags\n\ttagsIds.sort((a, b) => {\n\t\tif (!props.tags) return 0;\n\n\t\tconst aIndex = props.tags.findIndex((tag) => tag.id === a);\n\t\tconst bIndex = props.tags.findIndex((tag) => tag.id === b);\n\n\t\treturn aIndex - bIndex;\n\t});\n\n\ttarget.value.model.value = tagsIds;\n\n\tif (target.value.mode === 'setter' && target.value.targetId !== undefined) {\n\t\temitDebounce('setter', {\n\t\t\ttagsIds: tagsIds as Tag['id'][],\n\t\t\ttargetId: target.value.targetId,\n\t\t\tpayload: target.value.payload,\n\t\t});\n\t}\n};\n\nconst classString = computed(() => {\n\tlet res = 'top-tagSelector_popup';\n\n\tif (target.value.mode === 'filter') res += ' top-tagSelector_popup-filter';\n\tif (target.value.mode === 'setter') res += ' top-tagSelector_popup-setter';\n\n\treturn res;\n});\n\n/**\n * Добавить тег\n */\nconst addTag = () => {\n\tconst tagName = prompt('', 'New tag');\n\tif (!tagName || tagName === 'New tag') return;\n\n\tconst tagId = tags.value.length + 1;\n\n\ttags.value.push({\n\t\tid: String(tagId) as Tag['id'],\n\t\tname: tagName,\n\t\tcolor_id: String((tagId - 1) % 10 + 1) as Tag['color_id'],\n\t});\n\n\temit('tagsChanged', tags.value);\n};\n\nconst onOpen = (popupEvent: PopupEvent) => {\n\t// popup открыт другой кнопкой c другим modelValue, для редактирвоания объектов\n\ttarget.value = storage(popupEvent.elPopupOpener, 'topTagSelectorTarget');\n\tif (!target.value) throw new Error('Open popup TopTagSelector required v-data:topTagSelectorTarget');\n\n\t// при начале массовой установки тегов сбросить состояние формы\n\tif (target.value.filters) {\n\t\tfiltersAction.value = 'add';\n\t\ttarget.value.model.value = [];\n\t}\n\n\tif (!Core.$?.ui['sortable']) {\n\t\tconsole.info('Для работы сортировки требуется глобальная загрузка jQuery UI Sortable');\n\n\t\treturn;\n\t}\n\n\tif (!Core.state.isMobile && !Core.state.isMobileUA && tags.value) {\n\t\t$(popupEvent.elPopup).sortable({\n\t\t\titems: 'li:has([data-tag_id]:not([data-tag_id=\"all\"]))',\n\t\t\tcancel: '[contenteditable=\"plaintext-only\"]',\n\t\t\tdistance: 10,\n\t\t\tstop: function (_e, ui) {\n\t\t\t\tif (!tags.value) return;\n\n\t\t\t\tconst $tags = $(ui.item).parent().find('[data-tag_id]');\n\n\t\t\t\tconst tagsSorted: Tag['id'][] = [];\n\t\t\t\t$tags.each((_index, elTag) => {\n\t\t\t\t\tif (!tags.value) return;\n\n\t\t\t\t\tconst tagId = $(elTag).attr('data-tag_id') as Tag['id'];\n\t\t\t\t\ttagsSorted.push(tagId);\n\t\t\t\t});\n\n\t\t\t\ttags.value.sort((tagIdA, tagIdB) => {\n\t\t\t\t\tconst a = tagsSorted.findIndex(tagSorted => tagSorted === tagIdA.id);\n\t\t\t\t\tconst b = tagsSorted.findIndex(tagSorted => tagSorted === tagIdB.id);\n\n\t\t\t\t\treturn a - b;\n\t\t\t\t});\n\n\t\t\t\temitDebounce('tagsChanged', tags.value);\n\t\t\t},\n\t\t});\n\t}\n};\n\nconst onClose = (popupEvent: PopupEvent) => {\n\tif (!Core.$?.ui['sortable']) return;\n\n\tif ($(popupEvent.elPopup).data('ui-sortable')) {\n\t\t$(popupEvent.elPopup).sortable('destroy');\n\t}\n};\n</script>\n\n<template>\n\t<TopTagSelectorPopupOpener\n\t\tclass=\"top-select_arrow\"\n\t\tv-model=\"model\"\n\t\t:id\n\t\t:tags\n\t\tmode=\"filter\"\n\t\tuseTopButton\n\t/>\n\n\t<TopPopup\n\t\t:id\n\t\t:class=\"classString\"\n\t\t@open=\"onOpen($event)\"\n\t\t@close=\"onClose($event)\"\n\t\t:transition-duration=\"50\"\n\t>\n\t\t<!-- Массовое редактирвоание-->\n\t\t<template #header v-if=\"target.mode === 'setter' && target.filters\">\n\t\t\t<TopSelect\n\t\t\t\tv-model=\"filtersAction\"\n\t\t\t\t:options=\"genFiltersActionOptions()\"\n\t\t\t/>\n\t\t</template>\n\n\t\t<template #footer v-if=\"target.mode === 'setter' && target.filters\">\n\t\t\t<TopButton color=\"theme\">\n\t\t\t\t{{ $i18n.Common.Cancel }}\n\t\t\t</TopButton>\n\n\t\t\t<TopButton\n\t\t\t\t@click=\"emitDebounce('setter', {\n\t\t\t\t\ttagsIds: target.model.value as Tag['id'][],\n\t\t\t\t\tfilters: target.filters,\n\t\t\t\t\tfiltersAction,\n\t\t\t\t\tpayload: target.payload,\n\t\t\t\t})\"\n\t\t\t>\n\t\t\t\t{{ filtersAction === 'add' ? $i18n.Common['Add'] : '' }}\n\t\t\t\t{{ filtersAction === 'replace' ? $i18n.Common['Replace'] : '' }}\n\t\t\t\t{{ filtersAction === 'delete' ? $i18n.Common['Remove'] : '' }}\n\t\t\t</TopButton>\n\t\t</template>\n\n\t\t<template #contentList>\n\t\t\t<TopTagListItem\n\t\t\t\tv-if=\"target.mode === 'filter' && !singleMode\"\n\t\t\t\tid=\"all\"\n\t\t\t\tcolorId=\"\"\n\t\t\t\t:name=\"$i18n.Common.All_tags ?? ''\"\n\t\t\t\t:state=\"target.model.value.length ? '' : 'selected'\"\n\t\t\t\t@select=\"target.model.value = []\"\n\t\t\t/>\n\n\t\t\t<TopTagListItem\n\t\t\t\tv-for=\"tag in tags\"\n\t\t\t\t:key=\"tag.id\"\n\t\t\t\t:id=\"tag.id\"\n\t\t\t\t:colorId=\"tag.color_id\"\n\t\t\t\t:name=\"tag.name\"\n\t\t\t\t:state=\"genTargetTagState(tag.id)\"\n\t\t\t\t:canExclude=\"target.mode === 'filter' && !singleMode\"\n\t\t\t\t:editable=\"tagsEditable\"\n\t\t\t\t:disabled=\"disabled && genTargetTagState(tag.id) === ''\"\n\t\t\t\t@unselect=\"updateTargetModel(tag.id, 'unselect')\"\n\t\t\t\t@select=\"updateTargetModel(tag.id, 'select')\"\n\t\t\t\t@exclude=\"updateTargetModel(tag.id, 'exclude')\"\n\t\t\t\t@update:name=\"tag.name = $event as string, emitDebounce('tagsChanged', tags);\"\n\t\t\t/>\n\n\t\t\t<TopPopupListItem\n\t\t\t\tv-if=\"tagsEditable && tags.length < tagsMax && tags.length < 20\"\n\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t@click.stop=\"addTag\"\n\t\t\t>\n\t\t\t\t{{ $i18n.Common.Add }}\n\t\t\t</TopPopupListItem>\n\t\t</template>\n\t</TopPopup>\n</template>\n\n<style>\n.top-tagSelector_popup .top-popup {\n\tuser-select: none;\n\tmin-width: 220px !important;\n\ttext-align: left;\n}\n\n.top-tagSelector_popup .top-popup_header .top-select{\n\tflex-grow: 1;\n}\n</style>\n","import { isRef, type Ref, ref, unref, watch } from 'vue';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { storage } from '@/core/utils/dom';\nimport TopPopupWorker from '@/components/popup/lib/worker';\nimport type { OpenerProps as PopupOpenerProps } from '@/components/popup/popup/popup';\nimport type { Props as TagSelectorOpenerProps, TagSelectorTarget } from '../popupOpener/types';\nimport type { Props as TagIconProps } from '../tagIcon/types';\nimport { genTagIdClear, getTagById } from '../utils/utils';\n\n/**\n * Сгенерировтаь элемент для открытия popup с выбором тегов\n *\n * Альтернатива TopTagSelecorPopupOpener для работы вне vue\n *\n * Требует монтирования компонента TopTagSelecor\n */\nexport const genElPopupOpener = (\n\tprops: TagSelectorOpenerProps & { modelValue: TagSelectorOpenerProps['modelValue'] | Ref<TagSelectorOpenerProps['modelValue']> },\n\tpropsPopup?: Partial<PopupOpenerProps>,\n\thtmlSetterSeveral?: string,\n): HTMLElement => {\n\tif (!propsPopup) propsPopup = { id: props.id };\n\n\tpropsPopup.id = props.id;\n\n\tconst el = TopPopupWorker.genElPopupOpener('div', propsPopup as PopupOpenerProps);\n\n\tel.classList.add('top-tagSelector');\n\tif (props.useTopButton) el.classList.add('top-button', 'top-color_theme');\n\tif (props.mode === 'filter') el.classList.add('top-tagSelector-filter');\n\tif (props.mode === 'setter' && !props.filters) el.classList.add('top-tagSelector-setter_single');\n\tif (props.mode === 'setter' && props.filters) el.classList.add('top-tagSelector-setter_several');\n\n\t// прокcи клик: lazy connect\n\tel.onclick = (e) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\n\t\tel.onclick = null;\n\n\t\tconst model = ref(props.modelValue);\n\n\t\tconst target: TagSelectorTarget = {\n\t\t\tmodel,\n\t\t\tmode: props.mode,\n\t\t\ttargetId: props.targetId,\n\t\t\tfilters: props.filters,\n\t\t\tpayload: props.payload,\n\t\t};\n\n\t\tstorage(el, 'topTagSelectorTarget', target);\n\n\t\tdelete el.dataset.topPopupDisabled;\n\n\t\tif (!isRef(props.modelValue)) {\n\t\t\twatch(model, () => {\n\t\t\t\tprops.modelValue = model.value;\n\n\t\t\t\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\t\t\t});\n\t\t}\n\n\t\t// выполнение клика\n\t\tel.click();\n\t};\n\n\tif (isRef(props.modelValue)) {\n\t\twatch(props.modelValue, () => elPopupOpenerRender(el, props, htmlSetterSeveral));\n\t} else {\n\t\tstorage(el, 'topTagSelectorRender', (modelValue: TagSelectorOpenerProps['modelValue']) => {\n\t\t\tprops.modelValue = modelValue;\n\n\t\t\tconst target = storage(el, 'topTagSelectorTarget');\n\t\t\tif (target) target.model.value = modelValue;\n\n\t\t\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\t\t});\n\t}\n\n\telPopupOpenerRender(el, props, htmlSetterSeveral);\n\n\treturn el;\n};\n\n/**\n * Вызвать перерисовку элемента, который был создан через genElPopupOpener()\n *\n * Работет только для элементов не с реактивным modelValue\n */\nexport const renderElPopupOpener = (el: HTMLElement, modelValue: TagSelectorOpenerProps['modelValue']) => {\n\tstorage(el, 'topTagSelectorRender')?.(modelValue);\n};\n\n/**\n * Отрисовать TopTagSelecorPopupOpener\n */\nconst elPopupOpenerRender = (el, props: TagSelectorOpenerProps, htmlSetterSeveral?: string) => {\n\tconst tagsIds = unref(props.modelValue);\n\n\tel.classList.toggle('top-tagSelector-selectedOne', !tagsIds.length || tagsIds.length === 1);\n\tel.classList.toggle('top-tagSelector-toTwoLine', tagsIds.length > 5);\n\n\tif (props.mode === 'setter' && props.filters) {\n\t\tel.innerHTML = `<div>${htmlSetterSeveral}</div>`;\n\n\t\treturn;\n\t}\n\n\tel.innerHTML = '';\n\n\tif (!tagsIds.length && props.mode === 'filter') {\n\t\tconst elTagIcon = genElTagIcon({\n\t\t\tid: 'all',\n\t\t\tcolorId: '',\n\t\t\tname: useI18n().Common?.All_tags ?? '',\n\t\t\tstate: '',\n\t\t});\n\n\t\tel.append(elTagIcon);\n\t}\n\n\ttagsIds.forEach(tagId => {\n\t\tconst elTagIcon = genElTagIcon({\n\t\t\tid: genTagIdClear(tagId),\n\t\t\tcolorId: getTagById(tagId, props.tags)?.color_id ?? '',\n\t\t\tname: getTagById(tagId, props.tags)?.name ?? '',\n\t\t\tstate: genTagIdClear(tagId) === tagId ? 'selected' : 'excluded',\n\t\t});\n\n\t\tel.append(elTagIcon);\n\t});\n};\n\n/**\n * Сгенерировтаь элемент для открытия popup с выбором тегов\n *\n * Альтернатива TopTagSelecorTagIcon для работы вне vue\n */\nconst genElTagIcon = (props: TagIconProps) => {\n\tconst el = document.createElement('div');\n\n\tel.classList.add('top-tagSelector_tagIcon');\n\tel.classList.toggle('top-tagSelector-active', !!props.state);\n\tel.classList.toggle('top-tagSelector-excluded', props.state === 'excluded');\n\n\tel.dataset.tag_id = props.id;\n\tel.dataset.tag_color_id = props.colorId;\n\tel.title = props.name;\n\n\treturn el;\n};\n","import type { ComponentCustomProps } from 'vue';\n\nimport SelectorCompetitors from './selectorCompetitors/selectorCompetitors.vue';\nimport SelectorRegion from './selectorRegion/selectorRegion.vue';\n\nimport TagSelector from './tagSelector/tagSelector.vue';\nimport TagSelectorPopupOpener from './tagSelector/popupOpener/popupOpener.vue';\nimport TagSelectorTagIcon from './tagSelector/tagIcon/tagIcon.vue';\n\nexport const TopSelectorCompetitors = SelectorCompetitors as typeof SelectorCompetitors & ComponentCustomProps;\n\nexport { findRegion, genSearcherByKey } from './selectorRegion/utils/utils';\nexport const TopSelectorRegion = SelectorRegion as typeof SelectorRegion & ComponentCustomProps;\n\nexport type { Emits as TopTagSelectorEmits, Tag, TagId, TagIdExclude } from './tagSelector/types';\nexport {\n\tgenElPopupOpener as genElTopTagSelectorPopupOpener,\n\trenderElPopupOpener as renderElTopTagSelectorPopupOpener,\n} from './tagSelector/utils/el';\nexport const TopTagSelector = TagSelector as typeof TagSelector & ComponentCustomProps;\nexport const TopTagSelectorPopupOpener = TagSelectorPopupOpener as typeof TagSelectorPopupOpener & ComponentCustomProps;\nexport const TopTagSelectorTagIcon = TagSelectorTagIcon as typeof TagSelectorTagIcon & ComponentCustomProps;\n"],"names":["props","__props","selectAllItem","vue","forms","dummyIndex","searchersNames","regionUndefined","searcherUndefined","regionAuto","searcherAuto","regionGlobal","genSearcherByKey","forFrequency","autoRegion","searchers","searcherByKey","genSearchersMapVolume","genSearchersMapCommon","getSearcherAuto","onlyEnabledRegions","forceSearchersKeys","searcher","searcherI","regionI","region","searcherKey","serarcherByKey","findRegion","searchRegion","findedRegion","useSelectSearcher","mapSearchers","i18n","optionBySearcherKey","res","option","utils_searchers","useSelectRegion","activeSearcherIndexed","regionIndex","_c","optionByRegionIndex","options","regionLabel","langLabel","newRegionIndex","optionByRegionIndex2","regionName","_a","oldOptionByRegionIndex","regionMatchLevel","index","title","regexpDevice","regionNameCompare","regionMatchLevelI","regionsIndexes","regionsIndexesSaved","useSelectorRegion","selectSearcher","allRegionsIndexes","compare","newSearcherKey","selectRegion","regionsNewSearcher","_b","regionsCurrentSearcher","_d","getSearcherKey","getSearcher","getRegionIndex","emit","__emit","getRegion","model","modelSingle","defaultKey","newModel","defaultIndex","all","newSearherKey","__expose","tagsDefaults","genTagIdExcluded","tagId","genTagIdClear","getTagById","tags","tag","tag2","elName","inEdit","name2","editCancel","changeSelect","e","toState","name","id","filtersAction","tagsText","target","disabled","genTargetTagState","updateTargetModel","action","tagIdExcluded","tagsIds","tagId2","aIndex","a","bIndex","b","classString","onOpen","popupEvent","utils_dom","_e","ui","$tags","tagsSorted","elTag","tagSorted","tagIdA","tagIdB","onClose","genElPopupOpener","propsPopup","htmlSetterSeveral","el","elPopupOpenerRender","modelValue","renderElPopupOpener","elTagIcon","genElTagIcon","TopSelectorCompetitors","_sfc_main$5","TopSelectorRegion","_sfc_main$4","TopTagSelector","_sfc_main","TopTagSelectorPopupOpener","_sfc_main$1","TopTagSelectorTagIcon","_sfc_main$3"],"mappings":"4pBAUA,MAAAA,EAAAC,+BAKAC,EAAAC,EAAA,SAAA,IAAA,CACC,GAAAH,EAAA,kBACC,MAAA,UACO,MAAAI,EAAA,QAAA,EAAA,OAAA,iCAGG,CAEX,CAAA,oqCCpBMC,EAAA,GAEAC,GAAA,4IAYP,EAEOC,EAAA,wBAIP,EAEOC,EAAA,iBAEA,QAAA,CAAAD,CAAA,EACmB,cAAA,IAAA,IAAA,CAAA,CAAAF,EAAAE,CAAA,CAAA,CAAA,CAE1B,EAEAE,EAAA,gCAIA,EAEAC,EAAA,yBAEO,QAAA,CAAAD,CAAA,EACc,cAAA,IAAA,IAAA,CAAA,CAAAJ,EAAAI,CAAA,CAAA,CAAA,CAErB,EAEAE,EAAA,kFAQA,oGAYC,QAAA,IAAAD,CAAA,2DCjDYE,EAAA,CAAAC,EAAA,GAAAC,EAAA,GAAAC,EAAA,CAAA,IAAA,gBAQXC,EAAAC,GAAAF,CAAA,EAEAC,EAAAE,EAAAH,CAAA,EAGDD,GAAAE,EAAA,IAAAX,EAAAc,GAAA,CAAA,EACAH,EAAA,MAAAA,EAAA,IAAAX,EAAAG,CAAA,KAaDU,EAAA,CAAAH,EAAAK,EAAA,GAAAC,EAAA,CAAA,EAAAR,EAAA,KAAA,CAMC,MAAAG,EAAA,IAAA,IAGA,OAAAD,EAAA,QAAAO,GAAA,CAEC,GADA,CAAAA,EAAA,SACAT,GAAA,OAA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