@topvisor/ui 1.0.34 → 1.0.35

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.
Files changed (102) hide show
  1. package/.chunks/{core-CUNwUlL6.es.js → core-DipMf5fL.es.js} +4 -4
  2. package/.chunks/{core-CUNwUlL6.es.js.map → core-DipMf5fL.es.js.map} +1 -1
  3. package/.chunks/{core-BHvOvH4M.amd.js → core-MEpuX1uJ.amd.js} +2 -2
  4. package/.chunks/{core-BHvOvH4M.amd.js.map → core-MEpuX1uJ.amd.js.map} +1 -1
  5. package/.chunks/{datepicker-CW2Ql1NG.es.js → datepicker-CSXTkKbz.es.js} +2 -2
  6. package/.chunks/{datepicker-CW2Ql1NG.es.js.map → datepicker-CSXTkKbz.es.js.map} +1 -1
  7. package/.chunks/{datepicker-C0a_eKze.amd.js → datepicker-CkmL14DR.amd.js} +2 -2
  8. package/.chunks/{datepicker-C0a_eKze.amd.js.map → datepicker-CkmL14DR.amd.js.map} +1 -1
  9. package/.chunks/{dialog_selectorRegions-Bkw1LXvI.es.js → dialog_selectorRegions-DrwLBBcE.es.js} +4 -4
  10. package/.chunks/{dialog_selectorRegions-Bkw1LXvI.es.js.map → dialog_selectorRegions-DrwLBBcE.es.js.map} +1 -1
  11. package/.chunks/{dialog_selectorRegions-Bhblg2Ks.amd.js → dialog_selectorRegions-UF09pD6-.amd.js} +2 -2
  12. package/.chunks/{dialog_selectorRegions-Bhblg2Ks.amd.js.map → dialog_selectorRegions-UF09pD6-.amd.js.map} +1 -1
  13. package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-CXtBj2Ah.amd.js → dialogs.vue_vue_type_script_setup_true_lang-Dvauzr0y.amd.js} +2 -2
  14. package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-CXtBj2Ah.amd.js.map → dialogs.vue_vue_type_script_setup_true_lang-Dvauzr0y.amd.js.map} +1 -1
  15. package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-JyillkBh.es.js → dialogs.vue_vue_type_script_setup_true_lang-jCRcr8b0.es.js} +2 -2
  16. package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-JyillkBh.es.js.map → dialogs.vue_vue_type_script_setup_true_lang-jCRcr8b0.es.js.map} +1 -1
  17. package/.chunks/{forms-CKYHAaPQ.amd.js → forms-DvEX_A0C.amd.js} +3 -3
  18. package/.chunks/{forms-CKYHAaPQ.amd.js.map → forms-DvEX_A0C.amd.js.map} +1 -1
  19. package/.chunks/{forms-zDpk9gMK.es.js → forms-gknXHfMr.es.js} +7 -7
  20. package/.chunks/{forms-zDpk9gMK.es.js.map → forms-gknXHfMr.es.js.map} +1 -1
  21. package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-Di1h6iID.es.js → listItem.vue_vue_type_script_setup_true_lang-CFOaqhEN.es.js} +23 -23
  22. package/.chunks/listItem.vue_vue_type_script_setup_true_lang-CFOaqhEN.es.js.map +1 -0
  23. package/.chunks/listItem.vue_vue_type_script_setup_true_lang-DzidIHjH.amd.js +2 -0
  24. package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-C_ZN2Nia.amd.js.map → listItem.vue_vue_type_script_setup_true_lang-DzidIHjH.amd.js.map} +1 -1
  25. package/.chunks/{menu.vue_vue_type_style_index_0_lang-vyCH9NUZ.amd.js → menu.vue_vue_type_style_index_0_lang-BTEBvb7v.amd.js} +2 -2
  26. package/.chunks/{menu.vue_vue_type_style_index_0_lang-vyCH9NUZ.amd.js.map → menu.vue_vue_type_style_index_0_lang-BTEBvb7v.amd.js.map} +1 -1
  27. package/.chunks/{menu.vue_vue_type_style_index_0_lang-B5fkWPo5.es.js → menu.vue_vue_type_style_index_0_lang-Di2dBh6s.es.js} +2 -2
  28. package/.chunks/{menu.vue_vue_type_style_index_0_lang-B5fkWPo5.es.js.map → menu.vue_vue_type_style_index_0_lang-Di2dBh6s.es.js.map} +1 -1
  29. package/.chunks/{notice-B8hUtbou.es.js → notice-B1bqWjOr.es.js} +2 -2
  30. package/.chunks/{notice-B8hUtbou.es.js.map → notice-B1bqWjOr.es.js.map} +1 -1
  31. package/.chunks/{notice-CyeaHgdt.amd.js → notice-CNEYYEEf.amd.js} +2 -2
  32. package/.chunks/{notice-CyeaHgdt.amd.js.map → notice-CNEYYEEf.amd.js.map} +1 -1
  33. package/.chunks/{page.vue_vue_type_script_setup_true_lang-DmbqzLa6.amd.js → page.vue_vue_type_script_setup_true_lang-Z_tJYuPX.amd.js} +2 -2
  34. package/.chunks/{page.vue_vue_type_script_setup_true_lang-DmbqzLa6.amd.js.map → page.vue_vue_type_script_setup_true_lang-Z_tJYuPX.amd.js.map} +1 -1
  35. package/.chunks/{page.vue_vue_type_script_setup_true_lang-C8oRGxFZ.es.js → page.vue_vue_type_script_setup_true_lang-rQWGIFXD.es.js} +4 -4
  36. package/.chunks/{page.vue_vue_type_script_setup_true_lang-C8oRGxFZ.es.js.map → page.vue_vue_type_script_setup_true_lang-rQWGIFXD.es.js.map} +1 -1
  37. package/.chunks/{popup-BaFsC2VD.es.js → popup-B62kTGwH.es.js} +2 -2
  38. package/.chunks/{popup-BaFsC2VD.es.js.map → popup-B62kTGwH.es.js.map} +1 -1
  39. package/.chunks/{popup-DR6JnpNV.amd.js → popup-sy_pGJeq.amd.js} +2 -2
  40. package/.chunks/{popup-DR6JnpNV.amd.js.map → popup-sy_pGJeq.amd.js.map} +1 -1
  41. package/.chunks/utils-CIbDLh5d.es.js +227 -0
  42. package/.chunks/{utils-CKggUvLI.es.js.map → utils-CIbDLh5d.es.js.map} +1 -1
  43. package/.chunks/{utils-BPyrKdwc.amd.js → utils-CtUqTcmN.amd.js} +2 -2
  44. package/.chunks/{utils-BPyrKdwc.amd.js.map → utils-CtUqTcmN.amd.js.map} +1 -1
  45. package/.chunks/{utils-BPcGxQ0s.es.js → utils-DnAJ2MaK.es.js} +2 -2
  46. package/.chunks/{utils-BPcGxQ0s.es.js.map → utils-DnAJ2MaK.es.js.map} +1 -1
  47. package/.chunks/utils-abiX7BcR.amd.js +2 -0
  48. package/.chunks/{utils-BO3j538g.amd.js.map → utils-abiX7BcR.amd.js.map} +1 -1
  49. package/assets/core.css +1 -1
  50. package/assets/forms.css +1 -1
  51. package/assets/layout.css +1 -1
  52. package/charts/charts.amd.js +1 -1
  53. package/charts/charts.js +1 -1
  54. package/components/core/notice/item/types.d.ts +2 -0
  55. package/core/app.amd.js +1 -1
  56. package/core/app.js +5 -5
  57. package/dialog/dialog.amd.js +1 -1
  58. package/dialog/dialog.js +2 -2
  59. package/extra/extra.amd.js +1 -1
  60. package/extra/extra.amd.js.map +1 -1
  61. package/extra/extra.js +1 -0
  62. package/extra/extra.js.map +1 -1
  63. package/forms/forms.amd.js +1 -1
  64. package/forms/forms.js +1 -1
  65. package/formsExt/formsExt.amd.js +1 -1
  66. package/formsExt/formsExt.js +2 -2
  67. package/layout/layout.amd.js +1 -1
  68. package/layout/layout.amd.js.map +1 -1
  69. package/layout/layout.js +1 -1
  70. package/layout/layout.js.map +1 -1
  71. package/package.json +4 -1
  72. package/popup/popup.amd.js +1 -1
  73. package/popup/popup.js +2 -2
  74. package/popup/worker.amd.js +1 -1
  75. package/popup/worker.js +2 -2
  76. package/project/project.amd.js +1 -1
  77. package/project/project.js +5 -5
  78. package/tabsView/tabsView.amd.js +1 -1
  79. package/tabsView/tabsView.amd.js.map +1 -1
  80. package/tabsView/tabsView.js +1 -1
  81. package/tabsView/tabsView.js.map +1 -1
  82. package/utils/clipboard.amd.js +1 -1
  83. package/utils/clipboard.js +1 -1
  84. package/utils/date.amd.js +1 -1
  85. package/utils/date.js +1 -1
  86. package/utils/device.amd.js +1 -1
  87. package/utils/device.js +1 -1
  88. package/utils/lodash.amd.js +1 -1
  89. package/utils/lodash.js +1 -1
  90. package/utils/price.amd.js +1 -1
  91. package/utils/price.js +1 -1
  92. package/utils/searchers.amd.js +1 -1
  93. package/utils/searchers.js +3 -3
  94. package/utils/string.amd.js +1 -1
  95. package/utils/string.amd.js.map +1 -1
  96. package/utils/string.js +5 -5
  97. package/utils/string.js.map +1 -1
  98. package/.chunks/listItem.vue_vue_type_script_setup_true_lang-C_ZN2Nia.amd.js +0 -2
  99. package/.chunks/listItem.vue_vue_type_script_setup_true_lang-Di1h6iID.es.js.map +0 -1
  100. package/.chunks/utils-BO3j538g.amd.js +0 -2
  101. package/.chunks/utils-CKggUvLI.es.js +0 -227
  102. package/components/tabsView/tabsView/store.d.ts +0 -192
@@ -1,2 +1,2 @@
1
- define(["require","exports","vue","../.chunks/forms-CKYHAaPQ.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-C_ZN2Nia.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-vyCH9NUZ.amd","../.chunks/utils-BPyrKdwc.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 v;return s.value===((v=r.value)==null?void 0:v[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,a=>{var s;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(s=r.value)==null?void 0:s.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 v={...s};a.regionByIndex.set(v.index,v)}),!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-Bhblg2Ks.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 v=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};v.has(S.key)||v.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};v.set(S.index,c)}),v});return e.watch(d,(v,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&v.get(t.value))return;let S=v.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 v.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 f=i,u=3;C.indexOf(f)===-1&&(f=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(f)===-1&&(f=i.replace(/ \/.*/,""),u--),C.indexOf(f)===-1&&(f=i.replace(/ \/.*/,""),f=f.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(f)!==-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,f,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=(f=l.value.get(i))==null?void 0:f.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},v=()=>{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=v();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:v,allRegionsIndexes:h,getSearcher:S,getRegion:i}=ye(r),m=()=>{const c=[];v.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&&!v.value.has(t.value[0])||t.value.length===1&&t.value[0]===y&&!r.autoRegion){let f=v.value.keys().next().value;f===y&&!r.autoRegion&&(f=void 0,d.value=y),f!==void 0?t.value=[f]: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 f=[...new Set(t.value)],u=(I=(c=v.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=v.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),!f.length)u!==void 0&&f.push(u);else if(f.length===1){let g=h.value;r.forFrequency&&(g=new Set,v.value.forEach(p=>{p.regionByIndex.forEach(k=>{k.index!==L&&k.index!==y&&g.add(k.key)})})),g.has(f[0])||(f=[],u!==void 0&&f.push(u))}else f=f.filter(g=>h.value.has(g)),!f.length&&u!==void 0&&f.push(u);if(JSON.stringify(t.value)!==JSON.stringify(f)){t.value=f;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 f;for(const u of v.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){f=u.key;break}if(f!==void 0)break}f!==void 0&&(o.searcherKey.value=f)}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),v=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:v}))],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 v=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"])),[[v,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 v=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)}})},f=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(v),tags:o.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(v),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=p=>V(p)),onClose:g[5]||(g[5]=p=>f(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,v;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((v=O(o,l.tags))==null?void 0:v.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-DvEX_A0C.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-DzidIHjH.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-BTEBvb7v.amd","../.chunks/utils-CtUqTcmN.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 v;return s.value===((v=r.value)==null?void 0:v[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,a=>{var s;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(s=r.value)==null?void 0:s.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 v={...s};a.regionByIndex.set(v.index,v)}),!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-UF09pD6-.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 v=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};v.has(S.key)||v.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};v.set(S.index,c)}),v});return e.watch(d,(v,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&v.get(t.value))return;let S=v.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 v.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 f=i,u=3;C.indexOf(f)===-1&&(f=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(f)===-1&&(f=i.replace(/ \/.*/,""),u--),C.indexOf(f)===-1&&(f=i.replace(/ \/.*/,""),f=f.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(f)!==-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,f,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=(f=l.value.get(i))==null?void 0:f.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},v=()=>{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=v();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:v,allRegionsIndexes:h,getSearcher:S,getRegion:i}=ye(r),m=()=>{const c=[];v.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&&!v.value.has(t.value[0])||t.value.length===1&&t.value[0]===y&&!r.autoRegion){let f=v.value.keys().next().value;f===y&&!r.autoRegion&&(f=void 0,d.value=y),f!==void 0?t.value=[f]: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 f=[...new Set(t.value)],u=(I=(c=v.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=v.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),!f.length)u!==void 0&&f.push(u);else if(f.length===1){let g=h.value;r.forFrequency&&(g=new Set,v.value.forEach(p=>{p.regionByIndex.forEach(k=>{k.index!==L&&k.index!==y&&g.add(k.key)})})),g.has(f[0])||(f=[],u!==void 0&&f.push(u))}else f=f.filter(g=>h.value.has(g)),!f.length&&u!==void 0&&f.push(u);if(JSON.stringify(t.value)!==JSON.stringify(f)){t.value=f;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 f;for(const u of v.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){f=u.key;break}if(f!==void 0)break}f!==void 0&&(o.searcherKey.value=f)}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),v=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:v}))],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 v=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"])),[[v,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 v=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)}})},f=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(v),tags:o.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(v),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=p=>V(p)),onClose:g[5]||(g[5]=p=>f(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,v;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((v=O(o,l.tags))==null?void 0:v.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
@@ -1,9 +1,9 @@
1
1
  import { Core as be } from "../core/app.js";
2
2
  import { defineComponent as P, mergeModels as N, useModel as D, computed as E, createElementBlock as B, openBlock as k, createBlock as b, unref as y, withCtx as _, Fragment as Y, renderList as se, normalizeClass as X, createElementVNode as he, toDisplayString as K, createVNode as A, createTextVNode as G, ref as F, watch as w, createCommentVNode as q, withModifiers as z, mergeProps as Se, withKeys as de, nextTick as Ve, resolveDirective as Ee, withDirectives as Me, resolveDynamicComponent as Ke, renderSlot as $e, shallowRef as we, createSlots as Le, reactive as Ae, toValue as ce, isRef as ge } from "vue";
3
- import { u as R, C as J, _ as H, y as ie, d as Re } from "../.chunks/forms-zDpk9gMK.es.js";
4
- import { _ as Ie, a as ue, b as Oe } from "../.chunks/listItem.vue_vue_type_script_setup_true_lang-Di1h6iID.es.js";
5
- import { _ as Ne } from "../.chunks/menu.vue_vue_type_style_index_0_lang-B5fkWPo5.es.js";
6
- import { u as De } from "../.chunks/utils-BPcGxQ0s.es.js";
3
+ import { u as R, C as J, _ as H, y as ie, d as Re } from "../.chunks/forms-gknXHfMr.es.js";
4
+ import { _ as Ie, a as ue, b as Oe } from "../.chunks/listItem.vue_vue_type_script_setup_true_lang-CFOaqhEN.es.js";
5
+ import { _ as Ne } from "../.chunks/menu.vue_vue_type_style_index_0_lang-Di2dBh6s.es.js";
6
+ import { u as De } from "../.chunks/utils-DnAJ2MaK.es.js";
7
7
  import { getSearcherGIcon as Fe, getLangLabel as qe, getDeviceGIcon as Pe } from "../utils/searchers.js";
8
8
  import { storage as W } from "../utils/dom.js";
9
9
  import { TopPopupWorker as Ue } from "../popup/worker.js";
