@topvisor/ui 1.0.26-1 → 1.0.26-3

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.
@@ -0,0 +1,181 @@
1
+ import { Core as P } from "../core/app.js";
2
+ import { defineComponent as M, ref as k, reactive as O, watch as L, resolveComponent as V, createBlock as N, openBlock as u, unref as C, withCtx as m, createVNode as p, createTextVNode as B, toDisplayString as v, createElementVNode as f, createElementBlock as y, Fragment as G, renderList as X, createCommentVNode as b } from "vue";
3
+ import { _ as Q, a as q } from "./page.vue_vue_type_script_setup_true_lang-CCE8pKg7.es.js";
4
+ import { b as z } from "./utils-DIly8mml.es.js";
5
+ import { genFlagLinkByCountryCode as H } from "../utils/string.js";
6
+ import { getSearcherGIcon as J, getLangLabel as K, getDeviceGIcon as W } from "../utils/searchers.js";
7
+ import { C as A } from "./forms-BEMrEl5V.es.js";
8
+ const D = ["../assets/dialog_selectorRegions.css"].map((x) => import.meta.resolve(x));
9
+ P.insertCSSLinkToPage(D, !0);
10
+ const Y = { class: "dialog_selectorRegions_header" }, Z = ["data-top-icon"], F = ["src", "alt"], ee = { class: "dialog_selectorRegions_regionAreaName top-ellipsis" }, oe = { key: 1 }, te = ["data-top-icon"], de = /* @__PURE__ */ M({
11
+ id: "selectorRegions",
12
+ __name: "dialog_selectorRegions",
13
+ props: {
14
+ regions: {},
15
+ regionsIndexes: {},
16
+ "@update:regionsIndexes": { type: Function }
17
+ },
18
+ setup(x) {
19
+ const l = x, I = z(), _ = k(!1), a = k([]), i = k(null), g = O({
20
+ searcher_key: -1,
21
+ key: -1,
22
+ name: -1
23
+ }), h = (o) => {
24
+ g[o] = -g[o], a.value.sort((n, s) => !n[o] || !s[o] ? -1 : n[o] >= s[o] ? g[o] : -g[o]);
25
+ }, T = () => {
26
+ var n;
27
+ if (!a.value.some((s) => s.selected)) return;
28
+ const o = a.value.filter((s) => s.selected).map((s) => s.index);
29
+ (n = l["@update:regionsIndexes"]) == null || n.call(l, o), I.close();
30
+ };
31
+ L(_, () => {
32
+ a.value = a.value.map((o) => ({ ...o, selected: _.value }));
33
+ }), L([
34
+ () => l.regions,
35
+ () => l.regionsIndexes
36
+ ], () => {
37
+ if (a.value = [], !l.regions || !l.regionsIndexes) return;
38
+ let o = !0, n = [...l.regions];
39
+ const s = new Map(l.regionsIndexes.map((t, e) => [t, e]));
40
+ n.sort((t, e) => {
41
+ const r = s.get(t.index) ?? Number.MAX_VALUE, c = s.get(e.index) ?? Number.MAX_VALUE;
42
+ return r - c;
43
+ }), n.forEach((t) => {
44
+ var S;
45
+ let e = t.name;
46
+ t.areaName && (e += ` (${t.areaName})`);
47
+ const r = ((S = l.regionsIndexes) == null ? void 0 : S.includes(t.index)) ?? !1, c = J(t.searcher_key), d = t.lang !== void 0 ? K(t.searcher_key ?? 999, t.lang) : void 0, j = t.device !== void 0 ? W(t.device) : void 0, w = t.countryCode !== void 0 ? H(t.countryCode) : void 0, R = {
48
+ ...t,
49
+ selected: r,
50
+ title: e,
51
+ searcherIcon: c,
52
+ langLabel: d,
53
+ deviceIcon: j,
54
+ flagLink: w
55
+ };
56
+ a.value.push(R), R.selected || (o = !1);
57
+ }), _.value = o;
58
+ });
59
+ const U = () => {
60
+ var o;
61
+ if (!((o = A.$) != null && o.ui.sortable)) {
62
+ console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");
63
+ return;
64
+ }
65
+ i.value && $(i.value).sortable({
66
+ distance: 10,
67
+ stop: () => {
68
+ const n = [...i.value.children].map((s) => Number(s.getAttribute("data-region-index")));
69
+ a.value.sort((s, t) => n.indexOf(s.index) - n.indexOf(t.index));
70
+ }
71
+ });
72
+ }, E = () => {
73
+ var o;
74
+ (o = A.$) != null && o.ui.sortable && i.value && $(i.value).sortable("destroy");
75
+ };
76
+ return (o, n) => {
77
+ const s = V("TopCheckbox"), t = V("TopButton");
78
+ return u(), N(C(Q), {
79
+ id: C(I).id,
80
+ pageActive: "selectorRegions",
81
+ class: "dialog_selectorRegions",
82
+ height: "600px",
83
+ width: "600px",
84
+ onOpen: U,
85
+ onClose: E
86
+ }, {
87
+ default: m(() => [
88
+ p(C(q), {
89
+ name: "selectorRegions",
90
+ order: 0
91
+ }, {
92
+ header: m(() => {
93
+ var e, r, c;
94
+ return [
95
+ f("div", Y, [
96
+ p(s, {
97
+ modelValue: _.value,
98
+ "onUpdate:modelValue": n[0] || (n[0] = (d) => _.value = d)
99
+ }, null, 8, ["modelValue"]),
100
+ p(t, {
101
+ class: "dialog_selectorRegions_sortButton",
102
+ color: "theme",
103
+ "data-top-icon": "",
104
+ onClick: n[1] || (n[1] = (d) => h("searcher_key")),
105
+ title: (e = o.$i18n.Projects) == null ? void 0 : e.Sort_by_search_engine
106
+ }, null, 8, ["title"]),
107
+ p(t, {
108
+ class: "dialog_selectorRegions_sortButton",
109
+ color: "theme",
110
+ "data-top-icon": "",
111
+ onClick: n[2] || (n[2] = (d) => h("key")),
112
+ title: (r = o.$i18n.Projects) == null ? void 0 : r.Sort_by_yande_region_code
113
+ }, null, 8, ["title"]),
114
+ p(t, {
115
+ class: "dialog_selectorRegions_sortButton",
116
+ color: "theme",
117
+ "data-top-icon": "",
118
+ onClick: n[3] || (n[3] = (d) => h("name")),
119
+ title: (c = o.$i18n.Projects) == null ? void 0 : c.Sort_by_lphabetically
120
+ }, null, 8, ["title"])
121
+ ])
122
+ ];
123
+ }),
124
+ body: m(() => [
125
+ f("div", {
126
+ ref_key: "elRegions",
127
+ ref: i
128
+ }, [
129
+ (u(!0), y(G, null, X(a.value, (e) => (u(), N(s, {
130
+ key: e.index,
131
+ modelValue: e.selected,
132
+ "onUpdate:modelValue": (r) => e.selected = r,
133
+ class: "dialog_selectorRegions_region",
134
+ "data-region-index": e.index
135
+ }, {
136
+ default: m(() => [
137
+ f("div", {
138
+ class: "dialog_selectorRegions_regionSearcherIcon",
139
+ "data-top-icon": e.searcherIcon
140
+ }, null, 8, Z),
141
+ e.flagLink ? (u(), y("img", {
142
+ key: 0,
143
+ class: "top-flag",
144
+ src: "//topvisor.dev" + e.flagLink,
145
+ alt: e.countryCode
146
+ }, null, 8, F)) : b("", !0),
147
+ B(" " + v(e.name) + " ", 1),
148
+ f("div", ee, v(e.areaName), 1),
149
+ e.langLabel ? (u(), y("div", oe, " [" + v(e.langLabel) + "] ", 1)) : b("", !0),
150
+ e.deviceIcon ? (u(), y("div", {
151
+ key: 2,
152
+ "data-top-icon": e.deviceIcon
153
+ }, null, 8, te)) : b("", !0)
154
+ ]),
155
+ _: 2
156
+ }, 1032, ["modelValue", "onUpdate:modelValue", "data-region-index"]))), 128))
157
+ ], 512)
158
+ ]),
159
+ footer: m(() => [
160
+ p(t, { onClick: T }, {
161
+ default: m(() => {
162
+ var e;
163
+ return [
164
+ B(v((e = o.$i18n.Common) == null ? void 0 : e.Apply), 1)
165
+ ];
166
+ }),
167
+ _: 1
168
+ })
169
+ ]),
170
+ _: 1
171
+ })
172
+ ]),
173
+ _: 1
174
+ }, 8, ["id"]);
175
+ };
176
+ }
177
+ });
178
+ export {
179
+ de as default
180
+ };
181
+ //# sourceMappingURL=dialog_selectorRegions-DZR64Wm8.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog_selectorRegions-DZR64Wm8.es.js","sources":["../../src/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { reactive, ref, watch } from 'vue';\nimport { TopDialog, TopDialogPage, useTopDialogSelf } from '@/components/dialog/dialog';\nimport { genFlagLinkByCountryCode } from '@/core/utils/string';\nimport type { Props, RegionRich } from './types';\nimport { getDeviceGIcon, getLangLabel, getSearcherGIcon } from '@/core/utils/searchers';\nimport Core from '@/core/core/core';\n\ndefineOptions({ id: 'selectorRegions' });\n\nconst props = defineProps<Partial<Props>>();\n\nconst dialog = useTopDialogSelf();\n\n/**\n * Выбраны все регионы\n */\nconst isAllSelected = ref(false);\n\n/**\n * Список расширенных регионов для использования в компоненте\n */\nconst regionsRich = ref<RegionRich[]>([]);\n\n/**\n * Ссылка на элемент с регионами\n */\nconst elRegions = ref<null | HTMLElement>(null);\n\n/**\n * Направление сортировки по полю\n */\nconst sortedVectorByField = reactive({\n\tsearcher_key: -1,\n\tkey: -1,\n\tname: -1,\n});\n\n/**\n * Сортировать регионы по выбранному полю\n * @param sortedField - Поле для сортировки\n */\nconst sort = (sortedField: keyof typeof sortedVectorByField) => {\n\tsortedVectorByField[sortedField] = -sortedVectorByField[sortedField];\n\n\tregionsRich.value.sort((regionA, regionB) => {\n\t\tif (!regionA[sortedField] || !regionB[sortedField]) return -1;\n\n\t\treturn regionA[sortedField] >= regionB[sortedField] ? sortedVectorByField[sortedField] : -sortedVectorByField[sortedField];\n\t});\n};\n\n/**\n * Применить изменения\n *\n * Вызывает callback `props['@update:regionsIndexes']`\n */\nconst onSubmit = () => {\n\tif (!regionsRich.value.some((region) => region.selected)) return;\n\n\tconst regionsIndexes = regionsRich.value\n\t\t.filter((region) => region.selected)\n\t\t.map((region) => region.index);\n\n\tprops['@update:regionsIndexes']?.(regionsIndexes);\n\n\tdialog.close();\n};\n\n// Выбрать / отменить все регионы\nwatch(isAllSelected, () => {\n\tregionsRich.value = regionsRich.value.map((region) => ({ ...region, selected: isAllSelected.value }));\n});\n\n// генерация регионов\nwatch([\n\t() => props.regions,\n\t() => props.regionsIndexes,\n], () => {\n\tregionsRich.value = [];\n\n\tif (!props.regions) return;\n\tif (!props.regionsIndexes) return;\n\n\tlet isAllSelectedLocal = true;\n\n\tlet regions = [...props.regions];\n\n\t// отсортировать регионы по входным данным\n\tconst orderByRegionIndex = new Map(props.regionsIndexes.map((index, order) => [index, order]));\n\n\tregions.sort((regionA, regionB) => {\n\t\tconst orderA = orderByRegionIndex.get(regionA.index) ?? Number.MAX_VALUE;\n\t\tconst orderB = orderByRegionIndex.get(regionB.index) ?? Number.MAX_VALUE;\n\n\t\treturn orderA - orderB;\n\t});\n\n\tregions.forEach((region) => {\n\t\tlet title = region.name;\n\t\tif (region.areaName) title += ` (${region.areaName})`;\n\n\t\tconst selected = props.regionsIndexes?.includes(region.index) ?? false;\n\t\tconst searcherIcon = getSearcherGIcon(region.searcher_key);\n\t\tconst langLabel = region.lang !== undefined ? getLangLabel(region.searcher_key ?? 999, region.lang) : undefined;\n\t\tconst deviceIcon = region.device !== undefined ? getDeviceGIcon(region.device) : undefined;\n\t\tconst flagLink = region.countryCode !== undefined ? genFlagLinkByCountryCode(region.countryCode) : undefined;\n\n\t\tconst regionRich = {\n\t\t\t...region,\n\t\t\tselected,\n\t\t\ttitle,\n\t\t\tsearcherIcon,\n\t\t\tlangLabel,\n\t\t\tdeviceIcon,\n\t\t\tflagLink,\n\t\t};\n\n\t\tregionsRich.value.push(regionRich);\n\n\t\tif (!regionRich.selected) {\n\t\t\tisAllSelectedLocal = false;\n\t\t}\n\t});\n\n\tisAllSelected.value = isAllSelectedLocal;\n});\n\n/**\n * Проверить на существование sortable\n */\nconst onOpen = () => {\n\tif (!Core.$?.ui['sortable']) {\n\t\tconsole.info('Для работы сортировки требуется глобальная загрузка jQuery UI Sortable');\n\n\t\treturn;\n\t}\n\n\tif (!elRegions.value) return;\n\n\t$(elRegions.value).sortable({\n\t\tdistance: 10,\n\n\t\tstop: () => {\n\t\t\t// Обновляем порядок регионов в массиве regionsRich после сортировки\n\t\t\tconst sortedIndexes = [...elRegions.value!.children].map(el => Number(el.getAttribute('data-region-index')));\n\t\t\tregionsRich.value.sort((a, b) => sortedIndexes.indexOf(a.index) - sortedIndexes.indexOf(b.index));\n\t\t},\n\t});\n\n};\n\n/**\n * Удаление sortable\n */\nconst onClose = () => {\n\tif (!Core.$?.ui['sortable']) return;\n\tif (!elRegions.value) return;\n\n\t$(elRegions.value).sortable('destroy');\n};\n\n</script>\n\n<template>\n\t<TopDialog\n\t\t:id=\"dialog.id\"\n\t\tpageActive=\"selectorRegions\"\n\t\tclass=\"dialog_selectorRegions\"\n\t\theight=\"600px\"\n\t\twidth=\"600px\"\n\t\t@open=\"onOpen\"\n\t\t@close=\"onClose\"\n\t>\n\t\t<TopDialogPage name=\"selectorRegions\" :order=\"0\">\n\t\t\t<template #header>\n\t\t\t\t<div class=\"dialog_selectorRegions_header\">\n\t\t\t\t\t<TopCheckbox v-model=\"isAllSelected\"></TopCheckbox>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('searcher_key')\"\n\t\t\t\t\t\t:title=\"$i18n.Projects?.Sort_by_search_engine\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('key')\"\n\t\t\t\t\t\t:title=\"$i18n.Projects?.Sort_by_yande_region_code\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('name')\"\n\t\t\t\t\t\t:title=\"$i18n.Projects?.Sort_by_lphabetically\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #body>\n\t\t\t\t<div ref=\"elRegions\">\n\t\t\t\t\t<TopCheckbox\n\t\t\t\t\t\tv-for=\"region of regionsRich\"\n\t\t\t\t\t\t:key=\"region.index\"\n\t\t\t\t\t\tv-model=\"region.selected\"\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_region\"\n\t\t\t\t\t\t:data-region-index=\"region.index\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass=\"dialog_selectorRegions_regionSearcherIcon\"\n\t\t\t\t\t\t\t:data-top-icon=\"region.searcherIcon\"\n\t\t\t\t\t\t></div>\n\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tv-if=\"region.flagLink\"\n\t\t\t\t\t\t\tclass=\"top-flag\"\n\t\t\t\t\t\t\t:src=\"'//topvisor.dev' + region.flagLink\"\n\t\t\t\t\t\t\t:alt=\"region.countryCode\"\n\t\t\t\t\t\t>\n\n\t\t\t\t\t\t{{ region.name }}\n\n\t\t\t\t\t\t<div class=\"dialog_selectorRegions_regionAreaName top-ellipsis\">\n\t\t\t\t\t\t\t{{ region.areaName }}\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div v-if=\"region.langLabel\">\n\t\t\t\t\t\t\t[{{ region.langLabel }}]\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tv-if=\"region.deviceIcon\"\n\t\t\t\t\t\t\t:data-top-icon=\"region.deviceIcon\"\n\t\t\t\t\t\t></div>\n\t\t\t\t\t</TopCheckbox>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #footer>\n\t\t\t\t<TopButton @click=\"onSubmit\">\n\t\t\t\t\t{{ $i18n.Common?.Apply }}\n\t\t\t\t</TopButton>\n\t\t\t</template>\n\t\t</TopDialogPage>\n\t</TopDialog>\n</template>\n\n<style>\n@import \"./style.css\";\n</style>\n"],"names":["props","__props","dialog","useTopDialogSelf","isAllSelected","ref","regionsRich","elRegions","sortedVectorByField","reactive","sort","sortedField","regionA","regionB","onSubmit","region","regionsIndexes","_a","watch","isAllSelectedLocal","regions","orderByRegionIndex","index","order","orderA","orderB","title","selected","searcherIcon","getSearcherGIcon","langLabel","getLangLabel","deviceIcon","getDeviceGIcon","flagLink","genFlagLinkByCountryCode","regionRich","onOpen","Core","sortedIndexes","el","a","b","onClose"],"mappings":";;;;;;;;;;;;;;;;;;AAUA,UAAAA,IAAAC,GAEAC,IAAAC,EAAA,GAKAC,IAAAC,EAAA,EAAA,GAKAC,IAAAD,EAAA,CA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,CAAAmC,GAAAC,MAAAH,EAAA,QAAAE,EAAA,KAAA,IAAAF,EAAA,QAAAG,EAAA,KAAA,CAAA;AAAA,QAAgG;AAAA,MACjG,CAAA;AAAA,IACA,GAOFC,IAAA,MAAA;;AACC,OAAA1B,IAAAqB,EAAA,MAAA,QAAArB,EAAA,GAAA,YACAV,EAAA,SAEA,EAAAA,EAAA,KAAA,EAAA,SAAA,SAAA;AAAA,IAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ define(["require","exports","vue","./page.vue_vue_type_script_setup_true_lang-BI9HWAyQ.amd","./utils-CTjq0RlC.amd","../utils/string.amd","../utils/searchers.amd","./forms-B3bJpLOo.amd","../require/css.amd!../assets/dialog_selectorRegions.css"],function(j,_,e,f,C,V,g,y){"use strict";if(typeof e>"u")var e=window.Vue;const b={class:"dialog_selectorRegions_header"},N=["data-top-icon"],B=["src","alt"],I={class:"dialog_selectorRegions_regionAreaName top-ellipsis"},R={key:1},S=["data-top-icon"],L=e.defineComponent({id:"selectorRegions",__name:"dialog_selectorRegions",props:{regions:{},regionsIndexes:{},"@update:regionsIndexes":{type:Function}},setup(w){const s=w,k=C.useTopDialogSelf(),m=e.ref(!1),r=e.ref([]),i=e.ref(null),p=e.reactive({searcher_key:-1,key:-1,name:-1}),v=o=>{p[o]=-p[o],r.value.sort((l,a)=>!l[o]||!a[o]?-1:l[o]>=a[o]?p[o]:-p[o])},E=()=>{var l;if(!r.value.some(a=>a.selected))return;const o=r.value.filter(a=>a.selected).map(a=>a.index);(l=s["@update:regionsIndexes"])==null||l.call(s,o),k.close()};e.watch(m,()=>{r.value=r.value.map(o=>({...o,selected:m.value}))}),e.watch([()=>s.regions,()=>s.regionsIndexes],()=>{if(r.value=[],!s.regions||!s.regionsIndexes)return;let o=!0,l=[...s.regions];const a=new Map(s.regionsIndexes.map((n,t)=>[n,t]));l.sort((n,t)=>{const c=a.get(n.index)??Number.MAX_VALUE,d=a.get(t.index)??Number.MAX_VALUE;return c-d}),l.forEach(n=>{var h;let t=n.name;n.areaName&&(t+=` (${n.areaName})`);const c=((h=s.regionsIndexes)==null?void 0:h.includes(n.index))??!1,d=g.getSearcherGIcon(n.searcher_key),u=n.lang!==void 0?g.getLangLabel(n.searcher_key??999,n.lang):void 0,D=n.device!==void 0?g.getDeviceGIcon(n.device):void 0,U=n.countryCode!==void 0?V.genFlagLinkByCountryCode(n.countryCode):void 0,x={...n,selected:c,title:t,searcherIcon:d,langLabel:u,deviceIcon:D,flagLink:U};r.value.push(x),x.selected||(o=!1)}),m.value=o});const A=()=>{var o;if(!((o=y.Core.$)!=null&&o.ui.sortable)){console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");return}i.value&&$(i.value).sortable({distance:10,stop:()=>{const l=[...i.value.children].map(a=>Number(a.getAttribute("data-region-index")));r.value.sort((a,n)=>l.indexOf(a.index)-l.indexOf(n.index))}})},T=()=>{var o;(o=y.Core.$)!=null&&o.ui.sortable&&i.value&&$(i.value).sortable("destroy")};return(o,l)=>{const a=e.resolveComponent("TopCheckbox"),n=e.resolveComponent("TopButton");return e.openBlock(),e.createBlock(e.unref(f._sfc_main),{id:e.unref(k).id,pageActive:"selectorRegions",class:"dialog_selectorRegions",height:"600px",width:"600px",onOpen:A,onClose:T},{default:e.withCtx(()=>[e.createVNode(e.unref(f._sfc_main$1),{name:"selectorRegions",order:0},{header:e.withCtx(()=>{var t,c,d;return[e.createElementVNode("div",b,[e.createVNode(a,{modelValue:m.value,"onUpdate:modelValue":l[0]||(l[0]=u=>m.value=u)},null,8,["modelValue"]),e.createVNode(n,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:l[1]||(l[1]=u=>v("searcher_key")),title:(t=o.$i18n.Projects)==null?void 0:t.Sort_by_search_engine},null,8,["title"]),e.createVNode(n,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:l[2]||(l[2]=u=>v("key")),title:(c=o.$i18n.Projects)==null?void 0:c.Sort_by_yande_region_code},null,8,["title"]),e.createVNode(n,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:l[3]||(l[3]=u=>v("name")),title:(d=o.$i18n.Projects)==null?void 0:d.Sort_by_lphabetically},null,8,["title"])])]}),body:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"elRegions",ref:i},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,t=>(e.openBlock(),e.createBlock(a,{key:t.index,modelValue:t.selected,"onUpdate:modelValue":c=>t.selected=c,class:"dialog_selectorRegions_region","data-region-index":t.index},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"dialog_selectorRegions_regionSearcherIcon","data-top-icon":t.searcherIcon},null,8,N),t.flagLink?(e.openBlock(),e.createElementBlock("img",{key:0,class:"top-flag",src:"//topvisor.dev"+t.flagLink,alt:t.countryCode},null,8,B)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.name)+" ",1),e.createElementVNode("div",I,e.toDisplayString(t.areaName),1),t.langLabel?(e.openBlock(),e.createElementBlock("div",R," ["+e.toDisplayString(t.langLabel)+"] ",1)):e.createCommentVNode("",!0),t.deviceIcon?(e.openBlock(),e.createElementBlock("div",{key:2,"data-top-icon":t.deviceIcon},null,8,S)):e.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","data-region-index"]))),128))],512)]),footer:e.withCtx(()=>[e.createVNode(n,{onClick:E},{default:e.withCtx(()=>{var t;return[e.createTextVNode(e.toDisplayString((t=o.$i18n.Common)==null?void 0:t.Apply),1)]}),_:1})]),_:1})]),_:1},8,["id"])}}});_.default=L,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=dialog_selectorRegions-D_HXNjOX.amd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog_selectorRegions-D_HXNjOX.amd.js","sources":["../../src/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { reactive, ref, watch } from 'vue';\nimport { TopDialog, TopDialogPage, useTopDialogSelf } from '@/components/dialog/dialog';\nimport { genFlagLinkByCountryCode } from '@/core/utils/string';\nimport type { Props, RegionRich } from './types';\nimport { getDeviceGIcon, getLangLabel, getSearcherGIcon } from '@/core/utils/searchers';\nimport Core from '@/core/core/core';\n\ndefineOptions({ id: 'selectorRegions' });\n\nconst props = defineProps<Partial<Props>>();\n\nconst dialog = useTopDialogSelf();\n\n/**\n * Выбраны все регионы\n */\nconst isAllSelected = ref(false);\n\n/**\n * Список расширенных регионов для использования в компоненте\n */\nconst regionsRich = ref<RegionRich[]>([]);\n\n/**\n * Ссылка на элемент с регионами\n */\nconst elRegions = ref<null | HTMLElement>(null);\n\n/**\n * Направление сортировки по полю\n */\nconst sortedVectorByField = reactive({\n\tsearcher_key: -1,\n\tkey: -1,\n\tname: -1,\n});\n\n/**\n * Сортировать регионы по выбранному полю\n * @param sortedField - Поле для сортировки\n */\nconst sort = (sortedField: keyof typeof sortedVectorByField) => {\n\tsortedVectorByField[sortedField] = -sortedVectorByField[sortedField];\n\n\tregionsRich.value.sort((regionA, regionB) => {\n\t\tif (!regionA[sortedField] || !regionB[sortedField]) return -1;\n\n\t\treturn regionA[sortedField] >= regionB[sortedField] ? sortedVectorByField[sortedField] : -sortedVectorByField[sortedField];\n\t});\n};\n\n/**\n * Применить изменения\n *\n * Вызывает callback `props['@update:regionsIndexes']`\n */\nconst onSubmit = () => {\n\tif (!regionsRich.value.some((region) => region.selected)) return;\n\n\tconst regionsIndexes = regionsRich.value\n\t\t.filter((region) => region.selected)\n\t\t.map((region) => region.index);\n\n\tprops['@update:regionsIndexes']?.(regionsIndexes);\n\n\tdialog.close();\n};\n\n// Выбрать / отменить все регионы\nwatch(isAllSelected, () => {\n\tregionsRich.value = regionsRich.value.map((region) => ({ ...region, selected: isAllSelected.value }));\n});\n\n// генерация регионов\nwatch([\n\t() => props.regions,\n\t() => props.regionsIndexes,\n], () => {\n\tregionsRich.value = [];\n\n\tif (!props.regions) return;\n\tif (!props.regionsIndexes) return;\n\n\tlet isAllSelectedLocal = true;\n\n\tlet regions = [...props.regions];\n\n\t// отсортировать регионы по входным данным\n\tconst orderByRegionIndex = new Map(props.regionsIndexes.map((index, order) => [index, order]));\n\n\tregions.sort((regionA, regionB) => {\n\t\tconst orderA = orderByRegionIndex.get(regionA.index) ?? Number.MAX_VALUE;\n\t\tconst orderB = orderByRegionIndex.get(regionB.index) ?? Number.MAX_VALUE;\n\n\t\treturn orderA - orderB;\n\t});\n\n\tregions.forEach((region) => {\n\t\tlet title = region.name;\n\t\tif (region.areaName) title += ` (${region.areaName})`;\n\n\t\tconst selected = props.regionsIndexes?.includes(region.index) ?? false;\n\t\tconst searcherIcon = getSearcherGIcon(region.searcher_key);\n\t\tconst langLabel = region.lang !== undefined ? getLangLabel(region.searcher_key ?? 999, region.lang) : undefined;\n\t\tconst deviceIcon = region.device !== undefined ? getDeviceGIcon(region.device) : undefined;\n\t\tconst flagLink = region.countryCode !== undefined ? genFlagLinkByCountryCode(region.countryCode) : undefined;\n\n\t\tconst regionRich = {\n\t\t\t...region,\n\t\t\tselected,\n\t\t\ttitle,\n\t\t\tsearcherIcon,\n\t\t\tlangLabel,\n\t\t\tdeviceIcon,\n\t\t\tflagLink,\n\t\t};\n\n\t\tregionsRich.value.push(regionRich);\n\n\t\tif (!regionRich.selected) {\n\t\t\tisAllSelectedLocal = false;\n\t\t}\n\t});\n\n\tisAllSelected.value = isAllSelectedLocal;\n});\n\n/**\n * Проверить на существование sortable\n */\nconst onOpen = () => {\n\tif (!Core.$?.ui['sortable']) {\n\t\tconsole.info('Для работы сортировки требуется глобальная загрузка jQuery UI Sortable');\n\n\t\treturn;\n\t}\n\n\tif (!elRegions.value) return;\n\n\t$(elRegions.value).sortable({\n\t\tdistance: 10,\n\n\t\tstop: () => {\n\t\t\t// Обновляем порядок регионов в массиве regionsRich после сортировки\n\t\t\tconst sortedIndexes = [...elRegions.value!.children].map(el => Number(el.getAttribute('data-region-index')));\n\t\t\tregionsRich.value.sort((a, b) => sortedIndexes.indexOf(a.index) - sortedIndexes.indexOf(b.index));\n\t\t},\n\t});\n\n};\n\n/**\n * Удаление sortable\n */\nconst onClose = () => {\n\tif (!Core.$?.ui['sortable']) return;\n\tif (!elRegions.value) return;\n\n\t$(elRegions.value).sortable('destroy');\n};\n\n</script>\n\n<template>\n\t<TopDialog\n\t\t:id=\"dialog.id\"\n\t\tpageActive=\"selectorRegions\"\n\t\tclass=\"dialog_selectorRegions\"\n\t\theight=\"600px\"\n\t\twidth=\"600px\"\n\t\t@open=\"onOpen\"\n\t\t@close=\"onClose\"\n\t>\n\t\t<TopDialogPage name=\"selectorRegions\" :order=\"0\">\n\t\t\t<template #header>\n\t\t\t\t<div class=\"dialog_selectorRegions_header\">\n\t\t\t\t\t<TopCheckbox v-model=\"isAllSelected\"></TopCheckbox>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('searcher_key')\"\n\t\t\t\t\t\t:title=\"$i18n.Projects?.Sort_by_search_engine\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('key')\"\n\t\t\t\t\t\t:title=\"$i18n.Projects?.Sort_by_yande_region_code\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('name')\"\n\t\t\t\t\t\t:title=\"$i18n.Projects?.Sort_by_lphabetically\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #body>\n\t\t\t\t<div ref=\"elRegions\">\n\t\t\t\t\t<TopCheckbox\n\t\t\t\t\t\tv-for=\"region of regionsRich\"\n\t\t\t\t\t\t:key=\"region.index\"\n\t\t\t\t\t\tv-model=\"region.selected\"\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_region\"\n\t\t\t\t\t\t:data-region-index=\"region.index\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass=\"dialog_selectorRegions_regionSearcherIcon\"\n\t\t\t\t\t\t\t:data-top-icon=\"region.searcherIcon\"\n\t\t\t\t\t\t></div>\n\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tv-if=\"region.flagLink\"\n\t\t\t\t\t\t\tclass=\"top-flag\"\n\t\t\t\t\t\t\t:src=\"'//topvisor.dev' + region.flagLink\"\n\t\t\t\t\t\t\t:alt=\"region.countryCode\"\n\t\t\t\t\t\t>\n\n\t\t\t\t\t\t{{ region.name }}\n\n\t\t\t\t\t\t<div class=\"dialog_selectorRegions_regionAreaName top-ellipsis\">\n\t\t\t\t\t\t\t{{ region.areaName }}\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div v-if=\"region.langLabel\">\n\t\t\t\t\t\t\t[{{ region.langLabel }}]\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tv-if=\"region.deviceIcon\"\n\t\t\t\t\t\t\t:data-top-icon=\"region.deviceIcon\"\n\t\t\t\t\t\t></div>\n\t\t\t\t\t</TopCheckbox>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #footer>\n\t\t\t\t<TopButton @click=\"onSubmit\">\n\t\t\t\t\t{{ $i18n.Common?.Apply }}\n\t\t\t\t</TopButton>\n\t\t\t</template>\n\t\t</TopDialogPage>\n\t</TopDialog>\n</template>\n\n<style>\n@import \"./style.css\";\n</style>\n"],"names":["dialog","utils","isAllSelected","vue","regionsRich","elRegions","sortedVectorByField","sort","sortedField","regionA","regionB","region","_a","props","regionsIndexes","orderA","orderByRegionIndex","orderB","regions","title","selected","deviceIcon","utils_searchers","flagLink","utils_string","searcherIcon","langLabel","regionRich","isAllSelectedLocal","b","sortedIndexes"],"mappings":"wpBAYAA,EAAAC,EAAA,iBAAA,EAKAC,EAAAC,EAAA,IAAA,EAAA,EAKAC,EAAAD,EAAA,IAAA,CAAA,CAAA,EAKAE,EAAAF,EAAA,IAAA,IAAA,EAKAG,EAAAH,EAAA,SAAA,wBAEM,KAAA,EACC,CAAA,EAOPI,EAAAC,GAAA,gCAIE,CAAAC,EAAAD,CAAA,GAAA,CAAAE,EAAAF,CAAA,EAAA,wBAEyH,gBAU1H,GAAA,CAAAJ,EAAA,MAAA,KAAAO,GAAAA,EAAA,QAAA,EAAA,8DAMAC,EAAAC,EAAA,4BAAA,MAAAD,EAAA,KAAAC,EAAAC,cAMDX,EAAA,MAAAD,EAAA,IAAA,kDACqG,CAAA,EAIrGC,EAAA,MAAA,mCAEa,EAAA,IAAA,CAKZ,GAHAC,EAAA,MAAA,CAAA,EAEA,CAAAS,EAAA,SACA,CAAAA,EAAA,eAAA,oGAUC,MAAAE,EAAAC,EAAA,IAAAP,EAAA,KAAA,GAAA,OAAA,UACAQ,EAAAD,EAAA,IAAAN,EAAA,KAAA,GAAA,OAAA,oBAEgB,CAAA,EAGjBQ,EAAA,QAAAP,GAAA,OACC,IAAAQ,EAAAR,EAAA,KACAA,EAAA,WAAAQ,GAAA,KAAAR,EAAA,QAAA,KAEA,MAAAS,IAAAR,EAAAC,EAAA,iBAAA,YAAAD,EAAA,SAAAD,EAAA,SAAA,4GAGAU,EAAAV,EAAA,SAAA,OAAAW,EAAA,eAAAX,EAAA,MAAA,EAAA,OACAY,EAAAZ,EAAA,cAAA,OAAAa,EAAA,yBAAAb,EAAA,WAAA,EAAA,UAEmB,GAAAA,EACf,SAAAS,EACH,MAAAD,EACA,aAAAM,EACA,UAAAC,EACA,WAAAL,cAKDjB,EAAA,MAAA,KAAAuB,CAAA,EAEAA,EAAA,gBAEA,CAAA,EAGDzB,EAAA,MAAA0B,CAAsB,CAAA,8DAQrB,QAAA,KAAA,wEAAA,QAEA,CAGDvB,EAAA,oIAQED,EAAA,MAAA,KAAA,CAAA,EAAAyB,IAAAC,EAAA,QAAA,EAAA,KAAA,EAAAA,EAAA,QAAAD,EAAA,KAAA,CAAA,CAAgG,CACjG,CAAA,mDAUDxB,EAAA"}
@@ -0,0 +1 @@
1
+ .top-rive{width:100%;height:100%;flex-grow:1}
@@ -0,0 +1,3 @@
1
+ import { ComponentCustomProps } from 'vue';
2
+ import { default as Rive } from './rive/rive.vue';
3
+ export declare const TopRive: typeof Rive & ComponentCustomProps;
@@ -0,0 +1,11 @@
1
+ import { Rive } from '@rive-app/canvas-lite';
2
+ import { Props } from './types';
3
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
4
+ declare const _default: DefineComponent<Props, {
5
+ riveInstance: Rive | undefined;
6
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {
7
+ autoplay: boolean;
8
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {
9
+ el: HTMLCanvasElement;
10
+ }, HTMLCanvasElement>;
11
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { RiveParameters } from '@rive-app/canvas-lite';
2
+ export interface Props extends Omit<RiveParameters, 'canvas' | 'file'> {
3
+ /**
4
+ * Описание всех полей см. тут: https://rive.app/docs/runtimes/web/rive-parameters
5
+ */
6
+ src: RiveParameters['src'];
7
+ }
@@ -1,4 +1,6 @@
1
1
  import { Props } from './types';
2
2
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
- declare const _default: DefineComponent<Partial<Props>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Partial<Props>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
3
+ declare const _default: DefineComponent<Partial<Props>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Partial<Props>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
4
+ elRegions: HTMLDivElement;
5
+ }, HTMLDivElement>;
4
6
  export default _default;
@@ -29,4 +29,6 @@ export declare const findRegion: (forFrequency: boolean, searchRegion: Partial<R
29
29
  *
30
30
  * @see import('../dialog_selectorRegions/types').Props
31
31
  */
32
- export declare const dialogSelectorRegions: AsyncTopDialogHandle<DefineComponent<Partial< Props>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Partial< Props>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>>;
32
+ export declare const dialogSelectorRegions: AsyncTopDialogHandle<DefineComponent<Partial< Props>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Partial< Props>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
33
+ elRegions: HTMLDivElement;
34
+ }, HTMLDivElement>>;
package/core/app.amd.js CHANGED
@@ -1,2 +1,2 @@
1
- define(["require","exports","../.chunks/forms-B3bJpLOo.amd","../.chunks/core-B9imztzR.amd","vue","../utils/clipboard.amd","../utils/string.amd","../utils/route.amd","../.chunks/utils-CTjq0RlC.amd","../.chunks/dialogs.vue_vue_type_script_setup_true_lang-vT5jI1Ll.amd"],function(y,o,c,l,d,m,S,p,g,k){"use strict";if(typeof d>"u")var d=window.Vue;class E{#s;#t;#e;#i;#h;#a=[];#o=[];#c=[];#n=[];constructor(s){var t;this.#t=s.store,this.#s=this.#t.$id,this.#e=s.options.Page,this.#i=s.options.user,this.#h=s.options.Api,this.#a=s.options.tpaNamesUrlHash||[],this.#o=s.options.tpaNamesStorage||[],this.#c=s.options.tpaNamesStorageLocal||[],this.#n=s.options.tpaNamesGuestLink||[],s.store.genGuestLink=(i,a)=>this.genGuestLink(i,a),(t=this.#i.guest_data)!=null&&t.data||(this.#u(),this.#u(!0),this.#f()),this.#S(),this.#k();const e=c.debounce(()=>{this.#l(),this.#m()});s.store.$subscribe(e)}async genGuestLink(s,e){const t=this.#p();e=Object.assign(e,Object.fromEntries(t));const i=await this.#h.gen(s,"fetchColumn").call({},e);i!=null&&i.errors||await m.guestLinkToClipboard(i.result)}#p(){const s=new Map;return this.#n.forEach(e=>{const t=S.camelToSnakeCase(e);s.set(t,this.#t[e])}),s}#r(s){s.forEach((e,t)=>{const i=this.#t[t];if(e!=null&&i!==void 0&&e!=null&&e.constructor&&e.constructor===i.constructor){if(t.indexOf("date")===0&&!Array.isArray(e)){if(typeof e=="string"&&!/\d\d\d\d-\d\d-\d\d/.test(e))return}this.#t[t]=e}})}#g(s){const e=new Map;return s.forEach((t,i)=>{t!==null&&(t=JSON.stringify(t),e.set(i,t))}),e}#d(s){const e=new Map;return s.forEach((t,i)=>{if(!(t==null||t==="false")){try{if(typeof t=="string"&&!/^\d\d\d\d-\d\d-\d\d$/.test(t)&&(t=JSON.parse(t)),t==null||t==="false")return}catch{}e.set(i,t)}}),e}#f(){let s;try{s=JSON.parse(p.getHash(this.#s))}catch{}if(!s)return;const e=new Map;this.#a.forEach(t=>{const i=s[t];i&&e.set(t,i)}),this.#r(e)}#l(){const s=new Map;this.#a.forEach(i=>{const a=this.#t[i];s.set(i,a)});const e=Object.fromEntries(s),t=JSON.stringify(e);p.setHash(this.#s,t)}#u(s=!1){const e=new Map;let t="state:"+this.#s;s&&(t="state:"+this.#s+":"+location.pathname),this.#o.forEach(a=>{const n=localStorage.getItem(t+":"+a);e.set(a,n)});const i=this.#d(e);this.#r(i)}#m(s=!1){const e=new Map;let t=this.#o,i="state:"+this.#s;s&&(t=this.#c,i="state:"+this.#s+":"+location.pathname),t.forEach(n=>{const r=this.#t[n];e.set(n,r)});const a=this.#g(e);t.forEach(n=>{const r=a.get(n);localStorage.setItem(i+":"+n,r)})}#S(){var a,n,r;const s=(n=(a=this.#i)==null?void 0:a.guest_data)==null?void 0:n.data;if(!s)return;this.#i.id===-1&&(this.#i.positionsReverseDates=s.positionsReverseDates);const e=new Map;this.#n.forEach(h=>{const u=s[h];e.set(h,u)});const t=this.#d(e);this.#r(t);const i=$(".mod_guest_title");if(((r=this.#t.competitorsIds)==null?void 0:r.length)===1&&this.#e.page.data.competitors){let h=this.#e.page.data.competitors.filter(u=>u.id===s.competitorsIds[0]);h.length&&($("a",i).attr("href","http://"+h[0].url),$("a",i).text(h[0].name))}}#k(){this.#t.regionsIndexes&&d.watch(this.#t.regionsIndexes,s=>{if(!s.length)return;s.forEach((i,a)=>s[a]=i);const e=TplProjectSelectorRegion.genSearchersMap(),t=[];e.forEach(i=>{i.regions.forEach(a=>{a.index!==-1&&t.push(a.index)})}),this.#t.regionsIndexes=s.filter(i=>t.includes(i))},{immediate:!0}),this.#t.competitorsIds&&d.watch(this.#t.competitorsIds,s=>{if(!s.length)return;s.forEach((t,i)=>s[i]=t);const e=[this.#e.page.data.project.id];this.#e.page.data.project.competitors.forEach(t=>{t.on>=0&&e.push(t.id)}),this.#t.competitorsIds=s.filter(t=>e.includes(t))},{immediate:!0})}}const w=f=>{var e,t,i,a;const s=f;!((e=s.options.tpaNamesUrlHash)!=null&&e.length)&&!((t=s.options.tpaNamesStorage)!=null&&t.length)&&!((i=s.options.tpaNamesStorageLocal)!=null&&i.length)&&!((a=s.options.tpaNamesGuestLink)!=null&&a.length)||new E(s)};o.Core=c.Core,o.i18nPlugin=c.i18n,o.useI18n=c.useI18n,o.useI18nLang=c.useI18nLang,o.corePlugin=l.core,o.useAsyncTopDialog=g.useAsyncTopDialog,o.useTopDialog=g.useTopDialog,o.TopDialogWorker=k.TopDialogWorker,o.piniaTPAPlugin=w,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
1
+ define(["require","exports","../.chunks/forms-B3bJpLOo.amd","../.chunks/core-B9imztzR.amd","vue","../utils/clipboard.amd","../utils/string.amd","../utils/route.amd","../.chunks/utils-CTjq0RlC.amd","../.chunks/dialogs.vue_vue_type_script_setup_true_lang-vT5jI1Ll.amd"],function(y,n,c,l,d,m,S,p,g,k){"use strict";if(typeof d>"u")var d=window.Vue;class E{#s;#t;#e;#i;#c;#a=[];#o=[];#n=[];#r=[];constructor(s){var t;this.#t=s.store,this.#s=this.#t.$id,this.#e=s.options.Page,this.#i=s.options.user,this.#c=s.options.Api,this.#a=s.options.tpaNamesUrlHash||[],this.#o=s.options.tpaNamesStorage||[],this.#n=s.options.tpaNamesStorageLocal||[],this.#r=s.options.tpaNamesGuestLink||[],s.store.genGuestLink=(i,a)=>this.genGuestLink(i,a),(t=this.#i.guest_data)!=null&&t.data||(this.#u(),this.#u(!0),this.#l()),this.#S(),this.#k();const e=c.debounce(()=>{this.#m(),this.#p(),this.#p(!0)});s.store.$subscribe(e)}async genGuestLink(s,e){const t=this.#g();e=Object.assign(e,Object.fromEntries(t));const i=await this.#c.gen(s,"fetchColumn").call({},e);i!=null&&i.errors||await m.guestLinkToClipboard(i.result)}#g(){const s=new Map;return this.#r.forEach(e=>{const t=S.camelToSnakeCase(e);s.set(t,this.#t[e])}),s}#h(s){s.forEach((e,t)=>{const i=this.#t[t];if(e!=null&&i!==void 0&&e!=null&&e.constructor&&e.constructor===i.constructor){if(t.indexOf("date")===0&&!Array.isArray(e)){if(typeof e=="string"&&!/\d\d\d\d-\d\d-\d\d/.test(e))return}this.#t[t]=e}})}#f(s){const e=new Map;return s.forEach((t,i)=>{t!==null&&(t=JSON.stringify(t),e.set(i,t))}),e}#d(s){const e=new Map;return s.forEach((t,i)=>{if(!(t==null||t==="false")){try{if(typeof t=="string"&&!/^\d\d\d\d-\d\d-\d\d$/.test(t)&&(t=JSON.parse(t)),t==null||t==="false")return}catch{}e.set(i,t)}}),e}#l(){let s;try{s=JSON.parse(p.getHash(this.#s))}catch{}if(!s)return;const e=new Map;this.#a.forEach(t=>{const i=s[t];i&&e.set(t,i)}),this.#h(e)}#m(){const s=new Map;this.#a.forEach(i=>{const a=this.#t[i];s.set(i,a)});const e=Object.fromEntries(s),t=JSON.stringify(e);p.setHash(this.#s,t)}#u(s=!1){const e=new Map;let t=this.#o,i="state:"+this.#s;s&&(t=this.#n,i="state:"+this.#s+":"+location.pathname),t.forEach(o=>{const r=localStorage.getItem(i+":"+o);e.set(o,r)});const a=this.#d(e);this.#h(a)}#p(s=!1){const e=new Map;let t=this.#o,i="state:"+this.#s;s&&(t=this.#n,i="state:"+this.#s+":"+location.pathname),t.forEach(o=>{const r=this.#t[o];e.set(o,r)});const a=this.#f(e);t.forEach(o=>{const r=a.get(o);localStorage.setItem(i+":"+o,r)})}#S(){var a,o,r;const s=(o=(a=this.#i)==null?void 0:a.guest_data)==null?void 0:o.data;if(!s)return;this.#i.id===-1&&(this.#i.positionsReverseDates=s.positionsReverseDates);const e=new Map;this.#r.forEach(h=>{const u=s[h];e.set(h,u)});const t=this.#d(e);this.#h(t);const i=$(".mod_guest_title");if(((r=this.#t.competitorsIds)==null?void 0:r.length)===1&&this.#e.page.data.competitors){let h=this.#e.page.data.competitors.filter(u=>u.id===s.competitorsIds[0]);h.length&&($("a",i).attr("href","http://"+h[0].url),$("a",i).text(h[0].name))}}#k(){this.#t.regionsIndexes&&d.watch(this.#t.regionsIndexes,s=>{if(!s.length)return;s.forEach((i,a)=>s[a]=i);const e=TplProjectSelectorRegion.genSearchersMap(),t=[];e.forEach(i=>{i.regions.forEach(a=>{a.index!==-1&&t.push(a.index)})}),this.#t.regionsIndexes=s.filter(i=>t.includes(i))},{immediate:!0}),this.#t.competitorsIds&&d.watch(this.#t.competitorsIds,s=>{if(!s.length)return;s.forEach((t,i)=>s[i]=t);const e=[this.#e.page.data.project.id];this.#e.page.data.project.competitors.forEach(t=>{t.on>=0&&e.push(t.id)}),this.#t.competitorsIds=s.filter(t=>e.includes(t))},{immediate:!0})}}const w=f=>{var e,t,i,a;const s=f;!((e=s.options.tpaNamesUrlHash)!=null&&e.length)&&!((t=s.options.tpaNamesStorage)!=null&&t.length)&&!((i=s.options.tpaNamesStorageLocal)!=null&&i.length)&&!((a=s.options.tpaNamesGuestLink)!=null&&a.length)||new E(s)};n.Core=c.Core,n.i18nPlugin=c.i18n,n.useI18n=c.useI18n,n.useI18nLang=c.useI18nLang,n.corePlugin=l.core,n.useAsyncTopDialog=g.useAsyncTopDialog,n.useTopDialog=g.useTopDialog,n.TopDialogWorker=k.TopDialogWorker,n.piniaTPAPlugin=w,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=app.amd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.amd.js","sources":["../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { PiniaPluginContext, Store } from 'pinia';\nimport { watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { debounce } from '@/core/utils/lodash';\nimport { guestLinkToClipboard } from '@/core/utils/clipboard';\nimport { camelToSnakeCase } from '@/core/utils/string.js';\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\nimport { getHash, setHash } from '@/core/utils/route';\n\ntype OpenAPIPath = keyof OpenAPIPaths;\n\nclass PiniaTPA {\n\n\treadonly #storeId: string;\n\treadonly #store: Store<string, any>;\n\n\t/**\n\t * @deprecated\n\t */\n\treadonly #Page: any;\n\n\treadonly #user: any;\n\treadonly #Api: any;\n\n\treadonly #namesUrlHash: string[] = [];\n\treadonly #namesStorage: string[] = [];\n\treadonly #namesStorageLocal: string[] = [];\n\treadonly #namesGuestLink: string[] = [];\n\n\tconstructor(context: Context) {\n\t\tthis.#store = context.store;\n\t\tthis.#storeId = this.#store.$id;\n\n\t\tthis.#Page = context.options.Page;\n\n\t\tthis.#user = context.options.user;\n\t\tthis.#Api = context.options.Api;\n\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\n\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\n\n\t\tif (!this.#user.guest_data?.data) {\n\t\t\tthis.#loadFromStorage();\n\t\t\tthis.#loadFromStorage(true);\n\n\t\t\t// настройки URL hash имеют приоритет\n\t\t\tthis.#loadFromHash();\n\t\t}\n\n\t\t// настройки гостевой ссылки имеют приоритет\n\t\tthis.#loadFromGuestLink();\n\n\t\tthis.#prepareParams();\n\n\t\tconst save = debounce(() => {\n\t\t\tthis.#saveInHash();\n\t\t\tthis.#saveInStorage();\n\t\t});\n\n\t\tcontext.store.$subscribe(save);\n\t}\n\n\t/**\n\t * Сгенерировать гостевую ссылку\n\t *\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\n\t */\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\n\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tif (res?.errors) return;\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tawait guestLinkToClipboard(res.result);\n\t}\n\n\t/**\n\t * Сгенерировать опции для гостевой ссылки\n\t */\n\t#genOptionsForGuestLink() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesGuestLink.forEach(name => {\n\t\t\t// формат параметров API: snake_case\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из объекта без фиксации состояния\n\t */\n\t#setOptions(data: Map<string, any>) {\n\t\tdata.forEach((value, name) => {\n\t\t\tconst currentValue = this.#store[name];\n\n\t\t\tif (value === null || value === undefined) return;\n\t\t\tif (currentValue === undefined) return;\n\t\t\tif (!value?.constructor) return;\n\t\t\tif (value.constructor !== currentValue.constructor) return;\n\n\t\t\t// дополнительная проверка на формат даты\n\t\t\tif (name.indexOf('date') === 0) {\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t// value.forEach((valueI) => {\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\n\t\t\t\t\t// });\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof (value) === 'string') {\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#store[name] = value;\n\t\t});\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\n\t */\n\t#genDataFormat(data: Map<string, any>) {\n\t\tconst dataFormatted = new Map();\n\n\t\tdata.forEach((value, name) => {\n\t\t\tif (value === null) return;\n\n\t\t\tvalue = JSON.stringify(value);\n\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\treturn dataFormatted;\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\n\t */\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tdataFormatted.forEach((value, name) => {\n\t\t\tif (value === null || value === undefined || value === 'false') return;\n\n\t\t\ttry {\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\n\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\n\t\t\t} catch (e) {\n\t\t\t\t// не json строка\n\t\t\t}\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из хеша адреса страницы\n\t */\n\t#loadFromHash() {\n\t\tlet dataHash: any;\n\t\ttry {\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\n\t\t} catch (e) {\n\n\t\t}\n\t\tif (!dataHash) return;\n\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = dataHash[name];\n\t\t\tif (!value) return;\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в хеш адреса страницы\n\t */\n\t#saveInHash() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataObject = Object.fromEntries(data);\n\t\tconst dataJSON = JSON.stringify(dataObject);\n\n\t\tsetHash(this.#storeId, dataJSON);\n\t};\n\n\t/**\n\t * Установить опции из localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#loadFromStorage(isLocal = false) {\n\t\tconst dataFormatted = new Map();\n\n\t\t// let names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\t// names = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tthis.#namesStorage.forEach((name) => {\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#saveInStorage(isLocal = false) {\n\t\tconst data = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataFormatted = this.#genDataFormat(data);\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = dataFormatted.get(name);\n\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\n\t\t});\n\t}\n\n\t/**\n\t * Установить опции из гостевой ссылки\n\t */\n\t#loadFromGuestLink() {\n\t\tconst guestData = this.#user?.guest_data?.data;\n\t\tif (!guestData) return;\n\n\t\t// общие правила для гостевых сессий\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\n\n\t\tconst dataFormatted = new Map();\n\n\t\tthis.#namesGuestLink.forEach((name) => {\n\t\t\tconst value = guestData[name];\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\n\t\tconst $guestTitle = $('.mod_guest_title');\n\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\n\t\t\tif (competitors.length) {\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Подготовить входные параметры перед инициализацией основного функционала\n\t *\n\t * Входные параметры устанавливаются при открытии страницы\n\t *\n\t * Входные параметры могут меняться пользоваталем и устаревать\n\t */\n\t#prepareParams() {\n\t\t// контролль за вводом регионов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.regionsIndexes) {\n\t\t\twatch(this.#store.regionsIndexes, (regionsIndexes) => {\n\t\t\t\tif (!regionsIndexes.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\n\n\t\t\t\t// оставить только включенные регионы\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\n\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\n\t\t\t}, { immediate: true });\n\t\t}\n\n\t\t// контролль за вводом конкурентов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds) {\n\t\t\twatch(this.#store.competitorsIds, (competitorsIds) => {\n\t\t\t\tif (!competitorsIds.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorsIds[index] = competitorId);\n\n\t\t\t\t// оставить только включенных конкурентов\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\n\t\t\t\t});\n\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\n\t\t\t}, { immediate: true });\n\t\t}\n\t}\n\n}\n\ntype Options = {\n\t/**\n\t * TODO: Убрать из плагина\n\t */\n\tPage: any,\n\n\t/**\n\t * Объект с настройками пользователя\n\t */\n\tuser: any,\n\n\t/**\n\t * Объект для работы с API\n\t *\n\t * См. на сайте: @/component/api/core/api.ts\n\t */\n\tApi: any;\n\n\t/**\n\t * Имена свойств для сохранения в URL\n\t */\n\ttpaNamesUrlHash?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage\n\t */\n\ttpaNamesStorage?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\n\t *\n\t * Каждый URL будет работать со своим состоянием\n\t */\n\ttpaNamesStorageLocal?: string[],\n\n\t/**\n\t * Имена свойств для работы с гостевой ссылкой\n\t *\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\n\t */\n\ttpaNamesGuestLink?: string[],\n};\n\ntype Context = PiniaPluginContext & {\n\toptions: Options\n};\n\n/**\n * Плагин tpa (Third-party access) для pinia\n *\n * Добавляет возможность сохранять и загружать данные в/из:\n * \t- URL hash в адресе страницы\n * \t- localStorage\n * \t- гостевая ссылка\n *\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\n * - tpaNamesUrlHash\n * - tpaNamesStorage\n * - tpaNamesStorageLocal\n * - tpaNamesGuestLink\n */\nexport default (contextPinia: PiniaPluginContext) => {\n\tconst context = contextPinia as Context;\n\n\t// плагин подключать не нужно\n\tif (\n\t\t!context.options.tpaNamesUrlHash?.length &&\n\t\t!context.options.tpaNamesStorage?.length &&\n\t\t!context.options.tpaNamesStorageLocal?.length &&\n\t\t!context.options.tpaNamesGuestLink?.length\n\t) {\n\t\treturn;\n\t}\n\n\tnew PiniaTPA(context);\n}\n"],"names":["PiniaTPA","#storeId","#store","#Page","#user","#Api","context","url","data","#loadFromStorage","save","forms","dataGuestLink","#genOptionsForGuestLink","res","utils_clipboard","nameSnakeCase","utils_string","name","currentValue","value","dataFormatted","#loadFromHash","dataHash","utils_route","#setOptions","#saveInHash","dataJSON","isLocal","storageNamespace","#saveInStorage","names","#namesStorage","#namesStorageLocal","#loadFromGuestLink","guestData","$guestTitle","competitors","competitor","#prepareParams","regionsIndexes","regionIndex","index","mapSearchers","searcher","region","availableRegionsIndexes","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_a","_b","_c","_d"],"mappings":"wVAYA,MAAAA,CAAA,CAAeC,GAELC,GACAC,GAKAC,GAEAC,gDASR,KAAAH,GAAAI,EAAA,6PAaAA,EAAA,MAAA,aAAA,CAAAC,EAAAC,IAAA,KAAA,aAAAD,EAAAC,CAAA,mDAIC,KAAAC,GAAA,EAAA,iCAWD,MAAAC,EAAAC,EAAA,SAAA,IAAA,oBAEqB,CAAA,EAGrBL,EAAA,MAAA,WAAAI,CAAA,CAA6B,CAC9B,MAAA,aAAAH,EAAAC,EAAA,CAQC,MAAAI,EAAA,KAAAC,GAAA,EACAL,EAAA,OAAA,OAAAA,EAAA,OAAA,YAAAI,CAAA,CAAA,wDAKAE,GAAA,MAAAA,EAAA,QAGA,MAAAC,EAAA,qBAAAD,EAAA,MAAA,CAAqC,CACtCD,IAAA,CAMC,MAAAL,EAAA,IAAA,+BAIC,MAAAQ,EAAAC,EAAA,iBAAAC,CAAA,EACAV,EAAA,IAAAQ,EAAA,KAAAd,GAAAgB,CAAA,CAAA,CAAyC,CAAA,EAG1CV,CAAO,wDAWNW,IAAA,QACAC,GAAA,MAAAA,EAAA,yFAUE,GAAA,OAAAA,GAAA,+CAMF,KAAAlB,GAAAgB,CAAA,EAAAE,EAAoB,CAAA,CACpB,OAOD,MAAAC,EAAA,IAAA,6BAGCD,IAAA,OAEAA,EAAA,KAAA,UAAAA,CAAA,EAEAC,EAAA,IAAAH,EAAAE,CAAA,EAA6B,CAAA,EAG9BC,CAAO,OAOP,MAAAb,EAAA,IAAA,6BAGC,GAAA,EAAAY,GAAA,MAAAA,IAAA,SAEA,IAAA,CAGC,0EAAAA,GAAA,MAAAA,IAAA,QAAA,aACW,CAIZZ,EAAA,IAAAU,EAAAE,CAAA,EAAoB,CAAA,EAGrBZ,CAAO,CACRc,IAAA,CAMC,IAAAC,EACA,GAAA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AA,QAAA,oBAAA,MAAAiD,EAAA,SASA,IAAAvD,EAAAM,CAAA"}
1
+ {"version":3,"file":"app.amd.js","sources":["../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { PiniaPluginContext, Store } from 'pinia';\nimport { watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { debounce } from '@/core/utils/lodash';\nimport { guestLinkToClipboard } from '@/core/utils/clipboard';\nimport { camelToSnakeCase } from '@/core/utils/string.js';\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\nimport { getHash, setHash } from '@/core/utils/route';\n\ntype OpenAPIPath = keyof OpenAPIPaths;\n\nclass PiniaTPA {\n\n\treadonly #storeId: string;\n\treadonly #store: Store<string, any>;\n\n\t/**\n\t * @deprecated\n\t */\n\treadonly #Page: any;\n\n\treadonly #user: any;\n\treadonly #Api: any;\n\n\treadonly #namesUrlHash: string[] = [];\n\treadonly #namesStorage: string[] = [];\n\treadonly #namesStorageLocal: string[] = [];\n\treadonly #namesGuestLink: string[] = [];\n\n\tconstructor(context: Context) {\n\t\tthis.#store = context.store;\n\t\tthis.#storeId = this.#store.$id;\n\n\t\tthis.#Page = context.options.Page;\n\n\t\tthis.#user = context.options.user;\n\t\tthis.#Api = context.options.Api;\n\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\n\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\n\n\t\tif (!this.#user.guest_data?.data) {\n\t\t\tthis.#loadFromStorage();\n\t\t\tthis.#loadFromStorage(true);\n\n\t\t\t// настройки URL hash имеют приоритет\n\t\t\tthis.#loadFromHash();\n\t\t}\n\n\t\t// настройки гостевой ссылки имеют приоритет\n\t\tthis.#loadFromGuestLink();\n\n\t\tthis.#prepareParams();\n\n\t\tconst save = debounce(() => {\n\t\t\tthis.#saveInHash();\n\t\t\tthis.#saveInStorage();\n\t\t\tthis.#saveInStorage(true);\n\t\t});\n\n\t\tcontext.store.$subscribe(save);\n\t}\n\n\t/**\n\t * Сгенерировать гостевую ссылку\n\t *\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\n\t */\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\n\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tif (res?.errors) return;\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tawait guestLinkToClipboard(res.result);\n\t}\n\n\t/**\n\t * Сгенерировать опции для гостевой ссылки\n\t */\n\t#genOptionsForGuestLink() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesGuestLink.forEach(name => {\n\t\t\t// формат параметров API: snake_case\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из объекта без фиксации состояния\n\t */\n\t#setOptions(data: Map<string, any>) {\n\t\tdata.forEach((value, name) => {\n\t\t\tconst currentValue = this.#store[name];\n\n\t\t\tif (value === null || value === undefined) return;\n\t\t\tif (currentValue === undefined) return;\n\t\t\tif (!value?.constructor) return;\n\t\t\tif (value.constructor !== currentValue.constructor) return;\n\n\t\t\t// дополнительная проверка на формат даты\n\t\t\tif (name.indexOf('date') === 0) {\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t// value.forEach((valueI) => {\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\n\t\t\t\t\t// });\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof (value) === 'string') {\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#store[name] = value;\n\t\t});\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\n\t */\n\t#genDataFormat(data: Map<string, any>) {\n\t\tconst dataFormatted = new Map();\n\n\t\tdata.forEach((value, name) => {\n\t\t\tif (value === null) return;\n\n\t\t\tvalue = JSON.stringify(value);\n\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\treturn dataFormatted;\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\n\t */\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tdataFormatted.forEach((value, name) => {\n\t\t\tif (value === null || value === undefined || value === 'false') return;\n\n\t\t\ttry {\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\n\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\n\t\t\t} catch (e) {\n\t\t\t\t// не json строка\n\t\t\t}\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из хеша адреса страницы\n\t */\n\t#loadFromHash() {\n\t\tlet dataHash: any;\n\t\ttry {\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\n\t\t} catch (e) {\n\n\t\t}\n\t\tif (!dataHash) return;\n\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = dataHash[name];\n\t\t\tif (!value) return;\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в хеш адреса страницы\n\t */\n\t#saveInHash() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataObject = Object.fromEntries(data);\n\t\tconst dataJSON = JSON.stringify(dataObject);\n\n\t\tsetHash(this.#storeId, dataJSON);\n\t};\n\n\t/**\n\t * Установить опции из localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#loadFromStorage(isLocal = false) {\n\t\tconst dataFormatted = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#saveInStorage(isLocal = false) {\n\t\tconst data = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataFormatted = this.#genDataFormat(data);\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = dataFormatted.get(name);\n\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\n\t\t});\n\t}\n\n\t/**\n\t * Установить опции из гостевой ссылки\n\t */\n\t#loadFromGuestLink() {\n\t\tconst guestData = this.#user?.guest_data?.data;\n\t\tif (!guestData) return;\n\n\t\t// общие правила для гостевых сессий\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\n\n\t\tconst dataFormatted = new Map();\n\n\t\tthis.#namesGuestLink.forEach((name) => {\n\t\t\tconst value = guestData[name];\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\n\t\tconst $guestTitle = $('.mod_guest_title');\n\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\n\t\t\tif (competitors.length) {\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Подготовить входные параметры перед инициализацией основного функционала\n\t *\n\t * Входные параметры устанавливаются при открытии страницы\n\t *\n\t * Входные параметры могут меняться пользоваталем и устаревать\n\t */\n\t#prepareParams() {\n\t\t// контролль за вводом регионов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.regionsIndexes) {\n\t\t\twatch(this.#store.regionsIndexes, (regionsIndexes) => {\n\t\t\t\tif (!regionsIndexes.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\n\n\t\t\t\t// оставить только включенные регионы\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\n\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\n\t\t\t}, { immediate: true });\n\t\t}\n\n\t\t// контролль за вводом конкурентов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds) {\n\t\t\twatch(this.#store.competitorsIds, (competitorsIds) => {\n\t\t\t\tif (!competitorsIds.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorsIds[index] = competitorId);\n\n\t\t\t\t// оставить только включенных конкурентов\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\n\t\t\t\t});\n\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\n\t\t\t}, { immediate: true });\n\t\t}\n\t}\n\n}\n\ntype Options = {\n\t/**\n\t * TODO: Убрать из плагина\n\t */\n\tPage: any,\n\n\t/**\n\t * Объект с настройками пользователя\n\t */\n\tuser: any,\n\n\t/**\n\t * Объект для работы с API\n\t *\n\t * См. на сайте: @/component/api/core/api.ts\n\t */\n\tApi: any;\n\n\t/**\n\t * Имена свойств для сохранения в URL\n\t */\n\ttpaNamesUrlHash?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage\n\t */\n\ttpaNamesStorage?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\n\t *\n\t * Каждый URL будет работать со своим состоянием\n\t */\n\ttpaNamesStorageLocal?: string[],\n\n\t/**\n\t * Имена свойств для работы с гостевой ссылкой\n\t *\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\n\t */\n\ttpaNamesGuestLink?: string[],\n};\n\ntype Context = PiniaPluginContext & {\n\toptions: Options\n};\n\n/**\n * Плагин tpa (Third-party access) для pinia\n *\n * Добавляет возможность сохранять и загружать данные в/из:\n * \t- URL hash в адресе страницы\n * \t- localStorage\n * \t- гостевая ссылка\n *\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\n * - tpaNamesUrlHash\n * - tpaNamesStorage\n * - tpaNamesStorageLocal\n * - tpaNamesGuestLink\n */\nexport default (contextPinia: PiniaPluginContext) => {\n\tconst context = contextPinia as Context;\n\n\t// плагин подключать не нужно\n\tif (\n\t\t!context.options.tpaNamesUrlHash?.length &&\n\t\t!context.options.tpaNamesStorage?.length &&\n\t\t!context.options.tpaNamesStorageLocal?.length &&\n\t\t!context.options.tpaNamesGuestLink?.length\n\t) {\n\t\treturn;\n\t}\n\n\tnew PiniaTPA(context);\n}\n"],"names":["PiniaTPA","#storeId","#store","#Page","#user","#Api","context","url","data","#loadFromStorage","save","forms","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","utils_clipboard","nameSnakeCase","utils_string","name","currentValue","value","dataFormatted","#loadFromHash","dataHash","utils_route","#setOptions","#saveInHash","dataJSON","isLocal","names","#namesStorage","storageNamespace","#namesStorageLocal","#loadFromGuestLink","guestData","$guestTitle","competitors","competitor","#prepareParams","regionsIndexes","regionIndex","index","mapSearchers","searcher","region","availableRegionsIndexes","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_a","_b","_c","_d"],"mappings":"wVAYA,MAAAA,CAAA,CAAeC,GAELC,GACAC,GAKAC,GAEAC,gDASR,KAAAH,GAAAI,EAAA,6PAaAA,EAAA,MAAA,aAAA,CAAAC,EAAAC,IAAA,KAAA,aAAAD,EAAAC,CAAA,mDAIC,KAAAC,GAAA,EAAA,iCAWD,MAAAC,EAAAC,EAAA,SAAA,IAAA,qBAGC,KAAAC,GAAA,EAAA,CAAwB,CAAA,EAGzBN,EAAA,MAAA,WAAAI,CAAA,CAA6B,CAC9B,MAAA,aAAAH,EAAAC,EAAA,CAQC,MAAAK,EAAA,KAAAC,GA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AAA,QAAA,IAEAC,EAAA,KAAAD,EAAA,KAAA,CAAyC,CAAA,CACzC,CAAA,EAGF,KAAA3C,GAAA,eAAAsC,EAAA,OAAAC,GAAAK,EAAA,SAAAL,CAAA,CAAA,CAAyH,EAAA,CAAA,UAAA,EAAA,CAAA,EAM3H,KAAAvC,GAAA,mDAEE,GAAA,CAAA6C,EAAA,OAAA,OAGAA,EAAA,QAAA,CAAAC,EAAAN,IAAAK,EAAAL,CAAA,EAAAM,CAAA,EAGA,MAAAC,EAAA,CAAA,KAAA9C,GAAA,KAAA,KAAA,QAAA,EAAA,EACA,KAAAA,GAAA,KAAA,KAAA,QAAA,YAAA,QAAAmC,GAAA,CACCA,EAAA,IAAA,GAAAW,EAAA,KAAAX,EAAA,EAAA,CAAkE,CAAA,EAGnE,KAAApC,GAAA,eAAA6C,EAAA,OAAAC,GAAAC,EAAA,SAAAD,CAAA,CAAA,CAA2H,EAAA,CAAA,UAAA,EAAA,CAAA,CAE7H,CAGF,CA+DA,MAAAE,EAAAC,GAAA,uBAIC,GAAAC,EAAA9C,EAAA,QAAA,kBAAA,MAAA8C,EAAA,SAAA,GAAAC,EAAA/C,EAAA,QAAA,kBAAA,MAAA+C,EAAA,SAAA,GAAAC,EAAAhD,EAAA,QAAA,uBAAA,MAAAgD,EAAA,SAAA,GAAAC,EAAAjD,EAAA,QAAA,oBAAA,MAAAiD,EAAA,SASA,IAAAvD,EAAAM,CAAA"}
package/core/app.js CHANGED
@@ -15,16 +15,16 @@ class u {
15
15
  */
16
16
  #e;
17
17
  #a;
18
- #h;
18
+ #c;
19
19
  #i = [];
20
20
  #o = [];
21
- #c = [];
22
21
  #r = [];
22
+ #n = [];
23
23
  constructor(s) {
24
24
  var t;
25
- this.#t = s.store, this.#s = this.#t.$id, this.#e = s.options.Page, this.#a = s.options.user, this.#h = s.options.Api, this.#i = s.options.tpaNamesUrlHash || [], this.#o = s.options.tpaNamesStorage || [], this.#c = s.options.tpaNamesStorageLocal || [], this.#r = s.options.tpaNamesGuestLink || [], s.store.genGuestLink = (a, i) => this.genGuestLink(a, i), (t = this.#a.guest_data) != null && t.data || (this.#d(), this.#d(!0), this.#m()), this.#S(), this.#E();
25
+ this.#t = s.store, this.#s = this.#t.$id, this.#e = s.options.Page, this.#a = s.options.user, this.#c = s.options.Api, this.#i = s.options.tpaNamesUrlHash || [], this.#o = s.options.tpaNamesStorage || [], this.#r = s.options.tpaNamesStorageLocal || [], this.#n = s.options.tpaNamesGuestLink || [], s.store.genGuestLink = (a, i) => this.genGuestLink(a, i), (t = this.#a.guest_data) != null && t.data || (this.#d(), this.#d(!0), this.#l()), this.#S(), this.#E();
26
26
  const e = d(() => {
27
- this.#l(), this.#u();
27
+ this.#u(), this.#f(), this.#f(!0);
28
28
  });
29
29
  s.store.$subscribe(e);
30
30
  }
@@ -34,17 +34,17 @@ class u {
34
34
  * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку
35
35
  */
36
36
  async genGuestLink(s, e) {
37
- const t = this.#f();
37
+ const t = this.#g();
38
38
  e = Object.assign(e, Object.fromEntries(t));
39
- const a = await this.#h.gen(s, "fetchColumn").call({}, e);
39
+ const a = await this.#c.gen(s, "fetchColumn").call({}, e);
40
40
  a != null && a.errors || await f(a.result);
41
41
  }
42
42
  /**
43
43
  * Сгенерировать опции для гостевой ссылки
44
44
  */
45
- #f() {
45
+ #g() {
46
46
  const s = /* @__PURE__ */ new Map();
47
- return this.#r.forEach((e) => {
47
+ return this.#n.forEach((e) => {
48
48
  const t = g(e);
49
49
  s.set(t, this.#t[e]);
50
50
  }), s;
@@ -52,7 +52,7 @@ class u {
52
52
  /**
53
53
  * Установить опции из объекта без фиксации состояния
54
54
  */
55
- #n(s) {
55
+ #h(s) {
56
56
  s.forEach((e, t) => {
57
57
  const a = this.#t[t];
58
58
  if (e != null && a !== void 0 && e != null && e.constructor && e.constructor === a.constructor) {
@@ -67,7 +67,7 @@ class u {
67
67
  /**
68
68
  * Сгенерировать Map объект с опциями со значениями в виде json строк
69
69
  */
70
- #g(s) {
70
+ #m(s) {
71
71
  const e = /* @__PURE__ */ new Map();
72
72
  return s.forEach((t, a) => {
73
73
  t !== null && (t = JSON.stringify(t), e.set(a, t));
@@ -91,7 +91,7 @@ class u {
91
91
  /**
92
92
  * Установить опции из хеша адреса страницы
93
93
  */
94
- #m() {
94
+ #l() {
95
95
  let s;
96
96
  try {
97
97
  s = JSON.parse(m(this.#s));
@@ -102,12 +102,12 @@ class u {
102
102
  this.#i.forEach((t) => {
103
103
  const a = s[t];
104
104
  a && e.set(t, a);
105
- }), this.#n(e);
105
+ }), this.#h(e);
106
106
  }
107
107
  /**
108
108
  * Сохранить опции в хеш адреса страницы
109
109
  */
110
- #l() {
110
+ #u() {
111
111
  const s = /* @__PURE__ */ new Map();
112
112
  this.#i.forEach((a) => {
113
113
  const i = this.#t[a];
@@ -122,26 +122,26 @@ class u {
122
122
  */
123
123
  #d(s = !1) {
124
124
  const e = /* @__PURE__ */ new Map();
125
- let t = "state:" + this.#s;
126
- s && (t = "state:" + this.#s + ":" + location.pathname), this.#o.forEach((i) => {
127
- const o = localStorage.getItem(t + ":" + i);
128
- e.set(i, o);
125
+ let t = this.#o, a = "state:" + this.#s;
126
+ s && (t = this.#r, a = "state:" + this.#s + ":" + location.pathname), t.forEach((o) => {
127
+ const r = localStorage.getItem(a + ":" + o);
128
+ e.set(o, r);
129
129
  });
130
- const a = this.#p(e);
131
- this.#n(a);
130
+ const i = this.#p(e);
131
+ this.#h(i);
132
132
  }
133
133
  /**
134
134
  * Сохранить опции в localStorage
135
135
  * @param isLocal - сохранить с учетом адреса страницы
136
136
  */
137
- #u(s = !1) {
137
+ #f(s = !1) {
138
138
  const e = /* @__PURE__ */ new Map();
139
139
  let t = this.#o, a = "state:" + this.#s;
140
- s && (t = this.#c, a = "state:" + this.#s + ":" + location.pathname), t.forEach((o) => {
140
+ s && (t = this.#r, a = "state:" + this.#s + ":" + location.pathname), t.forEach((o) => {
141
141
  const r = this.#t[o];
142
142
  e.set(o, r);
143
143
  });
144
- const i = this.#g(e);
144
+ const i = this.#m(e);
145
145
  t.forEach((o) => {
146
146
  const r = i.get(o);
147
147
  localStorage.setItem(a + ":" + o, r);
@@ -156,12 +156,12 @@ class u {
156
156
  if (!s) return;
157
157
  this.#a.id === -1 && (this.#a.positionsReverseDates = s.positionsReverseDates);
158
158
  const e = /* @__PURE__ */ new Map();
159
- this.#r.forEach((n) => {
159
+ this.#n.forEach((n) => {
160
160
  const h = s[n];
161
161
  e.set(n, h);
162
162
  });
163
163
  const t = this.#p(e);
164
- this.#n(t);
164
+ this.#h(t);
165
165
  const a = $(".mod_guest_title");
166
166
  if (((r = this.#t.competitorsIds) == null ? void 0 : r.length) === 1 && this.#e.page.data.competitors) {
167
167
  let n = this.#e.page.data.competitors.filter((h) => h.id === s.competitorsIds[0]);
package/core/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sources":["../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { PiniaPluginContext, Store } from 'pinia';\nimport { watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { debounce } from '@/core/utils/lodash';\nimport { guestLinkToClipboard } from '@/core/utils/clipboard';\nimport { camelToSnakeCase } from '@/core/utils/string.js';\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\nimport { getHash, setHash } from '@/core/utils/route';\n\ntype OpenAPIPath = keyof OpenAPIPaths;\n\nclass PiniaTPA {\n\n\treadonly #storeId: string;\n\treadonly #store: Store<string, any>;\n\n\t/**\n\t * @deprecated\n\t */\n\treadonly #Page: any;\n\n\treadonly #user: any;\n\treadonly #Api: any;\n\n\treadonly #namesUrlHash: string[] = [];\n\treadonly #namesStorage: string[] = [];\n\treadonly #namesStorageLocal: string[] = [];\n\treadonly #namesGuestLink: string[] = [];\n\n\tconstructor(context: Context) {\n\t\tthis.#store = context.store;\n\t\tthis.#storeId = this.#store.$id;\n\n\t\tthis.#Page = context.options.Page;\n\n\t\tthis.#user = context.options.user;\n\t\tthis.#Api = context.options.Api;\n\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\n\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\n\n\t\tif (!this.#user.guest_data?.data) {\n\t\t\tthis.#loadFromStorage();\n\t\t\tthis.#loadFromStorage(true);\n\n\t\t\t// настройки URL hash имеют приоритет\n\t\t\tthis.#loadFromHash();\n\t\t}\n\n\t\t// настройки гостевой ссылки имеют приоритет\n\t\tthis.#loadFromGuestLink();\n\n\t\tthis.#prepareParams();\n\n\t\tconst save = debounce(() => {\n\t\t\tthis.#saveInHash();\n\t\t\tthis.#saveInStorage();\n\t\t});\n\n\t\tcontext.store.$subscribe(save);\n\t}\n\n\t/**\n\t * Сгенерировать гостевую ссылку\n\t *\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\n\t */\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\n\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tif (res?.errors) return;\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tawait guestLinkToClipboard(res.result);\n\t}\n\n\t/**\n\t * Сгенерировать опции для гостевой ссылки\n\t */\n\t#genOptionsForGuestLink() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesGuestLink.forEach(name => {\n\t\t\t// формат параметров API: snake_case\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из объекта без фиксации состояния\n\t */\n\t#setOptions(data: Map<string, any>) {\n\t\tdata.forEach((value, name) => {\n\t\t\tconst currentValue = this.#store[name];\n\n\t\t\tif (value === null || value === undefined) return;\n\t\t\tif (currentValue === undefined) return;\n\t\t\tif (!value?.constructor) return;\n\t\t\tif (value.constructor !== currentValue.constructor) return;\n\n\t\t\t// дополнительная проверка на формат даты\n\t\t\tif (name.indexOf('date') === 0) {\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t// value.forEach((valueI) => {\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\n\t\t\t\t\t// });\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof (value) === 'string') {\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#store[name] = value;\n\t\t});\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\n\t */\n\t#genDataFormat(data: Map<string, any>) {\n\t\tconst dataFormatted = new Map();\n\n\t\tdata.forEach((value, name) => {\n\t\t\tif (value === null) return;\n\n\t\t\tvalue = JSON.stringify(value);\n\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\treturn dataFormatted;\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\n\t */\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tdataFormatted.forEach((value, name) => {\n\t\t\tif (value === null || value === undefined || value === 'false') return;\n\n\t\t\ttry {\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\n\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\n\t\t\t} catch (e) {\n\t\t\t\t// не json строка\n\t\t\t}\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из хеша адреса страницы\n\t */\n\t#loadFromHash() {\n\t\tlet dataHash: any;\n\t\ttry {\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\n\t\t} catch (e) {\n\n\t\t}\n\t\tif (!dataHash) return;\n\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = dataHash[name];\n\t\t\tif (!value) return;\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в хеш адреса страницы\n\t */\n\t#saveInHash() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataObject = Object.fromEntries(data);\n\t\tconst dataJSON = JSON.stringify(dataObject);\n\n\t\tsetHash(this.#storeId, dataJSON);\n\t};\n\n\t/**\n\t * Установить опции из localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#loadFromStorage(isLocal = false) {\n\t\tconst dataFormatted = new Map();\n\n\t\t// let names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\t// names = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tthis.#namesStorage.forEach((name) => {\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#saveInStorage(isLocal = false) {\n\t\tconst data = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataFormatted = this.#genDataFormat(data);\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = dataFormatted.get(name);\n\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\n\t\t});\n\t}\n\n\t/**\n\t * Установить опции из гостевой ссылки\n\t */\n\t#loadFromGuestLink() {\n\t\tconst guestData = this.#user?.guest_data?.data;\n\t\tif (!guestData) return;\n\n\t\t// общие правила для гостевых сессий\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\n\n\t\tconst dataFormatted = new Map();\n\n\t\tthis.#namesGuestLink.forEach((name) => {\n\t\t\tconst value = guestData[name];\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\n\t\tconst $guestTitle = $('.mod_guest_title');\n\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\n\t\t\tif (competitors.length) {\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Подготовить входные параметры перед инициализацией основного функционала\n\t *\n\t * Входные параметры устанавливаются при открытии страницы\n\t *\n\t * Входные параметры могут меняться пользоваталем и устаревать\n\t */\n\t#prepareParams() {\n\t\t// контролль за вводом регионов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.regionsIndexes) {\n\t\t\twatch(this.#store.regionsIndexes, (regionsIndexes) => {\n\t\t\t\tif (!regionsIndexes.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\n\n\t\t\t\t// оставить только включенные регионы\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\n\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\n\t\t\t}, { immediate: true });\n\t\t}\n\n\t\t// контролль за вводом конкурентов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds) {\n\t\t\twatch(this.#store.competitorsIds, (competitorsIds) => {\n\t\t\t\tif (!competitorsIds.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorsIds[index] = competitorId);\n\n\t\t\t\t// оставить только включенных конкурентов\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\n\t\t\t\t});\n\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\n\t\t\t}, { immediate: true });\n\t\t}\n\t}\n\n}\n\ntype Options = {\n\t/**\n\t * TODO: Убрать из плагина\n\t */\n\tPage: any,\n\n\t/**\n\t * Объект с настройками пользователя\n\t */\n\tuser: any,\n\n\t/**\n\t * Объект для работы с API\n\t *\n\t * См. на сайте: @/component/api/core/api.ts\n\t */\n\tApi: any;\n\n\t/**\n\t * Имена свойств для сохранения в URL\n\t */\n\ttpaNamesUrlHash?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage\n\t */\n\ttpaNamesStorage?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\n\t *\n\t * Каждый URL будет работать со своим состоянием\n\t */\n\ttpaNamesStorageLocal?: string[],\n\n\t/**\n\t * Имена свойств для работы с гостевой ссылкой\n\t *\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\n\t */\n\ttpaNamesGuestLink?: string[],\n};\n\ntype Context = PiniaPluginContext & {\n\toptions: Options\n};\n\n/**\n * Плагин tpa (Third-party access) для pinia\n *\n * Добавляет возможность сохранять и загружать данные в/из:\n * \t- URL hash в адресе страницы\n * \t- localStorage\n * \t- гостевая ссылка\n *\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\n * - tpaNamesUrlHash\n * - tpaNamesStorage\n * - tpaNamesStorageLocal\n * - tpaNamesGuestLink\n */\nexport default (contextPinia: PiniaPluginContext) => {\n\tconst context = contextPinia as Context;\n\n\t// плагин подключать не нужно\n\tif (\n\t\t!context.options.tpaNamesUrlHash?.length &&\n\t\t!context.options.tpaNamesStorage?.length &&\n\t\t!context.options.tpaNamesStorageLocal?.length &&\n\t\t!context.options.tpaNamesGuestLink?.length\n\t) {\n\t\treturn;\n\t}\n\n\tnew PiniaTPA(context);\n}\n"],"names":["PiniaTPA","#storeId","#store","#Page","#user","#Api","#namesUrlHash","#namesStorage","#namesStorageLocal","#namesGuestLink","context","url","data","_a","#loadFromStorage","#loadFromHash","#loadFromGuestLink","#prepareParams","save","debounce","#saveInHash","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","guestLinkToClipboard","name","nameSnakeCase","camelToSnakeCase","#setOptions","value","currentValue","#genDataFormat","dataFormatted","#genDataUnFormat","dataHash","getHash","dataObject","dataJSON","setHash","isLocal","storageNamespace","names","guestData","_b","$guestTitle","_c","competitors","competitor","watch","regionsIndexes","regionIndex","index","mapSearchers","availableRegionsIndexes","searcher","region","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_d"],"mappings":";;;;;;;;;AAYA,MAAMA,EAAS;AAAA,EAELC;AAAA,EACAC;AAAA;AAAA;AAAA;AAAA,EAKAC;AAAA,EAEAC;AAAA,EACAC;AAAA,EAEAC,KAA0B,CAAC;AAAA,EAC3BC,KAA0B,CAAC;AAAA,EAC3BC,KAA+B,CAAC;AAAA,EAChCC,KAA4B,CAAC;AAAA,EAEtC,YAAYC,GAAkB;;AAC7B,SAAKR,KAASQ,EAAQ,OACjB,KAAAT,KAAW,KAAKC,GAAO,KAEvB,KAAAC,KAAQO,EAAQ,QAAQ,MAExB,KAAAN,KAAQM,EAAQ,QAAQ,MACxB,KAAAL,KAAOK,EAAQ,QAAQ,KAE5B,KAAKJ,KAAgBI,EAAQ,QAAQ,mBAAmB,CAAC,GACzD,KAAKH,KAAgBG,EAAQ,QAAQ,mBAAmB,CAAC,GACzD,KAAKF,KAAqBE,EAAQ,QAAQ,wBAAwB,CAAC,GACnE,KAAKD,KAAkBC,EAAQ,QAAQ,qBAAqB,CAAC,GAErDA,EAAA,MAAM,eAAe,CAA2BC,GAAWC,MAAc,KAAK,aAAaD,GAAKC,CAAI,IAEvGC,IAAA,KAAKT,GAAM,eAAX,QAAAS,EAAuB,SAC3B,KAAKC,GAAiB,GACtB,KAAKA,GAAiB,EAAI,GAG1B,KAAKC,GAAc,IAIpB,KAAKC,GAAmB,GAExB,KAAKC,GAAe;AAEd,UAAAC,IAAOC,EAAS,MAAM;AAC3B,WAAKC,GAAY,GACjB,KAAKC,GAAe;AAAA,IAAA,CACpB;AAEO,IAAAX,EAAA,MAAM,WAAWQ,CAAI;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9B,MAAM,aAAuCP,GAAWC,GAA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,UAAA,CAACA,EAAe,OAAQ;AAG5B,MAAAA,EAAe,QAAQ,CAACC,GAAsBN,MAAkBK,EAAeL,CAAK,IAAIM,CAAY;AAGpG,YAAMC,IAA0B,CAAC,KAAKxD,GAAM,KAAK,KAAK,QAAQ,EAAE;AAChE,WAAKA,GAAM,KAAK,KAAK,QAAQ,YAAY,QAAQ,CAAC6C,MAAoB;AACrE,QAAIA,EAAW,MAAM,KAA2BW,EAAA,KAAKX,EAAW,EAAE;AAAA,MAAA,CAClE,GAEI,KAAA9C,GAAO,iBAAiBuD,EAAe,OAAO,CAACC,MAAyBC,EAAwB,SAASD,CAAY,CAAC;AAAA,IAAA,GACzH,EAAE,WAAW,IAAM;AAAA,EACvB;AAGF;AA+DA,MAAeE,IAAA,CAACC,MAAqC;;AACpD,QAAMnD,IAAUmD;AAGhB,EACC,GAAChD,IAAAH,EAAQ,QAAQ,oBAAhB,QAAAG,EAAiC,WAClC,GAAC+B,IAAAlC,EAAQ,QAAQ,oBAAhB,QAAAkC,EAAiC,WAClC,GAACE,IAAApC,EAAQ,QAAQ,yBAAhB,QAAAoC,EAAsC,WACvC,GAACgB,IAAApD,EAAQ,QAAQ,sBAAhB,QAAAoD,EAAmC,WAKrC,IAAI9D,EAASU,CAAO;AACrB;"}
1
+ {"version":3,"file":"app.js","sources":["../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { PiniaPluginContext, Store } from 'pinia';\nimport { watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { debounce } from '@/core/utils/lodash';\nimport { guestLinkToClipboard } from '@/core/utils/clipboard';\nimport { camelToSnakeCase } from '@/core/utils/string.js';\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\nimport { getHash, setHash } from '@/core/utils/route';\n\ntype OpenAPIPath = keyof OpenAPIPaths;\n\nclass PiniaTPA {\n\n\treadonly #storeId: string;\n\treadonly #store: Store<string, any>;\n\n\t/**\n\t * @deprecated\n\t */\n\treadonly #Page: any;\n\n\treadonly #user: any;\n\treadonly #Api: any;\n\n\treadonly #namesUrlHash: string[] = [];\n\treadonly #namesStorage: string[] = [];\n\treadonly #namesStorageLocal: string[] = [];\n\treadonly #namesGuestLink: string[] = [];\n\n\tconstructor(context: Context) {\n\t\tthis.#store = context.store;\n\t\tthis.#storeId = this.#store.$id;\n\n\t\tthis.#Page = context.options.Page;\n\n\t\tthis.#user = context.options.user;\n\t\tthis.#Api = context.options.Api;\n\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\n\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\n\n\t\tif (!this.#user.guest_data?.data) {\n\t\t\tthis.#loadFromStorage();\n\t\t\tthis.#loadFromStorage(true);\n\n\t\t\t// настройки URL hash имеют приоритет\n\t\t\tthis.#loadFromHash();\n\t\t}\n\n\t\t// настройки гостевой ссылки имеют приоритет\n\t\tthis.#loadFromGuestLink();\n\n\t\tthis.#prepareParams();\n\n\t\tconst save = debounce(() => {\n\t\t\tthis.#saveInHash();\n\t\t\tthis.#saveInStorage();\n\t\t\tthis.#saveInStorage(true);\n\t\t});\n\n\t\tcontext.store.$subscribe(save);\n\t}\n\n\t/**\n\t * Сгенерировать гостевую ссылку\n\t *\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\n\t */\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\n\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tif (res?.errors) return;\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tawait guestLinkToClipboard(res.result);\n\t}\n\n\t/**\n\t * Сгенерировать опции для гостевой ссылки\n\t */\n\t#genOptionsForGuestLink() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesGuestLink.forEach(name => {\n\t\t\t// формат параметров API: snake_case\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из объекта без фиксации состояния\n\t */\n\t#setOptions(data: Map<string, any>) {\n\t\tdata.forEach((value, name) => {\n\t\t\tconst currentValue = this.#store[name];\n\n\t\t\tif (value === null || value === undefined) return;\n\t\t\tif (currentValue === undefined) return;\n\t\t\tif (!value?.constructor) return;\n\t\t\tif (value.constructor !== currentValue.constructor) return;\n\n\t\t\t// дополнительная проверка на формат даты\n\t\t\tif (name.indexOf('date') === 0) {\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t// value.forEach((valueI) => {\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\n\t\t\t\t\t// });\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof (value) === 'string') {\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#store[name] = value;\n\t\t});\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\n\t */\n\t#genDataFormat(data: Map<string, any>) {\n\t\tconst dataFormatted = new Map();\n\n\t\tdata.forEach((value, name) => {\n\t\t\tif (value === null) return;\n\n\t\t\tvalue = JSON.stringify(value);\n\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\treturn dataFormatted;\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\n\t */\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tdataFormatted.forEach((value, name) => {\n\t\t\tif (value === null || value === undefined || value === 'false') return;\n\n\t\t\ttry {\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\n\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\n\t\t\t} catch (e) {\n\t\t\t\t// не json строка\n\t\t\t}\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из хеша адреса страницы\n\t */\n\t#loadFromHash() {\n\t\tlet dataHash: any;\n\t\ttry {\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\n\t\t} catch (e) {\n\n\t\t}\n\t\tif (!dataHash) return;\n\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = dataHash[name];\n\t\t\tif (!value) return;\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в хеш адреса страницы\n\t */\n\t#saveInHash() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataObject = Object.fromEntries(data);\n\t\tconst dataJSON = JSON.stringify(dataObject);\n\n\t\tsetHash(this.#storeId, dataJSON);\n\t};\n\n\t/**\n\t * Установить опции из localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#loadFromStorage(isLocal = false) {\n\t\tconst dataFormatted = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#saveInStorage(isLocal = false) {\n\t\tconst data = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataFormatted = this.#genDataFormat(data);\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = dataFormatted.get(name);\n\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\n\t\t});\n\t}\n\n\t/**\n\t * Установить опции из гостевой ссылки\n\t */\n\t#loadFromGuestLink() {\n\t\tconst guestData = this.#user?.guest_data?.data;\n\t\tif (!guestData) return;\n\n\t\t// общие правила для гостевых сессий\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\n\n\t\tconst dataFormatted = new Map();\n\n\t\tthis.#namesGuestLink.forEach((name) => {\n\t\t\tconst value = guestData[name];\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\n\t\tconst $guestTitle = $('.mod_guest_title');\n\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\n\t\t\tif (competitors.length) {\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Подготовить входные параметры перед инициализацией основного функционала\n\t *\n\t * Входные параметры устанавливаются при открытии страницы\n\t *\n\t * Входные параметры могут меняться пользоваталем и устаревать\n\t */\n\t#prepareParams() {\n\t\t// контролль за вводом регионов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.regionsIndexes) {\n\t\t\twatch(this.#store.regionsIndexes, (regionsIndexes) => {\n\t\t\t\tif (!regionsIndexes.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\n\n\t\t\t\t// оставить только включенные регионы\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\n\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\n\t\t\t}, { immediate: true });\n\t\t}\n\n\t\t// контролль за вводом конкурентов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds) {\n\t\t\twatch(this.#store.competitorsIds, (competitorsIds) => {\n\t\t\t\tif (!competitorsIds.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorsIds[index] = competitorId);\n\n\t\t\t\t// оставить только включенных конкурентов\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\n\t\t\t\t});\n\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\n\t\t\t}, { immediate: true });\n\t\t}\n\t}\n\n}\n\ntype Options = {\n\t/**\n\t * TODO: Убрать из плагина\n\t */\n\tPage: any,\n\n\t/**\n\t * Объект с настройками пользователя\n\t */\n\tuser: any,\n\n\t/**\n\t * Объект для работы с API\n\t *\n\t * См. на сайте: @/component/api/core/api.ts\n\t */\n\tApi: any;\n\n\t/**\n\t * Имена свойств для сохранения в URL\n\t */\n\ttpaNamesUrlHash?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage\n\t */\n\ttpaNamesStorage?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\n\t *\n\t * Каждый URL будет работать со своим состоянием\n\t */\n\ttpaNamesStorageLocal?: string[],\n\n\t/**\n\t * Имена свойств для работы с гостевой ссылкой\n\t *\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\n\t */\n\ttpaNamesGuestLink?: string[],\n};\n\ntype Context = PiniaPluginContext & {\n\toptions: Options\n};\n\n/**\n * Плагин tpa (Third-party access) для pinia\n *\n * Добавляет возможность сохранять и загружать данные в/из:\n * \t- URL hash в адресе страницы\n * \t- localStorage\n * \t- гостевая ссылка\n *\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\n * - tpaNamesUrlHash\n * - tpaNamesStorage\n * - tpaNamesStorageLocal\n * - tpaNamesGuestLink\n */\nexport default (contextPinia: PiniaPluginContext) => {\n\tconst context = contextPinia as Context;\n\n\t// плагин подключать не нужно\n\tif (\n\t\t!context.options.tpaNamesUrlHash?.length &&\n\t\t!context.options.tpaNamesStorage?.length &&\n\t\t!context.options.tpaNamesStorageLocal?.length &&\n\t\t!context.options.tpaNamesGuestLink?.length\n\t) {\n\t\treturn;\n\t}\n\n\tnew PiniaTPA(context);\n}\n"],"names":["PiniaTPA","#storeId","#store","#Page","#user","#Api","#namesUrlHash","#namesStorage","#namesStorageLocal","#namesGuestLink","context","url","data","_a","#loadFromStorage","#loadFromHash","#loadFromGuestLink","#prepareParams","save","debounce","#saveInHash","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","guestLinkToClipboard","name","nameSnakeCase","camelToSnakeCase","#setOptions","value","currentValue","#genDataFormat","dataFormatted","#genDataUnFormat","dataHash","getHash","dataObject","dataJSON","setHash","isLocal","names","storageNamespace","guestData","_b","$guestTitle","_c","competitors","competitor","watch","regionsIndexes","regionIndex","index","mapSearchers","availableRegionsIndexes","searcher","region","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_d"],"mappings":";;;;;;;;;AAYA,MAAMA,EAAS;AAAA,EAELC;AAAA,EACAC;AAAA;AAAA;AAAA;AAAA,EAKAC;AAAA,EAEAC;AAAA,EACAC;AAAA,EAEAC,KAA0B,CAAC;AAAA,EAC3BC,KAA0B,CAAC;AAAA,EAC3BC,KAA+B,CAAC;AAAA,EAChCC,KAA4B,CAAC;AAAA,EAEtC,YAAYC,GAAkB;;AAC7B,SAAKR,KAASQ,EAAQ,OACjB,KAAAT,KAAW,KAAKC,GAAO,KAEvB,KAAAC,KAAQO,EAAQ,QAAQ,MAExB,KAAAN,KAAQM,EAAQ,QAAQ,MACxB,KAAAL,KAAOK,EAAQ,QAAQ,KAE5B,KAAKJ,KAAgBI,EAAQ,QAAQ,mBAAmB,CAAC,GACzD,KAAKH,KAAgBG,EAAQ,QAAQ,mBAAmB,CAAC,GACzD,KAAKF,KAAqBE,EAAQ,QAAQ,wBAAwB,CAAC,GACnE,KAAKD,KAAkBC,EAAQ,QAAQ,qBAAqB,CAAC,GAErDA,EAAA,MAAM,eAAe,CAA2BC,GAAWC,MAAc,KAAK,aAAaD,GAAKC,CAAI,IAEvGC,IAAA,KAAKT,GAAM,eAAX,QAAAS,EAAuB,SAC3B,KAAKC,GAAiB,GACtB,KAAKA,GAAiB,EAAI,GAG1B,KAAKC,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EAAA,QAAQ,QAAQ,CAACC,MAAgB;AACrC,UAAAA,EAAO,UAAU,MAEGF,EAAA,KAAKE,EAAO,KAAK;AAAA,QAAA,CACzC;AAAA,MAAA,CACD,GAEI,KAAAtD,GAAO,iBAAiBgD,EAAe,OAAO,CAACC,MAAwBG,EAAwB,SAASH,CAAW,CAAC;AAAA,IAAA,GACvH,EAAE,WAAW,IAAM,GAKnB,KAAKjD,GAAO,kBACf+C,EAAM,KAAK/C,GAAO,gBAAgB,CAACuD,MAAmB;AACjD,UAAA,CAACA,EAAe,OAAQ;AAG5B,MAAAA,EAAe,QAAQ,CAACC,GAAsBN,MAAkBK,EAAeL,CAAK,IAAIM,CAAY;AAGpG,YAAMC,IAA0B,CAAC,KAAKxD,GAAM,KAAK,KAAK,QAAQ,EAAE;AAChE,WAAKA,GAAM,KAAK,KAAK,QAAQ,YAAY,QAAQ,CAAC6C,MAAoB;AACrE,QAAIA,EAAW,MAAM,KAA2BW,EAAA,KAAKX,EAAW,EAAE;AAAA,MAAA,CAClE,GAEI,KAAA9C,GAAO,iBAAiBuD,EAAe,OAAO,CAACC,MAAyBC,EAAwB,SAASD,CAAY,CAAC;AAAA,IAAA,GACzH,EAAE,WAAW,IAAM;AAAA,EACvB;AAGF;AA+DA,MAAeE,IAAA,CAACC,MAAqC;;AACpD,QAAMnD,IAAUmD;AAGhB,EACC,GAAChD,IAAAH,EAAQ,QAAQ,oBAAhB,QAAAG,EAAiC,WAClC,GAAC+B,IAAAlC,EAAQ,QAAQ,oBAAhB,QAAAkC,EAAiC,WAClC,GAACE,IAAApC,EAAQ,QAAQ,yBAAhB,QAAAoC,EAAsC,WACvC,GAACgB,IAAApD,EAAQ,QAAQ,sBAAhB,QAAAoD,EAAmC,WAKrC,IAAI9D,EAASU,CAAO;AACrB;"}
@@ -19,7 +19,7 @@ export declare const searchersNames: {
19
19
  * Получить иконку ПС
20
20
  * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом
21
21
  */
22
- export declare const getSearcherGIcon: (searcherKey: number | string | null) => string;
22
+ export declare const getSearcherGIcon: (searcherKey: number | string | undefined) => string;
23
23
  /**
24
24
  * Получить иконку устройства (ПК, планшет, смартфон)
25
25
  */
@@ -0,0 +1,2 @@
1
+ define(["require","exports","vue","@rive-app/canvas-lite","../require/css.amd!../assets/extra.css"],function(f,p,e,b){"use strict";if(typeof e>"u")var e=window.Vue;function y(a){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>a[n]})}}return r.default=a,Object.freeze(r)}const m=e.defineComponent({__name:"rive",props:{src:{},buffer:{},riveFile:{},artboard:{},animations:{},stateMachines:{},layout:{},autoplay:{type:Boolean,default:!0},useOffscreenRenderer:{type:Boolean},enableRiveAssetCDN:{type:Boolean},shouldDisableRiveListeners:{type:Boolean},isTouchScrollEnabled:{type:Boolean},automaticallyHandleEvents:{type:Boolean},onLoad:{},onLoadError:{},onPlay:{},onPause:{},onStop:{},onLoop:{},onStateChange:{},onAdvance:{},assetLoader:{},onload:{},onloaderror:{},onplay:{},onpause:{},onstop:{},onloop:{},onstatechange:{}},setup(a,{expose:r}){let n;const o=a,l=e.ref(),s={riveInstance:void 0};return e.watch([l,o],async()=>{var d;n||(n=await new Promise((u,i)=>f(["@rive-app/canvas-lite"],c=>u(y(c)),i)));const t=l.value;if(!t)return;(d=s.riveInstance)==null||d.cleanup();const v={...o,canvas:t,onLoad:u=>{var i,c;(i=o.onLoad)==null||i.call(o,u),(c=s.riveInstance)==null||c.resizeDrawingSurfaceToCanvas()}};s.riveInstance=new n.Rive(v)}),e.onUnmounted(()=>{var t;(t=s.riveInstance)==null||t.cleanup()}),r(s),(t,v)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"el",ref:l,class:"top-rive"},null,512))}});p.TopRive=m,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=extra.amd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extra.amd.js","sources":["../../src/components/extra/extra.ts","../../src/components/extra/rive/rive.vue"],"sourcesContent":["import type { ComponentCustomProps } from 'vue';\n\nimport Rive from './rive/rive.vue';\n\nexport const TopRive = Rive as typeof Rive & ComponentCustomProps;\n","<script setup lang=\"ts\">\nimport { Rive } from '@rive-app/canvas-lite';\nimport type { RiveParameters } from '@rive-app/canvas-lite';\n\nimport type { Props } from './types';\nimport { onUnmounted, ref, watch } from 'vue';\n\nlet rive: typeof import('@rive-app/canvas-lite');\n\nconst props = withDefaults(defineProps<Props>(), {\n\tautoplay: true,\n});\n\nconst el = ref<HTMLCanvasElement>();\n\nconst topRive = {\n\triveInstance: undefined as Rive | undefined,\n};\n\nwatch([el, props], async () => {\n\tif (!rive) rive = await import('@rive-app/canvas-lite');\n\n\tconst canvas = el.value;\n\tif (!canvas) return;\n\n\ttopRive.riveInstance?.cleanup();\n\n\tconst options: RiveParameters = {\n\t\t...props,\n\t\tcanvas,\n\t\tonLoad: (e) => {\n\t\t\tprops.onLoad?.(e);\n\n\t\t\ttopRive.riveInstance?.resizeDrawingSurfaceToCanvas();\n\t\t},\n\t};\n\n\ttopRive.riveInstance = new rive.Rive(options);\n});\n\nonUnmounted(() => {\n\ttopRive.riveInstance?.cleanup();\n});\n\ndefineExpose(topRive);\n</script>\n\n<template>\n\t<canvas ref=\"el\" class=\"top-rive\"></canvas>\n</template>\n\n<style>\n.top-rive {\n\twidth: 100%;\n\theight: 100%;\n\tflex-grow: 1;\n}\n</style>\n"],"names":["TopRive","rive","el","vue","canvas","_a","topRive","props","e","_b"],"mappings":"ibAIO,MAAAA,mjBCGP,IAAAC,YAMAC,EAAAC,EAAA,IAAA,KAEgB,aAAA,wHAOf,MAAAC,EAAAF,EAAA,oBAGAG,EAAAC,EAAA,eAAA,MAAAD,EAAA,mBAEgC,GAAAE,EAC5B,OAAAH,EACH,OAAAI,GAAA,UAECH,EAAAE,EAAA,SAAA,MAAAF,EAAA,KAAAE,EAAAC,IAEAC,EAAAH,EAAA,eAAA,MAAAG,EAAA,8BAAmD,+BAIT,CAAA,4BAI5CJ,EAAAC,EAAA,eAAA,MAAAD,EAAA,SAA8B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from '../components/extra/extra'
2
+ export {}
package/extra/extra.js ADDED
@@ -0,0 +1,72 @@
1
+ import { Core as v } from "../core/app.js";
2
+ import { defineComponent as m, ref as f, watch as y, onUnmounted as B, createElementBlock as C, openBlock as L } from "vue";
3
+ import "@rive-app/canvas-lite";
4
+ const d = ["../assets/extra.css"].map((a) => import.meta.resolve(a));
5
+ v.insertCSSLinkToPage(d, !0);
6
+ const S = /* @__PURE__ */ m({
7
+ __name: "rive",
8
+ props: {
9
+ src: {},
10
+ buffer: {},
11
+ riveFile: {},
12
+ artboard: {},
13
+ animations: {},
14
+ stateMachines: {},
15
+ layout: {},
16
+ autoplay: { type: Boolean, default: !0 },
17
+ useOffscreenRenderer: { type: Boolean },
18
+ enableRiveAssetCDN: { type: Boolean },
19
+ shouldDisableRiveListeners: { type: Boolean },
20
+ isTouchScrollEnabled: { type: Boolean },
21
+ automaticallyHandleEvents: { type: Boolean },
22
+ onLoad: {},
23
+ onLoadError: {},
24
+ onPlay: {},
25
+ onPause: {},
26
+ onStop: {},
27
+ onLoop: {},
28
+ onStateChange: {},
29
+ onAdvance: {},
30
+ assetLoader: {},
31
+ onload: {},
32
+ onloaderror: {},
33
+ onplay: {},
34
+ onpause: {},
35
+ onstop: {},
36
+ onloop: {},
37
+ onstatechange: {}
38
+ },
39
+ setup(a, { expose: p }) {
40
+ let t;
41
+ const o = a, r = f(), n = {
42
+ riveInstance: void 0
43
+ };
44
+ return y([r, o], async () => {
45
+ var i;
46
+ t || (t = await import("@rive-app/canvas-lite"));
47
+ const e = r.value;
48
+ if (!e) return;
49
+ (i = n.riveInstance) == null || i.cleanup();
50
+ const s = {
51
+ ...o,
52
+ canvas: e,
53
+ onLoad: (u) => {
54
+ var l, c;
55
+ (l = o.onLoad) == null || l.call(o, u), (c = n.riveInstance) == null || c.resizeDrawingSurfaceToCanvas();
56
+ }
57
+ };
58
+ n.riveInstance = new t.Rive(s);
59
+ }), B(() => {
60
+ var e;
61
+ (e = n.riveInstance) == null || e.cleanup();
62
+ }), p(n), (e, s) => (L(), C("canvas", {
63
+ ref_key: "el",
64
+ ref: r,
65
+ class: "top-rive"
66
+ }, null, 512));
67
+ }
68
+ }), b = S;
69
+ export {
70
+ b as TopRive
71
+ };
72
+ //# sourceMappingURL=extra.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extra.js","sources":["../../src/components/extra/rive/rive.vue","../../src/components/extra/extra.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Rive } from '@rive-app/canvas-lite';\nimport type { RiveParameters } from '@rive-app/canvas-lite';\n\nimport type { Props } from './types';\nimport { onUnmounted, ref, watch } from 'vue';\n\nlet rive: typeof import('@rive-app/canvas-lite');\n\nconst props = withDefaults(defineProps<Props>(), {\n\tautoplay: true,\n});\n\nconst el = ref<HTMLCanvasElement>();\n\nconst topRive = {\n\triveInstance: undefined as Rive | undefined,\n};\n\nwatch([el, props], async () => {\n\tif (!rive) rive = await import('@rive-app/canvas-lite');\n\n\tconst canvas = el.value;\n\tif (!canvas) return;\n\n\ttopRive.riveInstance?.cleanup();\n\n\tconst options: RiveParameters = {\n\t\t...props,\n\t\tcanvas,\n\t\tonLoad: (e) => {\n\t\t\tprops.onLoad?.(e);\n\n\t\t\ttopRive.riveInstance?.resizeDrawingSurfaceToCanvas();\n\t\t},\n\t};\n\n\ttopRive.riveInstance = new rive.Rive(options);\n});\n\nonUnmounted(() => {\n\ttopRive.riveInstance?.cleanup();\n});\n\ndefineExpose(topRive);\n</script>\n\n<template>\n\t<canvas ref=\"el\" class=\"top-rive\"></canvas>\n</template>\n\n<style>\n.top-rive {\n\twidth: 100%;\n\theight: 100%;\n\tflex-grow: 1;\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport Rive from './rive/rive.vue';\n\nexport const TopRive = Rive as typeof Rive & ComponentCustomProps;\n"],"names":["rive","props","__props","el","ref","topRive","watch","canvas","_a","options","e","_b","onUnmounted","__expose","TopRive","_sfc_main"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,QAAAA;AAEA,UAAAC,IAAAC,GAIAC,IAAAC,EAAA,GAEAC,IAAA;AAAA,MAAgB,cAAA;AAAA,IACD;AAGf,WAAAC,EAAA,CAAAH,GAAAF,CAAA,GAAA,YAAA;;AACC,MAAAD,MAAAA,IAAA,MAAA,OAAA,uBAAA;AAEA,YAAAO,IAAAJ,EAAA;AACA,UAAA,CAAAI,EAAA;AAEA,OAAAC,IAAAH,EAAA,iBAAA,QAAAG,EAAA;AAEA,YAAAC,IAAA;AAAA,QAAgC,GAAAR;AAAA,QAC5B,QAAAM;AAAA,QACH,QAAA,CAAAG,MAAA;;AAEC,WAAAF,IAAAP,EAAA,WAAA,QAAAO,EAAA,KAAAP,GAAAS,KAEAC,IAAAN,EAAA,iBAAA,QAAAM,EAAA;AAAA,QAAmD;AAAA,MACpD;AAGD,MAAAN,EAAA,eAAA,IAAAL,EAAA,KAAAS,CAAA;AAAA,IAA4C,CAAA,GAG7CG,EAAA,MAAA;;AACC,OAAAJ,IAAAH,EAAA,iBAAA,QAAAG,EAAA;AAAA,IAA8B,CAAA,GAG/BK,EAAAR,CAAA;;;;;;ICxCOS,IAAAC;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topvisor/ui",
3
3
  "private": false,
4
- "version": "1.0.26-1",
4
+ "version": "1.0.26-3",
5
5
  "type": "module",
6
6
  "description": "Topvisor UI-kit Vue",
7
7
  "author": "Topvisor",
@@ -1,2 +1,2 @@
1
- define(["require","exports","vue","../.chunks/forms-B3bJpLOo.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-DLF_Qnj6.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-VpwRSIdl.amd","../.chunks/utils-CTjq0RlC.amd","../utils/searchers.amd","../utils/dom.amd","../popup/worker.amd","../require/css.amd!../assets/project.css"],function(ne,T,e,x,E,oe,le,P,_,ae){"use strict";if(typeof e>"u")var e=window.Vue;const re={class:"top-selectorCompetitors"},ie={class:"top-ellipsis1"},de=e.defineComponent({__name:"selectorCompetitors",props:e.mergeModels({modelValue:{},items:{},showSelectAllItem:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=e.computed(()=>{if(l.showSelectAllItem)return{icon:"",title:x.useI18n().Common.Select_all,value:"all",content:""}});return(d,o)=>(e.openBlock(),e.createElementBlock("div",re,[e.unref(x.Core).state.isMobile?(e.openBlock(),e.createBlock(E._sfc_main,{key:0},{opener:e.withCtx(()=>[e.createVNode(x._sfc_main,{class:"top-selectorCompetitors_opener",color:"theme",icon:"",icon2:""},{default:e.withCtx(()=>{var a;return[e.createTextVNode(e.toDisplayString((a=d.items.find(s=>{var f;return s.value===((f=r.value)==null?void 0:f[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(a,s)=>{var f;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(f=r.value)==null?void 0:f.includes(a.value)}),"data-top-icon":a.icon,title:a.title,onClick:()=>r.value=[a.value]},{default:e.withCtx(()=>[e.createElementVNode("span",ie,e.toDisplayString(a.content),1)]),_:2},1032,["class","data-top-icon","title","onClick"])}),256))]),_:1})):(e.openBlock(),e.createBlock(oe._sfc_main,{key:1,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=a=>r.value=a),items:d.items,isMultiple:!0,styling:"bar",canBeEmptyMultiple:!1,selectAllItem:t.value},null,8,["modelValue","items","selectAllItem"]))]))}}),w=-1,y=-2,L=-1,ue={0:"Yandex",1:"Google",4:"YouTube",5:"Bing",7:"Seznam",8:"AppStore",9:"GoogleStore",20:"Yandex.com",21:"Yandex.com.tr"},J={key:y,name:"--",index:y},G={key:y,name:"--",regions:[J],regionByIndex:new Map([[y,J]])},A={key:y,name:"Autoselect",index:y},U={key:y,name:"Autoselect",regions:[A],regionByIndex:new Map([[y,A]])},Y={countryCode:"00",depth:1,device:0,key:L,index:L,lang:"ru",name:"Without region"},se=()=>(A.name=x.useI18n().Common.Autoselect,A),ce=()=>(se(),U.name=x.useI18n().Common.Autoselect,console.log(U),U),ge=()=>(Y.name=x.useI18n().Keywords.Without_region,Y),z=(n=!1,l=!1,r=[])=>{let t;return n?t=me(r):t=W(r),l&&t.set(y,ce()),t.size||t.set(y,G),t},W=(n,l=!0,r=[],t=!1)=>{const d=new Map;return n.forEach(o=>{if(!o.enabled||t&&typeof o.key=="number"&&o.key>1)return;const a={...o};a.regionByIndex=new Map,o.regions&&o.regions.forEach(s=>{if(l&&!s.enabled)return;const f={...s};a.regionByIndex.set(f.index,f)}),!a.regionByIndex.size&&r.length,(!o.regions||a.regionByIndex.size||r.length)&&typeof a.key=="number"&&d.set(a.key,a)}),r.forEach(o=>{if(d.has(o))return;const a={key:o,name:ue[o],regions:[],regionByIndex:new Map};d.set(a.key,a)}),d},me=n=>{const l=W(n,!1,[0,1],!0);if(l.has(2)){const r=l.get(2);r&&(r.regionByIndex=new Map)}return l.forEach(r=>{if(!r.regionByIndex)return;const t={...ge()};r.regionByIndex.set(t.index,t)}),l},H=(n,l,r=[])=>{const t=z(n,!1,r);let d;return t.forEach(o=>{if(!(l.searcher_key!==void 0&&l.searcher_key!=o.key)&&o.regions&&(o.regions.forEach(a=>{if(!d&&!(l.key!==void 0&&l.key!=a.key)&&!(l.index!==void 0&&l.index!=a.index)&&!(!n&&(l.lang!==void 0&&l.lang!=a.lang||l.device!==void 0&&l.device!=a.device)))return a.searcher_key=o.key,d=a,!1}),d))return!1}),d},Q=le.useAsyncTopDialog(()=>new Promise((n,l)=>ne(["../.chunks/dialog_selectorRegions-BOPta9cH.amd"],n,l))),fe=(n,l)=>{const r=x.useI18n(),t=e.ref(l.value.keys().next().value??y),d=e.computed(()=>{const o=new Map;if(l.value.forEach(a=>{let s={value:a.key,title:a.name};n.addSearcherIcon&&(s.icon=P.getSearcherGIcon(a.key)),o.set(a.key,s)}),n.addCompare&&!o.has(y)){const a={value:"",title:"--------------------",disabled:!0};o.set(a.value,a);const s={value:w,title:r.Common.Compare};o.set(s.value,s)}return o});return{searcherKey:t,optionBySearcherKey:d}},ve=(n,l)=>{var o,a,s;const r=x.useI18n(),t=e.ref(y);n.modelValue.length===1&&(t.value=n.modelValue[0]),t.value===y&&(n.forFrequency?t.value=((a=(o=l.value)==null?void 0:o.regionByIndex.values().next().value)==null?void 0:a.key)??y:t.value=((s=l.value)==null?void 0:s.regionByIndex.keys().next().value)??y);const d=e.computed(()=>{var h;const f=new Map;return(h=l.value.regionByIndex)==null||h.forEach(S=>{let i=S.name;if(n.forFrequency){const I={value:S.key,title:i};f.has(S.key)||f.set(S.key,I);return}S.device&&(i+=" ("+r.Common["Device_"+S.device]+")");const m=P.getLangLabel(l.value.key||0,S.lang??"");m&&(i+=" / "+m);const c={value:S.index,title:i,icon:S.device?P.getDeviceGIcon(S.device):void 0};f.set(S.index,c)}),f});return e.watch(d,(f,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&f.get(t.value))return;let S=f.keys().next().value;if(t.value===y||S===y){t.value=S;return}let i=((c=h==null?void 0:h.get(t.value))==null?void 0:c.title)||"",m=-1;for(const[I,B]of f.entries()){const C=B.title;if(typeof C!="string"||typeof I=="string")break;if(C===i){S=I;break}const V=new RegExp(` \\((${r.Common.Device_1}|${r.Common.Device_2})\\)`);let v=i,u=3;C.indexOf(v)===-1&&(v=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),v=v.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)!==-1&&(u<=m||(m=u,S=I))}t.value=S}),{regionIndex:t,optionByRegionIndex:d}},pe=(n,l,r)=>{const t=e.ref([]),d=()=>{if(n.onlySearcher&&l.value){t.value=Array.from(l.value.keys());return}let a=[];if(n.modelValue.length>1)a=[...n.modelValue];else try{a=JSON.parse(localStorage.getItem("ui:project:regionSelector"+n.projectId+":regionsIndexes"))??[]}catch{}a.length&&(a=a.filter(s=>r.value.has(s))),a.length||(a=Array.from(r.value)),t.value=[...a]},o=()=>{t.value.length?localStorage.setItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes",JSON.stringify(t.value)):localStorage.removeItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes")};return e.watch(t,()=>{o()}),n.addCompare&&d(),{regionsIndexes:t}},ye=n=>{const l=e.computed(()=>z(n.forFrequency,n.autoRegion,n.searchers)),r=e.computed(()=>l.value.get(d.searcherKey.value)||G),t=e.computed(()=>{const i=new Set;return l.value.forEach(m=>{m.regionByIndex.forEach(c=>{c.index!==L&&c.index!==y&&i.add(c.index)})}),i}),d=fe(n,l),o=ve(n,r),a=pe(n,l,t);e.watch(l,()=>{var m,c,I,B;if(n.onlySearcher?a.regionsIndexes.value=Array.from(l.value.keys()):a.regionsIndexes.value=a.regionsIndexes.value.filter(C=>t.value.has(C)),d.searcherKey.value===w)return;let i=l.value.keys().next().value;l.value.forEach(C=>{var V,v,u;if(n.onlySearcher&&C.key===d.searcherKey.value){i=d.searcherKey.value;return}if(o.regionIndex.value&&((V=C.regionByIndex)!=null&&V.has(o.regionIndex.value))&&(i=C.key),!n.onlySearcher){let g;i!==void 0&&(g=(v=l.value.get(i))==null?void 0:v.regionByIndex);const p=(u=l.value.get(C.key))==null?void 0:u.regionByIndex;g!=null&&g.has(y)&&!(p!=null&&p.has(y))&&(i=C.key)}}),i!==void 0&&(d.searcherKey.value=i),o.regionIndex.value!==void 0&&!((c=(m=r.value)==null?void 0:m.regionByIndex)!=null&&c.has(o.regionIndex.value))&&(o.regionIndex.value=(B=(I=r.value)==null?void 0:I.regions)==null?void 0:B.keys().next().value)},{immediate:!0});const s=()=>{if(!(d.searcherKey.value===w||d.searcherKey.value===y))return d.searcherKey.value},f=()=>{if(n.onlySearcher||o.regionIndex.value===y)return;let i=o.regionIndex.value;if(n.forFrequency){const m=o.regionIndex.value,c=H(n.forFrequency,{searcher_key:s(),key:m},n.searchers);i=c==null?void 0:c.index}return i},h=()=>{const i=s();if(i!==void 0)return l.value.get(i)};return{selectSearcher:d,selectRegion:o,compare:a,searcherByKey:l,allRegionsIndexes:t,getSearcher:h,getRegion:()=>{var m,c;const i=f();if(i!==void 0)return(c=(m=h())==null?void 0:m.regionByIndex)==null?void 0:c.get(i)}}},he=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:["update:modelValue","update:modelValueSingle"],setup(n,{expose:l}){const r=n,t=e.useModel(n,"modelValue"),d=e.useModel(n,"modelValueSingle"),{selectSearcher:o,selectRegion:a,compare:s,searcherByKey:f,allRegionsIndexes:h,getSearcher:S,getRegion:i}=ye(r),m=()=>{const c=[];f.value.forEach(I=>{I.enabled&&I.regions.forEach(B=>{B.enabled&&c.push(B)})}),Q.open("selectorRegions",{regions:c,regionsIndexes:s.regionsIndexes.value,"@update:regionsIndexes":I=>s.regionsIndexes.value=I})};return e.watch([a.regionIndex,o.searcherKey,s.regionsIndexes],()=>{if(o.searcherKey.value===w&&s.regionsIndexes.value.length){if(JSON.stringify(t.value)===JSON.stringify(s.regionsIndexes.value))return;t.value=[...s.regionsIndexes.value]}else r.onlySearcher?(t.value=[o.searcherKey.value],o.searcherKey.value===y&&!r.autoRegion&&(t.value.length=0)):(t.value=[a.regionIndex.value],a.regionIndex.value===y&&!r.autoRegion&&(t.value.length=0));!r.onlySearcher&&!h.value.size&&(o.searcherKey.value=y)}),d.value&&e.watch(d,()=>{d.value&&(t.value=[d.value])},{immediate:!0}),e.watch(t,()=>{var c,I,B,C,V;if(t.value[0]&&(d.value=t.value[0]),r.onlySearcher){if(!t.value.length||t.value.length===1&&!f.value.has(t.value[0])||t.value.length===1&&t.value[0]===y&&!r.autoRegion){let v=f.value.keys().next().value;v===y&&!r.autoRegion&&(v=void 0,d.value=y),v!==void 0?t.value=[v]:t.value.length=0;return}if(t.value.length>1&&JSON.stringify(t.value)!==JSON.stringify(s.regionsIndexes.value)){t.value=[...s.regionsIndexes.value];return}}else{let v=[...new Set(t.value)],u=(I=(c=f.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=f.value.values().next().value)==null?void 0:B.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:V.key),u===y&&!r.autoRegion&&(u=void 0,d.value=y),!v.length)u!==void 0&&v.push(u);else if(v.length===1){let g=h.value;r.forFrequency&&(g=new Set,f.value.forEach(p=>{p.regionByIndex.forEach(k=>{k.index!==L&&k.index!==y&&g.add(k.key)})})),g.has(v[0])||(v=[],u!==void 0&&v.push(u))}else v=v.filter(g=>h.value.has(g)),!v.length&&u!==void 0&&v.push(u);if(JSON.stringify(t.value)!==JSON.stringify(v)){t.value=v;return}}if(!(t.value.length===1&&t.value[0]===(r.onlySearcher?o.searcherKey.value:a.regionIndex.value)))if(r.onlySearcher){if(t.value.length===1){o.searcherKey.value=t.value[0];return}o.searcherKey.value=w;return}else{if(!t.value.length)return;if(t.value.length===1&&o.searcherKey.value!==w){a.regionIndex.value=t.value[0];let v;for(const u of f.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){v=u.key;break}if(v!==void 0)break}v!==void 0&&(o.searcherKey.value=v)}else o.searcherKey.value=w,s.regionsIndexes.value=[...t.value]}},{immediate:!0}),l({getSearcher:S,getRegion:i}),(c,I)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-selectorRegion":!0,"top-selectorRegion-onlySearcher":c.onlySearcher})},[e.createVNode(x._sfc_main$4,{options:e.unref(o).optionBySearcherKey.value,modelValue:e.unref(o).searcherKey.value,"onUpdate:modelValue":I[0]||(I[0]=B=>e.unref(o).searcherKey.value=B),name:"searcher_key",addChanger:c.addChanger},null,8,["options","modelValue","addChanger"]),!c.onlySearcher&&e.unref(o).searcherKey.value!==e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main$4,{key:0,class:"top-select-region",options:e.unref(a).optionByRegionIndex.value,modelValue:e.unref(a).regionIndex.value,"onUpdate:modelValue":I[1]||(I[1]=B=>e.unref(a).regionIndex.value=B),name:c.forFrequency?"region_key":"region_index",addChanger:c.addChanger,"data-top-icon":c.addRegionIcon?"":void 0},null,8,["options","modelValue","name","addChanger","data-top-icon"])):e.createCommentVNode("",!0),c.addCompare&&!c.onlySearcher&&e.unref(o).searcherKey.value===e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main,{key:1,name:"compare",onClick:m,"data-count-compare-regions-indexes":e.unref(s).regionsIndexes.value.length},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.$i18n.Common.Selected_regions),1)]),_:1},8,["data-count-compare-regions-indexes"])):e.createCommentVNode("",!0)],2))}}),Se=[{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"}],X=n=>"-"+n,K=n=>n[0]==="-"?n.substring(1):n,O=(n,l)=>{n=K(n);const r=l.find(t=>t.id===n);if(r)return r},ke=["data-tag_id","data-tag_color_id","title"],D=e.defineComponent({__name:"tagIcon",props:{id:{},colorId:{},name:{},state:{}},setup(n){return(l,r)=>(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,ke))}}),Ie=["contenteditable","onKeydown"],Z=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(n,{emit:l}){const r=n,t=l,d=e.useModel(n,"name"),o=e.ref(null),a=e.computed(()=>navigator.userAgent.indexOf("Firefox")!=-1?{contenteditable:s.value,onpaste:m=>m.preventDefault()}:{}),s=e.ref(!1),f=async()=>{var m;s.value=!0,await e.nextTick(),(m=o.value)==null||m.focus()},h=()=>{var c;const m=(c=o.value)==null?void 0:c.innerText;if(!m)return S();o.value&&(o.value.innerText=m),s.value=!1,t("update:name",m)},S=async()=>{o.value&&(o.value.innerText=r.name),s.value=!1},i=m=>{if(s.value||r.disabled)return;let c="selected";r.canExclude&&(m.ctrlKey||m.metaKey)&&(c="excluded"),r.state==c&&(c=""),c===""&&t("unselect"),c==="selected"&&t("select"),c==="excluded"&&t("exclude")};return(m,c)=>(e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-tagSelector_tagListItem":!0,"top-tagSelector_tagListItem-inEdit":s.value,"top-tagSelector_tagListItem-disabled":m.disabled,"top-tagSelector_tagListItem-canExclude":m.canExclude,"top-tagSelector-active":!!m.state,"top-tagSelector-excluded":m.state==="excluded"}),onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createVNode(D,{id:m.id,name:d.value,colorId:m.colorId,state:m.state},null,8,["id","name","colorId","state"]),e.createElementVNode("span",e.mergeProps({ref_key:"elName",ref:o,class:"top-tagSelector_tagListItemName",contenteditable:s.value?"plaintext-only":!1},a.value,{onKeydown:[e.withKeys(e.withModifiers(h,["stop"]),["enter"]),e.withKeys(e.withModifiers(S,["stop"]),["esc"])]}),e.toDisplayString(d.value),17,Ie),m.editable?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[s.value?(e.openBlock(),e.createElementBlock("span",{key:1,"data-top-icon":"",class:"top-tagSelector_edit",onClick:e.withModifiers(h,["stop"])})):(e.openBlock(),e.createElementBlock("span",{key:0,"data-top-icon":"",class:"top-tagSelector_edit",onClick:f}))],64)):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),xe={key:1},ee=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(n){const l=n,r=e.useModel(n,"modelValue"),t=l.useTopButton?x._sfc_main:"div",d=l.useTopButton?"html":"default",o={model:r,mode:l.mode,targetId:l.targetId,filters:l.filters,payload:l.payload};return(a,s)=>{const f=e.resolveDirective("top-data");return e.openBlock(),e.createBlock(E._sfc_main$2,{id:a.id},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),e.mergeProps({class:{"top-tagSelector":!0,"top-tagSelector-filter":l.mode==="filter","top-tagSelector-setter_single":l.mode==="setter"&&!a.filters,"top-tagSelector-setter_several":l.mode==="setter"&&a.filters,"top-tagSelector-selectedOne":!r.value.length||r.value.length===1,"top-tagSelector-toTwoLine":r.value.length>5},color:"theme",styling:""},a.$attrs),{[e.unref(d)]:e.withCtx(()=>[!r.value.length&&a.mode==="filter"?(e.openBlock(),e.createBlock(D,{key:0,id:"all",colorId:"",name:a.$i18n.Common.All_tags??"",state:""},null,8,["name"])):e.createCommentVNode("",!0),a.mode==="setter"&&a.filters?(e.openBlock(),e.createElementBlock("div",xe,[e.renderSlot(a.$slots,"default")])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(r.value,h=>{var S,i;return e.openBlock(),e.createBlock(D,{id:e.unref(K)(h),colorId:((S=e.unref(O)(h,a.tags))==null?void 0:S.color_id)??"",name:((i=e.unref(O)(h,a.tags))==null?void 0:i.name)??"",state:e.unref(K)(h)===h?"selected":"excluded"},null,8,["id","colorId","name","state"])}),256))]),_:2},1040,["class"])),[[f,o,"topTagSelectorTarget"]])]),_:3},8,["id"])}}}),Ce=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(Se)},tagsModifiers:{}}),emits:e.mergeModels(["selector","setter","tagsChanged"],["update:modelValue","update:tags"]),setup(n,{emit:l}){const r=x.useI18n(),t=n,d=e.useModel(n,"modelValue"),o=e.useModel(n,"tags"),a=l,s=x.debounce((u,g)=>{a(u,g)},t.emitDelay);t.singleMode&&!d.value.length&&(d.value=[o.value[0].id]);const f=t.id??"top-popup-id-"+Math.random(),h=e.ref("add"),S=()=>{var p;const u=" "+((p=r.Common.Tags)==null?void 0:p.toLowerCase()),g=new Map;return g.set("add",{value:"add",title:r.Common.Add+u}),g.set("replace",{value:"replace",title:r.Common.Replace+u}),g.set("delete",{value:"delete",title:r.Common.Delete+u}),g};let i=e.shallowRef({model:d,mode:"filter",targetId:void 0,filters:void 0,payload:void 0});e.watch(d,()=>{s("selector",d.value)});const m=e.computed(()=>{if(i.value.mode==="setter"&&t.maxTagsForSetter&&!i.value.filters)return i.value.model.value.length>=t.maxTagsForSetter}),c=u=>{if(u!=="all"){if(i.value.model.value.includes(u))return"selected";if(i.value.model.value.includes(X(u)))return"excluded"}return u==="all"&&!i.value.model.value.length?"selected":""},I=(u,g)=>{const p=X(u);let k=i.value.model.value.filter(M=>M!==u&&M!==p);g==="select"&&k.push(u),g==="exclude"&&k.push(p),i.value.mode==="setter"&&i.value.targetId!==void 0&&t.requiredForSetter&&(k.length||k.push("1"),k.length===2&&i.value.model.value.length===1&&i.value.model.value[0]==="1"&&(k=k.filter(M=>M!=="1"))),t.singleMode&&!i.value.filters&&(k.length||(k=i.value.model.value),k.length>1&&(k=[k[k.length-1]])),k.sort((M,N)=>{if(!t.tags)return 0;const q=t.tags.findIndex(b=>b.id===M),R=t.tags.findIndex(b=>b.id===N);return q-R}),i.value.model.value=k,i.value.mode==="setter"&&i.value.targetId!==void 0&&s("setter",{tagsIds:k,targetId:i.value.targetId,payload:i.value.payload})},B=e.computed(()=>{let u="top-tagSelector_popup";return i.value.mode==="filter"&&(u+=" top-tagSelector_popup-filter"),i.value.mode==="setter"&&(u+=" top-tagSelector_popup-setter"),u}),C=()=>{const u=prompt("","New tag");if(!u||u==="New tag")return;const g=o.value.length+1;o.value.push({id:String(g),name:u,color_id:String((g-1)%10+1)}),a("tagsChanged",o.value)},V=u=>{var g;if(i.value=_.storage(u.elPopupOpener,"topTagSelectorTarget"),!i.value)throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");if(i.value.filters&&(h.value="add",i.value.model.value=[]),!((g=x.Core.$)!=null&&g.ui.sortable)){console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");return}!x.Core.state.isMobile&&!x.Core.state.isMobileUA&&o.value&&$(u.elPopup).sortable({items:'li:has([data-tag_id]:not([data-tag_id="all"]))',cancel:'[contenteditable="plaintext-only"], [contenteditable="true"]',distance:10,stop:function(p,k){if(!o.value)return;const M=$(k.item).parent().find("[data-tag_id]"),N=[];M.each((q,R)=>{if(!o.value)return;const b=$(R).attr("data-tag_id");N.push(b)}),o.value.sort((q,R)=>{const b=N.findIndex(j=>j===q.id),Ke=N.findIndex(j=>j===R.id);return b-Ke}),s("tagsChanged",o.value)}})},v=u=>{var g;(g=x.Core.$)!=null&&g.ui.sortable&&$(u.elPopup).data("ui-sortable")&&$(u.elPopup).sortable("destroy")};return(u,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ee,{class:"top-select_arrow",modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=p=>d.value=p),id:e.unref(f),tags:o.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(f),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=p=>V(p)),onClose:g[5]||(g[5]=p=>v(p)),"transition-duration":50},e.createSlots({contentList:e.withCtx(()=>[e.unref(i).mode==="filter"&&!u.singleMode?(e.openBlock(),e.createBlock(Z,{key:0,id:"all",colorId:"",name:u.$i18n.Common.All_tags??"",state:e.unref(i).model.value.length?"":"selected",onSelect:g[3]||(g[3]=p=>e.unref(i).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,p=>(e.openBlock(),e.createBlock(Z,{key:p.id,id:p.id,colorId:p.color_id,name:p.name,state:c(p.id),canExclude:e.unref(i).mode==="filter"&&!u.singleMode,editable:u.tagsEditable,disabled:m.value&&c(p.id)==="",onUnselect:k=>I(p.id,"unselect"),onSelect:k=>I(p.id,"select"),onExclude:k=>I(p.id,"exclude"),"onUpdate:name":k=>{p.name=k,e.unref(s)("tagsChanged",o.value)}},null,8,["id","colorId","name","state","canExclude","editable","disabled","onUnselect","onSelect","onExclude","onUpdate:name"]))),128)),u.tagsEditable&&o.value.length<u.tagsMax&&o.value.length<20?(e.openBlock(),e.createBlock(E._sfc_main$1,{key:1,"data-top-icon":"",onClick:e.withModifiers(C,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Add),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"header",fn:e.withCtx(()=>[e.createVNode(x._sfc_main$4,{modelValue:h.value,"onUpdate:modelValue":g[1]||(g[1]=p=>h.value=p),options:S()},null,8,["modelValue","options"])]),key:"0"}:void 0,e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"footer",fn:e.withCtx(()=>[e.createVNode(x._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(x._sfc_main,{onClick:g[2]||(g[2]=p=>e.unref(s)("setter",{tagsIds:e.unref(i).model.value,filters:e.unref(i).filters,filtersAction:h.value,payload:e.unref(i).payload}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.value==="add"?u.$i18n.Common.Add:"")+" "+e.toDisplayString(h.value==="replace"?u.$i18n.Common.Replace:"")+" "+e.toDisplayString(h.value==="delete"?u.$i18n.Common.Remove:""),1)]),_:1})]),key:"1"}:void 0]),1032,["id","class"])],64))}}),Be=(n,l)=>e.computed(()=>e.toValue(n).filter(d=>d.on>=0||d.id===l).map(d=>({value:d.id,title:d.url+` [${d.id}]`,icon:d.id===e.toValue(l)?"":"",content:d.name}))),Te=(n,l,r)=>{l||(l={id:n.id}),l.id=n.id;const t=ae.TopPopupWorker.genElPopupOpener("div",l);return t.classList.add("top-tagSelector"),n.useTopButton&&t.classList.add("top-button","top-color_theme"),n.mode==="filter"&&t.classList.add("top-tagSelector-filter"),n.mode==="setter"&&!n.filters&&t.classList.add("top-tagSelector-setter_single"),n.mode==="setter"&&n.filters&&t.classList.add("top-tagSelector-setter_several"),t.onclick=d=>{d.preventDefault(),d.stopPropagation(),t.onclick=null;const o=e.ref(n.modelValue),a={model:o,mode:n.mode,targetId:n.targetId,filters:n.filters,payload:n.payload};_.storage(t,"topTagSelectorTarget",a),delete t.dataset.topPopupDisabled,e.isRef(n.modelValue)||e.watch(o,()=>{n.modelValue=o.value,F(t,n,r)}),t.click()},e.isRef(n.modelValue)?e.watch(n.modelValue,()=>F(t,n,r)):_.storage(t,"topTagSelectorRender",d=>{n.modelValue=d;const o=_.storage(t,"topTagSelectorTarget");o&&(o.model.value=d),F(t,n,r)}),F(t,n,r),t},Ve=(n,l)=>{var r;(r=_.storage(n,"topTagSelectorRender"))==null||r(l)},F=(n,l,r)=>{var d;const t=e.unref(l.modelValue);if(n.classList.toggle("top-tagSelector-selectedOne",!t.length||t.length===1),n.classList.toggle("top-tagSelector-toTwoLine",t.length>5),l.mode==="setter"&&l.filters){n.innerHTML=`<div>${r}</div>`;return}if(n.innerHTML="",!t.length&&l.mode==="filter"){const o=te({id:"all",colorId:"",name:((d=x.useI18n().Common)==null?void 0:d.All_tags)??"",state:""});n.append(o)}t.forEach(o=>{var s,f;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((f=O(o,l.tags))==null?void 0:f.name)??"",state:K(o)===o?"selected":"excluded"});n.append(a)})},te=n=>{const l=document.createElement("div");return l.classList.add("top-tagSelector_tagIcon"),l.classList.toggle("top-tagSelector-active",!!n.state),l.classList.toggle("top-tagSelector-excluded",n.state==="excluded"),l.dataset.tag_id=n.id,l.dataset.tag_color_id=n.colorId,l.title=n.name,l},we=de,Me=he,be=Ce,Ee=ee,_e=D;T.TopSelectorCompetitors=we,T.TopSelectorRegion=Me,T.TopTagSelector=be,T.TopTagSelectorPopupOpener=Ee,T.TopTagSelectorTagIcon=_e,T.dialogSelectorRegions=Q,T.findRegion=H,T.genElTopTagSelectorPopupOpener=Te,T.genSearcherByKey=z,T.renderElTopTagSelectorPopupOpener=Ve,T.useItemsFromCompetitors=Be,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
1
+ define(["require","exports","vue","../.chunks/forms-B3bJpLOo.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-DLF_Qnj6.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-VpwRSIdl.amd","../.chunks/utils-CTjq0RlC.amd","../utils/searchers.amd","../utils/dom.amd","../popup/worker.amd","../require/css.amd!../assets/project.css"],function(ne,T,e,x,E,oe,le,P,_,ae){"use strict";if(typeof e>"u")var e=window.Vue;const re={class:"top-selectorCompetitors"},ie={class:"top-ellipsis1"},de=e.defineComponent({__name:"selectorCompetitors",props:e.mergeModels({modelValue:{},items:{},showSelectAllItem:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=e.computed(()=>{if(l.showSelectAllItem)return{icon:"",title:x.useI18n().Common.Select_all,value:"all",content:""}});return(d,o)=>(e.openBlock(),e.createElementBlock("div",re,[e.unref(x.Core).state.isMobile?(e.openBlock(),e.createBlock(E._sfc_main,{key:0},{opener:e.withCtx(()=>[e.createVNode(x._sfc_main,{class:"top-selectorCompetitors_opener",color:"theme",icon:"",icon2:""},{default:e.withCtx(()=>{var a;return[e.createTextVNode(e.toDisplayString((a=d.items.find(s=>{var f;return s.value===((f=r.value)==null?void 0:f[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(a,s)=>{var f;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(f=r.value)==null?void 0:f.includes(a.value)}),"data-top-icon":a.icon,title:a.title,onClick:()=>r.value=[a.value]},{default:e.withCtx(()=>[e.createElementVNode("span",ie,e.toDisplayString(a.content),1)]),_:2},1032,["class","data-top-icon","title","onClick"])}),256))]),_:1})):(e.openBlock(),e.createBlock(oe._sfc_main,{key:1,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=a=>r.value=a),items:d.items,isMultiple:!0,styling:"bar",canBeEmptyMultiple:!1,selectAllItem:t.value},null,8,["modelValue","items","selectAllItem"]))]))}}),w=-1,y=-2,L=-1,ue={0:"Yandex",1:"Google",4:"YouTube",5:"Bing",7:"Seznam",8:"AppStore",9:"GoogleStore",20:"Yandex.com",21:"Yandex.com.tr"},J={key:y,name:"--",index:y},G={key:y,name:"--",regions:[J],regionByIndex:new Map([[y,J]])},A={key:y,name:"Autoselect",index:y},U={key:y,name:"Autoselect",regions:[A],regionByIndex:new Map([[y,A]])},Y={countryCode:"00",depth:1,device:0,key:L,index:L,lang:"ru",name:"Without region"},se=()=>(A.name=x.useI18n().Common.Autoselect,A),ce=()=>(se(),U.name=x.useI18n().Common.Autoselect,console.log(U),U),ge=()=>(Y.name=x.useI18n().Keywords.Without_region,Y),z=(n=!1,l=!1,r=[])=>{let t;return n?t=me(r):t=W(r),l&&t.set(y,ce()),t.size||t.set(y,G),t},W=(n,l=!0,r=[],t=!1)=>{const d=new Map;return n.forEach(o=>{if(!o.enabled||t&&typeof o.key=="number"&&o.key>1)return;const a={...o};a.regionByIndex=new Map,o.regions&&o.regions.forEach(s=>{if(l&&!s.enabled)return;const f={...s};a.regionByIndex.set(f.index,f)}),!a.regionByIndex.size&&r.length,(!o.regions||a.regionByIndex.size||r.length)&&typeof a.key=="number"&&d.set(a.key,a)}),r.forEach(o=>{if(d.has(o))return;const a={key:o,name:ue[o],regions:[],regionByIndex:new Map};d.set(a.key,a)}),d},me=n=>{const l=W(n,!1,[0,1],!0);if(l.has(2)){const r=l.get(2);r&&(r.regionByIndex=new Map)}return l.forEach(r=>{if(!r.regionByIndex)return;const t={...ge()};r.regionByIndex.set(t.index,t)}),l},H=(n,l,r=[])=>{const t=z(n,!1,r);let d;return t.forEach(o=>{if(!(l.searcher_key!==void 0&&l.searcher_key!=o.key)&&o.regions&&(o.regions.forEach(a=>{if(!d&&!(l.key!==void 0&&l.key!=a.key)&&!(l.index!==void 0&&l.index!=a.index)&&!(!n&&(l.lang!==void 0&&l.lang!=a.lang||l.device!==void 0&&l.device!=a.device)))return a.searcher_key=o.key,d=a,!1}),d))return!1}),d},Q=le.useAsyncTopDialog(()=>new Promise((n,l)=>ne(["../.chunks/dialog_selectorRegions-D_HXNjOX.amd"],n,l))),fe=(n,l)=>{const r=x.useI18n(),t=e.ref(l.value.keys().next().value??y),d=e.computed(()=>{const o=new Map;if(l.value.forEach(a=>{let s={value:a.key,title:a.name};n.addSearcherIcon&&(s.icon=P.getSearcherGIcon(a.key)),o.set(a.key,s)}),n.addCompare&&!o.has(y)){const a={value:"",title:"--------------------",disabled:!0};o.set(a.value,a);const s={value:w,title:r.Common.Compare};o.set(s.value,s)}return o});return{searcherKey:t,optionBySearcherKey:d}},ve=(n,l)=>{var o,a,s;const r=x.useI18n(),t=e.ref(y);n.modelValue.length===1&&(t.value=n.modelValue[0]),t.value===y&&(n.forFrequency?t.value=((a=(o=l.value)==null?void 0:o.regionByIndex.values().next().value)==null?void 0:a.key)??y:t.value=((s=l.value)==null?void 0:s.regionByIndex.keys().next().value)??y);const d=e.computed(()=>{var h;const f=new Map;return(h=l.value.regionByIndex)==null||h.forEach(S=>{let i=S.name;if(n.forFrequency){const I={value:S.key,title:i};f.has(S.key)||f.set(S.key,I);return}S.device&&(i+=" ("+r.Common["Device_"+S.device]+")");const m=P.getLangLabel(l.value.key||0,S.lang??"");m&&(i+=" / "+m);const c={value:S.index,title:i,icon:S.device?P.getDeviceGIcon(S.device):void 0};f.set(S.index,c)}),f});return e.watch(d,(f,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&f.get(t.value))return;let S=f.keys().next().value;if(t.value===y||S===y){t.value=S;return}let i=((c=h==null?void 0:h.get(t.value))==null?void 0:c.title)||"",m=-1;for(const[I,B]of f.entries()){const C=B.title;if(typeof C!="string"||typeof I=="string")break;if(C===i){S=I;break}const V=new RegExp(` \\((${r.Common.Device_1}|${r.Common.Device_2})\\)`);let v=i,u=3;C.indexOf(v)===-1&&(v=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),v=v.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)!==-1&&(u<=m||(m=u,S=I))}t.value=S}),{regionIndex:t,optionByRegionIndex:d}},pe=(n,l,r)=>{const t=e.ref([]),d=()=>{if(n.onlySearcher&&l.value){t.value=Array.from(l.value.keys());return}let a=[];if(n.modelValue.length>1)a=[...n.modelValue];else try{a=JSON.parse(localStorage.getItem("ui:project:regionSelector"+n.projectId+":regionsIndexes"))??[]}catch{}a.length&&(a=a.filter(s=>r.value.has(s))),a.length||(a=Array.from(r.value)),t.value=[...a]},o=()=>{t.value.length?localStorage.setItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes",JSON.stringify(t.value)):localStorage.removeItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes")};return e.watch(t,()=>{o()}),n.addCompare&&d(),{regionsIndexes:t}},ye=n=>{const l=e.computed(()=>z(n.forFrequency,n.autoRegion,n.searchers)),r=e.computed(()=>l.value.get(d.searcherKey.value)||G),t=e.computed(()=>{const i=new Set;return l.value.forEach(m=>{m.regionByIndex.forEach(c=>{c.index!==L&&c.index!==y&&i.add(c.index)})}),i}),d=fe(n,l),o=ve(n,r),a=pe(n,l,t);e.watch(l,()=>{var m,c,I,B;if(n.onlySearcher?a.regionsIndexes.value=Array.from(l.value.keys()):a.regionsIndexes.value=a.regionsIndexes.value.filter(C=>t.value.has(C)),d.searcherKey.value===w)return;let i=l.value.keys().next().value;l.value.forEach(C=>{var V,v,u;if(n.onlySearcher&&C.key===d.searcherKey.value){i=d.searcherKey.value;return}if(o.regionIndex.value&&((V=C.regionByIndex)!=null&&V.has(o.regionIndex.value))&&(i=C.key),!n.onlySearcher){let g;i!==void 0&&(g=(v=l.value.get(i))==null?void 0:v.regionByIndex);const p=(u=l.value.get(C.key))==null?void 0:u.regionByIndex;g!=null&&g.has(y)&&!(p!=null&&p.has(y))&&(i=C.key)}}),i!==void 0&&(d.searcherKey.value=i),o.regionIndex.value!==void 0&&!((c=(m=r.value)==null?void 0:m.regionByIndex)!=null&&c.has(o.regionIndex.value))&&(o.regionIndex.value=(B=(I=r.value)==null?void 0:I.regions)==null?void 0:B.keys().next().value)},{immediate:!0});const s=()=>{if(!(d.searcherKey.value===w||d.searcherKey.value===y))return d.searcherKey.value},f=()=>{if(n.onlySearcher||o.regionIndex.value===y)return;let i=o.regionIndex.value;if(n.forFrequency){const m=o.regionIndex.value,c=H(n.forFrequency,{searcher_key:s(),key:m},n.searchers);i=c==null?void 0:c.index}return i},h=()=>{const i=s();if(i!==void 0)return l.value.get(i)};return{selectSearcher:d,selectRegion:o,compare:a,searcherByKey:l,allRegionsIndexes:t,getSearcher:h,getRegion:()=>{var m,c;const i=f();if(i!==void 0)return(c=(m=h())==null?void 0:m.regionByIndex)==null?void 0:c.get(i)}}},he=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:["update:modelValue","update:modelValueSingle"],setup(n,{expose:l}){const r=n,t=e.useModel(n,"modelValue"),d=e.useModel(n,"modelValueSingle"),{selectSearcher:o,selectRegion:a,compare:s,searcherByKey:f,allRegionsIndexes:h,getSearcher:S,getRegion:i}=ye(r),m=()=>{const c=[];f.value.forEach(I=>{I.enabled&&I.regions.forEach(B=>{B.enabled&&c.push(B)})}),Q.open("selectorRegions",{regions:c,regionsIndexes:s.regionsIndexes.value,"@update:regionsIndexes":I=>s.regionsIndexes.value=I})};return e.watch([a.regionIndex,o.searcherKey,s.regionsIndexes],()=>{if(o.searcherKey.value===w&&s.regionsIndexes.value.length){if(JSON.stringify(t.value)===JSON.stringify(s.regionsIndexes.value))return;t.value=[...s.regionsIndexes.value]}else r.onlySearcher?(t.value=[o.searcherKey.value],o.searcherKey.value===y&&!r.autoRegion&&(t.value.length=0)):(t.value=[a.regionIndex.value],a.regionIndex.value===y&&!r.autoRegion&&(t.value.length=0));!r.onlySearcher&&!h.value.size&&(o.searcherKey.value=y)}),d.value&&e.watch(d,()=>{d.value&&(t.value=[d.value])},{immediate:!0}),e.watch(t,()=>{var c,I,B,C,V;if(t.value[0]&&(d.value=t.value[0]),r.onlySearcher){if(!t.value.length||t.value.length===1&&!f.value.has(t.value[0])||t.value.length===1&&t.value[0]===y&&!r.autoRegion){let v=f.value.keys().next().value;v===y&&!r.autoRegion&&(v=void 0,d.value=y),v!==void 0?t.value=[v]:t.value.length=0;return}if(t.value.length>1&&JSON.stringify(t.value)!==JSON.stringify(s.regionsIndexes.value)){t.value=[...s.regionsIndexes.value];return}}else{let v=[...new Set(t.value)],u=(I=(c=f.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=f.value.values().next().value)==null?void 0:B.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:V.key),u===y&&!r.autoRegion&&(u=void 0,d.value=y),!v.length)u!==void 0&&v.push(u);else if(v.length===1){let g=h.value;r.forFrequency&&(g=new Set,f.value.forEach(p=>{p.regionByIndex.forEach(k=>{k.index!==L&&k.index!==y&&g.add(k.key)})})),g.has(v[0])||(v=[],u!==void 0&&v.push(u))}else v=v.filter(g=>h.value.has(g)),!v.length&&u!==void 0&&v.push(u);if(JSON.stringify(t.value)!==JSON.stringify(v)){t.value=v;return}}if(!(t.value.length===1&&t.value[0]===(r.onlySearcher?o.searcherKey.value:a.regionIndex.value)))if(r.onlySearcher){if(t.value.length===1){o.searcherKey.value=t.value[0];return}o.searcherKey.value=w;return}else{if(!t.value.length)return;if(t.value.length===1&&o.searcherKey.value!==w){a.regionIndex.value=t.value[0];let v;for(const u of f.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){v=u.key;break}if(v!==void 0)break}v!==void 0&&(o.searcherKey.value=v)}else o.searcherKey.value=w,s.regionsIndexes.value=[...t.value]}},{immediate:!0}),l({getSearcher:S,getRegion:i}),(c,I)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-selectorRegion":!0,"top-selectorRegion-onlySearcher":c.onlySearcher})},[e.createVNode(x._sfc_main$4,{options:e.unref(o).optionBySearcherKey.value,modelValue:e.unref(o).searcherKey.value,"onUpdate:modelValue":I[0]||(I[0]=B=>e.unref(o).searcherKey.value=B),name:"searcher_key",addChanger:c.addChanger},null,8,["options","modelValue","addChanger"]),!c.onlySearcher&&e.unref(o).searcherKey.value!==e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main$4,{key:0,class:"top-select-region",options:e.unref(a).optionByRegionIndex.value,modelValue:e.unref(a).regionIndex.value,"onUpdate:modelValue":I[1]||(I[1]=B=>e.unref(a).regionIndex.value=B),name:c.forFrequency?"region_key":"region_index",addChanger:c.addChanger,"data-top-icon":c.addRegionIcon?"":void 0},null,8,["options","modelValue","name","addChanger","data-top-icon"])):e.createCommentVNode("",!0),c.addCompare&&!c.onlySearcher&&e.unref(o).searcherKey.value===e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main,{key:1,name:"compare",onClick:m,"data-count-compare-regions-indexes":e.unref(s).regionsIndexes.value.length},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.$i18n.Common.Selected_regions),1)]),_:1},8,["data-count-compare-regions-indexes"])):e.createCommentVNode("",!0)],2))}}),Se=[{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"}],X=n=>"-"+n,K=n=>n[0]==="-"?n.substring(1):n,O=(n,l)=>{n=K(n);const r=l.find(t=>t.id===n);if(r)return r},ke=["data-tag_id","data-tag_color_id","title"],D=e.defineComponent({__name:"tagIcon",props:{id:{},colorId:{},name:{},state:{}},setup(n){return(l,r)=>(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,ke))}}),Ie=["contenteditable","onKeydown"],Z=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(n,{emit:l}){const r=n,t=l,d=e.useModel(n,"name"),o=e.ref(null),a=e.computed(()=>navigator.userAgent.indexOf("Firefox")!=-1?{contenteditable:s.value,onpaste:m=>m.preventDefault()}:{}),s=e.ref(!1),f=async()=>{var m;s.value=!0,await e.nextTick(),(m=o.value)==null||m.focus()},h=()=>{var c;const m=(c=o.value)==null?void 0:c.innerText;if(!m)return S();o.value&&(o.value.innerText=m),s.value=!1,t("update:name",m)},S=async()=>{o.value&&(o.value.innerText=r.name),s.value=!1},i=m=>{if(s.value||r.disabled)return;let c="selected";r.canExclude&&(m.ctrlKey||m.metaKey)&&(c="excluded"),r.state==c&&(c=""),c===""&&t("unselect"),c==="selected"&&t("select"),c==="excluded"&&t("exclude")};return(m,c)=>(e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-tagSelector_tagListItem":!0,"top-tagSelector_tagListItem-inEdit":s.value,"top-tagSelector_tagListItem-disabled":m.disabled,"top-tagSelector_tagListItem-canExclude":m.canExclude,"top-tagSelector-active":!!m.state,"top-tagSelector-excluded":m.state==="excluded"}),onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createVNode(D,{id:m.id,name:d.value,colorId:m.colorId,state:m.state},null,8,["id","name","colorId","state"]),e.createElementVNode("span",e.mergeProps({ref_key:"elName",ref:o,class:"top-tagSelector_tagListItemName",contenteditable:s.value?"plaintext-only":!1},a.value,{onKeydown:[e.withKeys(e.withModifiers(h,["stop"]),["enter"]),e.withKeys(e.withModifiers(S,["stop"]),["esc"])]}),e.toDisplayString(d.value),17,Ie),m.editable?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[s.value?(e.openBlock(),e.createElementBlock("span",{key:1,"data-top-icon":"",class:"top-tagSelector_edit",onClick:e.withModifiers(h,["stop"])})):(e.openBlock(),e.createElementBlock("span",{key:0,"data-top-icon":"",class:"top-tagSelector_edit",onClick:f}))],64)):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),xe={key:1},ee=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(n){const l=n,r=e.useModel(n,"modelValue"),t=l.useTopButton?x._sfc_main:"div",d=l.useTopButton?"html":"default",o={model:r,mode:l.mode,targetId:l.targetId,filters:l.filters,payload:l.payload};return(a,s)=>{const f=e.resolveDirective("top-data");return e.openBlock(),e.createBlock(E._sfc_main$2,{id:a.id},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),e.mergeProps({class:{"top-tagSelector":!0,"top-tagSelector-filter":l.mode==="filter","top-tagSelector-setter_single":l.mode==="setter"&&!a.filters,"top-tagSelector-setter_several":l.mode==="setter"&&a.filters,"top-tagSelector-selectedOne":!r.value.length||r.value.length===1,"top-tagSelector-toTwoLine":r.value.length>5},color:"theme",styling:""},a.$attrs),{[e.unref(d)]:e.withCtx(()=>[!r.value.length&&a.mode==="filter"?(e.openBlock(),e.createBlock(D,{key:0,id:"all",colorId:"",name:a.$i18n.Common.All_tags??"",state:""},null,8,["name"])):e.createCommentVNode("",!0),a.mode==="setter"&&a.filters?(e.openBlock(),e.createElementBlock("div",xe,[e.renderSlot(a.$slots,"default")])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(r.value,h=>{var S,i;return e.openBlock(),e.createBlock(D,{id:e.unref(K)(h),colorId:((S=e.unref(O)(h,a.tags))==null?void 0:S.color_id)??"",name:((i=e.unref(O)(h,a.tags))==null?void 0:i.name)??"",state:e.unref(K)(h)===h?"selected":"excluded"},null,8,["id","colorId","name","state"])}),256))]),_:2},1040,["class"])),[[f,o,"topTagSelectorTarget"]])]),_:3},8,["id"])}}}),Ce=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(Se)},tagsModifiers:{}}),emits:e.mergeModels(["selector","setter","tagsChanged"],["update:modelValue","update:tags"]),setup(n,{emit:l}){const r=x.useI18n(),t=n,d=e.useModel(n,"modelValue"),o=e.useModel(n,"tags"),a=l,s=x.debounce((u,g)=>{a(u,g)},t.emitDelay);t.singleMode&&!d.value.length&&(d.value=[o.value[0].id]);const f=t.id??"top-popup-id-"+Math.random(),h=e.ref("add"),S=()=>{var p;const u=" "+((p=r.Common.Tags)==null?void 0:p.toLowerCase()),g=new Map;return g.set("add",{value:"add",title:r.Common.Add+u}),g.set("replace",{value:"replace",title:r.Common.Replace+u}),g.set("delete",{value:"delete",title:r.Common.Delete+u}),g};let i=e.shallowRef({model:d,mode:"filter",targetId:void 0,filters:void 0,payload:void 0});e.watch(d,()=>{s("selector",d.value)});const m=e.computed(()=>{if(i.value.mode==="setter"&&t.maxTagsForSetter&&!i.value.filters)return i.value.model.value.length>=t.maxTagsForSetter}),c=u=>{if(u!=="all"){if(i.value.model.value.includes(u))return"selected";if(i.value.model.value.includes(X(u)))return"excluded"}return u==="all"&&!i.value.model.value.length?"selected":""},I=(u,g)=>{const p=X(u);let k=i.value.model.value.filter(M=>M!==u&&M!==p);g==="select"&&k.push(u),g==="exclude"&&k.push(p),i.value.mode==="setter"&&i.value.targetId!==void 0&&t.requiredForSetter&&(k.length||k.push("1"),k.length===2&&i.value.model.value.length===1&&i.value.model.value[0]==="1"&&(k=k.filter(M=>M!=="1"))),t.singleMode&&!i.value.filters&&(k.length||(k=i.value.model.value),k.length>1&&(k=[k[k.length-1]])),k.sort((M,N)=>{if(!t.tags)return 0;const q=t.tags.findIndex(b=>b.id===M),R=t.tags.findIndex(b=>b.id===N);return q-R}),i.value.model.value=k,i.value.mode==="setter"&&i.value.targetId!==void 0&&s("setter",{tagsIds:k,targetId:i.value.targetId,payload:i.value.payload})},B=e.computed(()=>{let u="top-tagSelector_popup";return i.value.mode==="filter"&&(u+=" top-tagSelector_popup-filter"),i.value.mode==="setter"&&(u+=" top-tagSelector_popup-setter"),u}),C=()=>{const u=prompt("","New tag");if(!u||u==="New tag")return;const g=o.value.length+1;o.value.push({id:String(g),name:u,color_id:String((g-1)%10+1)}),a("tagsChanged",o.value)},V=u=>{var g;if(i.value=_.storage(u.elPopupOpener,"topTagSelectorTarget"),!i.value)throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");if(i.value.filters&&(h.value="add",i.value.model.value=[]),!((g=x.Core.$)!=null&&g.ui.sortable)){console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");return}!x.Core.state.isMobile&&!x.Core.state.isMobileUA&&o.value&&$(u.elPopup).sortable({items:'li:has([data-tag_id]:not([data-tag_id="all"]))',cancel:'[contenteditable="plaintext-only"], [contenteditable="true"]',distance:10,stop:function(p,k){if(!o.value)return;const M=$(k.item).parent().find("[data-tag_id]"),N=[];M.each((q,R)=>{if(!o.value)return;const b=$(R).attr("data-tag_id");N.push(b)}),o.value.sort((q,R)=>{const b=N.findIndex(j=>j===q.id),Ke=N.findIndex(j=>j===R.id);return b-Ke}),s("tagsChanged",o.value)}})},v=u=>{var g;(g=x.Core.$)!=null&&g.ui.sortable&&$(u.elPopup).data("ui-sortable")&&$(u.elPopup).sortable("destroy")};return(u,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ee,{class:"top-select_arrow",modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=p=>d.value=p),id:e.unref(f),tags:o.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(f),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=p=>V(p)),onClose:g[5]||(g[5]=p=>v(p)),"transition-duration":50},e.createSlots({contentList:e.withCtx(()=>[e.unref(i).mode==="filter"&&!u.singleMode?(e.openBlock(),e.createBlock(Z,{key:0,id:"all",colorId:"",name:u.$i18n.Common.All_tags??"",state:e.unref(i).model.value.length?"":"selected",onSelect:g[3]||(g[3]=p=>e.unref(i).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,p=>(e.openBlock(),e.createBlock(Z,{key:p.id,id:p.id,colorId:p.color_id,name:p.name,state:c(p.id),canExclude:e.unref(i).mode==="filter"&&!u.singleMode,editable:u.tagsEditable,disabled:m.value&&c(p.id)==="",onUnselect:k=>I(p.id,"unselect"),onSelect:k=>I(p.id,"select"),onExclude:k=>I(p.id,"exclude"),"onUpdate:name":k=>{p.name=k,e.unref(s)("tagsChanged",o.value)}},null,8,["id","colorId","name","state","canExclude","editable","disabled","onUnselect","onSelect","onExclude","onUpdate:name"]))),128)),u.tagsEditable&&o.value.length<u.tagsMax&&o.value.length<20?(e.openBlock(),e.createBlock(E._sfc_main$1,{key:1,"data-top-icon":"",onClick:e.withModifiers(C,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Add),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"header",fn:e.withCtx(()=>[e.createVNode(x._sfc_main$4,{modelValue:h.value,"onUpdate:modelValue":g[1]||(g[1]=p=>h.value=p),options:S()},null,8,["modelValue","options"])]),key:"0"}:void 0,e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"footer",fn:e.withCtx(()=>[e.createVNode(x._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(x._sfc_main,{onClick:g[2]||(g[2]=p=>e.unref(s)("setter",{tagsIds:e.unref(i).model.value,filters:e.unref(i).filters,filtersAction:h.value,payload:e.unref(i).payload}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.value==="add"?u.$i18n.Common.Add:"")+" "+e.toDisplayString(h.value==="replace"?u.$i18n.Common.Replace:"")+" "+e.toDisplayString(h.value==="delete"?u.$i18n.Common.Remove:""),1)]),_:1})]),key:"1"}:void 0]),1032,["id","class"])],64))}}),Be=(n,l)=>e.computed(()=>e.toValue(n).filter(d=>d.on>=0||d.id===l).map(d=>({value:d.id,title:d.url+` [${d.id}]`,icon:d.id===e.toValue(l)?"":"",content:d.name}))),Te=(n,l,r)=>{l||(l={id:n.id}),l.id=n.id;const t=ae.TopPopupWorker.genElPopupOpener("div",l);return t.classList.add("top-tagSelector"),n.useTopButton&&t.classList.add("top-button","top-color_theme"),n.mode==="filter"&&t.classList.add("top-tagSelector-filter"),n.mode==="setter"&&!n.filters&&t.classList.add("top-tagSelector-setter_single"),n.mode==="setter"&&n.filters&&t.classList.add("top-tagSelector-setter_several"),t.onclick=d=>{d.preventDefault(),d.stopPropagation(),t.onclick=null;const o=e.ref(n.modelValue),a={model:o,mode:n.mode,targetId:n.targetId,filters:n.filters,payload:n.payload};_.storage(t,"topTagSelectorTarget",a),delete t.dataset.topPopupDisabled,e.isRef(n.modelValue)||e.watch(o,()=>{n.modelValue=o.value,F(t,n,r)}),t.click()},e.isRef(n.modelValue)?e.watch(n.modelValue,()=>F(t,n,r)):_.storage(t,"topTagSelectorRender",d=>{n.modelValue=d;const o=_.storage(t,"topTagSelectorTarget");o&&(o.model.value=d),F(t,n,r)}),F(t,n,r),t},Ve=(n,l)=>{var r;(r=_.storage(n,"topTagSelectorRender"))==null||r(l)},F=(n,l,r)=>{var d;const t=e.unref(l.modelValue);if(n.classList.toggle("top-tagSelector-selectedOne",!t.length||t.length===1),n.classList.toggle("top-tagSelector-toTwoLine",t.length>5),l.mode==="setter"&&l.filters){n.innerHTML=`<div>${r}</div>`;return}if(n.innerHTML="",!t.length&&l.mode==="filter"){const o=te({id:"all",colorId:"",name:((d=x.useI18n().Common)==null?void 0:d.All_tags)??"",state:""});n.append(o)}t.forEach(o=>{var s,f;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((f=O(o,l.tags))==null?void 0:f.name)??"",state:K(o)===o?"selected":"excluded"});n.append(a)})},te=n=>{const l=document.createElement("div");return l.classList.add("top-tagSelector_tagIcon"),l.classList.toggle("top-tagSelector-active",!!n.state),l.classList.toggle("top-tagSelector-excluded",n.state==="excluded"),l.dataset.tag_id=n.id,l.dataset.tag_color_id=n.colorId,l.title=n.name,l},we=de,Me=he,be=Ce,Ee=ee,_e=D;T.TopSelectorCompetitors=we,T.TopSelectorRegion=Me,T.TopTagSelector=be,T.TopTagSelectorPopupOpener=Ee,T.TopTagSelectorTagIcon=_e,T.dialogSelectorRegions=Q,T.findRegion=H,T.genElTopTagSelectorPopupOpener=Te,T.genSearcherByKey=z,T.renderElTopTagSelectorPopupOpener=Ve,T.useItemsFromCompetitors=Be,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=project.amd.js.map
@@ -165,7 +165,7 @@ const je = { class: "top-selectorCompetitors" }, ze = { class: "top-ellipsis1" }
165
165
  }), i))
166
166
  return !1;
167
167
  }), i;
168
- }, Ze = De(() => import("../.chunks/dialog_selectorRegions-Dy0AlECS.es.js")), et = (t, l) => {
168
+ }, Ze = De(() => import("../.chunks/dialog_selectorRegions-DZR64Wm8.es.js")), et = (t, l) => {
169
169
  const o = R(), e = F(l.value.keys().next().value ?? p), i = E(() => {
170
170
  const a = /* @__PURE__ */ new Map();
171
171
  if (l.value.forEach((n) => {
@@ -1 +1 @@
1
- {"version":3,"file":"searchers.amd.js","sources":["../../src/core/utils/searchers.ts"],"sourcesContent":["import { useI18nLang } from '@/core/app';\n\n/**\n * Вспомогательный класс для работы с разными Поисковиками\n */\nexport const searchersNames = {\n\t0: 'Yandex',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GooglePlay',\n\t101: 'VK',\n\t102: 'Facebook',\n\t103: 'Twitter',\n};\n\n/**\n * Получить иконку ПС\n * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом\n */\nexport const getSearcherGIcon = (searcherKey: number | string | null): string => {\n\tlet icon = '';\n\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 20:\n\t\tcase 21:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase null:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку устройства (ПК, планшет, смартфон)\n */\nexport const getDeviceGIcon = (device: number | string): string => {\n\tlet icon = '';\n\n\tif (typeof device === 'string') device = Number(device);\n\n\tswitch (device % 10) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку языка\n */\nexport const getLangLabel = (searcherKey: number | string, lang: string) => {\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey * 1) {\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\tcase 8:\n\t\tcase 9:\n\t\t\treturn lang;\n\t}\n\n\treturn '';\n};\n\n/**\n * Сгенерировать заголовок типа частоты\n */\nexport const genVolumeLabel = (label: string, searcherKey: 0 | 1, volumeType: 1 | 2 | 3 | 5 | 6): string => {\n\tswitch (searcherKey * 1) {\n\t\t// Яндекс\n\t\tcase 0:\n\t\t\tswitch (volumeType * 1) {\n\t\t\t\tcase 2:\n\t\t\t\t\tlabel = `\"${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tlabel = `\"!${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tlabel = `\"[${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tlabel = `\"[!${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t// Google\n\t\tcase 1:\n\t\t\tlabel = `[${label}]`;\n\n\t\t\tbreak;\n\t}\n\n\treturn label;\n};\n\n/**\n * Проверить значение частоты, вернуть правильное значение частоты\n */\nexport const prepareVolumeType = (searcherKey: number, volumeType: number): number => {\n\t// по умолчанию выбрана сама точная частота\n\tif (volumeType === null) volumeType = 6;\n\n\tswitch (searcherKey) {\n\t\tcase 1:\n\t\t\tvolumeType = 3;\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tvolumeType = 2;\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tif (volumeType > 1) volumeType = 1;\n\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (![1, 2, 3, 5, 6].includes(volumeType)) volumeType = 3;\n\t}\n\n\treturn volumeType;\n};\n"],"names":["searchersNames","getSearcherGIcon","searcherKey","icon","getDeviceGIcon","device","getLangLabel","lang","genVolumeLabel","label","volumeType","prepareVolumeType"],"mappings":"4OAKO,MAAAA,EAAA,8IAWD,IAAA,SAEN,EAMaC,EAAAC,GAAA,UAKZ,yCAAAA,EAAA,CAAqB,IAAA,eAInB,IAAA,IACI,IAAA,gBAIJ,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,KAAA,gBAIA,CAGF,OAAAC,CACD,EAKaC,EAAAC,GAAA,yDAKS,IAAA,eAInB,IAAA,eAIA,IAAA,cAIA,CAGF,OAAAF,CACD,EAKaG,EAAA,CAAAJ,EAAAK,IAAA,+CAGa,IAAA,GACnB,IAAA,GACA,IAAA,GACA,IAAA,GACA,IAAA,GACA,IAAA,GAEJ,OAAAA,CAAO,CAGT,MAAA,EACD,EAKOC,EAAA,CAAAC,EAAAP,EAAAQ,IAAA,aACmB,IAAA,eAGC,IAAA,oBAItB,IAAA,qBAIA,IAAA,sBAIA,IAAA,sBAIA,OAEF,IAAA,mBAKA,CAGF,OAAAD,CACD,EAKaE,EAAA,CAAAT,EAAAQ,IAAA,CAIZ,OAFAA,IAAA,OAAAA,EAAA,GAEAR,EAAA,CAAqB,IAAA,aAInB,IAAA,aAIA,IAAA,GAEAQ,EAAA,IAAAA,EAAA,+CAIwD,CAG1D,OAAAA,CACD"}
1
+ {"version":3,"file":"searchers.amd.js","sources":["../../src/core/utils/searchers.ts"],"sourcesContent":["import { useI18nLang } from '@/core/app';\n\n/**\n * Вспомогательный класс для работы с разными Поисковиками\n */\nexport const searchersNames = {\n\t0: 'Yandex',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GooglePlay',\n\t101: 'VK',\n\t102: 'Facebook',\n\t103: 'Twitter',\n};\n\n/**\n * Получить иконку ПС\n * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом\n */\nexport const getSearcherGIcon = (searcherKey: number | string | undefined): string => {\n\tlet icon = '';\n\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 20:\n\t\tcase 21:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase null:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку устройства (ПК, планшет, смартфон)\n */\nexport const getDeviceGIcon = (device: number | string): string => {\n\tlet icon = '';\n\n\tif (typeof device === 'string') device = Number(device);\n\n\tswitch (device % 10) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку языка\n */\nexport const getLangLabel = (searcherKey: number | string, lang: string) => {\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey * 1) {\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\tcase 8:\n\t\tcase 9:\n\t\t\treturn lang;\n\t}\n\n\treturn '';\n};\n\n/**\n * Сгенерировать заголовок типа частоты\n */\nexport const genVolumeLabel = (label: string, searcherKey: 0 | 1, volumeType: 1 | 2 | 3 | 5 | 6): string => {\n\tswitch (searcherKey * 1) {\n\t\t// Яндекс\n\t\tcase 0:\n\t\t\tswitch (volumeType * 1) {\n\t\t\t\tcase 2:\n\t\t\t\t\tlabel = `\"${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tlabel = `\"!${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tlabel = `\"[${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tlabel = `\"[!${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t// Google\n\t\tcase 1:\n\t\t\tlabel = `[${label}]`;\n\n\t\t\tbreak;\n\t}\n\n\treturn label;\n};\n\n/**\n * Проверить значение частоты, вернуть правильное значение частоты\n */\nexport const prepareVolumeType = (searcherKey: number, volumeType: number): number => {\n\t// по умолчанию выбрана сама точная частота\n\tif (volumeType === null) volumeType = 6;\n\n\tswitch (searcherKey) {\n\t\tcase 1:\n\t\t\tvolumeType = 3;\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tvolumeType = 2;\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tif (volumeType > 1) volumeType = 1;\n\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (![1, 2, 3, 5, 6].includes(volumeType)) volumeType = 3;\n\t}\n\n\treturn volumeType;\n};\n"],"names":["searchersNames","getSearcherGIcon","searcherKey","icon","getDeviceGIcon","device","getLangLabel","lang","genVolumeLabel","label","volumeType","prepareVolumeType"],"mappings":"4OAKO,MAAAA,EAAA,8IAWD,IAAA,SAEN,EAMaC,EAAAC,GAAA,UAKZ,yCAAAA,EAAA,CAAqB,IAAA,eAInB,IAAA,IACI,IAAA,gBAIJ,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,IAAA,eAIA,KAAA,gBAIA,CAGF,OAAAC,CACD,EAKaC,EAAAC,GAAA,yDAKS,IAAA,eAInB,IAAA,eAIA,IAAA,cAIA,CAGF,OAAAF,CACD,EAKaG,EAAA,CAAAJ,EAAAK,IAAA,+CAGa,IAAA,GACnB,IAAA,GACA,IAAA,GACA,IAAA,GACA,IAAA,GACA,IAAA,GAEJ,OAAAA,CAAO,CAGT,MAAA,EACD,EAKOC,EAAA,CAAAC,EAAAP,EAAAQ,IAAA,aACmB,IAAA,eAGC,IAAA,oBAItB,IAAA,qBAIA,IAAA,sBAIA,IAAA,sBAIA,OAEF,IAAA,mBAKA,CAGF,OAAAD,CACD,EAKaE,EAAA,CAAAT,EAAAQ,IAAA,CAIZ,OAFAA,IAAA,OAAAA,EAAA,GAEAR,EAAA,CAAqB,IAAA,aAInB,IAAA,aAIA,IAAA,GAEAQ,EAAA,IAAAA,EAAA,+CAIwD,CAG1D,OAAAA,CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"searchers.js","sources":["../../src/core/utils/searchers.ts"],"sourcesContent":["import { useI18nLang } from '@/core/app';\n\n/**\n * Вспомогательный класс для работы с разными Поисковиками\n */\nexport const searchersNames = {\n\t0: 'Yandex',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GooglePlay',\n\t101: 'VK',\n\t102: 'Facebook',\n\t103: 'Twitter',\n};\n\n/**\n * Получить иконку ПС\n * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом\n */\nexport const getSearcherGIcon = (searcherKey: number | string | null): string => {\n\tlet icon = '';\n\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 20:\n\t\tcase 21:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase null:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку устройства (ПК, планшет, смартфон)\n */\nexport const getDeviceGIcon = (device: number | string): string => {\n\tlet icon = '';\n\n\tif (typeof device === 'string') device = Number(device);\n\n\tswitch (device % 10) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку языка\n */\nexport const getLangLabel = (searcherKey: number | string, lang: string) => {\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey * 1) {\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\tcase 8:\n\t\tcase 9:\n\t\t\treturn lang;\n\t}\n\n\treturn '';\n};\n\n/**\n * Сгенерировать заголовок типа частоты\n */\nexport const genVolumeLabel = (label: string, searcherKey: 0 | 1, volumeType: 1 | 2 | 3 | 5 | 6): string => {\n\tswitch (searcherKey * 1) {\n\t\t// Яндекс\n\t\tcase 0:\n\t\t\tswitch (volumeType * 1) {\n\t\t\t\tcase 2:\n\t\t\t\t\tlabel = `\"${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tlabel = `\"!${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tlabel = `\"[${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tlabel = `\"[!${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t// Google\n\t\tcase 1:\n\t\t\tlabel = `[${label}]`;\n\n\t\t\tbreak;\n\t}\n\n\treturn label;\n};\n\n/**\n * Проверить значение частоты, вернуть правильное значение частоты\n */\nexport const prepareVolumeType = (searcherKey: number, volumeType: number): number => {\n\t// по умолчанию выбрана сама точная частота\n\tif (volumeType === null) volumeType = 6;\n\n\tswitch (searcherKey) {\n\t\tcase 1:\n\t\t\tvolumeType = 3;\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tvolumeType = 2;\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tif (volumeType > 1) volumeType = 1;\n\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (![1, 2, 3, 5, 6].includes(volumeType)) volumeType = 3;\n\t}\n\n\treturn volumeType;\n};\n"],"names":["searchersNames","getSearcherGIcon","searcherKey","icon","getDeviceGIcon","device","getLangLabel","lang","genVolumeLabel","label","volumeType","prepareVolumeType"],"mappings":";;;;AAKO,MAAMA,IAAiB;AAAA,EAC7B,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACN,GAMaC,IAAmB,CAACC,MAAgD;AAChF,MAAIC,IAAO;AAIX,UAFI,OAAOD,KAAgB,aAAUA,IAAc,OAAOA,CAAW,IAE7DA,GAAa;AAAA,IACpB,KAAK;AACG,MAAAC,IAAA;AAEP;AAAA,IACD,KAAK;AAAA,IACL,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,EAAA;AAGK,SAAAA;AACR,GAKaC,IAAiB,CAACC,MAAoC;AAClE,MAAIF,IAAO;AAIX,UAFI,OAAOE,KAAW,aAAUA,IAAS,OAAOA,CAAM,IAE9CA,IAAS,IAAI;AAAA,IACpB,KAAK;A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["../../src/core/utils/searchers.ts"],"sourcesContent":["import { useI18nLang } from '@/core/app';\n\n/**\n * Вспомогательный класс для работы с разными Поисковиками\n */\nexport const searchersNames = {\n\t0: 'Yandex',\n\t20: 'Yandex.com',\n\t21: 'Yandex.com.tr',\n\t1: 'Google',\n\t4: 'YouTube',\n\t5: 'Bing',\n\t7: 'Seznam',\n\t8: 'AppStore',\n\t9: 'GooglePlay',\n\t101: 'VK',\n\t102: 'Facebook',\n\t103: 'Twitter',\n};\n\n/**\n * Получить иконку ПС\n * @param searcherKey - цифра или строка с цифрой обозначающая ПС. Если null вернется иконка с глобусом\n */\nexport const getSearcherGIcon = (searcherKey: number | string | undefined): string => {\n\tlet icon = '';\n\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 20:\n\t\tcase 21:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase null:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку устройства (ПК, планшет, смартфон)\n */\nexport const getDeviceGIcon = (device: number | string): string => {\n\tlet icon = '';\n\n\tif (typeof device === 'string') device = Number(device);\n\n\tswitch (device % 10) {\n\t\tcase 0:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ticon = '';\n\n\t\t\tbreak;\n\t}\n\n\treturn icon;\n};\n\n/**\n * Получить иконку языка\n */\nexport const getLangLabel = (searcherKey: number | string, lang: string) => {\n\tif (typeof searcherKey === 'string') searcherKey = Number(searcherKey);\n\n\tswitch (searcherKey * 1) {\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 5:\n\t\tcase 6:\n\t\tcase 8:\n\t\tcase 9:\n\t\t\treturn lang;\n\t}\n\n\treturn '';\n};\n\n/**\n * Сгенерировать заголовок типа частоты\n */\nexport const genVolumeLabel = (label: string, searcherKey: 0 | 1, volumeType: 1 | 2 | 3 | 5 | 6): string => {\n\tswitch (searcherKey * 1) {\n\t\t// Яндекс\n\t\tcase 0:\n\t\t\tswitch (volumeType * 1) {\n\t\t\t\tcase 2:\n\t\t\t\t\tlabel = `\"${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tlabel = `\"!${label}\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tlabel = `\"[${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tlabel = `\"[!${label}]\"`;\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t// Google\n\t\tcase 1:\n\t\t\tlabel = `[${label}]`;\n\n\t\t\tbreak;\n\t}\n\n\treturn label;\n};\n\n/**\n * Проверить значение частоты, вернуть правильное значение частоты\n */\nexport const prepareVolumeType = (searcherKey: number, volumeType: number): number => {\n\t// по умолчанию выбрана сама точная частота\n\tif (volumeType === null) volumeType = 6;\n\n\tswitch (searcherKey) {\n\t\tcase 1:\n\t\t\tvolumeType = 3;\n\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tvolumeType = 2;\n\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tif (volumeType > 1) volumeType = 1;\n\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (![1, 2, 3, 5, 6].includes(volumeType)) volumeType = 3;\n\t}\n\n\treturn volumeType;\n};\n"],"names":["searchersNames","getSearcherGIcon","searcherKey","icon","getDeviceGIcon","device","getLangLabel","lang","genVolumeLabel","label","volumeType","prepareVolumeType"],"mappings":";;;;AAKO,MAAMA,IAAiB;AAAA,EAC7B,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACN,GAMaC,IAAmB,CAACC,MAAqD;AACrF,MAAIC,IAAO;AAIX,UAFI,OAAOD,KAAgB,aAAUA,IAAc,OAAOA,CAAW,IAE7DA,GAAa;AAAA,IACpB,KAAK;AACG,MAAAC,IAAA;AAEP;AAAA,IACD,KAAK;AAAA,IACL,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,IACD,KAAK;AACG,MAAAA,IAAA;AAEP;AAAA,EAAA;AAGK,SAAAA;AACR,GAKaC,IAAiB,CAACC,MAAoC;AAClE,MAAIF,IAAO;AAIX,UAFI,OAAOE,KAAW,aAAUA,IAAS,OAAOA,CAAM,I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A;AACR;"}
@@ -1,2 +0,0 @@
1
- define(["require","exports","vue","./page.vue_vue_type_script_setup_true_lang-BI9HWAyQ.amd","./utils-CTjq0RlC.amd","../utils/string.amd","../utils/searchers.amd","../require/css.amd!../assets/dialog_selectorRegions.css"],function(w,p,e,v,f,k,r){"use strict";if(typeof e>"u")var e=window.Vue;const h={class:"dialog_selectorRegions_header"},y=["data-top-icon"],C=["src","alt"],V={class:"dialog_selectorRegions_regionAreaName top-ellipsis"},x={key:1},B=["data-top-icon"],N=e.defineComponent({id:"selectorRegions",__name:"dialog_selectorRegions",props:{regions:{},regionsIndexes:{},"@update:regionsIndexes":{type:Function}},setup(R){const c=R,g=f.useTopDialogSelf(),i=e.ref(!1),l=e.ref([]),d=e.reactive({searcher_key:-1,key:-1,name:-1}),u=n=>{d[n]=-d[n],l.value.sort((t,a)=>!t[n]||!a[n]?-1:t[n]>=a[n]?d[n]:-d[n])},I=()=>{var t;if(!l.value.some(a=>a.selected))return;const n=l.value.filter(a=>a.selected).map(a=>a.index);(t=c["@update:regionsIndexes"])==null||t.call(c,n),g.close()};return e.watch(i,()=>{l.value=l.value.map(n=>({...n,selected:i.value}))}),e.watch([()=>c.regions,()=>c.regionsIndexes],()=>{l.value=[];let n=!0;c.regions.forEach(t=>{let a=t.name;t.areaName&&(a+=` (${t.areaName})`);const s=c.regionsIndexes.indexOf(+t.index)!==-1,o=r.getSearcherGIcon(t.searcher_key),m=t.lang!==void 0?r.getLangLabel(t.searcher_key,t.lang):void 0,S=t.device!==void 0?r.getDeviceGIcon(t.device):void 0,b=t.countryCode!==void 0?k.genFlagLinkByCountryCode(t.countryCode):void 0,_={...t,selected:s,title:a,searcherIcon:o,langLabel:m,deviceIcon:S,flagLink:b};l.value.push(_),_.selected||(n=!1)}),i.value=n}),(n,t)=>{const a=e.resolveComponent("TopCheckbox"),s=e.resolveComponent("TopButton");return e.openBlock(),e.createBlock(e.unref(v._sfc_main),{id:e.unref(g).id,pageActive:"selectorRegions",class:"dialog_selectorRegions",height:"600px",width:"600px"},{default:e.withCtx(()=>[e.createVNode(e.unref(v._sfc_main$1),{name:"selectorRegions",order:0},{header:e.withCtx(()=>[e.createElementVNode("div",h,[e.createVNode(a,{modelValue:i.value,"onUpdate:modelValue":t[0]||(t[0]=o=>i.value=o)},null,8,["modelValue"]),e.createVNode(s,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:t[1]||(t[1]=o=>u("searcher_key"))}),e.createVNode(s,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:t[2]||(t[2]=o=>u("key"))}),e.createVNode(s,{class:"dialog_selectorRegions_sortButton",color:"theme","data-top-icon":"",onClick:t[3]||(t[3]=o=>u("name"))})])]),body:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,o=>(e.openBlock(),e.createBlock(a,{key:o.index,modelValue:o.selected,"onUpdate:modelValue":m=>o.selected=m,class:"dialog_selectorRegions_region"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"dialog_selectorRegions_regionSearcherIcon","data-top-icon":o.searcherIcon},null,8,y),o.flagLink?(e.openBlock(),e.createElementBlock("img",{key:0,class:"top-flag",src:"//topvisor.dev"+o.flagLink,alt:o.countryCode},null,8,C)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(o.name)+" ",1),e.createElementVNode("div",V,e.toDisplayString(o.areaName),1),o.langLabel?(e.openBlock(),e.createElementBlock("div",x," ["+e.toDisplayString(o.langLabel)+"] ",1)):e.createCommentVNode("",!0),o.deviceIcon?(e.openBlock(),e.createElementBlock("div",{key:2,"data-top-icon":o.deviceIcon},null,8,B)):e.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),128))]),footer:e.withCtx(()=>[e.createVNode(s,{onClick:I},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.$i18n.Common.Apply),1)]),_:1})]),_:1})]),_:1},8,["id"])}}});p.default=N,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
2
- //# sourceMappingURL=dialog_selectorRegions-BOPta9cH.amd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dialog_selectorRegions-BOPta9cH.amd.js","sources":["../../src/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { reactive, ref, watch } from 'vue';\nimport { TopDialog, TopDialogPage, useTopDialogSelf } from '@/components/dialog/dialog';\nimport { genFlagLinkByCountryCode } from '@/core/utils/string';\nimport type { Props, RegionRich } from './types';\nimport { getDeviceGIcon, getLangLabel, getSearcherGIcon } from '@/core/utils/searchers';\n\ndefineOptions({ id: 'selectorRegions' });\n\nconst props = defineProps<Partial<Props>>();\n\nconst dialog = useTopDialogSelf();\n\n/**\n * Выбраны все регионы\n */\nconst isAllSelected = ref(false);\n\n/**\n * Список расширенных регионов для использования в компоненте\n */\nconst regionsRich = ref<RegionRich[]>([]);\n\n/**\n * Направление сортировки по полю\n */\nconst sortedVectorByField = reactive({\n\tsearcher_key: -1,\n\tkey: -1,\n\tname: -1,\n});\n\n/**\n * Сортировать регионы по выбранному полю\n * @param sortedField - Поле для сортировки\n */\nconst sort = (sortedField: keyof typeof sortedVectorByField) => {\n\tsortedVectorByField[sortedField] = -sortedVectorByField[sortedField];\n\n\tregionsRich.value.sort((regionA, regionB) => {\n\t\tif (!regionA[sortedField] || !regionB[sortedField]) return -1;\n\n\t\treturn regionA[sortedField] >= regionB[sortedField] ? sortedVectorByField[sortedField] : -sortedVectorByField[sortedField];\n\t});\n};\n\n/**\n * Применить изменения\n *\n * Вызывает callback `props['@update:regionsIndexes']`\n */\nconst onSubmit = () => {\n\tif (!regionsRich.value.some((region) => region.selected)) return;\n\n\tconst regionsIndexes = regionsRich.value.filter((region) => region.selected).map((region) => region.index);\n\n\tprops['@update:regionsIndexes']?.(regionsIndexes);\n\n\tdialog.close();\n};\n\n// Выбрать / отменить все регионы\nwatch(isAllSelected, () => {\n\tregionsRich.value = regionsRich.value.map((region) => ({ ...region, selected: isAllSelected.value }));\n});\n\n// генерация регионов\nwatch([\n\t() => props.regions,\n\t() => props.regionsIndexes,\n], () => {\n\tregionsRich.value = [];\n\n\tlet isAllSelectedLocal = true;\n\n\tprops.regions.forEach((region) => {\n\t\tlet title = region.name;\n\t\tif (region.areaName) title += ` (${region.areaName})`;\n\n\t\tconst selected = (props.regionsIndexes.indexOf(+region.index) !== -1);\n\t\tconst searcherIcon = getSearcherGIcon(region.searcher_key);\n\t\tconst langLabel = region.lang !== undefined ? getLangLabel(region.searcher_key, region.lang) : undefined;\n\t\tconst deviceIcon = region.device !== undefined ? getDeviceGIcon(region.device) : undefined;\n\t\tconst flagLink = region.countryCode !== undefined ? genFlagLinkByCountryCode(region.countryCode) : undefined;\n\n\t\tconst regionRich = {\n\t\t\t...region,\n\t\t\tselected,\n\t\t\ttitle,\n\t\t\tsearcherIcon,\n\t\t\tlangLabel,\n\t\t\tdeviceIcon,\n\t\t\tflagLink,\n\t\t};\n\n\t\tregionsRich.value.push(regionRich);\n\n\t\tif (!regionRich.selected) {\n\t\t\tisAllSelectedLocal = false;\n\t\t}\n\t});\n\n\tisAllSelected.value = isAllSelectedLocal;\n});\n</script>\n\n<template>\n\t<TopDialog\n\t\t:id=\"dialog.id\"\n\t\tpageActive=\"selectorRegions\"\n\t\tclass=\"dialog_selectorRegions\"\n\t\theight=\"600px\"\n\t\twidth=\"600px\"\n\t>\n\t\t<TopDialogPage name=\"selectorRegions\" :order=\"0\">\n\t\t\t<template #header>\n\t\t\t\t<div class=\"dialog_selectorRegions_header\">\n\t\t\t\t\t<TopCheckbox v-model=\"isAllSelected\"></TopCheckbox>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('searcher_key')\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('key')\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('name')\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #body>\n\t\t\t\t<TopCheckbox\n\t\t\t\t\tv-for=\"region of regionsRich\"\n\t\t\t\t\t:key=\"region.index\"\n\t\t\t\t\tv-model=\"region.selected\"\n\t\t\t\t\tclass=\"dialog_selectorRegions_region\"\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_regionSearcherIcon\"\n\t\t\t\t\t\t:data-top-icon=\"region.searcherIcon\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<img\n\t\t\t\t\t\tv-if=\"region.flagLink\"\n\t\t\t\t\t\tclass=\"top-flag\"\n\t\t\t\t\t\t:src=\"'//topvisor.dev' + region.flagLink\"\n\t\t\t\t\t\t:alt=\"region.countryCode\"\n\t\t\t\t\t>\n\n\t\t\t\t\t{{ region.name }}\n\n\t\t\t\t\t<div class=\"dialog_selectorRegions_regionAreaName top-ellipsis\">\n\t\t\t\t\t\t{{ region.areaName }}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div v-if=\"region.langLabel\">\n\t\t\t\t\t\t[{{ region.langLabel }}]\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"region.deviceIcon\"\n\t\t\t\t\t\t:data-top-icon=\"region.deviceIcon\"\n\t\t\t\t\t></div>\n\t\t\t\t</TopCheckbox>\n\t\t\t</template>\n\n\t\t\t<template #footer>\n\t\t\t\t<TopButton @click=\"onSubmit\">\n\t\t\t\t\t{{ $i18n.Common.Apply }}\n\t\t\t\t</TopButton>\n\t\t\t</template>\n\t\t</TopDialogPage>\n\t</TopDialog>\n</template>\n\n<style>\n@import \"./style.css\";\n</style>\n"],"names":["dialog","utils","isAllSelected","vue","regionsRich","sortedVectorByField","sort","sortedField","regionA","regionB","region","_a","props","regionsIndexes","title","selected","deviceIcon","utils_searchers","flagLink","utils_string","searcherIcon","langLabel","regionRich","isAllSelectedLocal"],"mappings":"+nBAWAA,EAAAC,EAAA,iBAAA,EAKAC,EAAAC,EAAA,IAAA,EAAA,EAKAC,EAAAD,EAAA,IAAA,CAAA,CAAA,EAKAE,EAAAF,EAAA,SAAA,wBAEM,KAAA,EACC,CAAA,EAOPG,EAAAC,GAAA,gCAIE,CAAAC,EAAAD,CAAA,GAAA,CAAAE,EAAAF,CAAA,EAAA,wBAEyH,gBAU1H,GAAA,CAAAH,EAAA,MAAA,KAAAM,GAAAA,EAAA,QAAA,EAAA,8DAIAC,EAAAC,EAAA,4BAAA,MAAAD,EAAA,KAAAC,EAAAC,cAMD,OAAAV,EAAA,MAAAD,EAAA,IAAA,kDACqG,CAAA,EAIrGC,EAAA,MAAA,mCAEa,EAAA,IAAA,CAEZC,EAAA,MAAA,CAAA,iCAKC,IAAAU,EAAAJ,EAAA,KACAA,EAAA,WAAAI,GAAA,KAAAJ,EAAA,QAAA,KAEA,MAAAK,EAAAH,EAAA,eAAA,QAAA,CAAAF,EAAA,KAAA,IAAA,uGAGAM,EAAAN,EAAA,SAAA,OAAAO,EAAA,eAAAP,EAAA,MAAA,EAAA,OACAQ,EAAAR,EAAA,cAAA,OAAAS,EAAA,yBAAAT,EAAA,WAAA,EAAA,UAEmB,GAAAA,EACf,SAAAK,EACH,MAAAD,EACA,aAAAM,EACA,UAAAC,EACA,WAAAL,cAKDZ,EAAA,MAAA,KAAAkB,CAAA,EAEAA,EAAA,gBAEA,CAAA,EAGDpB,EAAA,MAAAqB,CAAsB,CAAA"}
@@ -1,140 +0,0 @@
1
- import { Core as N } from "../core/app.js";
2
- import { defineComponent as $, ref as x, reactive as A, watch as R, resolveComponent as I, createBlock as L, openBlock as c, unref as f, withCtx as i, createVNode as r, createTextVNode as V, toDisplayString as m, createElementBlock as p, Fragment as w, renderList as D, createElementVNode as k, createCommentVNode as h } from "vue";
3
- import { _ as E, a as U } from "./page.vue_vue_type_script_setup_true_lang-CCE8pKg7.es.js";
4
- import { b as G } from "./utils-DIly8mml.es.js";
5
- import { genFlagLinkByCountryCode as O } from "../utils/string.js";
6
- import { getSearcherGIcon as P, getLangLabel as j, getDeviceGIcon as q } from "../utils/searchers.js";
7
- const T = ["../assets/dialog_selectorRegions.css"].map((_) => import.meta.resolve(_));
8
- N.insertCSSLinkToPage(T, !0);
9
- const z = { class: "dialog_selectorRegions_header" }, H = ["data-top-icon"], J = ["src", "alt"], K = { class: "dialog_selectorRegions_regionAreaName top-ellipsis" }, M = { key: 1 }, Q = ["data-top-icon"], oe = /* @__PURE__ */ $({
10
- id: "selectorRegions",
11
- __name: "dialog_selectorRegions",
12
- props: {
13
- regions: {},
14
- regionsIndexes: {},
15
- "@update:regionsIndexes": { type: Function }
16
- },
17
- setup(_) {
18
- const l = _, y = G(), d = x(!1), a = x([]), u = A({
19
- searcher_key: -1,
20
- key: -1,
21
- name: -1
22
- }), v = (t) => {
23
- u[t] = -u[t], a.value.sort((e, s) => !e[t] || !s[t] ? -1 : e[t] >= s[t] ? u[t] : -u[t]);
24
- }, S = () => {
25
- var e;
26
- if (!a.value.some((s) => s.selected)) return;
27
- const t = a.value.filter((s) => s.selected).map((s) => s.index);
28
- (e = l["@update:regionsIndexes"]) == null || e.call(l, t), y.close();
29
- };
30
- return R(d, () => {
31
- a.value = a.value.map((t) => ({ ...t, selected: d.value }));
32
- }), R([
33
- () => l.regions,
34
- () => l.regionsIndexes
35
- ], () => {
36
- a.value = [];
37
- let t = !0;
38
- l.regions.forEach((e) => {
39
- let s = e.name;
40
- e.areaName && (s += ` (${e.areaName})`);
41
- const n = l.regionsIndexes.indexOf(+e.index) !== -1, o = P(e.searcher_key), g = e.lang !== void 0 ? j(e.searcher_key, e.lang) : void 0, b = e.device !== void 0 ? q(e.device) : void 0, B = e.countryCode !== void 0 ? O(e.countryCode) : void 0, C = {
42
- ...e,
43
- selected: n,
44
- title: s,
45
- searcherIcon: o,
46
- langLabel: g,
47
- deviceIcon: b,
48
- flagLink: B
49
- };
50
- a.value.push(C), C.selected || (t = !1);
51
- }), d.value = t;
52
- }), (t, e) => {
53
- const s = I("TopCheckbox"), n = I("TopButton");
54
- return c(), L(f(E), {
55
- id: f(y).id,
56
- pageActive: "selectorRegions",
57
- class: "dialog_selectorRegions",
58
- height: "600px",
59
- width: "600px"
60
- }, {
61
- default: i(() => [
62
- r(f(U), {
63
- name: "selectorRegions",
64
- order: 0
65
- }, {
66
- header: i(() => [
67
- k("div", z, [
68
- r(s, {
69
- modelValue: d.value,
70
- "onUpdate:modelValue": e[0] || (e[0] = (o) => d.value = o)
71
- }, null, 8, ["modelValue"]),
72
- r(n, {
73
- class: "dialog_selectorRegions_sortButton",
74
- color: "theme",
75
- "data-top-icon": "",
76
- onClick: e[1] || (e[1] = (o) => v("searcher_key"))
77
- }),
78
- r(n, {
79
- class: "dialog_selectorRegions_sortButton",
80
- color: "theme",
81
- "data-top-icon": "",
82
- onClick: e[2] || (e[2] = (o) => v("key"))
83
- }),
84
- r(n, {
85
- class: "dialog_selectorRegions_sortButton",
86
- color: "theme",
87
- "data-top-icon": "",
88
- onClick: e[3] || (e[3] = (o) => v("name"))
89
- })
90
- ])
91
- ]),
92
- body: i(() => [
93
- (c(!0), p(w, null, D(a.value, (o) => (c(), L(s, {
94
- key: o.index,
95
- modelValue: o.selected,
96
- "onUpdate:modelValue": (g) => o.selected = g,
97
- class: "dialog_selectorRegions_region"
98
- }, {
99
- default: i(() => [
100
- k("div", {
101
- class: "dialog_selectorRegions_regionSearcherIcon",
102
- "data-top-icon": o.searcherIcon
103
- }, null, 8, H),
104
- o.flagLink ? (c(), p("img", {
105
- key: 0,
106
- class: "top-flag",
107
- src: "//topvisor.dev" + o.flagLink,
108
- alt: o.countryCode
109
- }, null, 8, J)) : h("", !0),
110
- V(" " + m(o.name) + " ", 1),
111
- k("div", K, m(o.areaName), 1),
112
- o.langLabel ? (c(), p("div", M, " [" + m(o.langLabel) + "] ", 1)) : h("", !0),
113
- o.deviceIcon ? (c(), p("div", {
114
- key: 2,
115
- "data-top-icon": o.deviceIcon
116
- }, null, 8, Q)) : h("", !0)
117
- ]),
118
- _: 2
119
- }, 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
120
- ]),
121
- footer: i(() => [
122
- r(n, { onClick: S }, {
123
- default: i(() => [
124
- V(m(t.$i18n.Common.Apply), 1)
125
- ]),
126
- _: 1
127
- })
128
- ]),
129
- _: 1
130
- })
131
- ]),
132
- _: 1
133
- }, 8, ["id"]);
134
- };
135
- }
136
- });
137
- export {
138
- oe as default
139
- };
140
- //# sourceMappingURL=dialog_selectorRegions-Dy0AlECS.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dialog_selectorRegions-Dy0AlECS.es.js","sources":["../../src/components/project/selectorRegion/dialog_selectorRegions/dialog_selectorRegions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { reactive, ref, watch } from 'vue';\nimport { TopDialog, TopDialogPage, useTopDialogSelf } from '@/components/dialog/dialog';\nimport { genFlagLinkByCountryCode } from '@/core/utils/string';\nimport type { Props, RegionRich } from './types';\nimport { getDeviceGIcon, getLangLabel, getSearcherGIcon } from '@/core/utils/searchers';\n\ndefineOptions({ id: 'selectorRegions' });\n\nconst props = defineProps<Partial<Props>>();\n\nconst dialog = useTopDialogSelf();\n\n/**\n * Выбраны все регионы\n */\nconst isAllSelected = ref(false);\n\n/**\n * Список расширенных регионов для использования в компоненте\n */\nconst regionsRich = ref<RegionRich[]>([]);\n\n/**\n * Направление сортировки по полю\n */\nconst sortedVectorByField = reactive({\n\tsearcher_key: -1,\n\tkey: -1,\n\tname: -1,\n});\n\n/**\n * Сортировать регионы по выбранному полю\n * @param sortedField - Поле для сортировки\n */\nconst sort = (sortedField: keyof typeof sortedVectorByField) => {\n\tsortedVectorByField[sortedField] = -sortedVectorByField[sortedField];\n\n\tregionsRich.value.sort((regionA, regionB) => {\n\t\tif (!regionA[sortedField] || !regionB[sortedField]) return -1;\n\n\t\treturn regionA[sortedField] >= regionB[sortedField] ? sortedVectorByField[sortedField] : -sortedVectorByField[sortedField];\n\t});\n};\n\n/**\n * Применить изменения\n *\n * Вызывает callback `props['@update:regionsIndexes']`\n */\nconst onSubmit = () => {\n\tif (!regionsRich.value.some((region) => region.selected)) return;\n\n\tconst regionsIndexes = regionsRich.value.filter((region) => region.selected).map((region) => region.index);\n\n\tprops['@update:regionsIndexes']?.(regionsIndexes);\n\n\tdialog.close();\n};\n\n// Выбрать / отменить все регионы\nwatch(isAllSelected, () => {\n\tregionsRich.value = regionsRich.value.map((region) => ({ ...region, selected: isAllSelected.value }));\n});\n\n// генерация регионов\nwatch([\n\t() => props.regions,\n\t() => props.regionsIndexes,\n], () => {\n\tregionsRich.value = [];\n\n\tlet isAllSelectedLocal = true;\n\n\tprops.regions.forEach((region) => {\n\t\tlet title = region.name;\n\t\tif (region.areaName) title += ` (${region.areaName})`;\n\n\t\tconst selected = (props.regionsIndexes.indexOf(+region.index) !== -1);\n\t\tconst searcherIcon = getSearcherGIcon(region.searcher_key);\n\t\tconst langLabel = region.lang !== undefined ? getLangLabel(region.searcher_key, region.lang) : undefined;\n\t\tconst deviceIcon = region.device !== undefined ? getDeviceGIcon(region.device) : undefined;\n\t\tconst flagLink = region.countryCode !== undefined ? genFlagLinkByCountryCode(region.countryCode) : undefined;\n\n\t\tconst regionRich = {\n\t\t\t...region,\n\t\t\tselected,\n\t\t\ttitle,\n\t\t\tsearcherIcon,\n\t\t\tlangLabel,\n\t\t\tdeviceIcon,\n\t\t\tflagLink,\n\t\t};\n\n\t\tregionsRich.value.push(regionRich);\n\n\t\tif (!regionRich.selected) {\n\t\t\tisAllSelectedLocal = false;\n\t\t}\n\t});\n\n\tisAllSelected.value = isAllSelectedLocal;\n});\n</script>\n\n<template>\n\t<TopDialog\n\t\t:id=\"dialog.id\"\n\t\tpageActive=\"selectorRegions\"\n\t\tclass=\"dialog_selectorRegions\"\n\t\theight=\"600px\"\n\t\twidth=\"600px\"\n\t>\n\t\t<TopDialogPage name=\"selectorRegions\" :order=\"0\">\n\t\t\t<template #header>\n\t\t\t\t<div class=\"dialog_selectorRegions_header\">\n\t\t\t\t\t<TopCheckbox v-model=\"isAllSelected\"></TopCheckbox>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('searcher_key')\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('key')\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<TopButton\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_sortButton\"\n\t\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"sort('name')\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #body>\n\t\t\t\t<TopCheckbox\n\t\t\t\t\tv-for=\"region of regionsRich\"\n\t\t\t\t\t:key=\"region.index\"\n\t\t\t\t\tv-model=\"region.selected\"\n\t\t\t\t\tclass=\"dialog_selectorRegions_region\"\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"dialog_selectorRegions_regionSearcherIcon\"\n\t\t\t\t\t\t:data-top-icon=\"region.searcherIcon\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<img\n\t\t\t\t\t\tv-if=\"region.flagLink\"\n\t\t\t\t\t\tclass=\"top-flag\"\n\t\t\t\t\t\t:src=\"'//topvisor.dev' + region.flagLink\"\n\t\t\t\t\t\t:alt=\"region.countryCode\"\n\t\t\t\t\t>\n\n\t\t\t\t\t{{ region.name }}\n\n\t\t\t\t\t<div class=\"dialog_selectorRegions_regionAreaName top-ellipsis\">\n\t\t\t\t\t\t{{ region.areaName }}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div v-if=\"region.langLabel\">\n\t\t\t\t\t\t[{{ region.langLabel }}]\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"region.deviceIcon\"\n\t\t\t\t\t\t:data-top-icon=\"region.deviceIcon\"\n\t\t\t\t\t></div>\n\t\t\t\t</TopCheckbox>\n\t\t\t</template>\n\n\t\t\t<template #footer>\n\t\t\t\t<TopButton @click=\"onSubmit\">\n\t\t\t\t\t{{ $i18n.Common.Apply }}\n\t\t\t\t</TopButton>\n\t\t\t</template>\n\t\t</TopDialogPage>\n\t</TopDialog>\n</template>\n\n<style>\n@import \"./style.css\";\n</style>\n"],"names":["props","__props","dialog","useTopDialogSelf","isAllSelected","ref","regionsRich","sortedVectorByField","reactive","sort","sortedField","regionA","regionB","onSubmit","region","regionsIndexes","_a","watch","isAllSelectedLocal","title","selected","searcherIcon","getSearcherGIcon","langLabel","getLangLabel","deviceIcon","getDeviceGIcon","flagLink","genFlagLinkByCountryCode","regionRich"],"mappings":";;;;;;;;;;;;;;;;;AASA,UAAAA,IAAAC,GAEAC,IAAAC,EAAA,GAKAC,IAAAC,EAAA,EAAA,GAKAC,IAAAD,EAAA,CAAA,CAAA,GAKAE,IAAAC,EAAA;AAAA,MAAqC,cAAA;AAAA,MACtB,KAAA;AAAA,MACT,MAAA;AAAA,IACC,CAAA,GAOPC,IAAA,CAAAC,MAAA;AACC,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