HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/matomo.vdk/plugins/SegmentEditor/vue/dist/SegmentEditor.umd.min.js
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["SegmentEditor"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["SegmentEditor"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="plugins/SegmentEditor/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},a5a2:function(e,t){e.exports=n},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"SegmentGeneratorStore",(function(){return d})),n.d(t,"SegmentGenerator",(function(){return U})),"undefined"!==typeof window){var o=window.document.currentScript,i=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var a=n("8bbf"),r=n("19dc");
/*!
 * Matomo - free/libre analytics platform
 *
 * @link    https://matomo.org
 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/*!
 * Matomo - free/libre analytics platform
 *
 * @link    https://matomo.org
 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */class l{constructor(){s(this,"privateState",Object(a["reactive"])({isLoading:!1,segments:[]})),s(this,"state",Object(a["computed"])(()=>Object(a["readonly"])(this.privateState))),s(this,"loadSegmentsAbort",void 0),s(this,"loadSegmentsPromise",void 0),s(this,"fetchedSiteId",void 0)}loadSegments(e,t){if(this.loadSegmentsAbort&&(this.loadSegmentsAbort.abort(),this.loadSegmentsAbort=void 0),this.privateState.isLoading=!0,this.fetchedSiteId!==e&&(this.loadSegmentsAbort=void 0,this.fetchedSiteId=e),!this.loadSegmentsPromise){let t=void 0,n=void 0;"all"!==e&&e?e&&(t=e,n=e):(t="all",n="all"),this.loadSegmentsAbort=new AbortController,this.loadSegmentsPromise=r["AjaxHelper"].fetch({method:"API.getSegmentsMetadata",filter_limit:"-1",_hideImplementationData:0,idSites:t,idSite:n})}return this.loadSegmentsPromise.then(e=>(this.privateState.isLoading=!1,e&&(this.privateState.segments=t?e.filter(e=>e.sqlSegment&&e.sqlSegment.match(/log_visit\./)):e),this.state.value.segments)).finally(()=>{this.privateState.isLoading=!1,delete this.loadSegmentsPromise})}}var d=new l;const c={class:"segment-generator",ref:"root"},u={class:"segment-rows"},m={class:"segment-row"},p=["onClick"],g={class:"segment-loading"},h={class:"segment-row-inputs valign-wrapper"},v={class:"segment-input metricListBlock valign-wrapper"},O={style:{width:"100%"}},f={class:"segment-input metricMatchBlock valign-wrapper"},b={style:{display:"inline-block"}},j={class:"segment-input metricValueBlock valign-wrapper"},S={class:"form-group row",style:{width:"100%"}},C={class:"input-field col s12"},y=Object(a["createElementVNode"])("span",{role:"status","aria-live":"polite",class:"ui-helper-hidden-accessible"},null,-1),V=Object(a["createElementVNode"])("div",{class:"clear"},null,-1),k={class:"segment-or"},N=["onClick"],E=["innerHTML"],w={class:"segment-and"},A=["innerHTML"];function L(e,t,n,o,i,r){const s=Object(a["resolveComponent"])("ActivityIndicator"),l=Object(a["resolveComponent"])("MatomoLoader"),d=Object(a["resolveComponent"])("Field"),L=Object(a["resolveComponent"])("ValueInput");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",c,[Object(a["createVNode"])(s,{loading:e.isLoading},null,8,["loading"]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.conditions,(t,n)=>(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])("segmentRow"+n),key:n},[Object(a["createElementVNode"])("div",u,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(t.orConditions,(n,o)=>{var i,r;return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])("orCondId"+n.id),key:o},[Object(a["createElementVNode"])("div",m,[Object(a["createElementVNode"])("a",{class:"segment-close",onClick:o=>e.removeOrCondition(t,n)},null,8,p),Object(a["createElementVNode"])("div",g,[Object(a["withDirectives"])(Object(a["createVNode"])(l,null,null,512),[[a["vShow"],e.conditionValuesLoading[n.id]]])]),Object(a["createElementVNode"])("div",h,[Object(a["createElementVNode"])("div",v,[Object(a["createElementVNode"])("div",O,[Object(a["createVNode"])(d,{uicontrol:"expandable-select",name:"segments","model-value":n.segment,"onUpdate:modelValue":t=>e.onSegmentSelection(t,n),title:null===(i=e.segments[n.segment])||void 0===i?void 0:i.name,"full-width":!0,options:e.segmentList},null,8,["model-value","onUpdate:modelValue","title","options"])])]),Object(a["createElementVNode"])("div",f,[Object(a["createElementVNode"])("div",b,[Object(a["createVNode"])(d,{uicontrol:"select",name:"matchType","model-value":n.matches,"onUpdate:modelValue":t=>{n.matches=t,e.computeSegmentDefinition()},"full-width":!0,options:e.matches[null===(r=e.segments[n.segment])||void 0===r?void 0:r.type]},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(a["createElementVNode"])("div",j,[Object(a["createElementVNode"])("div",S,[Object(a["createElementVNode"])("div",C,[y,Object(a["createVNode"])(L,{value:n.value,onUpdate:e=>{n.value=e,this.computeSegmentDefinition()}},null,8,["value","onUpdate"])])])]),V])]),Object(a["createElementVNode"])("div",k,Object(a["toDisplayString"])(e.translate("SegmentEditor_OperatorOR")),1)],2)}),128)),Object(a["createElementVNode"])("div",{class:"segment-add-or",onClick:n=>e.addNewOrCondition(t)},[Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("a",{innerHTML:e.$sanitize(e.addNewOrConditionLinkText)},null,8,E)])],8,N)]),Object(a["createElementVNode"])("div",w,Object(a["toDisplayString"])(e.translate("SegmentEditor_OperatorAND")),1)],2))),128)),Object(a["createElementVNode"])("div",{class:"segment-add-row initial",onClick:t[0]||(t[0]=t=>e.addNewAndCondition())},[Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("a",{innerHTML:e.$sanitize(e.addNewAndConditionLinkText)},null,8,A)])])],512)}var I=n("a5a2");const _=["placeholder","title","value"];function x(e,t,n,o,i,r){return Object(a["openBlock"])(),Object(a["createElementBlock"])("input",{placeholder:e.translate("General_Value"),type:"text",class:"autocomplete",title:e.translate("General_Value"),autocomplete:"off",value:e.value,onKeydown:t[0]||(t[0]=t=>e.onKeydownOrConditionValue(t)),onChange:t[1]||(t[1]=t=>e.onKeydownOrConditionValue(t))},null,40,_)}var B=Object(a["defineComponent"])({props:{value:null},created(){this.onKeydownOrConditionValue=Object(r["debounce"])(this.onKeydownOrConditionValue,50)},emits:["update"],methods:{onKeydownOrConditionValue(e){this.$emit("update",e.target.value)}}});B.render=x;var D=B;function M(){return{metric:[{key:"==",value:Object(r["translate"])("General_OperationEquals")},{key:"!=",value:Object(r["translate"])("General_OperationNotEquals")},{key:"<=",value:Object(r["translate"])("General_OperationAtMost")},{key:">=",value:Object(r["translate"])("General_OperationAtLeast")},{key:"<",value:Object(r["translate"])("General_OperationLessThan")},{key:">",value:Object(r["translate"])("General_OperationGreaterThan")}],dimension:[{key:"==",value:Object(r["translate"])("General_OperationIs")},{key:"!=",value:Object(r["translate"])("General_OperationIsNot")},{key:"=@",value:Object(r["translate"])("General_OperationContains")},{key:"!@",value:Object(r["translate"])("General_OperationDoesNotContain")},{key:"=^",value:Object(r["translate"])("General_OperationStartsWith")},{key:"=$",value:Object(r["translate"])("General_OperationEndsWith")}]}}function P(){let e="";const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(let n=1;n<=10;n+=1)e+=t.charAt(Math.floor(Math.random()*t.length));return e}function $(e){const t=["==","!=","<=",">=","=@","!@","<",">","=^","=$"],n={};let o,i,a=e.length,r=!1;for(let l=0;l<t.length;l+=1)o=t[l],i=e.indexOf(o),-1!==i&&i<a&&(a=i,1===o.length&&(r=!0));a<e.length&&(!0===r?(n.segment=e.slice(0,a),n.matches=e.slice(a,a+1),n.value=decodeURIComponent(e.slice(a+1))):(n.segment=e.slice(0,a),n.matches=e.slice(a,a+2),n.value=decodeURIComponent(e.slice(a+2))),'""'===n.value&&(n.value=""));try{n.value=decodeURIComponent(n.value)}catch(s){}return n}function G(e){return e?(""+e).replace(/(<([^>]+)>)/gi,""):e}const{$:q}=window;var T=Object(a["defineComponent"])({props:{addInitialCondition:Boolean,visitSegmentsOnly:Boolean,idsite:{type:[String,Number],default:()=>r["Matomo"].idSite},modelValue:{type:String,default:""}},components:{ActivityIndicator:r["ActivityIndicator"],Field:I["Field"],MatomoLoader:r["MatomoLoader"],ValueInput:D},data(){return{conditions:[],queriedSegments:[],matches:M(),conditionValuesLoading:{},segmentDefinition:""}},emits:["update:modelValue"],watch:{modelValue(e){(e||"")!==(this.segmentDefinition||"")&&this.setSegmentString(e)},conditions:{deep:!0,handler(){this.computeSegmentDefinition()}},segmentDefinition(e){(e||"")!==(this.modelValue||"")&&this.$emit("update:modelValue",e)},idsite(e){this.reloadSegments(e,this.visitSegmentsOnly)}},created(){this.matches[""]=this.matches.dimension,this.setSegmentString(this.modelValue),this.segmentDefinition=this.modelValue,this.reloadSegments(this.idsite,this.visitSegmentsOnly)},methods:{reloadSegments(e,t){d.loadSegments(e,t).then(e=>{this.queriedSegments=e.map(e=>Object.assign(Object.assign({},e),{},{category:e.category||"Others"})),this.addInitialCondition&&0===this.conditions.length&&this.addNewAndCondition()})},addAndCondition(e){this.conditions.push(e)},addNewOrCondition(e){if(!this.firstSegment)return;const t={segment:this.firstSegment,matches:this.firstMatch,value:""};this.addOrCondition(e,t)},addOrCondition(e,t){this.conditionValuesLoading[t.id]=!1,t.id=P(),e.orConditions.push(t),Object(a["nextTick"])(()=>{this.updateAutocomplete(t)})},onSegmentSelection(e,t){t.segment=e,this.updateAutocomplete(t),this.computeSegmentDefinition(),this.focusValueInput(t)},updateAutocomplete(e){this.conditionValuesLoading[e.id]=!0,q(`.orCondId${e.id} .metricValueBlock input`,this.$refs.root).autocomplete({source:[],minLength:0});const t=new AbortController;let n=!1;r["AjaxHelper"].fetch({module:"API",format:"json",method:"API.getSuggestedValuesForSegment",segmentName:e.segment,idSite:this.idsite},{createErrorNotification:!1}).then(t=>{this.conditionValuesLoading[e.id]=!1,n=!0;let o=t;Array.isArray(o)&&(o=o.map(e=>""+e));const i=q(`.orCondId${e.id} .metricValueBlock input`).autocomplete({source:o,minLength:0,select:(t,n)=>{t.preventDefault(),e.value=n.item.value,this.computeSegmentDefinition(),this.$forceUpdate()}}).off("click").click(()=>{q(i).autocomplete("search",e.value)})}).catch(()=>{n=!0,this.conditionValuesLoading[e.id]=!1,q(`.orCondId${e.id} .metricValueBlock input`).autocomplete({source:[],minLength:0}).autocomplete("search",e.value)}),setTimeout(()=>{n||t.abort()},2e4)},removeOrCondition(e,t){const n=e.orConditions.indexOf(t);if(n>-1&&e.orConditions.splice(n,1),0===e.orConditions.length){const t=this.conditions.indexOf(e);n>-1&&this.conditions.splice(t,1)}},setSegmentString(e){if(this.conditions=[],!e)return;const t=e.split(";").map(e=>e.split(","));this.conditions=t.map(e=>{const t={orConditions:[]};return e.forEach(e=>{const n=$(e);this.addOrCondition(t,n)}),t})},addNewAndCondition(){const e={orConditions:[]};this.firstSegment&&(this.addAndCondition(e),this.addNewOrCondition(e))},computeSegmentDefinition(){let e="";this.conditions.forEach(t=>{if(!t.orConditions.length)return;let n="";t.orConditions.forEach(e=>{if(!e.value&&!e.segment&&!e.matches)return;""!==n&&(n+=",");const t=encodeURIComponent(encodeURIComponent(e.value));n+=`${e.segment}${e.matches}${t}`}),""!==e&&(e+=";"),e+=n}),this.segmentDefinition=e},focusValueInput(e){const t=q(`.orCondId${e.id} .metricValueBlock input`);t.focus(),t.val()&&t.select()}},computed:{firstSegment(){var e;return(null===(e=this.queriedSegments[0])||void 0===e?void 0:e.segment)||null},firstMatch(){const e=this.queriedSegments[0];return e?e.type&&this.matches[e.type]?this.matches[e.type][0].key:this.matches[""][0].key:null},segments(){const e={};return this.queriedSegments.forEach(t=>{e[t.segment]=t}),e},segmentList(){return this.queriedSegments.map(e=>({group:e.category,key:e.segment,value:e.name,tooltip:e.acceptedValues?G(e.acceptedValues):void 0}))},addNewOrConditionLinkText(){return"+ "+Object(r["translate"])("SegmentEditor_AddANDorORCondition",`<span>${Object(r["translate"])("SegmentEditor_OperatorOR")}</span>`)},andConditionLabel(){return this.conditions.length?Object(r["translate"])("SegmentEditor_OperatorAND"):""},addNewAndConditionLinkText(){return"+ "+Object(r["translate"])("SegmentEditor_AddANDorORCondition",`<span>${this.andConditionLabel}</span>`)},isLoading(){return d.state.value.isLoading}}});T.render=L;var U=T;
/*!
 * Matomo - free/libre analytics platform
 *
 * @link    https://matomo.org
 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */}})}));
//# sourceMappingURL=SegmentEditor.umd.min.js.map