@@ -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-Bkw1LXvI.es.js")), et = (t, l) => {
168
+ }, Ze = De(() => import("../.chunks/dialog_selectorRegions-DrwLBBcE.es.js")), et = (t, l) => {
169
169
  const n = R(), e = F(l.value.keys().next().value ?? p), i = E(() => {
170
170
  const a = /* @__PURE__ */ new Map();
171
171
  if (l.value.forEach((o) => {
@@ -1,2 +1,2 @@
1
- define(["require","exports","vue","../.chunks/forms-CKYHAaPQ.amd","../utils/route.amd","../.chunks/store-esTid5oI.amd","../popup/popup.amd","../utils/system.amd","../require/css.amd!../assets/tabsView.css"],function(X,h,e,m,f,_,S,L){"use strict";if(typeof e>"u")var e=window.Vue;const g=(o,n)=>`top:${String(o)}:${n}`,y={loadLocalStorge:(o,n)=>{if(!n.$id)return;const t=g(o,n.$id);try{const a=JSON.parse(localStorage.getItem(t));typeof a==typeof n[o]&&(n[o]=a)}catch{console.warn(new Error(`В localStorage[${t}] не корректный json`))}},addSaverLocalStorge:(o,n)=>{if(!n.$id)return;const t=g(o,n.$id);e.watch(()=>n[o],()=>{localStorage.setItem(t,JSON.stringify(n[o]))},{immediate:!0})}},k=new Set;addEventListener("popstate",o=>{k.forEach(n=>n(o))});const V=Symbol(),C=(o,n)=>{const t=_.defineStore(V,()=>{const a=e.computed(()=>o.showMenuInPopup??m.Core.state.isMobile),i=e.computed(()=>o.pageMod),u=e.ref(!1),r=e.ref(void 0),l=e.ref(!0);return{showMenuInPopup:a,pageMod:i,isShort:u,activeItemName:n,component:r,scrollable:l}},o.idState);if(o.isShortable){const a="isShort";y.loadLocalStorge(a,t),y.addSaverLocalStorge(a,t)}if(t.$id){const a=i=>{n.value=f.getHash(t.$id)};k.add(a)}return t},w=()=>_.useStore(V),P={key:1,class:"top-ellipsis"},v=e.defineComponent({__name:"menuItem",props:{name:{},href:{},icon:{},disabled:{type:Boolean},component:{default:void 0},scrollable:{type:Boolean,default:!0}},setup(o){const n=o,t=w(),a=e.computed(()=>n.name&&t.$id?f.genHash(t.$id,n.name):n.href),i=e.computed(()=>t.showMenuInPopup?S.TopPopupListItem:a?"a":"button"),u=r=>{!n.href&&a.value&&r.preventDefault(),n.name&&(t.activeItemName=n.name)};return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{target:"_self",class:e.normalizeClass({"top-tabsView_menuItem":!e.unref(t).showMenuInPopup,"top-active":r.name&&e.unref(t).activeItemName===r.name,"top-disabled":r.disabled,"top-spa-disabled":!0}),href:a.value,"data-top-icon":r.icon||void 0,disabled:r.disabled||void 0,onClick:u},{default:e.withCtx(()=>[e.unref(t).showMenuInPopup?e.renderSlot(r.$slots,"default",{key:0}):r.$slots.default&&!e.unref(t).isShort?(e.openBlock(),e.createElementBlock("span",P,[e.renderSlot(r.$slots,"default")])):e.createCommentVNode("",!0)]),_:3},8,["class","href","data-top-icon","disabled"]))}}),B=o=>(o==null?void 0:o.name)==="AsyncComponentWrapper"&&!(o!=null&&o.__asyncResolved),E=async(o,n)=>{(o==null?void 0:o.name)==="AsyncComponentWrapper"&&(o!=null&&o.__asyncResolved||(o.__asyncLoader(),await L.sleepWhile(()=>n()&&B(o),200)))},z={class:"top-tabsView_menuOpener"},R=["data-top-icon"],O={class:"top-ellipsis"},D={class:"top-tabsView_menuList"},H={key:0,class:"top-tabsView_menuFooter"},K=e.defineComponent({__name:"menu",props:e.mergeModels({isShortable:{type:Boolean},isLoading:{type:Boolean}},{isLoading:{},isLoadingModifiers:{}}),emits:["update:isLoading"],setup(o){const n=e.useModel(o,"isLoading"),t=w(),a=e.useSlots(),i=new Map,u=()=>{if(!a.default)return;const c=a.default({}).find(s=>s.key==="_menu");c&&r(c.children)},r=c=>{c.forEach(s=>{var M,$,N,T;if(s.type.__name&&s.type.__name!==v.__name)return;if(!s.type.__name&&typeof s.children=="object"){r(s.children);return}if(!((M=s.props)!=null&&M.name)||($=s.props)!=null&&$.disabled)return;const I={title:((T=(N=s.children).default)==null?void 0:T.call(N)[0].children).trim(),icon:s.props.icon,component:s.props.component?e.markRaw(s.props.component):v.props.component.default,scrollable:s.props.scrollable??v.props.scrollable.default};i.set(s.props.name,I)})},l=e.ref(null);let d=0;e.watch(()=>t.activeItemName,async()=>{const c=++d;if(i.size===0&&u(),i.size===0){t.activeItemName="";return}if(l.value=i.get(t.activeItemName)??null,!l.value&&t.$id){const s=f.getHash(t.$id);if(l.value=i.get(s)??null,l.value){t.activeItemName=s;return}}if(!l.value){t.activeItemName=i.keys().next().value;return}if(l.value.component===t.component){n.value=!1;return}t.$id&&f.setHash(t.$id,t.activeItemName,!1),n.value=!0,await E(l.value.component,()=>c===d),c===d&&(t.scrollable=l.value.scrollable,t.component=l.value.component,l.value&&!t.component&&console.warn(`Компонент вкладки ${t.activeItemName} не найден. Добавьте props.component для пункта меню ${t.activeItemName}.`))},{immediate:!0});const p=e.ref();let b;return e.onMounted(()=>{b=new ResizeObserver(()=>{p.value.parentElement.style.setProperty("--top-tabsView-contents-offset-top",p.value.offsetHeight+"px")}),b.observe(p.value)}),e.onUnmounted(()=>{b.disconnect()}),(c,s)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:p,class:e.normalizeClass({"top-tabsView_menu":!0,"top-tabsView_menu-inPopup_0":!e.unref(t).showMenuInPopup,"top-tabsView_menu-inPopup_1":e.unref(t).showMenuInPopup,"top-tabsView_menu-short":e.unref(t).isShort&&!e.unref(t).showMenuInPopup})},[e.unref(t).showMenuInPopup?(e.openBlock(),e.createBlock(e.unref(S.TopPopup),{key:0},{opener:e.withCtx(()=>[e.createElementVNode("div",z,[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-tabsView_menuOpenerActiveItem","data-top-icon":l.value.icon},[e.createElementVNode("span",O,e.toDisplayString(l.value.title),1)],8,R)):e.createCommentVNode("",!0),s[1]||(s[1]=e.createElementVNode("div",{class:"top-tabsView_menuOpenerIcon","data-top-icon":""},null,-1))])]),contentList:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",D,[e.renderSlot(c.$slots,"default")]),c.isShortable?(e.openBlock(),e.createElementBlock("div",H,[c.isShortable?(e.openBlock(),e.createBlock(v,{key:0,icon:e.unref(t).isShort?"":"",onClick:s[0]||(s[0]=I=>e.unref(t).isShort=!e.unref(t).isShort)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t).isShort?"":"Свернуть"),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],64))],2))}}),j=e.defineComponent({__name:"tabsView",props:e.mergeModels({modelValue:{},pageMod:{type:Boolean},showMenuInPopup:{type:Boolean,default:void 0},isShortable:{type:Boolean,default:!1},idState:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const n=o,t=e.useModel(o,"modelValue"),a=C(n,t),i=Math.random();n.pageMod&&m.Core.state.documentClassModificators.set(i,"top-hasTabsViewPageMod"),e.onUnmounted(()=>{n.pageMod&&m.Core.state.documentClassModificators.delete(i),a.$id&&f.delHash(a.$id,a.activeItemName,!0)});const u=e.ref(),r=e.ref(!1);return e.watch([u,()=>a.component],()=>{r.value=B(a.component)},{immediate:!0}),(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-tabsView":!0,"top-tabsView-pageMod":n.pageMod,"top-tabsView-inPopup":e.unref(a).showMenuInPopup})},[e.createVNode(K,{isShortable:l.isShortable,isLoading:r.value,"onUpdate:isLoading":d[0]||(d[0]=p=>r.value=p)},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"menu")]),_:3},8,["isShortable","isLoading"]),e.createElementVNode("div",{class:e.normalizeClass({"top-tabsView_contents":!0,"top-tabsView_contents-isLoading":r.value,"top-tabsView_contents-noScrollable":!e.unref(a).scrollable})},[r.value?(e.openBlock(),e.createBlock(m.TopLoadbar$1,{key:0})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(a).component),{ref_key:"componentRef",ref:u},null,512))],1024))],2)],2))}}),A={},q={class:"top-tabsView_menuDelimeter"};function F(o,n){return e.openBlock(),e.createElementBlock("div",q)}const U=m._export_sfc(A,[["render",F]]),W=e.defineComponent({__name:"menuTitle",props:{isSubtitle:{type:Boolean}},setup(o){const n=w();return(t,a)=>e.unref(n).showMenuInPopup?(e.openBlock(),e.createBlock(e.unref(S.TopPopupListItem),{key:0,type:"title"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3})):e.unref(n).isShort?(e.openBlock(),e.createBlock(U,{key:1})):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass({"top-tabsView_menuTitle":!0,"top-tabsView_menuTitle-subtitle":t.isSubtitle})},[e.renderSlot(t.$slots,"default")],2))}}),J=j,G=v,Q=W;h.TopTabsView=J,h.TopTabsViewMenuItem=G,h.TopTabsViewMenuTitle=Q,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
1
+ define(["require","exports","vue","../.chunks/forms-DvEX_A0C.amd","../utils/route.amd","../.chunks/store-esTid5oI.amd","../popup/popup.amd","../utils/system.amd","../require/css.amd!../assets/tabsView.css"],function(X,h,e,m,f,_,S,L){"use strict";if(typeof e>"u")var e=window.Vue;const g=(o,n)=>`top:${String(o)}:${n}`,y={loadLocalStorge:(o,n)=>{if(!n.$id)return;const t=g(o,n.$id);try{const a=JSON.parse(localStorage.getItem(t));typeof a==typeof n[o]&&(n[o]=a)}catch{console.warn(new Error(`В localStorage[${t}] не корректный json`))}},addSaverLocalStorge:(o,n)=>{if(!n.$id)return;const t=g(o,n.$id);e.watch(()=>n[o],()=>{localStorage.setItem(t,JSON.stringify(n[o]))},{immediate:!0})}},k=new Set;addEventListener("popstate",o=>{k.forEach(n=>n(o))});const V=Symbol(),C=(o,n)=>{const t=_.defineStore(V,()=>{const a=e.computed(()=>o.showMenuInPopup??m.Core.state.isMobile),i=e.computed(()=>o.pageMod),u=e.ref(!1),r=e.ref(void 0),l=e.ref(!0);return{showMenuInPopup:a,pageMod:i,isShort:u,activeItemName:n,component:r,scrollable:l}},o.idState);if(o.isShortable){const a="isShort";y.loadLocalStorge(a,t),y.addSaverLocalStorge(a,t)}if(t.$id){const a=i=>{n.value=f.getHash(t.$id)};k.add(a)}return t},w=()=>_.useStore(V),P={key:1,class:"top-ellipsis"},v=e.defineComponent({__name:"menuItem",props:{name:{},href:{},icon:{},disabled:{type:Boolean},component:{default:void 0},scrollable:{type:Boolean,default:!0}},setup(o){const n=o,t=w(),a=e.computed(()=>n.name&&t.$id?f.genHash(t.$id,n.name):n.href),i=e.computed(()=>t.showMenuInPopup?S.TopPopupListItem:a?"a":"button"),u=r=>{!n.href&&a.value&&r.preventDefault(),n.name&&(t.activeItemName=n.name)};return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{target:"_self",class:e.normalizeClass({"top-tabsView_menuItem":!e.unref(t).showMenuInPopup,"top-active":r.name&&e.unref(t).activeItemName===r.name,"top-disabled":r.disabled,"top-spa-disabled":!0}),href:a.value,"data-top-icon":r.icon||void 0,disabled:r.disabled||void 0,onClick:u},{default:e.withCtx(()=>[e.unref(t).showMenuInPopup?e.renderSlot(r.$slots,"default",{key:0}):r.$slots.default&&!e.unref(t).isShort?(e.openBlock(),e.createElementBlock("span",P,[e.renderSlot(r.$slots,"default")])):e.createCommentVNode("",!0)]),_:3},8,["class","href","data-top-icon","disabled"]))}}),B=o=>(o==null?void 0:o.name)==="AsyncComponentWrapper"&&!(o!=null&&o.__asyncResolved),E=async(o,n)=>{(o==null?void 0:o.name)==="AsyncComponentWrapper"&&(o!=null&&o.__asyncResolved||(o.__asyncLoader(),await L.sleepWhile(()=>n()&&B(o),200)))},z={class:"top-tabsView_menuOpener"},R=["data-top-icon"],O={class:"top-ellipsis"},D={class:"top-tabsView_menuList"},H={key:0,class:"top-tabsView_menuFooter"},K=e.defineComponent({__name:"menu",props:e.mergeModels({isShortable:{type:Boolean},isLoading:{type:Boolean}},{isLoading:{},isLoadingModifiers:{}}),emits:["update:isLoading"],setup(o){const n=e.useModel(o,"isLoading"),t=w(),a=e.useSlots(),i=new Map,u=()=>{if(!a.default)return;const c=a.default({}).find(s=>s.key==="_menu");c&&r(c.children)},r=c=>{c.forEach(s=>{var M,$,N,T;if(s.type.__name&&s.type.__name!==v.__name)return;if(!s.type.__name&&typeof s.children=="object"){r(s.children);return}if(!((M=s.props)!=null&&M.name)||($=s.props)!=null&&$.disabled)return;const I={title:((T=(N=s.children).default)==null?void 0:T.call(N)[0].children).trim(),icon:s.props.icon,component:s.props.component?e.markRaw(s.props.component):v.props.component.default,scrollable:s.props.scrollable??v.props.scrollable.default};i.set(s.props.name,I)})},l=e.ref(null);let d=0;e.watch(()=>t.activeItemName,async()=>{const c=++d;if(i.size===0&&u(),i.size===0){t.activeItemName="";return}if(l.value=i.get(t.activeItemName)??null,!l.value&&t.$id){const s=f.getHash(t.$id);if(l.value=i.get(s)??null,l.value){t.activeItemName=s;return}}if(!l.value){t.activeItemName=i.keys().next().value;return}if(l.value.component===t.component){n.value=!1;return}t.$id&&f.setHash(t.$id,t.activeItemName,!1),n.value=!0,await E(l.value.component,()=>c===d),c===d&&(t.scrollable=l.value.scrollable,t.component=l.value.component,l.value&&!t.component&&console.warn(`Компонент вкладки ${t.activeItemName} не найден. Добавьте props.component для пункта меню ${t.activeItemName}.`))},{immediate:!0});const p=e.ref();let b;return e.onMounted(()=>{b=new ResizeObserver(()=>{p.value.parentElement.style.setProperty("--top-tabsView-contents-offset-top",p.value.offsetHeight+"px")}),b.observe(p.value)}),e.onUnmounted(()=>{b.disconnect()}),(c,s)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:p,class:e.normalizeClass({"top-tabsView_menu":!0,"top-tabsView_menu-inPopup_0":!e.unref(t).showMenuInPopup,"top-tabsView_menu-inPopup_1":e.unref(t).showMenuInPopup,"top-tabsView_menu-short":e.unref(t).isShort&&!e.unref(t).showMenuInPopup})},[e.unref(t).showMenuInPopup?(e.openBlock(),e.createBlock(e.unref(S.TopPopup),{key:0},{opener:e.withCtx(()=>[e.createElementVNode("div",z,[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-tabsView_menuOpenerActiveItem","data-top-icon":l.value.icon},[e.createElementVNode("span",O,e.toDisplayString(l.value.title),1)],8,R)):e.createCommentVNode("",!0),s[1]||(s[1]=e.createElementVNode("div",{class:"top-tabsView_menuOpenerIcon","data-top-icon":""},null,-1))])]),contentList:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",D,[e.renderSlot(c.$slots,"default")]),c.isShortable?(e.openBlock(),e.createElementBlock("div",H,[c.isShortable?(e.openBlock(),e.createBlock(v,{key:0,icon:e.unref(t).isShort?"":"",onClick:s[0]||(s[0]=I=>e.unref(t).isShort=!e.unref(t).isShort)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t).isShort?"":"Свернуть"),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],64))],2))}}),j=e.defineComponent({__name:"tabsView",props:e.mergeModels({modelValue:{},pageMod:{type:Boolean},showMenuInPopup:{type:Boolean,default:void 0},isShortable:{type:Boolean,default:!1},idState:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const n=o,t=e.useModel(o,"modelValue"),a=C(n,t),i=Math.random();n.pageMod&&m.Core.state.documentClassModificators.set(i,"top-hasTabsViewPageMod"),e.onUnmounted(()=>{n.pageMod&&m.Core.state.documentClassModificators.delete(i),a.$id&&f.delHash(a.$id,a.activeItemName,!0)});const u=e.ref(),r=e.ref(!1);return e.watch([u,()=>a.component],()=>{r.value=B(a.component)},{immediate:!0}),(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-tabsView":!0,"top-tabsView-pageMod":n.pageMod,"top-tabsView-inPopup":e.unref(a).showMenuInPopup})},[e.createVNode(K,{isShortable:l.isShortable,isLoading:r.value,"onUpdate:isLoading":d[0]||(d[0]=p=>r.value=p)},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"menu")]),_:3},8,["isShortable","isLoading"]),e.createElementVNode("div",{class:e.normalizeClass({"top-tabsView_contents":!0,"top-tabsView_contents-isLoading":r.value,"top-tabsView_contents-noScrollable":!e.unref(a).scrollable})},[r.value?(e.openBlock(),e.createBlock(m.TopLoadbar$1,{key:0})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(a).component),{ref_key:"componentRef",ref:u},null,512))],1024))],2)],2))}}),A={},q={class:"top-tabsView_menuDelimeter"};function F(o,n){return e.openBlock(),e.createElementBlock("div",q)}const U=m._export_sfc(A,[["render",F]]),W=e.defineComponent({__name:"menuTitle",props:{isSubtitle:{type:Boolean}},setup(o){const n=w();return(t,a)=>e.unref(n).showMenuInPopup?(e.openBlock(),e.createBlock(e.unref(S.TopPopupListItem),{key:0,type:"title"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3})):e.unref(n).isShort?(e.openBlock(),e.createBlock(U,{key:1})):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass({"top-tabsView_menuTitle":!0,"top-tabsView_menuTitle-subtitle":t.isSubtitle})},[e.renderSlot(t.$slots,"default")],2))}}),J=j,G=v,Q=W;h.TopTabsView=J,h.TopTabsViewMenuItem=G,h.TopTabsViewMenuTitle=Q,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=tabsView.amd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tabsView.amd.js","sources":["../../src/core/utils/store/localStorage.ts","../../src/components/tabsView/tabsView/store.ts","../../src/components/tabsView/tabsView/menuItem.vue","../../src/components/tabsView/tabsView/utils.ts","../../src/components/tabsView/tabsView/menu.vue","../../src/components/tabsView/tabsView/tabsView.vue","../../src/components/tabsView/tabsView/menuDelimeter.vue","../../src/components/tabsView/tabsView/menuTitle.vue","../../src/components/tabsView/tabsView.ts"],"sourcesContent":["import { watch } from 'vue';\nimport type { Store } from './store';\n\n/**\n * Сгенерировать имя для сохранения данных в localStorage\n * @param stateName - имя свойства состояния\n * @param stateKey - ключ состояния, разные компоненты могут использовать одинаковый ключ\n */\nconst genStorageKey = <T extends Store>(stateName: keyof T, stateKey: string): string => {\n\tconst stateNameString = String(stateName);\n\n\treturn `top:${stateNameString}:${stateKey}`;\n};\n\n/**\n * Загрузить состояние\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst loadLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если Store.key не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\ttry {\n\t\tconst localStorageValue: typeof store[keyof typeof store] = JSON.parse(localStorage.getItem(localStorageKey) as string);\n\n\t\tif (typeof localStorageValue === typeof store[stateName]) {\n\t\t\tstore[stateName] = localStorageValue;\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(new Error(`В localStorage[${localStorageKey}] не корректный json`));\n\t}\n};\n\n/**\n * Добавить автосохранение состояние при его изменении\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst addSaverLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если store.$id не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\twatch(() => store[stateName], () => {\n\t\tlocalStorage.setItem(localStorageKey, JSON.stringify(store[stateName]));\n\t}, { immediate: true });\n};\n\nexport default {\n\tloadLocalStorge,\n\taddSaverLocalStorge,\n};","import type { InjectionKey, ModelRef } from 'vue';\nimport { computed, ref } from 'vue';\nimport Core from '@/core/core/core';\nimport { defineStore, useStore } from '@/core/utils/store';\nimport StoreLocalStorage from '@/core/utils/store/localStorage';\nimport type { Props, Store } from './tabsView';\nimport { getHash } from '@/core/utils/route';\n\nconst popstateCallbacks = new Set<(e: PopStateEvent) => void>();\n\naddEventListener('popstate', (e) => {\n\tpopstateCallbacks.forEach(popstateCallback => popstateCallback(e));\n});\n\nexport const injectionKey = Symbol() as InjectionKey<Store>;\n\n/**\n * Инициировать Store компонента\n */\nexport const defineTabsStore = (props: Props, model: ModelRef<string | undefined>) => {\n\tconst store = defineStore(injectionKey, () => {\n\t\tconst showMenuInPopup = computed(() => props.showMenuInPopup ?? Core.state.isMobile);\n\t\tconst pageMod = computed(() => props.pageMod);\n\t\tconst isShort = ref(false);\n\n\t\tconst component = ref(undefined);\n\t\tconst scrollable = ref(true);\n\n\t\treturn {\n\t\t\tshowMenuInPopup,\n\t\t\tpageMod,\n\t\t\tisShort,\n\t\t\tactiveItemName: model,\n\t\t\tcomponent,\n\t\t\tscrollable,\n\t\t};\n\t}, props.idState);\n\n\tif (props.isShortable) {\n\t\tconst stateName = 'isShort';\n\n\t\tStoreLocalStorage.loadLocalStorge(stateName, store);\n\t\tStoreLocalStorage.addSaverLocalStorge(stateName, store);\n\t}\n\n\tif (store.$id) {\n\t\tconst popstateCallback = (_e: PopStateEvent) => {\n\t\t\tmodel.value = getHash(store.$id!);\n\t\t};\n\n\t\tpopstateCallbacks.add(popstateCallback);\n\t}\n\n\treturn store;\n};\n\n/**\n * Получить Store компонента\n */\nexport const useTabsStore = () => useStore(injectionKey);\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { genHash } from '@/core/utils/route';\nimport { TopPopupListItem } from '@/components/popup/popup';\nimport { useTabsStore } from './store';\nimport type { PropsMenuItem } from './tabsView';\n\nconst props = withDefaults(defineProps<PropsMenuItem>(), {\n\tscrollable: true,\n\tcomponent: undefined,\n});\n\nconst store = useTabsStore();\n\nconst href = computed(() => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (props.name && store.$id) {\n\t\treturn genHash(store.$id, props.name);\n\t}\n\n\treturn props.href;\n});\n\nconst tagName = computed(() => {\n\tif (store.showMenuInPopup) {\n\t\treturn TopPopupListItem;\n\t}\n\n\treturn href ? 'a' : 'button';\n});\n\n/**\n * Клик по элементу меню\n */\nconst onClick = (e: MouseEvent) => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (!props.href && href.value) {\n\t\te.preventDefault();\n\t}\n\n\tif (props.name) {\n\t\tstore.activeItemName = props.name;\n\t}\n};\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\ttarget=\"_self\"\n\t\t:class=\"{\n\t\t\t['top-tabsView_menuItem']: !store.showMenuInPopup,\n\t\t\t['top-active']: name && store.activeItemName === name,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-spa-disabled']: true,\n\t\t}\"\n\t\t:href=\"href\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t@click=\"onClick\"\n\t>\n\t\t<slot name=\"default\" v-if=\"store.showMenuInPopup\"></slot>\n\n\t\t<span\n\t\t\tv-else-if=\"$slots.default && !store.isShort\"\n\t\t\tclass=\"top-ellipsis\"\n\t\t>\n\t\t\t<slot name=\"default\"></slot>\n\t\t</span>\n\t</component>\n</template>\n\n<style>\n.top-tabsView_menuItem {\n\t--top-icon-color: var(--color-text-2);\n\t--top-icon-width: calc(var(--top-icon-size));\n\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\n\tborder: none;\n\tborder-radius: var(--top-radius-2);\n\tpadding: var(--top-padding-2);\n\tbackground: transparent;\n\theight: 40px;\n\n\tcolor: var(--color-text-1);\n\ttext-decoration: none;\n\twhite-space: nowrap;\n\n\tdisplay: flex;\n\tgap: var(--top-gap-2);\n\talign-items: center;\n\tjustify-content: flex-start;\n\ttransition: background var(--transition);\n}\n\n.top-tabsView_menuItem:hover {\n\t--top-icon-color: var(--color-text-1);\n\n\tbackground: var(--color-bg-shading-1);\n\ttext-decoration: none;\n}\n\n.top-tabsView_menuItem.top-active {\n\t--top-icon-color: inherit;\n\n\tbackground: var(--color-layout-front-1);\n\tcolor: inherit;\n}\n\n.top-tabsView_menuItem:disabled:not(option):not(optgroup):not(.top-forms-option),\n.top-tabsView_menuItem:disabled ~ .top-formsCaption,\n.top-tabsView_menuItem.top-disabled[data-top-icon]:before,\n.top-tabsView_menuItem.top-disabled[data-top-icon2]:after {\n\topacity: unset;\n\tfilter: unset;\n}\n\n.top-tabsView_menuItem.top-disabled {\n\t--top-icon-color: var(--color-text-4);\n\n\tcolor: var(--color-text-4);\n}\n</style>\n","// TODO: Эту функцию можно вынести в глобальный utils\n\nimport { sleepWhile } from '@/core/utils/system';\n\n/**\n * Проверка нахождения компонента в состояние загрузки\n * @param component\n */\nexport const checkComponentIsLoading = (component: any) => {\n\treturn component?.name === 'AsyncComponentWrapper' && !component?.__asyncResolved;\n};\n\n/**\n * Презагрузить компонент\n *\n * Некоторое время ожидает загрузку компонента, прежде чем завершит работу\n */\nexport const preResolveComponent = async (component: any, condition: Function) => {\n\tif (component?.name !== 'AsyncComponentWrapper') return;\n\tif (component?.__asyncResolved) return;\n\n\tcomponent.__asyncLoader();\n\n\tawait sleepWhile(() => {\n\t\treturn condition() && checkComponentIsLoading(component);\n\t}, 200);\n};\n","<script setup lang=\"ts\">\nimport type { Ref, VNode } from 'vue';\nimport { markRaw, onMounted, onUnmounted, ref, useSlots, watch } from 'vue';\nimport { TopPopup } from '../../popup/popup';\nimport { getHash, setHash } from '@/core/utils/route';\n\nimport type { MenuItem, PropsMenu, PropsMenuItem } from './tabsView';\nimport { useTabsStore } from './store';\nimport TabsViewMenuItem from './menuItem.vue';\nimport { preResolveComponent } from './utils';\n\ndefineProps<PropsMenu>();\n\nconst isLoading = defineModel('isLoading');\n\nconst store = useTabsStore();\n\nconst slots = useSlots();\n\n// словарь используется для оптимизации получения нужного menuItem\nconst menuItemByName: Map<PropsMenuItem['name'], MenuItem> = new Map();\n\n// заполнить словарь с menuItem, по элементам в slot default\nconst setMenuItemByName = () => {\n\tif (!slots.default) return;\n\n\tconst component: any = slots.default({}).find(item => item.key === '_menu');\n\tif (!component) return;\n\n\tsetMenuItemByNameFromItems(component.children);\n};\n\n// заполнить словарь с menuItem, по элементам\nconst setMenuItemByNameFromItems = (menuItems: VNode[]) => {\n\tmenuItems.forEach((subComponent: any) => {\n\t\t// это не компонент элемента меню\n\t\tif (subComponent.type.__name && subComponent.type.__name !== TabsViewMenuItem.__name) return;\n\n\t\t// это не компонент, например template\n\t\tif (!subComponent.type.__name && typeof subComponent.children === 'object') {\n\t\t\tsetMenuItemByNameFromItems(subComponent.children);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (!subComponent.props?.name || subComponent.props?.disabled) return;\n\n\t\tconst menuItem: MenuItem = {\n\t\t\ttitle: (subComponent.children.default?.()[0].children as string).trim(),\n\t\t\ticon: subComponent.props.icon,\n\t\t\tcomponent: subComponent.props.component ? markRaw(subComponent.props.component) : TabsViewMenuItem.props.component.default,\n\t\t\tscrollable: subComponent.props.scrollable ?? TabsViewMenuItem.props.scrollable.default,\n\t\t};\n\n\t\tmenuItemByName.set(subComponent.props.name, menuItem);\n\t});\n};\n\n/**\n * activeMenuItem нужен:\n * - для вывода текста активной вкладки в меню с popup\n * - для вывода компонента активной вкладки (store.component)\n * - для установки store.scrollable\n */\nconst activeMenuItem: Ref<MenuItem | null> = ref(null);\n\n/**\n * Кол-во изменений активной вкладки\n */\nlet countChanged = 0;\n\n/**\n * Смена активной вкладки\n *\n * TODO: смена slot, например смена языка, требует повторного выполнения setMenuItemByName()\n */\nwatch(\n\t() => store.activeItemName,\n\tasync () => {\n\t\tconst numberChanged = ++countChanged; // порядковый номер текущего изменения\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tsetMenuItemByName();\n\t\t}\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tstore.activeItemName = '';\n\n\t\t\treturn;\n\t\t}\n\n\t\tactiveMenuItem.value = menuItemByName.get(store.activeItemName) ?? null;\n\n\t\t// элемент не найден, установить из хеша страницы\n\t\tif (!activeMenuItem.value && store.$id) {\n\t\t\tconst activeItemName = getHash(store.$id);\n\n\t\t\tactiveMenuItem.value = menuItemByName.get(activeItemName) ?? null;\n\n\t\t\tif (activeMenuItem.value) {\n\t\t\t\tstore.activeItemName = activeItemName;\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// элемент не найден, установить первый доступный\n\t\tif (!activeMenuItem.value) {\n\t\t\tstore.activeItemName = menuItemByName.keys().next().value!;\n\n\t\t\treturn;\n\t\t}\n\n\t\t// запрошена смена на уже активный элемент\n\t\tif (activeMenuItem.value.component === store.component) {\n\t\t\tisLoading.value = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (store.$id) setHash(store.$id, store.activeItemName, false);\n\n\t\t// флаг загрузки будет сброшен при инициализации компонента\n\t\tisLoading.value = true;\n\n\t\t/**\n\t\t * Презагрузить компонент\n\t\t *\n\t\t * Нужно для того, чтобы минимизировать скачки интерфейса при ожидании загрузки асинхронного компонента\n\t\t */\n\t\tawait preResolveComponent(activeMenuItem.value.component, () => numberChanged === countChanged);\n\n\t\t// влкадка была сменена еще раз во время sleepWhile\n\t\tif (numberChanged !== countChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore.scrollable = activeMenuItem.value.scrollable;\n\t\tstore.component = activeMenuItem.value.component;\n\n\t\tif (activeMenuItem.value && !store.component) {\n\t\t\tconsole.warn(`Компонент вкладки ${store.activeItemName} не найден. Добавьте props.component для пункта меню ${store.activeItemName}.`);\n\t\t}\n\t},\n\t{ immediate: true },\n);\n\nconst elRef = ref();\nlet resizeObserver: ResizeObserver;\n\nonMounted(() => {\n\tresizeObserver = new ResizeObserver(() => {\n\t\telRef.value.parentElement.style.setProperty('--top-tabsView-contents-offset-top', elRef.value.offsetHeight + 'px');\n\t});\n\n\tresizeObserver.observe(elRef.value);\n});\n\nonUnmounted(() => {\n\tresizeObserver.disconnect();\n});\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t'top-tabsView_menu': true,\n\t\t\t'top-tabsView_menu-inPopup_0': !store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-inPopup_1': store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-short': store.isShort && !store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<!-- Спрятать меню под кнопку в popup -->\n\t\t<TopPopup v-if=\"store.showMenuInPopup\">\n\t\t\t<template #opener>\n\t\t\t\t<div class=\"top-tabsView_menuOpener\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"activeMenuItem\"\n\t\t\t\t\t\tclass=\"top-tabsView_menuOpenerActiveItem\"\n\t\t\t\t\t\t:data-top-icon=\"activeMenuItem.icon\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span class=\"top-ellipsis\">\n\t\t\t\t\t\t\t{{ activeMenuItem.title }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"top-tabsView_menuOpenerIcon\" data-top-icon=\"\"></div>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<slot></slot>\n\t\t\t</template>\n\t\t</TopPopup>\n\n\t\t<!-- Отобразить меню на странице -->\n\t\t<template v-else>\n\t\t\t<div class=\"top-tabsView_menuList\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tv-if=\"isShortable\"\n\t\t\t\tclass=\"top-tabsView_menuFooter\"\n\t\t\t>\n\t\t\t\t<TabsViewMenuItem\n\t\t\t\t\tv-if=\"isShortable\"\n\t\t\t\t\t:icon=\"store.isShort ? '' : ''\"\n\t\t\t\t\t@click=\"store.isShort = !store.isShort\"\n\t\t\t\t>\n\t\t\t\t\t{{ store.isShort ? '' : 'Свернуть' }} <!--TODO: translate-->\n\t\t\t\t</TabsViewMenuItem>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<style>\n/* режим отображение табов в основной области документа */\n.top-tabsView-pageMod .top-tabsView_menu {\n\tbox-sizing: border-box;\n\tposition: sticky;\n\ttop: var(--top-tabsView-top);\n\tz-index: 10;\n}\n\n/* режим отображение табов в основной области документа без popup */\n.top-tabsView-pageMod .top-tabsView_menu-inPopup_0 {\n\theight: calc(var(--100vh) - var(--top-tabsView-top));\n}\n\n/* стантартный режим */\n.top-tabsView_menu-inPopup_0 {\n\tbox-sizing: border-box;\n\twidth: var(--top-tabsView-menu-width);\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tflex-shrink: 0;\n}\n\n/* режим вывода в popup */\n.top-tabsView_menu-inPopup_1 {\n\tborder-bottom: 1px solid var(--color-line-2-opacity);\n}\n\n.top-tabsView_menu-short {\n\twidth: auto;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener:hover {\n\tbackground: var(--color-layer-1);\n}\n\n.top-tabsView_menuOpenerIcon { display: flex; }\n\n.top-tabsView_menuOpenerActiveItem {\n\t--top-forms-padding: 0px;\n\n\tbox-sizing: border-box;\n\tpadding: var(--top-padding-2);\n\tmax-width: calc(100% - var(--top-forms-base-height));\n\twhite-space: nowrap;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--top-padding-2);\n}\n\n.top-tabsView_menuList,\n.top-tabsView_menuFooter {\n\tpadding: var(--top-padding-2);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--top-gap-2);\n}\n\n.top-tabsView_menuList {\n\toverflow-y: auto;\n}\n\n.top-tabsView_menu-short .top-tabsView_menuFooter > .top-tabsView_menuItem {\n\t--top-icon-width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { defineModel, onUnmounted, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { delHash } from '@/core/utils/route';\nimport type { Props } from './tabsView';\nimport { defineTabsStore } from './store';\nimport TabsViewMenu from './menu.vue';\nimport TopLoadbar from '@/components/forms/loadbar/loadbar.vue';\nimport { checkComponentIsLoading } from './utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowMenuInPopup: undefined,\n\tisShortable: false,\n});\n\nconst model = defineModel<string>();\n\nconst store = defineTabsStore(props, model);\n\nconst uid = Math.random();\n\nif (props.pageMod) Core.state.documentClassModificators.set(uid, 'top-hasTabsViewPageMod');\n\nonUnmounted(() => {\n\tif (props.pageMod) Core.state.documentClassModificators.delete(uid);\n\n\tif (store.$id) delHash(store.$id, store.activeItemName, true);\n});\n\nconst componentRef = ref();\nconst isLoading = ref(false);\n\nwatch([componentRef, () => store.component], () => {\n\tisLoading.value = checkComponentIsLoading(store.component);\n}, { immediate: true });\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-tabsView': true,\n\t\t\t'top-tabsView-pageMod': props.pageMod,\n\t\t\t'top-tabsView-inPopup': store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<TabsViewMenu\n\t\t\t:isShortable=\"isShortable\"\n\t\t\tv-model:isLoading=\"isLoading\"\n\t\t>\n\t\t\t<!-- @slot Меню, ожидает передачу компонентов TabsViewMenuItem и TabsViewMenuTitle -->\n\t\t\t<slot name=\"menu\"></slot>\n\t\t</TabsViewMenu>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-tabsView_contents': true,\n\t\t\t\t'top-tabsView_contents-isLoading': isLoading,\n\t\t\t\t'top-tabsView_contents-noScrollable': !store.scrollable,\n\t\t\t}\"\n\t\t>\n\t\t\t<TopLoadbar v-if=\"isLoading\"/>\n\n\t\t\t<keep-alive>\n\t\t\t\t<component\n\t\t\t\t\tref=\"componentRef\"\n\t\t\t\t\t:is=\"store.component\"\n\t\t\t\t/>\n\t\t\t</keep-alive>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n:root {\n\t--top-tabsView-top: 0px;\n\t--top-tabsView-menu-width: 220px;\n\t--top-tabsView-contents-offset-top: 0px;\n}\n\n.top-tabsView {\n\tbackground: var(--color-layout-middle);\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.top-tabsView_contents {\n\tborder-radius: var(--top-radius-4);\n\tbackground: var(--color-layout-front-1);\n\tpadding: var(--top-padding-4);\n\tflex-grow: 1;\n\toverflow: auto;\n\tposition: relative;\n}\n\n.top-tabsView_contents-isLoading {\n\tpointer-events: none;\n}\n\n.top-tabsView_contents-noScrollable {\n\twidth: calc(100% - var(--top-tabsView-menu-width));\n\tpadding: 0;\n\toverflow: visible;\n}\n\n/* top-tabsView-inPopup */\n.top-tabsView-inPopup {\n\tbackground: var(--color-layout-front-1);\n\tflex-direction: column;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents {\n\tborder-radius: 0;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents-noScrollable {\n\twidth: auto;\n}\n</style>\n","<script setup lang=\"ts\">\n\n</script>\n\n<template>\n\t<div class=\"top-tabsView_menuDelimeter\"></div>\n</template>\n\n<style>\n.top-tabsView_menuDelimeter {\n\tpadding: var(--top-padding-1) 0;\n\tdisplay: flex;\n}\n\n.top-tabsView_menuDelimeter:before {\n\tcontent: \"\";\n\theight: 2px;\n\tbackground: var(--color-line-2);\n\tflex-grow: 1;\n}\n\n.top-tabsView_menuDelimeter:first-child,\n.top-tabsView_menuDelimeter + .top-tabsView_menuDelimeter {\n\tdisplay: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useTabsStore } from './store';\nimport type { PropsMenuTitle } from './tabsView';\nimport TabsViewMenuDelimeter from './menuDelimeter.vue';\nimport { TopPopupListItem } from '../../popup/popup';\n\ndefineProps<PropsMenuTitle>();\n\nconst store = useTabsStore();\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\tv-if=\"store.showMenuInPopup\"\n\t\ttype=\"title\"\n\t>\n\t\t<slot></slot>\n\t</TopPopupListItem>\n\n\t<TabsViewMenuDelimeter v-else-if=\"store.isShort\"/>\n\n\t<div\n\t\tv-else\n\t\t:class=\"{\n\t\t\t'top-tabsView_menuTitle': true,\n\t\t\t'top-tabsView_menuTitle-subtitle': isSubtitle,\n\t\t}\"\n\t>\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<style>\n.top-tabsView_menuTitle {\n\tpadding: var(--top-padding-4) var(--top-padding-2) var(--top-padding-1);\n\tfont-weight: 600;\n\tcolor: var(--color-text-1);\n}\n\n.top-tabsView_menuTitle-subtitle {\n\tpadding-top: var(--top-padding-1);\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: var(--color-text-2);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport TabsView from './tabsView/tabsView.vue';\nimport TabsViewMenuItem from './tabsView/menuItem.vue';\nimport TabsViewMenuTitle from './tabsView/menuTitle.vue';\n\nexport const TopTabsView = TabsView as typeof TabsView & ComponentCustomProps;\nexport const TopTabsViewMenuItem = TabsViewMenuItem as typeof TabsViewMenuItem & ComponentCustomProps;\nexport const TopTabsViewMenuTitle = TabsViewMenuTitle as typeof TabsViewMenuTitle & ComponentCustomProps;\n"],"names":["genStorageKey","stateName","stateKey","StoreLocalStorage","store","localStorageValue","localStorageKey","popstateCallbacks","e","defineTabsStore","props","model","store$1","injectionKey","showMenuInPopup","vue","forms","isShort","component","scrollable","pageMod","popstateCallback","_e","useTabsStore","href","tagName","popup_popup","onClick","checkComponentIsLoading","preResolveComponent","condition","slots","menuItemByName","setMenuItemByNameFromItems","menuItems","subComponent","_sfc_main$4","_a","_b","_d","_c","activeMenuItem","numberChanged","countChanged","setMenuItemByName","activeItemName","isLoading","utils_route","elRef","resizeObserver","uid","componentRef","_sfc_render","_ctx","_cache","TopTabsView","_sfc_main$2","TopTabsViewMenuItem","TopTabsViewMenuTitle","_sfc_main"],"mappings":"uRAQA,MAAAA,EAAA,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CAGD1C,EAAA,KAAA2C,EAAA,QAAA3C,EAAA,IAAAA,EAAA,eAAA,EAAA,EAGA0C,EAAA,MAAA,GAOA,MAAAjB,EAAAY,EAAA,MAAA,UAAA,IAAAC,IAAAC,CAAA,EAGAD,IAAAC,yFAQC,QAAA,KAAA,qBAAAvC,EAAA,cAAA,wDAAAA,EAAA,cAAA,GAAA,oBAMH,MAAA4C,EAAAjC,EAAA,IAAA,EACA,IAAAkC,0BAGCA,EAAA,IAAA,eAAA,IAAA,CACCD,EAAA,MAAA,cAAA,MAAA,YAAA,qCAAAA,EAAA,MAAA,aAAA,IAAA,CAAiH,CAAA,EAGlHC,EAAA,QAAAD,EAAA,KAAA,CAAkC,CAAA,mCAIR,CAAA,6pDC5I3BE,EAAA,KAAA,OAAA,EAEAxC,EAAA,SAAAM,EAAA,KAAA,MAAA,0BAAA,IAAAkC,EAAA,wBAAA,qBAGCxC,EAAA,SAAAM,EAAA,KAAA,MAAA,0BAAA,OAAAkC,CAAA,EAEA9C,EAAA,KAAA2C,EAAA,QAAA3C,EAAA,IAAAA,EAAA,eAAA,EAAA,CAA4D,CAAA,EAG7D,MAAA+C,EAAApC,EAAA,IAAA,EACA+B,EAAA/B,EAAA,IAAA,EAAA,gEAG0D,EAAA,CAAA,UAAA,EAAA,CAAA,u3BC5BzD,SAAAqC,EAAAC,EAAAC,EAAA,+KCGD,MAAAlD,EAAAmB,EAAA,ubCFOgC,EAAAC,EACAC,EAAArB,EACAsB,EAAAC"}
1
+ {"version":3,"file":"tabsView.amd.js","sources":["../../src/core/utils/store/localStorage.ts","../../src/components/tabsView/tabsView/store.ts","../../src/components/tabsView/tabsView/menuItem.vue","../../src/components/tabsView/tabsView/utils.ts","../../src/components/tabsView/tabsView/menu.vue","../../src/components/tabsView/tabsView/tabsView.vue","../../src/components/tabsView/tabsView/menuDelimeter.vue","../../src/components/tabsView/tabsView/menuTitle.vue","../../src/components/tabsView/tabsView.ts"],"sourcesContent":["import { watch } from 'vue';\nimport type { Store } from './store';\n\n/**\n * Сгенерировать имя для сохранения данных в localStorage\n * @param stateName - имя свойства состояния\n * @param stateKey - ключ состояния, разные компоненты могут использовать одинаковый ключ\n */\nconst genStorageKey = <T extends Store>(stateName: keyof T, stateKey: string): string => {\n\tconst stateNameString = String(stateName);\n\n\treturn `top:${stateNameString}:${stateKey}`;\n};\n\n/**\n * Загрузить состояние\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst loadLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если Store.key не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\ttry {\n\t\tconst localStorageValue: typeof store[keyof typeof store] = JSON.parse(localStorage.getItem(localStorageKey) as string);\n\n\t\tif (typeof localStorageValue === typeof store[stateName]) {\n\t\t\tstore[stateName] = localStorageValue;\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(new Error(`В localStorage[${localStorageKey}] не корректный json`));\n\t}\n};\n\n/**\n * Добавить автосохранение состояние при его изменении\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst addSaverLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если store.$id не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\twatch(() => store[stateName], () => {\n\t\tlocalStorage.setItem(localStorageKey, JSON.stringify(store[stateName]));\n\t}, { immediate: true });\n};\n\nexport default {\n\tloadLocalStorge,\n\taddSaverLocalStorge,\n};","import type { InjectionKey, ModelRef } from 'vue';\nimport { computed, ref } from 'vue';\nimport Core from '@/core/core/core';\nimport { defineStore, useStore } from '@/core/utils/store';\nimport StoreLocalStorage from '@/core/utils/store/localStorage';\nimport type { Props, Store } from './tabsView';\nimport { getHash } from '@/core/utils/route';\n\nconst popstateCallbacks = new Set<(e: PopStateEvent) => void>();\n\naddEventListener('popstate', (e) => {\n\tpopstateCallbacks.forEach(popstateCallback => popstateCallback(e));\n});\n\nexport const injectionKey = Symbol() as InjectionKey<Store>;\n\n/**\n * Инициировать Store компонента\n */\nexport const defineTabsStore = (props: Props, model: ModelRef<string | undefined>) => {\n\tconst store = defineStore(injectionKey, () => {\n\t\tconst showMenuInPopup = computed(() => props.showMenuInPopup ?? Core.state.isMobile);\n\t\tconst pageMod = computed(() => props.pageMod);\n\t\tconst isShort = ref(false);\n\n\t\tconst component = ref(undefined);\n\t\tconst scrollable = ref(true);\n\n\t\treturn {\n\t\t\tshowMenuInPopup,\n\t\t\tpageMod,\n\t\t\tisShort,\n\t\t\tactiveItemName: model,\n\t\t\tcomponent,\n\t\t\tscrollable,\n\t\t};\n\t}, props.idState);\n\n\tif (props.isShortable) {\n\t\tconst stateName = 'isShort';\n\n\t\tStoreLocalStorage.loadLocalStorge(stateName, store);\n\t\tStoreLocalStorage.addSaverLocalStorge(stateName, store);\n\t}\n\n\tif (store.$id) {\n\t\tconst popstateCallback = (_e: PopStateEvent) => {\n\t\t\tmodel.value = getHash(store.$id!);\n\t\t};\n\n\t\tpopstateCallbacks.add(popstateCallback);\n\t}\n\n\treturn store;\n};\n\n/**\n * Получить Store компонента\n */\nexport const useTabsStore = () => useStore(injectionKey);\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { genHash } from '@/core/utils/route';\nimport { TopPopupListItem } from '@/components/popup/popup';\nimport { useTabsStore } from './store';\nimport type { PropsMenuItem } from './tabsView';\n\nconst props = withDefaults(defineProps<PropsMenuItem>(), {\n\tscrollable: true,\n\tcomponent: undefined,\n});\n\nconst store = useTabsStore();\n\nconst href = computed(() => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (props.name && store.$id) {\n\t\treturn genHash(store.$id, props.name);\n\t}\n\n\treturn props.href;\n});\n\nconst tagName = computed(() => {\n\tif (store.showMenuInPopup) {\n\t\treturn TopPopupListItem;\n\t}\n\n\treturn href ? 'a' : 'button';\n});\n\n/**\n * Клик по элементу меню\n */\nconst onClick = (e: MouseEvent) => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (!props.href && href.value) {\n\t\te.preventDefault();\n\t}\n\n\tif (props.name) {\n\t\tstore.activeItemName = props.name;\n\t}\n};\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\ttarget=\"_self\"\n\t\t:class=\"{\n\t\t\t['top-tabsView_menuItem']: !store.showMenuInPopup,\n\t\t\t['top-active']: name && store.activeItemName === name,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-spa-disabled']: true,\n\t\t}\"\n\t\t:href=\"href\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t@click=\"onClick\"\n\t>\n\t\t<slot name=\"default\" v-if=\"store.showMenuInPopup\"></slot>\n\n\t\t<span\n\t\t\tv-else-if=\"$slots.default && !store.isShort\"\n\t\t\tclass=\"top-ellipsis\"\n\t\t>\n\t\t\t<slot name=\"default\"></slot>\n\t\t</span>\n\t</component>\n</template>\n\n<style>\n.top-tabsView_menuItem {\n\t--top-icon-color: var(--color-text-2);\n\t--top-icon-width: calc(var(--top-icon-size));\n\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\n\tborder: none;\n\tborder-radius: var(--top-radius-2);\n\tpadding: var(--top-padding-2);\n\tbackground: transparent;\n\theight: 40px;\n\n\tcolor: var(--color-text-1);\n\ttext-decoration: none;\n\twhite-space: nowrap;\n\n\tdisplay: flex;\n\tgap: var(--top-gap-2);\n\talign-items: center;\n\tjustify-content: flex-start;\n\ttransition: background var(--transition);\n}\n\n.top-tabsView_menuItem:hover {\n\t--top-icon-color: var(--color-text-1);\n\n\tbackground: var(--color-bg-shading-1);\n\ttext-decoration: none;\n}\n\n.top-tabsView_menuItem.top-active {\n\t--top-icon-color: inherit;\n\n\tbackground: var(--color-layout-front-1);\n\tcolor: inherit;\n}\n\n.top-tabsView_menuItem:disabled:not(option):not(optgroup):not(.top-forms-option),\n.top-tabsView_menuItem:disabled ~ .top-formsCaption,\n.top-tabsView_menuItem.top-disabled[data-top-icon]:before,\n.top-tabsView_menuItem.top-disabled[data-top-icon2]:after {\n\topacity: unset;\n\tfilter: unset;\n}\n\n.top-tabsView_menuItem.top-disabled {\n\t--top-icon-color: var(--color-text-4);\n\n\tcolor: var(--color-text-4);\n}\n</style>\n","// TODO: Эту функцию можно вынести в глобальный utils\n\nimport { sleepWhile } from '@/core/utils/system';\n\n/**\n * Проверка нахождения компонента в состояние загрузки\n * @param component\n */\nexport const checkComponentIsLoading = (component: any) => {\n\treturn component?.name === 'AsyncComponentWrapper' && !component?.__asyncResolved;\n};\n\n/**\n * Презагрузить компонент\n *\n * Некоторое время ожидает загрузку компонента, прежде чем завершит работу\n */\nexport const preResolveComponent = async (component: any, condition: Function) => {\n\tif (component?.name !== 'AsyncComponentWrapper') return;\n\tif (component?.__asyncResolved) return;\n\n\tcomponent.__asyncLoader();\n\n\tawait sleepWhile(() => {\n\t\treturn condition() && checkComponentIsLoading(component);\n\t}, 200);\n};\n","<script setup lang=\"ts\">\nimport type { Ref, VNode } from 'vue';\nimport { markRaw, onMounted, onUnmounted, ref, useSlots, watch } from 'vue';\nimport { TopPopup } from '../../popup/popup';\nimport { getHash, setHash } from '@/core/utils/route';\n\nimport type { MenuItem, PropsMenu, PropsMenuItem } from './tabsView';\nimport { useTabsStore } from './store';\nimport TabsViewMenuItem from './menuItem.vue';\nimport { preResolveComponent } from './utils';\n\ndefineProps<PropsMenu>();\n\nconst isLoading = defineModel('isLoading');\n\nconst store = useTabsStore();\n\nconst slots = useSlots();\n\n// словарь используется для оптимизации получения нужного menuItem\nconst menuItemByName: Map<PropsMenuItem['name'], MenuItem> = new Map();\n\n// заполнить словарь с menuItem, по элементам в slot default\nconst setMenuItemByName = () => {\n\tif (!slots.default) return;\n\n\tconst component: any = slots.default({}).find(item => item.key === '_menu');\n\tif (!component) return;\n\n\tsetMenuItemByNameFromItems(component.children);\n};\n\n// заполнить словарь с menuItem, по элементам\nconst setMenuItemByNameFromItems = (menuItems: VNode[]) => {\n\tmenuItems.forEach((subComponent: any) => {\n\t\t// это не компонент элемента меню\n\t\tif (subComponent.type.__name && subComponent.type.__name !== TabsViewMenuItem.__name) return;\n\n\t\t// это не компонент, например template\n\t\tif (!subComponent.type.__name && typeof subComponent.children === 'object') {\n\t\t\tsetMenuItemByNameFromItems(subComponent.children);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (!subComponent.props?.name || subComponent.props?.disabled) return;\n\n\t\tconst menuItem: MenuItem = {\n\t\t\ttitle: (subComponent.children.default?.()[0].children as string).trim(),\n\t\t\ticon: subComponent.props.icon,\n\t\t\tcomponent: subComponent.props.component ? markRaw(subComponent.props.component) : TabsViewMenuItem.props.component.default,\n\t\t\tscrollable: subComponent.props.scrollable ?? TabsViewMenuItem.props.scrollable.default,\n\t\t};\n\n\t\tmenuItemByName.set(subComponent.props.name, menuItem);\n\t});\n};\n\n/**\n * activeMenuItem нужен:\n * - для вывода текста активной вкладки в меню с popup\n * - для вывода компонента активной вкладки (store.component)\n * - для установки store.scrollable\n */\nconst activeMenuItem: Ref<MenuItem | null> = ref(null);\n\n/**\n * Кол-во изменений активной вкладки\n */\nlet countChanged = 0;\n\n/**\n * Смена активной вкладки\n *\n * TODO: смена slot, например смена языка, требует повторного выполнения setMenuItemByName()\n */\nwatch(\n\t() => store.activeItemName,\n\tasync () => {\n\t\tconst numberChanged = ++countChanged; // порядковый номер текущего изменения\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tsetMenuItemByName();\n\t\t}\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tstore.activeItemName = '';\n\n\t\t\treturn;\n\t\t}\n\n\t\tactiveMenuItem.value = menuItemByName.get(store.activeItemName) ?? null;\n\n\t\t// элемент не найден, установить из хеша страницы\n\t\tif (!activeMenuItem.value && store.$id) {\n\t\t\tconst activeItemName = getHash(store.$id);\n\n\t\t\tactiveMenuItem.value = menuItemByName.get(activeItemName) ?? null;\n\n\t\t\tif (activeMenuItem.value) {\n\t\t\t\tstore.activeItemName = activeItemName;\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// элемент не найден, установить первый доступный\n\t\tif (!activeMenuItem.value) {\n\t\t\tstore.activeItemName = menuItemByName.keys().next().value!;\n\n\t\t\treturn;\n\t\t}\n\n\t\t// запрошена смена на уже активный элемент\n\t\tif (activeMenuItem.value.component === store.component) {\n\t\t\tisLoading.value = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (store.$id) setHash(store.$id, store.activeItemName, false);\n\n\t\t// флаг загрузки будет сброшен при инициализации компонента\n\t\tisLoading.value = true;\n\n\t\t/**\n\t\t * Презагрузить компонент\n\t\t *\n\t\t * Нужно для того, чтобы минимизировать скачки интерфейса при ожидании загрузки асинхронного компонента\n\t\t */\n\t\tawait preResolveComponent(activeMenuItem.value.component, () => numberChanged === countChanged);\n\n\t\t// влкадка была сменена еще раз во время sleepWhile\n\t\tif (numberChanged !== countChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore.scrollable = activeMenuItem.value.scrollable;\n\t\tstore.component = activeMenuItem.value.component;\n\n\t\tif (activeMenuItem.value && !store.component) {\n\t\t\tconsole.warn(`Компонент вкладки ${store.activeItemName} не найден. Добавьте props.component для пункта меню ${store.activeItemName}.`);\n\t\t}\n\t},\n\t{ immediate: true },\n);\n\nconst elRef = ref();\nlet resizeObserver: ResizeObserver;\n\nonMounted(() => {\n\tresizeObserver = new ResizeObserver(() => {\n\t\telRef.value.parentElement.style.setProperty('--top-tabsView-contents-offset-top', elRef.value.offsetHeight + 'px');\n\t});\n\n\tresizeObserver.observe(elRef.value);\n});\n\nonUnmounted(() => {\n\tresizeObserver.disconnect();\n});\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t'top-tabsView_menu': true,\n\t\t\t'top-tabsView_menu-inPopup_0': !store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-inPopup_1': store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-short': store.isShort && !store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<!-- Спрятать меню под кнопку в popup -->\n\t\t<TopPopup v-if=\"store.showMenuInPopup\">\n\t\t\t<template #opener>\n\t\t\t\t<div class=\"top-tabsView_menuOpener\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"activeMenuItem\"\n\t\t\t\t\t\tclass=\"top-tabsView_menuOpenerActiveItem\"\n\t\t\t\t\t\t:data-top-icon=\"activeMenuItem.icon\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span class=\"top-ellipsis\">\n\t\t\t\t\t\t\t{{ activeMenuItem.title }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"top-tabsView_menuOpenerIcon\" data-top-icon=\"\"></div>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<slot></slot>\n\t\t\t</template>\n\t\t</TopPopup>\n\n\t\t<!-- Отобразить меню на странице -->\n\t\t<template v-else>\n\t\t\t<div class=\"top-tabsView_menuList\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tv-if=\"isShortable\"\n\t\t\t\tclass=\"top-tabsView_menuFooter\"\n\t\t\t>\n\t\t\t\t<TabsViewMenuItem\n\t\t\t\t\tv-if=\"isShortable\"\n\t\t\t\t\t:icon=\"store.isShort ? '' : ''\"\n\t\t\t\t\t@click=\"store.isShort = !store.isShort\"\n\t\t\t\t>\n\t\t\t\t\t{{ store.isShort ? '' : 'Свернуть' }} <!--TODO: translate-->\n\t\t\t\t</TabsViewMenuItem>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<style>\n/* режим отображение табов в основной области документа */\n.top-tabsView-pageMod .top-tabsView_menu {\n\tbox-sizing: border-box;\n\tposition: sticky;\n\ttop: var(--top-tabsView-top);\n\tz-index: 10;\n}\n\n/* режим отображение табов в основной области документа без popup */\n.top-tabsView-pageMod .top-tabsView_menu-inPopup_0 {\n\theight: calc(var(--100vh) - var(--top-tabsView-top));\n}\n\n/* стантартный режим */\n.top-tabsView_menu-inPopup_0 {\n\tbox-sizing: border-box;\n\twidth: var(--top-tabsView-menu-width);\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tflex-shrink: 0;\n}\n\n/* режим вывода в popup */\n.top-tabsView_menu-inPopup_1 {\n\tborder-bottom: 1px solid var(--color-line-2-opacity);\n}\n\n.top-tabsView_menu-short {\n\twidth: auto;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener:hover {\n\tbackground: var(--color-layer-1);\n}\n\n.top-tabsView_menuOpenerIcon { display: flex; }\n\n.top-tabsView_menuOpenerActiveItem {\n\t--top-forms-padding: 0px;\n\n\tbox-sizing: border-box;\n\tpadding: var(--top-padding-2);\n\tmax-width: calc(100% - var(--top-forms-base-height));\n\twhite-space: nowrap;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--top-padding-2);\n}\n\n.top-tabsView_menuList,\n.top-tabsView_menuFooter {\n\tpadding: var(--top-padding-2);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--top-gap-2);\n}\n\n.top-tabsView_menuList {\n\toverflow-y: auto;\n}\n\n.top-tabsView_menu-short .top-tabsView_menuFooter > .top-tabsView_menuItem {\n\t--top-icon-width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { defineModel, onUnmounted, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { delHash } from '@/core/utils/route';\nimport type { Props } from './tabsView';\nimport { defineTabsStore } from './store';\nimport TabsViewMenu from './menu.vue';\nimport TopLoadbar from '@/components/forms/loadbar/loadbar.vue';\nimport { checkComponentIsLoading } from './utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowMenuInPopup: undefined,\n\tisShortable: false,\n});\n\nconst model = defineModel<string>();\n\nconst store = defineTabsStore(props, model);\n\nconst uid = Math.random();\n\nif (props.pageMod) Core.state.documentClassModificators.set(uid, 'top-hasTabsViewPageMod');\n\nonUnmounted(() => {\n\tif (props.pageMod) Core.state.documentClassModificators.delete(uid);\n\n\tif (store.$id) delHash(store.$id, store.activeItemName, true);\n});\n\nconst componentRef = ref();\nconst isLoading = ref(false);\n\nwatch([componentRef, () => store.component], () => {\n\tisLoading.value = checkComponentIsLoading(store.component);\n}, { immediate: true });\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-tabsView': true,\n\t\t\t'top-tabsView-pageMod': props.pageMod,\n\t\t\t'top-tabsView-inPopup': store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<TabsViewMenu\n\t\t\t:isShortable=\"isShortable\"\n\t\t\tv-model:isLoading=\"isLoading\"\n\t\t>\n\t\t\t<!-- @slot Меню, ожидает передачу компонентов TabsViewMenuItem и TabsViewMenuTitle -->\n\t\t\t<slot name=\"menu\"></slot>\n\t\t</TabsViewMenu>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-tabsView_contents': true,\n\t\t\t\t'top-tabsView_contents-isLoading': isLoading,\n\t\t\t\t'top-tabsView_contents-noScrollable': !store.scrollable,\n\t\t\t}\"\n\t\t>\n\t\t\t<TopLoadbar v-if=\"isLoading\"/>\n\n\t\t\t<keep-alive>\n\t\t\t\t<component\n\t\t\t\t\tref=\"componentRef\"\n\t\t\t\t\t:is=\"store.component\"\n\t\t\t\t/>\n\t\t\t</keep-alive>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n:root {\n\t--top-tabsView-top: 0px;\n\t--top-tabsView-menu-width: 220px;\n\t--top-tabsView-contents-offset-top: 0px;\n}\n\n.top-tabsView {\n\tbackground: var(--color-layout-middle);\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.top-tabsView_contents {\n\tborder-radius: var(--top-radius-4);\n\tbackground: var(--color-layout-front-1);\n\tpadding: var(--top-padding-4);\n\tflex-grow: 1;\n\toverflow: auto;\n\tposition: relative;\n}\n\n.top-tabsView_contents-isLoading {\n\tpointer-events: none;\n}\n\n.top-tabsView_contents-noScrollable {\n\twidth: calc(100% - var(--top-tabsView-menu-width));\n\tpadding: 0;\n\toverflow: visible;\n}\n\n/* top-tabsView-inPopup */\n.top-tabsView-inPopup {\n\tbackground: var(--color-layout-front-1);\n\tflex-direction: column;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents {\n\tborder-radius: 0;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents-noScrollable {\n\twidth: auto;\n}\n</style>\n","<script setup lang=\"ts\">\n\n</script>\n\n<template>\n\t<div class=\"top-tabsView_menuDelimeter\"></div>\n</template>\n\n<style>\n.top-tabsView_menuDelimeter {\n\tpadding: var(--top-padding-1) 0;\n\tdisplay: flex;\n}\n\n.top-tabsView_menuDelimeter:before {\n\tcontent: \"\";\n\theight: 2px;\n\tbackground: var(--color-line-2);\n\tflex-grow: 1;\n}\n\n.top-tabsView_menuDelimeter:first-child,\n.top-tabsView_menuDelimeter + .top-tabsView_menuDelimeter {\n\tdisplay: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useTabsStore } from './store';\nimport type { PropsMenuTitle } from './tabsView';\nimport TabsViewMenuDelimeter from './menuDelimeter.vue';\nimport { TopPopupListItem } from '../../popup/popup';\n\ndefineProps<PropsMenuTitle>();\n\nconst store = useTabsStore();\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\tv-if=\"store.showMenuInPopup\"\n\t\ttype=\"title\"\n\t>\n\t\t<slot></slot>\n\t</TopPopupListItem>\n\n\t<TabsViewMenuDelimeter v-else-if=\"store.isShort\"/>\n\n\t<div\n\t\tv-else\n\t\t:class=\"{\n\t\t\t'top-tabsView_menuTitle': true,\n\t\t\t'top-tabsView_menuTitle-subtitle': isSubtitle,\n\t\t}\"\n\t>\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<style>\n.top-tabsView_menuTitle {\n\tpadding: var(--top-padding-4) var(--top-padding-2) var(--top-padding-1);\n\tfont-weight: 600;\n\tcolor: var(--color-text-1);\n}\n\n.top-tabsView_menuTitle-subtitle {\n\tpadding-top: var(--top-padding-1);\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: var(--color-text-2);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport TabsView from './tabsView/tabsView.vue';\nimport TabsViewMenuItem from './tabsView/menuItem.vue';\nimport TabsViewMenuTitle from './tabsView/menuTitle.vue';\n\nexport const TopTabsView = TabsView as typeof TabsView & ComponentCustomProps;\nexport const TopTabsViewMenuItem = TabsViewMenuItem as typeof TabsViewMenuItem & ComponentCustomProps;\nexport const TopTabsViewMenuTitle = TabsViewMenuTitle as typeof TabsViewMenuTitle & ComponentCustomProps;\n"],"names":["genStorageKey","stateName","stateKey","StoreLocalStorage","store","localStorageValue","localStorageKey","popstateCallbacks","e","defineTabsStore","props","model","store$1","injectionKey","showMenuInPopup","vue","forms","isShort","component","scrollable","pageMod","popstateCallback","_e","useTabsStore","href","tagName","popup_popup","onClick","checkComponentIsLoading","preResolveComponent","condition","slots","menuItemByName","setMenuItemByNameFromItems","menuItems","subComponent","_sfc_main$4","_a","_b","_d","_c","activeMenuItem","numberChanged","countChanged","setMenuItemByName","activeItemName","isLoading","utils_route","elRef","resizeObserver","uid","componentRef","_hoisted_1","TopTabsView","_sfc_main$2","TopTabsViewMenuItem","TopTabsViewMenuTitle","_sfc_main"],"mappings":"uRAQA,MAAAA,EAAA,CAAAC,EAAAC,WACC,OAAAD,CAAA,SA2CDE,EAAA,CAAe,gBAjCf,CAAAF,EAAAG,IAAA,CAEC,GAAA,CAAAA,EAAA,IAAA,0BAIA,GAAA,CACC,MAAAC,EAAA,KAAA,MAAA,aAAA,QAAAC,CAAA,CAAA,0BAGCF,EAAAH,CAAA,EAAAI,SAGD,QAAA,KAAA,IAAA,MAAA,k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A4C,EAAAjC,EAAA,IAAA,EACA,IAAAkC,0BAGCA,EAAA,IAAA,eAAA,IAAA,CACCD,EAAA,MAAA,cAAA,MAAA,YAAA,qCAAAA,EAAA,MAAA,aAAA,IAAA,CAAiH,CAAA,EAGlHC,EAAA,QAAAD,EAAA,KAAA,CAAkC,CAAA,mCAIR,CAAA,6pDC5I3BE,EAAA,KAAA,OAAA,EAEAxC,EAAA,SAAAM,EAAA,KAAA,MAAA,0BAAA,IAAAkC,EAAA,wBAAA,qBAGCxC,EAAA,SAAAM,EAAA,KAAA,MAAA,0BAAA,OAAAkC,CAAA,EAEA9C,EAAA,KAAA2C,EAAA,QAAA3C,EAAA,IAAAA,EAAA,eAAA,EAAA,CAA4D,CAAA,EAG7D,MAAA+C,EAAApC,EAAA,IAAA,EACA+B,EAAA/B,EAAA,IAAA,EAAA,gEAG0D,EAAA,CAAA,UAAA,EAAA,CAAA,g1BC5BpDqC,EAAA,CAAA,MAAA,4BAAA,gMCGN,MAAAhD,EAAAmB,EAAA,ubCFO8B,EAAAC,EACAC,EAAAnB,EACAoB,EAAAC"}
@@ -1,6 +1,6 @@
1
1
  import { Core as U } from "../core/app.js";
2
2
  import { watch as k, computed as I, ref as f, defineComponent as M, createBlock as m, openBlock as l, resolveDynamicComponent as O, normalizeClass as w, unref as i, withCtx as b, renderSlot as v, createElementBlock as d, createCommentVNode as y, mergeModels as z, useModel as D, useSlots as G, onMounted as Q, onUnmounted as H, createElementVNode as S, toDisplayString as R, Fragment as X, createTextVNode as Y, markRaw as Z, createVNode as x, KeepAlive as ee } from "vue";
3
- import { C as $, v as te, t as oe } from "../.chunks/forms-zDpk9gMK.es.js";
3
+ import { C as $, v as te, t as oe } from "../.chunks/forms-gknXHfMr.es.js";
4
4
  import { getHash as K, genHash as ae, setHash as se, delHash as ne } from "../utils/route.js";
5
5
  import { u as ie, d as re } from "../.chunks/store-CX_6ZXhO.es.js";
6
6
  import { TopPopupListItem as A, TopPopup as le } from "../popup/popup.js";
@@ -1 +1 @@
1
- {"version":3,"file":"tabsView.js","sources":["../../src/core/utils/store/localStorage.ts","../../src/components/tabsView/tabsView/store.ts","../../src/components/tabsView/tabsView/menuItem.vue","../../src/components/tabsView/tabsView/utils.ts","../../src/components/tabsView/tabsView/menu.vue","../../src/components/tabsView/tabsView/tabsView.vue","../../src/components/tabsView/tabsView/menuDelimeter.vue","../../src/components/tabsView/tabsView/menuTitle.vue","../../src/components/tabsView/tabsView.ts"],"sourcesContent":["import { watch } from 'vue';\nimport type { Store } from './store';\n\n/**\n * Сгенерировать имя для сохранения данных в localStorage\n * @param stateName - имя свойства состояния\n * @param stateKey - ключ состояния, разные компоненты могут использовать одинаковый ключ\n */\nconst genStorageKey = <T extends Store>(stateName: keyof T, stateKey: string): string => {\n\tconst stateNameString = String(stateName);\n\n\treturn `top:${stateNameString}:${stateKey}`;\n};\n\n/**\n * Загрузить состояние\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst loadLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если Store.key не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\ttry {\n\t\tconst localStorageValue: typeof store[keyof typeof store] = JSON.parse(localStorage.getItem(localStorageKey) as string);\n\n\t\tif (typeof localStorageValue === typeof store[stateName]) {\n\t\t\tstore[stateName] = localStorageValue;\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(new Error(`В localStorage[${localStorageKey}] не корректный json`));\n\t}\n};\n\n/**\n * Добавить автосохранение состояние при его изменении\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst addSaverLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если store.$id не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\twatch(() => store[stateName], () => {\n\t\tlocalStorage.setItem(localStorageKey, JSON.stringify(store[stateName]));\n\t}, { immediate: true });\n};\n\nexport default {\n\tloadLocalStorge,\n\taddSaverLocalStorge,\n};","import type { InjectionKey, ModelRef } from 'vue';\nimport { computed, ref } from 'vue';\nimport Core from '@/core/core/core';\nimport { defineStore, useStore } from '@/core/utils/store';\nimport StoreLocalStorage from '@/core/utils/store/localStorage';\nimport type { Props, Store } from './tabsView';\nimport { getHash } from '@/core/utils/route';\n\nconst popstateCallbacks = new Set<(e: PopStateEvent) => void>();\n\naddEventListener('popstate', (e) => {\n\tpopstateCallbacks.forEach(popstateCallback => popstateCallback(e));\n});\n\nexport const injectionKey = Symbol() as InjectionKey<Store>;\n\n/**\n * Инициировать Store компонента\n */\nexport const defineTabsStore = (props: Props, model: ModelRef<string | undefined>) => {\n\tconst store = defineStore(injectionKey, () => {\n\t\tconst showMenuInPopup = computed(() => props.showMenuInPopup ?? Core.state.isMobile);\n\t\tconst pageMod = computed(() => props.pageMod);\n\t\tconst isShort = ref(false);\n\n\t\tconst component = ref(undefined);\n\t\tconst scrollable = ref(true);\n\n\t\treturn {\n\t\t\tshowMenuInPopup,\n\t\t\tpageMod,\n\t\t\tisShort,\n\t\t\tactiveItemName: model,\n\t\t\tcomponent,\n\t\t\tscrollable,\n\t\t};\n\t}, props.idState);\n\n\tif (props.isShortable) {\n\t\tconst stateName = 'isShort';\n\n\t\tStoreLocalStorage.loadLocalStorge(stateName, store);\n\t\tStoreLocalStorage.addSaverLocalStorge(stateName, store);\n\t}\n\n\tif (store.$id) {\n\t\tconst popstateCallback = (_e: PopStateEvent) => {\n\t\t\tmodel.value = getHash(store.$id!);\n\t\t};\n\n\t\tpopstateCallbacks.add(popstateCallback);\n\t}\n\n\treturn store;\n};\n\n/**\n * Получить Store компонента\n */\nexport const useTabsStore = () => useStore(injectionKey);\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { genHash } from '@/core/utils/route';\nimport { TopPopupListItem } from '@/components/popup/popup';\nimport { useTabsStore } from './store';\nimport type { PropsMenuItem } from './tabsView';\n\nconst props = withDefaults(defineProps<PropsMenuItem>(), {\n\tscrollable: true,\n\tcomponent: undefined,\n});\n\nconst store = useTabsStore();\n\nconst href = computed(() => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (props.name && store.$id) {\n\t\treturn genHash(store.$id, props.name);\n\t}\n\n\treturn props.href;\n});\n\nconst tagName = computed(() => {\n\tif (store.showMenuInPopup) {\n\t\treturn TopPopupListItem;\n\t}\n\n\treturn href ? 'a' : 'button';\n});\n\n/**\n * Клик по элементу меню\n */\nconst onClick = (e: MouseEvent) => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (!props.href && href.value) {\n\t\te.preventDefault();\n\t}\n\n\tif (props.name) {\n\t\tstore.activeItemName = props.name;\n\t}\n};\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\ttarget=\"_self\"\n\t\t:class=\"{\n\t\t\t['top-tabsView_menuItem']: !store.showMenuInPopup,\n\t\t\t['top-active']: name && store.activeItemName === name,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-spa-disabled']: true,\n\t\t}\"\n\t\t:href=\"href\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t@click=\"onClick\"\n\t>\n\t\t<slot name=\"default\" v-if=\"store.showMenuInPopup\"></slot>\n\n\t\t<span\n\t\t\tv-else-if=\"$slots.default && !store.isShort\"\n\t\t\tclass=\"top-ellipsis\"\n\t\t>\n\t\t\t<slot name=\"default\"></slot>\n\t\t</span>\n\t</component>\n</template>\n\n<style>\n.top-tabsView_menuItem {\n\t--top-icon-color: var(--color-text-2);\n\t--top-icon-width: calc(var(--top-icon-size));\n\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\n\tborder: none;\n\tborder-radius: var(--top-radius-2);\n\tpadding: var(--top-padding-2);\n\tbackground: transparent;\n\theight: 40px;\n\n\tcolor: var(--color-text-1);\n\ttext-decoration: none;\n\twhite-space: nowrap;\n\n\tdisplay: flex;\n\tgap: var(--top-gap-2);\n\talign-items: center;\n\tjustify-content: flex-start;\n\ttransition: background var(--transition);\n}\n\n.top-tabsView_menuItem:hover {\n\t--top-icon-color: var(--color-text-1);\n\n\tbackground: var(--color-bg-shading-1);\n\ttext-decoration: none;\n}\n\n.top-tabsView_menuItem.top-active {\n\t--top-icon-color: inherit;\n\n\tbackground: var(--color-layout-front-1);\n\tcolor: inherit;\n}\n\n.top-tabsView_menuItem:disabled:not(option):not(optgroup):not(.top-forms-option),\n.top-tabsView_menuItem:disabled ~ .top-formsCaption,\n.top-tabsView_menuItem.top-disabled[data-top-icon]:before,\n.top-tabsView_menuItem.top-disabled[data-top-icon2]:after {\n\topacity: unset;\n\tfilter: unset;\n}\n\n.top-tabsView_menuItem.top-disabled {\n\t--top-icon-color: var(--color-text-4);\n\n\tcolor: var(--color-text-4);\n}\n</style>\n","// TODO: Эту функцию можно вынести в глобальный utils\n\nimport { sleepWhile } from '@/core/utils/system';\n\n/**\n * Проверка нахождения компонента в состояние загрузки\n * @param component\n */\nexport const checkComponentIsLoading = (component: any) => {\n\treturn component?.name === 'AsyncComponentWrapper' && !component?.__asyncResolved;\n};\n\n/**\n * Презагрузить компонент\n *\n * Некоторое время ожидает загрузку компонента, прежде чем завершит работу\n */\nexport const preResolveComponent = async (component: any, condition: Function) => {\n\tif (component?.name !== 'AsyncComponentWrapper') return;\n\tif (component?.__asyncResolved) return;\n\n\tcomponent.__asyncLoader();\n\n\tawait sleepWhile(() => {\n\t\treturn condition() && checkComponentIsLoading(component);\n\t}, 200);\n};\n","<script setup lang=\"ts\">\nimport type { Ref, VNode } from 'vue';\nimport { markRaw, onMounted, onUnmounted, ref, useSlots, watch } from 'vue';\nimport { TopPopup } from '../../popup/popup';\nimport { getHash, setHash } from '@/core/utils/route';\n\nimport type { MenuItem, PropsMenu, PropsMenuItem } from './tabsView';\nimport { useTabsStore } from './store';\nimport TabsViewMenuItem from './menuItem.vue';\nimport { preResolveComponent } from './utils';\n\ndefineProps<PropsMenu>();\n\nconst isLoading = defineModel('isLoading');\n\nconst store = useTabsStore();\n\nconst slots = useSlots();\n\n// словарь используется для оптимизации получения нужного menuItem\nconst menuItemByName: Map<PropsMenuItem['name'], MenuItem> = new Map();\n\n// заполнить словарь с menuItem, по элементам в slot default\nconst setMenuItemByName = () => {\n\tif (!slots.default) return;\n\n\tconst component: any = slots.default({}).find(item => item.key === '_menu');\n\tif (!component) return;\n\n\tsetMenuItemByNameFromItems(component.children);\n};\n\n// заполнить словарь с menuItem, по элементам\nconst setMenuItemByNameFromItems = (menuItems: VNode[]) => {\n\tmenuItems.forEach((subComponent: any) => {\n\t\t// это не компонент элемента меню\n\t\tif (subComponent.type.__name && subComponent.type.__name !== TabsViewMenuItem.__name) return;\n\n\t\t// это не компонент, например template\n\t\tif (!subComponent.type.__name && typeof subComponent.children === 'object') {\n\t\t\tsetMenuItemByNameFromItems(subComponent.children);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (!subComponent.props?.name || subComponent.props?.disabled) return;\n\n\t\tconst menuItem: MenuItem = {\n\t\t\ttitle: (subComponent.children.default?.()[0].children as string).trim(),\n\t\t\ticon: subComponent.props.icon,\n\t\t\tcomponent: subComponent.props.component ? markRaw(subComponent.props.component) : TabsViewMenuItem.props.component.default,\n\t\t\tscrollable: subComponent.props.scrollable ?? TabsViewMenuItem.props.scrollable.default,\n\t\t};\n\n\t\tmenuItemByName.set(subComponent.props.name, menuItem);\n\t});\n};\n\n/**\n * activeMenuItem нужен:\n * - для вывода текста активной вкладки в меню с popup\n * - для вывода компонента активной вкладки (store.component)\n * - для установки store.scrollable\n */\nconst activeMenuItem: Ref<MenuItem | null> = ref(null);\n\n/**\n * Кол-во изменений активной вкладки\n */\nlet countChanged = 0;\n\n/**\n * Смена активной вкладки\n *\n * TODO: смена slot, например смена языка, требует повторного выполнения setMenuItemByName()\n */\nwatch(\n\t() => store.activeItemName,\n\tasync () => {\n\t\tconst numberChanged = ++countChanged; // порядковый номер текущего изменения\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tsetMenuItemByName();\n\t\t}\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tstore.activeItemName = '';\n\n\t\t\treturn;\n\t\t}\n\n\t\tactiveMenuItem.value = menuItemByName.get(store.activeItemName) ?? null;\n\n\t\t// элемент не найден, установить из хеша страницы\n\t\tif (!activeMenuItem.value && store.$id) {\n\t\t\tconst activeItemName = getHash(store.$id);\n\n\t\t\tactiveMenuItem.value = menuItemByName.get(activeItemName) ?? null;\n\n\t\t\tif (activeMenuItem.value) {\n\t\t\t\tstore.activeItemName = activeItemName;\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// элемент не найден, установить первый доступный\n\t\tif (!activeMenuItem.value) {\n\t\t\tstore.activeItemName = menuItemByName.keys().next().value!;\n\n\t\t\treturn;\n\t\t}\n\n\t\t// запрошена смена на уже активный элемент\n\t\tif (activeMenuItem.value.component === store.component) {\n\t\t\tisLoading.value = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (store.$id) setHash(store.$id, store.activeItemName, false);\n\n\t\t// флаг загрузки будет сброшен при инициализации компонента\n\t\tisLoading.value = true;\n\n\t\t/**\n\t\t * Презагрузить компонент\n\t\t *\n\t\t * Нужно для того, чтобы минимизировать скачки интерфейса при ожидании загрузки асинхронного компонента\n\t\t */\n\t\tawait preResolveComponent(activeMenuItem.value.component, () => numberChanged === countChanged);\n\n\t\t// влкадка была сменена еще раз во время sleepWhile\n\t\tif (numberChanged !== countChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore.scrollable = activeMenuItem.value.scrollable;\n\t\tstore.component = activeMenuItem.value.component;\n\n\t\tif (activeMenuItem.value && !store.component) {\n\t\t\tconsole.warn(`Компонент вкладки ${store.activeItemName} не найден. Добавьте props.component для пункта меню ${store.activeItemName}.`);\n\t\t}\n\t},\n\t{ immediate: true },\n);\n\nconst elRef = ref();\nlet resizeObserver: ResizeObserver;\n\nonMounted(() => {\n\tresizeObserver = new ResizeObserver(() => {\n\t\telRef.value.parentElement.style.setProperty('--top-tabsView-contents-offset-top', elRef.value.offsetHeight + 'px');\n\t});\n\n\tresizeObserver.observe(elRef.value);\n});\n\nonUnmounted(() => {\n\tresizeObserver.disconnect();\n});\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t'top-tabsView_menu': true,\n\t\t\t'top-tabsView_menu-inPopup_0': !store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-inPopup_1': store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-short': store.isShort && !store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<!-- Спрятать меню под кнопку в popup -->\n\t\t<TopPopup v-if=\"store.showMenuInPopup\">\n\t\t\t<template #opener>\n\t\t\t\t<div class=\"top-tabsView_menuOpener\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"activeMenuItem\"\n\t\t\t\t\t\tclass=\"top-tabsView_menuOpenerActiveItem\"\n\t\t\t\t\t\t:data-top-icon=\"activeMenuItem.icon\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span class=\"top-ellipsis\">\n\t\t\t\t\t\t\t{{ activeMenuItem.title }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"top-tabsView_menuOpenerIcon\" data-top-icon=\"\"></div>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<slot></slot>\n\t\t\t</template>\n\t\t</TopPopup>\n\n\t\t<!-- Отобразить меню на странице -->\n\t\t<template v-else>\n\t\t\t<div class=\"top-tabsView_menuList\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tv-if=\"isShortable\"\n\t\t\t\tclass=\"top-tabsView_menuFooter\"\n\t\t\t>\n\t\t\t\t<TabsViewMenuItem\n\t\t\t\t\tv-if=\"isShortable\"\n\t\t\t\t\t:icon=\"store.isShort ? '' : ''\"\n\t\t\t\t\t@click=\"store.isShort = !store.isShort\"\n\t\t\t\t>\n\t\t\t\t\t{{ store.isShort ? '' : 'Свернуть' }} <!--TODO: translate-->\n\t\t\t\t</TabsViewMenuItem>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<style>\n/* режим отображение табов в основной области документа */\n.top-tabsView-pageMod .top-tabsView_menu {\n\tbox-sizing: border-box;\n\tposition: sticky;\n\ttop: var(--top-tabsView-top);\n\tz-index: 10;\n}\n\n/* режим отображение табов в основной области документа без popup */\n.top-tabsView-pageMod .top-tabsView_menu-inPopup_0 {\n\theight: calc(var(--100vh) - var(--top-tabsView-top));\n}\n\n/* стантартный режим */\n.top-tabsView_menu-inPopup_0 {\n\tbox-sizing: border-box;\n\twidth: var(--top-tabsView-menu-width);\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tflex-shrink: 0;\n}\n\n/* режим вывода в popup */\n.top-tabsView_menu-inPopup_1 {\n\tborder-bottom: 1px solid var(--color-line-2-opacity);\n}\n\n.top-tabsView_menu-short {\n\twidth: auto;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener:hover {\n\tbackground: var(--color-layer-1);\n}\n\n.top-tabsView_menuOpenerIcon { display: flex; }\n\n.top-tabsView_menuOpenerActiveItem {\n\t--top-forms-padding: 0px;\n\n\tbox-sizing: border-box;\n\tpadding: var(--top-padding-2);\n\tmax-width: calc(100% - var(--top-forms-base-height));\n\twhite-space: nowrap;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--top-padding-2);\n}\n\n.top-tabsView_menuList,\n.top-tabsView_menuFooter {\n\tpadding: var(--top-padding-2);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--top-gap-2);\n}\n\n.top-tabsView_menuList {\n\toverflow-y: auto;\n}\n\n.top-tabsView_menu-short .top-tabsView_menuFooter > .top-tabsView_menuItem {\n\t--top-icon-width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { defineModel, onUnmounted, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { delHash } from '@/core/utils/route';\nimport type { Props } from './tabsView';\nimport { defineTabsStore } from './store';\nimport TabsViewMenu from './menu.vue';\nimport TopLoadbar from '@/components/forms/loadbar/loadbar.vue';\nimport { checkComponentIsLoading } from './utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowMenuInPopup: undefined,\n\tisShortable: false,\n});\n\nconst model = defineModel<string>();\n\nconst store = defineTabsStore(props, model);\n\nconst uid = Math.random();\n\nif (props.pageMod) Core.state.documentClassModificators.set(uid, 'top-hasTabsViewPageMod');\n\nonUnmounted(() => {\n\tif (props.pageMod) Core.state.documentClassModificators.delete(uid);\n\n\tif (store.$id) delHash(store.$id, store.activeItemName, true);\n});\n\nconst componentRef = ref();\nconst isLoading = ref(false);\n\nwatch([componentRef, () => store.component], () => {\n\tisLoading.value = checkComponentIsLoading(store.component);\n}, { immediate: true });\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-tabsView': true,\n\t\t\t'top-tabsView-pageMod': props.pageMod,\n\t\t\t'top-tabsView-inPopup': store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<TabsViewMenu\n\t\t\t:isShortable=\"isShortable\"\n\t\t\tv-model:isLoading=\"isLoading\"\n\t\t>\n\t\t\t<!-- @slot Меню, ожидает передачу компонентов TabsViewMenuItem и TabsViewMenuTitle -->\n\t\t\t<slot name=\"menu\"></slot>\n\t\t</TabsViewMenu>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-tabsView_contents': true,\n\t\t\t\t'top-tabsView_contents-isLoading': isLoading,\n\t\t\t\t'top-tabsView_contents-noScrollable': !store.scrollable,\n\t\t\t}\"\n\t\t>\n\t\t\t<TopLoadbar v-if=\"isLoading\"/>\n\n\t\t\t<keep-alive>\n\t\t\t\t<component\n\t\t\t\t\tref=\"componentRef\"\n\t\t\t\t\t:is=\"store.component\"\n\t\t\t\t/>\n\t\t\t</keep-alive>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n:root {\n\t--top-tabsView-top: 0px;\n\t--top-tabsView-menu-width: 220px;\n\t--top-tabsView-contents-offset-top: 0px;\n}\n\n.top-tabsView {\n\tbackground: var(--color-layout-middle);\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.top-tabsView_contents {\n\tborder-radius: var(--top-radius-4);\n\tbackground: var(--color-layout-front-1);\n\tpadding: var(--top-padding-4);\n\tflex-grow: 1;\n\toverflow: auto;\n\tposition: relative;\n}\n\n.top-tabsView_contents-isLoading {\n\tpointer-events: none;\n}\n\n.top-tabsView_contents-noScrollable {\n\twidth: calc(100% - var(--top-tabsView-menu-width));\n\tpadding: 0;\n\toverflow: visible;\n}\n\n/* top-tabsView-inPopup */\n.top-tabsView-inPopup {\n\tbackground: var(--color-layout-front-1);\n\tflex-direction: column;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents {\n\tborder-radius: 0;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents-noScrollable {\n\twidth: auto;\n}\n</style>\n","<script setup lang=\"ts\">\n\n</script>\n\n<template>\n\t<div class=\"top-tabsView_menuDelimeter\"></div>\n</template>\n\n<style>\n.top-tabsView_menuDelimeter {\n\tpadding: var(--top-padding-1) 0;\n\tdisplay: flex;\n}\n\n.top-tabsView_menuDelimeter:before {\n\tcontent: \"\";\n\theight: 2px;\n\tbackground: var(--color-line-2);\n\tflex-grow: 1;\n}\n\n.top-tabsView_menuDelimeter:first-child,\n.top-tabsView_menuDelimeter + .top-tabsView_menuDelimeter {\n\tdisplay: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useTabsStore } from './store';\nimport type { PropsMenuTitle } from './tabsView';\nimport TabsViewMenuDelimeter from './menuDelimeter.vue';\nimport { TopPopupListItem } from '../../popup/popup';\n\ndefineProps<PropsMenuTitle>();\n\nconst store = useTabsStore();\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\tv-if=\"store.showMenuInPopup\"\n\t\ttype=\"title\"\n\t>\n\t\t<slot></slot>\n\t</TopPopupListItem>\n\n\t<TabsViewMenuDelimeter v-else-if=\"store.isShort\"/>\n\n\t<div\n\t\tv-else\n\t\t:class=\"{\n\t\t\t'top-tabsView_menuTitle': true,\n\t\t\t'top-tabsView_menuTitle-subtitle': isSubtitle,\n\t\t}\"\n\t>\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<style>\n.top-tabsView_menuTitle {\n\tpadding: var(--top-padding-4) var(--top-padding-2) var(--top-padding-1);\n\tfont-weight: 600;\n\tcolor: var(--color-text-1);\n}\n\n.top-tabsView_menuTitle-subtitle {\n\tpadding-top: var(--top-padding-1);\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: var(--color-text-2);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport TabsView from './tabsView/tabsView.vue';\nimport TabsViewMenuItem from './tabsView/menuItem.vue';\nimport TabsViewMenuTitle from './tabsView/menuTitle.vue';\n\nexport const TopTabsView = TabsView as typeof TabsView & ComponentCustomProps;\nexport const TopTabsViewMenuItem = TabsViewMenuItem as typeof TabsViewMenuItem & ComponentCustomProps;\nexport const TopTabsViewMenuTitle = TabsViewMenuTitle as typeof TabsViewMenuTitle & ComponentCustomProps;\n"],"names":["genStorageKey","stateName","stateKey","loadLocalStorge","store","localStorageKey","localStorageValue","addSaverLocalStorge","watch","StoreLocalStorage","popstateCallbacks","e","popstateCallback","injectionKey","defineTabsStore","props","model","defineStore","showMenuInPopup","computed","Core","pageMod","isShort","ref","component","scrollable","_e","getHash","useTabsStore","useStore","__props","href","genHash","tagName","TopPopupListItem","onClick","checkComponentIsLoading","preResolveComponent","condition","sleepWhile","isLoading","useModel","slots","useSlots","menuItemByName","setMenuItemByName","item","setMenuItemByNameFromItems","menuItems","subComponent","_sfc_main$4","_a","_b","menuItem","_d","_c","markRaw","activeMenuItem","countChanged","numberChanged","activeItemName","setHash","elRef","resizeObserver","onMounted","onUnmounted","uid","delHash","componentRef","_sfc_render","_ctx","_cache","TopTabsView","_sfc_main$2","TopTabsViewMenuItem","TopTabsViewMenuTitle","_sfc_main"],"mappings":";;;;;;;;;AAQA,MAAAA,IAAA,CAAAC,GAAAC,MAGC,OAFA,OAAAD,CAAA,CAEA,IAAAC,CAAA,IAQDC,KAAA,CAAAF,GAAAG,MAAA;AAEC,MAAA,CAAAA,EAAA,IAAA;AAEA,QAAAC,IAAAL,EAAAC,GAAAG,EAAA,GAAA;AAEA,MAAA;AACC,UAAAE,IAAA,KAAA,MAAA,aAAA,QAAAD,CAAA,CAAA;AAEA,IAAA,OAAAC,KAAA,OAAAF,EAAAH,CAAA,MACCG,EAAAH,CAAA,IAAAK;AAAA,EACD,QAAA;AAEA,YAAA,KAAA,IAAA,MAAA,kBAAAD,CAAA,sBAAA,CAAA;AAAA,EAA+E;AAEjF,GAOAE,KAAA,CAAAN,GAAAG,MAAA;AAEC,MAAA,CAAAA,EAAA,IAAA;AAEA,QAAAC,IAAAL,EAAAC,GAAAG,EAAA,GAAA;AAEA,EAAAI,EAAA,MAAAJ,EAAAH,CAAA,GAAA,MAAA;AACC,iBAAA,QAAAI,GAAA,KAAA,UAAAD,EAAAH,CAAA,CAAA,CAAA;AAAA,EAAsE,GAAA,EAAA,WAAA,GAAA,CAAA;AAExE,GAEAQ,IAAA;AAAA,EAAe,iBAAAN;AAAA,EACd,qBAAAI;AAED,GC/CAG,IAAA,oBAAA,IAAA;AAEA,iBAAA,YAAA,CAAAC,MAAA;AACC,EAAAD,EAAA,QAAA,CAAAE,MAAAA,EAAAD,CAAA,CAAA;AACD,CAAA;AAEO,MAAAE,IAAA,OAAA,GAKMC,KAAA,CAAAC,GAAAC,MAAA;AACZ,QAAAZ,IAAAa,GAAAJ,GAAA,MAAA;AACC,UAAAK,IAAAC,EAAA,MAAAJ,EAAA,mBAAAK,EAAA,MAAA,Q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AAA;AAAA,IAAkC,CAAA,GAGnCG,EAAA,MAAA;AACC,MAAAF,EAAA,WAAA;AAAA,IAA0B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrJ3B,UAAAhD,IAAAe,GAKAd,IAAAyB,EAAAX,GAAA,YAAA,GAEA1B,IAAAU,GAAAC,GAAAC,CAAA,GAEAkD,IAAA,KAAA,OAAA;AAEA,IAAAnD,EAAA,WAAAK,EAAA,MAAA,0BAAA,IAAA8C,GAAA,wBAAA,GAEAD,EAAA,MAAA;AACC,MAAAlD,EAAA,WAAAK,EAAA,MAAA,0BAAA,OAAA8C,CAAA,GAEA9D,EAAA,OAAA+D,GAAA/D,EAAA,KAAAA,EAAA,gBAAA,EAAA;AAAA,IAA4D,CAAA;AAG7D,UAAAgE,IAAA7C,EAAA,GACAiB,IAAAjB,EAAA,EAAA;AAEA,WAAAf,EAAA,CAAA4D,GAAA,MAAAhE,EAAA,SAAA,GAAA,MAAA;AACC,MAAAoC,EAAA,QAAAJ,EAAAhC,EAAA,SAAA;AAAA,IAAyD,GAAA,EAAA,WAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5BzD,SAAAiE,GAAAC,GAAAC,GAAA;;;;;;;;;ACGD,UAAAnE,IAAAwB,EAAA;;;;;;;;;;;;;;;;;;;ICFO4C,KAAAC,IACAC,KAAAxB,GACAyB,KAAAC;"}
1
+ {"version":3,"file":"tabsView.js","sources":["../../src/core/utils/store/localStorage.ts","../../src/components/tabsView/tabsView/store.ts","../../src/components/tabsView/tabsView/menuItem.vue","../../src/components/tabsView/tabsView/utils.ts","../../src/components/tabsView/tabsView/menu.vue","../../src/components/tabsView/tabsView/tabsView.vue","../../src/components/tabsView/tabsView/menuDelimeter.vue","../../src/components/tabsView/tabsView/menuTitle.vue","../../src/components/tabsView/tabsView.ts"],"sourcesContent":["import { watch } from 'vue';\nimport type { Store } from './store';\n\n/**\n * Сгенерировать имя для сохранения данных в localStorage\n * @param stateName - имя свойства состояния\n * @param stateKey - ключ состояния, разные компоненты могут использовать одинаковый ключ\n */\nconst genStorageKey = <T extends Store>(stateName: keyof T, stateKey: string): string => {\n\tconst stateNameString = String(stateName);\n\n\treturn `top:${stateNameString}:${stateKey}`;\n};\n\n/**\n * Загрузить состояние\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst loadLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если Store.key не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\ttry {\n\t\tconst localStorageValue: typeof store[keyof typeof store] = JSON.parse(localStorage.getItem(localStorageKey) as string);\n\n\t\tif (typeof localStorageValue === typeof store[stateName]) {\n\t\t\tstore[stateName] = localStorageValue;\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(new Error(`В localStorage[${localStorageKey}] не корректный json`));\n\t}\n};\n\n/**\n * Добавить автосохранение состояние при его изменении\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst addSaverLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если store.$id не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\twatch(() => store[stateName], () => {\n\t\tlocalStorage.setItem(localStorageKey, JSON.stringify(store[stateName]));\n\t}, { immediate: true });\n};\n\nexport default {\n\tloadLocalStorge,\n\taddSaverLocalStorge,\n};","import type { InjectionKey, ModelRef } from 'vue';\nimport { computed, ref } from 'vue';\nimport Core from '@/core/core/core';\nimport { defineStore, useStore } from '@/core/utils/store';\nimport StoreLocalStorage from '@/core/utils/store/localStorage';\nimport type { Props, Store } from './tabsView';\nimport { getHash } from '@/core/utils/route';\n\nconst popstateCallbacks = new Set<(e: PopStateEvent) => void>();\n\naddEventListener('popstate', (e) => {\n\tpopstateCallbacks.forEach(popstateCallback => popstateCallback(e));\n});\n\nexport const injectionKey = Symbol() as InjectionKey<Store>;\n\n/**\n * Инициировать Store компонента\n */\nexport const defineTabsStore = (props: Props, model: ModelRef<string | undefined>) => {\n\tconst store = defineStore(injectionKey, () => {\n\t\tconst showMenuInPopup = computed(() => props.showMenuInPopup ?? Core.state.isMobile);\n\t\tconst pageMod = computed(() => props.pageMod);\n\t\tconst isShort = ref(false);\n\n\t\tconst component = ref(undefined);\n\t\tconst scrollable = ref(true);\n\n\t\treturn {\n\t\t\tshowMenuInPopup,\n\t\t\tpageMod,\n\t\t\tisShort,\n\t\t\tactiveItemName: model,\n\t\t\tcomponent,\n\t\t\tscrollable,\n\t\t};\n\t}, props.idState);\n\n\tif (props.isShortable) {\n\t\tconst stateName = 'isShort';\n\n\t\tStoreLocalStorage.loadLocalStorge(stateName, store);\n\t\tStoreLocalStorage.addSaverLocalStorge(stateName, store);\n\t}\n\n\tif (store.$id) {\n\t\tconst popstateCallback = (_e: PopStateEvent) => {\n\t\t\tmodel.value = getHash(store.$id!);\n\t\t};\n\n\t\tpopstateCallbacks.add(popstateCallback);\n\t}\n\n\treturn store;\n};\n\n/**\n * Получить Store компонента\n */\nexport const useTabsStore = () => useStore(injectionKey);\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { genHash } from '@/core/utils/route';\nimport { TopPopupListItem } from '@/components/popup/popup';\nimport { useTabsStore } from './store';\nimport type { PropsMenuItem } from './tabsView';\n\nconst props = withDefaults(defineProps<PropsMenuItem>(), {\n\tscrollable: true,\n\tcomponent: undefined,\n});\n\nconst store = useTabsStore();\n\nconst href = computed(() => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (props.name && store.$id) {\n\t\treturn genHash(store.$id, props.name);\n\t}\n\n\treturn props.href;\n});\n\nconst tagName = computed(() => {\n\tif (store.showMenuInPopup) {\n\t\treturn TopPopupListItem;\n\t}\n\n\treturn href ? 'a' : 'button';\n});\n\n/**\n * Клик по элементу меню\n */\nconst onClick = (e: MouseEvent) => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (!props.href && href.value) {\n\t\te.preventDefault();\n\t}\n\n\tif (props.name) {\n\t\tstore.activeItemName = props.name;\n\t}\n};\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\ttarget=\"_self\"\n\t\t:class=\"{\n\t\t\t['top-tabsView_menuItem']: !store.showMenuInPopup,\n\t\t\t['top-active']: name && store.activeItemName === name,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-spa-disabled']: true,\n\t\t}\"\n\t\t:href=\"href\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t@click=\"onClick\"\n\t>\n\t\t<slot name=\"default\" v-if=\"store.showMenuInPopup\"></slot>\n\n\t\t<span\n\t\t\tv-else-if=\"$slots.default && !store.isShort\"\n\t\t\tclass=\"top-ellipsis\"\n\t\t>\n\t\t\t<slot name=\"default\"></slot>\n\t\t</span>\n\t</component>\n</template>\n\n<style>\n.top-tabsView_menuItem {\n\t--top-icon-color: var(--color-text-2);\n\t--top-icon-width: calc(var(--top-icon-size));\n\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\n\tborder: none;\n\tborder-radius: var(--top-radius-2);\n\tpadding: var(--top-padding-2);\n\tbackground: transparent;\n\theight: 40px;\n\n\tcolor: var(--color-text-1);\n\ttext-decoration: none;\n\twhite-space: nowrap;\n\n\tdisplay: flex;\n\tgap: var(--top-gap-2);\n\talign-items: center;\n\tjustify-content: flex-start;\n\ttransition: background var(--transition);\n}\n\n.top-tabsView_menuItem:hover {\n\t--top-icon-color: var(--color-text-1);\n\n\tbackground: var(--color-bg-shading-1);\n\ttext-decoration: none;\n}\n\n.top-tabsView_menuItem.top-active {\n\t--top-icon-color: inherit;\n\n\tbackground: var(--color-layout-front-1);\n\tcolor: inherit;\n}\n\n.top-tabsView_menuItem:disabled:not(option):not(optgroup):not(.top-forms-option),\n.top-tabsView_menuItem:disabled ~ .top-formsCaption,\n.top-tabsView_menuItem.top-disabled[data-top-icon]:before,\n.top-tabsView_menuItem.top-disabled[data-top-icon2]:after {\n\topacity: unset;\n\tfilter: unset;\n}\n\n.top-tabsView_menuItem.top-disabled {\n\t--top-icon-color: var(--color-text-4);\n\n\tcolor: var(--color-text-4);\n}\n</style>\n","// TODO: Эту функцию можно вынести в глобальный utils\n\nimport { sleepWhile } from '@/core/utils/system';\n\n/**\n * Проверка нахождения компонента в состояние загрузки\n * @param component\n */\nexport const checkComponentIsLoading = (component: any) => {\n\treturn component?.name === 'AsyncComponentWrapper' && !component?.__asyncResolved;\n};\n\n/**\n * Презагрузить компонент\n *\n * Некоторое время ожидает загрузку компонента, прежде чем завершит работу\n */\nexport const preResolveComponent = async (component: any, condition: Function) => {\n\tif (component?.name !== 'AsyncComponentWrapper') return;\n\tif (component?.__asyncResolved) return;\n\n\tcomponent.__asyncLoader();\n\n\tawait sleepWhile(() => {\n\t\treturn condition() && checkComponentIsLoading(component);\n\t}, 200);\n};\n","<script setup lang=\"ts\">\nimport type { Ref, VNode } from 'vue';\nimport { markRaw, onMounted, onUnmounted, ref, useSlots, watch } from 'vue';\nimport { TopPopup } from '../../popup/popup';\nimport { getHash, setHash } from '@/core/utils/route';\n\nimport type { MenuItem, PropsMenu, PropsMenuItem } from './tabsView';\nimport { useTabsStore } from './store';\nimport TabsViewMenuItem from './menuItem.vue';\nimport { preResolveComponent } from './utils';\n\ndefineProps<PropsMenu>();\n\nconst isLoading = defineModel('isLoading');\n\nconst store = useTabsStore();\n\nconst slots = useSlots();\n\n// словарь используется для оптимизации получения нужного menuItem\nconst menuItemByName: Map<PropsMenuItem['name'], MenuItem> = new Map();\n\n// заполнить словарь с menuItem, по элементам в slot default\nconst setMenuItemByName = () => {\n\tif (!slots.default) return;\n\n\tconst component: any = slots.default({}).find(item => item.key === '_menu');\n\tif (!component) return;\n\n\tsetMenuItemByNameFromItems(component.children);\n};\n\n// заполнить словарь с menuItem, по элементам\nconst setMenuItemByNameFromItems = (menuItems: VNode[]) => {\n\tmenuItems.forEach((subComponent: any) => {\n\t\t// это не компонент элемента меню\n\t\tif (subComponent.type.__name && subComponent.type.__name !== TabsViewMenuItem.__name) return;\n\n\t\t// это не компонент, например template\n\t\tif (!subComponent.type.__name && typeof subComponent.children === 'object') {\n\t\t\tsetMenuItemByNameFromItems(subComponent.children);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (!subComponent.props?.name || subComponent.props?.disabled) return;\n\n\t\tconst menuItem: MenuItem = {\n\t\t\ttitle: (subComponent.children.default?.()[0].children as string).trim(),\n\t\t\ticon: subComponent.props.icon,\n\t\t\tcomponent: subComponent.props.component ? markRaw(subComponent.props.component) : TabsViewMenuItem.props.component.default,\n\t\t\tscrollable: subComponent.props.scrollable ?? TabsViewMenuItem.props.scrollable.default,\n\t\t};\n\n\t\tmenuItemByName.set(subComponent.props.name, menuItem);\n\t});\n};\n\n/**\n * activeMenuItem нужен:\n * - для вывода текста активной вкладки в меню с popup\n * - для вывода компонента активной вкладки (store.component)\n * - для установки store.scrollable\n */\nconst activeMenuItem: Ref<MenuItem | null> = ref(null);\n\n/**\n * Кол-во изменений активной вкладки\n */\nlet countChanged = 0;\n\n/**\n * Смена активной вкладки\n *\n * TODO: смена slot, например смена языка, требует повторного выполнения setMenuItemByName()\n */\nwatch(\n\t() => store.activeItemName,\n\tasync () => {\n\t\tconst numberChanged = ++countChanged; // порядковый номер текущего изменения\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tsetMenuItemByName();\n\t\t}\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tstore.activeItemName = '';\n\n\t\t\treturn;\n\t\t}\n\n\t\tactiveMenuItem.value = menuItemByName.get(store.activeItemName) ?? null;\n\n\t\t// элемент не найден, установить из хеша страницы\n\t\tif (!activeMenuItem.value && store.$id) {\n\t\t\tconst activeItemName = getHash(store.$id);\n\n\t\t\tactiveMenuItem.value = menuItemByName.get(activeItemName) ?? null;\n\n\t\t\tif (activeMenuItem.value) {\n\t\t\t\tstore.activeItemName = activeItemName;\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// элемент не найден, установить первый доступный\n\t\tif (!activeMenuItem.value) {\n\t\t\tstore.activeItemName = menuItemByName.keys().next().value!;\n\n\t\t\treturn;\n\t\t}\n\n\t\t// запрошена смена на уже активный элемент\n\t\tif (activeMenuItem.value.component === store.component) {\n\t\t\tisLoading.value = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (store.$id) setHash(store.$id, store.activeItemName, false);\n\n\t\t// флаг загрузки будет сброшен при инициализации компонента\n\t\tisLoading.value = true;\n\n\t\t/**\n\t\t * Презагрузить компонент\n\t\t *\n\t\t * Нужно для того, чтобы минимизировать скачки интерфейса при ожидании загрузки асинхронного компонента\n\t\t */\n\t\tawait preResolveComponent(activeMenuItem.value.component, () => numberChanged === countChanged);\n\n\t\t// влкадка была сменена еще раз во время sleepWhile\n\t\tif (numberChanged !== countChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore.scrollable = activeMenuItem.value.scrollable;\n\t\tstore.component = activeMenuItem.value.component;\n\n\t\tif (activeMenuItem.value && !store.component) {\n\t\t\tconsole.warn(`Компонент вкладки ${store.activeItemName} не найден. Добавьте props.component для пункта меню ${store.activeItemName}.`);\n\t\t}\n\t},\n\t{ immediate: true },\n);\n\nconst elRef = ref();\nlet resizeObserver: ResizeObserver;\n\nonMounted(() => {\n\tresizeObserver = new ResizeObserver(() => {\n\t\telRef.value.parentElement.style.setProperty('--top-tabsView-contents-offset-top', elRef.value.offsetHeight + 'px');\n\t});\n\n\tresizeObserver.observe(elRef.value);\n});\n\nonUnmounted(() => {\n\tresizeObserver.disconnect();\n});\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t'top-tabsView_menu': true,\n\t\t\t'top-tabsView_menu-inPopup_0': !store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-inPopup_1': store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-short': store.isShort && !store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<!-- Спрятать меню под кнопку в popup -->\n\t\t<TopPopup v-if=\"store.showMenuInPopup\">\n\t\t\t<template #opener>\n\t\t\t\t<div class=\"top-tabsView_menuOpener\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"activeMenuItem\"\n\t\t\t\t\t\tclass=\"top-tabsView_menuOpenerActiveItem\"\n\t\t\t\t\t\t:data-top-icon=\"activeMenuItem.icon\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span class=\"top-ellipsis\">\n\t\t\t\t\t\t\t{{ activeMenuItem.title }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"top-tabsView_menuOpenerIcon\" data-top-icon=\"\"></div>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<slot></slot>\n\t\t\t</template>\n\t\t</TopPopup>\n\n\t\t<!-- Отобразить меню на странице -->\n\t\t<template v-else>\n\t\t\t<div class=\"top-tabsView_menuList\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tv-if=\"isShortable\"\n\t\t\t\tclass=\"top-tabsView_menuFooter\"\n\t\t\t>\n\t\t\t\t<TabsViewMenuItem\n\t\t\t\t\tv-if=\"isShortable\"\n\t\t\t\t\t:icon=\"store.isShort ? '' : ''\"\n\t\t\t\t\t@click=\"store.isShort = !store.isShort\"\n\t\t\t\t>\n\t\t\t\t\t{{ store.isShort ? '' : 'Свернуть' }} <!--TODO: translate-->\n\t\t\t\t</TabsViewMenuItem>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<style>\n/* режим отображение табов в основной области документа */\n.top-tabsView-pageMod .top-tabsView_menu {\n\tbox-sizing: border-box;\n\tposition: sticky;\n\ttop: var(--top-tabsView-top);\n\tz-index: 10;\n}\n\n/* режим отображение табов в основной области документа без popup */\n.top-tabsView-pageMod .top-tabsView_menu-inPopup_0 {\n\theight: calc(var(--100vh) - var(--top-tabsView-top));\n}\n\n/* стантартный режим */\n.top-tabsView_menu-inPopup_0 {\n\tbox-sizing: border-box;\n\twidth: var(--top-tabsView-menu-width);\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tflex-shrink: 0;\n}\n\n/* режим вывода в popup */\n.top-tabsView_menu-inPopup_1 {\n\tborder-bottom: 1px solid var(--color-line-2-opacity);\n}\n\n.top-tabsView_menu-short {\n\twidth: auto;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener:hover {\n\tbackground: var(--color-layer-1);\n}\n\n.top-tabsView_menuOpenerIcon { display: flex; }\n\n.top-tabsView_menuOpenerActiveItem {\n\t--top-forms-padding: 0px;\n\n\tbox-sizing: border-box;\n\tpadding: var(--top-padding-2);\n\tmax-width: calc(100% - var(--top-forms-base-height));\n\twhite-space: nowrap;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--top-padding-2);\n}\n\n.top-tabsView_menuList,\n.top-tabsView_menuFooter {\n\tpadding: var(--top-padding-2);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--top-gap-2);\n}\n\n.top-tabsView_menuList {\n\toverflow-y: auto;\n}\n\n.top-tabsView_menu-short .top-tabsView_menuFooter > .top-tabsView_menuItem {\n\t--top-icon-width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { defineModel, onUnmounted, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { delHash } from '@/core/utils/route';\nimport type { Props } from './tabsView';\nimport { defineTabsStore } from './store';\nimport TabsViewMenu from './menu.vue';\nimport TopLoadbar from '@/components/forms/loadbar/loadbar.vue';\nimport { checkComponentIsLoading } from './utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowMenuInPopup: undefined,\n\tisShortable: false,\n});\n\nconst model = defineModel<string>();\n\nconst store = defineTabsStore(props, model);\n\nconst uid = Math.random();\n\nif (props.pageMod) Core.state.documentClassModificators.set(uid, 'top-hasTabsViewPageMod');\n\nonUnmounted(() => {\n\tif (props.pageMod) Core.state.documentClassModificators.delete(uid);\n\n\tif (store.$id) delHash(store.$id, store.activeItemName, true);\n});\n\nconst componentRef = ref();\nconst isLoading = ref(false);\n\nwatch([componentRef, () => store.component], () => {\n\tisLoading.value = checkComponentIsLoading(store.component);\n}, { immediate: true });\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-tabsView': true,\n\t\t\t'top-tabsView-pageMod': props.pageMod,\n\t\t\t'top-tabsView-inPopup': store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<TabsViewMenu\n\t\t\t:isShortable=\"isShortable\"\n\t\t\tv-model:isLoading=\"isLoading\"\n\t\t>\n\t\t\t<!-- @slot Меню, ожидает передачу компонентов TabsViewMenuItem и TabsViewMenuTitle -->\n\t\t\t<slot name=\"menu\"></slot>\n\t\t</TabsViewMenu>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-tabsView_contents': true,\n\t\t\t\t'top-tabsView_contents-isLoading': isLoading,\n\t\t\t\t'top-tabsView_contents-noScrollable': !store.scrollable,\n\t\t\t}\"\n\t\t>\n\t\t\t<TopLoadbar v-if=\"isLoading\"/>\n\n\t\t\t<keep-alive>\n\t\t\t\t<component\n\t\t\t\t\tref=\"componentRef\"\n\t\t\t\t\t:is=\"store.component\"\n\t\t\t\t/>\n\t\t\t</keep-alive>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n:root {\n\t--top-tabsView-top: 0px;\n\t--top-tabsView-menu-width: 220px;\n\t--top-tabsView-contents-offset-top: 0px;\n}\n\n.top-tabsView {\n\tbackground: var(--color-layout-middle);\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.top-tabsView_contents {\n\tborder-radius: var(--top-radius-4);\n\tbackground: var(--color-layout-front-1);\n\tpadding: var(--top-padding-4);\n\tflex-grow: 1;\n\toverflow: auto;\n\tposition: relative;\n}\n\n.top-tabsView_contents-isLoading {\n\tpointer-events: none;\n}\n\n.top-tabsView_contents-noScrollable {\n\twidth: calc(100% - var(--top-tabsView-menu-width));\n\tpadding: 0;\n\toverflow: visible;\n}\n\n/* top-tabsView-inPopup */\n.top-tabsView-inPopup {\n\tbackground: var(--color-layout-front-1);\n\tflex-direction: column;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents {\n\tborder-radius: 0;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents-noScrollable {\n\twidth: auto;\n}\n</style>\n","<script setup lang=\"ts\">\n\n</script>\n\n<template>\n\t<div class=\"top-tabsView_menuDelimeter\"></div>\n</template>\n\n<style>\n.top-tabsView_menuDelimeter {\n\tpadding: var(--top-padding-1) 0;\n\tdisplay: flex;\n}\n\n.top-tabsView_menuDelimeter:before {\n\tcontent: \"\";\n\theight: 2px;\n\tbackground: var(--color-line-2);\n\tflex-grow: 1;\n}\n\n.top-tabsView_menuDelimeter:first-child,\n.top-tabsView_menuDelimeter + .top-tabsView_menuDelimeter {\n\tdisplay: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useTabsStore } from './store';\nimport type { PropsMenuTitle } from './tabsView';\nimport TabsViewMenuDelimeter from './menuDelimeter.vue';\nimport { TopPopupListItem } from '../../popup/popup';\n\ndefineProps<PropsMenuTitle>();\n\nconst store = useTabsStore();\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\tv-if=\"store.showMenuInPopup\"\n\t\ttype=\"title\"\n\t>\n\t\t<slot></slot>\n\t</TopPopupListItem>\n\n\t<TabsViewMenuDelimeter v-else-if=\"store.isShort\"/>\n\n\t<div\n\t\tv-else\n\t\t:class=\"{\n\t\t\t'top-tabsView_menuTitle': true,\n\t\t\t'top-tabsView_menuTitle-subtitle': isSubtitle,\n\t\t}\"\n\t>\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<style>\n.top-tabsView_menuTitle {\n\tpadding: var(--top-padding-4) var(--top-padding-2) var(--top-padding-1);\n\tfont-weight: 600;\n\tcolor: var(--color-text-1);\n}\n\n.top-tabsView_menuTitle-subtitle {\n\tpadding-top: var(--top-padding-1);\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: var(--color-text-2);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport TabsView from './tabsView/tabsView.vue';\nimport TabsViewMenuItem from './tabsView/menuItem.vue';\nimport TabsViewMenuTitle from './tabsView/menuTitle.vue';\n\nexport const TopTabsView = TabsView as typeof TabsView & ComponentCustomProps;\nexport const TopTabsViewMenuItem = TabsViewMenuItem as typeof TabsViewMenuItem & ComponentCustomProps;\nexport const TopTabsViewMenuTitle = TabsViewMenuTitle as typeof TabsViewMenuTitle & ComponentCustomProps;\n"],"names":["genStorageKey","stateName","stateKey","loadLocalStorge","store","localStorageKey","localStorageValue","addSaverLocalStorge","watch","StoreLocalStorage","popstateCallbacks","e","popstateCallback","injectionKey","defineTabsStore","props","model","defineStore","showMenuInPopup","computed","Core","pageMod","isShort","ref","component","scrollable","_e","getHash","useTabsStore","useStore","__props","href","genHash","tagName","TopPopupListItem","onClick","checkComponentIsLoading","preResolveComponent","condition","sleepWhile","isLoading","useModel","slots","useSlots","menuItemByName","setMenuItemByName","item","setMenuItemByNameFromItems","menuItems","subComponent","_sfc_main$4","_a","_b","menuItem","_d","_c","markRaw","activeMenuItem","countChanged","numberChanged","activeItemName","setHash","elRef","resizeObserver","onMounted","onUnmounted","uid","delHash","componentRef","_hoisted_1","openBlock","createElementBlock","TopTabsView","_sfc_main$2","TopTabsViewMenuItem","TopTabsViewMenuTitle","_sfc_main"],"mappings":";;;;;;;;;AAQA,MAAAA,IAAA,CAAAC,GAAAC,MAGC,OAFA,OAAAD,CAAA,CAEA,IAAAC,CAAA,IAQDC,KAAA,CAAAF,GAAAG,MAAA;AAEC,MAAA,CAAAA,EAAA,IA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MAAA,0BAAA,IAAA8C,GAAA,wBAAA,GAEAD,EAAA,MAAA;AACC,MAAAlD,EAAA,WAAAK,EAAA,MAAA,0BAAA,OAAA8C,CAAA,GAEA9D,EAAA,OAAA+D,GAAA/D,EAAA,KAAAA,EAAA,gBAAA,EAAA;AAAA,IAA4D,CAAA;AAG7D,UAAAgE,IAAA7C,EAAA,GACAiB,IAAAjB,EAAA,EAAA;AAEA,WAAAf,EAAA,CAAA4D,GAAA,MAAAhE,EAAA,SAAA,GAAA,MAAA;AACC,MAAAoC,EAAA,QAAAJ,EAAAhC,EAAA,SAAA;AAAA,IAAyD,GAAA,EAAA,WAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aC5BpDiE,KAAA,EAAA,OAAA,6BAAA;;AAAL,SAAAC,EAAA,GAAAC,EAAA,OAAAF,EAAA;;;;;;;;ACGD,UAAAjE,IAAAwB,EAAA;;;;;;;;;;;;;;;;;;;ICFO4C,KAAAC,IACAC,KAAAxB,GACAyB,KAAAC;"}
@@ -1,4 +1,4 @@
1
- define(["require","exports","../.chunks/forms-CKYHAaPQ.amd"],function(l,t,e){"use strict";if(typeof r>"u")var r=window.Vue;async function a(o,n=!1){let i=!1;return navigator.clipboard&&(await navigator.clipboard.writeText(o),i=!0,n&&e.Core.notice(e.useI18n().Common.Copied_to_clipboard+"","info")),i}async function u(o){let n=!1;e.isSafari()||(n=await a(o));const i='<a href="'+o+'" target="_blank">'+o+"</a>",c=e.useI18n().Common.Copied_to_clipboard+`:
1
+ define(["require","exports","../.chunks/forms-DvEX_A0C.amd"],function(l,t,e){"use strict";if(typeof r>"u")var r=window.Vue;async function a(o,n=!1){let i=!1;return navigator.clipboard&&(await navigator.clipboard.writeText(o),i=!0,n&&e.Core.notice(e.useI18n().Common.Copied_to_clipboard+"","info")),i}async function u(o){let n=!1;e.isSafari()||(n=await a(o));const i='<a href="'+o+'" target="_blank">'+o+"</a>",c=e.useI18n().Common.Copied_to_clipboard+`:
2
2
  `+i;if(n)e.Core.notice(c,"info");else{if(!navigator.clipboard){e.Core.notice(e.useI18n().Common.Cannot_copied_to_clipboard+`:
3
3
  `+e.useI18n().Common.Copy_guest_link_manually+`
4
4
  `+i,"error");return}const d={onclick:()=>a(o).then(()=>e.Core.notice(c,"info")),default:e.useI18n().Common.Copy+"",class:"copy"};await e.Core.notice(e.useI18n().Common.Guest_link_created+`
@@ -1,4 +1,4 @@
1
- import { C as t, u as a, b as s } from "../.chunks/forms-zDpk9gMK.es.js";
1
+ import { C as t, u as a, b as s } from "../.chunks/forms-gknXHfMr.es.js";
2
2
  async function r(o, e = !1) {
3
3
  let i = !1;
4
4
  return navigator.clipboard && (await navigator.clipboard.writeText(o), i = !0, e && t.notice(a().Common.Copied_to_clipboard + "", "info")), i;
package/utils/date.amd.js CHANGED
@@ -1,2 +1,2 @@
1
- define(["require","exports","../.chunks/forms-CKYHAaPQ.amd"],function(n,e,t){"use strict";if(typeof a>"u")var a=window.Vue;e.dateFormat=t.dateFormat,e.dateToString=t.dateToString,e.dateUnformat=t.dateUnformat,e.genDate=t.genDate,e.genDateMoscow=t.genDateMoscow,e.getDayOfWeek=t.getDayOfWeek,e.stringToDate=t.stringToDate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ define(["require","exports","../.chunks/forms-DvEX_A0C.amd"],function(n,e,t){"use strict";if(typeof a>"u")var a=window.Vue;e.dateFormat=t.dateFormat,e.dateToString=t.dateToString,e.dateUnformat=t.dateUnformat,e.genDate=t.genDate,e.genDateMoscow=t.genDateMoscow,e.getDayOfWeek=t.getDayOfWeek,e.stringToDate=t.stringToDate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=date.amd.js.map
package/utils/date.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as t, Q as s, V as o, S as r, U as g, P as n, R as D } from "../.chunks/forms-zDpk9gMK.es.js";
1
+ import { c as t, Q as s, V as o, S as r, U as g, P as n, R as D } from "../.chunks/forms-gknXHfMr.es.js";
2
2
  export {
3
3
  t as dateFormat,
4
4
  s as dateToString,
@@ -1,2 +1,2 @@
1
- define(["require","exports","../.chunks/forms-CKYHAaPQ.amd"],function(a,e,i){"use strict";if(typeof l>"u")var l=window.Vue;e.get$scroll=i.get$scroll,e.getCommandKeyLabel=i.getCommandKeyLabel,e.getElsScroll=i.getElsScroll,e.getOS=i.getOS,e.getOSAsync=i.getOSAsync,e.getScrollTop=i.getScrollTop,e.isApp=i.isApp,e.isMacOS=i.isMacOS,e.isMobile=i.isMobile,e.isRetina=i.isRetina,e.isSafari=i.isSafari,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ define(["require","exports","../.chunks/forms-DvEX_A0C.amd"],function(a,e,i){"use strict";if(typeof l>"u")var l=window.Vue;e.get$scroll=i.get$scroll,e.getCommandKeyLabel=i.getCommandKeyLabel,e.getElsScroll=i.getElsScroll,e.getOS=i.getOS,e.getOSAsync=i.getOSAsync,e.getScrollTop=i.getScrollTop,e.isApp=i.isApp,e.isMacOS=i.isMacOS,e.isMobile=i.isMobile,e.isRetina=i.isRetina,e.isSafari=i.isSafari,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=device.amd.js.map
package/utils/device.js CHANGED
@@ -1,4 +1,4 @@
1
- import { H as e, F as l, I as i, J as o, K as t, G as g, B as r, D as S, A as c, z as p, b } from "../.chunks/forms-zDpk9gMK.es.js";
1
+ import { H as e, F as l, I as i, J as o, K as t, G as g, B as r, D as S, A as c, z as p, b } from "../.chunks/forms-gknXHfMr.es.js";
2
2
  export {
3
3
  e as get$scroll,
4
4
  l as getCommandKeyLabel,
@@ -1,2 +1,2 @@
1
- define(["require","exports","../.chunks/forms-CKYHAaPQ.amd"],function(u,e,n){"use strict";if(typeof i>"u")var i=window.Vue;e.cloneDeep=n.cloneDeep,e.debounce=n.debounce,e.memoize=n.memoize,e.merge=n.merge,e.throttle=n.throttle,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ define(["require","exports","../.chunks/forms-DvEX_A0C.amd"],function(u,e,n){"use strict";if(typeof i>"u")var i=window.Vue;e.cloneDeep=n.cloneDeep,e.debounce=n.debounce,e.memoize=n.memoize,e.merge=n.merge,e.throttle=n.throttle,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=lodash.amd.js.map
package/utils/lodash.js CHANGED
@@ -1,4 +1,4 @@
1
- import { L as a, d as s, M as m, O as r, N as t } from "../.chunks/forms-zDpk9gMK.es.js";
1
+ import { L as a, d as s, M as m, O as r, N as t } from "../.chunks/forms-gknXHfMr.es.js";
2
2
  export {
3
3
  a as cloneDeep,
4
4
  s as debounce,